local-operator-ui 0.25.19 → 0.26.0
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/renderer/assets/{_basePickBy-5CoGdeKI.js → _basePickBy-Bpah_DB5.js} +1 -1
- package/out/renderer/assets/{_baseUniq-CXR3bGLu.js → _baseUniq-BjTYkdoM.js} +1 -1
- package/out/renderer/assets/{agent-details-page-Bjt69TC3.js → agent-details-page-DUnaZtSD.js} +1 -1
- package/out/renderer/assets/{agent-hub-page-BJiTX5nz.js → agent-hub-page-D2jMJi71.js} +1 -1
- package/out/renderer/assets/{agents-page-0rMcAByt.js → agents-page-BzmZF2wA.js} +2 -2
- package/out/renderer/assets/{arc-CMNkyDKA.js → arc-PgrQf5G9.js} +1 -1
- package/out/renderer/assets/{architectureDiagram-IEHRJDOE-B7g44Vlf.js → architectureDiagram-IEHRJDOE-DYQewNZN.js} +1 -1
- package/out/renderer/assets/{blockDiagram-JOT3LUYC-Bc4GOnQ5.js → blockDiagram-JOT3LUYC-DfZ_XFPJ.js} +1 -1
- package/out/renderer/assets/browser-page-CsDt8lIc.js +1 -0
- package/out/renderer/assets/{c4Diagram-VJAJSXHY-BjtgyGC1.js → c4Diagram-VJAJSXHY-DDHzlwDi.js} +1 -1
- package/out/renderer/assets/channel-BbfnWIUI.js +1 -0
- package/out/renderer/assets/{chunk-4BMEZGHF-DPnejOYP.js → chunk-4BMEZGHF-BQl3nYL1.js} +1 -1
- package/out/renderer/assets/{chunk-A2AXSNBT-BDEtVwaL.js → chunk-A2AXSNBT-Bggc0r9P.js} +1 -1
- package/out/renderer/assets/{chunk-AEK57VVT-CmzdR892.js → chunk-AEK57VVT-y_KlRITR.js} +1 -1
- package/out/renderer/assets/{chunk-D6G4REZN-C2zmgcrD.js → chunk-D6G4REZN-Dktfzx4I.js} +1 -1
- package/out/renderer/assets/{chunk-RZ5BOZE2-BJJ-OTAf.js → chunk-RZ5BOZE2-CNXYA_Ud.js} +1 -1
- package/out/renderer/assets/{chunk-XZIHB7SX-DwyjIxJs.js → chunk-XZIHB7SX-CU1hhxyc.js} +1 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-BaDHx5v3.js +1 -0
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-BaDHx5v3.js +1 -0
- package/out/renderer/assets/clone-Bx12E3nh.js +1 -0
- package/out/renderer/assets/{compact-pagination-BhjXL_Vy.js → compact-pagination-vqH3UMnL.js} +1 -1
- package/out/renderer/assets/{dagre-OKDRZEBW-D915Oq0h.js → dagre-OKDRZEBW-Cq9mNXrX.js} +1 -1
- package/out/renderer/assets/{diagram-SSKATNLV-CCMHSOFl.js → diagram-SSKATNLV-Dr4fitdd.js} +1 -1
- package/out/renderer/assets/{diagram-VNBRO52H-DQFZ47jz.js → diagram-VNBRO52H-C0kaVZy-.js} +1 -1
- package/out/renderer/assets/{erDiagram-Q7BY3M3F-DOb42yOL.js → erDiagram-Q7BY3M3F-DvKxgX1J.js} +1 -1
- package/out/renderer/assets/{flowDiagram-4HSFHLVR-C9xATOcb.js → flowDiagram-4HSFHLVR-u8R-9WXa.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-APWFNJXF-BKGrN3nG.js → ganttDiagram-APWFNJXF-Vb4fxadf.js} +1 -1
- package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-DR0Z91nS.js → gitGraphDiagram-7IBYFJ6S-DqWUw8Th.js} +1 -1
- package/out/renderer/assets/{graph-BZhzpHSl.js → graph-D3CyNCVS.js} +1 -1
- package/out/renderer/assets/icon-B8Li1YYS.css +1 -0
- package/out/renderer/assets/icon-Bny6j4NZ.js +200 -0
- package/out/renderer/assets/{index-C-4XRZ68.js → index-Bcz37Dsr.js} +6 -6
- package/out/renderer/assets/{index-0fhFwnUv.js → index-C4wE5-hf.js} +1 -1
- package/out/renderer/assets/{index-CTTuGe3U.js → index-DOGq7e-U.js} +1 -1
- package/out/renderer/assets/{infoDiagram-PH2N3AL5-BSvIpVNN.js → infoDiagram-PH2N3AL5-Cyzau35q.js} +1 -1
- package/out/renderer/assets/{installer-CmDlZ6ZC.js → installer-DDldqUI5.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-U35MCT3I-bGhEBTWY.js → journeyDiagram-U35MCT3I-oZgA4kiL.js} +1 -1
- package/out/renderer/assets/{kanban-definition-NDS4AKOZ-1GZIm9bo.js → kanban-definition-NDS4AKOZ-DQV7n-AW.js} +1 -1
- package/out/renderer/assets/{layout-BxSJya1i.js → layout-Dh8fv9xe.js} +1 -1
- package/out/renderer/assets/{legacy-agents-page-MjvhEvs0.js → legacy-agents-page-DptSmKpl.js} +1 -1
- package/out/renderer/assets/{mermaid.core-C8WrVHA6.js → mermaid.core-Du-3Cewj.js} +5 -5
- package/out/renderer/assets/{mindmap-definition-ALO5MXBD-BrVNBwrz.js → mindmap-definition-ALO5MXBD-DDPHJEC1.js} +1 -1
- package/out/renderer/assets/{page-header-BxSu579T.js → page-header-un3csrkZ.js} +1 -1
- package/out/renderer/assets/{parseISO-Chhis1zA.js → parseISO-D7nsYBq4.js} +1 -1
- package/out/renderer/assets/{pieDiagram-IB7DONF6-DoaEBzyY.js → pieDiagram-IB7DONF6-D7lXUGWg.js} +1 -1
- package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-Rt0jQZuL.js → quadrantDiagram-7GDLP6J5-BBAynwl9.js} +1 -1
- package/out/renderer/assets/{radar-MK3ICKWK-DB3WvJx3.js → radar-MK3ICKWK-C59pXUfZ.js} +1 -1
- package/out/renderer/assets/{radient-auth-buttons-BgiaQdhl.js → radient-auth-buttons-C5U9BVCs.js} +1 -1
- package/out/renderer/assets/{requirementDiagram-KVF5MWMF-CZKO92D0.js → requirementDiagram-KVF5MWMF-BP02izkG.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-BRxDE8ze.js → sankeyDiagram-QLVOVGJD-BGMCA7OJ.js} +1 -1
- package/out/renderer/assets/{schedules-page-BzdwC9M-.js → schedules-page-BSMjSJUt.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-Mg9abwLq.js → sequenceDiagram-X6HHIX6F-CjFv2kmo.js} +1 -1
- package/out/renderer/assets/settings-page-BN1gnOIT.js +312 -0
- package/out/renderer/assets/{stateDiagram-DGXRK772-DzYf0hgn.js → stateDiagram-DGXRK772-Cd-iahlq.js} +1 -1
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-eF4wpUTl.js +1 -0
- package/out/renderer/assets/{timeline-definition-BDJGKUSR-SX-srvDY.js → timeline-definition-BDJGKUSR-ENYTiDkb.js} +1 -1
- package/out/renderer/assets/{use-agent-like-mutation-ZhXVgsm3.js → use-agent-like-mutation-CxNAsw0f.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-VJFVF3MP-CmjoPhao.js → xychartDiagram-VJFVF3MP-DUL0l1bZ.js} +1 -1
- package/out/renderer/index.html +3 -3
- package/out/renderer/installer.html +3 -3
- package/package.json +2 -2
- package/out/renderer/assets/browser-page-_cYqTYuS.js +0 -1
- package/out/renderer/assets/channel-DGjSSyl5.js +0 -1
- package/out/renderer/assets/classDiagram-GIVACNV2-ClRq6A8Z.js +0 -1
- package/out/renderer/assets/classDiagram-v2-COTLJTTW-ClRq6A8Z.js +0 -1
- package/out/renderer/assets/clone-DFaAQ-x7.js +0 -1
- package/out/renderer/assets/icon-CeaDeErk.js +0 -200
- package/out/renderer/assets/icon-FFSyDN4z.css +0 -1
- package/out/renderer/assets/settings-page-BJeFjWrB.js +0 -92
- package/out/renderer/assets/stateDiagram-v2-YXO3MK2T-Ccz78IHI.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./mermaid.core-
|
|
2
|
-
import{r as b,j as p,n as H,a2 as Lq,a as qe,a5 as u_e,B as we,c as A,ac as up,ad as jP,ae as LP,af as uZe,ag as I1,ah as dZe,ai as LR,aj as qP,h as sn,a4 as hZe,ak as fZe,a1 as pZe,D as OZe,A as Ml,X as Qi,F as rT,L as Us,I as Si,T as tm,S as pr,V as Ul,al as d_e,am as Ore,g as it,z as gZe,an as B2,a3 as Cr,f as oa,ao as mZe,ap as vZe,aq as gre,ar as mre,as as yZe,at as vre,t as Au,au as RY,U as h_e,b as F1,v as Ec,C as Dp,Z as qq,k as f_e,K as M1,M as j1,N as L1,O as q1,Q as z1,o as px,p as iv,q as Ox,s as $s,Y as p_e,av as bZe,aw as wZe,ax as xZe,ay as SZe,az as yre,y as O_e,aA as AY,aB as sv,W as $Ze,aC as kZe,u as tO,aD as g_e,a9 as m_e,P as v_e,w as y_e,x as b_e,aE as Yb,i as DY,H as qR,aF as BX,aG as TZe,d as w_e,e as x_e,aH as _Ze,aI as PZe,aJ as CZe,aK as EZe,E as zq,aL as S_e,aM as bre,l as QZe,m as RZe,R as AZe}from"./icon-CeaDeErk.js";var gx=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(){}},av=typeof window>"u"||"Deno"in globalThis;function au(){}function DZe(e,t){return typeof e=="function"?e(t):e}function Uq(e){return typeof e=="number"&&e>=0&&e!==1/0}function $_e(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Zb(e,t){return typeof e=="function"?e(t):e}function hd(e,t){return typeof e=="function"?e(t):e}function wre(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:a,stale:o}=e;if(a){if(r){if(t.queryHash!==NY(a,t.options))return!1}else if(!iT(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 xre(e,t){const{exact:n,status:r,predicate:i,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(ov(t.options.mutationKey)!==ov(s))return!1}else if(!iT(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function NY(e,t){return(t?.queryKeyHashFn||ov)(e)}function ov(e){return JSON.stringify(e,(t,n)=>Wq(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function iT(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>iT(e[n],t[n])):!1}function k_e(e,t){if(e===t)return e;const n=Sre(e)&&Sre(t);if(n||Wq(e)&&Wq(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]=k_e(e[u],t[u]),o[u]===e[u]&&e[u]!==void 0&&l++)}return i===a&&l===i?e:o}return t}function zR(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 Sre(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Wq(e){if(!$re(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!$re(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function $re(e){return Object.prototype.toString.call(e)==="[object Object]"}function NZe(e){return new Promise(t=>{setTimeout(t,e)})}function Gq(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?k_e(e,t):t}function zP(e){return e}function XZe(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function IZe(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var XY=Symbol();function T_e(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===XY?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var FZe=class extends gx{#t;#e;#n;constructor(){super(),this.#n=e=>{if(!av&&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"}},IY=new FZe,MZe=class extends gx{#t=!0;#e;#n;constructor(){super(),this.#n=e=>{if(!av&&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}},UR=new MZe;function Vq(){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 jZe(e){return Math.min(1e3*2**e,3e4)}function __e(e){return(e??"online")==="online"?UR.isOnline():!0}var P_e=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function YX(e){return e instanceof P_e}function C_e(e){let t=!1,n=0,r=!1,i;const s=Vq(),a=g=>{r||(h(new P_e(g)),e.abort?.())},o=()=>{t=!0},l=()=>{t=!1},c=()=>IY.isFocused()&&(e.networkMode==="always"||UR.isOnline())&&e.canRun(),u=()=>__e(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?.()}),O=()=>{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 y=e.retry??(av?0:3),w=e.retryDelay??jZe,k=typeof w=="function"?w(n,v):w,x=y===!0||typeof y=="number"&&n<y||typeof y=="function"&&y(n,v);if(t||!x){h(v);return}n++,e.onFail?.(n,v),NZe(k).then(()=>c()?void 0:f()).then(()=>{t?h(v):O()})})};return{promise:s,cancel:a,continue:()=>(i?.(),s),cancelRetry:o,continueRetry:l,canStart:u,start:()=>(u()?O():f().then(O),s)}}var LZe=e=>setTimeout(e,0);function qZe(){let e=[],t=0,n=o=>{o()},r=o=>{o()},i=LZe;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 va=qZe(),E_e=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Uq(this.gcTime)&&(this.#t=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(av?1/0:5*60*1e3))}clearGcTimeout(){this.#t&&(clearTimeout(this.#t),this.#t=void 0)}},zZe=class extends E_e{#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=UZe(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=Gq(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(au).catch(au):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(e=>hd(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===XY||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||!$_e(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=T_e(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=>{YX(o)&&o.silent||this.#s({type:"error",error:o}),YX(o)||(this.#n.config.onError?.(o,this),this.#n.config.onSettled?.(this.state.data,o,this)),this.scheduleGc()};return this.#i=C_e({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,...Q_e(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 YX(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),va.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function Q_e(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:__e(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function UZe(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 WZe=class extends gx{constructor(e={}){super(),this.config=e,this.#t=new Map}#t;build(e,t,n){const r=t.queryKey,i=t.queryHash??NY(r,t);let s=this.get(i);return s||(s=new zZe({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(){va.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=>wre(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>wre(e,n)):t}notify(e){va.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){va.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){va.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},GZe=class extends E_e{#t;#e;#n;constructor(e){super(),this.mutationId=e.mutationId,this.#e=e.mutationCache,this.#t=[],this.state=e.state||R_e(),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=C_e({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),va.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#e.notify({mutation:this,type:"updated",action:e})})}};function R_e(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var VZe=class extends gx{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 GZe({mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#t.add(e);const t=Y2(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=Y2(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=Y2(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=Y2(e);return typeof t=="string"?this.#e.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){va.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=>xre(t,n))}findAll(e={}){return this.getAll().filter(t=>xre(e,t))}notify(e){va.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return va.batch(()=>Promise.all(e.map(t=>t.continue().catch(au))))}};function Y2(e){return e.options.scope?.id}function kre(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=O=>{Object.defineProperty(O,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},h=T_e(t.options,t.fetchOptions),f=async(O,g,m)=>{if(u)return Promise.reject();if(g==null&&O.pages.length)return Promise.resolve(O);const v={client:t.client,queryKey:t.queryKey,pageParam:g,direction:m?"backward":"forward",meta:t.options.meta};d(v);const y=await h(v),{maxPages:w}=t.options,k=m?IZe:XZe;return{pages:k(O.pages,y,w),pageParams:k(O.pageParams,g,w)}};if(i&&s.length){const O=i==="backward",g=O?BZe:Tre,m={pages:s,pageParams:a},v=g(r,m);o=await f(m,v,O)}else{const O=e??s.length;do{const g=l===0?a[0]??r.initialPageParam:Tre(r,o);if(l>0&&g==null)break;o=await f(o,g),l++}while(l<O)}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 Tre(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 BZe(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var YZe=class{#t;#e;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#t=e.queryCache||new WZe,this.#e=e.mutationCache||new VZe,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=IY.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#s=UR.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(Zb(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=DZe(t,s);if(a!==void 0)return this.#t.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return va.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;va.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#t;return va.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=va.batch(()=>this.#t.findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(au).catch(au)}invalidateQueries(e,t={}){return va.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=va.batch(()=>this.#t.findAll(e).filter(i=>!i.isDisabled()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(au)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(au)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#t.build(this,t);return n.isStaleByTime(Zb(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(au).catch(au)}fetchInfiniteQuery(e){return e.behavior=kre(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(au).catch(au)}ensureInfiniteQueryData(e){return e.behavior=kre(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return UR.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(ov(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{iT(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(ov(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#i.values()],n={};return t.forEach(r=>{iT(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=NY(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===XY&&(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()}},ZZe=class extends gx{constructor(e,t){super(),this.options=t,this.#t=e,this.#s=null,this.#o=Vq(),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;#O;#h;#f;#c;#u;#l;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),_re(this.#e,this.options)?this.#d():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Bq(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Bq(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#w(),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 hd(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&&!zR(this.options,t)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&Pre(this.#e,n,this.options,t)&&this.#d(),this.updateResult(),r&&(this.#e!==n||hd(this.options.enabled,this.#e)!==hd(t.enabled,this.#e)||Zb(this.options.staleTime,this.#e)!==Zb(t.staleTime,this.#e))&&this.#g();const i=this.#m();r&&(this.#e!==n||hd(this.options.enabled,this.#e)!==hd(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 KZe(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.#p.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(au)),t}#g(){this.#b();const e=Zb(this.options.staleTime,this.#e);if(av||this.#r.isStale||!Uq(e))return;const n=$_e(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.#w(),this.#l=e,!(av||hd(this.options.enabled,this.#e)===!1||!Uq(this.#l)||this.#l===0)&&(this.#u=setInterval(()=>{(this.options.refetchIntervalInBackground||IY.isFocused())&&this.#d()},this.#l))}#y(){this.#g(),this.#v(this.#m())}#b(){this.#c&&(clearTimeout(this.#c),this.#c=void 0)}#w(){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 _=this.hasListeners(),P=!_&&_re(e,t),E=_&&Pre(e,n,t,r);(P||E)&&(u={...u,...Q_e(c.data,e.options)}),t._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:f,errorUpdatedAt:O,status:g}=u;h=u.data;let m=!1;if(t.placeholderData!==void 0&&h===void 0&&g==="pending"){let _;i?.isPlaceholderData&&t.placeholderData===a?.placeholderData?(_=i.data,m=!0):_=typeof t.placeholderData=="function"?t.placeholderData(this.#f?.state.data,this.#f):t.placeholderData,_!==void 0&&(g="success",h=Gq(i?.data,_,t),d=!0)}if(t.select&&h!==void 0&&!m)if(i&&h===s?.data&&t.select===this.#O)h=this.#h;else try{this.#O=t.select,h=t.select(h),h=Gq(i?.data,h,t),this.#h=h,this.#s=null}catch(_){this.#s=_}this.#s&&(f=this.#s,h=this.#h,O=Date.now(),g="error");const v=u.fetchStatus==="fetching",y=g==="pending",w=g==="error",k=y&&v,x=h!==void 0,T={status:g,fetchStatus:u.fetchStatus,isPending:y,isSuccess:g==="success",isError:w,isInitialLoading:k,isLoading:k,data:h,dataUpdatedAt:u.dataUpdatedAt,error:f,errorUpdatedAt:O,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&&!y,isLoadingError:w&&!x,isPaused:u.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:w&&x,isStale:FY(e,t),refetch:this.refetch,promise:this.#o};if(this.options.experimental_prefetchInRender){const _=C=>{T.status==="error"?C.reject(T.error):T.data!==void 0&&C.resolve(T.data)},P=()=>{const C=this.#o=T.promise=Vq();_(C)},E=this.#o;switch(E.status){case"pending":e.queryHash===n.queryHash&&_(E);break;case"fulfilled":(T.status==="error"||T.data!==E.value)&&P();break;case"rejected":(T.status!=="error"||T.error!==E.reason)&&P();break}}return T}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),zR(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.#p.size)return!0;const s=new Set(i??this.#p);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.#y()}#S(e){va.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#r)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function HZe(e,t){return hd(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function _re(e,t){return HZe(e,t)||e.state.data!==void 0&&Bq(e,t,t.refetchOnMount)}function Bq(e,t,n){if(hd(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&FY(e,t)}return!1}function Pre(e,t,n,r){return(e!==t||hd(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&FY(e,n)}function FY(e,t){return hd(t.enabled,e)!==!1&&e.isStaleByTime(Zb(t.staleTime,e))}function KZe(e,t){return!zR(e.getCurrentResult(),t)}var JZe=class extends gx{#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),zR(this.options,n)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&ov(n.mutationKey)!==ov(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??R_e();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){va.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)})})}},A_e=b.createContext(void 0),Mi=e=>{const t=b.useContext(A_e);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},D_e=({client:e,children:t})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),p.jsx(A_e.Provider,{value:e,children:t})),N_e=b.createContext(!1),eHe=()=>b.useContext(N_e);N_e.Provider;function tHe(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var nHe=b.createContext(tHe()),rHe=()=>b.useContext(nHe);function X_e(e,t){return typeof e=="function"?e(...t):!!e}function Yq(){}var iHe=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},sHe=e=>{b.useEffect(()=>{e.clearReset()},[e])},aHe=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||X_e(n,[e.error,r])),oHe=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)))},lHe=(e,t)=>e.isLoading&&e.isFetching&&!t,cHe=(e,t)=>e?.suspense&&t.isPending,Cre=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function uHe(e,t,n){const r=Mi(),i=eHe(),s=rHe(),a=r.defaultQueryOptions(e);r.getDefaultOptions().queries?._experimental_beforeQuery?.(a),a._optimisticResults=i?"isRestoring":"optimistic",oHe(a),iHe(a,s),sHe(s);const o=!r.getQueryCache().get(a.queryHash),[l]=b.useState(()=>new t(r,a)),c=l.getOptimisticResult(a),u=!i&&e.subscribed!==!1;if(b.useSyncExternalStore(b.useCallback(d=>{const h=u?l.subscribe(va.batchCalls(d)):Yq;return l.updateResult(),h},[l,u]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),b.useEffect(()=>{l.setOptions(a)},[a,l]),cHe(a,c))throw Cre(a,l,s);if(aHe({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&&!av&&lHe(c,i)&&(o?Cre(a,l,s):r.getQueryCache().get(a.queryHash)?.promise)?.catch(Yq).finally(()=>{l.updateResult()}),a.notifyOnChangeProps?c:l.trackResult(c)}function ir(e,t){return uHe(e,ZZe)}function Ol(e,t){const n=Mi(),[r]=b.useState(()=>new JZe(n,e));b.useEffect(()=>{r.setOptions(e)},[r,e]);const i=b.useSyncExternalStore(b.useCallback(a=>r.subscribe(va.batchCalls(a)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=b.useCallback((a,o)=>{r.mutate(a,o).catch(Yq)},[r]);if(i.error&&X_e(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:s,mutateAsync:i.mutate}}const dHe=function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"}(),hHe=function(e,t){return new URL(e,t).href},Ere={},je=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=hHe(c,r),c in Ere)return;Ere[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(!!r)for(let O=a.length-1;O>=0;O--){const g=a[O];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":dHe,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((O,g)=>{f.addEventListener("load",O),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 pd,Ve=typeof window<"u"?window:void 0,Al=typeof globalThis<"u"?globalThis:Ve,I_e=Array.prototype,Qre=I_e.forEach,Rre=I_e.indexOf,kc=Al?.navigator,ln=Al?.document,Pl=Al?.location,Zq=Al?.fetch,Hq=Al!=null&&Al.XMLHttpRequest&&"withCredentials"in new Al.XMLHttpRequest?Al.XMLHttpRequest:void 0,Are=Al?.AbortController,ia=kc?.userAgent,er=Ve??{},Zf={DEBUG:!1,LIB_VERSION:"1.235.6"},ZX="$copy_autocapture",fHe=["$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"})(pd||(pd={}));var pHe=["fatal","error","warning","log","info","debug"];function wr(e,t){return e.indexOf(t)!==-1}var M3=function(e){return e.trim()},MY=function(e){return e.replace(/^\$/,"")},OHe=Array.isArray,F_e=Object.prototype,M_e=F_e.hasOwnProperty,j3=F_e.toString,_s=OHe||function(e){return j3.call(e)==="[object Array]"},Sd=e=>typeof e=="function",Ps=e=>e===Object(e)&&!_s(e),Eb=e=>{if(Ps(e)){for(var t in e)if(M_e.call(e,t))return!1;return!0}return!1},Yt=e=>e===void 0,ca=e=>j3.call(e)=="[object String]",Kq=e=>ca(e)&&e.trim().length===0,nm=e=>e===null,fi=e=>Yt(e)||nm(e),al=e=>j3.call(e)=="[object Number]",rp=e=>j3.call(e)==="[object Boolean]",gHe=e=>e instanceof FormData,mHe=e=>wr(fHe,e),j_e=e=>{var t={_log:function(n){if(Ve&&(Zf.DEBUG||er.POSTHOG_DEBUG)&&!Yt(Ve.console)&&Ve.console){for(var r=("__rrweb_original__"in Ve.console[n])?Ve.console[n].__rrweb_original__:Ve.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=>j_e("".concat(e," ").concat(n))};return t},bn=j_e("[PostHog.js]"),Uo=bn.createLogger,vHe=Uo("[ExternalScriptsLoader]"),Dre=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return vHe.warn("".concat(t," was requested but loading of external scripts is disabled.")),n("Loading of external scripts is disabled");var r=ln?.querySelectorAll("script");if(r){for(var i=0;i<r.length;i++)if(r[i].src===t)return n()}var s=()=>{if(!ln)return n("document not found");var a=ln.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=ln.querySelectorAll("body > script");l.length>0?(o=l[0].parentNode)===null||o===void 0||o.insertBefore(a,l[0]):ln.body.appendChild(a)};ln!=null&&ln.body?s():ln?.addEventListener("DOMContentLoaded",s)};function Nre(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 et(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Nre(Object(n),!0).forEach(function(r){Nt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nre(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Nt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function L_e(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}er.__PosthogExtensions__=er.__PosthogExtensions__||{},er.__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);Dre(e,a,n)},er.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);Dre(e,r,n)};var WR={};function yg(e,t,n){if(_s(e)){if(Qre&&e.forEach===Qre)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)===WR)return}}}function _i(e,t,n){if(!fi(e)){if(_s(e))return yg(e,t,n);if(gHe(e)){for(var r of e.entries())if(t.call(n,r[1],r[0])===WR)return}else for(var i in e)if(M_e.call(e,i)&&t.call(n,e[i],i)===WR)return}}var Fs=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 yg(n,function(i){for(var s in i)i[s]!==void 0&&(e[s]=i[s])}),e},_Q=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 yg(n,function(i){yg(i,function(s){e.push(s)})}),e};function PQ(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 Xre=function(e){try{return e()}catch{return}},yHe=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){bn.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),bn.critical(i)}}},sT=function(e){var t={};return _i(e,function(n,r){ca(n)&&n.length>0&&(t[r]=n)}),t};function bHe(e,t){return n=e,r=s=>ca(s)&&!nm(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),_s(a)?(l=[],yg(a,c=>{l.push(s(c))})):(l={},_i(a,(c,u)=>{i.has(c)||(l[u]=s(c,u))})),l);var l}(n);var n,r,i}var wHe=["herokuapp.com","vercel.app","netlify.app"];function xHe(e){var t=e?.hostname;if(!ca(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of wHe)if(n===r)return!1;return!0}function q_e(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function Ls(e,t,n,r){var{capture:i=!1,passive:s=!0}=r??{};e?.addEventListener(t,n,{capture:i,passive:s})}var z_e="$people_distinct_id",v$="__alias",y$="__timers",Ire="$autocapture_disabled_server_side",Jq="$heatmaps_enabled_server_side",Fre="$exception_capture_enabled_server_side",Mre="$web_vitals_enabled_server_side",U_e="$dead_clicks_enabled_server_side",jre="$web_vitals_allowed_metrics",ez="$session_recording_enabled_server_side",Lre="$console_log_recording_enabled_server_side",qre="$session_recording_network_payload_capture",zre="$session_recording_masking",Ure="$session_recording_canvas_recording",Wre="$replay_sample_rate",Gre="$replay_minimum_duration",Vre="$replay_script_config",GR="$sesid",b$="$session_is_sampled",HX="$session_recording_url_trigger_activated_session",KX="$session_recording_event_trigger_activated_session",Qb="$enabled_feature_flags",CQ="$early_access_features",tz="$feature_flag_details",w$="$stored_person_properties",Jm="$stored_group_properties",nz="$surveys",Z2="$surveys_activated",VR="$flag_call_reported",qf="$user_state",rz="$client_session_props",iz="$capture_rate_limit",sz="$initial_campaign_params",az="$initial_referrer_info",oz="$initial_person_info",BR="$epp",W_e="__POSTHOG_TOOLBAR__",Bre="$posthog_cookieless",SHe=[z_e,v$,"__cmpns",y$,ez,Jq,GR,Qb,qf,CQ,tz,Jm,w$,nz,VR,rz,iz,sz,az,BR];function Yre(e){var t;return e instanceof Element&&(e.id===W_e||!((t=e.closest)===null||t===void 0||!t.call(e,".toolbar-global-fade-container")))}function L3(e){return!!e&&e.nodeType===1}function bg(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function G_e(e){return!!e&&e.nodeType===3}function V_e(e){return!!e&&e.nodeType===11}function jY(e){return e?M3(e).split(/\s+/):[]}function Zre(e){var t=Ve?.location.href;return!!(t&&e&&e.some(n=>t.match(n)))}function YR(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 jY(t)}function B_e(e){return fi(e)?null:M3(e).split(/(\s+)/).filter(t=>U1(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function q3(e){var t="";return cz(e)&&!H_e(e)&&e.childNodes&&e.childNodes.length&&_i(e.childNodes,function(n){var r;G_e(n)&&n.textContent&&(t+=(r=B_e(n.textContent))!==null&&r!==void 0?r:"")}),M3(t)}function Y_e(e){return Yt(e.target)?e.srcElement||null:(t=e.target)!==null&&t!==void 0&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var lz=["a","button","form","input","select","textarea","label"];function Z_e(e){var t=e.parentNode;return!(!t||!L3(t))&&t}function $He(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(!Ve||!e||bg(e,"html")||!L3(e)||n!=null&&n.url_allowlist&&!Zre(n.url_allowlist)||n!=null&&n.url_ignorelist&&Zre(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&&!bg(c,"body");)if(V_e(c.parentNode))o.push(c.parentNode.host),c=c.parentNode.host;else{if(!(l=Z_e(c)))break;if(r||lz.indexOf(l.tagName.toLowerCase())>-1)a=!0;else{var u=Ve.getComputedStyle(l);u&&u.getPropertyValue("cursor")==="pointer"&&(a=!0)}o.push(l),c=l}if(!function(f,O){var g=O?.element_allowlist;if(Yt(g))return!0;var m=function(w){if(g.some(k=>w.tagName.toLowerCase()===k))return{v:!0}};for(var v of f){var y=m(v);if(typeof y=="object")return y.v}return!1}(o,n)||!function(f,O){var g=O?.css_selector_allowlist;if(Yt(g))return!0;var m=function(w){if(g.some(k=>w.matches(k)))return{v:!0}};for(var v of f){var y=m(v);if(typeof y=="object")return y.v}return!1}(o,n))return!1;var d=Ve.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&&(lz.indexOf(h)>-1||e.getAttribute("contenteditable")==="true")}}function cz(e){for(var t=e;t.parentNode&&!bg(t,"body");t=t.parentNode){var n=YR(t);if(wr(n,"ph-sensitive")||wr(n,"ph-no-capture"))return!1}if(wr(YR(e),"ph-include"))return!0;var r=e.type||"";if(ca(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=e.name||e.id||"";return!(ca(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 H_e(e){return!!(bg(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||bg(e,"select")||bg(e,"textarea")||e.getAttribute("contenteditable")==="true")}var K_e="(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})",kHe=new RegExp("^(?:".concat(K_e,")$")),THe=new RegExp(K_e),J_e="\\d{3}-?\\d{2}-?\\d{4}",_He=new RegExp("^(".concat(J_e,")$")),PHe=new RegExp("(".concat(J_e,")"));function U1(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(fi(e)||ca(e)&&(e=M3(e),(t?kHe:THe).test((e||"").replace(/[- ]/g,""))||(t?_He:PHe).test(e)))}function ePe(e){var t=q3(e);return U1(t="".concat(t," ").concat(tPe(e)).trim())?t:""}function tPe(e){var t="";return e&&e.childNodes&&e.childNodes.length&&_i(e.childNodes,function(n){var r;if(n&&((r=n.tagName)===null||r===void 0?void 0:r.toLowerCase())==="span")try{var i=q3(n);t="".concat(t," ").concat(i).trim(),n.childNodes&&n.childNodes.length&&(t="".concat(t," ").concat(tPe(n)).trim())}catch(s){bn.error("[AutoCapture]",s)}}),t}function CHe(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=et(et(et(et({},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 PQ(l).sort((u,d)=>{var[h]=u,[f]=d;return h.localeCompare(f)}).forEach(u=>{var[d,h]=u;return c[Hre(d.toString())]=Hre(h.toString())}),a+=":",a+=PQ(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:EHe(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return PQ(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 Hre(e){return e.replace(/"|\\"/g,'\\"')}function EHe(e){var t=e.attr__class;return t?_s(t)?t:jY(t):void 0}class nPe{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 QHe=["localhost","127.0.0.1"],Hb=e=>{var t=ln?.createElement("a");return Yt(t)?null:(t.href=e,t)},RHe=function(e){var t,n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",i=[];return _i(e,function(s,a){Yt(s)||Yt(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)},ZR=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(!_s(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch{bn.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},JX=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("=");_s(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},HR=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},Kre=Uo("[AutoCapture]");function e6(e,t){return t.length>e?t.slice(0,e)+"...":t}function AHe(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!L3(t));return t}function DHe(e,t,n,r){var i=e.tagName.toLowerCase(),s={tag_name:i};lz.indexOf(i)>-1&&!n&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?s.$el_text=e6(1024,ePe(e)):s.$el_text=e6(1024,q3(e)));var a=YR(e);a.length>0&&(s.classes=a.filter(function(u){return u!==""})),_i(e.attributes,function(u){var d;if((!H_e(e)||["name","id","class","aria-label"].indexOf(u.name)!==-1)&&(r==null||!r.includes(u.name))&&!t&&U1(u.value)&&(d=u.name,!ca(d)||d.substring(0,10)!=="_ngcontent"&&d.substring(0,7)!=="_nghost")){var h=u.value;u.name==="class"&&(h=jY(h).join(" ")),s["attr__"+u.name]=e6(1024,h)}});for(var o=1,l=1,c=e;c=AHe(c);)o++,c.tagName===e.tagName&&l++;return s.nth_child=o,s.nth_of_type=l,s}function NHe(e,t){for(var n,r,{e:i,maskAllElementAttributes:s,maskAllText:a,elementAttributeIgnoreList:o,elementsChainAsString:l}=t,c=[e],u=e;u.parentNode&&!bg(u,"body");)V_e(u.parentNode)?(c.push(u.parentNode.host),u=u.parentNode.host):(c.push(u.parentNode),u=u.parentNode);var d,h=[],f={},O=!1,g=!1;if(_i(c,k=>{var x=cz(k);k.tagName.toLowerCase()==="a"&&(O=k.getAttribute("href"),O=x&&O&&U1(O)&&O),wr(YR(k),"ph-no-capture")&&(g=!0),h.push(DHe(k,s,a,o));var S=function(T){if(!cz(T))return{};var _={};return _i(T.attributes,function(P){if(P.name&&P.name.indexOf("data-ph-capture-attribute")===0){var E=P.name.replace("data-ph-capture-attribute-",""),C=P.value;E&&C&&U1(C)&&(_[E]=C)}}),_}(k);Fs(f,S)}),g)return{props:{},explicitNoCapture:g};if(a||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?h[0].$el_text=ePe(e):h[0].$el_text=q3(e)),O){var m,v;h[0].attr__href=O;var y=(m=Hb(O))===null||m===void 0?void 0:m.host,w=Ve==null||(v=Ve.location)===null||v===void 0?void 0:v.host;y&&w&&y!==w&&(d=O)}return{props:Fs({$event_type:i.type,$ce_version:1},l?{}:{$elements:h},{$elements_chain:CHe(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 XHe=class{constructor(t){Nt(this,"_initialized",!1),Nt(this,"_isDisabledServerSide",null),Nt(this,"rageclicks",new nPe),Nt(this,"_elementsChainAsString",!1),this.instance=t,this._elementSelectors=null}get config(){var t,n,r=Ps(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(Ve&&ln){var t=r=>{r=r||Ve?.event;try{this._captureEvent(r)}catch(i){Kre.error("Failed to capture event",i)}};if(Ls(ln,"submit",t,{capture:!0}),Ls(ln,"change",t,{capture:!0}),Ls(ln,"click",t,{capture:!0}),this.config.capture_copied_text){var n=r=>{r=r||Ve?.event,this._captureEvent(r,ZX)};Ls(ln,"copy",n,{capture:!0}),Ls(ln,"cut",n,{capture:!0})}}}else Kre.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({[Ire]:!!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=ln?.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[Ire],i=this._isDisabledServerSide;if(nm(i)&&!rp(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=Y_e(t);G_e(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===ZX;if(i&&$He(i,t,this.config,s,s?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:o}=NHe(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===ZX){var c,u=B_e(Ve==null||(c=Ve.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 Sd(ln?.querySelectorAll)}};Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return al(e)&&isFinite(e)&&Math.floor(e)===e});var Jre="0123456789abcdef";let IHe=class uz{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 uz(s)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+Jre.charAt(this.bytes[n]>>>4)+Jre.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 uz(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}},FHe=class{constructor(){Nt(this,"timestamp",0),Nt(this,"counter",0),Nt(this,"random",new MHe)}generate(){var t=this.generateOrAbort();if(Yt(t)){this.timestamp=0;var n=this.generateOrAbort();if(Yt(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 IHe.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 eie,rPe=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};Ve&&!Yt(Ve.crypto)&&crypto.getRandomValues&&(rPe=e=>crypto.getRandomValues(e));let MHe=class{constructor(){Nt(this,"buffer",new Uint32Array(8)),Nt(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(rPe(this.buffer),this.cursor=0),this.buffer[this.cursor++]}};var eg=()=>jHe().toString(),jHe=()=>(eie||(eie=new FHe)).generate(),LHe="Thu, 01 Jan 1970 00:00:00 GMT",sS="",qHe=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function zHe(e,t){if(t){var n=function(i){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ln;if(sS)return sS;if(!s||["localhost","127.0.0.1"].includes(i))return"";for(var a=i.split("."),o=Math.min(a.length,8),l="dmn_chk_"+eg(),c=new RegExp("(^|;)\\s*"+l+"=1");!sS&&o--;){var u=a.slice(o).join("."),d=l+"=1;domain=."+u;s.cookie=d,c.test(s.cookie)&&(s.cookie=d+";expires="+LHe,sS=u)}return sS}(e);if(!n){var r=(i=>{var s=i.match(qHe);return s?s[0]:""})(e);r!==n&&bn.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var LO,mp={is_supported:()=>!!ln,error:function(e){bn.error("cookieStore error: "+e)},get:function(e){if(ln){try{for(var t=e+"=",n=ln.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(mp.get(e))||{}}catch{}return t},set:function(e,t,n,r,i){if(ln)try{var s="",a="",o=zHe(ln.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&&bn.warn("cookieStore warning: large cookie, len="+c.length),ln.cookie=c,c}catch{return}},remove:function(e,t){try{mp.set(e,"",-1,t)}catch{return}}},t6=null,ga={is_supported:function(){if(!nm(t6))return t6;var e=!0;if(Yt(Ve))e=!1;else try{var t="__mplssupport__";ga.set(t,"xyz"),ga.get(t)!=='"xyz"'&&(e=!1),ga.remove(t)}catch{e=!1}return e||bn.error("localStorage unsupported; falling back to cookie store"),t6=e,e},error:function(e){bn.error("localStorage error: "+e)},get:function(e){try{return Ve?.localStorage.getItem(e)}catch(t){ga.error(t)}return null},parse:function(e){try{return JSON.parse(ga.get(e))||{}}catch{}return null},set:function(e,t){try{Ve?.localStorage.setItem(e,JSON.stringify(t))}catch(n){ga.error(n)}},remove:function(e){try{Ve?.localStorage.removeItem(e)}catch(t){ga.error(t)}}},UHe=["distinct_id",GR,b$,BR,oz],H2=et(et({},ga),{},{parse:function(e){try{var t={};try{t=mp.parse(e)||{}}catch{}var n=Fs(t,JSON.parse(ga.get(e)||"{}"));return ga.set(e,n),n}catch{}return null},set:function(e,t,n,r,i,s){try{ga.set(e,t,void 0,void 0,s);var a={};UHe.forEach(o=>{t[o]&&(a[o]=t[o])}),Object.keys(a).length&&mp.set(e,a,n,r,i,s)}catch(o){ga.error(o)}},remove:function(e,t){try{Ve?.localStorage.removeItem(e),mp.remove(e,t)}catch(n){ga.error(n)}}}),K2={},WHe={is_supported:function(){return!0},error:function(e){bn.error("memoryStorage error: "+e)},get:function(e){return K2[e]||null},parse:function(e){return K2[e]||null},set:function(e,t){K2[e]=t},remove:function(e){delete K2[e]}},Qm=null,no={is_supported:function(){if(!nm(Qm))return Qm;if(Qm=!0,Yt(Ve))Qm=!1;else try{var e="__support__";no.set(e,"xyz"),no.get(e)!=='"xyz"'&&(Qm=!1),no.remove(e)}catch{Qm=!1}return Qm},error:function(e){bn.error("sessionStorage error: ",e)},get:function(e){try{return Ve?.sessionStorage.getItem(e)}catch(t){no.error(t)}return null},parse:function(e){try{return JSON.parse(no.get(e))||null}catch{}return null},set:function(e,t){try{Ve?.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){no.error(n)}},remove:function(e){try{Ve?.sessionStorage.removeItem(e)}catch(t){no.error(t)}}};(function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"})(LO||(LO={}));let GHe=class{constructor(t){this.instance=t}get config(){return this.instance.config}get consent(){return this.getDnt()?LO.DENIED:this.storedConsent}isOptedOut(){return this.consent===LO.DENIED||this.consent===LO.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"?LO.GRANTED:t==="0"?LO.DENIED:LO.PENDING}get storage(){if(!this._storage){var t=this.config.opt_out_capturing_persistence_type;this._storage=t==="localStorage"?ga:mp;var n=t==="localStorage"?mp:ga;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&&!!q_e([kc?.doNotTrack,kc?.msDoNotTrack,er.doNotTrack],t=>wr([!0,1,"1","yes"],t))}};var J2=Uo("[Dead Clicks]"),VHe=()=>!0,BHe=e=>{var t,n=!((t=e.instance.persistence)===null||t===void 0||!t.get_property(U_e)),r=e.instance.config.capture_dead_clicks;return rp(r)?r:n};let iPe=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({[U_e]:t?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript(()=>{this.start()})}loadScript(t){var n,r,i;(n=er.__PosthogExtensions__)!==null&&n!==void 0&&n.initDeadClicksAutocapture&&t(),(r=er.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"dead-clicks-autocapture",s=>{s?J2.error("failed to load script",s):t()})}start(){var t;if(ln){if(!this._lazyLoadedDeadClicksAutocapture&&(t=er.__PosthogExtensions__)!==null&&t!==void 0&&t.initDeadClicksAutocapture){var n=Ps(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=er.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this._lazyLoadedDeadClicksAutocapture.start(ln),J2.info("starting...")}}else J2.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,J2.info("stopping..."))}};var n6=Uo("[ExceptionAutocapture]");let YHe=class{constructor(t){var n;Nt(this,"startCapturing",()=>{var r;if(Ve&&this.isEnabled&&(r=er.__PosthogExtensions__)!==null&&r!==void 0&&r.errorWrappingFunctions){var i=er.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,s=er.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,a=er.__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){n6.error("failed to start",o),this.stopCapturing()}}}),this.instance=t,this.remoteEnabled=!((n=this.instance.persistence)===null||n===void 0||!n.props[Fre]),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 Ps(t)?n=et(et({},n),t):(Yt(t)?this.remoteEnabled:t)&&(n=et(et({},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&&(n6.info("enabled"),this.loadScript(this.startCapturing))}loadScript(t){var n,r,i;(n=er.__PosthogExtensions__)!==null&&n!==void 0&&n.errorWrappingFunctions&&t(),(r=er.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"exception-autocapture",s=>{if(s)return n6.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({[Fre]: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 sPe(e){return!Yt(Event)&&aPe(e,Event)}function aPe(e,t){try{return e instanceof t}catch{return!1}}function EQ(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function r6(e){return EQ(e,"DOMError")}var tie=/\(error: (.*)\)/,nie=50,Rb="?";function i6(e,t,n,r){var i={platform:"web:javascript",filename:e,function:t==="<anonymous>"?Rb:t,in_app:!0};return Yt(n)||(i.lineno=n),Yt(r)||(i.colno=r),i}var ZHe=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,HHe=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,KHe=/\((\S*)(?::(\d+))(?::(\d+))\)/,JHe=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,eKe=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,tKe=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(`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./mermaid.core-Du-3Cewj.js","./icon-Bny6j4NZ.js","./icon-B8Li1YYS.css","./katex-BCx1q_2Y.css","./index-DOGq7e-U.js","./index-C4wE5-hf.js","./pug-DukmZTjD.js","./javascript-qCveANmP.js","./agent-details-page-DUnaZtSD.js","./use-agent-like-mutation-CxNAsw0f.js","./agent-hub-page-D2jMJi71.js","./compact-pagination-vqH3UMnL.js","./page-header-un3csrkZ.js","./agents-page-BzmZF2wA.js","./schedules-page-BSMjSJUt.js","./parseISO-D7nsYBq4.js","./browser-page-CsDt8lIc.js","./settings-page-BN1gnOIT.js","./radient-auth-buttons-C5U9BVCs.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as b,j as p,n as H,a2 as Lq,a as qe,a5 as u_e,B as we,c as A,ac as up,ad as jP,ae as LP,af as uZe,ag as I1,ah as dZe,ai as LR,aj as qP,h as sn,a4 as hZe,ak as fZe,a1 as pZe,D as OZe,A as Ml,X as Qi,F as rT,L as Us,I as Si,T as tm,S as pr,V as Ul,al as d_e,am as Ore,g as it,z as gZe,an as B2,a3 as Cr,f as oa,ao as mZe,ap as vZe,aq as gre,ar as mre,as as yZe,at as vre,t as Au,au as RY,U as h_e,b as F1,v as Ec,C as Dp,Z as qq,k as f_e,K as M1,M as j1,N as L1,O as q1,Q as z1,o as px,p as iv,q as Ox,s as $s,Y as p_e,av as bZe,aw as wZe,ax as xZe,ay as SZe,az as yre,y as O_e,aA as AY,aB as sv,W as $Ze,aC as kZe,u as tO,aD as g_e,a9 as m_e,P as v_e,w as y_e,x as b_e,aE as Yb,i as DY,H as qR,aF as BX,aG as TZe,d as w_e,e as x_e,aH as _Ze,aI as PZe,aJ as CZe,aK as EZe,E as zq,aL as S_e,aM as bre,l as QZe,m as RZe,R as AZe}from"./icon-Bny6j4NZ.js";var gx=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(){}},av=typeof window>"u"||"Deno"in globalThis;function au(){}function DZe(e,t){return typeof e=="function"?e(t):e}function Uq(e){return typeof e=="number"&&e>=0&&e!==1/0}function $_e(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Zb(e,t){return typeof e=="function"?e(t):e}function hd(e,t){return typeof e=="function"?e(t):e}function wre(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:a,stale:o}=e;if(a){if(r){if(t.queryHash!==NY(a,t.options))return!1}else if(!iT(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 xre(e,t){const{exact:n,status:r,predicate:i,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(ov(t.options.mutationKey)!==ov(s))return!1}else if(!iT(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function NY(e,t){return(t?.queryKeyHashFn||ov)(e)}function ov(e){return JSON.stringify(e,(t,n)=>Wq(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function iT(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>iT(e[n],t[n])):!1}function k_e(e,t){if(e===t)return e;const n=Sre(e)&&Sre(t);if(n||Wq(e)&&Wq(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]=k_e(e[u],t[u]),o[u]===e[u]&&e[u]!==void 0&&l++)}return i===a&&l===i?e:o}return t}function zR(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 Sre(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Wq(e){if(!$re(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!$re(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function $re(e){return Object.prototype.toString.call(e)==="[object Object]"}function NZe(e){return new Promise(t=>{setTimeout(t,e)})}function Gq(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?k_e(e,t):t}function zP(e){return e}function XZe(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function IZe(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var XY=Symbol();function T_e(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===XY?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var FZe=class extends gx{#t;#e;#n;constructor(){super(),this.#n=e=>{if(!av&&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"}},IY=new FZe,MZe=class extends gx{#t=!0;#e;#n;constructor(){super(),this.#n=e=>{if(!av&&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}},UR=new MZe;function Vq(){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 jZe(e){return Math.min(1e3*2**e,3e4)}function __e(e){return(e??"online")==="online"?UR.isOnline():!0}var P_e=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function YX(e){return e instanceof P_e}function C_e(e){let t=!1,n=0,r=!1,i;const s=Vq(),a=g=>{r||(h(new P_e(g)),e.abort?.())},o=()=>{t=!0},l=()=>{t=!1},c=()=>IY.isFocused()&&(e.networkMode==="always"||UR.isOnline())&&e.canRun(),u=()=>__e(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?.()}),O=()=>{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 y=e.retry??(av?0:3),w=e.retryDelay??jZe,k=typeof w=="function"?w(n,v):w,x=y===!0||typeof y=="number"&&n<y||typeof y=="function"&&y(n,v);if(t||!x){h(v);return}n++,e.onFail?.(n,v),NZe(k).then(()=>c()?void 0:f()).then(()=>{t?h(v):O()})})};return{promise:s,cancel:a,continue:()=>(i?.(),s),cancelRetry:o,continueRetry:l,canStart:u,start:()=>(u()?O():f().then(O),s)}}var LZe=e=>setTimeout(e,0);function qZe(){let e=[],t=0,n=o=>{o()},r=o=>{o()},i=LZe;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 va=qZe(),E_e=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Uq(this.gcTime)&&(this.#t=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(av?1/0:5*60*1e3))}clearGcTimeout(){this.#t&&(clearTimeout(this.#t),this.#t=void 0)}},zZe=class extends E_e{#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=UZe(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=Gq(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(au).catch(au):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(e=>hd(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===XY||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||!$_e(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=T_e(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=>{YX(o)&&o.silent||this.#s({type:"error",error:o}),YX(o)||(this.#n.config.onError?.(o,this),this.#n.config.onSettled?.(this.state.data,o,this)),this.scheduleGc()};return this.#i=C_e({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,...Q_e(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 YX(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),va.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function Q_e(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:__e(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function UZe(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 WZe=class extends gx{constructor(e={}){super(),this.config=e,this.#t=new Map}#t;build(e,t,n){const r=t.queryKey,i=t.queryHash??NY(r,t);let s=this.get(i);return s||(s=new zZe({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(){va.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=>wre(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>wre(e,n)):t}notify(e){va.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){va.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){va.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},GZe=class extends E_e{#t;#e;#n;constructor(e){super(),this.mutationId=e.mutationId,this.#e=e.mutationCache,this.#t=[],this.state=e.state||R_e(),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=C_e({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),va.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#e.notify({mutation:this,type:"updated",action:e})})}};function R_e(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var VZe=class extends gx{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 GZe({mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#t.add(e);const t=Y2(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=Y2(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=Y2(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=Y2(e);return typeof t=="string"?this.#e.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){va.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=>xre(t,n))}findAll(e={}){return this.getAll().filter(t=>xre(e,t))}notify(e){va.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return va.batch(()=>Promise.all(e.map(t=>t.continue().catch(au))))}};function Y2(e){return e.options.scope?.id}function kre(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=O=>{Object.defineProperty(O,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},h=T_e(t.options,t.fetchOptions),f=async(O,g,m)=>{if(u)return Promise.reject();if(g==null&&O.pages.length)return Promise.resolve(O);const v={client:t.client,queryKey:t.queryKey,pageParam:g,direction:m?"backward":"forward",meta:t.options.meta};d(v);const y=await h(v),{maxPages:w}=t.options,k=m?IZe:XZe;return{pages:k(O.pages,y,w),pageParams:k(O.pageParams,g,w)}};if(i&&s.length){const O=i==="backward",g=O?BZe:Tre,m={pages:s,pageParams:a},v=g(r,m);o=await f(m,v,O)}else{const O=e??s.length;do{const g=l===0?a[0]??r.initialPageParam:Tre(r,o);if(l>0&&g==null)break;o=await f(o,g),l++}while(l<O)}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 Tre(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 BZe(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var YZe=class{#t;#e;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#t=e.queryCache||new WZe,this.#e=e.mutationCache||new VZe,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=IY.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#s=UR.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(Zb(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=DZe(t,s);if(a!==void 0)return this.#t.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return va.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;va.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#t;return va.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=va.batch(()=>this.#t.findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(au).catch(au)}invalidateQueries(e,t={}){return va.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=va.batch(()=>this.#t.findAll(e).filter(i=>!i.isDisabled()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(au)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(au)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#t.build(this,t);return n.isStaleByTime(Zb(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(au).catch(au)}fetchInfiniteQuery(e){return e.behavior=kre(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(au).catch(au)}ensureInfiniteQueryData(e){return e.behavior=kre(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return UR.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(ov(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{iT(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(ov(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#i.values()],n={};return t.forEach(r=>{iT(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=NY(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===XY&&(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()}},ZZe=class extends gx{constructor(e,t){super(),this.options=t,this.#t=e,this.#s=null,this.#o=Vq(),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;#O;#h;#f;#c;#u;#l;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),_re(this.#e,this.options)?this.#d():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Bq(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Bq(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#w(),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 hd(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&&!zR(this.options,t)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&Pre(this.#e,n,this.options,t)&&this.#d(),this.updateResult(),r&&(this.#e!==n||hd(this.options.enabled,this.#e)!==hd(t.enabled,this.#e)||Zb(this.options.staleTime,this.#e)!==Zb(t.staleTime,this.#e))&&this.#g();const i=this.#m();r&&(this.#e!==n||hd(this.options.enabled,this.#e)!==hd(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 KZe(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.#p.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(au)),t}#g(){this.#b();const e=Zb(this.options.staleTime,this.#e);if(av||this.#r.isStale||!Uq(e))return;const n=$_e(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.#w(),this.#l=e,!(av||hd(this.options.enabled,this.#e)===!1||!Uq(this.#l)||this.#l===0)&&(this.#u=setInterval(()=>{(this.options.refetchIntervalInBackground||IY.isFocused())&&this.#d()},this.#l))}#y(){this.#g(),this.#v(this.#m())}#b(){this.#c&&(clearTimeout(this.#c),this.#c=void 0)}#w(){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 _=this.hasListeners(),P=!_&&_re(e,t),E=_&&Pre(e,n,t,r);(P||E)&&(u={...u,...Q_e(c.data,e.options)}),t._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:f,errorUpdatedAt:O,status:g}=u;h=u.data;let m=!1;if(t.placeholderData!==void 0&&h===void 0&&g==="pending"){let _;i?.isPlaceholderData&&t.placeholderData===a?.placeholderData?(_=i.data,m=!0):_=typeof t.placeholderData=="function"?t.placeholderData(this.#f?.state.data,this.#f):t.placeholderData,_!==void 0&&(g="success",h=Gq(i?.data,_,t),d=!0)}if(t.select&&h!==void 0&&!m)if(i&&h===s?.data&&t.select===this.#O)h=this.#h;else try{this.#O=t.select,h=t.select(h),h=Gq(i?.data,h,t),this.#h=h,this.#s=null}catch(_){this.#s=_}this.#s&&(f=this.#s,h=this.#h,O=Date.now(),g="error");const v=u.fetchStatus==="fetching",y=g==="pending",w=g==="error",k=y&&v,x=h!==void 0,T={status:g,fetchStatus:u.fetchStatus,isPending:y,isSuccess:g==="success",isError:w,isInitialLoading:k,isLoading:k,data:h,dataUpdatedAt:u.dataUpdatedAt,error:f,errorUpdatedAt:O,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&&!y,isLoadingError:w&&!x,isPaused:u.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:w&&x,isStale:FY(e,t),refetch:this.refetch,promise:this.#o};if(this.options.experimental_prefetchInRender){const _=C=>{T.status==="error"?C.reject(T.error):T.data!==void 0&&C.resolve(T.data)},P=()=>{const C=this.#o=T.promise=Vq();_(C)},E=this.#o;switch(E.status){case"pending":e.queryHash===n.queryHash&&_(E);break;case"fulfilled":(T.status==="error"||T.data!==E.value)&&P();break;case"rejected":(T.status!=="error"||T.error!==E.reason)&&P();break}}return T}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),zR(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.#p.size)return!0;const s=new Set(i??this.#p);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.#y()}#S(e){va.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#r)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function HZe(e,t){return hd(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function _re(e,t){return HZe(e,t)||e.state.data!==void 0&&Bq(e,t,t.refetchOnMount)}function Bq(e,t,n){if(hd(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&FY(e,t)}return!1}function Pre(e,t,n,r){return(e!==t||hd(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&FY(e,n)}function FY(e,t){return hd(t.enabled,e)!==!1&&e.isStaleByTime(Zb(t.staleTime,e))}function KZe(e,t){return!zR(e.getCurrentResult(),t)}var JZe=class extends gx{#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),zR(this.options,n)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&ov(n.mutationKey)!==ov(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??R_e();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){va.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)})})}},A_e=b.createContext(void 0),Mi=e=>{const t=b.useContext(A_e);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},D_e=({client:e,children:t})=>(b.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),p.jsx(A_e.Provider,{value:e,children:t})),N_e=b.createContext(!1),eHe=()=>b.useContext(N_e);N_e.Provider;function tHe(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var nHe=b.createContext(tHe()),rHe=()=>b.useContext(nHe);function X_e(e,t){return typeof e=="function"?e(...t):!!e}function Yq(){}var iHe=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},sHe=e=>{b.useEffect(()=>{e.clearReset()},[e])},aHe=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||X_e(n,[e.error,r])),oHe=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)))},lHe=(e,t)=>e.isLoading&&e.isFetching&&!t,cHe=(e,t)=>e?.suspense&&t.isPending,Cre=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function uHe(e,t,n){const r=Mi(),i=eHe(),s=rHe(),a=r.defaultQueryOptions(e);r.getDefaultOptions().queries?._experimental_beforeQuery?.(a),a._optimisticResults=i?"isRestoring":"optimistic",oHe(a),iHe(a,s),sHe(s);const o=!r.getQueryCache().get(a.queryHash),[l]=b.useState(()=>new t(r,a)),c=l.getOptimisticResult(a),u=!i&&e.subscribed!==!1;if(b.useSyncExternalStore(b.useCallback(d=>{const h=u?l.subscribe(va.batchCalls(d)):Yq;return l.updateResult(),h},[l,u]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),b.useEffect(()=>{l.setOptions(a)},[a,l]),cHe(a,c))throw Cre(a,l,s);if(aHe({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&&!av&&lHe(c,i)&&(o?Cre(a,l,s):r.getQueryCache().get(a.queryHash)?.promise)?.catch(Yq).finally(()=>{l.updateResult()}),a.notifyOnChangeProps?c:l.trackResult(c)}function ir(e,t){return uHe(e,ZZe)}function Ol(e,t){const n=Mi(),[r]=b.useState(()=>new JZe(n,e));b.useEffect(()=>{r.setOptions(e)},[r,e]);const i=b.useSyncExternalStore(b.useCallback(a=>r.subscribe(va.batchCalls(a)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=b.useCallback((a,o)=>{r.mutate(a,o).catch(Yq)},[r]);if(i.error&&X_e(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:s,mutateAsync:i.mutate}}const dHe=function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"}(),hHe=function(e,t){return new URL(e,t).href},Ere={},je=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=hHe(c,r),c in Ere)return;Ere[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(!!r)for(let O=a.length-1;O>=0;O--){const g=a[O];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":dHe,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((O,g)=>{f.addEventListener("load",O),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 pd,Ve=typeof window<"u"?window:void 0,Al=typeof globalThis<"u"?globalThis:Ve,I_e=Array.prototype,Qre=I_e.forEach,Rre=I_e.indexOf,kc=Al?.navigator,ln=Al?.document,Pl=Al?.location,Zq=Al?.fetch,Hq=Al!=null&&Al.XMLHttpRequest&&"withCredentials"in new Al.XMLHttpRequest?Al.XMLHttpRequest:void 0,Are=Al?.AbortController,ia=kc?.userAgent,er=Ve??{},Zf={DEBUG:!1,LIB_VERSION:"1.235.6"},ZX="$copy_autocapture",fHe=["$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"})(pd||(pd={}));var pHe=["fatal","error","warning","log","info","debug"];function wr(e,t){return e.indexOf(t)!==-1}var M3=function(e){return e.trim()},MY=function(e){return e.replace(/^\$/,"")},OHe=Array.isArray,F_e=Object.prototype,M_e=F_e.hasOwnProperty,j3=F_e.toString,_s=OHe||function(e){return j3.call(e)==="[object Array]"},Sd=e=>typeof e=="function",Ps=e=>e===Object(e)&&!_s(e),Eb=e=>{if(Ps(e)){for(var t in e)if(M_e.call(e,t))return!1;return!0}return!1},Yt=e=>e===void 0,ca=e=>j3.call(e)=="[object String]",Kq=e=>ca(e)&&e.trim().length===0,nm=e=>e===null,fi=e=>Yt(e)||nm(e),al=e=>j3.call(e)=="[object Number]",rp=e=>j3.call(e)==="[object Boolean]",gHe=e=>e instanceof FormData,mHe=e=>wr(fHe,e),j_e=e=>{var t={_log:function(n){if(Ve&&(Zf.DEBUG||er.POSTHOG_DEBUG)&&!Yt(Ve.console)&&Ve.console){for(var r=("__rrweb_original__"in Ve.console[n])?Ve.console[n].__rrweb_original__:Ve.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=>j_e("".concat(e," ").concat(n))};return t},bn=j_e("[PostHog.js]"),Uo=bn.createLogger,vHe=Uo("[ExternalScriptsLoader]"),Dre=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return vHe.warn("".concat(t," was requested but loading of external scripts is disabled.")),n("Loading of external scripts is disabled");var r=ln?.querySelectorAll("script");if(r){for(var i=0;i<r.length;i++)if(r[i].src===t)return n()}var s=()=>{if(!ln)return n("document not found");var a=ln.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=ln.querySelectorAll("body > script");l.length>0?(o=l[0].parentNode)===null||o===void 0||o.insertBefore(a,l[0]):ln.body.appendChild(a)};ln!=null&&ln.body?s():ln?.addEventListener("DOMContentLoaded",s)};function Nre(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 et(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Nre(Object(n),!0).forEach(function(r){Nt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Nre(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Nt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function L_e(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}er.__PosthogExtensions__=er.__PosthogExtensions__||{},er.__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);Dre(e,a,n)},er.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);Dre(e,r,n)};var WR={};function yg(e,t,n){if(_s(e)){if(Qre&&e.forEach===Qre)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)===WR)return}}}function _i(e,t,n){if(!fi(e)){if(_s(e))return yg(e,t,n);if(gHe(e)){for(var r of e.entries())if(t.call(n,r[1],r[0])===WR)return}else for(var i in e)if(M_e.call(e,i)&&t.call(n,e[i],i)===WR)return}}var Fs=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 yg(n,function(i){for(var s in i)i[s]!==void 0&&(e[s]=i[s])}),e},_Q=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 yg(n,function(i){yg(i,function(s){e.push(s)})}),e};function PQ(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 Xre=function(e){try{return e()}catch{return}},yHe=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){bn.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),bn.critical(i)}}},sT=function(e){var t={};return _i(e,function(n,r){ca(n)&&n.length>0&&(t[r]=n)}),t};function bHe(e,t){return n=e,r=s=>ca(s)&&!nm(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),_s(a)?(l=[],yg(a,c=>{l.push(s(c))})):(l={},_i(a,(c,u)=>{i.has(c)||(l[u]=s(c,u))})),l);var l}(n);var n,r,i}var wHe=["herokuapp.com","vercel.app","netlify.app"];function xHe(e){var t=e?.hostname;if(!ca(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of wHe)if(n===r)return!1;return!0}function q_e(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function Ls(e,t,n,r){var{capture:i=!1,passive:s=!0}=r??{};e?.addEventListener(t,n,{capture:i,passive:s})}var z_e="$people_distinct_id",v$="__alias",y$="__timers",Ire="$autocapture_disabled_server_side",Jq="$heatmaps_enabled_server_side",Fre="$exception_capture_enabled_server_side",Mre="$web_vitals_enabled_server_side",U_e="$dead_clicks_enabled_server_side",jre="$web_vitals_allowed_metrics",ez="$session_recording_enabled_server_side",Lre="$console_log_recording_enabled_server_side",qre="$session_recording_network_payload_capture",zre="$session_recording_masking",Ure="$session_recording_canvas_recording",Wre="$replay_sample_rate",Gre="$replay_minimum_duration",Vre="$replay_script_config",GR="$sesid",b$="$session_is_sampled",HX="$session_recording_url_trigger_activated_session",KX="$session_recording_event_trigger_activated_session",Qb="$enabled_feature_flags",CQ="$early_access_features",tz="$feature_flag_details",w$="$stored_person_properties",Jm="$stored_group_properties",nz="$surveys",Z2="$surveys_activated",VR="$flag_call_reported",qf="$user_state",rz="$client_session_props",iz="$capture_rate_limit",sz="$initial_campaign_params",az="$initial_referrer_info",oz="$initial_person_info",BR="$epp",W_e="__POSTHOG_TOOLBAR__",Bre="$posthog_cookieless",SHe=[z_e,v$,"__cmpns",y$,ez,Jq,GR,Qb,qf,CQ,tz,Jm,w$,nz,VR,rz,iz,sz,az,BR];function Yre(e){var t;return e instanceof Element&&(e.id===W_e||!((t=e.closest)===null||t===void 0||!t.call(e,".toolbar-global-fade-container")))}function L3(e){return!!e&&e.nodeType===1}function bg(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function G_e(e){return!!e&&e.nodeType===3}function V_e(e){return!!e&&e.nodeType===11}function jY(e){return e?M3(e).split(/\s+/):[]}function Zre(e){var t=Ve?.location.href;return!!(t&&e&&e.some(n=>t.match(n)))}function YR(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 jY(t)}function B_e(e){return fi(e)?null:M3(e).split(/(\s+)/).filter(t=>U1(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function q3(e){var t="";return cz(e)&&!H_e(e)&&e.childNodes&&e.childNodes.length&&_i(e.childNodes,function(n){var r;G_e(n)&&n.textContent&&(t+=(r=B_e(n.textContent))!==null&&r!==void 0?r:"")}),M3(t)}function Y_e(e){return Yt(e.target)?e.srcElement||null:(t=e.target)!==null&&t!==void 0&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var lz=["a","button","form","input","select","textarea","label"];function Z_e(e){var t=e.parentNode;return!(!t||!L3(t))&&t}function $He(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(!Ve||!e||bg(e,"html")||!L3(e)||n!=null&&n.url_allowlist&&!Zre(n.url_allowlist)||n!=null&&n.url_ignorelist&&Zre(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&&!bg(c,"body");)if(V_e(c.parentNode))o.push(c.parentNode.host),c=c.parentNode.host;else{if(!(l=Z_e(c)))break;if(r||lz.indexOf(l.tagName.toLowerCase())>-1)a=!0;else{var u=Ve.getComputedStyle(l);u&&u.getPropertyValue("cursor")==="pointer"&&(a=!0)}o.push(l),c=l}if(!function(f,O){var g=O?.element_allowlist;if(Yt(g))return!0;var m=function(w){if(g.some(k=>w.tagName.toLowerCase()===k))return{v:!0}};for(var v of f){var y=m(v);if(typeof y=="object")return y.v}return!1}(o,n)||!function(f,O){var g=O?.css_selector_allowlist;if(Yt(g))return!0;var m=function(w){if(g.some(k=>w.matches(k)))return{v:!0}};for(var v of f){var y=m(v);if(typeof y=="object")return y.v}return!1}(o,n))return!1;var d=Ve.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&&(lz.indexOf(h)>-1||e.getAttribute("contenteditable")==="true")}}function cz(e){for(var t=e;t.parentNode&&!bg(t,"body");t=t.parentNode){var n=YR(t);if(wr(n,"ph-sensitive")||wr(n,"ph-no-capture"))return!1}if(wr(YR(e),"ph-include"))return!0;var r=e.type||"";if(ca(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=e.name||e.id||"";return!(ca(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 H_e(e){return!!(bg(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||bg(e,"select")||bg(e,"textarea")||e.getAttribute("contenteditable")==="true")}var K_e="(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})",kHe=new RegExp("^(?:".concat(K_e,")$")),THe=new RegExp(K_e),J_e="\\d{3}-?\\d{2}-?\\d{4}",_He=new RegExp("^(".concat(J_e,")$")),PHe=new RegExp("(".concat(J_e,")"));function U1(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(fi(e)||ca(e)&&(e=M3(e),(t?kHe:THe).test((e||"").replace(/[- ]/g,""))||(t?_He:PHe).test(e)))}function ePe(e){var t=q3(e);return U1(t="".concat(t," ").concat(tPe(e)).trim())?t:""}function tPe(e){var t="";return e&&e.childNodes&&e.childNodes.length&&_i(e.childNodes,function(n){var r;if(n&&((r=n.tagName)===null||r===void 0?void 0:r.toLowerCase())==="span")try{var i=q3(n);t="".concat(t," ").concat(i).trim(),n.childNodes&&n.childNodes.length&&(t="".concat(t," ").concat(tPe(n)).trim())}catch(s){bn.error("[AutoCapture]",s)}}),t}function CHe(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=et(et(et(et({},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 PQ(l).sort((u,d)=>{var[h]=u,[f]=d;return h.localeCompare(f)}).forEach(u=>{var[d,h]=u;return c[Hre(d.toString())]=Hre(h.toString())}),a+=":",a+=PQ(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:EHe(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return PQ(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 Hre(e){return e.replace(/"|\\"/g,'\\"')}function EHe(e){var t=e.attr__class;return t?_s(t)?t:jY(t):void 0}class nPe{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 QHe=["localhost","127.0.0.1"],Hb=e=>{var t=ln?.createElement("a");return Yt(t)?null:(t.href=e,t)},RHe=function(e){var t,n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",i=[];return _i(e,function(s,a){Yt(s)||Yt(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)},ZR=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(!_s(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch{bn.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},JX=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("=");_s(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},HR=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},Kre=Uo("[AutoCapture]");function e6(e,t){return t.length>e?t.slice(0,e)+"...":t}function AHe(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!L3(t));return t}function DHe(e,t,n,r){var i=e.tagName.toLowerCase(),s={tag_name:i};lz.indexOf(i)>-1&&!n&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?s.$el_text=e6(1024,ePe(e)):s.$el_text=e6(1024,q3(e)));var a=YR(e);a.length>0&&(s.classes=a.filter(function(u){return u!==""})),_i(e.attributes,function(u){var d;if((!H_e(e)||["name","id","class","aria-label"].indexOf(u.name)!==-1)&&(r==null||!r.includes(u.name))&&!t&&U1(u.value)&&(d=u.name,!ca(d)||d.substring(0,10)!=="_ngcontent"&&d.substring(0,7)!=="_nghost")){var h=u.value;u.name==="class"&&(h=jY(h).join(" ")),s["attr__"+u.name]=e6(1024,h)}});for(var o=1,l=1,c=e;c=AHe(c);)o++,c.tagName===e.tagName&&l++;return s.nth_child=o,s.nth_of_type=l,s}function NHe(e,t){for(var n,r,{e:i,maskAllElementAttributes:s,maskAllText:a,elementAttributeIgnoreList:o,elementsChainAsString:l}=t,c=[e],u=e;u.parentNode&&!bg(u,"body");)V_e(u.parentNode)?(c.push(u.parentNode.host),u=u.parentNode.host):(c.push(u.parentNode),u=u.parentNode);var d,h=[],f={},O=!1,g=!1;if(_i(c,k=>{var x=cz(k);k.tagName.toLowerCase()==="a"&&(O=k.getAttribute("href"),O=x&&O&&U1(O)&&O),wr(YR(k),"ph-no-capture")&&(g=!0),h.push(DHe(k,s,a,o));var S=function(T){if(!cz(T))return{};var _={};return _i(T.attributes,function(P){if(P.name&&P.name.indexOf("data-ph-capture-attribute")===0){var E=P.name.replace("data-ph-capture-attribute-",""),C=P.value;E&&C&&U1(C)&&(_[E]=C)}}),_}(k);Fs(f,S)}),g)return{props:{},explicitNoCapture:g};if(a||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?h[0].$el_text=ePe(e):h[0].$el_text=q3(e)),O){var m,v;h[0].attr__href=O;var y=(m=Hb(O))===null||m===void 0?void 0:m.host,w=Ve==null||(v=Ve.location)===null||v===void 0?void 0:v.host;y&&w&&y!==w&&(d=O)}return{props:Fs({$event_type:i.type,$ce_version:1},l?{}:{$elements:h},{$elements_chain:CHe(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 XHe=class{constructor(t){Nt(this,"_initialized",!1),Nt(this,"_isDisabledServerSide",null),Nt(this,"rageclicks",new nPe),Nt(this,"_elementsChainAsString",!1),this.instance=t,this._elementSelectors=null}get config(){var t,n,r=Ps(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(Ve&&ln){var t=r=>{r=r||Ve?.event;try{this._captureEvent(r)}catch(i){Kre.error("Failed to capture event",i)}};if(Ls(ln,"submit",t,{capture:!0}),Ls(ln,"change",t,{capture:!0}),Ls(ln,"click",t,{capture:!0}),this.config.capture_copied_text){var n=r=>{r=r||Ve?.event,this._captureEvent(r,ZX)};Ls(ln,"copy",n,{capture:!0}),Ls(ln,"cut",n,{capture:!0})}}}else Kre.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({[Ire]:!!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=ln?.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[Ire],i=this._isDisabledServerSide;if(nm(i)&&!rp(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=Y_e(t);G_e(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===ZX;if(i&&$He(i,t,this.config,s,s?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:o}=NHe(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===ZX){var c,u=B_e(Ve==null||(c=Ve.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 Sd(ln?.querySelectorAll)}};Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return al(e)&&isFinite(e)&&Math.floor(e)===e});var Jre="0123456789abcdef";let IHe=class uz{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 uz(s)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+Jre.charAt(this.bytes[n]>>>4)+Jre.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 uz(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}},FHe=class{constructor(){Nt(this,"timestamp",0),Nt(this,"counter",0),Nt(this,"random",new MHe)}generate(){var t=this.generateOrAbort();if(Yt(t)){this.timestamp=0;var n=this.generateOrAbort();if(Yt(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 IHe.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 eie,rPe=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};Ve&&!Yt(Ve.crypto)&&crypto.getRandomValues&&(rPe=e=>crypto.getRandomValues(e));let MHe=class{constructor(){Nt(this,"buffer",new Uint32Array(8)),Nt(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(rPe(this.buffer),this.cursor=0),this.buffer[this.cursor++]}};var eg=()=>jHe().toString(),jHe=()=>(eie||(eie=new FHe)).generate(),LHe="Thu, 01 Jan 1970 00:00:00 GMT",sS="",qHe=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function zHe(e,t){if(t){var n=function(i){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ln;if(sS)return sS;if(!s||["localhost","127.0.0.1"].includes(i))return"";for(var a=i.split("."),o=Math.min(a.length,8),l="dmn_chk_"+eg(),c=new RegExp("(^|;)\\s*"+l+"=1");!sS&&o--;){var u=a.slice(o).join("."),d=l+"=1;domain=."+u;s.cookie=d,c.test(s.cookie)&&(s.cookie=d+";expires="+LHe,sS=u)}return sS}(e);if(!n){var r=(i=>{var s=i.match(qHe);return s?s[0]:""})(e);r!==n&&bn.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var LO,mp={is_supported:()=>!!ln,error:function(e){bn.error("cookieStore error: "+e)},get:function(e){if(ln){try{for(var t=e+"=",n=ln.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(mp.get(e))||{}}catch{}return t},set:function(e,t,n,r,i){if(ln)try{var s="",a="",o=zHe(ln.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&&bn.warn("cookieStore warning: large cookie, len="+c.length),ln.cookie=c,c}catch{return}},remove:function(e,t){try{mp.set(e,"",-1,t)}catch{return}}},t6=null,ga={is_supported:function(){if(!nm(t6))return t6;var e=!0;if(Yt(Ve))e=!1;else try{var t="__mplssupport__";ga.set(t,"xyz"),ga.get(t)!=='"xyz"'&&(e=!1),ga.remove(t)}catch{e=!1}return e||bn.error("localStorage unsupported; falling back to cookie store"),t6=e,e},error:function(e){bn.error("localStorage error: "+e)},get:function(e){try{return Ve?.localStorage.getItem(e)}catch(t){ga.error(t)}return null},parse:function(e){try{return JSON.parse(ga.get(e))||{}}catch{}return null},set:function(e,t){try{Ve?.localStorage.setItem(e,JSON.stringify(t))}catch(n){ga.error(n)}},remove:function(e){try{Ve?.localStorage.removeItem(e)}catch(t){ga.error(t)}}},UHe=["distinct_id",GR,b$,BR,oz],H2=et(et({},ga),{},{parse:function(e){try{var t={};try{t=mp.parse(e)||{}}catch{}var n=Fs(t,JSON.parse(ga.get(e)||"{}"));return ga.set(e,n),n}catch{}return null},set:function(e,t,n,r,i,s){try{ga.set(e,t,void 0,void 0,s);var a={};UHe.forEach(o=>{t[o]&&(a[o]=t[o])}),Object.keys(a).length&&mp.set(e,a,n,r,i,s)}catch(o){ga.error(o)}},remove:function(e,t){try{Ve?.localStorage.removeItem(e),mp.remove(e,t)}catch(n){ga.error(n)}}}),K2={},WHe={is_supported:function(){return!0},error:function(e){bn.error("memoryStorage error: "+e)},get:function(e){return K2[e]||null},parse:function(e){return K2[e]||null},set:function(e,t){K2[e]=t},remove:function(e){delete K2[e]}},Qm=null,no={is_supported:function(){if(!nm(Qm))return Qm;if(Qm=!0,Yt(Ve))Qm=!1;else try{var e="__support__";no.set(e,"xyz"),no.get(e)!=='"xyz"'&&(Qm=!1),no.remove(e)}catch{Qm=!1}return Qm},error:function(e){bn.error("sessionStorage error: ",e)},get:function(e){try{return Ve?.sessionStorage.getItem(e)}catch(t){no.error(t)}return null},parse:function(e){try{return JSON.parse(no.get(e))||null}catch{}return null},set:function(e,t){try{Ve?.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){no.error(n)}},remove:function(e){try{Ve?.sessionStorage.removeItem(e)}catch(t){no.error(t)}}};(function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"})(LO||(LO={}));let GHe=class{constructor(t){this.instance=t}get config(){return this.instance.config}get consent(){return this.getDnt()?LO.DENIED:this.storedConsent}isOptedOut(){return this.consent===LO.DENIED||this.consent===LO.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"?LO.GRANTED:t==="0"?LO.DENIED:LO.PENDING}get storage(){if(!this._storage){var t=this.config.opt_out_capturing_persistence_type;this._storage=t==="localStorage"?ga:mp;var n=t==="localStorage"?mp:ga;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&&!!q_e([kc?.doNotTrack,kc?.msDoNotTrack,er.doNotTrack],t=>wr([!0,1,"1","yes"],t))}};var J2=Uo("[Dead Clicks]"),VHe=()=>!0,BHe=e=>{var t,n=!((t=e.instance.persistence)===null||t===void 0||!t.get_property(U_e)),r=e.instance.config.capture_dead_clicks;return rp(r)?r:n};let iPe=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({[U_e]:t?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript(()=>{this.start()})}loadScript(t){var n,r,i;(n=er.__PosthogExtensions__)!==null&&n!==void 0&&n.initDeadClicksAutocapture&&t(),(r=er.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"dead-clicks-autocapture",s=>{s?J2.error("failed to load script",s):t()})}start(){var t;if(ln){if(!this._lazyLoadedDeadClicksAutocapture&&(t=er.__PosthogExtensions__)!==null&&t!==void 0&&t.initDeadClicksAutocapture){var n=Ps(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=er.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this._lazyLoadedDeadClicksAutocapture.start(ln),J2.info("starting...")}}else J2.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,J2.info("stopping..."))}};var n6=Uo("[ExceptionAutocapture]");let YHe=class{constructor(t){var n;Nt(this,"startCapturing",()=>{var r;if(Ve&&this.isEnabled&&(r=er.__PosthogExtensions__)!==null&&r!==void 0&&r.errorWrappingFunctions){var i=er.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,s=er.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,a=er.__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){n6.error("failed to start",o),this.stopCapturing()}}}),this.instance=t,this.remoteEnabled=!((n=this.instance.persistence)===null||n===void 0||!n.props[Fre]),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 Ps(t)?n=et(et({},n),t):(Yt(t)?this.remoteEnabled:t)&&(n=et(et({},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&&(n6.info("enabled"),this.loadScript(this.startCapturing))}loadScript(t){var n,r,i;(n=er.__PosthogExtensions__)!==null&&n!==void 0&&n.errorWrappingFunctions&&t(),(r=er.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"exception-autocapture",s=>{if(s)return n6.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({[Fre]: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 sPe(e){return!Yt(Event)&&aPe(e,Event)}function aPe(e,t){try{return e instanceof t}catch{return!1}}function EQ(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function r6(e){return EQ(e,"DOMError")}var tie=/\(error: (.*)\)/,nie=50,Rb="?";function i6(e,t,n,r){var i={platform:"web:javascript",filename:e,function:t==="<anonymous>"?Rb:t,in_app:!0};return Yt(n)||(i.lineno=n),Yt(r)||(i.colno=r),i}var ZHe=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,HHe=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,KHe=/\((\S*)(?::(\d+))(?::(\d+))\)/,JHe=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,eKe=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,tKe=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=tie.test(c)?c.replace(tie,"$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>=nie)break}}}return function(f){if(!f.length)return[];var O=Array.from(f);return O.reverse(),O.slice(0,nie).map(g=>et(et({},g),{},{filename:g.filename||nKe(O).filename,function:g.function||Rb}))}(a)}}([30,e=>{var t=ZHe.exec(e);if(t){var[,n,r,i]=t;return i6(n,Rb,+r,+i)}var s=HHe.exec(e);if(s){if(s[2]&&s[2].indexOf("eval")===0){var a=KHe.exec(s[2]);a&&(s[2]=a[1],s[3]=a[2],s[4]=a[3])}var[o,l]=iie(s[1]||Rb,s[2]);return i6(l,o,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}}],[50,e=>{var t=JHe.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=eKe.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]||Rb;return[i,r]=iie(i,r),i6(r,i,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]);function nKe(e){return e[e.length-1]||{}}var eC,rie,s6,iie=(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]:Rb,n?"safari-extension:".concat(t):"safari-web-extension:".concat(t)]:[e,t]},rKe=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function LY(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=e.stacktrace||e.stack||"",r=function(a){return a&&iKe.test(a.message)?1:0}(e);try{var i=tKe,s=function(a,o){var l=function(c){var u=globalThis._posthogChunkIds;if(!u)return{};var d=Object.keys(u);return s6&&d.length===rie||(rie=d.length,s6=d.reduce((h,f)=>{eC||(eC={});var O=eC[f];if(O)h[O[0]]=O[1];else for(var g=c(f),m=g.length-1;m>=0;m--){var v=g[m],y=v?.filename,w=u[f];if(y&&w){h[y]=w,eC[f]=[y,w];break}}return h},{})),s6}(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 iKe=/Minified React error #\d+;/i;function a6(e,t){var n,r,i=LY(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 o6(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=LY(t.syntheticException,1);l.length&&(o.stacktrace={frames:l,type:"raw"})}return{$exception_list:[o],$exception_level:"error"}}function sKe(e){return ca(e)&&!Kq(e)&&pHe.indexOf(e)>=0}function aKe(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:sPe(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 O=h.slice(0,f).join(", ");if(!(O.length>d))return f===h.length||O.length<=d?O:"".concat(O.slice(0,d),"...")}return""}(e)),l={type:a,value:o,mechanism:{handled:i,synthetic:s}};if(t!=null&&t.syntheticException){var c=LY(t?.syntheticException,1);c.length&&(l.stacktrace={frames:c,type:"raw"})}return{$exception_list:[l],$exception_level:sKe(e.level)?e.level:"error"}}function oKe(e,t){var{error:n,event:r}=e,i={$exception_list:[]},s=n||r;if(r6(s)||function(f){return EQ(f,"DOMException")}(s)){var a=s;if(function(f){return"stack"in f}(s))i=a6(s,t);else{var o=a.name||(r6(a)?"DOMError":"DOMException"),l=a.message?"".concat(o,": ").concat(a.message):o,c=r6(a)?"DOMError":"DOMException";i=o6(l,et(et({},t),{},{overrideExceptionType:c,defaultExceptionMessage:l}))}return"code"in a&&(i.$exception_DOMException_code="".concat(a.code)),i}if(function(f){return EQ(f,"ErrorEvent")}(s)&&s.error)return a6(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 aPe(f,Error)}}(s))return a6(s,t);if(function(f){return EQ(f,"Object")}(s)||sPe(s))return aKe(s,t);if(Yt(n)&&ca(r)){var u="Error",d=r,h=r.match(rKe);return h&&(u=h[1],d=h[2]),o6(d,et(et({},t),{},{overrideExceptionType:u,defaultExceptionMessage:d}))}return o6(s,t)}function KR(e){var t,n;return((t=JSON.stringify(e,(n=[],function(r,i){if(Ps(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 dz(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[dz({size:KR(r),data:r,sessionId:e.sessionId,windowId:e.windowId}),dz({size:KR(i),data:i,sessionId:e.sessionId,windowId:e.windowId})].flatMap(s=>s)}return[e]}var zf=(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))(zf||{}),sd=(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))(sd||{}),hz="[SessionRecording]",fz="redacted",tC={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"]},lKe=["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"],cKe=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],uKe=["/s/","/e/","/i/"];function sie(e,t,n,r){if(fi(e))return e;var i=t?.["content-length"]||function(s){return new Blob([s]).size}(e);return ca(i)&&(i=parseInt(i)),i>n?hz+" ".concat(r," body too large to record (").concat(i," bytes)"):e}function aie(e,t){if(fi(e))return e;var n=e;return U1(n,!1)||(n=hz+" "+t+" body "+fz),_i(cKe,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=hz+" "+t+" body "+fz+" as might contain: "+r)}),n}var dKe=(e,t)=>{var n,r,i,s={payloadSizeLimitBytes:tC.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...tC.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...tC.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=sie(h.requestBody,h.requestHeaders,i,"Request")),h!=null&&h.responseBody&&(h.responseBody=sie(h.responseBody,h.responseHeaders,i,"Response")),h)),u=h=>{return c(((g,m)=>{var v,y=Hb(g.name),w=m.indexOf("http")===0?(v=Hb(m))===null||v===void 0?void 0:v.pathname:m;w==="/"&&(w="");var k=y?.pathname.replace(w||"","");if(!(y&&k&&uKe.some(x=>k.indexOf(x)===0)))return g})((O=(f=h).requestHeaders,fi(O)||_i(Object.keys(O??{}),g=>{lKe.includes(g.toLowerCase())&&(O[g]=fz)}),f),e.api_host));var f,O},d=Sd(e.session_recording.maskNetworkRequestFn);return d&&Sd(e.session_recording.maskCapturedNetworkRequestFn)&&bn.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 et(et({},h),{},{name:f?.url})}),s.maskRequestFn=Sd(e.session_recording.maskCapturedNetworkRequestFn)?h=>{var f,O,g,m=u(h);return m&&(f=(O=(g=e.session_recording).maskCapturedNetworkRequestFn)===null||O===void 0?void 0:O.call(g,m))!==null&&f!==void 0?f:void 0}:h=>function(f){if(!Yt(f))return f.requestBody=aie(f.requestBody,"Request"),f.responseBody=aie(f.responseBody,"Response"),f}(u(h)),et(et(et({},tC),s),{},{recordHeaders:a,recordBody:o,recordPerformance:l,recordInitialRequests:l})};function gu(e,t,n,r,i){return t>n&&(bn.warn("min cannot be greater than max."),t=n),al(e)?e>n?(r&&bn.warn(r+" cannot be greater than max: "+n+". Using max value instead."),n):e<t?(r&&bn.warn(r+" cannot be less than min: "+t+". Using min value instead."),t):e:(r&&bn.warn(r+" must be a number. using max or fallback. max: "+n+", fallback: "+i),gu(i||n,t,n,r))}let hKe=class{constructor(t){var n,r,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Nt(this,"bucketSize",100),Nt(this,"refillRate",10),Nt(this,"mutationBuckets",{}),Nt(this,"loggedTracker",{}),Nt(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]})}),Nt(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]}),Nt(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)}),Nt(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,O]=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,O))),c)}));var l=this.numberOfChanges(a);return l!==0||o===l?s:void 0}),this.rrweb=t,this.options=i,this.refillRate=gu((n=this.options.refillRate)!==null&&n!==void 0?n:this.refillRate,0,100,"mutation throttling refill rate"),this.bucketSize=gu((r=this.options.bucketSize)!==null&&r!==void 0?r:this.bucketSize,0,100,"mutation throttling bucket size"),setInterval(()=>{this.refillBuckets()},1e3)}};var ku=Uint8Array,Dl=Uint16Array,W1=Uint32Array,qY=new ku([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]),zY=new ku([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]),oie=new ku([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),oPe=function(e,t){for(var n=new Dl(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new W1(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]},lPe=oPe(qY,2),fKe=lPe[0],pz=lPe[1];fKe[28]=258,pz[258]=28;for(var lie=oPe(zY,0)[1],cPe=new Dl(32768),Ui=0;Ui<32768;++Ui){var Rm=(43690&Ui)>>>1|(21845&Ui)<<1;Rm=(61680&(Rm=(52428&Rm)>>>2|(13107&Rm)<<2))>>>4|(3855&Rm)<<4,cPe[Ui]=((65280&Rm)>>>8|(255&Rm)<<8)>>>1}var Z$=function(e,t,n){for(var r=e.length,i=0,s=new Dl(t);i<r;++i)++s[e[i]-1];var a,o=new Dl(t);for(i=0;i<t;++i)o[i]=o[i-1]+s[i-1]<<1;for(a=new Dl(r),i=0;i<r;++i)a[i]=cPe[o[e[i]-1]++]>>>15-e[i];return a},lv=new ku(288);for(Ui=0;Ui<144;++Ui)lv[Ui]=8;for(Ui=144;Ui<256;++Ui)lv[Ui]=9;for(Ui=256;Ui<280;++Ui)lv[Ui]=7;for(Ui=280;Ui<288;++Ui)lv[Ui]=8;var JR=new ku(32);for(Ui=0;Ui<32;++Ui)JR[Ui]=5;var pKe=Z$(lv,9),OKe=Z$(JR,5),uPe=function(e){return(e/8>>0)+(7&e&&1)},dPe=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof Dl?Dl:e instanceof W1?W1:ku)(n-t);return r.set(e.subarray(t,n)),r},Tf=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},aS=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},l6=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 ku(0),0];if(i==1){var a=new ku(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 Dl(h+1),O=Oz(n[u-1],f,0);if(O>t){r=0;var g=0,m=O-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 y=s[r].s;if(!(f[y]>t))break;g+=v-(1<<O-f[y]),f[y]=t}for(g>>>=m;g>0;){var w=s[r].s;f[w]<t?g-=1<<t-f[w]++-1:++r}for(;r>=0&&g;--r){var k=s[r].s;f[k]==t&&(--f[k],++g)}O=t}return[new ku(f),O]},Oz=function(e,t,n){return e.s==-1?Math.max(Oz(e.l,t,n+1),Oz(e.r,t,n+1)):t[e.s]=n},cie=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Dl(++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]},oS=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},gz=function(e,t,n){var r=n.length,i=uPe(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)},uie=function(e,t,n,r,i,s,a,o,l,c,u){Tf(t,u++,n),++i[256];for(var d=l6(i,15),h=d[0],f=d[1],O=l6(s,15),g=O[0],m=O[1],v=cie(h),y=v[0],w=v[1],k=cie(g),x=k[0],S=k[1],T=new Dl(19),_=0;_<y.length;++_)T[31&y[_]]++;for(_=0;_<x.length;++_)T[31&x[_]]++;for(var P=l6(T,7),E=P[0],C=P[1],Q=19;Q>4&&!E[oie[Q-1]];--Q);var D,F,I,U,q=c+5<<3,Z=oS(i,lv)+oS(s,JR)+a,W=oS(i,h)+oS(s,g)+a+14+3*Q+oS(T,E)+(2*T[16]+3*T[17]+7*T[18]);if(q<=Z&&q<=W)return gz(t,u,e.subarray(l,l+c));if(Tf(t,u,1+(W<Z)),u+=2,W<Z){D=Z$(h,f),F=h,I=Z$(g,m),U=g;var M=Z$(E,C);for(Tf(t,u,w-257),Tf(t,u+5,S-1),Tf(t,u+10,Q-4),u+=14,_=0;_<Q;++_)Tf(t,u+3*_,E[oie[_]]);u+=3*Q;for(var J=[y,x],L=0;L<2;++L){var N=J[L];for(_=0;_<N.length;++_){var z=31&N[_];Tf(t,u,M[z]),u+=E[z],z>15&&(Tf(t,u,N[_]>>>5&127),u+=N[_]>>>12)}}}else D=pKe,F=lv,I=OKe,U=JR;for(_=0;_<o;++_)if(r[_]>255){z=r[_]>>>18&31,aS(t,u,D[z+257]),u+=F[z+257],z>7&&(Tf(t,u,r[_]>>>23&31),u+=qY[z]);var V=31&r[_];aS(t,u,I[V]),u+=U[V],V>3&&(aS(t,u,r[_]>>>5&8191),u+=zY[V])}else aS(t,u,D[r[_]]),u+=F[r[_]];return aS(t,u,D[256]),u+F[256]},gKe=new W1([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),mKe=function(){for(var e=new W1(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),vKe=function(){var e=4294967295;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=mKe[255&n^t[r]]^n>>>8;e=n},d:function(){return 4294967295^e}}},yKe=function(e,t,n,r,i){return function(s,a,o,l,c,u){var d=s.length,h=new ku(l+d+5*(1+Math.floor(d/7e3))+c),f=h.subarray(l,h.length-c),O=0;if(!a||d<8)for(var g=0;g<=d;g+=65535){var m=g+65535;m<d?O=gz(f,O,s.subarray(g,m)):(f[g]=u,O=gz(f,O,s.subarray(g,d)))}else{for(var v=gKe[a-1],y=v>>>13,w=8191&v,k=(1<<o)-1,x=new Dl(32768),S=new Dl(k+1),T=Math.ceil(o/3),_=2*T,P=function(ye){return(s[ye]^s[ye+1]<<T^s[ye+2]<<_)&k},E=new W1(25e3),C=new Dl(288),Q=new Dl(32),D=0,F=0,I=(g=0,0),U=0,q=0;g<d;++g){var Z=P(g),W=32767&g,M=S[Z];if(x[W]=M,S[Z]=W,U<=g){var J=d-g;if((D>7e3||I>24576)&&J>423){O=uie(s,f,0,E,C,Q,F,I,q,g-q,O),I=D=F=0,q=g;for(var L=0;L<286;++L)C[L]=0;for(L=0;L<30;++L)Q[L]=0}var N=2,z=0,V=w,ee=W-M&32767;if(J>2&&Z==P(g-ee))for(var oe=Math.min(y,J)-1,ie=Math.min(32767,g),he=Math.min(258,J);ee<=ie&&--V&&W!=M;){if(s[g+N]==s[g+N-ee]){for(var te=0;te<he&&s[g+te]==s[g+te-ee];++te);if(te>N){if(N=te,z=ee,te>oe)break;var pe=Math.min(ee,te-2),B=0;for(L=0;L<pe;++L){var Pe=g-ee+L+32768&32767,Ce=Pe-x[Pe]+32768&32767;Ce>B&&(B=Ce,M=Pe)}}}ee+=(W=M)-(M=x[W])+32768&32767}if(z){E[I++]=268435456|pz[N]<<18|lie[z];var Ie=31&pz[N],Oe=31&lie[z];F+=qY[Ie]+zY[Oe],++C[257+Ie],++Q[Oe],U=g+N,++D}else E[I++]=s[g],++C[s[g]]}}O=uie(s,f,u,E,C,Q,F,I,q,g-q,O)}return dPe(h,0,l+uPe(O)+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)},mz=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},bKe=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&&mz(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)}},wKe=function(e){return 10+(e.filename&&e.filename.length+1||0)};function hPe(e,t){t===void 0&&(t={});var n=vKe(),r=e.length;n.p(e);var i=yKe(e,t,wKe(t),8),s=i.length;return bKe(i,t),mz(i,s-8,n.d()),mz(i,s-4,r),i}function fPe(e,t){var n=e.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(e);for(var r=new ku(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 ku(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 dPe(r,0,i)}function xKe(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<gu(100*t,0,100)}var x$="[SessionRecording]",mo=Uo(x$);function nC(){var e,t;return er==null||(e=er.__PosthogExtensions__)===null||e===void 0||(t=e.rrweb)===null||t===void 0?void 0:t.record}var SKe=3e5,$Ke=[sd.MouseMove,sd.MouseInteraction,sd.Scroll,sd.ViewportResize,sd.Input,sd.TouchMove,sd.MediaInteraction,sd.Drag],die=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function Am(e){return function(t,n){for(var r="",i=0;i<t.length;){var s=t[i++];r+=String.fromCharCode(s)}return r}(hPe(fPe(JSON.stringify(e))))}function hie(e){return e.type===zf.Custom&&e.data.tag==="sessionIdle"}function fie(e,t){return t.some(n=>n.matching==="regex"&&new RegExp(n.url).test(e))}let kKe=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(x$+" 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:SKe}get isSampled(){var t=this.instance.get_property(b$);return rp(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(ez),n=!this.instance.config.disable_session_recording;return Ve&&t&&n}get isConsoleLogCaptureEnabled(){var t=!!this.instance.get_property(Lre),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(Ure),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:gu(u,0,12,"canvas recording fps",4),quality:gu(d,0,1,"canvas recording quality",.4)}}get networkPayloadCapture(){var t,n,r=this.instance.get_property(qre),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=Ps(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,l=!!(rp(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(zre),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 Yt(c)&&Yt(u)&&Yt(d)?void 0:{maskAllInputs:c==null||c,maskTextSelector:u,blockSelector:d}}get sampleRate(){var t=this.instance.get_property(Wre);return al(t)?t:null}get minimumDuration(){var t=this.instance.get_property(Gre);return al(t)?t:null}get status(){return this.receivedDecide?this.isRecordingEnabled?this.isSampled===!1?"disabled":this._urlBlocked?"paused":fi(this._linkedFlag)||this._linkedFlagSeen?this.triggerStatus==="trigger_pending"?"buffering":rp(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(HX))===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(KX))===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(Nt(this,"queuedRRWebEvents",[]),Nt(this,"isIdle","unknown"),Nt(this,"_linkedFlagSeen",!1),Nt(this,"_lastActivityTimestamp",Date.now()),Nt(this,"_linkedFlag",null),Nt(this,"_removePageViewCaptureHook",void 0),Nt(this,"_onSessionIdListener",void 0),Nt(this,"_persistDecideOnSessionListener",void 0),Nt(this,"_samplingSessionListener",void 0),Nt(this,"_urlTriggers",[]),Nt(this,"_urlBlocklist",[]),Nt(this,"_urlBlocked",!1),Nt(this,"_eventTriggers",[]),Nt(this,"_removeEventTriggerCaptureHook",void 0),Nt(this,"_forceAllowLocalhostNetworkCapture",!1),Nt(this,"_onBeforeUnload",()=>{this._flushBuffer()}),Nt(this,"_onOffline",()=>{this._tryAddCustomEvent("browser offline",{})}),Nt(this,"_onOnline",()=>{this._tryAddCustomEvent("browser online",{})}),Nt(this,"_onVisibilityChange",()=>{if(ln!=null&&ln.visibilityState){var i="window "+ln.visibilityState;this._tryAddCustomEvent(i,{})}}),this.instance=t,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw mo.error("started without valid sessionManager"),new Error(x$+" started without valid sessionManager. This is a bug.");if(this.instance.config.__preview_experimental_cookieless_mode)throw new Error(x$+" 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&&mo.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),Ls(Ve,"beforeunload",this._onBeforeUnload),Ls(Ve,"offline",this._onOffline),Ls(Ve,"online",this._onOnline),Ls(Ve,"visibilitychange",this._onVisibilityChange),this._setupSampling(),this._addEventTriggerListener(),fi(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){mo.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(KX),(o=this.instance)===null||o===void 0||(l=o.persistence)===null||l===void 0||l.unregister(HX))}))):this.stopRecording()}stopRecording(){var t,n,r,i;this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,Ve?.removeEventListener("beforeunload",this._onBeforeUnload),Ve?.removeEventListener("offline",this._onOffline),Ve?.removeEventListener("online",this._onOnline),Ve?.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,mo.info("stopped"))}_resetSampling(){var t;(t=this.instance.persistence)===null||t===void 0||t.unregister(b$)}makeSamplingDecision(t){var n,r=this.sessionId!==t,i=this.sampleRate;if(al(i)){var s=this.isSampled,a=r||!rp(s),o=a?xKe(t,i):s;a&&(o?this._reportStarted("sampled"):mo.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({[b$]: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(),!fi(this._linkedFlag)&&!this._linkedFlagSeen){var l=ca(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,c=ca(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags((u,d)=>{var h=Ps(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(){al(this.sampleRate)&&fi(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,O=(s=t.sessionRecording)===null||s===void 0?void 0:s.sampleRate,g=fi(O)?null:parseFloat(O);fi(g)&&this._resetSampling();var m=(a=t.sessionRecording)===null||a===void 0?void 0:a.minimumDurationMilliseconds;r.register({[ez]:!!t.sessionRecording,[Lre]:(o=t.sessionRecording)===null||o===void 0?void 0:o.consoleLogRecordingEnabled,[qre]:et({capturePerformance:t.capturePerformance},(l=t.sessionRecording)===null||l===void 0?void 0:l.networkPayloadCapture),[zre]:(c=t.sessionRecording)===null||c===void 0?void 0:c.masking,[Ure]:{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},[Wre]:g,[Gre]:Yt(m)?null:m,[Vre]:(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(!Yt(Object.assign)&&!Yt(Array.from)&&!(this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut())){var n,r;this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),nC()?this._onScriptLoaded():(n=er.__PosthogExtensions__)===null||n===void 0||(r=n.loadExternalDependency)===null||r===void 0||r.call(n,this.instance,this.scriptName,i=>{if(i)return mo.error("could not load recorder",i);this._onScriptLoaded()}),mo.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(Vre))===null||r===void 0?void 0:r.script)||"recorder"}isInteractiveEvent(t){var n;return t.type===3&&$Ke.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}):mo.warn("could not emit queued rrweb event.",n,t),!1}}_tryAddCustomEvent(t,n){return this._tryRRWebMethod(die(()=>nC().addCustomEvent(t,n)))}_tryTakeFullSnapshot(){return this._tryRRWebMethod(die(()=>nC().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=et({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=nC();if(c){this.mutationRateLimiter=(t=this.mutationRateLimiter)!==null&&t!==void 0?t:new hKe(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");mo.info(f,{node:h}),this.log(x$+" "+f,"warn")}});var u=this._gatherRRWebPlugins();this.stopRrweb=c(et({emit:d=>{this.onRRwebEmit(d)},plugins:u},s)),this._lastActivityTimestamp=Date.now(),this.isIdle=rp(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 mo.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=er.__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=er.__PosthogExtensions__)===null||r===void 0||(i=r.rrwebPlugins)===null||i===void 0?void 0:i.getRecordNetworkPlugin;return this.networkPayloadCapture&&Sd(o)&&(!QHe.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?s.push(o(dKe(this.instance.config,this.networkPayloadCapture))):mo.info("NetworkCapture not started because we are on localhost.")),s}onRRwebEmit(t){var n;if(this._processQueuedEvents(),t&&Ps(t)){if(t.type===zf.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===zf.Custom&&d.data.tag==="recording paused"}(t)){t.type===zf.FullSnapshot&&this._scheduleFullSnapshot(),t.type===zf.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&&Ps(h)&&h.type===6&&Ps(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=[],O=0;O<h.data.payload.payload.length;O++)h.data.payload.payload[O]&&h.data.payload.payload[O].length>2e3?f.push(h.data.payload.payload[O].slice(0,2e3)+"...[truncated]"):f.push(h.data.payload.payload[O]);return h.data.payload.payload=f,d}return d}(i);if(this._updateWindowAndSessionIds(s),this.isIdle!==!0||hie(s)){if(hie(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(KR(d)<1024)return d;try{if(d.type===zf.FullSnapshot)return et(et({},d),{},{data:Am(d.data),cv:"2024-10"});if(d.type===zf.IncrementalSnapshot&&d.data.source===sd.Mutation)return et(et({},d),{},{cv:"2024-10",data:et(et({},d.data),{},{texts:Am(d.data.texts),attributes:Am(d.data.attributes),removes:Am(d.data.removes),adds:Am(d.data.adds)})});if(d.type===zf.IncrementalSnapshot&&d.data.source===sd.StyleSheetRule)return et(et({},d),{},{cv:"2024-10",data:et(et({},d.data),{},{adds:d.data.adds?Am(d.data.adds):void 0,removes:d.data.removes?Am(d.data.removes):void 0})})}catch(h){mo.error("could not compress event - will use uncompressed event",h)}return d}(s):s,u={$snapshot_bytes:KR(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&&Ve){var t=this._maskUrl(Ve.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=al(n)&&n>=0,i=al(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&&dz(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:Zf.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(Ve!==void 0&&Ve.location.href){var t=Ve.location.href,n=this._urlBlocked,r=fie(t,this._urlBlocklist);r&&!n?this._pauseRecording():!r&&n&&this._resumeRecording(),fie(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"?HX:KX]:this.sessionId}),this._flushBuffer(),this._reportStarted(t+"_trigger_matched"))}_pauseRecording(){this._urlBlocked||(this._urlBlocked=!0,clearInterval(this._fullSnapshotTimer),mo.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"}),mo.info("recording resumed"))}_addEventTriggerListener(){this._eventTriggers.length!==0&&fi(this._removeEventTriggerCaptureHook)&&(this._removeEventTriggerCaptureHook=this.instance.on("eventCaptured",t=>{try{this._eventTriggers.includes(t.event)&&this._activateTrigger("event")}catch(n){mo.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({[b$]:!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}),mo.info(t.replace("_"," "),n),wr(["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 c6=Uo("[SegmentIntegration]");function TKe(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()||eg();r.config.get_device_id=c,l.id()&&(r.register({distinct_id:l.id(),$device_id:c()}),r.persistence.set_property(qf,"identified")),i()},o=s.user();"then"in o&&Sd(o.then)?o.then(l=>a(l)):a(o)})(e,()=>{n.register((r=>{Promise&&Promise.resolve||c6.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()||(c6.info("No userId set, resetting PostHog"),r.reset()),s.event.userId&&s.event.userId!==r.get_distinct_id()&&(c6.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 pPe="posthog-js";function OPe(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=>et(et({},g),{},{stacktrace:g.stacktrace?et(et({},g.stacktrace),{},{type:"raw",frames:(g.stacktrace.frames||[]).map(m=>et(et({},m),{},{platform:"web:javascript"}))}):void 0})),O={$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&&(O.$sentry_url=(r||"https://sentry.io/organizations/")+t+"/issues/?project="+n+"&query="+s.event_id),e.exceptions.sendExceptionEvent(O),s}}let _Ke=class{constructor(t,n,r,i,s){this.name=pPe,this.setupOnce=function(a){a(OPe(t,{organization:n,projectId:r,prefix:i,severityAllowList:s}))}}};var Uf,PKe=Ve!=null&&Ve.location?HR(Ve.location.hash,"__posthog")||HR(location.hash,"state"):null,pie="_postHogToolbarParams",Oie=Uo("[Toolbar]");(function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"})(Uf||(Uf={}));class CKe{constructor(t){this.instance=t}setToolbarState(t){er.ph_toolbar_state=t}getToolbarState(){var t;return(t=er.ph_toolbar_state)!==null&&t!==void 0?t:Uf.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(!Ve||!ln)return!1;r=(t=r)!==null&&t!==void 0?t:Ve.location,s=(n=s)!==null&&n!==void 0?n:Ve.history;try{if(!i){try{Ve.localStorage.setItem("test","test"),Ve.localStorage.removeItem("test")}catch{return!1}i=Ve?.localStorage}var a,o=PKe||HR(r.hash,"__posthog")||HR(r.hash,"state"),l=o?Xre(()=>JSON.parse(atob(decodeURIComponent(o))))||Xre(()=>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(pie)||"{}")).source="localstorage",delete a.userIntent),!(!a.token||this.instance.config.token!==a.token)&&(this.loadToolbar(a),!0)}catch{return!1}}_callLoadToolbar(t){var n=er.ph_load_toolbar||er.ph_load_editor;!fi(n)&&Sd(n)?n(t,this.instance):Oie.warn("No toolbar load function found")}loadToolbar(t){var n=!(ln==null||!ln.getElementById(W_e));if(!Ve||n)return!1;var r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=et(et({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(Ve.localStorage.setItem(pie,JSON.stringify(et(et({},i),{},{source:void 0}))),this.getToolbarState()===Uf.LOADED)this._callLoadToolbar(i);else if(this.getToolbarState()===Uf.UNINITIALIZED){var s,a;this.setToolbarState(Uf.LOADING),(s=er.__PosthogExtensions__)===null||s===void 0||(a=s.loadExternalDependency)===null||a===void 0||a.call(s,this.instance,"toolbar",o=>{if(o)return Oie.error("[Toolbar] Failed to load",o),void this.setToolbarState(Uf.UNINITIALIZED);this.setToolbarState(Uf.LOADED),this._callLoadToolbar(i)}),Ls(Ve,"turbolinks:load",()=>{this.setToolbarState(Uf.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 EKe=Uo("[TracingHeaders]");class QKe{constructor(t){Nt(this,"_restoreXHRPatch",void 0),Nt(this,"_restoreFetchPatch",void 0),Nt(this,"_startCapturing",()=>{var n,r,i,s;Yt(this._restoreXHRPatch)&&((n=er.__PosthogExtensions__)===null||n===void 0||(r=n.tracingHeadersPatchFns)===null||r===void 0||r._patchXHR(this.instance.sessionManager)),Yt(this._restoreFetchPatch)&&((i=er.__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=er.__PosthogExtensions__)!==null&&n!==void 0&&n.tracingHeadersPatchFns&&t(),(r=er.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"tracing-headers",s=>{if(s)return EKe.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 bO=Uo("[Web Vitals]"),gie=9e5;class RKe{constructor(t){var n;Nt(this,"_enabledServerSide",!1),Nt(this,"_initialized",!1),Nt(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),Nt(this,"_flushToCapture",()=>{clearTimeout(this._delayedFlushTimer),this.buffer.metrics.length!==0&&(this.instance.capture("$web_vitals",this.buffer.metrics.reduce((r,i)=>et(et({},r),{},{["$web_vitals_".concat(i.name,"_event")]:et({},i),["$web_vitals_".concat(i.name,"_value")]:i.value}),{})),this.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})}),Nt(this,"_addToBuffer",r=>{var i,s=(i=this.instance.sessionManager)===null||i===void 0?void 0:i.checkAndGetSessionAndWindowId(!0);if(Yt(s))bO.error("Could not read session ID. Dropping metrics!");else{this.buffer=this.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var a=this._currentURL();Yt(a)||(fi(r?.name)||fi(r?.value)?bO.error("Invalid metric received",r):this._maxAllowedValue&&r.value>=this._maxAllowedValue?bO.error("Ignoring metric with value >= "+this._maxAllowedValue,r):(this.buffer.url!==a&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),Yt(this.buffer.url)&&(this.buffer.url=a),this.buffer.firstMetricTimestamp=Yt(this.buffer.firstMetricTimestamp)?Date.now():this.buffer.firstMetricTimestamp,r.attribution&&r.attribution.interactionTargetElement&&(r.attribution.interactionTargetElement=void 0),this.buffer.metrics.push(et(et({},r),{},{$current_url:a,$session_id:s.sessionId,$window_id:s.windowId,timestamp:Date.now()})),this.buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()))}}),Nt(this,"_startCapturing",()=>{var r,i,s,a,o=er.__PosthogExtensions__;Yt(o)||Yt(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):bO.error("web vitals callbacks not loaded - not starting")}),this.instance=t,this._enabledServerSide=!((n=this.instance.persistence)===null||n===void 0||!n.props[Mre]),this.startIfEnabled()}get allowedMetrics(){var t,n,r=Ps(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 Yt(r)?((n=this.instance.persistence)===null||n===void 0?void 0:n.props[jre])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(Ps(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){var t=Ps(this.instance.config.capture_performance)&&al(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:gie;return 0<t&&t<=6e4?gie:t}get isEnabled(){var t=Pl?.protocol;if(t!=="http:"&&t!=="https:")return bO.info("Web Vitals are disabled on non-http/https protocols"),!1;var n=Ps(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:rp(this.instance.config.capture_performance)?this.instance.config.capture_performance:void 0;return rp(n)?n:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(bO.info("enabled, starting..."),this.loadScript(this._startCapturing))}onRemoteConfig(t){var n=Ps(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=Ps(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this.instance.persistence&&(this.instance.persistence.register({[Mre]:n}),this.instance.persistence.register({[jre]:r})),this._enabledServerSide=n,this.startIfEnabled()}loadScript(t){var n,r,i;(n=er.__PosthogExtensions__)!==null&&n!==void 0&&n.postHogWebVitalsCallbacks&&t(),(r=er.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"web-vitals",s=>{s?bO.error("failed to load script",s):t()})}_currentURL(){var t=Ve?Ve.location.href:void 0;return t||bO.error("Could not determine current URL"),t}}var AKe=Uo("[Heatmaps]");function mie(e){return Ps(e)&&"clientX"in e&&"clientY"in e&&al(e.clientX)&&al(e.clientY)}class DKe{constructor(t){var n;Nt(this,"rageclicks",new nPe),Nt(this,"_enabledServerSide",!1),Nt(this,"_initialized",!1),Nt(this,"_flushInterval",null),this.instance=t,this._enabledServerSide=!((n=this.instance.persistence)===null||n===void 0||!n.props[Jq])}get flushIntervalMilliseconds(){var t=5e3;return Ps(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 Yt(this.instance.config.capture_heatmaps)?Yt(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;AKe.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({[Jq]: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(){Ve&&ln&&(Ls(Ve,"beforeunload",this.flush.bind(this)),Ls(ln,"click",t=>this._onClick(t||Ve?.event),{capture:!0}),Ls(ln,"mousemove",t=>this._onMouseMove(t||Ve?.event),{capture:!0}),this.deadClicksCapture=new iPe(this.instance,VHe,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&&L3(u)&&!bg(u,"body");){if(u===c)return!1;if(wr(l,Ve?.getComputedStyle(u).position))return!0;u=Z_e(u)}return!1}(Y_e(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(!Yre(t.target)&&mie(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(et(et({},i),{},{type:"rageclick"})),this._capture(i)}}_onMouseMove(t){!Yre(t.target)&&mie(t)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(t,"mousemove"))},500))}_capture(t){if(Ve){var n=Ve.location.href;this.buffer=this.buffer||{},this.buffer[n]||(this.buffer[n]=[]),this.buffer[n].push(t)}}flush(){this.buffer&&!Eb(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}let NKe=class{constructor(t){this._instance=t}doPageView(t,n){var r,i=this._previousPageViewProperties(t,n);return this._currentPageview={pathname:(r=Ve?.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(!(Yt(a)||Yt(o)||Yt(l)||Yt(c)||Yt(u)||Yt(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:gu(o/a,0,1),f=a<=1?1:gu(l/a,0,1),O=c<=1?1:gu(u/c,0,1),g=c<=1?1:gu(d/c,0,1);i=Fs(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:O,$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}},XKe=class{constructor(t){this.instance=t}sendExceptionEvent(t){this.instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent"})}};var Tu="Mobile",e5="iOS",Qh="Android",aT="Tablet",gPe=Qh+" "+aT,mPe="iPad",vPe="Apple",yPe=vPe+" Watch",oT="Safari",G1="BlackBerry",bPe="Samsung",wPe=bPe+"Browser",xPe=bPe+" Internet",cv="Chrome",IKe=cv+" OS",SPe=cv+" "+e5,UY="Internet Explorer",$Pe=UY+" "+Tu,WY="Opera",FKe=WY+" Mini",GY="Edge",kPe="Microsoft "+GY,Kb="Firefox",TPe=Kb+" "+e5,lT="Nintendo",cT="PlayStation",Jb="Xbox",_Pe=Qh+" "+Tu,PPe=Tu+" "+oT,S$="Windows",vz=S$+" Phone",vie="Nokia",yz="Ouya",CPe="Generic",MKe=CPe+" "+Tu.toLowerCase(),EPe=CPe+" "+aT.toLowerCase(),bz="Konqueror",Ko="(\\d+(\\.\\d+)?)",u6=new RegExp("Version/"+Ko),jKe=new RegExp(Jb,"i"),LKe=new RegExp(cT+" \\w+","i"),qKe=new RegExp(lT+" \\w+","i"),VY=new RegExp(G1+"|PlayBook|BB10","i"),zKe={"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"},wz,UKe=(e,t)=>t&&wr(t,vPe)||function(n){return wr(n,oT)&&!wr(n,cv)&&!wr(n,Qh)}(e),yie=function(e,t){return t=t||"",wr(e," OPR/")&&wr(e,"Mini")?FKe:wr(e," OPR/")?WY:VY.test(e)?G1:wr(e,"IE"+Tu)||wr(e,"WPDesktop")?$Pe:wr(e,wPe)?xPe:wr(e,GY)||wr(e,"Edg/")?kPe:wr(e,"FBIOS")?"Facebook "+Tu:wr(e,"UCWEB")||wr(e,"UCBrowser")?"UC Browser":wr(e,"CriOS")?SPe:wr(e,"CrMo")||wr(e,cv)?cv:wr(e,Qh)&&wr(e,oT)?_Pe:wr(e,"FxiOS")?TPe:wr(e.toLowerCase(),bz.toLowerCase())?bz:UKe(e,t)?wr(e,Tu)?PPe:oT:wr(e,Kb)?Kb:wr(e,"MSIE")||wr(e,"Trident/")?UY:wr(e,"Gecko")?Kb:""},WKe={[$Pe]:[new RegExp("rv:"+Ko)],[kPe]:[new RegExp(GY+"?\\/"+Ko)],[cv]:[new RegExp("("+cv+"|CrMo)\\/"+Ko)],[SPe]:[new RegExp("CriOS\\/"+Ko)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ko)],[oT]:[u6],[PPe]:[u6],[WY]:[new RegExp("(Opera|OPR)\\/"+Ko)],[Kb]:[new RegExp(Kb+"\\/"+Ko)],[TPe]:[new RegExp("FxiOS\\/"+Ko)],[bz]:[new RegExp("Konqueror[:/]?"+Ko,"i")],[G1]:[new RegExp(G1+" "+Ko),u6],[_Pe]:[new RegExp("android\\s"+Ko,"i")],[xPe]:[new RegExp(wPe+"\\/"+Ko)],[UY]:[new RegExp("(rv:|MSIE )"+Ko)],Mozilla:[new RegExp("rv:"+Ko)]},bie=[[new RegExp(Jb+"; "+Jb+" (.*?)[);]","i"),e=>[Jb,e&&e[1]||""]],[new RegExp(lT,"i"),[lT,""]],[new RegExp(cT,"i"),[cT,""]],[VY,[G1,""]],[new RegExp(S$,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[vz,""];if(new RegExp(Tu).test(t)&&!/IEMobile\b/.test(t))return[S$+" "+Tu,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=n[1],i=zKe[r]||"";return/arm/i.test(t)&&(i="RT"),[S$,i]}return[S$,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[e5,t.join(".")]}return[e5,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Yt(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Qh+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Qh+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[Qh,t.join(".")]}return[Qh,""]}],[/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/,[IKe,""]],[/Linux|debian/i,["Linux",""]]],wie=function(e){return qKe.test(e)?lT:LKe.test(e)?cT:jKe.test(e)?Jb:new RegExp(yz,"i").test(e)?yz:new RegExp("("+vz+"|WPDesktop)","i").test(e)?vz:/iPad/.test(e)?mPe:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?yPe:VY.test(e)?G1:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(vie,"i").test(e)?vie:/(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(Tu).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)?Qh:gPe:Qh:new RegExp("(pda|"+Tu+")","i").test(e)?MKe:new RegExp(aT,"i").test(e)&&!new RegExp(aT+" pc","i").test(e)?EPe:""},rC="https?://(.*)",QQ=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","irclid","_kx"],GKe=_Q(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],QQ),d6="<masked>",ns={campaignParams:function(){var{customTrackedParams:e,maskPersonalDataProperties:t,customPersonalDataProperties:n}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!ln)return{};var r=t?_Q([],QQ,n||[]):[];return this._campaignParamsFromUrl(JX(ln.URL,r,d6),e)},_campaignParamsFromUrl:function(e,t){var n=GKe.concat(t||[]),r={};return _i(n,function(i){var s=ZR(e,i);r[i]=s||null}),r},_searchEngine:function(e){return e?e.search(rC+"google.([^/?]*)")===0?"google":e.search(rC+"bing.com")===0?"bing":e.search(rC+"yahoo.com")===0?"yahoo":e.search(rC+"duckduckgo.com")===0?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){var t=ns._searchEngine(e),n=t!="yahoo"?"q":"p",r={};if(!nm(t)){r.$search_engine=t;var i=ln?ZR(ln.referrer,n):"";i.length&&(r.ph_keyword=i)}return r},searchInfo:function(){var e=ln?.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:yie,browserVersion:function(e,t){var n=yie(e,t),r=WKe[n];if(Yt(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<bie.length;t++){var[n,r]=bie[t],i=n.exec(e),s=i&&(Sd(r)?r(i,e):r);if(s)return s}return["",""]},device:wie,deviceType:function(e){var t=wie(e);return t===mPe||t===gPe||t==="Kobo"||t==="Kindle Fire"||t===EPe?aT:t===lT||t===Jb||t===cT||t===yz?"Console":t===yPe?"Wearable":t?Tu:"Desktop"},referrer:function(){return ln?.referrer||"$direct"},referringDomain:function(){var e;return ln!=null&&ln.referrer&&((e=Hb(ln.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?_Q([],QQ,t||[]):[],r=Pl?.href.substring(0,1e3);return{r:this.referrer().substring(0,1e3),u:r?JX(r,n,d6):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=Hb(n))===null||t===void 0?void 0:t.host};if(r){i.$current_url=r;var s=Hb(r);i.$host=s?.host,i.$pathname=s?.pathname;var a=this._campaignParamsFromUrl(r);Fs(i,a)}if(n){var o=this._searchInfoFromReferrer(n);Fs(i,o)}return i},initialPersonPropsFromInfo:function(e){var t=this.personPropsFromInfo(e),n={};return _i(t,function(r,i){n["$initial_".concat(MY(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(!ia)return{};var n=e?_Q([],QQ,t||[]):[],[r,i]=ns.os(ia);return Fs(sT({$os:r,$os_version:i,$browser:ns.browser(ia,navigator.vendor),$device:ns.device(ia),$device_type:ns.deviceType(ia),$timezone:ns.timezone(),$timezone_offset:ns.timezoneOffset()}),{$current_url:JX(Pl?.href,n,d6),$host:Pl?.host,$pathname:Pl?.pathname,$raw_user_agent:ia.length>1e3?ia.substring(0,997)+"...":ia,$browser_version:ns.browserVersion(ia,navigator.vendor),$browser_language:ns.browserLanguage(),$browser_language_prefix:ns.browserLanguagePrefix(),$screen_height:Ve?.screen.height,$screen_width:Ve?.screen.width,$viewport_height:Ve?.innerHeight,$viewport_width:Ve?.innerWidth,$lib:"web",$lib_version:Zf.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(!ia)return{};var[e,t]=ns.os(ia);return Fs(sT({$os:e,$os_version:t,$browser:ns.browser(ia,navigator.vendor)}),{$browser_version:ns.browserVersion(ia,navigator.vendor)})}},hh=Uo("[FeatureFlags]"),h6="$active_feature_flags",Xy="$override_feature_flags",xie="$feature_flag_payloads",lS="$override_feature_flag_payloads",Sie="$feature_flag_request_id",$ie=e=>{var t={};for(var[n,r]of PQ(e||{}))r&&(t[n]=r);return t},VKe=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]}))):hh.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"})(wz||(wz={}));class BKe{constructor(t){Nt(this,"_override_warning",!1),Nt(this,"_hasLoadedFlags",!1),Nt(this,"_requestInFlight",!1),Nt(this,"_reloadingDisabled",!1),Nt(this,"_additionalReloadRequested",!1),Nt(this,"_decideCalled",!1),Nt(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(tz),n=this.instance.get_property(Xy),r=this.instance.get_property(lS);if(!r&&!n)return t||{};var i=Fs({},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=Yt(u)?(o=c?.enabled)!==null&&o!==void 0&&o:!!u,h=Yt(u)?c.variant:typeof u=="string"?u:void 0,f=r?.[a],O=et(et({},c),{},{enabled:d,variant:d?h??c?.variant:void 0});d!==c?.enabled&&(O.original_enabled=c?.enabled),h!==c?.variant&&(O.original_variant=c?.variant),f&&(O.metadata=et(et({},c?.metadata),{},{payload:f,original_payload:c==null||(l=c.metadata)===null||l===void 0?void 0:l.payload})),i[a]=O}return this._override_warning||(hh.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:i}),this._override_warning=!0),i}getFlagVariants(){var t=this.instance.get_property(Qb),n=this.instance.get_property(Xy);if(!n)return t||{};for(var r=Fs({},t),i=Object.keys(n),s=0;s<i.length;s++)r[i[s]]=n[i[s]];return this._override_warning||(hh.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:n,finalFlags:r}),this._override_warning=!0),r}getFlagPayloads(){var t=this.instance.get_property(xie),n=this.instance.get_property(lS);if(!n)return t||{};for(var r=Fs({},t||{}),i=Object.keys(n),s=0;s<i.length;s++)r[i[s]]=n[i[s]];return this._override_warning||(hh.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:et(et({},((n=this.instance.persistence)===null||n===void 0?void 0:n.get_initial_props())||{}),this.instance.get_property(w$)||{}),group_properties:this.instance.get_property(Jm)};(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=ns.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:pd.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(wz.FeatureFlags)?hh.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(Sie)||void 0,a=this.instance.get_property(VR)||{};if((n.send_event||!("send_event"in n))&&(!(t in a)||!a[t].includes(i))){var o,l,c,u,d,h,f,O,g,m,v;_s(a[t])?a[t].push(i):a[t]=[i],(o=this.instance.persistence)===null||o===void 0||o.register({[VR]:a});var y=this.getFeatureFlagDetails(t),w={$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};Yt(y==null||(h=y.metadata)===null||h===void 0?void 0:h.version)||(w.$feature_flag_version=y.metadata.version);var k,x=(f=y==null||(O=y.reason)===null||O===void 0?void 0:O.description)!==null&&f!==void 0?f:y==null||(g=y.reason)===null||g===void 0?void 0:g.code;x&&(w.$feature_flag_reason=x),y!=null&&(m=y.metadata)!==null&&m!==void 0&&m.id&&(w.$feature_flag_id=y.metadata.id),Yt(y?.original_variant)&&Yt(y?.original_enabled)||(w.$feature_flag_original_response=Yt(y.original_variant)?y.original_enabled:y.original_variant),y!=null&&(v=y.metadata)!==null&&v!==void 0&&v.original_payload&&(w.$feature_flag_original_payload=y==null||(k=y.metadata)===null||k===void 0?void 0:k.original_payload),this.instance.capture("$feature_flag_called",w)}return r}hh.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:pd.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);hh.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=VKe(a),h=d.flags,f=d.featureFlags,O=d.featureFlagPayloads;if(f){var g=a.requestId;if(_s(f)){hh.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({[h6]:f,[Qb]:m})}else{var y=f,w=O,k=h;a.errorsWhileComputingFlags&&(y=et(et({},l),y),w=et(et({},c),w),k=et(et({},u),k)),o&&o.register(et({[h6]:Object.keys($ie(y)),[Qb]:y||{},[xie]:w||{},[tz]:k||{}},g?{[Sie]:g}:{}))}}})(t,this.instance.persistence,r,i,s),this._fireFeatureFlagsCallbacks(n)}}override(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];hh.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:n})}overrideFeatureFlags(t){if(!this.instance.__loaded||!this.instance.persistence)return hh.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.instance.persistence.unregister(Xy),this.instance.persistence.unregister(lS),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(Xy);else if(r.flags)if(_s(r.flags)){for(var i={},s=0;s<r.flags.length;s++)i[r.flags[s]]=!0;this.instance.persistence.register({[Xy]:i})}else this.instance.persistence.register({[Xy]:r.flags})}return"payloads"in r&&(r.payloads===!1?this.instance.persistence.unregister(lS):r.payloads&&this.instance.persistence.register({[lS]: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(CQ)||[]).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=et(et({},this.getFlagVariants()),{},{[t]:n});(r=this.instance.persistence)===null||r===void 0||r.register({[h6]:Object.keys($ie(o)),[Qb]: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(CQ),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({[CQ]: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(w$)||{};this.instance.register({[w$]:et(et({},r),t)}),n&&this.instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this.instance.unregister(w$)}setGroupPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],r=this.instance.get_property(Jm)||{};Object.keys(r).length!==0&&Object.keys(r).forEach(i=>{r[i]=et(et({},r[i]),t[i]),delete t[i]}),this.instance.register({[Jm]:et(et({},r),t)}),n&&this.instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var n=this.instance.get_property(Jm)||{};this.instance.register({[Jm]:et(et({},n),{},{[t]:{}})})}else this.instance.unregister(Jm)}}var YKe=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class f6{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&&bn.info("Persistence loaded",t.persistence,et({},this.props)),this.update_config(t,t),this.save()}buildStorage(t){YKe.indexOf(t.persistence.toLowerCase())===-1&&(bn.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n=t.persistence.toLowerCase();return n==="localstorage"&&ga.is_supported()?ga:n==="localstorage+cookie"&&H2.is_supported()?H2:n==="sessionstorage"&&no.is_supported()?no:n==="memory"?WHe:n==="cookie"?mp:H2.is_supported()?H2:mp}properties(){var t={};return _i(this.props,function(n,r){if(r===Qb&&Ps(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,(nm(a=SHe)?l:Rre&&a.indexOf===Rre?a.indexOf(o)!=-1:(_i(a,function(c){if(l||(l=c===o))return WR}),l))||(t[r]=n);var a,o,l}),t}load(){if(!this.disabled){var t=this.storage.parse(this.name);t&&(this.props=Fs({},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(Ps(t)){Yt(n)&&(n="None"),this.expire_days=Yt(r)?this.default_expiry:r;var i=!1;if(_i(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(Ps(t)){this.expire_days=Yt(n)?this.default_expiry:n;var r=!1;if(_i(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=ns.campaignParams({customTrackedParams:this.config.custom_campaign_params,maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});Eb(sT(t))||this.register(t),this.campaign_params_saved=!0}}update_search_keyword(){this.register(ns.searchInfo())}update_referrer_info(){this.register_once(ns.referrerInfo(),void 0)}set_initial_person_info(){this.props[sz]||this.props[az]||this.register_once({[oz]:ns.personInfo({maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties})},void 0)}get_referrer_info(){return sT({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}get_initial_props(){var t={};_i([az,sz],i=>{var s=this.props[i];s&&_i(s,function(a,o){t["$initial_"+MY(o)]=a})});var n=this.props[oz];if(n){var r=ns.initialPersonPropsFromInfo(n);Fs(t,r)}return t}safe_merge(t){return _i(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[y$]||{};r[t]=n,this.props[y$]=r,this.save()}remove_event_timer(t){var n=(this.props[y$]||{})[t];return Yt(n)||(delete this.props[y$][t],this.save()),n}get_property(t){return this.props[t]}set_property(t,n){this.props[t]=n,this.save()}}var QPe,Cs,RPe,l0,kie,APe,xz,DPe,Tie,Sz,_ie,Pie,Cie,Eie,$z={},NPe=[],ZKe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,BY=Array.isArray;function tg(e,t){for(var n in t)e[n]=t[n];return e}function XPe(e){var t=e.parentNode;t&&t.removeChild(e)}function p6(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??++RPe,__i:-1,__u:0};return i==null&&Cs.vnode!=null&&Cs.vnode(s),s}function YY(e){return e.children}function RQ(e,t){this.props=e,this.context=t}function V1(e,t){if(t==null)return e.__?V1(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"?V1(e):null}function IPe(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 IPe(e)}}function kz(e){(!e.__d&&(e.__d=!0)&&l0.push(e)&&!t5.__r++||kie!==Cs.debounceRendering)&&((kie=Cs.debounceRendering)||APe)(t5)}function t5(){var e,t,n,r,i,s,a,o,l;for(l0.sort(xz);e=l0.shift();)e.__d&&(t=l0.length,r=void 0,s=(i=(n=e).__v).__e,o=[],l=[],(a=n.__P)&&((r=tg({},i)).__v=i.__v+1,Cs.vnode&&Cs.vnode(r),jPe(a,r,i,n.__n,a.ownerSVGElement!==void 0,32&i.__u?[s]:null,o,s??V1(i),!!(32&i.__u),l),r.__.__k[r.__i]=r,JKe(o,r,l),r.__e!=s&&IPe(r)),l0.length>t&&l0.sort(xz));t5.__r=0}function FPe(e,t,n,r,i,s,a,o,l,c,u){var d,h,f,O,g,m=r&&r.__k||NPe,v=t.length;for(n.__d=l,HKe(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?$z:m[f.__i]||$z,f.__i=d,jPe(e,f,h,i,s,a,o,l,c,u),O=f.__e,f.ref&&h.ref!=f.ref&&(h.ref&&ZY(h.ref,null,f),u.push(f.ref,f.__c||O,f)),g==null&&O!=null&&(g=O),65536&f.__u||h.__k===f.__k?l=MPe(f,l,e):typeof f.type=="function"&&f.__d!==void 0?l=f.__d:O&&(l=O.nextSibling),f.__d=void 0,f.__u&=-196609);n.__d=l,n.__e=g}function HKe(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?p6(null,i,null,null,i):BY(i)?p6(YY,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?p6(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)!=null?(i.__=e,i.__b=e.__b+1,o=KKe(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=V1(s)),Tz(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=V1(s)),Tz(s,s))}function MPe(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=MPe(r[i],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function KKe(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 Qie(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||ZKe.test(t)?n:n+"px"}function iC(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||Qie(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||Qie(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?Aie:Rie,s)):e.removeEventListener(t,s?Aie:Rie,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 Rie(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(Cs.event?Cs.event(e):e)}function Aie(e){return this.l[e.type+!0](Cs.event?Cs.event(e):e)}function jPe(e,t,n,r,i,s,a,o,l,c){var u,d,h,f,O,g,m,v,y,w,k,x,S,T,_,P=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),s=[o=t.__e=n.__e]),(u=Cs.__b)&&u(t);e:if(typeof P=="function")try{if(v=t.props,y=(u=P.contextType)&&r[u.__c],w=u?y?y.props.value:u.__:r,n.__c?m=(d=t.__c=n.__c).__=d.__E:("prototype"in P&&P.prototype.render?t.__c=d=new P(v,w):(t.__c=d=new RQ(v,w),d.constructor=P,d.render=tJe),y&&y.sub(d),d.props=v,d.state||(d.state={}),d.context=w,d.__n=r,h=d.__d=!0,d.__h=[],d._sb=[]),d.__s==null&&(d.__s=d.state),P.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=tg({},d.__s)),tg(d.__s,P.getDerivedStateFromProps(v,d.__s))),f=d.props,O=d.state,d.__v=t,h)P.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(P.getDerivedStateFromProps==null&&v!==f&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(v,w),!d.__e&&(d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(v,d.__s,w)===!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(E){E&&(E.__=t)}),k=0;k<d._sb.length;k++)d.__h.push(d._sb[k]);d._sb=[],d.__h.length&&a.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(v,d.__s,w),d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(f,O,g)})}if(d.context=w,d.props=v,d.__P=e,d.__e=!1,x=Cs.__r,S=0,"prototype"in P&&P.prototype.render){for(d.state=d.__s,d.__d=!1,x&&x(t),u=d.render(d.props,d.state,d.context),T=0;T<d._sb.length;T++)d.__h.push(d._sb[T]);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=tg(tg({},r),d.getChildContext())),h||d.getSnapshotBeforeUpdate==null||(g=d.getSnapshotBeforeUpdate(f,O)),FPe(e,BY(_=u!=null&&u.type===YY&&u.key==null?u.props.children:u)?_:[_],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(E){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),Cs.__e(E,t,n)}else s==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=eJe(n.__e,t,n,r,i,s,a,l,c);(u=Cs.diffed)&&u(t)}function JKe(e,t,n){t.__d=void 0;for(var r=0;r<n.length;r++)ZY(n[r],n[++r],n[++r]);Cs.__c&&Cs.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(s){s.call(i)})}catch(s){Cs.__e(s,i.__v)}})}function eJe(e,t,n,r,i,s,a,o,l){var c,u,d,h,f,O,g,m=n.props,v=t.props,y=t.type;if(y==="svg"&&(i=!0),s!=null){for(c=0;c<s.length;c++)if((f=s[c])&&"setAttribute"in f==!!y&&(y?f.localName===y:f.nodeType===3)){e=f,s[c]=null;break}}if(e==null){if(y===null)return document.createTextNode(v);e=i?document.createElementNS("http://www.w3.org/2000/svg",y):document.createElement(y,v.is&&v),s=null,o=!1}if(y===null)m===v||o&&e.data===v||(e.data=v);else{if(s=s&&QPe.call(e.childNodes),m=n.props||$z,!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||iC(e,c,null,f,i));for(c in v)f=v[c],c=="children"?h=f:c=="dangerouslySetInnerHTML"?u=f:c=="value"?O=f:c=="checked"?g=f:c==="key"||o&&typeof f!="function"||m[c]===f||iC(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=""),FPe(e,BY(h)?h:[h],t,n,r,i&&y!=="foreignObject",s,a,s?s[0]:n.__k&&V1(n,0),o,l),s!=null)for(c=s.length;c--;)s[c]!=null&&XPe(s[c]);o||(c="value",O!==void 0&&(O!==e[c]||y==="progress"&&!O||y==="option"&&O!==m[c])&&iC(e,c,O,m[c],!1),c="checked",g!==void 0&&g!==e[c]&&iC(e,c,g,m[c],!1))}return e}function ZY(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){Cs.__e(r,n)}}function Tz(e,t,n){var r,i;if(Cs.unmount&&Cs.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||ZY(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(s){Cs.__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]&&Tz(r[i],t,n||typeof e.type!="function");n||e.__e==null||XPe(e.__e),e.__=e.__e=e.__d=void 0}function tJe(e,t,n){return this.constructor(e,n)}QPe=NPe.slice,Cs={__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}},RPe=0,RQ.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=tg({},this.state),typeof e=="function"&&(e=e(tg({},n),this.props)),e&&tg(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),kz(this))},RQ.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),kz(this))},RQ.prototype.render=YY,l0=[],APe=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,xz=function(e,t){return e.__v.__b-t.__v.__b},t5.__r=0,DPe=0,function(e){e.Button="button",e.Tab="tab",e.Selector="selector"}(Tie||(Tie={})),function(e){e.Left="left",e.Center="center",e.Right="right",e.NextToTrigger="next_to_trigger"}(Sz||(Sz={})),function(e){e.Popover="popover",e.API="api",e.Widget="widget"}(_ie||(_ie={})),function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"}(Pie||(Pie={})),function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"}(Cie||(Cie={})),function(e){e.Once="once",e.Recurring="recurring",e.Always="always"}(Eie||(Eie={}));var B1=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}},Za=Uo("[Surveys]"),Die={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=>B1(t,n)),not_regex:(e,t)=>e.every(n=>!B1(t,n)),exact:(e,t)=>e.some(n=>t===n),is_not:(e,t)=>e.every(n=>t!==n)};function Nie(e){return e??"icontains"}Sz.Right;(function(e,t){var n={__c:t="__cC"+DPe++,__: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,kz(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 LPe=class{constructor(){Nt(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)}},nJe=class vb{constructor(t){Nt(this,"_debugEventEmitter",new LPe),Nt(this,"checkStep",(n,r)=>this.checkStepEvent(n,r)&&this.checkStepUrl(n,r)&&this.checkStepElement(n,r)),Nt(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(!Yt((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(!Yt((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"||!vb.matchString(i,n?.url,n?.url_matching||"contains"))return!1}return!0}static matchString(t,n,r){switch(r){case"regex":return!!Ve&&B1(t,n);case"exact":return n===t;case"contains":var i=vb.escapeStringRegexp(n).replace(/_/g,".").replace(/%/g,".*");return B1(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&&!vb.matchString(s.href||"",n?.href,n?.href_matching||"exact"))&&(n==null||!n.tag_name||s.tag_name===n?.tag_name)&&!(n!=null&&n.text&&!vb.matchString(s.text||"",n?.text,n?.text_matching||"exact")&&!vb.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}},_z=class qPe{constructor(t){this.instance=t,this.eventToSurveys=new Map,this.actionToSurveys=new Map}register(t){var n;Yt((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 nJe(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(O=>{if(O&&O.name){var g=this.actionToSurveys.get(O.name);g&&g.push(r.id),this.actionToSurveys.set(O.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[Z2])||[];if(qPe.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[Z2])||[];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({[Z2]:[...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[Z2];return r||[]}getEventToSurveys(){return this.eventToSurveys}_getActionMatcher(){return this.actionMatcher}};Nt(_z,"SURVEY_SHOWN_EVENT_NAME","survey shown");let rJe=class{constructor(t){Nt(this,"_isFetchingSurveys",!1),Nt(this,"_isInitializingSurveys",!1),Nt(this,"_surveyCallbacks",[]),this.instance=t,this._surveyEventReceiver=null}onRemoteConfig(t){var n=t.surveys;if(fi(n))return Za.warn("Decide not loaded yet. Not loading surveys.");var r=_s(n);this._hasSurveys=r?n.length>0:n,Za.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)Za.info("Already initializing surveys, skipping...");else if(this.instance.config.disable_surveys)Za.info("Disabled. Not loading surveys.");else{var t=er?.__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 _z(this.instance),Za.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 Za.error("Could not load surveys script",s),void(this._isInitializingSurveys=!1);this._surveyManager=t.generateSurveys(this.instance),this._isInitializingSurveys=!1,this._surveyEventReceiver=new _z(this.instance),Za.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})});else{var i="PostHog loadExternalDependency extension not found. Cannot load remote config.";Za.error(i),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:i})}}}catch(s){throw Za.error("Error initializing surveys",s),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:"Error initializing surveys"}),s}}else Za.info("No surveys to load.");else Za.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 Za.info("Disabled. Not loading surveys."),t([]);var r=this.instance.get_property(nz);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 Za.error(o),t([],{isLoaded:!1,error:o})}var l,c=i.json.surveys||[],u=c.filter(d=>{var h,f,O,g,m,v,y,w,k,x,S,T;return((h=d.conditions)===null||h===void 0?void 0:h.events)&&((f=d.conditions)===null||f===void 0||(O=f.events)===null||O===void 0?void 0:O.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||((y=d.conditions)===null||y===void 0?void 0:y.actions)&&((w=d.conditions)===null||w===void 0||(k=w.actions)===null||k===void 0?void 0:k.values)&&((x=d.conditions)===null||x===void 0||(S=x.actions)===null||S===void 0||(T=S.values)===null||T===void 0?void 0:T.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({[nz]: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){Za.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 O,g,m;if((O=f.conditions)===null||O===void 0||!O.url)return!0;var v=Ve==null||(g=Ve.location)===null||g===void 0?void 0:g.href;if(!v)return!1;var y=[f.conditions.url];return Die[Nie((m=f.conditions)===null||m===void 0?void 0:m.urlMatchType)](y,v)}(l),d=(c=l.conditions)===null||c===void 0||!c.selector||ln?.querySelector(l.conditions.selector),h=function(f){var O,g,m;if((O=f.conditions)===null||O===void 0||!O.deviceTypes||((g=f.conditions)===null||g===void 0?void 0:g.deviceTypes.length)===0)return!0;if(!ia)return!1;var v=ns.deviceType(ia);return Die[Nie((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,O,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 y=this.isSurveyFeatureFlagEnabled(l.linked_flag_key),w=this.isSurveyFeatureFlagEnabled(l.targeting_flag_key),k=((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=((O=(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&&O!==void 0?O:0)>0,S=!k&&!x||a?.includes(l.id),T=this._canActivateRepeatedly(l)||this.isSurveyFeatureFlagEnabled(l.internal_targeting_flag_key),_=this.checkFlags(l);return y&&w&&T&&S&&_});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 fi((n=er.__PosthogExtensions__)===null||n===void 0?void 0:n.canActivateRepeatedly)?(Za.warn("init was not called"),!1):er.__PosthogExtensions__.canActivateRepeatedly(t)}canRenderSurvey(t){if(fi(this._surveyManager))return Za.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?et({},this._surveyManager.canRenderSurvey(i)):{visible:!1,disabledReason:"Survey not found"}}),n}renderSurvey(t,n){fi(this._surveyManager)?Za.warn("init was not called"):this.getSurveys(r=>{var i=r.filter(s=>s.id===t)[0];this._surveyManager.renderSurvey(i,ln?.querySelector(n))})}};var Xie=Uo("[RateLimiter]");let iJe=class{constructor(t){var n,r;Nt(this,"serverLimits",{}),Nt(this,"lastEventRateLimited",!1),Nt(this,"checkForLimiting",i=>{var s=i.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach(a=>{Xie.info("".concat(a||"events"," is quota limited.")),this.serverLimits[a]=new Date().getTime()+6e4})}catch(a){return void Xie.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(iz))!==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(iz,a),{isRateLimited:o,remainingTokens:a.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}};var Dm=Uo("[RemoteConfig]");let sJe=class{constructor(t){this.instance=t}get remoteConfig(){var t,n;return(t=er._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=er.__PosthogExtensions__)!==null&&n!==void 0&&n.loadExternalDependency?(r=er.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"remote-config",()=>t(this.remoteConfig)):(Dm.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 Dm.info("Using preloaded remote config",this.remoteConfig),void this.onRemoteConfig(this.remoteConfig);if(this.instance.config.advanced_disable_decide)return void Dm.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(t=>{if(!t)return Dm.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){Dm.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()):Dm.info("__preview_remote_config is disabled. Logging config instead",t):Dm.error("Failed to fetch remote config from PostHog.")}};var aJe=function(e){var t,n,r,i,s="";for(t=n=0,r=(e=(e+"").replace(/\r\n/g,`
|
|
4
4
|
`).replace(/\r/g,`
|
|
5
5
|
`)).length,i=0;i<r;i++){var a=e.charCodeAt(i),o=null;a<128?n++:o=a>127&&a<2048?String.fromCharCode(a>>6|192,63&a|128):String.fromCharCode(a>>12|224,a>>6&63|128,63&a|128),nm(o)||(n>t&&(s+=e.substring(t,n)),s+=o,t=n=i+1)}return n>t&&(s+=e.substring(t,e.length)),s},oJe=!!Hq||!!Zq,Iie="text/plain",n5=(e,t)=>{var[n,r]=e.split("?"),i=et({},t);r?.split("&").forEach(a=>{var[o]=a.split("=");delete i[o]});var s=RHe(i);return s=s?(r?r+"&":"")+s:r,"".concat(n,"?").concat(s)},$$=(e,t)=>JSON.stringify(e,(n,r)=>typeof r=="bigint"?r.toString():r,t),O6=e=>{var{data:t,compression:n}=e;if(t){if(n===pd.GZipJS){var r=hPe(fPe($$(t)),{mtime:0}),i=new Blob([r],{type:Iie});return{contentType:Iie,body:i,estimatedSize:i.size}}if(n===pd.Base64){var s=function(l){var c,u,d,h,f,O="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g=0,m=0,v="",y=[];if(!l)return l;l=aJe(l);do c=(f=l.charCodeAt(g++)<<16|l.charCodeAt(g++)<<8|l.charCodeAt(g++))>>18&63,u=f>>12&63,d=f>>6&63,h=63&f,y[m++]=O.charAt(c)+O.charAt(u)+O.charAt(d)+O.charAt(h);while(g<l.length);switch(v=y.join(""),l.length%3){case 1:v=v.slice(0,-2)+"==";break;case 2:v=v.slice(0,-1)+"="}return v}($$(t)),a=(l=>"data="+encodeURIComponent(typeof l=="string"?l:$$(l)))(s);return{contentType:"application/x-www-form-urlencoded",body:a,estimatedSize:new Blob([a]).size}}var o=$$(t);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},H$=[];Zq&&H$.push({transport:"fetch",method:e=>{var t,n,{contentType:r,body:i,estimatedSize:s}=(t=O6(e))!==null&&t!==void 0?t:{},a=new Headers;_i(e.headers,function(u,d){a.append(d,u)}),r&&a.append("Content-Type",r);var o=e.url,l=null;if(Are){var c=new Are;l={signal:c.signal,timeout:setTimeout(()=>c.abort(),e.timeout)}}Zq(o,et({method:e?.method||"GET",headers:a,keepalive:e.method==="POST"&&(s||0)<52428.8,body:i,signal:(n=l)===null||n===void 0?void 0:n.signal},e.fetchOptions)).then(u=>u.text().then(d=>{var h,f={statusCode:u.status,text:d};if(u.status===200)try{f.json=JSON.parse(d)}catch(O){bn.error(O)}(h=e.callback)===null||h===void 0||h.call(e,f)})).catch(u=>{var d;bn.error(u),(d=e.callback)===null||d===void 0||d.call(e,{statusCode:0,text:u})}).finally(()=>l?clearTimeout(l.timeout):null)}}),Hq&&H$.push({transport:"XHR",method:e=>{var t,n=new Hq;n.open(e.method||"GET",e.url,!0);var{contentType:r,body:i}=(t=O6(e))!==null&&t!==void 0?t:{};_i(e.headers,function(s,a){n.setRequestHeader(a,s)}),r&&n.setRequestHeader("Content-Type",r),e.timeout&&(n.timeout=e.timeout),n.withCredentials=!0,n.onreadystatechange=()=>{if(n.readyState===4){var s,a={statusCode:n.status,text:n.responseText};if(n.status===200)try{a.json=JSON.parse(n.responseText)}catch{}(s=e.callback)===null||s===void 0||s.call(e,a)}},n.send(i)}}),kc!=null&&kc.sendBeacon&&H$.push({transport:"sendBeacon",method:e=>{var t=n5(e.url,{beacon:"1"});try{var n,{contentType:r,body:i}=(n=O6(e))!==null&&n!==void 0?n:{},s=typeof i=="string"?new Blob([i],{type:r}):i;kc.sendBeacon(t,s)}catch{}}});var Pz=3e3;let lJe=class{constructor(t,n){Nt(this,"isPaused",!0),Nt(this,"queue",[]),this.flushTimeoutMs=gu(n?.flush_interval_ms||Pz,250,5e3,"flush interval",Pz),this.sendRequest=t}enqueue(t){this.queue.push(t),this.flushTimeout||this.setFlushTimeout()}unload(){this.clearFlushTimeout();var t=this.queue.length>0?this.formatQueue():{},n=Object.values(t),r=[...n.filter(i=>i.url.indexOf("/e")===0),...n.filter(i=>i.url.indexOf("/e")!==0)];r.map(i=>{this.sendRequest(et(et({},i),{},{transport:"sendBeacon"}))})}enable(){this.isPaused=!1,this.setFlushTimeout()}setFlushTimeout(){var t=this;this.isPaused||(this.flushTimeout=setTimeout(()=>{if(this.clearFlushTimeout(),this.queue.length>0){var n=this.formatQueue(),r=function(s){var a=n[s],o=new Date().getTime();a.data&&_s(a.data)&&_i(a.data,l=>{l.offset=Math.abs(l.timestamp-o),delete l.timestamp}),t.sendRequest(a)};for(var i in n)r(i)}},this.flushTimeoutMs))}clearFlushTimeout(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}formatQueue(){var t={};return _i(this.queue,n=>{var r,i=n,s=(i?i.batchKey:null)||i.url;Yt(t[s])&&(t[s]=et(et({},i),{},{data:[]})),(r=t[s].data)===null||r===void 0||r.push(i.data)}),this.queue=[],t}};var cJe=["retriesPerformedSoFar"];let uJe=class{constructor(t){Nt(this,"isPolling",!1),Nt(this,"pollIntervalMs",3e3),Nt(this,"queue",[]),this.instance=t,this.queue=[],this.areWeOnline=!0,!Yt(Ve)&&"onLine"in Ve.navigator&&(this.areWeOnline=Ve.navigator.onLine,Ls(Ve,"online",()=>{this.areWeOnline=!0,this.flush()}),Ls(Ve,"offline",()=>{this.areWeOnline=!1}))}retriableRequest(t){var{retriesPerformedSoFar:n}=t,r=L_e(t,cJe);al(n)&&n>0&&(r.url=n5(r.url,{retry_count:n})),this.instance._send_request(et(et({},r),{},{callback:i=>{var s;i.statusCode!==200&&(i.statusCode<400||i.statusCode>=500)&&(n??0)<10?this.enqueue(et({retriesPerformedSoFar:n},r)):(s=r.callback)===null||s===void 0||s.call(r,i)}}))}enqueue(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var r=function(a){var o=3e3*Math.pow(2,a),l=o/2,c=Math.min(18e5,o),u=(Math.random()-.5)*(c-l);return Math.ceil(c+u)}(n),i=Date.now()+r;this.queue.push({retryAt:i,requestOptions:t});var s="Enqueued failed request for retry in ".concat(r);navigator.onLine||(s+=" (Browser is offline)"),bn.warn(s),this.isPolling||(this.isPolling=!0,this.poll())}poll(){this.poller&&clearTimeout(this.poller),this.poller=setTimeout(()=>{this.areWeOnline&&this.queue.length>0&&this.flush(),this.poll()},this.pollIntervalMs)}flush(){var t=Date.now(),n=[],r=this.queue.filter(s=>s.retryAt<t||(n.push(s),!1));if(this.queue=n,r.length>0)for(var{requestOptions:i}of r)this.retriableRequest(i)}unload(){for(var{requestOptions:t}of(this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.queue))try{this.instance._send_request(et(et({},t),{},{transport:"sendBeacon"}))}catch(n){bn.error(n)}this.queue=[]}},dJe=class{constructor(t){Nt(this,"_updateScrollData",()=>{var n,r,i,s;this.context||(this.context={});var a=this.scrollElement(),o=this.scrollY(),l=a?Math.max(0,a.scrollHeight-a.clientHeight):0,c=o+(a?.clientHeight||0),u=a?.scrollHeight||0;this.context.lastScrollY=Math.ceil(o),this.context.maxScrollY=Math.max(o,(n=this.context.maxScrollY)!==null&&n!==void 0?n:0),this.context.maxScrollHeight=Math.max(l,(r=this.context.maxScrollHeight)!==null&&r!==void 0?r:0),this.context.lastContentY=c,this.context.maxContentY=Math.max(c,(i=this.context.maxContentY)!==null&&i!==void 0?i:0),this.context.maxContentHeight=Math.max(u,(s=this.context.maxContentHeight)!==null&&s!==void 0?s:0)}),this.instance=t}getContext(){return this.context}resetContext(){var t=this.context;return setTimeout(this._updateScrollData,0),t}startMeasuringScrollPosition(){Ls(Ve,"scroll",this._updateScrollData,{capture:!0}),Ls(Ve,"scrollend",this._updateScrollData,{capture:!0}),Ls(Ve,"resize",this._updateScrollData)}scrollElement(){if(!this.instance.config.scroll_root_selector)return Ve?.document.documentElement;var t=_s(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector];for(var n of t){var r=Ve?.document.querySelector(n);if(r)return r}}scrollY(){if(this.instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollTop||0}return Ve&&(Ve.scrollY||Ve.pageYOffset||Ve.document.documentElement.scrollTop)||0}scrollX(){if(this.instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollLeft||0}return Ve&&(Ve.scrollX||Ve.pageXOffset||Ve.document.documentElement.scrollLeft)||0}};var hJe=e=>ns.personInfo({maskPersonalDataProperties:e?.config.mask_personal_data_properties,customPersonalDataProperties:e?.config.custom_personal_data_properties});let fJe=class{constructor(t,n,r,i){Nt(this,"_onSessionIdCallback",s=>{var a=this._getStored();if(!a||a.sessionId!==s){var o={sessionId:s,props:this._sessionSourceParamGenerator(this.instance)};this._persistence.register({[rz]:o})}}),this.instance=t,this._sessionIdManager=n,this._persistence=r,this._sessionSourceParamGenerator=i||hJe,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[rz]}getSetOnceProps(){var t,n=(t=this._getStored())===null||t===void 0?void 0:t.props;return n?"r"in n?ns.personPropsFromInfo(n):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var t={};return _i(sT(this.getSetOnceProps()),(n,r)=>{r==="$current_url"&&(r="url"),t["$session_entry_".concat(MY(r))]=n}),t}};var Fie=Uo("[SessionId]");let pJe=class{constructor(t,n,r){var i;if(Nt(this,"_sessionIdChangedHandlers",[]),!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.__preview_experimental_cookieless_mode)throw new Error("SessionIdManager cannot be used with __preview_experimental_cookieless_mode");this.config=t.config,this.persistence=t.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=n||eg,this._windowIdGenerator=r||eg;var s=this.config.persistence_name||this.config.token,a=this.config.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*gu(a,60,36e3,"session_idle_timeout_seconds",1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.resetIdleTimer(),this._window_id_storage_key="ph_"+s+"_window_id",this._primary_window_exists_storage_key="ph_"+s+"_primary_window_exists",this._canUseSessionStorage()){var o=no.parse(this._window_id_storage_key),l=no.parse(this._primary_window_exists_storage_key);o&&!l?this._windowId=o:no.remove(this._window_id_storage_key),no.set(this._primary_window_exists_storage_key,!0)}if((i=this.config.bootstrap)!==null&&i!==void 0&&i.sessionID)try{var c=(u=>{var d=u.replace(/-/g,"");if(d.length!==32)throw new Error("Not a valid UUID");if(d[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(d.substring(0,12),16)})(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,new Date().getTime(),c)}catch(u){Fie.error("Invalid sessionID in bootstrap",u)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Yt(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(t),this._sessionId&&t(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter(n=>n!==t)}}_canUseSessionStorage(){return this.config.persistence!=="memory"&&!this.persistence.disabled&&no.is_supported()}_setWindowId(t){t!==this._windowId&&(this._windowId=t,this._canUseSessionStorage()&&no.set(this._window_id_storage_key,t))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?no.parse(this._window_id_storage_key):null}_setSessionId(t,n,r){t===this._sessionId&&n===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this._sessionId=t,this.persistence.register({[GR]:[n,t,r]}))}_getSessionId(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var t=this.persistence.props[GR];return _s(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}_listenToReloadWindow(){Ls(Ve,"beforeunload",()=>{this._canUseSessionStorage()&&no.remove(this._primary_window_exists_storage_key)},{capture:!1})}checkAndGetSessionAndWindowId(){var t=arguments.length>0&&arguments[0]!==void 0&&arguments[0],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(this.config.__preview_experimental_cookieless_mode)throw new Error("checkAndGetSessionAndWindowId should not be called in __preview_experimental_cookieless_mode");var r=n||new Date().getTime(),[i,s,a]=this._getSessionId(),o=this._getWindowId(),l=al(a)&&a>0&&Math.abs(r-a)>864e5,c=!1,u=!s,d=!t&&Math.abs(r-i)>this.sessionTimeoutMs;u||d||l?(s=this._sessionIdGenerator(),o=this._windowIdGenerator(),Fie.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:l}}),a=r,c=!0):o||(o=this._windowIdGenerator(),c=!0);var h=i===0||!t||l?r:i,f=a===0?new Date().getTime():a;return this._setWindowId(o),this._setSessionId(s,h,f),t||this.resetIdleTimer(),c&&this._sessionIdChangedHandlers.forEach(O=>O(s,o,c?{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:l}:void 0)),{sessionId:s,windowId:o,sessionStartTimestamp:f,changeReason:c?{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:i}}resetIdleTimer(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{this.resetSessionId()},1.1*this.sessionTimeoutMs)}};var OJe=["$set_once","$set"],wO=Uo("[SiteApps]");let gJe=class{constructor(t){this.instance=t,this.bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this.instance.config.opt_in_site_apps}eventCollector(t,n){if(n){var r=this.globalsForEvent(n);this.bufferedInvocations.push(r),this.bufferedInvocations.length>1e3&&(this.bufferedInvocations=this.bufferedInvocations.slice(10))}}get siteAppLoaders(){var t,n;return(t=er._POSTHOG_REMOTE_CONFIG)===null||t===void 0||(n=t[this.instance.config.token])===null||n===void 0?void 0:n.siteApps}init(){if(this.isEnabled){var t=this.instance._addCaptureHook(this.eventCollector.bind(this));this.stopBuffering=()=>{t(),this.bufferedInvocations=[],this.stopBuffering=void 0}}}globalsForEvent(t){var n,r,i,s,a,o,l;if(!t)throw new Error("Event payload is required");var c={},u=this.instance.get_property("$groups")||[],d=this.instance.get_property("$stored_group_properties")||{};for(var[h,f]of Object.entries(d))c[h]={id:u[h],type:h,properties:f};var{$set_once:O,$set:g}=t;return{event:et(et({},L_e(t,OJe)),{},{properties:et(et(et({},t.properties),g?{$set:et(et({},(n=(r=t.properties)===null||r===void 0?void 0:r.$set)!==null&&n!==void 0?n:{}),g)}:{}),O?{$set_once:et(et({},(i=(s=t.properties)===null||s===void 0?void 0:s.$set_once)!==null&&i!==void 0?i:{}),O)}:{}),elements_chain:(a=(o=t.properties)===null||o===void 0?void 0:o.$elements_chain)!==null&&a!==void 0?a:"",distinct_id:(l=t.properties)===null||l===void 0?void 0:l.distinct_id}),person:{properties:this.instance.get_property("$stored_person_properties")},groups:c}}setupSiteApp(t){var n=this.apps[t.id],r=()=>{var o;!n.errored&&this.bufferedInvocations.length&&(wO.info("Processing ".concat(this.bufferedInvocations.length," events for site app with id ").concat(t.id)),this.bufferedInvocations.forEach(l=>{var c;return(c=n.processEvent)===null||c===void 0?void 0:c.call(n,l)}),n.processedBuffer=!0),Object.values(this.apps).every(l=>l.processedBuffer||l.errored)&&((o=this.stopBuffering)===null||o===void 0||o.call(this))},i=!1,s=o=>{n.errored=!o,n.loaded=!0,wO.info("Site app with id ".concat(t.id," ").concat(o?"loaded":"errored")),i&&r()};try{var{processEvent:a}=t.init({posthog:this.instance,callback:o=>{s(o)}});a&&(n.processEvent=a),i=!0}catch(o){wO.error("Error while initializing PostHog app with config id ".concat(t.id),o),s(!1)}if(i&&n.loaded)try{r()}catch(o){wO.error("Error while processing buffered events PostHog app with config id ".concat(t.id),o),n.errored=!0}}setupSiteApps(){var t=this.siteAppLoaders||[];for(var n of t)this.apps[n.id]={id:n.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of t)this.setupSiteApp(r)}onCapturedEvent(t){if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(t);for(var r of Object.values(this.apps))try{var i;(i=r.processEvent)===null||i===void 0||i.call(r,n)}catch(s){wO.error("Error while processing event ".concat(t.event," for site app ").concat(r.id),s)}}}onRemoteConfig(t){var n,r,i,s=this;if((n=this.siteAppLoaders)!==null&&n!==void 0&&n.length)return this.isEnabled?(this.setupSiteApps(),void this.instance.on("eventCaptured",c=>this.onCapturedEvent(c))):void wO.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this.stopBuffering)===null||r===void 0||r.call(this),(i=t.siteApps)!==null&&i!==void 0&&i.length)if(this.isEnabled){var a=function(c,u){var d,h;er["__$$ph_site_app_".concat(c)]=s.instance,(d=er.__PosthogExtensions__)===null||d===void 0||(h=d.loadSiteApp)===null||h===void 0||h.call(d,s.instance,u,f=>{if(f)return wO.error("Error while initializing PostHog app with config id ".concat(c),f)})};for(var{id:o,url:l}of t.siteApps)a(o,l)}else wO.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}};var g0,mJe=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google","bytespider"],Mie=function(e,t){if(!e)return!1;var n=e.toLowerCase();return mJe.concat(t||[]).some(r=>{var i=r.toLowerCase();return n.indexOf(i)!==-1})},zPe=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&Mie(n,t))return!0;try{var r=e?.userAgentData;if(r!=null&&r.brands&&r.brands.some(i=>Mie(i?.brand,t)))return!0}catch{}return!!e.webdriver};function jie(e,t,n){return $$({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}(function(e){e.US="us",e.EU="eu",e.CUSTOM="custom"})(g0||(g0={}));var Lie="i.posthog.com";let vJe=class{constructor(t){Nt(this,"_regionCache",{}),this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return t==="https://app.posthog.com"?"https://us.i.posthog.com":t}get uiHost(){var t,n=(t=this.instance.config.ui_host)===null||t===void 0?void 0:t.replace(/\/$/,"");return n||(n=this.apiHost.replace(".".concat(Lie),".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this._regionCache[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=g0.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=g0.EU:this._regionCache[this.apiHost]=g0.CUSTOM),this._regionCache[this.apiHost]}endpointFor(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if(n&&(n=n[0]==="/"?n:"/".concat(n)),t==="ui")return this.uiHost+n;if(this.region===g0.CUSTOM)return this.apiHost+n;var r=Lie+n;switch(t){case"assets":return"https://".concat(this.region,"-assets.").concat(r);case"api":return"https://".concat(this.region,".").concat(r)}}};var yJe={icontains:(e,t)=>!!Ve&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!Ve&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!Ve&&B1(t.href,e),not_regex:(e,t)=>!!Ve&&!B1(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};let bJe=class Jo{constructor(t){var n=this;Nt(this,"getWebExperimentsAndEvaluateDisplayLogic",function(){var r=arguments.length>0&&arguments[0]!==void 0&&arguments[0];n.getWebExperiments(i=>{Jo.logInfo("retrieved web experiments from the server"),n._flagToExperiments=new Map,i.forEach(s=>{if(s.feature_flag_key){var a;n._flagToExperiments&&(Jo.logInfo("setting flag key ",s.feature_flag_key," to web experiment ",s),(a=n._flagToExperiments)===null||a===void 0||a.set(s.feature_flag_key,s));var o=n.instance.getFeatureFlag(s.feature_flag_key);ca(o)&&s.variants[o]&&n.applyTransforms(s.name,o,s.variants[o].transforms)}else if(s.variants)for(var l in s.variants){var c=s.variants[l];Jo.matchesTestVariant(c)&&n.applyTransforms(s.name,l,c.transforms)}})},r)}),this.instance=t,this.instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}onFeatureFlags(t){if(this._is_bot())Jo.logInfo("Refusing to render web experiment since the viewer is a likely bot");else if(!this.instance.config.disable_web_experiments){if(fi(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Jo.logInfo("applying feature flags",t),t.forEach(n=>{var r;if(this._flagToExperiments&&(r=this._flagToExperiments)!==null&&r!==void 0&&r.has(n)){var i,s=this.instance.getFeatureFlag(n),a=(i=this._flagToExperiments)===null||i===void 0?void 0:i.get(n);s&&a!=null&&a.variants[s]&&this.applyTransforms(a.name,s,a.variants[s].transforms)}})}}previewWebExperiment(){var t=Jo.getWindowLocation();if(t!=null&&t.search){var n=ZR(t?.search,"__experiment_id"),r=ZR(t?.search,"__experiment_variant");n&&r&&(Jo.logInfo("previewing web experiments ".concat(n," && ").concat(r)),this.getWebExperiments(i=>{this.showPreviewWebExperiment(parseInt(n),r,i)},!1,!0))}}loadIfEnabled(){this.instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,r){if(this.instance.config.disable_web_experiments&&!r)return t([]);var i=this.instance.get_property("$web_experiments");if(i&&!n)return t(i);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/web_experiments/?token=".concat(this.instance.config.token)),method:"GET",callback:s=>{if(s.statusCode!==200||!s.json)return t([]);var a=s.json.experiments||[];return t(a)}})}showPreviewWebExperiment(t,n,r){var i=r.filter(s=>s.id===t);i&&i.length>0&&(Jo.logInfo("Previewing web experiment [".concat(i[0].name,"] with variant [").concat(n,"]")),this.applyTransforms(i[0].name,n,i[0].variants[n].transforms))}static matchesTestVariant(t){return!fi(t.conditions)&&Jo.matchUrlConditions(t)&&Jo.matchUTMConditions(t)}static matchUrlConditions(t){var n;if(fi(t.conditions)||fi((n=t.conditions)===null||n===void 0?void 0:n.url))return!0;var r,i,s,a=Jo.getWindowLocation();return!!a&&((r=t.conditions)===null||r===void 0||!r.url||yJe[(i=(s=t.conditions)===null||s===void 0?void 0:s.urlMatchType)!==null&&i!==void 0?i:"icontains"](t.conditions.url,a))}static getWindowLocation(){return Ve?.location}static matchUTMConditions(t){var n;if(fi(t.conditions)||fi((n=t.conditions)===null||n===void 0?void 0:n.utm))return!0;var r=ns.campaignParams();if(r.utm_source){var i,s,a,o,l,c,u,d,h,f,O,g,m,v,y,w,k=(i=t.conditions)===null||i===void 0||(s=i.utm)===null||s===void 0||!s.utm_campaign||((a=t.conditions)===null||a===void 0||(o=a.utm)===null||o===void 0?void 0:o.utm_campaign)==r.utm_campaign,x=(l=t.conditions)===null||l===void 0||(c=l.utm)===null||c===void 0||!c.utm_source||((u=t.conditions)===null||u===void 0||(d=u.utm)===null||d===void 0?void 0:d.utm_source)==r.utm_source,S=(h=t.conditions)===null||h===void 0||(f=h.utm)===null||f===void 0||!f.utm_medium||((O=t.conditions)===null||O===void 0||(g=O.utm)===null||g===void 0?void 0:g.utm_medium)==r.utm_medium,T=(m=t.conditions)===null||m===void 0||(v=m.utm)===null||v===void 0||!v.utm_term||((y=t.conditions)===null||y===void 0||(w=y.utm)===null||w===void 0?void 0:w.utm_term)==r.utm_term;return k&&S&&T&&x}return!1}static logInfo(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];bn.info("[WebExperiments] ".concat(t),r)}applyTransforms(t,n,r){this._is_bot()?Jo.logInfo("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?r.forEach(i=>{if(i.selector){var s;Jo.logInfo("applying transform of variant ".concat(n," for experiment ").concat(t," "),i);var a=(s=document)===null||s===void 0?void 0:s.querySelectorAll(i.selector);a?.forEach(o=>{var l=o;i.html&&(l.innerHTML=i.html),i.css&&l.setAttribute("style",i.css)})}}):Jo.logInfo("Control variants leave the page unmodified.")}_is_bot(){return kc&&this.instance?zPe(kc,this.instance.config.custom_blocked_useragents):void 0}};var K$={},Cz=()=>{},yb="posthog",UPe=!oJe&&ia?.indexOf("MSIE")===-1&&ia?.indexOf("Mozilla")===-1,qie=()=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:xHe(ln?.location),persistence:"localStorage+cookie",persistence_name:"",loaded:Cz,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:Pl&&ca(Pl?.search)&&Pl.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(Ve==null||(e=Ve.location)===null||e===void 0?void 0:e.protocol)==="https:",ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var n="Bad HTTP status: "+t.statusCode+" "+t.text;bn.error(n)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Pz},_onCapture:Cz}},zie=e=>{var t={};Yt(e.process_person)||(t.person_profiles=e.process_person),Yt(e.xhr_headers)||(t.request_headers=e.xhr_headers),Yt(e.cookie_name)||(t.persistence_name=e.cookie_name),Yt(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),Yt(e.store_google)||(t.save_campaign_params=e.store_google),Yt(e.verbose)||(t.debug=e.verbose);var n=Fs({},t,e);return _s(e.property_blacklist)&&(Yt(e.property_denylist)?n.property_denylist=e.property_blacklist:_s(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:bn.error("Invalid value for property_denylist config: "+e.property_denylist)),n};class wJe{constructor(){Nt(this,"__forceAllowLocalhost",!1)}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(t){bn.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class z3{get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){Nt(this,"webPerformance",new wJe),Nt(this,"_personProcessingSetOncePropertiesSent",!1),Nt(this,"version",Zf.LIB_VERSION),Nt(this,"_internalEventEmitter",new LPe),this.config=qie(),this.SentryIntegration=_Ke,this.sentryIntegration=t=>function(n,r){var i=OPe(n,r);return{name:pPe,processEvent:s=>i(s)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.featureFlags=new BKe(this),this.toolbar=new CKe(this),this.scrollManager=new dJe(this),this.pageViewManager=new NKe(this),this.surveys=new rJe(this),this.experiments=new bJe(this),this.exceptions=new XKe(this),this.rateLimiter=new iJe(this),this.requestRouter=new vJe(this),this.consent=new GHe(this),this.people={set:(t,n,r)=>{var i=ca(t)?{[t]:n}:t;this.setPersonProperties(i),r?.({})},set_once:(t,n,r)=>{var i=ca(t)?{[t]:n}:t;this.setPersonProperties(void 0,i),r?.({})}},this.on("eventCaptured",t=>bn.info('send "'.concat(t?.event,'"'),t))}init(t,n,r){if(r&&r!==yb){var i,s=(i=K$[r])!==null&&i!==void 0?i:new z3;return s._init(t,n,r),K$[r]=s,K$[yb][r]=s,s}return this._init(t,n,r)}_init(t){var n,r,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0;if(Yt(t)||Kq(t))return bn.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return bn.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this._triggered_notifs=[],i.person_profiles&&(this._initialPersonProfilesConfig=i.person_profiles),this.set_config(Fs({},qie(),zie(i),{name:s,token:t})),this.config.on_xhr_error&&bn.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:pd.GZipJS,this.persistence=new f6(this.config),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new f6(et(et({},this.config),{},{persistence:"sessionStorage"}));var a=et({},this.persistence.props),o=et({},this.sessionPersistence.props);if(this._requestQueue=new lJe(v=>this._send_retriable_request(v),this.config.request_queue_config),this._retryQueue=new uJe(this),this.__request_queue=[],this.config.__preview_experimental_cookieless_mode||(this.sessionManager=new pJe(this),this.sessionPropsManager=new fJe(this,this.sessionManager,this.persistence)),new QKe(this).startIfEnabledOrStop(),this.siteApps=new gJe(this),(n=this.siteApps)===null||n===void 0||n.init(),this.config.__preview_experimental_cookieless_mode||(this.sessionRecording=new kKe(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new XHe(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new DKe(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new RKe(this),this.exceptionObserver=new YHe(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new iPe(this,BHe),this.deadClicksAutocapture.startIfEnabled(),Zf.DEBUG=Zf.DEBUG||this.config.debug,Zf.DEBUG&&bn.info("Starting in debug mode",{this:this,config:i,thisC:et({},this.config),p:a,s:o}),this._sync_opt_out_with_persistence(),((r=i.bootstrap)===null||r===void 0?void 0:r.distinctID)!==void 0){var l,c,u=this.config.get_device_id(eg()),d=(l=i.bootstrap)!==null&&l!==void 0&&l.isIdentifiedID?u:i.bootstrap.distinctID;this.persistence.set_property(qf,(c=i.bootstrap)!==null&&c!==void 0&&c.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.bootstrap.distinctID,$device_id:d})}if(this._hasBootstrappedFeatureFlags()){var h,f,O=Object.keys(((h=i.bootstrap)===null||h===void 0?void 0:h.featureFlags)||{}).filter(v=>{var y,w;return!((y=i.bootstrap)===null||y===void 0||(w=y.featureFlags)===null||w===void 0||!w[v])}).reduce((v,y)=>{var w,k;return v[y]=((w=i.bootstrap)===null||w===void 0||(k=w.featureFlags)===null||k===void 0?void 0:k[y])||!1,v},{}),g=Object.keys(((f=i.bootstrap)===null||f===void 0?void 0:f.featureFlagPayloads)||{}).filter(v=>O[v]).reduce((v,y)=>{var w,k,x,S;return(w=i.bootstrap)!==null&&w!==void 0&&(k=w.featureFlagPayloads)!==null&&k!==void 0&&k[y]&&(v[y]=(x=i.bootstrap)===null||x===void 0||(S=x.featureFlagPayloads)===null||S===void 0?void 0:S[y]),v},{});this.featureFlags.receivedFeatureFlags({featureFlags:O,featureFlagPayloads:g})}if(this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:Bre,$device_id:null},"");else if(!this.get_distinct_id()){var m=this.config.get_device_id(eg());this.register_once({distinct_id:m,$device_id:m},""),this.persistence.set_property(qf,"anonymous")}return Ls(Ve,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),i.segment?TKe(this,()=>this._loaded()):this._loaded(),Sd(this.config._onCapture)&&this.config._onCapture!==Cz&&(bn.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",v=>this.config._onCapture(v.event,v))),this}_onRemoteConfig(t){var n,r,i,s,a,o,l,c;if(!ln||!ln.body)return bn.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this._onRemoteConfig(t)},500);this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=wr(t.supportedCompression,pd.GZipJS)?pd.GZipJS:wr(t.supportedCompression,pd.Base64)?pd.Base64:void 0),(n=t.analytics)!==null&&n!==void 0&&n.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:"identified_only"}),(r=this.siteApps)===null||r===void 0||r.onRemoteConfig(t),(i=this.sessionRecording)===null||i===void 0||i.onRemoteConfig(t),(s=this.autocapture)===null||s===void 0||s.onRemoteConfig(t),(a=this.heatmaps)===null||a===void 0||a.onRemoteConfig(t),this.surveys.onRemoteConfig(t),(o=this.webVitalsAutocapture)===null||o===void 0||o.onRemoteConfig(t),(l=this.exceptionObserver)===null||l===void 0||l.onRemoteConfig(t),(c=this.deadClicksAutocapture)===null||c===void 0||c.onRemoteConfig(t)}_loaded(){try{this.config.loaded(this)}catch(t){bn.critical("`loaded` function failed",t)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout(()=>{this.consent.isOptedIn()&&this._captureInitialPageview()},1),new sJe(this).load(),this.featureFlags.decide()}_start_queue_if_opted_in(){var t;this.has_opted_out_capturing()||this.config.request_batching&&((t=this._requestQueue)===null||t===void 0||t.enable())}_dom_loaded(){this.has_opted_out_capturing()||yg(this.__request_queue,t=>this._send_retriable_request(t)),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var t,n;this.config.request_batching?(this._shouldCapturePageleave()&&this.capture("$pageleave"),(t=this._requestQueue)===null||t===void 0||t.unload(),(n=this._retryQueue)===null||n===void 0||n.unload()):this._shouldCapturePageleave()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(UPe?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=n5(t.url,{ip:this.config.ip?1:0}),t.headers=et({},this.config.request_headers),t.compression=t.compression==="best-available"?this.compression:t.compression,t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var r,i,s,a=et({},n);a.timeout=a.timeout||6e4,a.url=n5(a.url,{_:new Date().getTime().toString(),ver:Zf.LIB_VERSION,compression:a.compression});var o=(r=a.transport)!==null&&r!==void 0?r:"fetch",l=(i=(s=q_e(H$,c=>c.transport===o))===null||s===void 0?void 0:s.method)!==null&&i!==void 0?i:H$[0].method;if(!l)throw new Error("No available transport method");l(a)})(et(et({},t),{},{callback:n=>{var r,i,s;this.rateLimiter.checkForLimiting(n),n.statusCode>=400&&((i=(s=this.config).on_request_error)===null||i===void 0||i.call(s,n)),(r=t.callback)===null||r===void 0||r.call(t,n)}}))))}_send_retriable_request(t){this._retryQueue?this._retryQueue.retriableRequest(t):this._send_request(t)}_execute_array(t){var n,r=[],i=[],s=[];yg(t,o=>{o&&(n=o[0],_s(n)?s.push(o):Sd(o)?o.call(this):_s(o)&&n==="alias"?r.push(o):_s(o)&&n.indexOf("capture")!==-1&&Sd(this[n])?s.push(o):i.push(o))});var a=function(o,l){yg(o,function(c){if(_s(c[0])){var u=l;_i(c,function(d){u=u[d[0]].apply(u,d.slice(1))})}else this[c[0]].apply(this,c.slice(1))},l)};a(r,this),a(i,this),a(s,this)}_hasBootstrappedFeatureFlags(){var t,n;return((t=this.config.bootstrap)===null||t===void 0?void 0:t.featureFlags)&&Object.keys((n=this.config.bootstrap)===null||n===void 0?void 0:n.featureFlags).length>0||!1}push(t){this._execute_array([t])}capture(t,n,r){var i;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(!this.consent.isOptedOut())if(!Yt(t)&&ca(t)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var s=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(s==null||!s.isRateLimited){n!=null&&n.$current_url&&!ca(n?.$current_url)&&(bn.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var a=new Date,o=r?.timestamp||a,l=eg(),c={uuid:l,event:t,properties:this._calculate_event_properties(t,n||{},o,l)};s&&(c.properties.$lib_rate_limit_remaining_tokens=s.remainingTokens),r?.$set&&(c.$set=r?.$set);var u=this._calculate_set_once_properties(r?.$set_once);u&&(c.$set_once=u),(c=bHe(c,r!=null&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=o,Yt(r?.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=a);var d=et(et({},c.properties.$set),c.$set);if(Eb(d)||this.setPersonPropertiesForFlags(d),!fi(this.config.before_send)){var h=this._runBeforeSend(c);if(!h)return;c=h}this._internalEventEmitter.emit("eventCaptured",c);var f={method:"POST",url:(i=r?._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",batchKey:r?._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this._send_retriable_request(f):this._requestQueue.enqueue(f),c}bn.critical("This capture call is ignored due to client rate limiting.")}}else bn.error("No event name provided to posthog.capture")}else bn.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",n=>t(n.event,n))}_calculate_event_properties(t,n,r,i){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var s=this.persistence.remove_event_timer(t),a=et({},n);if(a.token=this.config.token,this.config.__preview_experimental_cookieless_mode&&(a.$cookieless_mode=!0),t==="$snapshot"){var o=et(et({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=o.distinct_id,(!ca(a.distinct_id)&&!al(a.distinct_id)||Kq(a.distinct_id))&&bn.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var l,c=ns.properties({maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});if(this.sessionManager){var{sessionId:u,windowId:d}=this.sessionManager.checkAndGetSessionAndWindowId();a.$session_id=u,a.$window_id=d}this.sessionPropsManager&&Fs(a,this.sessionPropsManager.getSessionProps());try{var h,f;this.sessionRecording&&Fs(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(h=this._retryQueue)===null||h===void 0||(f=h.queue)===null||f===void 0?void 0:f.length}catch(v){a.$sdk_debug_error_capturing_properties=String(v)}if(this.requestRouter.region===g0.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),l=t==="$pageview"?this.pageViewManager.doPageView(r,i):t==="$pageleave"?this.pageViewManager.doPageLeave(r):this.pageViewManager.doEvent(),a=Fs(a,l),t==="$pageview"&&ln&&(a.title=ln.title),!Yt(s)){var O=r.getTime()-s;a.$duration=parseFloat((O/1e3).toFixed(3))}ia&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Fs({},c,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),_s(this.config.property_denylist)?_i(this.config.property_denylist,function(v){delete a[v]}):bn.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var g=this.config.sanitize_properties;g&&(bn.error("sanitize_properties is deprecated. Use before_send instead"),a=g(a,t));var m=this._hasPersonProcessing();return a.$process_person_profile=m,m&&this._requirePersonProcessing("_calculate_event_properties"),a}_calculate_set_once_properties(t){var n;if(!this.persistence||!this._hasPersonProcessing()||this._personProcessingSetOncePropertiesSent)return t;var r=this.persistence.get_initial_props(),i=(n=this.sessionPropsManager)===null||n===void 0?void 0:n.getSetOnceProps(),s=Fs({},r,i||{},t||{}),a=this.config.sanitize_properties;return a&&(bn.error("sanitize_properties is deprecated. Use before_send instead"),s=a(s,"$set_once")),this._personProcessingSetOncePropertiesSent=!0,Eb(s)?void 0:s}register(t,n){var r;(r=this.persistence)===null||r===void 0||r.register(t,n)}register_once(t,n,r){var i;(i=this.persistence)===null||i===void 0||i.register_once(t,n,r)}register_for_session(t){var n;(n=this.sessionPersistence)===null||n===void 0||n.register(t)}unregister(t){var n;(n=this.persistence)===null||n===void 0||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(t)}_register_single(t,n){this.register({[t]:n})}getFeatureFlag(t,n){return this.featureFlags.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n=this.featureFlags.getFeatureFlagPayload(t);try{return JSON.parse(n)}catch{return n}}isFeatureEnabled(t,n){return this.featureFlags.isFeatureEnabled(t,n)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(t,n){this.featureFlags.updateEarlyAccessFeatureEnrollment(t,n)}getEarlyAccessFeatures(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1],r=arguments.length>2?arguments[2]:void 0;return this.featureFlags.getEarlyAccessFeatures(t,n,r)}on(t,n){return this._internalEventEmitter.on(t,n)}onFeatureFlags(t){return this.featureFlags.onFeatureFlags(t)}onSurveysLoaded(t){return this.surveys.onSurveysLoaded(t)}onSessionId(t){var n,r;return(n=(r=this.sessionManager)===null||r===void 0?void 0:r.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getSurveys(t,n)}getActiveMatchingSurveys(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getActiveMatchingSurveys(t,n)}renderSurvey(t,n){this.surveys.renderSurvey(t,n)}canRenderSurvey(t){return this.surveys.canRenderSurvey(t)}identify(t,n,r){if(!this.__loaded||!this.persistence)return bn.uninitializedWarning("posthog.identify");if(al(t)&&(t=t.toString(),bn.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),t){if(["distinct_id","distinctid"].includes(t.toLowerCase()))bn.critical('The string "'.concat(t,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else if(this._requirePersonProcessing("posthog.identify")){var i=this.get_distinct_id();if(this.register({$user_id:t}),!this.get_property("$device_id")){var s=i;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}t!==i&&t!==this.get_property(v$)&&(this.unregister(v$),this.register({distinct_id:t}));var a=(this.persistence.get_property(qf)||"anonymous")==="anonymous";t!==i&&a?(this.persistence.set_property(qf,"identified"),this.setPersonPropertiesForFlags(et(et({},r||{}),n||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:i},{$set:n||{},$set_once:r||{}}),this._cachedPersonProperties=jie(t,n,r),this.featureFlags.setAnonymousDistinctId(i)):(n||r)&&this.setPersonProperties(n,r),t!==i&&(this.reloadFeatureFlags(),this.unregister(VR))}}else bn.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,n){if((t||n)&&this._requirePersonProcessing("posthog.setPersonProperties")){var r=jie(this.get_distinct_id(),t,n);this._cachedPersonProperties!==r?(this.setPersonPropertiesForFlags(et(et({},n||{}),t||{})),this.capture("$set",{$set:t||{},$set_once:n||{}}),this._cachedPersonProperties=r):bn.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,n,r){if(t&&n){if(this._requirePersonProcessing("posthog.group")){var i=this.getGroups();i[t]!==n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:et(et({},i),{},{[t]:n})}),r&&(this.capture("$groupidentify",{$group_type:t,$group_key:n,$group_set:r}),this.setGroupPropertiesForFlags({[t]:r})),i[t]===n||r||this.reloadFeatureFlags()}}else bn.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this.featureFlags.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(t,n)}resetGroupPropertiesForFlags(t){this.featureFlags.resetGroupPropertiesForFlags(t)}reset(t){var n,r,i,s;if(bn.info("reset"),!this.__loaded)return bn.uninitializedWarning("posthog.reset");var a=this.get_property("$device_id");if(this.consent.reset(),(n=this.persistence)===null||n===void 0||n.clear(),(r=this.sessionPersistence)===null||r===void 0||r.clear(),this.surveys.reset(),(i=this.persistence)===null||i===void 0||i.set_property(qf,"anonymous"),(s=this.sessionManager)===null||s===void 0||s.resetSessionId(),this._cachedPersonProperties=null,this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:Bre,$device_id:null},"");else{var o=this.config.get_device_id(eg());this.register_once({distinct_id:o,$device_id:t?o:a},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)===null||n===void 0?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(n));if(t!=null&&t.withTimestamp&&r){var s,a=(s=t.timestampLookBack)!==null&&s!==void 0?s:10;if(!r)return i;var o=Math.max(Math.floor((new Date().getTime()-r)/1e3)-a,0);i+="?t=".concat(o)}return i}alias(t,n){return t===this.get_property(z_e)?(bn.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Yt(n)&&(n=this.get_distinct_id()),t!==n?(this._register_single(v$,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(bn.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n,r,i,s,a=et({},this.config);Ps(t)&&(Fs(this.config,zie(t)),(n=this.persistence)===null||n===void 0||n.update_config(this.config,a),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new f6(et(et({},this.config),{},{persistence:"sessionStorage"})),ga.is_supported()&&ga.get("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(Zf.DEBUG=!0,bn.info("set_config",JSON.stringify({config:t,oldConfig:a,newConfig:et({},this.config)},null,2))),(r=this.sessionRecording)===null||r===void 0||r.startIfEnabledOrStop(),(i=this.autocapture)===null||i===void 0||i.startIfEnabled(),(s=this.heatmaps)===null||s===void 0||s.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence())}startSessionRecording(t){var n=t===!0,r={sampling:n||!(t==null||!t.sampling),linked_flag:n||!(t==null||!t.linked_flag),url_trigger:n||!(t==null||!t.url_trigger),event_trigger:n||!(t==null||!t.event_trigger)};if(Object.values(r).some(Boolean)){var i,s,a,o,l;(i=this.sessionManager)===null||i===void 0||i.checkAndGetSessionAndWindowId(),r.sampling&&((s=this.sessionRecording)===null||s===void 0||s.overrideSampling()),r.linked_flag&&((a=this.sessionRecording)===null||a===void 0||a.overrideLinkedFlag()),r.url_trigger&&((o=this.sessionRecording)===null||o===void 0||o.overrideTrigger("url")),r.event_trigger&&((l=this.sessionRecording)===null||l===void 0||l.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)===null||t===void 0||!t.started)}captureException(t,n){var r=new Error("PostHog syntheticException");this.exceptions.sendExceptionEvent(et(et({},oKe((i=>i instanceof Error)(t)?{error:t,event:t.message}:{event:t},{syntheticException:r})),n))}loadToolbar(t){return this.toolbar.loadToolbar(t)}get_property(t){var n;return(n=this.persistence)===null||n===void 0?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)===null||n===void 0?void 0:n.props[t]}toString(){var t,n=(t=this.config.name)!==null&&t!==void 0?t:yb;return n!==yb&&(n=yb+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)===null||t===void 0?void 0:t.get_property(qf))==="identified"||((n=this.sessionPersistence)===null||n===void 0?void 0:n.get_property(qf))==="identified"}_hasPersonProcessing(){var t,n,r,i;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Eb(this.getGroups())&&((t=this.persistence)===null||t===void 0||(n=t.props)===null||n===void 0||!n[v$])&&((r=this.persistence)===null||r===void 0||(i=r.props)===null||i===void 0||!i[BR]))}_shouldCapturePageleave(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}_requirePersonProcessing(t){return this.config.person_profiles==="never"?(bn.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(BR,!0),!0)}_sync_opt_out_with_persistence(){var t,n,r,i,s=this.consent.isOptedOut(),a=this.config.opt_out_persistence_by_default,o=this.config.disable_persistence||s&&!!a;((t=this.persistence)===null||t===void 0?void 0:t.disabled)!==o&&((r=this.persistence)===null||r===void 0||r.set_disabled(o)),((n=this.sessionPersistence)===null||n===void 0?void 0:n.disabled)!==o&&((i=this.sessionPersistence)===null||i===void 0||i.set_disabled(o))}opt_in_capturing(t){var n;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),(Yt(t?.captureEventName)||t!=null&&t.captureEventName)&&this.capture((n=t?.captureEventName)!==null&&n!==void 0?n:"$opt_in",t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}opt_out_capturing(){this.consent.optInOut(!1),this._sync_opt_out_with_persistence()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return kc?zPe(kc,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){ln&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:ln.title},{send_instantly:!0}))}debug(t){t===!1?(Ve?.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(Ve?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}_runBeforeSend(t){if(fi(this.config.before_send))return t;var n=_s(this.config.before_send)?this.config.before_send:[this.config.before_send],r=t;for(var i of n){if(r=i(r),fi(r)){var s="Event '".concat(t.event,"' was rejected in beforeSend function");return mHe(t.event)?bn.warn("".concat(s,". This can cause unexpected behavior.")):bn.info(s),null}r.properties&&!Eb(r.properties)||bn.warn("Event '".concat(t.event,"' has no properties after beforeSend function, this is likely an error."))}return r}getPageViewId(){var t;return(t=this.pageViewManager._currentPageview)===null||t===void 0?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,r){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(r)})}}(function(e,t){for(var n=0;n<t.length;n++)e.prototype[t[n]]=yHe(e.prototype[t[n]])})(z3,["identify"]);var Uie,c0=(Uie=K$[yb]=new z3,function(){function e(){e.done||(e.done=!0,UPe=!1,_i(K$,function(t){t._dom_loaded()}))}ln!=null&&ln.addEventListener?ln.readyState==="complete"?e():Ls(ln,"DOMContentLoaded",e,{capture:!1}):Ve&&bn.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),Uie),HY=b.createContext({client:c0});function WPe(e,t,n){if(n===void 0&&(n=new WeakMap),e===t)return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(n.has(e)&&n.get(e)===t)return!0;n.set(e,t);var r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(var s=0,a=r;s<a.length;s++){var o=a[s];if(!i.includes(o)||!WPe(e[o],t[o],n))return!1}return!0}function xJe(e){var t=e.children,n=e.client,r=e.apiKey,i=e.options,s=b.useRef(null),a=b.useMemo(function(){return n?(r&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),i&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),n):(r||console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior."),c0)},[n,r,JSON.stringify(i)]);return b.useEffect(function(){if(!n){var o=s.current;o?(r!==o.apiKey&&console.warn("[PostHog.js] You have provided a different `apiKey` to `PostHogProvider` than the one that was already initialized. This is not supported by our provider and we'll keep using the previous key. If you need to toggle between API Keys you need to control the `client` yourself and pass it in as a prop rather than an `apiKey` prop."),i&&!WPe(i,o.options)&&c0.set_config(i),s.current={apiKey:r,options:i??{}}):(c0.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),c0.init(r,i),s.current={apiKey:r,options:i??{}})}},[n,r,JSON.stringify(i)]),H.createElement(HY.Provider,{value:{client:a}},t)}var SJe=function(){var e=b.useContext(HY).client;return e};function g6(e){var t=SJe(),n=b.useState(function(){return t.isFeatureEnabled(e)}),r=n[0],i=n[1];return b.useEffect(function(){return t.onFeatureFlags(function(){i(t.isFeatureEnabled(e))})},[t,e]),r}var Ez=function(e,t){return Ez=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},Ez(e,t)};function $Je(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Ez(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var m6=function(e){return typeof e=="function"},kJe={componentStack:null,error:null},TJe={INVALID_FALLBACK:"[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."};(function(e){$Je(t,e);function t(n){var r=e.call(this,n)||this;return r.state=kJe,r}return t.prototype.componentDidCatch=function(n,r){var i=r.componentStack,s=this.props.additionalProperties;this.setState({error:n,componentStack:i});var a;m6(s)?a=s(n):typeof s=="object"&&(a=s);var o=this.context.client;o.captureException(n,a)},t.prototype.render=function(){var n=this.props,r=n.children,i=n.fallback,s=this.state;if(s.componentStack==null)return m6(r)?r():r;var a=m6(i)?H.createElement(i,{error:s.error,componentStack:s.componentStack}):i;return H.isValidElement(a)?a:(console.warn(TJe.INVALID_FALLBACK),H.createElement(H.Fragment,null))},t.contextType=HY,t})(H.Component);/**
|
|
@@ -1188,7 +1188,7 @@ l0,-`+(n+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
|
|
|
1188
1188
|
`,before:f,encode:["$"],...u.current()})),O()}return f+=u.move(`
|
|
1189
1189
|
`),c&&(f+=u.move(c+`
|
|
1190
1190
|
`)),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 O;for(;O=f.exec(l);){let g=O.index;l.codePointAt(g)===10&&l.codePointAt(g-1)===13&&g--,l=l.slice(0,g)+" "+l.slice(O.index+1)}}return u+l+u}function i(){return"$"}}const vMt={tokenize:yMt,concrete:!0,name:"mathFlow"},vge={tokenize:bMt,partial:!0};function yMt(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(y){return e.enter("mathFlow"),e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),l(y)}function l(y){return y===36?(e.consume(y),a++,l):a<2?n(y):(e.exit("mathFlowFenceSequence"),vr(e,c,"whitespace")(y))}function c(y){return y===null||wn(y)?d(y):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),u(y))}function u(y){return y===null||wn(y)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),d(y)):y===36?n(y):(e.consume(y),u)}function d(y){return e.exit("mathFlowFence"),r.interrupt?t(y):e.attempt(vge,h,m)(y)}function h(y){return e.attempt({tokenize:v,partial:!0},m,f)(y)}function f(y){return(s?vr(e,O,"linePrefix",s+1):O)(y)}function O(y){return y===null?m(y):wn(y)?e.attempt(vge,h,m)(y):(e.enter("mathFlowValue"),g(y))}function g(y){return y===null||wn(y)?(e.exit("mathFlowValue"),O(y)):(e.consume(y),g)}function m(y){return e.exit("mathFlow"),t(y)}function v(y,w,k){let x=0;return vr(y,S,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function S(P){return y.enter("mathFlowFence"),y.enter("mathFlowFenceSequence"),T(P)}function T(P){return P===36?(x++,y.consume(P),T):x<a?k(P):(y.exit("mathFlowFenceSequence"),vr(y,_,"whitespace")(P))}function _(P){return P===null||wn(P)?(y.exit("mathFlowFence"),w(P)):k(P)}}}function bMt(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 wMt(e){let n=(e||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:r,resolve:xMt,previous:SMt,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,O(g)):g===32?(i.enter("space"),i.consume(g),i.exit("space"),h):wn(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||wn(g)?(i.exit("mathTextData"),h(g)):(i.consume(g),f)}function O(g){return g===36?(i.consume(g),l++,O):l===o?(i.exit("mathTextSequence"),i.exit("mathText"),s(g)):(c.type="mathTextData",f(g))}}}function xMt(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 SMt(e){return e!==36||this.events[this.events.length-1][1].type==="characterEscape"}function $Mt(e){return{flow:{36:vMt},text:{36:wMt(e)}}}const kMt={};function TMt(e){const t=this,n=e||kMt,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push($Mt(n)),s.push(gMt()),a.push(mMt(n))}const _Mt=e=>e.charCodeAt(e.length-1)===13?e.slice(0,-1):e,oNe=/^[ \t]*$/,PMt=/^ {0,3}(`{3,}|~{3,})/,lNe=/^ {0,3}(?:[-*+]|\d{1,9}[.)])(?:[ \t]|$)/,cNe=/^(?: {4}|\t)/,CMt=/^(?: {2,}|\t)/,EMt=()=>({source:"",cursor:0,blockStart:0,blankRunStart:-1,kind:"none",fence:null,blocks:[],revision:0}),QMt=e=>{e.source="",e.cursor=0,e.blockStart=0,e.blankRunStart=-1,e.kind="none",e.fence=null,e.blocks=[],e.revision+=1},yge=e=>cNe.test(e)?"indented-code":lNe.test(e)?"list":"other",RMt=(e,t)=>e==="list"?lNe.test(t)||CMt.test(t):e==="indented-code"?cNe.test(t):!1,AMt=(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:oNe.test(e.slice(n+r))},DMt=(e,t)=>{(t.length<e.source.length||!t.startsWith(e.source))&&QMt(e),e.source=t;let n=e.cursor;for(;;){const r=t.indexOf(`
|
|
1191
|
-
`,n);if(r===-1)break;const i=_Mt(t.slice(n,r));if(e.fence){AMt(i,e.fence)&&(e.fence=null),n=r+1;continue}if(oNe.test(i)){e.blankRunStart<0&&(e.blankRunStart=n),n=r+1;continue}if(e.blankRunStart>=0){if(e.kind==="none"||!RMt(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=yge(i)}e.blankRunStart=-1}else e.kind==="none"&&(e.kind=yge(i));if(e.kind!=="indented-code"){const s=PMt.exec(i);s&&(e.fence={char:s[1][0],length:s[1].length})}n=r+1}e.cursor=n},NMt=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},ar="var(--color-ink)",Qf="var(--color-ink-muted)",rh="var(--color-surface)",kO="var(--color-elevated)",Rf="var(--color-sunken)",vo="var(--color-hairline)",TO="var(--color-control)",Yy="var(--color-accent)",Q$="var(--color-accent-wash)",XMt="var(--color-on-accent)",IMt="var(--color-info)",uNe="var(--color-info-wash)",FMt="var(--color-success)",dNe="var(--color-success-wash)",MMt="var(--color-warning)",fG="var(--color-warning-wash)",jMt="var(--color-warning-border)",C7="var(--color-danger)",pG="var(--color-danger-wash)",bge=[Q$,uNe,dNe,fG,pG],_O=e=>getComputedStyle(document.documentElement).getPropertyValue(e).trim(),LMt=()=>{const e={primaryColor:_O("--color-accent"),secondaryColor:_O("--color-success"),tertiaryColor:_O("--color-info"),mainBkg:_O("--color-elevated"),clusterBkg:_O("--color-sunken"),clusterBorder:_O("--color-hairline"),edgeLabelBackground:_O("--color-surface"),quadrant1Fill:_O("--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:rh,primaryTextColor:ar,primaryBorderColor:TO,secondaryTextColor:ar,secondaryBorderColor:vo,tertiaryTextColor:ar,tertiaryBorderColor:vo,lineColor:Qf,arrowheadColor:Qf,textColor:ar,secondBkg:Rf,border1:TO,border2:vo,labelColor:ar,nodeBkg:kO,nodeBorder:TO,nodeTextColor:ar,defaultLinkColor:Qf,titleColor:ar,noteBkgColor:fG,noteBorderColor:jMt,noteTextColor:ar,actorBkg:kO,actorBorder:TO,actorTextColor:ar,actorLineColor:vo,signalColor:Qf,signalTextColor:ar,labelBoxBkgColor:kO,labelBoxBorderColor:vo,labelTextColor:ar,loopTextColor:ar,activationBkgColor:Q$,activationBorderColor:Yy,sequenceNumberColor:rh,sectionBkgColor:Rf,sectionBkgColor2:rh,altSectionBkgColor:Rf,excludeBkgColor:Rf,taskBkgColor:Q$,taskBorderColor:TO,taskTextColor:ar,taskTextLightColor:ar,taskTextDarkColor:ar,taskTextOutsideColor:ar,taskTextClickableColor:Yy,activeTaskBkgColor:Q$,activeTaskBorderColor:Yy,gridColor:vo,doneTaskBkgColor:Rf,doneTaskBorderColor:vo,critBkgColor:pG,critBorderColor:C7,todayLineColor:Yy,transitionColor:Qf,transitionLabelColor:ar,stateLabelColor:ar,stateBkg:kO,labelBackgroundColor:rh,compositeBackground:Rf,altBackground:Rf,compositeTitleBackground:kO,compositeBorder:vo,innerEndBackground:ar,specialStateColor:ar,classText:ar,attributeBackgroundColorOdd:rh,attributeBackgroundColorEven:Rf,rowOdd:rh,rowEven:Rf,errorBkgColor:pG,errorTextColor:C7,pieTitleTextColor:ar,pieSectionTextColor:ar,pieLegendTextColor:ar,pieStrokeColor:rh,pieOuterStrokeColor:vo,requirementBackground:kO,requirementBorderColor:TO,requirementTextColor:ar,relationColor:Qf,relationLabelBackground:rh,relationLabelColor:ar,branchLabelColor:XMt,commitLabelColor:ar,commitLabelBackground:rh,tagLabelColor:ar,tagLabelBackground:Q$,tagLabelBorder:TO,quadrant2Fill:uNe,quadrant3Fill:dNe,quadrant4Fill:fG,quadrant2TextFill:ar,quadrant3TextFill:ar,quadrant4TextFill:ar,quadrantPointFill:Yy,archEdgeColor:Qf,archEdgeArrowColor:Qf,archGroupBorderColor:vo,scaleLabelColor:ar,packet:{startByteColor:ar,endByteColor:ar,labelColor:ar,titleColor:ar,blockStrokeColor:TO,blockFillColor:kO},radar:{axisColor:Qf,axisStrokeWidth:2,axisLabelFontSize:12,curveOpacity:.5,curveStrokeWidth:2,graticuleColor:vo,graticuleStrokeWidth:1,graticuleOpacity:.3,legendBoxSize:12,legendFontSize:12},xyChart:{backgroundColor:rh,titleColor:ar,xAxisTitleColor:ar,xAxisLabelColor:ar,xAxisTickColor:vo,xAxisLineColor:vo,yAxisTitleColor:ar,yAxisLabelColor:ar,yAxisTickColor:vo,yAxisLineColor:vo,plotColorPalette:[Yy,IMt,FMt,MMt,C7].join(",")}};for(let n=0;n<5;n++)t[`surface${n}`]=kO,t[`surfacePeer${n}`]=vo;for(let n=0;n<8;n++)t[`fillType${n}`]=bge[n%bge.length];return{...t,...e}};let E7=null,wge=null;const qMt=async e=>{E7||(E7=je(async()=>{const{default:n}=await import("./mermaid.core-C8WrVHA6.js").then(r=>r.b4);return{default:n}},__vite__mapDeps([0,1,2]),import.meta.url).then(({default:n})=>n));const t=await E7;return wge!==e&&(t.initialize({startOnLoad:!0,theme:"base",securityLevel:"loose",fontFamily:"var(--font-sans)",fontSize:14,suppressErrorRendering:!0,themeVariables:LMt()}),wge=e),t},xge=({className:e,copied:t,onZoomIn:n,onZoomOut:r,onReset:i,onSave:s,onCopy:a,children:o})=>p.jsxs("div",{className:A("absolute z-10 flex items-center gap-0.5 rounded-md bg-elevated p-1 shadow-overlay",e),children:[p.jsx(it,{content:"Zoom in",children:p.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Zoom in",onClick:n,children:p.jsx(Sit,{})})}),p.jsx(it,{content:"Zoom out",children:p.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Zoom out",onClick:r,children:p.jsx(kit,{})})}),p.jsx(it,{content:"Drag the diagram to pan",children:p.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Drag to pan",children:p.jsx(Bnt,{})})}),p.jsx(it,{content:"Reset view",children:p.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Reset view",onClick:i,children:p.jsx(dZ,{})})}),p.jsx(it,{content:"Save as SVG",children:p.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Save as SVG",onClick:s,children:p.jsx(Np,{})})}),p.jsx(it,{content:t?"Copied":"Copy mermaid text",children:p.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":t?"Copied":"Copy mermaid text",onClick:a,children:p.jsx(ey,{className:A(t&&"text-success")})})}),o]}),OG=({title:e,children:t})=>p.jsxs(Ml,{variant:"danger",role:"alert",className:"my-4",children:[p.jsx(O_e,{children:e}),p.jsx(rT,{children:t})]});class zMt extends b.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||p.jsxs(OG,{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 UMt=b.memo(({chart:e,id:t})=>{const n=b.useRef(null),r=b.useRef(null),[i,s]=b.useState(null),[a,o]=b.useState(!0),[l,c]=b.useState(""),[u,d]=b.useState(!1),[h,f]=b.useState({scale:1,x:0,y:0}),[O,g]=b.useState({scale:1,x:0,y:0}),[m,v]=b.useState(!1),[y,w]=b.useState({x:0,y:0}),[k,x]=b.useState("idle"),[S,T]=b.useState("idle"),_=mn(N=>N.themeName),P=b.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 N=await qMt(_),z=t||`mermaid-${Date.now()}-${Math.floor(Math.random()*1e6)}`,{svg:V}=await N.render(z,e);if(!V||typeof V!="string"||V.trim().length===0)throw new Error("Mermaid failed to generate valid SVG output");c(V)}catch(N){console.error("Mermaid rendering error:",N);const z=N instanceof Error?N.message:"Failed to render mermaid diagram";s(z),c("")}finally{o(!1)}},[e,t,_]);b.useEffect(()=>{P().catch(N=>{console.error("Error in renderDiagram effect:",N),s("Failed to initialize diagram rendering"),o(!1)})},[P]);const E=b.useCallback(()=>{try{if(!l||!r.current)return 1;const z=r.current.getBoundingClientRect(),V=document.createElement("div");V.innerHTML=l;const ee=V.querySelector("svg");if(!ee)return 1;const oe=ee.getBoundingClientRect?.()?.width||Number.parseFloat(ee.getAttribute("width")||"0")||ee.viewBox?.baseVal?.width||800,ie=ee.getBoundingClientRect?.()?.height||Number.parseFloat(ee.getAttribute("height")||"0")||ee.viewBox?.baseVal?.height||600,he=z.width*.9/oe,te=z.height*.9/ie;return Math.min(he,te,1)}catch(N){return console.error("Error calculating fullscreen scale:",N),1}},[l]);b.useEffect(()=>{u&&l&&setTimeout(()=>{try{const N=E();g({scale:N,x:0,y:0})}catch(N){console.error("Error setting fullscreen transform:",N)}},100)},[u,l,E]);const C=b.useCallback((N=!1)=>{try{(N?g:f)(V=>({...V,scale:Math.min(V.scale*1.2,10)}))}catch(z){console.error("Error in zoom in:",z)}},[]),Q=b.useCallback((N=!1)=>{try{(N?g:f)(V=>({...V,scale:Math.max(V.scale/1.2,.1)}))}catch(z){console.error("Error in zoom out:",z)}},[]),D=b.useCallback((N=!1)=>{try{const z=N?g:f;if(N){const V=E();z({scale:V,x:0,y:0})}else z({scale:1,x:0,y:0})}catch(z){console.error("Error in reset:",z)}},[E]),F=b.useCallback(()=>{if(l)try{const N=new Blob([l],{type:"image/svg+xml"}),z=URL.createObjectURL(N),V=document.createElement("a");V.href=z,V.download=`mermaid-diagram-${Date.now()}.svg`,document.body.appendChild(V),V.click(),document.body.removeChild(V),URL.revokeObjectURL(z)}catch(N){console.error("Failed to save SVG:",N)}},[l]),I=b.useCallback(async()=>{try{await navigator.clipboard.writeText(e),x("copied"),setTimeout(()=>x("idle"),1200)}catch(N){console.error("Failed to copy Mermaid chart text:",N)}},[e]),U=b.useCallback(async()=>{try{await navigator.clipboard.writeText(e),T("copied"),setTimeout(()=>T("idle"),1200)}catch(N){console.error("Failed to copy Mermaid chart text:",N)}},[e]),q=b.useCallback(N=>{try{v(!0),w({x:N.clientX,y:N.clientY}),N.preventDefault()}catch(z){console.error("Error in mouse down:",z)}},[]),Z=b.useCallback((N,z=!1)=>{try{if(!m)return;const V=N.clientX-y.x,ee=N.clientY-y.y;(z?g:f)(ie=>({...ie,x:ie.x+V,y:ie.y+ee})),w({x:N.clientX,y:N.clientY})}catch(V){console.error("Error in mouse move:",V)}},[m,y]),W=b.useCallback(()=>{try{v(!1)}catch(N){console.error("Error in mouse up:",N)}},[]),M=b.useCallback((N,z=!1)=>{try{N.preventDefault();const V=N.deltaY>0?.9:1.1;(z?g:f)(oe=>({...oe,scale:Math.min(Math.max(oe.scale*V,.1),5)}))}catch(V){console.error("Error in wheel:",V)}},[]),J=b.useCallback(N=>{try{d(N)}catch(z){console.error("Error toggling fullscreen:",z)}},[]);if(i)return p.jsxs(OG,{title:"Mermaid diagram error",children:[i,p.jsx("span",{className:A("mt-2 block text-ink-muted"),children:"Chart"}),p.jsx("span",{className:A("mt-1 block whitespace-pre-wrap font-mono text-mono-sm"),children:e})]});const L=(N=!1)=>{try{const z=N?r:n,V=N?O:h;return p.jsx("div",{ref:z,className:A("mermaid flex w-full items-center justify-center",N?"h-full min-h-full":"h-auto min-h-50",m?"cursor-grabbing":"cursor-grab"),onMouseDown:q,onMouseMove:ee=>Z(ee,N),onMouseUp:W,onMouseLeave:W,onWheel:ee=>M(ee,N),children:a?p.jsx("div",{className:A("p-4 text-body-sm text-ink-muted"),children:"Loading diagram..."}):l?p.jsx("div",{className:A("flex h-full w-full items-center justify-center"),style:{transform:`translate(${V.x}px, ${V.y}px) scale(${V.scale})`,transformOrigin:"center center"},dangerouslySetInnerHTML:{__html:l}}):null})}catch(z){return console.error("Error rendering diagram content:",z),p.jsx(OG,{title:"Rendering error",children:"Failed to render diagram content."})}};return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:A("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:[L(!1),p.jsx(xge,{className:"top-2 right-2",copied:k==="copied",onZoomIn:()=>C(!1),onZoomOut:()=>Q(!1),onReset:()=>D(!1),onSave:F,onCopy:I,children:p.jsx(it,{content:"Fullscreen",children:p.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Open diagram fullscreen",onClick:()=>J(!0),children:p.jsx(Ant,{})})})})]}),p.jsx(Nc,{open:u,onClose:()=>J(!1),title:"Mermaid diagram",maxWidth:"xl",fullWidth:!0,dialogProps:{className:"h-[90vh] max-h-[90vh]"},children:p.jsxs("div",{className:A("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:[L(!0),p.jsx(xge,{className:"top-4 right-4",copied:S==="copied",onZoomIn:()=>C(!0),onZoomOut:()=>Q(!0),onReset:()=>D(!0),onSave:F,onCopy:U,children:p.jsx(it,{content:"Close fullscreen",children:p.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Close fullscreen",onClick:()=>J(!1),children:p.jsx(Qi,{})})})})]})})]})}),WMt=b.memo(e=>p.jsx(zMt,{children:p.jsx(UMt,{...e})}));let hNe=!1,Q7=null;const GMt=()=>(Q7||(Q7=je(()=>Promise.resolve({}),__vite__mapDeps([3]),import.meta.url).then(e=>(hNe=!0,e))),Q7),VMt=/language-(\w+)/,BMt=/\n$/,YMt=/\$(?!\d)(.+?)\$/,ZMt=/\$\$([\s\S]+?)\$\$/,HMt=/\\begin\{([^}]+)\}([\s\S]+?)\\end\{\1\}/,KMt=/\\[a-zA-Z]+(\{[^}]*\})?/,fNe={a:({href:e,children:t})=>p.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:t}),code:({node:e,className:t,children:n,...r})=>VMt.exec(t??"")?.[1]==="mermaid"?p.jsx(WMt,{chart:String(n).replace(BMt,"")}):p.jsx("code",{className:t,...r,children:n})},JMt=[mN],e8t=[mN,TMt],t8t=[],n8t=[U6t],r8t=e=>YMt.test(e)||ZMt.test(e)||HMt.test(e)?!0:KMt.test(e)&&(e.includes("\\frac")||e.includes("\\sum")||e.includes("\\int")||e.includes("\\sqrt")),pNe=e=>b.useMemo(()=>{if(!(!e?.fontSize&&!e?.lineHeight))return{"--md-font-size":e.fontSize,"--md-line-height":e.lineHeight}},[e?.fontSize,e?.lineHeight]),ONe=e=>{const t=b.useMemo(()=>r8t(e),[e]),[n,r]=b.useState(()=>t&&hNe);return b.useEffect(()=>{if(!t||n)return;let i=!1;return GMt().then(()=>{i||r(!0)}),()=>{i=!0}},[t,n]),{remarkPlugins:n?e8t:JMt,rehypePlugins:n?n8t:t8t}},uy=b.memo(({content:e,styleProps:t,className:n})=>{const r=b.useMemo(()=>e.trim(),[e]),{remarkPlugins:i,rehypePlugins:s}=ONe(r),a=pNe(t);return p.jsx("div",{className:A("lo-markdown",n),style:a,children:p.jsx(EK,{remarkPlugins:i,rehypePlugins:s,components:fNe,children:r})})});uy.displayName="MarkdownRenderer";const gNe=b.memo(({source:e})=>{const{remarkPlugins:t,rehypePlugins:n}=ONe(e);return p.jsx(EK,{remarkPlugins:t,rehypePlugins:n,components:fNe,children:e})});gNe.displayName="StableBlock";const mNe=b.memo(({text:e,animate:t})=>p.jsx("span",{className:t?"lo-stream-chunk":void 0,children:e}));mNe.displayName="ArrivedText";const vNe=({content:e,styleProps:t,className:n})=>{const r=b.useRef(null);r.current===null&&(r.current=EMt());const i=r.current,s=b.useRef([]),a=b.useRef(0);DMt(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+NMt(e.slice(l)),h=[{offset:l,animate:!1}];for(const O of c){if(O.offset>=d)break;h.push(O)}const f=pNe(t);return p.jsxs("div",{className:A("lo-markdown",n),style:f,children:[i.blocks.map((O,g)=>p.jsx(gNe,{source:O},g)),d>l&&p.jsx("p",{className:"lo-stream-tail",children:h.map((O,g)=>{const m=h[g+1]?.offset??d;return p.jsx(mNe,{text:e.slice(O.offset,m),animate:O.animate},O.offset)})})]})};vNe.displayName="StreamingMarkdown";const yNe=({className:e})=>p.jsx("div",{className:A("flex size-7 shrink-0 items-center justify-center rounded-full bg-sunken text-ink-muted",e),children:p.jsx(Jv,{size:16,"aria-label":"Assistant"})}),Ok="pl-10",yc=({isUser:e,children:t,isSmallView:n,showAvatar:r,className:i})=>e?p.jsx("div",{className:A("flex w-full justify-end",i),children:t}):p.jsxs("div",{className:A("relative w-full",!n&&Ok,i),children:[r&&!n&&p.jsx(yNe,{className:"absolute top-0 left-0"}),t]}),rJ=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.getTime()},i8t=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()+1),Math.max(1,t.getTime()-e)};let iJ=rJ(Date.now()),ZO=null;const HQ=new Set,bNe=()=>{ZO!==null&&clearTimeout(ZO),ZO=setTimeout(()=>{ZO=null,iJ=rJ(Date.now());for(const e of HQ)e();bNe()},i8t(Date.now())),ZO.unref?.()},s8t=e=>(HQ.add(e),iJ=rJ(Date.now()),bNe(),()=>{HQ.delete(e),HQ.size===0&&ZO!==null&&(clearTimeout(ZO),ZO=null)}),Sge=()=>iJ,a8t=()=>b.useSyncExternalStore(s8t,Sge,Sge),o8t=e=>new Date(e+1e3),l8t=()=>o8t(a8t()),wNe=6048e5,c8t=864e5,$ge=6e4,yrr=36e5,brr=1e3,kge=525600,Tge=43200,_ge=1440,Pge=Symbol.for("constructDateFrom");function zp(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Pge in e?e[Pge](t):e instanceof Date?new e.constructor(t):new Date(t)}function Xc(e,t){return zp(t||e,e)}let u8t={};function c2(){return u8t}function E_(e,t){const n=c2(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Xc(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 I4(e,t){return E_(e,{...t,weekStartsOn:1})}function xNe(e,t){const n=Xc(e,t?.in),r=n.getFullYear(),i=zp(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);const s=I4(i),a=zp(n,0);a.setFullYear(r,0,4),a.setHours(0,0,0,0);const o=I4(a);return n.getTime()>=s.getTime()?r+1:n.getTime()>=o.getTime()?r:r-1}function F4(e){const t=Xc(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 SNe(e,...t){const n=zp.bind(null,t.find(r=>typeof r=="object"));return t.map(n)}function Cge(e,t){const n=Xc(e,t?.in);return n.setHours(0,0,0,0),n}function d8t(e,t,n){const[r,i]=SNe(n?.in,e,t),s=Cge(r),a=Cge(i),o=+s-F4(s),l=+a-F4(a);return Math.round((o-l)/c8t)}function h8t(e,t){const n=xNe(e,t),r=zp(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),I4(r)}function f8t(e,t){const n=+Xc(e)-+Xc(t);return n<0?-1:n>0?1:n}function p8t(e){return zp(e,Date.now())}function O8t(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function g8t(e){return!(!O8t(e)&&typeof e!="number"||isNaN(+Xc(e)))}function m8t(e){return t=>{const r=(e?Math[e]:Math.trunc)(t);return r===0?0:r}}function v8t(e,t){const n=Xc(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const y8t={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"}},b8t=(e,t,n)=>{let r;const i=y8t[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 R7(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const w8t={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},x8t={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},S8t={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},$8t={date:R7({formats:w8t,defaultWidth:"full"}),time:R7({formats:x8t,defaultWidth:"full"}),dateTime:R7({formats:S8t,defaultWidth:"full"})},k8t={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},T8t=(e,t,n,r)=>k8t[e];function AS(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 _8t={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},P8t={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},C8t={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"]},E8t={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"]},Q8t={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"}},R8t={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"}},A8t=(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"},D8t={ordinalNumber:A8t,era:AS({values:_8t,defaultWidth:"wide"}),quarter:AS({values:P8t,defaultWidth:"wide",argumentCallback:e=>e-1}),month:AS({values:C8t,defaultWidth:"wide"}),day:AS({values:E8t,defaultWidth:"wide"}),dayPeriod:AS({values:Q8t,defaultWidth:"wide",formattingValues:R8t,defaultFormattingWidth:"wide"})};function DS(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)?X8t(o,d=>d.test(a)):N8t(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 N8t(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function X8t(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function I8t(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 F8t=/^(\d+)(th|st|nd|rd)?/i,M8t=/\d+/i,j8t={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},L8t={any:[/^b/i,/^(a|c)/i]},q8t={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},z8t={any:[/1/i,/2/i,/3/i,/4/i]},U8t={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},W8t={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]},G8t={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},V8t={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]},B8t={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},Y8t={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}},Z8t={ordinalNumber:I8t({matchPattern:F8t,parsePattern:M8t,valueCallback:e=>parseInt(e,10)}),era:DS({matchPatterns:j8t,defaultMatchWidth:"wide",parsePatterns:L8t,defaultParseWidth:"any"}),quarter:DS({matchPatterns:q8t,defaultMatchWidth:"wide",parsePatterns:z8t,defaultParseWidth:"any",valueCallback:e=>e+1}),month:DS({matchPatterns:U8t,defaultMatchWidth:"wide",parsePatterns:W8t,defaultParseWidth:"any"}),day:DS({matchPatterns:G8t,defaultMatchWidth:"wide",parsePatterns:V8t,defaultParseWidth:"any"}),dayPeriod:DS({matchPatterns:B8t,defaultMatchWidth:"any",parsePatterns:Y8t,defaultParseWidth:"any"})},$Ne={code:"en-US",formatDistance:b8t,formatLong:$8t,formatRelative:T8t,localize:D8t,match:Z8t,options:{weekStartsOn:0,firstWeekContainsDate:1}};function H8t(e,t){const n=Xc(e,t?.in);return d8t(n,v8t(n))+1}function K8t(e,t){const n=Xc(e,t?.in),r=+I4(n)-+h8t(n);return Math.round(r/wNe)+1}function kNe(e,t){const n=Xc(e,t?.in),r=n.getFullYear(),i=c2(),s=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,a=zp(t?.in||e,0);a.setFullYear(r+1,0,s),a.setHours(0,0,0,0);const o=E_(a,t),l=zp(t?.in||e,0);l.setFullYear(r,0,s),l.setHours(0,0,0,0);const c=E_(l,t);return+n>=+o?r+1:+n>=+c?r:r-1}function J8t(e,t){const n=c2(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=kNe(e,t),s=zp(t?.in||e,0);return s.setFullYear(i,0,r),s.setHours(0,0,0,0),E_(s,t)}function e7t(e,t){const n=Xc(e,t?.in),r=+E_(n,t)-+J8t(n,t);return Math.round(r/wNe)+1}function ci(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const PO={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return ci(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):ci(n+1,2)},d(e,t){return ci(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 ci(e.getHours()%12||12,t.length)},H(e,t){return ci(e.getHours(),t.length)},m(e,t){return ci(e.getMinutes(),t.length)},s(e,t){return ci(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),i=Math.trunc(r*Math.pow(10,n-3));return ci(i,t.length)}},Zy={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ege={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 PO.y(e,t)},Y:function(e,t,n,r){const i=kNe(e,r),s=i>0?i:1-i;if(t==="YY"){const a=s%100;return ci(a,2)}return t==="Yo"?n.ordinalNumber(s,{unit:"year"}):ci(s,t.length)},R:function(e,t){const n=xNe(e);return ci(n,t.length)},u:function(e,t){const n=e.getFullYear();return ci(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 ci(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 ci(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 PO.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 ci(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=e7t(e,r);return t==="wo"?n.ordinalNumber(i,{unit:"week"}):ci(i,t.length)},I:function(e,t,n){const r=K8t(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):ci(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):PO.d(e,t)},D:function(e,t,n){const r=H8t(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):ci(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 ci(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 ci(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 ci(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=Zy.noon:r===0?i=Zy.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=Zy.evening:r>=12?i=Zy.afternoon:r>=4?i=Zy.morning:i=Zy.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 PO.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):PO.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):ci(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):ci(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):PO.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):PO.s(e,t)},S:function(e,t){return PO.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return Rge(r);case"XXXX":case"XX":return r0(r);case"XXXXX":case"XXX":default:return r0(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return Rge(r);case"xxxx":case"xx":return r0(r);case"xxxxx":case"xxx":default:return r0(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Qge(r,":");case"OOOO":default:return"GMT"+r0(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Qge(r,":");case"zzzz":default:return"GMT"+r0(r,":")}},t:function(e,t,n){const r=Math.trunc(+e/1e3);return ci(r,t.length)},T:function(e,t,n){return ci(+e,t.length)}};function Qge(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+ci(s,2)}function Rge(e,t){return e%60===0?(e>0?"-":"+")+ci(Math.abs(e)/60,2):r0(e,t)}function r0(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=ci(Math.trunc(r/60),2),s=ci(r%60,2);return n+i+t+s}const Age=(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"})}},TNe=(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"})}},t7t=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return Age(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}}",Age(r,t)).replace("{{time}}",TNe(i,t))},n7t={p:TNe,P:t7t},r7t=/^D+$/,i7t=/^Y+$/,s7t=["D","DD","YY","YYYY"];function a7t(e){return r7t.test(e)}function o7t(e){return i7t.test(e)}function l7t(e,t,n){const r=c7t(e,t,n);if(console.warn(r),s7t.includes(e))throw new RangeError(r)}function c7t(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 u7t=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,d7t=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,h7t=/^'([^]*?)'?$/,f7t=/''/g,p7t=/[a-zA-Z]/;function A7(e,t,n){const r=c2(),i=n?.locale??r.locale??$Ne,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=Xc(e,n?.in);if(!g8t(o))throw new RangeError("Invalid time value");let l=t.match(d7t).map(u=>{const d=u[0];if(d==="p"||d==="P"){const h=n7t[d];return h(u,i.formatLong)}return u}).join("").match(u7t).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const d=u[0];if(d==="'")return{isToken:!1,value:O7t(u)};if(Ege[d])return{isToken:!0,value:u};if(d.match(p7t))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&&o7t(d)||!n?.useAdditionalDayOfYearTokens&&a7t(d))&&l7t(d,t,String(e));const h=Ege[d[0]];return h(o,d,i.localize,c)}).join("")}function O7t(e){const t=e.match(h7t);return t?t[1].replace(f7t,"'"):e}function g7t(e,t,n){const r=c2(),i=n?.locale??r.locale??$Ne,s=f8t(e,t);if(isNaN(s))throw new RangeError("Invalid time value");const a=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:s}),[o,l]=SNe(n?.in,...s>0?[t,e]:[e,t]),c=m8t("round"),u=l.getTime()-o.getTime(),d=u/$ge,h=F4(l)-F4(o),f=(u-h)/$ge,O=n?.unit;let g;if(d<1?g="second":d<60?g="minute":d<_ge?g="hour":f<Tge?g="day":f<kge?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/_ge);return i.formatDistance("xDays",m,a)}else if(g==="month"){const m=c(f/Tge);return m===12&&O!=="month"?i.formatDistance("xYears",1,a):i.formatDistance("xMonths",m,a)}else{const m=c(f/kge);return i.formatDistance("xYears",m,a)}}function m7t(e,t){return g7t(e,p8t(e),t)}const v7t=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 A7(t,"h:mm a");if(t.toDateString()===r.toDateString())return"Yesterday";const i=new Date(n);return i.setDate(n.getDate()-7),t>i?A7(t,"EEEE"):A7(t,"yyyy-MM-dd")}catch(t){return console.error("Error formatting date:",t),""}},wrr=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),""}},y7t=(e,t=new Date)=>{if(e==null)return"";try{const n=e instanceof Date?e:new Date(e);if(Number.isNaN(n.getTime()))return"";const r=n.toLocaleTimeString(navigator.language,{hour:"numeric",minute:"2-digit",hour12:!0});if(n.toDateString()===t.toDateString())return r;const i=new Date(t);if(i.setDate(t.getDate()-1),n.toDateString()===i.toDateString())return`Yesterday ${r}`;const s=n.toLocaleDateString(navigator.language,{month:"short",day:"numeric"});return n.getFullYear()===t.getFullYear()?`${s}, ${r}`:`${s}, ${n.getFullYear()}, ${r}`}catch(n){return console.error("Error formatting turn timestamp:",n),""}},_Ne=(e,t)=>{if(!e)return"";try{const n=e instanceof Date?e:new Date(e);return Number.isNaN(n.getTime())?"":n.toLocaleString(navigator.language,{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"2-digit",...t})}catch(n){return console.error("Error formatting calendar date-time:",n),""}},sJ=({timestamp:e,scope:t,className:n})=>{const r=e instanceof Date?e:new Date(e),i=l8t();if(Number.isNaN(r.getTime()))return null;const s=_Ne(r,{hour12:!0});return p.jsx(it,{content:s,side:"bottom",delayDuration:1200,children:p.jsx("time",{dateTime:r.toISOString(),"data-stamp":t,"aria-label":`Sent ${s}`,className:A("shrink-0 cursor-help select-none whitespace-nowrap text-ink-dim text-meta",n),children:y7t(r,i)})})},Q_=({replies:e,onRemoveReply:t})=>p.jsxs("div",{className:"mb-2 flex flex-col gap-1.5 rounded-sm bg-sunken p-2",children:[p.jsxs("div",{className:"flex items-center gap-1.5 text-ink-dim",children:[p.jsx(h2e,{size:12,"aria-hidden":"true"}),p.jsx("span",{className:"text-meta",children:"Replying to"})]}),e.map(n=>p.jsxs("div",{className:"flex items-center gap-2 border-hairline border-l-2 py-0.5 pl-2",children:[p.jsx("span",{className:"flex-1 truncate text-body-sm text-ink-muted",title:n.text,children:n.text}),t&&p.jsx(we,{variant:"ghost",size:"icon-sm",className:"shrink-0 text-ink-dim hover:bg-elevated hover:text-ink",onClick:()=>t(n.id),"aria-label":"Remove reply",children:p.jsx(Qi,{"aria-hidden":"true"})})]},n.id))]}),PNe=({content:e,busy:t=!1,className:n})=>e?p.jsxs("section",{"aria-label":"Question from the agent",className:A("flex gap-3 rounded-md border border-accent bg-accent-wash px-4 py-3",n),children:[p.jsx(Int,{className:"mt-0.5 size-4 shrink-0 text-accent","aria-hidden":!0}),p.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[p.jsx("p",{className:"font-medium text-accent text-meta",children:t?"Sending your answer…":"Waiting for your answer"}),p.jsx("div",{className:"lo-on-wash text-ink",children:p.jsx(uy,{content:e})})]})]}):null,b7t=({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 p.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)=>p.jsxs("button",{type:"button",disabled:n,onClick:()=>r(a.label),className:A("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&&p.jsxs("span",{"aria-hidden":!0,className:A("shrink-0 font-mono text-mono-sm",n?"text-ink-disabled":"text-ink-dim"),children:[o+1,"."]}),p.jsxs("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[p.jsxs("span",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[p.jsx("span",{className:A("min-w-0 text-body-sm",n?"text-ink-disabled":"text-ink"),children:a.label}),s===o&&p.jsx("span",{className:A("shrink-0 font-medium text-meta",n?"text-ink-disabled":"text-ink"),children:"Recommended"})]}),a.description&&p.jsx("span",{className:A("text-body-sm",n?"text-ink-disabled":"text-ink-muted"),children:a.description})]})]},`${i}-${String(o)}`))})},CNe=({children:e,className:t})=>p.jsx("span",{"aria-hidden":!0,className:A("flex size-3.5 shrink-0 [&_svg]:size-3.5",t),children:e}),aJ=({label:e="Reasoning",content:t})=>!mn(r=>r.showAgentReasoning)||!t?null:p.jsx(Nu,{summary:p.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[p.jsx(CNe,{}),p.jsx("span",{className:"truncate",children:p.jsx("span",{className:"text-ink-dim text-meta",children:e})})]}),children:p.jsx(uy,{content:t,className:"[--md-ink:var(--lo-ink-muted)]",styleProps:{fontSize:"var(--text-body-sm)",lineHeight:"var(--text-body-sm--line-height)"}})}),w7t={hunk:"text-ink-muted",added:"text-success",removed:"text-danger",context:"text-ink-dim"},x7t=({line:e})=>p.jsx("span",{className:A(w7t[e.kind],"block"),children:e.text}),S7t=({diff:e,className:t})=>{const n=ldt(e);return p.jsxs("div",{className:A("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)=>p.jsx(x7t,{line:r},i)),n.hidden>0&&p.jsx("span",{className:"sticky -bottom-3 -mb-3 block bg-sunken pb-3 text-ink-dim",children:cdt(n.hidden)})]})},$7t=({content:e,details:t,className:n})=>p.jsxs("section",{"aria-label":"Security notice",className:A("flex gap-3 border-warning border-l-2 py-0.5 pl-3",n),children:[p.jsx(S2e,{className:"mt-0.5 size-4 shrink-0 text-warning","aria-hidden":!0}),p.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[p.jsx("p",{className:"font-medium text-body-sm text-warning",children:"Blocked a risky action"}),e?p.jsx("p",{className:"text-body-sm text-ink-muted",children:e}):null,t?p.jsx(Nu,{summary:p.jsx("span",{className:"text-meta",children:"Show the reviewed code"}),children:t}):null]})]}),k7t=(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()},Dge=e=>e.startsWith("file://")?e.slice(7):e,T7t={READ:{verb:"Read",runningVerb:"Reading",icon:iZ},WRITE:{verb:"Wrote",runningVerb:"Writing",icon:cZ},EDIT:{verb:"Edited",runningVerb:"Editing",icon:ort},CODE:{verb:"Ran code",runningVerb:"Running code",icon:sZ},DELEGATE:{verb:"Delegated work",runningVerb:"Delegating work",icon:Xrt},DONE:{verb:"Finished",runningVerb:"Finishing",icon:AY},ASK:{verb:"Asked",runningVerb:"Asking",icon:W3},BYE:{verb:"Ended the conversation",runningVerb:"Ending",icon:$tt}},_7t={verb:"Worked on the request",runningVerb:"Working on the request",icon:sZ},P7t=(e,t,n,r)=>{const i=e?T7t[e]:_7t;let s;if(t)s=Dge(t);else if(n&&n.length>0){const o=n.filter(l=>!l.startsWith("data:"));o.length===1?s=Dge(o[0]):o.length>1&&(s=`${o.length} files`)}const a=!s&&r?k7t(r):"";return{verb:i.verb,runningVerb:i.runningVerb,object:s,narration:a||void 0,icon:i.icon}},Nge="min-h-5 py-0",C7t=({icon:e,verb:t,object:n,narration:r,running:i,failed:s,wrap:a})=>p.jsxs("span",{className:A("flex min-w-0 gap-2",a?"items-start":"items-center"),"aria-busy":i||void 0,children:[p.jsx(CNe,{className:A(s?"text-danger":"text-ink-dim",a&&O4e),children:e}),p.jsxs("span",{className:A(a?"min-w-0 whitespace-pre-wrap break-words":"truncate"),children:[p.jsxs("span",{...L8,className:A("select-text font-mono text-mono-sm",i?"text-ink-muted":"text-ink-dim",s&&"text-danger"),children:[t,r?":":null]}),n?p.jsxs("span",{...L8,className:"select-text font-mono text-ink-muted text-mono-sm",children:[" ",n]}):null,r?p.jsxs("span",{...L8,className:"select-text text-body-sm text-ink-muted",children:[" ",r]}):null]})]}),M4=({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 O=P7t(e,t,n,r),g=c??(i?O.runningVerb:O.verb),m=s?sv:O.icon,v=s||!c||!d?p.jsx(m,{}):d,y=p.jsx(C7t,{icon:v,verb:g,object:c?u:O.object,narration:c?r:O.narration,running:i,failed:s,wrap:h}),w=h?"firstLine":"center";return o?p.jsx(Nu,{summary:y,chevron:"leading",summaryAlign:w,defaultOpen:a,className:l,rowClassName:f?Nge:void 0,triggerClassName:"-mx-2 rounded-sm px-2 hover:bg-elevated",children:o}):p.jsx(Nu,{disabled:!0,summary:y,summaryAlign:w,className:l,rowClassName:f?Nge:void 0})},ENe=8,E7t="… deeper values not shown",Q7t="(empty)";function R7t(e){return`… ${e} more line${e===1?"":"s"}`}const Xge=.5;function A7t(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 QNe(e){return e==null?"null":typeof e=="string"?e.trim()||null:typeof e=="number"||typeof e=="boolean"?String(e):null}function oJ(e){return typeof e=="object"&&e!==null}function RNe(e,t,n,r){if(n>ENe){r.push({key:t,value:E7t,depth:n});return}if(oJ(e)){for(const[s,a]of Object.entries(e))RNe(a,t?`${t}.${s}`:s,n+1,r);return}const i=QNe(e);i!==null&&r.push({key:t,value:i,depth:n})}function ANe(e){if(!e)return[];const t=[];for(const[n,r]of Object.entries(e))RNe(r,n,1,t);return t}const D7t=512;function N7t(e,t){if(t)return!0;if(!e)return!1;let n=D7t;const r=(i,s)=>{if(n--<=0||s>ENe)return!0;if(!oJ(i))return QNe(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 X7t(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(!oJ(n))return null;const r=ANe(n);return r.length>0?r:[{key:"",value:Q7t,depth:1}]}const I7t=8,Ige="max-h-[240px]",F7t=({line:e})=>p.jsxs("div",{className:A("whitespace-pre-wrap break-words"),style:{paddingInlineStart:(e.depth-1)*I7t},children:[e.key?p.jsxs("span",{className:A("text-ink-dim"),children:[e.key,": "]}):null,p.jsx("span",{className:A("text-ink-muted"),children:e.value})]}),Fge=({lines:e,label:t})=>p.jsx("div",{className:A("flex flex-col gap-1"),"data-detail-lines":t,children:e.map((n,r)=>p.jsx(F7t,{line:n},r))});function Mge(e){const[t,n]=b.useState(0),[r,i]=b.useState(!1);return b.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+Xge);const f=c.children.length>0?Array.from(c.children):[c];n(A7t(f.map(O=>{const g=O.getBoundingClientRect();return{top:g.top,height:g.height}}),u,d.bottom,Xge))};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 jge=({lines:e,overflowing:t})=>t?p.jsx("span",{className:A("mt-1 block text-ink-dim"),children:e>0?R7t(e):" "}):null,M7t=({args:e,output:t,isError:n})=>{const r=ANe(e),i=X7t(t),s=b.useRef(null),a=b.useRef(null),o=Mge(s),l=Mge(a);return r.length===0&&!t?null:p.jsxs("div",{className:A("w-full rounded-sm border border-hairline bg-sunken p-3 font-mono text-mono-sm"),children:[r.length>0&&p.jsxs("div",{"data-detail-section":"input",children:[p.jsx("div",{ref:s,className:A(Ige,"overflow-auto"),children:p.jsx(Fge,{lines:r,label:"input"})}),p.jsx(jge,{lines:o.lines,overflowing:o.overflowing})]}),t&&p.jsxs("div",{className:A(r.length>0&&"mt-3"),"data-detail-section":"output",children:[p.jsx("span",{className:A("mb-1 block text-meta",n?"text-danger":"text-ink-dim"),children:n?"Error":"Output"}),p.jsx("div",{ref:a,className:A(Ige,"overflow-auto"),children:i?p.jsx(Fge,{lines:i,label:"result-json"}):p.jsx("pre",{className:A("whitespace-pre font-mono",n?"text-danger":"text-ink"),children:t})}),p.jsx(jge,{lines:l.lines,overflowing:l.overflowing})]})]})},j7t="mcp__",L7t={bash:uit,read:uv,write:nse,edit:nse,glob:hT,grep:dv,todo:$nt,wake:G3,list_variables:a5,read_variable:a5,browser:_g,web_search:_g,web_fetch:Np,task:vp,agent:vp,send:hZ,peer:pnt};function q7t(e){const t=e.trim().toLowerCase(),n=L7t[t];return n||(t.startsWith(j7t)?uZ:$Ze)}const z7t=Ul,U7t=Qi,W7t=l2e,Lge="min-h-5 py-0",G7t={read:"text-info",mutate:"text-ink-muted",exec:"text-ink-muted",meta:"text-accent",plain:"text-ink-muted"},V7t=(e,t)=>e==="running"?"text-ink":e==="error"?"text-danger":e==="receipt"?"text-ink-muted":G7t[Hut(t)],B7t=({added:e,removed:t})=>e<=0&&t<=0?null:p.jsxs("span",{className:A("hidden shrink-0 gap-1 font-mono text-mono-sm tabular-nums @[34rem]/toolrow:flex"),children:[e>0&&p.jsxs("span",{className:A("text-success"),children:["+",e]}),t>0&&p.jsxs("span",{className:A("text-danger"),children:["-",t]})]}),qge={running:"",success:"succeeded",error:"failed",interrupted:"interrupted",receipt:""},Y7t=1e3;function Z7t(e){const[t,n]=b.useState(()=>e===null?null:Math.max(0,(Date.now()-e)/1e3));return b.useEffect(()=>{if(e===null){n(null);return}const r=()=>n(Math.max(0,(Date.now()-e)/1e3));r();const i=window.setInterval(r,Y7t);return()=>window.clearInterval(i)},[e]),t}const H7t=({outcome:e,durationS:t,startedAt:n})=>{const r=e==="running",i=Z7t(r?n??null:null),s=e==="success"?z7t:e==="error"?U7t:e==="interrupted"?W7t:null,a=e==="success"?"text-success":e==="error"?"text-danger":"text-ink-dim",o=r?n==null?"":FZ(i??0):But(t);return p.jsxs("span",{className:A("flex shrink-0 items-center gap-1.5"),children:[p.jsxs("span",{className:A("flex size-3.5 shrink-0 [&_svg]:size-3.5",a),children:[s?p.jsx(s,{"aria-hidden":!0}):null,qge[e]?p.jsx("span",{className:A("sr-only"),children:qge[e]}):null]}),p.jsx("span",{className:A("w-[5ch] text-right font-mono text-ink-dim text-mono-sm tabular-nums"),children:o})]})},j4=({toolName:e,summary:t,summaryFallback:n=null,outcome:r,durationS:i,startedAt:s=null,added:a=0,removed:o=0,nameColumn:l=VCe,details:c,defaultOpen:u=!1,onOpenChange:d,className:h,media:f})=>{const O=b.useRef(u),g=b.useRef(d);b.useEffect(()=>{g.current=d,d?.(O.current)},[d]),b.useEffect(()=>()=>{O.current&&g.current?.(!1)},[]);const m=b.useCallback(P=>{O.current=P,g.current?.(P)},[]),v=r==="running",y=r==="error",w=q7t(e),k=AT(e),x=GCe(t,e)?n??"":t,S=p.jsxs("span",{className:A("flex min-w-0 flex-1 items-center gap-2"),children:[p.jsx("span",{"aria-hidden":!0,className:A("flex size-3.5 shrink-0 [&_svg]:size-3.5",v?"text-accent":y?"text-danger":"text-ink-dim"),children:p.jsx(w,{})}),p.jsx("span",{className:A("shrink-0 truncate font-mono text-mono-sm","pr-1",V7t(r,e)),style:{width:`calc(${l}ch + 0.25rem)`},title:k,children:k}),p.jsx("span",{className:A("min-w-0 flex-1 truncate font-mono text-mono-sm",v?"text-ink-muted":"text-ink-dim"),title:x,children:x}),p.jsx(B7t,{added:a,removed:o}),p.jsx(H7t,{outcome:r,durationS:i,startedAt:s})]}),T=v?"bg-elevated":y?"bg-danger-wash":"hover:bg-elevated",_=c?p.jsx(Nu,{summary:S,chevron:"leading",defaultOpen:u,onOpenChange:m,className:A("@container/toolrow",h),rowClassName:Lge,triggerClassName:A("-mx-2 rounded-sm px-2",T),children:c}):p.jsx(Nu,{disabled:!0,summary:S,rowClassName:Lge,className:A("@container/toolrow",(v||y)&&A("-mx-2 rounded-sm px-2",T),h)});return f?p.jsxs("div",{className:A("flex flex-col"),children:[_,f]}):_},lJ=e=>{const t=b.useCallback(r=>{const i=window.matchMedia(e);return i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[e]),n=b.useCallback(()=>window.matchMedia(e).matches,[e]);return b.useSyncExternalStore(t,n,()=>!1)},zge=["⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"],K7t=80,J7t=1e3,ejt=({activity:e,phase:t,startedAt:n,className:r})=>{const[i,s]=b.useState(0),[a,o]=b.useState(()=>n===void 0?0:Math.floor((Date.now()-n)/1e3)),l=lJ("(prefers-reduced-motion: reduce)"),c=b.useRef(n??Date.now()),u=b.useRef(t);return u.current!==t&&(u.current=t,c.current=n??Date.now(),o(0)),b.useEffect(()=>{const d=window.setInterval(()=>o(Math.floor((Date.now()-c.current)/1e3)),J7t);if(l)return s(0),()=>window.clearInterval(d);const h=window.setInterval(()=>s(f=>(f+1)%zge.length),K7t);return()=>{window.clearInterval(h),window.clearInterval(d)}},[l]),p.jsxs("div",{className:A("flex items-center gap-2",r),"data-lo-working-line":!0,"aria-live":"polite",children:[p.jsx("span",{"aria-hidden":!0,className:A("w-[1ch] shrink-0 select-none font-mono text-ink-muted text-mono-sm"),children:zge[i]}),p.jsx("span",{className:A("min-w-0 truncate font-mono text-ink-dim text-mono-sm"),children:e}),p.jsx("span",{"aria-hidden":!0,className:A("w-[6ch] shrink-0 font-mono text-ink-dim text-mono-sm tabular-nums"),children:FZ(a)})]})},tjt=/^\s*<reply-to>([\s\S]*?)<\/reply-to>/,cJ=e=>{const t=[];let n=e;for(;;){const r=tjt.exec(n);if(r===null)break;t.push({id:za(),text:r[1]}),n=n.slice(r[0].length)}return{replies:t,remainingContent:n.trim()}},DNe=({children:e,className:t})=>p.jsx("div",{className:A("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}),njt="could not be displayed. It may have been moved, renamed, or deleted.",uJ="could not be displayed. Its stored copy is not available to this reader.",R_=({name:e,detail:t=njt,className:n})=>p.jsxs("div",{className:A("flex w-fit max-w-full items-center gap-2.5 rounded-sm border border-hairline bg-sunken px-3 py-2",n),children:[p.jsx(dnt,{className:"size-4 shrink-0 text-ink-dim","aria-hidden":!0}),p.jsxs("span",{className:"min-w-0 text-body-sm text-ink-muted",children:[p.jsx("span",{className:"truncate font-mono text-ink text-mono-sm",children:e}),` ${t}`]})]}),vN=({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),ms("File path copied to clipboard")}catch(o){console.error("Failed to copy file path: ",o),Rr("Failed to copy file path")}},a=()=>{e&&window.api.openFile(e)};return p.jsxs(px,{children:[p.jsx(it,{content:t,children:p.jsx(iv,{asChild:!0,children:p.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":r,onClick:o=>o.stopPropagation(),children:n??p.jsx(V3,{"aria-hidden":"true"})})})}),p.jsxs(Ox,{align:"end",className:"min-w-45",onClick:o=>o.stopPropagation(),children:[i&&p.jsxs($s,{onSelect:i,children:[p.jsx(bnt,{"aria-hidden":"true"}),p.jsx("span",{children:"Show in canvas"})]}),p.jsxs($s,{onSelect:a,children:[p.jsx(vx,{"aria-hidden":"true"}),p.jsx("span",{children:"Open file"})]}),p.jsxs($s,{onSelect:()=>window.api.showItemInFolder(e),children:[p.jsx(hT,{"aria-hidden":"true"}),p.jsx("span",{children:"Open folder"})]}),p.jsxs($s,{onSelect:s,children:[p.jsx(c2e,{"aria-hidden":"true"}),p.jsx("span",{children:"Copy file path"})]})]})]})},D7="max-h-[min(90vh,calc(100vh-104px))] max-w-[min(90vw,calc(100vw-104px))]",dJ=({src:e,label:t,open:n,onOpenChange:r,restoreFocusTo:i,fallback:s})=>{const[a,o]=b.useState(!1);return up(n,"image-lightbox"),p.jsx(jP,{open:n,onOpenChange:r,children:p.jsxs(LP,{showClose:!1,"aria-describedby":void 0,onCloseAutoFocus:l=>{const c=i?.current;c&&(l.preventDefault(),c.focus())},className:A("inset-0 top-0 left-0 m-auto h-fit w-fit translate-none",D7,"gap-0 rounded-none border-0 border-transparent bg-transparent p-0 shadow-none"),children:[p.jsx(I1,{className:"sr-only",children:t}),a?p.jsx("div",{className:A(D7,"flex min-h-16 min-w-64 items-center justify-center p-6"),children:s}):p.jsx("img",{src:e,alt:t,className:A(D7,"object-contain"),onError:()=>o(!0)}),p.jsx(kZe,{asChild:!0,children:p.jsx(we,{variant:"ghost",size:"icon-sm",className:A("fixed top-4 right-4"),"aria-label":"Close image",children:p.jsx(Qi,{"aria-hidden":"true"})})})]})})};dJ.displayName="ImageLightbox";const NNe=1024;let rjt=0,yu=class{constructor(t,n){this.from=t,this.to=n}};class Wn{constructor(t={}){this.id=rjt++,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=ha.match(t)),n=>{let r=t(n);return r===void 0?null:[this,r]}}}Wn.closedBy=new Wn({deserialize:e=>e.split(" ")});Wn.openedBy=new Wn({deserialize:e=>e.split(" ")});Wn.group=new Wn({deserialize:e=>e.split(" ")});Wn.isolate=new Wn({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});Wn.contextHash=new Wn({perNode:!0});Wn.lookAhead=new Wn({perNode:!0});Wn.mounted=new Wn({perNode:!0});class A_{constructor(t,n,r){this.tree=t,this.overlay=n,this.parser=r}static get(t){return t&&t.props&&t.props[Wn.mounted.id]}}const ijt=Object.create(null);class ha{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):ijt,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new ha(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(Wn.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(Wn.group),s=-1;s<(i?i.length:0);s++){let a=n[s<0?r.name:i[s]];if(a)return a}}}}ha.none=new ha("",Object.create(null),0,8);class Fx{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 ha(r.name,i,r.id,r.flags):r)}return new Fx(n)}}const WC=new WeakMap,Uge=new WeakMap;var Pi;(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays"})(Pi||(Pi={}));class $r{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=A_.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 L4(this.topNode,t)}cursorAt(t,n=0,r=0){let i=WC.get(this)||this.topNode,s=new L4(i);return s.moveTo(t,n),WC.set(this,s._tree),s}get topNode(){return new Fo(this,0,0,null)}resolve(t,n=0){let r=D_(WC.get(this)||this.topNode,t,n,!1);return WC.set(this,r),r}resolveInner(t,n=0){let r=D_(Uge.get(this)||this.topNode,t,n,!0);return Uge.set(this,r),r}resolveStack(t,n=0){return ojt(this,t,n)}iterate(t){let{enter:n,leave:r,from:i=0,to:s=this.length}=t,a=t.mode||0,o=(a&Pi.IncludeAnonymous)>0;for(let l=this.cursor(a|Pi.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:pJ(ha.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new $r(this.type,n,r,i,this.propValues),t.makeTree||((n,r,i)=>new $r(ha.none,n,r,i)))}static build(t){return ljt(t)}}$r.empty=new $r(ha.none,[],[],0);class hJ{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 hJ(this.buffer,this.index)}}class qg{constructor(t,n,r){this.buffer=t,this.length=n,this.set=r}get type(){return ha.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&&!(XNe(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 qg(s,a,this.set)}}function XNe(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 D_(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 Fo&&e.index<0?null:e.parent;if(!a)return e;e=a}let s=r?0:Pi.IgnoreOverlays;if(r)for(let a=e,o=a.parent;o;a=o,o=a.parent)a instanceof Fo&&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 INe{cursor(t=0){return new L4(this,t)}getChild(t,n=null,r=null){let i=Wge(this,t,n,r);return i.length?i[0]:null}getChildren(t,n=null,r=null){return Wge(this,t,n,r)}resolve(t,n=0){return D_(this,t,n,!1)}resolveInner(t,n=0){return D_(this,t,n,!0)}matchContext(t){return gG(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 Fo extends INe{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(XNe(i,r,d,d+u.length)){if(u instanceof qg){if(s&Pi.ExcludeBuffers)continue;let h=u.findChild(0,u.buffer.length,n,r-d,i);if(h>-1)return new Xh(new sjt(a,u,t,d),null,h)}else if(s&Pi.IncludeAnonymous||!u.type.isAnonymous||fJ(u)){let h;if(!(s&Pi.IgnoreMounts)&&(h=A_.get(u))&&!h.overlay)return new Fo(h.tree,d,t,a);let f=new Fo(u,d,t,a);return s&Pi.IncludeAnonymous||!f.type.isAnonymous?f:f.nextChild(n<0?u.children.length-1:0,n,r,i)}}}if(s&Pi.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&Pi.IgnoreOverlays)&&(i=A_.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 Fo(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 Wge(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 gG(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 sjt{constructor(t,n,r,i){this.parent=t,this.buffer=n,this.index=r,this.start=i}}class Xh extends INe{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 Xh(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&Pi.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 Xh(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 Xh(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 Xh(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 $r(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function FNe(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 Fo&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new ajt(i,n)}class ajt{constructor(t,n){this.heads=t,this.node=n}get next(){return FNe(this.heads)}}function ojt(e,t,n){let r=e.resolveInner(t,n),i=null;for(let s=r instanceof Fo?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=A_.get(s.tree);if(a&&a.overlay&&a.overlay[0].from<=t&&a.overlay[a.overlay.length-1].to>=t){let o=new Fo(a.tree,a.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(D_(o,t,n,!1))}}return i?FNe(i):r}class L4{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 Fo)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 Fo?(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&Pi.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Pi.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Pi.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&Pi.IncludeAnonymous||o instanceof qg||!o.type.isAnonymous||fJ(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 Xh(this.buffer,n,this.stack[i]);return this.bufferNode=new Xh(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 gG(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 gG(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 fJ(e){return e.children.some(t=>t instanceof qg||!t.type.isAnonymous||fJ(t))}function ljt(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:i=NNe,reused:s=[],minRepeatType:a=r.types.length}=e,o=Array.isArray(n)?new hJ(n,n.length):n,l=r.types,c=0,u=0;function d(x,S,T,_,P,E){let{id:C,start:Q,end:D,size:F}=o,I=u,U=c;for(;F<0;)if(o.next(),F==-1){let J=s[C];T.push(J),_.push(Q-x);return}else if(F==-3){c=C;return}else if(F==-4){u=C;return}else throw new RangeError(`Unrecognized record size: ${F}`);let q=l[C],Z,W,M=Q-x;if(D-Q<=i&&(W=m(o.pos-S,P))){let J=new Uint16Array(W.size-W.skip),L=o.pos-W.size,N=J.length;for(;o.pos>L;)N=v(W.start,J,N);Z=new qg(J,D-W.start,r),M=W.start-x}else{let J=o.pos-F;o.next();let L=[],N=[],z=C>=a?C:-1,V=0,ee=D;for(;o.pos>J;)z>=0&&o.id==z&&o.size>=0?(o.end<=ee-i&&(O(L,N,Q,V,o.end,ee,z,I,U),V=L.length,ee=o.end),o.next()):E>2500?h(Q,J,L,N):d(Q,J,L,N,z,E+1);if(z>=0&&V>0&&V<L.length&&O(L,N,Q,V,Q,ee,z,I,U),L.reverse(),N.reverse(),z>-1&&V>0){let oe=f(q,U);Z=pJ(q,L,N,0,L.length,0,D-Q,oe,oe)}else Z=g(q,L,N,D-Q,I-D,U)}T.push(Z),_.push(M)}function h(x,S,T,_){let P=[],E=0,C=-1;for(;o.pos>S;){let{id:Q,start:D,end:F,size:I}=o;if(I>4)o.next();else{if(C>-1&&D<C)break;C<0&&(C=F-i),P.push(Q,D,F),E++,o.next()}}if(E){let Q=new Uint16Array(E*4),D=P[P.length-2];for(let F=P.length-3,I=0;F>=0;F-=3)Q[I++]=P[F],Q[I++]=P[F+1]-D,Q[I++]=P[F+2]-D,Q[I++]=I;T.push(new qg(Q,P[2]-D,r)),_.push(D-x)}}function f(x,S){return(T,_,P)=>{let E=0,C=T.length-1,Q,D;if(C>=0&&(Q=T[C])instanceof $r){if(!C&&Q.type==x&&Q.length==P)return Q;(D=Q.prop(Wn.lookAhead))&&(E=_[C]+Q.length+D)}return g(x,T,_,P,E,S)}}function O(x,S,T,_,P,E,C,Q,D){let F=[],I=[];for(;x.length>_;)F.push(x.pop()),I.push(S.pop()+T-P);x.push(g(r.types[C],F,I,E-P,Q-E,D)),S.push(P-T)}function g(x,S,T,_,P,E,C){if(E){let Q=[Wn.contextHash,E];C=C?[Q].concat(C):[Q]}if(P>25){let Q=[Wn.lookAhead,P];C=C?[Q].concat(C):[Q]}return new $r(x,S,T,_,C)}function m(x,S){let T=o.fork(),_=0,P=0,E=0,C=T.end-i,Q={size:0,start:0,skip:0};e:for(let D=T.pos-x;T.pos>D;){let F=T.size;if(T.id==S&&F>=0){Q.size=_,Q.start=P,Q.skip=E,E+=4,_+=4,T.next();continue}let I=T.pos-F;if(F<0||I<D||T.start<C)break;let U=T.id>=a?4:0,q=T.start;for(T.next();T.pos>I;){if(T.size<0)if(T.size==-3)U+=4;else break e;else T.id>=a&&(U+=4);T.next()}P=q,_+=F,E+=U}return(S<0||_==x)&&(Q.size=_,Q.start=P,Q.skip=E),Q.size>4?Q:void 0}function v(x,S,T){let{id:_,start:P,end:E,size:C}=o;if(o.next(),C>=0&&_<a){let Q=T;if(C>4){let D=o.pos-(C-4);for(;o.pos>D;)T=v(x,S,T)}S[--T]=Q,S[--T]=E-x,S[--T]=P-x,S[--T]=_}else C==-3?c=_:C==-4&&(u=_);return T}let y=[],w=[];for(;o.pos>0;)d(e.start||0,e.bufferStart||0,y,w,-1,0);let k=(t=e.length)!==null&&t!==void 0?t:y.length?w[0]+y[0].length:0;return new $r(l[e.topID],y.reverse(),w.reverse(),k)}const Gge=new WeakMap;function KQ(e,t){if(!e.isAnonymous||t instanceof qg||t.type!=e)return 1;let n=Gge.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof $r)){n=1;break}n+=KQ(e,r)}Gge.set(t,n)}return n}function pJ(e,t,n,r,i,s,a,o,l){let c=0;for(let O=r;O<i;O++)c+=KQ(e,t[O]);let u=Math.ceil(c*1.5/8),d=[],h=[];function f(O,g,m,v,y){for(let w=m;w<v;){let k=w,x=g[w],S=KQ(e,O[w]);for(w++;w<v;w++){let T=KQ(e,O[w]);if(S+T>=u)break;S+=T}if(w==k+1){if(S>u){let T=O[k];f(T.children,T.positions,0,T.children.length,g[k]+y);continue}d.push(O[k])}else{let T=g[w-1]+O[w-1].length-x;d.push(pJ(e,O,g,k,w,x,T,null,l))}h.push(x+y-s)}}return f(t,n,r,i,0),(o||l)(d,h,a)}class OJ{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 Xh?this.setBuffer(t.context.buffer,t.index,n):t instanceof Fo&&this.map.set(t.tree,n)}get(t){return t instanceof Xh?this.getBuffer(t.context.buffer,t.index):t instanceof Fo?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 kp{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 kp(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,O=Math.min(h.to,d)-c;h=f>=O?null:new kp(f,O,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 yN=class{startParse(t,n,r){return typeof t=="string"&&(t=new cjt(t)),r=r?r.length?r.map(i=>new yu(i.from,i.to)):[new yu(0,0)]:[new yu(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 cjt{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 zu(e){return(t,n,r,i)=>new djt(t,e,n,r,i)}class Vge{constructor(t,n,r,i,s){this.parser=t,this.parse=n,this.overlay=r,this.target=i,this.from=s}}function Bge(e){if(!e.length||e.some(t=>t.from>=t.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(e))}class ujt{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 mG=new Wn({perNode:!0});class djt{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 $r(r.type,r.children,r.positions,r.length,r.propValues.concat([[mG,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[Wn.mounted.id]=new A_(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 pjt(this.fragments),n=null,r=null,i=new L4(new Fo(this.baseTree,this.ranges[0].from,0,null),Pi.IncludeAnonymous|Pi.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=hjt(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||fjt(i);let c=t.findMounts(i.from,s.parser);if(typeof s.overlay=="function")n=new ujt(s.parser,s.overlay,c,this.inner.length,i.from,i.tree,n);else{let u=Hge(this.ranges,s.overlay||(i.from<i.to?[new yu(i.from,i.to)]:[]));u.length&&Bge(u),(u.length||!s.overlay)&&this.inner.push(new Vge(s.parser,u.length?s.parser.startParse(this.input,Kge(c,u),u):s.parser.startParse(""),s.overlay?s.overlay.map(d=>new yu(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 yu(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=Hge(this.ranges,n.ranges);c.length&&(Bge(c),this.inner.splice(n.index,0,new Vge(n.parser,n.parser.startParse(this.input,Kge(n.mounts,c),c),n.ranges.map(u=>new yu(u.from-n.start,u.to-n.start)),n.target,c[0].from))),n=n.prev}r&&!--r.depth&&(r=r.prev)}}}}function hjt(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 Yge(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 fjt(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,O,g){let m=n[g],v=[],y=[];Yge(a,u,m,v,y,f);let w=o[m+1],k=o[m+2];l.push(v.length);let x=g?c(m+4,o[m+3],a.set.types[o[m]],w,k-w,g-1):t.toTree();return v.push(x),y.push(w-f),Yge(a,o[m+3],d,v,y,f),new $r(h,v,y,O)}i.children[s]=c(0,o.length,ha.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 Fo(d,h+e.from,u,e._tree))}}class Zge{constructor(t,n){this.offset=n,this.done=!1,this.cursor=t.cursor(Pi.IncludeAnonymous|Pi.IgnoreMounts)}moveTo(t){let{cursor:n}=this,r=t-this.offset;for(;!this.done&&n.from<r;)n.to>=t&&n.enter(r,1,Pi.IgnoreOverlays|Pi.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 $r)n=n.children[0];else break}return!1}}let pjt=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(mG))!==null&&n!==void 0?n:r.to,this.inner=new Zge(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(mG))!==null&&t!==void 0?t:n.to,this.inner=new Zge(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(Wn.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 Hge(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 yu(l.from,a),l.to>o&&n.splice(s+1,0,new yu(o,l.to))):l.to>o?n[s--]=new yu(o,l.to):n.splice(s--,1))}}return r}function Ojt(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 yu(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 Kge(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 yu(h.from+r,h.to+r)),d=Ojt(t,u,l,c);for(let h=0,f=l;;h++){let O=h==d.length,g=O?c:d[h].from;if(g>f&&n.push(new kp(f,g,i.tree,-a,s.from>=f||s.openStart,s.to<=g||s.openEnd)),O)break;f=d[h].to}}else n.push(new kp(l,c,i.tree,-a,s.from>=a||s.openStart,s.to<=o||s.openEnd))}return n}let vG=[],MNe=[];(()=>{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?MNe:vG).push(n=n+e[t])})();function gjt(e){if(e<768)return!1;for(let t=0,n=vG.length;;){let r=t+n>>1;if(e<vG[r])n=r;else if(e>=MNe[r])t=r+1;else return!0;if(t==n)return!1}}function Jge(e){return e>=127462&&e<=127487}const eme=8205;function mjt(e,t,n=!0,r=!0){return(n?jNe:vjt)(e,t,r)}function jNe(e,t,n){if(t==e.length)return t;t&&LNe(e.charCodeAt(t))&&qNe(e.charCodeAt(t-1))&&t--;let r=N7(e,t);for(t+=tme(r);t<e.length;){let i=N7(e,t);if(r==eme||i==eme||n&&gjt(i))t+=tme(i),r=i;else if(Jge(i)){let s=0,a=t-2;for(;a>=0&&Jge(N7(e,a));)s++,a-=2;if(s%2==0)break;t+=2}else break}return t}function vjt(e,t,n){for(;t>0;){let r=jNe(e,t-2,n);if(r<t)return r;t--}return 0}function N7(e,t){let n=e.charCodeAt(t);if(!qNe(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return LNe(r)?(n-55296<<10)+(r-56320)+65536:n}function LNe(e){return e>=56320&&e<57344}function qNe(e){return e>=55296&&e<56320}function tme(e){return e<65536?1:2}let Vr=class zNe{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]=Nw(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),Th.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]=Nw(this,t,n);let r=[];return this.decompose(t,n,r,0),Th.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 gk(this),s=new gk(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 gk(this,t)}iterRange(t,n=this.length){return new UNe(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 WNe(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]?zNe.empty:t.length<=32?new Xs(t):Th.from(Xs.split(t,[]))}};class Xs extends Vr{constructor(t,n=yjt(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 bjt(i,o,r,a);i=o+1,r++}}decompose(t,n,r,i){let s=t<=0&&n>=this.length?this:new Xs(nme(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let a=r.pop(),o=JQ(s.text,a.text.slice(),0,s.length);if(o.length<=32)r.push(new Xs(o,a.length+s.length));else{let l=o.length>>1;r.push(new Xs(o.slice(0,l)),new Xs(o.slice(l)))}}else r.push(s)}replace(t,n,r){if(!(r instanceof Xs))return super.replace(t,n,r);[t,n]=Nw(this,t,n);let i=JQ(this.text,JQ(r.text,nme(this.text,0,t)),n),s=this.length+r.length-(n-t);return i.length<=32?new Xs(i,s):Th.from(Xs.split(i,[]),s)}sliceString(t,n=this.length,r=`
|
|
1191
|
+
`,n);if(r===-1)break;const i=_Mt(t.slice(n,r));if(e.fence){AMt(i,e.fence)&&(e.fence=null),n=r+1;continue}if(oNe.test(i)){e.blankRunStart<0&&(e.blankRunStart=n),n=r+1;continue}if(e.blankRunStart>=0){if(e.kind==="none"||!RMt(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=yge(i)}e.blankRunStart=-1}else e.kind==="none"&&(e.kind=yge(i));if(e.kind!=="indented-code"){const s=PMt.exec(i);s&&(e.fence={char:s[1][0],length:s[1].length})}n=r+1}e.cursor=n},NMt=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},ar="var(--color-ink)",Qf="var(--color-ink-muted)",rh="var(--color-surface)",kO="var(--color-elevated)",Rf="var(--color-sunken)",vo="var(--color-hairline)",TO="var(--color-control)",Yy="var(--color-accent)",Q$="var(--color-accent-wash)",XMt="var(--color-on-accent)",IMt="var(--color-info)",uNe="var(--color-info-wash)",FMt="var(--color-success)",dNe="var(--color-success-wash)",MMt="var(--color-warning)",fG="var(--color-warning-wash)",jMt="var(--color-warning-border)",C7="var(--color-danger)",pG="var(--color-danger-wash)",bge=[Q$,uNe,dNe,fG,pG],_O=e=>getComputedStyle(document.documentElement).getPropertyValue(e).trim(),LMt=()=>{const e={primaryColor:_O("--color-accent"),secondaryColor:_O("--color-success"),tertiaryColor:_O("--color-info"),mainBkg:_O("--color-elevated"),clusterBkg:_O("--color-sunken"),clusterBorder:_O("--color-hairline"),edgeLabelBackground:_O("--color-surface"),quadrant1Fill:_O("--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:rh,primaryTextColor:ar,primaryBorderColor:TO,secondaryTextColor:ar,secondaryBorderColor:vo,tertiaryTextColor:ar,tertiaryBorderColor:vo,lineColor:Qf,arrowheadColor:Qf,textColor:ar,secondBkg:Rf,border1:TO,border2:vo,labelColor:ar,nodeBkg:kO,nodeBorder:TO,nodeTextColor:ar,defaultLinkColor:Qf,titleColor:ar,noteBkgColor:fG,noteBorderColor:jMt,noteTextColor:ar,actorBkg:kO,actorBorder:TO,actorTextColor:ar,actorLineColor:vo,signalColor:Qf,signalTextColor:ar,labelBoxBkgColor:kO,labelBoxBorderColor:vo,labelTextColor:ar,loopTextColor:ar,activationBkgColor:Q$,activationBorderColor:Yy,sequenceNumberColor:rh,sectionBkgColor:Rf,sectionBkgColor2:rh,altSectionBkgColor:Rf,excludeBkgColor:Rf,taskBkgColor:Q$,taskBorderColor:TO,taskTextColor:ar,taskTextLightColor:ar,taskTextDarkColor:ar,taskTextOutsideColor:ar,taskTextClickableColor:Yy,activeTaskBkgColor:Q$,activeTaskBorderColor:Yy,gridColor:vo,doneTaskBkgColor:Rf,doneTaskBorderColor:vo,critBkgColor:pG,critBorderColor:C7,todayLineColor:Yy,transitionColor:Qf,transitionLabelColor:ar,stateLabelColor:ar,stateBkg:kO,labelBackgroundColor:rh,compositeBackground:Rf,altBackground:Rf,compositeTitleBackground:kO,compositeBorder:vo,innerEndBackground:ar,specialStateColor:ar,classText:ar,attributeBackgroundColorOdd:rh,attributeBackgroundColorEven:Rf,rowOdd:rh,rowEven:Rf,errorBkgColor:pG,errorTextColor:C7,pieTitleTextColor:ar,pieSectionTextColor:ar,pieLegendTextColor:ar,pieStrokeColor:rh,pieOuterStrokeColor:vo,requirementBackground:kO,requirementBorderColor:TO,requirementTextColor:ar,relationColor:Qf,relationLabelBackground:rh,relationLabelColor:ar,branchLabelColor:XMt,commitLabelColor:ar,commitLabelBackground:rh,tagLabelColor:ar,tagLabelBackground:Q$,tagLabelBorder:TO,quadrant2Fill:uNe,quadrant3Fill:dNe,quadrant4Fill:fG,quadrant2TextFill:ar,quadrant3TextFill:ar,quadrant4TextFill:ar,quadrantPointFill:Yy,archEdgeColor:Qf,archEdgeArrowColor:Qf,archGroupBorderColor:vo,scaleLabelColor:ar,packet:{startByteColor:ar,endByteColor:ar,labelColor:ar,titleColor:ar,blockStrokeColor:TO,blockFillColor:kO},radar:{axisColor:Qf,axisStrokeWidth:2,axisLabelFontSize:12,curveOpacity:.5,curveStrokeWidth:2,graticuleColor:vo,graticuleStrokeWidth:1,graticuleOpacity:.3,legendBoxSize:12,legendFontSize:12},xyChart:{backgroundColor:rh,titleColor:ar,xAxisTitleColor:ar,xAxisLabelColor:ar,xAxisTickColor:vo,xAxisLineColor:vo,yAxisTitleColor:ar,yAxisLabelColor:ar,yAxisTickColor:vo,yAxisLineColor:vo,plotColorPalette:[Yy,IMt,FMt,MMt,C7].join(",")}};for(let n=0;n<5;n++)t[`surface${n}`]=kO,t[`surfacePeer${n}`]=vo;for(let n=0;n<8;n++)t[`fillType${n}`]=bge[n%bge.length];return{...t,...e}};let E7=null,wge=null;const qMt=async e=>{E7||(E7=je(async()=>{const{default:n}=await import("./mermaid.core-Du-3Cewj.js").then(r=>r.b4);return{default:n}},__vite__mapDeps([0,1,2]),import.meta.url).then(({default:n})=>n));const t=await E7;return wge!==e&&(t.initialize({startOnLoad:!0,theme:"base",securityLevel:"loose",fontFamily:"var(--font-sans)",fontSize:14,suppressErrorRendering:!0,themeVariables:LMt()}),wge=e),t},xge=({className:e,copied:t,onZoomIn:n,onZoomOut:r,onReset:i,onSave:s,onCopy:a,children:o})=>p.jsxs("div",{className:A("absolute z-10 flex items-center gap-0.5 rounded-md bg-elevated p-1 shadow-overlay",e),children:[p.jsx(it,{content:"Zoom in",children:p.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Zoom in",onClick:n,children:p.jsx(Sit,{})})}),p.jsx(it,{content:"Zoom out",children:p.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Zoom out",onClick:r,children:p.jsx(kit,{})})}),p.jsx(it,{content:"Drag the diagram to pan",children:p.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Drag to pan",children:p.jsx(Bnt,{})})}),p.jsx(it,{content:"Reset view",children:p.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Reset view",onClick:i,children:p.jsx(dZ,{})})}),p.jsx(it,{content:"Save as SVG",children:p.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Save as SVG",onClick:s,children:p.jsx(Np,{})})}),p.jsx(it,{content:t?"Copied":"Copy mermaid text",children:p.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":t?"Copied":"Copy mermaid text",onClick:a,children:p.jsx(ey,{className:A(t&&"text-success")})})}),o]}),OG=({title:e,children:t})=>p.jsxs(Ml,{variant:"danger",role:"alert",className:"my-4",children:[p.jsx(O_e,{children:e}),p.jsx(rT,{children:t})]});class zMt extends b.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||p.jsxs(OG,{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 UMt=b.memo(({chart:e,id:t})=>{const n=b.useRef(null),r=b.useRef(null),[i,s]=b.useState(null),[a,o]=b.useState(!0),[l,c]=b.useState(""),[u,d]=b.useState(!1),[h,f]=b.useState({scale:1,x:0,y:0}),[O,g]=b.useState({scale:1,x:0,y:0}),[m,v]=b.useState(!1),[y,w]=b.useState({x:0,y:0}),[k,x]=b.useState("idle"),[S,T]=b.useState("idle"),_=mn(N=>N.themeName),P=b.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 N=await qMt(_),z=t||`mermaid-${Date.now()}-${Math.floor(Math.random()*1e6)}`,{svg:V}=await N.render(z,e);if(!V||typeof V!="string"||V.trim().length===0)throw new Error("Mermaid failed to generate valid SVG output");c(V)}catch(N){console.error("Mermaid rendering error:",N);const z=N instanceof Error?N.message:"Failed to render mermaid diagram";s(z),c("")}finally{o(!1)}},[e,t,_]);b.useEffect(()=>{P().catch(N=>{console.error("Error in renderDiagram effect:",N),s("Failed to initialize diagram rendering"),o(!1)})},[P]);const E=b.useCallback(()=>{try{if(!l||!r.current)return 1;const z=r.current.getBoundingClientRect(),V=document.createElement("div");V.innerHTML=l;const ee=V.querySelector("svg");if(!ee)return 1;const oe=ee.getBoundingClientRect?.()?.width||Number.parseFloat(ee.getAttribute("width")||"0")||ee.viewBox?.baseVal?.width||800,ie=ee.getBoundingClientRect?.()?.height||Number.parseFloat(ee.getAttribute("height")||"0")||ee.viewBox?.baseVal?.height||600,he=z.width*.9/oe,te=z.height*.9/ie;return Math.min(he,te,1)}catch(N){return console.error("Error calculating fullscreen scale:",N),1}},[l]);b.useEffect(()=>{u&&l&&setTimeout(()=>{try{const N=E();g({scale:N,x:0,y:0})}catch(N){console.error("Error setting fullscreen transform:",N)}},100)},[u,l,E]);const C=b.useCallback((N=!1)=>{try{(N?g:f)(V=>({...V,scale:Math.min(V.scale*1.2,10)}))}catch(z){console.error("Error in zoom in:",z)}},[]),Q=b.useCallback((N=!1)=>{try{(N?g:f)(V=>({...V,scale:Math.max(V.scale/1.2,.1)}))}catch(z){console.error("Error in zoom out:",z)}},[]),D=b.useCallback((N=!1)=>{try{const z=N?g:f;if(N){const V=E();z({scale:V,x:0,y:0})}else z({scale:1,x:0,y:0})}catch(z){console.error("Error in reset:",z)}},[E]),F=b.useCallback(()=>{if(l)try{const N=new Blob([l],{type:"image/svg+xml"}),z=URL.createObjectURL(N),V=document.createElement("a");V.href=z,V.download=`mermaid-diagram-${Date.now()}.svg`,document.body.appendChild(V),V.click(),document.body.removeChild(V),URL.revokeObjectURL(z)}catch(N){console.error("Failed to save SVG:",N)}},[l]),I=b.useCallback(async()=>{try{await navigator.clipboard.writeText(e),x("copied"),setTimeout(()=>x("idle"),1200)}catch(N){console.error("Failed to copy Mermaid chart text:",N)}},[e]),U=b.useCallback(async()=>{try{await navigator.clipboard.writeText(e),T("copied"),setTimeout(()=>T("idle"),1200)}catch(N){console.error("Failed to copy Mermaid chart text:",N)}},[e]),q=b.useCallback(N=>{try{v(!0),w({x:N.clientX,y:N.clientY}),N.preventDefault()}catch(z){console.error("Error in mouse down:",z)}},[]),Z=b.useCallback((N,z=!1)=>{try{if(!m)return;const V=N.clientX-y.x,ee=N.clientY-y.y;(z?g:f)(ie=>({...ie,x:ie.x+V,y:ie.y+ee})),w({x:N.clientX,y:N.clientY})}catch(V){console.error("Error in mouse move:",V)}},[m,y]),W=b.useCallback(()=>{try{v(!1)}catch(N){console.error("Error in mouse up:",N)}},[]),M=b.useCallback((N,z=!1)=>{try{N.preventDefault();const V=N.deltaY>0?.9:1.1;(z?g:f)(oe=>({...oe,scale:Math.min(Math.max(oe.scale*V,.1),5)}))}catch(V){console.error("Error in wheel:",V)}},[]),J=b.useCallback(N=>{try{d(N)}catch(z){console.error("Error toggling fullscreen:",z)}},[]);if(i)return p.jsxs(OG,{title:"Mermaid diagram error",children:[i,p.jsx("span",{className:A("mt-2 block text-ink-muted"),children:"Chart"}),p.jsx("span",{className:A("mt-1 block whitespace-pre-wrap font-mono text-mono-sm"),children:e})]});const L=(N=!1)=>{try{const z=N?r:n,V=N?O:h;return p.jsx("div",{ref:z,className:A("mermaid flex w-full items-center justify-center",N?"h-full min-h-full":"h-auto min-h-50",m?"cursor-grabbing":"cursor-grab"),onMouseDown:q,onMouseMove:ee=>Z(ee,N),onMouseUp:W,onMouseLeave:W,onWheel:ee=>M(ee,N),children:a?p.jsx("div",{className:A("p-4 text-body-sm text-ink-muted"),children:"Loading diagram..."}):l?p.jsx("div",{className:A("flex h-full w-full items-center justify-center"),style:{transform:`translate(${V.x}px, ${V.y}px) scale(${V.scale})`,transformOrigin:"center center"},dangerouslySetInnerHTML:{__html:l}}):null})}catch(z){return console.error("Error rendering diagram content:",z),p.jsx(OG,{title:"Rendering error",children:"Failed to render diagram content."})}};return p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:A("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:[L(!1),p.jsx(xge,{className:"top-2 right-2",copied:k==="copied",onZoomIn:()=>C(!1),onZoomOut:()=>Q(!1),onReset:()=>D(!1),onSave:F,onCopy:I,children:p.jsx(it,{content:"Fullscreen",children:p.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Open diagram fullscreen",onClick:()=>J(!0),children:p.jsx(Ant,{})})})})]}),p.jsx(Nc,{open:u,onClose:()=>J(!1),title:"Mermaid diagram",maxWidth:"xl",fullWidth:!0,dialogProps:{className:"h-[90vh] max-h-[90vh]"},children:p.jsxs("div",{className:A("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:[L(!0),p.jsx(xge,{className:"top-4 right-4",copied:S==="copied",onZoomIn:()=>C(!0),onZoomOut:()=>Q(!0),onReset:()=>D(!0),onSave:F,onCopy:U,children:p.jsx(it,{content:"Close fullscreen",children:p.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Close fullscreen",onClick:()=>J(!1),children:p.jsx(Qi,{})})})})]})})]})}),WMt=b.memo(e=>p.jsx(zMt,{children:p.jsx(UMt,{...e})}));let hNe=!1,Q7=null;const GMt=()=>(Q7||(Q7=je(()=>Promise.resolve({}),__vite__mapDeps([3]),import.meta.url).then(e=>(hNe=!0,e))),Q7),VMt=/language-(\w+)/,BMt=/\n$/,YMt=/\$(?!\d)(.+?)\$/,ZMt=/\$\$([\s\S]+?)\$\$/,HMt=/\\begin\{([^}]+)\}([\s\S]+?)\\end\{\1\}/,KMt=/\\[a-zA-Z]+(\{[^}]*\})?/,fNe={a:({href:e,children:t})=>p.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:t}),code:({node:e,className:t,children:n,...r})=>VMt.exec(t??"")?.[1]==="mermaid"?p.jsx(WMt,{chart:String(n).replace(BMt,"")}):p.jsx("code",{className:t,...r,children:n})},JMt=[mN],e8t=[mN,TMt],t8t=[],n8t=[U6t],r8t=e=>YMt.test(e)||ZMt.test(e)||HMt.test(e)?!0:KMt.test(e)&&(e.includes("\\frac")||e.includes("\\sum")||e.includes("\\int")||e.includes("\\sqrt")),pNe=e=>b.useMemo(()=>{if(!(!e?.fontSize&&!e?.lineHeight))return{"--md-font-size":e.fontSize,"--md-line-height":e.lineHeight}},[e?.fontSize,e?.lineHeight]),ONe=e=>{const t=b.useMemo(()=>r8t(e),[e]),[n,r]=b.useState(()=>t&&hNe);return b.useEffect(()=>{if(!t||n)return;let i=!1;return GMt().then(()=>{i||r(!0)}),()=>{i=!0}},[t,n]),{remarkPlugins:n?e8t:JMt,rehypePlugins:n?n8t:t8t}},uy=b.memo(({content:e,styleProps:t,className:n})=>{const r=b.useMemo(()=>e.trim(),[e]),{remarkPlugins:i,rehypePlugins:s}=ONe(r),a=pNe(t);return p.jsx("div",{className:A("lo-markdown",n),style:a,children:p.jsx(EK,{remarkPlugins:i,rehypePlugins:s,components:fNe,children:r})})});uy.displayName="MarkdownRenderer";const gNe=b.memo(({source:e})=>{const{remarkPlugins:t,rehypePlugins:n}=ONe(e);return p.jsx(EK,{remarkPlugins:t,rehypePlugins:n,components:fNe,children:e})});gNe.displayName="StableBlock";const mNe=b.memo(({text:e,animate:t})=>p.jsx("span",{className:t?"lo-stream-chunk":void 0,children:e}));mNe.displayName="ArrivedText";const vNe=({content:e,styleProps:t,className:n})=>{const r=b.useRef(null);r.current===null&&(r.current=EMt());const i=r.current,s=b.useRef([]),a=b.useRef(0);DMt(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+NMt(e.slice(l)),h=[{offset:l,animate:!1}];for(const O of c){if(O.offset>=d)break;h.push(O)}const f=pNe(t);return p.jsxs("div",{className:A("lo-markdown",n),style:f,children:[i.blocks.map((O,g)=>p.jsx(gNe,{source:O},g)),d>l&&p.jsx("p",{className:"lo-stream-tail",children:h.map((O,g)=>{const m=h[g+1]?.offset??d;return p.jsx(mNe,{text:e.slice(O.offset,m),animate:O.animate},O.offset)})})]})};vNe.displayName="StreamingMarkdown";const yNe=({className:e})=>p.jsx("div",{className:A("flex size-7 shrink-0 items-center justify-center rounded-full bg-sunken text-ink-muted",e),children:p.jsx(Jv,{size:16,"aria-label":"Assistant"})}),Ok="pl-10",yc=({isUser:e,children:t,isSmallView:n,showAvatar:r,className:i})=>e?p.jsx("div",{className:A("flex w-full justify-end",i),children:t}):p.jsxs("div",{className:A("relative w-full",!n&&Ok,i),children:[r&&!n&&p.jsx(yNe,{className:"absolute top-0 left-0"}),t]}),rJ=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.getTime()},i8t=e=>{const t=new Date(e);return t.setHours(0,0,0,0),t.setDate(t.getDate()+1),Math.max(1,t.getTime()-e)};let iJ=rJ(Date.now()),ZO=null;const HQ=new Set,bNe=()=>{ZO!==null&&clearTimeout(ZO),ZO=setTimeout(()=>{ZO=null,iJ=rJ(Date.now());for(const e of HQ)e();bNe()},i8t(Date.now())),ZO.unref?.()},s8t=e=>(HQ.add(e),iJ=rJ(Date.now()),bNe(),()=>{HQ.delete(e),HQ.size===0&&ZO!==null&&(clearTimeout(ZO),ZO=null)}),Sge=()=>iJ,a8t=()=>b.useSyncExternalStore(s8t,Sge,Sge),o8t=e=>new Date(e+1e3),l8t=()=>o8t(a8t()),wNe=6048e5,c8t=864e5,$ge=6e4,yrr=36e5,brr=1e3,kge=525600,Tge=43200,_ge=1440,Pge=Symbol.for("constructDateFrom");function zp(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Pge in e?e[Pge](t):e instanceof Date?new e.constructor(t):new Date(t)}function Xc(e,t){return zp(t||e,e)}let u8t={};function c2(){return u8t}function E_(e,t){const n=c2(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Xc(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 I4(e,t){return E_(e,{...t,weekStartsOn:1})}function xNe(e,t){const n=Xc(e,t?.in),r=n.getFullYear(),i=zp(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);const s=I4(i),a=zp(n,0);a.setFullYear(r,0,4),a.setHours(0,0,0,0);const o=I4(a);return n.getTime()>=s.getTime()?r+1:n.getTime()>=o.getTime()?r:r-1}function F4(e){const t=Xc(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 SNe(e,...t){const n=zp.bind(null,t.find(r=>typeof r=="object"));return t.map(n)}function Cge(e,t){const n=Xc(e,t?.in);return n.setHours(0,0,0,0),n}function d8t(e,t,n){const[r,i]=SNe(n?.in,e,t),s=Cge(r),a=Cge(i),o=+s-F4(s),l=+a-F4(a);return Math.round((o-l)/c8t)}function h8t(e,t){const n=xNe(e,t),r=zp(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),I4(r)}function f8t(e,t){const n=+Xc(e)-+Xc(t);return n<0?-1:n>0?1:n}function p8t(e){return zp(e,Date.now())}function O8t(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function g8t(e){return!(!O8t(e)&&typeof e!="number"||isNaN(+Xc(e)))}function m8t(e){return t=>{const r=(e?Math[e]:Math.trunc)(t);return r===0?0:r}}function v8t(e,t){const n=Xc(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const y8t={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"}},b8t=(e,t,n)=>{let r;const i=y8t[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 R7(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const w8t={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},x8t={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},S8t={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},$8t={date:R7({formats:w8t,defaultWidth:"full"}),time:R7({formats:x8t,defaultWidth:"full"}),dateTime:R7({formats:S8t,defaultWidth:"full"})},k8t={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},T8t=(e,t,n,r)=>k8t[e];function AS(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 _8t={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},P8t={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},C8t={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"]},E8t={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"]},Q8t={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"}},R8t={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"}},A8t=(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"},D8t={ordinalNumber:A8t,era:AS({values:_8t,defaultWidth:"wide"}),quarter:AS({values:P8t,defaultWidth:"wide",argumentCallback:e=>e-1}),month:AS({values:C8t,defaultWidth:"wide"}),day:AS({values:E8t,defaultWidth:"wide"}),dayPeriod:AS({values:Q8t,defaultWidth:"wide",formattingValues:R8t,defaultFormattingWidth:"wide"})};function DS(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)?X8t(o,d=>d.test(a)):N8t(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 N8t(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function X8t(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function I8t(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 F8t=/^(\d+)(th|st|nd|rd)?/i,M8t=/\d+/i,j8t={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},L8t={any:[/^b/i,/^(a|c)/i]},q8t={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},z8t={any:[/1/i,/2/i,/3/i,/4/i]},U8t={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},W8t={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]},G8t={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},V8t={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]},B8t={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},Y8t={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}},Z8t={ordinalNumber:I8t({matchPattern:F8t,parsePattern:M8t,valueCallback:e=>parseInt(e,10)}),era:DS({matchPatterns:j8t,defaultMatchWidth:"wide",parsePatterns:L8t,defaultParseWidth:"any"}),quarter:DS({matchPatterns:q8t,defaultMatchWidth:"wide",parsePatterns:z8t,defaultParseWidth:"any",valueCallback:e=>e+1}),month:DS({matchPatterns:U8t,defaultMatchWidth:"wide",parsePatterns:W8t,defaultParseWidth:"any"}),day:DS({matchPatterns:G8t,defaultMatchWidth:"wide",parsePatterns:V8t,defaultParseWidth:"any"}),dayPeriod:DS({matchPatterns:B8t,defaultMatchWidth:"any",parsePatterns:Y8t,defaultParseWidth:"any"})},$Ne={code:"en-US",formatDistance:b8t,formatLong:$8t,formatRelative:T8t,localize:D8t,match:Z8t,options:{weekStartsOn:0,firstWeekContainsDate:1}};function H8t(e,t){const n=Xc(e,t?.in);return d8t(n,v8t(n))+1}function K8t(e,t){const n=Xc(e,t?.in),r=+I4(n)-+h8t(n);return Math.round(r/wNe)+1}function kNe(e,t){const n=Xc(e,t?.in),r=n.getFullYear(),i=c2(),s=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,a=zp(t?.in||e,0);a.setFullYear(r+1,0,s),a.setHours(0,0,0,0);const o=E_(a,t),l=zp(t?.in||e,0);l.setFullYear(r,0,s),l.setHours(0,0,0,0);const c=E_(l,t);return+n>=+o?r+1:+n>=+c?r:r-1}function J8t(e,t){const n=c2(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=kNe(e,t),s=zp(t?.in||e,0);return s.setFullYear(i,0,r),s.setHours(0,0,0,0),E_(s,t)}function e7t(e,t){const n=Xc(e,t?.in),r=+E_(n,t)-+J8t(n,t);return Math.round(r/wNe)+1}function ci(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const PO={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return ci(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):ci(n+1,2)},d(e,t){return ci(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 ci(e.getHours()%12||12,t.length)},H(e,t){return ci(e.getHours(),t.length)},m(e,t){return ci(e.getMinutes(),t.length)},s(e,t){return ci(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),i=Math.trunc(r*Math.pow(10,n-3));return ci(i,t.length)}},Zy={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ege={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 PO.y(e,t)},Y:function(e,t,n,r){const i=kNe(e,r),s=i>0?i:1-i;if(t==="YY"){const a=s%100;return ci(a,2)}return t==="Yo"?n.ordinalNumber(s,{unit:"year"}):ci(s,t.length)},R:function(e,t){const n=xNe(e);return ci(n,t.length)},u:function(e,t){const n=e.getFullYear();return ci(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 ci(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 ci(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 PO.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 ci(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=e7t(e,r);return t==="wo"?n.ordinalNumber(i,{unit:"week"}):ci(i,t.length)},I:function(e,t,n){const r=K8t(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):ci(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):PO.d(e,t)},D:function(e,t,n){const r=H8t(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):ci(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 ci(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 ci(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 ci(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=Zy.noon:r===0?i=Zy.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=Zy.evening:r>=12?i=Zy.afternoon:r>=4?i=Zy.morning:i=Zy.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 PO.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):PO.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):ci(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):ci(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):PO.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):PO.s(e,t)},S:function(e,t){return PO.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return Rge(r);case"XXXX":case"XX":return r0(r);case"XXXXX":case"XXX":default:return r0(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return Rge(r);case"xxxx":case"xx":return r0(r);case"xxxxx":case"xxx":default:return r0(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Qge(r,":");case"OOOO":default:return"GMT"+r0(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Qge(r,":");case"zzzz":default:return"GMT"+r0(r,":")}},t:function(e,t,n){const r=Math.trunc(+e/1e3);return ci(r,t.length)},T:function(e,t,n){return ci(+e,t.length)}};function Qge(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+ci(s,2)}function Rge(e,t){return e%60===0?(e>0?"-":"+")+ci(Math.abs(e)/60,2):r0(e,t)}function r0(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=ci(Math.trunc(r/60),2),s=ci(r%60,2);return n+i+t+s}const Age=(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"})}},TNe=(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"})}},t7t=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return Age(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}}",Age(r,t)).replace("{{time}}",TNe(i,t))},n7t={p:TNe,P:t7t},r7t=/^D+$/,i7t=/^Y+$/,s7t=["D","DD","YY","YYYY"];function a7t(e){return r7t.test(e)}function o7t(e){return i7t.test(e)}function l7t(e,t,n){const r=c7t(e,t,n);if(console.warn(r),s7t.includes(e))throw new RangeError(r)}function c7t(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 u7t=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,d7t=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,h7t=/^'([^]*?)'?$/,f7t=/''/g,p7t=/[a-zA-Z]/;function A7(e,t,n){const r=c2(),i=n?.locale??r.locale??$Ne,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=Xc(e,n?.in);if(!g8t(o))throw new RangeError("Invalid time value");let l=t.match(d7t).map(u=>{const d=u[0];if(d==="p"||d==="P"){const h=n7t[d];return h(u,i.formatLong)}return u}).join("").match(u7t).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const d=u[0];if(d==="'")return{isToken:!1,value:O7t(u)};if(Ege[d])return{isToken:!0,value:u};if(d.match(p7t))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&&o7t(d)||!n?.useAdditionalDayOfYearTokens&&a7t(d))&&l7t(d,t,String(e));const h=Ege[d[0]];return h(o,d,i.localize,c)}).join("")}function O7t(e){const t=e.match(h7t);return t?t[1].replace(f7t,"'"):e}function g7t(e,t,n){const r=c2(),i=n?.locale??r.locale??$Ne,s=f8t(e,t);if(isNaN(s))throw new RangeError("Invalid time value");const a=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:s}),[o,l]=SNe(n?.in,...s>0?[t,e]:[e,t]),c=m8t("round"),u=l.getTime()-o.getTime(),d=u/$ge,h=F4(l)-F4(o),f=(u-h)/$ge,O=n?.unit;let g;if(d<1?g="second":d<60?g="minute":d<_ge?g="hour":f<Tge?g="day":f<kge?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/_ge);return i.formatDistance("xDays",m,a)}else if(g==="month"){const m=c(f/Tge);return m===12&&O!=="month"?i.formatDistance("xYears",1,a):i.formatDistance("xMonths",m,a)}else{const m=c(f/kge);return i.formatDistance("xYears",m,a)}}function m7t(e,t){return g7t(e,p8t(e),t)}const v7t=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 A7(t,"h:mm a");if(t.toDateString()===r.toDateString())return"Yesterday";const i=new Date(n);return i.setDate(n.getDate()-7),t>i?A7(t,"EEEE"):A7(t,"yyyy-MM-dd")}catch(t){return console.error("Error formatting date:",t),""}},wrr=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),""}},y7t=(e,t=new Date)=>{if(e==null)return"";try{const n=e instanceof Date?e:new Date(e);if(Number.isNaN(n.getTime()))return"";const r=n.toLocaleTimeString(navigator.language,{hour:"numeric",minute:"2-digit",hour12:!0});if(n.toDateString()===t.toDateString())return r;const i=new Date(t);if(i.setDate(t.getDate()-1),n.toDateString()===i.toDateString())return`Yesterday ${r}`;const s=n.toLocaleDateString(navigator.language,{month:"short",day:"numeric"});return n.getFullYear()===t.getFullYear()?`${s}, ${r}`:`${s}, ${n.getFullYear()}, ${r}`}catch(n){return console.error("Error formatting turn timestamp:",n),""}},_Ne=(e,t)=>{if(!e)return"";try{const n=e instanceof Date?e:new Date(e);return Number.isNaN(n.getTime())?"":n.toLocaleString(navigator.language,{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"2-digit",...t})}catch(n){return console.error("Error formatting calendar date-time:",n),""}},sJ=({timestamp:e,scope:t,className:n})=>{const r=e instanceof Date?e:new Date(e),i=l8t();if(Number.isNaN(r.getTime()))return null;const s=_Ne(r,{hour12:!0});return p.jsx(it,{content:s,side:"bottom",delayDuration:1200,children:p.jsx("time",{dateTime:r.toISOString(),"data-stamp":t,"aria-label":`Sent ${s}`,className:A("shrink-0 cursor-help select-none whitespace-nowrap text-ink-dim text-meta",n),children:y7t(r,i)})})},Q_=({replies:e,onRemoveReply:t})=>p.jsxs("div",{className:"mb-2 flex flex-col gap-1.5 rounded-sm bg-sunken p-2",children:[p.jsxs("div",{className:"flex items-center gap-1.5 text-ink-dim",children:[p.jsx(h2e,{size:12,"aria-hidden":"true"}),p.jsx("span",{className:"text-meta",children:"Replying to"})]}),e.map(n=>p.jsxs("div",{className:"flex items-center gap-2 border-hairline border-l-2 py-0.5 pl-2",children:[p.jsx("span",{className:"flex-1 truncate text-body-sm text-ink-muted",title:n.text,children:n.text}),t&&p.jsx(we,{variant:"ghost",size:"icon-sm",className:"shrink-0 text-ink-dim hover:bg-elevated hover:text-ink",onClick:()=>t(n.id),"aria-label":"Remove reply",children:p.jsx(Qi,{"aria-hidden":"true"})})]},n.id))]}),PNe=({content:e,busy:t=!1,className:n})=>e?p.jsxs("section",{"aria-label":"Question from the agent",className:A("flex gap-3 rounded-md border border-accent bg-accent-wash px-4 py-3",n),children:[p.jsx(Int,{className:"mt-0.5 size-4 shrink-0 text-accent","aria-hidden":!0}),p.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[p.jsx("p",{className:"font-medium text-accent text-meta",children:t?"Sending your answer…":"Waiting for your answer"}),p.jsx("div",{className:"lo-on-wash text-ink",children:p.jsx(uy,{content:e})})]})]}):null,b7t=({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 p.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)=>p.jsxs("button",{type:"button",disabled:n,onClick:()=>r(a.label),className:A("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&&p.jsxs("span",{"aria-hidden":!0,className:A("shrink-0 font-mono text-mono-sm",n?"text-ink-disabled":"text-ink-dim"),children:[o+1,"."]}),p.jsxs("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[p.jsxs("span",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[p.jsx("span",{className:A("min-w-0 text-body-sm",n?"text-ink-disabled":"text-ink"),children:a.label}),s===o&&p.jsx("span",{className:A("shrink-0 font-medium text-meta",n?"text-ink-disabled":"text-ink"),children:"Recommended"})]}),a.description&&p.jsx("span",{className:A("text-body-sm",n?"text-ink-disabled":"text-ink-muted"),children:a.description})]})]},`${i}-${String(o)}`))})},CNe=({children:e,className:t})=>p.jsx("span",{"aria-hidden":!0,className:A("flex size-3.5 shrink-0 [&_svg]:size-3.5",t),children:e}),aJ=({label:e="Reasoning",content:t})=>!mn(r=>r.showAgentReasoning)||!t?null:p.jsx(Nu,{summary:p.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[p.jsx(CNe,{}),p.jsx("span",{className:"truncate",children:p.jsx("span",{className:"text-ink-dim text-meta",children:e})})]}),children:p.jsx(uy,{content:t,className:"[--md-ink:var(--lo-ink-muted)]",styleProps:{fontSize:"var(--text-body-sm)",lineHeight:"var(--text-body-sm--line-height)"}})}),w7t={hunk:"text-ink-muted",added:"text-success",removed:"text-danger",context:"text-ink-dim"},x7t=({line:e})=>p.jsx("span",{className:A(w7t[e.kind],"block"),children:e.text}),S7t=({diff:e,className:t})=>{const n=ldt(e);return p.jsxs("div",{className:A("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)=>p.jsx(x7t,{line:r},i)),n.hidden>0&&p.jsx("span",{className:"sticky -bottom-3 -mb-3 block bg-sunken pb-3 text-ink-dim",children:cdt(n.hidden)})]})},$7t=({content:e,details:t,className:n})=>p.jsxs("section",{"aria-label":"Security notice",className:A("flex gap-3 border-warning border-l-2 py-0.5 pl-3",n),children:[p.jsx(S2e,{className:"mt-0.5 size-4 shrink-0 text-warning","aria-hidden":!0}),p.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[p.jsx("p",{className:"font-medium text-body-sm text-warning",children:"Blocked a risky action"}),e?p.jsx("p",{className:"text-body-sm text-ink-muted",children:e}):null,t?p.jsx(Nu,{summary:p.jsx("span",{className:"text-meta",children:"Show the reviewed code"}),children:t}):null]})]}),k7t=(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()},Dge=e=>e.startsWith("file://")?e.slice(7):e,T7t={READ:{verb:"Read",runningVerb:"Reading",icon:iZ},WRITE:{verb:"Wrote",runningVerb:"Writing",icon:cZ},EDIT:{verb:"Edited",runningVerb:"Editing",icon:ort},CODE:{verb:"Ran code",runningVerb:"Running code",icon:sZ},DELEGATE:{verb:"Delegated work",runningVerb:"Delegating work",icon:Xrt},DONE:{verb:"Finished",runningVerb:"Finishing",icon:AY},ASK:{verb:"Asked",runningVerb:"Asking",icon:W3},BYE:{verb:"Ended the conversation",runningVerb:"Ending",icon:$tt}},_7t={verb:"Worked on the request",runningVerb:"Working on the request",icon:sZ},P7t=(e,t,n,r)=>{const i=e?T7t[e]:_7t;let s;if(t)s=Dge(t);else if(n&&n.length>0){const o=n.filter(l=>!l.startsWith("data:"));o.length===1?s=Dge(o[0]):o.length>1&&(s=`${o.length} files`)}const a=!s&&r?k7t(r):"";return{verb:i.verb,runningVerb:i.runningVerb,object:s,narration:a||void 0,icon:i.icon}},Nge="min-h-5 py-0",C7t=({icon:e,verb:t,object:n,narration:r,running:i,failed:s,wrap:a})=>p.jsxs("span",{className:A("flex min-w-0 gap-2",a?"items-start":"items-center"),"aria-busy":i||void 0,children:[p.jsx(CNe,{className:A(s?"text-danger":"text-ink-dim",a&&O4e),children:e}),p.jsxs("span",{className:A(a?"min-w-0 whitespace-pre-wrap break-words":"truncate"),children:[p.jsxs("span",{...L8,className:A("select-text font-mono text-mono-sm",i?"text-ink-muted":"text-ink-dim",s&&"text-danger"),children:[t,r?":":null]}),n?p.jsxs("span",{...L8,className:"select-text font-mono text-ink-muted text-mono-sm",children:[" ",n]}):null,r?p.jsxs("span",{...L8,className:"select-text text-body-sm text-ink-muted",children:[" ",r]}):null]})]}),M4=({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 O=P7t(e,t,n,r),g=c??(i?O.runningVerb:O.verb),m=s?sv:O.icon,v=s||!c||!d?p.jsx(m,{}):d,y=p.jsx(C7t,{icon:v,verb:g,object:c?u:O.object,narration:c?r:O.narration,running:i,failed:s,wrap:h}),w=h?"firstLine":"center";return o?p.jsx(Nu,{summary:y,chevron:"leading",summaryAlign:w,defaultOpen:a,className:l,rowClassName:f?Nge:void 0,triggerClassName:"-mx-2 rounded-sm px-2 hover:bg-elevated",children:o}):p.jsx(Nu,{disabled:!0,summary:y,summaryAlign:w,className:l,rowClassName:f?Nge:void 0})},ENe=8,E7t="… deeper values not shown",Q7t="(empty)";function R7t(e){return`… ${e} more line${e===1?"":"s"}`}const Xge=.5;function A7t(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 QNe(e){return e==null?"null":typeof e=="string"?e.trim()||null:typeof e=="number"||typeof e=="boolean"?String(e):null}function oJ(e){return typeof e=="object"&&e!==null}function RNe(e,t,n,r){if(n>ENe){r.push({key:t,value:E7t,depth:n});return}if(oJ(e)){for(const[s,a]of Object.entries(e))RNe(a,t?`${t}.${s}`:s,n+1,r);return}const i=QNe(e);i!==null&&r.push({key:t,value:i,depth:n})}function ANe(e){if(!e)return[];const t=[];for(const[n,r]of Object.entries(e))RNe(r,n,1,t);return t}const D7t=512;function N7t(e,t){if(t)return!0;if(!e)return!1;let n=D7t;const r=(i,s)=>{if(n--<=0||s>ENe)return!0;if(!oJ(i))return QNe(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 X7t(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(!oJ(n))return null;const r=ANe(n);return r.length>0?r:[{key:"",value:Q7t,depth:1}]}const I7t=8,Ige="max-h-[240px]",F7t=({line:e})=>p.jsxs("div",{className:A("whitespace-pre-wrap break-words"),style:{paddingInlineStart:(e.depth-1)*I7t},children:[e.key?p.jsxs("span",{className:A("text-ink-dim"),children:[e.key,": "]}):null,p.jsx("span",{className:A("text-ink-muted"),children:e.value})]}),Fge=({lines:e,label:t})=>p.jsx("div",{className:A("flex flex-col gap-1"),"data-detail-lines":t,children:e.map((n,r)=>p.jsx(F7t,{line:n},r))});function Mge(e){const[t,n]=b.useState(0),[r,i]=b.useState(!1);return b.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+Xge);const f=c.children.length>0?Array.from(c.children):[c];n(A7t(f.map(O=>{const g=O.getBoundingClientRect();return{top:g.top,height:g.height}}),u,d.bottom,Xge))};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 jge=({lines:e,overflowing:t})=>t?p.jsx("span",{className:A("mt-1 block text-ink-dim"),children:e>0?R7t(e):" "}):null,M7t=({args:e,output:t,isError:n})=>{const r=ANe(e),i=X7t(t),s=b.useRef(null),a=b.useRef(null),o=Mge(s),l=Mge(a);return r.length===0&&!t?null:p.jsxs("div",{className:A("w-full rounded-sm border border-hairline bg-sunken p-3 font-mono text-mono-sm"),children:[r.length>0&&p.jsxs("div",{"data-detail-section":"input",children:[p.jsx("div",{ref:s,className:A(Ige,"overflow-auto"),children:p.jsx(Fge,{lines:r,label:"input"})}),p.jsx(jge,{lines:o.lines,overflowing:o.overflowing})]}),t&&p.jsxs("div",{className:A(r.length>0&&"mt-3"),"data-detail-section":"output",children:[p.jsx("span",{className:A("mb-1 block text-meta",n?"text-danger":"text-ink-dim"),children:n?"Error":"Output"}),p.jsx("div",{ref:a,className:A(Ige,"overflow-auto"),children:i?p.jsx(Fge,{lines:i,label:"result-json"}):p.jsx("pre",{className:A("whitespace-pre font-mono",n?"text-danger":"text-ink"),children:t})}),p.jsx(jge,{lines:l.lines,overflowing:l.overflowing})]})]})},j7t="mcp__",L7t={bash:uit,read:uv,write:nse,edit:nse,glob:hT,grep:dv,todo:$nt,wake:G3,list_variables:a5,read_variable:a5,browser:_g,web_search:_g,web_fetch:Np,task:vp,agent:vp,send:hZ,peer:pnt};function q7t(e){const t=e.trim().toLowerCase(),n=L7t[t];return n||(t.startsWith(j7t)?uZ:$Ze)}const z7t=Ul,U7t=Qi,W7t=l2e,Lge="min-h-5 py-0",G7t={read:"text-info",mutate:"text-ink-muted",exec:"text-ink-muted",meta:"text-accent",plain:"text-ink-muted"},V7t=(e,t)=>e==="running"?"text-ink":e==="error"?"text-danger":e==="receipt"?"text-ink-muted":G7t[Hut(t)],B7t=({added:e,removed:t})=>e<=0&&t<=0?null:p.jsxs("span",{className:A("hidden shrink-0 gap-1 font-mono text-mono-sm tabular-nums @[34rem]/toolrow:flex"),children:[e>0&&p.jsxs("span",{className:A("text-success"),children:["+",e]}),t>0&&p.jsxs("span",{className:A("text-danger"),children:["-",t]})]}),qge={running:"",success:"succeeded",error:"failed",interrupted:"interrupted",receipt:""},Y7t=1e3;function Z7t(e){const[t,n]=b.useState(()=>e===null?null:Math.max(0,(Date.now()-e)/1e3));return b.useEffect(()=>{if(e===null){n(null);return}const r=()=>n(Math.max(0,(Date.now()-e)/1e3));r();const i=window.setInterval(r,Y7t);return()=>window.clearInterval(i)},[e]),t}const H7t=({outcome:e,durationS:t,startedAt:n})=>{const r=e==="running",i=Z7t(r?n??null:null),s=e==="success"?z7t:e==="error"?U7t:e==="interrupted"?W7t:null,a=e==="success"?"text-success":e==="error"?"text-danger":"text-ink-dim",o=r?n==null?"":FZ(i??0):But(t);return p.jsxs("span",{className:A("flex shrink-0 items-center gap-1.5"),children:[p.jsxs("span",{className:A("flex size-3.5 shrink-0 [&_svg]:size-3.5",a),children:[s?p.jsx(s,{"aria-hidden":!0}):null,qge[e]?p.jsx("span",{className:A("sr-only"),children:qge[e]}):null]}),p.jsx("span",{className:A("w-[5ch] text-right font-mono text-ink-dim text-mono-sm tabular-nums"),children:o})]})},j4=({toolName:e,summary:t,summaryFallback:n=null,outcome:r,durationS:i,startedAt:s=null,added:a=0,removed:o=0,nameColumn:l=VCe,details:c,defaultOpen:u=!1,onOpenChange:d,className:h,media:f})=>{const O=b.useRef(u),g=b.useRef(d);b.useEffect(()=>{g.current=d,d?.(O.current)},[d]),b.useEffect(()=>()=>{O.current&&g.current?.(!1)},[]);const m=b.useCallback(P=>{O.current=P,g.current?.(P)},[]),v=r==="running",y=r==="error",w=q7t(e),k=AT(e),x=GCe(t,e)?n??"":t,S=p.jsxs("span",{className:A("flex min-w-0 flex-1 items-center gap-2"),children:[p.jsx("span",{"aria-hidden":!0,className:A("flex size-3.5 shrink-0 [&_svg]:size-3.5",v?"text-accent":y?"text-danger":"text-ink-dim"),children:p.jsx(w,{})}),p.jsx("span",{className:A("shrink-0 truncate font-mono text-mono-sm","pr-1",V7t(r,e)),style:{width:`calc(${l}ch + 0.25rem)`},title:k,children:k}),p.jsx("span",{className:A("min-w-0 flex-1 truncate font-mono text-mono-sm",v?"text-ink-muted":"text-ink-dim"),title:x,children:x}),p.jsx(B7t,{added:a,removed:o}),p.jsx(H7t,{outcome:r,durationS:i,startedAt:s})]}),T=v?"bg-elevated":y?"bg-danger-wash":"hover:bg-elevated",_=c?p.jsx(Nu,{summary:S,chevron:"leading",defaultOpen:u,onOpenChange:m,className:A("@container/toolrow",h),rowClassName:Lge,triggerClassName:A("-mx-2 rounded-sm px-2",T),children:c}):p.jsx(Nu,{disabled:!0,summary:S,rowClassName:Lge,className:A("@container/toolrow",(v||y)&&A("-mx-2 rounded-sm px-2",T),h)});return f?p.jsxs("div",{className:A("flex flex-col"),children:[_,f]}):_},lJ=e=>{const t=b.useCallback(r=>{const i=window.matchMedia(e);return i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[e]),n=b.useCallback(()=>window.matchMedia(e).matches,[e]);return b.useSyncExternalStore(t,n,()=>!1)},zge=["⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"],K7t=80,J7t=1e3,ejt=({activity:e,phase:t,startedAt:n,className:r})=>{const[i,s]=b.useState(0),[a,o]=b.useState(()=>n===void 0?0:Math.floor((Date.now()-n)/1e3)),l=lJ("(prefers-reduced-motion: reduce)"),c=b.useRef(n??Date.now()),u=b.useRef(t);return u.current!==t&&(u.current=t,c.current=n??Date.now(),o(0)),b.useEffect(()=>{const d=window.setInterval(()=>o(Math.floor((Date.now()-c.current)/1e3)),J7t);if(l)return s(0),()=>window.clearInterval(d);const h=window.setInterval(()=>s(f=>(f+1)%zge.length),K7t);return()=>{window.clearInterval(h),window.clearInterval(d)}},[l]),p.jsxs("div",{className:A("flex items-center gap-2",r),"data-lo-working-line":!0,"aria-live":"polite",children:[p.jsx("span",{"aria-hidden":!0,className:A("w-[1ch] shrink-0 select-none font-mono text-ink-muted text-mono-sm"),children:zge[i]}),p.jsx("span",{className:A("min-w-0 truncate font-mono text-ink-dim text-mono-sm"),children:e}),p.jsx("span",{"aria-hidden":!0,className:A("w-[6ch] shrink-0 font-mono text-ink-dim text-mono-sm tabular-nums"),children:FZ(a)})]})},tjt=/^\s*<reply-to>([\s\S]*?)<\/reply-to>/,cJ=e=>{const t=[];let n=e;for(;;){const r=tjt.exec(n);if(r===null)break;t.push({id:za(),text:r[1]}),n=n.slice(r[0].length)}return{replies:t,remainingContent:n.trim()}},DNe=({children:e,className:t})=>p.jsx("div",{className:A("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}),njt="could not be displayed. It may have been moved, renamed, or deleted.",uJ="could not be displayed. Its stored copy is not available to this reader.",R_=({name:e,detail:t=njt,className:n})=>p.jsxs("div",{className:A("flex w-fit max-w-full items-center gap-2.5 rounded-sm border border-hairline bg-sunken px-3 py-2",n),children:[p.jsx(dnt,{className:"size-4 shrink-0 text-ink-dim","aria-hidden":!0}),p.jsxs("span",{className:"min-w-0 text-body-sm text-ink-muted",children:[p.jsx("span",{className:"truncate font-mono text-ink text-mono-sm",children:e}),` ${t}`]})]}),vN=({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),ms("File path copied to clipboard")}catch(o){console.error("Failed to copy file path: ",o),Rr("Failed to copy file path")}},a=()=>{e&&window.api.openFile(e)};return p.jsxs(px,{children:[p.jsx(it,{content:t,children:p.jsx(iv,{asChild:!0,children:p.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":r,onClick:o=>o.stopPropagation(),children:n??p.jsx(V3,{"aria-hidden":"true"})})})}),p.jsxs(Ox,{align:"end",className:"min-w-45",onClick:o=>o.stopPropagation(),children:[i&&p.jsxs($s,{onSelect:i,children:[p.jsx(bnt,{"aria-hidden":"true"}),p.jsx("span",{children:"Show in canvas"})]}),p.jsxs($s,{onSelect:a,children:[p.jsx(vx,{"aria-hidden":"true"}),p.jsx("span",{children:"Open file"})]}),p.jsxs($s,{onSelect:()=>window.api.showItemInFolder(e),children:[p.jsx(hT,{"aria-hidden":"true"}),p.jsx("span",{children:"Open folder"})]}),p.jsxs($s,{onSelect:s,children:[p.jsx(c2e,{"aria-hidden":"true"}),p.jsx("span",{children:"Copy file path"})]})]})]})},D7="max-h-[min(90vh,calc(100vh-104px))] max-w-[min(90vw,calc(100vw-104px))]",dJ=({src:e,label:t,open:n,onOpenChange:r,restoreFocusTo:i,fallback:s})=>{const[a,o]=b.useState(!1);return up(n,"image-lightbox"),p.jsx(jP,{open:n,onOpenChange:r,children:p.jsxs(LP,{showClose:!1,"aria-describedby":void 0,onCloseAutoFocus:l=>{const c=i?.current;c&&(l.preventDefault(),c.focus())},className:A("inset-0 top-0 left-0 m-auto h-fit w-fit translate-none",D7,"gap-0 rounded-none border-0 border-transparent bg-transparent p-0 shadow-none"),children:[p.jsx(I1,{className:"sr-only",children:t}),a?p.jsx("div",{className:A(D7,"flex min-h-16 min-w-64 items-center justify-center p-6"),children:s}):p.jsx("img",{src:e,alt:t,className:A(D7,"object-contain"),onError:()=>o(!0)}),p.jsx(kZe,{asChild:!0,children:p.jsx(we,{variant:"ghost",size:"icon-sm",className:A("fixed top-4 right-4"),"aria-label":"Close image",children:p.jsx(Qi,{"aria-hidden":"true"})})})]})})};dJ.displayName="ImageLightbox";const NNe=1024;let rjt=0,yu=class{constructor(t,n){this.from=t,this.to=n}};class Wn{constructor(t={}){this.id=rjt++,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=ha.match(t)),n=>{let r=t(n);return r===void 0?null:[this,r]}}}Wn.closedBy=new Wn({deserialize:e=>e.split(" ")});Wn.openedBy=new Wn({deserialize:e=>e.split(" ")});Wn.group=new Wn({deserialize:e=>e.split(" ")});Wn.isolate=new Wn({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});Wn.contextHash=new Wn({perNode:!0});Wn.lookAhead=new Wn({perNode:!0});Wn.mounted=new Wn({perNode:!0});class A_{constructor(t,n,r){this.tree=t,this.overlay=n,this.parser=r}static get(t){return t&&t.props&&t.props[Wn.mounted.id]}}const ijt=Object.create(null);class ha{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):ijt,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new ha(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(Wn.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(Wn.group),s=-1;s<(i?i.length:0);s++){let a=n[s<0?r.name:i[s]];if(a)return a}}}}ha.none=new ha("",Object.create(null),0,8);class Fx{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 ha(r.name,i,r.id,r.flags):r)}return new Fx(n)}}const WC=new WeakMap,Uge=new WeakMap;var Pi;(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays"})(Pi||(Pi={}));class $r{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=A_.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 L4(this.topNode,t)}cursorAt(t,n=0,r=0){let i=WC.get(this)||this.topNode,s=new L4(i);return s.moveTo(t,n),WC.set(this,s._tree),s}get topNode(){return new Fo(this,0,0,null)}resolve(t,n=0){let r=D_(WC.get(this)||this.topNode,t,n,!1);return WC.set(this,r),r}resolveInner(t,n=0){let r=D_(Uge.get(this)||this.topNode,t,n,!0);return Uge.set(this,r),r}resolveStack(t,n=0){return ojt(this,t,n)}iterate(t){let{enter:n,leave:r,from:i=0,to:s=this.length}=t,a=t.mode||0,o=(a&Pi.IncludeAnonymous)>0;for(let l=this.cursor(a|Pi.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:pJ(ha.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new $r(this.type,n,r,i,this.propValues),t.makeTree||((n,r,i)=>new $r(ha.none,n,r,i)))}static build(t){return ljt(t)}}$r.empty=new $r(ha.none,[],[],0);class hJ{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 hJ(this.buffer,this.index)}}class qg{constructor(t,n,r){this.buffer=t,this.length=n,this.set=r}get type(){return ha.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&&!(XNe(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 qg(s,a,this.set)}}function XNe(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 D_(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 Fo&&e.index<0?null:e.parent;if(!a)return e;e=a}let s=r?0:Pi.IgnoreOverlays;if(r)for(let a=e,o=a.parent;o;a=o,o=a.parent)a instanceof Fo&&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 INe{cursor(t=0){return new L4(this,t)}getChild(t,n=null,r=null){let i=Wge(this,t,n,r);return i.length?i[0]:null}getChildren(t,n=null,r=null){return Wge(this,t,n,r)}resolve(t,n=0){return D_(this,t,n,!1)}resolveInner(t,n=0){return D_(this,t,n,!0)}matchContext(t){return gG(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 Fo extends INe{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(XNe(i,r,d,d+u.length)){if(u instanceof qg){if(s&Pi.ExcludeBuffers)continue;let h=u.findChild(0,u.buffer.length,n,r-d,i);if(h>-1)return new Xh(new sjt(a,u,t,d),null,h)}else if(s&Pi.IncludeAnonymous||!u.type.isAnonymous||fJ(u)){let h;if(!(s&Pi.IgnoreMounts)&&(h=A_.get(u))&&!h.overlay)return new Fo(h.tree,d,t,a);let f=new Fo(u,d,t,a);return s&Pi.IncludeAnonymous||!f.type.isAnonymous?f:f.nextChild(n<0?u.children.length-1:0,n,r,i)}}}if(s&Pi.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&Pi.IgnoreOverlays)&&(i=A_.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 Fo(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 Wge(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 gG(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 sjt{constructor(t,n,r,i){this.parent=t,this.buffer=n,this.index=r,this.start=i}}class Xh extends INe{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 Xh(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&Pi.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 Xh(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 Xh(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 Xh(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 $r(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function FNe(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 Fo&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new ajt(i,n)}class ajt{constructor(t,n){this.heads=t,this.node=n}get next(){return FNe(this.heads)}}function ojt(e,t,n){let r=e.resolveInner(t,n),i=null;for(let s=r instanceof Fo?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=A_.get(s.tree);if(a&&a.overlay&&a.overlay[0].from<=t&&a.overlay[a.overlay.length-1].to>=t){let o=new Fo(a.tree,a.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(D_(o,t,n,!1))}}return i?FNe(i):r}class L4{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 Fo)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 Fo?(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&Pi.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Pi.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&Pi.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&Pi.IncludeAnonymous||o instanceof qg||!o.type.isAnonymous||fJ(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 Xh(this.buffer,n,this.stack[i]);return this.bufferNode=new Xh(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 gG(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 gG(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 fJ(e){return e.children.some(t=>t instanceof qg||!t.type.isAnonymous||fJ(t))}function ljt(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:i=NNe,reused:s=[],minRepeatType:a=r.types.length}=e,o=Array.isArray(n)?new hJ(n,n.length):n,l=r.types,c=0,u=0;function d(x,S,T,_,P,E){let{id:C,start:Q,end:D,size:F}=o,I=u,U=c;for(;F<0;)if(o.next(),F==-1){let J=s[C];T.push(J),_.push(Q-x);return}else if(F==-3){c=C;return}else if(F==-4){u=C;return}else throw new RangeError(`Unrecognized record size: ${F}`);let q=l[C],Z,W,M=Q-x;if(D-Q<=i&&(W=m(o.pos-S,P))){let J=new Uint16Array(W.size-W.skip),L=o.pos-W.size,N=J.length;for(;o.pos>L;)N=v(W.start,J,N);Z=new qg(J,D-W.start,r),M=W.start-x}else{let J=o.pos-F;o.next();let L=[],N=[],z=C>=a?C:-1,V=0,ee=D;for(;o.pos>J;)z>=0&&o.id==z&&o.size>=0?(o.end<=ee-i&&(O(L,N,Q,V,o.end,ee,z,I,U),V=L.length,ee=o.end),o.next()):E>2500?h(Q,J,L,N):d(Q,J,L,N,z,E+1);if(z>=0&&V>0&&V<L.length&&O(L,N,Q,V,Q,ee,z,I,U),L.reverse(),N.reverse(),z>-1&&V>0){let oe=f(q,U);Z=pJ(q,L,N,0,L.length,0,D-Q,oe,oe)}else Z=g(q,L,N,D-Q,I-D,U)}T.push(Z),_.push(M)}function h(x,S,T,_){let P=[],E=0,C=-1;for(;o.pos>S;){let{id:Q,start:D,end:F,size:I}=o;if(I>4)o.next();else{if(C>-1&&D<C)break;C<0&&(C=F-i),P.push(Q,D,F),E++,o.next()}}if(E){let Q=new Uint16Array(E*4),D=P[P.length-2];for(let F=P.length-3,I=0;F>=0;F-=3)Q[I++]=P[F],Q[I++]=P[F+1]-D,Q[I++]=P[F+2]-D,Q[I++]=I;T.push(new qg(Q,P[2]-D,r)),_.push(D-x)}}function f(x,S){return(T,_,P)=>{let E=0,C=T.length-1,Q,D;if(C>=0&&(Q=T[C])instanceof $r){if(!C&&Q.type==x&&Q.length==P)return Q;(D=Q.prop(Wn.lookAhead))&&(E=_[C]+Q.length+D)}return g(x,T,_,P,E,S)}}function O(x,S,T,_,P,E,C,Q,D){let F=[],I=[];for(;x.length>_;)F.push(x.pop()),I.push(S.pop()+T-P);x.push(g(r.types[C],F,I,E-P,Q-E,D)),S.push(P-T)}function g(x,S,T,_,P,E,C){if(E){let Q=[Wn.contextHash,E];C=C?[Q].concat(C):[Q]}if(P>25){let Q=[Wn.lookAhead,P];C=C?[Q].concat(C):[Q]}return new $r(x,S,T,_,C)}function m(x,S){let T=o.fork(),_=0,P=0,E=0,C=T.end-i,Q={size:0,start:0,skip:0};e:for(let D=T.pos-x;T.pos>D;){let F=T.size;if(T.id==S&&F>=0){Q.size=_,Q.start=P,Q.skip=E,E+=4,_+=4,T.next();continue}let I=T.pos-F;if(F<0||I<D||T.start<C)break;let U=T.id>=a?4:0,q=T.start;for(T.next();T.pos>I;){if(T.size<0)if(T.size==-3)U+=4;else break e;else T.id>=a&&(U+=4);T.next()}P=q,_+=F,E+=U}return(S<0||_==x)&&(Q.size=_,Q.start=P,Q.skip=E),Q.size>4?Q:void 0}function v(x,S,T){let{id:_,start:P,end:E,size:C}=o;if(o.next(),C>=0&&_<a){let Q=T;if(C>4){let D=o.pos-(C-4);for(;o.pos>D;)T=v(x,S,T)}S[--T]=Q,S[--T]=E-x,S[--T]=P-x,S[--T]=_}else C==-3?c=_:C==-4&&(u=_);return T}let y=[],w=[];for(;o.pos>0;)d(e.start||0,e.bufferStart||0,y,w,-1,0);let k=(t=e.length)!==null&&t!==void 0?t:y.length?w[0]+y[0].length:0;return new $r(l[e.topID],y.reverse(),w.reverse(),k)}const Gge=new WeakMap;function KQ(e,t){if(!e.isAnonymous||t instanceof qg||t.type!=e)return 1;let n=Gge.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof $r)){n=1;break}n+=KQ(e,r)}Gge.set(t,n)}return n}function pJ(e,t,n,r,i,s,a,o,l){let c=0;for(let O=r;O<i;O++)c+=KQ(e,t[O]);let u=Math.ceil(c*1.5/8),d=[],h=[];function f(O,g,m,v,y){for(let w=m;w<v;){let k=w,x=g[w],S=KQ(e,O[w]);for(w++;w<v;w++){let T=KQ(e,O[w]);if(S+T>=u)break;S+=T}if(w==k+1){if(S>u){let T=O[k];f(T.children,T.positions,0,T.children.length,g[k]+y);continue}d.push(O[k])}else{let T=g[w-1]+O[w-1].length-x;d.push(pJ(e,O,g,k,w,x,T,null,l))}h.push(x+y-s)}}return f(t,n,r,i,0),(o||l)(d,h,a)}class OJ{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 Xh?this.setBuffer(t.context.buffer,t.index,n):t instanceof Fo&&this.map.set(t.tree,n)}get(t){return t instanceof Xh?this.getBuffer(t.context.buffer,t.index):t instanceof Fo?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 kp{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 kp(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,O=Math.min(h.to,d)-c;h=f>=O?null:new kp(f,O,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 yN=class{startParse(t,n,r){return typeof t=="string"&&(t=new cjt(t)),r=r?r.length?r.map(i=>new yu(i.from,i.to)):[new yu(0,0)]:[new yu(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 cjt{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 zu(e){return(t,n,r,i)=>new djt(t,e,n,r,i)}class Vge{constructor(t,n,r,i,s){this.parser=t,this.parse=n,this.overlay=r,this.target=i,this.from=s}}function Bge(e){if(!e.length||e.some(t=>t.from>=t.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(e))}class ujt{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 mG=new Wn({perNode:!0});class djt{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 $r(r.type,r.children,r.positions,r.length,r.propValues.concat([[mG,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[Wn.mounted.id]=new A_(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 pjt(this.fragments),n=null,r=null,i=new L4(new Fo(this.baseTree,this.ranges[0].from,0,null),Pi.IncludeAnonymous|Pi.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=hjt(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||fjt(i);let c=t.findMounts(i.from,s.parser);if(typeof s.overlay=="function")n=new ujt(s.parser,s.overlay,c,this.inner.length,i.from,i.tree,n);else{let u=Hge(this.ranges,s.overlay||(i.from<i.to?[new yu(i.from,i.to)]:[]));u.length&&Bge(u),(u.length||!s.overlay)&&this.inner.push(new Vge(s.parser,u.length?s.parser.startParse(this.input,Kge(c,u),u):s.parser.startParse(""),s.overlay?s.overlay.map(d=>new yu(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 yu(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=Hge(this.ranges,n.ranges);c.length&&(Bge(c),this.inner.splice(n.index,0,new Vge(n.parser,n.parser.startParse(this.input,Kge(n.mounts,c),c),n.ranges.map(u=>new yu(u.from-n.start,u.to-n.start)),n.target,c[0].from))),n=n.prev}r&&!--r.depth&&(r=r.prev)}}}}function hjt(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 Yge(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 fjt(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,O,g){let m=n[g],v=[],y=[];Yge(a,u,m,v,y,f);let w=o[m+1],k=o[m+2];l.push(v.length);let x=g?c(m+4,o[m+3],a.set.types[o[m]],w,k-w,g-1):t.toTree();return v.push(x),y.push(w-f),Yge(a,o[m+3],d,v,y,f),new $r(h,v,y,O)}i.children[s]=c(0,o.length,ha.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 Fo(d,h+e.from,u,e._tree))}}class Zge{constructor(t,n){this.offset=n,this.done=!1,this.cursor=t.cursor(Pi.IncludeAnonymous|Pi.IgnoreMounts)}moveTo(t){let{cursor:n}=this,r=t-this.offset;for(;!this.done&&n.from<r;)n.to>=t&&n.enter(r,1,Pi.IgnoreOverlays|Pi.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 $r)n=n.children[0];else break}return!1}}let pjt=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(mG))!==null&&n!==void 0?n:r.to,this.inner=new Zge(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(mG))!==null&&t!==void 0?t:n.to,this.inner=new Zge(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(Wn.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 Hge(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 yu(l.from,a),l.to>o&&n.splice(s+1,0,new yu(o,l.to))):l.to>o?n[s--]=new yu(o,l.to):n.splice(s--,1))}}return r}function Ojt(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 yu(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 Kge(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 yu(h.from+r,h.to+r)),d=Ojt(t,u,l,c);for(let h=0,f=l;;h++){let O=h==d.length,g=O?c:d[h].from;if(g>f&&n.push(new kp(f,g,i.tree,-a,s.from>=f||s.openStart,s.to<=g||s.openEnd)),O)break;f=d[h].to}}else n.push(new kp(l,c,i.tree,-a,s.from>=a||s.openStart,s.to<=o||s.openEnd))}return n}let vG=[],MNe=[];(()=>{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?MNe:vG).push(n=n+e[t])})();function gjt(e){if(e<768)return!1;for(let t=0,n=vG.length;;){let r=t+n>>1;if(e<vG[r])n=r;else if(e>=MNe[r])t=r+1;else return!0;if(t==n)return!1}}function Jge(e){return e>=127462&&e<=127487}const eme=8205;function mjt(e,t,n=!0,r=!0){return(n?jNe:vjt)(e,t,r)}function jNe(e,t,n){if(t==e.length)return t;t&&LNe(e.charCodeAt(t))&&qNe(e.charCodeAt(t-1))&&t--;let r=N7(e,t);for(t+=tme(r);t<e.length;){let i=N7(e,t);if(r==eme||i==eme||n&&gjt(i))t+=tme(i),r=i;else if(Jge(i)){let s=0,a=t-2;for(;a>=0&&Jge(N7(e,a));)s++,a-=2;if(s%2==0)break;t+=2}else break}return t}function vjt(e,t,n){for(;t>0;){let r=jNe(e,t-2,n);if(r<t)return r;t--}return 0}function N7(e,t){let n=e.charCodeAt(t);if(!qNe(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return LNe(r)?(n-55296<<10)+(r-56320)+65536:n}function LNe(e){return e>=56320&&e<57344}function qNe(e){return e>=55296&&e<56320}function tme(e){return e<65536?1:2}let Vr=class zNe{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]=Nw(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),Th.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]=Nw(this,t,n);let r=[];return this.decompose(t,n,r,0),Th.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 gk(this),s=new gk(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 gk(this,t)}iterRange(t,n=this.length){return new UNe(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 WNe(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]?zNe.empty:t.length<=32?new Xs(t):Th.from(Xs.split(t,[]))}};class Xs extends Vr{constructor(t,n=yjt(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 bjt(i,o,r,a);i=o+1,r++}}decompose(t,n,r,i){let s=t<=0&&n>=this.length?this:new Xs(nme(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let a=r.pop(),o=JQ(s.text,a.text.slice(),0,s.length);if(o.length<=32)r.push(new Xs(o,a.length+s.length));else{let l=o.length>>1;r.push(new Xs(o.slice(0,l)),new Xs(o.slice(l)))}}else r.push(s)}replace(t,n,r){if(!(r instanceof Xs))return super.replace(t,n,r);[t,n]=Nw(this,t,n);let i=JQ(this.text,JQ(r.text,nme(this.text,0,t)),n),s=this.length+r.length-(n-t);return i.length<=32?new Xs(i,s):Th.from(Xs.split(i,[]),s)}sliceString(t,n=this.length,r=`
|
|
1192
1192
|
`){[t,n]=Nw(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 Xs(r,i)),r=[],i=-1);return i>-1&&n.push(new Xs(r,i)),n}}class Th extends Vr{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]=Nw(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 Th(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=`
|
|
1193
1193
|
`){[t,n]=Nw(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 Th))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 O of t)O.flatten(f);return new Xs(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 O;if(f.lines>s&&f instanceof Th)for(let g of f.children)d(g);else f.lines>a&&(l>a||!l)?(h(),o.push(f)):f instanceof Xs&&l&&(O=u[u.length-1])instanceof Xs&&f.lines+O.lines<=32?(l+=f.lines,c+=f.length+1,u[u.length-1]=new Xs(O.text.concat(f.text),O.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]:Th.from(u,c)),c=-1,l=u.length=0)}for(let f of t)d(f);return h(),o.length==1?o[0]:new Th(o,n)}}Vr.empty=new Xs([""],0);function yjt(e){let t=-1;for(let n of e)t+=n.length+1;return t}function JQ(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 nme(e,t,n){return JQ(e,[""],t,n)}class gk{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 Xs?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 Xs?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=`
|
|
1194
1194
|
`,this;t--}else if(i instanceof Xs){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 Xs?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 UNe{constructor(t,n,r){this.value="",this.done=!1,this.cursor=new gk(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 WNe{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"&&(Vr.prototype[Symbol.iterator]=function(){return this.iter()},gk.prototype[Symbol.iterator]=UNe.prototype[Symbol.iterator]=WNe.prototype[Symbol.iterator]=function(){return this});let bjt=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 Nw(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function uo(e,t,n=!0,r=!0){return mjt(e,t,n,r)}function wjt(e){return e>=56320&&e<57344}function xjt(e){return e>=55296&&e<56320}function Cl(e,t){let n=e.charCodeAt(t);if(!xjt(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return wjt(r)?(n-55296<<10)+(r-56320)+65536:n}function gJ(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function _h(e){return e<65536?1:2}const yG=/\r\n?|\n/;var oo=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(oo||(oo={}));class Yh{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){bG(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 Yh(t)}composeDesc(t){return this.empty?t:t.empty?this:GNe(this,t)}mapDesc(t,n=!1){return t.empty?this:wG(this,t,n)}mapPos(t,n=-1,r=oo.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!=oo.Simple&&c>=t&&(r==oo.TrackDel&&i<t&&c>t||r==oo.TrackBefore&&i<t||r==oo.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 Yh(t)}static create(t){return new Yh(t)}}class ma extends Yh{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 bG(this,(n,r,i,s,a)=>t=t.replace(i,i+(r-n),a),!1),t}mapDesc(t,n=!1){return wG(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(Vr.empty);r.push(a?t.slice(s,s+a):Vr.empty)}s+=a}return new ma(n,r)}compose(t){return this.empty?t:t.empty?this:GNe(this,t,!0)}map(t,n=!1){return t.empty?this:wG(this,t,n,!0)}iterChanges(t,n=!1){bG(this,t,n)}get desc(){return Yh.create(this.sections)}filter(t){let n=[],r=[],i=[],s=new N_(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);Po(i,u,-1);let d=s.ins==-1?-1:s.off==0?s.ins:0;Po(n,u,d),d>0&&cg(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);Po(n,u,-1),Po(i,u,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(u),o+=u}}return{changes:new ma(n,r),filtered:Yh.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&&Po(i,n-a,-1);let d=new ma(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 ma){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 O=f?typeof f=="string"?Vr.of(f.split(r||yG)):f:Vr.empty,g=O.length;if(d==h&&g==0)return;d<a&&l(),d>a&&Po(i,d-a,-1),Po(i,h-d,g),cg(s,i,O),a=h}}return c(t),l(!o),o}static empty(t){return new ma(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(Vr.empty);r[i]=Vr.of(s.slice(1)),n.push(s[0],r[i].length)}}}return new ma(n,r)}static createSet(t,n){return new ma(t,n)}}function Po(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 cg(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(Vr.empty);e.push(n)}}function bG(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=Vr.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 wG(e,t,n,r=!1){let i=[],s=r?[]:null,a=new N_(e),o=new N_(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);Po(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(Po(i,o.ins,-1);c;){let u=Math.min(a.len,c);a.ins>=0&&l<a.i&&a.len<=u&&(Po(i,0,a.ins),s&&cg(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;Po(i,c,l<a.i?a.ins:0),s&&l<a.i&&cg(s,i,a.text),l=a.i,a.forward(a.len-u)}else{if(a.done&&o.done)return s?ma.createSet(i,s):Yh.create(i);throw new Error("Mismatched change set lengths")}}}function GNe(e,t,n=!1){let r=[],i=n?[]:null,s=new N_(e),a=new N_(t);for(let o=!1;;){if(s.done&&a.done)return i?ma.createSet(r,i):Yh.create(r);if(s.ins==0)Po(r,s.len,0,o),s.next();else if(a.len==0&&!a.done)Po(r,0,a.ins,o),i&&cg(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;Po(r,l,u,o),i&&u&&cg(i,r,a.text)}else a.ins==-1?(Po(r,s.off?0:s.len,l,o),i&&cg(i,r,s.textBit(l))):(Po(r,s.off?0:s.len,a.off?0:a.ins,o),i&&!a.off&&cg(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 N_{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?Vr.empty:t[n]}textBit(t){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!t?Vr.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 T0{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 T0(r,i,this.flags)}extend(t,n=t){if(t<=this.anchor&&n>=this.anchor)return He.range(t,n);let r=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return He.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 He.range(t.anchor,t.head)}static create(t,n,r){return new T0(t,n,r)}}class He{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:He.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 He([this.main],0)}addRange(t,n=!0){return He.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let r=this.ranges.slice();return r[n]=t,He.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 He(t.ranges.map(n=>T0.fromJSON(n)),t.main)}static single(t,n=t){return new He([He.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 He.normalized(t.slice(),n);r=s.to}return new He(t,n)}static cursor(t,n=0,r,i){return T0.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?T0.create(n,t,48|s):T0.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?He.range(l,o):He.range(o,l))}}return new He(t,n)}}function VNe(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let mJ=0;class Jt{constructor(t,n,r,i,s){this.combine=t,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=mJ++,this.default=t([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(t={}){return new Jt(t.combine||(n=>n),t.compareInput||((n,r)=>n===r),t.compare||(t.combine?(n,r)=>n===r:vJ),!!t.static,t.enables)}of(t){return new eR([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new eR(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new eR(t,this,2,n)}from(t,n){return n||(n=r=>r),this.compute([t],r=>n(r.field(t)))}}function vJ(e,t){return e==t||e.length==t.length&&e.every((n,r)=>n===t[r])}class eR{constructor(t,n,r,i){this.dependencies=t,this.facet=n,this.type=r,this.value=i,this.id=mJ++}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)||xG(d,u)){let f=r(d);if(o?!rme(f,d.values[a],i):!i(f,d.values[a]))return d.values[a]=f,1}return 0},reconfigure:(d,h)=>{let f,O=h.config.address[s];if(O!=null){let g=z4(h,O);if(this.dependencies.every(m=>m instanceof Jt?h.facet(m)===d.facet(m):m instanceof Va?h.field(m,!1)==d.field(m,!1):!0)||(o?rme(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 rme(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 xG(e,t){let n=!1;for(let r of t)mk(e,r)&1&&(n=!0);return n}function Sjt(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=z4(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)mk(l,c);return l.values[a]=o(l),1},update(l,c){if(!xG(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=xG(l,r),d=c.config.facets[t.id],h=c.facet(t);if(d&&!u&&vJ(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 GC=Jt.define({static:!0});class Va{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 Va(mJ++,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(GC).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(GC),a=i.facet(GC),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,GC.of({field:this,create:t})]}get extension(){return this}}const u0={lowest:4,low:3,default:2,high:1,highest:0};function NS(e){return t=>new BNe(t,e)}const cO={highest:NS(u0.highest),high:NS(u0.high),default:NS(u0.default),low:NS(u0.low),lowest:NS(u0.lowest)};class BNe{constructor(t,n){this.inner=t,this.prec=n}}class bN{of(t){return new SG(this,t)}reconfigure(t){return bN.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class SG{constructor(t,n){this.compartment=t,this.inner=n}}class q4{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 $jt(t,n,a))h instanceof Va?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],O=f[0].facet,g=u&&u[h]||[];if(f.every(m=>m.type==0))if(o[O.id]=l.length<<1|1,vJ(g,f))l.push(r.facet(O));else{let m=O.combine(f.map(v=>v.value));l.push(r&&O.compare(m,r.facet(O))?r.facet(O):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[O.id]=c.length<<1,c.push(m=>Sjt(m,O,f))}}let d=c.map(h=>h(o));return new q4(t,a,d,o,l,s)}}function $jt(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 SG&&n.delete(a.compartment)}if(i.set(a,o),Array.isArray(a))for(let c of a)s(c,o);else if(a instanceof SG){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 BNe)s(a.inner,a.prec);else if(a instanceof Va)r[o].push(a),a.provides&&s(a.provides,o);else if(a instanceof eR)r[o].push(a),a.facet.extensions&&s(a.facet.extensions,u0.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,u0.default),r.reduce((a,o)=>a.concat(o))}function mk(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 z4(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const YNe=Jt.define(),$G=Jt.define({combine:e=>e.some(t=>t),static:!0}),ZNe=Jt.define({combine:e=>e.length?e[0]:void 0,static:!0}),HNe=Jt.define(),KNe=Jt.define(),JNe=Jt.define(),eXe=Jt.define({combine:e=>e.length?e[0]:!1});class yf{constructor(t,n){this.type=t,this.value=n}static define(){return new kjt}}class kjt{of(t){return new yf(this,t)}}class Tjt{constructor(t){this.map=t}of(t){return new Yn(this,t)}}class Yn{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 Yn(this.type,n)}is(t){return this.type==t}static define(t={}){return new Tjt(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}}Yn.reconfigure=Yn.define();Yn.appendConfig=Yn.define();class ua{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&&VNe(r,n.newLength),s.some(o=>o.type==ua.time)||(this.annotations=s.concat(ua.time.of(Date.now())))}static create(t,n,r,i,s,a){return new ua(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(ua.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]=="."))}}ua.time=yf.define();ua.userEvent=yf.define();ua.addToHistory=yf.define();ua.remote=yf.define();function _jt(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 tXe(e,t,n){var r;let i,s,a;return n?(i=t.changes,s=ma.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:Yn.mapEffects(e.effects,i).concat(Yn.mapEffects(t.effects,s)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function kG(e,t,n){let r=t.selection,i=f1(t.annotations);return t.userEvent&&(i=i.concat(ua.userEvent.of(t.userEvent))),{changes:t.changes instanceof ma?t.changes:ma.of(t.changes||[],n,e.facet(ZNe)),selection:r&&(r instanceof He?r:He.single(r.anchor,r.head)),effects:f1(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}function nXe(e,t,n){let r=kG(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=tXe(r,kG(e,t[s],a?r.changes.newLength:e.doc.length),a)}let i=ua.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return Cjt(n?Pjt(i):i)}function Pjt(e){let t=e.startState,n=!0;for(let i of t.facet(HNe)){let s=i(e);if(s===!1){n=!1;break}Array.isArray(s)&&(n=n===!0?s:_jt(n,s))}if(n!==!0){let i,s;if(n===!1)s=e.changes.invertedDesc,i=ma.empty(t.doc.length);else{let a=e.changes.filter(n);i=a.changes,s=a.filtered.mapDesc(a.changes).invertedDesc}e=ua.create(t,i,e.selection&&e.selection.map(s),Yn.mapEffects(e.effects,s),e.annotations,e.scrollIntoView)}let r=t.facet(KNe);for(let i=r.length-1;i>=0;i--){let s=r[i](e);s instanceof ua?e=s:Array.isArray(s)&&s.length==1&&s[0]instanceof ua?e=s[0]:e=nXe(t,f1(s),!1)}return e}function Cjt(e){let t=e.startState,n=t.facet(JNe),r=e;for(let i=n.length-1;i>=0;i--){let s=n[i](e);s&&Object.keys(s).length&&(r=tXe(r,kG(t,s,e.changes.newLength),!0))}return r==e?e:ua.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}const Ejt=[];function f1(e){return e==null?Ejt:Array.isArray(e)?e:[e]}var ss=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(ss||(ss={}));const Qjt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let TG;try{TG=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Rjt(e){if(TG)return TG.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||Qjt.test(n)))return!0}return!1}function Ajt(e){return t=>{if(!/\S/.test(t))return ss.Space;if(Rjt(t))return ss.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return ss.Word;return ss.Other}}class _r{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++)mk(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 mk(this,r),z4(this,r)}update(...t){return nXe(this,t,!0)}applyTransaction(t){let n=this.config,{base:r,compartments:i}=n;for(let o of t.effects)o.is(bN.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(Yn.reconfigure)?(n=null,r=o.value):o.is(Yn.appendConfig)&&(n=null,r=f1(r).concat(o.value));let s;n?s=t.startState.values.slice():(n=q4.resolve(r,i,this),s=new _r(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let a=t.startState.facet($G)?t.newSelection:t.newSelection.asSingle();new _r(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:He.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=f1(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=Yn.mapEffects(a,u).concat(Yn.mapEffects(f1(l.effects),d))}return{changes:i,selection:He.create(s,n.mainIndex),effects:a}}changes(t=[]){return t instanceof ma?t:ma.of(t,this.doc.length,this.facet(_r.lineSeparator))}toText(t){return Vr.of(t.split(this.facet(_r.lineSeparator)||yG))}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:(mk(this,n),z4(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 Va&&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 _r.create({doc:t.doc,selection:He.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=q4.resolve(t.extensions||[],new Map),r=t.doc instanceof Vr?t.doc:Vr.of((t.doc||"").split(n.staticFacet(_r.lineSeparator)||yG)),i=t.selection?t.selection instanceof He?t.selection:He.single(t.selection.anchor,t.selection.head):He.single(0);return VNe(i,r.length),n.staticFacet($G)||(i=i.asSingle()),new _r(n,r,i,n.dynamicSlots.map(()=>null),(s,a)=>a.create(s),null)}get tabSize(){return this.facet(_r.tabSize)}get lineBreak(){return this.facet(_r.lineSeparator)||`
|
|
@@ -1200,7 +1200,7 @@ l0,-`+(n+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
|
|
|
1200
1200
|
`))};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=He.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));u.main.eq(i)||t.dispatch({selection:u,userEvent:"select"});return}if((rn.mac||rn.android)&&c.from==a-1&&/^\. ?$/.test(r.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(c={from:o,to:l,insert:Vr.of([r.text.replace("."," ")])}),this.pendingContextChange=c,!t.state.readOnly){let u=this.to-this.from+(c.to-c.from+c.insert.length);_J(t,c,He.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(Kt.mark({attributes:{style:u}}).range(l,c))}}}t.dispatch({effects:NXe.of(Kt.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=F_(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 At{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||zjt(t.parent)||document,this.viewState=new Xme(t.state||_r.create(t)),t.scrollTo&&t.scrollTo.is(ZC)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(jb).map(i=>new M7(i));for(let i of this.plugins)i.update(this);this.observer=new oLt(this),this.inputState=new E9t(this),this.inputState.ensureHandlers(this.plugins),this.docView=new mme(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 ua?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(BXe))?(this.inputState.notifiedFocused=a,o=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,l=YXe(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(_r.phrases)!=this.state.facet(_r.phrases))return this.setState(s);i=G4.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 O1(f.empty?f:He.cursor(f.head,f.head>f.anchor?-1:1))}for(let f of h.effects)f.is(ZC)&&(d=f.value.clip(this.state))}this.viewState.update(i,d),this.bidiCache=B4.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(R$)!=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(nE)!=i.state.facet(nE)&&(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(zG))try{h(i)}catch(f){Xl(this.state,f,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!qXe(this,u)&&c.force&&p1(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 Xme(t),this.plugins=t.facet(jb).map(r=>new M7(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new mme(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(jb),r=t.state.facet(jb);if(n!=r){let i=[];for(let s of r){let a=n.indexOf(s);if(a<0)i.push(new M7(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){Xl(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(cXe(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(O){return Xl(this.state,O),jme}}),d=G4.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]!=jme)try{let O=c[f];O.write&&O.write(u[f],this)}catch(O){Xl(this.state,O)}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 O=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-a;if(O>1||O<-1){i=i+O,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(zG))o(n)}get themeClasses(){return BG+" "+(this.state.facet(VG)?JXe:KXe)+" "+this.state.facet(nE)}updateAttrs(){let t=Lme(this,XXe,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(ap)?"true":"false",class:"cm-content",style:`${rn.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),Lme(this,$J,n);let r=this.observer.ignore(()=>{let i=FG(this.contentDOM,this.contentAttrs,n),s=FG(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(At.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(R$);let t=this.state.facet(At.cspNonce);zg.mount(this.root,this.styleModules.concat(sLt).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 L7(this,t,xme(this,t,n,r))}moveByGroup(t,n){return L7(this,t,xme(this,t,n,r=>w9t(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 He.cursor(s.side(n,i)+t.from,s.forward(!n,i)?1:-1)}moveToLineBoundary(t,n,r=!0){return b9t(this,t,n,r)}moveVertically(t,n,r){return L7(this,t,x9t(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(),LXe(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[dg.find(s,t-i.from,-1,n)];return u2(r,a.dir==Gi.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(RXe)||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>uLt)return $Xe(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||SXe(s.isolates,r=gme(this,t))))return s.order;r||(r=gme(this,t));let i=i9t(t.text,n,r);return this.bidiCache.push(new B4(t.from,t.to,n,r,!0,i)),i}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||rn.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{oXe(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 ZC.of(new O1(typeof t=="number"?He.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 ZC.of(new O1(He.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 vs.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return vs.define(()=>({}),{eventObservers:t})}static theme(t,n){let r=zg.newName(),i=[nE.of(r),R$.of(YG(`.${r}`,t))];return n&&n.dark&&i.push(VG.of(!0)),i}static baseTheme(t){return cO.lowest(R$.of(YG("."+BG,t,e6e)))}static findFromDOM(t){var n;let r=t.querySelector(".cm-content"),i=r&&Ei.get(r)||Ei.get(t);return((n=i?.rootView)===null||n===void 0?void 0:n.view)||null}}At.styleModule=R$;At.inputHandler=EXe;At.clipboardInputFilter=xJ;At.clipboardOutputFilter=SJ;At.scrollHandler=DXe;At.focusChangeEffect=QXe;At.perLineTextDirection=RXe;At.exceptionSink=CXe;At.updateListener=zG;At.editable=ap;At.mouseSelectionStyle=PXe;At.dragMovesSelection=_Xe;At.clickAddsSelectionRange=TXe;At.decorations=M_;At.outerDecorations=IXe;At.atomicRanges=kJ;At.bidiIsolatedRanges=FXe;At.scrollMargins=MXe;At.darkTheme=VG;At.cspNonce=Jt.define({combine:e=>e.length?e[0]:""});At.contentAttributes=$J;At.editorAttributes=XXe;At.lineWrapping=At.contentAttributes.of({class:"cm-lineWrapping"});At.announce=Yn.define();const uLt=4096,jme={};class B4{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:Gi.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 B4(n.mapPos(a.from,1),n.mapPos(a.to,-1),a.dir,a.isolates,!1,a.order))}return r}}function Lme(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&&IG(a,n)}return n}const dLt=rn.mac?"mac":rn.windows?"win":rn.linux?"linux":"key";function hLt(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 rE(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 fLt=cO.default(At.domEventHandlers({keydown(e,t){return n6e(t6e(t.state),e,t,"editor")}})),dy=Jt.define({enables:fLt}),qme=new WeakMap;function t6e(e){let t=e.facet(dy),n=qme.get(t);return n||qme.set(t,n=gLt(t.reduce((r,i)=>r.concat(i),[]))),n}function pLt(e,t,n){return n6e(t6e(e.state),t,e,n)}let HO=null;const OLt=4e3;function gLt(e,t=dLt){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)),O=o.split(/ (?!$)/).map(v=>hLt(v,t));for(let v=1;v<O.length;v++){let y=O.slice(0,v).join(" ");i(y,!0),f[y]||(f[y]={preventDefault:!0,stopPropagation:!1,run:[w=>{let k=HO={view:w,prefix:y,scope:a};return setTimeout(()=>{HO==k&&(HO=null)},OLt),!0}]})}let g=O.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,ZG))}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 ZG=null;function n6e(e,t,n,r){ZG=t;let i=Fjt(t),s=Cl(i,0),a=_h(s)==i.length&&i!=" ",o="",l=!1,c=!1,u=!1;HO&&HO.view==n&&HO.scope==r&&(o=HO.prefix+" ",UXe.indexOf(t.keyCode)<0&&(c=!0,HO=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],O,g;return f&&(h(f[o+rE(i,t,!a)])?l=!0:a&&(t.altKey||t.metaKey||t.ctrlKey)&&!(rn.windows&&t.ctrlKey&&t.altKey)&&(O=Ug[t.keyCode])&&O!=i?(h(f[o+rE(O,t,!0)])||t.shiftKey&&(g=I_[t.keyCode])!=i&&g!=O&&h(f[o+rE(g,t,!1)]))&&(l=!0):a&&t.shiftKey&&h(f[o+rE(i,t,!0)])&&(l=!0),!l&&h(f._any)&&(l=!0)),c&&(l=!0),l&&u&&t.stopPropagation(),ZG=null,l}class f2{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=r6e(t);return[new f2(n,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return mLt(t,n,r)}}function r6e(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==Gi.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function zme(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 mLt(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==Gi.LTR,a=e.contentDOM,o=a.getBoundingClientRect(),l=r6e(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=WG(e,r,1),O=WG(e,i,-1),g=f.type==dl.Text?f:null,m=O.type==dl.Text?O:null;if(g&&(e.lineWrapping||f.widgetLineBreaks)&&(g=zme(e,r,1,g)),m&&(e.lineWrapping||O.widgetLineBreaks)&&(m=zme(e,i,-1,m)),g&&m&&g.from==m.from&&g.to==m.to)return y(w(n.from,n.to,g));{let x=g?w(n.from,null,g):k(f,!1),S=m?w(null,n.to,m):k(O,!0),T=[];return(g||f).to<(m||O).from-(g&&m?1:0)||f.widgetLineBreaks>1&&x.bottom+e.defaultLineHeight/2<S.top?T.push(v(d,x.bottom,h,S.top)):x.bottom<S.top&&e.elementAtHeight((x.bottom+S.top)/2).type==dl.Text&&(x.bottom=S.top=(x.bottom+S.top)/2),y(x).concat(T).concat(y(S))}function v(x,S,T,_){return new f2(t,x-l.left,S-l.top,T-x,_-S)}function y({top:x,bottom:S,horizontal:T}){let _=[];for(let P=0;P<T.length;P+=2)_.push(v(T[P],x,T[P+1],S));return _}function w(x,S,T){let _=1e9,P=-1e9,E=[];function C(F,I,U,q,Z){let W=e.coordsAtPos(F,F==T.to?-2:2),M=e.coordsAtPos(U,U==T.from?2:-2);!W||!M||(_=Math.min(W.top,M.top,_),P=Math.max(W.bottom,M.bottom,P),Z==Gi.LTR?E.push(s&&I?d:W.left,s&&q?h:M.right):E.push(!s&&q?d:M.left,!s&&I?h:W.right))}let Q=x??T.from,D=S??T.to;for(let F of e.visibleRanges)if(F.to>Q&&F.from<D)for(let I=Math.max(F.from,Q),U=Math.min(F.to,D);;){let q=e.state.doc.lineAt(I);for(let Z of e.bidiSpans(q)){let W=Z.from+q.from,M=Z.to+q.from;if(W>=U)break;M>I&&C(Math.max(W,I),x==null&&W<=Q,Math.min(M,U),S==null&&M>=D,Z.dir)}if(I=q.to+1,I>=U)break}return E.length==0&&C(Q,x==null,D,S==null,e.textDirection),{top:_,bottom:P,horizontal:E}}function k(x,S){let T=o.top+(S?x.top:x.bottom);return{top:T,bottom:T,horizontal:[]}}}function vLt(e,t){return e.constructor==t.constructor&&e.eq(t)}class yLt{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(sR)!=t.state.facet(sR)&&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(sR);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)=>!vLt(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 sR=Jt.define();function i6e(e){return[vs.define(t=>new yLt(t,e)),sR.of(e)]}const j_=Jt.define({combine(e){return bf(e,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function bLt(e={}){return[j_.of(e),wLt,xLt,SLt,AXe.of(!0)]}function s6e(e){return e.startState.facet(j_)!=e.state.facet(j_)}const wLt=i6e({above:!0,markers(e){let{state:t}=e,n=t.facet(j_),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:He.cursor(i.head,i.head>i.anchor?-1:1);for(let l of f2.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=s6e(e);return n&&Ume(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){Ume(t.state,e)},class:"cm-cursorLayer"});function Ume(e,t){t.style.animationDuration=e.facet(j_).cursorBlinkRate+"ms"}const xLt=i6e({above:!1,markers(e){return e.state.selection.ranges.map(t=>t.empty?[]:f2.forRange(e,"cm-selectionBackground",t)).reduce((t,n)=>t.concat(n))},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||s6e(e)},class:"cm-selectionLayer"}),SLt=cO.highest(At.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"}}}})),a6e=Yn.define({map(e,t){return e==null?null:t.mapPos(e)}}),N$=Va.define({create(){return null},update(e,t){return e!=null&&(e=t.changes.mapPos(e)),t.effects.reduce((n,r)=>r.is(a6e)?r.value:n,e)}}),$Lt=vs.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(N$);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(N$)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(N$),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(N$)!=e&&this.view.dispatch({effects:a6e.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 kLt(){return[N$,$Lt]}function Wme(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 TLt(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 _Lt{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 Up,r=n.add.bind(n);for(let{from:i,to:s}of TLt(t,this.maxLength))Wme(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,O=(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,O);else Wme(t.state.doc,this.regexp,u,d,(g,m)=>this.addMatch(m,t,g,O));n=n.update({filterFrom:u,filterTo:d,filter:(g,m)=>g<u||m>d,add:h})}}return n}}const HG=/x/.unicode!=null?"gu":"g",PLt=new RegExp(`[\0-\b
|
|
1201
1201
|
--\u2028\u2029\uFEFF-]`,HG),CLt={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 U7=null;function ELt(){var e;if(U7==null&&typeof document<"u"&&document.body){let t=document.body.style;U7=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return U7||!1}const aR=Jt.define({combine(e){let t=bf(e,{render:null,specialChars:PLt,addSpecialChars:null});return(t.replaceTabs=!ELt())&&(t.specialChars=new RegExp(" |"+t.specialChars.source,HG)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,HG)),t}});function QLt(e={}){return[aR.of(e),RLt()]}let Gme=null;function RLt(){return Gme||(Gme=vs.fromClass(class{constructor(e){this.view=e,this.decorations=Kt.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(aR)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new _Lt({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:i}=n.state,s=Cl(t[0],0);if(s==9){let a=i.lineAt(r),o=n.state.tabSize,l=Nd(a.text,o,r-a.from);return Kt.replace({widget:new XLt((o-l%o)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Kt.replace({widget:new NLt(e,s)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(aR);e.startState.facet(aR)!=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 ALt="•";function DLt(e){return e>=32?ALt:e==10?"":String.fromCharCode(9216+e)}class NLt extends zd{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=DLt(this.code),r=t.state.phrase("Control character")+" "+(CLt[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 XLt extends zd{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 ILt(){return MLt}const FLt=Kt.line({class:"cm-activeLine"}),MLt=vs.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(FLt.range(i.from)),t=i.from)}return Kt.set(n)}},{decorations:e=>e.decorations});class jLt extends zd{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?Xw(t.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(t.parentNode),i=u2(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 LLt(e){let t=vs.fromClass(class{constructor(n){this.view=n,this.placeholder=e?Kt.set([Kt.widget({widget:new jLt(e),side:1}).range(0)]):Kt.none}get decorations(){return this.view.state.doc.length?Kt.none:this.placeholder}},{decorations:n=>n.decorations});return typeof e=="string"?[t,At.contentAttributes.of({"aria-placeholder":e})]:t}const KG=2e3;function qLt(e,t,n){let r=Math.min(t.line,n.line),i=Math.max(t.line,n.line),s=[];if(t.off>KG||n.off>KG||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(He.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=EG(c.text,a,e.tabSize,!0);if(u<0)s.push(He.cursor(c.to));else{let d=EG(c.text,o,e.tabSize);s.push(He.range(c.from+u,c.from+d))}}}return s}function zLt(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}function Vme(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>KG?-1:i==r.length?zLt(e,t.clientX):Nd(r.text,e.state.tabSize,n-r.from);return{line:r.number,col:s,off:i}}function ULt(e,t){let n=Vme(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=Vme(e,i);if(!o)return r;let l=qLt(e.state,n,o);return l.length?a?He.create(l.concat(r.ranges)):He.create(l):r}}:null}function WLt(e){let t=n=>n.altKey&&n.button==0;return At.mouseSelectionStyle.of((n,r)=>t(r)?ULt(n,r):null)}const GLt={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},VLt={style:"cursor: crosshair"};function BLt(e={}){let[t,n]=GLt[e.key||"Alt"],r=vs.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,At.contentAttributes.of(i=>{var s;return!((s=i.plugin(r))===null||s===void 0)&&s.isDown?VLt:null})]}const IS="-10000px";class o6e{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 YLt(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const W7=Jt.define({combine:e=>{var t,n,r;return{position:rn.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)||YLt}}}),Bme=new WeakMap,EJ=vs.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(W7);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 o6e(e,QJ,(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(W7);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=IS,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(rn.gecko)n=s.offsetParent!=this.container.ownerDocument.body;else if(s.style.top==IS&&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=TJ(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(W7).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=IS;continue}let f=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,O=f?7:0,g=h.right-h.left,m=(t=Bme.get(c))!==null&&t!==void 0?t:h.bottom-h.top,v=c.offset||HLt,y=this.view.textDirection==Gi.LTR,w=h.width>r.right-r.left?y?r.left:r.right-h.width:y?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),k=this.above[o];!l.strictSide&&(k?d.top-m-O-v.y<r.top:d.bottom+m+O+v.y>r.bottom)&&k==r.bottom-d.bottom>d.top-r.top&&(k=this.above[o]=!k);let x=(k?d.top-r.top:r.bottom-d.bottom)-O;if(x<m&&c.resize!==!1){if(x<this.view.defaultLineHeight){u.style.top=IS;continue}Bme.set(c,m),u.style.height=(m=x)/s+"px"}else u.style.height&&(u.style.height="");let S=k?d.top-m-O-v.y:d.bottom+O+v.y,T=w+g;if(c.overlap!==!0)for(let _ of a)_.left<T&&_.right>w&&_.top<S+m&&_.bottom>S&&(S=k?_.top-m-2-O:_.bottom+O+2);if(this.position=="absolute"?(u.style.top=(S-e.parent.top)/s+"px",Yme(u,(w-e.parent.left)/i)):(u.style.top=S/s+"px",Yme(u,w/i)),f){let _=d.left+(y?v.x:-v.x)-(w+14-7);f.style.left=_/i+"px"}c.overlap!==!0&&a.push({left:w,top:S,right:T,bottom:S+m}),u.classList.toggle("cm-tooltip-above",k),u.classList.toggle("cm-tooltip-below",!k),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=IS}},{eventObservers:{scroll(){this.maybeMeasure()}}});function Yme(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const ZLt=At.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"}}}),HLt={x:0,y:0},QJ=Jt.define({enables:[EJ,ZLt]}),Y4=Jt.define({combine:e=>e.reduce((t,n)=>t.concat(n),[])});class SN{static create(t){return new SN(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new o6e(t,Y4,(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 KLt=QJ.compute([Y4],e=>{let t=e.facet(Y4);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:SN.create,above:t[0].above,arrow:t.some(n=>n.arrow)}});class JLt{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 ug)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==Gi.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=>Xl(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(EJ),n=t?t.manager.tooltips.findIndex(r=>r.create==SN.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&&!eqt(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:!tqt(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 iE=4;function eqt(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-iE&&t.clientX<=r+iE&&t.clientY>=i-iE&&t.clientY<=s+iE}function tqt(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 nqt(e,t={}){let n=Yn.define(),r=Va.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,oo.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(rqt)&&(i=[]);return i},provide:i=>Y4.from(i)});return{active:r,extension:[r,vs.define(i=>new JLt(i,e,r,n,t.hoverTime||300)),KLt]}}function l6e(e,t){let n=e.plugin(EJ);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}const rqt=Yn.define(),Zme=Jt.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 L_(e,t){let n=e.plugin(c6e),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}const c6e=vs.fromClass(class{constructor(e){this.input=e.state.facet(q_),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(e));let t=e.state.facet(Zme);this.top=new sE(e,!0,t.topContainer),this.bottom=new sE(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(Zme);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new sE(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new sE(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(q_);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=>At.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class sE{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=Hme(t);t=t.nextSibling}else this.dom.insertBefore(n.dom,t);for(;t;)t=Hme(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 Hme(e){let t=e.nextSibling;return e.remove(),t}const q_=Jt.define({enables:c6e});class Gp extends Sv{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}Gp.prototype.elementClass="";Gp.prototype.toDOM=void 0;Gp.prototype.mapMode=oo.TrackBefore;Gp.prototype.startSide=Gp.prototype.endSide=-1;Gp.prototype.point=!0;const oR=Jt.define(),iqt=Jt.define(),sqt={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Ir.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},bk=Jt.define();function aqt(e){return[u6e(),bk.of({...sqt,...e})]}const Kme=Jt.define({combine:e=>e.some(t=>t)});function u6e(e){return[oqt]}const oqt=vs.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(bk).map(t=>new e0e(e,t));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!e.state.facet(Kme),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(Kme)!=!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=Ir.iter(this.view.state.facet(oR),this.view.viewport.from),r=[],i=this.gutters.map(s=>new lqt(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==dl.Text&&a){JG(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==dl.Text){JG(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(bk),n=e.state.facet(bk),r=e.docChanged||e.heightChanged||e.viewportChanged||!Ir.eq(e.startState.facet(oR),e.state.facet(oR),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 e0e(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=>At.scrollMargins.of(t=>{let n=t.plugin(e);return!n||n.gutters.length==0||!n.fixed?null:t.textDirection==Gi.LTR?{left:n.dom.offsetWidth*t.scaleX}:{right:n.dom.offsetWidth*t.scaleX}})});function Jme(e){return Array.isArray(e)?e:[e]}function JG(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class lqt{constructor(t,n,r){this.gutter=t,this.height=r,this.i=0,this.cursor=Ir.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 d6e(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=[];JG(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(iqt)){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 e0e{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=Jme(n.markers(t)),n.initialSpacer&&(this.spacer=new d6e(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=Jme(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!Ir.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 d6e{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":""),cqt(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 cqt(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 uqt=Jt.define(),dqt=Jt.define(),Lb=Jt.define({combine(e){return bf(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 G7 extends Gp{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function V7(e,t){return e.state.facet(Lb).formatNumber(t,e.state)}const hqt=bk.compute([Lb],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(uqt)},lineMarker(t,n,r){return r.some(i=>i.toDOM)?null:new G7(V7(t,t.state.doc.lineAt(n.from).number))},widgetMarker:(t,n,r)=>{for(let i of t.state.facet(dqt)){let s=i(t,n,r);if(s)return s}return null},lineMarkerChange:t=>t.startState.facet(Lb)!=t.state.facet(Lb),initialSpacer(t){return new G7(V7(t,t0e(t.state.doc.lines)))},updateSpacer(t,n){let r=V7(n.view,t0e(n.view.state.doc.lines));return r==t.number?t:new G7(r)},domEventHandlers:e.facet(Lb).domEventHandlers}));function fqt(e={}){return[Lb.of(e),u6e(),hqt]}function t0e(e){let t=9;for(;t<e;)t=t*10+9;return t}const pqt=new class extends Gp{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},Oqt=oR.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(pqt.range(i)))}return Ir.of(t)});function gqt(){return Oqt}let mqt=0;class Vt{constructor(t,n,r,i){this.name=t,this.set=n,this.base=r,this.modified=i,this.id=mqt++}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 Vt&&(n=t),n?.base)throw new Error("Can not derive from a modified tag");let i=new Vt(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 Z4(t);return r=>r.modified.indexOf(n)>-1?r:Z4.get(r.base||r,r.modified.concat(n).sort((i,s)=>i.id-s.id))}}let vqt=0;class Z4{constructor(t){this.name=t,this.instances=[],this.id=vqt++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(o=>o.base==t&&yqt(n,o.modified));if(r)return r;let i=[],s=new Vt(t.name,i,t,n);for(let o of n)o.instances.push(s);let a=bqt(n);for(let o of t.set)if(!o.modified.length)for(let l of a)i.push(Z4.get(o,l));return s}}function yqt(e,t){return e.length==t.length&&e.every((n,r)=>n==t[r])}function bqt(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 Yr(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 H4(r,a,l>0?s.slice(0,l):null);t[c]=u.sort(t[c])}}return h6e.add(t)}const h6e=new Wn;let H4=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}};H4.empty=new H4([],2,null);function f6e(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 wqt(e,t){let n=null;for(let r of e){let i=r.style(t);i&&(n=n?n+" "+i:i)}return n}function xqt(e,t,n,r=0,i=e.length){let s=new Sqt(r,Array.isArray(t)?t:[t],n);s.highlightRange(e.cursor(),r,i,"",s.highlighters),s.flush(i)}class Sqt{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=$qt(t)||H4.empty,d=wqt(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(Wn.mounted);if(h&&h.overlay){let f=t.node.enter(h.overlay[0].from+o,1),O=this.highlighters.filter(m=>!m.scope||m.scope(h.tree.type)),g=t.firstChild();for(let m=0,v=o;;m++){let y=m<h.overlay.length?h.overlay[m]:null,w=y?y.from+o:l,k=Math.max(n,v),x=Math.min(r,w);if(k<x&&g)for(;t.from<x&&(this.highlightRange(t,k,x,i,s),this.startSpan(Math.min(x,t.to),c),!(t.to>=w||!t.nextSibling())););if(!y||w>r)break;v=y.to+o,v>n&&(this.highlightRange(f.cursor(),Math.max(n,y.from+o),Math.min(r,v),"",O),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 $qt(e){let t=e.type.prop(h6e);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const zt=Vt.define,aE=zt(),zO=zt(),n0e=zt(zO),r0e=zt(zO),UO=zt(),oE=zt(UO),B7=zt(UO),fh=zt(),qm=zt(fh),sh=zt(),ah=zt(),eV=zt(),FS=zt(eV),lE=zt(),R={comment:aE,lineComment:zt(aE),blockComment:zt(aE),docComment:zt(aE),name:zO,variableName:zt(zO),typeName:n0e,tagName:zt(n0e),propertyName:r0e,attributeName:zt(r0e),className:zt(zO),labelName:zt(zO),namespace:zt(zO),macroName:zt(zO),literal:UO,string:oE,docString:zt(oE),character:zt(oE),attributeValue:zt(oE),number:B7,integer:zt(B7),float:zt(B7),bool:zt(UO),regexp:zt(UO),escape:zt(UO),color:zt(UO),url:zt(UO),keyword:sh,self:zt(sh),null:zt(sh),atom:zt(sh),unit:zt(sh),modifier:zt(sh),operatorKeyword:zt(sh),controlKeyword:zt(sh),definitionKeyword:zt(sh),moduleKeyword:zt(sh),operator:ah,derefOperator:zt(ah),arithmeticOperator:zt(ah),logicOperator:zt(ah),bitwiseOperator:zt(ah),compareOperator:zt(ah),updateOperator:zt(ah),definitionOperator:zt(ah),typeOperator:zt(ah),controlOperator:zt(ah),punctuation:eV,separator:zt(eV),bracket:FS,angleBracket:zt(FS),squareBracket:zt(FS),paren:zt(FS),brace:zt(FS),content:fh,heading:qm,heading1:zt(qm),heading2:zt(qm),heading3:zt(qm),heading4:zt(qm),heading5:zt(qm),heading6:zt(qm),contentSeparator:zt(fh),list:zt(fh),quote:zt(fh),emphasis:zt(fh),strong:zt(fh),link:zt(fh),monospace:zt(fh),strikethrough:zt(fh),inserted:zt(),deleted:zt(),changed:zt(),invalid:zt(),meta:lE,documentMeta:zt(lE),annotation:zt(lE),processingInstruction:zt(lE),definition:Vt.defineModifier("definition"),constant:Vt.defineModifier("constant"),function:Vt.defineModifier("function"),standard:Vt.defineModifier("standard"),local:Vt.defineModifier("local"),special:Vt.defineModifier("special")};for(let e in R){let t=R[e];t instanceof Vt&&(t.name=e)}f6e([{tag:R.link,class:"tok-link"},{tag:R.heading,class:"tok-heading"},{tag:R.emphasis,class:"tok-emphasis"},{tag:R.strong,class:"tok-strong"},{tag:R.keyword,class:"tok-keyword"},{tag:R.atom,class:"tok-atom"},{tag:R.bool,class:"tok-bool"},{tag:R.url,class:"tok-url"},{tag:R.labelName,class:"tok-labelName"},{tag:R.inserted,class:"tok-inserted"},{tag:R.deleted,class:"tok-deleted"},{tag:R.literal,class:"tok-literal"},{tag:R.string,class:"tok-string"},{tag:R.number,class:"tok-number"},{tag:[R.regexp,R.escape,R.special(R.string)],class:"tok-string2"},{tag:R.variableName,class:"tok-variableName"},{tag:R.local(R.variableName),class:"tok-variableName tok-local"},{tag:R.definition(R.variableName),class:"tok-variableName tok-definition"},{tag:R.special(R.variableName),class:"tok-variableName2"},{tag:R.definition(R.propertyName),class:"tok-propertyName tok-definition"},{tag:R.typeName,class:"tok-typeName"},{tag:R.namespace,class:"tok-namespace"},{tag:R.className,class:"tok-className"},{tag:R.macroName,class:"tok-macroName"},{tag:R.propertyName,class:"tok-propertyName"},{tag:R.operator,class:"tok-operator"},{tag:R.comment,class:"tok-comment"},{tag:R.meta,class:"tok-meta"},{tag:R.invalid,class:"tok-invalid"},{tag:R.punctuation,class:"tok-punctuation"}]);var Y7;const hg=new Wn;function $N(e){return Jt.define({combine:e?t=>t.concat(e):void 0})}const RJ=new Wn;class _c{constructor(t,n,r=[],i=""){this.data=t,this.name=i,_r.prototype.hasOwnProperty("tree")||Object.defineProperty(_r.prototype,"tree",{get(){return Lr(this)}}),this.parser=n,this.extension=[Gg.of(this),_r.languageData.of((s,a,o)=>{let l=i0e(s,a,o),c=l.type.prop(hg);if(!c)return[];let u=s.facet(c),d=l.type.prop(RJ);if(d){let h=l.resolve(a-l.from,o);for(let f of d)if(f.test(h,s)){let O=s.facet(f.facet);return f.type=="replace"?O:O.concat(u)}}return u})].concat(r)}isActiveAt(t,n,r=-1){return i0e(t,n,r).type.prop(hg)==this.data}findRegions(t){let n=t.facet(Gg);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(hg)==this.data){r.push({from:a,to:a+s.length});return}let o=s.prop(Wn.mounted);if(o){if(o.tree.prop(hg)==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 $r&&i(c,s.positions[l]+a)}};return i(Lr(t),0),r}get allowsNesting(){return!0}}_c.setState=Yn.define();function i0e(e,t,n){let r=e.facet(Gg),i=Lr(e).topNode;if(!r||r.allowsNesting)for(let s=i;s;s=s.enter(t,n,Pi.ExcludeBuffers))s.type.isTop&&(i=s);return i}class jr extends _c{constructor(t,n,r){super(t,n,[],r),this.parser=n}static define(t){let n=$N(t.languageData);return new jr(n,t.parser.configure({props:[hg.add(r=>r.isTop?n:void 0)]}),t.name)}configure(t,n){return new jr(this.data,this.parser.configure(t),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Lr(e){let t=e.field(_c.state,!1);return t?t.tree:$r.empty}class kqt{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 MS=null;class _v{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 _v(t,n,[],$r.empty,0,r,[],null)}startParse(){return this.parser.startParse(new kqt(this.state.doc),this.fragments)}work(t,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=$r.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(kp.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(kp.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=MS;MS=this;try{return t()}finally{MS=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=s0e(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=kp.applyChanges(r,l),i=$r.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 _v(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=s0e(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 yN{createParse(n,r,i){let s=i[0].from,a=i[i.length-1].to;return{parsedPos:s,advance(){let l=MS;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 $r(ha.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 MS}}function s0e(e,t,n){return kp.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class jw{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 jw(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=_v.create(t.facet(Gg).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new jw(r)}}_c.state=Va.define({create:jw.init,update(e,t){for(let n of t.effects)if(n.is(_c.setState))return n.value;return t.startState.facet(Gg)!=t.state.facet(Gg)?jw.init(t.state):e.apply(t)}});let p6e=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(p6e=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const Z7=typeof navigator<"u"&&(!((Y7=navigator.scheduling)===null||Y7===void 0)&&Y7.isInputPending)?()=>navigator.scheduling.isInputPending():null,Tqt=vs.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(_c.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(_c.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=p6e(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(_c.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,t&&!Z7?Math.max(25,t.timeRemaining()-5):1e9),o=s.context.treeLen<i&&r.doc.length>i+1e3,l=s.context.work(()=>Z7&&Z7()||Date.now()>a,i+(o?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:_c.setState.of(new jw(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=>Xl(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()}}}),Gg=Jt.define({combine(e){return e.length?e[0]:null},enables:e=>[_c.state,Tqt,At.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});class Ar{constructor(t,n=[]){this.language=t,this.support=n,this.extension=[t,n]}}class Ne{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 Ne(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 _qt=Jt.define(),Mx=Jt.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 Pv(e){let t=e.facet(Mx);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function z_(e,t){let n="",r=e.tabSize,i=e.facet(Mx)[0];if(i==" "){for(;t>=r;)n+=" ",t-=r;i=" "}for(let s=0;s<t;s++)n+=i;return n}function AJ(e,t){e instanceof _r&&(e=new kN(e));for(let r of e.state.facet(_qt)){let i=r(e,t);if(i!==void 0)return i}let n=Lr(e.state);return n.length>=t?Pqt(e,n,t):null}class kN{constructor(t,n={}){this.state=t,this.options=n,this.unit=Pv(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 Nd(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 ys=new Wn;function Pqt(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 O6e(r,e,n)}function O6e(e,t,n){for(let r=e;r;r=r.next){let i=Eqt(r.node);if(i)return i(DJ.create(t,n,r))}return 0}function Cqt(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function Eqt(e){let t=e.type.prop(ys);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(Wn.closedBy))){let i=e.lastChild,s=i&&r.indexOf(i.name)>-1;return a=>g6e(a,!0,1,void 0,s&&!Cqt(a)?i.from:void 0)}return e.parent==null?Qqt:null}function Qqt(){return 0}class DJ extends kN{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 DJ(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(Rqt(r,t))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return O6e(this.context.next,this.base,this.pos)}}function Rqt(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function Aqt(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 Cu({closing:e,align:t=!0,units:n=1}){return r=>g6e(r,t,n,e)}function g6e(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?Aqt(e):null;return l?o?e.column(l.from):e.column(l.to):e.baseIndent+(o?0:e.unit*n)}const NJ=e=>e.baseIndent;function Es({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}const Dqt=200;function Nqt(){return _r.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+Dqt)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=AJ(a,u.from);if(d==null)continue;let h=/^\s*/.exec(u.text)[0],f=z_(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 m6e=Jt.define(),ls=new Wn;function qo(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 Xqt(e,t,n){let r=Lr(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(ls);if(l&&(o.to<r.length-50||r.length==e.doc.length||!Iqt(o))){let c=l(o,e);c&&c.from<=n&&c.from>=t&&c.to>n&&(s=c)}}return s}function Iqt(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function K4(e,t,n){for(let r of e.facet(m6e)){let i=r(e,t,n);if(i)return i}return Xqt(e,t,n)}function v6e(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 TN=Yn.define({map:v6e}),p2=Yn.define({map:v6e});function y6e(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 Cv=Va.define({create(){return Kt.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)if(n.is(TN)&&!Fqt(e,n.value.from,n.value.to)){let{preparePlaceholder:r}=t.state.facet(x6e),i=r?Kt.replace({widget:new Wqt(r(t.state,n.value))}):a0e;e=e.update({add:[i.range(n.value.from,n.value.to)]})}else n.is(p2)&&(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=>At.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(a0e.range(r,i))}return Kt.set(t,!0)}});function J4(e,t,n){var r;let i=null;return(r=e.field(Cv,!1))===null||r===void 0||r.between(t,n,(s,a)=>{(!i||i.from>s)&&(i={from:s,to:a})}),i}function Fqt(e,t,n){let r=!1;return e.between(t,t,(i,s)=>{i==t&&s==n&&(r=!0)}),r}function b6e(e,t){return e.field(Cv,!1)?t:t.concat(Yn.appendConfig.of(S6e()))}const Mqt=e=>{for(let t of y6e(e)){let n=K4(e.state,t.from,t.to);if(n)return e.dispatch({effects:b6e(e.state,[TN.of(n),w6e(e,n)])}),!0}return!1},jqt=e=>{if(!e.state.field(Cv,!1))return!1;let t=[];for(let n of y6e(e)){let r=J4(e.state,n.from,n.to);r&&t.push(p2.of(r),w6e(e,r,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function w6e(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return At.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${e.state.phrase("to")} ${i}.`)}const Lqt=e=>{let{state:t}=e,n=[];for(let r=0;r<t.doc.length;){let i=e.lineBlockAt(r),s=K4(t,i.from,i.to);s&&n.push(TN.of(s)),r=(s?e.lineBlockAt(s.to):i).to+1}return n.length&&e.dispatch({effects:b6e(e.state,n)}),!!n.length},qqt=e=>{let t=e.state.field(Cv,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(r,i)=>{n.push(p2.of({from:r,to:i}))}),e.dispatch({effects:n}),!0},zqt=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Mqt},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:jqt},{key:"Ctrl-Alt-[",run:Lqt},{key:"Ctrl-Alt-]",run:qqt}],Uqt={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},x6e=Jt.define({combine(e){return bf(e,Uqt)}});function S6e(e){return[Cv,Bqt]}function $6e(e,t){let{state:n}=e,r=n.facet(x6e),i=a=>{let o=e.lineBlockAt(e.posAtDOM(a.target)),l=J4(e.state,o.from,o.to);l&&e.dispatch({effects:p2.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 a0e=Kt.replace({widget:new class extends zd{toDOM(e){return $6e(e,null)}}});class Wqt extends zd{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return $6e(t,this.value)}}const Gqt={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class H7 extends Gp{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 Vqt(e={}){let t={...Gqt,...e},n=new H7(t,!0),r=new H7(t,!1),i=vs.fromClass(class{constructor(a){this.from=a.viewport.from,this.markers=this.buildMarkers(a)}update(a){(a.docChanged||a.viewportChanged||a.startState.facet(Gg)!=a.state.facet(Gg)||a.startState.field(Cv,!1)!=a.state.field(Cv,!1)||Lr(a.startState)!=Lr(a.state)||t.foldingChanged(a))&&(this.markers=this.buildMarkers(a.view))}buildMarkers(a){let o=new Up;for(let l of a.viewportLineBlocks){let c=J4(a.state,l.from,l.to)?r:K4(a.state,l.from,l.to)?n:null;c&&o.add(l.from,l.from,c)}return o.finish()}}),{domEventHandlers:s}=t;return[i,aqt({class:"cm-foldGutter",markers(a){var o;return((o=a.plugin(i))===null||o===void 0?void 0:o.markers)||Ir.empty},initialSpacer(){return new H7(t,!1)},domEventHandlers:{...s,click:(a,o,l)=>{if(s.click&&s.click(a,o,l))return!0;let c=J4(a.state,o.from,o.to);if(c)return a.dispatch({effects:p2.of(c)}),!0;let u=K4(a.state,o.from,o.to);return u?(a.dispatch({effects:TN.of(u)}),!0):!1}}}),S6e()]}const Bqt=At.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 jx{constructor(t,n){this.specs=t;let r;function i(o){let l=zg.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 _c?o=>o.prop(hg)==a.data:a?o=>o==a:void 0,this.style=f6e(t.map(o=>({tag:o.tag,class:o.class||i(Object.assign({},o,{tag:null}))})),{all:s}).style,this.module=r?new zg(r):null,this.themeType=n.themeType}static define(t,n){return new jx(t,n||{})}}const tV=Jt.define(),k6e=Jt.define({combine(e){return e.length?[e[0]]:null}});function K7(e){let t=e.facet(tV);return t.length?t:e.facet(k6e)}function eA(e,t){let n=[Zqt],r;return e instanceof jx&&(e.module&&n.push(At.styleModule.of(e.module)),r=e.themeType),t?.fallback?n.push(k6e.of(e)):r?n.push(tV.computeN([At.darkTheme],i=>i.facet(At.darkTheme)==(r=="dark")?[e]:[])):n.push(tV.of(e)),n}class Yqt{constructor(t){this.markCache=Object.create(null),this.tree=Lr(t.state),this.decorations=this.buildDeco(t,K7(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=Lr(t.state),r=K7(t.state),i=r!=K7(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 Kt.none;let r=new Up;for(let{from:i,to:s}of t.visibleRanges)xqt(this.tree,n,(a,o,l)=>{r.add(a,o,this.markCache[l]||(this.markCache[l]=Kt.mark({class:l})))},i,s);return r.finish()}}const Zqt=cO.high(vs.fromClass(Yqt,{decorations:e=>e.decorations})),Hqt=jx.define([{tag:R.meta,color:"#404740"},{tag:R.link,textDecoration:"underline"},{tag:R.heading,textDecoration:"underline",fontWeight:"bold"},{tag:R.emphasis,fontStyle:"italic"},{tag:R.strong,fontWeight:"bold"},{tag:R.strikethrough,textDecoration:"line-through"},{tag:R.keyword,color:"#708"},{tag:[R.atom,R.bool,R.url,R.contentSeparator,R.labelName],color:"#219"},{tag:[R.literal,R.inserted],color:"#164"},{tag:[R.string,R.deleted],color:"#a11"},{tag:[R.regexp,R.escape,R.special(R.string)],color:"#e40"},{tag:R.definition(R.variableName),color:"#00f"},{tag:R.local(R.variableName),color:"#30a"},{tag:[R.typeName,R.namespace],color:"#085"},{tag:R.className,color:"#167"},{tag:[R.special(R.variableName),R.macroName],color:"#256"},{tag:R.definition(R.propertyName),color:"#00c"},{tag:R.comment,color:"#940"},{tag:R.invalid,color:"#f00"}]),Kqt=At.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),T6e=1e4,_6e="()[]{}",P6e=Jt.define({combine(e){return bf(e,{afterCursor:!0,brackets:_6e,maxScanDistance:T6e,renderMatch:tzt})}}),Jqt=Kt.mark({class:"cm-matchingBracket"}),ezt=Kt.mark({class:"cm-nonmatchingBracket"});function tzt(e){let t=[],n=e.matched?Jqt:ezt;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 nzt=Va.define({create(){return Kt.none},update(e,t){if(!t.docChanged&&!t.selection)return e;let n=[],r=t.state.facet(P6e);for(let i of t.state.selection.ranges){if(!i.empty)continue;let s=Ih(t.state,i.head,-1,r)||i.head>0&&Ih(t.state,i.head-1,1,r)||r.afterCursor&&(Ih(t.state,i.head,1,r)||i.head<t.state.doc.length&&Ih(t.state,i.head+1,-1,r));s&&(n=n.concat(r.renderMatch(s,t.state)))}return Kt.set(n,!0)},provide:e=>At.decorations.from(e)}),rzt=[nzt,Kqt];function izt(e={}){return[P6e.of(e),rzt]}const XJ=new Wn;function nV(e,t,n){let r=e.prop(t<0?Wn.openedBy:Wn.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 rV(e){let t=e.type.prop(XJ);return t?t(e.node):e}function Ih(e,t,n,r={}){let i=r.maxScanDistance||T6e,s=r.brackets||_6e,a=Lr(e),o=a.resolveInner(t,n);for(let l=o;l;l=l.parent){let c=nV(l.type,n,s);if(c&&l.from<l.to){let u=rV(l);if(u&&(n>0?t>=u.from&&t<u.to:t>u.from&&t<=u.to))return szt(e,t,n,l,u,c,s)}}return azt(e,t,n,a,o.type,i,s)}function szt(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=rV(u);return{start:l,end:d?{from:d.from,to:d.to}:void 0,matched:!0}}else if(nV(u.type,n,a))c++;else if(nV(u.type,-n,a)){if(c==0){let d=rV(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 azt(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 O=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(O+g,1).type!=i))if(v%2==0==n>0)d++;else{if(d==1)return{start:c,end:{from:O+g,to:O+g+1},matched:v>>1==l>>1};d--}}n>0&&(h+=f.length)}return u.done?{start:c,matched:!1}:null}function o0e(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 C6e{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=o0e(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:o0e(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 ozt(e){return{name:e.name||"",token:e.token,blankLine:e.blankLine||(()=>{}),startState:e.startState||(()=>!0),copyState:e.copyState||lzt,indent:e.indent||(()=>null),languageData:e.languageData||{},tokenTable:e.tokenTable||FJ,mergeTokens:e.mergeTokens!==!1}}function lzt(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 l0e=new WeakMap;class ft extends _c{constructor(t){let n=$N(t.languageData),r=ozt(t),i,s=new class extends yN{createParse(a,o,l){return new uzt(i,a,o,l)}};super(n,s,[],t.name),this.topNode=fzt(n,this),i=this,this.streamParser=r,this.stateAfter=new Wn({perNode:!0}),this.tokenTable=t.tokenTable?new A6e(r.tokenTable):hzt}static define(t){return new ft(t)}getIndent(t){let n,{overrideIndentation:r}=t.options;r&&(n=l0e.get(t.state),n!=null&&n<t.pos-1e4&&(n=void 0));let i=IJ(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 C6e(l.text,t.state.tabSize,t.unit,u<0?void 0:u);for(;d.pos<c-l.from;)Q6e(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&&l0e.set(t.state,o.from),this.streamParser.indent(a,/^\s*(.*)/.exec(o.text)[1],t)}get allowsNesting(){return!1}}function IJ(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 $r&&l<i&&IJ(e,o,l,r,i);if(c)return c}return null}function E6e(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 $r){if(!(l=E6e(e,o,n-a,r-a,i)))break;return i?new $r(t.type,t.children.slice(0,s).concat(l),t.positions.slice(0,s+1),a+l.length):l}}return null}function czt(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&&IJ(e,s.tree,0-s.offset,n,o),c;if(l&&l.pos<=r&&(c=E6e(e,s.tree,n+s.offset,l.pos+s.offset,!1)))return{state:l.state,tree:c}}return{state:e.streamParser.startState(i?Pv(i):4),tree:$r.empty}}let uzt=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=_v.get(),a=i[0].from,{state:o,tree:l}=czt(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(Pv(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let t=_v.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==`
|
|
1202
1202
|
`&&(n="");else{let r=n.indexOf(`
|
|
1203
|
-
`);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 C6e(n,t?t.state.tabSize:4,t?Pv(t.state):2);if(a.eol())s.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let o=Q6e(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=$r.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:dzt,topID:0,maxBufferLength:2048,reused:this.chunkReused});t=new $r(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 $r(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function Q6e(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 FJ=Object.create(null),U_=[ha.none],dzt=new Fx(U_),c0e=[],u0e=Object.create(null),R6e=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"]])R6e[e]=D6e(FJ,t);class A6e{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),R6e)}resolve(t){return t?this.table[t]||(this.table[t]=D6e(this.extra,t)):0}}const hzt=new A6e(FJ);function J7(e,t){c0e.indexOf(e)>-1||(c0e.push(e),console.warn(t))}function D6e(e,t){let n=[];for(let o of t.split(" ")){let l=[];for(let c of o.split(".")){let u=e[c]||R[c];u?typeof u=="function"?l.length?l=l.map(u):J7(c,`Modifier ${c} used at start of tag`):l.length?J7(c,`Tag ${c} used as modifier`):l=Array.isArray(u)?u:[u]:J7(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=u0e[i];if(s)return s.id;let a=u0e[i]=ha.define({id:U_.length,name:r,props:[Yr({[r]:n})]});return U_.push(a),a.id}function fzt(e,t){let n=ha.define({id:U_.length,name:"Document",props:[hg.add(()=>e),ys.add(()=>r=>t.getIndent(r))],top:!0});return U_.push(n),n}Gi.RTL,Gi.LTR;function st(e){return new Ar(ft.define(e))}function CO(e){return je(()=>Promise.resolve().then(()=>MKt),void 0,import.meta.url).then(t=>t.sql({dialect:t[e]}))}const pzt=[Ne.of({name:"C",extensions:["c","h","ino"],load(){return je(()=>Promise.resolve().then(()=>tye),void 0,import.meta.url).then(e=>e.cpp())}}),Ne.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return je(()=>Promise.resolve().then(()=>tye),void 0,import.meta.url).then(e=>e.cpp())}}),Ne.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return CO("Cassandra")}}),Ne.of({name:"CSS",extensions:["css"],load(){return je(()=>Promise.resolve().then(()=>eGt),void 0,import.meta.url).then(e=>e.css())}}),Ne.of({name:"Go",extensions:["go"],load(){return je(()=>import("./index-CTTuGe3U.js"),__vite__mapDeps([4,1,2]),import.meta.url).then(e=>e.go())}}),Ne.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return je(()=>Promise.resolve().then(()=>WGt),void 0,import.meta.url).then(e=>e.html())}}),Ne.of({name:"Java",extensions:["java"],load(){return je(()=>Promise.resolve().then(()=>zKt),void 0,import.meta.url).then(e=>e.java())}}),Ne.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return je(()=>Promise.resolve().then(()=>hE),void 0,import.meta.url).then(e=>e.javascript())}}),Ne.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return je(()=>Promise.resolve().then(()=>ZVt),void 0,import.meta.url).then(e=>e.json())}}),Ne.of({name:"JSX",extensions:["jsx"],load(){return je(()=>Promise.resolve().then(()=>hE),void 0,import.meta.url).then(e=>e.javascript({jsx:!0}))}}),Ne.of({name:"LESS",extensions:["less"],load(){return je(()=>Promise.resolve().then(()=>hVt),void 0,import.meta.url).then(e=>e.less())}}),Ne.of({name:"Liquid",extensions:["liquid"],load(){return je(()=>Promise.resolve().then(()=>Ptn),void 0,import.meta.url).then(e=>e.liquid())}}),Ne.of({name:"MariaDB SQL",load(){return CO("MariaSQL")}}),Ne.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return je(()=>Promise.resolve().then(()=>tVt),void 0,import.meta.url).then(e=>e.markdown())}}),Ne.of({name:"MS SQL",load(){return CO("MSSQL")}}),Ne.of({name:"MySQL",load(){return CO("MySQL")}}),Ne.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return je(()=>Promise.resolve().then(()=>stn),void 0,import.meta.url).then(e=>e.php())}}),Ne.of({name:"PLSQL",extensions:["pls"],load(){return CO("PLSQL")}}),Ne.of({name:"PostgreSQL",load(){return CO("PostgreSQL")}}),Ne.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return je(()=>Promise.resolve().then(()=>PHt),void 0,import.meta.url).then(e=>e.python())}}),Ne.of({name:"Rust",extensions:["rs"],load(){return je(()=>Promise.resolve().then(()=>cJt),void 0,import.meta.url).then(e=>e.rust())}}),Ne.of({name:"Sass",extensions:["sass"],load(){return je(()=>Promise.resolve().then(()=>gve),void 0,import.meta.url).then(e=>e.sass({indented:!0}))}}),Ne.of({name:"SCSS",extensions:["scss"],load(){return je(()=>Promise.resolve().then(()=>gve),void 0,import.meta.url).then(e=>e.sass())}}),Ne.of({name:"SQL",extensions:["sql"],load(){return CO("StandardSQL")}}),Ne.of({name:"SQLite",load(){return CO("SQLite")}}),Ne.of({name:"TSX",extensions:["tsx"],load(){return je(()=>Promise.resolve().then(()=>hE),void 0,import.meta.url).then(e=>e.javascript({jsx:!0,typescript:!0}))}}),Ne.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return je(()=>Promise.resolve().then(()=>hE),void 0,import.meta.url).then(e=>e.javascript({typescript:!0}))}}),Ne.of({name:"WebAssembly",extensions:["wat","wast"],load(){return je(()=>Promise.resolve().then(()=>Qtn),void 0,import.meta.url).then(e=>e.wast())}}),Ne.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return je(()=>Promise.resolve().then(()=>ZHt),void 0,import.meta.url).then(e=>e.xml())}}),Ne.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return je(()=>import("./index-0fhFwnUv.js"),__vite__mapDeps([5,1,2]),import.meta.url).then(e=>e.yaml())}}),Ne.of({name:"APL",extensions:["dyalog","apl"],load(){return je(()=>Promise.resolve().then(()=>ain),void 0,import.meta.url).then(e=>st(e.apl))}}),Ne.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return je(()=>Promise.resolve().then(()=>oin),void 0,import.meta.url).then(e=>st(e.asciiArmor))}}),Ne.of({name:"ASN.1",extensions:["asn","asn1"],load(){return je(()=>import("./asn1-EdZsLKOL.js"),[],import.meta.url).then(e=>st(e.asn1({})))}}),Ne.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return je(()=>Promise.resolve().then(()=>hin),void 0,import.meta.url).then(e=>st(e.asterisk))}}),Ne.of({name:"Brainfuck",extensions:["b","bf"],load(){return je(()=>Promise.resolve().then(()=>pin),void 0,import.meta.url).then(e=>st(e.brainfuck))}}),Ne.of({name:"Cobol",extensions:["cob","cpy"],load(){return je(()=>Promise.resolve().then(()=>qin),void 0,import.meta.url).then(e=>st(e.cobol))}}),Ne.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return je(()=>Promise.resolve().then(()=>Gm),void 0,import.meta.url).then(e=>st(e.csharp))}}),Ne.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return je(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>st(e.clojure))}}),Ne.of({name:"ClojureScript",extensions:["cljs"],load(){return je(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>st(e.clojure))}}),Ne.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return je(()=>import("./css-BnMrqG3P.js"),[],import.meta.url).then(e=>st(e.gss))}}),Ne.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return je(()=>Promise.resolve().then(()=>Ain),void 0,import.meta.url).then(e=>st(e.cmake))}}),Ne.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return je(()=>Promise.resolve().then(()=>tsn),void 0,import.meta.url).then(e=>st(e.coffeeScript))}}),Ne.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return je(()=>Promise.resolve().then(()=>osn),void 0,import.meta.url).then(e=>st(e.commonLisp))}}),Ne.of({name:"Cypher",extensions:["cyp","cypher"],load(){return je(()=>Promise.resolve().then(()=>ksn),void 0,import.meta.url).then(e=>st(e.cypher))}}),Ne.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return je(()=>import("./python-BuPzkPfP.js"),[],import.meta.url).then(e=>st(e.cython))}}),Ne.of({name:"Crystal",extensions:["cr"],load(){return je(()=>Promise.resolve().then(()=>ysn),void 0,import.meta.url).then(e=>st(e.crystal))}}),Ne.of({name:"D",extensions:["d"],load(){return je(()=>Promise.resolve().then(()=>Rsn),void 0,import.meta.url).then(e=>st(e.d))}}),Ne.of({name:"Dart",extensions:["dart"],load(){return je(()=>Promise.resolve().then(()=>Gm),void 0,import.meta.url).then(e=>st(e.dart))}}),Ne.of({name:"diff",extensions:["diff","patch"],load(){return je(()=>Promise.resolve().then(()=>Asn),void 0,import.meta.url).then(e=>st(e.diff))}}),Ne.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return je(()=>Promise.resolve().then(()=>Gsn),void 0,import.meta.url).then(e=>st(e.dockerFile))}}),Ne.of({name:"DTD",extensions:["dtd"],load(){return je(()=>Promise.resolve().then(()=>Ysn),void 0,import.meta.url).then(e=>st(e.dtd))}}),Ne.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return je(()=>Promise.resolve().then(()=>ean),void 0,import.meta.url).then(e=>st(e.dylan))}}),Ne.of({name:"EBNF",load(){return je(()=>Promise.resolve().then(()=>tan),void 0,import.meta.url).then(e=>st(e.ebnf))}}),Ne.of({name:"ECL",extensions:["ecl"],load(){return je(()=>Promise.resolve().then(()=>can),void 0,import.meta.url).then(e=>st(e.ecl))}}),Ne.of({name:"edn",extensions:["edn"],load(){return je(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>st(e.clojure))}}),Ne.of({name:"Eiffel",extensions:["e"],load(){return je(()=>Promise.resolve().then(()=>Oan),void 0,import.meta.url).then(e=>st(e.eiffel))}}),Ne.of({name:"Elm",extensions:["elm"],load(){return je(()=>Promise.resolve().then(()=>Tan),void 0,import.meta.url).then(e=>st(e.elm))}}),Ne.of({name:"Erlang",extensions:["erl"],load(){return je(()=>Promise.resolve().then(()=>Zan),void 0,import.meta.url).then(e=>st(e.erlang))}}),Ne.of({name:"Esper",load(){return je(()=>import("./sql-D0XecflT.js"),[],import.meta.url).then(e=>st(e.esper))}}),Ne.of({name:"Factor",extensions:["factor"],load(){return je(()=>Promise.resolve().then(()=>Han),void 0,import.meta.url).then(e=>st(e.factor))}}),Ne.of({name:"FCL",load(){return je(()=>Promise.resolve().then(()=>non),void 0,import.meta.url).then(e=>st(e.fcl))}}),Ne.of({name:"Forth",extensions:["forth","fth","4th"],load(){return je(()=>Promise.resolve().then(()=>son),void 0,import.meta.url).then(e=>st(e.forth))}}),Ne.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return je(()=>Promise.resolve().then(()=>hon),void 0,import.meta.url).then(e=>st(e.fortran))}}),Ne.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return je(()=>import("./mllike-CXdrOF99.js"),[],import.meta.url).then(e=>st(e.fSharp))}}),Ne.of({name:"Gas",extensions:["s"],load(){return je(()=>Promise.resolve().then(()=>pon),void 0,import.meta.url).then(e=>st(e.gas))}}),Ne.of({name:"Gherkin",extensions:["feature"],load(){return je(()=>Promise.resolve().then(()=>Oon),void 0,import.meta.url).then(e=>st(e.gherkin))}}),Ne.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return je(()=>Promise.resolve().then(()=>Ton),void 0,import.meta.url).then(e=>st(e.groovy))}}),Ne.of({name:"Haskell",extensions:["hs"],load(){return je(()=>Promise.resolve().then(()=>Aon),void 0,import.meta.url).then(e=>st(e.haskell))}}),Ne.of({name:"Haxe",extensions:["hx"],load(){return je(()=>Promise.resolve().then(()=>$be),void 0,import.meta.url).then(e=>st(e.haxe))}}),Ne.of({name:"HXML",extensions:["hxml"],load(){return je(()=>Promise.resolve().then(()=>$be),void 0,import.meta.url).then(e=>st(e.hxml))}}),Ne.of({name:"HTTP",load(){return je(()=>Promise.resolve().then(()=>nln),void 0,import.meta.url).then(e=>st(e.http))}}),Ne.of({name:"IDL",extensions:["pro"],load(){return je(()=>Promise.resolve().then(()=>cln),void 0,import.meta.url).then(e=>st(e.idl))}}),Ne.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return je(()=>import("./javascript-qCveANmP.js"),[],import.meta.url).then(e=>st(e.jsonld))}}),Ne.of({name:"Jinja2",extensions:["j2","jinja","jinja2"],load(){return je(()=>Promise.resolve().then(()=>fln),void 0,import.meta.url).then(e=>st(e.jinja2))}}),Ne.of({name:"Julia",extensions:["jl"],load(){return je(()=>Promise.resolve().then(()=>Fln),void 0,import.meta.url).then(e=>st(e.julia))}}),Ne.of({name:"Kotlin",extensions:["kt","kts"],load(){return je(()=>Promise.resolve().then(()=>Gm),void 0,import.meta.url).then(e=>st(e.kotlin))}}),Ne.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return je(()=>Promise.resolve().then(()=>qln),void 0,import.meta.url).then(e=>st(e.liveScript))}}),Ne.of({name:"Lua",extensions:["lua"],load(){return je(()=>Promise.resolve().then(()=>Zln),void 0,import.meta.url).then(e=>st(e.lua))}}),Ne.of({name:"mIRC",extensions:["mrc"],load(){return je(()=>Promise.resolve().then(()=>ycn),void 0,import.meta.url).then(e=>st(e.mirc))}}),Ne.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return je(()=>Promise.resolve().then(()=>icn),void 0,import.meta.url).then(e=>st(e.mathematica))}}),Ne.of({name:"Modelica",extensions:["mo"],load(){return je(()=>Promise.resolve().then(()=>Ccn),void 0,import.meta.url).then(e=>st(e.modelica))}}),Ne.of({name:"MUMPS",extensions:["mps"],load(){return je(()=>Promise.resolve().then(()=>Wcn),void 0,import.meta.url).then(e=>st(e.mumps))}}),Ne.of({name:"Mbox",extensions:["mbox"],load(){return je(()=>Promise.resolve().then(()=>gcn),void 0,import.meta.url).then(e=>st(e.mbox))}}),Ne.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return je(()=>Promise.resolve().then(()=>Zcn),void 0,import.meta.url).then(e=>st(e.nginx))}}),Ne.of({name:"NSIS",extensions:["nsh","nsi"],load(){return je(()=>Promise.resolve().then(()=>Hcn),void 0,import.meta.url).then(e=>st(e.nsis))}}),Ne.of({name:"NTriples",extensions:["nt","nq"],load(){return je(()=>Promise.resolve().then(()=>Kcn),void 0,import.meta.url).then(e=>st(e.ntriples))}}),Ne.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return je(()=>Promise.resolve().then(()=>Gm),void 0,import.meta.url).then(e=>st(e.objectiveC))}}),Ne.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return je(()=>Promise.resolve().then(()=>Gm),void 0,import.meta.url).then(e=>st(e.objectiveCpp))}}),Ne.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return je(()=>import("./mllike-CXdrOF99.js"),[],import.meta.url).then(e=>st(e.oCaml))}}),Ne.of({name:"Octave",extensions:["m"],load(){return je(()=>Promise.resolve().then(()=>cun),void 0,import.meta.url).then(e=>st(e.octave))}}),Ne.of({name:"Oz",extensions:["oz"],load(){return je(()=>Promise.resolve().then(()=>wun),void 0,import.meta.url).then(e=>st(e.oz))}}),Ne.of({name:"Pascal",extensions:["p","pas"],load(){return je(()=>Promise.resolve().then(()=>_un),void 0,import.meta.url).then(e=>st(e.pascal))}}),Ne.of({name:"Perl",extensions:["pl","pm"],load(){return je(()=>Promise.resolve().then(()=>Pun),void 0,import.meta.url).then(e=>st(e.perl))}}),Ne.of({name:"Pig",extensions:["pig"],load(){return je(()=>Promise.resolve().then(()=>Qun),void 0,import.meta.url).then(e=>st(e.pig))}}),Ne.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return je(()=>Promise.resolve().then(()=>Vun),void 0,import.meta.url).then(e=>st(e.powerShell))}}),Ne.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return je(()=>Promise.resolve().then(()=>Bun),void 0,import.meta.url).then(e=>st(e.properties))}}),Ne.of({name:"ProtoBuf",extensions:["proto"],load(){return je(()=>Promise.resolve().then(()=>Jun),void 0,import.meta.url).then(e=>st(e.protobuf))}}),Ne.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return je(()=>import("./pug-DukmZTjD.js"),__vite__mapDeps([6,7]),import.meta.url).then(e=>st(e.pug))}}),Ne.of({name:"Puppet",extensions:["pp"],load(){return je(()=>Promise.resolve().then(()=>ndn),void 0,import.meta.url).then(e=>st(e.puppet))}}),Ne.of({name:"Q",extensions:["q"],load(){return je(()=>Promise.resolve().then(()=>udn),void 0,import.meta.url).then(e=>st(e.q))}}),Ne.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return je(()=>Promise.resolve().then(()=>mdn),void 0,import.meta.url).then(e=>st(e.r))}}),Ne.of({name:"RPM Changes",load(){return je(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>st(e.rpmChanges))}}),Ne.of({name:"RPM Spec",extensions:["spec"],load(){return je(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>st(e.rpmSpec))}}),Ne.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return je(()=>Promise.resolve().then(()=>Tdn),void 0,import.meta.url).then(e=>st(e.ruby))}}),Ne.of({name:"SAS",extensions:["sas"],load(){return je(()=>Promise.resolve().then(()=>Edn),void 0,import.meta.url).then(e=>st(e.sas))}}),Ne.of({name:"Scala",extensions:["scala"],load(){return je(()=>Promise.resolve().then(()=>Gm),void 0,import.meta.url).then(e=>st(e.scala))}}),Ne.of({name:"Scheme",extensions:["scm","ss"],load(){return je(()=>Promise.resolve().then(()=>zdn),void 0,import.meta.url).then(e=>st(e.scheme))}}),Ne.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return je(()=>Promise.resolve().then(()=>Vdn),void 0,import.meta.url).then(e=>st(e.shell))}}),Ne.of({name:"Sieve",extensions:["siv","sieve"],load(){return je(()=>Promise.resolve().then(()=>Kdn),void 0,import.meta.url).then(e=>st(e.sieve))}}),Ne.of({name:"Smalltalk",extensions:["st"],load(){return je(()=>Promise.resolve().then(()=>thn),void 0,import.meta.url).then(e=>st(e.smalltalk))}}),Ne.of({name:"Solr",load(){return je(()=>Promise.resolve().then(()=>lhn),void 0,import.meta.url).then(e=>st(e.solr))}}),Ne.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return je(()=>import("./mllike-CXdrOF99.js"),[],import.meta.url).then(e=>st(e.sml))}}),Ne.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return je(()=>Promise.resolve().then(()=>Ohn),void 0,import.meta.url).then(e=>st(e.sparql))}}),Ne.of({name:"Spreadsheet",alias:["excel","formula"],load(){return je(()=>Promise.resolve().then(()=>ghn),void 0,import.meta.url).then(e=>st(e.spreadsheet))}}),Ne.of({name:"Squirrel",extensions:["nut"],load(){return je(()=>Promise.resolve().then(()=>Gm),void 0,import.meta.url).then(e=>st(e.squirrel))}}),Ne.of({name:"Stylus",extensions:["styl"],load(){return je(()=>Promise.resolve().then(()=>Fhn),void 0,import.meta.url).then(e=>st(e.stylus))}}),Ne.of({name:"Swift",extensions:["swift"],load(){return je(()=>Promise.resolve().then(()=>ifn),void 0,import.meta.url).then(e=>st(e.swift))}}),Ne.of({name:"sTeX",load(){return je(()=>Promise.resolve().then(()=>O1e),void 0,import.meta.url).then(e=>st(e.stex))}}),Ne.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return je(()=>Promise.resolve().then(()=>O1e),void 0,import.meta.url).then(e=>st(e.stex))}}),Ne.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return je(()=>Promise.resolve().then(()=>N1e),void 0,import.meta.url).then(e=>st(e.verilog))}}),Ne.of({name:"Tcl",extensions:["tcl"],load(){return je(()=>Promise.resolve().then(()=>lfn),void 0,import.meta.url).then(e=>st(e.tcl))}}),Ne.of({name:"Textile",extensions:["textile"],load(){return je(()=>Promise.resolve().then(()=>hfn),void 0,import.meta.url).then(e=>st(e.textile))}}),Ne.of({name:"TiddlyWiki",load(){return je(()=>Promise.resolve().then(()=>Afn),void 0,import.meta.url).then(e=>st(e.tiddlyWiki))}}),Ne.of({name:"Tiki wiki",load(){return je(()=>Promise.resolve().then(()=>jfn),void 0,import.meta.url).then(e=>st(e.tiki))}}),Ne.of({name:"TOML",extensions:["toml"],load(){return je(()=>Promise.resolve().then(()=>Lfn),void 0,import.meta.url).then(e=>st(e.toml))}}),Ne.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return je(()=>Promise.resolve().then(()=>Ufn),void 0,import.meta.url).then(e=>st(e.troff))}}),Ne.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return je(()=>Promise.resolve().then(()=>lpn),void 0,import.meta.url).then(e=>st(e.ttcn))}}),Ne.of({name:"TTCN_CFG",extensions:["cfg"],load(){return je(()=>import("./ttcn-cfg-B9xdYoR4.js"),[],import.meta.url).then(e=>st(e.ttcnCfg))}}),Ne.of({name:"Turtle",extensions:["ttl"],load(){return je(()=>Promise.resolve().then(()=>dpn),void 0,import.meta.url).then(e=>st(e.turtle))}}),Ne.of({name:"Web IDL",extensions:["webidl"],load(){return je(()=>Promise.resolve().then(()=>iOn),void 0,import.meta.url).then(e=>st(e.webIDL))}}),Ne.of({name:"VB.NET",extensions:["vb"],load(){return je(()=>Promise.resolve().then(()=>Tpn),void 0,import.meta.url).then(e=>st(e.vb))}}),Ne.of({name:"VBScript",extensions:["vbs"],load(){return je(()=>Promise.resolve().then(()=>Ppn),void 0,import.meta.url).then(e=>st(e.vbScript))}}),Ne.of({name:"Velocity",extensions:["vtl"],load(){return je(()=>Promise.resolve().then(()=>Qpn),void 0,import.meta.url).then(e=>st(e.velocity))}}),Ne.of({name:"Verilog",extensions:["v"],load(){return je(()=>Promise.resolve().then(()=>N1e),void 0,import.meta.url).then(e=>st(e.verilog))}}),Ne.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return je(()=>Promise.resolve().then(()=>jpn),void 0,import.meta.url).then(e=>st(e.vhdl))}}),Ne.of({name:"XQuery",extensions:["xy","xquery"],load(){return je(()=>Promise.resolve().then(()=>pOn),void 0,import.meta.url).then(e=>st(e.xQuery))}}),Ne.of({name:"Yacas",extensions:["ys"],load(){return je(()=>Promise.resolve().then(()=>$On),void 0,import.meta.url).then(e=>st(e.yacas))}}),Ne.of({name:"Z80",extensions:["z80"],load(){return je(()=>Promise.resolve().then(()=>COn),void 0,import.meta.url).then(e=>st(e.z80))}}),Ne.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return je(()=>Promise.resolve().then(()=>s9),void 0,import.meta.url).then(e=>st(e.mscgen))}}),Ne.of({name:"Xù",extensions:["xu"],load(){return je(()=>Promise.resolve().then(()=>s9),void 0,import.meta.url).then(e=>st(e.xu))}}),Ne.of({name:"MsGenny",extensions:["msgenny"],load(){return je(()=>Promise.resolve().then(()=>s9),void 0,import.meta.url).then(e=>st(e.msgenny))}}),Ne.of({name:"Vue",extensions:["vue"],load(){return je(()=>Promise.resolve().then(()=>Mtn),void 0,import.meta.url).then(e=>e.vue())}}),Ne.of({name:"Angular Template",load(){return je(()=>Promise.resolve().then(()=>inn),void 0,import.meta.url).then(e=>e.angular())}})];class MJ{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=Lr(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(N6e(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 d0e(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 Ozt(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=d0e(t)+d0e(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function O2(e){let t=e.map(i=>typeof i=="string"?{label:i}:i),[n,r]=t.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:Ozt(t);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:t,validFor:n}:null}}function _N(e,t){return n=>{for(let r=Lr(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 h0e{constructor(t,n,r,i){this.completion=t,this.source=n,this.match=r,this.score=i}}function F0(e){return e.selection.main.from}function N6e(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 jJ=yf.define();function gzt(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:He.cursor(o.from+s+l.length)}})),{scrollIntoView:!0,userEvent:"input.complete"})}const f0e=new WeakMap;function mzt(e){if(!Array.isArray(e))return e;let t=f0e.get(e);return t||f0e.set(e,t=O2(e)),t}const tA=Yn.define(),W_=Yn.define();class vzt{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=Cl(t,n),i=_h(r);this.chars.push(r);let s=t.slice(n,n+i),a=s.toUpperCase();this.folded.push(Cl(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 y=Cl(t,0),w=_h(y),k=w==t.length?0:-100;if(y!=n[0])if(y==r[0])k+=-200;else return null;return this.ret(k,[0,w])}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 y=0,w=Math.min(t.length,200);y<w&&c<l;){let k=Cl(t,y);(k==n[c]||k==r[c])&&(i[c++]=y),y+=_h(k)}if(c<l)return null}let u=0,d=0,h=!1,f=0,O=-1,g=-1,m=/[a-z]/.test(t),v=!0;for(let y=0,w=Math.min(t.length,200),k=0;y<w&&d<l;){let x=Cl(t,y);o<0&&(u<l&&x==n[u]&&(s[u++]=y),f<l&&(x==n[f]||x==r[f]?(f==0&&(O=y),g=y+1,f++):f=0));let S,T=x<255?x>=48&&x<=57||x>=97&&x<=122?2:x>=65&&x<=90?1:0:(S=gJ(x))!=S.toLowerCase()?1:S!=S.toUpperCase()?2:0;(!y||T==1&&m||k==0&&T!=0)&&(n[d]==x||r[d]==x&&(h=!0)?a[d++]=y:a.length&&(v=!1)),k=T,y+=_h(x)}return d==l&&a[0]==0&&v?this.result(-100+(h?-200:0),a,t):f==l&&O==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,[O,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?_h(Cl(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 yzt{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 Ma=Jt.define({combine(e){return bf(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:bzt,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=>p0e(t(r),n(r)),optionClass:(t,n)=>r=>p0e(t(r),n(r)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function p0e(e,t){return e?t?e+" "+t:e:t}function bzt(e,t,n,r,i,s){let a=e.textDirection==Gi.RTL,o=a,l=!1,c="top",u,d,h=t.left-i.left,f=i.right-t.right,O=r.right-r.left,g=r.bottom-r.top;if(o&&h<Math.min(O,f)?o=!1:!o&&f<Math.min(O,h)&&(o=!0),O<=(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 y=i.bottom-t.bottom;y>=g||y>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 wzt(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 ej(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 xzt{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(Ma);this.optionContent=wzt(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=ej(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(Ma).closeOnBlur&&l.relatedTarget!=t.contentDOM&&t.dispatch({effects:W_.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=ej(s.length,a,t.state.facet(Ma).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=ej(n.options.length,n.selected,this.view.state.facet(Ma).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=>Xl(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&&$zt(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(Ma).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 Szt(e,t){return n=>new xzt(n,e,t)}function $zt(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 O0e(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function kzt(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(Ma);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 h0e(d,c.source,u?u(d):[],1e9-n.length));else{let d=t.sliceDoc(c.from,c.to),h,f=s.filterStrict?new yzt(d):new vzt(d);for(let O of c.result.options)if(h=f.match(O.label)){let g=O.displayLabel?u?u(O,h.matched):[]:h.matched;i(new h0e(O,c.source,g,h.score+(O.boost||0)))}}}if(r){let c=Object.create(null),u=0,d=(h,f)=>{var O,g;return((O=h.rank)!==null&&O!==void 0?O: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):O0e(c.completion)>O0e(o)&&(a[a.length-1]=c),o=c.completion}return a}class qb{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 qb(this.options,g0e(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=kzt(t,n);if(!o.length)return i&&t.some(c=>c.isPending)?i.setDisabled():null;let l=n.facet(Ma).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 qb(o,g0e(r,l),{pos:t.reduce((c,u)=>u.hasResult()?Math.min(c,u.from):c,1e8),create:Qzt,above:s.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(t){return new qb(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 qb(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class nA{constructor(t,n,r){this.active=t,this.id=n,this.open=r}static start(){return new nA(Czt,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(Ma),s=(r.override||n.languageDataAt("autocomplete",F0(n)).map(mzt)).map(l=>(this.active.find(u=>u.source==l)||new bu(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(LJ));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||s.some(l=>l.hasResult()&&t.changes.touchesRange(l.from,l.to))||!Tzt(s,this.active)||o?a=qb.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 bu(l.source,0):l));for(let l of t.effects)l.is(I6e)&&(a=a&&a.setSelected(l.value,this.id));return s==this.active&&a==this.open?this:new nA(s,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?_zt:Pzt}}function Tzt(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 _zt={"aria-autocomplete":"list"},Pzt={};function g0e(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const Czt=[];function X6e(e,t){if(e.isUserEvent("input.complete")){let r=e.annotation(jJ);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 bu{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=X6e(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new bu(i.source,0)),r&4&&i.state==0&&(i=new bu(this.source,1)),i=i.updateFor(t,r);for(let s of t.effects)if(s.is(tA))i=new bu(i.source,1,s.value);else if(s.is(W_))i=new bu(i.source,0);else if(s.is(LJ))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(F0(t.state))}}class g1 extends bu{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=F0(t.state);if(o>a||!i||n&2&&(F0(t.startState)==this.from||o<this.limit))return new bu(this.source,n&4?1:0);let l=t.changes.mapPos(this.limit);return Ezt(i.validFor,t.state,s,a)?new g1(this.source,this.explicit,l,i,s,a):i.update&&(i=i.update(i,s,a,new MJ(t.state,o,!1)))?new g1(this.source,this.explicit,l,i,i.from,(r=i.to)!==null&&r!==void 0?r:F0(t.state)):new bu(this.source,1,this.explicit)}map(t){return t.empty?this:(this.result.map?this.result.map(this.result,t):this.result)?new g1(this.source,this.explicit,t.mapPos(this.limit),this.result,t.mapPos(this.from),t.mapPos(this.to,1)):new bu(this.source,0)}touches(t){return t.changes.touchesRange(this.from,this.to)}}function Ezt(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e=="function"?e(i,n,r,t):N6e(e,!0).test(i)}const LJ=Yn.define({map(e,t){return e.map(n=>n.map(t))}}),I6e=Yn.define(),Ql=Va.define({create(){return nA.start()},update(e,t){return e.update(t)},provide:e=>[QJ.from(e,t=>t.tooltip),At.contentAttributes.from(e,t=>t.attrs)]});function qJ(e,t){const n=t.completion.apply||t.completion.label;let r=e.state.field(Ql).active.find(i=>i.source==t.source);return r instanceof g1?(typeof n=="string"?e.dispatch(Object.assign(Object.assign({},gzt(e.state,n,r.from,r.to)),{annotations:jJ.of(t.completion)})):n(e,t.completion,r.from,r.to),!0):!1}const Qzt=Szt(Ql,qJ);function cE(e,t="option"){return n=>{let r=n.state.field(Ql,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(Ma).interactionDelay)return!1;let i=1,s;t=="page"&&(s=l6e(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:I6e.of(o)}),!0}}const Rzt=e=>{let t=e.state.field(Ql,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(Ma).interactionDelay?!1:qJ(e,t.open.options[t.open.selected])},m0e=e=>e.state.field(Ql,!1)?(e.dispatch({effects:tA.of(!0)}),!0):!1,Azt=e=>{let t=e.state.field(Ql,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:W_.of(null)}),!0)};class Dzt{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const Nzt=50,Xzt=1e3,Izt=vs.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(Ql).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(Ql),n=e.state.facet(Ma);if(!e.selectionSet&&!e.docChanged&&e.startState.field(Ql)==t)return;let r=e.transactions.some(s=>{let a=X6e(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>Nzt&&Date.now()-a.time>Xzt){for(let o of a.context.abortListeners)try{o()}catch(l){Xl(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(tA)))&&(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(Ql);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(Ma).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=F0(t),r=new MJ(t,n,e.explicit,this.view),i=new Dzt(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:W_.of(null)}),Xl(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(Ma).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(Ma),r=this.view.state.field(Ql);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=F0(s.updates.length?s.updates[0].startState:this.view.state),l=Math.min(o,s.done.from+(s.active.explicit?0:1)),c=new g1(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 bu(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:LJ.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(Ql,!1);if(t&&t.tooltip&&this.view.state.facet(Ma).closeOnBlur){let n=t.open&&l6e(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:W_.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:tA.of(!1)}),20),this.composing=0}}}),Fzt=typeof navigator=="object"&&/Win/.test(navigator.platform),Mzt=cO.highest(At.domEventHandlers({keydown(e,t){let n=t.state.field(Ql,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(Fzt&&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&&qJ(t,r),!1}})),F6e=At.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 jzt{constructor(t,n,r,i){this.field=t,this.line=n,this.from=r,this.to=i}}class zJ{constructor(t,n,r){this.field=t,this.from=n,this.to=r}map(t){let n=t.mapPos(this.from,-1,oo.TrackDel),r=t.mapPos(this.to,1,oo.TrackDel);return n==null||r==null?null:new zJ(this.field,n,r)}}class UJ{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(Mx);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 zJ(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 jzt(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 UJ(r,i)}}let Lzt=Kt.widget({widget:new class extends zd{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),qzt=Kt.mark({class:"cm-snippetField"});class Lx{constructor(t,n){this.ranges=t,this.active=n,this.deco=Kt.set(t.map(r=>(r.from==r.to?Lzt:qzt).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 Lx(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 g2=Yn.define({map(e,t){return e&&e.map(t)}}),zzt=Yn.define(),G_=Va.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(g2))return n.value;if(n.is(zzt)&&e)return new Lx(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=>At.decorations.from(e,t=>t?t.deco:Kt.none)});function WJ(e,t){return He.create(e.filter(n=>n.field==t).map(n=>He.range(n.from,n.to)))}function Uzt(e){let t=UJ.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:Vr.of(a)},scrollIntoView:!0,annotations:r?[jJ.of(r),ua.userEvent.of("input.complete")]:void 0};if(o.length&&(c.selection=WJ(o,0)),o.some(u=>u.field>0)){let u=new Lx(o,0),d=c.effects=[g2.of(u)];n.state.field(G_,!1)===void 0&&d.push(Yn.appendConfig.of([G_,Yzt,Zzt,F6e]))}n.dispatch(n.state.update(c))}}function M6e(e){return({state:t,dispatch:n})=>{let r=t.field(G_,!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:WJ(r.ranges,i),effects:g2.of(s?null:new Lx(r.ranges,i)),scrollIntoView:!0})),!0}}const Wzt=({state:e,dispatch:t})=>e.field(G_,!1)?(t(e.update({effects:g2.of(null)})),!0):!1,Gzt=M6e(1),Vzt=M6e(-1),Bzt=[{key:"Tab",run:Gzt,shift:Vzt},{key:"Escape",run:Wzt}],v0e=Jt.define({combine(e){return e.length?e[0]:Bzt}}),Yzt=cO.highest(dy.compute([v0e],e=>e.facet(v0e)));function Li(e,t){return Object.assign(Object.assign({},t),{apply:Uzt(e)})}const Zzt=At.domEventHandlers({mousedown(e,t){let n=t.state.field(G_,!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:WJ(n.ranges,i.field),effects:g2.of(n.ranges.some(s=>s.field>i.field)?new Lx(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),V_={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},_0=Yn.define({map(e,t){let n=t.mapPos(e,-1,oo.TrackAfter);return n??void 0}}),GJ=new class extends Sv{};GJ.startSide=1;GJ.endSide=-1;const j6e=Va.define({create(){return Ir.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(_0)&&(e=e.update({add:[GJ.range(n.value,n.value+1)]}));return e}});function Hzt(){return[Jzt,j6e]}const tj="()[]{}<>«»»«[]{}";function L6e(e){for(let t=0;t<tj.length;t+=2)if(tj.charCodeAt(t)==e)return tj.charAt(t+1);return gJ(e<128?e:e+1)}function q6e(e,t){return e.languageDataAt("closeBrackets",t)[0]||V_}const Kzt=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Jzt=At.inputHandler.of((e,t,n,r)=>{if((Kzt?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||r.length==2&&_h(Cl(r,0))==1||t!=i.from||n!=i.to)return!1;let s=nUt(e.state,r);return s?(e.dispatch(s),!0):!1}),eUt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=q6e(e,e.selection.main.head).brackets||V_.brackets,i=null,s=e.changeByRange(a=>{if(a.empty){let o=rUt(e.doc,a.head);for(let l of r)if(l==o&&PN(e.doc,a.head)==L6e(Cl(l,0)))return{changes:{from:a.head-l.length,to:a.head+l.length},range:He.cursor(a.head-l.length)}}return{range:i=a}});return i||t(e.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},tUt=[{key:"Backspace",run:eUt}];function nUt(e,t){let n=q6e(e,e.selection.main.head),r=n.brackets||V_.brackets;for(let i of r){let s=L6e(Cl(i,0));if(t==i)return s==i?aUt(e,i,r.indexOf(i+i+i)>-1,n):iUt(e,i,s,n.before||V_.before);if(t==s&&z6e(e,e.selection.main.from))return sUt(e,i,s)}return null}function z6e(e,t){let n=!1;return e.field(j6e).between(0,e.doc.length,r=>{r==t&&(n=!0)}),n}function PN(e,t){let n=e.sliceString(t,t+2);return n.slice(0,_h(Cl(n,0)))}function rUt(e,t){let n=e.sliceString(t-2,t);return _h(Cl(n,0))==n.length?n:n.slice(1)}function iUt(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:_0.of(a.to+t.length),range:He.range(a.anchor+t.length,a.head+t.length)};let o=PN(e.doc,a.head);return!o||/\s/.test(o)||r.indexOf(o)>-1?{changes:{insert:t+n,from:a.head},effects:_0.of(a.head+t.length),range:He.cursor(a.head+t.length)}:{range:i=a}});return i?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function sUt(e,t,n){let r=null,i=e.changeByRange(s=>s.empty&&PN(e.doc,s.head)==n?{changes:{from:s.head,to:s.head+n.length,insert:n},range:He.cursor(s.head+n.length)}:r={range:s});return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function aUt(e,t,n,r){let i=r.stringPrefixes||V_.stringPrefixes,s=null,a=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:t,from:o.to}],effects:_0.of(o.to+t.length),range:He.range(o.anchor+t.length,o.head+t.length)};let l=o.head,c=PN(e.doc,l),u;if(c==t){if(y0e(e,l))return{changes:{insert:t+t,from:l},effects:_0.of(l+t.length),range:He.cursor(l+t.length)};if(z6e(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:He.cursor(l+h.length)}}}else{if(n&&e.sliceDoc(l-2*t.length,l)==t+t&&(u=b0e(e,l-2*t.length,i))>-1&&y0e(e,u))return{changes:{insert:t+t+t+t,from:l},effects:_0.of(l+t.length),range:He.cursor(l+t.length)};if(e.charCategorizer(l)(c)!=ss.Word&&b0e(e,l,i)>-1&&!oUt(e,l,t,i))return{changes:{insert:t+t,from:l},effects:_0.of(l+t.length),range:He.cursor(l+t.length)}}return{range:s=o}});return s?null:e.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function y0e(e,t){let n=Lr(e).resolveInner(t+1);return n.parent&&n.from==t}function oUt(e,t,n,r){let i=Lr(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 b0e(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=ss.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))!=ss.Word)return s}return-1}function lUt(e={}){return[Mzt,Ql,Ma.of(e),Izt,cUt,F6e]}const U6e=[{key:"Ctrl-Space",run:m0e},{mac:"Alt-`",run:m0e},{key:"Escape",run:Azt},{key:"ArrowDown",run:cE(!0)},{key:"ArrowUp",run:cE(!1)},{key:"PageDown",run:cE(!0,"page")},{key:"PageUp",run:cE(!1,"page")},{key:"Enter",run:Rzt}],cUt=cO.highest(dy.computeN([Ma],e=>e.facet(Ma).defaultKeymap?[U6e]:[]));class rA{static create(t,n,r,i,s){let a=i+(i<<8)+t+(n<<4)|0;return new rA(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=[[Wn.contextHash,i]]}addChild(t,n){t.prop(Wn.contextHash)!=this.hash&&(t=new $r(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 $r(t.types[this.type],this.children,this.positions,n-this.from).balance({makeTree:(i,s,a)=>new $r(ha.none,i,s,a,this.hashProp)})}}var Ct;(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"})(Ct||(Ct={}));class uUt{constructor(t,n){this.start=t,this.content=n,this.marks=[],this.parsers=[]}}class dUt{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 wk(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 w0e(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==Ct.OrderedList?YJ:BJ)(n,t,!1);return r>0&&(e.type!=Ct.BulletList||VJ(n,t,!1)<0)&&n.text.charCodeAt(n.pos+r-1)==e.value}const W6e={[Ct.Blockquote](e,t,n){return n.next!=62?!1:(n.markers.push(Er(Ct.QuoteMark,t.lineStart+n.pos,t.lineStart+n.pos+1)),n.moveBase(n.pos+(Uu(n.text.charCodeAt(n.pos+1))?2:1)),e.end=t.lineStart+n.text.length,!0)},[Ct.ListItem](e,t,n){return n.indent<n.baseIndent+e.value&&n.next>-1?!1:(n.moveBaseColumn(n.baseIndent+e.value),!0)},[Ct.OrderedList]:w0e,[Ct.BulletList]:w0e,[Ct.Document](){return!0}};function Uu(e){return e==32||e==9||e==10||e==13}function wk(e,t=0){for(;t<e.length&&Uu(e.charCodeAt(t));)t++;return t}function x0e(e,t,n){for(;t>n&&Uu(e.charCodeAt(t-1));)t--;return t}function G6e(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 V6e(e){return e.next!=62?-1:e.text.charCodeAt(e.pos+1)==32?2:1}function VJ(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(!Uu(s))return-1}return n&&e.next==45&&Z6e(e)>-1&&e.depth==t.stack.length&&t.parser.leafBlockParsers.indexOf(eIe.SetextHeading)>-1||r<3?-1:1}function B6e(e,t){for(let n=e.stack.length-1;n>=0;n--)if(e.stack[n].type==t)return!0;return!1}function BJ(e,t,n){return(e.next==45||e.next==43||e.next==42)&&(e.pos==e.text.length-1||Uu(e.text.charCodeAt(e.pos+1)))&&(!n||B6e(t,Ct.BulletList)||e.skipSpace(e.pos+2)<e.text.length)?1:-1}function YJ(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&&!Uu(e.text.charCodeAt(r+1))||n&&!B6e(t,Ct.OrderedList)&&(e.skipSpace(r+1)==e.text.length||r>e.pos+1||e.next!=49)?-1:r+1-e.pos}function Y6e(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 Z6e(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&&Uu(e.text.charCodeAt(t));)t++;return t==e.text.length?n:-1}const iV=/^[ \t]*$/,H6e=/-->/,K6e=/\?>/,sV=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,H6e],[/^\s*<\?/,K6e],[/^\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,iV],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,iV]];function J6e(e,t,n){if(e.next!=60)return-1;let r=e.text.slice(e.pos);for(let i=0,s=sV.length-(n?1:0);i<s;i++)if(sV[i][0].test(r))return i;return-1}function S0e(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 zm(e,t,n){let r=e.length-1;r>=0&&e[r].to==t&&e[r].type==Ct.CodeText?e[r].to=n:e.push(Er(Ct.CodeText,t,n))}const uE={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(zm(a,i,s);e.nextLine()&&t.depth>=e.stack.length;)if(t.pos==t.text.length){zm(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==Ct.CodeText?zm(a,c.from,c.to):a.push(c);o=[]}zm(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&&zm(a,l,s)}}return o.length&&(o=o.filter(l=>l.type!=Ct.CodeText),o.length&&(t.markers=o.concat(t.markers))),e.addNode(e.buffer.writeElements(a,-i).finish(Ct.CodeBlock,s-i),i),!0},FencedCode(e,t){let n=G6e(t);if(n<0)return!1;let r=e.lineStart+t.pos,i=t.next,s=n-t.pos,a=t.skipSpace(n),o=x0e(t.text,t.text.length,a),l=[Er(Ct.CodeMark,r,r+s)];a<o&&l.push(Er(Ct.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(Er(Ct.CodeMark,e.lineStart+t.pos,e.lineStart+u)),e.nextLine();break}else{c||zm(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&&zm(l,d,h)}}return e.addNode(e.buffer.writeElements(l,-r).finish(Ct.FencedCode,e.prevLineEnd()-r),r),!0},Blockquote(e,t){let n=V6e(t);return n<0?!1:(e.startContext(Ct.Blockquote,t.pos),e.addNode(Ct.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1),t.moveBase(t.pos+n),null)},HorizontalRule(e,t){if(VJ(t,e,!1)<0)return!1;let n=e.lineStart+t.pos;return e.nextLine(),e.addNode(Ct.HorizontalRule,n),!0},BulletList(e,t){let n=BJ(t,e,!1);if(n<0)return!1;e.block.type!=Ct.BulletList&&e.startContext(Ct.BulletList,t.basePos,t.next);let r=S0e(t,t.pos+1);return e.startContext(Ct.ListItem,t.basePos,r-t.baseIndent),e.addNode(Ct.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},OrderedList(e,t){let n=YJ(t,e,!1);if(n<0)return!1;e.block.type!=Ct.OrderedList&&e.startContext(Ct.OrderedList,t.basePos,t.text.charCodeAt(t.pos+n-1));let r=S0e(t,t.pos+n);return e.startContext(Ct.ListItem,t.basePos,r-t.baseIndent),e.addNode(Ct.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},ATXHeading(e,t){let n=Y6e(t);if(n<0)return!1;let r=t.pos,i=e.lineStart+r,s=x0e(t.text,t.text.length,r),a=s;for(;a>r&&t.text.charCodeAt(a-1)==t.next;)a--;(a==s||a==r||!Uu(t.text.charCodeAt(a-1)))&&(a=t.text.length);let o=e.buffer.write(Ct.HeaderMark,0,n).writeElements(e.parser.parseInline(t.text.slice(r+n+1,a),i+n+1),-i);a<t.text.length&&o.write(Ct.HeaderMark,a-r,s-r);let l=o.finish(Ct.ATXHeading1-1+n,t.text.length-r);return e.nextLine(),e.addNode(l,i),!0},HTMLBlock(e,t){let n=J6e(t,e,!1);if(n<0)return!1;let r=e.lineStart+t.pos,i=sV[n][1],s=[],a=i!=iV;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==H6e?Ct.CommentBlock:i==K6e?Ct.ProcessingInstructionBlock:Ct.HTMLBlock,l=e.prevLineEnd();return e.addNode(e.buffer.writeElements(s,-r).finish(o,l-r),r),!0},SetextHeading:void 0};class hUt{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+`
|
|
1203
|
+
`);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 C6e(n,t?t.state.tabSize:4,t?Pv(t.state):2);if(a.eol())s.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let o=Q6e(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=$r.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:dzt,topID:0,maxBufferLength:2048,reused:this.chunkReused});t=new $r(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 $r(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function Q6e(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 FJ=Object.create(null),U_=[ha.none],dzt=new Fx(U_),c0e=[],u0e=Object.create(null),R6e=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"]])R6e[e]=D6e(FJ,t);class A6e{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),R6e)}resolve(t){return t?this.table[t]||(this.table[t]=D6e(this.extra,t)):0}}const hzt=new A6e(FJ);function J7(e,t){c0e.indexOf(e)>-1||(c0e.push(e),console.warn(t))}function D6e(e,t){let n=[];for(let o of t.split(" ")){let l=[];for(let c of o.split(".")){let u=e[c]||R[c];u?typeof u=="function"?l.length?l=l.map(u):J7(c,`Modifier ${c} used at start of tag`):l.length?J7(c,`Tag ${c} used as modifier`):l=Array.isArray(u)?u:[u]:J7(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=u0e[i];if(s)return s.id;let a=u0e[i]=ha.define({id:U_.length,name:r,props:[Yr({[r]:n})]});return U_.push(a),a.id}function fzt(e,t){let n=ha.define({id:U_.length,name:"Document",props:[hg.add(()=>e),ys.add(()=>r=>t.getIndent(r))],top:!0});return U_.push(n),n}Gi.RTL,Gi.LTR;function st(e){return new Ar(ft.define(e))}function CO(e){return je(()=>Promise.resolve().then(()=>MKt),void 0,import.meta.url).then(t=>t.sql({dialect:t[e]}))}const pzt=[Ne.of({name:"C",extensions:["c","h","ino"],load(){return je(()=>Promise.resolve().then(()=>tye),void 0,import.meta.url).then(e=>e.cpp())}}),Ne.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return je(()=>Promise.resolve().then(()=>tye),void 0,import.meta.url).then(e=>e.cpp())}}),Ne.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return CO("Cassandra")}}),Ne.of({name:"CSS",extensions:["css"],load(){return je(()=>Promise.resolve().then(()=>eGt),void 0,import.meta.url).then(e=>e.css())}}),Ne.of({name:"Go",extensions:["go"],load(){return je(()=>import("./index-DOGq7e-U.js"),__vite__mapDeps([4,1,2]),import.meta.url).then(e=>e.go())}}),Ne.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return je(()=>Promise.resolve().then(()=>WGt),void 0,import.meta.url).then(e=>e.html())}}),Ne.of({name:"Java",extensions:["java"],load(){return je(()=>Promise.resolve().then(()=>zKt),void 0,import.meta.url).then(e=>e.java())}}),Ne.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return je(()=>Promise.resolve().then(()=>hE),void 0,import.meta.url).then(e=>e.javascript())}}),Ne.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return je(()=>Promise.resolve().then(()=>ZVt),void 0,import.meta.url).then(e=>e.json())}}),Ne.of({name:"JSX",extensions:["jsx"],load(){return je(()=>Promise.resolve().then(()=>hE),void 0,import.meta.url).then(e=>e.javascript({jsx:!0}))}}),Ne.of({name:"LESS",extensions:["less"],load(){return je(()=>Promise.resolve().then(()=>hVt),void 0,import.meta.url).then(e=>e.less())}}),Ne.of({name:"Liquid",extensions:["liquid"],load(){return je(()=>Promise.resolve().then(()=>Ptn),void 0,import.meta.url).then(e=>e.liquid())}}),Ne.of({name:"MariaDB SQL",load(){return CO("MariaSQL")}}),Ne.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return je(()=>Promise.resolve().then(()=>tVt),void 0,import.meta.url).then(e=>e.markdown())}}),Ne.of({name:"MS SQL",load(){return CO("MSSQL")}}),Ne.of({name:"MySQL",load(){return CO("MySQL")}}),Ne.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return je(()=>Promise.resolve().then(()=>stn),void 0,import.meta.url).then(e=>e.php())}}),Ne.of({name:"PLSQL",extensions:["pls"],load(){return CO("PLSQL")}}),Ne.of({name:"PostgreSQL",load(){return CO("PostgreSQL")}}),Ne.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return je(()=>Promise.resolve().then(()=>PHt),void 0,import.meta.url).then(e=>e.python())}}),Ne.of({name:"Rust",extensions:["rs"],load(){return je(()=>Promise.resolve().then(()=>cJt),void 0,import.meta.url).then(e=>e.rust())}}),Ne.of({name:"Sass",extensions:["sass"],load(){return je(()=>Promise.resolve().then(()=>gve),void 0,import.meta.url).then(e=>e.sass({indented:!0}))}}),Ne.of({name:"SCSS",extensions:["scss"],load(){return je(()=>Promise.resolve().then(()=>gve),void 0,import.meta.url).then(e=>e.sass())}}),Ne.of({name:"SQL",extensions:["sql"],load(){return CO("StandardSQL")}}),Ne.of({name:"SQLite",load(){return CO("SQLite")}}),Ne.of({name:"TSX",extensions:["tsx"],load(){return je(()=>Promise.resolve().then(()=>hE),void 0,import.meta.url).then(e=>e.javascript({jsx:!0,typescript:!0}))}}),Ne.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return je(()=>Promise.resolve().then(()=>hE),void 0,import.meta.url).then(e=>e.javascript({typescript:!0}))}}),Ne.of({name:"WebAssembly",extensions:["wat","wast"],load(){return je(()=>Promise.resolve().then(()=>Qtn),void 0,import.meta.url).then(e=>e.wast())}}),Ne.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return je(()=>Promise.resolve().then(()=>ZHt),void 0,import.meta.url).then(e=>e.xml())}}),Ne.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return je(()=>import("./index-C4wE5-hf.js"),__vite__mapDeps([5,1,2]),import.meta.url).then(e=>e.yaml())}}),Ne.of({name:"APL",extensions:["dyalog","apl"],load(){return je(()=>Promise.resolve().then(()=>ain),void 0,import.meta.url).then(e=>st(e.apl))}}),Ne.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return je(()=>Promise.resolve().then(()=>oin),void 0,import.meta.url).then(e=>st(e.asciiArmor))}}),Ne.of({name:"ASN.1",extensions:["asn","asn1"],load(){return je(()=>import("./asn1-EdZsLKOL.js"),[],import.meta.url).then(e=>st(e.asn1({})))}}),Ne.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return je(()=>Promise.resolve().then(()=>hin),void 0,import.meta.url).then(e=>st(e.asterisk))}}),Ne.of({name:"Brainfuck",extensions:["b","bf"],load(){return je(()=>Promise.resolve().then(()=>pin),void 0,import.meta.url).then(e=>st(e.brainfuck))}}),Ne.of({name:"Cobol",extensions:["cob","cpy"],load(){return je(()=>Promise.resolve().then(()=>qin),void 0,import.meta.url).then(e=>st(e.cobol))}}),Ne.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return je(()=>Promise.resolve().then(()=>Gm),void 0,import.meta.url).then(e=>st(e.csharp))}}),Ne.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return je(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>st(e.clojure))}}),Ne.of({name:"ClojureScript",extensions:["cljs"],load(){return je(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>st(e.clojure))}}),Ne.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return je(()=>import("./css-BnMrqG3P.js"),[],import.meta.url).then(e=>st(e.gss))}}),Ne.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return je(()=>Promise.resolve().then(()=>Ain),void 0,import.meta.url).then(e=>st(e.cmake))}}),Ne.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return je(()=>Promise.resolve().then(()=>tsn),void 0,import.meta.url).then(e=>st(e.coffeeScript))}}),Ne.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return je(()=>Promise.resolve().then(()=>osn),void 0,import.meta.url).then(e=>st(e.commonLisp))}}),Ne.of({name:"Cypher",extensions:["cyp","cypher"],load(){return je(()=>Promise.resolve().then(()=>ksn),void 0,import.meta.url).then(e=>st(e.cypher))}}),Ne.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return je(()=>import("./python-BuPzkPfP.js"),[],import.meta.url).then(e=>st(e.cython))}}),Ne.of({name:"Crystal",extensions:["cr"],load(){return je(()=>Promise.resolve().then(()=>ysn),void 0,import.meta.url).then(e=>st(e.crystal))}}),Ne.of({name:"D",extensions:["d"],load(){return je(()=>Promise.resolve().then(()=>Rsn),void 0,import.meta.url).then(e=>st(e.d))}}),Ne.of({name:"Dart",extensions:["dart"],load(){return je(()=>Promise.resolve().then(()=>Gm),void 0,import.meta.url).then(e=>st(e.dart))}}),Ne.of({name:"diff",extensions:["diff","patch"],load(){return je(()=>Promise.resolve().then(()=>Asn),void 0,import.meta.url).then(e=>st(e.diff))}}),Ne.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return je(()=>Promise.resolve().then(()=>Gsn),void 0,import.meta.url).then(e=>st(e.dockerFile))}}),Ne.of({name:"DTD",extensions:["dtd"],load(){return je(()=>Promise.resolve().then(()=>Ysn),void 0,import.meta.url).then(e=>st(e.dtd))}}),Ne.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return je(()=>Promise.resolve().then(()=>ean),void 0,import.meta.url).then(e=>st(e.dylan))}}),Ne.of({name:"EBNF",load(){return je(()=>Promise.resolve().then(()=>tan),void 0,import.meta.url).then(e=>st(e.ebnf))}}),Ne.of({name:"ECL",extensions:["ecl"],load(){return je(()=>Promise.resolve().then(()=>can),void 0,import.meta.url).then(e=>st(e.ecl))}}),Ne.of({name:"edn",extensions:["edn"],load(){return je(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>st(e.clojure))}}),Ne.of({name:"Eiffel",extensions:["e"],load(){return je(()=>Promise.resolve().then(()=>Oan),void 0,import.meta.url).then(e=>st(e.eiffel))}}),Ne.of({name:"Elm",extensions:["elm"],load(){return je(()=>Promise.resolve().then(()=>Tan),void 0,import.meta.url).then(e=>st(e.elm))}}),Ne.of({name:"Erlang",extensions:["erl"],load(){return je(()=>Promise.resolve().then(()=>Zan),void 0,import.meta.url).then(e=>st(e.erlang))}}),Ne.of({name:"Esper",load(){return je(()=>import("./sql-D0XecflT.js"),[],import.meta.url).then(e=>st(e.esper))}}),Ne.of({name:"Factor",extensions:["factor"],load(){return je(()=>Promise.resolve().then(()=>Han),void 0,import.meta.url).then(e=>st(e.factor))}}),Ne.of({name:"FCL",load(){return je(()=>Promise.resolve().then(()=>non),void 0,import.meta.url).then(e=>st(e.fcl))}}),Ne.of({name:"Forth",extensions:["forth","fth","4th"],load(){return je(()=>Promise.resolve().then(()=>son),void 0,import.meta.url).then(e=>st(e.forth))}}),Ne.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return je(()=>Promise.resolve().then(()=>hon),void 0,import.meta.url).then(e=>st(e.fortran))}}),Ne.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return je(()=>import("./mllike-CXdrOF99.js"),[],import.meta.url).then(e=>st(e.fSharp))}}),Ne.of({name:"Gas",extensions:["s"],load(){return je(()=>Promise.resolve().then(()=>pon),void 0,import.meta.url).then(e=>st(e.gas))}}),Ne.of({name:"Gherkin",extensions:["feature"],load(){return je(()=>Promise.resolve().then(()=>Oon),void 0,import.meta.url).then(e=>st(e.gherkin))}}),Ne.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return je(()=>Promise.resolve().then(()=>Ton),void 0,import.meta.url).then(e=>st(e.groovy))}}),Ne.of({name:"Haskell",extensions:["hs"],load(){return je(()=>Promise.resolve().then(()=>Aon),void 0,import.meta.url).then(e=>st(e.haskell))}}),Ne.of({name:"Haxe",extensions:["hx"],load(){return je(()=>Promise.resolve().then(()=>$be),void 0,import.meta.url).then(e=>st(e.haxe))}}),Ne.of({name:"HXML",extensions:["hxml"],load(){return je(()=>Promise.resolve().then(()=>$be),void 0,import.meta.url).then(e=>st(e.hxml))}}),Ne.of({name:"HTTP",load(){return je(()=>Promise.resolve().then(()=>nln),void 0,import.meta.url).then(e=>st(e.http))}}),Ne.of({name:"IDL",extensions:["pro"],load(){return je(()=>Promise.resolve().then(()=>cln),void 0,import.meta.url).then(e=>st(e.idl))}}),Ne.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return je(()=>import("./javascript-qCveANmP.js"),[],import.meta.url).then(e=>st(e.jsonld))}}),Ne.of({name:"Jinja2",extensions:["j2","jinja","jinja2"],load(){return je(()=>Promise.resolve().then(()=>fln),void 0,import.meta.url).then(e=>st(e.jinja2))}}),Ne.of({name:"Julia",extensions:["jl"],load(){return je(()=>Promise.resolve().then(()=>Fln),void 0,import.meta.url).then(e=>st(e.julia))}}),Ne.of({name:"Kotlin",extensions:["kt","kts"],load(){return je(()=>Promise.resolve().then(()=>Gm),void 0,import.meta.url).then(e=>st(e.kotlin))}}),Ne.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return je(()=>Promise.resolve().then(()=>qln),void 0,import.meta.url).then(e=>st(e.liveScript))}}),Ne.of({name:"Lua",extensions:["lua"],load(){return je(()=>Promise.resolve().then(()=>Zln),void 0,import.meta.url).then(e=>st(e.lua))}}),Ne.of({name:"mIRC",extensions:["mrc"],load(){return je(()=>Promise.resolve().then(()=>ycn),void 0,import.meta.url).then(e=>st(e.mirc))}}),Ne.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return je(()=>Promise.resolve().then(()=>icn),void 0,import.meta.url).then(e=>st(e.mathematica))}}),Ne.of({name:"Modelica",extensions:["mo"],load(){return je(()=>Promise.resolve().then(()=>Ccn),void 0,import.meta.url).then(e=>st(e.modelica))}}),Ne.of({name:"MUMPS",extensions:["mps"],load(){return je(()=>Promise.resolve().then(()=>Wcn),void 0,import.meta.url).then(e=>st(e.mumps))}}),Ne.of({name:"Mbox",extensions:["mbox"],load(){return je(()=>Promise.resolve().then(()=>gcn),void 0,import.meta.url).then(e=>st(e.mbox))}}),Ne.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return je(()=>Promise.resolve().then(()=>Zcn),void 0,import.meta.url).then(e=>st(e.nginx))}}),Ne.of({name:"NSIS",extensions:["nsh","nsi"],load(){return je(()=>Promise.resolve().then(()=>Hcn),void 0,import.meta.url).then(e=>st(e.nsis))}}),Ne.of({name:"NTriples",extensions:["nt","nq"],load(){return je(()=>Promise.resolve().then(()=>Kcn),void 0,import.meta.url).then(e=>st(e.ntriples))}}),Ne.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return je(()=>Promise.resolve().then(()=>Gm),void 0,import.meta.url).then(e=>st(e.objectiveC))}}),Ne.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return je(()=>Promise.resolve().then(()=>Gm),void 0,import.meta.url).then(e=>st(e.objectiveCpp))}}),Ne.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return je(()=>import("./mllike-CXdrOF99.js"),[],import.meta.url).then(e=>st(e.oCaml))}}),Ne.of({name:"Octave",extensions:["m"],load(){return je(()=>Promise.resolve().then(()=>cun),void 0,import.meta.url).then(e=>st(e.octave))}}),Ne.of({name:"Oz",extensions:["oz"],load(){return je(()=>Promise.resolve().then(()=>wun),void 0,import.meta.url).then(e=>st(e.oz))}}),Ne.of({name:"Pascal",extensions:["p","pas"],load(){return je(()=>Promise.resolve().then(()=>_un),void 0,import.meta.url).then(e=>st(e.pascal))}}),Ne.of({name:"Perl",extensions:["pl","pm"],load(){return je(()=>Promise.resolve().then(()=>Pun),void 0,import.meta.url).then(e=>st(e.perl))}}),Ne.of({name:"Pig",extensions:["pig"],load(){return je(()=>Promise.resolve().then(()=>Qun),void 0,import.meta.url).then(e=>st(e.pig))}}),Ne.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return je(()=>Promise.resolve().then(()=>Vun),void 0,import.meta.url).then(e=>st(e.powerShell))}}),Ne.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return je(()=>Promise.resolve().then(()=>Bun),void 0,import.meta.url).then(e=>st(e.properties))}}),Ne.of({name:"ProtoBuf",extensions:["proto"],load(){return je(()=>Promise.resolve().then(()=>Jun),void 0,import.meta.url).then(e=>st(e.protobuf))}}),Ne.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return je(()=>import("./pug-DukmZTjD.js"),__vite__mapDeps([6,7]),import.meta.url).then(e=>st(e.pug))}}),Ne.of({name:"Puppet",extensions:["pp"],load(){return je(()=>Promise.resolve().then(()=>ndn),void 0,import.meta.url).then(e=>st(e.puppet))}}),Ne.of({name:"Q",extensions:["q"],load(){return je(()=>Promise.resolve().then(()=>udn),void 0,import.meta.url).then(e=>st(e.q))}}),Ne.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return je(()=>Promise.resolve().then(()=>mdn),void 0,import.meta.url).then(e=>st(e.r))}}),Ne.of({name:"RPM Changes",load(){return je(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>st(e.rpmChanges))}}),Ne.of({name:"RPM Spec",extensions:["spec"],load(){return je(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>st(e.rpmSpec))}}),Ne.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return je(()=>Promise.resolve().then(()=>Tdn),void 0,import.meta.url).then(e=>st(e.ruby))}}),Ne.of({name:"SAS",extensions:["sas"],load(){return je(()=>Promise.resolve().then(()=>Edn),void 0,import.meta.url).then(e=>st(e.sas))}}),Ne.of({name:"Scala",extensions:["scala"],load(){return je(()=>Promise.resolve().then(()=>Gm),void 0,import.meta.url).then(e=>st(e.scala))}}),Ne.of({name:"Scheme",extensions:["scm","ss"],load(){return je(()=>Promise.resolve().then(()=>zdn),void 0,import.meta.url).then(e=>st(e.scheme))}}),Ne.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return je(()=>Promise.resolve().then(()=>Vdn),void 0,import.meta.url).then(e=>st(e.shell))}}),Ne.of({name:"Sieve",extensions:["siv","sieve"],load(){return je(()=>Promise.resolve().then(()=>Kdn),void 0,import.meta.url).then(e=>st(e.sieve))}}),Ne.of({name:"Smalltalk",extensions:["st"],load(){return je(()=>Promise.resolve().then(()=>thn),void 0,import.meta.url).then(e=>st(e.smalltalk))}}),Ne.of({name:"Solr",load(){return je(()=>Promise.resolve().then(()=>lhn),void 0,import.meta.url).then(e=>st(e.solr))}}),Ne.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return je(()=>import("./mllike-CXdrOF99.js"),[],import.meta.url).then(e=>st(e.sml))}}),Ne.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return je(()=>Promise.resolve().then(()=>Ohn),void 0,import.meta.url).then(e=>st(e.sparql))}}),Ne.of({name:"Spreadsheet",alias:["excel","formula"],load(){return je(()=>Promise.resolve().then(()=>ghn),void 0,import.meta.url).then(e=>st(e.spreadsheet))}}),Ne.of({name:"Squirrel",extensions:["nut"],load(){return je(()=>Promise.resolve().then(()=>Gm),void 0,import.meta.url).then(e=>st(e.squirrel))}}),Ne.of({name:"Stylus",extensions:["styl"],load(){return je(()=>Promise.resolve().then(()=>Fhn),void 0,import.meta.url).then(e=>st(e.stylus))}}),Ne.of({name:"Swift",extensions:["swift"],load(){return je(()=>Promise.resolve().then(()=>ifn),void 0,import.meta.url).then(e=>st(e.swift))}}),Ne.of({name:"sTeX",load(){return je(()=>Promise.resolve().then(()=>O1e),void 0,import.meta.url).then(e=>st(e.stex))}}),Ne.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return je(()=>Promise.resolve().then(()=>O1e),void 0,import.meta.url).then(e=>st(e.stex))}}),Ne.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return je(()=>Promise.resolve().then(()=>N1e),void 0,import.meta.url).then(e=>st(e.verilog))}}),Ne.of({name:"Tcl",extensions:["tcl"],load(){return je(()=>Promise.resolve().then(()=>lfn),void 0,import.meta.url).then(e=>st(e.tcl))}}),Ne.of({name:"Textile",extensions:["textile"],load(){return je(()=>Promise.resolve().then(()=>hfn),void 0,import.meta.url).then(e=>st(e.textile))}}),Ne.of({name:"TiddlyWiki",load(){return je(()=>Promise.resolve().then(()=>Afn),void 0,import.meta.url).then(e=>st(e.tiddlyWiki))}}),Ne.of({name:"Tiki wiki",load(){return je(()=>Promise.resolve().then(()=>jfn),void 0,import.meta.url).then(e=>st(e.tiki))}}),Ne.of({name:"TOML",extensions:["toml"],load(){return je(()=>Promise.resolve().then(()=>Lfn),void 0,import.meta.url).then(e=>st(e.toml))}}),Ne.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return je(()=>Promise.resolve().then(()=>Ufn),void 0,import.meta.url).then(e=>st(e.troff))}}),Ne.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return je(()=>Promise.resolve().then(()=>lpn),void 0,import.meta.url).then(e=>st(e.ttcn))}}),Ne.of({name:"TTCN_CFG",extensions:["cfg"],load(){return je(()=>import("./ttcn-cfg-B9xdYoR4.js"),[],import.meta.url).then(e=>st(e.ttcnCfg))}}),Ne.of({name:"Turtle",extensions:["ttl"],load(){return je(()=>Promise.resolve().then(()=>dpn),void 0,import.meta.url).then(e=>st(e.turtle))}}),Ne.of({name:"Web IDL",extensions:["webidl"],load(){return je(()=>Promise.resolve().then(()=>iOn),void 0,import.meta.url).then(e=>st(e.webIDL))}}),Ne.of({name:"VB.NET",extensions:["vb"],load(){return je(()=>Promise.resolve().then(()=>Tpn),void 0,import.meta.url).then(e=>st(e.vb))}}),Ne.of({name:"VBScript",extensions:["vbs"],load(){return je(()=>Promise.resolve().then(()=>Ppn),void 0,import.meta.url).then(e=>st(e.vbScript))}}),Ne.of({name:"Velocity",extensions:["vtl"],load(){return je(()=>Promise.resolve().then(()=>Qpn),void 0,import.meta.url).then(e=>st(e.velocity))}}),Ne.of({name:"Verilog",extensions:["v"],load(){return je(()=>Promise.resolve().then(()=>N1e),void 0,import.meta.url).then(e=>st(e.verilog))}}),Ne.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return je(()=>Promise.resolve().then(()=>jpn),void 0,import.meta.url).then(e=>st(e.vhdl))}}),Ne.of({name:"XQuery",extensions:["xy","xquery"],load(){return je(()=>Promise.resolve().then(()=>pOn),void 0,import.meta.url).then(e=>st(e.xQuery))}}),Ne.of({name:"Yacas",extensions:["ys"],load(){return je(()=>Promise.resolve().then(()=>$On),void 0,import.meta.url).then(e=>st(e.yacas))}}),Ne.of({name:"Z80",extensions:["z80"],load(){return je(()=>Promise.resolve().then(()=>COn),void 0,import.meta.url).then(e=>st(e.z80))}}),Ne.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return je(()=>Promise.resolve().then(()=>s9),void 0,import.meta.url).then(e=>st(e.mscgen))}}),Ne.of({name:"Xù",extensions:["xu"],load(){return je(()=>Promise.resolve().then(()=>s9),void 0,import.meta.url).then(e=>st(e.xu))}}),Ne.of({name:"MsGenny",extensions:["msgenny"],load(){return je(()=>Promise.resolve().then(()=>s9),void 0,import.meta.url).then(e=>st(e.msgenny))}}),Ne.of({name:"Vue",extensions:["vue"],load(){return je(()=>Promise.resolve().then(()=>Mtn),void 0,import.meta.url).then(e=>e.vue())}}),Ne.of({name:"Angular Template",load(){return je(()=>Promise.resolve().then(()=>inn),void 0,import.meta.url).then(e=>e.angular())}})];class MJ{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=Lr(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(N6e(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 d0e(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 Ozt(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=d0e(t)+d0e(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function O2(e){let t=e.map(i=>typeof i=="string"?{label:i}:i),[n,r]=t.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:Ozt(t);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:t,validFor:n}:null}}function _N(e,t){return n=>{for(let r=Lr(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 h0e{constructor(t,n,r,i){this.completion=t,this.source=n,this.match=r,this.score=i}}function F0(e){return e.selection.main.from}function N6e(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 jJ=yf.define();function gzt(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:He.cursor(o.from+s+l.length)}})),{scrollIntoView:!0,userEvent:"input.complete"})}const f0e=new WeakMap;function mzt(e){if(!Array.isArray(e))return e;let t=f0e.get(e);return t||f0e.set(e,t=O2(e)),t}const tA=Yn.define(),W_=Yn.define();class vzt{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=Cl(t,n),i=_h(r);this.chars.push(r);let s=t.slice(n,n+i),a=s.toUpperCase();this.folded.push(Cl(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 y=Cl(t,0),w=_h(y),k=w==t.length?0:-100;if(y!=n[0])if(y==r[0])k+=-200;else return null;return this.ret(k,[0,w])}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 y=0,w=Math.min(t.length,200);y<w&&c<l;){let k=Cl(t,y);(k==n[c]||k==r[c])&&(i[c++]=y),y+=_h(k)}if(c<l)return null}let u=0,d=0,h=!1,f=0,O=-1,g=-1,m=/[a-z]/.test(t),v=!0;for(let y=0,w=Math.min(t.length,200),k=0;y<w&&d<l;){let x=Cl(t,y);o<0&&(u<l&&x==n[u]&&(s[u++]=y),f<l&&(x==n[f]||x==r[f]?(f==0&&(O=y),g=y+1,f++):f=0));let S,T=x<255?x>=48&&x<=57||x>=97&&x<=122?2:x>=65&&x<=90?1:0:(S=gJ(x))!=S.toLowerCase()?1:S!=S.toUpperCase()?2:0;(!y||T==1&&m||k==0&&T!=0)&&(n[d]==x||r[d]==x&&(h=!0)?a[d++]=y:a.length&&(v=!1)),k=T,y+=_h(x)}return d==l&&a[0]==0&&v?this.result(-100+(h?-200:0),a,t):f==l&&O==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,[O,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?_h(Cl(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 yzt{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 Ma=Jt.define({combine(e){return bf(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:bzt,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=>p0e(t(r),n(r)),optionClass:(t,n)=>r=>p0e(t(r),n(r)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function p0e(e,t){return e?t?e+" "+t:e:t}function bzt(e,t,n,r,i,s){let a=e.textDirection==Gi.RTL,o=a,l=!1,c="top",u,d,h=t.left-i.left,f=i.right-t.right,O=r.right-r.left,g=r.bottom-r.top;if(o&&h<Math.min(O,f)?o=!1:!o&&f<Math.min(O,h)&&(o=!0),O<=(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 y=i.bottom-t.bottom;y>=g||y>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 wzt(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 ej(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 xzt{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(Ma);this.optionContent=wzt(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=ej(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(Ma).closeOnBlur&&l.relatedTarget!=t.contentDOM&&t.dispatch({effects:W_.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=ej(s.length,a,t.state.facet(Ma).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=ej(n.options.length,n.selected,this.view.state.facet(Ma).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=>Xl(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&&$zt(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(Ma).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 Szt(e,t){return n=>new xzt(n,e,t)}function $zt(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 O0e(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function kzt(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(Ma);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 h0e(d,c.source,u?u(d):[],1e9-n.length));else{let d=t.sliceDoc(c.from,c.to),h,f=s.filterStrict?new yzt(d):new vzt(d);for(let O of c.result.options)if(h=f.match(O.label)){let g=O.displayLabel?u?u(O,h.matched):[]:h.matched;i(new h0e(O,c.source,g,h.score+(O.boost||0)))}}}if(r){let c=Object.create(null),u=0,d=(h,f)=>{var O,g;return((O=h.rank)!==null&&O!==void 0?O: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):O0e(c.completion)>O0e(o)&&(a[a.length-1]=c),o=c.completion}return a}class qb{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 qb(this.options,g0e(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=kzt(t,n);if(!o.length)return i&&t.some(c=>c.isPending)?i.setDisabled():null;let l=n.facet(Ma).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 qb(o,g0e(r,l),{pos:t.reduce((c,u)=>u.hasResult()?Math.min(c,u.from):c,1e8),create:Qzt,above:s.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(t){return new qb(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 qb(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class nA{constructor(t,n,r){this.active=t,this.id=n,this.open=r}static start(){return new nA(Czt,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(Ma),s=(r.override||n.languageDataAt("autocomplete",F0(n)).map(mzt)).map(l=>(this.active.find(u=>u.source==l)||new bu(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(LJ));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||s.some(l=>l.hasResult()&&t.changes.touchesRange(l.from,l.to))||!Tzt(s,this.active)||o?a=qb.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 bu(l.source,0):l));for(let l of t.effects)l.is(I6e)&&(a=a&&a.setSelected(l.value,this.id));return s==this.active&&a==this.open?this:new nA(s,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?_zt:Pzt}}function Tzt(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 _zt={"aria-autocomplete":"list"},Pzt={};function g0e(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const Czt=[];function X6e(e,t){if(e.isUserEvent("input.complete")){let r=e.annotation(jJ);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 bu{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=X6e(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new bu(i.source,0)),r&4&&i.state==0&&(i=new bu(this.source,1)),i=i.updateFor(t,r);for(let s of t.effects)if(s.is(tA))i=new bu(i.source,1,s.value);else if(s.is(W_))i=new bu(i.source,0);else if(s.is(LJ))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(F0(t.state))}}class g1 extends bu{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=F0(t.state);if(o>a||!i||n&2&&(F0(t.startState)==this.from||o<this.limit))return new bu(this.source,n&4?1:0);let l=t.changes.mapPos(this.limit);return Ezt(i.validFor,t.state,s,a)?new g1(this.source,this.explicit,l,i,s,a):i.update&&(i=i.update(i,s,a,new MJ(t.state,o,!1)))?new g1(this.source,this.explicit,l,i,i.from,(r=i.to)!==null&&r!==void 0?r:F0(t.state)):new bu(this.source,1,this.explicit)}map(t){return t.empty?this:(this.result.map?this.result.map(this.result,t):this.result)?new g1(this.source,this.explicit,t.mapPos(this.limit),this.result,t.mapPos(this.from),t.mapPos(this.to,1)):new bu(this.source,0)}touches(t){return t.changes.touchesRange(this.from,this.to)}}function Ezt(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e=="function"?e(i,n,r,t):N6e(e,!0).test(i)}const LJ=Yn.define({map(e,t){return e.map(n=>n.map(t))}}),I6e=Yn.define(),Ql=Va.define({create(){return nA.start()},update(e,t){return e.update(t)},provide:e=>[QJ.from(e,t=>t.tooltip),At.contentAttributes.from(e,t=>t.attrs)]});function qJ(e,t){const n=t.completion.apply||t.completion.label;let r=e.state.field(Ql).active.find(i=>i.source==t.source);return r instanceof g1?(typeof n=="string"?e.dispatch(Object.assign(Object.assign({},gzt(e.state,n,r.from,r.to)),{annotations:jJ.of(t.completion)})):n(e,t.completion,r.from,r.to),!0):!1}const Qzt=Szt(Ql,qJ);function cE(e,t="option"){return n=>{let r=n.state.field(Ql,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(Ma).interactionDelay)return!1;let i=1,s;t=="page"&&(s=l6e(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:I6e.of(o)}),!0}}const Rzt=e=>{let t=e.state.field(Ql,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(Ma).interactionDelay?!1:qJ(e,t.open.options[t.open.selected])},m0e=e=>e.state.field(Ql,!1)?(e.dispatch({effects:tA.of(!0)}),!0):!1,Azt=e=>{let t=e.state.field(Ql,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:W_.of(null)}),!0)};class Dzt{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const Nzt=50,Xzt=1e3,Izt=vs.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(Ql).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(Ql),n=e.state.facet(Ma);if(!e.selectionSet&&!e.docChanged&&e.startState.field(Ql)==t)return;let r=e.transactions.some(s=>{let a=X6e(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>Nzt&&Date.now()-a.time>Xzt){for(let o of a.context.abortListeners)try{o()}catch(l){Xl(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(tA)))&&(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(Ql);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(Ma).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=F0(t),r=new MJ(t,n,e.explicit,this.view),i=new Dzt(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:W_.of(null)}),Xl(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(Ma).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(Ma),r=this.view.state.field(Ql);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=F0(s.updates.length?s.updates[0].startState:this.view.state),l=Math.min(o,s.done.from+(s.active.explicit?0:1)),c=new g1(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 bu(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:LJ.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(Ql,!1);if(t&&t.tooltip&&this.view.state.facet(Ma).closeOnBlur){let n=t.open&&l6e(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:W_.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:tA.of(!1)}),20),this.composing=0}}}),Fzt=typeof navigator=="object"&&/Win/.test(navigator.platform),Mzt=cO.highest(At.domEventHandlers({keydown(e,t){let n=t.state.field(Ql,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(Fzt&&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&&qJ(t,r),!1}})),F6e=At.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 jzt{constructor(t,n,r,i){this.field=t,this.line=n,this.from=r,this.to=i}}class zJ{constructor(t,n,r){this.field=t,this.from=n,this.to=r}map(t){let n=t.mapPos(this.from,-1,oo.TrackDel),r=t.mapPos(this.to,1,oo.TrackDel);return n==null||r==null?null:new zJ(this.field,n,r)}}class UJ{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(Mx);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 zJ(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 jzt(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 UJ(r,i)}}let Lzt=Kt.widget({widget:new class extends zd{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),qzt=Kt.mark({class:"cm-snippetField"});class Lx{constructor(t,n){this.ranges=t,this.active=n,this.deco=Kt.set(t.map(r=>(r.from==r.to?Lzt:qzt).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 Lx(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 g2=Yn.define({map(e,t){return e&&e.map(t)}}),zzt=Yn.define(),G_=Va.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(g2))return n.value;if(n.is(zzt)&&e)return new Lx(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=>At.decorations.from(e,t=>t?t.deco:Kt.none)});function WJ(e,t){return He.create(e.filter(n=>n.field==t).map(n=>He.range(n.from,n.to)))}function Uzt(e){let t=UJ.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:Vr.of(a)},scrollIntoView:!0,annotations:r?[jJ.of(r),ua.userEvent.of("input.complete")]:void 0};if(o.length&&(c.selection=WJ(o,0)),o.some(u=>u.field>0)){let u=new Lx(o,0),d=c.effects=[g2.of(u)];n.state.field(G_,!1)===void 0&&d.push(Yn.appendConfig.of([G_,Yzt,Zzt,F6e]))}n.dispatch(n.state.update(c))}}function M6e(e){return({state:t,dispatch:n})=>{let r=t.field(G_,!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:WJ(r.ranges,i),effects:g2.of(s?null:new Lx(r.ranges,i)),scrollIntoView:!0})),!0}}const Wzt=({state:e,dispatch:t})=>e.field(G_,!1)?(t(e.update({effects:g2.of(null)})),!0):!1,Gzt=M6e(1),Vzt=M6e(-1),Bzt=[{key:"Tab",run:Gzt,shift:Vzt},{key:"Escape",run:Wzt}],v0e=Jt.define({combine(e){return e.length?e[0]:Bzt}}),Yzt=cO.highest(dy.compute([v0e],e=>e.facet(v0e)));function Li(e,t){return Object.assign(Object.assign({},t),{apply:Uzt(e)})}const Zzt=At.domEventHandlers({mousedown(e,t){let n=t.state.field(G_,!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:WJ(n.ranges,i.field),effects:g2.of(n.ranges.some(s=>s.field>i.field)?new Lx(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),V_={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},_0=Yn.define({map(e,t){let n=t.mapPos(e,-1,oo.TrackAfter);return n??void 0}}),GJ=new class extends Sv{};GJ.startSide=1;GJ.endSide=-1;const j6e=Va.define({create(){return Ir.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(_0)&&(e=e.update({add:[GJ.range(n.value,n.value+1)]}));return e}});function Hzt(){return[Jzt,j6e]}const tj="()[]{}<>«»»«[]{}";function L6e(e){for(let t=0;t<tj.length;t+=2)if(tj.charCodeAt(t)==e)return tj.charAt(t+1);return gJ(e<128?e:e+1)}function q6e(e,t){return e.languageDataAt("closeBrackets",t)[0]||V_}const Kzt=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Jzt=At.inputHandler.of((e,t,n,r)=>{if((Kzt?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||r.length==2&&_h(Cl(r,0))==1||t!=i.from||n!=i.to)return!1;let s=nUt(e.state,r);return s?(e.dispatch(s),!0):!1}),eUt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=q6e(e,e.selection.main.head).brackets||V_.brackets,i=null,s=e.changeByRange(a=>{if(a.empty){let o=rUt(e.doc,a.head);for(let l of r)if(l==o&&PN(e.doc,a.head)==L6e(Cl(l,0)))return{changes:{from:a.head-l.length,to:a.head+l.length},range:He.cursor(a.head-l.length)}}return{range:i=a}});return i||t(e.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},tUt=[{key:"Backspace",run:eUt}];function nUt(e,t){let n=q6e(e,e.selection.main.head),r=n.brackets||V_.brackets;for(let i of r){let s=L6e(Cl(i,0));if(t==i)return s==i?aUt(e,i,r.indexOf(i+i+i)>-1,n):iUt(e,i,s,n.before||V_.before);if(t==s&&z6e(e,e.selection.main.from))return sUt(e,i,s)}return null}function z6e(e,t){let n=!1;return e.field(j6e).between(0,e.doc.length,r=>{r==t&&(n=!0)}),n}function PN(e,t){let n=e.sliceString(t,t+2);return n.slice(0,_h(Cl(n,0)))}function rUt(e,t){let n=e.sliceString(t-2,t);return _h(Cl(n,0))==n.length?n:n.slice(1)}function iUt(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:_0.of(a.to+t.length),range:He.range(a.anchor+t.length,a.head+t.length)};let o=PN(e.doc,a.head);return!o||/\s/.test(o)||r.indexOf(o)>-1?{changes:{insert:t+n,from:a.head},effects:_0.of(a.head+t.length),range:He.cursor(a.head+t.length)}:{range:i=a}});return i?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function sUt(e,t,n){let r=null,i=e.changeByRange(s=>s.empty&&PN(e.doc,s.head)==n?{changes:{from:s.head,to:s.head+n.length,insert:n},range:He.cursor(s.head+n.length)}:r={range:s});return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function aUt(e,t,n,r){let i=r.stringPrefixes||V_.stringPrefixes,s=null,a=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:t,from:o.to}],effects:_0.of(o.to+t.length),range:He.range(o.anchor+t.length,o.head+t.length)};let l=o.head,c=PN(e.doc,l),u;if(c==t){if(y0e(e,l))return{changes:{insert:t+t,from:l},effects:_0.of(l+t.length),range:He.cursor(l+t.length)};if(z6e(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:He.cursor(l+h.length)}}}else{if(n&&e.sliceDoc(l-2*t.length,l)==t+t&&(u=b0e(e,l-2*t.length,i))>-1&&y0e(e,u))return{changes:{insert:t+t+t+t,from:l},effects:_0.of(l+t.length),range:He.cursor(l+t.length)};if(e.charCategorizer(l)(c)!=ss.Word&&b0e(e,l,i)>-1&&!oUt(e,l,t,i))return{changes:{insert:t+t,from:l},effects:_0.of(l+t.length),range:He.cursor(l+t.length)}}return{range:s=o}});return s?null:e.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function y0e(e,t){let n=Lr(e).resolveInner(t+1);return n.parent&&n.from==t}function oUt(e,t,n,r){let i=Lr(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 b0e(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=ss.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))!=ss.Word)return s}return-1}function lUt(e={}){return[Mzt,Ql,Ma.of(e),Izt,cUt,F6e]}const U6e=[{key:"Ctrl-Space",run:m0e},{mac:"Alt-`",run:m0e},{key:"Escape",run:Azt},{key:"ArrowDown",run:cE(!0)},{key:"ArrowUp",run:cE(!1)},{key:"PageDown",run:cE(!0,"page")},{key:"PageUp",run:cE(!1,"page")},{key:"Enter",run:Rzt}],cUt=cO.highest(dy.computeN([Ma],e=>e.facet(Ma).defaultKeymap?[U6e]:[]));class rA{static create(t,n,r,i,s){let a=i+(i<<8)+t+(n<<4)|0;return new rA(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=[[Wn.contextHash,i]]}addChild(t,n){t.prop(Wn.contextHash)!=this.hash&&(t=new $r(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 $r(t.types[this.type],this.children,this.positions,n-this.from).balance({makeTree:(i,s,a)=>new $r(ha.none,i,s,a,this.hashProp)})}}var Ct;(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"})(Ct||(Ct={}));class uUt{constructor(t,n){this.start=t,this.content=n,this.marks=[],this.parsers=[]}}class dUt{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 wk(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 w0e(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==Ct.OrderedList?YJ:BJ)(n,t,!1);return r>0&&(e.type!=Ct.BulletList||VJ(n,t,!1)<0)&&n.text.charCodeAt(n.pos+r-1)==e.value}const W6e={[Ct.Blockquote](e,t,n){return n.next!=62?!1:(n.markers.push(Er(Ct.QuoteMark,t.lineStart+n.pos,t.lineStart+n.pos+1)),n.moveBase(n.pos+(Uu(n.text.charCodeAt(n.pos+1))?2:1)),e.end=t.lineStart+n.text.length,!0)},[Ct.ListItem](e,t,n){return n.indent<n.baseIndent+e.value&&n.next>-1?!1:(n.moveBaseColumn(n.baseIndent+e.value),!0)},[Ct.OrderedList]:w0e,[Ct.BulletList]:w0e,[Ct.Document](){return!0}};function Uu(e){return e==32||e==9||e==10||e==13}function wk(e,t=0){for(;t<e.length&&Uu(e.charCodeAt(t));)t++;return t}function x0e(e,t,n){for(;t>n&&Uu(e.charCodeAt(t-1));)t--;return t}function G6e(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 V6e(e){return e.next!=62?-1:e.text.charCodeAt(e.pos+1)==32?2:1}function VJ(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(!Uu(s))return-1}return n&&e.next==45&&Z6e(e)>-1&&e.depth==t.stack.length&&t.parser.leafBlockParsers.indexOf(eIe.SetextHeading)>-1||r<3?-1:1}function B6e(e,t){for(let n=e.stack.length-1;n>=0;n--)if(e.stack[n].type==t)return!0;return!1}function BJ(e,t,n){return(e.next==45||e.next==43||e.next==42)&&(e.pos==e.text.length-1||Uu(e.text.charCodeAt(e.pos+1)))&&(!n||B6e(t,Ct.BulletList)||e.skipSpace(e.pos+2)<e.text.length)?1:-1}function YJ(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&&!Uu(e.text.charCodeAt(r+1))||n&&!B6e(t,Ct.OrderedList)&&(e.skipSpace(r+1)==e.text.length||r>e.pos+1||e.next!=49)?-1:r+1-e.pos}function Y6e(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 Z6e(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&&Uu(e.text.charCodeAt(t));)t++;return t==e.text.length?n:-1}const iV=/^[ \t]*$/,H6e=/-->/,K6e=/\?>/,sV=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,H6e],[/^\s*<\?/,K6e],[/^\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,iV],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,iV]];function J6e(e,t,n){if(e.next!=60)return-1;let r=e.text.slice(e.pos);for(let i=0,s=sV.length-(n?1:0);i<s;i++)if(sV[i][0].test(r))return i;return-1}function S0e(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 zm(e,t,n){let r=e.length-1;r>=0&&e[r].to==t&&e[r].type==Ct.CodeText?e[r].to=n:e.push(Er(Ct.CodeText,t,n))}const uE={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(zm(a,i,s);e.nextLine()&&t.depth>=e.stack.length;)if(t.pos==t.text.length){zm(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==Ct.CodeText?zm(a,c.from,c.to):a.push(c);o=[]}zm(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&&zm(a,l,s)}}return o.length&&(o=o.filter(l=>l.type!=Ct.CodeText),o.length&&(t.markers=o.concat(t.markers))),e.addNode(e.buffer.writeElements(a,-i).finish(Ct.CodeBlock,s-i),i),!0},FencedCode(e,t){let n=G6e(t);if(n<0)return!1;let r=e.lineStart+t.pos,i=t.next,s=n-t.pos,a=t.skipSpace(n),o=x0e(t.text,t.text.length,a),l=[Er(Ct.CodeMark,r,r+s)];a<o&&l.push(Er(Ct.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(Er(Ct.CodeMark,e.lineStart+t.pos,e.lineStart+u)),e.nextLine();break}else{c||zm(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&&zm(l,d,h)}}return e.addNode(e.buffer.writeElements(l,-r).finish(Ct.FencedCode,e.prevLineEnd()-r),r),!0},Blockquote(e,t){let n=V6e(t);return n<0?!1:(e.startContext(Ct.Blockquote,t.pos),e.addNode(Ct.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1),t.moveBase(t.pos+n),null)},HorizontalRule(e,t){if(VJ(t,e,!1)<0)return!1;let n=e.lineStart+t.pos;return e.nextLine(),e.addNode(Ct.HorizontalRule,n),!0},BulletList(e,t){let n=BJ(t,e,!1);if(n<0)return!1;e.block.type!=Ct.BulletList&&e.startContext(Ct.BulletList,t.basePos,t.next);let r=S0e(t,t.pos+1);return e.startContext(Ct.ListItem,t.basePos,r-t.baseIndent),e.addNode(Ct.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},OrderedList(e,t){let n=YJ(t,e,!1);if(n<0)return!1;e.block.type!=Ct.OrderedList&&e.startContext(Ct.OrderedList,t.basePos,t.text.charCodeAt(t.pos+n-1));let r=S0e(t,t.pos+n);return e.startContext(Ct.ListItem,t.basePos,r-t.baseIndent),e.addNode(Ct.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},ATXHeading(e,t){let n=Y6e(t);if(n<0)return!1;let r=t.pos,i=e.lineStart+r,s=x0e(t.text,t.text.length,r),a=s;for(;a>r&&t.text.charCodeAt(a-1)==t.next;)a--;(a==s||a==r||!Uu(t.text.charCodeAt(a-1)))&&(a=t.text.length);let o=e.buffer.write(Ct.HeaderMark,0,n).writeElements(e.parser.parseInline(t.text.slice(r+n+1,a),i+n+1),-i);a<t.text.length&&o.write(Ct.HeaderMark,a-r,s-r);let l=o.finish(Ct.ATXHeading1-1+n,t.text.length-r);return e.nextLine(),e.addNode(l,i),!0},HTMLBlock(e,t){let n=J6e(t,e,!1);if(n<0)return!1;let r=e.lineStart+t.pos,i=sV[n][1],s=[],a=i!=iV;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==H6e?Ct.CommentBlock:i==K6e?Ct.ProcessingInstructionBlock:Ct.HTMLBlock,l=e.prevLineEnd();return e.addNode(e.buffer.writeElements(s,-r).finish(o,l-r),r),!0},SetextHeading:void 0};class hUt{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+`
|
|
1204
1204
|
`+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)&&wk(n.content,this.pos)==n.content.length?this.complete(t,n,n.content.length):!1}complete(t,n,r){return t.addLeafElement(n,Er(Ct.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(cIe(t,this.pos,this.start,!0)))return-1;if(t.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(Er(Ct.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(oIe(t,wk(t,this.pos),this.start)))return-1}else if(this.stage==2){let n=wk(t,this.pos),r=0;if(n>this.pos){let i=lIe(t,n,this.start);if(i){let s=nj(t,i.to-this.start);s>0&&(this.nextStage(i),r=s)}}return r||(r=nj(t,this.pos)),r>0&&r<t.length?r:-1}else return nj(t,this.pos)}}}function nj(e,t){for(;t<e.length;t++){let n=e.charCodeAt(t);if(n==10)break;if(!Uu(n))return-1}return t}class fUt{nextLine(t,n,r){let i=n.depth<t.stack.length?-1:Z6e(n),s=n.next;if(i<0)return!1;let a=Er(Ct.HeaderMark,t.lineStart+n.pos,t.lineStart+i);return t.nextLine(),t.addLeafElement(r,Er(s==61?Ct.SetextHeading1:Ct.SetextHeading2,r.start,t.prevLineEnd(),[...t.parser.parseInline(r.content,r.start),a])),!0}finish(){return!1}}const eIe={LinkReference(e,t){return t.content.charCodeAt(0)==91?new hUt(t):null},SetextHeading(){return new fUt}},pUt=[(e,t)=>Y6e(t)>=0,(e,t)=>G6e(t)>=0,(e,t)=>V6e(t)>=0,(e,t)=>BJ(t,e,!0)>=0,(e,t)=>YJ(t,e,!0)>=0,(e,t)=>VJ(t,e,!0)>=0,(e,t)=>J6e(t,e,!0)>=0],OUt={text:"",end:0};class gUt{constructor(t,n,r,i){this.parser=t,this.input=n,this.ranges=i,this.line=new dUt,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=rA.create(Ct.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=r.length?new bUt(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 uUt(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+=`
|
|
1205
1205
|
`+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=uIe(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=OUt;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 "+Ct[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==`
|
|
1206
1206
|
`?"":n;else{let i=n.indexOf(`
|
|
@@ -1453,7 +1453,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),Hl=at,Ur=Ht);const vl=
|
|
|
1453
1453
|
* LICENSE file in the root directory of this source tree.
|
|
1454
1454
|
*/var QTe;function vJn(){if(QTe)return m$;QTe=1;var e=H,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 m$.Fragment=n,m$.jsx=a,m$.jsxs=a,m$}var RTe;function yJn(){return RTe||(RTe=1,ETe.exports=vJn()),ETe.exports}var bJn=yJn();/*! shepherd.js 14.5.0 */function wJn(e){return e instanceof Element}function lx(e){return e instanceof HTMLElement}function Jg(e){return typeof e=="function"}function IP(e){return typeof e=="string"}function Do(e){return e===void 0}class Jne{on(t,n,r,i=!1){var s;return Do(this.bindings)&&(this.bindings={}),Do(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(Do(this.bindings)||Do(this.bindings[t]))return this;if(Do(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(!Do(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 zl(){return zl=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},zl.apply(null,arguments)}function ere(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 Sm={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")};Sm.defaultMerge;function xJn(e,t){return t}function SJn(e,t){return e.filter(n=>n!==void 0)}var ATe;(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"})(ATe||(ATe={}));function DTe(e){return typeof e!="object"||e===null?0:Array.isArray(e)?2:TJn(e)?1:e instanceof Set?3:e instanceof Map?4:5}function $Jn(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 kJn(e,t){return typeof e=="object"&&Object.prototype.propertyIsEnumerable.call(e,t)}function jYe(e){return{*[Symbol.iterator](){for(const t of e)for(const n of t)yield n}}}const NTe=new Set(["[object Object]","[object Module]"]);function TJn(e){if(!NTe.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"||!NTe.has(Object.prototype.toString.call(n))||!n.hasOwnProperty("isPrototypeOf"))}function _Jn(e,t,n){const r={};for(const i of $Jn(e)){const s=[];for(const l of e)kJn(l,i)&&s.push(l[i]);if(s.length===0)continue;const a=t.metaDataUpdater(n,{key:i,parents:e}),o=LYe(s,t,a);o!==Sm.skip&&(i==="__proto__"?Object.defineProperty(r,i,{value:o,configurable:!0,enumerable:!0,writable:!0}):r[i]=o)}return r}function PJn(e){return e.flat()}function CJn(e){return new Set(jYe(e))}function EJn(e){return new Map(jYe(e))}function QJn(e){return e.at(-1)}const kQ={mergeRecords:_Jn,mergeArrays:PJn,mergeSets:CJn,mergeMaps:EJn,mergeOthers:QJn};function tre(...e){return RJn({})(...e)}function RJn(e,t){const n=AJn(e,r);function r(...i){return LYe(i,n,t)}return r}function AJn(e,t){var n,r,i;return{defaultMergeFunctions:kQ,mergeFunctions:zl({},kQ,Object.fromEntries(Object.entries(e).filter(([s,a])=>Object.hasOwn(kQ,s)).map(([s,a])=>a===!1?[s,kQ.mergeOthers]:[s,a]))),metaDataUpdater:(n=e.metaDataUpdater)!=null?n:xJn,deepmerge:t,useImplicitDefaultMerging:(r=e.enableImplicitDefaultMerging)!=null?r:!1,filterValues:e.filterValues===!1?void 0:(i=e.filterValues)!=null?i:SJn,actions:Sm}}function LYe(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 Iq(i,t,n);const s=DTe(i[0]);if(s!==0&&s!==5){for(let a=1;a<i.length;a++)if(DTe(i[a])!==s)return Iq(i,t,n)}switch(s){case 1:return DJn(i,t,n);case 2:return NJn(i,t,n);case 3:return XJn(i,t,n);case 4:return IJn(i,t,n);default:return Iq(i,t,n)}}function DJn(e,t,n){const r=t.mergeFunctions.mergeRecords(e,t,n);return r===Sm.defaultMerge||t.useImplicitDefaultMerging&&r===void 0&&t.mergeFunctions.mergeRecords!==t.defaultMergeFunctions.mergeRecords?t.defaultMergeFunctions.mergeRecords(e,t,n):r}function NJn(e,t,n){const r=t.mergeFunctions.mergeArrays(e,t,n);return r===Sm.defaultMerge||t.useImplicitDefaultMerging&&r===void 0&&t.mergeFunctions.mergeArrays!==t.defaultMergeFunctions.mergeArrays?t.defaultMergeFunctions.mergeArrays(e):r}function XJn(e,t,n){const r=t.mergeFunctions.mergeSets(e,t,n);return r===Sm.defaultMerge||t.useImplicitDefaultMerging&&r===void 0&&t.mergeFunctions.mergeSets!==t.defaultMergeFunctions.mergeSets?t.defaultMergeFunctions.mergeSets(e):r}function IJn(e,t,n){const r=t.mergeFunctions.mergeMaps(e,t,n);return r===Sm.defaultMerge||t.useImplicitDefaultMerging&&r===void 0&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps?t.defaultMergeFunctions.mergeMaps(e):r}function Iq(e,t,n){const r=t.mergeFunctions.mergeOthers(e,t,n);return r===Sm.defaultMerge||t.useImplicitDefaultMerging&&r===void 0&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(e):r}function nre(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 FJn(e,t){return n=>{if(e.isOpen()){const r=e.el&&n.currentTarget===e.el;(!Do(t)&&n.currentTarget.matches(t)||r)&&e.tour.next()}}}function MJn(e){const{event:t,selector:n}=e.options.advanceOn||{};if(t){const r=FJn(e,n);let i=null;if(!Do(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 jJn{constructor(t){}}class LJn{constructor(t,n){}}function qYe(e){return!IP(e)||e===""?"":e.charAt(e.length-1)!=="-"?`${e}-`:e}function qJn(e){const t=e.options.attachTo||{},n=Object.assign({},t);if(Jg(n.element)&&(n.element=n.element.call(e)),IP(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 zJn(e){return e.options.extraHighlights?e.options.extraHighlights.flatMap(t=>Array.from(document.querySelectorAll(t))):[]}function zYe(e){return e==null?!0:!e.element||!e.on}function UYe(){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 UJn=["top","right","bottom","left"],XTe=["start","end"],ITe=UJn.reduce((e,t)=>e.concat(t,t+"-"+XTe[0],t+"-"+XTe[1]),[]),cx=Math.min,tv=Math.max,A3=Math.round,TQ=Math.floor,Kh=e=>({x:e,y:e}),WJn={left:"right",right:"left",bottom:"top",top:"bottom"},GJn={start:"end",end:"start"};function _Y(e,t,n){return tv(e,cx(t,n))}function Yv(e,t){return typeof e=="function"?e(t):e}function eO(e){return e.split("-")[0]}function Ap(e){return e.split("-")[1]}function rre(e){return e==="x"?"y":"x"}function ire(e){return e==="y"?"height":"width"}function ux(e){return["top","bottom"].includes(eO(e))?"y":"x"}function sre(e){return rre(ux(e))}function WYe(e,t,n){n===void 0&&(n=!1);const r=Ap(e),i=sre(e),s=ire(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=N3(a)),[a,N3(a)]}function VJn(e){const t=N3(e);return[D3(e),t,D3(t)]}function D3(e){return e.replace(/start|end/g,t=>GJn[t])}function BJn(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 YJn(e,t,n,r){const i=Ap(e);let s=BJn(eO(e),n==="start",r);return i&&(s=s.map(a=>a+"-"+i),t&&(s=s.concat(s.map(D3)))),s}function N3(e){return e.replace(/left|right|bottom|top/g,t=>WJn[t])}function ZJn(e){return zl({top:0,right:0,bottom:0,left:0},e)}function GYe(e){return typeof e!="number"?ZJn(e):{top:e,right:e,bottom:e,left:e}}function X3(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 HJn=["crossAxis","alignment","allowedPlacements","autoAlignment"],KJn=["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"],JJn=["mainAxis","crossAxis","limiter"];function FTe(e,t,n){let{reference:r,floating:i}=e;const s=ux(t),a=sre(t),o=ire(a),l=eO(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(Ap(t)){case"start":f[a]-=h*(n&&c?-1:1);break;case"end":f[a]+=h*(n&&c?-1:1);break}return f}const eer=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}=FTe(c,r,l),h=r,f={},O=0;for(let g=0;g<o.length;g++){const{name:m,fn:v}=o[g],{x:y,y:w,data:k,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=y??u,d=w??d,f=zl({},f,{[m]:zl({},f[m],k)}),x&&O<=50&&(O++,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}=FTe(c,h,l)),g=-1)}return{x:u,y:d,placement:h,strategy:i,middlewareData:f}};async function are(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}=Yv(t,e),O=GYe(f),g=o[h?d==="floating"?"reference":"floating":d],m=X3(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,y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(o.floating)),w=await(s.isElement==null?void 0:s.isElement(y))?await(s.getScale==null?void 0:s.getScale(y))||{x:1,y:1}:{x:1,y:1},k=X3(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:v,offsetParent:y,strategy:l}):v);return{top:(m.top-k.top+O.top)/w.y,bottom:(k.bottom-m.bottom+O.bottom)/w.y,left:(m.left-k.left+O.left)/w.x,right:(k.right-m.right+O.right)/w.x}}const ter=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}=Yv(e,t)||{};if(c==null)return{};const d=GYe(u),h={x:n,y:r},f=sre(i),O=ire(f),g=await a.getDimensions(c),m=f==="y",v=m?"top":"left",y=m?"bottom":"right",w=m?"clientHeight":"clientWidth",k=s.reference[O]+s.reference[f]-h[f]-s.floating[O],x=h[f]-s.reference[f],S=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c));let T=S?S[w]:0;(!T||!await(a.isElement==null?void 0:a.isElement(S)))&&(T=o.floating[w]||s.floating[O]);const _=k/2-x/2,P=T/2-g[O]/2-1,E=cx(d[v],P),C=cx(d[y],P),Q=E,D=T-g[O]-C,F=T/2-g[O]/2+_,I=_Y(Q,F,D),U=!l.arrow&&Ap(i)!=null&&F!==I&&s.reference[O]/2-(F<Q?E:C)-g[O]/2<0,q=U?F<Q?F-Q:F-D:0;return{[f]:h[f]+q,data:zl({[f]:I,centerOffset:F-I-q},U&&{alignmentOffset:q}),reset:U}}});function ner(e,t,n){return(e?[...n.filter(r=>Ap(r)===e),...n.filter(r=>Ap(r)!==e)]:n.filter(r=>eO(r)===r)).filter(r=>e?Ap(r)===e||(t?D3(r)!==r:!1):!0)}const rer=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=Yv(e,t),{crossAxis:d=!1,alignment:h,allowedPlacements:f=ITe,autoAlignment:O=!0}=u,g=ere(u,HJn),m=h!==void 0||f===ITe?ner(h||null,O,f):f,v=await are(t,g),y=((n=a.autoPlacement)==null?void 0:n.index)||0,w=m[y];if(w==null)return{};const k=WYe(w,s,await(l.isRTL==null?void 0:l.isRTL(c.floating)));if(o!==w)return{reset:{placement:m[0]}};const x=[v[eO(w)],v[k[0]],v[k[1]]],S=[...((r=a.autoPlacement)==null?void 0:r.overflows)||[],{placement:w,overflows:x}],T=m[y+1];if(T)return{data:{index:y+1,overflows:S},reset:{placement:T}};const _=S.map(E=>{const C=Ap(E.placement);return[E.placement,C&&d?E.overflows.slice(0,2).reduce((Q,D)=>Q+D,0):E.overflows[0],E.overflows]}).sort((E,C)=>E[1]-C[1]),P=((i=_.filter(E=>E[2].slice(0,Ap(E[0])?2:3).every(C=>C<=0))[0])==null?void 0:i[0])||_[0][0];return P!==o?{data:{index:y+1,overflows:S},reset:{placement:P}}:{}}}},ier=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=Yv(e,t),{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:f,fallbackStrategy:O="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:m=!0}=u,v=ere(u,KJn);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=eO(i),w=ux(o),k=eO(o)===o,x=await(l.isRTL==null?void 0:l.isRTL(c.floating)),S=f||(k||!m?[N3(o)]:VJn(o)),T=g!=="none";!f&&T&&S.push(...YJn(o,m,g,x));const _=[o,...S],P=await are(t,v),E=[];let C=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&E.push(P[y]),h){const I=WYe(i,a,x);E.push(P[I[0]],P[I[1]])}if(C=[...C,{placement:i,overflows:E}],!E.every(I=>I<=0)){var Q,D;const I=(((Q=s.flip)==null?void 0:Q.index)||0)+1,U=_[I];if(U)return{data:{index:I,overflows:C},reset:{placement:U}};let q=(D=C.filter(Z=>Z.overflows[0]<=0).sort((Z,W)=>Z.overflows[1]-W.overflows[1])[0])==null?void 0:D.placement;if(!q)switch(O){case"bestFit":{var F;const Z=(F=C.filter(W=>{if(T){const M=ux(W.placement);return M===w||M==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(M=>M>0).reduce((M,J)=>M+J,0)]).sort((W,M)=>W[1]-M[1])[0])==null?void 0:F[0];Z&&(q=Z);break}case"initialPlacement":q=o;break}if(i!==q)return{reset:{placement:q}}}return{}}}},ser=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,s=Yv(e,t),{mainAxis:a=!0,crossAxis:o=!1,limiter:l={fn:v=>{let{x:y,y:w}=v;return{x:y,y:w}}}}=s,c=ere(s,JJn),u={x:n,y:r},d=await are(t,c),h=ux(eO(i)),f=rre(h);let O=u[f],g=u[h];if(a){const v=f==="y"?"top":"left",y=f==="y"?"bottom":"right",w=O+d[v],k=O-d[y];O=_Y(w,O,k)}if(o){const v=h==="y"?"top":"left",y=h==="y"?"bottom":"right",w=g+d[v],k=g-d[y];g=_Y(w,g,k)}const m=l.fn(zl({},t,{[f]:O,[h]:g}));return zl({},m,{data:{x:m.x-n,y:m.y-r}})}}},aer=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}=Yv(e,t),u={x:n,y:r},d=ux(i),h=rre(d);let f=u[h],O=u[d];const g=Yv(o,t),m=typeof g=="number"?{mainAxis:g,crossAxis:0}:zl({mainAxis:0,crossAxis:0},g);if(l){const w=h==="y"?"height":"width",k=s.reference[h]-s.floating[w]+m.mainAxis,x=s.reference[h]+s.reference[w]-m.mainAxis;f<k?f=k:f>x&&(f=x)}if(c){var v,y;const w=h==="y"?"width":"height",k=["top","left"].includes(eO(i)),x=s.reference[d]-s.floating[w]+(k&&((v=a.offset)==null?void 0:v[d])||0)+(k?0:m.crossAxis),S=s.reference[d]+s.reference[w]+(k?0:((y=a.offset)==null?void 0:y[d])||0)-(k?m.crossAxis:0);O<x?O=x:O>S&&(O=S)}return{[h]:f,[d]:O}}}};function LX(){return typeof window<"u"}function nS(e){return VYe(e)?(e.nodeName||"").toLowerCase():"#document"}function Dc(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function kf(e){var t;return(t=(VYe(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function VYe(e){return LX()?e instanceof Node||e instanceof Dc(e).Node:!1}function Fd(e){return LX()?e instanceof Element||e instanceof Dc(e).Element:!1}function hf(e){return LX()?e instanceof HTMLElement||e instanceof Dc(e).HTMLElement:!1}function MTe(e){return!LX()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Dc(e).ShadowRoot}function U2(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Md(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function oer(e){return["table","td","th"].includes(nS(e))}function qX(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function ore(e){const t=lre(),n=Fd(e)?Md(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 ler(e){let t=em(e);for(;hf(t)&&!dx(t);){if(ore(t))return t;if(qX(t))return null;t=em(t)}return null}function lre(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function dx(e){return["html","body","#document"].includes(nS(e))}function Md(e){return Dc(e).getComputedStyle(e)}function zX(e){return Fd(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function em(e){if(nS(e)==="html")return e;const t=e.assignedSlot||e.parentNode||MTe(e)&&e.host||kf(e);return MTe(t)?t.host:t}function BYe(e){const t=em(e);return dx(t)?e.ownerDocument?e.ownerDocument.body:e.body:hf(t)&&U2(t)?t:BYe(t)}function FP(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=BYe(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),a=Dc(i);if(s){const o=PY(a);return t.concat(a,a.visualViewport||[],U2(i)?i:[],o&&n?FP(o):[])}return t.concat(i,FP(i,[],n))}function PY(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function YYe(e){const t=Md(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=hf(e),s=i?e.offsetWidth:n,a=i?e.offsetHeight:r,o=A3(n)!==s||A3(r)!==a;return o&&(n=s,r=a),{width:n,height:r,$:o}}function cre(e){return Fd(e)?e:e.contextElement}function N1(e){const t=cre(e);if(!hf(t))return Kh(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=YYe(t);let a=(s?A3(n.width):n.width)/r,o=(s?A3(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}const cer=Kh(0);function ZYe(e){const t=Dc(e);return!lre()||!t.visualViewport?cer:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function uer(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Dc(e)?!1:t}function Zv(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=cre(e);let a=Kh(1);t&&(r?Fd(r)&&(a=N1(r)):a=N1(e));const o=uer(s,n,r)?ZYe(s):Kh(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=Dc(s),f=r&&Fd(r)?Dc(r):r;let O=h,g=PY(O);for(;g&&r&&f!==O;){const m=N1(g),v=g.getBoundingClientRect(),y=Md(g),w=v.left+(g.clientLeft+parseFloat(y.paddingLeft))*m.x,k=v.top+(g.clientTop+parseFloat(y.paddingTop))*m.y;l*=m.x,c*=m.y,u*=m.x,d*=m.y,l+=w,c+=k,O=Dc(g),g=PY(O)}}return X3({width:u,height:d,x:l,y:c})}function ure(e,t){const n=zX(e).scrollLeft;return t?t.left+n:Zv(kf(e)).left+n}function HYe(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=r.left+t.scrollLeft-(n?0:ure(e,r)),s=r.top+t.scrollTop;return{x:i,y:s}}function der(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",a=kf(r),o=t?qX(t.floating):!1;if(r===a||o&&s)return n;let l={scrollLeft:0,scrollTop:0},c=Kh(1);const u=Kh(0),d=hf(r);if((d||!d&&!s)&&((nS(r)!=="body"||U2(a))&&(l=zX(r)),hf(r))){const f=Zv(r);c=N1(r),u.x=f.x+r.clientLeft,u.y=f.y+r.clientTop}const h=a&&!d&&!s?HYe(a,l,!0):Kh(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 her(e){return Array.from(e.getClientRects())}function fer(e){const t=kf(e),n=zX(e),r=e.ownerDocument.body,i=tv(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=tv(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+ure(e);const o=-n.scrollTop;return Md(r).direction==="rtl"&&(a+=tv(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:a,y:o}}function per(e,t){const n=Dc(e),r=kf(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=lre();(!c||c&&t==="fixed")&&(o=i.offsetLeft,l=i.offsetTop)}return{width:s,height:a,x:o,y:l}}function Oer(e,t){const n=Zv(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=hf(e)?N1(e):Kh(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 jTe(e,t,n){let r;if(t==="viewport")r=per(e,n);else if(t==="document")r=fer(kf(e));else if(Fd(t))r=Oer(t,n);else{const i=ZYe(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return X3(r)}function KYe(e,t){const n=em(e);return n===t||!Fd(n)||dx(n)?!1:Md(n).position==="fixed"||KYe(n,t)}function ger(e,t){const n=t.get(e);if(n)return n;let r=FP(e,[],!1).filter(o=>Fd(o)&&nS(o)!=="body"),i=null;const s=Md(e).position==="fixed";let a=s?em(e):e;for(;Fd(a)&&!dx(a);){const o=Md(a),l=ore(a);!l&&o.position==="fixed"&&(i=null),(s?!l&&!i:!l&&o.position==="static"&&i&&["absolute","fixed"].includes(i.position)||U2(a)&&!l&&KYe(e,a))?r=r.filter(c=>c!==a):i=o,a=em(a)}return t.set(e,r),r}function mer(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?qX(t)?[]:ger(t,this._c):[].concat(n),r],a=s[0],o=s.reduce((l,c)=>{const u=jTe(t,c,i);return l.top=tv(u.top,l.top),l.right=cx(u.right,l.right),l.bottom=cx(u.bottom,l.bottom),l.left=tv(u.left,l.left),l},jTe(t,a,i));return{width:o.right-o.left,height:o.bottom-o.top,x:o.left,y:o.top}}function ver(e){const{width:t,height:n}=YYe(e);return{width:t,height:n}}function yer(e,t,n){const r=hf(t),i=kf(t),s=n==="fixed",a=Zv(e,!0,s,t);let o={scrollLeft:0,scrollTop:0};const l=Kh(0);if(r||!r&&!s)if((nS(t)!=="body"||U2(i))&&(o=zX(t)),r){const h=Zv(t,!0,s,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else i&&(l.x=ure(i));const c=i&&!r&&!s?HYe(i,o):Kh(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 Fq(e){return Md(e).position==="static"}function LTe(e,t){if(!hf(e)||Md(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return kf(e)===n&&(n=n.ownerDocument.body),n}function JYe(e,t){const n=Dc(e);if(qX(e))return n;if(!hf(e)){let i=em(e);for(;i&&!dx(i);){if(Fd(i)&&!Fq(i))return i;i=em(i)}return n}let r=LTe(e,t);for(;r&&oer(r)&&Fq(r);)r=LTe(r,t);return r&&dx(r)&&Fq(r)&&!ore(r)?n:r||ler(e)||n}const ber=async function(e){const t=this.getOffsetParent||JYe,n=this.getDimensions,r=await n(e.floating);return{reference:yer(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wer(e){return Md(e).direction==="rtl"}const xer={convertOffsetParentRelativeRectToViewportRelativeRect:der,getDocumentElement:kf,getClippingRect:mer,getOffsetParent:JYe,getElementRects:ber,getClientRects:her,getDimensions:ver,getScale:N1,isElement:Fd,isRTL:wer};function Ser(e,t){let n=null,r;const i=kf(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=TQ(u),O=TQ(i.clientWidth-(c+d)),g=TQ(i.clientHeight-(u+h)),m=TQ(c),v={rootMargin:-f+"px "+-O+"px "+-g+"px "+-m+"px",threshold:tv(0,cx(1,l))||1};let y=!0;function w(k){const x=k[0].intersectionRatio;if(x!==l){if(!y)return a();x?a(!1,x):r=setTimeout(()=>{a(!1,1e-7)},1e3)}y=!1}try{n=new IntersectionObserver(w,zl({},v,{root:i.ownerDocument}))}catch{n=new IntersectionObserver(w,v)}n.observe(e)}return a(!0),s}function $er(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=cre(e),u=i||s?[...c?FP(c):[],...FP(t)]:[];u.forEach(v=>{i&&v.addEventListener("scroll",n,{passive:!0}),s&&v.addEventListener("resize",n)});const d=c&&o?Ser(c,n):null;let h=-1,f=null;a&&(f=new ResizeObserver(v=>{let[y]=v;y&&y.target===c&&f&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=f)==null||w.observe(t)})),n()}),c&&!l&&f.observe(c),f.observe(t));let O,g=l?Zv(e):null;l&&m();function m(){const v=Zv(e);g&&(v.x!==g.x||v.y!==g.y||v.width!==g.width||v.height!==g.height)&&n(),g=v,O=requestAnimationFrame(m)}return n(),()=>{var v;u.forEach(y=>{i&&y.removeEventListener("scroll",n),s&&y.removeEventListener("resize",n)}),d?.(),(v=f)==null||v.disconnect(),f=null,l&&cancelAnimationFrame(O)}}const ker=rer,Ter=ser,_er=ier,Per=ter,Cer=aer,Eer=(e,t,n)=>{const r=new Map,i=zl({platform:xer},n),s=zl({},i.platform,{_c:r});return eer(e,t,zl({},i,{platform:s}))};function Qer(e){e.cleanup&&e.cleanup();const t=e._getResolvedAttachToOptions();let n=t.element;const r=Ier(t,e),i=zYe(t);return i&&(n=document.body,e.shepherdElementComponent.getElement().classList.add("shepherd-centered")),e.cleanup=$er(n,e.el,()=>{if(!e.el){e.cleanup==null||e.cleanup();return}Der(n,e,r,i)}),e.target=t.element,r}function Rer(e,t){return{floatingUIOptions:tre(e.floatingUIOptions||{},t.floatingUIOptions||{})}}function Aer(e){e.cleanup&&e.cleanup(),e.cleanup=null}function Der(e,t,n,r){return Eer(e,t.el,n).then(Ner(t,r)).then(i=>new Promise(s=>{setTimeout(()=>s(i),300)})).then(i=>{i!=null&&i.el&&i.el.focus({preventScroll:!0})})}function Ner(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,Xer(e.el,s)),e)}function Xer(e,t){const n=e.querySelector(".shepherd-arrow");if(lx(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 Ier(e,t){var n,r,i;const s={strategy:"absolute"};s.middleware=[];const a=Fer(t),o=zYe(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(ker({crossAxis:!0,alignment:c?e==null||(u=e.on)==null?void 0:u.split("-").pop():null}))}else s.middleware.push(_er());if(s.middleware.push(Ter({limiter:Cer(),crossAxis:!0})),a){const d=typeof t.options.arrow=="object"?t.options.arrow:{padding:4};s.middleware.push(Per({element:a,padding:c?d.padding:0}))}l||(s.placement=e.on)}return tre(s,t.options.floatingUIOptions||{})}function Fer(e){return e.options.arrow&&e.el?e.el.querySelector(".shepherd-arrow"):!1}function jc(){}function Mer(e,t){for(const n in t)e[n]=t[n];return e}function eZe(e){return e()}function qTe(){return Object.create(null)}function W2(e){e.forEach(eZe)}function dre(e){return typeof e=="function"}function gO(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function jer(e){return Object.keys(e).length===0}function hx(e,t){e.appendChild(t)}function Zd(e,t,n){e.insertBefore(t,n||null)}function Vu(e){e.parentNode&&e.parentNode.removeChild(e)}function Ler(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function ff(e){return document.createElement(e)}function zTe(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function tZe(e){return document.createTextNode(e)}function I3(){return tZe(" ")}function qer(){return tZe("")}function UX(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function Ci(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}const zer=["width","height"];function UTe(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&&zer.indexOf(r)===-1?e[r]=t[r]:Ci(e,r,t[r])}function Uer(e){return Array.from(e.childNodes)}function gb(e,t,n){e.classList.toggle(t,!!n)}let MP;function tT(e){MP=e}function nZe(){if(!MP)throw new Error("Function called outside component initialization");return MP}function Wer(e){nZe().$$.on_mount.push(e)}function hre(e){nZe().$$.after_update.push(e)}const Cb=[],fx=[];let X1=[];const WTe=[],Ger=Promise.resolve();let CY=!1;function Ver(){CY||(CY=!0,Ger.then(rZe))}function EY(e){X1.push(e)}const Mq=new Set;let mb=0;function rZe(){if(mb!==0)return;const e=MP;do{try{for(;mb<Cb.length;){const t=Cb[mb];mb++,tT(t),Ber(t.$$)}}catch(t){throw Cb.length=0,mb=0,t}for(tT(null),Cb.length=0,mb=0;fx.length;)fx.pop()();for(let t=0;t<X1.length;t+=1){const n=X1[t];Mq.has(n)||(Mq.add(n),n())}X1.length=0}while(Cb.length);for(;WTe.length;)WTe.pop()();CY=!1,Mq.clear(),tT(e)}function Ber(e){if(e.fragment!==null){e.update(),W2(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(EY)}}function Yer(e){const t=[],n=[];X1.forEach(r=>e.indexOf(r)===-1?t.push(r):n.push(r)),n.forEach(r=>r()),X1=t}const jR=new Set;let Q0;function nv(){Q0={r:0,c:[],p:Q0}}function rv(){Q0.r||W2(Q0.c),Q0=Q0.p}function hi(e,t){e&&e.i&&(jR.delete(e),e.i(t))}function js(e,t,n,r){if(e&&e.o){if(jR.has(e))return;jR.add(e),Q0.c.push(()=>{jR.delete(e),r&&(n&&e.d(1),r())}),e.o(t)}else r&&r()}function GTe(e){return e?.length!==void 0?e:Array.from(e)}function Zer(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 Ny(e){e&&e.c()}function $m(e,t,n){const{fragment:r,after_update:i}=e.$$;r&&r.m(t,n),EY(()=>{const s=e.$$.on_mount.map(eZe).filter(dre);e.$$.on_destroy?e.$$.on_destroy.push(...s):W2(s),e.$$.on_mount=[]}),i.forEach(EY)}function km(e,t){const n=e.$$;n.fragment!==null&&(Yer(n.after_update),W2(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Her(e,t){e.$$.dirty[0]===-1&&(Cb.push(e),Ver(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function mO(e,t,n,r,i,s,a=null,o=[-1]){const l=MP;tT(e);const c=e.$$={fragment:null,ctx:[],props:s,update:jc,not_equal:i,bound:qTe(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:qTe(),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 O=f.length?f[0]:h;return c.ctx&&i(c.ctx[d],c.ctx[d]=O)&&(!c.skip_bound&&c.bound[d]&&c.bound[d](O),u&&Her(e,d)),h}):[],c.update(),u=!0,W2(c.before_update),c.fragment=r?r(c.ctx):!1,t.target){if(t.hydrate){const d=Uer(t.target);c.fragment&&c.fragment.l(d),d.forEach(Vu)}else c.fragment&&c.fragment.c();t.intro&&hi(e.$$.fragment),$m(e,t.target,t.anchor),rZe()}tT(l)}class vO{constructor(){this.$$=void 0,this.$$set=void 0}$destroy(){km(this,1),this.$destroy=jc}$on(t,n){if(!dre(n))return jc;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&&!jer(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Ker="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Ker);function Jer(e){let t,n,r,i,s;return{c(){t=ff("button"),Ci(t,"aria-label",n=e[3]?e[3]:null),Ci(t,"class",r=`${e[1]||""} shepherd-button ${e[4]?"shepherd-button-secondary":""}`),t.disabled=e[2],Ci(t,"tabindex","0"),Ci(t,"type","button")},m(a,o){Zd(a,t,o),t.innerHTML=e[5],i||(s=UX(t,"click",function(){dre(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)&&Ci(t,"aria-label",n),o&18&&r!==(r=`${e[1]||""} shepherd-button ${e[4]?"shepherd-button-secondary":""}`)&&Ci(t,"class",r),o&4&&(t.disabled=e[2])},i:jc,o:jc,d(a){a&&Vu(t),i=!1,s()}}}function etr(e,t,n){let{config:r,step:i}=t,s,a,o,l,c,u;function d(h){return Jg(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 ttr extends vO{constructor(t){super(),mO(this,t,etr,Jer,gO,{config:6,step:7})}}function VTe(e,t,n){const r=e.slice();return r[2]=t[n],r}function BTe(e){let t,n,r=GTe(e[1]),i=[];for(let a=0;a<r.length;a+=1)i[a]=YTe(VTe(e,r,a));const s=a=>js(i[a],1,1,()=>{i[a]=null});return{c(){for(let a=0;a<i.length;a+=1)i[a].c();t=qer()},m(a,o){for(let l=0;l<i.length;l+=1)i[l]&&i[l].m(a,o);Zd(a,t,o),n=!0},p(a,o){if(o&3){r=GTe(a[1]);let l;for(l=0;l<r.length;l+=1){const c=VTe(a,r,l);i[l]?(i[l].p(c,o),hi(i[l],1)):(i[l]=YTe(c),i[l].c(),hi(i[l],1),i[l].m(t.parentNode,t))}for(nv(),l=r.length;l<i.length;l+=1)s(l);rv()}},i(a){if(!n){for(let o=0;o<r.length;o+=1)hi(i[o]);n=!0}},o(a){i=i.filter(Boolean);for(let o=0;o<i.length;o+=1)js(i[o]);n=!1},d(a){a&&Vu(t),Ler(i,a)}}}function YTe(e){let t,n;return t=new ttr({props:{config:e[2],step:e[0]}}),{c(){Ny(t.$$.fragment)},m(r,i){$m(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||(hi(t.$$.fragment,r),n=!0)},o(r){js(t.$$.fragment,r),n=!1},d(r){km(t,r)}}}function ntr(e){let t,n,r=e[1]&&BTe(e);return{c(){t=ff("footer"),r&&r.c(),Ci(t,"class","shepherd-footer")},m(i,s){Zd(i,t,s),r&&r.m(t,null),n=!0},p(i,[s]){i[1]?r?(r.p(i,s),s&2&&hi(r,1)):(r=BTe(i),r.c(),hi(r,1),r.m(t,null)):r&&(nv(),js(r,1,1,()=>{r=null}),rv())},i(i){n||(hi(r),n=!0)},o(i){js(r),n=!1},d(i){i&&Vu(t),r&&r.d()}}}function rtr(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 itr extends vO{constructor(t){super(),mO(this,t,rtr,ntr,gO,{step:0})}}function str(e){let t,n,r,i,s;return{c(){t=ff("button"),n=ff("span"),n.textContent="×",Ci(n,"aria-hidden","true"),Ci(t,"aria-label",r=e[0].label?e[0].label:"Close Tour"),Ci(t,"class","shepherd-cancel-icon"),Ci(t,"type","button")},m(a,o){Zd(a,t,o),hx(t,n),i||(s=UX(t,"click",e[1]),i=!0)},p(a,[o]){o&1&&r!==(r=a[0].label?a[0].label:"Close Tour")&&Ci(t,"aria-label",r)},i:jc,o:jc,d(a){a&&Vu(t),i=!1,s()}}}function atr(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 otr extends vO{constructor(t){super(),mO(this,t,atr,str,gO,{cancelIcon:0,step:2})}}function ltr(e){let t;return{c(){t=ff("h3"),Ci(t,"id",e[1]),Ci(t,"class","shepherd-title")},m(n,r){Zd(n,t,r),e[3](t)},p(n,[r]){r&2&&Ci(t,"id",n[1])},i:jc,o:jc,d(n){n&&Vu(t),e[3](null)}}}function ctr(e,t,n){let{labelId:r,element:i,title:s}=t;hre(()=>{Jg(s)&&n(2,s=s()),n(0,i.innerHTML=s,i)});function a(o){fx[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 utr extends vO{constructor(t){super(),mO(this,t,ctr,ltr,gO,{labelId:1,element:0,title:2})}}function ZTe(e){let t,n;return t=new utr({props:{labelId:e[0],title:e[2]}}),{c(){Ny(t.$$.fragment)},m(r,i){$m(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||(hi(t.$$.fragment,r),n=!0)},o(r){js(t.$$.fragment,r),n=!1},d(r){km(t,r)}}}function HTe(e){let t,n;return t=new otr({props:{cancelIcon:e[3],step:e[1]}}),{c(){Ny(t.$$.fragment)},m(r,i){$m(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||(hi(t.$$.fragment,r),n=!0)},o(r){js(t.$$.fragment,r),n=!1},d(r){km(t,r)}}}function dtr(e){let t,n,r,i=e[2]&&ZTe(e),s=e[3]&&e[3].enabled&&HTe(e);return{c(){t=ff("header"),i&&i.c(),n=I3(),s&&s.c(),Ci(t,"class","shepherd-header")},m(a,o){Zd(a,t,o),i&&i.m(t,null),hx(t,n),s&&s.m(t,null),r=!0},p(a,[o]){a[2]?i?(i.p(a,o),o&4&&hi(i,1)):(i=ZTe(a),i.c(),hi(i,1),i.m(t,n)):i&&(nv(),js(i,1,1,()=>{i=null}),rv()),a[3]&&a[3].enabled?s?(s.p(a,o),o&8&&hi(s,1)):(s=HTe(a),s.c(),hi(s,1),s.m(t,null)):s&&(nv(),js(s,1,1,()=>{s=null}),rv())},i(a){r||(hi(i),hi(s),r=!0)},o(a){js(i),js(s),r=!1},d(a){a&&Vu(t),i&&i.d(),s&&s.d()}}}function htr(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 ftr extends vO{constructor(t){super(),mO(this,t,htr,dtr,gO,{labelId:0,step:1})}}function ptr(e){let t;return{c(){t=ff("div"),Ci(t,"class","shepherd-text"),Ci(t,"id",e[1])},m(n,r){Zd(n,t,r),e[3](t)},p(n,[r]){r&2&&Ci(t,"id",n[1])},i:jc,o:jc,d(n){n&&Vu(t),e[3](null)}}}function Otr(e,t,n){let{descriptionId:r,element:i,step:s}=t;hre(()=>{let{text:o}=s.options;Jg(o)&&(o=o.call(s)),lx(o)?i.appendChild(o):n(0,i.innerHTML=o,i)});function a(o){fx[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 gtr extends vO{constructor(t){super(),mO(this,t,Otr,ptr,gO,{descriptionId:1,element:0,step:2})}}function KTe(e){let t,n;return t=new ftr({props:{labelId:e[1],step:e[2]}}),{c(){Ny(t.$$.fragment)},m(r,i){$m(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||(hi(t.$$.fragment,r),n=!0)},o(r){js(t.$$.fragment,r),n=!1},d(r){km(t,r)}}}function JTe(e){let t,n;return t=new gtr({props:{descriptionId:e[0],step:e[2]}}),{c(){Ny(t.$$.fragment)},m(r,i){$m(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||(hi(t.$$.fragment,r),n=!0)},o(r){js(t.$$.fragment,r),n=!1},d(r){km(t,r)}}}function e_e(e){let t,n;return t=new itr({props:{step:e[2]}}),{c(){Ny(t.$$.fragment)},m(r,i){$m(t,r,i),n=!0},p(r,i){const s={};i&4&&(s.step=r[2]),t.$set(s)},i(r){n||(hi(t.$$.fragment,r),n=!0)},o(r){js(t.$$.fragment,r),n=!1},d(r){km(t,r)}}}function mtr(e){let t,n=!Do(e[2].options.title)||e[2].options.cancelIcon&&e[2].options.cancelIcon.enabled,r,i=!Do(e[2].options.text),s,a=Array.isArray(e[2].options.buttons)&&e[2].options.buttons.length,o,l=n&&KTe(e),c=i&&JTe(e),u=a&&e_e(e);return{c(){t=ff("div"),l&&l.c(),r=I3(),c&&c.c(),s=I3(),u&&u.c(),Ci(t,"class","shepherd-content")},m(d,h){Zd(d,t,h),l&&l.m(t,null),hx(t,r),c&&c.m(t,null),hx(t,s),u&&u.m(t,null),o=!0},p(d,[h]){h&4&&(n=!Do(d[2].options.title)||d[2].options.cancelIcon&&d[2].options.cancelIcon.enabled),n?l?(l.p(d,h),h&4&&hi(l,1)):(l=KTe(d),l.c(),hi(l,1),l.m(t,r)):l&&(nv(),js(l,1,1,()=>{l=null}),rv()),h&4&&(i=!Do(d[2].options.text)),i?c?(c.p(d,h),h&4&&hi(c,1)):(c=JTe(d),c.c(),hi(c,1),c.m(t,s)):c&&(nv(),js(c,1,1,()=>{c=null}),rv()),h&4&&(a=Array.isArray(d[2].options.buttons)&&d[2].options.buttons.length),a?u?(u.p(d,h),h&4&&hi(u,1)):(u=e_e(d),u.c(),hi(u,1),u.m(t,null)):u&&(nv(),js(u,1,1,()=>{u=null}),rv())},i(d){o||(hi(l),hi(c),hi(u),o=!0)},o(d){js(l),js(c),js(u),o=!1},d(d){d&&Vu(t),l&&l.d(),c&&c.d(),u&&u.d()}}}function vtr(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 ytr extends vO{constructor(t){super(),mO(this,t,vtr,mtr,gO,{descriptionId:0,labelId:1,step:2})}}function t_e(e){let t;return{c(){t=ff("div"),Ci(t,"class","shepherd-arrow"),Ci(t,"data-popper-arrow","")},m(n,r){Zd(n,t,r)},d(n){n&&Vu(t)}}}function btr(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&&t_e();r=new ytr({props:{descriptionId:e[2],labelId:e[3],step:e[4]}});let u=[{"aria-describedby":i=Do(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=Mer(d,u[h]);return{c(){t=ff("dialog"),c&&c.c(),n=I3(),Ny(r.$$.fragment),UTe(t,d),gb(t,"shepherd-has-cancel-icon",e[5]),gb(t,"shepherd-has-title",e[6]),gb(t,"shepherd-element",!0)},m(h,f){Zd(h,t,f),c&&c.m(t,null),hx(t,n),$m(r,t,null),e[13](t),a=!0,o||(l=UX(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=t_e(),c.c(),c.m(t,n)):c&&(c.d(1),c=null);const O={};f&4&&(O.descriptionId=h[2]),f&8&&(O.labelId=h[3]),f&16&&(O.step=h[4]),r.$set(O),UTe(t,d=Zer(u,[(!a||f&20&&i!==(i=Do(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"}])),gb(t,"shepherd-has-cancel-icon",h[5]),gb(t,"shepherd-has-title",h[6]),gb(t,"shepherd-element",!0)},i(h){a||(hi(r.$$.fragment,h),a=!0)},o(h){js(r.$$.fragment,h),a=!1},d(h){h&&Vu(t),c&&c.d(),km(r),e[13](null),o=!1,l()}}}const wtr=9,xtr=27,Str=37,$tr=39;function n_e(e){return e.split(" ").filter(t=>!!t.length)}function ktr(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,O;const g=()=>i;Wer(()=>{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])}),hre(()=>{O!==u.options.classes&&m()});function m(){v(O),O=u.options.classes,y(O)}function v(x){if(IP(x)){const S=n_e(x);S.length&&i.classList.remove(...S)}}function y(x){if(IP(x)){const S=n_e(x);S.length&&i.classList.add(...S)}}const w=x=>{const{tour:S}=u;switch(x.keyCode){case wtr: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 xtr:S.options.exitOnEsc&&(x.preventDefault(),x.stopPropagation(),u.cancel());break;case Str:S.options.keyboardNavigation&&(x.preventDefault(),x.stopPropagation(),S.back());break;case $tr:S.options.keyboardNavigation&&(x.preventDefault(),x.stopPropagation(),S.next());break}};function k(x){fx[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,w,a,o,c,r,g,k]}class Ttr extends vO{constructor(t){super(),mO(this,t,ktr,btr,gO,{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 QY extends Jne{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?qYe(this.tour.options.classPrefix):"",this.styles=t.styles,this._resolvedAttachTo=null,nre(this),this._setOptions(n),this}cancel(){this.tour.cancel(),this.trigger("cancel")}complete(){this.tour.complete(),this.trigger("complete")}destroy(){Aer(this),lx(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=zJn(this),this._resolvedExtraHighlightElements}_resolveAttachToOptions(){return this._resolvedAttachTo=qJn(this),this._resolvedAttachTo}_getResolvedAttachToOptions(){return this._resolvedAttachTo===null?this._resolveAttachToOptions():this._resolvedAttachTo}isOpen(){return!!(this.el&&!this.el.hidden)}show(){return Jg(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 Ttr({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();Jg(this.options.scrollToHandler)?this.options.scrollToHandler(n):wJn(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=tre({},n||{}),this.options=Object.assign({arrow:!0},n,t,Rer(n,t));const{when:r}=this.options;this.options.classes=this._getClassOptions(t),this.destroy(),this.id=this.options.id||`step-${UYe()}`,r&&Object.keys(r).forEach(i=>{this.on(i,r[i],this)})}_setupElements(){Do(this.el)||this.destroy(),this.el=this._createTooltipContent(),this.options.advanceOn&&MJn(this),Qer(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 _tr(e){if(e){const{steps:t}=e;t.forEach(n=>{n.options&&n.options.canClickTarget===!1&&n.options.attachTo&&(lx(n.target)&&n.target.classList.remove("shepherd-target-click-disabled"),n._resolvedExtraHighlightElements&&n._resolvedExtraHighlightElements.forEach(r=>{lx(r)&&r.classList.remove("shepherd-target-click-disabled")}))})}}function Ptr(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 Ctr(e){let t,n,r,i,s;return{c(){t=zTe("svg"),n=zTe("path"),Ci(n,"d",e[2]),Ci(t,"class",r=`${e[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)},m(a,o){Zd(a,t,o),hx(t,n),e[11](t),i||(s=UX(t,"touchmove",e[3]),i=!0)},p(a,[o]){o&4&&Ci(n,"d",a[2]),o&2&&r!==(r=`${a[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)&&Ci(t,"class",r)},i:jc,o:jc,d(a){a&&Vu(t),e[11](null),i=!1,s()}}}function iZe(e){if(!e)return null;const t=e instanceof HTMLElement&&window.getComputedStyle(e).overflowY;return t!=="hidden"&&t!=="visible"&&e.scrollHeight>=e.clientHeight?e:iZe(e.parentElement)}function Etr(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 Qtr(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 Rtr(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(k=0,x=0,S=0,T=0,_,P,E){if(P){const C=[P,...E||[]];n(4,i=[]);for(const Q of C){if(!Q||C.indexOf(Q)!==C.lastIndexOf(Q))continue;const{y:D,height:F}=Qtr(Q,_),{x:I,width:U,left:q}=Q.getBoundingClientRect();C.some(Z=>{if(Z===Q)return!1;const W=Z.getBoundingClientRect();return I>=W.left&&I+U<=W.right&&D>=W.top&&D+F<=W.bottom})||i.push({width:U+k*2,height:F+k*2,x:(I||q)+S-k,y:D+T-k,r:x})}}else c()}function h(k){v(),k.tour.options.useModalOverlay?(y(k),f()):u()}function f(){n(1,s=!0)}const O=k=>{k.preventDefault()},g=k=>{k.stopPropagation()};function m(){window.addEventListener("touchmove",O,{passive:!1})}function v(){a&&(cancelAnimationFrame(a),a=void 0),window.removeEventListener("touchmove",O,{passive:!1})}function y(k){const{modalOverlayOpeningPadding:x,modalOverlayOpeningRadius:S,modalOverlayOpeningXOffset:T=0,modalOverlayOpeningYOffset:_=0}=k.options,P=Etr(k.target),E=iZe(k.target),C=()=>{a=void 0,d(x,S,T+P.left,_+P.top,E,k.target,k._resolvedExtraHighlightElements),a=requestAnimationFrame(C)};C(),m()}function w(k){fx[k?"unshift":"push"](()=>{r=k,n(0,r)})}return e.$$set=k=>{"element"in k&&n(0,r=k.element),"openingProperties"in k&&n(4,i=k.openingProperties)},e.$$.update=()=>{e.$$.dirty&16&&n(2,o=Ptr(i))},[r,s,o,g,i,l,c,u,d,h,f,w]}class Atr extends vO{constructor(t){super(),mO(this,t,Rtr,Ctr,gO,{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 Dtr extends Jne{constructor(){super(),this.activeTour=void 0,nre(this)}}class Ntr extends Jne{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,nre(this);const n={exitOnEsc:!0,keyboardNavigation:!0};return this.options=Object.assign({},n,t),this.classPrefix=qYe(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,R0.trigger(i,s)})})(r)}),this._setTourID(t.id),this}addStep(t,n){let r=t;return r instanceof QY?r.tour=this:r=new QY(this,r),Do(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;Jg(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 R0.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=IP(t)?this.getById(t):this.steps[t];r&&(this._updateStateBeforeShow(),Jg(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()),_tr(this),this.trigger(t,{index:n}),R0.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)}lx(this.focusedElBeforeOpen)&&this.focusedElBeforeOpen.focus()}_setupActiveTour(){this.trigger("active",{tour:this}),R0.activeTour=this}setupModal(){this.modal=new Atr({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||UYe();this.id=`${n}--${r}`}}const R0=new Dtr,sZe=typeof window>"u";R0.Step=sZe?jJn:QY;R0.Tour=sZe?LJn:Ntr;const WX=b.createContext(void 0);WX.Consumer;const Xtr=({children:e})=>bJn.jsx(WX.Provider,{value:{Shepherd:R0},children:e}),Itr=""+new URL("agentic-sequence-CExfswgi.png",import.meta.url).href,Ftr=""+new URL("canvas-code-inline-edit-DLji9b0m.png",import.meta.url).href,Mtr=""+new URL("canvas-overview-CruGEIRC.png",import.meta.url).href,jtr=""+new URL("canvas-variables-view-DrA20zqs.png",import.meta.url).href,Ltr=""+new URL("chat-attachments-_3cRrONU.png",import.meta.url).href,qtr=""+new URL("chat-full-view-e-eJPzrw.png",import.meta.url).href,ztr=""+new URL("chat-input-CU-CA7Se.png",import.meta.url).href,Utr=""+new URL("inline-edit-canvas-O9conTkE.png",import.meta.url).href,Wtr=e=>{const t=Array.from(document.querySelectorAll(`[data-tour-tag="${e}"]`));return t.find(n=>n.offsetParent!==null)??t[0]??null},r_e=e=>{document.querySelector(`[data-tour-action="${e}"]`)?.click()},i_e=[{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="${qtr}" 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="${ztr}" 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="${Ltr}" 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="${Itr}" 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}=mn.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>${kY(!0)}</code> on Mac and <code>${kY(!1)}</code> on Windows or Linux. This is a helpful window that you can open from anywhere in the app to be able to access your chats, agents, settings, pages and actions, and much more, using your keyboard. It can often be faster to access sections in the app this way instead of clicking through menus. Type a word to search everything at once, or start with a prefix to narrow it: <code>#</code> for chats, <code>@</code> for agents, <code>,</code> for settings, and <code>></code> for commands and pages. You can also just click Search in the sidebar to open it.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const{closeCommandPalette:e}=mn.getState();e(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const{closeCommandPalette:e}=mn.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}=mn.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="${Mtr}" 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="${Utr}" 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.
|
|
1455
1455
|
<br /><img src="${Ftr}" 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="${jtr}" 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").
|
|
1456
|
-
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:()=>Wtr("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(){r_e("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(()=>{r_e("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()}}]}],Gtr=()=>{const e=ka(),{completeTourOnboarding:t}=QT(),n=b.useContext(WX),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=QT.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(i_e)}else l.steps.length===0&&l.addSteps(i_e);typeof l.start=="function"?(e("/"),l.start()):console.warn("Shepherd tour instance does not have a start method.",l)}}},Vtr=()=>{const{isModalComplete:e,isTourComplete:t}=QT(),{startTour:n}=Gtr(),r=H.useContext(WX),{data:i}=p5(1,1);return b.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},Btr=({children:e})=>p.jsxs(Xtr,{children:[e,p.jsx(Vtr,{})]}),s_e=Z2e,a_e="The backend update could not start. Retry, or update from Settings, under Application updates.",Ytr=()=>{const e=Wa(),t=Mi(),[n,r]=b.useState(!1),[i,s]=b.useState(null),a=b.useCallback(()=>{t.invalidateQueries({queryKey:Td.capabilities})},[t]),o=b.useCallback(async()=>{r(!0),s(null);let m=null;const v=window.api.updater.onBackendUpdateError(y=>{y.phase==="update"&&(m=CZ(y.message))});try{if(await window.api.updater.updateBackend()===!1){s(m??a_e);return}a()}catch(y){s(y instanceof Error?If(y):a_e)}finally{v(),r(!1)}},[a]);if(e.isLoading)return null;const l=e.data,c=l?s_e.filter(m=>(l.features?.[m]??0)<1):[...s_e],u=!!l&&!l?.desktop_available;if(!H2e(l))return null;const d=V2e(e.error),h=!!l,f=!!window.api?.updater?.updateBackend,O=eot({kind:d,unpaired:u,missing:c,answered:h}),g=f&&Jat({kind:d,unpaired:u,answered:h});return p.jsx("div",{className:"fixed inset-x-0 top-0 z-2100 w-full",children:p.jsx(Ml,{variant:"warning",className:"items-center rounded-none border-x-0 border-t-0",children:p.jsxs("div",{className:"flex w-full items-center justify-between gap-4",children:[p.jsxs(rT,{children:[O,i?` ${i}`:null]}),p.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[g&&p.jsx(we,{variant:"primary",size:"sm",onClick:()=>void o(),disabled:n,children:n?"Updating":"Update backend"}),p.jsx(we,{variant:"secondary",size:"sm",onClick:a,children:"Retry"})]})]})})})},Ztr=""+new URL("radient-icon-1024x1024-D_JJedvo.png",import.meta.url).href,aZe={all:["radient-prices"],prices:()=>[...aZe.all,"prices"]},Htr=()=>{const e=ir({queryKey:aZe.prices(),queryFn:()=>NZ({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}},oZe=po()(jd(e=>({hasBeenNotified:!1,setHasBeenNotified:t=>{e({hasBeenNotified:t})}}),{name:"low-credits-storage"})),Ktr=({open:e,onClose:t,onGoToConsole:n})=>{const{setHasBeenNotified:r}=oZe(),{prices:i,isLoading:s,error:a}=Htr(),o=u=>typeof u!="number"?"$...":`$${u.toFixed(2)} USD`,l=()=>{r(!0),t()},c=()=>{r(!0),n()};return p.jsx(Nc,{open:e,onClose:l,title:p.jsxs(p.Fragment,{children:[p.jsx("img",{src:Ztr,alt:"Radient icon",className:"size-7"}),"Running low on Radient credits?"]}),maxWidth:"sm",fullWidth:!1,actions:p.jsxs(p.Fragment,{children:[p.jsx(sl,{onClick:l,children:"Maybe later"}),p.jsx(vd,{onClick:c,startIcon:p.jsx(B3,{size:18}),className:"min-w-55",children:"Get more credits"})]}),children:p.jsxs("div",{className:"flex flex-col items-center gap-4 py-2 text-center",children:[p.jsxs("p",{className:"text-body-sm text-ink-muted",children:["Unlock the full power of Local Operator with"," ",p.jsx("span",{className:"font-bold text-accent",children:"Radient Pass"}),"."]}),p.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."}),p.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."}),p.jsxs("p",{className:"text-body-sm text-ink-muted",children:["Plus, get"," ",p.jsx("span",{className:"font-medium text-ink",children:s?p.jsx(pr,{size:"sm",className:"mr-0.5 align-middle"}):o(i?.default_registration_credits)})," ","in bonus credits with your first purchase.",a&&p.jsx("span",{className:"mt-1 block text-meta text-danger",children:"Could not load bonus credit information."})]}),p.jsx("p",{className:"text-meta text-ink-dim",children:"You can also reach the Radient Console from Settings at any time."})]})})},o_e=({expanded:e})=>p.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[p.jsx("img",{src:QZe,alt:e?"":"Local Operator",loading:"eager",className:"size-6 shrink-0"}),e&&p.jsx("span",{className:"truncate font-semibold text-body text-ink",children:"Local Operator"})]}),lZe=H.memo(({expanded:e,useAuth:t=!1})=>{const n=ka(),{user:r,isAuthenticated:i,signOut:s}=XZ(),a=r?.name??"User",o=r?.email??"",l=b.useCallback(async()=>{i&&(await s(),window.location.reload())},[i,s]),c=b.useMemo(()=>a?a.split(" ").map(h=>h.charAt(0)).join("").toUpperCase().substring(0,2):null,[a]),u=p.jsxs("button",{type:"button",onClick:t?void 0:()=>n("/settings"),"aria-label":e?void 0:"Account settings",className:A("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:[p.jsx(w_e,{className:"size-7 shrink-0",children:p.jsx(x_e,{className:"bg-elevated text-ink",children:c??p.jsx(_2e,{size:14,"aria-hidden":"true"})})}),e&&a&&p.jsxs("span",{className:"min-w-0 text-left",children:[p.jsx("span",{className:"block truncate text-body-sm text-ink",children:a}),o&&p.jsx("span",{className:"block truncate text-meta text-ink-dim",children:o})]})]}),d=e?u:p.jsx(it,{content:"Account settings",side:"right",children:u});return t?p.jsxs(px,{children:[e?p.jsx(iv,{asChild:!0,children:u}):p.jsx(it,{content:"Account settings",side:"right",children:p.jsx(iv,{asChild:!0,children:u})}),p.jsxs(Ox,{align:"end",side:"top",className:"min-w-50",children:[p.jsxs($s,{onSelect:()=>n("/settings"),children:[p.jsx(rg,{size:16,"aria-hidden":"true"}),"Settings"]}),p.jsxs($s,{children:[p.jsx($2e,{size:16,"aria-hidden":"true"}),"Privacy and security"]}),p.jsx(Yb,{}),p.jsxs($s,{onSelect:l,className:"text-danger focus:bg-danger-wash focus:text-danger",children:[p.jsx(Qnt,{size:16,"aria-hidden":"true"}),"Sign out"]})]})]}):d});lZe.displayName="UserProfileSidebar";const l_e={expanded:"w-55",collapsed:"w-12"},Jtr=()=>{const e=ka(),t=Ect(),{isSidebarCollapsed:n,toggleSidebar:r}=mn(),i=mn(f=>f.openCommandPalette),s=!n,a=[{icon:lZ,label:"Chat",path:"/chat",isActive:t==="chat",tourTag:"nav-item-chat"},{icon:Jv,label:"My agents",path:"/agents",isActive:t==="agents",tourTag:"nav-item-agents"},{icon:T2e,label:"Agent hub",path:"/agent-hub",isActive:t==="agent-hub",tourTag:"nav-item-agent-hub"},{icon:s2e,label:"Schedules",path:"/schedules",isActive:t==="schedules",tourTag:"nav-item-schedules"},{icon:_g,label:"Browser",path:"/browser",isActive:t==="browser",tourTag:"nav-item-browser"},{icon:rg,label:"Settings",path:"/settings",isActive:t==="settings",tourTag:"nav-item-settings"}],o=f=>{const O=p.jsxs("button",{type:"button",onClick:()=>e(f.path),"data-tour-tag":f.tourTag,"aria-current":f.isActive?"page":void 0,"aria-label":s?void 0:f.label,className:A("flex h-8 w-full items-center rounded-sm text-body-sm transition-colors duration-fast ease-out-quart",s?"justify-start gap-2 px-3":"justify-center",f.isActive?"bg-accent-wash font-medium text-ink":"text-ink-muted hover:bg-elevated hover:text-ink"),children:[p.jsx(f.icon,{size:16,"aria-hidden":"true",className:A("shrink-0",f.isActive&&"text-accent")}),s&&p.jsx("span",{className:"truncate",children:f.label})]});return s?p.jsx("li",{children:O},f.path):p.jsx("li",{children:p.jsx(it,{content:f.label,side:"right",children:O})},f.path)},l=s?"Collapse sidebar":"Expand sidebar",c=navigator.platform.toUpperCase().indexOf("MAC")>=0,u=`Search (${kY(c)})`,d=s?p.jsxs("button",{type:"button","data-command-palette-trigger":"",onClick:i,className:A("flex h-8 w-full items-center gap-2 rounded-sm px-3 text-body-sm text-ink-muted","transition-colors duration-fast ease-out-quart","hover:bg-elevated hover:text-ink"),children:[p.jsx(dv,{size:16,"aria-hidden":"true",className:"shrink-0"}),p.jsx("span",{className:"truncate",children:"Search"}),p.jsx("span",{"aria-hidden":"true",className:"ml-auto",children:p.jsx(fd,{shortcut:UKn(c)})})]}):p.jsx(it,{content:u,side:"right",children:p.jsx("button",{type:"button","data-command-palette-trigger":"",onClick:i,"aria-label":u,className:A("flex h-8 w-full items-center justify-center rounded-sm text-ink-muted","transition-colors duration-fast ease-out-quart","hover:bg-elevated hover:text-ink"),children:p.jsx(dv,{size:16,"aria-hidden":"true"})})}),h=p.jsx("div",{className:A("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:p.jsx(it,{content:l,side:"right",children:p.jsx(we,{variant:"ghost",size:"icon-sm",onClick:r,"aria-label":l,"aria-expanded":s,children:s?p.jsx(Y1,{"aria-hidden":"true"}):p.jsx(Dp,{"aria-hidden":"true"})})})});return p.jsxs("nav",{className:A("group flex shrink-0 flex-col overflow-x-hidden bg-sunken transition-[width] duration-base ease-out-quart",s?l_e.expanded:l_e.collapsed),children:[p.jsx("div",{className:A("flex h-12 shrink-0 items-center",s?"justify-between pr-2 pl-5":"justify-center"),children:s?p.jsxs(p.Fragment,{children:[p.jsx(o_e,{expanded:!0}),h]}):p.jsxs("div",{className:"relative flex size-8 items-center justify-center",children:[p.jsx("div",{className:"transition-opacity duration-fast ease-out-quart group-hover:opacity-0 group-focus-within:opacity-0",children:p.jsx(o_e,{expanded:!1})}),p.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:h})]})}),p.jsx("ul",{className:"flex flex-col gap-1 p-2",children:a.map(o)}),p.jsxs("div",{className:"mt-auto flex flex-col gap-1 p-2",children:[d,p.jsx(lZe,{expanded:s})]})]})},enr=1,tnr=()=>{const{isAuthenticated:e,user:t}=XZ(),{hasBeenNotified:n,setHasBeenNotified:r}=oZe(),[i,s]=b.useState(!1),[a,o]=b.useState(null),l=b.useCallback(async()=>{if(!(!e||!t?.radientUser?.account?.tenant_id))try{const h=await NZ({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 b.useEffect(()=>{e&&l()},[e,l]),b.useEffect(()=>{e&&a!==null?a<enr?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}},nnr=b.lazy(()=>je(()=>import("./agent-details-page-Bjt69TC3.js"),__vite__mapDeps([8,1,2,9]),import.meta.url).then(e=>({default:e.AgentDetailsPage}))),rnr=b.lazy(()=>je(()=>import("./agent-hub-page-BJiTX5nz.js"),__vite__mapDeps([10,1,2,11,12,9]),import.meta.url).then(e=>({default:e.AgentHubPage}))),c_e=b.lazy(()=>je(()=>import("./agents-page-0rMcAByt.js"),__vite__mapDeps([13,1,2]),import.meta.url).then(e=>({default:e.AgentsPage}))),inr=b.lazy(()=>je(()=>import("./schedules-page-BzdwC9M-.js"),__vite__mapDeps([14,1,2,12,15]),import.meta.url).then(e=>({default:e.SchedulesPage}))),snr=b.lazy(()=>je(()=>import("./browser-page-_cYqTYuS.js"),__vite__mapDeps([16,1,2]),import.meta.url).then(e=>({default:e.BrowserPage}))),anr=b.lazy(()=>je(()=>import("./settings-page-BJeFjWrB.js"),__vite__mapDeps([17,1,2,12,18,15]),import.meta.url).then(e=>({default:e.SettingsPage}))),onr=()=>{const{isOnboardingActive:e}=hct(),{isLowCreditsDialogOpen:t,openRadientConsole:n,onLowCreditsDialogClose:r}=tnr(),{isCommandPaletteOpen:i,isCreateAgentDialogOpen:s,closeCreateAgentDialog:a}=mn();up(i,"command-palette"),up(s,"create-agent-dialog"),up(e,"onboarding"),up(t,"low-credits");const o=ka(),l=Wa(),c=Oi(l.data,"session_catalogue",2),u=h=>{o(`/chat/${h}`),a()};WKn();const d=Sn(h=>h.setActiveSession);return b.useEffect(()=>{const h=window.api?.desktop?.onOpenConversation?.(f=>{f!==null&&performance.mark("lop:open:requested"),d(f),o("/chat")});return()=>h?.()},[o,d]),b.useEffect(()=>{const h=window.api?.browser?.onConsentAttention?.(f=>{q5t(f.entryId),o("/browser")});return()=>h?.()},[o]),b.useEffect(()=>{const h=f=>{e||c&&XHn(f)&&(f.preventDefault(),Sn.getState().stageDraft(void 0,!0),o("/chat"))};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[c,e,o]),p.jsx(Btr,{children:p.jsxs("div",{className:"relative flex h-screen overflow-hidden",children:[i&&p.jsx(LKn,{}),p.jsx(nKn,{}),p.jsx(QCe,{}),p.jsx(mJn,{open:e}),p.jsx(Klt,{}),p.jsx(Ytr,{}),p.jsx(mut,{}),p.jsx(Ktr,{open:t,onClose:r,onGoToConsole:n}),p.jsx(Yct,{open:s,onClose:a,onAgentCreated:u}),p.jsx(Jtr,{}),p.jsx("main",{className:"flex grow flex-col overflow-hidden",children:p.jsx(b.Suspense,{fallback:p.jsx("div",{className:"flex grow items-center justify-center",children:p.jsx(pr,{size:"lg",label:"Loading page"})}),children:p.jsxs(vet,{children:[p.jsx(Bc,{path:"/",element:p.jsx(Zie,{to:"/chat",replace:!0})}),p.jsx(Bc,{path:"/chat",element:p.jsx(oTe,{})}),p.jsx(Bc,{path:"/chat/:agentId",element:p.jsx(oTe,{})}),p.jsx(Bc,{path:"/agents",element:p.jsx(c_e,{})}),p.jsx(Bc,{path:"/agents/:agentId",element:p.jsx(c_e,{})}),p.jsx(Bc,{path:"/settings",element:p.jsx(anr,{})}),p.jsx(Bc,{path:"/agent-hub",element:p.jsx(rnr,{})}),p.jsx(Bc,{path:"/agent-hub/:agentId",element:p.jsx(nnr,{})}),p.jsx(Bc,{path:"/schedules",element:p.jsx(inr,{})}),p.jsx(Bc,{path:"/browser",element:p.jsx(snr,{})}),p.jsx(Bc,{path:"*",element:p.jsx(Zie,{to:"/chat",replace:!0})})]})})})]})})};function F3(){return new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))})}const lnr=3,cnr=3e3;function unr(e){return e instanceof CSSTransition&&e.playState==="running"}function dnr(e){const t=e.effect,n=t instanceof KeyframeEffect?t.target:null,r=e.transitionProperty,s=/^[a-z-]+$/.test(r)&&n instanceof Element?getComputedStyle(n).getPropertyValue(r).trim()||"(empty)":"(unreadable)";return`${r||"(unnamed property)"} on ${fre(n)??"an element no longer in the document"} = ${s}`}async function hnr(e=cnr){const t=performance.now();let n=0;for(;;){await F3();const r=Math.round(performance.now()-t),i=document.getAnimations().filter(unr);if(n=i.length===0?n+1:0,n>=lnr)return{waitedMs:r,timedOut:!1,pending:[]};if(r>e)return{waitedMs:r,timedOut:!0,pending:i.map(dnr)}}}const fnr=/^#/;function nT(){const e=window.location.hash.replace(fnr,"");return e===""?"/":e}function fre(e){if(!e)return null;const t=e.getAttribute("aria-label")??e.textContent??"";return`${e.tagName.toLowerCase()}${e.id?`#${e.id}`:""} "${t.trim().slice(0,60)}"`}function pnr(e){const t=e.getBoundingClientRect(),n=t.left+t.width/2,r=t.top+t.height/2,i=document.elementFromPoint(n,r),s=i!==null&&(i===e||e.contains(i)),a={bubbles:!0,cancelable:!0,composed:!0,button:0,buttons:1,clientX:n,clientY:r,view:window};return e.dispatchEvent(new PointerEvent("pointerdown",{...a,pointerId:1,isPrimary:!0})),e.dispatchEvent(new MouseEvent("mousedown",a)),e.dispatchEvent(new PointerEvent("pointerup",{...a,buttons:0,pointerId:1,isPrimary:!0})),e.dispatchEvent(new MouseEvent("mouseup",{...a,buttons:0})),e.dispatchEvent(new MouseEvent("click",{...a,buttons:0})),{hitTest:s,hit:fre(i),rect:{x:t.x,y:t.y,width:t.width,height:t.height}}}function jq(e,t){if(typeof e!="string"||e==="")throw new Error(`${t} must be a non-empty string`);return e}async function Onr(e,t=1e4){const n=Date.now();for(;nT()!==e;){if(Date.now()-n>t)throw new Error(`route did not become ${e} (it is ${nT()})`);await new Promise(r=>setTimeout(r,50))}return await F3(),nT()}function gnr(){const e=window.__loDevDriver;return e?.armed?e.install({hello:()=>({armed:!0,outDir:e.outDir,title:document.title,route:nT(),href:window.location.href,theme:mn.getState().themeName,viewport:{width:window.innerWidth,height:window.innerHeight,devicePixelRatio:window.devicePixelRatio},visibilityState:document.visibilityState,hasFocus:document.hasFocus(),apiBaseUrl:ai.baseUrl,userAgent:navigator.userAgent}),state:()=>{const t=mn.getState(),n=Sn.getState();return{route:nT(),theme:t.themeName,commandPaletteOpen:t.isCommandPaletteOpen,canvasOpen:t.isCanvasOpen,runPanelOpen:t.isRunPanelOpen,browserPaneOpen:t.isBrowserPaneOpen,browserPanelWidth:t.browserPanelWidth,activeSessionId:n.activeSessionId,sessionCount:n.sessions.length,onboardingVisible:!!document.querySelector("[data-onboarding-modal]")}},navigate:async t=>{const n=jq(t,"navigate path");if(!n.startsWith("/"))throw new Error(`navigate path must start with "/" (got "${n}")`);return window.location.hash=`#${n}`,{route:await Onr(n)}},setTheme:async t=>{const n=jq(t,"theme name");mn.getState().setTheme(n),await F3();const r=document.documentElement.getAttribute("data-theme"),i=await hnr();return{theme:mn.getState().themeName,dataTheme:r,settledAfterMs:i.waitedMs,settleTimedOut:i.timedOut,settlePending:i.pending}},press:async t=>{const n=typeof t=="string"?{selector:t}:t,r=jq(n?.selector,"press selector"),i=typeof n?.timeoutMs=="number"?n.timeoutMs:1e4,s=Date.now();let a=null;for(;a===null&&(a=document.querySelector(r),a===null);){if(Date.now()-s>i)throw new Error(`nothing matches ${r} after ${i}ms of waiting`);await new Promise(l=>setTimeout(l,100))}const o=pnr(a);return await F3(),{selector:r,target:fre(a),...o}}}):[]}const mnr={queries:{staleTime:5*60*1e3,gcTime:10*60*1e3,retry:1,refetchOnWindowFocus:!0,refetchOnMount:!0,refetchOnReconnect:!1,networkMode:"always"},mutations:{retry:1,networkMode:"always"}},cZe=new YZe({defaultOptions:mnr}),vnr=`
|
|
1456
|
+
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:()=>Wtr("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(){r_e("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(()=>{r_e("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()}}]}],Gtr=()=>{const e=ka(),{completeTourOnboarding:t}=QT(),n=b.useContext(WX),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=QT.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(i_e)}else l.steps.length===0&&l.addSteps(i_e);typeof l.start=="function"?(e("/"),l.start()):console.warn("Shepherd tour instance does not have a start method.",l)}}},Vtr=()=>{const{isModalComplete:e,isTourComplete:t}=QT(),{startTour:n}=Gtr(),r=H.useContext(WX),{data:i}=p5(1,1);return b.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},Btr=({children:e})=>p.jsxs(Xtr,{children:[e,p.jsx(Vtr,{})]}),s_e=Z2e,a_e="The backend update could not start. Retry, or update from Settings, under Application updates.",Ytr=()=>{const e=Wa(),t=Mi(),[n,r]=b.useState(!1),[i,s]=b.useState(null),a=b.useCallback(()=>{t.invalidateQueries({queryKey:Td.capabilities})},[t]),o=b.useCallback(async()=>{r(!0),s(null);let m=null;const v=window.api.updater.onBackendUpdateError(y=>{y.phase==="update"&&(m=CZ(y.message))});try{if(await window.api.updater.updateBackend()===!1){s(m??a_e);return}a()}catch(y){s(y instanceof Error?If(y):a_e)}finally{v(),r(!1)}},[a]);if(e.isLoading)return null;const l=e.data,c=l?s_e.filter(m=>(l.features?.[m]??0)<1):[...s_e],u=!!l&&!l?.desktop_available;if(!H2e(l))return null;const d=V2e(e.error),h=!!l,f=!!window.api?.updater?.updateBackend,O=eot({kind:d,unpaired:u,missing:c,answered:h}),g=f&&Jat({kind:d,unpaired:u,answered:h});return p.jsx("div",{className:"fixed inset-x-0 top-0 z-2100 w-full",children:p.jsx(Ml,{variant:"warning",className:"items-center rounded-none border-x-0 border-t-0",children:p.jsxs("div",{className:"flex w-full items-center justify-between gap-4",children:[p.jsxs(rT,{children:[O,i?` ${i}`:null]}),p.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[g&&p.jsx(we,{variant:"primary",size:"sm",onClick:()=>void o(),disabled:n,children:n?"Updating":"Update backend"}),p.jsx(we,{variant:"secondary",size:"sm",onClick:a,children:"Retry"})]})]})})})},Ztr=""+new URL("radient-icon-1024x1024-D_JJedvo.png",import.meta.url).href,aZe={all:["radient-prices"],prices:()=>[...aZe.all,"prices"]},Htr=()=>{const e=ir({queryKey:aZe.prices(),queryFn:()=>NZ({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}},oZe=po()(jd(e=>({hasBeenNotified:!1,setHasBeenNotified:t=>{e({hasBeenNotified:t})}}),{name:"low-credits-storage"})),Ktr=({open:e,onClose:t,onGoToConsole:n})=>{const{setHasBeenNotified:r}=oZe(),{prices:i,isLoading:s,error:a}=Htr(),o=u=>typeof u!="number"?"$...":`$${u.toFixed(2)} USD`,l=()=>{r(!0),t()},c=()=>{r(!0),n()};return p.jsx(Nc,{open:e,onClose:l,title:p.jsxs(p.Fragment,{children:[p.jsx("img",{src:Ztr,alt:"Radient icon",className:"size-7"}),"Running low on Radient credits?"]}),maxWidth:"sm",fullWidth:!1,actions:p.jsxs(p.Fragment,{children:[p.jsx(sl,{onClick:l,children:"Maybe later"}),p.jsx(vd,{onClick:c,startIcon:p.jsx(B3,{size:18}),className:"min-w-55",children:"Get more credits"})]}),children:p.jsxs("div",{className:"flex flex-col items-center gap-4 py-2 text-center",children:[p.jsxs("p",{className:"text-body-sm text-ink-muted",children:["Unlock the full power of Local Operator with"," ",p.jsx("span",{className:"font-bold text-accent",children:"Radient Pass"}),"."]}),p.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."}),p.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."}),p.jsxs("p",{className:"text-body-sm text-ink-muted",children:["Plus, get"," ",p.jsx("span",{className:"font-medium text-ink",children:s?p.jsx(pr,{size:"sm",className:"mr-0.5 align-middle"}):o(i?.default_registration_credits)})," ","in bonus credits with your first purchase.",a&&p.jsx("span",{className:"mt-1 block text-meta text-danger",children:"Could not load bonus credit information."})]}),p.jsx("p",{className:"text-meta text-ink-dim",children:"You can also reach the Radient Console from Settings at any time."})]})})},o_e=({expanded:e})=>p.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[p.jsx("img",{src:QZe,alt:e?"":"Local Operator",loading:"eager",className:"size-6 shrink-0"}),e&&p.jsx("span",{className:"truncate font-semibold text-body text-ink",children:"Local Operator"})]}),lZe=H.memo(({expanded:e,useAuth:t=!1})=>{const n=ka(),{user:r,isAuthenticated:i,signOut:s}=XZ(),a=r?.name??"User",o=r?.email??"",l=b.useCallback(async()=>{i&&(await s(),window.location.reload())},[i,s]),c=b.useMemo(()=>a?a.split(" ").map(h=>h.charAt(0)).join("").toUpperCase().substring(0,2):null,[a]),u=p.jsxs("button",{type:"button",onClick:t?void 0:()=>n("/settings"),"aria-label":e?void 0:"Account settings",className:A("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:[p.jsx(w_e,{className:"size-7 shrink-0",children:p.jsx(x_e,{className:"bg-elevated text-ink",children:c??p.jsx(_2e,{size:14,"aria-hidden":"true"})})}),e&&a&&p.jsxs("span",{className:"min-w-0 text-left",children:[p.jsx("span",{className:"block truncate text-body-sm text-ink",children:a}),o&&p.jsx("span",{className:"block truncate text-meta text-ink-dim",children:o})]})]}),d=e?u:p.jsx(it,{content:"Account settings",side:"right",children:u});return t?p.jsxs(px,{children:[e?p.jsx(iv,{asChild:!0,children:u}):p.jsx(it,{content:"Account settings",side:"right",children:p.jsx(iv,{asChild:!0,children:u})}),p.jsxs(Ox,{align:"end",side:"top",className:"min-w-50",children:[p.jsxs($s,{onSelect:()=>n("/settings"),children:[p.jsx(rg,{size:16,"aria-hidden":"true"}),"Settings"]}),p.jsxs($s,{children:[p.jsx($2e,{size:16,"aria-hidden":"true"}),"Privacy and security"]}),p.jsx(Yb,{}),p.jsxs($s,{onSelect:l,className:"text-danger focus:bg-danger-wash focus:text-danger",children:[p.jsx(Qnt,{size:16,"aria-hidden":"true"}),"Sign out"]})]})]}):d});lZe.displayName="UserProfileSidebar";const l_e={expanded:"w-55",collapsed:"w-12"},Jtr=()=>{const e=ka(),t=Ect(),{isSidebarCollapsed:n,toggleSidebar:r}=mn(),i=mn(f=>f.openCommandPalette),s=!n,a=[{icon:lZ,label:"Chat",path:"/chat",isActive:t==="chat",tourTag:"nav-item-chat"},{icon:Jv,label:"My agents",path:"/agents",isActive:t==="agents",tourTag:"nav-item-agents"},{icon:T2e,label:"Agent hub",path:"/agent-hub",isActive:t==="agent-hub",tourTag:"nav-item-agent-hub"},{icon:s2e,label:"Schedules",path:"/schedules",isActive:t==="schedules",tourTag:"nav-item-schedules"},{icon:_g,label:"Browser",path:"/browser",isActive:t==="browser",tourTag:"nav-item-browser"},{icon:rg,label:"Settings",path:"/settings",isActive:t==="settings",tourTag:"nav-item-settings"}],o=f=>{const O=p.jsxs("button",{type:"button",onClick:()=>e(f.path),"data-tour-tag":f.tourTag,"aria-current":f.isActive?"page":void 0,"aria-label":s?void 0:f.label,className:A("flex h-8 w-full items-center rounded-sm text-body-sm transition-colors duration-fast ease-out-quart",s?"justify-start gap-2 px-3":"justify-center",f.isActive?"bg-accent-wash font-medium text-ink":"text-ink-muted hover:bg-elevated hover:text-ink"),children:[p.jsx(f.icon,{size:16,"aria-hidden":"true",className:A("shrink-0",f.isActive&&"text-accent")}),s&&p.jsx("span",{className:"truncate",children:f.label})]});return s?p.jsx("li",{children:O},f.path):p.jsx("li",{children:p.jsx(it,{content:f.label,side:"right",children:O})},f.path)},l=s?"Collapse sidebar":"Expand sidebar",c=navigator.platform.toUpperCase().indexOf("MAC")>=0,u=`Search (${kY(c)})`,d=s?p.jsxs("button",{type:"button","data-command-palette-trigger":"",onClick:i,className:A("flex h-8 w-full items-center gap-2 rounded-sm px-3 text-body-sm text-ink-muted","transition-colors duration-fast ease-out-quart","hover:bg-elevated hover:text-ink"),children:[p.jsx(dv,{size:16,"aria-hidden":"true",className:"shrink-0"}),p.jsx("span",{className:"truncate",children:"Search"}),p.jsx("span",{"aria-hidden":"true",className:"ml-auto",children:p.jsx(fd,{shortcut:UKn(c)})})]}):p.jsx(it,{content:u,side:"right",children:p.jsx("button",{type:"button","data-command-palette-trigger":"",onClick:i,"aria-label":u,className:A("flex h-8 w-full items-center justify-center rounded-sm text-ink-muted","transition-colors duration-fast ease-out-quart","hover:bg-elevated hover:text-ink"),children:p.jsx(dv,{size:16,"aria-hidden":"true"})})}),h=p.jsx("div",{className:A("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:p.jsx(it,{content:l,side:"right",children:p.jsx(we,{variant:"ghost",size:"icon-sm",onClick:r,"aria-label":l,"aria-expanded":s,children:s?p.jsx(Y1,{"aria-hidden":"true"}):p.jsx(Dp,{"aria-hidden":"true"})})})});return p.jsxs("nav",{className:A("group flex shrink-0 flex-col overflow-x-hidden bg-sunken transition-[width] duration-base ease-out-quart",s?l_e.expanded:l_e.collapsed),children:[p.jsx("div",{className:A("flex h-12 shrink-0 items-center",s?"justify-between pr-2 pl-5":"justify-center"),children:s?p.jsxs(p.Fragment,{children:[p.jsx(o_e,{expanded:!0}),h]}):p.jsxs("div",{className:"relative flex size-8 items-center justify-center",children:[p.jsx("div",{className:"transition-opacity duration-fast ease-out-quart group-hover:opacity-0 group-focus-within:opacity-0",children:p.jsx(o_e,{expanded:!1})}),p.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:h})]})}),p.jsx("ul",{className:"flex flex-col gap-1 p-2",children:a.map(o)}),p.jsxs("div",{className:"mt-auto flex flex-col gap-1 p-2",children:[d,p.jsx(lZe,{expanded:s})]})]})},enr=1,tnr=()=>{const{isAuthenticated:e,user:t}=XZ(),{hasBeenNotified:n,setHasBeenNotified:r}=oZe(),[i,s]=b.useState(!1),[a,o]=b.useState(null),l=b.useCallback(async()=>{if(!(!e||!t?.radientUser?.account?.tenant_id))try{const h=await NZ({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 b.useEffect(()=>{e&&l()},[e,l]),b.useEffect(()=>{e&&a!==null?a<enr?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}},nnr=b.lazy(()=>je(()=>import("./agent-details-page-DUnaZtSD.js"),__vite__mapDeps([8,1,2,9]),import.meta.url).then(e=>({default:e.AgentDetailsPage}))),rnr=b.lazy(()=>je(()=>import("./agent-hub-page-D2jMJi71.js"),__vite__mapDeps([10,1,2,11,12,9]),import.meta.url).then(e=>({default:e.AgentHubPage}))),c_e=b.lazy(()=>je(()=>import("./agents-page-BzmZF2wA.js"),__vite__mapDeps([13,1,2]),import.meta.url).then(e=>({default:e.AgentsPage}))),inr=b.lazy(()=>je(()=>import("./schedules-page-BSMjSJUt.js"),__vite__mapDeps([14,1,2,12,15]),import.meta.url).then(e=>({default:e.SchedulesPage}))),snr=b.lazy(()=>je(()=>import("./browser-page-CsDt8lIc.js"),__vite__mapDeps([16,1,2]),import.meta.url).then(e=>({default:e.BrowserPage}))),anr=b.lazy(()=>je(()=>import("./settings-page-BN1gnOIT.js"),__vite__mapDeps([17,1,2,12,18,15]),import.meta.url).then(e=>({default:e.SettingsPage}))),onr=()=>{const{isOnboardingActive:e}=hct(),{isLowCreditsDialogOpen:t,openRadientConsole:n,onLowCreditsDialogClose:r}=tnr(),{isCommandPaletteOpen:i,isCreateAgentDialogOpen:s,closeCreateAgentDialog:a}=mn();up(i,"command-palette"),up(s,"create-agent-dialog"),up(e,"onboarding"),up(t,"low-credits");const o=ka(),l=Wa(),c=Oi(l.data,"session_catalogue",2),u=h=>{o(`/chat/${h}`),a()};WKn();const d=Sn(h=>h.setActiveSession);return b.useEffect(()=>{const h=window.api?.desktop?.onOpenConversation?.(f=>{f!==null&&performance.mark("lop:open:requested"),d(f),o("/chat")});return()=>h?.()},[o,d]),b.useEffect(()=>{const h=window.api?.browser?.onConsentAttention?.(f=>{q5t(f.entryId),o("/browser")});return()=>h?.()},[o]),b.useEffect(()=>{const h=f=>{e||c&&XHn(f)&&(f.preventDefault(),Sn.getState().stageDraft(void 0,!0),o("/chat"))};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[c,e,o]),p.jsx(Btr,{children:p.jsxs("div",{className:"relative flex h-screen overflow-hidden",children:[i&&p.jsx(LKn,{}),p.jsx(nKn,{}),p.jsx(QCe,{}),p.jsx(mJn,{open:e}),p.jsx(Klt,{}),p.jsx(Ytr,{}),p.jsx(mut,{}),p.jsx(Ktr,{open:t,onClose:r,onGoToConsole:n}),p.jsx(Yct,{open:s,onClose:a,onAgentCreated:u}),p.jsx(Jtr,{}),p.jsx("main",{className:"flex grow flex-col overflow-hidden",children:p.jsx(b.Suspense,{fallback:p.jsx("div",{className:"flex grow items-center justify-center",children:p.jsx(pr,{size:"lg",label:"Loading page"})}),children:p.jsxs(vet,{children:[p.jsx(Bc,{path:"/",element:p.jsx(Zie,{to:"/chat",replace:!0})}),p.jsx(Bc,{path:"/chat",element:p.jsx(oTe,{})}),p.jsx(Bc,{path:"/chat/:agentId",element:p.jsx(oTe,{})}),p.jsx(Bc,{path:"/agents",element:p.jsx(c_e,{})}),p.jsx(Bc,{path:"/agents/:agentId",element:p.jsx(c_e,{})}),p.jsx(Bc,{path:"/settings",element:p.jsx(anr,{})}),p.jsx(Bc,{path:"/agent-hub",element:p.jsx(rnr,{})}),p.jsx(Bc,{path:"/agent-hub/:agentId",element:p.jsx(nnr,{})}),p.jsx(Bc,{path:"/schedules",element:p.jsx(inr,{})}),p.jsx(Bc,{path:"/browser",element:p.jsx(snr,{})}),p.jsx(Bc,{path:"*",element:p.jsx(Zie,{to:"/chat",replace:!0})})]})})})]})})};function F3(){return new Promise(e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))})}const lnr=3,cnr=3e3;function unr(e){return e instanceof CSSTransition&&e.playState==="running"}function dnr(e){const t=e.effect,n=t instanceof KeyframeEffect?t.target:null,r=e.transitionProperty,s=/^[a-z-]+$/.test(r)&&n instanceof Element?getComputedStyle(n).getPropertyValue(r).trim()||"(empty)":"(unreadable)";return`${r||"(unnamed property)"} on ${fre(n)??"an element no longer in the document"} = ${s}`}async function hnr(e=cnr){const t=performance.now();let n=0;for(;;){await F3();const r=Math.round(performance.now()-t),i=document.getAnimations().filter(unr);if(n=i.length===0?n+1:0,n>=lnr)return{waitedMs:r,timedOut:!1,pending:[]};if(r>e)return{waitedMs:r,timedOut:!0,pending:i.map(dnr)}}}const fnr=/^#/;function nT(){const e=window.location.hash.replace(fnr,"");return e===""?"/":e}function fre(e){if(!e)return null;const t=e.getAttribute("aria-label")??e.textContent??"";return`${e.tagName.toLowerCase()}${e.id?`#${e.id}`:""} "${t.trim().slice(0,60)}"`}function pnr(e){const t=e.getBoundingClientRect(),n=t.left+t.width/2,r=t.top+t.height/2,i=document.elementFromPoint(n,r),s=i!==null&&(i===e||e.contains(i)),a={bubbles:!0,cancelable:!0,composed:!0,button:0,buttons:1,clientX:n,clientY:r,view:window};return e.dispatchEvent(new PointerEvent("pointerdown",{...a,pointerId:1,isPrimary:!0})),e.dispatchEvent(new MouseEvent("mousedown",a)),e.dispatchEvent(new PointerEvent("pointerup",{...a,buttons:0,pointerId:1,isPrimary:!0})),e.dispatchEvent(new MouseEvent("mouseup",{...a,buttons:0})),e.dispatchEvent(new MouseEvent("click",{...a,buttons:0})),{hitTest:s,hit:fre(i),rect:{x:t.x,y:t.y,width:t.width,height:t.height}}}function jq(e,t){if(typeof e!="string"||e==="")throw new Error(`${t} must be a non-empty string`);return e}async function Onr(e,t=1e4){const n=Date.now();for(;nT()!==e;){if(Date.now()-n>t)throw new Error(`route did not become ${e} (it is ${nT()})`);await new Promise(r=>setTimeout(r,50))}return await F3(),nT()}function gnr(){const e=window.__loDevDriver;return e?.armed?e.install({hello:()=>({armed:!0,outDir:e.outDir,title:document.title,route:nT(),href:window.location.href,theme:mn.getState().themeName,viewport:{width:window.innerWidth,height:window.innerHeight,devicePixelRatio:window.devicePixelRatio},visibilityState:document.visibilityState,hasFocus:document.hasFocus(),apiBaseUrl:ai.baseUrl,userAgent:navigator.userAgent}),state:()=>{const t=mn.getState(),n=Sn.getState();return{route:nT(),theme:t.themeName,commandPaletteOpen:t.isCommandPaletteOpen,canvasOpen:t.isCanvasOpen,runPanelOpen:t.isRunPanelOpen,browserPaneOpen:t.isBrowserPaneOpen,browserPanelWidth:t.browserPanelWidth,activeSessionId:n.activeSessionId,sessionCount:n.sessions.length,onboardingVisible:!!document.querySelector("[data-onboarding-modal]")}},navigate:async t=>{const n=jq(t,"navigate path");if(!n.startsWith("/"))throw new Error(`navigate path must start with "/" (got "${n}")`);return window.location.hash=`#${n}`,{route:await Onr(n)}},setTheme:async t=>{const n=jq(t,"theme name");mn.getState().setTheme(n),await F3();const r=document.documentElement.getAttribute("data-theme"),i=await hnr();return{theme:mn.getState().themeName,dataTheme:r,settledAfterMs:i.waitedMs,settleTimedOut:i.timedOut,settlePending:i.pending}},press:async t=>{const n=typeof t=="string"?{selector:t}:t,r=jq(n?.selector,"press selector"),i=typeof n?.timeoutMs=="number"?n.timeoutMs:1e4,s=Date.now();let a=null;for(;a===null&&(a=document.querySelector(r),a===null);){if(Date.now()-s>i)throw new Error(`nothing matches ${r} after ${i}ms of waiting`);await new Promise(l=>setTimeout(l,100))}const o=pnr(a);return await F3(),{selector:r,target:fre(a),...o}}}):[]}const mnr={queries:{staleTime:5*60*1e3,gcTime:10*60*1e3,retry:1,refetchOnWindowFocus:!0,refetchOnMount:!0,refetchOnReconnect:!1,networkMode:"always"},mutations:{retry:1,networkMode:"always"}},cZe=new YZe({defaultOptions:mnr}),vnr=`
|
|
1457
1457
|
*::-webkit-scrollbar {
|
|
1458
1458
|
width: 8px;
|
|
1459
1459
|
height: 8px;
|
|
@@ -1466,4 +1466,4 @@ A good description helps you and others understand what the agent does and any s
|
|
|
1466
1466
|
*::-webkit-scrollbar-corner {
|
|
1467
1467
|
background-color: transparent;
|
|
1468
1468
|
}
|
|
1469
|
-
`,ynr=()=>p.jsx("style",{children:vnr}),bnr=({children:e})=>p.jsx(D_e,{client:cZe,children:e}),wnr=({children:e})=>p.jsx(bnr,{children:e}),xnr=b.createContext(null),Snr=({children:e})=>{const t=b.useMemo(()=>()=>{c0.reloadFeatureFlags()},[]);b.useEffect(()=>{t();const r=setInterval(()=>{t()},10*60*1e3);return()=>{clearInterval(r)}},[t]);const n=b.useMemo(()=>({isEnabled:r=>g6(r),getValue:r=>{if(typeof g6(r)=="boolean")return g6(r)},reloadFeatureFlags:t}),[t]);return p.jsx(xnr.Provider,{value:n,children:e})},$nr=({children:e})=>{const t=mn(r=>r.themeName),n=g_e(t);return b.useLayoutEffect(()=>{RZe(t)},[t]),p.jsx(Qlt,{theme:n.theme,children:e})},knr={api_host:J$.VITE_PUBLIC_POSTHOG_HOST,capture_exceptions:!0};gnr();document.addEventListener("DOMContentLoaded",()=>{AZe.createRoot(document.getElementById("app")).render(p.jsx(H.StrictMode,{children:p.jsx(xJe,{apiKey:J$.VITE_PUBLIC_POSTHOG_KEY,options:knr,children:p.jsx(D_e,{client:cZe,children:p.jsx(Snr,{children:p.jsx(wnr,{children:p.jsxs($nr,{children:[p.jsx(ynr,{}),p.jsx(zq,{children:p.jsx(_et,{children:p.jsx(onr,{})})}),p.jsx(Hct,{}),S_e()]})})})})})}))});export{Lr as $,drr as A,Jv as B,Y1 as C,j5 as D,VT as E,JEe as F,hgt as G,nn as H,Sh as I,Yr as J,hy as K,qr as L,R as M,jr as N,Li as O,Z1 as P,Ar as Q,_N as R,O2 as S,ys as T,vp as U,ls as V,Es as W,Cu as X,NJ as Y,qo as Z,je as _,Znr as a,PH as a$,OJ as a0,Pi as a1,zu as a2,Xc as a3,zp as a4,yrr as a5,$ge as a6,BP as a7,YKn as a8,qQ as a9,Frr as aA,cJn as aB,Mrr as aC,aJn as aD,sJn as aE,iJn as aF,FYe as aG,Fet as aH,lnt as aI,k2e as aJ,Np as aK,oJn as aL,wrr as aM,Nc as aN,sl as aO,vd as aP,Nl as aQ,Oyt as aR,pH as aS,BQe as aT,JP as aU,HQe as aV,frr as aW,p1t as aX,lde as aY,ode as aZ,ORe as a_,XZ as aa,Yrr as ab,Ol as ac,XYe as ad,zrr as ae,qrr as af,Brr as ag,IYe as ah,Lrr as ai,jrr as aj,eH as ak,fH as al,lJn as am,gTe as an,uJn as ao,T2e as ap,Wrr as aq,Rr as ar,ms as as,Urr as at,Grr as au,Vrr as av,Trt as aw,m7t as ax,Zrt as ay,fZ as az,Wa as b,TY as b$,CD as b0,nbt as b1,tbt as b2,uw as b3,ebt as b4,Jyt as b5,q5 as b6,t2 as b7,TH as b8,$H as b9,trr as bA,p5 as bB,rot as bC,Cct as bD,Knr as bE,V3 as bF,Nz as bG,Mlt as bH,Db as bI,wb as bJ,If as bK,Y2t as bL,GD as bM,VD as bN,vTt as bO,UD as bP,g8t as bQ,ci as bR,Pct as bS,NZ as bT,R2e as bU,Nu as bV,dZ as bW,Y2e as bX,Zrr as bY,d2e as bZ,B3 as b_,x0 as ba,L5 as bb,Jnr as bc,eCe as bd,lZ as be,rg as bf,Ott as bg,tse as bh,nD as bi,WP as bj,As as bk,ai as bl,srr as bm,Kv as bn,err as bo,dv as bp,Iy as bq,uae as br,yZ as bs,YWn as bt,JWn as bu,wtt as bv,$2e as bw,Gct as bx,mn as by,wy as bz,kHn as c,
|
|
1469
|
+
`,ynr=()=>p.jsx("style",{children:vnr}),bnr=({children:e})=>p.jsx(D_e,{client:cZe,children:e}),wnr=({children:e})=>p.jsx(bnr,{children:e}),xnr=b.createContext(null),Snr=({children:e})=>{const t=b.useMemo(()=>()=>{c0.reloadFeatureFlags()},[]);b.useEffect(()=>{t();const r=setInterval(()=>{t()},10*60*1e3);return()=>{clearInterval(r)}},[t]);const n=b.useMemo(()=>({isEnabled:r=>g6(r),getValue:r=>{if(typeof g6(r)=="boolean")return g6(r)},reloadFeatureFlags:t}),[t]);return p.jsx(xnr.Provider,{value:n,children:e})},$nr=({children:e})=>{const t=mn(r=>r.themeName),n=g_e(t);return b.useLayoutEffect(()=>{RZe(t)},[t]),p.jsx(Qlt,{theme:n.theme,children:e})},knr={api_host:J$.VITE_PUBLIC_POSTHOG_HOST,capture_exceptions:!0};gnr();document.addEventListener("DOMContentLoaded",()=>{AZe.createRoot(document.getElementById("app")).render(p.jsx(H.StrictMode,{children:p.jsx(xJe,{apiKey:J$.VITE_PUBLIC_POSTHOG_KEY,options:knr,children:p.jsx(D_e,{client:cZe,children:p.jsx(Snr,{children:p.jsx(wnr,{children:p.jsxs($nr,{children:[p.jsx(ynr,{}),p.jsx(zq,{children:p.jsx(_et,{children:p.jsx(onr,{})})}),p.jsx(Hct,{}),S_e()]})})})})})}))});export{Lr as $,drr as A,Jv as B,Y1 as C,j5 as D,VT as E,JEe as F,hgt as G,nn as H,Sh as I,Yr as J,hy as K,qr as L,R as M,jr as N,Li as O,Z1 as P,Ar as Q,_N as R,O2 as S,ys as T,vp as U,ls as V,Es as W,Cu as X,NJ as Y,qo as Z,je as _,Znr as a,PH as a$,OJ as a0,Pi as a1,zu as a2,Xc as a3,zp as a4,yrr as a5,$ge as a6,BP as a7,YKn as a8,qQ as a9,Frr as aA,cJn as aB,Mrr as aC,aJn as aD,sJn as aE,iJn as aF,FYe as aG,Fet as aH,lnt as aI,k2e as aJ,Np as aK,oJn as aL,wrr as aM,Nc as aN,sl as aO,vd as aP,Nl as aQ,Oyt as aR,pH as aS,BQe as aT,JP as aU,HQe as aV,frr as aW,p1t as aX,lde as aY,ode as aZ,ORe as a_,XZ as aa,Yrr as ab,Ol as ac,XYe as ad,zrr as ae,qrr as af,Brr as ag,IYe as ah,Lrr as ai,jrr as aj,eH as ak,fH as al,lJn as am,gTe as an,uJn as ao,T2e as ap,Wrr as aq,Rr as ar,ms as as,Urr as at,Grr as au,Vrr as av,Trt as aw,m7t as ax,Zrt as ay,fZ as az,Wa as b,TY as b$,CD as b0,nbt as b1,tbt as b2,uw as b3,ebt as b4,Jyt as b5,q5 as b6,t2 as b7,TH as b8,$H as b9,trr as bA,p5 as bB,rot as bC,Cct as bD,Knr as bE,V3 as bF,Nz as bG,Mlt as bH,Db as bI,wb as bJ,If as bK,Y2t as bL,GD as bM,VD as bN,vTt as bO,UD as bP,g8t as bQ,ci as bR,Pct as bS,NZ as bT,R2e as bU,Nu as bV,dZ as bW,Y2e as bX,Zrr as bY,d2e as bZ,B3 as b_,x0 as ba,L5 as bb,Jnr as bc,eCe as bd,lZ as be,rg as bf,Ott as bg,tse as bh,nD as bi,WP as bj,As as bk,ai as bl,srr as bm,Kv as bn,err as bo,dv as bp,Iy as bq,uae as br,yZ as bs,YWn as bt,JWn as bu,wtt as bv,$2e as bw,Gct as bx,mn as by,wy as bz,kHn as c,ult as c$,YP as c0,Bct as c1,nAe as c2,prr as c3,yh as c4,jW as c5,$4 as c6,jut as c7,uZ as c8,W4e as c9,k5 as cA,I5 as cB,mde as cC,_yt as cD,ZT as cE,bgt as cF,wgt as cG,ygt as cH,vgt as cI,mgt as cJ,ggt as cK,Ogt as cL,bD as cM,JOt as cN,KOt as cO,pgt as cP,fgt as cQ,Rot as cR,pCe as cS,O5 as cT,aD as cU,Wot as cV,SZ as cW,cCe as cX,Kot as cY,uCe as cZ,hlt as c_,tAe as ca,O5t as cb,eK as cc,DZ as cd,Qnt as ce,FCt as cf,so as cg,_Ne as ch,Wet as ci,zrt as cj,Vct as ck,Gtr as cl,lD as cm,Irr as cn,RKn as co,_2e as cp,ltt as cq,s5 as cr,Unt as cs,Iz as ct,i5 as cu,HKn as cv,I0 as cw,A7 as cx,RCe as cy,rQe as cz,Oi as d,Vz as d0,flt as d1,n1 as d2,r5e as d3,SNe as d4,Cge as d5,c2 as d6,brr as d7,kNe as d8,E_ as d9,I4 as da,e7t as db,K8t as dc,F4 as dd,$Ne as de,n7t as df,o7t as dg,l7t as dh,a7t as di,Lit as dj,v8t as dk,ri as dl,irr as dm,rrr as dn,nrr as dp,ilt as dq,s2e as dr,G3 as ds,eit as dt,E2e as du,vrr as dv,THn as e,Mi as f,ir as g,ka as h,Sn as i,qt as j,g4t as k,BEe as l,Ii as m,Ale as n,urr as o,rw as p,Ld as q,crr as r,$5 as s,yD as t,HPe as u,arr as v,JZ as w,orr as x,hrr as y,lrr as z};
|