(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();const J$=!1;var K1=Array.isArray,vK=Array.prototype.indexOf,SC=Array.from,kC=Object.defineProperty,Dc=Object.getOwnPropertyDescriptor,eM=Object.getOwnPropertyDescriptors,wK=Object.prototype,xK=Array.prototype,CC=Object.getPrototypeOf,bT=Object.isExtensible;function Dd(t){return typeof t=="function"}const Cn=()=>{};function _K(t){return t()}function hv(t){for(var e=0;e{t=r,e=i});return{promise:n,resolve:t,reject:e}}function Y_(t,e,n=!1){return t===void 0?n?e():e:t}function OT(t,e){if(Array.isArray(t))return t;if(!(Symbol.iterator in t))return Array.from(t);const n=[];for(const r of t)if(n.push(r),n.length===e)break;return n}const Si=2,Zw=4,Xw=8,Il=16,Zu=32,Gh=64,Ww=128,oi=1024,ks=2048,Fl=4096,Gs=8192,Cu=16384,Yw=32768,Qu=65536,vT=1<<17,nM=1<<18,P0=1<<19,rM=1<<20,xo=256,dv=512,pv=32768,gk=1<<21,AC=1<<22,Pc=1<<23,ul=Symbol("$state"),EC=Symbol("legacy props"),SK=Symbol(""),Zd=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},Gw=3,Hh=8;function Hw(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function kK(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function CK(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function AK(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function EK(t){throw new Error("https://svelte.dev/e/effect_orphan")}function TK(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function DK(){throw new Error("https://svelte.dev/e/hydration_failed")}function PK(t){throw new Error("https://svelte.dev/e/lifecycle_legacy_only")}function RK(t){throw new Error("https://svelte.dev/e/props_invalid_value")}function IK(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function FK(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function $K(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function MK(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}const Kw=1,Jw=2,iM=4,LK=8,NK=16,QK=1,BK=2,zK=4,UK=8,jK=16,qK=1,VK=2,ZK=4,sM=1,XK=2,oM="[",ex="[!",TC="]",_h={},ni=Symbol(),WK="http://www.w3.org/1999/xhtml",YK="@attach";function J1(t){console.warn("https://svelte.dev/e/hydration_mismatch")}function GK(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function HK(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let vt=!1;function aa(t){vt=t}let Mt;function Oi(t){if(t===null)throw J1(),_h;return Mt=t}function jc(){return Oi(ga(Mt))}function F(t){if(vt){if(ga(Mt)!==null)throw J1(),_h;Mt=t}}function ws(t=1){if(vt){for(var e=t,n=Mt;e--;)n=ga(n);Mt=n}}function mv(t=!0){for(var e=0,n=Mt;;){if(n.nodeType===Hh){var r=n.data;if(r===TC){if(e===0)return n;e-=1}else(r===oM||r===ex)&&(e+=1)}var i=ga(n);t&&n.remove(),n=i}}function aM(t){if(!t||t.nodeType!==Hh)throw J1(),_h;return t.data}function lM(t){return t===this.v}function DC(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function uM(t){return!DC(t,this.v)}let R0=!1,KK=!1;function JK(){R0=!0}let wn=null;function Bp(t){wn=t}function De(t,e=!1,n){wn={p:wn,i:!1,c:null,e:null,s:t,x:null,l:R0&&!e?{s:null,u:null,$:[]}:null}}function Pe(t){var e=wn,n=e.e;if(n!==null){e.e=null;for(var r of n)TM(r)}return t!==void 0&&(e.x=t),e.i=!0,wn=e.p,t??{}}function I0(){return!R0||wn!==null&&wn.l===null}let Uf=[];function cM(){var t=Uf;Uf=[],hv(t)}function Xu(t){if(Uf.length===0&&!mg){var e=Uf;queueMicrotask(()=>{e===Uf&&cM()})}Uf.push(t)}function eJ(){for(;Uf.length>0;)cM()}function fM(t){var e=At;if(e===null)return Ft.f|=Pc,t;if((e.f&Yw)===0){if((e.f&Ww)===0)throw t;e.b.error(t)}else zp(t,e)}function zp(t,e){for(;e!==null;){if((e.f&Ww)!==0)try{e.b.error(t);return}catch(n){t=n}e=e.parent}throw t}const Uy=new Set;let qn=null,lO=null,ta=null,qa=[],tx=null,yk=!1,mg=!1,jf=class bk{committed=!1;current=new Map;previous=new Map;#t=new Set;#e=new Set;#n=0;#r=0;#l=null;#a=[];#o=[];skipped_effects=new Set;is_fork=!1;process(e){qa=[],lO=null,this.apply();var n={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(const r of e)this.#i(r,n);this.is_fork||this.#u(),this.#r>0||this.is_fork?(this.#s(n.effects),this.#s(n.render_effects),this.#s(n.block_effects)):(lO=this,qn=null,wT(n.render_effects),wT(n.effects),lO=null,this.#l?.resolve()),ta=null}#i(e,n){e.f^=oi;for(var r=e.first;r!==null;){var i=r.f,s=(i&(Zu|Gh))!==0,o=s&&(i&oi)!==0,a=o||(i&Gs)!==0||this.skipped_effects.has(r);if((r.f&Ww)!==0&&r.b?.is_pending()&&(n={parent:n,effect:r,effects:[],render_effects:[],block_effects:[]}),!a&&r.fn!==null){s?r.f^=oi:(i&Zw)!==0?n.effects.push(r):L0(r)&&((r.f&Il)!==0&&n.block_effects.push(r),jp(r));var l=r.first;if(l!==null){r=l;continue}}var u=r.parent;for(r=r.next;r===null&&u!==null;)u===n.effect&&(this.#s(n.effects),this.#s(n.render_effects),this.#s(n.block_effects),n=n.parent),r=u.next,u=u.parent}}#s(e){for(const n of e)((n.f&ks)!==0?this.#a:this.#o).push(n),li(n,oi)}capture(e,n){this.previous.has(e)||this.previous.set(e,n),(e.f&Pc)===0&&(this.current.set(e,e.v),ta?.set(e,e.v))}activate(){qn=this,this.apply()}deactivate(){qn=null,ta=null}flush(){if(this.activate(),qa.length>0){if(dM(),qn!==null&&qn!==this)return}else this.#n===0&&this.process([]);this.deactivate()}discard(){for(const e of this.#e)e(this);this.#e.clear()}#u(){if(this.#r===0){for(const e of this.#t)e();this.#t.clear()}this.#n===0&&this.#c()}#c(){if(Uy.size>1){this.previous.clear();var e=ta,n=!0,r={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(const i of Uy){if(i===this){n=!1;continue}const s=[];for(const[a,l]of this.current){if(i.current.has(a))if(n&&l!==i.current.get(a))i.current.set(a,l);else continue;s.push(a)}if(s.length===0)continue;const o=[...i.current.keys()].filter(a=>!this.current.has(a));if(o.length>0){const a=new Set,l=new Map;for(const u of s)pM(u,o,a,l);if(qa.length>0){qn=i,i.apply();for(const u of qa)i.#i(u,r);qa=[],i.deactivate()}}}qn=null,ta=e}this.committed=!0,Uy.delete(this)}increment(e){this.#n+=1,e&&(this.#r+=1)}decrement(e){this.#n-=1,e&&(this.#r-=1),this.revive()}revive(){for(const e of this.#a)li(e,ks),Sh(e);for(const e of this.#o)li(e,Fl),Sh(e);this.#a=[],this.#o=[],this.flush()}oncommit(e){this.#t.add(e)}ondiscard(e){this.#e.add(e)}settled(){return(this.#l??=tM()).promise}static ensure(){if(qn===null){const e=qn=new bk;Uy.add(qn),mg||bk.enqueue(()=>{qn===e&&e.flush()})}return qn}static enqueue(e){Xu(e)}apply(){}};function hM(t){var e=mg;mg=!0;try{for(var n;;){if(eJ(),qa.length===0&&(qn?.flush(),qa.length===0))return tx=null,n;dM()}}finally{mg=e}}function dM(){var t=ap;yk=!0;try{var e=0;for(ST(!0);qa.length>0;){var n=jf.ensure();if(e++>1e3){var r,i;tJ()}n.process(qa),Rc.clear()}}finally{yk=!1,ST(t),tx=null}}function tJ(){try{TK()}catch(t){zp(t,tx)}}let nu=null;function wT(t){var e=t.length;if(e!==0){for(var n=0;n0)){Rc.clear();for(const i of nu){if((i.f&(Cu|Gs))!==0)continue;const s=[i];let o=i.parent;for(;o!==null;)nu.has(o)&&(nu.delete(o),s.push(o)),o=o.parent;for(let a=s.length-1;a>=0;a--){const l=s[a];(l.f&(Cu|Gs))===0&&jp(l)}}nu.clear()}}nu=null}}function pM(t,e,n,r){if(!n.has(t)&&(n.add(t),t.reactions!==null))for(const i of t.reactions){const s=i.f;(s&Si)!==0?pM(i,e,n,r):(s&(AC|Il))!==0&&(s&ks)===0&&mM(i,e,r)&&(li(i,ks),Sh(i))}}function mM(t,e,n){const r=n.get(t);if(r!==void 0)return r;if(t.deps!==null)for(const i of t.deps){if(e.includes(i))return!0;if((i.f&Si)!==0&&mM(i,e,n))return n.set(i,!0),!0}return n.set(t,!1),!1}function Sh(t){for(var e=tx=t;e.parent!==null;){e=e.parent;var n=e.f;if(yk&&e===At&&(n&Il)!==0&&(n&nM)===0)return;if((n&(Gh|Zu))!==0){if((n&oi)===0)return;e.f^=oi}}qa.push(e)}function nJ(t){let e=0,n=kh(0),r;return()=>{dJ()&&(b(n),M0(()=>(e===0&&(r=Br(()=>t(()=>gg(n)))),e+=1,()=>{Xu(()=>{e-=1,e===0&&(r?.(),r=void 0,gg(n))})})))}}var rJ=Qu|P0|Ww;function gM(t,e,n){new iJ(t,e,n)}class iJ{parent;#t=!1;#e;#n=vt?Mt:null;#r;#l;#a;#o=null;#i=null;#s=null;#u=null;#c=null;#d=0;#f=0;#p=!1;#h=null;#O=nJ(()=>(this.#h=kh(this.#d),()=>{this.#h=null}));constructor(e,n,r){this.#e=e,this.#r=n,this.#l=r,this.parent=At.b,this.#t=!!this.#r.pending,this.#a=hf(()=>{if(At.b=this,vt){const s=this.#n;jc(),s.nodeType===Hh&&s.data===ex?this.#w():this.#v()}else{var i=this.#y();try{this.#o=us(()=>r(i))}catch(s){this.error(s)}this.#f>0?this.#g():this.#t=!1}return()=>{this.#c?.remove()}},rJ),vt&&(this.#e=Mt)}#v(){try{this.#o=us(()=>this.#l(this.#e))}catch(e){this.error(e)}this.#t=!1}#w(){const e=this.#r.pending;e&&(this.#i=us(()=>e(this.#e)),jf.enqueue(()=>{var n=this.#y();this.#o=this.#m(()=>(jf.ensure(),us(()=>this.#l(n)))),this.#f>0?this.#g():(op(this.#i,()=>{this.#i=null}),this.#t=!1)}))}#y(){var e=this.#e;return this.#t&&(this.#c=to(),this.#e.before(this.#c),e=this.#c),e}is_pending(){return this.#t||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!this.#r.pending}#m(e){var n=At,r=Ft,i=wn;vl(this.#a),gs(this.#a),Bp(this.#a.ctx);try{return e()}catch(s){return fM(s),null}finally{vl(n),gs(r),Bp(i)}}#g(){const e=this.#r.pending;this.#o!==null&&(this.#u=document.createDocumentFragment(),this.#u.append(this.#c),MM(this.#o,this.#u)),this.#i===null&&(this.#i=us(()=>e(this.#e)))}#b(e){if(!this.has_pending_snippet()){this.parent&&this.parent.#b(e);return}this.#f+=e,this.#f===0&&(this.#t=!1,this.#i&&op(this.#i,()=>{this.#i=null}),this.#u&&(this.#e.before(this.#u),this.#u=null))}update_pending_count(e){this.#b(e),this.#d+=e,this.#h&&Up(this.#h,this.#d)}get_effect_pending(){return this.#O(),b(this.#h)}error(e){var n=this.#r.onerror;let r=this.#r.failed;if(this.#p||!n&&!r)throw e;this.#o&&(ei(this.#o),this.#o=null),this.#i&&(ei(this.#i),this.#i=null),this.#s&&(ei(this.#s),this.#s=null),vt&&(Oi(this.#n),ws(),Oi(mv()));var i=!1,s=!1;const o=()=>{if(i){HK();return}i=!0,s&&MK(),jf.ensure(),this.#d=0,this.#s!==null&&op(this.#s,()=>{this.#s=null}),this.#t=this.has_pending_snippet(),this.#o=this.#m(()=>(this.#p=!1,us(()=>this.#l(this.#e)))),this.#f>0?this.#g():this.#t=!1};var a=Ft;try{gs(null),s=!0,n?.(e,o),s=!1}catch(l){zp(l,this.#a&&this.#a.parent)}finally{gs(a)}r&&Xu(()=>{this.#s=this.#m(()=>{jf.ensure(),this.#p=!0;try{return us(()=>{r(this.#e,()=>e,()=>o)})}catch(l){return zp(l,this.#a.parent),null}finally{this.#p=!1}})})}}function yM(t,e,n,r){const i=I0()?ey:PC;if(n.length===0&&t.length===0){r(e.map(i));return}var s=qn,o=At,a=sJ();function l(){Promise.all(n.map(u=>oJ(u))).then(u=>{a();try{r([...e.map(i),...u])}catch(c){(o.f&Cu)===0&&zp(c,o)}s?.deactivate(),gv()}).catch(u=>{zp(u,o)})}t.length>0?Promise.all(t).then(()=>{a();try{return l()}finally{s?.deactivate(),gv()}}):l()}function sJ(){var t=At,e=Ft,n=wn,r=qn;return function(s=!0){vl(t),gs(e),Bp(n),s&&r?.activate()}}function gv(){vl(null),gs(null),Bp(null)}function ey(t){var e=Si|ks,n=Ft!==null&&(Ft.f&Si)!==0?Ft:null;return At===null||n!==null&&(n.f&xo)!==0?e|=xo:At.f|=P0,{ctx:wn,deps:null,effects:null,equals:lM,f:e,fn:t,reactions:null,rv:0,v:ni,wv:0,parent:n??At,ac:null}}function oJ(t,e){let n=At;n===null&&kK();var r=n.b,i=void 0,s=kh(ni),o=!Ft,a=new Map;return yJ(()=>{var l=tM();i=l.promise;try{Promise.resolve(t()).then(l.resolve,l.reject).then(()=>{u===qn&&u.committed&&u.deactivate(),gv()})}catch(h){l.reject(h),gv()}var u=qn;if(o){var c=!r.is_pending();r.update_pending_count(1),u.increment(c),a.get(u)?.reject(Zd),a.delete(u),a.set(u,l)}const f=(h,d=void 0)=>{if(u.activate(),d)d!==Zd&&(s.f|=Pc,Up(s,d));else{(s.f&Pc)!==0&&(s.f^=Pc),Up(s,h);for(const[p,m]of a){if(a.delete(p),p===u)break;m.reject(Zd)}}o&&(r.update_pending_count(-1),u.decrement(c))};l.promise.then(f,h=>f(null,h||"unknown"))}),nx(()=>{for(const l of a.values())l.reject(Zd)}),new Promise(l=>{function u(c){function f(){c===i?l(s):u(i)}c.then(f,f)}u(i)})}function L(t){const e=ey(t);return LM(e),e}function PC(t){const e=ey(t);return e.equals=uM,e}function bM(t){var e=t.effects;if(e!==null){t.effects=null;for(var n=0;n0&&!vM&&lJ()}return e}function lJ(){vM=!1;const t=Array.from(Ok);for(const e of t)(e.f&oi)!==0&&li(e,Fl),L0(e)&&jp(e);Ok.clear()}function gg(t){X(t,t.v+1)}function wM(t,e){var n=t.reactions;if(n!==null)for(var r=I0(),i=n.length,s=0;s{if(fh===s)return a();var l=Ft,u=fh;gs(null),CT(s);var c=a();return gs(l),CT(u),c};return r&&n.set("length",pe(t.length)),new Proxy(t,{defineProperty(a,l,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&IK();var c=n.get(l);return c===void 0?c=o(()=>{var f=pe(u.value);return n.set(l,f),f}):X(c,u.value,!0),!0},deleteProperty(a,l){var u=n.get(l);if(u===void 0){if(l in a){const c=o(()=>pe(ni));n.set(l,c),gg(i)}}else X(u,ni),gg(i);return!0},get(a,l,u){if(l===ul)return t;var c=n.get(l),f=l in a;if(c===void 0&&(!f||Dc(a,l)?.writable)&&(c=o(()=>{var d=vc(f?a[l]:ni),p=pe(d);return p}),n.set(l,c)),c!==void 0){var h=b(c);return h===ni?void 0:h}return Reflect.get(a,l,u)},getOwnPropertyDescriptor(a,l){var u=Reflect.getOwnPropertyDescriptor(a,l);if(u&&"value"in u){var c=n.get(l);c&&(u.value=b(c))}else if(u===void 0){var f=n.get(l),h=f?.v;if(f!==void 0&&h!==ni)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return u},has(a,l){if(l===ul)return!0;var u=n.get(l),c=u!==void 0&&u.v!==ni||Reflect.has(a,l);if(u!==void 0||At!==null&&(!c||Dc(a,l)?.writable)){u===void 0&&(u=o(()=>{var h=c?vc(a[l]):ni,d=pe(h);return d}),n.set(l,u));var f=b(u);if(f===ni)return!1}return c},set(a,l,u,c){var f=n.get(l),h=l in a;if(r&&l==="length")for(var d=u;dpe(ni)),n.set(d+"",p))}if(f===void 0)(!h||Dc(a,l)?.writable)&&(f=o(()=>pe(void 0)),X(f,vc(u)),n.set(l,f));else{h=f.v!==ni;var m=o(()=>vc(u));X(f,m)}var g=Reflect.getOwnPropertyDescriptor(a,l);if(g?.set&&g.set.call(c,u),!h){if(r&&typeof l=="string"){var y=n.get("length"),O=Number(l);Number.isInteger(O)&&O>=y.v&&X(y,O+1)}gg(i)}return!0},ownKeys(a){b(i);var l=Reflect.ownKeys(a).filter(f=>{var h=n.get(f);return h===void 0||h.v!==ni});for(var[u,c]of n)c.v!==ni&&!(u in a)&&l.push(u);return l},setPrototypeOf(){FK()}})}function xT(t){try{if(t!==null&&typeof t=="object"&&ul in t)return t[ul]}catch{}return t}function uJ(t,e){return Object.is(xT(t),xT(e))}var vk,xM,_M,SM;function wk(){if(vk===void 0){vk=window,xM=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;_M=Dc(e,"firstChild").get,SM=Dc(e,"nextSibling").get,bT(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),bT(n)&&(n.__t=void 0)}}function to(t=""){return document.createTextNode(t)}function gi(t){return _M.call(t)}function ga(t){return SM.call(t)}function M(t,e){if(!vt)return gi(t);var n=gi(Mt);if(n===null)n=Mt.appendChild(to());else if(e&&n.nodeType!==Gw){var r=to();return n?.before(r),Oi(r),r}return Oi(n),n}function ke(t,e=!1){if(!vt){var n=gi(t);return n instanceof Comment&&n.data===""?ga(n):n}if(e&&Mt?.nodeType!==Gw){var r=to();return Mt?.before(r),Oi(r),r}return Mt}function V(t,e=1,n=!1){let r=vt?Mt:t;for(var i;e--;)i=r,r=ga(r);if(!vt)return r;if(n&&r?.nodeType!==Gw){var s=to();return r===null?i?.after(s):r.before(s),Oi(s),s}return Oi(r),r}function kM(t){t.textContent=""}function CM(){return!1}function cJ(t,e){if(e){const n=document.body;t.autofocus=!0,Xu(()=>{document.activeElement===n&&t.focus()})}}let _T=!1;function AM(){_T||(_T=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{if(!t.defaultPrevented)for(const e of t.target.elements)e.__on_r?.()})},{capture:!0}))}function F0(t){var e=Ft,n=At;gs(null),vl(null);try{return t()}finally{gs(e),vl(n)}}function fJ(t,e,n,r=n){t.addEventListener(e,()=>F0(n));const i=t.__on_r;i?t.__on_r=()=>{i(),r(!0)}:t.__on_r=()=>r(!0),AM()}function EM(t){At===null&&Ft===null&&EK(),Ft!==null&&(Ft.f&xo)!==0&&At===null&&AK(),Kh&&CK()}function hJ(t,e){var n=e.last;n===null?e.last=e.first=t:(n.next=t,t.prev=n,e.last=t)}function $l(t,e,n,r=!0){var i=At;i!==null&&(i.f&Gs)!==0&&(t|=Gs);var s={ctx:wn,deps:null,nodes_start:null,nodes_end:null,f:t|ks,first:null,fn:e,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(n)try{jp(s),s.f|=Yw}catch(l){throw ei(s),l}else e!==null&&Sh(s);if(r){var o=s;if(n&&o.deps===null&&o.teardown===null&&o.nodes_start===null&&o.first===o.last&&(o.f&P0)===0&&(o=o.first,(t&Il)!==0&&(t&Qu)!==0&&o!==null&&(o.f|=Qu)),o!==null&&(o.parent=i,i!==null&&hJ(o,i),Ft!==null&&(Ft.f&Si)!==0&&(t&Gh)===0)){var a=Ft;(a.effects??=[]).push(o)}}return s}function dJ(){return Ft!==null&&!na}function nx(t){const e=$l(Xw,null,!1);return li(e,oi),e.teardown=t,e}function ki(t){EM();var e=At.f,n=!Ft&&(e&Zu)!==0&&(e&Yw)===0;if(n){var r=wn;(r.e??=[]).push(t)}else return TM(t)}function TM(t){return $l(Zw|rM,t,!1)}function An(t){return EM(),$l(Xw|rM,t,!0)}function pJ(t){jf.ensure();const e=$l(Gh|P0,t,!0);return(n={})=>new Promise(r=>{n.outro?op(e,()=>{ei(e),r(void 0)}):(ei(e),r(void 0))})}function $0(t){return $l(Zw,t,!1)}function mJ(t,e){var n=wn,r={effect:null,ran:!1,deps:t};n.l.$.push(r),r.effect=M0(()=>{t(),!r.ran&&(r.ran=!0,Br(e))})}function gJ(){var t=wn;M0(()=>{for(var e of t.l.$){e.deps();var n=e.effect;(n.f&oi)!==0&&li(n,Fl),L0(n)&&jp(n),e.ran=!1}})}function yJ(t){return $l(AC|P0,t,!0)}function M0(t,e=0){return $l(Xw|e,t,!0)}function de(t,e=[],n=[],r=[],i=!1){yM(r,e,n,s=>{$l(i?Zw:Xw,()=>t(...s.map(b)),!0)})}function hf(t,e=0){var n=$l(Il|e,t,!0);return n}function us(t,e=!0){return $l(Zu|P0,t,!0,e)}function DM(t){var e=t.teardown;if(e!==null){const n=Kh,r=Ft;kT(!0),gs(null);try{e.call(null)}finally{kT(n),gs(r)}}}function PM(t,e=!1){var n=t.first;for(t.first=t.last=null;n!==null;){const i=n.ac;i!==null&&F0(()=>{i.abort(Zd)});var r=n.next;(n.f&Gh)!==0?n.parent=null:ei(n,e),n=r}}function bJ(t){for(var e=t.first;e!==null;){var n=e.next;(e.f&Zu)===0&&ei(e),e=n}}function ei(t,e=!0){var n=!1;(e||(t.f&nM)!==0)&&t.nodes_start!==null&&t.nodes_end!==null&&(RM(t.nodes_start,t.nodes_end),n=!0),PM(t,e&&!n),yv(t,0),li(t,Cu);var r=t.transitions;if(r!==null)for(const s of r)s.stop();DM(t);var i=t.parent;i!==null&&i.first!==null&&IM(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes_start=t.nodes_end=t.ac=null}function RM(t,e){for(;t!==null;){var n=t===e?null:ga(t);t.remove(),t=n}}function IM(t){var e=t.parent,n=t.prev,r=t.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),e!==null&&(e.first===t&&(e.first=r),e.last===t&&(e.last=n))}function op(t,e,n=!0){var r=[];IC(t,r,!0),FM(r,()=>{n&&ei(t),e&&e()})}function FM(t,e){var n=t.length;if(n>0){var r=()=>--n||e();for(var i of t)i.out(r)}else e()}function IC(t,e,n){if((t.f&Gs)===0){if(t.f^=Gs,t.transitions!==null)for(const o of t.transitions)(o.is_global||n)&&e.push(o);for(var r=t.first;r!==null;){var i=r.next,s=(r.f&Qu)!==0||(r.f&Zu)!==0&&(t.f&Il)!==0;IC(r,e,s?n:!1),r=i}}}function FC(t){$M(t,!0)}function $M(t,e){if((t.f&Gs)!==0){t.f^=Gs,(t.f&oi)===0&&(li(t,ks),Sh(t));for(var n=t.first;n!==null;){var r=n.next,i=(n.f&Qu)!==0||(n.f&Zu)!==0;$M(n,i?e:!1),n=r}if(t.transitions!==null)for(const s of t.transitions)(s.is_global||e)&&s.in()}}function MM(t,e){for(var n=t.nodes_start,r=t.nodes_end;n!==null;){var i=n===r?null:ga(n);e.append(n),n=i}}let ap=!1;function ST(t){ap=t}let Kh=!1;function kT(t){Kh=t}let Ft=null,na=!1;function gs(t){Ft=t}let At=null;function vl(t){At=t}let Au=null;function LM(t){Ft!==null&&(Au===null?Au=[t]:Au.push(t))}let Ni=null,Qs=0,co=null;function OJ(t){co=t}let NM=1,Qg=0,fh=Qg;function CT(t){fh=t}let wc=!1;function QM(){return++NM}function L0(t){var e=t.f;if((e&ks)!==0)return!0;if((e&Fl)!==0){var n=t.deps,r=(e&xo)!==0;if(e&Si&&(t.f&=~pv),n!==null){var i,s,o=(e&dv)!==0,a=r&&At!==null&&!wc,l=n.length;if((o||a)&&(At===null||(At.f&Cu)===0)){var u=t,c=u.parent;for(i=0;it.wv)return!0}(!r||At!==null&&!wc)&&li(t,oi)}return!1}function BM(t,e,n=!0){var r=t.reactions;if(r!==null&&!Au?.includes(t))for(var i=0;i{t.ac.abort(Zd)}),t.ac=null);try{t.f|=gk;var f=t.fn,h=f(),d=t.deps;if(Ni!==null){var p;if(yv(t,Qs),d!==null&&Qs>0)for(d.length=Qs+Ni.length,p=0;pn?.call(this,s))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?Xu(()=>{e.addEventListener(t,i,r)}):e.addEventListener(t,i,r),i}function cl(t,e,n,r,i){var s={capture:r,passive:i},o=VM(t,e,n,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&nx(()=>{e.removeEventListener(t,o,s)})}function dn(t){for(var e=0;e{throw g});throw h}}finally{t.__root=e,delete t.currentTarget,gs(c),vl(f)}}}function MC(t){var e=document.createElement("template");return e.innerHTML=t.replaceAll("",""),e.content}function Hs(t,e){var n=At;n.nodes_start===null&&(n.nodes_start=t,n.nodes_end=e)}function G(t,e){var n=(e&sM)!==0,r=(e&XK)!==0,i,s=!t.startsWith("");return()=>{if(vt)return Hs(Mt,null),Mt;i===void 0&&(i=MC(s?t:""+t),n||(i=gi(i)));var o=r||xM?document.importNode(i,!0):i.cloneNode(!0);if(n){var a=gi(o),l=o.lastChild;Hs(a,l)}else Hs(o,o);return o}}function TJ(t,e,n="svg"){var r=!t.startsWith(""),i=(e&sM)!==0,s=`<${n}>${r?t:""+t}`,o;return()=>{if(vt)return Hs(Mt,null),Mt;if(!o){var a=MC(s),l=gi(a);if(i)for(o=document.createDocumentFragment();gi(l);)o.appendChild(gi(l));else o=gi(l)}var u=o.cloneNode(!0);if(i){var c=gi(u),f=u.lastChild;Hs(c,f)}else Hs(u,u);return u}}function ft(t,e){return TJ(t,e,"svg")}function hh(t=""){if(!vt){var e=to(t+"");return Hs(e,e),e}var n=Mt;return n.nodeType!==Gw&&(n.before(n=to()),Oi(n)),Hs(n,n),n}function ot(){if(vt)return Hs(Mt,null),Mt;var t=document.createDocumentFragment(),e=document.createComment(""),n=to();return t.append(e,n),Hs(e,n),t}function I(t,e){if(vt){At.nodes_end=Mt,jc();return}t!==null&&t.before(e)}let Sk=!0;function ut(t,e){var n=e==null?"":typeof e=="object"?e+"":e;n!==(t.__t??=t.nodeValue)&&(t.__t=n,t.nodeValue=n+"")}function LC(t,e){return ZM(t,e)}function DJ(t,e){wk(),e.intro=e.intro??!1;const n=e.target,r=vt,i=Mt;try{for(var s=gi(n);s&&(s.nodeType!==Hh||s.data!==oM);)s=ga(s);if(!s)throw _h;aa(!0),Oi(s);const o=ZM(t,{...e,anchor:s});return aa(!1),o}catch(o){if(o instanceof Error&&o.message.split(` `).some(a=>a.startsWith("https://svelte.dev/e/")))throw o;return o!==_h&&console.warn("Failed to hydrate: ",o),e.recover===!1&&DK(),wk(),kM(n),aa(!1),LC(t,e)}finally{aa(r),Oi(i)}}const Od=new Map;function ZM(t,{target:e,anchor:n,props:r={},events:i,context:s,intro:o=!0}){wk();var a=new Set,l=f=>{for(var h=0;h{var f=n??e.appendChild(to());return gM(f,{pending:()=>{}},h=>{if(s){De({});var d=wn;d.c=s}if(i&&(r.$$events=i),vt&&Hs(h,null),Sk=o,u=t(h,r)||{},Sk=!0,vt&&(At.nodes_end=Mt,Mt===null||Mt.nodeType!==Hh||Mt.data!==TC))throw J1(),_h;s&&Pe()}),()=>{for(var h of a){e.removeEventListener(h,qm);var d=Od.get(h);--d===0?(document.removeEventListener(h,qm),Od.delete(h)):Od.set(h,d)}_k.delete(l),f!==n&&f.parentNode?.removeChild(f)}});return kk.set(u,c),u}let kk=new WeakMap;function PJ(t,e){const n=kk.get(t);return n?(kk.delete(t),n(e)):Promise.resolve()}class rx{anchor;#t=new Map;#e=new Map;#n=new Map;#r=!0;constructor(e,n=!0){this.anchor=e,this.#r=n}#l=()=>{var e=qn;if(this.#t.has(e)){var n=this.#t.get(e),r=this.#e.get(n);if(r)FC(r);else{var i=this.#n.get(n);i&&(this.#e.set(n,i.effect),this.#n.delete(n),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),r=i.effect)}for(const[s,o]of this.#t){if(this.#t.delete(s),s===e)break;const a=this.#n.get(o);a&&(ei(a.effect),this.#n.delete(o))}for(const[s,o]of this.#e){if(s===n)continue;const a=()=>{if(Array.from(this.#t.values()).includes(s)){var u=document.createDocumentFragment();MM(o,u),u.append(to()),this.#n.set(s,{effect:o,fragment:u})}else ei(o);this.#e.delete(s)};this.#r||!r?op(o,a,!1):a()}}};#a=e=>{this.#t.delete(e);const n=Array.from(this.#t.values());for(const[r,i]of this.#n)n.includes(r)||(ei(i.effect),this.#n.delete(r))};ensure(e,n){var r=qn,i=CM();if(n&&!this.#e.has(e)&&!this.#n.has(e))if(i){var s=document.createDocumentFragment(),o=to();s.append(o),this.#n.set(e,{effect:us(()=>n(o)),fragment:s})}else this.#e.set(e,us(()=>n(this.anchor)));if(this.#t.set(r,e),i){for(const[a,l]of this.#e)a===e?r.skipped_effects.delete(l):r.skipped_effects.add(l);for(const[a,l]of this.#n)a===e?r.skipped_effects.delete(l.effect):r.skipped_effects.add(l.effect);r.oncommit(this.#l),r.ondiscard(this.#a)}else vt&&(this.anchor=Mt),this.#l()}}function oe(t,e,n=!1){vt&&jc();var r=new rx(t),i=n?Qu:0;function s(o,a){if(vt){const u=aM(t)===ex;if(o===u){var l=mv();Oi(l),r.anchor=l,aa(!1),r.ensure(o,a),aa(!0);return}}r.ensure(o,a)}hf(()=>{var o=!1;e((a,l=!0)=>{o=!0,s(l,a)}),o||s(!1,null)},i)}function bv(t,e,n){vt&&jc();var r=new rx(t),i=!I0();hf(()=>{var s=e();i&&s!==null&&typeof s=="object"&&(s={}),r.ensure(s,n)})}let uO=null;function Wt(t,e){return e}function RJ(t,e,n){for(var r=t.items,i=[],s=e.length,o=0;o0&&i.length===0&&n!==null;if(a){var l=n.parentNode;kM(l),l.append(n),r.clear(),Ma(t,e[0].prev,e[s-1].next)}FM(i,()=>{for(var u=0;u{var y=n();return K1(y)?y:y==null?[]:SC(y)}),p,m;function g(){IJ(m,p,a,h,o,i,e,r,n),s!==null&&(p.length===0?c?FC(c):c=us(()=>s(o)):c!==null&&op(c,()=>{c=null}))}hf(()=>{m??=At,p=b(d);var y=p.length;if(f&&y===0)return;f=y===0;let O=!1;if(vt){var v=aM(o)===ex;v!==(y===0)&&(o=mv(),Oi(o),aa(!1),O=!0)}if(vt){for(var w=null,x,S=0;S0&&Oi(mv())}if(vt)y===0&&s&&(c=us(()=>s(o)));else if(CM()){var C=new Set,D=qn;for(S=0;S0){var B=(o&iM)!==0&&f===0?i:null;if(u){for(_=0;_{if(y!==void 0)for(S of y)S.a?.apply()}),t.first=n.first&&n.first.e,t.last=g&&g.e;for(var q of r.values())ei(q.e);r.clear()}function XM(t,e,n,r){(r&Kw)!==0&&Up(t.v,e),(r&Jw)!==0?Up(t.i,n):t.i=n}function Ck(t,e,n,r,i,s,o,a,l,u,c){var f=uO,h=(l&Kw)!==0,d=(l&NK)===0,p=h?d?ch(i,!1,!1):kh(i):i,m=(l&Jw)===0?o:kh(o),g={i:m,v:p,k:s,a:null,e:null,prev:n,next:r};uO=g;try{if(t===null){var y=document.createDocumentFragment();y.append(t=to())}return g.e=us(()=>a(t,p,m,u),vt),g.e.prev=n&&n.e,g.e.next=r&&r.e,n===null?c||(e.first=g):(n.next=g,n.e.next=g.e),r!==null&&(r.prev=g,r.e.prev=g.e),g}finally{uO=f}}function G_(t,e,n){for(var r=t.next?t.next.e.nodes_start:n,i=e?e.e.nodes_start:n,s=t.e.nodes_start;s!==null&&s!==r;){var o=ga(s);i.before(s),s=o}}function Ma(t,e,n){e===null?t.first=n:(e.next=n,e.e.next=n&&n.e),n!==null&&(n.prev=e,n.e.prev=e&&e.e)}function ix(t,e,n=!1,r=!1,i=!1){var s=t,o="";de(()=>{var a=At;if(o===(o=e()??"")){vt&&jc();return}if(a.nodes_start!==null&&(RM(a.nodes_start,a.nodes_end),a.nodes_start=a.nodes_end=null),o!==""){if(vt){Mt.data;for(var l=jc(),u=l;l!==null&&(l.nodeType!==Hh||l.data!=="");)u=l,l=ga(l);if(l===null)throw J1(),_h;Hs(Mt,u),s=Oi(l);return}var c=o+"";n?c=`${c}`:r&&(c=`${c}`);var f=MC(c);if((n||r)&&(f=gi(f)),Hs(gi(f),f.lastChild),n||r)for(;gi(f);)s.before(gi(f));else s.before(f)}})}function Eo(t,e,...n){var r=new rx(t);hf(()=>{const i=e()??null;r.ensure(i,i&&(s=>i(s,...n)))},Qu)}function Bu(t,e,n){vt&&jc();var r=new rx(t);hf(()=>{var i=e()??null;r.ensure(i,i&&(s=>n(s,i)))},Qu)}function Zn(t,e,n){$0(()=>{var r=Br(()=>e(t,n?.())||{});if(n&&r?.update){var i=!1,s={};M0(()=>{var o=n();$C(o),i&&DC(s,o)&&(s=o,r.update(o))}),i=!0}if(r?.destroy)return()=>r.destroy()})}function FJ(t,e){var n=void 0,r;hf(()=>{n!==(n=e())&&(r&&(ei(r),r=null),n&&(r=us(()=>{$0(()=>n(t))})))})}function WM(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e=0;){var a=o+s;(o===0||ET.includes(r[o-1]))&&(a===r.length||ET.includes(r[a]))?r=(o===0?"":r.substring(0,o))+r.substring(a+1):o=a}}return r===""?null:r}function TT(t,e=!1){var n=e?" !important;":";",r="";for(var i in t){var s=t[i];s!=null&&s!==""&&(r+=" "+i+": "+s+n)}return r}function H_(t){return t[0]!=="-"||t[1]!=="-"?t.toLowerCase():t}function LJ(t,e){if(e){var n="",r,i;if(Array.isArray(e)?(r=e[0],i=e[1]):r=e,t){t=String(t).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var s=!1,o=0,a=!1,l=[];r&&l.push(...Object.keys(r).map(H_)),i&&l.push(...Object.keys(i).map(H_));var u=0,c=-1;const m=t.length;for(var f=0;f{Ov(t,t.__value)});e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),nx(()=>{e.disconnect()})}function DT(t){return"__value"in t?t.__value:t.value}const fm=Symbol("class"),hm=Symbol("style"),GM=Symbol("is custom element"),HM=Symbol("is html");function ox(t){if(vt){var e=!1,n=()=>{if(!e){if(e=!0,t.hasAttribute("value")){var r=t.value;ne(t,"value",null),t.value=r}if(t.hasAttribute("checked")){var i=t.checked;ne(t,"checked",null),t.checked=i}}};t.__on_r=n,Xu(n),AM()}}function KM(t,e){var n=NC(t);n.value===(n.value=e??void 0)||t.value===e&&(e!==0||t.nodeName!=="PROGRESS")||(t.value=e??"")}function NJ(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function ne(t,e,n,r){var i=NC(t);vt&&(i[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName==="LINK")||i[e]!==(i[e]=n)&&(e==="loading"&&(t[SK]=n),n==null?t.removeAttribute(e):typeof n!="string"&&JM(t).includes(e)?t[e]=n:t.setAttribute(e,n))}function QJ(t,e,n,r,i=!1,s=!1){if(vt&&i&&t.tagName==="INPUT"){var o=t,a=o.type==="checkbox"?"defaultChecked":"defaultValue";a in n||ox(o)}var l=NC(t),u=l[GM],c=!l[HM];let f=vt&&u;f&&aa(!1);var h=e||{},d=t.tagName==="OPTION";for(var p in e)p in n||(n[p]=null);n.class?n.class=sx(n.class):n[fm]&&(n.class=null),n[hm]&&(n.style??=null);var m=JM(t);for(const S in n){let _=n[S];if(d&&S==="value"&&_==null){t.value=t.__value="",h[S]=_;continue}if(S==="class"){var g=t.namespaceURI==="http://www.w3.org/1999/xhtml";Qt(t,g,_,r,e?.[fm],n[fm]),h[S]=_,h[fm]=n[fm];continue}if(S==="style"){Ve(t,_,e?.[hm],n[hm]),h[S]=_,h[hm]=n[hm];continue}var y=h[S];if(!(_===y&&!(_===void 0&&t.hasAttribute(S)))){h[S]=_;var O=S[0]+S[1];if(O!=="$$")if(O==="on"){const k={},C="$$"+S;let D=S.slice(2);var v=SJ(D);if(xJ(D)&&(D=D.slice(0,-7),k.capture=!0),!v&&y){if(_!=null)continue;t.removeEventListener(D,h[C],k),h[C]=null}if(_!=null)if(v)t[`__${D}`]=_,dn([D]);else{let A=function(E){h[S].call(this,E)};h[C]=VM(D,t,A,k)}else v&&(t[`__${D}`]=void 0)}else if(S==="style")ne(t,S,_);else if(S==="autofocus")cJ(t,!!_);else if(!u&&(S==="__value"||S==="value"&&_!=null))t.value=t.__value=_;else if(S==="selected"&&d)NJ(t,_);else{var w=S;c||(w=CJ(w));var x=w==="defaultValue"||w==="defaultChecked";if(_==null&&!u&&!x)if(l[S]=null,w==="value"||w==="checked"){let k=t;const C=e===void 0;if(w==="value"){let D=k.defaultValue;k.removeAttribute(w),k.defaultValue=D,k.value=k.__value=C?D:null}else{let D=k.defaultChecked;k.removeAttribute(w),k.defaultChecked=D,k.checked=C?D:!1}}else t.removeAttribute(S);else x||m.includes(w)&&(u||typeof _!="string")?(t[w]=_,w in l&&(l[w]=ni)):typeof _!="function"&&ne(t,w,_)}}}return f&&aa(!0),h}function Dn(t,e,n=[],r=[],i=[],s,o=!1,a=!1){yM(i,n,r,l=>{var u=void 0,c={},f=t.nodeName==="SELECT",h=!1;if(hf(()=>{var p=e(...l.map(b)),m=QJ(t,u,p,s,o,a);h&&f&&"value"in p&&Ov(t,p.value);for(let y of Object.getOwnPropertySymbols(c))p[y]||ei(c[y]);for(let y of Object.getOwnPropertySymbols(p)){var g=p[y];y.description===YK&&(!u||g!==u[y])&&(c[y]&&ei(c[y]),c[y]=us(()=>FJ(t,()=>g))),m[y]=g}u=m}),f){var d=t;$0(()=>{Ov(d,u.value,!0),YM(d)})}h=!0})}function NC(t){return t.__attributes??={[GM]:t.nodeName.includes("-"),[HM]:t.namespaceURI===WK}}var PT=new Map;function JM(t){var e=t.getAttribute("is")||t.nodeName,n=PT.get(e);if(n)return n;PT.set(e,n=[]);for(var r,i=t,s=Element.prototype;s!==i;){r=eM(i);for(var o in r)r[o].set&&n.push(o);i=CC(i)}return n}const BJ=()=>performance.now(),cu={tick:t=>requestAnimationFrame(t),now:()=>BJ(),tasks:new Set};function eL(){const t=cu.now();cu.tasks.forEach(e=>{e.c(t)||(cu.tasks.delete(e),e.f())}),cu.tasks.size!==0&&cu.tick(eL)}function zJ(t){let e;return cu.tasks.size===0&&cu.tick(eL),{promise:new Promise(n=>{cu.tasks.add(e={c:t,f:n})}),abort(){cu.tasks.delete(e)}}}function jy(t,e){F0(()=>{t.dispatchEvent(new CustomEvent(e))})}function UJ(t){if(t==="float")return"cssFloat";if(t==="offset")return"cssOffset";if(t.startsWith("--"))return t;const e=t.split("-");return e.length===1?e[0]:e[0]+e.slice(1).map(n=>n[0].toUpperCase()+n.slice(1)).join("")}function RT(t){const e={},n=t.split(";");for(const r of n){const[i,s]=r.split(":");if(!i||s===void 0)break;const o=UJ(i.trim());e[o]=s.trim()}return e}const jJ=t=>t;function IT(t,e,n){var r=uO,i,s,o,a=null;r.a??={element:t,measure(){i=this.element.getBoundingClientRect()},apply(){if(o?.abort(),s=this.element.getBoundingClientRect(),i.left!==s.left||i.right!==s.right||i.top!==s.top||i.bottom!==s.bottom){const l=e()(this.element,{from:i,to:s},n?.());o=vv(this.element,l,void 0,1,()=>{o?.abort(),o=void 0})}},fix(){if(!t.getAnimations().length){var{position:l,width:u,height:c}=getComputedStyle(t);if(l!=="absolute"&&l!=="fixed"){var f=t.style;a={position:f.position,width:f.width,height:f.height,transform:f.transform},f.position="absolute",f.width=u,f.height=c;var h=t.getBoundingClientRect();if(i.left!==h.left||i.top!==h.top){var d=`translate(${i.left-h.left}px, ${i.top-h.top}px)`;f.transform=f.transform?`${f.transform} ${d}`:d}}}},unfix(){if(a){var l=t.style;l.position=a.position,l.width=a.width,l.height=a.height,l.transform=a.transform}}},r.a.element=t}function xc(t,e,n,r){var i=(t&qK)!==0,s=(t&VK)!==0,o=i&&s,a=(t&ZK)!==0,l=o?"both":i?"in":"out",u,c=e.inert,f=e.style.overflow,h,d;function p(){return F0(()=>u??=n()(e,r?.()??{},{direction:l}))}var m={is_global:a,in(){if(e.inert=c,!i){d?.abort(),d?.reset?.();return}s||h?.abort(),jy(e,"introstart"),h=vv(e,p(),d,1,()=>{jy(e,"introend"),h?.abort(),h=u=void 0,e.style.overflow=f})},out(v){if(!s){v?.(),u=void 0;return}e.inert=!0,jy(e,"outrostart"),d=vv(e,p(),h,0,()=>{jy(e,"outroend"),v?.()})},stop:()=>{h?.abort(),d?.abort()}},g=At;if((g.transitions??=[]).push(m),i&&Sk){var y=a;if(!y){for(var O=g.parent;O&&(O.f&Qu)!==0;)for(;(O=O.parent)&&(O.f&Il)===0;);y=!O||(O.f&Yw)!==0}y&&$0(()=>{Br(()=>m.in())})}}function vv(t,e,n,r,i){var s=r===1;if(Dd(e)){var o,a=!1;return Xu(()=>{if(!a){var g=e({direction:s?"in":"out"});o=vv(t,g,n,r,i)}}),{abort:()=>{a=!0,o?.abort()},deactivate:()=>o.deactivate(),reset:()=>o.reset(),t:()=>o.t()}}if(n?.deactivate(),!e?.duration)return i(),{abort:Cn,deactivate:Cn,reset:Cn,t:()=>r};const{delay:l=0,css:u,tick:c,easing:f=jJ}=e;var h=[];if(s&&n===void 0&&(c&&c(0,1),u)){var d=RT(u(0,1));h.push(d,d)}var p=()=>1-r,m=t.animate(h,{duration:l,fill:"forwards"});return m.onfinish=()=>{m.cancel();var g=n?.t()??1-r;n?.abort();var y=r-g,O=e.duration*Math.abs(y),v=[];if(O>0){var w=!1;if(u)for(var x=Math.ceil(O/16.666666666666668),S=0;S<=x;S+=1){var _=g+y*f(S/x),k=RT(u(_,1-_));v.push(k),w||=k.overflow==="hidden"}w&&(t.style.overflow="hidden"),p=()=>{var C=m.currentTime;return g+y*f(C/O)},c&&zJ(()=>{if(m.playState!=="running")return!1;var C=p();return c(C,1-C),!0})}m=t.animate(v,{duration:O,fill:"forwards"}),m.onfinish=()=>{p=()=>r,c?.(r,1-r),i()}},{abort:()=>{m&&(m.cancel(),m.effect=null,m.onfinish=Cn)},deactivate:()=>{i=Cn},reset:()=>{r===0&&c?.(1,0)},t:()=>p()}}function qJ(t,e,n=e){var r=new WeakSet;fJ(t,"input",async i=>{var s=i?t.defaultValue:t.value;if(s=J_(t)?eS(s):s,n(s),qn!==null&&r.add(qn),await UM(),s!==(s=e())){var o=t.selectionStart,a=t.selectionEnd,l=t.value.length;if(t.value=s??"",a!==null){var u=t.value.length;o===a&&a===l&&u>l?(t.selectionStart=u,t.selectionEnd=u):(t.selectionStart=o,t.selectionEnd=Math.min(a,u))}}}),(vt&&t.defaultValue!==t.value||Br(e)==null&&t.value)&&(n(J_(t)?eS(t.value):t.value),qn!==null&&r.add(qn)),M0(()=>{var i=e();if(t===document.activeElement){var s=lO??qn;if(r.has(s))return}J_(t)&&i===eS(t.value)||t.type==="date"&&!i&&!t.value||i!==t.value&&(t.value=i??"")})}function J_(t){var e=t.type;return e==="number"||e==="range"}function eS(t){return t===""?null:+t}class QC{#t=new WeakMap;#e;#n;static entries=new WeakMap;constructor(e){this.#n=e}observe(e,n){var r=this.#t.get(e)||new Set;return r.add(n),this.#t.set(e,r),this.#r().observe(e,this.#n),()=>{var i=this.#t.get(e);i.delete(n),i.size===0&&(this.#t.delete(e),this.#e.unobserve(e))}}#r(){return this.#e??(this.#e=new ResizeObserver(e=>{for(var n of e){QC.entries.set(n.target,n);for(var r of this.#t.get(n.target)||[])r(n)}}))}}var VJ=new QC({box:"border-box"});function fl(t,e,n){var r=VJ.observe(t,()=>n(t[e]));$0(()=>(Br(()=>n(t[e])),r))}function FT(t,e){return t===e||t?.[ul]===e}function lr(t={},e,n,r){return $0(()=>{var i,s;return M0(()=>{i=s,s=r?.()||[],Br(()=>{t!==n(...s)&&(e(t,...s),i&&FT(n(...i),t)&&e(null,...i))})}),()=>{Xu(()=>{s&&FT(n(...s),t)&&e(null,...s)})}}),t}function BC(t=!1){const e=wn,n=e.l.u;if(!n)return;let r=()=>$C(e.s);if(t){let i=0,s={};const o=ey(()=>{let a=!1;const l=e.s;for(const u in l)l[u]!==s[u]&&(s[u]=l[u],a=!0);return a&&i++,i});r=()=>b(o)}n.b.length&&An(()=>{$T(e,r),hv(n.b)}),ki(()=>{const i=Br(()=>n.m.map(_K));return()=>{for(const s of i)typeof s=="function"&&s()}}),n.a.length&&ki(()=>{$T(e,r),hv(n.a)})}function $T(t,e){if(t.l.s)for(const n of t.l.s)b(n);e()}function MT(t,e){var n=t.$$events?.[e.type],r=K1(n)?n.slice():n==null?[]:[n];for(var i of r)i.call(this,e)}function zC(t,e,n){if(t==null)return e(void 0),n&&n(void 0),Cn;const r=Br(()=>t.subscribe(e,n));return r.unsubscribe?()=>r.unsubscribe():r}const vd=[];function tL(t,e){return{subscribe:Xi(t,e).subscribe}}function Xi(t,e=Cn){let n=null;const r=new Set;function i(a){if(DC(t,a)&&(t=a,n)){const l=!vd.length;for(const u of r)u[1](),vd.push(u,t);if(l){for(let u=0;u{r.delete(u),r.size===0&&n&&(n(),n=null)}}return{set:i,update:s,subscribe:o}}function ty(t,e,n){const r=!Array.isArray(t),i=r?[t]:t;if(!i.every(Boolean))throw new Error("derived() expects stores as input, got a falsy value");const s=e.length<2;return tL(n,(o,a)=>{let l=!1;const u=[];let c=0,f=Cn;const h=()=>{if(c)return;f();const p=e(r?u[0]:u,o,a);s?o(p):f=typeof p=="function"?p:Cn},d=i.map((p,m)=>zC(p,g=>{u[m]=g,c&=~(1<{c|=1<e=n)(),e}let qy=!1,Ak=Symbol();function hr(t,e,n){const r=n[e]??={store:null,source:ch(void 0),unsubscribe:Cn};if(r.store!==t&&!(Ak in n))if(r.unsubscribe(),r.store=t??null,t==null)r.source.v=void 0,r.unsubscribe=Cn;else{var i=!0;r.unsubscribe=zC(t,s=>{i?r.source.v=s:X(r.source,s)}),i=!1}return t&&Ak in n?nL(t):b(r.source)}function LT(t,e){return t.set(e),e}function Lo(){const t={};function e(){nx(()=>{for(var n in t)t[n].unsubscribe();kC(t,Ak,{enumerable:!1,value:!0})})}return[t,e]}function ZJ(t){var e=qy;try{return qy=!1,[t(),qy]}finally{qy=e}}const XJ={get(t,e){if(!t.exclude.includes(e))return t.props[e]},set(t,e){return!1},getOwnPropertyDescriptor(t,e){if(!t.exclude.includes(e)&&e in t.props)return{enumerable:!0,configurable:!0,value:t.props[e]}},has(t,e){return t.exclude.includes(e)?!1:e in t.props},ownKeys(t){return Reflect.ownKeys(t.props).filter(e=>!t.exclude.includes(e))}};function Ht(t,e,n){return new Proxy({props:t,exclude:e},XJ)}const WJ={get(t,e){let n=t.props.length;for(;n--;){let r=t.props[n];if(Dd(r)&&(r=r()),typeof r=="object"&&r!==null&&e in r)return r[e]}},set(t,e,n){let r=t.props.length;for(;r--;){let i=t.props[r];Dd(i)&&(i=i());const s=Dc(i,e);if(s&&s.set)return s.set(n),!0}return!1},getOwnPropertyDescriptor(t,e){let n=t.props.length;for(;n--;){let r=t.props[n];if(Dd(r)&&(r=r()),typeof r=="object"&&r!==null&&e in r){const i=Dc(r,e);return i&&!i.configurable&&(i.configurable=!0),i}}},has(t,e){if(e===ul||e===EC)return!1;for(let n of t.props)if(Dd(n)&&(n=n()),n!=null&&e in n)return!0;return!1},ownKeys(t){const e=[];for(let n of t.props)if(Dd(n)&&(n=n()),!!n){for(const r in n)e.includes(r)||e.push(r);for(const r of Object.getOwnPropertySymbols(n))e.includes(r)||e.push(r)}return e}};function Ch(...t){return new Proxy({props:t},WJ)}function Xe(t,e,n,r){var i=!R0||(n&BK)!==0,s=(n&UK)!==0,o=(n&jK)!==0,a=r,l=!0,u=()=>(l&&(l=!1,a=o?Br(r):r),a),c;if(s){var f=ul in t||EC in t;c=Dc(t,e)?.set??(f&&e in t?v=>t[e]=v:void 0)}var h,d=!1;s?[h,d]=ZJ(()=>t[e]):h=t[e],h===void 0&&r!==void 0&&(h=u(),c&&(i&&RK(),c(h)));var p;if(i?p=()=>{var v=t[e];return v===void 0?u():(l=!0,v)}:p=()=>{var v=t[e];return v!==void 0&&(a=void 0),v===void 0?a:v},i&&(n&zK)===0)return p;if(c){var m=t.$$legacy;return(function(v,w){return arguments.length>0?((!i||!w||m||d)&&c(w?p():v),v):p()})}var g=!1,y=((n&QK)!==0?ey:PC)(()=>(g=!1,p()));s&&b(y);var O=At;return(function(v,w){if(arguments.length>0){const x=w?b(y):i&&s?vc(v):v;return X(y,x),g=!0,a!==void 0&&(a=x),v}return Kh&&g||(O.f&Cu)!==0?y.v:b(y)})}function rL(t){return new YJ(t)}class YJ{#t;#e;constructor(e){var n=new Map,r=(s,o)=>{var a=ch(o,!1,!1);return n.set(s,a),a};const i=new Proxy({...e.props||{},$$events:{}},{get(s,o){return b(n.get(o)??r(o,Reflect.get(s,o)))},has(s,o){return o===EC?!0:(b(n.get(o)??r(o,Reflect.get(s,o))),Reflect.has(s,o))},set(s,o,a){return X(n.get(o)??r(o,a),a),Reflect.set(s,o,a)}});this.#e=(e.hydrate?DJ:LC)(e.component,{target:e.target,anchor:e.anchor,props:i,context:e.context,intro:e.intro??!1,recover:e.recover}),(!e?.props?.$$host||e.sync===!1)&&hM(),this.#t=i.$$events;for(const s of Object.keys(this.#e))s==="$set"||s==="$destroy"||s==="$on"||kC(this,s,{get(){return this.#e[s]},set(o){this.#e[s]=o},enumerable:!0});this.#e.$set=s=>{Object.assign(i,s)},this.#e.$destroy=()=>{PJ(this.#e)}}$set(e){this.#e.$set(e)}$on(e,n){this.#t[e]=this.#t[e]||[];const r=(...i)=>n.call(this,...i);return this.#t[e].push(r),()=>{this.#t[e]=this.#t[e].filter(i=>i!==r)}}$destroy(){this.#e.$destroy()}}function Ah(t){wn===null&&Hw(),R0&&wn.l!==null?iL(wn).m.push(t):ki(()=>{const e=Br(t);if(typeof e=="function")return e})}function UC(t){wn===null&&Hw(),Ah(()=>()=>Br(t))}function GJ(t,e,{bubbles:n=!1,cancelable:r=!1}={}){return new CustomEvent(t,{detail:e,bubbles:n,cancelable:r})}function HJ(){const t=wn;return t===null&&Hw(),(e,n,r)=>{const i=t.s.$$events?.[e];if(i){const s=K1(i)?i.slice():[i],o=GJ(e,n,r);for(const a of s)a.call(t.x,o);return!o.defaultPrevented}return!0}}function KJ(t){wn===null&&Hw(),wn.l===null&&PK(),iL(wn).a.push(t)}function iL(t){var e=t.l;return e.u??={a:[],b:[],m:[]}}const JJ="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(JJ);JK();function eee(t,e){if(t instanceof RegExp)return{keys:!1,pattern:t};var n,r,i,s,o=[],a="",l=t.split("/");for(l[0]||l.shift();i=l.shift();)n=i[0],n==="*"?(o.push("wild"),a+="/(.*)"):n===":"?(r=i.indexOf("?",1),s=i.indexOf(".",1),o.push(i.substring(1,~r?r:~s?s:i.length)),a+=~r&&!~s?"(?:/([^/]+?))?":"/([^/]+?)",~s&&(a+=(~r?"?":"")+"\\"+i.substring(s))):a+="/"+i;return{keys:o,pattern:new RegExp("^"+a+"/?$","i")}}function NT(){const t=window.location.href.indexOf("#/");let e=t>-1?window.location.href.substr(t+1):"/";const n=e.indexOf("?");let r="";return n>-1&&(r=e.substr(n+1),e=e.substr(0,n)),{location:e,querystring:r}}const jC=tL(null,function(e){e(NT());const n=()=>{e(NT())};return window.addEventListener("hashchange",n,!1),function(){window.removeEventListener("hashchange",n,!1)}});ty(jC,t=>t.location);ty(jC,t=>t.querystring);const QT=Xi(void 0);function tee(t){t?window.scrollTo(t.__svelte_spa_router_scrollX,t.__svelte_spa_router_scrollY):window.scrollTo(0,0)}function nee(t,e){De(e,!1);let n=Xe(e,"routes",24,()=>({})),r=Xe(e,"prefix",8,""),i=Xe(e,"restoreScrollState",8,!1);class s{constructor(S,_){if(!_||typeof _!="function"&&(typeof _!="object"||_._sveltesparouter!==!0))throw Error("Invalid component object");if(!S||typeof S=="string"&&(S.length<1||S.charAt(0)!="/"&&S.charAt(0)!="*")||typeof S=="object"&&!(S instanceof RegExp))throw Error('Invalid value for "path" argument - strings must start with / or *');const{pattern:k,keys:C}=eee(S);this.path=S,typeof _=="object"&&_._sveltesparouter===!0?(this.component=_.component,this.conditions=_.conditions||[],this.userData=_.userData,this.props=_.props||{}):(this.component=()=>Promise.resolve(_),this.conditions=[],this.props={}),this._pattern=k,this._keys=C}match(S){if(r()){if(typeof r()=="string")if(S.startsWith(r()))S=S.substr(r().length)||"/";else return null;else if(r()instanceof RegExp){const D=S.match(r());if(D&&D[0])S=S.substr(D[0].length)||"/";else return null}}const _=this._pattern.exec(S);if(_===null)return null;if(this._keys===!1)return _;const k={};let C=0;for(;C{o.push(new s(S,x))}):Object.keys(n()).forEach(x=>{o.push(new s(x,n()[x]))});let a=ch(null),l=ch(null),u=ch({});const c=HJ();async function f(x,S){await UM(),c(x,S)}let h=null,d=null;i()&&(d=x=>{x.state&&(x.state.__svelte_spa_router_scrollY||x.state.__svelte_spa_router_scrollX)?h=x.state:h=null},window.addEventListener("popstate",d),KJ(()=>{tee(h)}));let p=null,m=null;const g=jC.subscribe(async x=>{p=x;let S=0;for(;S{QT.set(b(l))});return}X(a,null),m=null,QT.set(void 0)});UC(()=>{g(),d&&window.removeEventListener("popstate",d)}),mJ(()=>$C(i()),()=>{history.scrollRestoration=i()?"manual":"auto"}),gJ(),BC();var y=ot(),O=ke(y);{var v=x=>{var S=ot(),_=ke(S);Bu(_,()=>b(a),(k,C)=>{C(k,Ch({get params(){return b(l)}},()=>b(u),{$$events:{routeEvent(D){MT.call(this,e,D)}}}))}),I(x,S)},w=x=>{var S=ot(),_=ke(S);Bu(_,()=>b(a),(k,C)=>{C(k,Ch(()=>b(u),{$$events:{routeEvent(D){MT.call(this,e,D)}}}))}),I(x,S)};oe(O,x=>{b(l)?x(v):x(w,!1)})}I(t,y),Pe()}async function ree(t,e="gzip"){let n=new CompressionStream(e),i=new Blob([t]).stream().pipeThrough(n),o=await(await new Response(i).blob()).arrayBuffer();return new Uint8Array(o)}async function iee(t,e="gzip"){let n=new DecompressionStream(e),i=new Blob([t]).stream().pipeThrough(n),o=await(await new Response(i).blob()).arrayBuffer();return new Uint8Array(o)}function see(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");const n=e.length%4;return n===2?e+="==":n===3?e+="=":n===1&&(e+="==="),e}function oee(t){let e=t.replace(/\+/g,"-").replace(/\//g,"_");return e=e.replace(/=+$/,""),e}function aee(t){let n="";for(let r=0;r{n&&clearTimeout(n),n=setTimeout(()=>{t(...i)},e)}}function Bg(t,e){if(t===e)return!0;if(t===null||e===null||typeof t!="object"||typeof e!="object"||Object.keys(t).length!==Object.keys(e).length)return!1;for(let n in t)if(e.hasOwnProperty(n)){if(!Bg(t[n],e[n]))return!1}else return!1;return!0}function wv(t){let e;return(...n)=>{let r=t(...n);return e!==void 0&&Bg(r,e)?e:(e=r,r)}}function ac(t,e,...n){try{if(n.every(r=>r!==void 0)){const r=t[e];if(typeof r=="function")return r(...n)}}catch(r){console.error(r)}}const uee=2;function Vy(t){return{clientX:t.clientX,clientY:t.clientY,pageX:t.pageX,pageY:t.pageY,modifiers:{shift:t.shiftKey,ctrl:t.ctrlKey,alt:t.altKey,meta:t.metaKey}}}function sn(t,e){let n=e,r,i=!1,s=!1;const o=u=>{let c=Vy(u);u.preventDefault(),u.stopPropagation(),cee(),i=!0,r&&(ac(r,"up"),r=void 0);let f=d=>{let p=Vy(d);n.drag&&!r?Math.hypot(c.clientX-p.clientX,c.clientY-p.clientY)>uee&&(r=ac(n,"drag",c),r&&ac(r,"move",p)):r&&ac(r,"move",p)},h=d=>{let p=Vy(d);i=!1,window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",h),r?(ac(r,"up",d),r=void 0):n.click&&ac(n,"click",p)};window.addEventListener("mousemove",f,{passive:!0}),window.addEventListener("mouseup",h,{passive:!0})},a=u=>{if(!i){n.hover&&(ac(n,"hover",Vy(u)),s=!0);return}},l=u=>{s&&n.hover&&(ac(n,"hover",null),s=!1)};return t.addEventListener("mousedown",o,{passive:!1}),t.addEventListener("mousemove",a,{passive:!0}),t.addEventListener("mouseleave",l,{passive:!0}),{update:u=>{n=u},destroy:()=>{t.removeEventListener("mousedown",o),t.removeEventListener("mousemove",a),t.removeEventListener("mouseleave",l)}}}function cee(){try{document.activeElement&&document.activeElement!==document.body&&document.activeElement.blur?.()}catch{}}function lp(t,e){if(BT(t)&&BT(e)){let n;for(let r in e)if(e[r]!==t[r])if(e[r]===void 0)n===void 0&&(n={...t}),delete n[r];else{let i=lp(t[r],e[r]);i!==void 0&&(n===void 0&&(n={...t}),n[r]=i)}return n}else return Bg(t,e)?void 0:e}function qp(t,e,n,r){switch(n){case"merge":{let i=lp(t,e);return i!==void 0?r(i):void 0}case"replace":return t!==e?r(e):void 0}}function cO(t,e,n,r,i){switch(r){case"merge":{let s=lp(t,{[e]:n});return s!==void 0?i(s):void 0}case"replace":if(t[e]!==n){let s={...t};return s[e]=n,i(s)}else return}}function BT(t){return t!=null&&typeof t=="object"&&!Array.isArray(t)}const zT={};function fee(t,e=!1){let n,r,i=zT;function s(u){n=t(u)?.catch(()=>{}).finally(()=>{if(r){const{event:c}=r;r=null,s(c)}else n=null})||null}function o(u){r={event:u}}function a(u){n?o(u):s(u)}function l(u){i!==u&&requestAnimationFrame(()=>{const c=i;i=zT,a(c)}),i=u}return e?l:a}class sL{_filterBy;_requestUpdate;_coordinator;_pending;_enabled;_initialized;_request;constructor(e){this._filterBy=e,this._requestUpdate=fee(()=>this.requestQuery(),!0),this._coordinator=null,this._pending=Promise.resolve(),this._enabled=!0,this._initialized=!1,this._request=null}get coordinator(){return this._coordinator}set coordinator(e){this._coordinator=e}get enabled(){return this._enabled}set enabled(e){e=!!e,this._enabled!==e&&(this._enabled=e,e&&(this._initialized?this._request&&this.requestQuery(this._request===!0?void 0:this._request):this.initialize(),this._request=null))}get pending(){return this._pending}get filterBy(){return this._filterBy}get filterStable(){return!0}async prepare(){}query(e){return null}queryPending(){return this}queryResult(e){return this}queryError(e){return this}requestQuery(e){if(this._enabled){const n=e||this.query(this.filterBy?.predicate(this));return this._coordinator.requestQuery(this,n)}else return this._request=e??!0,null}requestUpdate(){this._enabled?this._requestUpdate():this.requestQuery()}initialize(){this._enabled?this._coordinator&&(this._initialized=!0,this._pending=this.prepare().then(()=>this.requestQuery())):this._initialized=!1}destroy(){this._enabled=!1,this.coordinator?.disconnect(this)}update(){return this}}const oL=Uint8Array.of(65,82,82,79,87,49),ax={V1:0,V4:3,V5:4},fu={NONE:0,Schema:1,DictionaryBatch:2,RecordBatch:3,Tensor:4,SparseTensor:5},fe={Dictionary:-1,NONE:0,Null:1,Int:2,Float:3,Binary:4,Utf8:5,Bool:6,Decimal:7,Date:8,Time:9,Timestamp:10,Interval:11,List:12,Struct:13,Union:14,FixedSizeBinary:15,FixedSizeList:16,Map:17,Duration:18,LargeBinary:19,LargeUtf8:20,LargeList:21,RunEndEncoded:22,BinaryView:23,Utf8View:24,ListView:25,LargeListView:26},aL={HALF:0,SINGLE:1,DOUBLE:2},xv={DAY:0,MILLISECOND:1},ys={SECOND:0,MILLISECOND:1,MICROSECOND:2,NANOSECOND:3},up={YEAR_MONTH:0,DAY_TIME:1,MONTH_DAY_NANO:2},VC={Sparse:0,Dense:1},hee=Uint8Array,lL=Uint16Array,dee=Uint32Array,uL=BigUint64Array,cL=Int8Array,pee=Int16Array,ya=Int32Array,Ml=BigInt64Array,mee=Float32Array,lx=Float64Array;function gee(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}function yee(t,e){const n=Math.log2(t)-3;return(e?[cL,pee,ya,Ml]:[hee,lL,dee,uL])[n]}function ZC(t,e){let n=0,r=t.length;if(r<=2147483648)do{const i=n+r>>>1;t[i]<=e?n=i+1:r=i}while(ne.includes(r),n??(()=>`${t} must be one of ${e}`))}function fL(t,e){for(const[n,r]of Object.entries(t))if(r===e)return n;return""}const WC=t=>`Unsupported data type: "${fL(fe,t)}" (id ${t})`,hL=(t,e,n=!0,r=null)=>({name:t,type:e,nullable:n,metadata:r});function dL(t){return Object.hasOwn(t,"name")&&pL(t.type)}function pL(t){return typeof t?.typeId=="number"}function qc(t,e="",n=!0){return dL(t)?t:hL(e,XC(t,pL,()=>"Data type expected."),n)}const bee=(t,e,n=!1,r=-1)=>({typeId:fe.Dictionary,id:r,dictionary:t,indices:e||gL(),ordered:n}),mL=(t=32,e=!0)=>({typeId:fe.Int,bitWidth:Ll(t,[8,16,32,64]),signed:e,values:yee(t,e)}),gL=()=>mL(32),Oee=(t=2)=>({typeId:fe.Float,precision:Ll(t,aL),values:[lL,mee,lx][t]}),vee=()=>({typeId:fe.Binary,offsets:ya}),wee=()=>({typeId:fe.Utf8,offsets:ya}),xee=(t,e,n=128)=>({typeId:fe.Decimal,precision:t,scale:e,bitWidth:Ll(n,[32,64,128,256]),values:n===32?ya:uL}),_ee=t=>({typeId:fe.Date,unit:Ll(t,xv),values:t===xv.DAY?ya:Ml}),See=(t=ys.MILLISECOND)=>{t=Ll(t,ys);const e=t===ys.SECOND||t===ys.MILLISECOND?32:64;return{typeId:fe.Time,unit:t,bitWidth:e,values:e===32?ya:Ml}},kee=(t=ys.MILLISECOND,e=null)=>({typeId:fe.Timestamp,unit:Ll(t,ys),timezone:e,values:Ml}),Cee=(t=up.MONTH_DAY_NANO)=>({typeId:fe.Interval,unit:Ll(t,up),values:t===up.MONTH_DAY_NANO?void 0:ya}),Aee=t=>({typeId:fe.List,children:[qc(t)],offsets:ya}),Eee=t=>({typeId:fe.Struct,children:Array.isArray(t)&&dL(t[0])?t:Object.entries(t).map(([e,n])=>hL(e,n))}),Tee=(t,e,n,r)=>(n??=e.map((i,s)=>s),{typeId:fe.Union,mode:Ll(t,VC),typeIds:n,typeMap:n.reduce((i,s,o)=>(i[s]=o,i),{}),children:e.map((i,s)=>qc(i,`_${s}`)),typeIdForValue:r,offsets:ya}),Dee=t=>({typeId:fe.FixedSizeBinary,stride:t}),Pee=(t,e)=>({typeId:fe.FixedSizeList,stride:e,children:[qc(t)]}),Ree=(t,e)=>({typeId:fe.Map,keysSorted:t,children:[e],offsets:ya}),Iee=(t=ys.MILLISECOND)=>({typeId:fe.Duration,unit:Ll(t,ys),values:Ml}),Fee=()=>({typeId:fe.LargeBinary,offsets:Ml}),$ee=()=>({typeId:fe.LargeUtf8,offsets:Ml}),Mee=t=>({typeId:fe.LargeList,children:[qc(t)],offsets:Ml}),Lee=(t,e)=>({typeId:fe.RunEndEncoded,children:[XC(qc(t,"run_ends"),n=>n.type.typeId===fe.Int,()=>"Run-ends must have an integer type."),qc(e,"values")]}),Nee=t=>({typeId:fe.ListView,children:[qc(t,"value")],offsets:ya}),Qee=t=>({typeId:fe.LargeListView,children:[qc(t,"value")],offsets:Ml}),Bee=new lx(2),zee=Bee.buffer;new Ml(zee);function Vc(t){if(t>Number.MAX_SAFE_INTEGER||tBigInt.asUintN(64,t);function Uee(t,e){return BigInt.asIntN(64,t[e])}function jee(t,e){const n=e<<1;let r;return BigInt.asIntN(64,t[n+1])<0?(r=Xd(~t[n])|Xd(~t[n+1])<<64n,r=-(r+1n)):r=t[n]|t[n+1]<<64n,r}function qee(t,e){const n=e<<2;let r;return BigInt.asIntN(64,t[n+3])<0?(r=Xd(~t[n])|Xd(~t[n+1])<<64n|Xd(~t[n+2])<<128n|Xd(~t[n+3])<<192n,r=-(r+1n)):r=t[n]|t[n+1]<<64n|t[n+2]<<128n|t[n+3]<<192n,r}const Vee=new TextDecoder("utf-8");new TextEncoder;function ux(t){return Vee.decode(t)}const zg=4;function yL(t,e){return(t[e>>3]&1<{if(s>24}function GC(t,e){return t[e]}function ho(t,e){return Xee(t,e)<<16>>16}function Xee(t,e){return t[e]|t[e+1]<<8}function ir(t,e){return t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24}function UT(t,e){return ir(t,e)>>>0}function mo(t,e){return Vc(BigInt.asIntN(64,BigInt(UT(t,e))+(BigInt(UT(t,e+zg))<<32n)))}function _v(t,e){let n=e+ir(t,e);const r=ir(t,n);return n+=zg,ux(t.subarray(n,n+r))}function Ic(t,e,n,r){if(!e)return[];const i=e+ir(t,e);return Array.from({length:ir(t,i)},(s,o)=>r(t,i+zg+o*n))}const tS=Symbol("rowIndex");function Ek(t,e){class n{constructor(s){this[tS]=s}toJSON(){return OL(t,e,this[tS])}}const r=n.prototype;for(let i=0;inew n(i)}function bL(t,e){return n=>OL(t,e,n)}function OL(t,e,n){const r={};for(let i=0;ithis.value(u))}get[Symbol.toStringTag](){return"Batch"}at(e){return this.isValid(e)?this.value(e):null}isValid(e){return yL(this.validity,e)}value(e){return this.values[e]}slice(e,n){const r=n-e,i=Array(r);for(let s=0;s>10,i=(n&1023)/1024,s=(-1)**((n&32768)>>15);switch(r){case 31:return s*(i?Number.NaN:1/0);case 0:return s*(i?6103515625e-14*i:0)}return s*2**(r-15)*(1+i)}}class Hee extends vr{value(e){return yL(this.values,e)}}class Kee extends fx{constructor(e){super(e);const{scale:n}=this.type;this.scale=10**n}value(e){return this.values[e]/this.scale}}class vL extends cx{constructor(e){super(e);const{bitWidth:n,scale:r}=this.type;this.decimal=n===64?Uee:n===128?jee:qee,this.scale=10n**BigInt(r)}}class Jee extends vL{static ArrayType=lx;value(e){return YC(this.decimal(this.values,e),this.scale)}}class ete extends vL{static ArrayType=Array;value(e){return this.decimal(this.values,e)}}class jT extends vr{constructor(e){super(e),this.source=e}value(e){return new Date(this.source.value(e))}}class tte extends fx{value(e){return 864e5*this.values[e]}}const nte=N0;class rte extends N0{value(e){return super.value(e)*1e3}}const ite=N0;class ste extends N0{value(e){return YC(this.values[e],1000n)}}class ote extends N0{value(e){return YC(this.values[e],1000000n)}}class ate extends vr{value(e){return this.values.subarray(e<<1,e+1<<1)}}class lte extends vr{value(e){const n=this.values,r=e<<4;return Float64Array.of(ir(n,r),ir(n,r+4),mo(n,r+8))}}const wL=({values:t,offsets:e},n)=>t.subarray(e[n],e[n+1]),xL=({values:t,offsets:e},n)=>t.subarray(Vc(e[n]),Vc(e[n+1]));class ute extends vr{value(e){return wL(this,e)}}class cte extends vr{value(e){return xL(this,e)}}class fte extends vr{value(e){return ux(wL(this,e))}}class hte extends vr{value(e){return ux(xL(this,e))}}class dte extends vr{value(e){const n=this.offsets;return this.children[0].slice(n[e],n[e+1])}}class pte extends vr{value(e){const n=this.offsets;return this.children[0].slice(Vc(n[e]),Vc(n[e+1]))}}class mte extends vr{value(e){const n=this.offsets[e],r=n+this.sizes[e];return this.children[0].slice(n,r)}}class gte extends vr{value(e){const n=this.offsets[e],r=n+this.sizes[e];return this.children[0].slice(Vc(n),Vc(r))}}class _L extends vr{constructor(e){super(e),this.stride=this.type.stride}}class yte extends _L{value(e){const{stride:n,values:r}=this;return r.subarray(e*n,(e+1)*n)}}class bte extends _L{value(e){const{children:n,stride:r}=this;return n[0].slice(e*r,(e+1)*r)}}function SL({children:t,offsets:e},n){const[r,i]=t[0].children,s=e[n],o=e[n+1],a=[];for(let l=s;lr.name),this.factory=n(this.names,this.children)}value(e){return this.factory(e)}}class xte extends CL{constructor(e){super(e,Ek)}}class _te extends vr{value(e){const[{values:n},r]=this.children;return r.at(ZC(n,e))}}let Ste=class extends vr{setDictionary(e){return this.dictionary=e,this.cache=e.cache(),this}value(e){return this.cache[this.key(e)]}key(e){return this.values[e]}};class AL extends vr{constructor({data:e,...n}){super(n),this.data=e}view(e){const{values:n,data:r}=this,i=e<<4;let s=i+4,o=n;const a=ir(o,i);return a>12&&(s=ir(o,i+12),o=r[ir(o,i+8)]),o.subarray(s,s+a)}}class kte extends AL{value(e){return this.view(e)}}class Cte extends AL{value(e){return ux(this.view(e))}}function qT(t){let e=[];return{add(n){return e.push(n),this},clear:()=>e=[],done:()=>new Ate(e,t)}}class Ate{constructor(e,n=e[0]?.type){this.type=n,this.length=e.reduce((s,o)=>s+o.length,0),this.nullCount=e.reduce((s,o)=>s+o.nullCount,0),this.data=e;const r=e.length,i=new Int32Array(r+1);if(r===1){const[s]=e;i[1]=s.length,this.at=o=>s.at(o)}else for(let s=0,o=0;s0?Array:r[0].constructor.ArrayType??r[0].values.constructor,a=new o(e);return i?Tte(a,r):Dte(a,r)}cache(){return this._cache??(this._cache=this.toArray())}}function*Ete(t){for(let e=0;eo.name);this.schema=e,this.names=i,this.children=n,this.factory=r?Ek:bL;const s=[];this.getFactory=o=>s[o]??(s[o]=this.factory(i,n.map(a=>a.data[o])))}get[Symbol.toStringTag](){return"Table"}get numCols(){return this.names.length}get numRows(){return this.children[0]?.length??0}getChildAt(e){return this.children[e]}getChild(e){const n=this.names.findIndex(r=>r===e);return n>-1?this.children[n]:void 0}selectAt(e,n=[]){const{children:r,factory:i,schema:s}=this,{fields:o}=s;return new EL({...s,fields:e.map((a,l)=>Rte(o[a],n[l]))},e.map(a=>r[a]),i===Ek)}select(e,n){const r=this.names,i=e.map(s=>r.indexOf(s));return this.selectAt(i,n)}toColumns(){const{children:e,names:n}=this,r={};return n.forEach((i,s)=>r[i]=e[s]?.toArray()??[]),r}toArray(){const{children:e,getFactory:n,numRows:r}=this,i=e[0]?.data??[],s=Array(r);for(let o=0,a=-1;o=i)return null;const[{offsets:s}]=n,o=ZC(s,e)-1;return r(o)(e-s[o])}get(e){return this.at(e)}};function Rte(t,e){return e!=null&&e!==t.name?{...t,name:e}:t}function Ite(t,e={}){const{typeId:n,bitWidth:r,mode:i,precision:s,unit:o}=t,{useBigInt:a,useDate:l,useDecimalInt:u,useMap:c,useProxy:f}=e;switch(n){case fe.Null:return Yee;case fe.Bool:return Hee;case fe.Int:case fe.Time:case fe.Duration:return a||r<64?Vm:N0;case fe.Float:return s?Vm:Gee;case fe.Date:return VT(o===xv.DAY?tte:nte,l&&jT);case fe.Timestamp:return VT(o===ys.SECOND?rte:o===ys.MILLISECOND?ite:o===ys.MICROSECOND?ste:ote,l&&jT);case fe.Decimal:return r===32?u?Vm:Kee:u?ete:Jee;case fe.Interval:return o===up.DAY_TIME?ate:o===up.YEAR_MONTH?Vm:lte;case fe.FixedSizeBinary:return yte;case fe.Utf8:return fte;case fe.LargeUtf8:return hte;case fe.Binary:return ute;case fe.LargeBinary:return cte;case fe.BinaryView:return kte;case fe.Utf8View:return Cte;case fe.List:return dte;case fe.LargeList:return pte;case fe.Map:return c?vte:Ote;case fe.ListView:return mte;case fe.LargeListView:return gte;case fe.FixedSizeList:return bte;case fe.Struct:return f?xte:CL;case fe.RunEndEncoded:return _te;case fe.Dictionary:return Ste;case fe.Union:return i?wte:kL}throw new Error(WC(n))}function VT(t,e){return e?class extends e{constructor(r){super(new t(r))}}:t}function Fte(t,e){return{offset:mo(t,e),metadataLength:ir(t,e+8),bodyLength:mo(t,e+16)}}function ZT(t,e){return Ic(t,e,24,Fte)}function TL(t,e,n){const r=Wu(t,e);if(r(10,qf,0))throw new Error("Record batch compression not implemented");const i=n({length:mo(s,o),nullCount:mo(s,o+8)})),regions:Ic(t,r(8,qf),16+i,(s,o)=>({offset:mo(s,o+i),length:mo(s,o+i+8)})),variadic:Ic(t,r(12,qf),8,mo)}}function $te(t,e,n){const r=Wu(t,e);return{id:r(4,mo,0),data:r(6,(i,s)=>TL(i,s,n)),isDelta:r(8,Ug,!1)}}function DL(t,e,n,r){Ll(n,fe,WC);const i=Wu(t,e);switch(n){case fe.Binary:return vee();case fe.Utf8:return wee();case fe.LargeBinary:return Fee();case fe.LargeUtf8:return $ee();case fe.List:return Aee(r[0]);case fe.ListView:return Nee(r[0]);case fe.LargeList:return Mee(r[0]);case fe.LargeListView:return Qee(r[0]);case fe.Struct:return Eee(r);case fe.RunEndEncoded:return Lee(r[0],r[1]);case fe.Int:return mL(i(4,ir,0),i(6,Ug,!1));case fe.Float:return Oee(i(4,ho,aL.HALF));case fe.Decimal:return xee(i(4,ir,0),i(6,ir,0),i(8,ir,128));case fe.Date:return _ee(i(4,ho,xv.MILLISECOND));case fe.Time:return See(i(4,ho,ys.MILLISECOND));case fe.Timestamp:return kee(i(4,ho,ys.SECOND),i(6,_v));case fe.Interval:return Cee(i(4,ho,up.YEAR_MONTH));case fe.Duration:return Iee(i(4,ho,ys.MILLISECOND));case fe.FixedSizeBinary:return Dee(i(4,ir,0));case fe.FixedSizeList:return Pee(r[0],i(4,ir,0));case fe.Map:return Ree(i(4,Ug,!1),r[0]);case fe.Union:return Tee(i(4,ho,VC.Sparse),r,Ic(t,i(6,qf),4,ir))}return{typeId:n}}function HC(t,e){const n=Ic(t,e,4,(r,i)=>{const s=Wu(r,i);return[s(4,_v),s(6,_v)]});return n.length?new Map(n):null}function PL(t,e,n){const r=Wu(t,e);return{version:n,endianness:r(4,ho,0),fields:r(6,Mte,[]),metadata:r(8,HC)}}function Mte(t,e){return Ic(t,e,4,RL)}function RL(t,e){const n=Wu(t,e),r=n(8,GC,fe.NONE),i=n(10,qf,0),s=n(12,Nte),o=n(14,(l,u)=>Lte(l,u));let a=DL(t,i,r,o);return s&&(s.dictionary=a,a=s),{name:n(4,_v),type:a,nullable:n(6,Ug,!1),metadata:n(16,HC)}}function Lte(t,e){const n=Ic(t,e,4,RL);return n.length?n:null}function Nte(t,e){if(!e)return null;const n=Wu(t,e);return bee(null,n(6,Qte,gL()),n(8,Ug,!1),n(4,mo,0))}function Qte(t,e){return DL(t,e,fe.Int)}const Bte=(t,e)=>`Expected to read ${t} metadata bytes, but only read ${e}.`,zte=(t,e)=>`Expected to read ${t} bytes for message body, but only read ${e}.`,Ute=t=>`Unsupported message type: ${t} (${fL(fu,t)})`;function Tk(t,e){let n=ir(t,e)||0;if(e+=zg,n===-1&&(n=ir(t,e)||0,e+=zg),n===0)return null;const r=t.subarray(e,e+=n);if(r.byteLength0){const f=t.subarray(e,e+=l);if(f.byteLengthPL(a,l,i)),dictionaries:s.map(({offset:a})=>Tk(t,a).content),records:o.map(({offset:a})=>Tk(t,a).content),metadata:r(12,HC)}}function Xte(t,e){return Wte(jte(t),e)}function Wte(t,e={}){const{schema:n={fields:[]},dictionaries:r,records:i}=t,{version:s,fields:o}=n,a=new Map,l=Gte(e,s,a),u=new Map;Yte(n,h=>{const d=h.type;d.typeId===fe.Dictionary&&u.set(d.id,d.dictionary)});const c=new Map;for(const h of r){const{id:d,data:p,isDelta:m,body:g}=h,y=u.get(d),O=Dk(y,l({...p,body:g}));if(c.has(d)){const v=c.get(d);m||v.clear(),v.add(O)}else{if(m)throw new Error("Delta update can not be first dictionary batch.");c.set(d,qT(y).add(O))}}c.forEach((h,d)=>a.set(d,h.done()));const f=o.map(h=>qT(h.type));for(const h of i){const d=l(h);o.forEach((p,m)=>f[m].add(Dk(p.type,d)))}return new Pte(n,f.map(h=>h.done()),e.useProxy)}function Yte(t,e){t.fields.forEach(function n(r){e(r),r.type.dictionary?.children?.forEach(n),r.type.children?.forEach(n)})}function Gte(t,e,n){const r={version:e,options:t,dictionary:i=>n.get(i)};return i=>{const{length:s,nodes:o,regions:a,variadic:l,body:u}=i;let c=-1,f=-1,h=-1;return{...r,length:s,node:()=>o[++c],buffer:d=>{const{length:p,offset:m}=a[++f];return d?new d(u.buffer,u.byteOffset+m,p/d.BYTES_PER_ELEMENT):u.subarray(m,m+p)},variadic:()=>l[++h],visit(d){return d.map(p=>Dk(p.type,this))}}}}function Dk(t,e){const{typeId:n}=t,{options:r,node:i,buffer:s,variadic:o,version:a}=e,l=Ite(t,r),u={...i(),type:t};if(n===fe.Null)return new l({...u,nullCount:u.length});switch(n){case fe.Bool:case fe.Int:case fe.Time:case fe.Duration:case fe.Float:case fe.Decimal:case fe.Date:case fe.Timestamp:case fe.Interval:case fe.FixedSizeBinary:return new l({...u,validity:s(),values:s(t.values)});case fe.Utf8:case fe.LargeUtf8:case fe.Binary:case fe.LargeBinary:return new l({...u,validity:s(),offsets:s(t.offsets),values:s()});case fe.BinaryView:case fe.Utf8View:return new l({...u,validity:s(),values:s(),data:Array.from({length:o()},()=>s())});case fe.List:case fe.LargeList:case fe.Map:return new l({...u,validity:s(),offsets:s(t.offsets),children:e.visit(t.children)});case fe.ListView:case fe.LargeListView:return new l({...u,validity:s(),offsets:s(t.offsets),sizes:s(t.offsets),children:e.visit(t.children)});case fe.FixedSizeList:case fe.Struct:return new l({...u,validity:s(),children:e.visit(t.children)});case fe.RunEndEncoded:return new l({...u,children:e.visit(t.children)});case fe.Dictionary:{const{id:c,indices:f}=t;return new l({...u,validity:s(),values:s(f.values)}).setDictionary(e.dictionary(c))}case fe.Union:return athis.enqueue(e,n,r))}}function wl(t){return t instanceof Nl}let FL;function Kte(t){FL=t}class Nl{type;constructor(e){this.type=e}clone(){const e=new this.constructor(this.type);for(const n in this)n!=="type"&&(e[n]=this[n]);return e}toString(e=FL){if(!e)throw new Error("No visitor provided and no default visitor set.");return e.toString(this)}}class wr extends Nl{}function $L(t){return t.split(".")}function xf(t){return`"${t.replaceAll('"','""')}"`}function nS(t){return t&&Jte(t)?t.slice(1,-1):t}function Jte(t){return t[0]==='"'&&t[t.length-1]==='"'}const hx="COLUMN_REF",dx="COLUMN_PARAM",ML="TABLE_REF",LL="LITERAL",ene="INTERVAL",NL="LIST",QL="UNNEST",KC="ORDER_BY",JC="CAST",e6="CASE",t6="WHEN",BL="COLLATE",n6="UNARY",r6="UNARY_POSTFIX",i6="BINARY",s6="BETWEEN",zL="NOT_BETWEEN",o6="LOGICAL_OPERATOR",a6="IN",l6="FUNCTION",ny="AGGREGATE",px="WINDOW",u6="WINDOW_FUNCTION",c6="WINDOW_DEF",UL="WINDOW_FRAME",f6="WINDOW_EXTENT_EXPR",jL="EXPRESSION",mx="FRAGMENT",h6="VERBATIM",d6="PARAM",p6="WITH_CLAUSE",m6="WINDOW_CLAUSE",g6="SELECT_CLAUSE",y6="FROM_CLAUSE",qL="JOIN_CLAUSE",VL="SAMPLE_CLAUSE",b6="SELECT_QUERY",O6="DESCRIBE_QUERY",v6="SET_OPERATION",ZL="SCALAR_SUBQUERY";class XL extends wr{value;constructor(e){super(LL),this.value=e}}function XT(t){switch(typeof t){case"number":return Number.isFinite(t)?`${t}`:"NULL";case"string":return`'${t.replaceAll("'","''")}'`;case"boolean":return t?"TRUE":"FALSE";default:if(t==null)return"NULL";if(t instanceof Date){const e=+t;if(Number.isNaN(e))return"NULL";const n=t.getUTCFullYear(),r=t.getUTCMonth(),i=t.getUTCDate();return e===Date.UTC(n,r,i)?`DATE '${n}-${r+1}-${i}'`:`epoch_ms(${e})`}else return t instanceof RegExp?`'${t.source}'`:`${t}`}}class tne{toString(e){if(!e)throw new Error("Node is null or undefined");if(typeof e.type!="string")throw new Error(`Node type is not a string: ${typeof e.type}, value: ${e.type}`);if(e.type==="CUSTOM")return e.toString(this);const n=this.getVisitMethod(e.type);if(typeof n=="function")return n.call(this,e);throw new Error(`No visitor method for node type: '${e.type}'`)}getVisitMethod(e){switch(e){case ny:return this.visitAggregate;case s6:return this.visitBetween;case i6:return this.visitBinary;case e6:return this.visitCase;case JC:return this.visitCast;case BL:return this.visitCollate;case dx:return this.visitColumnParam;case hx:return this.visitColumnRef;case O6:return this.visitDescribeQuery;case jL:return this.visitExpression;case mx:return this.visitFragment;case y6:return this.visitFromClause;case l6:return this.visitFunction;case a6:return this.visitIn;case ene:return this.visitInterval;case qL:return this.visitJoinClause;case NL:return this.visitList;case LL:return this.visitLiteral;case o6:return this.visitLogicalOperator;case zL:return this.visitNotBetween;case KC:return this.visitOrderBy;case d6:return this.visitParam;case VL:return this.visitSampleClause;case ZL:return this.visitScalarSubquery;case g6:return this.visitSelectClause;case b6:return this.visitSelectQuery;case v6:return this.visitSetOperation;case ML:return this.visitTableRef;case n6:return this.visitUnary;case r6:return this.visitUnaryPostfix;case QL:return this.visitUnnest;case h6:return this.visitVerbatim;case t6:return this.visitWhen;case px:return this.visitWindow;case m6:return this.visitWindowClause;case c6:return this.visitWindowDef;case f6:return this.visitWindowExtentExpr;case UL:return this.visitWindowFrame;case u6:return this.visitWindowFunction;case p6:return this.visitWithClause;default:throw new Error(`Unknown node type: '${e}'`)}}mapToString(e){return e.map(n=>this.toString(n))}}function Zc(t){return typeof t=="string"}function Pk(t){return Array.isArray(t)}function w6(t){if(t){const e=t;return typeof e?.addEventListener=="function"&&e.dynamic!==!1&&"value"in e}return!1}class x6 extends wr{param;constructor(e){super(d6),this.param=e}get value(){return this.param.value}}const nne="PRECEDING",rne="FOLLOWING",WL="CURRENT ROW",YL="UNBOUNDED";class ine extends tne{visitAggregate(e){const{name:n,args:r,isDistinct:i,filter:s,order:o}=e,a=[i?"DISTINCT":"",r?.length?this.mapToString(r).join(", "):n.toLowerCase()==="count"?"*":"",o.length?`ORDER BY ${this.mapToString(o).join(", ")}`:""].filter(u=>u).join(" "),l=s?` FILTER (WHERE ${this.toString(s)})`:"";return`${n}(${a})${l}`}visitBetween(e){return WT(this,e,"BETWEEN")}visitBinary(e){const{left:n,right:r,op:i}=e;return`(${this.toString(n)} ${i} ${this.toString(r)})`}visitCase(e){const{expr:n,_when:r,_else:i}=e;return"CASE "+(n?`${this.toString(n)} `:"")+this.mapToString(r).join(" ")+(i?` ELSE ${this.toString(i)}`:"")+" END"}visitCast(e){const{expr:n,cast:r}=e;return`(${this.toString(n)})::${r}`}visitCollate(e){const{expr:n,collation:r}=e;return`${this.toString(n)} COLLATE ${r}`}visitColumnParam(e){return this.visitColumnRef(e)}visitColumnRef(e){const{column:n,table:r}=e,i=r?`${this.toString(r)}.`:"",s=n==="*"?"*":xf(n);return`${i}${s}`}visitDescribeQuery(e){const{query:n}=e;return`DESC ${this.toString(n)}`}visitExpression(e){throw new Error(`Unexpected EXPRESSION node type. Node: ${JSON.stringify(e)}`)}visitFragment(e){const{spans:n}=e;return n.map(r=>typeof r=="string"?r:this.toString(r)).join("")}visitFromClause(e){const{expr:n,alias:r,sample:i}=e,s=iN(n)?`(${this.toString(n)})`:`${this.toString(n)}`;return`${r&&!(kv(n)&&n.table?.join(".")===r)?`${s} AS ${xf(r)}`:`${s}`}${i?` TABLESAMPLE ${this.toString(i)}`:""}`}visitFunction(e){const{name:n,args:r}=e;return`${n}(${this.mapToString(r).join(", ")})`}visitIn(e){const{expr:n,values:r}=e;return`(${this.toString(n)} IN (${this.mapToString(r).join(", ")}))`}visitInterval(e){const{steps:n,name:r}=e;return`INTERVAL ${n} ${r}`}visitJoinClause(e){const{left:n,right:r,joinVariant:i,joinType:s,condition:o,using:a,sample:l}=e,u=i==="REGULAR"?"":`${i} `;let c="",f="";i!=="CROSS"&&(c=s!=="INNER"?`${s} `:"",f=o?` ON ${this.toString(o)}`:a?` USING (${this.mapToString(a).join(", ")})`:"");const h=l?` USING SAMPLE ${this.toString(l)}`:"";return`${this.toString(n)} ${u}${c}JOIN ${this.toString(r)}${f}${h}`}visitList(e){const{values:n}=e;return`[${this.mapToString(n).join(", ")}]`}visitLiteral(e){const{value:n}=e;return XT(n)}visitLogicalOperator(e){const{clauses:n,op:r}=e,i=this.mapToString(n);return i.length===0?"":i.length===1?`${i[0]}`:`(${i.join(` ${r} `)})`}visitNotBetween(e){return WT(this,e,"NOT BETWEEN")}visitOrderBy(e){const{expr:n,desc:r,nullsFirst:i}=e,s=r?" DESC":r===!1?" ASC":"",o=i?" NULLS FIRST":i===!1?" NULLS LAST":"";return`${this.toString(n)}${s}${o}`}visitParam(e){const{param:n}=e;return XT(n.value)}visitSampleClause(e){const{size:n,perc:r,method:i,seed:s}=e,o=i?`${i} `:"",a=s!=null?` REPEATABLE (${s})`:"";return`${o}(${n}${r?"%":" ROWS"})${a}`}visitScalarSubquery(e){return`(${this.toString(e.subquery)})`}visitSelectClause(e){const{expr:n,alias:r}=e;return!r||sne(n,r)?this.toString(n):`${this.toString(n)} AS ${xf(r)}`}visitSelectQuery(e){const{_with:n,_select:r,_distinct:i,_from:s,_sample:o,_where:a,_groupby:l,_having:u,_window:c,_qualify:f,_orderby:h,_limitPerc:d,_limit:p,_offset:m}=e,g=[];if(n.length&&g.push(`WITH ${this.mapToString(n).join(", ")}`),g.push(`SELECT${i?" DISTINCT":""} ${this.mapToString(r).join(", ")}`),s.length&&g.push(`FROM ${this.mapToString(s).join(", ")}`),o&&g.push(`USING SAMPLE ${this.toString(o)}`),a.length){const y=this.mapToString(a).filter(O=>O).join(" AND ");y&&g.push(`WHERE ${y}`)}if(l.length&&g.push(`GROUP BY ${this.mapToString(l).join(", ")}`),u.length){const y=this.mapToString(u).filter(O=>O).join(" AND ");y&&g.push(`HAVING ${y}`)}if(c.length&&g.push(`WINDOW ${this.mapToString(c).join(", ")}`),f.length){const y=this.mapToString(f).filter(O=>O).join(" AND ");y&&g.push(`QUALIFY ${y}`)}return h.length&&g.push(`ORDER BY ${this.mapToString(h).join(", ")}`),p&&g.push(`LIMIT ${this.toString(p)}${d?"%":""}`),m!=null&&g.push(`OFFSET ${this.toString(m)}`),g.join(" ")}visitSetOperation(e){const{op:n,queries:r,_with:i,_orderby:s,_limitPerc:o,_limit:a,_offset:l}=e,u=[];return i.length&&u.push(`WITH ${this.mapToString(i).join(", ")}`),u.push(r.join(` ${n} `)),s.length&&u.push(`ORDER BY ${this.mapToString(s).join(", ")}`),a&&u.push(`LIMIT ${this.toString(a)}${o?"%":""}`),l&&u.push(`OFFSET ${this.toString(l)}`),u.join(" ")}visitTableRef(e){const{table:n}=e;return n.map(r=>xf(r)).join(".")}visitUnary(e){const{expr:n,op:r}=e;return`(${r} ${this.toString(n)})`}visitUnaryPostfix(e){const{expr:n,op:r}=e;return`(${this.toString(n)} ${r})`}visitUnnest(e){const{expr:n,recursive:r,maxDepth:i}=e,s=[this.toString(n)];return r&&s.push("recursive := true"),i!=null&&i>0&&s.push(`max_depth := ${i}`),`UNNEST(${s.join(", ")})`}visitVerbatim(e){const{value:n}=e;return n}visitWhen(e){const{when:n,then:r}=e;return`WHEN ${this.toString(n)} THEN ${this.toString(r)}`}visitWindow(e){const{func:n,def:r}=e;return`${this.toString(n)} OVER ${this.toString(r)}`}visitWindowClause(e){const{name:n,def:r}=e;return`${xf(n)} AS ${this.toString(r)}`}visitWindowDef(e){const{name:n,partition:r,order:i,framedef:s}=e,o=n&&xf(n),a=[o,r?.length&&`PARTITION BY ${this.mapToString(r).join(", ")}`,i?.length&&`ORDER BY ${this.mapToString(i).join(", ")}`,s&&this.toString(s)].filter(l=>l);return o&&a.length<2?o:`(${a.join(" ")})`}visitWindowExtentExpr(e){const{scope:n,expr:r}=e;return n===WL?n:`${wl(r)?this.toString(r):r??YL} ${n}`}visitWindowFrame(e){const{frameType:n,exclude:r,extent:i}=e,[s,o]=wl(i)?i.value:i,a=YT(this,s,nne),l=YT(this,o,rne);return`${n} BETWEEN ${a} AND ${l}${r?` ${r}`:""}`}visitWindowFunction(e){const{name:n,args:r,ignoreNulls:i,order:s}=e,o=[this.mapToString(r).join(", "),s.length?`ORDER BY ${this.mapToString(s).join(", ")}`:"",i?"IGNORE NULLS":""].filter(a=>a).join(" ");return`${n}(${o})`}visitWithClause(e){const{name:n,query:r,materialized:i}=e,s=i===!0?"MATERIALIZED ":i===!1?"NOT MATERIALIZED ":"";return`${xf(n)} AS ${s}(${this.toString(r)})`}}function sne(t,e){return t instanceof yx&&t.table==null&&t.column===e}function WT(t,e,n){const{extent:r,expr:i}=e;if(!r)return"";const[s,o]=t.mapToString(r);return`(${t.toString(i)} ${n} ${s} AND ${o})`}function YT(t,e,n){const r=wl(e)?t.toString(e):e;return wl(e)&&e.type===f6?r:r!=null&&typeof r!="number"?`${r} ${n}`:r===0?WL:r&&Number.isFinite(r)?`${Math.abs(r)} ${n}`:`${YL} ${n}`}const one=new ine;Kte(one);class ane extends wr{name;args;constructor(e,n=[]){super(l6),this.name=e,this.args=n}}function so(t,...e){return new ane(t,gx(e).map(an))}function fi(t,...e){return new Og(t,gx(e).map(an))}function lne(t,...e){return new Vf(new cne(t,gx(e).map(an)))}function yg(t,e){return t.flat().filter(n=>n!=null).map(n=>e(n))}function Xc(t){return yg(t,an)}function gx(t){const e=t.length;let n=e;for(;n>0&&t[n-1]===void 0;--n);return n{const o=s.clone();o.setCteFor(this),n.push(new GT(i,o))};return e.flat().forEach(i=>{if(i instanceof GT)n.push(i);else if(i!=null)for(const s in i)r(s,i[s])}),this._with=this._with.concat(n),this}orderby(...e){return this._orderby=this._orderby.concat(Xc(e)),this}limitPercent(e){return this._limitPerc=!0,this._limit=an(e),this}limit(e){return this._limitPerc=!1,this._limit=an(e),this}offset(e){return this._offset=an(e),this}}class Vp extends Be{_select=[];_from=[];_where=[];_sample;_groupby=[];_having=[];_window=[];_qualify=[];_distinct=!1;constructor(){super(b6)}get subqueries(){const e=this.cteFor||this,r=(e instanceof Vp?e._with:[]).reduce((s,o)=>(s[o.name]=o.query,s),{}),i=[];return this._from.forEach(s=>{if(s instanceof qg){const{expr:o}=s;if(iN(o))i.push(o);else if(kv(o)){const a=r[o.name];a&&i.push(a)}}}),i}clone(){return Object.assign(new Vp,this)}select(...e){const n=new Set,r=[],i=(s,o)=>{const a=nS(o);n.add(a),s&&r.push(new Ene(an(s),a))};return e.flat().forEach(s=>{if(s!=null)if(Zc(s))i(s,s);else if(_6(s))i(s,s.column);else if(Pk(s))i(s[1],s[0]);else if(wl(s))i(s,`${s}`);else for(const o in s)i(s[o],o)}),this._select=this._select.filter(s=>!n.has(s.alias)).concat(r),this}setSelect(...e){return this._select=[],this.select(...e)}distinct(e=!0){return this._distinct=!!e,this}from(...e){const n=[],r=(i,s)=>{n.push(new qg(pne(i),nS(s)))};return e.flat().forEach(i=>{if(i!=null)if(i instanceof tN)n.push(i);else if(Zc(i))r(i,i);else if(kv(i))r(i,i.name);else if(wl(i))r(i);else if(Pk(i))r(i[1],i[0]);else for(const s in i)r(i[s],s)}),this._from=this._from.concat(n),this}setFrom(...e){return this._from=[],this.from(...e)}sample(e,n,r){let i;if(typeof e=="number"){const s=e>0&&e<1,o=s?e*100:Math.floor(e);i=new Ane(o,s,n,r)}else i=e;return this._sample=i??void 0,this}where(...e){return this._where=this._where.concat(yg(e,bg)),this}setWhere(...e){return this._where=[],this.where(...e)}groupby(...e){return this._groupby=this._groupby.concat(Xc(e)),this}setGroupby(...e){return this._groupby=[],this.groupby(...e)}having(...e){return this._having=this._having.concat(yg(e,bg)),this}window(...e){const n=[];return e.flat().forEach(r=>{if(r!=null)for(const i in r)n.push(new une(nS(i),r[i]))}),this._window=this._window.concat(n),this}qualify(...e){return this._qualify=this._qualify.concat(yg(e,bg)),this}}class vx extends Nl{query;constructor(e){super(O6),this.query=e}clone(){return new vx(this.query.clone())}}class La extends Be{op;queries;constructor(e,n){super(v6),this.op=e,this.queries=n}setCteFor(e){super.setCteFor(e);const{queries:n,cteFor:r}=this;r&&n.forEach(i=>i.setCteFor(r))}get subqueries(){return this.queries}clone(){const{op:e,queries:n,...r}=this;return Object.assign(new La(e,n),r)}}class Dne{_with;constructor(...e){this._with=e}select(...e){return Be.select(...e).with(...this._with)}from(...e){return Be.from(...e).with(...this._with)}union(...e){return Be.union(...e).with(...this._with)}unionByName(...e){return Be.unionByName(...e).with(...this._with)}unionAll(...e){return Be.unionAll(...e).with(...this._with)}unionAllByName(...e){return Be.unionAllByName(...e).with(...this._with)}intersect(...e){return Be.intersect(...e).with(...this._with)}intersectAll(...e){return Be.intersectAll(...e).with(...this._with)}except(...e){return Be.except(...e).with(...this._with)}exceptAll(...e){return Be.exceptAll(...e).with(...this._with)}}class sN extends wr{op;expr;constructor(e,n,r){super(e),this.op=n,this.expr=r}}class Pne extends sN{constructor(e,n){super(n6,e,n)}}class Rne extends sN{constructor(e,n){super(r6,e,n)}}function Ine(t,e){return fi("arg_max",t,e)}function Fne(t,e){return fi("arg_min",t,e)}function Cv(t){return fi("avg",t)}function Cr(t){return fi("count",t)}function wx(t){return fi("max",t)}function C6(t){return fi("median",t)}function Vg(t){return fi("min",t)}function $ne(t){return fi("product",t)}function Mne(t,e){return fi("quantile",t,e)}function Lne(t,e){return fi("regr_avgx",t,e)}function Nne(t,e){return fi("regr_avgy",t,e)}function Qne(t,e){return fi("regr_count",t,e)}function Bne(t){return fi("stddev",t)}function zne(t){return fi("stddev_pop",t)}function dr(t){return fi("sum",t)}function Une(t){return fi("var_samp",t)}function jne(t){return fi("var_pop",t)}function Zf(t,e,n){return t?new jg(void 0,[new eN(an(t),an(e))],an(n)):new jg}function Hn(t,e){return new wne(an(t),e)}function qne(t){return Hn(t,"INTEGER")}function HT(t){return Hn(t,"DOUBLE")}function Vne(t){return so("epoch_ms",t)}function Zne(t){return new Sne(gx(t).map(bx))}function Xne(t){return Array.isArray(t)?Zne(t):an(t)}function KT(t,e){return so("list_contains",Xne(t),bx(e))}function Fc(t){return so("isfinite",t)}function A6(t){return so("exp",t)}function oN(t){return so("log",t)}function cp(t){return so("ln",t)}function Eh(t){return so("sign",t)}function Zp(t){return so("abs",t)}function Av(t){return so("sqrt",t)}function Wne(t){return so("ceil",t)}function Ev(t){return so("floor",t)}function Yne(t,e){return so("round",t,e)}function Gne(t,e){return new Pne(t,an(e))}function aN(t,e){return new Rne(t,an(e))}function ba(t,e,n){return new vne(t,an(e),an(n))}function xs(...t){return new kne(Xc(t))}function _o(...t){return new Cne(Xc(t))}function Xp(t){return Gne("NOT",t)}function Eu(t){return aN("IS NULL",t)}function Th(t){return aN("IS NOT NULL",t)}function E6(t,e){return ba("+",t,e)}function Er(t,e){return ba("-",t,e)}function Or(t,e){return ba("*",t,e)}function Kr(t,e){return ba("/",t,e)}function Hne(t,e){return ba("%",t,e)}function To(t,e){return ba("**",t,e)}function qs(t,e){return ba("=",t,e)}function rS(t,e){return ba("<",t,e)}function xx(t,e){return ba(">",t,e)}function JT(t,e){return ba("<=",t,e)}function T6(t,e){return ba("IS NOT DISTINCT FROM",t,e)}function vu(t,e){return new One(an(t),e?.map(an))}function Dh(t,e){return new _ne(an(t),e.map(an))}function Pd(t,e){return new rN(an(t),!1,e)}function fp(t,e){return new rN(an(t),!0,e)}function Ze(t,...e){return new xne(Kne(t,e))}function Kne(t,e){const n=[t[0]],r=e.length;for(let i=0,s=0;ii).map(i=>Zc(i)?new KL(i):i)}function lN(...t){return so("coalesce",...t)}function eD(){return lne("row_number")}const uN={[ny]:["args","order","filter"],[s6]:["expr","extent"],[i6]:["left","right"],[e6]:["expr","_when","_else"],[JC]:["expr"],[BL]:["expr"],[dx]:["param","table"],[hx]:["table"],[O6]:["query"],[jL]:["node"],[mx]:["spans"],[y6]:["expr"],[l6]:["args"],[a6]:["expr","values"],[qL]:["left","right","on","using","sample"],[o6]:["clauses"],[zL]:["expr","extent"],[KC]:["expr"],[d6]:["value"],[ZL]:["subquery"],[g6]:["expr"],[b6]:["_with","_select","_from","_where","_sample","_groupby","_having","_window","_qualify","_orderby"],[v6]:["queries","_orderby"],[n6]:["expr"],[r6]:["expr"],[QL]:["expr"],[t6]:["when","then"],[px]:["func","def"],[m6]:["def"],[c6]:["partition","order","framedef"],[f6]:["expr"],[UL]:["extent"],[u6]:["args"],[p6]:["query"]};function Rk(t,e){if(e.has(t))return e.get(t);if(wl(t)){const n=uN[t.type],r=n?.length??0;if(r>0){t=t.clone();for(let i=0;ie.endsWith("(")&&Jne.test(e.slice(0,-1)))}function D6(t){let e=0;return Zg(t,n=>{switch(n.type){case px:return-1;case ny:return e|=1,-1;case mx:case h6:{let r=`${n}`.toLowerCase();const i=r.indexOf("(select ");return i>=0&&(r=r.slice(0,i)),r.includes(") over ")?-1:tre(r)?(e|=2,-1):1}}}),e}function nre(t){const e=new Set;return Zg(t,n=>{n.type===ny&&e.add(n)}),Array.from(e)}function cN(t){const e={};return Zg(t,n=>{(n.type===hx||n.type===dx)&&(e[`${n}`]=n)}),Object.values(e)}function rre(t,e,{replace:n=!1,temp:r=!1,view:i=!1}={}){return"CREATE"+(n?" OR REPLACE ":" ")+(r?"TEMP ":"")+(i?"VIEW":"TABLE")+(n?" ":" IF NOT EXISTS ")+t+" AS "+e}function fO(t){return t}function tD(){return{apply:fO,invert:fO,sqlApply:an,sqlInvert:fO}}function ire({base:t=null}={}){if(t==null||t===Math.E)return{apply:Math.log,invert:Math.exp,sqlApply:e=>cp(e),sqlInvert:e=>A6(e)};if(t===10)return{apply:Math.log10,invert:e=>Math.pow(10,e),sqlApply:e=>oN(e),sqlInvert:e=>To(10,e)};{const e=+t;return{apply:n=>Math.log(n)/Math.log(e),invert:n=>Math.pow(e,n),sqlApply:n=>Kr(cp(n),cp(e)),sqlInvert:n=>To(e,n)}}}function sre({constant:t=1}={}){const e=+t;return{apply:n=>Math.sign(n)*Math.log1p(Math.abs(n)),invert:n=>Math.sign(n)*Math.exp(Math.abs(n)-e),sqlApply:n=>(n=an(n),Or(Eh(n),cp(E6(e,Zp(n))))),sqlInvert:n=>Or(Eh(n),Er(A6(Zp(n)),e))}}function ore(){return{apply:t=>Math.sign(t)*Math.sqrt(Math.abs(t)),invert:t=>Math.sign(t)*t*t,sqlApply:t=>(t=an(t),Or(Eh(t),Av(Zp(t)))),sqlInvert:t=>Or(Eh(t),To(t,2))}}function are({exponent:t=1}={}){const e=+t;return{apply:n=>Math.sign(n)*Math.pow(Math.abs(n),e),invert:n=>Math.sign(n)*Math.pow(Math.abs(n),1/e),sqlApply:n=>(n=an(n),Or(Eh(n),To(Zp(n),e))),sqlInvert:n=>Or(Eh(n),To(Zp(n),Kr(1,e)))}}function nD(){return{apply:t=>Number(t),invert:t=>new Date(t),sqlApply:t=>t instanceof Date?Ae(+t):cre(t)?Ae(Number(t.value)):Vne(t),sqlInvert:fO}}const lre={identity:tD,linear:tD,log:ire,symlog:sre,sqrt:ore,pow:are,time:nD,utc:nD};function ure(t){const e=lre[t.type];if(!e)throw new Error(`Unrecognized scale type: ${t.type}`);return{...t,...e(t)}}function cre(t){return t instanceof XL&&t.value instanceof Date}function fN(t){let e=2166136261;for(let n=0,r=t.length;n>8)),e=rD(e^i&255)}return fre(e)>>>0}function rD(t){return t+(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24)}function fre(t){return t+=t<<13,t^=t>>>7,t+=t<<3,t^=t>>>17,t+=t<<5,t&4294967295}function hre(t,e,n){switch(t.name){case"count":case"count_star":return dre(e,t);case"sum":return dN(e,t);case"avg":return pre(e,t);case"geomean":return mre(e,t);case"arg_max":return gre(e,t);case"arg_min":return yre(e,t);case"variance":case"var_samp":return Xy(e,t,n);case"var_pop":return Xy(e,t,n,!1);case"stddev":case"stddev_samp":return Av(Xy(e,t,n));case"stddev_pop":return Av(Xy(e,t,n,!1));case"covar_samp":return hO(e,t,n);case"covar_pop":return hO(e,t,n,!1);case"corr":return iD(e,t,n);case"regr_count":return Q0(e,t).expr;case"regr_avgx":return mN(e,t);case"regr_avgy":return gN(e,t);case"regr_syy":return Fk(e,0,t,n);case"regr_sxx":return Fk(e,1,t,n);case"regr_sxy":return hO(e,t,n,null);case"regr_slope":return yN(e,t,n);case"regr_intercept":return bre(e,t,n);case"regr_r2":return To(iD(e,t,n),2);case"max":case"min":case"bit_and":case"bit_or":case"bit_xor":case"bool_and":case"bool_or":case"product":{const r=hN(t);return e[r]=t,Ze`${t.name}("${r}")`}default:return null}}function hN(t){return"pre_"+fN(`${t}`).toString(16)}function Ci(t,e,n){const r=n?.filter;r&&(e=e.filter?e.where(xs(r,e.filter)):e.where(r));const i=hN(e);return t[i]=e,i}function P6(t,e){const n=Ci(t,Cr(e.args[0]),e);return{expr:lN(dr(n),0),name:n}}function dre(t,e){return lN(dN(t,e),0)}function dN(t,e){return dr(Ci(t,e))}function pre(t,e){const n=Ci(t,e),{expr:r,name:i}=P6(t,e);return Kr(dr(Or(n,i)),r)}function mre(t,e){const n=e.args[0],r=Ci(t,dr(cp(n)),e),{expr:i}=P6(t,e);return A6(Kr(dr(r),i))}function gre(t,e){const n=Ci(t,e),r=Ci(t,wx(e.args[1]),e);return Ine(n,r)}function yre(t,e){const n=Ci(t,e),r=Ci(t,Vg(e.args[1]),e);return Fne(n,r)}function Xy(t,e,n,r=!0){const i=e.args[0],{expr:s}=P6(t,e),o=Er(i,n(i)),a=Ci(t,dr(To(o,2)),e),l=Ci(t,dr(o),e),u=r?Er(s,1):s;return Kr(Er(dr(a),Kr(To(dr(l),2),s)),u)}function hO(t,e,n,r=!0){const{expr:i}=Q0(t,e),s=pN(t,e,n),o=Xg(t,1,e,n),a=Xg(t,0,e,n),l=Er(s,Kr(Or(o,a),i));return r===null?l:r?Kr(l,Er(i,1)):Kr(l,i)}function iD(t,e,n){const{expr:r}=Q0(t,e),i=pN(t,e,n),s=Ik(t,1,e,n),o=Ik(t,0,e,n),a=Xg(t,1,e,n),l=Xg(t,0,e,n),u=Er(s,Kr(To(a,2),r)),c=Er(o,Kr(To(l,2),r));return Kr(Er(i,Kr(Or(a,l),r)),Av(Or(u,c)))}function Q0(t,e){const[n,r]=e.args,i=Ci(t,Qne(n,r),e);return{expr:dr(i),name:i}}function Xg(t,e,n,r){const i=n.args,s=i[e],o=i[1-e],a=dr(Er(s,r(s))).where(Th(o));return dr(Ci(t,a,n))}function Ik(t,e,n,r){const i=n.args,s=i[e],o=i[1-e],a=dr(To(Er(s,r(s)),2)).where(Th(o));return dr(Ci(t,a,n))}function pN(t,e,n){const[r,i]=e.args,s=dr(Or(Er(i,n(i)),Er(r,n(r))));return dr(Ci(t,s,e))}function mN(t,e){const[n,r]=e.args,{expr:i,name:s}=Q0(t,e),o=Ci(t,Lne(n,r),e);return Kr(dr(Or(o,s)),i)}function gN(t,e){const[n,r]=e.args,{expr:i,name:s}=Q0(t,e),o=Ci(t,Nne(n,r),e);return Kr(dr(Or(o,s)),i)}function Fk(t,e,n,r){const{expr:i}=Q0(t,n),s=Xg(t,e,n,r),o=Ik(t,e,n,r);return Er(o,Kr(To(s,2),i))}function yN(t,e,n){const r=hO(t,e,n,null),i=Fk(t,1,e,n);return Kr(r,i)}function bre(t,e,n){const r=mN(t,e),i=gN(t,e),s=yN(t,e,n);return Er(i,Or(s,r))}function Ore(t){if(!t.filterStable)return null;const e=t.query();if(!Ox(e))return null;const n=Tv(e,l=>{const u=l._from[0],c=u instanceof qg&&u.expr;return kv(c)?c.name:c});if(typeof n!="string")return null;const r=new Map,i={},s={},o=[],a=l=>{const u=l.column,c=Tv(e,f=>f._select.find(h=>h.alias===u)?.expr);return Ze`(SELECT avg(${c??l}) FROM "${n}")`};for(const{alias:l,expr:u}of e._select){if(D6(u)>1)return null;const c=nre(u);if(c.length===0)o.push(l),i[l]=u;else{for(const f of c){if(f.isDistinct)return null;const h=hre(f,i,a);if(!h)return null;r.set(f,h)}s[l]=Rk(u,r)}}return r.size?{group:o,preagg:i,output:s}:null}function Tv(t,e){const n=t.subqueries;if(Ox(t)&&n.length===0)return e(t);const r=Tv(n[0],e);for(let i=1;is.logger().error(h))}return i.set(e,c),c}}function xre(t){const{source:e,meta:n}=t,r=t.predicate,i=cN(r).map(a=>a.column);let s,o;if(!n||!i)return{source:null,columns:o,predicate:s};switch(n.type){case"point":s=a=>a,o=Object.fromEntries(i.map(a=>[`${a}`,an(a)]));break;case"interval":{const{scales:a,bin:l,pixelSize:u=1}=n;if(!a)break;const c=a.map(f=>Sre(f,u,l));c.some(f=>!f)||(c.length===1?(s=f=>f?vu("active0",f.extent?.map(c[0])):[],o={active0:c[0](r.expr)}):(s=f=>f?xs(f.clauses.map((h,d)=>vu(`active${d}`,h.extent?.map(c[d])))):[],o=Object.fromEntries(r.clauses.map((f,h)=>[`active${h}`,c[h](f.expr)]))))}}return{source:o?e:null,columns:o,predicate:s}}const _re={ceil:Wne,round:Yne};function Sre(t,e,n){const{type:r,domain:i,range:s,apply:o,sqlApply:a}=ure(t);if(!o)return;const l=_re[`${n}`.toLowerCase()]||Ev,u=i.map(m=>Number(m)),c=o(Math.min(...u)),f=o(Math.max(...u)),h=(r==="identity"?1:Math.abs(s[1]-s[0])/(f-c))/e,d=h===1?m=>m:m=>Or(HT(h),m),p=c===0?m=>m:m=>Er(m,HT(c));return m=>qne(l(d(p(a(m)))))}function kre(t,e,n,r){const{group:i,output:s,preagg:o}=n,{columns:a}=e,l=t.setSelect({...o,...a}).groupby(Object.keys(a)),[u]=l.subqueries;if(u){const g=Object.values(a).flatMap(y=>cN(y).map(O=>O.column));Cre(u,g)}const c=l._having,f=l._orderby;l._having=[],l._orderby=[];const h=l.toString(),d=(fN(h)>>>0).toString(16),p=`${r}.preagg_${d}`,m=Be.select(i,s).from(p).groupby(i).having(c).orderby(f);return new Ere({table:p,create:h,active:e,select:m})}function Cre(t,e){const n=new Set,r=i=>{if(!n.has(i)){if(n.add(i),Ox(i)&&i._from.length&&(i.select(e),Are(i))){const s=new Set(i._groupby.flatMap(o=>o instanceof HL?[o.name]:[]));i.groupby(e.filter(o=>!s.has(o)))}i.subqueries.forEach(r)}};r(t)}function Are(t){return t._groupby.length>0||t._select.some(e=>D6(e))}class Ere{table;create;result;active;select;skip;constructor({table:e,create:n,active:r,select:i}){this.table=e,this.create=n,this.result=null,this.active=r,this.select=i,this.skip=!1}query(e){return this.select.clone().where(this.active.predicate(e))}}function $k(){return{debug(){},info(){},log(){},warn(){},error(){},group(){},groupCollapsed(){},groupEnd(){}}}const Xf=Object.freeze({pending:Symbol("pending"),ready:Symbol("ready"),error:Symbol("error"),done:Symbol("done")});class R6 extends Promise{_resolve;_reject;_state;_value;constructor(){let e,n;super((r,i)=>{e=r,n=i}),this._resolve=e,this._reject=n,this._state=Xf.pending,this._value=void 0}fulfill(e){if(this._value!==void 0){if(e!==void 0)throw Error("Promise is ready and fulfill has a provided value");this._resolve(this._value)}else{if(e===void 0)throw Error("Promise is neither ready nor has provided value");this._resolve(e)}return this._state=Xf.done,this}ready(e){return this._state=Xf.ready,this._value=e,this}reject(e){return this._state=Xf.error,this._reject(e),this}get state(){return this._state}}R6.prototype.constructor=Promise;function Tre(t){return typeof requestAnimationFrame<"u"?requestAnimationFrame(t):typeof setImmediate<"u"?setImmediate(t):setTimeout(t)}function Dre(t,e){let n=[],r=0;function i(){const s=Pre(n,e);n=[],r=0;for(const o of s)Ire(o,t),Mre(o,e)}return{add(s,o){s.request.type==="arrow"?(r||=Tre(()=>i()),n.push({entry:s,priority:o,index:n.length})):t(s,o)}}}function Pre(t,e){const n=[],r=new Map;for(const i of t){const{entry:{request:s}}=i,o=Rre(s.query,e);if(!r.has(o)){const a=[];n.push(a),r.set(o,a)}r.get(o).push(i)}return n}function Rre(t,e){const n=`${t}`;if(Ox(t)&&!e.get(n)){if(t._where.length||t._qualify.length||t._having.length||t._orderby.length||t._distinct)return n;const r=t.clone().setSelect("*"),i=t._groupby;if(i.length){const s={};t._select.forEach(({alias:o,expr:a})=>s[o]=a),r.setGroupby(i.map(o=>_6(o)&&s[o.column]||o))}else t._select.some(s=>D6(s.expr))&&r.setGroupby("ALL");return`${r}`}else return n}function Ire(t,e){if(Fre(t))e({request:{type:"arrow",cache:!1,query:t.query=$re(t)},result:t.result=new R6});else for(const{entry:n,priority:r}of t)e(n,r)}function Fre(t){if(t.length>1){const e=`${t[0].entry.request.query}`;for(let n=1;ns[a]=o),r.setGroupby(i.map(o=>_6(o)&&s[o.column]||o))}return r.setSelect(Array.from(n.values()))}async function Mre(t,e){const{maps:n,query:r,result:i}=t;if(!n)return;let s;try{s=await i}catch(a){for(const{entry:l}of t)l.result.reject(a);return}const o=Tne(r);t.forEach(({entry:a},l)=>{const{request:u,result:c}=a,f=n[l],h=o&&f?Nre(s,f):f?Lre(s,f):s;u.cache&&e.set(String(u.query),h),c.fulfill(h)})}function Lre(t,e){return t.select(e.map(n=>n[0]),e.map(n=>n[1]))}function Nre(t,e){const n=new Map(e),r=[];for(const i of t)n.has(i.column_name)&&r.push({...i,column_name:n.get(i.column_name)});return r}const Qre=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout;function Bre(){return{get:()=>{},set:(t,e)=>e,clear:()=>{}}}function zre({max:t=1e3,ttl:e=10800*1e3}={}){let n=new Map;function r(){const i=performance.now()-e;let s=null,o=1/0;for(const[a,l]of n){const{last:u}=l;uu&&n.delete(a)}s&&n.delete(s)}return{get(i){const s=n.get(i);if(s)return s.last=performance.now(),s.value},set(i,s){return n.set(i,{last:performance.now(),value:s}),n.size>t&&Qre(r),s},clear(){n=new Map}}}class Ure{queue;constructor(e){this.queue=Array.from({length:e},()=>({head:null,tail:null}))}isEmpty(){return this.queue.every(e=>!e.head)}insert(e,n){const r=this.queue[n];if(!r)throw new Error(`Invalid queue priority rank: ${n}`);const i={item:e,next:null};r.head===null?r.head=r.tail=i:r.tail=r.tail.next=i}remove(e){for(const n of this.queue){let{head:r,tail:i}=n;for(let s=null,o=r;o;s=o,o=o.next)e(o.item)&&(o===r?r=o.next:s.next=o.next,o===i&&(i=s||r));n.head=r,n.tail=i}}next(){for(const e of this.queue){const{head:n}=e;if(n!==null)return e.head=n.next,e.tail===n&&(e.tail=null),n.item}}}const Wd=Object.freeze({High:0,Normal:1,Low:2});class jre{queue;db;clientCache;_logger;_logQueries;_consolidate;pendingResults;maxConcurrentRequests;pendingExec;constructor(e=32){this.queue=new Ure(3),this.db=null,this.clientCache=null,this._logger=$k(),this._logQueries=!1,this._consolidate=null,this.pendingResults=[],this.maxConcurrentRequests=e,this.pendingExec=!1}next(){if(this.queue.isEmpty()||this.pendingResults.length>this.maxConcurrentRequests||this.pendingExec)return;const e=this.queue.next();if(!e)return;const{request:n,result:r}=e;this.pendingResults.push(r),n.type==="exec"&&(this.pendingExec=!0),this.submit(n,r).finally(()=>{for(;this.pendingResults.length&&this.pendingResults[0].state!==Xf.pending;){const i=this.pendingResults.shift();i.state===Xf.ready?i.fulfill():i.state===Xf.done&&this._logger.warn("Found resolved query in pending results.")}n.type==="exec"&&(this.pendingExec=!1),this.next()})}enqueue(e,n=Wd.Normal){this.queue.insert(e,n),this.next()}async submit(e,n){try{const{query:r,type:i,cache:s=!1,options:o}=e,a=r?`${r}`:null;if(s){const f=this.clientCache.get(a);if(f){const h=await f;this._logger.debug("Cache"),n.ready(h);return}}const l=performance.now();this._logQueries&&this._logger.debug("Query",{type:i,sql:a,...o});const u=this.db.query({type:i,sql:a,...o});s&&this.clientCache.set(a,u);const c=await u;s&&this.clientCache.set(a,c),this._logger.debug(`Request: ${(performance.now()-l).toFixed(1)}`),n.ready(i==="exec"?null:c)}catch(r){n.reject(r)}}cache(e){return e!==void 0?this.clientCache=e===!0?zre():e||Bre():this.clientCache}logger(e){return e?this._logger=e:this._logger}logQueries(e){return e!==void 0?this._logQueries=!!e:this._logQueries}connector(e){return e?this.db=e:this.db}consolidate(e){e&&!this._consolidate?this._consolidate=Dre(this.enqueue.bind(this),this.clientCache):!e&&this._consolidate&&(this._consolidate=null)}request(e,n=Wd.Normal){const r=new R6,i={request:e,result:r};return this._consolidate?this._consolidate.add(i,n):this.enqueue(i,n),r}cancel(e){const n=new Set(e);if(n.size){this.queue.remove(({result:r})=>n.has(r)?(r.reject("Canceled"),!0):!1);for(const r of this.pendingResults)n.has(r)&&r.reject("Canceled")}}clear(){this.queue.remove(({result:e})=>(e.reject("Cleared"),!0));for(const e of this.pendingResults)e.reject("Cleared");this.pendingResults=[]}}let Wy;function _x(t){return t?Wy=t:Wy==null&&(Wy=new qre),Wy}class qre{manager;preaggregator;clients=new Set;filterGroups=new Map;_logger=$k();constructor(e=new IL,n={}){const{logger:r=console,manager:i=new jre,cache:s=!0,consolidate:o=!0,preagg:a={}}=n;this.manager=i,this.manager.cache(s),this.manager.consolidate(o),this.databaseConnector(e),this.logger(r),this.clear(),this.preaggregator=new wre(this,a)}clear(e={}){const{clients:n=!0,cache:r=!0}=e;this.manager.clear(),n&&(this.filterGroups?.forEach(i=>i.disconnect()),this.filterGroups=new Map,this.clients?.forEach(i=>this.disconnect(i)),this.clients=new Set),r&&this.manager.cache().clear()}databaseConnector(e){return e?this.manager.connector(e):this.manager.connector()}logger(e){return arguments.length&&(this._logger=e||$k(),this.manager.logger(this._logger)),this._logger}cancel(e){this.manager.cancel(e)}exec(e,n={}){const{priority:r=Wd.Normal}=n;return e=Array.isArray(e)?e.filter(i=>i).join(`; `):e,this.manager.request({type:"exec",query:e},r)}query(e,n={}){const{type:r="arrow",cache:i=!0,priority:s=Wd.Normal,...o}=n;return this.manager.request({type:r,query:e,cache:i,options:o},s)}prefetch(e,n={}){return this.query(e,{...n,cache:!0,priority:Wd.Low})}updateClient(e,n,r=Wd.Normal){return e.queryPending(),e._pending=this.query(n,{priority:r}).then(i=>e.queryResult(i).update(),i=>{this._logger?.error(i),e.queryError(i)}).catch(i=>this._logger?.error(i))}requestQuery(e,n){return this.preaggregator.clear(),n?this.updateClient(e,n):Promise.resolve(e.update())}connect(e){const{clients:n}=this;if(n?.has(e))throw new Error("Client already connected.");n?.add(e),e.coordinator=this,e.initialize(),Vre(this,e.filterBy,e)}disconnect(e){const{clients:n,filterGroups:r}=this;if(!n?.has(e))return;n.delete(e),e.coordinator=null;const i=r?.get(e.filterBy);i&&i.clients.delete(e)}}function Vre(t,e,n){if(!e)return;let r=t.filterGroups?.get(e);if(!r){const i=o=>Zre(t,e,o),s=()=>Xre(t,e);e.addEventListener("activate",i),e.addEventListener("value",s),r={selection:e,clients:new Set,disconnect(){e.removeEventListener("activate",i),e.removeEventListener("value",s)}},t.filterGroups?.set(e,r)}r.clients.add(n)}function Zre(t,e,n){const{preaggregator:r,filterGroups:i}=t,{clients:s}=i.get(e);for(const o of s)o.enabled&&r.request(o,e,n)}function Xre(t,e){const{preaggregator:n,filterGroups:r}=t,{clients:i}=r.get(e),{active:s}=e;return Promise.allSettled(Array.from(i,o=>{if(!o.enabled)return o.requestQuery();const a=n.request(o,e,s),l=a?null:e.predicate(o);if(a?.skip||!a&&!l)return;const u=a?.query(s.predicate)??o.query(l);return t.updateClient(o,u)}))}function Ph(t){const{coordinator:e=_x(),...n}=t,r=new Wre(n);return e.connect(r),r}class Wre extends sL{_methods;_filterStable;constructor({selection:e=void 0,enabled:n=!0,filterStable:r=!0,...i}){super(e),this.enabled=n,this._methods=i,this._filterStable=r}get filterStable(){return this._filterStable}async prepare(){await this._methods.prepare?.()}query(e){return this._methods.query?.(e)??null}queryResult(e){return this._methods.queryResult?.(e),this}queryPending(){return this._methods.queryPending?.(),this}queryError(e){return this._methods.queryError?.(e),this}}class Yre{_callbacks;constructor(){this._callbacks=new Map}addEventListener(e,n){this._callbacks.has(e)||this._callbacks.set(e,{callbacks:new Set,pending:null,queue:new Gre}),this._callbacks.get(e).callbacks.add(n)}removeEventListener(e,n){const r=this._callbacks.get(e);r&&r.callbacks.delete(n)}willEmit(e,n){return n}emitQueueFilter(e,n){return null}cancel(e){this._callbacks.get(e)?.queue.clear()}async pending(e){await this._callbacks.get(e)?.pending}emit(e,n){const r=this._callbacks.get(e)||{};if(r.pending)r.queue.enqueue(n,this.emitQueueFilter(e,n));else{const i=this.willEmit(e,n),{callbacks:s,queue:o}=r;if(s?.size){const a=Array.from(s,l=>l(i));r.pending=Promise.allSettled(a).then(()=>{r.pending=null,o.isEmpty()||this.emit(e,o.dequeue())})}}}}class Gre{next=null;constructor(){this.clear()}clear(){this.next=null}isEmpty(){return!this.next}enqueue(e,n){const r={value:e};if(n&&this.next){let i=this;for(;i.next;)n(i.next.value)?i=i.next:i.next=i.next.next;i.next=r}else this.next=r}dequeue(){const{next:e}=this;return this.next=e?.next||null,e?.value}}function Hre(t,e){return t===e?!1:t instanceof Date&&e instanceof Date?+t!=+e:Array.isArray(t)&&Array.isArray(e)?Kre(t,e):!0}function Kre(t,e){if(t.length!==e.length)return!0;for(let n=0;niS(n))){const n=new hp,r=()=>{n.update(e.map(i=>iS(i)?i.value:i))};return r(),e.forEach(i=>iS(i)?i.addEventListener("value",r):0),n}return new hp(e)}get value(){return this._value}update(e,{force:n}={}){return Hre(this._value,e)||n?this.emit("value",e):this.cancel("value"),this}willEmit(e,n){return e==="value"&&(this._value=n),n}}function sD(t){return t instanceof I6}function Yy(t,e){return new I6(new ON(t),e?[e].flat():void 0)}let I6=class bN extends hp{_resolved;_resolver;_relay;static intersect({cross:e=!1,empty:n=!1,include:r=[]}={}){return Yy({cross:e,empty:n},r)}static union({cross:e=!1,empty:n=!1,include:r=[]}={}){return Yy({cross:e,empty:n,union:!0},r)}static single({cross:e=!1,empty:n=!1,include:r=[]}={}){return Yy({cross:e,empty:n,single:!0},r)}static crossfilter({empty:e=!1,include:n=[]}={}){return Yy({cross:!0,empty:e},n)}constructor(e=new ON,n=[]){if(super([]),this._resolved=this._value,this._resolver=e,this._relay=new Set,Array.isArray(n))for(const r of n)r._relay.add(this)}clone(){const e=new bN(this._resolver);return e._value=e._resolved=this._value,e}remove(e){const n=this.clone();return n._value=n._resolved=n._resolver.resolve(this._resolved,{source:e}),n._value.active={source:e},n}get resolver(){return this._resolver}get single(){return this._resolver.single}get clauses(){return super.value}get active(){return this.clauses.active}get value(){return this.active?.value}valueFor(e){return this.clauses.find(n=>n.source===e)?.value}activate(e){this.emit("activate",e),this._relay.forEach(n=>n.activate(e))}update(e){return this._resolved=this._resolver.resolve(this._resolved,e,!0),this._resolved.active=e,this._relay.forEach(n=>n.update(e)),super.update(this._resolved)}reset(e){return e??=this._resolved,e.forEach(n=>n.source?.reset?.()),this._resolved=this._resolved.filter(n=>!e.includes(n)),this._relay.forEach(n=>n.reset(e)),super.update(this._resolved)}willEmit(e,n){return e==="value"?(this._value=n,this.value):n}emitQueueFilter(e,n){return e==="value"?this._resolver.queueFilter(n):null}skip(e,n){return this._resolver.skip(e,n)}predicate(e=void 0,n=!1){const{clauses:r}=this,i=n?null:r.active;return this._resolver.predicate(r,i,e)}};class ON{union;cross;single;empty;constructor({union:e,cross:n,single:r,empty:i}={}){this.union=!!e,this.cross=!!n,this.single=!!r,this.empty=!!i}resolve(e,n,r=!1){const{source:i,predicate:s}=n,o=e.filter(l=>i!==l.source),a=this.single?[]:o;return this.single&&r&&o.forEach(l=>l.source?.reset?.()),s&&a.push(n),a}skip(e,n){return e==null?!1:!!(this.cross&&n?.clients?.has(e))}predicate(e,n,r){const{empty:i,union:s}=this;if(i&&!e.length)return[Ae(!1)];if(this.skip(r,n))return;const o=e.filter(a=>!this.skip(r,a)).map(a=>a.predicate);return s&&o.length>1?_o(o):o}queueFilter(e){if(this.cross){const n=e.active?.source;return r=>r.active?.source!==n}return null}}function Jre(t){return new eie(t)}class eie{_uri;_ipc;constructor({uri:e="http://localhost:3000/",ipc:n=void 0}={}){this._uri=e,this._ipc=n}async query(e){const n=fetch(this._uri,{method:"POST",mode:"cors",credentials:"omit",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),r=await n;if(!r.ok)throw new Error(`Query failed with HTTP status ${r.status}: ${await r.text()}`);return e.type==="exec"?n:e.type==="arrow"?Sv(await r.arrayBuffer(),this._ipc):r.json()}}function dt(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{u(r.next(c))}catch(f){o(f)}}function l(c){try{u(r.throw(c))}catch(f){o(f)}}function u(c){c.done?s(c.value):i(c.value).then(a,l)}u((r=r.apply(t,e||[])).next())})}function oD(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function _t(t){return this instanceof _t?(this.v=t,this):new _t(t)}function Ja(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),i[Symbol.asyncIterator]=function(){return this},i;function o(d){return function(p){return Promise.resolve(p).then(d,f)}}function a(d,p){r[d]&&(i[d]=function(m){return new Promise(function(g,y){s.push([d,m,g,y])>1||l(d,m)})},p&&(i[d]=p(i[d])))}function l(d,p){try{u(r[d](p))}catch(m){h(s[0][3],m)}}function u(d){d.value instanceof _t?Promise.resolve(d.value.v).then(c,f):h(s[0][2],d)}function c(d){l("next",d)}function f(d){l("throw",d)}function h(d,p){d(p),s.shift(),s.length&&l(s[0][0],s[0][1])}}function dO(t){var e,n;return e={},r("next"),r("throw",function(i){throw i}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(i,s){e[i]=t[i]?function(o){return(n=!n)?{value:_t(t[i](o)),done:!1}:s?s(o):o}:s}}function dh(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof oD=="function"?oD(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=t[s]&&function(o){return new Promise(function(a,l){o=t[s](o),i(a,l,o.done,o.value)})}}function i(s,o,a,l){Promise.resolve(l).then(function(u){s({value:u,done:a})},o)}}const tie=new TextDecoder("utf-8"),Mk=t=>tie.decode(t),nie=new TextEncoder,F6=t=>nie.encode(t),rie=t=>typeof t=="number",vN=t=>typeof t=="boolean",Mr=t=>typeof t=="function",Cs=t=>t!=null&&Object(t)===t,Rh=t=>Cs(t)&&Mr(t.then),ry=t=>Cs(t)&&Mr(t[Symbol.iterator]),B0=t=>Cs(t)&&Mr(t[Symbol.asyncIterator]),Lk=t=>Cs(t)&&Cs(t.schema),wN=t=>Cs(t)&&"done"in t&&"value"in t,xN=t=>Cs(t)&&Mr(t.stat)&&rie(t.fd),_N=t=>Cs(t)&&$6(t.body),Sx=t=>"_getDOMStream"in t&&"_getNodeStream"in t,iie=t=>Cs(t)&&Mr(t.abort)&&Mr(t.getWriter)&&!Sx(t),$6=t=>Cs(t)&&Mr(t.cancel)&&Mr(t.getReader)&&!Sx(t),sie=t=>Cs(t)&&Mr(t.end)&&Mr(t.write)&&vN(t.writable)&&!Sx(t),SN=t=>Cs(t)&&Mr(t.read)&&Mr(t.pipe)&&vN(t.readable)&&!Sx(t),oie=t=>Cs(t)&&Mr(t.clear)&&Mr(t.bytes)&&Mr(t.position)&&Mr(t.setPosition)&&Mr(t.capacity)&&Mr(t.getBufferIdentifier)&&Mr(t.createLong),M6=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function aie(t){const e=t[0]?[t[0]]:[];let n,r,i,s;for(let o,a,l=0,u=0,c=t.length;++lc+f.byteLength,0);let i,s,o,a=0,l=-1;const u=Math.min(e||Number.POSITIVE_INFINITY,r);for(const c=n.length;++lyn(Int32Array,t),lD=t=>yn(BigInt64Array,t),Lt=t=>yn(Uint8Array,t),Nk=t=>(t.next(),t);function*lie(t,e){const n=function*(i){yield i},r=typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof M6?n(e):ry(e)?e:n(e);return yield*Nk((function*(i){let s=null;do s=i.next(yield yn(t,s));while(!s.done)})(r[Symbol.iterator]())),new t}const uie=t=>lie(Uint8Array,t);function kN(t,e){return Ja(this,arguments,function*(){if(Rh(e))return yield _t(yield _t(yield*dO(dh(kN(t,yield _t(e))))));const r=function(o){return Ja(this,arguments,function*(){yield yield _t(yield _t(o))})},i=function(o){return Ja(this,arguments,function*(){yield _t(yield*dO(dh(Nk((function*(a){let l=null;do l=a.next(yield l?.value);while(!l.done)})(o[Symbol.iterator]())))))})},s=typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof M6?r(e):ry(e)?i(e):B0(e)?e:r(e);return yield _t(yield*dO(dh(Nk((function(o){return Ja(this,arguments,function*(){let a=null;do a=yield _t(o.next(yield yield _t(yn(t,a))));while(!a.done)})})(s[Symbol.asyncIterator]()))))),yield _t(new t)})}const cie=t=>kN(Uint8Array,t);function CN(t,e,n){if(t!==0){n=n.slice(0,e);for(let r=-1,i=n.length;++r0)do if(t[n]!==e[n])return!1;while(++n(t.next(),t);function*hie(t){let e,n=!1,r=[],i,s,o,a=0;function l(){return s==="peek"?xl(r,o)[0]:([i,r,a]=xl(r,o),i)}({cmd:s,size:o}=(yield null)||{cmd:"read",size:0});const u=uie(t)[Symbol.iterator]();try{do if({done:e,value:i}=Number.isNaN(o-a)?u.next():u.next(o-a),!e&&i.byteLength>0&&(r.push(i),a+=i.byteLength),e||o<=a)do({cmd:s,size:o}=yield l());while(o0&&(i.push(s),l+=s.byteLength),n||a<=l)do({cmd:o,size:a}=yield yield _t(u()));while(a0&&(i.push(Lt(s)),l+=s.byteLength),n||a<=l)do({cmd:o,size:a}=yield yield _t(u()));while(a{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(e){return dt(this,void 0,void 0,function*(){const{reader:n,source:r}=this;n&&(yield n.cancel(e).catch(()=>{})),r&&r.locked&&this.releaseLock()})}read(e){return dt(this,void 0,void 0,function*(){if(e===0)return{done:this.reader==null,value:new Uint8Array(0)};const n=yield this.reader.read();return!n.done&&(n.value=Lt(n)),n})}}const sS=(t,e)=>{const n=i=>r([e,i]);let r;return[e,n,new Promise(i=>(r=i)&&t.once(e,n))]};function gie(t){return Ja(this,arguments,function*(){const n=[];let r="error",i=!1,s=null,o,a,l=0,u=[],c;function f(){return o==="peek"?xl(u,a)[0]:([c,u,l]=xl(u,a),c)}if({cmd:o,size:a}=(yield yield _t(null))||{cmd:"read",size:0},t.isTTY)return yield yield _t(new Uint8Array(0)),yield _t(null);try{n[0]=sS(t,"end"),n[1]=sS(t,"error");do{if(n[2]=sS(t,"readable"),[r,s]=yield _t(Promise.race(n.map(d=>d[2]))),r==="error")break;if((i=r==="end")||(Number.isFinite(a-l)?(c=Lt(t.read(a-l)),c.byteLength0&&(u.push(c),l+=c.byteLength)),i||a<=l)do({cmd:o,size:a}=yield yield _t(f()));while(a{for(const[y,O]of d)t.off(y,O);try{const y=t.destroy;y&&y.call(t,p),p=void 0}catch(y){p=y||p}finally{p!=null?g(p):m()}})}})}var yr;(function(t){t[t.V1=0]="V1",t[t.V2=1]="V2",t[t.V3=2]="V3",t[t.V4=3]="V4",t[t.V5=4]="V5"})(yr||(yr={}));var Ai;(function(t){t[t.Sparse=0]="Sparse",t[t.Dense=1]="Dense"})(Ai||(Ai={}));var vi;(function(t){t[t.HALF=0]="HALF",t[t.SINGLE=1]="SINGLE",t[t.DOUBLE=2]="DOUBLE"})(vi||(vi={}));var Do;(function(t){t[t.DAY=0]="DAY",t[t.MILLISECOND=1]="MILLISECOND"})(Do||(Do={}));var et;(function(t){t[t.SECOND=0]="SECOND",t[t.MILLISECOND=1]="MILLISECOND",t[t.MICROSECOND=2]="MICROSECOND",t[t.NANOSECOND=3]="NANOSECOND"})(et||(et={}));var _l;(function(t){t[t.YEAR_MONTH=0]="YEAR_MONTH",t[t.DAY_TIME=1]="DAY_TIME",t[t.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(_l||(_l={}));const oS=2,Va=4,hu=4,pn=4,hc=new Int32Array(2),uD=new Float32Array(hc.buffer),cD=new Float64Array(hc.buffer),Hy=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Qk;(function(t){t[t.UTF8_BYTES=1]="UTF8_BYTES",t[t.UTF16_STRING=2]="UTF16_STRING"})(Qk||(Qk={}));let Wp=class AN{constructor(e){this.bytes_=e,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(e){return new AN(new Uint8Array(e))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return BigInt.asIntN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<>8}writeUint16(e,n){this.bytes_[e]=n,this.bytes_[e+1]=n>>8}writeInt32(e,n){this.bytes_[e]=n,this.bytes_[e+1]=n>>8,this.bytes_[e+2]=n>>16,this.bytes_[e+3]=n>>24}writeUint32(e,n){this.bytes_[e]=n,this.bytes_[e+1]=n>>8,this.bytes_[e+2]=n>>16,this.bytes_[e+3]=n>>24}writeInt64(e,n){this.writeInt32(e,Number(BigInt.asIntN(32,n))),this.writeInt32(e+4,Number(BigInt.asIntN(32,n>>BigInt(32))))}writeUint64(e,n){this.writeUint32(e,Number(BigInt.asUintN(32,n))),this.writeUint32(e+4,Number(BigInt.asUintN(32,n>>BigInt(32))))}writeFloat32(e,n){uD[0]=n,this.writeInt32(e,hc[0])}writeFloat64(e,n){cD[0]=n,this.writeInt32(e,hc[Hy?0:1]),this.writeInt32(e+4,hc[Hy?1:0])}getBufferIdentifier(){if(this.bytes_.lengththis.minalign&&(this.minalign=e);const r=~(this.bb.capacity()-this.space+n)+1&e-1;for(;this.space=0&&this.vtable[n]==0;n--);const r=n+1;for(;n>=0;n--)this.addInt16(this.vtable[n]!=0?e-this.vtable[n]:0);const i=2;this.addInt16(e-this.object_start);const s=(r+i)*oS;this.addInt16(s);let o=0;const a=this.space;e:for(n=0;n=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,Va+i),this.addOffset(e),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,n){this.finish(e,n,!0)}requiredField(e,n){const r=this.bb.capacity()-e,i=r-this.bb.readInt32(r);if(!(n=0;r--)e.addInt32(n[r]);return e.endVector()}static startTypeIdsVector(e,n){e.startVector(4,n,4)}static endUnion(e){return e.endObject()}static createUnion(e,n,r){return fs.startUnion(e),fs.addMode(e,n),fs.addTypeIds(e,r),fs.endUnion(e)}}let yD=class Km{constructor(){this.bb=null,this.bb_pos=0}__init(e,n){return this.bb_pos=e,this.bb=n,this}static getRootAsUtf8(e,n){return(n||new Km).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsUtf8(e,n){return e.setPosition(e.position()+pn),(n||new Km).__init(e.readInt32(e.position())+e.position(),e)}static startUtf8(e){e.startObject(0)}static endUtf8(e){return e.endObject()}static createUtf8(e){return Km.startUtf8(e),Km.endUtf8(e)}};var Fn;(function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.FloatingPoint=3]="FloatingPoint",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct_=13]="Struct_",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Duration=18]="Duration",t[t.LargeBinary=19]="LargeBinary",t[t.LargeUtf8=20]="LargeUtf8",t[t.LargeList=21]="LargeList",t[t.RunEndEncoded=22]="RunEndEncoded"})(Fn||(Fn={}));let lo=class OO{constructor(){this.bb=null,this.bb_pos=0}__init(e,n){return this.bb_pos=e,this.bb=n,this}static getRootAsField(e,n){return(n||new OO).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsField(e,n){return e.setPosition(e.position()+pn),(n||new OO).__init(e.readInt32(e.position())+e.position(),e)}name(e){const n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,e):null}nullable(){const e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}typeType(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readUint8(this.bb_pos+e):Fn.NONE}type(e){const n=this.bb.__offset(this.bb_pos,10);return n?this.bb.__union(e,this.bb_pos+n):null}dictionary(e){const n=this.bb.__offset(this.bb_pos,12);return n?(e||new du).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}children(e,n){const r=this.bb.__offset(this.bb_pos,14);return r?(n||new OO).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+e*4),this.bb):null}childrenLength(){const e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,n){const r=this.bb.__offset(this.bb_pos,16);return r?(n||new Nr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,16);return e?this.bb.__vector_len(this.bb_pos+e):0}static startField(e){e.startObject(7)}static addName(e,n){e.addFieldOffset(0,n,0)}static addNullable(e,n){e.addFieldInt8(1,+n,0)}static addTypeType(e,n){e.addFieldInt8(2,n,Fn.NONE)}static addType(e,n){e.addFieldOffset(3,n,0)}static addDictionary(e,n){e.addFieldOffset(4,n,0)}static addChildren(e,n){e.addFieldOffset(5,n,0)}static createChildrenVector(e,n){e.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)e.addOffset(n[r]);return e.endVector()}static startChildrenVector(e,n){e.startVector(4,n,4)}static addCustomMetadata(e,n){e.addFieldOffset(6,n,0)}static createCustomMetadataVector(e,n){e.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)e.addOffset(n[r]);return e.endVector()}static startCustomMetadataVector(e,n){e.startVector(4,n,4)}static endField(e){return e.endObject()}},Na=class Hl{constructor(){this.bb=null,this.bb_pos=0}__init(e,n){return this.bb_pos=e,this.bb=n,this}static getRootAsSchema(e,n){return(n||new Hl).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsSchema(e,n){return e.setPosition(e.position()+pn),(n||new Hl).__init(e.readInt32(e.position())+e.position(),e)}endianness(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):Yp.Little}fields(e,n){const r=this.bb.__offset(this.bb_pos,6);return r?(n||new lo).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+e*4),this.bb):null}fieldsLength(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,n){const r=this.bb.__offset(this.bb_pos,8);return r?(n||new Nr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}features(e){const n=this.bb.__offset(this.bb_pos,10);return n?this.bb.readInt64(this.bb.__vector(this.bb_pos+n)+e*8):BigInt(0)}featuresLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}static startSchema(e){e.startObject(4)}static addEndianness(e,n){e.addFieldInt16(0,n,Yp.Little)}static addFields(e,n){e.addFieldOffset(1,n,0)}static createFieldsVector(e,n){e.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)e.addOffset(n[r]);return e.endVector()}static startFieldsVector(e,n){e.startVector(4,n,4)}static addCustomMetadata(e,n){e.addFieldOffset(2,n,0)}static createCustomMetadataVector(e,n){e.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)e.addOffset(n[r]);return e.endVector()}static startCustomMetadataVector(e,n){e.startVector(4,n,4)}static addFeatures(e,n){e.addFieldOffset(3,n,0)}static createFeaturesVector(e,n){e.startVector(8,n.length,8);for(let r=n.length-1;r>=0;r--)e.addInt64(n[r]);return e.endVector()}static startFeaturesVector(e,n){e.startVector(8,n,8)}static endSchema(e){return e.endObject()}static finishSchemaBuffer(e,n){e.finish(n)}static finishSizePrefixedSchemaBuffer(e,n){e.finish(n,void 0,!0)}static createSchema(e,n,r,i,s){return Hl.startSchema(e),Hl.addEndianness(e,n),Hl.addFields(e,r),Hl.addCustomMetadata(e,i),Hl.addFeatures(e,s),Hl.endSchema(e)}};var Jt;(function(t){t[t.NONE=0]="NONE",t[t.Schema=1]="Schema",t[t.DictionaryBatch=2]="DictionaryBatch",t[t.RecordBatch=3]="RecordBatch",t[t.Tensor=4]="Tensor",t[t.SparseTensor=5]="SparseTensor"})(Jt||(Jt={}));var U;(function(t){t[t.NONE=0]="NONE",t[t.Null=1]="Null",t[t.Int=2]="Int",t[t.Float=3]="Float",t[t.Binary=4]="Binary",t[t.Utf8=5]="Utf8",t[t.Bool=6]="Bool",t[t.Decimal=7]="Decimal",t[t.Date=8]="Date",t[t.Time=9]="Time",t[t.Timestamp=10]="Timestamp",t[t.Interval=11]="Interval",t[t.List=12]="List",t[t.Struct=13]="Struct",t[t.Union=14]="Union",t[t.FixedSizeBinary=15]="FixedSizeBinary",t[t.FixedSizeList=16]="FixedSizeList",t[t.Map=17]="Map",t[t.Duration=18]="Duration",t[t.LargeBinary=19]="LargeBinary",t[t.LargeUtf8=20]="LargeUtf8",t[t.Dictionary=-1]="Dictionary",t[t.Int8=-2]="Int8",t[t.Int16=-3]="Int16",t[t.Int32=-4]="Int32",t[t.Int64=-5]="Int64",t[t.Uint8=-6]="Uint8",t[t.Uint16=-7]="Uint16",t[t.Uint32=-8]="Uint32",t[t.Uint64=-9]="Uint64",t[t.Float16=-10]="Float16",t[t.Float32=-11]="Float32",t[t.Float64=-12]="Float64",t[t.DateDay=-13]="DateDay",t[t.DateMillisecond=-14]="DateMillisecond",t[t.TimestampSecond=-15]="TimestampSecond",t[t.TimestampMillisecond=-16]="TimestampMillisecond",t[t.TimestampMicrosecond=-17]="TimestampMicrosecond",t[t.TimestampNanosecond=-18]="TimestampNanosecond",t[t.TimeSecond=-19]="TimeSecond",t[t.TimeMillisecond=-20]="TimeMillisecond",t[t.TimeMicrosecond=-21]="TimeMicrosecond",t[t.TimeNanosecond=-22]="TimeNanosecond",t[t.DenseUnion=-23]="DenseUnion",t[t.SparseUnion=-24]="SparseUnion",t[t.IntervalDayTime=-25]="IntervalDayTime",t[t.IntervalYearMonth=-26]="IntervalYearMonth",t[t.DurationSecond=-27]="DurationSecond",t[t.DurationMillisecond=-28]="DurationMillisecond",t[t.DurationMicrosecond=-29]="DurationMicrosecond",t[t.DurationNanosecond=-30]="DurationNanosecond"})(U||(U={}));var iu;(function(t){t[t.OFFSET=0]="OFFSET",t[t.DATA=1]="DATA",t[t.VALIDITY=2]="VALIDITY",t[t.TYPE=3]="TYPE"})(iu||(iu={}));const yie=void 0;function Wg(t){if(t===null)return"null";if(t===yie)return"undefined";switch(typeof t){case"number":return`${t}`;case"bigint":return`${t}`;case"string":return`"${t}"`}return typeof t[Symbol.toPrimitive]=="function"?t[Symbol.toPrimitive]("string"):ArrayBuffer.isView(t)?t instanceof BigInt64Array||t instanceof BigUint64Array?`[${[...t].map(e=>Wg(e))}]`:`[${t}]`:ArrayBuffer.isView(t)?`[${t}]`:JSON.stringify(t,(e,n)=>typeof n=="bigint"?`${n}`:n)}function En(t){if(typeof t=="bigint"&&(tNumber.MAX_SAFE_INTEGER))throw new TypeError(`${t} is not safe to convert to a number.`);return Number(t)}function RN(t,e){return En(t/e)+En(t%e)/En(e)}const bie=Symbol.for("isArrowBigNum");function Oa(t,...e){return e.length===0?Object.setPrototypeOf(yn(this.TypedArray,t),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(t,...e),this.constructor.prototype)}Oa.prototype[bie]=!0;Oa.prototype.toJSON=function(){return`"${Gg(this)}"`};Oa.prototype.valueOf=function(t){return IN(this,t)};Oa.prototype.toString=function(){return Gg(this)};Oa.prototype[Symbol.toPrimitive]=function(t="default"){switch(t){case"number":return IN(this);case"string":return Gg(this);case"default":return wie(this)}return Gg(this)};function dp(...t){return Oa.apply(this,t)}function pp(...t){return Oa.apply(this,t)}function Yg(...t){return Oa.apply(this,t)}Object.setPrototypeOf(dp.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(pp.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Yg.prototype,Object.create(Uint32Array.prototype));Object.assign(dp.prototype,Oa.prototype,{constructor:dp,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(pp.prototype,Oa.prototype,{constructor:pp,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Yg.prototype,Oa.prototype,{constructor:Yg,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const Oie=BigInt(4294967296)*BigInt(4294967296),vie=Oie-BigInt(1);function IN(t,e){const{buffer:n,byteOffset:r,byteLength:i,signed:s}=t,o=new BigUint64Array(n,r,i/8),a=s&&o.at(-1)&BigInt(1)<=0)return aS(t);e=e.slice();let r=1;for(let s=0;s(t.children=null,t.ArrayType=Array,t.OffsetArrayType=Int32Array,t[Symbol.toStringTag]="DataType"))(Ue.prototype);let Wc=class extends Ue{constructor(){super(U.Null)}toString(){return"Null"}};$N=Symbol.toStringTag;Wc[$N]=(t=>t[Symbol.toStringTag]="Null")(Wc.prototype);class Ih extends Ue{constructor(e,n){super(U.Int),this.isSigned=e,this.bitWidth=n}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}MN=Symbol.toStringTag;Ih[MN]=(t=>(t.isSigned=null,t.bitWidth=null,t[Symbol.toStringTag]="Int"))(Ih.prototype);class Hg extends Ih{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(Hg.prototype,"ArrayType",{value:Int32Array});class Iv extends Ue{constructor(e){super(U.Float),this.precision=e}get ArrayType(){switch(this.precision){case vi.HALF:return Uint16Array;case vi.SINGLE:return Float32Array;case vi.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}LN=Symbol.toStringTag;Iv[LN]=(t=>(t.precision=null,t[Symbol.toStringTag]="Float"))(Iv.prototype);class Fv extends Ue{constructor(){super(U.Binary)}toString(){return"Binary"}}NN=Symbol.toStringTag;Fv[NN]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Binary"))(Fv.prototype);class $v extends Ue{constructor(){super(U.LargeBinary)}toString(){return"LargeBinary"}}QN=Symbol.toStringTag;$v[QN]=(t=>(t.ArrayType=Uint8Array,t.OffsetArrayType=BigInt64Array,t[Symbol.toStringTag]="LargeBinary"))($v.prototype);class Mv extends Ue{constructor(){super(U.Utf8)}toString(){return"Utf8"}}BN=Symbol.toStringTag;Mv[BN]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Utf8"))(Mv.prototype);class Lv extends Ue{constructor(){super(U.LargeUtf8)}toString(){return"LargeUtf8"}}zN=Symbol.toStringTag;Lv[zN]=(t=>(t.ArrayType=Uint8Array,t.OffsetArrayType=BigInt64Array,t[Symbol.toStringTag]="LargeUtf8"))(Lv.prototype);let Nv=class extends Ue{constructor(){super(U.Bool)}toString(){return"Bool"}};UN=Symbol.toStringTag;Nv[UN]=(t=>(t.ArrayType=Uint8Array,t[Symbol.toStringTag]="Bool"))(Nv.prototype);class Qv extends Ue{constructor(e,n,r=128){super(U.Decimal),this.scale=e,this.precision=n,this.bitWidth=r}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}jN=Symbol.toStringTag;Qv[jN]=(t=>(t.scale=null,t.precision=null,t.ArrayType=Uint32Array,t[Symbol.toStringTag]="Decimal"))(Qv.prototype);class Bv extends Ue{constructor(e){super(U.Date),this.unit=e}toString(){return`Date${(this.unit+1)*32}<${Do[this.unit]}>`}get ArrayType(){return this.unit===Do.DAY?Int32Array:BigInt64Array}}qN=Symbol.toStringTag;Bv[qN]=(t=>(t.unit=null,t[Symbol.toStringTag]="Date"))(Bv.prototype);class zv extends Ue{constructor(e,n){super(U.Time),this.unit=e,this.bitWidth=n}toString(){return`Time${this.bitWidth}<${et[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}VN=Symbol.toStringTag;zv[VN]=(t=>(t.unit=null,t.bitWidth=null,t[Symbol.toStringTag]="Time"))(zv.prototype);class Uv extends Ue{constructor(e,n){super(U.Timestamp),this.unit=e,this.timezone=n}toString(){return`Timestamp<${et[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}ZN=Symbol.toStringTag;Uv[ZN]=(t=>(t.unit=null,t.timezone=null,t.ArrayType=BigInt64Array,t[Symbol.toStringTag]="Timestamp"))(Uv.prototype);class jv extends Ue{constructor(e){super(U.Interval),this.unit=e}toString(){return`Interval<${_l[this.unit]}>`}}XN=Symbol.toStringTag;jv[XN]=(t=>(t.unit=null,t.ArrayType=Int32Array,t[Symbol.toStringTag]="Interval"))(jv.prototype);class qv extends Ue{constructor(e){super(U.Duration),this.unit=e}toString(){return`Duration<${et[this.unit]}>`}}WN=Symbol.toStringTag;qv[WN]=(t=>(t.unit=null,t.ArrayType=BigInt64Array,t[Symbol.toStringTag]="Duration"))(qv.prototype);class Vv extends Ue{constructor(e){super(U.List),this.children=[e]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}YN=Symbol.toStringTag;Vv[YN]=(t=>(t.children=null,t[Symbol.toStringTag]="List"))(Vv.prototype);class qi extends Ue{constructor(e){super(U.Struct),this.children=e}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}}GN=Symbol.toStringTag;qi[GN]=(t=>(t.children=null,t[Symbol.toStringTag]="Struct"))(qi.prototype);class Zv extends Ue{constructor(e,n,r){super(U.Union),this.mode=e,this.children=r,this.typeIds=n=Int32Array.from(n),this.typeIdToChildIndex=n.reduce((i,s,o)=>(i[s]=o)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(e=>`${e.type}`).join(" | ")}>`}}HN=Symbol.toStringTag;Zv[HN]=(t=>(t.mode=null,t.typeIds=null,t.children=null,t.typeIdToChildIndex=null,t.ArrayType=Int8Array,t[Symbol.toStringTag]="Union"))(Zv.prototype);class Xv extends Ue{constructor(e){super(U.FixedSizeBinary),this.byteWidth=e}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}KN=Symbol.toStringTag;Xv[KN]=(t=>(t.byteWidth=null,t.ArrayType=Uint8Array,t[Symbol.toStringTag]="FixedSizeBinary"))(Xv.prototype);class Wv extends Ue{constructor(e,n){super(U.FixedSizeList),this.listSize=e,this.children=[n]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}JN=Symbol.toStringTag;Wv[JN]=(t=>(t.children=null,t.listSize=null,t[Symbol.toStringTag]="FixedSizeList"))(Wv.prototype);class Yv extends Ue{constructor(e,n=!1){var r,i,s;if(super(U.Map),this.children=[e],this.keysSorted=n,e&&(e.name="entries",!((r=e?.type)===null||r===void 0)&&r.children)){const o=(i=e?.type)===null||i===void 0?void 0:i.children[0];o&&(o.name="key");const a=(s=e?.type)===null||s===void 0?void 0:s.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}}eQ=Symbol.toStringTag;Yv[eQ]=(t=>(t.children=null,t.keysSorted=null,t[Symbol.toStringTag]="Map_"))(Yv.prototype);const xie=(t=>()=>++t)(-1);class Gp extends Ue{constructor(e,n,r,i){super(U.Dictionary),this.indices=n,this.dictionary=e,this.isOrdered=i||!1,this.id=r==null?xie():En(r)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}tQ=Symbol.toStringTag;Gp[tQ]=(t=>(t.id=null,t.indices=null,t.isOrdered=null,t.dictionary=null,t[Symbol.toStringTag]="Dictionary"))(Gp.prototype);function su(t){const e=t;switch(t.typeId){case U.Decimal:return t.bitWidth/32;case U.Interval:return 1+e.unit;case U.FixedSizeList:return e.listSize;case U.FixedSizeBinary:return e.byteWidth;default:return 1}}class Et{visitMany(e,...n){return e.map((r,i)=>this.visit(r,...n.map(s=>s[i])))}visit(...e){return this.getVisitFn(e[0],!1).apply(this,e)}getVisitFn(e,n=!0){return _ie(this,e,n)}getVisitFnByTypeId(e,n=!0){return Qd(this,e,n)}visitNull(e,...n){return null}visitBool(e,...n){return null}visitInt(e,...n){return null}visitFloat(e,...n){return null}visitUtf8(e,...n){return null}visitLargeUtf8(e,...n){return null}visitBinary(e,...n){return null}visitLargeBinary(e,...n){return null}visitFixedSizeBinary(e,...n){return null}visitDate(e,...n){return null}visitTimestamp(e,...n){return null}visitTime(e,...n){return null}visitDecimal(e,...n){return null}visitList(e,...n){return null}visitStruct(e,...n){return null}visitUnion(e,...n){return null}visitDictionary(e,...n){return null}visitInterval(e,...n){return null}visitDuration(e,...n){return null}visitFixedSizeList(e,...n){return null}visitMap(e,...n){return null}}function _ie(t,e,n=!0){return typeof e=="number"?Qd(t,e,n):typeof e=="string"&&e in U?Qd(t,U[e],n):e&&e instanceof Ue?Qd(t,bD(e),n):e?.type&&e.type instanceof Ue?Qd(t,bD(e.type),n):Qd(t,U.NONE,n)}function Qd(t,e,n=!0){let r=null;switch(e){case U.Null:r=t.visitNull;break;case U.Bool:r=t.visitBool;break;case U.Int:r=t.visitInt;break;case U.Int8:r=t.visitInt8||t.visitInt;break;case U.Int16:r=t.visitInt16||t.visitInt;break;case U.Int32:r=t.visitInt32||t.visitInt;break;case U.Int64:r=t.visitInt64||t.visitInt;break;case U.Uint8:r=t.visitUint8||t.visitInt;break;case U.Uint16:r=t.visitUint16||t.visitInt;break;case U.Uint32:r=t.visitUint32||t.visitInt;break;case U.Uint64:r=t.visitUint64||t.visitInt;break;case U.Float:r=t.visitFloat;break;case U.Float16:r=t.visitFloat16||t.visitFloat;break;case U.Float32:r=t.visitFloat32||t.visitFloat;break;case U.Float64:r=t.visitFloat64||t.visitFloat;break;case U.Utf8:r=t.visitUtf8;break;case U.LargeUtf8:r=t.visitLargeUtf8;break;case U.Binary:r=t.visitBinary;break;case U.LargeBinary:r=t.visitLargeBinary;break;case U.FixedSizeBinary:r=t.visitFixedSizeBinary;break;case U.Date:r=t.visitDate;break;case U.DateDay:r=t.visitDateDay||t.visitDate;break;case U.DateMillisecond:r=t.visitDateMillisecond||t.visitDate;break;case U.Timestamp:r=t.visitTimestamp;break;case U.TimestampSecond:r=t.visitTimestampSecond||t.visitTimestamp;break;case U.TimestampMillisecond:r=t.visitTimestampMillisecond||t.visitTimestamp;break;case U.TimestampMicrosecond:r=t.visitTimestampMicrosecond||t.visitTimestamp;break;case U.TimestampNanosecond:r=t.visitTimestampNanosecond||t.visitTimestamp;break;case U.Time:r=t.visitTime;break;case U.TimeSecond:r=t.visitTimeSecond||t.visitTime;break;case U.TimeMillisecond:r=t.visitTimeMillisecond||t.visitTime;break;case U.TimeMicrosecond:r=t.visitTimeMicrosecond||t.visitTime;break;case U.TimeNanosecond:r=t.visitTimeNanosecond||t.visitTime;break;case U.Decimal:r=t.visitDecimal;break;case U.List:r=t.visitList;break;case U.Struct:r=t.visitStruct;break;case U.Union:r=t.visitUnion;break;case U.DenseUnion:r=t.visitDenseUnion||t.visitUnion;break;case U.SparseUnion:r=t.visitSparseUnion||t.visitUnion;break;case U.Dictionary:r=t.visitDictionary;break;case U.Interval:r=t.visitInterval;break;case U.IntervalDayTime:r=t.visitIntervalDayTime||t.visitInterval;break;case U.IntervalYearMonth:r=t.visitIntervalYearMonth||t.visitInterval;break;case U.Duration:r=t.visitDuration;break;case U.DurationSecond:r=t.visitDurationSecond||t.visitDuration;break;case U.DurationMillisecond:r=t.visitDurationMillisecond||t.visitDuration;break;case U.DurationMicrosecond:r=t.visitDurationMicrosecond||t.visitDuration;break;case U.DurationNanosecond:r=t.visitDurationNanosecond||t.visitDuration;break;case U.FixedSizeList:r=t.visitFixedSizeList;break;case U.Map:r=t.visitMap;break}if(typeof r=="function")return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${U[e]}'`)}function bD(t){switch(t.typeId){case U.Null:return U.Null;case U.Int:{const{bitWidth:e,isSigned:n}=t;switch(e){case 8:return n?U.Int8:U.Uint8;case 16:return n?U.Int16:U.Uint16;case 32:return n?U.Int32:U.Uint32;case 64:return n?U.Int64:U.Uint64}return U.Int}case U.Float:switch(t.precision){case vi.HALF:return U.Float16;case vi.SINGLE:return U.Float32;case vi.DOUBLE:return U.Float64}return U.Float;case U.Binary:return U.Binary;case U.LargeBinary:return U.LargeBinary;case U.Utf8:return U.Utf8;case U.LargeUtf8:return U.LargeUtf8;case U.Bool:return U.Bool;case U.Decimal:return U.Decimal;case U.Time:switch(t.unit){case et.SECOND:return U.TimeSecond;case et.MILLISECOND:return U.TimeMillisecond;case et.MICROSECOND:return U.TimeMicrosecond;case et.NANOSECOND:return U.TimeNanosecond}return U.Time;case U.Timestamp:switch(t.unit){case et.SECOND:return U.TimestampSecond;case et.MILLISECOND:return U.TimestampMillisecond;case et.MICROSECOND:return U.TimestampMicrosecond;case et.NANOSECOND:return U.TimestampNanosecond}return U.Timestamp;case U.Date:switch(t.unit){case Do.DAY:return U.DateDay;case Do.MILLISECOND:return U.DateMillisecond}return U.Date;case U.Interval:switch(t.unit){case _l.DAY_TIME:return U.IntervalDayTime;case _l.YEAR_MONTH:return U.IntervalYearMonth}return U.Interval;case U.Duration:switch(t.unit){case et.SECOND:return U.DurationSecond;case et.MILLISECOND:return U.DurationMillisecond;case et.MICROSECOND:return U.DurationMicrosecond;case et.NANOSECOND:return U.DurationNanosecond}return U.Duration;case U.Map:return U.Map;case U.List:return U.List;case U.Struct:return U.Struct;case U.Union:switch(t.mode){case Ai.Dense:return U.DenseUnion;case Ai.Sparse:return U.SparseUnion}return U.Union;case U.FixedSizeBinary:return U.FixedSizeBinary;case U.FixedSizeList:return U.FixedSizeList;case U.Dictionary:return U.Dictionary}throw new Error(`Unrecognized type '${U[t.typeId]}'`)}Et.prototype.visitInt8=null;Et.prototype.visitInt16=null;Et.prototype.visitInt32=null;Et.prototype.visitInt64=null;Et.prototype.visitUint8=null;Et.prototype.visitUint16=null;Et.prototype.visitUint32=null;Et.prototype.visitUint64=null;Et.prototype.visitFloat16=null;Et.prototype.visitFloat32=null;Et.prototype.visitFloat64=null;Et.prototype.visitDateDay=null;Et.prototype.visitDateMillisecond=null;Et.prototype.visitTimestampSecond=null;Et.prototype.visitTimestampMillisecond=null;Et.prototype.visitTimestampMicrosecond=null;Et.prototype.visitTimestampNanosecond=null;Et.prototype.visitTimeSecond=null;Et.prototype.visitTimeMillisecond=null;Et.prototype.visitTimeMicrosecond=null;Et.prototype.visitTimeNanosecond=null;Et.prototype.visitDenseUnion=null;Et.prototype.visitSparseUnion=null;Et.prototype.visitIntervalDayTime=null;Et.prototype.visitIntervalYearMonth=null;Et.prototype.visitDuration=null;Et.prototype.visitDurationSecond=null;Et.prototype.visitDurationMillisecond=null;Et.prototype.visitDurationMicrosecond=null;Et.prototype.visitDurationNanosecond=null;const nQ=new Float64Array(1),wd=new Uint32Array(nQ.buffer);function rQ(t){const e=(t&31744)>>10,n=(t&1023)/1024,r=Math.pow(-1,(t&32768)>>15);switch(e){case 31:return r*(n?Number.NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*Math.pow(2,e-15)*(1+n)}function Sie(t){if(t!==t)return 32256;nQ[0]=t;const e=(wd[1]&2147483648)>>16&65535;let n=wd[1]&2146435072,r=0;return n>=1089470464?wd[0]>0?n=31744:(n=(n&2080374784)>>16,r=(wd[1]&1048575)>>10):n<=1056964608?(r=1048576+(wd[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(wd[1]&1048575)+512>>10),e|n|r&65535}class tt extends Et{}function at(t){return(e,n,r)=>{if(e.setValid(n,r!=null))return t(e,n,r)}}const kie=(t,e,n)=>{t[e]=Math.floor(n/864e5)},iQ=(t,e,n,r)=>{if(n+1{const i=t+n;r?e[i>>3]|=1<>3]&=~(1<{t[e]=n},N6=({values:t},e,n)=>{t[e]=n},sQ=({values:t},e,n)=>{t[e]=Sie(n)},Aie=(t,e,n)=>{switch(t.type.precision){case vi.HALF:return sQ(t,e,n);case vi.SINGLE:case vi.DOUBLE:return N6(t,e,n)}},oQ=({values:t},e,n)=>{kie(t,e,n.valueOf())},aQ=({values:t},e,n)=>{t[e]=BigInt(n)},Eie=({stride:t,values:e},n,r)=>{e.set(r.subarray(0,t),t*n)},lQ=({values:t,valueOffsets:e},n,r)=>iQ(t,e,n,r),uQ=({values:t,valueOffsets:e},n,r)=>iQ(t,e,n,F6(r)),Tie=(t,e,n)=>{t.type.unit===Do.DAY?oQ(t,e,n):aQ(t,e,n)},cQ=({values:t},e,n)=>{t[e]=BigInt(n/1e3)},fQ=({values:t},e,n)=>{t[e]=BigInt(n)},hQ=({values:t},e,n)=>{t[e]=BigInt(n*1e3)},dQ=({values:t},e,n)=>{t[e]=BigInt(n*1e6)},Die=(t,e,n)=>{switch(t.type.unit){case et.SECOND:return cQ(t,e,n);case et.MILLISECOND:return fQ(t,e,n);case et.MICROSECOND:return hQ(t,e,n);case et.NANOSECOND:return dQ(t,e,n)}},pQ=({values:t},e,n)=>{t[e]=n},mQ=({values:t},e,n)=>{t[e]=n},gQ=({values:t},e,n)=>{t[e]=n},yQ=({values:t},e,n)=>{t[e]=n},Pie=(t,e,n)=>{switch(t.type.unit){case et.SECOND:return pQ(t,e,n);case et.MILLISECOND:return mQ(t,e,n);case et.MICROSECOND:return gQ(t,e,n);case et.NANOSECOND:return yQ(t,e,n)}},Rie=({values:t,stride:e},n,r)=>{t.set(r.subarray(0,e),e*n)},Iie=(t,e,n)=>{const r=t.children[0],i=t.valueOffsets,s=Po.getVisitFn(r);if(Array.isArray(n))for(let o=-1,a=i[e],l=i[e+1];a{const r=t.children[0],{valueOffsets:i}=t,s=Po.getVisitFn(r);let{[e]:o,[e+1]:a}=i;const l=n instanceof Map?n.entries():Object.entries(n);for(const u of l)if(s(r,o,u),++o>=a)break},$ie=(t,e)=>(n,r,i,s)=>r&&n(r,t,e[s]),Mie=(t,e)=>(n,r,i,s)=>r&&n(r,t,e.get(s)),Lie=(t,e)=>(n,r,i,s)=>r&&n(r,t,e.get(i.name)),Nie=(t,e)=>(n,r,i,s)=>r&&n(r,t,e[i.name]),Qie=(t,e,n)=>{const r=t.type.children.map(s=>Po.getVisitFn(s.type)),i=n instanceof Map?Lie(e,n):n instanceof cn?Mie(e,n):Array.isArray(n)?$ie(e,n):Nie(e,n);t.type.children.forEach((s,o)=>i(r[o],t.children[o],s,o))},Bie=(t,e,n)=>{t.type.mode===Ai.Dense?bQ(t,e,n):OQ(t,e,n)},bQ=(t,e,n)=>{const r=t.type.typeIdToChildIndex[t.typeIds[e]],i=t.children[r];Po.visit(i,t.valueOffsets[e],n)},OQ=(t,e,n)=>{const r=t.type.typeIdToChildIndex[t.typeIds[e]],i=t.children[r];Po.visit(i,e,n)},zie=(t,e,n)=>{var r;(r=t.dictionary)===null||r===void 0||r.set(t.values[e],n)},Uie=(t,e,n)=>{t.type.unit===_l.DAY_TIME?vQ(t,e,n):wQ(t,e,n)},vQ=({values:t},e,n)=>{t.set(n.subarray(0,2),2*e)},wQ=({values:t},e,n)=>{t[e]=n[0]*12+n[1]%12},xQ=({values:t},e,n)=>{t[e]=n},_Q=({values:t},e,n)=>{t[e]=n},SQ=({values:t},e,n)=>{t[e]=n},kQ=({values:t},e,n)=>{t[e]=n},jie=(t,e,n)=>{switch(t.type.unit){case et.SECOND:return xQ(t,e,n);case et.MILLISECOND:return _Q(t,e,n);case et.MICROSECOND:return SQ(t,e,n);case et.NANOSECOND:return kQ(t,e,n)}},qie=(t,e,n)=>{const{stride:r}=t,i=t.children[0],s=Po.getVisitFn(i);if(Array.isArray(n))for(let o=-1,a=e*r;++o`${Wg(e)}: ${Wg(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Vie(this[Yo],this[mp])}}class Vie{constructor(e,n){this.childIndex=0,this.children=e.children,this.rowIndex=n,this.childFields=e.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const e=this.childIndex;return en.name)}has(e,n){return e[Yo].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(e,n){if(e[Yo].type.children.findIndex(r=>r.name===n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,n){if(Reflect.has(e,n))return e[n];const r=e[Yo].type.children.findIndex(i=>i.name===n);if(r!==-1){const i=As.visit(e[Yo].children[r],e[mp]);return Reflect.set(e,n,i),i}}set(e,n,r){const i=e[Yo].type.children.findIndex(s=>s.name===n);return i!==-1?(Po.visit(e[Yo].children[i],e[mp],r),Reflect.set(e,n,r)):Reflect.has(e,n)||typeof n=="symbol"?Reflect.set(e,n,r):!1}}class Ye extends Et{}function nt(t){return(e,n)=>e.getValid(n)?t(e,n):null}const Xie=(t,e)=>864e5*t[e],Wie=(t,e)=>null,CQ=(t,e,n)=>{if(n+1>=e.length)return null;const r=En(e[n]),i=En(e[n+1]);return t.subarray(r,i)},Yie=({offset:t,values:e},n)=>{const r=t+n;return(e[r>>3]&1<Xie(t,e),EQ=({values:t},e)=>En(t[e]),df=({stride:t,values:e},n)=>e[t*n],Gie=({stride:t,values:e},n)=>rQ(e[t*n]),TQ=({values:t},e)=>t[e],Hie=({stride:t,values:e},n)=>e.subarray(t*n,t*(n+1)),DQ=({values:t,valueOffsets:e},n)=>CQ(t,e,n),PQ=({values:t,valueOffsets:e},n)=>{const r=CQ(t,e,n);return r!==null?Mk(r):null},Kie=({values:t},e)=>t[e],Jie=({type:t,values:e},n)=>t.precision!==vi.HALF?e[n]:rQ(e[n]),ese=(t,e)=>t.type.unit===Do.DAY?AQ(t,e):EQ(t,e),RQ=({values:t},e)=>1e3*En(t[e]),IQ=({values:t},e)=>En(t[e]),FQ=({values:t},e)=>RN(t[e],BigInt(1e3)),$Q=({values:t},e)=>RN(t[e],BigInt(1e6)),tse=(t,e)=>{switch(t.type.unit){case et.SECOND:return RQ(t,e);case et.MILLISECOND:return IQ(t,e);case et.MICROSECOND:return FQ(t,e);case et.NANOSECOND:return $Q(t,e)}},MQ=({values:t},e)=>t[e],LQ=({values:t},e)=>t[e],NQ=({values:t},e)=>t[e],QQ=({values:t},e)=>t[e],nse=(t,e)=>{switch(t.type.unit){case et.SECOND:return MQ(t,e);case et.MILLISECOND:return LQ(t,e);case et.MICROSECOND:return NQ(t,e);case et.NANOSECOND:return QQ(t,e)}},rse=({values:t,stride:e},n)=>L6.decimal(t.subarray(e*n,e*(n+1))),ise=(t,e)=>{const{valueOffsets:n,stride:r,children:i}=t,{[e*r]:s,[e*r+1]:o}=n,l=i[0].slice(s,o-s);return new cn([l])},sse=(t,e)=>{const{valueOffsets:n,children:r}=t,{[e]:i,[e+1]:s}=n,o=r[0];return new B6(o.slice(i,s-i))},ose=(t,e)=>new Q6(t,e),ase=(t,e)=>t.type.mode===Ai.Dense?BQ(t,e):zQ(t,e),BQ=(t,e)=>{const n=t.type.typeIdToChildIndex[t.typeIds[e]],r=t.children[n];return As.visit(r,t.valueOffsets[e])},zQ=(t,e)=>{const n=t.type.typeIdToChildIndex[t.typeIds[e]],r=t.children[n];return As.visit(r,e)},lse=(t,e)=>{var n;return(n=t.dictionary)===null||n===void 0?void 0:n.get(t.values[e])},use=(t,e)=>t.type.unit===_l.DAY_TIME?UQ(t,e):jQ(t,e),UQ=({values:t},e)=>t.subarray(2*e,2*(e+1)),jQ=({values:t},e)=>{const n=t[e],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r},qQ=({values:t},e)=>t[e],VQ=({values:t},e)=>t[e],ZQ=({values:t},e)=>t[e],XQ=({values:t},e)=>t[e],cse=(t,e)=>{switch(t.type.unit){case et.SECOND:return qQ(t,e);case et.MILLISECOND:return VQ(t,e);case et.MICROSECOND:return ZQ(t,e);case et.NANOSECOND:return XQ(t,e)}},fse=(t,e)=>{const{stride:n,children:r}=t,s=r[0].slice(e*n,n);return new cn([s])};Ye.prototype.visitNull=nt(Wie);Ye.prototype.visitBool=nt(Yie);Ye.prototype.visitInt=nt(Kie);Ye.prototype.visitInt8=nt(df);Ye.prototype.visitInt16=nt(df);Ye.prototype.visitInt32=nt(df);Ye.prototype.visitInt64=nt(TQ);Ye.prototype.visitUint8=nt(df);Ye.prototype.visitUint16=nt(df);Ye.prototype.visitUint32=nt(df);Ye.prototype.visitUint64=nt(TQ);Ye.prototype.visitFloat=nt(Jie);Ye.prototype.visitFloat16=nt(Gie);Ye.prototype.visitFloat32=nt(df);Ye.prototype.visitFloat64=nt(df);Ye.prototype.visitUtf8=nt(PQ);Ye.prototype.visitLargeUtf8=nt(PQ);Ye.prototype.visitBinary=nt(DQ);Ye.prototype.visitLargeBinary=nt(DQ);Ye.prototype.visitFixedSizeBinary=nt(Hie);Ye.prototype.visitDate=nt(ese);Ye.prototype.visitDateDay=nt(AQ);Ye.prototype.visitDateMillisecond=nt(EQ);Ye.prototype.visitTimestamp=nt(tse);Ye.prototype.visitTimestampSecond=nt(RQ);Ye.prototype.visitTimestampMillisecond=nt(IQ);Ye.prototype.visitTimestampMicrosecond=nt(FQ);Ye.prototype.visitTimestampNanosecond=nt($Q);Ye.prototype.visitTime=nt(nse);Ye.prototype.visitTimeSecond=nt(MQ);Ye.prototype.visitTimeMillisecond=nt(LQ);Ye.prototype.visitTimeMicrosecond=nt(NQ);Ye.prototype.visitTimeNanosecond=nt(QQ);Ye.prototype.visitDecimal=nt(rse);Ye.prototype.visitList=nt(ise);Ye.prototype.visitStruct=nt(ose);Ye.prototype.visitUnion=nt(ase);Ye.prototype.visitDenseUnion=nt(BQ);Ye.prototype.visitSparseUnion=nt(zQ);Ye.prototype.visitDictionary=nt(lse);Ye.prototype.visitInterval=nt(use);Ye.prototype.visitIntervalDayTime=nt(UQ);Ye.prototype.visitIntervalYearMonth=nt(jQ);Ye.prototype.visitDuration=nt(cse);Ye.prototype.visitDurationSecond=nt(qQ);Ye.prototype.visitDurationMillisecond=nt(VQ);Ye.prototype.visitDurationMicrosecond=nt(ZQ);Ye.prototype.visitDurationNanosecond=nt(XQ);Ye.prototype.visitFixedSizeList=nt(fse);Ye.prototype.visitMap=nt(sse);const As=new Ye,Bd=Symbol.for("keys"),gp=Symbol.for("vals"),zd=Symbol.for("kKeysAsStrings"),Uk=Symbol.for("_kKeysAsStrings");class B6{constructor(e){return this[Bd]=new cn([e.children[0]]).memoize(),this[gp]=e.children[1],new Proxy(this,new dse)}get[zd](){return this[Uk]||(this[Uk]=Array.from(this[Bd].toArray(),String))}[Symbol.iterator](){return new hse(this[Bd],this[gp])}get size(){return this[Bd].length}toArray(){return Object.values(this.toJSON())}toJSON(){const e=this[Bd],n=this[gp],r={};for(let i=-1,s=e.length;++i`${Wg(e)}: ${Wg(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class hse{constructor(e,n){this.keys=e,this.vals=n,this.keyIndex=0,this.numKeys=e.length}[Symbol.iterator](){return this}next(){const e=this.keyIndex;return e===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(e),As.visit(this.vals,e)]})}}class dse{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[zd]}has(e,n){return e[zd].includes(n)}getOwnPropertyDescriptor(e,n){if(e[zd].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,n){if(Reflect.has(e,n))return e[n];const r=e[zd].indexOf(n);if(r!==-1){const i=As.visit(Reflect.get(e,gp),r);return Reflect.set(e,n,i),i}}set(e,n,r){const i=e[zd].indexOf(n);return i!==-1?(Po.visit(Reflect.get(e,gp),i,r),Reflect.set(e,n,r)):Reflect.has(e,n)?Reflect.set(e,n,r):!1}}Object.defineProperties(B6.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Bd]:{writable:!0,enumerable:!1,configurable:!1,value:null},[gp]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Uk]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let OD;function WQ(t,e,n,r){const{length:i=0}=t;let s=typeof e!="number"?0:e,o=typeof n!="number"?i:n;return s<0&&(s=(s%i+i)%i),o<0&&(o=(o%i+i)%i),oi&&(o=i),r?r(t,s,o):[s,o]}const z6=(t,e)=>t<0?e+t:t,vD=t=>t!==t;function z0(t){if(typeof t!=="object"||t===null)return vD(t)?vD:n=>n===t;if(t instanceof Date){const n=t.valueOf();return r=>r instanceof Date?r.valueOf()===n:!1}return ArrayBuffer.isView(t)?n=>n?fie(t,n):!1:t instanceof Map?mse(t):Array.isArray(t)?pse(t):t instanceof cn?gse(t):yse(t,!0)}function pse(t){const e=[];for(let n=-1,r=t.length;++n!1;const r=[];for(let i=-1,s=n.length;++i{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return bse(t,n);case Map:return wD(t,n,n.keys());case B6:case Q6:case Object:case void 0:return wD(t,n,e||Object.keys(n))}return n instanceof cn?Ose(t,n):!1}}function bse(t,e){const n=t.length;if(e.length!==n)return!1;for(let r=-1;++r>r}function Gv(t,e,n){const r=n.byteLength+7&-8;if(t>0||n.byteLength>3):Hv(new U6(n,t,e,null,YQ)).subarray(0,r)),i}return n}function Hv(t){const e=[];let n=0,r=0,i=0;for(const o of t)o&&(i|=1<0)&&(e[n++]=i);const s=new Uint8Array(e.length+7&-8);return s.set(e),s}class U6{constructor(e,n,r,i,s){this.bytes=e,this.length=r,this.context=i,this.get=s,this.bit=n%8,this.byteIndex=n>>3,this.byte=e[this.byteIndex++],this.index=0}next(){return this.index>3<<3,i=e+(e%8===0?0:8-e%8);return jk(t,e,i)+jk(t,r,n)+wse(t,i>>3,r-i>>3)}function wse(t,e,n){let r=0,i=Math.trunc(e);const s=new DataView(t.buffer,t.byteOffset,t.byteLength),o=n===void 0?t.byteLength:i+n;for(;o-i>=4;)r+=lS(s.getUint32(i)),i+=4;for(;o-i>=2;)r+=lS(s.getUint16(i)),i+=2;for(;o-i>=1;)r+=lS(s.getUint8(i)),i+=1;return r}function lS(t){let e=Math.trunc(t);return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24}const xse=-1;class mn{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){const{type:e}=this;return Ue.isSparseUnion(e)?this.children.some(n=>n.nullable):Ue.isDenseUnion(e)?this.children.some(n=>n.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let e=0;const{valueOffsets:n,values:r,nullBitmap:i,typeIds:s}=this;return n&&(e+=n.byteLength),r&&(e+=r.byteLength),i&&(e+=i.byteLength),s&&(e+=s.byteLength),this.children.reduce((o,a)=>o+a.byteLength,e)}get nullCount(){if(Ue.isUnion(this.type))return this.children.reduce((r,i)=>r+i.nullCount,0);let e=this._nullCount,n;return e<=xse&&(n=this.nullBitmap)&&(this._nullCount=e=n.length===0?0:this.length-jk(n,this.offset,this.offset+this.length)),e}constructor(e,n,r,i,s,o=[],a){this.type=e,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let l;s instanceof mn?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=su(e),s&&((l=s[0])&&(this.valueOffsets=l),(l=s[1])&&(this.values=l),(l=s[2])&&(this.nullBitmap=l),(l=s[3])&&(this.typeIds=l)))}getValid(e){const{type:n}=this;if(Ue.isUnion(n)){const r=n,i=this.children[r.typeIdToChildIndex[this.typeIds[e]]],s=r.mode===Ai.Dense?this.valueOffsets[e]:e;return i.getValid(s)}if(this.nullable&&this.nullCount>0){const r=this.offset+e;return(this.nullBitmap[r>>3]&1<>3;(!s||s.byteLength<=c)&&(s=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0?(s.set(Gv(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:s})):Object.assign(this,{nullBitmap:s,_nullCount:0}));const f=s[c];r=(f&u)!==0,s[c]=n?f|u:f&~u}return r!==!!n&&(this._nullCount=this.nullCount+(n?-1:1)),n}clone(e=this.type,n=this.offset,r=this.length,i=this._nullCount,s=this,o=this.children){return new mn(e,n,r,i,s,o,this.dictionary)}slice(e,n){const{stride:r,typeId:i,children:s}=this,o=+(this._nullCount===0)-1,a=i===16?r:1,l=this._sliceBuffers(e,n,r,i);return this.clone(this.type,this.offset+e,n,o,l,s.length===0||this.valueOffsets?s:this._sliceChildren(s,a*e,a*n))}_changeLengthAndBackfillNullBitmap(e){if(this.typeId===U.Null)return this.clone(this.type,0,e,0);const{length:n,nullCount:r}=this,i=new Uint8Array((e+63&-64)>>3).fill(255,0,n>>3);i[n>>3]=(1<0&&i.set(Gv(this.offset,n,this.nullBitmap),0);const s=this.buffers;return s[iu.VALIDITY]=i,this.clone(this.type,0,e,r+(e-n),s)}_sliceBuffers(e,n,r,i){let s;const{buffers:o}=this;return(s=o[iu.TYPE])&&(o[iu.TYPE]=s.subarray(e,e+n)),(s=o[iu.OFFSET])&&(o[iu.OFFSET]=s.subarray(e,e+n+1))||(s=o[iu.DATA])&&(o[iu.DATA]=i===6?s:s.subarray(r*e,r*(e+n))),o}_sliceChildren(e,n,r){return e.map(i=>i.slice(n,r))}}mn.prototype.children=Object.freeze([]);class vg extends Et{visit(e){return this.getVisitFn(e.type).call(this,e)}visitNull(e){const{["type"]:n,["offset"]:r=0,["length"]:i=0}=e;return new mn(n,r,i,i)}visitBool(e){const{["type"]:n,["offset"]:r=0}=e,i=Lt(e.nullBitmap),s=yn(n.ArrayType,e.data),{["length"]:o=s.length>>3,["nullCount"]:a=e.nullBitmap?-1:0}=e;return new mn(n,r,o,a,[void 0,s,i])}visitInt(e){const{["type"]:n,["offset"]:r=0}=e,i=Lt(e.nullBitmap),s=yn(n.ArrayType,e.data),{["length"]:o=s.length,["nullCount"]:a=e.nullBitmap?-1:0}=e;return new mn(n,r,o,a,[void 0,s,i])}visitFloat(e){const{["type"]:n,["offset"]:r=0}=e,i=Lt(e.nullBitmap),s=yn(n.ArrayType,e.data),{["length"]:o=s.length,["nullCount"]:a=e.nullBitmap?-1:0}=e;return new mn(n,r,o,a,[void 0,s,i])}visitUtf8(e){const{["type"]:n,["offset"]:r=0}=e,i=Lt(e.data),s=Lt(e.nullBitmap),o=dm(e.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=e.nullBitmap?-1:0}=e;return new mn(n,r,a,l,[o,i,s])}visitLargeUtf8(e){const{["type"]:n,["offset"]:r=0}=e,i=Lt(e.data),s=Lt(e.nullBitmap),o=lD(e.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=e.nullBitmap?-1:0}=e;return new mn(n,r,a,l,[o,i,s])}visitBinary(e){const{["type"]:n,["offset"]:r=0}=e,i=Lt(e.data),s=Lt(e.nullBitmap),o=dm(e.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=e.nullBitmap?-1:0}=e;return new mn(n,r,a,l,[o,i,s])}visitLargeBinary(e){const{["type"]:n,["offset"]:r=0}=e,i=Lt(e.data),s=Lt(e.nullBitmap),o=lD(e.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=e.nullBitmap?-1:0}=e;return new mn(n,r,a,l,[o,i,s])}visitFixedSizeBinary(e){const{["type"]:n,["offset"]:r=0}=e,i=Lt(e.nullBitmap),s=yn(n.ArrayType,e.data),{["length"]:o=s.length/su(n),["nullCount"]:a=e.nullBitmap?-1:0}=e;return new mn(n,r,o,a,[void 0,s,i])}visitDate(e){const{["type"]:n,["offset"]:r=0}=e,i=Lt(e.nullBitmap),s=yn(n.ArrayType,e.data),{["length"]:o=s.length/su(n),["nullCount"]:a=e.nullBitmap?-1:0}=e;return new mn(n,r,o,a,[void 0,s,i])}visitTimestamp(e){const{["type"]:n,["offset"]:r=0}=e,i=Lt(e.nullBitmap),s=yn(n.ArrayType,e.data),{["length"]:o=s.length/su(n),["nullCount"]:a=e.nullBitmap?-1:0}=e;return new mn(n,r,o,a,[void 0,s,i])}visitTime(e){const{["type"]:n,["offset"]:r=0}=e,i=Lt(e.nullBitmap),s=yn(n.ArrayType,e.data),{["length"]:o=s.length/su(n),["nullCount"]:a=e.nullBitmap?-1:0}=e;return new mn(n,r,o,a,[void 0,s,i])}visitDecimal(e){const{["type"]:n,["offset"]:r=0}=e,i=Lt(e.nullBitmap),s=yn(n.ArrayType,e.data),{["length"]:o=s.length/su(n),["nullCount"]:a=e.nullBitmap?-1:0}=e;return new mn(n,r,o,a,[void 0,s,i])}visitList(e){const{["type"]:n,["offset"]:r=0,["child"]:i}=e,s=Lt(e.nullBitmap),o=dm(e.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=e.nullBitmap?-1:0}=e;return new mn(n,r,a,l,[o,void 0,s],[i])}visitStruct(e){const{["type"]:n,["offset"]:r=0,["children"]:i=[]}=e,s=Lt(e.nullBitmap),{length:o=i.reduce((l,{length:u})=>Math.max(l,u),0),nullCount:a=e.nullBitmap?-1:0}=e;return new mn(n,r,o,a,[void 0,void 0,s],i)}visitUnion(e){const{["type"]:n,["offset"]:r=0,["children"]:i=[]}=e,s=yn(n.ArrayType,e.typeIds),{["length"]:o=s.length,["nullCount"]:a=-1}=e;if(Ue.isSparseUnion(n))return new mn(n,r,o,a,[void 0,void 0,void 0,s],i);const l=dm(e.valueOffsets);return new mn(n,r,o,a,[l,void 0,void 0,s],i)}visitDictionary(e){const{["type"]:n,["offset"]:r=0}=e,i=Lt(e.nullBitmap),s=yn(n.indices.ArrayType,e.data),{["dictionary"]:o=new cn([new vg().visit({type:n.dictionary})])}=e,{["length"]:a=s.length,["nullCount"]:l=e.nullBitmap?-1:0}=e;return new mn(n,r,a,l,[void 0,s,i],[],o)}visitInterval(e){const{["type"]:n,["offset"]:r=0}=e,i=Lt(e.nullBitmap),s=yn(n.ArrayType,e.data),{["length"]:o=s.length/su(n),["nullCount"]:a=e.nullBitmap?-1:0}=e;return new mn(n,r,o,a,[void 0,s,i])}visitDuration(e){const{["type"]:n,["offset"]:r=0}=e,i=Lt(e.nullBitmap),s=yn(n.ArrayType,e.data),{["length"]:o=s.length,["nullCount"]:a=e.nullBitmap?-1:0}=e;return new mn(n,r,o,a,[void 0,s,i])}visitFixedSizeList(e){const{["type"]:n,["offset"]:r=0,["child"]:i=new vg().visit({type:n.valueType})}=e,s=Lt(e.nullBitmap),{["length"]:o=i.length/su(n),["nullCount"]:a=e.nullBitmap?-1:0}=e;return new mn(n,r,o,a,[void 0,void 0,s],[i])}visitMap(e){const{["type"]:n,["offset"]:r=0,["child"]:i=new vg().visit({type:n.childType})}=e,s=Lt(e.nullBitmap),o=dm(e.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=e.nullBitmap?-1:0}=e;return new mn(n,r,a,l,[o,void 0,s],[i])}}const _se=new vg;function Tt(t){return _se.visit(t)}class xD{constructor(e=0,n){this.numChunks=e,this.getChunkIterator=n,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndexe.nullable)}function GQ(t){return t.reduce((e,n)=>e+n.nullCount,0)}function HQ(t){return t.reduce((e,n,r)=>(e[r+1]=e[r]+n.length,e),new Uint32Array(t.length+1))}function KQ(t,e,n,r){const i=[];for(let s=-1,o=t.length;++s=r)break;if(n>=l+u)continue;if(l>=n&&l+u<=r){i.push(a);continue}const c=Math.max(0,n-l),f=Math.min(r-l,u);i.push(a.slice(c,f-c))}return i.length===0&&i.push(t[0].slice(0,0)),i}function j6(t,e,n,r){let i=0,s=0,o=e.length-1;do{if(i>=o-1)return n0?0:-1}function Cse(t,e){const{nullBitmap:n}=t;if(!n||t.nullCount<=0)return-1;let r=0;for(const i of new U6(n,t.offset+(e||0),t.length,n,YQ)){if(!i)return r;++r}return-1}function ht(t,e,n){if(e===void 0)return-1;if(e===null)switch(t.typeId){case U.Union:break;case U.Dictionary:break;default:return Cse(t,n)}const r=As.getVisitFn(t),i=z0(e);for(let s=(n||0)-1,o=t.length;++s{const i=t.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let n=0;return new xD(t.data.length,r=>{const s=t.data[r].length,o=t.slice(n,n+s);return n+=s,new Ase(o)})}class Ase{constructor(e){this.vector=e,this.index=0}next(){return this.indexa.data):e;if(s.length===0||s.some(a=>!(a instanceof mn)))throw new TypeError("Vector constructor expects an Array of Data instances.");const o=(n=s[0])===null||n===void 0?void 0:n.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{const{get:a,set:l,indexOf:u}=rB[o.typeId],c=s[0];this.isValid=f=>q6(c,f),this.get=f=>a(c,f),this.set=(f,h)=>l(c,f,h),this.indexOf=f=>u(c,f),this._offsets=[0,c.length];break}default:Object.setPrototypeOf(this,iB[o.typeId]),this._offsets=HQ(s);break}this.data=s,this.type=o,this.stride=su(o),this.numChildren=(i=(r=o.children)===null||r===void 0?void 0:r.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((e,n)=>e+n.byteLength,0)}get nullable(){return Sse(this.data)}get nullCount(){return GQ(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${U[this.type.typeId]}Vector`}isValid(e){return!1}get(e){return null}at(e){return this.get(z6(e,this.length))}set(e,n){}indexOf(e,n){return-1}includes(e,n){return this.indexOf(e,n)>-1}[Symbol.iterator](){return V6.visit(this)}concat(...e){return new cn(this.data.concat(e.flatMap(n=>n.data).flat(Number.POSITIVE_INFINITY)))}slice(e,n){return new cn(WQ(this,e,n,({data:r,_offsets:i},s,o)=>KQ(r,i,s,o)))}toJSON(){return[...this]}toArray(){const{type:e,data:n,length:r,stride:i,ArrayType:s}=this;switch(e.typeId){case U.Int:case U.Float:case U.Decimal:case U.Time:case U.Timestamp:switch(n.length){case 0:return new s;case 1:return n[0].values.subarray(0,r*i);default:return n.reduce((o,{values:a,length:l})=>(o.array.set(a.subarray(0,l*i),o.offset),o.offset+=l*i,o),{array:new s(r*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(e){var n;return this.getChildAt((n=this.type.children)===null||n===void 0?void 0:n.findIndex(r=>r.name===e))}getChildAt(e){return e>-1&&en[e])):null}get isMemoized(){return Ue.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(Ue.isDictionary(this.type)){const e=new e2(this.data[0].dictionary),n=this.data.map(r=>{const i=r.clone();return i.dictionary=e,i});return new cn(n)}return new e2(this)}unmemoize(){if(Ue.isDictionary(this.type)&&this.isMemoized){const e=this.data[0].dictionary.unmemoize(),n=this.data.map(r=>{const i=r.clone();return i.dictionary=e,i});return new cn(n)}return this}}nB=Symbol.toStringTag;cn[nB]=(t=>{t.type=Ue.prototype,t.data=[],t.length=0,t.stride=1,t.numChildren=0,t._offsets=new Uint32Array([0]),t[Symbol.isConcatSpreadable]=!0;const e=Object.keys(U).map(n=>U[n]).filter(n=>typeof n=="number"&&n!==U.NONE);for(const n of e){const r=As.getVisitFnByTypeId(n),i=Po.getVisitFnByTypeId(n),s=Jv.getVisitFnByTypeId(n);rB[n]={get:r,set:i,indexOf:s},iB[n]=Object.create(t,{isValid:{value:Kv(q6)},get:{value:Kv(As.getVisitFnByTypeId(n))},set:{value:JQ(Po.getVisitFnByTypeId(n))},indexOf:{value:eB(Jv.getVisitFnByTypeId(n))}})}return"Vector"})(cn.prototype);class e2 extends cn{constructor(e){super(e.data);const n=this.get,r=this.set,i=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(o){const a=s[o];if(a!==void 0)return a;const l=n.call(this,o);return s[o]=l,l}}),Object.defineProperty(this,"set",{value(o,a){r.call(this,o,a),s[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new e2(i.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new cn(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}class qk{constructor(){this.bb=null,this.bb_pos=0}__init(e,n){return this.bb_pos=e,this.bb=n,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(e,n,r,i){return e.prep(8,24),e.writeInt64(BigInt(i??0)),e.pad(4),e.writeInt32(r),e.writeInt64(BigInt(n??0)),e.offset()}}class zs{constructor(){this.bb=null,this.bb_pos=0}__init(e,n){return this.bb_pos=e,this.bb=n,this}static getRootAsFooter(e,n){return(n||new zs).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFooter(e,n){return e.setPosition(e.position()+pn),(n||new zs).__init(e.readInt32(e.position())+e.position(),e)}version(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):yr.V1}schema(e){const n=this.bb.__offset(this.bb_pos,6);return n?(e||new Na).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}dictionaries(e,n){const r=this.bb.__offset(this.bb_pos,8);return r?(n||new qk).__init(this.bb.__vector(this.bb_pos+r)+e*24,this.bb):null}dictionariesLength(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}recordBatches(e,n){const r=this.bb.__offset(this.bb_pos,10);return r?(n||new qk).__init(this.bb.__vector(this.bb_pos+r)+e*24,this.bb):null}recordBatchesLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,n){const r=this.bb.__offset(this.bb_pos,12);return r?(n||new Nr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startFooter(e){e.startObject(5)}static addVersion(e,n){e.addFieldInt16(0,n,yr.V1)}static addSchema(e,n){e.addFieldOffset(1,n,0)}static addDictionaries(e,n){e.addFieldOffset(2,n,0)}static startDictionariesVector(e,n){e.startVector(24,n,8)}static addRecordBatches(e,n){e.addFieldOffset(3,n,0)}static startRecordBatchesVector(e,n){e.startVector(24,n,8)}static addCustomMetadata(e,n){e.addFieldOffset(4,n,0)}static createCustomMetadataVector(e,n){e.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)e.addOffset(n[r]);return e.endVector()}static startCustomMetadataVector(e,n){e.startVector(4,n,4)}static endFooter(e){return e.endObject()}static finishFooterBuffer(e,n){e.finish(n)}static finishSizePrefixedFooterBuffer(e,n){e.finish(n,void 0,!0)}}let sr=class Df{constructor(e=[],n,r,i=yr.V5){this.fields=e||[],this.metadata=n||new Map,r||(r=Vk(this.fields)),this.dictionaries=r,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(e=>e.name)}toString(){return`Schema<{ ${this.fields.map((e,n)=>`${n}: ${e}`).join(", ")} }>`}select(e){const n=new Set(e),r=this.fields.filter(i=>n.has(i.name));return new Df(r,this.metadata)}selectAt(e){const n=e.map(r=>this.fields[r]).filter(Boolean);return new Df(n,this.metadata)}assign(...e){const n=e[0]instanceof Df?e[0]:Array.isArray(e[0])?new Df(e[0]):new Df(e),r=[...this.fields],i=Ky(Ky(new Map,this.metadata),n.metadata),s=n.fields.filter(a=>{const l=r.findIndex(u=>u.name===a.name);return~l?(r[l]=a.clone({metadata:Ky(Ky(new Map,r[l].metadata),a.metadata)}))&&!1:!0}),o=Vk(s,new Map);return new Df([...r,...s],i,new Map([...this.dictionaries,...o]))}};sr.prototype.fields=null;sr.prototype.metadata=null;sr.prototype.dictionaries=null;class Wn{static new(...e){let[n,r,i,s]=e;return e[0]&&typeof e[0]=="object"&&({name:n}=e[0],r===void 0&&(r=e[0].type),i===void 0&&(i=e[0].nullable),s===void 0&&(s=e[0].metadata)),new Wn(`${n}`,r,i,s)}constructor(e,n,r=!1,i){this.name=e,this.type=n,this.nullable=r,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...e){let[n,r,i,s]=e;return!e[0]||typeof e[0]!="object"?[n=this.name,r=this.type,i=this.nullable,s=this.metadata]=e:{name:n=this.name,type:r=this.type,nullable:i=this.nullable,metadata:s=this.metadata}=e[0],Wn.new(n,r,i,s)}}Wn.prototype.type=null;Wn.prototype.name=null;Wn.prototype.nullable=null;Wn.prototype.metadata=null;function Ky(t,e){return new Map([...t||new Map,...e||new Map])}function Vk(t,e=new Map){for(let n=-1,r=t.length;++n0&&Vk(s.children,e)}return e}var Ese=EN,Tse=Wp;class Kg{static decode(e){e=new Tse(Lt(e));const n=zs.getRootAsFooter(e),r=sr.decode(n.schema(),new Map,n.version());return new Dse(r,n)}static encode(e){const n=new Ese,r=sr.encode(n,e.schema);zs.startRecordBatchesVector(n,e.numRecordBatches);for(const o of[...e.recordBatches()].slice().reverse())Yc.encode(n,o);const i=n.endVector();zs.startDictionariesVector(n,e.numDictionaries);for(const o of[...e.dictionaryBatches()].slice().reverse())Yc.encode(n,o);const s=n.endVector();return zs.startFooter(n),zs.addSchema(n,r),zs.addVersion(n,yr.V5),zs.addRecordBatches(n,i),zs.addDictionaries(n,s),zs.finishFooterBuffer(n,zs.endFooter(n)),n.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(e,n=yr.V5,r,i){this.schema=e,this.version=n,r&&(this._recordBatches=r),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let e,n=-1,r=this.numRecordBatches;++n=0&&e=0&&e=0&&e=0&&ethis._closedPromiseResolve=e)}get closed(){return this._closedPromise}cancel(e){return dt(this,void 0,void 0,function*(){yield this.return(e)})}write(e){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(e):this.resolvers.shift().resolve({done:!1,value:e}))}abort(e){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:e}:this.resolvers.shift().reject({done:!0,value:e}))}close(){if(this._closedPromiseResolve){const{resolvers:e}=this;for(;e.length>0;)e.shift().resolve(ar);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(e){return po.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,e)}toNodeStream(e){return po.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,e)}throw(e){return dt(this,void 0,void 0,function*(){return yield this.abort(e),ar})}return(e){return dt(this,void 0,void 0,function*(){return yield this.close(),ar})}read(e){return dt(this,void 0,void 0,function*(){return(yield this.next(e,"read")).value})}peek(e){return dt(this,void 0,void 0,function*(){return(yield this.next(e,"peek")).value})}next(...e){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((n,r)=>{this.resolvers.push({resolve:n,reject:r})}):Promise.resolve(ar)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class vO extends Pse{write(e){if((e=Lt(e)).byteLength>0)return super.write(e)}toString(e=!1){return e?Mk(this.toUint8Array(!0)):this.toUint8Array(!1).then(Mk)}toUint8Array(e=!1){return e?xl(this._values)[0]:dt(this,void 0,void 0,function*(){var n,r,i,s;const o=[];let a=0;try{for(var l=!0,u=dh(this),c;c=yield u.next(),n=c.done,!n;l=!0){s=c.value,l=!1;const f=s;o.push(f),a+=f.byteLength}}catch(f){r={error:f}}finally{try{!l&&!n&&(i=u.return)&&(yield i.call(u))}finally{if(r)throw r.error}}return xl(o,a)[0]})}}class t2{constructor(e){e&&(this.source=new Rse(po.fromIterable(e)))}[Symbol.iterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}}class Hp{constructor(e){e instanceof Hp?this.source=e.source:e instanceof vO?this.source=new _f(po.fromAsyncIterable(e)):SN(e)?this.source=new _f(po.fromNodeStream(e)):$6(e)?this.source=new _f(po.fromDOMStream(e)):_N(e)?this.source=new _f(po.fromDOMStream(e.body)):ry(e)?this.source=new _f(po.fromIterable(e)):Rh(e)?this.source=new _f(po.fromAsyncIterable(e)):B0(e)&&(this.source=new _f(po.fromAsyncIterable(e)))}[Symbol.asyncIterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}get closed(){return this.source.closed}cancel(e){return this.source.cancel(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}}class Rse{constructor(e){this.source=e}cancel(e){this.return(e)}peek(e){return this.next(e,"peek").value}read(e){return this.next(e,"read").value}next(e,n="read"){return this.source.next({cmd:n,size:e})}throw(e){return Object.create(this.source.throw&&this.source.throw(e)||ar)}return(e){return Object.create(this.source.return&&this.source.return(e)||ar)}}class _f{constructor(e){this.source=e,this._closedPromise=new Promise(n=>this._closedPromiseResolve=n)}cancel(e){return dt(this,void 0,void 0,function*(){yield this.return(e)})}get closed(){return this._closedPromise}read(e){return dt(this,void 0,void 0,function*(){return(yield this.next(e,"read")).value})}peek(e){return dt(this,void 0,void 0,function*(){return(yield this.next(e,"peek")).value})}next(e){return dt(this,arguments,void 0,function*(n,r="read"){return yield this.source.next({cmd:r,size:n})})}throw(e){return dt(this,void 0,void 0,function*(){const n=this.source.throw&&(yield this.source.throw(e))||ar;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}return(e){return dt(this,void 0,void 0,function*(){const n=this.source.return&&(yield this.source.return(e))||ar;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}}class SD extends t2{constructor(e,n){super(),this.position=0,this.buffer=Lt(e),this.size=n===void 0?this.buffer.byteLength:n}readInt32(e){const{buffer:n,byteOffset:r}=this.readAt(e,4);return new DataView(n,r).getInt32(0,!0)}seek(e){return this.position=Math.min(e,this.size),e>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),r=new Uint32Array([e.buffer[1]>>>16,e.buffer[1]&65535,e.buffer[0]>>>16,e.buffer[0]&65535]);let i=n[3]*r[3];this.buffer[0]=i&65535;let s=i>>>16;return i=n[2]*r[3],s+=i,i=n[3]*r[2]>>>0,s+=i,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0>>16,this.buffer[1]+=n[1]*r[3]+n[2]*r[2]+n[3]*r[1],this.buffer[1]+=n[0]*r[3]+n[1]*r[2]+n[2]*r[1]+n[3]*r[0]<<16,this}_plus(e){const n=this.buffer[0]+e.buffer[0]>>>0;this.buffer[1]+=e.buffer[1],n>>0&&++this.buffer[1],this.buffer[0]=n}lessThan(e){return this.buffer[1]>>0,n[2]=this.buffer[2]+e.buffer[2]>>>0,n[1]=this.buffer[1]+e.buffer[1]>>>0,n[0]=this.buffer[0]+e.buffer[0]>>>0,n[0]>>0&&++n[1],n[1]>>0&&++n[2],n[2]>>0&&++n[3],this.buffer[3]=n[3],this.buffer[2]=n[2],this.buffer[1]=n[1],this.buffer[0]=n[0],this}hex(){return`${Yd(this.buffer[3])} ${Yd(this.buffer[2])} ${Yd(this.buffer[1])} ${Yd(this.buffer[0])}`}static multiply(e,n){return new Qa(new Uint32Array(e.buffer)).times(n)}static add(e,n){return new Qa(new Uint32Array(e.buffer)).plus(n)}static from(e,n=new Uint32Array(4)){return Qa.fromString(typeof e=="string"?e:e.toString(),n)}static fromNumber(e,n=new Uint32Array(4)){return Qa.fromString(e.toString(),n)}static fromString(e,n=new Uint32Array(4)){const r=e.startsWith("-"),i=e.length,s=new Qa(n);for(let o=r?1:0;o0&&this.readData(e,r)||new Uint8Array(0)}readOffsets(e,n){return this.readData(e,n)}readTypeIds(e,n){return this.readData(e,n)}readData(e,{length:n,offset:r}=this.nextBufferRange()){return this.bytes.subarray(r,r+n)}readDictionary(e){return this.dictionaries.get(e.id)}}class Fse extends oB{constructor(e,n,r,i,s){super(new Uint8Array(0),n,r,i,s),this.sources=e}readNullBitmap(e,n,{offset:r}=this.nextBufferRange()){return n<=0?new Uint8Array(0):Hv(this.sources[r])}readOffsets(e,{offset:n}=this.nextBufferRange()){return yn(Uint8Array,yn(e.OffsetArrayType,this.sources[n]))}readTypeIds(e,{offset:n}=this.nextBufferRange()){return yn(Uint8Array,yn(e.ArrayType,this.sources[n]))}readData(e,{offset:n}=this.nextBufferRange()){const{sources:r}=this;return Ue.isTimestamp(e)||(Ue.isInt(e)||Ue.isTime(e))&&e.bitWidth===64||Ue.isDuration(e)||Ue.isDate(e)&&e.unit===Do.MILLISECOND?yn(Uint8Array,ls.convertArray(r[n])):Ue.isDecimal(e)?yn(Uint8Array,Qa.convertArray(r[n])):Ue.isBinary(e)||Ue.isLargeBinary(e)||Ue.isFixedSizeBinary(e)?$se(r[n]):Ue.isBool(e)?Hv(r[n]):Ue.isUtf8(e)||Ue.isLargeUtf8(e)?F6(r[n].join("")):yn(Uint8Array,yn(e.ArrayType,r[n].map(i=>+i)))}}function $se(t){const e=t.join(""),n=new Uint8Array(e.length/2);for(let r=0;r>1]=Number.parseInt(e.slice(r,r+2),16);return n}class Ke extends Et{compareSchemas(e,n){return e===n||n instanceof e.constructor&&this.compareManyFields(e.fields,n.fields)}compareManyFields(e,n){return e===n||Array.isArray(e)&&Array.isArray(n)&&e.length===n.length&&e.every((r,i)=>this.compareFields(r,n[i]))}compareFields(e,n){return e===n||n instanceof e.constructor&&e.name===n.name&&e.nullable===n.nullable&&this.visit(e.type,n.type)}}function ts(t,e){return e instanceof t.constructor}function Jh(t,e){return t===e||ts(t,e)}function Gu(t,e){return t===e||ts(t,e)&&t.bitWidth===e.bitWidth&&t.isSigned===e.isSigned}function Cx(t,e){return t===e||ts(t,e)&&t.precision===e.precision}function Mse(t,e){return t===e||ts(t,e)&&t.byteWidth===e.byteWidth}function W6(t,e){return t===e||ts(t,e)&&t.unit===e.unit}function iy(t,e){return t===e||ts(t,e)&&t.unit===e.unit&&t.timezone===e.timezone}function sy(t,e){return t===e||ts(t,e)&&t.unit===e.unit&&t.bitWidth===e.bitWidth}function Lse(t,e){return t===e||ts(t,e)&&t.children.length===e.children.length&&Gc.compareManyFields(t.children,e.children)}function Nse(t,e){return t===e||ts(t,e)&&t.children.length===e.children.length&&Gc.compareManyFields(t.children,e.children)}function Y6(t,e){return t===e||ts(t,e)&&t.mode===e.mode&&t.typeIds.every((n,r)=>n===e.typeIds[r])&&Gc.compareManyFields(t.children,e.children)}function Qse(t,e){return t===e||ts(t,e)&&t.id===e.id&&t.isOrdered===e.isOrdered&&Gc.visit(t.indices,e.indices)&&Gc.visit(t.dictionary,e.dictionary)}function G6(t,e){return t===e||ts(t,e)&&t.unit===e.unit}function oy(t,e){return t===e||ts(t,e)&&t.unit===e.unit}function Bse(t,e){return t===e||ts(t,e)&&t.listSize===e.listSize&&t.children.length===e.children.length&&Gc.compareManyFields(t.children,e.children)}function zse(t,e){return t===e||ts(t,e)&&t.keysSorted===e.keysSorted&&t.children.length===e.children.length&&Gc.compareManyFields(t.children,e.children)}Ke.prototype.visitNull=Jh;Ke.prototype.visitBool=Jh;Ke.prototype.visitInt=Gu;Ke.prototype.visitInt8=Gu;Ke.prototype.visitInt16=Gu;Ke.prototype.visitInt32=Gu;Ke.prototype.visitInt64=Gu;Ke.prototype.visitUint8=Gu;Ke.prototype.visitUint16=Gu;Ke.prototype.visitUint32=Gu;Ke.prototype.visitUint64=Gu;Ke.prototype.visitFloat=Cx;Ke.prototype.visitFloat16=Cx;Ke.prototype.visitFloat32=Cx;Ke.prototype.visitFloat64=Cx;Ke.prototype.visitUtf8=Jh;Ke.prototype.visitLargeUtf8=Jh;Ke.prototype.visitBinary=Jh;Ke.prototype.visitLargeBinary=Jh;Ke.prototype.visitFixedSizeBinary=Mse;Ke.prototype.visitDate=W6;Ke.prototype.visitDateDay=W6;Ke.prototype.visitDateMillisecond=W6;Ke.prototype.visitTimestamp=iy;Ke.prototype.visitTimestampSecond=iy;Ke.prototype.visitTimestampMillisecond=iy;Ke.prototype.visitTimestampMicrosecond=iy;Ke.prototype.visitTimestampNanosecond=iy;Ke.prototype.visitTime=sy;Ke.prototype.visitTimeSecond=sy;Ke.prototype.visitTimeMillisecond=sy;Ke.prototype.visitTimeMicrosecond=sy;Ke.prototype.visitTimeNanosecond=sy;Ke.prototype.visitDecimal=Jh;Ke.prototype.visitList=Lse;Ke.prototype.visitStruct=Nse;Ke.prototype.visitUnion=Y6;Ke.prototype.visitDenseUnion=Y6;Ke.prototype.visitSparseUnion=Y6;Ke.prototype.visitDictionary=Qse;Ke.prototype.visitInterval=G6;Ke.prototype.visitIntervalDayTime=G6;Ke.prototype.visitIntervalYearMonth=G6;Ke.prototype.visitDuration=oy;Ke.prototype.visitDurationSecond=oy;Ke.prototype.visitDurationMillisecond=oy;Ke.prototype.visitDurationMicrosecond=oy;Ke.prototype.visitDurationNanosecond=oy;Ke.prototype.visitFixedSizeList=Bse;Ke.prototype.visitMap=zse;const Gc=new Ke;function Zk(t,e){return Gc.compareSchemas(t,e)}function uS(t,e){return Use(t,e.map(n=>n.data.concat()))}function Use(t,e){const n=[...t.fields],r=[],i={numBatches:e.reduce((f,h)=>Math.max(f,h.length),0)};let s=0,o=0,a=-1;const l=e.length;let u,c=[];for(;i.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a0&&(r[s++]=Tt({type:new qi(n),length:o,nullCount:0,children:c.slice()})))}return[t=t.assign(n),r.map(f=>new hs(t,f))]}function jse(t,e,n,r,i){var s;const o=(e+63&-64)>>3;for(let a=-1,l=r.length;++a=e)c===e?n[a]=u:(n[a]=u.slice(0,e),i.numBatches=Math.max(i.numBatches,r[a].unshift(u.slice(e,c-e))));else{const f=t[a];t[a]=f.clone({nullable:!0}),n[a]=(s=u?._changeLengthAndBackfillNullBitmap(e))!==null&&s!==void 0?s:Tt({type:f.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)})}}return n}var aB;let Hc=class Pf{constructor(...e){var n,r;if(e.length===0)return this.batches=[],this.schema=new sr([]),this._offsets=[0],this;let i,s;e[0]instanceof sr&&(i=e.shift()),e.at(-1)instanceof Uint32Array&&(s=e.pop());const o=l=>{if(l){if(l instanceof hs)return[l];if(l instanceof Pf)return l.batches;if(l instanceof mn){if(l.type instanceof qi)return[new hs(new sr(l.type.children),l)]}else{if(Array.isArray(l))return l.flatMap(u=>o(u));if(typeof l[Symbol.iterator]=="function")return[...l].flatMap(u=>o(u));if(typeof l=="object"){const u=Object.keys(l),c=u.map(d=>new cn([l[d]])),f=i??new sr(u.map((d,p)=>new Wn(String(d),c[p].type,c[p].nullable))),[,h]=uS(f,c);return h.length===0?[new hs(l)]:h}}}return[]},a=e.flatMap(l=>o(l));if(i=(r=i??((n=a[0])===null||n===void 0?void 0:n.schema))!==null&&r!==void 0?r:new sr([]),!(i instanceof sr))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const l of a){if(!(l instanceof hs))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Zk(i,l.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=s??HQ(this.data)}get data(){return this.batches.map(({data:e})=>e)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((e,n)=>e+n.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=GQ(this.data)),this._nullCount}isValid(e){return!1}get(e){return null}at(e){return this.get(z6(e,this.numRows))}set(e,n){}indexOf(e,n){return-1}[Symbol.iterator](){return this.batches.length>0?V6.visit(new cn(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[ ${this.toArray().join(`, `)} ]`}concat(...e){const n=this.schema,r=this.data.concat(e.flatMap(({data:i})=>i));return new Pf(n,r.map(i=>new hs(n,i)))}slice(e,n){const r=this.schema;[e,n]=WQ({length:this.numRows},e,n);const i=KQ(this.data,this._offsets,e,n);return new Pf(r,i.map(s=>new hs(r,s)))}getChild(e){return this.getChildAt(this.schema.fields.findIndex(n=>n.name===e))}getChildAt(e){if(e>-1&&er.children[e]);if(n.length===0){const{type:r}=this.schema.fields[e],i=Tt({type:r,length:0,nullCount:0});n.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new cn(n)}return null}setChild(e,n){var r;return this.setChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===e),n)}setChildAt(e,n){let r=this.schema,i=[...this.batches];if(e>-1&&ethis.getChildAt(u));[s[e],a[e]]=[o,n],[r,i]=uS(r,a)}return new Pf(r,i)}select(e){const n=this.schema.fields.reduce((r,i,s)=>r.set(i.name,s),new Map);return this.selectAt(e.map(r=>n.get(r)).filter(r=>r>-1))}selectAt(e){const n=this.schema.selectAt(e),r=this.batches.map(i=>i.selectAt(e));return new Pf(n,r)}assign(e){const n=this.schema.fields,[r,i]=e.schema.fields.reduce((a,l,u)=>{const[c,f]=a,h=n.findIndex(d=>d.name===l.name);return~h?f[h]=u:c.push(u),a},[[],[]]),s=this.schema.assign(e.schema),o=[...n.map((a,l)=>[l,i[l]]).map(([a,l])=>l===void 0?this.getChildAt(a):e.getChildAt(l)),...r.map(a=>e.getChildAt(a))].filter(Boolean);return new Pf(...uS(s,o))}};aB=Symbol.toStringTag;Hc[aB]=(t=>(t.schema=null,t.batches=[],t._offsets=new Uint32Array([0]),t._nullCount=-1,t[Symbol.isConcatSpreadable]=!0,t.isValid=Kv(q6),t.get=Kv(As.getVisitFn(U.Struct)),t.set=JQ(Po.getVisitFn(U.Struct)),t.indexOf=eB(Jv.getVisitFn(U.Struct)),"Table"))(Hc.prototype);var lB;let hs=class Jm{constructor(...e){switch(e.length){case 2:{if([this.schema]=e,!(this.schema instanceof sr))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Tt({nullCount:0,type:new qi(this.schema.fields),children:this.schema.fields.map(n=>Tt({type:n.type,nullCount:0}))})]=e,!(this.data instanceof mn))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=kD(this.schema,this.data.children);break}case 1:{const[n]=e,{fields:r,children:i,length:s}=Object.keys(n).reduce((l,u,c)=>(l.children[c]=n[u],l.length=Math.max(l.length,n[u].length),l.fields[c]=Wn.new({name:u,type:n[u].type,nullable:!0}),l),{length:0,fields:new Array,children:new Array}),o=new sr(r),a=Tt({type:new qi(r),length:s,children:i,nullCount:0});[this.schema,this.data]=kD(o,a.children,s);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=uB(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(e){return this.data.getValid(e)}get(e){return As.visit(this.data,e)}at(e){return this.get(z6(e,this.numRows))}set(e,n){return Po.visit(this.data,e,n)}indexOf(e,n){return Jv.visit(this.data,e,n)}[Symbol.iterator](){return V6.visit(new cn([this.data]))}toArray(){return[...this]}concat(...e){return new Hc(this.schema,[this,...e])}slice(e,n){const[r]=new cn([this.data]).slice(e,n).data;return new Jm(this.schema,r)}getChild(e){var n;return this.getChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(r=>r.name===e))}getChildAt(e){return e>-1&&ei.name===e),n)}setChildAt(e,n){let r=this.schema,i=this.data;if(e>-1&&ea.name===s);~o&&(i[o]=this.data.children[o])}return new Jm(n,Tt({type:r,length:this.numRows,children:i}))}selectAt(e){const n=this.schema.selectAt(e),r=e.map(s=>this.data.children[s]).filter(Boolean),i=Tt({type:new qi(n.fields),length:this.numRows,children:r});return new Jm(n,i)}};lB=Symbol.toStringTag;hs[lB]=(t=>(t._nullCount=-1,t[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(hs.prototype);function kD(t,e,n=e.reduce((r,i)=>Math.max(r,i.length),0)){var r;const i=[...t.fields],s=[...e],o=(n+63&-64)>>3;for(const[a,l]of t.fields.entries()){const u=e[a];(!u||u.length!==n)&&(i[a]=l.clone({nullable:!0}),s[a]=(r=u?._changeLengthAndBackfillNullBitmap(n))!==null&&r!==void 0?r:Tt({type:l.type,length:n,nullCount:n,nullBitmap:new Uint8Array(o)}))}return[t.assign(i),Tt({type:new qi(i),length:n,children:s})]}function uB(t,e,n=new Map){var r,i;if(((r=t?.length)!==null&&r!==void 0?r:0)>0&&t?.length===e?.length)for(let s=-1,o=t.length;++sTt({type:i.type})),r=Tt({type:new qi(e.fields),nullCount:0,children:n});super(e,r)}}let lc=class Ra{constructor(){this.bb=null,this.bb_pos=0}__init(e,n){return this.bb_pos=e,this.bb=n,this}static getRootAsMessage(e,n){return(n||new Ra).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsMessage(e,n){return e.setPosition(e.position()+pn),(n||new Ra).__init(e.readInt32(e.position())+e.position(),e)}version(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):yr.V1}headerType(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):Jt.NONE}header(e){const n=this.bb.__offset(this.bb_pos,8);return n?this.bb.__union(e,this.bb_pos+n):null}bodyLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}customMetadata(e,n){const r=this.bb.__offset(this.bb_pos,12);return r?(n||new Nr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startMessage(e){e.startObject(5)}static addVersion(e,n){e.addFieldInt16(0,n,yr.V1)}static addHeaderType(e,n){e.addFieldInt8(1,n,Jt.NONE)}static addHeader(e,n){e.addFieldOffset(2,n,0)}static addBodyLength(e,n){e.addFieldInt64(3,n,BigInt("0"))}static addCustomMetadata(e,n){e.addFieldOffset(4,n,0)}static createCustomMetadataVector(e,n){e.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)e.addOffset(n[r]);return e.endVector()}static startCustomMetadataVector(e,n){e.startVector(4,n,4)}static endMessage(e){return e.endObject()}static finishMessageBuffer(e,n){e.finish(n)}static finishSizePrefixedMessageBuffer(e,n){e.finish(n,void 0,!0)}static createMessage(e,n,r,i,s,o){return Ra.startMessage(e),Ra.addVersion(e,n),Ra.addHeaderType(e,r),Ra.addHeader(e,i),Ra.addBodyLength(e,s),Ra.addCustomMetadata(e,o),Ra.endMessage(e)}};class qse extends Et{visit(e,n){return e==null||n==null?void 0:super.visit(e,n)}visitNull(e,n){return gD.startNull(n),gD.endNull(n)}visitInt(e,n){return Vs.startInt(n),Vs.addBitWidth(n,e.bitWidth),Vs.addIsSigned(n,e.isSigned),Vs.endInt(n)}visitFloat(e,n){return Za.startFloatingPoint(n),Za.addPrecision(n,e.precision),Za.endFloatingPoint(n)}visitBinary(e,n){return fD.startBinary(n),fD.endBinary(n)}visitLargeBinary(e,n){return dD.startLargeBinary(n),dD.endLargeBinary(n)}visitBool(e,n){return hD.startBool(n),hD.endBool(n)}visitUtf8(e,n){return yD.startUtf8(n),yD.endUtf8(n)}visitLargeUtf8(e,n){return pD.startLargeUtf8(n),pD.endLargeUtf8(n)}visitDecimal(e,n){return Fd.startDecimal(n),Fd.addScale(n,e.scale),Fd.addPrecision(n,e.precision),Fd.addBitWidth(n,e.bitWidth),Fd.endDecimal(n)}visitDate(e,n){return pO.startDate(n),pO.addUnit(n,e.unit),pO.endDate(n)}visitTime(e,n){return go.startTime(n),go.addUnit(n,e.unit),go.addBitWidth(n,e.bitWidth),go.endTime(n)}visitTimestamp(e,n){const r=e.timezone&&n.createString(e.timezone)||void 0;return yo.startTimestamp(n),yo.addUnit(n,e.unit),r!==void 0&&yo.addTimezone(n,r),yo.endTimestamp(n)}visitInterval(e,n){return Xa.startInterval(n),Xa.addUnit(n,e.unit),Xa.endInterval(n)}visitDuration(e,n){return mO.startDuration(n),mO.addUnit(n,e.unit),mO.endDuration(n)}visitList(e,n){return mD.startList(n),mD.endList(n)}visitStruct(e,n){return Wf.startStruct_(n),Wf.endStruct_(n)}visitUnion(e,n){fs.startTypeIdsVector(n,e.typeIds.length);const r=fs.createTypeIdsVector(n,e.typeIds);return fs.startUnion(n),fs.addMode(n,e.mode),fs.addTypeIds(n,r),fs.endUnion(n)}visitDictionary(e,n){const r=this.visit(e.indices,n);return du.startDictionaryEncoding(n),du.addId(n,BigInt(e.id)),du.addIsOrdered(n,e.isOrdered),r!==void 0&&du.addIndexType(n,r),du.endDictionaryEncoding(n)}visitFixedSizeBinary(e,n){return gO.startFixedSizeBinary(n),gO.addByteWidth(n,e.byteWidth),gO.endFixedSizeBinary(n)}visitFixedSizeList(e,n){return yO.startFixedSizeList(n),yO.addListSize(n,e.listSize),yO.endFixedSizeList(n)}visitMap(e,n){return bO.startMap(n),bO.addKeysSorted(n,e.keysSorted),bO.endMap(n)}}const cS=new qse;function Vse(t,e=new Map){return new sr(Xse(t,e),wO(t.metadata),e)}function cB(t){return new no(t.count,fB(t.columns),hB(t.columns))}function Zse(t){return new Sl(cB(t.data),t.id,t.isDelta)}function Xse(t,e){return(t.fields||[]).filter(Boolean).map(n=>Wn.fromJSON(n,e))}function CD(t,e){return(t.children||[]).filter(Boolean).map(n=>Wn.fromJSON(n,e))}function fB(t){return(t||[]).reduce((e,n)=>[...e,new Kc(n.count,Wse(n.VALIDITY)),...fB(n.children)],[])}function hB(t,e=[]){for(let n=-1,r=(t||[]).length;++ne+ +(n===0),0)}function Yse(t,e){let n,r,i,s,o,a;return!e||!(s=t.dictionary)?(o=ED(t,CD(t,e)),i=new Wn(t.name,o,t.nullable,wO(t.metadata))):e.has(n=s.id)?(r=(r=s.indexType)?AD(r):new Hg,a=new Gp(e.get(n),r,n,s.isOrdered),i=new Wn(t.name,a,t.nullable,wO(t.metadata))):(r=(r=s.indexType)?AD(r):new Hg,e.set(n,o=ED(t,CD(t,e))),a=new Gp(o,r,n,s.isOrdered),i=new Wn(t.name,a,t.nullable,wO(t.metadata))),i||null}function wO(t=[]){return new Map(t.map(({key:e,value:n})=>[e,n]))}function AD(t){return new Ih(t.isSigned,t.bitWidth)}function ED(t,e){const n=t.type.name;switch(n){case"NONE":return new Wc;case"null":return new Wc;case"binary":return new Fv;case"largebinary":return new $v;case"utf8":return new Mv;case"largeutf8":return new Lv;case"bool":return new Nv;case"list":return new Vv((e||[])[0]);case"struct":return new qi(e||[]);case"struct_":return new qi(e||[])}switch(n){case"int":{const r=t.type;return new Ih(r.isSigned,r.bitWidth)}case"floatingpoint":{const r=t.type;return new Iv(vi[r.precision])}case"decimal":{const r=t.type;return new Qv(r.scale,r.precision,r.bitWidth)}case"date":{const r=t.type;return new Bv(Do[r.unit])}case"time":{const r=t.type;return new zv(et[r.unit],r.bitWidth)}case"timestamp":{const r=t.type;return new Uv(et[r.unit],r.timezone)}case"interval":{const r=t.type;return new jv(_l[r.unit])}case"duration":{const r=t.type;return new qv(et[r.unit])}case"union":{const r=t.type,[i,...s]=(r.mode+"").toLowerCase(),o=i.toUpperCase()+s.join("");return new Zv(Ai[o],r.typeIds||[],e||[])}case"fixedsizebinary":{const r=t.type;return new Xv(r.byteWidth)}case"fixedsizelist":{const r=t.type;return new Wv(r.listSize,(e||[])[0])}case"map":{const r=t.type;return new Yv((e||[])[0],r.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var Gse=EN,Hse=Wp;class Vi{static fromJSON(e,n){const r=new Vi(0,yr.V5,n);return r._createHeader=Kse(e,n),r}static decode(e){e=new Hse(Lt(e));const n=lc.getRootAsMessage(e),r=n.bodyLength(),i=n.version(),s=n.headerType(),o=new Vi(r,i,s);return o._createHeader=Jse(n,s),o}static encode(e){const n=new Gse;let r=-1;return e.isSchema()?r=sr.encode(n,e.header()):e.isRecordBatch()?r=no.encode(n,e.header()):e.isDictionaryBatch()&&(r=Sl.encode(n,e.header())),lc.startMessage(n),lc.addVersion(n,yr.V5),lc.addHeader(n,r),lc.addHeaderType(n,e.headerType),lc.addBodyLength(n,BigInt(e.bodyLength)),lc.finishMessageBuffer(n,lc.endMessage(n)),n.asUint8Array()}static from(e,n=0){if(e instanceof sr)return new Vi(0,yr.V5,Jt.Schema,e);if(e instanceof no)return new Vi(n,yr.V5,Jt.RecordBatch,e);if(e instanceof Sl)return new Vi(n,yr.V5,Jt.DictionaryBatch,e);throw new Error(`Unrecognized Message header: ${e}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===Jt.Schema}isRecordBatch(){return this.headerType===Jt.RecordBatch}isDictionaryBatch(){return this.headerType===Jt.DictionaryBatch}constructor(e,n,r,i){this._version=n,this._headerType=r,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=En(e)}}class no{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(e,n,r){this._nodes=n,this._buffers=r,this._length=En(e)}}class Sl{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(e,n,r=!1){this._data=e,this._isDelta=r,this._id=En(n)}}class el{constructor(e,n){this.offset=En(e),this.length=En(n)}}class Kc{constructor(e,n){this.length=En(e),this.nullCount=En(n)}}function Kse(t,e){return(()=>{switch(e){case Jt.Schema:return sr.fromJSON(t);case Jt.RecordBatch:return no.fromJSON(t);case Jt.DictionaryBatch:return Sl.fromJSON(t)}throw new Error(`Unrecognized Message type: { name: ${Jt[e]}, type: ${e} }`)})}function Jse(t,e){return(()=>{switch(e){case Jt.Schema:return sr.decode(t.header(new Na),new Map,t.version());case Jt.RecordBatch:return no.decode(t.header(new ru),t.version());case Jt.DictionaryBatch:return Sl.decode(t.header(new Rd),t.version())}throw new Error(`Unrecognized Message type: { name: ${Jt[e]}, type: ${e} }`)})}Wn.encode=coe;Wn.decode=loe;Wn.fromJSON=Yse;sr.encode=uoe;sr.decode=eoe;sr.fromJSON=Vse;no.encode=foe;no.decode=toe;no.fromJSON=cB;Sl.encode=hoe;Sl.decode=noe;Sl.fromJSON=Zse;Kc.encode=doe;Kc.decode=ioe;el.encode=poe;el.decode=roe;function eoe(t,e=new Map,n=yr.V5){const r=aoe(t,e);return new sr(r,xO(t),e,n)}function toe(t,e=yr.V5){if(t.compression()!==null)throw new Error("Record batch compression not implemented");return new no(t.length(),soe(t),ooe(t,e))}function noe(t,e=yr.V5){return new Sl(no.decode(t.data(),e),t.id(),t.isDelta())}function roe(t){return new el(t.offset(),t.length())}function ioe(t){return new Kc(t.length(),t.nullCount())}function soe(t){const e=[];for(let n,r=-1,i=-1,s=t.nodesLength();++rWn.encode(t,s));Na.startFieldsVector(t,n.length);const r=Na.createFieldsVector(t,n),i=e.metadata&&e.metadata.size>0?Na.createCustomMetadataVector(t,[...e.metadata].map(([s,o])=>{const a=t.createString(`${s}`),l=t.createString(`${o}`);return Nr.startKeyValue(t),Nr.addKey(t,a),Nr.addValue(t,l),Nr.endKeyValue(t)})):-1;return Na.startSchema(t),Na.addFields(t,r),Na.addEndianness(t,moe?Yp.Little:Yp.Big),i!==-1&&Na.addCustomMetadata(t,i),Na.endSchema(t)}function coe(t,e){let n=-1,r=-1,i=-1;const s=e.type;let o=e.typeId;Ue.isDictionary(s)?(o=s.dictionary.typeId,i=cS.visit(s,t),r=cS.visit(s.dictionary,t)):r=cS.visit(s,t);const a=(s.children||[]).map(c=>Wn.encode(t,c)),l=lo.createChildrenVector(t,a),u=e.metadata&&e.metadata.size>0?lo.createCustomMetadataVector(t,[...e.metadata].map(([c,f])=>{const h=t.createString(`${c}`),d=t.createString(`${f}`);return Nr.startKeyValue(t),Nr.addKey(t,h),Nr.addValue(t,d),Nr.endKeyValue(t)})):-1;return e.name&&(n=t.createString(e.name)),lo.startField(t),lo.addType(t,r),lo.addTypeType(t,o),lo.addChildren(t,l),lo.addNullable(t,!!e.nullable),n!==-1&&lo.addName(t,n),i!==-1&&lo.addDictionary(t,i),u!==-1&&lo.addCustomMetadata(t,u),lo.endField(t)}function foe(t,e){const n=e.nodes||[],r=e.buffers||[];ru.startNodesVector(t,n.length);for(const o of n.slice().reverse())Kc.encode(t,o);const i=t.endVector();ru.startBuffersVector(t,r.length);for(const o of r.slice().reverse())el.encode(t,o);const s=t.endVector();return ru.startRecordBatch(t),ru.addLength(t,BigInt(e.length)),ru.addNodes(t,i),ru.addBuffers(t,s),ru.endRecordBatch(t)}function hoe(t,e){const n=no.encode(t,e.data);return Rd.startDictionaryBatch(t),Rd.addId(t,BigInt(e.id)),Rd.addIsDelta(t,e.isDelta),Rd.addData(t,n),Rd.endDictionaryBatch(t)}function doe(t,e){return PN.createFieldNode(t,BigInt(e.length),BigInt(e.nullCount))}function poe(t,e){return DN.createBuffer(t,BigInt(e.offset),BigInt(e.length))}const moe=(()=>{const t=new ArrayBuffer(2);return new DataView(t).setInt16(0,256,!0),new Int16Array(t)[0]===256})(),K6=t=>`Expected ${Jt[t]} Message in stream, but was null or length 0.`,J6=t=>`Header pointer of flatbuffer-encoded ${Jt[t]} Message is null or length 0.`,dB=(t,e)=>`Expected to read ${t} metadata bytes, but only read ${e}.`,pB=(t,e)=>`Expected to read ${t} bytes for message body, but only read ${e}.`;class mB{constructor(e){this.source=e instanceof t2?e:new t2(e)}[Symbol.iterator](){return this}next(){let e;return(e=this.readMetadataLength()).done||e.value===-1&&(e=this.readMetadataLength()).done||(e=this.readMetadata(e.value)).done?ar:e}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}readMessage(e){let n;if((n=this.next()).done)return null;if(e!=null&&n.value.headerType!==e)throw new Error(K6(e));return n.value}readMessageBody(e){if(e<=0)return new Uint8Array(0);const n=Lt(this.source.read(e));if(n.byteLength[...i,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE_ID&&[s.TYPE_ID]||[],...s.OFFSET&&[s.OFFSET]||[],...s.DATA&&[s.DATA]||[],...n(s.children)],[])}}readMessage(e){let n;if((n=this.next()).done)return null;if(e!=null&&n.value.headerType!==e)throw new Error(K6(e));return n.value}readSchema(){const e=Jt.Schema,n=this.readMessage(e),r=n?.header();if(!n||!r)throw new Error(J6(e));return r}}const Ax=4,Xk="ARROW1",Jg=new Uint8Array(Xk.length);for(let t=0;tthis):this}readRecordBatch(e){return this._impl.isFile()?this._impl.readRecordBatch(e):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return po.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return po.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,n){throw new Error('"throughDOM" not available in this environment')}static from(e){return e instanceof So?e:Lk(e)?xoe(e):xN(e)?koe(e):Rh(e)?dt(this,void 0,void 0,function*(){return yield So.from(yield e)}):_N(e)||$6(e)||SN(e)||B0(e)?Soe(new Hp(e)):_oe(new t2(e))}static readAll(e){return e instanceof So?e.isSync()?RD(e):ID(e):Lk(e)||ArrayBuffer.isView(e)||ry(e)||wN(e)?RD(e):ID(e)}}class r2 extends So{constructor(e){super(e),this._impl=e}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Ja(this,arguments,function*(){yield _t(yield*dO(dh(this[Symbol.iterator]())))})}}class i2 extends So{constructor(e){super(e),this._impl=e}readAll(){return dt(this,void 0,void 0,function*(){var e,n,r,i;const s=new Array;try{for(var o=!0,a=dh(this),l;l=yield a.next(),e=l.done,!e;o=!0){i=l.value,o=!1;const u=i;s.push(u)}}catch(u){n={error:u}}finally{try{!o&&!e&&(r=a.return)&&(yield r.call(a))}finally{if(n)throw n.error}}return s})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class yB extends r2{constructor(e){super(e),this._impl=e}}class Ooe extends i2{constructor(e){super(e),this._impl=e}}class bB{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(e=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=e}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(e){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=e,this.dictionaries=new Map,this}_loadRecordBatch(e,n){const r=this._loadVectors(e,n,this.schema.fields),i=Tt({type:new qi(this.schema.fields),length:e.length,children:r});return new hs(this.schema,i)}_loadDictionaryBatch(e,n){const{id:r,isDelta:i}=e,{dictionaries:s,schema:o}=this,a=s.get(r),l=o.dictionaries.get(r),u=this._loadVectors(e.data,n,[l]);return(a&&i?a.concat(new cn(u)):new cn(u)).memoize()}_loadVectors(e,n,r){return new oB(n,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}}class s2 extends bB{constructor(e,n){super(n),this._reader=Lk(e)?new yoe(this._handle=e):new mB(this._handle=e)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(e){return this.closed||(this.autoDestroy=vB(this,e),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(e):ar}return(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(e):ar}next(){if(this.closed)return ar;let e;const{_reader:n}=this;for(;e=this._readNextMessageAndValidate();)if(e.isSchema())this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;const r=e.header(),i=n.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;const r=e.header(),i=n.readMessageBody(e.bodyLength),s=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new H6(this.schema)}):this.return()}_readNextMessageAndValidate(e){return this._reader.readMessage(e)}}class o2 extends bB{constructor(e,n){super(n),this._reader=new goe(this._handle=e)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return dt(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(e){return dt(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=vB(this,e),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(e){return dt(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(e):ar})}return(e){return dt(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(e):ar})}next(){return dt(this,void 0,void 0,function*(){if(this.closed)return ar;let e;const{_reader:n}=this;for(;e=yield this._readNextMessageAndValidate();)if(e.isSchema())yield this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;const r=e.header(),i=yield n.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;const r=e.header(),i=yield n.readMessageBody(e.bodyLength),s=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new H6(this.schema)}):yield this.return()})}_readNextMessageAndValidate(e){return dt(this,void 0,void 0,function*(){return yield this._reader.readMessage(e)})}}class OB extends s2{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,n){super(e instanceof SD?e:new SD(e),n)}isSync(){return!0}isFile(){return!0}open(e){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const n of this._footer.dictionaryBatches())n&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(e)}readRecordBatch(e){var n;if(this.closed)return null;this._footer||this.open();const r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(e);if(r&&this._handle.seek(r.offset)){const i=this._reader.readMessage(Jt.RecordBatch);if(i?.isRecordBatch()){const s=i.header(),o=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null}_readDictionaryBatch(e){var n;const r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(e);if(r&&this._handle.seek(r.offset)){const i=this._reader.readMessage(Jt.DictionaryBatch);if(i?.isDictionaryBatch()){const s=i.header(),o=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}}_readFooter(){const{_handle:e}=this,n=e.size-gB,r=e.readInt32(n),i=e.readAt(n-r,r);return Kg.decode(i)}_readNextMessageAndValidate(e){var n;if(this._footer||this.open(),this._footer&&this._recordBatchIndexsuper.open}});return dt(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const r of this._footer.dictionaryBatches())r&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield n.open.call(this,e)})}readRecordBatch(e){return dt(this,void 0,void 0,function*(){var n;if(this.closed)return null;this._footer||(yield this.open());const r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(e);if(r&&(yield this._handle.seek(r.offset))){const i=yield this._reader.readMessage(Jt.RecordBatch);if(i?.isRecordBatch()){const s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null})}_readDictionaryBatch(e){return dt(this,void 0,void 0,function*(){var n;const r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(e);if(r&&(yield this._handle.seek(r.offset))){const i=yield this._reader.readMessage(Jt.DictionaryBatch);if(i?.isDictionaryBatch()){const s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}})}_readFooter(){return dt(this,void 0,void 0,function*(){const{_handle:e}=this;e._pending&&(yield e._pending);const n=e.size-gB,r=yield e.readInt32(n),i=yield e.readAt(n-r,r);return Kg.decode(i)})}_readNextMessageAndValidate(e){return dt(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex=4?eA(e)?new yB(new OB(t.read())):new r2(new s2(t)):new r2(new s2((function*(){})()))}function Soe(t){return dt(this,void 0,void 0,function*(){const e=yield t.peek(ay+7&-8);return e&&e.byteLength>=4?eA(e)?new yB(new OB(yield t.read())):new i2(new o2(t)):new i2(new o2((function(){return Ja(this,arguments,function*(){})})()))})}function koe(t){return dt(this,void 0,void 0,function*(){const{size:e}=yield t.stat(),n=new n2(t,e);return e>=boe&&eA(yield n.readAt(0,ay+7&-8))?new Ooe(new voe(n)):new i2(new o2(n))})}class cr extends Et{static assemble(...e){const n=i=>i.flatMap(s=>Array.isArray(s)?n(s):s instanceof hs?s.data.children:s.data),r=new cr;return r.visitMany(n(e)),r}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(e){if(e instanceof cn)return this.visitMany(e.data),this;const{type:n}=e;if(!Ue.isDictionary(n)){const{length:r}=e;if(r>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(Ue.isUnion(n))this.nodes.push(new Kc(r,0));else{const{nullCount:i}=e;Ue.isNull(n)||la.call(this,i<=0?new Uint8Array(0):Gv(e.offset,r,e.nullBitmap)),this.nodes.push(new Kc(r,i))}}return super.visit(e)}visitNull(e){return this}visitDictionary(e){return this.visit(e.clone(e.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}}function la(t){const e=t.byteLength+7&-8;return this.buffers.push(t),this.bufferRegions.push(new el(this._byteLength,e)),this._byteLength+=e,this}function Coe(t){var e;const{type:n,length:r,typeIds:i,valueOffsets:s}=t;if(la.call(this,i),n.mode===Ai.Sparse)return Wk.call(this,t);if(n.mode===Ai.Dense){if(t.offset<=0)return la.call(this,s),Wk.call(this,t);{const o=new Int32Array(r),a=Object.create(null),l=Object.create(null);for(let u,c,f=-1;++f{const f=n.typeIds[c],h=a[f],d=l[f];return u.slice(h,Math.min(r,d))}))}}return this}function Aoe(t){let e;return t.nullCount>=t.length?la.call(this,new Uint8Array(0)):(e=t.values)instanceof Uint8Array?la.call(this,Gv(t.offset,t.length,e)):la.call(this,Hv(t.values))}function Hu(t){return la.call(this,t.values.subarray(0,t.length*t.stride))}function Ex(t){const{length:e,values:n,valueOffsets:r}=t,i=En(r[0]),s=En(r[e]),o=Math.min(s-i,n.byteLength-i);return la.call(this,CN(-i,e+1,r)),la.call(this,n.subarray(i,i+o)),this}function tA(t){const{length:e,valueOffsets:n}=t;if(n){const{[0]:r,[e]:i}=n;return la.call(this,CN(-r,e+1,n)),this.visit(t.children[0].slice(r,i-r))}return this.visit(t.children[0])}function Wk(t){return this.visitMany(t.type.children.map((e,n)=>t.children[n]).filter(Boolean))[0]}cr.prototype.visitBool=Aoe;cr.prototype.visitInt=Hu;cr.prototype.visitFloat=Hu;cr.prototype.visitUtf8=Ex;cr.prototype.visitLargeUtf8=Ex;cr.prototype.visitBinary=Ex;cr.prototype.visitLargeBinary=Ex;cr.prototype.visitFixedSizeBinary=Hu;cr.prototype.visitDate=Hu;cr.prototype.visitTimestamp=Hu;cr.prototype.visitTime=Hu;cr.prototype.visitDecimal=Hu;cr.prototype.visitList=tA;cr.prototype.visitStruct=Wk;cr.prototype.visitUnion=Coe;cr.prototype.visitInterval=Hu;cr.prototype.visitDuration=Hu;cr.prototype.visitFixedSizeList=tA;cr.prototype.visitMap=tA;class wB extends Z6{static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,n){throw new Error('"throughDOM" not available in this environment')}constructor(e){super(),this._position=0,this._started=!1,this._sink=new vO,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,Cs(e)||(e={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof e.autoDestroy=="boolean"?e.autoDestroy:!0,this._writeLegacyIpcFormat=typeof e.writeLegacyIpcFormat=="boolean"?e.writeLegacyIpcFormat:!1}toString(e=!1){return this._sink.toString(e)}toUint8Array(e=!1){return this._sink.toUint8Array(e)}writeAll(e){return Rh(e)?e.then(n=>this.writeAll(n)):B0(e)?sA(this,e):iA(this,e)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(e){return this._sink.toDOMStream(e)}toNodeStream(e){return this._sink.toNodeStream(e)}close(){return this.reset()._sink.close()}abort(e){return this.reset()._sink.abort(e)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(e=this._sink,n=null){return e===this._sink||e instanceof vO?this._sink=e:(this._sink=new vO,e&&iie(e)?this.toDOMStream({type:"bytes"}).pipeTo(e):e&&sie(e)&&this.toNodeStream({objectMode:!1}).pipe(e)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!n||!Zk(n,this._schema))&&(n==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=n,this._writeSchema(n))),this}write(e){let n=null;if(this._sink){if(e==null)return this.finish()&&void 0;if(e instanceof Hc&&!(n=e.schema))return this.finish()&&void 0;if(e instanceof hs&&!(n=e.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(n&&!Zk(n,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,n)}e instanceof hs?e instanceof H6||this._writeRecordBatch(e):e instanceof Hc?this.writeAll(e.batches):ry(e)&&this.writeAll(e)}_writeMessage(e,n=8){const r=n-1,i=Vi.encode(e),s=i.byteLength,o=this._writeLegacyIpcFormat?4:8,a=s+o+r&~r,l=a-s-o;return e.headerType===Jt.RecordBatch?this._recordBatchBlocks.push(new Yc(a,e.bodyLength,this._position)):e.headerType===Jt.DictionaryBatch&&this._dictionaryBlocks.push(new Yc(a,e.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),s>0&&this._write(i),this._writePadding(l)}_write(e){if(this._started){const n=Lt(e);n&&n.byteLength>0&&(this._sink.write(n),this._position+=n.byteLength)}return this}_writeSchema(e){return this._writeMessage(Vi.from(e))}_writeFooter(e){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Jg)}_writePadding(e){return e>0?this._write(new Uint8Array(e)):this}_writeRecordBatch(e){const{byteLength:n,nodes:r,bufferRegions:i,buffers:s}=cr.assemble(e),o=new no(e.numRows,r,i),a=Vi.from(o,n);return this._writeDictionaries(e)._writeMessage(a)._writeBodyBuffers(s)}_writeDictionaryBatch(e,n,r=!1){const{byteLength:i,nodes:s,bufferRegions:o,buffers:a}=cr.assemble(new cn([e])),l=new no(e.length,s,o),u=new Sl(l,n,r),c=Vi.from(u,i);return this._writeMessage(c)._writeBodyBuffers(a)}_writeBodyBuffers(e){let n,r,i;for(let s=-1,o=e.length;++s0&&(this._write(n),(i=(r+7&-8)-r)>0&&this._writePadding(i));return this}_writeDictionaries(e){var n,r;for(const[i,s]of e.dictionaries){const o=(n=s?.data)!==null&&n!==void 0?n:[],a=this._seenDictionaries.get(i),l=(r=this._dictionaryDeltaOffsets.get(i))!==null&&r!==void 0?r:0;if(!a||a.data[0]!==o[0])for(const[u,c]of o.entries())this._writeDictionaryBatch(c,i,u>0);else if(lr.writeAll(i)):B0(e)?sA(r,e):iA(r,e)}}class rA extends wB{static writeAll(e){const n=new rA;return Rh(e)?e.then(r=>n.writeAll(r)):B0(e)?sA(n,e):iA(n,e)}constructor(){super(),this._autoDestroy=!0}_writeSchema(e){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(e,n,r=!1){if(!r&&this._seenDictionaries.has(n))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(e,n,r)}_writeFooter(e){const n=Kg.encode(new Kg(e,yr.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(e)._write(n)._write(Int32Array.of(n.byteLength))._writeMagic()}}function iA(t,e){let n=e;e instanceof Hc&&(n=e.batches,t.reset(void 0,e.schema));for(const r of n)t.write(r);return t.finish()}function sA(t,e){return dt(this,void 0,void 0,function*(){var n,r,i,s,o,a,l;try{for(n=!0,r=dh(e);i=yield r.next(),s=i.done,!s;n=!0){l=i.value,n=!1;const u=l;t.write(u)}}catch(u){o={error:u}}finally{try{!n&&!s&&(a=r.return)&&(yield a.call(r))}finally{if(o)throw o.error}}return t.finish()})}function Eoe(t,e="stream"){return(e==="stream"?nA:rA).writeAll(t).toUint8Array(!0)}var Toe=Object.create,xB=Object.defineProperty,Doe=Object.getOwnPropertyDescriptor,Poe=Object.getOwnPropertyNames,Roe=Object.getPrototypeOf,Ioe=Object.prototype.hasOwnProperty,Foe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),$oe=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Poe(e))!Ioe.call(t,i)&&i!==n&&xB(t,i,{get:()=>e[i],enumerable:!(r=Doe(e,i))||r.enumerable});return t},Moe=(t,e,n)=>(n=t!=null?Toe(Roe(t)):{},$oe(!t||!t.__esModule?xB(n,"default",{value:t,enumerable:!0}):n,t)),Loe=Foe((t,e)=>{e.exports=Worker}),Noe=(t=>(t[t.UNDEFINED=0]="UNDEFINED",t[t.AUTOMATIC=1]="AUTOMATIC",t[t.READ_ONLY=2]="READ_ONLY",t[t.READ_WRITE=3]="READ_WRITE",t))(Noe||{}),Qoe=(t=>(t[t.IDENTIFIER=0]="IDENTIFIER",t[t.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",t[t.STRING_CONSTANT=2]="STRING_CONSTANT",t[t.OPERATOR=3]="OPERATOR",t[t.KEYWORD=4]="KEYWORD",t[t.COMMENT=5]="COMMENT",t))(Qoe||{}),Boe=(t=>(t[t.NONE=0]="NONE",t[t.DEBUG=1]="DEBUG",t[t.INFO=2]="INFO",t[t.WARNING=3]="WARNING",t[t.ERROR=4]="ERROR",t))(Boe||{}),zoe=(t=>(t[t.NONE=0]="NONE",t[t.CONNECT=1]="CONNECT",t[t.DISCONNECT=2]="DISCONNECT",t[t.OPEN=3]="OPEN",t[t.QUERY=4]="QUERY",t[t.INSTANTIATE=5]="INSTANTIATE",t))(zoe||{}),Uoe=(t=>(t[t.NONE=0]="NONE",t[t.OK=1]="OK",t[t.ERROR=2]="ERROR",t[t.START=3]="START",t[t.RUN=4]="RUN",t[t.CAPTURE=5]="CAPTURE",t))(Uoe||{}),joe=(t=>(t[t.NONE=0]="NONE",t[t.WEB_WORKER=1]="WEB_WORKER",t[t.NODE_WORKER=2]="NODE_WORKER",t[t.BINDINGS=3]="BINDINGS",t[t.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",t))(joe||{}),_B=class{log(e){}},SB=class{constructor(e=2){this.level=e}log(e){e.level>=this.level&&console.log(e)}},qoe=(t=>(t[t.SUCCESS=0]="SUCCESS",t[t.MAX_ARROW_ERROR=255]="MAX_ARROW_ERROR",t[t.DUCKDB_WASM_RETRY=256]="DUCKDB_WASM_RETRY",t))(qoe||{}),Voe=class{constructor(e,n){this._bindings=e,this._conn=n}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(e){return e(this._bindings,this._conn)}async query(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let n=await this._bindings.runQuery(this._conn,e),r=So.from(n);return console.assert(r.isSync(),"Reader is not sync"),console.assert(r.isFile(),"Reader is not file"),new Hc(r)}async send(e,n=!1){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let r=await this._bindings.startPendingQuery(this._conn,e,n);for(;r==null;)r=await this._bindings.pollPendingQuery(this._conn);let i=new kB(this._bindings,this._conn,r),s=await So.from(i);return console.assert(s.isAsync()),console.assert(s.isStream()),s}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(e){return await this._bindings.getTableNames(this._conn,e)}async prepare(e){let n=await this._bindings.createPrepared(this._conn,e);return new Zoe(this._bindings,this._conn,n)}async insertArrowTable(e,n){let r=Eoe(e,"stream");await this.insertArrowFromIPCStream(r,n)}async insertArrowFromIPCStream(e,n){await this._bindings.insertArrowFromIPCStream(this._conn,e,n)}async insertCSVFromPath(e,n){await this._bindings.insertCSVFromPath(this._conn,e,n)}async insertJSONFromPath(e,n){await this._bindings.insertJSONFromPath(this._conn,e,n)}},kB=class{constructor(e,n,r){this.db=e,this.conn=n,this.header=r,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let e=null;for(this._inFlight!=null&&(e=await this._inFlight,this._inFlight=null);e==null;)e=await this.db.fetchQueryResults(this.conn);return this._depleted=e.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:e}}[Symbol.asyncIterator](){return this}},Zoe=class{constructor(e,n,r){this.bindings=e,this.connectionId=n,this.statementId=r}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...e){let n=await this.bindings.runPrepared(this.connectionId,this.statementId,e),r=So.from(n);return console.assert(r.isSync()),console.assert(r.isFile()),new Hc(r)}async send(...e){let n=await this.bindings.sendPrepared(this.connectionId,this.statementId,e),r=new kB(this.bindings,this.connectionId,n),i=await So.from(r);return console.assert(i.isAsync()),console.assert(i.isStream()),i}},Xoe=(t=>(t.CANCEL_PENDING_QUERY="CANCEL_PENDING_QUERY",t.CLOSE_PREPARED="CLOSE_PREPARED",t.COLLECT_FILE_STATISTICS="COLLECT_FILE_STATISTICS",t.REGISTER_OPFS_FILE_NAME="REGISTER_OPFS_FILE_NAME",t.CONNECT="CONNECT",t.COPY_FILE_TO_BUFFER="COPY_FILE_TO_BUFFER",t.COPY_FILE_TO_PATH="COPY_FILE_TO_PATH",t.CREATE_PREPARED="CREATE_PREPARED",t.DISCONNECT="DISCONNECT",t.DROP_FILE="DROP_FILE",t.DROP_FILES="DROP_FILES",t.EXPORT_FILE_STATISTICS="EXPORT_FILE_STATISTICS",t.FETCH_QUERY_RESULTS="FETCH_QUERY_RESULTS",t.FLUSH_FILES="FLUSH_FILES",t.GET_FEATURE_FLAGS="GET_FEATURE_FLAGS",t.GET_TABLE_NAMES="GET_TABLE_NAMES",t.GET_VERSION="GET_VERSION",t.GLOB_FILE_INFOS="GLOB_FILE_INFOS",t.INSERT_ARROW_FROM_IPC_STREAM="INSERT_ARROW_FROM_IPC_STREAM",t.INSERT_CSV_FROM_PATH="IMPORT_CSV_FROM_PATH",t.INSERT_JSON_FROM_PATH="IMPORT_JSON_FROM_PATH",t.INSTANTIATE="INSTANTIATE",t.OPEN="OPEN",t.PING="PING",t.POLL_PENDING_QUERY="POLL_PENDING_QUERY",t.REGISTER_FILE_BUFFER="REGISTER_FILE_BUFFER",t.REGISTER_FILE_HANDLE="REGISTER_FILE_HANDLE",t.REGISTER_FILE_URL="REGISTER_FILE_URL",t.RESET="RESET",t.RUN_PREPARED="RUN_PREPARED",t.RUN_QUERY="RUN_QUERY",t.SEND_PREPARED="SEND_PREPARED",t.START_PENDING_QUERY="START_PENDING_QUERY",t.TOKENIZE="TOKENIZE",t))(Xoe||{}),Woe=(t=>(t.CONNECTION_INFO="CONNECTION_INFO",t.ERROR="ERROR",t.FEATURE_FLAGS="FEATURE_FLAGS",t.FILE_BUFFER="FILE_BUFFER",t.FILE_INFOS="FILE_INFOS",t.FILE_SIZE="FILE_SIZE",t.FILE_STATISTICS="FILE_STATISTICS",t.INSTANTIATE_PROGRESS="INSTANTIATE_PROGRESS",t.LOG="LOG",t.PROGRESS_UPDATE="PROGRESS_UPDATE",t.OK="OK",t.PREPARED_STATEMENT_ID="PREPARED_STATEMENT_ID",t.QUERY_PLAN="QUERY_PLAN",t.QUERY_RESULT="QUERY_RESULT",t.QUERY_RESULT_CHUNK="QUERY_RESULT_CHUNK",t.QUERY_RESULT_HEADER="QUERY_RESULT_HEADER",t.QUERY_RESULT_HEADER_OR_NULL="QUERY_RESULT_HEADER_OR_NULL",t.REGISTERED_FILE="REGISTERED_FILE",t.SCRIPT_TOKENS="SCRIPT_TOKENS",t.SUCCESS="SUCCESS",t.TABLE_NAMES="TABLE_NAMES",t.VERSION_STRING="VERSION_STRING",t))(Woe||{}),zt=class{constructor(e,n){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=e,this.data=n,this.promise=new Promise((r,i)=>{this.promiseResolver=r,this.promiseRejecter=i})}};function _O(t){switch(t.typeId){case U.Binary:return{sqlType:"binary"};case U.Bool:return{sqlType:"bool"};case U.Date:return{sqlType:"date"};case U.DateDay:return{sqlType:"date32[d]"};case U.DateMillisecond:return{sqlType:"date64[ms]"};case U.Decimal:{let e=t;return{sqlType:"decimal",precision:e.precision,scale:e.scale}}case U.Float:return{sqlType:"float"};case U.Float16:return{sqlType:"float16"};case U.Float32:return{sqlType:"float32"};case U.Float64:return{sqlType:"float64"};case U.Int:return{sqlType:"int32"};case U.Int16:return{sqlType:"int16"};case U.Int32:return{sqlType:"int32"};case U.Int64:return{sqlType:"int64"};case U.Uint16:return{sqlType:"uint16"};case U.Uint32:return{sqlType:"uint32"};case U.Uint64:return{sqlType:"uint64"};case U.Uint8:return{sqlType:"uint8"};case U.IntervalDayTime:return{sqlType:"interval[dt]"};case U.IntervalYearMonth:return{sqlType:"interval[m]"};case U.List:return{sqlType:"list",valueType:_O(t.valueType)};case U.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:t.byteWidth};case U.Null:return{sqlType:"null"};case U.Utf8:return{sqlType:"utf8"};case U.Struct:return{sqlType:"struct",fields:t.children.map(e=>Yk(e.name,e.type))};case U.Map:{let e=t;return{sqlType:"map",keyType:_O(e.keyType),valueType:_O(e.valueType)}}case U.Time:return{sqlType:"time[s]"};case U.TimeMicrosecond:return{sqlType:"time[us]"};case U.TimeMillisecond:return{sqlType:"time[ms]"};case U.TimeNanosecond:return{sqlType:"time[ns]"};case U.TimeSecond:return{sqlType:"time[s]"};case U.Timestamp:return{sqlType:"timestamp",timezone:t.timezone||void 0};case U.TimestampSecond:return{sqlType:"timestamp[s]",timezone:t.timezone||void 0};case U.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:t.timezone||void 0};case U.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:t.timezone||void 0};case U.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:t.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(t.toString()))}function Yk(t,e){let n=_O(e);return n.name=t,n}var Yoe=new TextEncoder,CB=class{constructor(t,e=null){this._onInstantiationProgress=[],this._onExecutionProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._logger=t,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),e!=null&&this.attach(e)}get logger(){return this._logger}attach(t){this._worker=t,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise((e,n)=>{this._workerShutdownResolver=e})}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(t,e=[]){if(!this._worker){console.error("cannot send a message since the worker is not set!");return}let n=this._nextMessageId++;return this._pendingRequests.set(n,t),this._worker.postMessage({messageId:n,type:t.type,data:t.data},e),await t.promise}onMessage(t){var e;let n=t.data;switch(n.type){case"PROGRESS_UPDATE":{for(let i of this._onExecutionProgress)i(n.data);return}case"LOG":{this._logger.log(n.data);return}case"INSTANTIATE_PROGRESS":{for(let i of this._onInstantiationProgress)i(n.data);return}}let r=this._pendingRequests.get(n.requestId);if(!r){console.warn("unassociated response: [".concat(n.requestId,", ").concat(n.type.toString(),"]"));return}if(this._pendingRequests.delete(n.requestId),n.type=="ERROR"){let i=new Error(n.data.message);i.name=n.data.name,(e=Object.getOwnPropertyDescriptor(i,"stack"))!=null&&e.writable&&(i.stack=n.data.stack),r.promiseRejecter(i);return}switch(r.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"REGISTER_OPFS_FILE_NAME":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if(n.type=="OK"){r.promiseResolver(n.data);return}break;case"INSTANTIATE":if(this._onInstantiationProgress=[],n.type=="OK"){r.promiseResolver(n.data);return}break;case"GLOB_FILE_INFOS":if(n.type=="FILE_INFOS"){r.promiseResolver(n.data);return}break;case"GET_VERSION":if(n.type=="VERSION_STRING"){r.promiseResolver(n.data);return}break;case"GET_FEATURE_FLAGS":if(n.type=="FEATURE_FLAGS"){r.promiseResolver(n.data);return}break;case"GET_TABLE_NAMES":if(n.type=="TABLE_NAMES"){r.promiseResolver(n.data);return}break;case"TOKENIZE":if(n.type=="SCRIPT_TOKENS"){r.promiseResolver(n.data);return}break;case"COPY_FILE_TO_BUFFER":if(n.type=="FILE_BUFFER"){r.promiseResolver(n.data);return}break;case"EXPORT_FILE_STATISTICS":if(n.type=="FILE_STATISTICS"){r.promiseResolver(n.data);return}break;case"CONNECT":if(n.type=="CONNECTION_INFO"){r.promiseResolver(n.data);return}break;case"RUN_PREPARED":case"RUN_QUERY":if(n.type=="QUERY_RESULT"){r.promiseResolver(n.data);return}break;case"SEND_PREPARED":if(n.type=="QUERY_RESULT_HEADER"){r.promiseResolver(n.data);return}break;case"START_PENDING_QUERY":if(n.type=="QUERY_RESULT_HEADER_OR_NULL"){r.promiseResolver(n.data);return}break;case"POLL_PENDING_QUERY":if(n.type=="QUERY_RESULT_HEADER_OR_NULL"){r.promiseResolver(n.data);return}break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],n.type=="SUCCESS"){r.promiseResolver(n.data);return}break;case"FETCH_QUERY_RESULTS":if(n.type=="QUERY_RESULT_CHUNK"){r.promiseResolver(n.data);return}break;case"CREATE_PREPARED":if(n.type=="PREPARED_STATEMENT_ID"){r.promiseResolver(n.data);return}break}r.promiseRejecter(new Error("unexpected response type: ".concat(n.type.toString())))}onError(t){console.error(t),console.error("error in duckdb worker: ".concat(t.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));return}this._pendingRequests.clear()}async reset(){let t=new zt("RESET",null);return await this.postTask(t)}async ping(){let t=new zt("PING",null);await this.postTask(t)}async dropFile(t){let e=new zt("DROP_FILE",t);return await this.postTask(e)}async dropFiles(){let t=new zt("DROP_FILES",null);return await this.postTask(t)}async flushFiles(){let t=new zt("FLUSH_FILES",null);return await this.postTask(t)}async instantiate(t,e=null,n=r=>{}){this._onInstantiationProgress.push(n);let r=new zt("INSTANTIATE",[t,e]);return await this.postTask(r)}async getVersion(){let t=new zt("GET_VERSION",null);return await this.postTask(t)}async getFeatureFlags(){let t=new zt("GET_FEATURE_FLAGS",null);return await this.postTask(t)}async open(t){let e=new zt("OPEN",t);await this.postTask(e)}async tokenize(t){let e=new zt("TOKENIZE",t);return await this.postTask(e)}async connectInternal(){let t=new zt("CONNECT",null);return await this.postTask(t)}async connect(){let t=await this.connectInternal();return new Voe(this,t)}async disconnect(t){let e=new zt("DISCONNECT",t);await this.postTask(e)}async runQuery(t,e){let n=new zt("RUN_QUERY",[t,e]);return await this.postTask(n)}async startPendingQuery(t,e,n=!1){let r=new zt("START_PENDING_QUERY",[t,e,n]);return await this.postTask(r)}async pollPendingQuery(t){let e=new zt("POLL_PENDING_QUERY",t);return await this.postTask(e)}async cancelPendingQuery(t){let e=new zt("CANCEL_PENDING_QUERY",t);return await this.postTask(e)}async fetchQueryResults(t){let e=new zt("FETCH_QUERY_RESULTS",t);return await this.postTask(e)}async getTableNames(t,e){let n=new zt("GET_TABLE_NAMES",[t,e]);return await this.postTask(n)}async createPrepared(t,e){let n=new zt("CREATE_PREPARED",[t,e]);return await this.postTask(n)}async closePrepared(t,e){let n=new zt("CLOSE_PREPARED",[t,e]);await this.postTask(n)}async runPrepared(t,e,n){let r=new zt("RUN_PREPARED",[t,e,n]);return await this.postTask(r)}async sendPrepared(t,e,n){let r=new zt("SEND_PREPARED",[t,e,n]);return await this.postTask(r)}async globFiles(t){let e=new zt("GLOB_FILE_INFOS",t);return await this.postTask(e)}async registerFileText(t,e){let n=Yoe.encode(e);await this.registerFileBuffer(t,n)}async registerFileURL(t,e,n,r){e===void 0&&(e=t);let i=new zt("REGISTER_FILE_URL",[t,e,n,r]);await this.postTask(i)}async registerEmptyFileBuffer(t){}async registerFileBuffer(t,e){let n=new zt("REGISTER_FILE_BUFFER",[t,e]);await this.postTask(n,[e.buffer])}async registerFileHandle(t,e,n,r){let i=new zt("REGISTER_FILE_HANDLE",[t,e,n,r]);await this.postTask(i,[])}async registerOPFSFileName(t){let e=new zt("REGISTER_OPFS_FILE_NAME",[t]);await this.postTask(e,[])}async collectFileStatistics(t,e){let n=new zt("COLLECT_FILE_STATISTICS",[t,e]);await this.postTask(n,[])}async exportFileStatistics(t){let e=new zt("EXPORT_FILE_STATISTICS",t);return await this.postTask(e,[])}async copyFileToBuffer(t){let e=new zt("COPY_FILE_TO_BUFFER",t);return await this.postTask(e)}async copyFileToPath(t,e){let n=new zt("COPY_FILE_TO_PATH",[t,e]);await this.postTask(n)}async insertArrowFromIPCStream(t,e,n){if(e.length==0)return;let r=new zt("INSERT_ARROW_FROM_IPC_STREAM",[t,e,n]);await this.postTask(r,[e.buffer])}async insertCSVFromPath(t,e,n){if(n.columns!==void 0){let i=[];for(let s in n.columns){let o=n.columns[s];i.push(Yk(s,o))}n.columnsFlat=i,delete n.columns}let r=new zt("IMPORT_CSV_FROM_PATH",[t,e,n]);await this.postTask(r)}async insertJSONFromPath(t,e,n){if(n.columns!==void 0){let i=[];for(let s in n.columns){let o=n.columns[s];i.push(Yk(s,o))}n.columnsFlat=i,delete n.columns}let r=new zt("IMPORT_JSON_FROM_PATH",[t,e,n]);await this.postTask(r)}};function Goe(){let t=new TextDecoder;return e=>(typeof SharedArrayBuffer<"u"&&e.buffer instanceof SharedArrayBuffer&&(e=new Uint8Array(e)),t.decode(e))}Goe();var Hoe=(t=>(t[t.BUFFER=0]="BUFFER",t[t.NODE_FS=1]="NODE_FS",t[t.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",t[t.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",t[t.HTTP=4]="HTTP",t[t.S3=5]="S3",t))(Hoe||{}),Koe=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),Joe=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),eae=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),tae=()=>(async t=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(t)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),oA={name:"@duckdb/duckdb-wasm",version:"1.30.0"},nae=oA.name,rae=oA.version,aA=oA.version.split(".");aA[0];aA[1];aA[2];var iae=()=>typeof navigator>"u";function sae(){let t="https://cdn.jsdelivr.net/npm/".concat(nae,"@").concat(rae,"/dist/");return{mvp:{mainModule:"".concat(t,"duckdb-mvp.wasm"),mainWorker:"".concat(t,"duckdb-browser-mvp.worker.js")},eh:{mainModule:"".concat(t,"duckdb-eh.wasm"),mainWorker:"".concat(t,"duckdb-browser-eh.worker.js")}}}var fS=null,hS=null,dS=null,pS=null,mS=null;async function oae(){return fS==null&&(fS=typeof BigInt64Array<"u"),hS==null&&(hS=await Joe()),dS==null&&(dS=await tae()),pS==null&&(pS=await eae()),mS==null&&(mS=await Koe()),{bigInt64Array:fS,crossOriginIsolated:iae()||globalThis.crossOriginIsolated||!1,wasmExceptions:hS,wasmSIMD:pS,wasmThreads:dS,wasmBulkMemory:mS}}async function AB(t){let e=await oae();if(e.wasmExceptions){if(e.wasmSIMD&&e.wasmThreads&&e.crossOriginIsolated&&t.coi)return{mainModule:t.coi.mainModule,mainWorker:t.coi.mainWorker,pthreadWorker:t.coi.pthreadWorker};if(t.eh)return{mainModule:t.eh.mainModule,mainWorker:t.eh.mainWorker,pthreadWorker:null}}return{mainModule:t.mvp.mainModule,mainWorker:t.mvp.mainWorker,pthreadWorker:null}}Moe(Loe());function aae(t={}){return new lae(t)}class lae{_ipc;_options;_db;_con;_config;_loadPromise;constructor(e={}){const{ipc:n,duckdb:r,connection:i,config:s,...o}=e;this._ipc=n,this._options=o,this._db=r,this._con=i,this._config=s}async getDuckDB(){return this._db||await FD(this),this._db}async getConnection(){return this._con||await FD(this),this._con}async query(e){const{type:n,sql:r}=e,i=await this.getConnection(),s=await uae(i,r);return n==="exec"?void 0:n==="arrow"?Sv(s,this._ipc):Sv(s).toArray()}}function uae(t,e){return new Promise((n,r)=>{t.useUnsafe(async(i,s)=>{try{const o=await i.runQuery(s,e);n(o)}catch(o){r(o)}})})}function FD(t){return t._loadPromise||(t._loadPromise=(t._db?Promise.resolve(t._db):cae(t._options).then(e=>t._db=e)).then(e=>t._config!=null?e.open(t._config).then(()=>e):e).then(e=>e.connect()).then(e=>t._con=e)),t._loadPromise}async function cae({log:t=!1}={}){const e=sae(),n=await AB(e),r=URL.createObjectURL(new Blob([`importScripts("${n.mainWorker}");`],{type:"text/javascript"})),i=new Worker(r),s=t?new SB:new _B,o=new CB(s,i);return await o.instantiate(n.mainModule,n.pthreadWorker),URL.revokeObjectURL(r),o}const fae=t=>t;function EB(t){const e=t-1;return e*e*e+1}function TB(t,{delay:e=0,duration:n=400,easing:r=fae}={}){const i=+getComputedStyle(t).opacity;return{delay:e,duration:n,easing:r,css:s=>`opacity: ${s*i}`}}function eg(t,{delay:e=0,duration:n=400,easing:r=EB,axis:i="y"}={}){const s=getComputedStyle(t),o=+s.opacity,a=i==="y"?"height":"width",l=parseFloat(s[a]),u=i==="y"?["top","bottom"]:["left","right"],c=u.map(y=>`${y[0].toUpperCase()}${y.slice(1)}`),f=parseFloat(s[`padding${c[0]}`]),h=parseFloat(s[`padding${c[1]}`]),d=parseFloat(s[`margin${c[0]}`]),p=parseFloat(s[`margin${c[1]}`]),m=parseFloat(s[`border${c[0]}Width`]),g=parseFloat(s[`border${c[1]}Width`]);return{delay:e,duration:n,easing:r,css:y=>`overflow: hidden;opacity: ${Math.min(y*20,1)*o};${a}: ${y*l}px;padding-${u[0]}: ${y*f}px;padding-${u[1]}: ${y*h}px;margin-${u[0]}: ${y*d}px;margin-${u[1]}: ${y*p}px;border-${u[0]}-width: ${y*m}px;border-${u[1]}-width: ${y*g}px;min-${a}: 0`}}function hae(t,{delay:e=0,duration:n=400,easing:r=EB,start:i=0,opacity:s=0}={}){const o=getComputedStyle(t),a=+o.opacity,l=o.transform==="none"?"":o.transform,u=1-i,c=a*(1-s);return{delay:e,duration:n,easing:r,css:(f,h)=>` transform: ${l} scale(${1-u*h}); opacity: ${a-c*h} `}}var dae=G("");function lA(t,e){De(e,!0);var n=dae();n.__click=()=>{e.disabled||e.onClick?.()};var r=M(n,!0);F(n),de(()=>{Qt(n,1,`px-2 h-8 w-24 rounded-md text-white text-sm select-none ${e.disabled?"bg-gray-300 dark:text-gray-500 dark:bg-gray-700":"bg-blue-500"}`),n.disabled=e.disabled,ut(r,e.label)}),I(t,n),Pe()}dn(["click"]);var pae=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,mae=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,gae=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,gS={Space_Separator:pae,ID_Start:mae,ID_Continue:gae},mr={isSpaceSeparator(t){return typeof t=="string"&&gS.Space_Separator.test(t)},isIdStartChar(t){return typeof t=="string"&&(t>="a"&&t<="z"||t>="A"&&t<="Z"||t==="$"||t==="_"||gS.ID_Start.test(t))},isIdContinueChar(t){return typeof t=="string"&&(t>="a"&&t<="z"||t>="A"&&t<="Z"||t>="0"&&t<="9"||t==="$"||t==="_"||t==="‌"||t==="‍"||gS.ID_Continue.test(t))},isDigit(t){return typeof t=="string"&&/[0-9]/.test(t)},isHexDigit(t){return typeof t=="string"&&/[0-9A-Fa-f]/.test(t)}};let Gk,Zi,pu,a2,Jc,ua,Zr,uA,wg;var yae=function(e,n){Gk=String(e),Zi="start",pu=[],a2=0,Jc=1,ua=0,Zr=void 0,uA=void 0,wg=void 0;do Zr=bae(),wae[Zi]();while(Zr.type!=="eof");return typeof n=="function"?Hk({"":wg},"",n):wg};function Hk(t,e,n){const r=t[e];if(r!=null&&typeof r=="object")if(Array.isArray(r))for(let i=0;i0;){const n=Tu();if(!mr.isHexDigit(n))throw jn(ce());t+=ce()}return String.fromCodePoint(parseInt(t,16))}const wae={start(){if(Zr.type==="eof")throw kf();yS()},beforePropertyName(){switch(Zr.type){case"identifier":case"string":uA=Zr.value,Zi="afterPropertyName";return;case"punctuator":Jy();return;case"eof":throw kf()}},afterPropertyName(){if(Zr.type==="eof")throw kf();Zi="beforePropertyValue"},beforePropertyValue(){if(Zr.type==="eof")throw kf();yS()},beforeArrayValue(){if(Zr.type==="eof")throw kf();if(Zr.type==="punctuator"&&Zr.value==="]"){Jy();return}yS()},afterPropertyValue(){if(Zr.type==="eof")throw kf();switch(Zr.value){case",":Zi="beforePropertyName";return;case"}":Jy()}},afterArrayValue(){if(Zr.type==="eof")throw kf();switch(Zr.value){case",":Zi="beforeArrayValue";return;case"]":Jy()}},end(){}};function yS(){let t;switch(Zr.type){case"punctuator":switch(Zr.value){case"{":t={};break;case"[":t=[];break}break;case"null":case"boolean":case"numeric":case"string":t=Zr.value;break}if(wg===void 0)wg=t;else{const e=pu[pu.length-1];Array.isArray(e)?e.push(t):Object.defineProperty(e,uA,{value:t,writable:!0,enumerable:!0,configurable:!0})}if(t!==null&&typeof t=="object")pu.push(t),Array.isArray(t)?Zi="beforeArrayValue":Zi="beforePropertyName";else{const e=pu[pu.length-1];e==null?Zi="end":Array.isArray(e)?Zi="afterArrayValue":Zi="afterPropertyValue"}}function Jy(){pu.pop();const t=pu[pu.length-1];t==null?Zi="end":Array.isArray(t)?Zi="afterArrayValue":Zi="afterPropertyValue"}function jn(t){return l2(t===void 0?`JSON5: invalid end of input at ${Jc}:${ua}`:`JSON5: invalid character '${PB(t)}' at ${Jc}:${ua}`)}function kf(){return l2(`JSON5: invalid end of input at ${Jc}:${ua}`)}function $D(){return ua-=5,l2(`JSON5: invalid identifier character at ${Jc}:${ua}`)}function xae(t){console.warn(`JSON5: '${PB(t)}' in strings is not valid ECMAScript; consider escaping`)}function PB(t){const e={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(e[t])return e[t];if(t<" "){const n=t.charCodeAt(0).toString(16);return"\\x"+("00"+n).substring(n.length)}return t}function l2(t){const e=new SyntaxError(t);return e.lineNumber=Jc,e.columnNumber=ua,e}var _ae=function(e,n,r){const i=[];let s="",o,a,l="",u;if(n!=null&&typeof n=="object"&&!Array.isArray(n)&&(r=n.space,u=n.quote,n=n.replacer),typeof n=="function")a=n;else if(Array.isArray(n)){o=[];for(const m of n){let g;typeof m=="string"?g=m:(typeof m=="number"||m instanceof String||m instanceof Number)&&(g=String(m)),g!==void 0&&o.indexOf(g)<0&&o.push(g)}}return r instanceof Number?r=Number(r):r instanceof String&&(r=String(r)),typeof r=="number"?r>0&&(r=Math.min(10,Math.floor(r)),l=" ".substr(0,r)):typeof r=="string"&&(l=r.substr(0,10)),c("",{"":e});function c(m,g){let y=g[m];switch(y!=null&&(typeof y.toJSON5=="function"?y=y.toJSON5(m):typeof y.toJSON=="function"&&(y=y.toJSON(m))),a&&(y=a.call(g,m,y)),y instanceof Number?y=Number(y):y instanceof String?y=String(y):y instanceof Boolean&&(y=y.valueOf()),y){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof y=="string")return f(y);if(typeof y=="number")return String(y);if(typeof y=="object")return Array.isArray(y)?p(y):h(y)}function f(m){const g={"'":.1,'"':.2},y={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};let O="";for(let w=0;wg[w]=0)throw TypeError("Converting circular structure to JSON5");i.push(m);let g=s;s=s+l;let y=o||Object.keys(m),O=[];for(const w of y){const x=c(w,m);if(x!==void 0){let S=d(w)+":";l!==""&&(S+=" "),S+=x,O.push(S)}}let v;if(O.length===0)v="{}";else{let w;if(l==="")w=O.join(","),v="{"+w+"}";else{let x=`, `+s;w=O.join(x),v=`{ `+s+w+`, `+g+"}"}}return i.pop(),s=g,v}function d(m){if(m.length===0)return f(m);const g=String.fromCodePoint(m.codePointAt(0));if(!mr.isIdStartChar(g))return f(m);for(let y=g.length;y=0)throw TypeError("Converting circular structure to JSON5");i.push(m);let g=s;s=s+l;let y=[];for(let v=0;v{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e>1;if(t=RB[r])e=r+1;else return!0;if(e==n)return!1}}function MD(t){return t>=127462&&t<=127487}const LD=8205;function Cae(t,e,n=!0,r=!0){return(n?IB:Aae)(t,e,r)}function IB(t,e,n){if(e==t.length)return e;e&&FB(t.charCodeAt(e))&&$B(t.charCodeAt(e-1))&&e--;let r=bS(t,e);for(e+=ND(r);e=0&&MD(bS(t,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function Aae(t,e,n){for(;e>0;){let r=IB(t,e-2,n);if(r=56320&&t<57344}function $B(t){return t>=55296&&t<56320}function ND(t){return t<65536?1:2}let en=class MB{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=e0(this,e,n);let i=[];return this.decompose(0,e,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),Wa.from(i,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=e0(this,e,n);let r=[];return this.decompose(e,n,r,0),Wa.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),i=new xg(this),s=new xg(e);for(let o=n,a=n;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(a+=i.value.length,i.done||a>=r)return!0}}iter(e=1){return new xg(this,e)}iterRange(e,n=this.length){return new LB(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(e).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new NB(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?MB.empty:e.length<=32?new gr(e):Wa.from(gr.split(e,[]))}};class gr extends en{constructor(e,n=Eae(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.text[s],a=i+o.length;if((n?r:a)>=e)return new Tae(i,a,r,o);i=a+1,r++}}decompose(e,n,r,i){let s=e<=0&&n>=this.length?this:new gr(QD(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(i&1){let o=r.pop(),a=SO(s.text,o.text.slice(),0,s.length);if(a.length<=32)r.push(new gr(a,o.length+s.length));else{let l=a.length>>1;r.push(new gr(a.slice(0,l)),new gr(a.slice(l)))}}else r.push(s)}replace(e,n,r){if(!(r instanceof gr))return super.replace(e,n,r);[e,n]=e0(this,e,n);let i=SO(this.text,SO(r.text,QD(this.text,0,e)),n),s=this.length+r.length-(n-e);return i.length<=32?new gr(i,s):Wa.from(gr.split(i,[]),s)}sliceString(e,n=this.length,r=` `){[e,n]=e0(this,e,n);let i="";for(let s=0,o=0;s<=n&&oe&&o&&(i+=r),es&&(i+=a.slice(Math.max(0,e-s),n-s)),s=l+1}return i}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],i=-1;for(let s of e)r.push(s),i+=s.length+1,r.length==32&&(n.push(new gr(r,i)),r=[],i=-1);return i>-1&&n.push(new gr(r,i)),n}}class Wa extends en{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,i){for(let s=0;;s++){let o=this.children[s],a=i+o.length,l=r+o.lines-1;if((n?l:a)>=e)return o.lineInner(e,n,r,i);i=a+1,r=l+1}}decompose(e,n,r,i){for(let s=0,o=0;o<=n&&s=o){let u=i&((o<=e?1:0)|(l>=n?2:0));o>=e&&l<=n&&!u?r.push(a):a.decompose(e-o,n-o,r,u)}o=l+1}}replace(e,n,r){if([e,n]=e0(this,e,n),r.lines=s&&n<=a){let l=o.replace(e-s,n-s,r),u=this.lines-o.lines+l.lines;if(l.lines>4&&l.lines>u>>6){let c=this.children.slice();return c[i]=l,new Wa(c,this.length-(n-e)+r.length)}return super.replace(s,a,l)}s=a+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=` `){[e,n]=e0(this,e,n);let i="";for(let s=0,o=0;se&&s&&(i+=r),eo&&(i+=a.sliceString(e-o,n-o,r)),o=l+1}return i}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof Wa))return 0;let r=0,[i,s,o,a]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=n,s+=n){if(i==o||s==a)return r;let l=this.children[i],u=e.children[s];if(l!=u)return r+l.scanIdentical(u,n);r+=l.length+1}}static from(e,n=e.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let d of e)r+=d.lines;if(r<32){let d=[];for(let p of e)p.flatten(d);return new gr(d,n)}let i=Math.max(32,r>>5),s=i<<1,o=i>>1,a=[],l=0,u=-1,c=[];function f(d){let p;if(d.lines>s&&d instanceof Wa)for(let m of d.children)f(m);else d.lines>o&&(l>o||!l)?(h(),a.push(d)):d instanceof gr&&l&&(p=c[c.length-1])instanceof gr&&d.lines+p.lines<=32?(l+=d.lines,u+=d.length+1,c[c.length-1]=new gr(p.text.concat(d.text),p.length+1+d.length)):(l+d.lines>i&&h(),l+=d.lines,u+=d.length+1,c.push(d))}function h(){l!=0&&(a.push(c.length==1?c[0]:Wa.from(c,u)),u=-1,l=c.length=0)}for(let d of e)f(d);return h(),a.length==1?a[0]:new Wa(a,n)}}en.empty=new gr([""],0);function Eae(t){let e=-1;for(let n of t)e+=n.length+1;return e}function SO(t,e,n=0,r=1e9){for(let i=0,s=0,o=!0;s=n&&(l>r&&(a=a.slice(0,r-i)),i0?1:(e instanceof gr?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],o=s>>1,a=i instanceof gr?i.text.length:i.children.length;if(o==(n>0?a: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,e==0)return this.lineBreak=!0,this.value=` `,this;e--}else if(i instanceof gr){let l=i.text[o+(n<0?-1:0)];if(this.offsets[r]+=n,l.length>Math.max(0,e))return this.value=e==0?l:n>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=i.children[o+(n<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof gr?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class LB{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new xg(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=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;e>r&&(e=r),r-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*n,this.value=i.length<=r?i:n<0?i.slice(i.length-r):i.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class NB{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:i}=this.inner.next(e);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"&&(en.prototype[Symbol.iterator]=function(){return this.iter()},xg.prototype[Symbol.iterator]=LB.prototype[Symbol.iterator]=NB.prototype[Symbol.iterator]=function(){return this});let Tae=class{constructor(e,n,r,i){this.from=e,this.to=n,this.number=r,this.text=i}get length(){return this.to-this.from}};function e0(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function ai(t,e,n=!0,r=!0){return Cae(t,e,n,r)}function Dae(t){return t>=56320&&t<57344}function Pae(t){return t>=55296&&t<56320}function ds(t,e){let n=t.charCodeAt(e);if(!Pae(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return Dae(r)?(n-55296<<10)+(r-56320)+65536:n}function cA(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Ya(t){return t<65536?1:2}const e5=/\r\n?|\n/;var si=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(si||(si={}));class hl{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;ne)return s+(e-i);s+=a}else{if(r!=si.Simple&&u>=e&&(r==si.TrackDel&&ie||r==si.TrackBefore&&ie))return null;if(u>e||u==e&&n<0&&!a)return e==i||n<0?s:s+l;s+=l}i=u}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,n=e){for(let r=0,i=0;r=0&&i<=n&&a>=e)return in?"cover":!0;i=a}return!1}toString(){let e="";for(let n=0;n=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new hl(e)}static create(e){return new hl(e)}}class Lr extends hl{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return t5(this,(n,r,i,s,o)=>e=e.replace(i,i+(r-n),o),!1),e}mapDesc(e,n=!1){return n5(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let i=0,s=0;i=0){n[i]=a,n[i+1]=o;let l=i>>1;for(;r.length0&&_c(r,n,s.text),s.forward(c),a+=c}let u=e[o++];for(;a>1].toJSON()))}return e}static of(e,n,r){let i=[],s=[],o=0,a=null;function l(c=!1){if(!c&&!i.length)return;oh||f<0||h>n)throw new RangeError(`Invalid change range ${f} to ${h} (in doc of length ${n})`);let p=d?typeof d=="string"?en.of(d.split(r||e5)):d:en.empty,m=p.length;if(f==h&&m==0)return;fo&&mi(i,f-o,-1),mi(i,h-f,m),_c(s,i,p),o=h}}return u(e),l(!a),a}static empty(e){return new Lr(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let i=0;ia&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)n.push(s[0],0);else{for(;r.length=0&&n<=0&&n==t[i+1]?t[i]+=e:i>=0&&e==0&&t[i]==0?t[i+1]+=n:r?(t[i]+=e,t[i+1]+=n):t.push(e,n)}function _c(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r>1])),!(n||o==t.sections.length||t.sections[o+1]<0);)a=t.sections[o++],l=t.sections[o++];e(i,u,s,c,f),i=u,s=c}}}function n5(t,e,n,r=!1){let i=[],s=r?[]:null,o=new e1(t),a=new e1(e);for(let l=-1;;){if(o.done&&a.len||a.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&a.ins==-1){let u=Math.min(o.len,a.len);mi(i,u,-1),o.forward(u),a.forward(u)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len=0&&l=0){let u=0,c=o.len;for(;c;)if(a.ins==-1){let f=Math.min(c,a.len);u+=f,c-=f,a.forward(f)}else if(a.ins==0&&a.lenl||o.ins>=0&&o.len>l)&&(a||r.length>u),s.forward2(l),o.forward(l)}}}}class e1{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return n>=e.length?en.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?en.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Yf{constructor(e,n,r){this.from=e,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 e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,i;return this.empty?r=i=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new Yf(r,i,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return re.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return re.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return re.range(e.anchor,e.head)}static create(e,n,r){return new Yf(e,n,r)}}class re{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:re.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;re.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new re(e.ranges.map(n=>Yf.fromJSON(n)),e.main)}static single(e,n=e){return new re([re.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;ie?8:0)|s)}static normalized(e,n=0){let r=e[n];e.sort((i,s)=>i.from-s.from),n=e.indexOf(r);for(let i=1;is.head?re.range(l,a):re.range(a,l))}}return new re(e,n)}}function BB(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let fA=0;class Ie{constructor(e,n,r,i,s){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=fA++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new Ie(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:hA),!!e.static,e.enables)}of(e){return new kO([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new kO(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new kO(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function hA(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class kO{constructor(e,n,r,i){this.dependencies=e,this.facet=n,this.type=r,this.value=i,this.id=fA++}dynamicSlot(e){var n;let r=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>1,a=this.type==2,l=!1,u=!1,c=[];for(let f of this.dependencies)f=="doc"?l=!0:f=="selection"?u=!0:(((n=e[f.id])!==null&&n!==void 0?n:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[o]=r(f),1},update(f,h){if(l&&h.docChanged||u&&(h.docChanged||h.selection)||r5(f,c)){let d=r(f);if(a?!BD(d,f.values[o],i):!i(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,h)=>{let d,p=h.config.address[s];if(p!=null){let m=c2(h,p);if(this.dependencies.every(g=>g instanceof Ie?h.facet(g)===f.facet(g):g instanceof Pr?h.field(g,!1)==f.field(g,!1):!0)||(a?BD(d=r(f),m,i):i(d=r(f),m)))return f.values[o]=m,0}else d=r(f);return f.values[o]=d,1}}}}function BD(t,e,n){if(t.length!=e.length)return!1;for(let r=0;rt[l.id]),i=n.map(l=>l.type),s=r.filter(l=>!(l&1)),o=t[e.id]>>1;function a(l){let u=[];for(let c=0;cr===i),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(eb).find(r=>r.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,i)=>{let s=r.values[n],o=this.updateF(s,i);return this.compareF(s,o)?0:(r.values[n]=o,1)},reconfigure:(r,i)=>{let s=r.facet(eb),o=i.facet(eb),a;return(a=s.find(l=>l.field==this))&&a!=o.find(l=>l.field==this)?(r.values[n]=a.create(r),1):i.config.address[this.id]!=null?(r.values[n]=i.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,eb.of({field:this,create:e})]}get extension(){return this}}const Nf={lowest:4,low:3,default:2,high:1,highest:0};function pm(t){return e=>new zB(e,t)}const Ku={highest:pm(Nf.highest),high:pm(Nf.high),default:pm(Nf.default),low:pm(Nf.low),lowest:pm(Nf.lowest)};class zB{constructor(e,n){this.inner=e,this.prec=n}}class Tx{of(e){return new i5(this,e)}reconfigure(e){return Tx.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class i5{constructor(e,n){this.compartment=e,this.inner=n}}class u2{constructor(e,n,r,i,s,o){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=i,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,n,r){let i=[],s=Object.create(null),o=new Map;for(let h of Iae(e,n,o))h instanceof Pr?i.push(h):(s[h.facet.id]||(s[h.facet.id]=[])).push(h);let a=Object.create(null),l=[],u=[];for(let h of i)a[h.id]=u.length<<1,u.push(d=>h.slot(d));let c=r?.config.facets;for(let h in s){let d=s[h],p=d[0].facet,m=c&&c[h]||[];if(d.every(g=>g.type==0))if(a[p.id]=l.length<<1|1,hA(m,d))l.push(r.facet(p));else{let g=p.combine(d.map(y=>y.value));l.push(r&&p.compare(g,r.facet(p))?r.facet(p):g)}else{for(let g of d)g.type==0?(a[g.id]=l.length<<1|1,l.push(g.value)):(a[g.id]=u.length<<1,u.push(y=>g.dynamicSlot(y)));a[p.id]=u.length<<1,u.push(g=>Rae(g,p,d))}}let f=u.map(h=>h(a));return new u2(e,o,f,a,l,s)}}function Iae(t,e,n){let r=[[],[],[],[],[]],i=new Map;function s(o,a){let l=i.get(o);if(l!=null){if(l<=a)return;let u=r[l].indexOf(o);u>-1&&r[l].splice(u,1),o instanceof i5&&n.delete(o.compartment)}if(i.set(o,a),Array.isArray(o))for(let u of o)s(u,a);else if(o instanceof i5){if(n.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let u=e.get(o.compartment)||o.inner;n.set(o.compartment,u),s(u,a)}else if(o instanceof zB)s(o.inner,o.prec);else if(o instanceof Pr)r[a].push(o),o.provides&&s(o.provides,a);else if(o instanceof kO)r[a].push(o),o.facet.extensions&&s(o.facet.extensions,Nf.default);else{let u=o.extension;if(!u)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(u,a)}}return s(t,Nf.default),r.reduce((o,a)=>o.concat(a))}function _g(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let i=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|i}function c2(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const UB=Ie.define(),s5=Ie.define({combine:t=>t.some(e=>e),static:!0}),jB=Ie.define({combine:t=>t.length?t[0]:void 0,static:!0}),qB=Ie.define(),VB=Ie.define(),ZB=Ie.define(),XB=Ie.define({combine:t=>t.length?t[0]:!1});class Ju{constructor(e,n){this.type=e,this.value=n}static define(){return new Fae}}class Fae{of(e){return new Ju(this,e)}}class $ae{constructor(e){this.map=e}of(e){return new wt(this,e)}}class wt{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new wt(this.type,n)}is(e){return this.type==e}static define(e={}){return new $ae(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let i of e){let s=i.map(n);s&&r.push(s)}return r}}wt.reconfigure=wt.define();wt.appendConfig=wt.define();class Ar{constructor(e,n,r,i,s,o){this.startState=e,this.changes=n,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&BB(r,n.newLength),s.some(a=>a.type==Ar.time)||(this.annotations=s.concat(Ar.time.of(Date.now())))}static create(e,n,r,i,s,o){return new Ar(e,n,r,i,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(Ar.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}Ar.time=Ju.define();Ar.userEvent=Ju.define();Ar.addToHistory=Ju.define();Ar.remote=Ju.define();function Mae(t,e){let n=[];for(let r=0,i=0;;){let s,o;if(r=t[r]))s=t[r++],o=t[r++];else if(i=0;i--){let s=r[i](t);s instanceof Ar?t=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Ar?t=s[0]:t=YB(e,yp(s),!1)}return t}function Nae(t){let e=t.startState,n=e.facet(ZB),r=t;for(let i=n.length-1;i>=0;i--){let s=n[i](t);s&&Object.keys(s).length&&(r=WB(r,o5(e,s,t.changes.newLength),!0))}return r==t?t:Ar.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const Qae=[];function yp(t){return t==null?Qae:Array.isArray(t)?t:[t]}var Kn=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(Kn||(Kn={}));const Bae=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let a5;try{a5=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function zae(t){if(a5)return a5.test(t);for(let e=0;e"€"&&(n.toUpperCase()!=n.toLowerCase()||Bae.test(n)))return!0}return!1}function Uae(t){return e=>{if(!/\S/.test(e))return Kn.Space;if(zae(e))return Kn.Word;for(let n=0;n-1)return Kn.Word;return Kn.Other}}class Zt{constructor(e,n,r,i,s,o){this.config=e,this.doc=n,this.selection=r,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let a=0;ai.set(u,l)),n=null),i.set(a.value.compartment,a.value.extension)):a.is(wt.reconfigure)?(n=null,r=a.value):a.is(wt.appendConfig)&&(n=null,r=yp(r).concat(a.value));let s;n?s=e.startState.values.slice():(n=u2.resolve(r,i,this),s=new Zt(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,u)=>u.reconfigure(l,this),null).values);let o=e.startState.facet(s5)?e.newSelection:e.newSelection.asSingle();new Zt(n,e.newDoc,o,s,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:re.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),i=this.changes(r.changes),s=[r.range],o=yp(r.effects);for(let a=1;ao.spec.fromJSON(a,l)))}}return Zt.create({doc:e.doc,selection:re.fromJSON(e.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(e={}){let n=u2.resolve(e.extensions||[],new Map),r=e.doc instanceof en?e.doc:en.of((e.doc||"").split(n.staticFacet(Zt.lineSeparator)||e5)),i=e.selection?e.selection instanceof re?e.selection:re.single(e.selection.anchor,e.selection.head):re.single(0);return BB(i,r.length),n.staticFacet(s5)||(i=i.asSingle()),new Zt(n,r,i,n.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(Zt.tabSize)}get lineBreak(){return this.facet(Zt.lineSeparator)||` `}get readOnly(){return this.facet(XB)}phrase(e,...n){for(let r of this.facet(Zt.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>n.length?r:n[s-1]})),e}languageDataAt(e,n,r=-1){let i=[];for(let s of this.facet(UB))for(let o of s(this,n,r))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){return Uae(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:n,from:r,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,a=e-r;for(;o>0;){let l=ai(n,o,!1);if(s(n.slice(l,o))!=Kn.Word)break;o=l}for(;at.length?t[0]:4});Zt.lineSeparator=jB;Zt.readOnly=XB;Zt.phrases=Ie.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(i=>t[i]==e[i])}});Zt.languageData=UB;Zt.changeFilter=qB;Zt.transactionFilter=VB;Zt.transactionExtender=ZB;Tx.reconfigure=wt.define();function ec(t,e,n={}){let r={};for(let i of t)for(let s of Object.keys(i)){let o=i[s],a=r[s];if(a===void 0)r[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(n,s))r[s]=n[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)r[i]===void 0&&(r[i]=e[i]);return r}class Fh{eq(e){return this==e}range(e,n=e){return l5.create(e,n,this)}}Fh.prototype.startSide=Fh.prototype.endSide=0;Fh.prototype.point=!1;Fh.prototype.mapMode=si.TrackDel;let l5=class GB{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new GB(e,n,r)}};function u5(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class dA{constructor(e,n,r,i){this.from=e,this.to=n,this.value=r,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,i=0){let s=r?this.to:this.from;for(let o=i,a=s.length;;){if(o==a)return o;let l=o+a>>1,u=s[l]-e||(r?this.value[l].endSide:this.value[l].startSide)-n;if(l==o)return u>=0?o:a;u>=0?a=l:o=l+1}}between(e,n,r,i){for(let s=this.findIndex(n,-1e9,!0),o=this.findIndex(r,1e9,!1,s);sd||h==d&&u.startSide>0&&u.endSide<=0)continue;(d-h||u.endSide-u.startSide)<0||(o<0&&(o=h),u.point&&(a=Math.max(a,d-h)),r.push(u),i.push(h-o),s.push(d-o))}return{mapped:r.length?new dA(i,s,r,a):null,pos:o}}}class on{constructor(e,n,r,i){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=i}static create(e,n,r,i){return new on(e,n,r,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(u5)),this.isEmpty)return n.length?on.of(n):this;let a=new HB(this,null,-1).goto(0),l=0,u=[],c=new ef;for(;a.value||l=0){let f=n[l++];c.addInner(f.from,f.to,f.value)||u.push(f)}else a.rangeIndex==1&&a.chunkIndexthis.chunkEnd(a.chunkIndex)||sa.to||s=s&&e<=s+o.length&&o.between(s,e-s,n-s,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return t1.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return t1.from(e).goto(n)}static compare(e,n,r,i,s=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),a=n.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),l=zD(o,a,r),u=new mm(o,l,s),c=new mm(a,l,s);r.iterGaps((f,h,d)=>UD(u,f,c,h,d,i)),r.empty&&r.length==0&&UD(u,0,c,0,0,i)}static eq(e,n,r=0,i){i==null&&(i=999999999);let s=e.filter(c=>!c.isEmpty&&n.indexOf(c)<0),o=n.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let a=zD(s,o),l=new mm(s,a,0).goto(r),u=new mm(o,a,0).goto(r);for(;;){if(l.to!=u.to||!c5(l.active,u.active)||l.point&&(!u.point||!l.point.eq(u.point)))return!1;if(l.to>i)return!0;l.next(),u.next()}}static spans(e,n,r,i,s=-1){let o=new mm(e,null,s).goto(n),a=n,l=o.openStart;for(;;){let u=Math.min(o.to,r);if(o.point){let c=o.activeForPoint(o.to),f=o.pointFroma&&(i.span(a,u,o.active,l),l=o.openEnd(u));if(o.to>r)return l+(o.point&&o.to>r?1:0);a=o.to,o.next()}}static of(e,n=!1){let r=new ef;for(let i of e instanceof l5?[e]:n?jae(e):e)r.add(i.from,i.to,i.value);return r.finish()}static join(e){if(!e.length)return on.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let i=e[r];i!=on.empty;i=i.nextLayer)n=new on(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}}on.empty=new on([],[],null,-1);function jae(t){if(t.length>1)for(let e=t[0],n=1;n0)return t.slice().sort(u5);e=r}return t}on.empty.nextLayer=on.empty;class ef{finishChunk(e){this.chunks.push(new dA(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,n,r){this.addInner(e,n,r)||(this.nextLayer||(this.nextLayer=new ef)).add(e,n,r)}addInner(e,n,r){let i=e-this.lastTo||r.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(on.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=on.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function zD(t,e,n){let r=new Map;for(let s of t)for(let o=0;o=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&i.push(new HB(o,n,r,s));return i.length==1?i[0]:new t1(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)OS(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)OS(this.heap,r);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),OS(this.heap,0)}}}function OS(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let i=t[r];if(r+1=0&&(i=t[r+1],r++),n.compare(i)<0)break;t[r]=n,t[e]=i,e=r}}class mm{constructor(e,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=t1.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){tb(this.active,e),tb(this.activeTo,e),tb(this.activeRank,e),this.minActive=jD(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:i,rank:s}=this.cursor;for(;n0;)n++;nb(this.active,n,r),nb(this.activeTo,n,i),nb(this.activeRank,n,s),e&&nb(e,n,this.cursor.from),this.minActive=jD(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),r&&tb(r,i)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from=0&&r[i]=0&&!(this.activeRank[r]e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function UD(t,e,n,r,i,s){t.goto(e),n.goto(r);let o=r+i,a=r,l=r-e;for(;;){let u=t.to+l-n.to,c=u||t.endSide-n.endSide,f=c<0?t.to+l:n.to,h=Math.min(f,o);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&c5(t.activeForPoint(t.to),n.activeForPoint(n.to))||s.comparePoint(a,h,t.point,n.point):h>a&&!c5(t.active,n.active)&&s.compareRange(a,h,t.active,n.active),f>o)break;(u||t.openEnd!=n.openEnd)&&s.boundChange&&s.boundChange(f),a=f,c<=0&&t.next(),c>=0&&n.next()}}function c5(t,e){if(t.length!=e.length)return!1;for(let n=0;n=e;r--)t[r+1]=t[r];t[e]=n}function jD(t,e){let n=-1,r=1e9;for(let i=0;i=e)return i;if(i==t.length)break;s+=t.charCodeAt(i)==9?n-s%n:1,i=ai(t,i)}return r===!0?-1:t.length}const h5="ͼ",qD=typeof Symbol>"u"?"__"+h5:Symbol.for(h5),d5=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),VD=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class tf{constructor(e,n){this.rules=[];let{finish:r}=n||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,a,l,u){let c=[],f=/^@(\w+)\b/.exec(o[0]),h=f&&f[1]=="keyframes";if(f&&a==null)return l.push(o[0]+";");for(let d in a){let p=a[d];if(/&/.test(d))s(d.split(/,\s*/).map(m=>o.map(g=>m.replace(/&/,g))).reduce((m,g)=>m.concat(g)),p,l);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+d+") should be a primitive value.");s(i(d),p,c,h)}else p!=null&&c.push(d.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}(c.length||h)&&l.push((r&&!f&&!u?o.map(r):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(` `)}static newName(){let e=VD[qD]||1;return VD[qD]=e+1,h5+e.toString(36)}static mount(e,n,r){let i=e[d5],s=r&&r.nonce;i?s&&i.setNonce(s):i=new qae(e,s),i.mount(Array.isArray(n)?n:[n],e)}}let ZD=new Map;class qae{constructor(e,n){let r=e.ownerDocument||e,i=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=ZD.get(r);if(s)return e[d5]=s;this.sheet=new i.CSSStyleSheet,ZD.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[d5]=this}mount(e,n){let r=this.sheet,i=0,s=0;for(let o=0;o-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,a),r)for(let u=0;u",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Vae=typeof navigator<"u"&&/Mac/.test(navigator.platform),Zae=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ii=0;ii<10;ii++)nf[48+ii]=nf[96+ii]=String(ii);for(var ii=1;ii<=24;ii++)nf[ii+111]="F"+ii;for(var ii=65;ii<=90;ii++)nf[ii]=String.fromCharCode(ii+32),n1[ii]=String.fromCharCode(ii);for(var vS in nf)n1.hasOwnProperty(vS)||(n1[vS]=nf[vS]);function Xae(t){var e=Vae&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Zae&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?n1:nf)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function _n(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i=="string"?t.setAttribute(r,i):i!=null&&(t[r]=i)}e++}for(;e2);var Ce={mac:WD||/Mac/.test(zi.platform),windows:/Win/.test(zi.platform),linux:/Linux|X11/.test(zi.platform),ie:Dx,ie_version:JB?p5.documentMode||6:g5?+g5[1]:m5?+m5[1]:0,gecko:XD,gecko_version:XD?+(/Firefox\/(\d+)/.exec(zi.userAgent)||[0,0])[1]:0,chrome:!!wS,chrome_version:wS?+wS[1]:0,ios:WD,android:/Android\b/.test(zi.userAgent),webkit_version:Wae?+(/\bAppleWebKit\/(\d+)/.exec(zi.userAgent)||[0,0])[1]:0,safari:y5,safari_version:y5?+(/\bVersion\/(\d+(\.\d+)?)/.exec(zi.userAgent)||[0,0])[1]:0,tabSize:p5.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function r1(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function b5(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function CO(t,e){if(!e.anchorNode)return!1;try{return b5(t,e.anchorNode)}catch{return!1}}function i1(t){return t.nodeType==3?Mh(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function Sg(t,e,n,r){return n?YD(t,e,n,r,-1)||YD(t,e,n,r,1):!1}function $h(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function f2(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function YD(t,e,n,r,i){for(;;){if(t==n&&e==r)return!0;if(e==(i<0?0:kl(t))){if(t.nodeName=="DIV")return!1;let s=t.parentNode;if(!s||s.nodeType!=1)return!1;e=$h(t)+(i<0?0:1),t=s}else if(t.nodeType==1){if(t=t.childNodes[e+(i<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=i<0?kl(t):0}else return!1}}function kl(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Px(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function Yae(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function ez(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function Gae(t,e,n,r,i,s,o,a){let l=t.ownerDocument,u=l.defaultView||window;for(let c=t,f=!1;c&&!f;)if(c.nodeType==1){let h,d=c==l.body,p=1,m=1;if(d)h=Yae(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(f=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let O=c.getBoundingClientRect();({scaleX:p,scaleY:m}=ez(c,O)),h={left:O.left,right:O.left+c.clientWidth*p,top:O.top,bottom:O.top+c.clientHeight*m}}let g=0,y=0;if(i=="nearest")e.top0&&e.bottom>h.bottom+y&&(y=e.bottom-h.bottom+o)):e.bottom>h.bottom&&(y=e.bottom-h.bottom+o,n<0&&e.top-y0&&e.right>h.right+g&&(g=e.right-h.right+s)):e.right>h.right&&(g=e.right-h.right+s,n<0&&e.lefth.bottom||e.lefth.right)&&(e={left:Math.max(e.left,h.left),right:Math.min(e.right,h.right),top:Math.max(e.top,h.top),bottom:Math.min(e.bottom,h.bottom)}),c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function Hae(t){let e=t.ownerDocument,n,r;for(let i=t.parentNode;i&&!(i==e.body||n&&r);)if(i.nodeType==1)!r&&i.scrollHeight>i.clientHeight&&(r=i),!n&&i.scrollWidth>i.clientWidth&&(n=i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;return{x:n,y:r}}class Kae{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?kl(n):0),r,Math.min(e.focusOffset,r?kl(r):0))}set(e,n,r,i){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=i}}let Rf=null;Ce.safari&&Ce.safari_version>=26&&(Rf=!1);function tz(t){if(t.setActive)return t.setActive();if(Rf)return t.focus(Rf);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(Rf==null?{get preventScroll(){return Rf={preventScroll:!0},!0}}:void 0),!Rf){Rf=!1;for(let n=0;nMath.max(1,t.scrollHeight-t.clientHeight-4)}function iz(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=kl(n)}else if(n.parentNode&&!f2(n))r=$h(n),n=n.parentNode;else return null}}function sz(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&rn)return f.domBoundsAround(e,n,u);if(h>=e&&i==-1&&(i=l,s=u),u>n&&f.dom.parentNode==this.dom){o=l,a=c;break}c=h,u=h+f.breakAfter}return{from:s,to:a<0?r+this.length:a,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let n=this.parent;n;n=n.parent){if(e&&(n.flags|=2),n.flags&1)return;n.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let n=e.parent;if(!n)return e;e=n}}replaceChildren(e,n,r=pA){this.markDirty();for(let i=e;ithis.pos||e==this.pos&&(n>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}}function az(t,e,n,r,i,s,o,a,l){let{children:u}=t,c=u.length?u[e]:null,f=s.length?s[s.length-1]:null,h=f?f.breakAfter:o;if(!(e==r&&c&&!o&&!h&&s.length<2&&c.merge(n,i,s.length?f:null,n==0,a,l))){if(r0&&(!o&&s.length&&c.merge(n,c.length,s[0],!1,a,0)?c.breakAfter=s.shift().breakAfter:(ntle||r.flags&8)?!1:(this.text=this.text.slice(0,e)+(r?r.text:"")+this.text.slice(n),this.markDirty(),!0)}split(e){let n=new fa(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),n.flags|=this.flags&8,n}localPosFromDOM(e,n){return e==this.dom?n:n?this.text.length:0}domAtPos(e){return new yi(this.dom,e)}domBoundsAround(e,n,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,n){return nle(this.dom,e,n)}}class zu extends vn{constructor(e,n=[],r=0){super(),this.mark=e,this.children=n,this.length=r;for(let i of n)i.setParent(this)}setAttrs(e){if(nz(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let n in this.mark.attrs)e.setAttribute(n,this.mark.attrs[n]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,n){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,n)}merge(e,n,r,i,s,o){return r&&(!(r instanceof zu&&r.mark.eq(this.mark))||e&&s<=0||ne&&n.push(r=e&&(i=s),r=l,s++}let o=this.length-e;return this.length=e,i>-1&&(this.children.length=i,this.markDirty()),new zu(this.mark,n,o)}domAtPos(e){return uz(this,e)}coordsAt(e,n){return fz(this,e,n)}}function nle(t,e,n){let r=t.nodeValue.length;e>r&&(e=r);let i=e,s=e,o=0;e==0&&n<0||e==r&&n>=0?Ce.chrome||Ce.gecko||(e?(i--,o=1):s=0)?0:a.length-1];return Ce.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,u=>u.width)||l),o?Px(l,o<0):l||null}class wu extends vn{static create(e,n,r){return new wu(e,n,r)}constructor(e,n,r){super(),this.widget=e,this.length=n,this.side=r,this.prevWidget=null}split(e){let n=wu.create(this.widget,this.length-e,this.side);return this.length-=e,n}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,n,r,i,s,o){return r&&(!(r instanceof wu)||!this.widget.compare(r.widget)||e>0&&s<=0||n0)?yi.before(this.dom):yi.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,n){let r=this.widget.coordsAt(this.dom,e,n);if(r)return r;let i=this.dom.getClientRects(),s=null;if(!i.length)return null;let o=this.side?this.side<0:e>0;for(let a=o?i.length-1:0;s=i[a],!(e>0?a==0:a==i.length-1||s.top0?yi.before(this.dom):yi.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return en.empty}get isHidden(){return!0}}fa.prototype.children=wu.prototype.children=t0.prototype.children=pA;function uz(t,e){let n=t.dom,{children:r}=t,i=0;for(let s=0;is&&e0;s--){let o=r[s-1];if(o.dom.parentNode==n)return o.domAtPos(o.length)}for(let s=i;s0&&e instanceof zu&&i.length&&(r=i[i.length-1])instanceof zu&&r.mark.eq(e.mark)?cz(r,e.children[0],n-1):(i.push(e),e.setParent(t)),t.length+=e.length}function fz(t,e,n){let r=null,i=-1,s=null,o=-1;function a(u,c){for(let f=0,h=0;f=c&&(d.children.length?a(d,c-h):(!s||s.isHidden&&(n>0||ile(s,d)))&&(p>c||h==p&&d.getSide()>0)?(s=d,o=c-h):(h-1?1:0)!=i.length-(n&&i.indexOf(n)>-1?1:0))return!1;for(let s of r)if(s!=n&&(i.indexOf(s)==-1||t[s]!==e[s]))return!1;return!0}function v5(t,e,n){let r=!1;if(e)for(let i in e)n&&i in n||(r=!0,i=="style"?t.style.cssText="":t.removeAttribute(i));if(n)for(let i in n)e&&e[i]==n[i]||(r=!0,i=="style"?t.style.cssText=n[i]:t.setAttribute(i,n[i]));return r}function sle(t){let e=Object.create(null);for(let n=0;n0?3e8:-4e8:n>0?1e8:-1e8,new rf(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,i;if(e.isBlockGap)r=-5e8,i=4e8;else{let{start:s,end:o}=hz(e,n);r=(s?n?-3e8:-1:5e8)-1,i=(o?n?2e8:1:-6e8)+1}return new rf(e,r,i,n,e.widget||null,!0)}static line(e){return new uy(e)}static set(e,n=!1){return on.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}st.none=on.empty;class ly extends st{constructor(e){let{start:n,end:r}=hz(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var n,r;return this==e||e instanceof ly&&this.tagName==e.tagName&&(this.class||((n=this.attrs)===null||n===void 0?void 0:n.class))==(e.class||((r=e.attrs)===null||r===void 0?void 0:r.class))&&h2(this.attrs,e.attrs,"class")}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}ly.prototype.point=!1;class uy extends st{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof uy&&this.spec.class==e.spec.class&&h2(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}uy.prototype.mapMode=si.TrackBefore;uy.prototype.point=!0;class rf extends st{constructor(e,n,r,i,s,o){super(n,r,s,e),this.block=i,this.isReplace=o,this.mapMode=i?n<=0?si.TrackBefore:si.TrackAfter:si.TrackDel}get type(){return this.startSide!=this.endSide?Gi.WidgetRange:this.startSide<=0?Gi.WidgetBefore:Gi.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof rf&&ole(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}rf.prototype.point=!0;function hz(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function ole(t,e){return t==e||!!(t&&e&&t.compare(e))}function AO(t,e,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=t?n[i]=Math.max(n[i],e):n.push(t,e)}class Sr extends vn{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,n,r,i,s,o){if(r){if(!(r instanceof Sr))return!1;this.dom||r.transferDOM(this)}return i&&this.setDeco(r?r.attrs:null),lz(this,e,n,r?r.children.slice():[],s,o),!0}split(e){let n=new Sr;if(n.breakAfter=this.breakAfter,this.length==0)return n;let{i:r,off:i}=this.childPos(e);i&&(n.append(this.children[r].split(i),0),this.children[r].merge(i,this.children[r].length,null,!1,0,0),r++);for(let s=r;s0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=e,n}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){h2(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){cz(this,e,n)}addLineDeco(e){let n=e.spec.attributes,r=e.spec.class;n&&(this.attrs=O5(n,this.attrs||{})),r&&(this.attrs=O5({class:r},this.attrs||{}))}domAtPos(e){return uz(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var r;this.dom?this.flags&4&&(nz(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(v5(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,n);let i=this.dom.lastChild;for(;i&&vn.get(i)instanceof zu;)i=i.lastChild;if(!i||!this.length||i.nodeName!="BR"&&((r=vn.get(i))===null||r===void 0?void 0:r.isEditable)==!1&&(!Ce.ios||!this.children.some(s=>s instanceof fa))){let s=document.createElement("BR");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,n;for(let r of this.children){if(!(r instanceof fa)||/[^ -~]/.test(r.text))return null;let i=i1(r.dom);if(i.length!=1)return null;e+=i[0].width,n=i[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:n}:null}coordsAt(e,n){let r=fz(this,e,n);if(!this.children.length&&r&&this.parent){let{heightOracle:i}=this.parent.view.viewState,s=r.bottom-r.top;if(Math.abs(s-i.lineHeight)<2&&i.textHeight=n){if(s instanceof Sr)return s;if(o>n)break}i=o+s.breakAfter}return null}}class Du extends vn{constructor(e,n,r){super(),this.widget=e,this.length=n,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(e,n,r,i,s,o){return r&&(!(r instanceof Du)||!this.widget.compare(r.widget)||e>0&&s<=0||n0}}class w5 extends ed{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class kg{constructor(e,n,r,i){this.doc=e,this.pos=n,this.end=r,this.disallowBlockEffectsFor=i,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=n}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof Du&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new Sr),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(rb(new t0(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof Du)&&this.getLine()}buildText(e,n,r){for(;e>0;){if(this.textOff==this.text.length){let{value:o,lineBreak:a,done:l}=this.cursor.next(this.skip);if(this.skip=0,l)throw new Error("Ran out of text content when drawing inline views");if(a){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=o,this.textOff=0}let i=Math.min(this.text.length-this.textOff,e),s=Math.min(i,512);this.flushBuffer(n.slice(n.length-r)),this.getLine().append(rb(new fa(this.text.slice(this.textOff,this.textOff+s)),n),r),this.atCursorPos=!0,this.textOff+=s,e-=s,r=i<=s?0:n.length}}span(e,n,r,i){this.buildText(n-e,r,i),this.pos=n,this.openStart<0&&(this.openStart=i)}point(e,n,r,i,s,o){if(this.disallowBlockEffectsFor[o]&&r instanceof rf){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(n>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let a=n-e;if(r instanceof rf)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Du(r.widget||n0.block,a,r));else{let l=wu.create(r.widget||n0.inline,a,a?0:r.startSide),u=this.atCursorPos&&!l.isEditable&&s<=i.length&&(e0),c=!l.isEditable&&(ei.length||r.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!u&&!l.isEditable&&(this.pendingBuffer=0),this.flushBuffer(i),u&&(f.append(rb(new t0(1),i),s),s=i.length+Math.max(0,s-i.length)),f.append(rb(l,i),s),this.atCursorPos=c,this.pendingBuffer=c?ei.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);a&&(this.textOff+a<=this.text.length?this.textOff+=a:(this.skip+=a-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=n),this.openStart<0&&(this.openStart=s)}static build(e,n,r,i,s){let o=new kg(e,n,r,s);return o.openEnd=on.spans(i,n,r,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function rb(t,e){for(let n of e)t=new zu(n,[t],t.length);return t}class n0 extends ed{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}n0.inline=new n0("span");n0.block=new n0("div");var Xn=(function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t})(Xn||(Xn={}));const Lh=Xn.LTR,mA=Xn.RTL;function dz(t){let e=[];for(let n=0;n=n){if(a.level==r)return o;(s<0||(i!=0?i<0?a.fromn:e[s].level>a.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function mz(t,e){if(t.length!=e.length)return!1;for(let n=0;n=0;m-=3)if(Ta[m+1]==-d){let g=Ta[m+2],y=g&2?i:g&4?g&1?s:i:0;y&&(kn[f]=kn[Ta[m]]=y),a=m;break}}else{if(Ta.length==189)break;Ta[a++]=f,Ta[a++]=h,Ta[a++]=l}else if((p=kn[f])==2||p==1){let m=p==i;l=m?0:1;for(let g=a-3;g>=0;g-=3){let y=Ta[g+2];if(y&2)break;if(m)Ta[g+2]|=2;else{if(y&4)break;Ta[g+2]|=4}}}}}function hle(t,e,n,r){for(let i=0,s=r;i<=n.length;i++){let o=i?n[i-1].to:t,a=il;)p==g&&(p=n[--m].from,g=m?n[m-1].to:t),kn[--p]=d;l=c}else s=u,l++}}}function _5(t,e,n,r,i,s,o){let a=r%2?2:1;if(r%2==i%2)for(let l=e,u=0;ll&&o.push(new Sc(l,m.from,d));let g=m.direction==Lh!=!(d%2);S5(t,g?r+1:r,i,m.inner,m.from,m.to,o),l=m.to}p=m.to}else{if(p==n||(c?kn[p]!=a:kn[p]==a))break;p++}h?_5(t,l,p,r+1,i,h,o):le;){let c=!0,f=!1;if(!u||l>s[u-1].to){let m=kn[l-1];m!=a&&(c=!1,f=m==16)}let h=!c&&a==1?[]:null,d=c?r:r+1,p=l;e:for(;;)if(u&&p==s[u-1].to){if(f)break e;let m=s[--u];if(!c)for(let g=m.from,y=u;;){if(g==e)break e;if(y&&s[y-1].to==g)g=s[--y].from;else{if(kn[g-1]==a)break e;break}}if(h)h.push(m);else{m.tokn.length;)kn[kn.length]=256;let r=[],i=e==Lh?0:1;return S5(t,i,i,n,0,t.length,r),r}function gz(t){return[new Sc(0,t,0)]}let yz="";function ple(t,e,n,r,i){var s;let o=r.head-t.from,a=Sc.find(e,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),l=e[a],u=l.side(i,n);if(o==u){let h=a+=i?1:-1;if(h<0||h>=e.length)return null;l=e[a=h],o=l.side(!i,n),u=l.side(i,n)}let c=ai(t.text,o,l.forward(i,n));(cl.to)&&(c=u),yz=t.text.slice(Math.min(o,c),Math.max(o,c));let f=a==(i?e.length-1:0)?null:e[a+(i?1:-1)];return f&&c==u&&f.level+(i?0:1)t.some(e=>e)}),kz=Ie.define({combine:t=>t.some(e=>e)}),Cz=Ie.define();class Op{constructor(e,n="nearest",r="nearest",i=5,s=5,o=!1){this.range=e,this.y=n,this.x=r,this.yMargin=i,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new Op(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Op(re.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const ib=wt.define({map:(t,e)=>t.map(e)}),Az=wt.define();function Wi(t,e,n){let r=t.facet(wz);r.length?r[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const mu=Ie.define({combine:t=>t.length?t[0]:!0});let gle=0;const Gd=Ie.define({combine(t){return t.filter((e,n)=>{for(let r=0;r{let l=[];return o&&l.push(s1.of(u=>{let c=u.plugin(a);return c?o(c):st.none})),s&&l.push(s(a)),l})}static fromClass(e,n){return Tr.define((r,i)=>new e(r,i),n)}}class xS{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(Wi(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(n){Wi(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){Wi(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Ez=Ie.define(),bA=Ie.define(),s1=Ie.define(),Tz=Ie.define(),cy=Ie.define(),Dz=Ie.define();function JD(t,e){let n=t.state.facet(Dz);if(!n.length)return n;let r=n.map(s=>s instanceof Function?s(t):s),i=[];return on.spans(r,e.from,e.to,{point(){},span(s,o,a,l){let u=s-e.from,c=o-e.from,f=i;for(let h=a.length-1;h>=0;h--,l--){let d=a[h].spec.bidiIsolate,p;if(d==null&&(d=mle(e.text,u,c)),l>0&&f.length&&(p=f[f.length-1]).to==u&&p.direction==d)p.to=c,f=p.inner;else{let m={from:u,to:c,direction:d,inner:[]};f.push(m),f=m.inner}}}}),i}const Pz=Ie.define();function OA(t){let e=0,n=0,r=0,i=0;for(let s of t.state.facet(Pz)){let o=s(t);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:e,right:n,top:r,bottom:i}}const ng=Ie.define();class ko{constructor(e,n,r,i){this.fromA=e,this.toA=n,this.fromB=r,this.toB=i}join(e){return new ko(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,r=this;for(;n>0;n--){let i=e[n-1];if(!(i.fromA>r.toA)){if(i.toAc)break;s+=2}if(!l)return r;new ko(l.fromA,l.toA,l.fromB,l.toB).addToSet(r),o=l.toA,a=l.toB}}}class d2{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=Lr.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let i=[];this.changes.iterChangedRanges((s,o,a,l)=>i.push(new ko(s,o,a,l))),this.changedRanges=i}static create(e,n,r){return new d2(e,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class eP extends vn{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=st.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new Sr],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new ko(0,0,0,e.state.doc.length)],0,null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:u,toA:c})=>cthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?i=this.domChanged.newSel.head:!_le(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?ble(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:u,to:c}=this.hasComposition;r=new ko(u,c,e.changes.mapPos(u,-1),e.changes.mapPos(c,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(Ce.ie||Ce.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.updateDeco(),l=wle(o,a,e.changes);return r=ko.extendWithRanges(r,l),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,e.startState.doc.length,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,n,r);let{observer:i}=this.view;i.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=Ce.chrome||Ce.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||i.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let s=[];if(this.view.viewport.from||this.view.viewport.to=0?i[o]:null;if(!a)break;let{fromA:l,toA:u,fromB:c,toB:f}=a,h,d,p,m;if(r&&r.range.fromBc){let w=kg.build(this.view.state.doc,c,r.range.fromB,this.decorations,this.dynamicDecorationMap),x=kg.build(this.view.state.doc,r.range.toB,f,this.decorations,this.dynamicDecorationMap);d=w.breakAtStart,p=w.openStart,m=x.openEnd;let S=this.compositionView(r);x.breakAtStart?S.breakAfter=1:x.content.length&&S.merge(S.length,S.length,x.content[0],!1,x.openStart,0)&&(S.breakAfter=x.content[0].breakAfter,x.content.shift()),w.content.length&&S.merge(0,0,w.content[w.content.length-1],!0,0,w.openEnd)&&w.content.pop(),h=w.content.concat(S).concat(x.content)}else({content:h,breakAtStart:d,openStart:p,openEnd:m}=kg.build(this.view.state.doc,c,f,this.decorations,this.dynamicDecorationMap));let{i:g,off:y}=s.findPos(u,1),{i:O,off:v}=s.findPos(l,-1);az(this,O,v,g,y,h,d,p,m)}r&&this.fixCompositionDOM(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(Az)&&(this.editContextFormatting=r.value)}compositionView(e){let n=new fa(e.text.nodeValue);n.flags|=8;for(let{deco:i}of e.marks)n=new zu(i,[n],n.length);let r=new Sr;return r.append(n,0),r}fixCompositionDOM(e){let n=(s,o)=>{o.flags|=8|(o.children.some(l=>l.flags&7)?1:0),this.markedForComposition.add(o);let a=vn.get(s);a&&a!=o&&(a.dom=null),o.setDOM(s)},r=this.childPos(e.range.fromB,1),i=this.children[r.i];n(e.line,i);for(let s=e.marks.length-1;s>=-1;s--)r=i.childPos(r.off,1),i=i.children[r.i],n(s>=0?e.marks[s].node:e.text,i)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,i=r==this.dom,s=!i&&!(this.view.state.facet(mu)||this.dom.tabIndex>-1)&&CO(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(i||n||s))return;let o=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(a.anchor)),u=a.empty?l:this.moveToLine(this.domAtPos(a.head));if(Ce.gecko&&a.empty&&!this.hasComposition&&yle(l)){let f=document.createTextNode("");this.view.observer.ignore(()=>l.node.insertBefore(f,l.node.childNodes[l.offset]||null)),l=u=new yi(f,0),o=!0}let c=this.view.observer.selectionRange;(o||!c.focusNode||(!Sg(l.node,l.offset,c.anchorNode,c.anchorOffset)||!Sg(u.node,u.offset,c.focusNode,c.focusOffset))&&!this.suppressWidgetCursorChange(c,a))&&(this.view.observer.ignore(()=>{Ce.android&&Ce.chrome&&this.dom.contains(c.focusNode)&&xle(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=r1(this.view.root);if(f)if(a.empty){if(Ce.gecko){let h=Ole(l.node,l.offset);if(h&&h!=3){let d=(h==1?iz:sz)(l.node,l.offset);d&&(l=new yi(d.node,d.offset))}}f.collapse(l.node,l.offset),a.bidiLevel!=null&&f.caretBidiLevel!==void 0&&(f.caretBidiLevel=a.bidiLevel)}else if(f.extend){f.collapse(l.node,l.offset);try{f.extend(u.node,u.offset)}catch{}}else{let h=document.createRange();a.anchor>a.head&&([l,u]=[u,l]),h.setEnd(u.node,u.offset),h.setStart(l.node,l.offset),f.removeAllRanges(),f.addRange(h)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(l,u)),this.impreciseAnchor=l.precise?null:new yi(c.anchorNode,c.anchorOffset),this.impreciseHead=u.precise?null:new yi(c.focusNode,c.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&Sg(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=r1(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let o=Sr.find(this,n.head);if(!o)return;let a=o.posAtStart;if(n.head==a||n.head==a+o.length)return;let l=this.coordsAt(n.head,-1),u=this.coordsAt(n.head,1);if(!l||!u||l.bottom>u.top)return;let c=this.domAtPos(n.head+n.assoc);r.collapse(c.node,c.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=n.from&&r.collapse(i,s)}moveToLine(e){let n=this.dom,r;if(e.node!=n)return e;for(let i=e.offset;!r&&i=0;i--){let s=vn.get(n.childNodes[i]);s instanceof Sr&&(r=s.domAtPos(s.length))}return r?new yi(r.node,r.offset,!0):e}nearest(e){for(let n=e;n;){let r=vn.get(n);if(r&&r.rootView==this)return r;n=n.parentNode}return null}posFromDOM(e,n){let r=this.nearest(e);if(!r)throw new RangeError("Trying to find position for a DOM position outside of the document");return r.localPosFromDOM(e,n)+r.posAtStart}domAtPos(e){let{i:n,off:r}=this.childCursor().findPos(e,-1);for(;n=0;o--){let a=this.children[o],l=s-a.breakAfter,u=l-a.length;if(le||a.covers(1))&&(!r||a instanceof Sr&&!(r instanceof Sr&&n>=0)))r=a,i=u;else if(r&&u==e&&l==e&&a instanceof Du&&Math.abs(n)<2){if(a.deco.startSide<0)break;o&&(r=null)}s=u}return r?r.coordsAt(e-i,n):null}coordsForChar(e){let{i:n,off:r}=this.childPos(e,1),i=this.children[n];if(!(i instanceof Sr))return null;for(;i.children.length;){let{i:a,off:l}=i.childPos(r,1);for(;;a++){if(a==i.children.length)return null;if((i=i.children[a]).length)break}r=l}if(!(i instanceof fa))return null;let s=ai(i.text,r);if(s==r)return null;let o=Mh(i.dom,r,s).getClientRects();for(let a=0;aMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==Xn.LTR;for(let u=0,c=0;ci)break;if(u>=r){let d=f.dom.getBoundingClientRect();if(n.push(d.height),o){let p=f.dom.lastChild,m=p?i1(p):[];if(m.length){let g=m[m.length-1],y=l?g.right-d.left:d.right-g.left;y>a&&(a=y,this.minWidth=s,this.minWidthFrom=u,this.minWidthTo=h)}}}u=h+f.breakAfter}return n}textDirectionAt(e){let{i:n}=this.childPos(e,1);return getComputedStyle(this.children[n].dom).direction=="rtl"?Xn.RTL:Xn.LTR}measureTextSize(){for(let s of this.children)if(s instanceof Sr){let o=s.measureTextSize();if(o)return o}let e=document.createElement("div"),n,r,i;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let s=i1(e.firstChild)[0];n=e.getBoundingClientRect().height,r=s?s.width/27:7,i=s?s.height:n,e.remove()}),{lineHeight:n,charWidth:r,textHeight:i}}childCursor(e=this.length){let n=this.children.length;return n&&(e-=this.children[--n].length),new oz(this.children,e,n)}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,i=0;;i++){let s=i==n.viewports.length?null:n.viewports[i],o=s?s.from-1:this.length;if(o>r){let a=(n.lineBlockAt(o).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(st.replace({widget:new w5(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return st.set(e)}updateDeco(){let e=1,n=this.view.state.facet(s1).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),r=!1,i=this.view.state.facet(Tz).map((s,o)=>{let a=typeof s=="function";return a&&(r=!0),a?s(this.view):s});for(i.length&&(this.dynamicDecorationMap[e++]=r,n.push(on.join(i))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];en.anchor?-1:1),i;if(!r)return;!n.empty&&(i=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,i.left),top:Math.min(r.top,i.top),right:Math.max(r.right,i.right),bottom:Math.max(r.bottom,i.bottom)});let s=OA(this.view),o={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;Gae(this.view.scrollDOM,o,n.headi instanceof wu||i.children.some(r);return r(this.children[n])}}function yle(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function Rz(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=iz(n.focusNode,n.focusOffset),i=sz(n.focusNode,n.focusOffset),s=r||i;if(i&&r&&i.node!=r.node){let a=vn.get(i.node);if(!a||a instanceof fa&&a.text!=i.node.nodeValue)s=i;else if(t.docView.lastCompositionAfterCursor){let l=vn.get(r.node);!l||l instanceof fa&&l.text!=r.node.nodeValue||(s=i)}}if(t.docView.lastCompositionAfterCursor=s!=r,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function ble(t,e,n){let r=Rz(t,n);if(!r)return null;let{node:i,from:s,to:o}=r,a=i.nodeValue;if(/[\n\r]/.test(a)||t.state.doc.sliceString(r.from,r.to)!=a)return null;let l=e.invertedDesc,u=new ko(l.mapPos(s),l.mapPos(o),s,o),c=[];for(let f=i.parentNode;;f=f.parentNode){let h=vn.get(f);if(h instanceof zu)c.push({node:f,deco:h.mark});else{if(h instanceof Sr||f.nodeName=="DIV"&&f.parentNode==t.contentDOM)return{range:u,text:i,marks:c,line:f};if(f!=t.contentDOM)c.push({node:f,deco:new ly({inclusive:!0,attributes:sle(f),tagName:f.tagName.toLowerCase()})});else return null}}}function Ole(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e{re.from&&(n=!0)}),n}function Sle(t,e,n=1){let r=t.charCategorizer(e),i=t.doc.lineAt(e),s=e-i.from;if(i.length==0)return re.cursor(e);s==0?n=1:s==i.length&&(n=-1);let o=s,a=s;n<0?o=ai(i.text,s,!1):a=ai(i.text,s);let l=r(i.text.slice(o,a));for(;o>0;){let u=ai(i.text,o,!1);if(r(i.text.slice(u,o))!=l)break;o=u}for(;at?e.left-t:Math.max(0,t-e.right)}function Cle(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function _S(t,e){return t.tope.top+1}function tP(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function C5(t,e,n){let r,i,s,o,a=!1,l,u,c,f;for(let p=t.firstChild;p;p=p.nextSibling){let m=i1(p);for(let g=0;gv||o==v&&s>O)&&(r=p,i=y,s=O,o=v,a=O?e0:gy.bottom&&(!c||c.bottomy.top)&&(u=p,f=y):c&&_S(c,y)?c=nP(c,y.bottom):f&&_S(f,y)&&(f=tP(f,y.top))}}if(c&&c.bottom>=n?(r=l,i=c):f&&f.top<=n&&(r=u,i=f),!r)return{node:t,offset:0};let h=Math.max(i.left,Math.min(i.right,e));if(r.nodeType==3)return rP(r,h,n);if(a&&r.contentEditable!="false")return C5(r,h,n);let d=Array.prototype.indexOf.call(t.childNodes,r)+(e>=(i.left+i.right)/2?1:0);return{node:t,offset:d}}function rP(t,e,n){let r=t.nodeValue.length,i=-1,s=1e9,o=0;for(let a=0;an?c.top-n:n-c.bottom)-1;if(c.left-1<=e&&c.right+1>=e&&f=(c.left+c.right)/2,d=h;if((Ce.chrome||Ce.gecko)&&Mh(t,a).getBoundingClientRect().left==c.right&&(d=!h),f<=0)return{node:t,offset:a+(d?1:0)};i=a+(d?1:0),s=f}}}return{node:t,offset:i>-1?i:o>0?t.nodeValue.length:0}}function Iz(t,e,n,r=-1){var i,s;let o=t.contentDOM.getBoundingClientRect(),a=o.top+t.viewState.paddingTop,l,{docHeight:u}=t.viewState,{x:c,y:f}=e,h=f-a;if(h<0)return 0;if(h>u)return t.state.doc.length;for(let w=t.viewState.heightOracle.textHeight/2,x=!1;l=t.elementAtHeight(h),l.type!=Gi.Text;)for(;h=r>0?l.bottom+w:l.top-w,!(h>=0&&h<=u);){if(x)return n?null:0;x=!0,r=-r}f=a+h;let d=l.from;if(dt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:iP(t,o,l,c,f);let p=t.dom.ownerDocument,m=t.root.elementFromPoint?t.root:p,g=m.elementFromPoint(c,f);g&&!t.contentDOM.contains(g)&&(g=null),g||(c=Math.max(o.left+1,Math.min(o.right-1,c)),g=m.elementFromPoint(c,f),g&&!t.contentDOM.contains(g)&&(g=null));let y,O=-1;if(g&&((i=t.docView.nearest(g))===null||i===void 0?void 0:i.isEditable)!=!1){if(p.caretPositionFromPoint){let w=p.caretPositionFromPoint(c,f);w&&({offsetNode:y,offset:O}=w)}else if(p.caretRangeFromPoint){let w=p.caretRangeFromPoint(c,f);w&&({startContainer:y,startOffset:O}=w)}y&&(!t.contentDOM.contains(y)||Ce.safari&&Ale(y,O,c)||Ce.chrome&&Ele(y,O,c))&&(y=void 0),y&&(O=Math.min(kl(y),O))}if(!y||!t.docView.dom.contains(y)){let w=Sr.find(t.docView,d);if(!w)return h>l.top+l.height/2?l.to:l.from;({node:y,offset:O}=C5(w.dom,c,f))}let v=t.docView.nearest(y);if(!v)return null;if(v.isWidget&&((s=v.dom)===null||s===void 0?void 0:s.nodeType)==1){let w=v.dom.getBoundingClientRect();return e.yt.defaultLineHeight*1.5){let a=t.viewState.heightOracle.textHeight,l=Math.floor((i-n.top-(t.defaultLineHeight-a)*.5)/a);s+=l*t.viewState.heightOracle.lineLength}let o=t.state.sliceDoc(n.from,n.to);return n.from+f5(o,s,t.state.tabSize)}function Fz(t,e,n){let r,i=t;if(t.nodeType!=3||e!=(r=t.nodeValue.length))return!1;for(;;){let s=i.nextSibling;if(s){if(s.nodeName=="BR")break;return!1}else{let o=i.parentNode;if(!o||o.nodeName=="DIV")break;i=o}}return Mh(t,r-1,r).getBoundingClientRect().right>n}function Ale(t,e,n){return Fz(t,e,n)}function Ele(t,e,n){if(e!=0)return Fz(t,e,n);for(let i=t;;){let s=i.parentNode;if(!s||s.nodeType!=1||s.firstChild!=i)return!1;if(s.classList.contains("cm-line"))break;i=s}let r=t.nodeType==1?t.getBoundingClientRect():Mh(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-r.left>5}function A5(t,e,n){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let i;for(let s of r.type){if(s.from>e)break;if(!(s.toe)return s;(!i||s.type==Gi.Text&&(i.type!=s.type||(n<0?s.frome)))&&(i=s)}}return i||r}return r}function Tle(t,e,n,r){let i=A5(t,e.head,e.assoc||-1),s=!r||i.type!=Gi.Text||!(t.lineWrapping||i.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let o=t.dom.getBoundingClientRect(),a=t.textDirectionAt(i.from),l=t.posAtCoords({x:n==(a==Xn.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(l!=null)return re.cursor(l,n?-1:1)}return re.cursor(n?i.to:i.from,n?-1:1)}function sP(t,e,n,r){let i=t.state.doc.lineAt(e.head),s=t.bidiSpans(i),o=t.textDirectionAt(i.from);for(let a=e,l=null;;){let u=ple(i,s,o,a,n),c=yz;if(!u){if(i.number==(n?t.state.doc.lines:1))return a;c=` `,i=t.state.doc.line(i.number+(n?1:-1)),s=t.bidiSpans(i),u=t.visualLineSide(i,!n)}if(l){if(!l(c))return a}else{if(!r)return u;l=r(c)}a=u}}function Dle(t,e,n){let r=t.state.charCategorizer(e),i=r(n);return s=>{let o=r(s);return i==Kn.Space&&(i=o),i==o}}function Ple(t,e,n,r){let i=e.head,s=n?1:-1;if(i==(n?t.state.doc.length:0))return re.cursor(i,e.assoc);let o=e.goalColumn,a,l=t.contentDOM.getBoundingClientRect(),u=t.coordsAtPos(i,e.assoc||-1),c=t.documentTop;if(u)o==null&&(o=u.left-l.left),a=s<0?u.top:u.bottom;else{let d=t.viewState.lineBlockAt(i);o==null&&(o=Math.min(l.right-l.left,t.defaultCharacterWidth*(i-d.from))),a=(s<0?d.top:d.bottom)+c}let f=l.left+o,h=r??t.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let p=a+(h+d)*s,m=Iz(t,{x:f,y:p},!1,s);if(pl.bottom||(s<0?mi)){let g=t.docView.coordsForChar(m),y=!g||p{if(e>s&&ei(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:re.cursor(r,rs)&&!Fle(o,n)&&this.lineBreak(),i=o}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,a;if(this.lineSeparator?(s=n.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(a=i.exec(n))&&(s=a.index,o=a[0].length),this.append(n.slice(r,s<0?n.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=o-1);r=s+o}}readNode(e){if(e.cmIgnore)return;let n=vn.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let i=r.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(Ile(e,r.node,r.offset)?n:0))}}function Ile(t,e,n){for(;;){if(!e||n-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,r,0))){let a=s||o?[]:Lle(e),l=new Rle(a,e.state);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=Nle(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=s&&s.node==a.focusNode&&s.offset==a.focusOffset||!b5(e.contentDOM,a.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),u=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!b5(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),c=e.viewport;if((Ce.ios||Ce.chrome)&&e.state.selection.main.empty&&l!=u&&(c.from>0||c.toDate.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:a}=e.bounds,l=i.from,u=null;(s===8||Ce.android&&e.text.length=i.from&&n.to<=i.to&&(n.from!=i.from||n.to!=i.to)&&i.to-i.from-(n.to-n.from)<=4?n={from:i.from,to:i.to,insert:t.state.doc.slice(i.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,i.to))}:t.state.doc.lineAt(i.from).toDate.now()-50?n={from:i.from,to:i.to,insert:t.state.toText(t.inputState.insertingText)}:Ce.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==` `&&t.lineWrapping&&(r&&(r=re.single(r.main.anchor-1,r.main.head-1)),n={from:i.from,to:i.to,insert:en.of([" "])}),n)return vA(t,n,r,s);if(r&&!r.main.eq(i)){let o=!1,a="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(o=!0),a=t.inputState.lastSelectionOrigin,a=="select.pointer"&&(r=$z(t.state.facet(cy).map(l=>l(t)),r))),t.dispatch({selection:r,scrollIntoView:o,userEvent:a}),!0}else return!1}function vA(t,e,n,r=-1){if(Ce.ios&&t.inputState.flushIOSKey(e))return!0;let i=t.state.selection.main;if(Ce.android&&(e.to==i.to&&(e.from==i.from||e.from==i.from-1&&t.state.sliceDoc(e.from,i.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&bp(t.contentDOM,"Enter",13)||(e.from==i.from-1&&e.to==i.to&&e.insert.length==0||r==8&&e.insert.lengthi.head)&&bp(t.contentDOM,"Backspace",8)||e.from==i.from&&e.to==i.to+1&&e.insert.length==0&&bp(t.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,a=()=>o||(o=Mle(t,e,n));return t.state.facet(xz).some(l=>l(t,e.from,e.to,s,a))||t.dispatch(a()),!0}function Mle(t,e,n){let r,i=t.state,s=i.selection.main,o=-1;if(e.from==e.to&&e.froms.to){let l=e.fromf(t)),u,l);e.from==c&&(o=c)}if(o>-1)r={changes:e,selection:re.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let l=s.frome.to?i.sliceDoc(e.to,s.to):"";r=i.replaceSelection(t.state.toText(l+e.insert.sliceString(0,void 0,t.state.lineBreak)+u))}else{let l=i.changes(e),u=n&&n.main.to<=l.newLength?n.main:void 0;if(i.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=s.to+10&&e.to>=s.to-10){let c=t.state.sliceDoc(e.from,e.to),f,h=n&&Rz(t,n.main.head);if(h){let m=e.insert.length-(e.to-e.from);f={from:h.from,to:h.to-m}}else f=t.state.doc.lineAt(s.head);let d=s.to-e.to,p=s.to-s.from;r=i.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:l,range:u||m.map(l)};let g=m.to-d,y=g-c.length;if(m.to-m.from!=p||t.state.sliceDoc(y,g)!=c||m.to>=f.from&&m.from<=f.to)return{range:m};let O=i.changes({from:y,to:g,insert:e.insert}),v=m.to-s.to;return{changes:O,range:u?re.range(Math.max(0,u.anchor+v),Math.max(0,u.head+v)):m.map(O)}})}else r={changes:l,selection:u&&i.selection.replaceRange(u)}}let a="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,a+=".compose",t.inputState.compositionFirstChange&&(a+=".start",t.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:a,scrollIntoView:!0})}function Lz(t,e,n,r){let i=Math.min(t.length,e.length),s=0;for(;s0&&a>0&&t.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let l=Math.max(0,s-Math.min(o,a));n-=o+l-s}if(o=o?s-n:0;s-=l,a=s+(a-o),o=s}else if(a=a?s-n:0;s-=l,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}function Lle(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}=t.observer.selectionRange;return n&&(e.push(new oP(n,r)),(i!=n||s!=r)&&e.push(new oP(i,s))),e}function Nle(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?re.single(n+e,r+e):null}class Qle{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Ce.safari&&e.contentDOM.addEventListener("input",()=>null),Ce.gecko&&tue(e.contentDOM.ownerDocument)}handleEvent(e){!Xle(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let r=this.handlers[e];if(r){for(let i of r.observers)i(this.view,n);for(let i of r.handlers){if(n.defaultPrevented)break;if(i(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=Ble(e),r=this.handlers,i=this.view.contentDOM;for(let s in n)if(s!="scroll"){let o=!n[s].handlers.length,a=r[s];a&&o!=!a.handlers.length&&(i.removeEventListener(s,this.handleEvent),a=null),a||i.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!="scroll"&&!n[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&Qz.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Ce.android&&Ce.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return Ce.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=Nz.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||zle.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from0?!0:Ce.safari&&!Ce.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function aP(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(i){Wi(n.state,i)}}}function Ble(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let i=r.spec,s=i&&i.plugin.domEventHandlers,o=i&&i.plugin.domEventObservers;if(s)for(let a in s){let l=s[a];l&&n(a).handlers.push(aP(r.value,l))}if(o)for(let a in o){let l=o[a];l&&n(a).observers.push(aP(r.value,l))}}for(let r in ha)n(r).handlers.push(ha[r]);for(let r in Ro)n(r).observers.push(Ro[r]);return e}const Nz=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],zle="dthko",Qz=[16,17,18,20,91,92,224,225],sb=6;function ob(t){return Math.max(0,t)*.7+8}function Ule(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class jle{constructor(e,n,r,i){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=Hae(e.contentDOM),this.atoms=e.state.facet(cy).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(Zt.allowMultipleSelections)&&qle(e,n),this.dragging=Zle(e,n)&&Uz(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&Ule(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,i=0,s=0,o=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:i,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=OA(this.view);e.clientX-l.left<=i+sb?n=-ob(i-e.clientX):e.clientX+l.right>=o-sb&&(n=ob(e.clientX-o)),e.clientY-l.top<=s+sb?r=-ob(s-e.clientY):e.clientY+l.bottom>=a-sb&&(r=ob(e.clientY-a)),this.setScrollSpeed(n,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=$z(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function qle(t,e){let n=t.state.facet(bz);return n.length?n[0](e):Ce.mac?e.metaKey:e.ctrlKey}function Vle(t,e){let n=t.state.facet(Oz);return n.length?n[0](e):Ce.mac?!e.altKey:!e.ctrlKey}function Zle(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=r1(t.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let s=0;s=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function Xle(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=vn.get(n))&&r.ignoreEvent(e))return!1;return!0}const ha=Object.create(null),Ro=Object.create(null),Bz=Ce.ie&&Ce.ie_version<15||Ce.ios&&Ce.webkit_version<604;function Wle(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),zz(t,n.value)},50)}function Rx(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function zz(t,e){e=Rx(t.state,gA,e);let{state:n}=t,r,i=1,s=n.toText(e),o=s.lines==n.selection.ranges.length;if(E5!=null&&n.selection.ranges.every(l=>l.empty)&&E5==s.toString()){let l=-1;r=n.changeByRange(u=>{let c=n.doc.lineAt(u.from);if(c.from==l)return{range:u};l=c.from;let f=n.toText((o?s.line(i++).text:e)+n.lineBreak);return{changes:{from:c.from,insert:f},range:re.cursor(u.from+f.length)}})}else o?r=n.changeByRange(l=>{let u=s.line(i++);return{changes:{from:l.from,to:l.to,insert:u.text},range:re.cursor(l.from+u.length)}}):r=n.replaceSelection(s);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Ro.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};ha.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);Ro.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};Ro.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};ha.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(vz))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=Hle(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new jle(t,e,n,r)),r&&t.observer.ignore(()=>{tz(t.contentDOM);let s=t.root.activeElement;s&&!s.contains(t.contentDOM)&&s.blur()});let i=t.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function lP(t,e,n,r){if(r==1)return re.cursor(e,n);if(r==2)return Sle(t.state,e,n);{let i=Sr.find(t.docView,e),s=t.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,a=i?i.posAtEnd:s.to;return ae>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function Yle(t,e,n,r){let i=Sr.find(t.docView,e);if(!i)return 1;let s=e-i.posAtStart;if(s==0)return 1;if(s==i.length)return-1;let o=i.coordsAt(s,-1);if(o&&uP(n,r,o))return-1;let a=i.coordsAt(s,1);return a&&uP(n,r,a)?1:o&&o.bottom>=r?-1:1}function cP(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:Yle(t,n,e.clientX,e.clientY)}}const Gle=Ce.ie&&Ce.ie_version<=11;let fP=null,hP=0,dP=0;function Uz(t){if(!Gle)return t.detail;let e=fP,n=dP;return fP=t,dP=Date.now(),hP=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(hP+1)%3:1}function Hle(t,e){let n=cP(t,e),r=Uz(e),i=t.state.selection;return{update(s){s.docChanged&&(n.pos=s.changes.mapPos(n.pos),i=i.map(s.changes))},get(s,o,a){let l=cP(t,s),u,c=lP(t,l.pos,l.bias,r);if(n.pos!=l.pos&&!o){let f=lP(t,n.pos,n.bias,r),h=Math.min(f.from,c.from),d=Math.max(f.to,c.to);c=h1&&(u=Kle(i,l.pos))?u:a?i.addRange(c):re.create([c])}}}function Kle(t,e){for(let n=0;n=e)return re.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}ha.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let i=t.docView.nearest(e.target);if(i&&i.isWidget){let s=i.posAtStart,o=s+i.length;(s>=n.to||o<=n.from)&&(n=re.range(s,o))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",Rx(t.state,yA,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};ha.dragend=t=>(t.inputState.draggedContent=null,!1);function pP(t,e,n,r){if(n=Rx(t.state,gA,n),!n)return;let i=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=t.inputState,o=r&&s&&Vle(t,e)?{from:s.from,to:s.to}:null,a={from:i,insert:n},l=t.state.changes(o?[o,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(i,-1),head:l.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"}),t.inputState.draggedContent=null}ha.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,s=()=>{++i==n.length&&pP(t,e,r.filter(o=>o!=null).join(t.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(r[o]=a.result),s()},a.readAsText(n[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return pP(t,e,r,!0),!0}return!1};ha.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=Bz?null:e.clipboardData;return n?(zz(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(Wle(t),!1)};function Jle(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function eue(t){let e=[],n=[],r=!1;for(let i of t.selection.ranges)i.empty||(e.push(t.sliceDoc(i.from,i.to)),n.push(i));if(!e.length){let i=-1;for(let{from:s}of t.selection.ranges){let o=t.doc.lineAt(s);o.number>i&&(e.push(o.text),n.push({from:o.from,to:Math.min(t.doc.length,o.to+1)})),i=o.number}r=!0}return{text:Rx(t,yA,e.join(t.lineBreak)),ranges:n,linewise:r}}let E5=null;ha.copy=ha.cut=(t,e)=>{let{text:n,ranges:r,linewise:i}=eue(t.state);if(!n&&!i)return!1;E5=i?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=Bz?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(Jle(t,n),!1)};const jz=Ju.define();function qz(t,e){let n=[];for(let r of t.facet(_z)){let i=r(t,e);i&&n.push(i)}return n.length?t.update({effects:n,annotations:jz.of(!0)}):null}function Vz(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=qz(t.state,e);n?t.dispatch(n):t.update([])}},10)}Ro.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),Vz(t)};Ro.blur=t=>{t.observer.clearSelectionRange(),Vz(t)};Ro.compositionstart=Ro.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};Ro.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Ce.chrome&&Ce.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};Ro.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};ha.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let s=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let a=o[0],l=t.posAtDOM(a.startContainer,a.startOffset),u=t.posAtDOM(a.endContainer,a.endOffset);return vA(t,{from:l,to:u,insert:t.state.toText(s)},null),!0}}let i;if(Ce.chrome&&Ce.android&&(i=Nz.find(s=>s.inputType==e.inputType))&&(t.observer.delayAndroidKey(i.key,i.keyCode),i.key=="Backspace"||i.key=="Delete")){let s=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>s+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return Ce.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),Ce.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Ro.compositionend(t,e),20),!1};const mP=new Set;function tue(t){mP.has(t)||(mP.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const gP=["pre-wrap","normal","pre-line","break-spaces"];let r0=!1;function yP(){r0=!1}class nue{constructor(e){this.lineWrapping=e,this.doc=en.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return gP.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r-1,l=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=n,this.charWidth=r,this.textHeight=i,this.lineLength=s,l){this.heightSamples={};for(let u=0;u0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>EO&&(r0=!0),this.height=e)}replace(e,n,r){return Hi.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,i){let s=this,o=r.doc;for(let a=i.length-1;a>=0;a--){let{fromA:l,toA:u,fromB:c,toB:f}=i[a],h=s.lineAt(l,Vn.ByPosNoHeight,r.setDoc(n),0,0),d=h.to>=u?h:s.lineAt(u,Vn.ByPosNoHeight,r,0,0);for(f+=d.to-u,u=d.to;a>0&&h.from<=i[a-1].toA;)l=i[a-1].fromA,c=i[a-1].fromB,a--,ls*2){let a=e[n-1];a.break?e.splice(--n,1,a.left,null,a.right):e.splice(--n,1,a.left,a.right),r+=1+a.break,i-=a.size}else if(s>i*2){let a=e[r];a.break?e.splice(r,1,a.left,null,a.right):e.splice(r,1,a.left,a.right),r+=2+a.break,s-=a.size}else break;else if(i=s&&o(this.blockAt(0,r,i,s))}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more&&this.setHeight(i.heights[i.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Us extends Zz{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,i){return new Ga(i,this.length,r,this.height,this.breaks)}replace(e,n,r){let i=r[0];return r.length==1&&(i instanceof Us||i instanceof ri&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof ri?i=new Us(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):Hi.of(r)}updateHeight(e,n=0,r=!1,i){return i&&i.from<=n&&i.more?this.setHeight(i.heights[i.index++]):(r||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class ri extends Hi{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,i=e.doc.lineAt(n+this.length).number,s=i-r+1,o,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*s);o=l/s,this.length>s+1&&(a=(this.height-l)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:i,perLine:o,perChar:a}}blockAt(e,n,r,i){let{firstLine:s,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(n,i);if(n.lineWrapping){let u=i+(e0){let s=r[r.length-1];s instanceof ri?r[r.length-1]=new ri(s.length+i):r.push(null,new ri(i-1))}if(e>0){let s=r[0];s instanceof ri?r[0]=new ri(e+s.length):r.unshift(new ri(e-1),null)}return Hi.of(r)}decomposeLeft(e,n){n.push(new ri(e-1),null)}decomposeRight(e,n){n.push(null,new ri(this.length-e-1))}updateHeight(e,n=0,r=!1,i){let s=n+this.length;if(i&&i.from<=n+this.length&&i.more){let o=[],a=Math.max(n,i.from),l=-1;for(i.from>n&&o.push(new ri(i.from-n-1).updateHeight(e,n));a<=s&&i.more;){let c=e.doc.lineAt(a).length;o.length&&o.push(null);let f=i.heights[i.index++];l==-1?l=f:Math.abs(f-l)>=EO&&(l=-2);let h=new Us(c,f);h.outdated=!1,o.push(h),a+=c+1}a<=s&&o.push(null,new ri(s-a).updateHeight(e,a));let u=Hi.of(o);return(l<0||Math.abs(u.height-this.height)>=EO||Math.abs(l-this.heightMetrics(e,n).perLine)>=EO)&&(r0=!0),p2(this,u)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class iue extends Hi{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,i){let s=r+this.left.height;return ea))return u;let c=n==Vn.ByPosNoHeight?Vn.ByPosNoHeight:Vn.ByPos;return l?u.join(this.right.lineAt(a,c,r,o,a)):this.left.lineAt(a,c,r,i,s).join(u)}forEachLine(e,n,r,i,s,o){let a=i+this.left.height,l=s+this.left.length+this.break;if(this.break)e=l&&this.right.forEachLine(e,n,r,a,l,o);else{let u=this.lineAt(l,Vn.ByPos,r,i,s);e=e&&u.from<=n&&o(u),n>u.to&&this.right.forEachLine(u.to+1,n,r,a,l,o)}}replace(e,n,r){let i=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(e-i,n-i,r));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let a of r)s.push(a);if(e>0&&bP(s,o-1),n=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,i=r+this.break;if(e>=i)return this.right.decomposeRight(e-i,n);e2*n.size||n.size>2*e.size?Hi.of(this.break?[e,null,n]:[e,n]):(this.left=p2(this.left,e),this.right=p2(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,i){let{left:s,right:o}=this,a=n+s.length+this.break,l=null;return i&&i.from<=n+s.length&&i.more?l=s=s.updateHeight(e,n,r,i):s.updateHeight(e,n,r),i&&i.from<=a+o.length&&i.more?l=o=o.updateHeight(e,a,r,i):o.updateHeight(e,a,r),l?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function bP(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof ri&&(r=t[e+1])instanceof ri&&t.splice(e-1,3,new ri(n.length+1+r.length))}const sue=5;class wA{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof Us?i.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Us(r-this.pos,-1)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e=sue)&&this.addLineDeco(i,s,o)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenToe&&this.nodes.push(new Us(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new ri(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Us)return e;let n=new Us(0,-1);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let i=this.ensureLine();i.length+=r,i.collapsed+=r,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof Us)&&!this.isCovered?this.nodes.push(new Us(0,-1)):(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let h=c.getBoundingClientRect();s=Math.max(s,h.left),o=Math.min(o,h.right),a=Math.max(a,h.top),l=Math.min(u==t.parentNode?i.innerHeight:l,h.bottom)}u=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:s-n.left,right:Math.max(s,o)-n.left,top:a-(n.top+e),bottom:Math.max(a,l)-(n.top+e)}}function uue(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left0&&e.top0}function cue(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class kS{constructor(e,n,r,i){this.from=e,this.to=n,this.size=r,this.displaySize=i}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;rtypeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new nue(n),this.stateDeco=e.facet(s1).filter(r=>typeof r!="function"),this.heightMap=Hi.empty().applyChanges(this.stateDeco,en.empty,this.heightOracle.setDoc(e.doc),[new ko(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=st.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let i=r?n.head:n.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new ab(s,o))}}return this.viewports=e.sort((r,i)=>r.from-i.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?vP:new xA(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(ig(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(s1).filter(c=>typeof c!="function");let i=e.changedRanges,s=ko.extendWithRanges(i,oue(r,this.stateDeco,e?e.changes:Lr.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);yP(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||r0)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let l=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.headl.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,n));let u=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(u||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(kz)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),i=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Xn.RTL:Xn.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),a=n.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let u=0,c=0;if(a.width&&a.height){let{scaleX:w,scaleY:x}=ez(n,a);(w>.005&&Math.abs(this.scaleX-w)>.005||x>.005&&Math.abs(this.scaleY-x)>.005)&&(this.scaleX=w,this.scaleY=x,u|=16,o=l=!0)}let f=(parseInt(r.paddingTop)||0)*this.scaleY,h=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=h)&&(this.paddingTop=f,this.paddingBottom=h,u|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,u|=16);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=rz(e.scrollDOM);let p=(this.printing?cue:lue)(n,this.paddingTop),m=p.top-this.pixelViewport.top,g=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let y=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(y!=this.inView&&(this.inView=y,y&&(l=!0)),!this.inView&&!this.scrollTarget&&!uue(e.dom))return 0;let O=a.width;if((this.contentDOMWidth!=O||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,u|=16),l){let w=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(w)&&(o=!0),o||i.lineWrapping&&Math.abs(O-this.contentDOMWidth)>i.charWidth){let{lineHeight:x,charWidth:S,textHeight:_}=e.docView.measureTextSize();o=x>0&&i.refresh(s,x,S,_,Math.max(5,O/S),w),o&&(e.docView.minWidth=0,u|=16)}m>0&&g>0?c=Math.max(m,g):m<0&&g<0&&(c=Math.min(m,g)),yP();for(let x of this.viewports){let S=x.from==this.viewport.from?w:e.docView.measureVisibleLineHeights(x);this.heightMap=(o?Hi.empty().applyChanges(this.stateDeco,en.empty,this.heightOracle,[new ko(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new rue(x.from,S))}r0&&(u|=2)}let v=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return v&&(u&2&&(u|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),u|=this.updateForViewport()),(u&2||v)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),u}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new ab(i.lineAt(o-r*1e3,Vn.ByHeight,s,0,0).from,i.lineAt(a+(1-r)*1e3,Vn.ByHeight,s,0,0).to);if(n){let{head:u}=n.range;if(ul.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=i.lineAt(u,Vn.ByPos,s,0,0),h;n.y=="center"?h=(f.top+f.bottom)/2-c/2:n.y=="start"||n.y=="nearest"&&u=a+Math.max(10,Math.min(r,250)))&&i>o-2*1e3&&s>1,o=i<<1;if(this.defaultTextDirection!=Xn.LTR&&!r)return[];let a=[],l=(c,f,h,d)=>{if(f-cc&&yy.from>=h.from&&y.to<=h.to&&Math.abs(y.from-c)y.fromO));if(!g){if(fv.from<=f&&v.to>=f)){let v=n.moveToLineBoundary(re.cursor(f),!1,!0).head;v>c&&(f=v)}let y=this.gapSize(h,c,f,d),O=r||y<2e6?y:2e6;g=new kS(c,f,y,O)}a.push(g)},u=c=>{if(c.length2e6)for(let S of e)S.from>=c.from&&S.fromc.from&&l(c.from,d,c,f),pn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];on.spans(n,this.viewport.from,this.viewport.to,{span(s,o){r.push({from:s,to:o})},point(){}},20);let i=0;if(r.length!=this.visibleRanges.length)i=12;else for(let s=0;s=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||ig(this.heightMap.lineAt(e,Vn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||ig(this.heightMap.lineAt(this.scaler.fromDOM(e),Vn.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return ig(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class ab{constructor(e,n){this.from=e,this.to=n}}function hue(t,e,n){let r=[],i=t,s=0;return on.spans(n,t,e,{span(){},point(o,a){o>i&&(r.push({from:i,to:o}),s+=o-i),i=a}},20),i=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let i=0;;i++){let{from:s,to:o}=e[i],a=o-s;if(r<=a)return s+r;r-=a}}function ub(t,e){let n=0;for(let{from:r,to:i}of t.ranges){if(e<=i){n+=e-r;break}n+=i-r}return n/t.total}function due(t,e){for(let n of t)if(e(n))return n}const vP={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class xA{constructor(e,n,r){let i=0,s=0,o=0;this.viewports=r.map(({from:a,to:l})=>{let u=n.lineAt(a,Vn.ByPos,e,0,0).top,c=n.lineAt(l,Vn.ByPos,e,0,0).bottom;return i+=c-u,{from:a,to:l,top:u,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(n.height-i);for(let a of this.viewports)a.domTop=o+(a.top-s)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),s=a.bottom}toDOM(e){for(let n=0,r=0,i=0;;n++){let s=nn.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function ig(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new Ga(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(i=>ig(i,e)):t._content)}const cb=Ie.define({combine:t=>t.join(" ")}),T5=Ie.define({combine:t=>t.indexOf(!0)>-1}),D5=tf.newName(),Xz=tf.newName(),Wz=tf.newName(),Yz={"&light":"."+Xz,"&dark":"."+Wz};function P5(t,e,n){return new tf(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,i=>{if(i=="&")return t;if(!n||!n[i])throw new RangeError(`Unsupported selector: ${i}`);return n[i]}):t+" "+r}})}const pue=P5("."+D5,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Yz),mue={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},CS=Ce.ie&&Ce.ie_version<=11;class gue{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Kae,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(Ce.ie&&Ce.ie_version<=11||Ce.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Ce.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Ce.chrome&&Ce.chrome_version<126)&&(this.editContext=new bue(e),e.state.facet(mu)&&(e.contentDOM.editContext=this.editContext.editContext)),CS&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,i=this.selectionRange;if(r.state.facet(mu)?r.root.activeElement!=this.dom:!CO(this.dom,i))return;let s=i.anchorNode&&r.docView.nearest(i.anchorNode);if(s&&s.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(Ce.ie&&Ce.ie_version<=11||Ce.android&&Ce.chrome)&&!r.state.selection.main.empty&&i.focusNode&&Sg(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=r1(e.root);if(!n)return!1;let r=Ce.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&yue(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let i=CO(this.dom,r);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&bp(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),n==-1?{from:n,to:r}=o:(n=Math.min(o.from,n),r=Math.max(o.to,r)))}return{from:n,to:r,typeOver:i}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),i=this.selectionChanged&&CO(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new $le(this.view,e,n,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=Mz(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!n.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),i}readMutation(e){let n=this.view.docView.nearest(e.target);if(!n||n.ignoreMutation(e))return null;if(n.markDirty(e.type=="attributes"),e.type=="attributes"&&(n.flags|=4),e.type=="childList"){let r=wP(n,e.previousSibling||e.target.previousSibling,-1),i=wP(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:i?n.posBefore(i):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(mu)!=e.state.facet(mu)&&(e.view.contentDOM.editContext=e.state.facet(mu)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function wP(t,e,n){for(;e;){let r=vn.get(e);if(r&&r.parent==t)return r;let i=e.parentNode;e=i!=t.dom?i:n>0?e.nextSibling:e.previousSibling}return null}function xP(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.docView.domAtPos(t.state.selection.main.anchor);return Sg(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function yue(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return xP(t,i)}let n=null;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?xP(t,n):null}class bue{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let i=e.state.selection.main,{anchor:s,head:o}=i,a=this.toEditorPos(r.updateRangeStart),l=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:a,drifted:!1});let u=l-a>r.text.length;a==this.from&&sthis.to&&(l=s);let c=Lz(e.state.sliceDoc(a,l),r.text,(u?i.from:i.to)-a,u?"end":null);if(!c){let h=re.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));h.main.eq(i)||e.dispatch({selection:h,userEvent:"select"});return}let f={from:c.from+a,to:c.toA+a,insert:en.of(r.text.slice(c.from,c.toB).split(` `))};if((Ce.mac||Ce.android)&&f.from==o-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:a,to:l,insert:en.of([r.text.replace("."," ")])}),this.pendingContextChange=f,!e.state.readOnly){let h=this.to-this.from+(f.to-f.from+f.insert.length);vA(e,f,re.single(this.toEditorPos(r.selectionStart,h),this.toEditorPos(r.selectionEnd,h)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),f.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let i=[],s=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);o{let i=[];for(let s of r.getTextFormats()){let o=s.underlineStyle,a=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(a)){let l=this.toEditorPos(s.rangeStart),u=this.toEditorPos(s.rangeEnd);if(l{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.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=r1(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,i=this.pendingContextChange;return e.changes.iterChanges((s,o,a,l,u)=>{if(r)return;let c=u.length-(o-s);if(i&&o>=i.to)if(i.from==s&&i.to==o&&i.insert.eq(u)){i=this.pendingContextChange=null,n+=c,this.to+=c;return}else i=null,this.revertPending(e.state);if(s+=n,o+=n,o<=this.from)this.from+=c,this.to+=c;else if(sthis.to||this.to-this.from+u.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),u.toString()),this.to+=c}n+=c}),i&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(i=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.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(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class Te{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var 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),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(i=>i.forEach(s=>r(s,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Jae(e.parent)||document,this.viewState=new OP(e.state||Zt.create(e)),e.scrollTo&&e.scrollTo.is(ib)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Gd).map(i=>new xS(i));for(let i of this.plugins)i.update(this);this.observer=new gue(this),this.inputState=new Qle(this),this.inputState.ensureHandlers(this.plugins),this.docView=new eP(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(...e){let n=e.length==1&&e[0]instanceof Ar?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){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 e){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 o=this.hasFocus,a=0,l=null;e.some(h=>h.annotation(jz))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=qz(s,o),l||(a=1));let u=this.observer.delayedAndroidKey,c=null;if(u?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(c=null)):this.observer.clear(),s.facet(Zt.phrases)!=this.state.facet(Zt.phrases))return this.setState(s);i=d2.create(this,s,e),i.flags|=a;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let h of e){if(f&&(f=f.map(h.changes)),h.scrollIntoView){let{main:d}=h.state.selection;f=new Op(d.empty?d:re.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of h.effects)d.is(ib)&&(f=d.value.clip(this.state))}this.viewState.update(i,f),this.bidiCache=m2.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(ng)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(h=>h.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(cb)!=i.state.facet(cb)&&(this.viewState.mustMeasureContent=!0),(n||r||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let h of this.state.facet(k5))try{h(i)}catch(d){Wi(this.state,d,"update listener")}(l||c)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),c&&!Mz(this,c)&&u.force&&bp(this.contentDOM,u.key,u.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new OP(e),this.plugins=e.facet(Gd).map(r=>new xS(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new eP(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(Gd),r=e.state.facet(Gd);if(n!=r){let i=[];for(let s of r){let o=n.indexOf(s);if(o<0)i.push(new xS(s));else{let a=this.plugins[o];a.mustUpdate=e,i.push(a)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,i=r.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(rz(r))s=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(i);s=d.from,o=d.top}this.updateState=1;let l=this.viewState.measure(this);if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];l&4||([this.measureRequests,u]=[u,this.measureRequests]);let c=u.map(d=>{try{return d.read(this)}catch(p){return Wi(this.state,p),_P}}),f=d2.create(this,this.state,[]),h=!1;f.flags|=l,n?n.flags|=l:n=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),h=this.docView.update(f),h&&this.docViewUpdate());for(let d=0;d1||p<-1){i=i+p,r.scrollTop=i/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let a of this.state.facet(k5))a(n)}get themeClasses(){return D5+" "+(this.state.facet(T5)?Wz:Xz)+" "+this.state.facet(cb)}updateAttrs(){let e=SP(this,Ez,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(mu)?"true":"false",class:"cm-content",style:`${Ce.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),SP(this,bA,n);let r=this.observer.ignore(()=>{let i=v5(this.contentDOM,this.contentAttrs,n),s=v5(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let i of r.effects)if(i.is(Te.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(ng);let e=this.state.facet(Te.cspNonce);tf.mount(this.root,this.styleModules.concat(pue).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;nr.plugin==e)||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(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return SS(this,e,sP(this,e,n,r))}moveByGroup(e,n){return SS(this,e,sP(this,e,n,r=>Dle(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),i=this.textDirectionAt(e.from),s=r[n?r.length-1:0];return re.cursor(s.side(n,i)+e.from,s.forward(!n,i)?1:-1)}moveToLineBoundary(e,n,r=!0){return Tle(this,e,n,r)}moveVertically(e,n,r){return SS(this,e,Ple(this,e,n,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){return this.readMeasured(),Iz(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let i=this.state.doc.lineAt(e),s=this.bidiSpans(i),o=s[Sc.find(s,e-i.from,-1,n)];return Px(r,o.dir==Xn.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Sz)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Oue)return gz(e.length);let n=this.textDirectionAt(e.from),r;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==n&&(s.fresh||mz(s.isolates,r=JD(this,e))))return s.order;r||(r=JD(this,e));let i=dle(e.text,n,r);return this.bidiCache.push(new m2(e.from,e.to,n,r,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Ce.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{tz(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return ib.of(new Op(typeof e=="number"?re.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return ib.of(new Op(re.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Tr.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Tr.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=tf.newName(),i=[cb.of(r),ng.of(P5(`.${r}`,e))];return n&&n.dark&&i.push(T5.of(!0)),i}static baseTheme(e){return Ku.lowest(ng.of(P5("."+D5,e,Yz)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),i=r&&vn.get(r)||vn.get(e);return((n=i?.rootView)===null||n===void 0?void 0:n.view)||null}}Te.styleModule=ng;Te.inputHandler=xz;Te.clipboardInputFilter=gA;Te.clipboardOutputFilter=yA;Te.scrollHandler=Cz;Te.focusChangeEffect=_z;Te.perLineTextDirection=Sz;Te.exceptionSink=wz;Te.updateListener=k5;Te.editable=mu;Te.mouseSelectionStyle=vz;Te.dragMovesSelection=Oz;Te.clickAddsSelectionRange=bz;Te.decorations=s1;Te.outerDecorations=Tz;Te.atomicRanges=cy;Te.bidiIsolatedRanges=Dz;Te.scrollMargins=Pz;Te.darkTheme=T5;Te.cspNonce=Ie.define({combine:t=>t.length?t[0]:""});Te.contentAttributes=bA;Te.editorAttributes=Ez;Te.lineWrapping=Te.contentAttributes.of({class:"cm-lineWrapping"});Te.announce=wt.define();const Oue=4096,_P={};class m2{constructor(e,n,r,i,s,o){this.from=e,this.to=n,this.dir=r,this.isolates=i,this.fresh=s,this.order=o}static update(e,n){if(n.empty&&!e.some(s=>s.fresh))return e;let r=[],i=e.length?e[e.length-1].dir:Xn.LTR;for(let s=Math.max(0,e.length-10);s=0;i--){let s=r[i],o=typeof s=="function"?s(t):s;o&&O5(o,n)}return n}const vue=Ce.mac?"mac":Ce.windows?"win":Ce.linux?"linux":"key";function wue(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let i,s,o,a;for(let l=0;lr.concat(i),[]))),n}function _ue(t,e,n){return Hz(Gz(t.state),e,t,n)}let bc=null;const Sue=4e3;function kue(t,e=vue){let n=Object.create(null),r=Object.create(null),i=(o,a)=>{let l=r[o];if(l==null)r[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,a,l,u,c)=>{var f,h;let d=n[o]||(n[o]=Object.create(null)),p=a.split(/ (?!$)/).map(y=>wue(y,e));for(let y=1;y{let w=bc={view:v,prefix:O,scope:o};return setTimeout(()=>{bc==w&&(bc=null)},Sue),!0}]})}let m=p.join(" ");i(m,!1);let g=d[m]||(d[m]={preventDefault:!1,stopPropagation:!1,run:((h=(f=d._any)===null||f===void 0?void 0:f.run)===null||h===void 0?void 0:h.slice())||[]});l&&g.run.push(l),u&&(g.preventDefault=!0),c&&(g.stopPropagation=!0)};for(let o of t){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let u of a){let c=n[u]||(n[u]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let h in c)c[h].run.push(d=>f(d,R5))}let l=o[e]||o.key;if(l)for(let u of a)s(u,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(u,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return n}let R5=null;function Hz(t,e,n,r){R5=e;let i=Xae(e),s=ds(i,0),o=Ya(s)==i.length&&i!=" ",a="",l=!1,u=!1,c=!1;bc&&bc.view==n&&bc.scope==r&&(a=bc.prefix+" ",Qz.indexOf(e.keyCode)<0&&(u=!0,bc=null));let f=new Set,h=g=>{if(g){for(let y of g.run)if(!f.has(y)&&(f.add(y),y(n)))return g.stopPropagation&&(c=!0),!0;g.preventDefault&&(g.stopPropagation&&(c=!0),u=!0)}return!1},d=t[r],p,m;return d&&(h(d[a+fb(i,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Ce.windows&&e.ctrlKey&&e.altKey)&&!(Ce.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(p=nf[e.keyCode])&&p!=i?(h(d[a+fb(p,e,!0)])||e.shiftKey&&(m=n1[e.keyCode])!=i&&m!=p&&h(d[a+fb(m,e,!1)]))&&(l=!0):o&&e.shiftKey&&h(d[a+fb(i,e,!0)])&&(l=!0),!l&&h(d._any)&&(l=!0)),u&&(l=!0),l&&c&&e.stopPropagation(),R5=null,l}class hy{constructor(e,n,r,i,s){this.className=e,this.left=n,this.top=r,this.width=i,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let i=e.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let s=Kz(e);return[new hy(n,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return Cue(e,n,r)}}function Kz(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Xn.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function CP(t,e,n,r){let i=t.coordsAtPos(e,n*2);if(!i)return r;let s=t.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,a=t.posAtCoords({x:s.left+1,y:o}),l=t.posAtCoords({x:s.right-1,y:o});return a==null||l==null?r:{from:Math.max(r.from,Math.min(a,l)),to:Math.min(r.to,Math.max(a,l))}}function Cue(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),i=Math.min(n.to,t.viewport.to),s=t.textDirection==Xn.LTR,o=t.contentDOM,a=o.getBoundingClientRect(),l=Kz(t),u=o.querySelector(".cm-line"),c=u&&window.getComputedStyle(u),f=a.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),h=a.right-(c?parseInt(c.paddingRight):0),d=A5(t,r,1),p=A5(t,i,-1),m=d.type==Gi.Text?d:null,g=p.type==Gi.Text?p:null;if(m&&(t.lineWrapping||d.widgetLineBreaks)&&(m=CP(t,r,1,m)),g&&(t.lineWrapping||p.widgetLineBreaks)&&(g=CP(t,i,-1,g)),m&&g&&m.from==g.from&&m.to==g.to)return O(v(n.from,n.to,m));{let x=m?v(n.from,null,m):w(d,!1),S=g?v(null,n.to,g):w(p,!0),_=[];return(m||d).to<(g||p).from-(m&&g?1:0)||d.widgetLineBreaks>1&&x.bottom+t.defaultLineHeight/2E&&R.from=Q)break;ee>$&&A(Math.max(z,$),x==null&&z<=E,Math.min(ee,Q),S==null&&ee>=T,q.dir)}if($=B.to+1,$>=Q)break}return D.length==0&&A(E,x==null,T,S==null,t.textDirection),{top:k,bottom:C,horizontal:D}}function w(x,S){let _=a.top+(S?x.top:x.bottom);return{top:_,bottom:_,horizontal:[]}}}function Aue(t,e){return t.constructor==e.constructor&&t.eq(e)}class Eue{constructor(e,n){this.view=e,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=e.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(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(TO)!=e.state.facet(TO)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(TO);for(;n!Aue(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let i of e)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=e,Ce.safari&&Ce.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const TO=Ie.define();function Jz(t){return[Tr.define(e=>new Eue(e,t)),TO.of(t)]}const o1=Ie.define({combine(t){return ec(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function Tue(t={}){return[o1.of(t),Due,Pue,Rue,kz.of(!0)]}function eU(t){return t.startState.facet(o1)!=t.state.facet(o1)}const Due=Jz({above:!0,markers(t){let{state:e}=t,n=e.facet(o1),r=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty||n.drawRangeCursor){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=i.empty?i:re.cursor(i.head,i.head>i.anchor?-1:1);for(let l of hy.forRange(t,o,a))r.push(l)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=eU(t);return n&&AP(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){AP(e.state,t)},class:"cm-cursorLayer"});function AP(t,e){e.style.animationDuration=t.facet(o1).cursorBlinkRate+"ms"}const Pue=Jz({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:hy.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||eU(t)},class:"cm-selectionLayer"}),Rue=Ku.highest(Te.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"}}}})),tU=wt.define({map(t,e){return t==null?null:e.mapPos(t)}}),sg=Pr.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(tU)?r.value:n,t)}}),Iue=Tr.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(sg);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(sg)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(sg),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(sg)!=t&&this.view.dispatch({effects:tU.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Fue(){return[sg,Iue]}function EP(t,e,n,r,i){e.lastIndex=0;for(let s=t.iterRange(n,r),o=n,a;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;a=e.exec(s.value);)i(o+a.index,a)}function $ue(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:i,to:s}of n)i=Math.max(t.state.doc.lineAt(i).from,i-e),s=Math.min(t.state.doc.lineAt(s).to,s+e),r.length&&r[r.length-1].to>=i?r[r.length-1].to=s:r.push({from:i,to:s});return r}class Mue{constructor(e){const{regexp:n,decoration:r,decorate:i,boundary:s,maxLength:o=1e3}=e;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=(a,l,u,c)=>i(c,u,u+a[0].length,a,l);else if(typeof r=="function")this.addMatch=(a,l,u,c)=>{let f=r(a,l,u);f&&c(u,u+a[0].length,f)};else if(r)this.addMatch=(a,l,u,c)=>c(u,u+a[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let n=new ef,r=n.add.bind(n);for(let{from:i,to:s}of $ue(e,this.maxLength))EP(e.state.doc,this.regexp,i,s,(o,a)=>this.addMatch(a,e,o,r));return n.finish()}updateDeco(e,n){let r=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((s,o,a,l)=>{l>=e.view.viewport.from&&a<=e.view.viewport.to&&(r=Math.min(a,r),i=Math.max(l,i))}),e.viewportMoved||i-r>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,n.map(e.changes),r,i):n}updateRange(e,n,r,i){for(let s of e.visibleRanges){let o=Math.max(s.from,r),a=Math.min(s.to,i);if(a>=o){let l=e.state.doc.lineAt(o),u=l.tol.from;o--)if(this.boundary.test(l.text[o-1-l.from])){c=o;break}for(;ah.push(y.range(m,g));if(l==u)for(this.regexp.lastIndex=c-l.from;(d=this.regexp.exec(l.text))&&d.indexthis.addMatch(g,e,m,p));n=n.update({filterFrom:c,filterTo:f,filter:(m,g)=>mf,add:h})}}return n}}const I5=/x/.unicode!=null?"gu":"g",Lue=new RegExp(`[\0-\b --Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,I5),Nue={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 AS=null;function Que(){var t;if(AS==null&&typeof document<"u"&&document.body){let e=document.body.style;AS=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return AS||!1}const DO=Ie.define({combine(t){let e=ec(t,{render:null,specialChars:Lue,addSpecialChars:null});return(e.replaceTabs=!Que())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,I5)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,I5)),e}});function Bue(t={}){return[DO.of(t),zue()]}let TP=null;function zue(){return TP||(TP=Tr.fromClass(class{constructor(t){this.view=t,this.decorations=st.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(DO)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new Mue({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:i}=n.state,s=ds(e[0],0);if(s==9){let o=i.lineAt(r),a=n.state.tabSize,l=ca(o.text,a,r-o.from);return st.replace({widget:new Vue((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=st.replace({widget:new que(t,s)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(DO);t.startState.facet(DO)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const Uue="•";function jue(t){return t>=32?Uue:t==10?"␤":String.fromCharCode(9216+t)}class que extends ed{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=jue(this.code),r=e.state.phrase("Control character")+" "+(Nue[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 Vue extends ed{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function Zue(){return Wue}const Xue=st.line({class:"cm-activeLine"}),Wue=Tr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let i=t.lineBlockAt(r.head);i.from>e&&(n.push(Xue.range(i.from)),e=i.from)}return st.set(n)}},{decorations:t=>t.decorations}),F5=2e3;function Yue(t,e,n){let r=Math.min(e.line,n.line),i=Math.max(e.line,n.line),s=[];if(e.off>F5||n.off>F5||e.col<0||n.col<0){let o=Math.min(e.off,n.off),a=Math.max(e.off,n.off);for(let l=r;l<=i;l++){let u=t.doc.line(l);u.length<=a&&s.push(re.range(u.from+o,u.to+a))}}else{let o=Math.min(e.col,n.col),a=Math.max(e.col,n.col);for(let l=r;l<=i;l++){let u=t.doc.line(l),c=f5(u.text,o,t.tabSize,!0);if(c<0)s.push(re.cursor(u.to));else{let f=f5(u.text,a,t.tabSize);s.push(re.range(u.from+c,u.from+f))}}}return s}function Gue(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function DP(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),i=n-r.from,s=i>F5?-1:i==r.length?Gue(t,e.clientX):ca(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:s,off:i}}function Hue(t,e){let n=DP(t,e),r=t.state.selection;return n?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(n.line).from),o=i.state.doc.lineAt(s);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},r=r.map(i.changes)}},get(i,s,o){let a=DP(t,i);if(!a)return r;let l=Yue(t.state,n,a);return l.length?o?re.create(l.concat(r.ranges)):re.create(l):r}}:null}function Kue(t){let e=(n=>n.altKey&&n.button==0);return Te.mouseSelectionStyle.of((n,r)=>e(r)?Hue(n,r):null)}const Jue={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},ece={style:"cursor: crosshair"};function tce(t={}){let[e,n]=Jue[t.key||"Alt"],r=Tr.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==e||n(i))},keyup(i){(i.keyCode==e||!n(i))&&this.set(!1)},mousemove(i){this.set(n(i))}}});return[r,Te.contentAttributes.of(i=>{var s;return!((s=i.plugin(r))===null||s===void 0)&&s.isDown?ece:null})]}const hb="-10000px";class nU{constructor(e,n,r,i){this.facet=n,this.createTooltipView=r,this.removeTooltipView=i,this.input=e.state.facet(n),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(e,n){var r;let i=e.state.facet(this.facet),s=i.filter(l=>l);if(i===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let o=[],a=n?[]:null;for(let l=0;ln[u]=l),n.length=a.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function nce(t={}){return PO.of(t)}function rce(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const PO=Ie.define({combine:t=>{var e,n,r;return{position:Ce.ios?"absolute":((e=t.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(i=>i.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||rce}}}),PP=new WeakMap,_A=Tr.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(PO);this.position=e.position,this.parent=e.parent,this.classes=t.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 nU(t,SA,(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(),t.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 t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(PO);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(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",n.dom.appendChild(i)}return n.dom.style.position=this.position,n.dom.style.top=hb,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(Ce.safari){let o=s.getBoundingClientRect();n=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else n=!!s.offsetParent&&s.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(t=s.width/this.parent.offsetWidth,e=s.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=OA(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,o)=>{let a=this.manager.tooltipViews[o];return a.getCoords?a.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(PO).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{visible:n,space:r,scaleX:i,scaleY:s}=t,o=[];for(let a=0;a=Math.min(n.bottom,r.bottom)||f.rightMath.min(n.right,r.right)+.1)){c.style.top=hb;continue}let d=l.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,m=h.right-h.left,g=(e=PP.get(u))!==null&&e!==void 0?e:h.bottom-h.top,y=u.offset||sce,O=this.view.textDirection==Xn.LTR,v=h.width>r.right-r.left?O?r.left:r.right-h.width:O?Math.max(r.left,Math.min(f.left-(d?14:0)+y.x,r.right-m)):Math.min(Math.max(r.left,f.left-m+(d?14:0)-y.x),r.right-m),w=this.above[a];!l.strictSide&&(w?f.top-g-p-y.yr.bottom)&&w==r.bottom-f.bottom>f.top-r.top&&(w=this.above[a]=!w);let x=(w?f.top-r.top:r.bottom-f.bottom)-p;if(xv&&k.topS&&(S=w?k.top-g-2-p:k.bottom+p+2);if(this.position=="absolute"?(c.style.top=(S-t.parent.top)/s+"px",RP(c,(v-t.parent.left)/i)):(c.style.top=S/s+"px",RP(c,v/i)),d){let k=f.left+(O?y.x:-y.x)-(v+14-7);d.style.left=k/i+"px"}u.overlap!==!0&&o.push({left:v,top:S,right:_,bottom:S+g}),c.classList.toggle("cm-tooltip-above",w),c.classList.toggle("cm-tooltip-below",!w),u.positioned&&u.positioned(t.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 t of this.manager.tooltipViews)t.dom.style.top=hb}},{eventObservers:{scroll(){this.maybeMeasure()}}});function RP(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const ice=Te.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),sce={x:0,y:0},SA=Ie.define({enables:[_A,ice]}),g2=Ie.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class Ix{static create(e){return new Ix(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new nU(e,g2,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.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(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let i=r[e];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 oce=SA.compute([g2],t=>{let e=t.facet(g2);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:Ix.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class ace{constructor(e,n,r,i,s){this.view=e,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:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.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 e=Date.now()-this.lastMove.time;ea.bottom||n.xa.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(i)).find(c=>c.from<=i&&c.to>=i),u=l&&l.dir==Xn.RTL?-1:1;s=n.x{this.pending==a&&(this.pending=null,l&&!(Array.isArray(l)&&!l.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])}))},l=>Wi(e.state,l,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(_A),n=e?e.manager.tooltips.findIndex(r=>r.create==Ix.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:s}=this;if(i.length&&s&&!lce(s.dom,e)||this.pending){let{pos:o}=i[0]||this.pending,a=(r=(n=i[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!uce(this.view,o,a,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const db=4;function lce(t,e){let{left:n,right:r,top:i,bottom:s}=t.getBoundingClientRect(),o;if(o=t.querySelector(".cm-tooltip-arrow")){let a=o.getBoundingClientRect();i=Math.min(a.top,i),s=Math.max(a.bottom,s)}return e.clientX>=n-db&&e.clientX<=r+db&&e.clientY>=i-db&&e.clientY<=s+db}function uce(t,e,n,r,i,s){let o=t.scrollDOM.getBoundingClientRect(),a=t.documentTop+t.documentPadding.top+t.contentHeight;if(o.left>r||o.righti||Math.min(o.bottom,a)=e&&l<=n}function kA(t,e={}){let n=wt.define(),r=Pr.define({create(){return[]},update(i,s){if(i.length&&(e.hideOnChange&&(s.docChanged||s.selection)?i=[]:e.hideOn&&(i=i.filter(o=>!e.hideOn(s,o))),s.docChanged)){let o=[];for(let a of i){let l=s.changes.mapPos(a.pos,-1,si.TrackDel);if(l!=null){let u=Object.assign(Object.create(null),a);u.pos=l,u.end!=null&&(u.end=s.changes.mapPos(u.end)),o.push(u)}}i=o}for(let o of s.effects)o.is(n)&&(i=o.value),o.is(cce)&&(i=[]);return i},provide:i=>g2.from(i)});return{active:r,extension:[r,Tr.define(i=>new ace(i,t,r,n,e.hoverTime||300)),oce]}}function rU(t,e){let n=t.plugin(_A);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const cce=wt.define(),IP=Ie.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function a1(t,e){let n=t.plugin(iU),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const iU=Tr.fromClass(class{constructor(t){this.input=t.state.facet(l1),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(IP);this.top=new pb(t,!0,e.topContainer),this.bottom=new pb(t,!1,e.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(t){let e=t.state.facet(IP);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new pb(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new pb(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(l1);if(n!=this.input){let r=n.filter(l=>l),i=[],s=[],o=[],a=[];for(let l of r){let u=this.specs.indexOf(l),c;u<0?(c=l(t.view),a.push(c)):(c=this.panels[u],c.update&&c.update(t)),i.push(c),(c.top?s:o).push(c)}this.specs=r,this.panels=i,this.top.sync(s),this.bottom.sync(o);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>Te.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class pb{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,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 e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=FP(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=FP(e)}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 e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function FP(t){let e=t.nextSibling;return t.remove(),e}const l1=Ie.define({enables:iU});class sf extends Fh{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}sf.prototype.elementClass="";sf.prototype.toDOM=void 0;sf.prototype.mapMode=si.TrackBefore;sf.prototype.startSide=sf.prototype.endSide=-1;sf.prototype.point=!0;const RO=Ie.define(),fce=Ie.define(),IO=Ie.define(),$P=Ie.define({combine:t=>t.some(e=>e)});function hce(t){return[dce]}const dce=Tr.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(IO).map(e=>new LP(t,e)),this.fixed=!t.state.facet($P);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(t.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet($P)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=on.iter(this.view.state.facet(RO),this.view.viewport.from),r=[],i=this.gutters.map(s=>new pce(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let o=!0;for(let a of s.type)if(a.type==Gi.Text&&o){$5(n,r,a.from);for(let l of i)l.line(this.view,a,r);o=!1}else if(a.widget)for(let l of i)l.widget(this.view,a)}else if(s.type==Gi.Text){$5(n,r,s.from);for(let o of i)o.line(this.view,s,r)}else if(s.widget)for(let o of i)o.widget(this.view,s);for(let s of i)s.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(IO),n=t.state.facet(IO),r=t.docChanged||t.heightChanged||t.viewportChanged||!on.eq(t.startState.facet(RO),t.state.facet(RO),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let i of this.gutters)i.update(t)&&(r=!0);else{r=!0;let i=[];for(let s of n){let o=e.indexOf(s);o<0?i.push(new LP(this.view,s)):(this.gutters[o].update(t),i.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),i.indexOf(s)<0&&s.destroy();for(let s of i)s.config.side=="after"?this.getDOMAfter().appendChild(s.dom):this.dom.appendChild(s.dom);this.gutters=i}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>Te.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*e.scaleX,i=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Xn.LTR?{left:r,right:i}:{right:r,left:i}})});function MP(t){return Array.isArray(t)?t:[t]}function $5(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class pce{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=on.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:i}=this,s=(n.top-this.height)/e.scaleY,o=n.height/e.scaleY;if(this.i==i.elements.length){let a=new sU(e,o,s,r);i.elements.push(a),i.dom.appendChild(a.dom)}else i.elements[this.i].update(e,o,s,r);this.height=n.bottom,this.i++}line(e,n,r){let i=[];$5(this.cursor,i,n.from),r.length&&(i=i.concat(r));let s=this.gutter.config.lineMarker(e,n,i);s&&i.unshift(s);let o=this.gutter;i.length==0&&!o.config.renderEmptyElements||this.addElement(e,n,i)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),i=r?[r]:null;for(let s of e.state.facet(fce)){let o=s(e,n.widget,n);o&&(i||(i=[])).push(o)}i&&this.addElement(e,n,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class LP{constructor(e,n){this.view=e,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,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let l=s.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=i.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);n.domEventHandlers[r](e,a,i)&&i.preventDefault()});this.markers=MP(n.markers(e)),n.initialSpacer&&(this.spacer=new sU(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=MP(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],e);i!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[i])}let r=e.view.viewport;return!on.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class sU{constructor(e,n,r,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,i)}update(e,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":""),mce(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,n){let r="cm-gutterElement",i=this.dom.firstChild;for(let s=0,o=0;;){let a=o,l=ss(a,l,u)||o(a,l,u):o}return r}})}});class ES extends sf{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function TS(t,e){return t.state.facet(Hd).formatNumber(e,t.state)}const bce=IO.compute([Hd],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(gce)},lineMarker(e,n,r){return r.some(i=>i.toDOM)?null:new ES(TS(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let i of e.state.facet(yce)){let s=i(e,n,r);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(Hd)!=e.state.facet(Hd),initialSpacer(e){return new ES(TS(e,NP(e.state.doc.lines)))},updateSpacer(e,n){let r=TS(n.view,NP(n.view.state.doc.lines));return r==e.number?e:new ES(r)},domEventHandlers:t.facet(Hd).domEventHandlers,side:"before"}));function Oce(t={}){return[Hd.of(t),hce(),bce]}function NP(t){let e=9;for(;e{let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.head).from;i>n&&(n=i,e.push(vce.range(i)))}return on.of(e)});function xce(){return wce}const oU=1024;let _ce=0;class bo{constructor(e,n){this.from=e,this.to=n}}class pt{constructor(e={}){this.id=_ce++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=zr.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}pt.closedBy=new pt({deserialize:t=>t.split(" ")});pt.openedBy=new pt({deserialize:t=>t.split(" ")});pt.group=new pt({deserialize:t=>t.split(" ")});pt.isolate=new pt({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});pt.contextHash=new pt({perNode:!0});pt.lookAhead=new pt({perNode:!0});pt.mounted=new pt({perNode:!0});class u1{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[pt.mounted.id]}}const Sce=Object.create(null);class zr{constructor(e,n,r,i=0){this.name=e,this.props=n,this.id=r,this.flags=i}static define(e){let n=e.props&&e.props.length?Object.create(null):Sce,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new zr(e.name||"",n,e.id,r);if(e.props){for(let s of e.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(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(pt.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let i of r.split(" "))n[i]=e[r];return r=>{for(let i=r.prop(pt.group),s=-1;s<(i?i.length:0);s++){let o=n[s<0?r.name:i[s]];if(o)return o}}}}zr.none=new zr("",Object.create(null),0,8);class dy{constructor(e){this.types=e;for(let n=0;n0;for(let l=this.cursor(o|Ln.IncludeAnonymous);;){let u=!1;if(l.from<=s&&l.to>=i&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;u=!0}for(;u&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;u=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:EA(zr.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new fn(this.type,n,r,i,this.propValues),e.makeTree||((n,r,i)=>new fn(zr.none,n,r,i)))}static build(e){return Ece(e)}}fn.empty=new fn(zr.none,[],[],0);class CA{constructor(e,n){this.buffer=e,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 CA(this.buffer,this.index)}}class of{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return zr.none}toString(){let e=[];for(let n=0;n0));l=o[l+3]);return a}slice(e,n,r){let i=this.buffer,s=new Uint16Array(n-e),o=0;for(let a=e,l=0;a=e&&ne;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function c1(t,e,n,r){for(var i;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to0?a.length:-1;e!=u;e+=n){let c=a[e],f=l[e]+o.from;if(aU(i,r,f,f+c.length)){if(c instanceof of){if(s&Ln.ExcludeBuffers)continue;let h=c.findChild(0,c.buffer.length,n,r-f,i);if(h>-1)return new tl(new kce(o,c,e,f),null,h)}else if(s&Ln.IncludeAnonymous||!c.type.isAnonymous||AA(c)){let h;if(!(s&Ln.IgnoreMounts)&&(h=u1.get(c))&&!h.overlay)return new wi(h.tree,f,e,o);let d=new wi(c,f,e,o);return s&Ln.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(n<0?c.children.length-1:0,n,r,i)}}}if(s&Ln.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+n:e=n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let i;if(!(r&Ln.IgnoreOverlays)&&(i=u1.get(this._tree))&&i.overlay){let s=e-this.from;for(let{from:o,to:a}of i.overlay)if((n>0?o<=s:o=s:a>s))return new wi(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function BP(t,e,n,r){let i=t.cursor(),s=[];if(!i.firstChild())return s;if(n!=null){for(let o=!1;!o;)if(o=i.type.is(n),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function M5(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class kce{constructor(e,n,r,i){this.parent=e,this.buffer=n,this.index=r,this.start=i}}class tl extends lU{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,n-this.context.start,r);return s<0?null:new tl(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,r=0){if(r&Ln.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return s<0?null:new tl(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new tl(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new tl(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let o=r.buffer[this.index+1];e.push(r.slice(i,s,o)),n.push(0)}return new fn(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function uU(t){if(!t.length)return null;let e=0,n=t[0];for(let s=1;sn.from||o.to=e){let a=new wi(o.tree,o.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(c1(a,e,n,!1))}}return i?uU(i):r}class y2{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof wi)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:i}=this.buffer;return this.type=n||i.set.types[i.buffer[e]],this.from=r+i.buffer[e+1],this.to=r+i.buffer[e+2],!0}yield(e){return e?e instanceof wi?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,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(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&Ln.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ln.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Ln.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<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+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:i}=this;if(i){if(e>0){if(this.index-1)for(let s=n+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let a=r._tree.children[s];if(this.mode&Ln.IncludeAnonymous||a instanceof of||!a.type.isAnonymous||AA(a))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;n=o,r=s+1;break e}i=this.stack[--s]}for(let i=r;i=0;s--){if(s<0)return M5(this._tree,e,i);let o=r[n.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function AA(t){return t.children.some(e=>e instanceof of||!e.type.isAnonymous||AA(e))}function Ece(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:i=oU,reused:s=[],minRepeatType:o=r.types.length}=t,a=Array.isArray(n)?new CA(n,n.length):n,l=r.types,u=0,c=0;function f(x,S,_,k,C,D){let{id:A,start:E,end:T,size:R}=a,$=c,Q=u;if(R<0)if(a.next(),R==-1){let W=s[A];_.push(W),k.push(E-x);return}else if(R==-3){u=A;return}else if(R==-4){c=A;return}else throw new RangeError(`Unrecognized record size: ${R}`);let B=l[A],q,z,ee=E-x;if(T-E<=i&&(z=g(a.pos-S,C))){let W=new Uint16Array(z.size-z.skip),K=a.pos-z.size,H=W.length;for(;a.pos>K;)H=y(z.start,W,H);q=new of(W,T-z.start,r),ee=z.start-x}else{let W=a.pos-R;a.next();let K=[],H=[],J=A>=o?A:-1,Y=0,Z=T;for(;a.pos>W;)J>=0&&a.id==J&&a.size>=0?(a.end<=Z-i&&(p(K,H,E,Y,a.end,Z,J,$,Q),Y=K.length,Z=a.end),a.next()):D>2500?h(E,W,K,H):f(E,W,K,H,J,D+1);if(J>=0&&Y>0&&Y-1&&Y>0){let he=d(B,Q);q=EA(B,K,H,0,K.length,0,T-E,he,he)}else q=m(B,K,H,T-E,$-T,Q)}_.push(q),k.push(ee)}function h(x,S,_,k){let C=[],D=0,A=-1;for(;a.pos>S;){let{id:E,start:T,end:R,size:$}=a;if($>4)a.next();else{if(A>-1&&T=0;R-=3)E[$++]=C[R],E[$++]=C[R+1]-T,E[$++]=C[R+2]-T,E[$++]=$;_.push(new of(E,C[2]-T,r)),k.push(T-x)}}function d(x,S){return(_,k,C)=>{let D=0,A=_.length-1,E,T;if(A>=0&&(E=_[A])instanceof fn){if(!A&&E.type==x&&E.length==C)return E;(T=E.prop(pt.lookAhead))&&(D=k[A]+E.length+T)}return m(x,_,k,C,D,S)}}function p(x,S,_,k,C,D,A,E,T){let R=[],$=[];for(;x.length>k;)R.push(x.pop()),$.push(S.pop()+_-C);x.push(m(r.types[A],R,$,D-C,E-D,T)),S.push(C-_)}function m(x,S,_,k,C,D,A){if(D){let E=[pt.contextHash,D];A=A?[E].concat(A):[E]}if(C>25){let E=[pt.lookAhead,C];A=A?[E].concat(A):[E]}return new fn(x,S,_,k,A)}function g(x,S){let _=a.fork(),k=0,C=0,D=0,A=_.end-i,E={size:0,start:0,skip:0};e:for(let T=_.pos-x;_.pos>T;){let R=_.size;if(_.id==S&&R>=0){E.size=k,E.start=C,E.skip=D,D+=4,k+=4,_.next();continue}let $=_.pos-R;if(R<0||$=o?4:0,B=_.start;for(_.next();_.pos>$;){if(_.size<0)if(_.size==-3)Q+=4;else break e;else _.id>=o&&(Q+=4);_.next()}C=B,k+=R,D+=Q}return(S<0||k==x)&&(E.size=k,E.start=C,E.skip=D),E.size>4?E:void 0}function y(x,S,_){let{id:k,start:C,end:D,size:A}=a;if(a.next(),A>=0&&k4){let T=a.pos-(A-4);for(;a.pos>T;)_=y(x,S,_)}S[--_]=E,S[--_]=D-x,S[--_]=C-x,S[--_]=k}else A==-3?u=k:A==-4&&(c=k);return _}let O=[],v=[];for(;a.pos>0;)f(t.start||0,t.bufferStart||0,O,v,-1,0);let w=(e=t.length)!==null&&e!==void 0?e:O.length?v[0]+O[0].length:0;return new fn(l[t.topID],O.reverse(),v.reverse(),w)}const zP=new WeakMap;function FO(t,e){if(!t.isAnonymous||e instanceof of||e.type!=t)return 1;let n=zP.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof fn)){n=1;break}n+=FO(t,r)}zP.set(e,n)}return n}function EA(t,e,n,r,i,s,o,a,l){let u=0;for(let p=r;p=c)break;S+=_}if(v==w+1){if(S>c){let _=p[w];d(_.children,_.positions,0,_.children.length,m[w]+O);continue}f.push(p[w])}else{let _=m[v-1]+p[v-1].length-x;f.push(EA(t,p,m,w,v,x,_,null,l))}h.push(x+O-s)}}return d(e,n,r,i,0),(a||l)(f,h,o)}class cU{constructor(){this.map=new WeakMap}setBuffer(e,n,r){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(n,r)}getBuffer(e,n){let r=this.map.get(e);return r&&r.get(n)}set(e,n){e instanceof tl?this.setBuffer(e.context.buffer,e.index,n):e instanceof wi&&this.map.set(e.tree,n)}get(e){return e instanceof tl?this.getBuffer(e.context.buffer,e.index):e instanceof wi?this.map.get(e.tree):void 0}cursorSet(e,n){e.buffer?this.setBuffer(e.buffer.buffer,e.index,n):this.map.set(e.tree,n)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Pu{constructor(e,n,r,i,s=!1,o=!1){this.from=e,this.to=n,this.tree=r,this.offset=i,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let i=[new Pu(0,e.length,e,0,!1,r)];for(let s of n)s.to>e.length&&i.push(s);return i}static applyChanges(e,n,r=128){if(!n.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let a=0,l=0,u=0;;a++){let c=a=r)for(;o&&o.from=h.from||f<=h.to||u){let d=Math.max(h.from,l)-u,p=Math.min(h.to,f)-u;h=d>=p?null:new Pu(d,p,h.tree,h.offset+u,a>0,!!c)}if(h&&i.push(h),o.to>f)break;o=snew bo(i.from,i.to)):[new bo(0,0)]:[new bo(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let i=this.startParse(e,n,r);for(;;){let s=i.advance();if(s)return s}}};class Tce{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}function fU(t){return(e,n,r,i)=>new Pce(e,t,n,r,i)}class UP{constructor(e,n,r,i,s){this.parser=e,this.parse=n,this.overlay=r,this.target=i,this.from=s}}function jP(t){if(!t.length||t.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(t))}class Dce{constructor(e,n,r,i,s,o,a){this.parser=e,this.predicate=n,this.mounts=r,this.index=i,this.start=s,this.target=o,this.prev=a,this.depth=0,this.ranges=[]}}const L5=new pt({perNode:!0});class Pce{constructor(e,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=e}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 fn(r.type,r.children,r.positions,r.length,r.propValues.concat([[L5,this.stoppedAt]]))),r}let e=this.inner[this.innerDone],n=e.parse.advance();if(n){this.innerDone++;let r=Object.assign(Object.create(null),e.target.props);r[pt.mounted.id]=new u1(n,e.overlay,e.parser),e.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let n=this.innerDone;n=this.stoppedAt)a=!1;else if(e.hasNode(i)){if(n){let u=n.mounts.find(c=>c.frag.from<=i.from&&c.frag.to>=i.to&&c.mount.overlay);if(u)for(let c of u.mount.overlay){let f=c.from+u.pos,h=c.to+u.pos;f>=i.from&&h<=i.to&&!n.ranges.some(d=>d.fromf)&&n.ranges.push({from:f,to:h})}}a=!1}else if(r&&(o=Rce(r.ranges,i.from,i.to)))a=o!=2;else if(!i.type.isAnonymous&&(s=this.nest(i,this.input))&&(i.fromnew bo(f.from-i.from,f.to-i.from)):null,i.tree,c.length?c[0].from:i.from)),s.overlay?c.length&&(r={ranges:c,depth:0,prev:r}):a=!1}}else if(n&&(l=n.predicate(i))&&(l===!0&&(l=new bo(i.from,i.to)),l.from=0&&n.ranges[u].to==l.from?n.ranges[u]={from:n.ranges[u].from,to:l.to}:n.ranges.push(l)}if(a&&i.firstChild())n&&n.depth++,r&&r.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(n&&!--n.depth){let u=ZP(this.ranges,n.ranges);u.length&&(jP(u),this.inner.splice(n.index,0,new UP(n.parser,n.parser.startParse(this.input,XP(n.mounts,u),u),n.ranges.map(c=>new bo(c.from-n.start,c.to-n.start)),n.target,u[0].from))),n=n.prev}r&&!--r.depth&&(r=r.prev)}}}}function Rce(t,e,n){for(let r of t){if(r.from>=n)break;if(r.to>e)return r.from<=e&&r.to>=n?2:1}return 0}function qP(t,e,n,r,i,s){if(e=e&&n.enter(r,1,Ln.IgnoreOverlays|Ln.ExcludeBuffers)||n.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let n=this.cursor.tree;;){if(n==e.tree)return!0;if(n.children.length&&n.positions[0]==0&&n.children[0]instanceof fn)n=n.children[0];else break}return!1}}let Fce=class{constructor(e){var n;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let r=this.curFrag=e[0];this.curTo=(n=r.tree.prop(L5))!==null&&n!==void 0?n:r.to,this.inner=new VP(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let n=this.curFrag=this.fragments[this.fragI];this.curTo=(e=n.tree.prop(L5))!==null&&e!==void 0?e:n.to,this.inner=new VP(n.tree,-n.offset)}}findMounts(e,n){var r;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(r=s.tree)===null||r===void 0?void 0:r.prop(pt.mounted);if(o&&o.parser==n)for(let a=this.fragI;a=s.to)break;l.tree==this.curFrag.tree&&i.push({frag:l,pos:s.from-l.offset,mount:o})}}}return i}};function ZP(t,e){let n=null,r=e;for(let i=1,s=0;i=a)break;l.to<=o||(n||(r=n=e.slice()),l.froma&&n.splice(s+1,0,new bo(a,l.to))):l.to>a?n[s--]=new bo(a,l.to):n.splice(s--,1))}}return r}function $ce(t,e,n,r){let i=0,s=0,o=!1,a=!1,l=-1e9,u=[];for(;;){let c=i==t.length?1e9:o?t[i].to:t[i].from,f=s==e.length?1e9:a?e[s].to:e[s].from;if(o!=a){let h=Math.max(l,n),d=Math.min(c,f,r);hnew bo(h.from+r,h.to+r)),f=$ce(e,c,l,u);for(let h=0,d=l;;h++){let p=h==f.length,m=p?u:f[h].from;if(m>d&&n.push(new Pu(d,m,i.tree,-o,s.from>=d||s.openStart,s.to<=m||s.openEnd)),p)break;d=f[h].to}}else n.push(new Pu(l,u,i.tree,-o,s.from>=o||s.openStart,s.to<=a||s.openEnd))}return n}let Mce=0,ja=class N5{constructor(e,n,r,i){this.name=e,this.set=n,this.base=r,this.modified=i,this.id=Mce++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof N5&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let i=new N5(r,[],null,[]);if(i.set.push(i),n)for(let s of n.set)i.set.push(s);return i}static defineModifier(e){let n=new b2(e);return r=>r.modified.indexOf(n)>-1?r:b2.get(r.base||r,r.modified.concat(n).sort((i,s)=>i.id-s.id))}},Lce=0;class b2{constructor(e){this.name=e,this.instances=[],this.id=Lce++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(a=>a.base==e&&Nce(n,a.modified));if(r)return r;let i=[],s=new ja(e.name,i,e,n);for(let a of n)a.instances.push(s);let o=Qce(n);for(let a of e.set)if(!a.modified.length)for(let l of o)i.push(b2.get(a,l));return s}}function Nce(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function Qce(t){let e=[[]];for(let n=0;nr.length-n.length)}function tc(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let i of n.split(" "))if(i){let s=[],o=2,a=i;for(let f=0;;){if(a=="..."&&f>0&&f+3==i.length){o=1;break}let h=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!h)throw new RangeError("Invalid path: "+i);if(s.push(h[0]=="*"?"":h[0][0]=='"'?JSON.parse(h[0]):h[0]),f+=h[0].length,f==i.length)break;let d=i[f++];if(f==i.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+i);a=i.slice(f)}let l=s.length-1,u=s[l];if(!u)throw new RangeError("Invalid path: "+i);let c=new f1(r,o,l>0?s.slice(0,l):null);e[u]=c.sort(e[u])}}return hU.add(e)}const hU=new pt({combine(t,e){let n,r,i;for(;t||e;){if(!t||e&&t.depth>=e.depth?(i=e,e=e.next):(i=t,t=t.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let s=new f1(i.tags,i.mode,i.context);n?n.next=s:r=s,n=s}return r}});let f1=class{constructor(e,n,r,i){this.tags=e,this.mode=n,this.context=r,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=i;for(let a of s)for(let l of a.set){let u=n[l.id];if(u){o=o?o+" "+u:u;break}}return o},scope:r}}function Bce(t,e){let n=null;for(let r of t){let i=r.style(e);i&&(n=n?n+" "+i:i)}return n}function zce(t,e,n,r=0,i=t.length){let s=new Uce(r,Array.isArray(e)?e:[e],n);s.highlightRange(t.cursor(),r,i,"",s.highlighters),s.flush(i)}class Uce{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,i,s){let{type:o,from:a,to:l}=e;if(a>=r||l<=n)return;o.isTop&&(s=this.highlighters.filter(d=>!d.scope||d.scope(o)));let u=i,c=jce(e)||f1.empty,f=Bce(s,c.tags);if(f&&(u&&(u+=" "),u+=f,c.mode==1&&(i+=(i?" ":"")+f)),this.startSpan(Math.max(n,a),u),c.opaque)return;let h=e.tree&&e.tree.prop(pt.mounted);if(h&&h.overlay){let d=e.node.enter(h.overlay[0].from+a,1),p=this.highlighters.filter(g=>!g.scope||g.scope(h.tree.type)),m=e.firstChild();for(let g=0,y=a;;g++){let O=g=v||!e.nextSibling())););if(!O||v>r)break;y=O.to+a,y>n&&(this.highlightRange(d.cursor(),Math.max(n,O.from+a),Math.min(r,y),"",p),this.startSpan(Math.min(r,y),u))}m&&e.parent()}else if(e.firstChild()){h&&(i="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,i,s),this.startSpan(Math.min(r,e.to),u)}while(e.nextSibling());e.parent()}}}function jce(t){let e=t.type.prop(hU);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const _e=ja.define,gb=_e(),pc=_e(),WP=_e(pc),YP=_e(pc),mc=_e(),yb=_e(mc),DS=_e(mc),Ia=_e(),Cf=_e(Ia),Da=_e(),Pa=_e(),Q5=_e(),gm=_e(Q5),bb=_e(),P={comment:gb,lineComment:_e(gb),blockComment:_e(gb),docComment:_e(gb),name:pc,variableName:_e(pc),typeName:WP,tagName:_e(WP),propertyName:YP,attributeName:_e(YP),className:_e(pc),labelName:_e(pc),namespace:_e(pc),macroName:_e(pc),literal:mc,string:yb,docString:_e(yb),character:_e(yb),attributeValue:_e(yb),number:DS,integer:_e(DS),float:_e(DS),bool:_e(mc),regexp:_e(mc),escape:_e(mc),color:_e(mc),url:_e(mc),keyword:Da,self:_e(Da),null:_e(Da),atom:_e(Da),unit:_e(Da),modifier:_e(Da),operatorKeyword:_e(Da),controlKeyword:_e(Da),definitionKeyword:_e(Da),moduleKeyword:_e(Da),operator:Pa,derefOperator:_e(Pa),arithmeticOperator:_e(Pa),logicOperator:_e(Pa),bitwiseOperator:_e(Pa),compareOperator:_e(Pa),updateOperator:_e(Pa),definitionOperator:_e(Pa),typeOperator:_e(Pa),controlOperator:_e(Pa),punctuation:Q5,separator:_e(Q5),bracket:gm,angleBracket:_e(gm),squareBracket:_e(gm),paren:_e(gm),brace:_e(gm),content:Ia,heading:Cf,heading1:_e(Cf),heading2:_e(Cf),heading3:_e(Cf),heading4:_e(Cf),heading5:_e(Cf),heading6:_e(Cf),contentSeparator:_e(Ia),list:_e(Ia),quote:_e(Ia),emphasis:_e(Ia),strong:_e(Ia),link:_e(Ia),monospace:_e(Ia),strikethrough:_e(Ia),inserted:_e(),deleted:_e(),changed:_e(),invalid:_e(),meta:bb,documentMeta:_e(bb),annotation:_e(bb),processingInstruction:_e(bb),definition:ja.defineModifier("definition"),constant:ja.defineModifier("constant"),function:ja.defineModifier("function"),standard:ja.defineModifier("standard"),local:ja.defineModifier("local"),special:ja.defineModifier("special")};for(let t in P){let e=P[t];e instanceof ja&&(e.name=t)}dU([{tag:P.link,class:"tok-link"},{tag:P.heading,class:"tok-heading"},{tag:P.emphasis,class:"tok-emphasis"},{tag:P.strong,class:"tok-strong"},{tag:P.keyword,class:"tok-keyword"},{tag:P.atom,class:"tok-atom"},{tag:P.bool,class:"tok-bool"},{tag:P.url,class:"tok-url"},{tag:P.labelName,class:"tok-labelName"},{tag:P.inserted,class:"tok-inserted"},{tag:P.deleted,class:"tok-deleted"},{tag:P.literal,class:"tok-literal"},{tag:P.string,class:"tok-string"},{tag:P.number,class:"tok-number"},{tag:[P.regexp,P.escape,P.special(P.string)],class:"tok-string2"},{tag:P.variableName,class:"tok-variableName"},{tag:P.local(P.variableName),class:"tok-variableName tok-local"},{tag:P.definition(P.variableName),class:"tok-variableName tok-definition"},{tag:P.special(P.variableName),class:"tok-variableName2"},{tag:P.definition(P.propertyName),class:"tok-propertyName tok-definition"},{tag:P.typeName,class:"tok-typeName"},{tag:P.namespace,class:"tok-namespace"},{tag:P.className,class:"tok-className"},{tag:P.macroName,class:"tok-macroName"},{tag:P.propertyName,class:"tok-propertyName"},{tag:P.operator,class:"tok-operator"},{tag:P.comment,class:"tok-comment"},{tag:P.meta,class:"tok-meta"},{tag:P.invalid,class:"tok-invalid"},{tag:P.punctuation,class:"tok-punctuation"}]);var PS;const Gf=new pt;function DA(t){return Ie.define({combine:t?e=>e.concat(t):void 0})}const PA=new pt;class Oo{constructor(e,n,r=[],i=""){this.data=e,this.name=i,Zt.prototype.hasOwnProperty("tree")||Object.defineProperty(Zt.prototype,"tree",{get(){return hn(this)}}),this.parser=n,this.extension=[s0.of(this),Zt.languageData.of((s,o,a)=>{let l=GP(s,o,a),u=l.type.prop(Gf);if(!u)return[];let c=s.facet(u),f=l.type.prop(PA);if(f){let h=l.resolve(o-l.from,a);for(let d of f)if(d.test(h,s)){let p=s.facet(d.facet);return d.type=="replace"?p:p.concat(c)}}return c})].concat(r)}isActiveAt(e,n,r=-1){return GP(e,n,r).type.prop(Gf)==this.data}findRegions(e){let n=e.facet(s0);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],i=(s,o)=>{if(s.prop(Gf)==this.data){r.push({from:o,to:o+s.length});return}let a=s.prop(pt.mounted);if(a){if(a.tree.prop(Gf)==this.data){if(a.overlay)for(let l of a.overlay)r.push({from:l.from+o,to:l.to+o});else r.push({from:o,to:o+s.length});return}else if(a.overlay){let l=r.length;if(i(a.tree,a.overlay[0].from+o),r.length>l)return}}for(let l=0;lr.isTop?n:void 0)]}),e.name)}configure(e,n){return new Uu(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function hn(t){let e=t.field(Oo.state,!1);return e?e.tree:fn.empty}class qce{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let ym=null;class h1{constructor(e,n,r=[],i,s,o,a,l){this.parser=e,this.state=n,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new h1(e,n,[],fn.empty,0,r,[],null)}startParse(){return this.parser.startParse(new qce(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=fn.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(Pu.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=ym;ym=this;try{return e()}finally{ym=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=HP(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:i,treeLen:s,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((u,c,f,h)=>l.push({fromA:u,toA:c,fromB:f,toB:h})),r=Pu.applyChanges(r,l),i=fn.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let u of this.skipped){let c=e.mapPos(u.from,1),f=e.mapPos(u.to,-1);ce.from&&(this.fragments=HP(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(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends TA{createParse(n,r,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let l=ym;if(l){for(let u of i)l.tempSkipped.push(u);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new fn(zr.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return ym}}function HP(t,e,n){return Pu.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class i0{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new i0(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=h1.create(e.facet(s0).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new i0(r)}}Oo.state=Pr.define({create:i0.init,update(t,e){for(let n of e.effects)if(n.is(Oo.setState))return n.value;return e.startState.facet(s0)!=e.state.facet(s0)?i0.init(e.state):t.apply(e)}});let pU=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(pU=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const RS=typeof navigator<"u"&&(!((PS=navigator.scheduling)===null||PS===void 0)&&PS.isInputPending)?()=>navigator.scheduling.isInputPending():null,Vce=Tr.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(Oo.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(Oo.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=pU(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEndi+1e3,l=s.context.work(()=>RS&&RS()||Date.now()>o,i+(a?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Oo.setState.of(new i0(s.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Wi(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),s0=Ie.define({combine(t){return t.length?t[0]:null},enables:t=>[Oo.state,Vce,Te.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class af{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}class O2{constructor(e,n,r,i,s,o=void 0){this.name=e,this.alias=n,this.extensions=r,this.filename=i,this.loadFunc=s,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:n,support:r}=e;if(!n){if(!r)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");n=()=>Promise.resolve(r)}return new O2(e.name,(e.alias||[]).concat(e.name).map(i=>i.toLowerCase()),e.extensions||[],e.filename,n,r)}static matchFilename(e,n){for(let i of e)if(i.filename&&i.filename.test(n))return i;let r=/\.([^.]+)$/.exec(n);if(r){for(let i of e)if(i.extensions.indexOf(r[1])>-1)return i}return null}static matchLanguageName(e,n,r=!0){n=n.toLowerCase();for(let i of e)if(i.alias.some(s=>s==n))return i;if(r)for(let i of e)for(let s of i.alias){let o=n.indexOf(s);if(o>-1&&(s.length>2||!/\w/.test(n[o-1])&&!/\w/.test(n[o+s.length])))return i}return null}}const Zce=Ie.define(),py=Ie.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function v2(t){let e=t.facet(py);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function d1(t,e){let n="",r=t.tabSize,i=t.facet(py)[0];if(i==" "){for(;e>=r;)n+=" ",e-=r;i=" "}for(let s=0;s=e?Xce(t,n,e):null}class Fx{constructor(e,n={}){this.state=e,this.options=n,this.unit=v2(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&i==e?{text:"",from:e}:(n<0?i-1&&(s+=o-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,n=e.length){return ca(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:i}=this.lineAt(e,n),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const pf=new pt;function Xce(t,e,n){let r=e.resolveStack(n),i=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let s=[];for(let o=i;o&&!(o.fromr.node.to||o.from==r.node.from&&o.type==r.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return mU(r,t,n)}function mU(t,e,n){for(let r=t;r;r=r.next){let i=Yce(r.node);if(i)return i(IA.create(e,n,r))}return 0}function Wce(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function Yce(t){let e=t.type.prop(pf);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(pt.closedBy))){let i=t.lastChild,s=i&&r.indexOf(i.name)>-1;return o=>gU(o,!0,1,void 0,s&&!Wce(o)?i.from:void 0)}return t.parent==null?Gce:null}function Gce(){return 0}class IA extends Fx{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new IA(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(Hce(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return mU(this.context.next,this.base,this.pos)}}function Hce(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function Kce(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let i=t.options.simulateBreak,s=t.state.doc.lineAt(n.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let a=n.to;;){let l=e.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped){if(l.from>=o)return null;let u=/^ */.exec(s.text.slice(n.to-s.from))[0].length;return{from:n.from,to:n.to+u}}a=l.to}}function Jce({closing:t,align:e=!0,units:n=1}){return r=>gU(r,e,n,t)}function gU(t,e,n,r,i){let s=t.textAfter,o=s.match(/^\s*/)[0].length,a=r&&s.slice(o,o+r.length)==r||i==t.pos+o,l=e?Kce(t):null;return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*n)}const efe=t=>t.baseIndent;function Ru({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const tfe=200;function nfe(){return Zt.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,i=n.lineAt(r);if(r>i.from+tfe)return t;let s=n.sliceString(i.from,r);if(!e.some(u=>u.test(s)))return t;let{state:o}=t,a=-1,l=[];for(let{head:u}of o.selection.ranges){let c=o.doc.lineAt(u);if(c.from==a)continue;a=c.from;let f=RA(o,c.from);if(f==null)continue;let h=/^\s*/.exec(c.text)[0],d=d1(o,f);h!=d&&l.push({from:c.from,to:c.from+h.length,insert:d})}return l.length?[t,{changes:l,sequential:!0}]:t})}const rfe=Ie.define(),mf=new pt;function $x(t){let e=t.firstChild,n=t.lastChild;return e&&e.toa.prop(Gf)==o.data:o?a=>a==o:void 0,this.style=dU(e.map(a=>({tag:a.tag,class:a.class||i(Object.assign({},a,{tag:null}))})),{all:s}).style,this.module=r?new tf(r):null,this.themeType=n.themeType}static define(e,n){return new my(e,n||{})}}const B5=Ie.define(),yU=Ie.define({combine(t){return t.length?[t[0]]:null}});function IS(t){let e=t.facet(B5);return e.length?e:t.facet(yU)}function bU(t,e){let n=[sfe],r;return t instanceof my&&(t.module&&n.push(Te.styleModule.of(t.module)),r=t.themeType),e?.fallback?n.push(yU.of(t)):r?n.push(B5.computeN([Te.darkTheme],i=>i.facet(Te.darkTheme)==(r=="dark")?[t]:[])):n.push(B5.of(t)),n}class ife{constructor(e){this.markCache=Object.create(null),this.tree=hn(e.state),this.decorations=this.buildDeco(e,IS(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=hn(e.state),r=IS(e.state),i=r!=IS(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);n.length=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(n!=this.tree||e.viewportChanged||i)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,n){if(!n||!this.tree.length)return st.none;let r=new ef;for(let{from:i,to:s}of e.visibleRanges)zce(this.tree,n,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=st.mark({class:l})))},i,s);return r.finish()}}const sfe=Ku.high(Tr.fromClass(ife,{decorations:t=>t.decorations})),ofe=my.define([{tag:P.meta,color:"#404740"},{tag:P.link,textDecoration:"underline"},{tag:P.heading,textDecoration:"underline",fontWeight:"bold"},{tag:P.emphasis,fontStyle:"italic"},{tag:P.strong,fontWeight:"bold"},{tag:P.strikethrough,textDecoration:"line-through"},{tag:P.keyword,color:"#708"},{tag:[P.atom,P.bool,P.url,P.contentSeparator,P.labelName],color:"#219"},{tag:[P.literal,P.inserted],color:"#164"},{tag:[P.string,P.deleted],color:"#a11"},{tag:[P.regexp,P.escape,P.special(P.string)],color:"#e40"},{tag:P.definition(P.variableName),color:"#00f"},{tag:P.local(P.variableName),color:"#30a"},{tag:[P.typeName,P.namespace],color:"#085"},{tag:P.className,color:"#167"},{tag:[P.special(P.variableName),P.macroName],color:"#256"},{tag:P.definition(P.propertyName),color:"#00c"},{tag:P.comment,color:"#940"},{tag:P.invalid,color:"#f00"}]),afe=Te.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),OU=1e4,vU="()[]{}",wU=Ie.define({combine(t){return ec(t,{afterCursor:!0,brackets:vU,maxScanDistance:OU,renderMatch:cfe})}}),lfe=st.mark({class:"cm-matchingBracket"}),ufe=st.mark({class:"cm-nonmatchingBracket"});function cfe(t){let e=[],n=t.matched?lfe:ufe;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const ffe=Pr.define({create(){return st.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(wU);for(let i of e.state.selection.ranges){if(!i.empty)continue;let s=nl(e.state,i.head,-1,r)||i.head>0&&nl(e.state,i.head-1,1,r)||r.afterCursor&&(nl(e.state,i.head,1,r)||i.headTe.decorations.from(t)}),hfe=[ffe,afe];function dfe(t={}){return[wU.of(t),hfe]}const xU=new pt;function z5(t,e,n){let r=t.prop(e<0?pt.openedBy:pt.closedBy);if(r)return r;if(t.name.length==1){let i=n.indexOf(t.name);if(i>-1&&i%2==(e<0?1:0))return[n[i+e]]}return null}function U5(t){let e=t.type.prop(xU);return e?e(t.node):t}function nl(t,e,n,r={}){let i=r.maxScanDistance||OU,s=r.brackets||vU,o=hn(t),a=o.resolveInner(e,n);for(let l=a;l;l=l.parent){let u=z5(l.type,n,s);if(u&&l.from0?e>=c.from&&ec.from&&e<=c.to))return pfe(t,e,n,l,c,u,s)}}return mfe(t,e,n,o,a.type,i,s)}function pfe(t,e,n,r,i,s,o){let a=r.parent,l={from:i.from,to:i.to},u=0,c=a?.cursor();if(c&&(n<0?c.childBefore(r.from):c.childAfter(r.to)))do if(n<0?c.to<=r.from:c.from>=r.to){if(u==0&&s.indexOf(c.type.name)>-1&&c.from0)return null;let u={from:n<0?e-1:e,to:n>0?e+1:e},c=t.doc.iterRange(e,n>0?t.doc.length:0),f=0;for(let h=0;!c.next().done&&h<=s;){let d=c.value;n<0&&(h+=d.length);let p=e+h*n;for(let m=n>0?0:d.length-1,g=n>0?d.length:-1;m!=g;m+=n){let y=o.indexOf(d[m]);if(!(y<0||r.resolveInner(p+m,1).type!=i))if(y%2==0==n>0)f++;else{if(f==1)return{start:u,end:{from:p+m,to:p+m+1},matched:y>>1==l>>1};f--}}n>0&&(h+=d.length)}return c.done?{start:u,matched:!1}:null}const gfe=Object.create(null),KP=[zr.none],JP=[],e7=Object.create(null),yfe=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])yfe[t]=bfe(gfe,e);function FS(t,e){JP.indexOf(t)>-1||(JP.push(t),console.warn(e))}function bfe(t,e){let n=[];for(let a of e.split(" ")){let l=[];for(let u of a.split(".")){let c=t[u]||P[u];c?typeof c=="function"?l.length?l=l.map(c):FS(u,`Modifier ${u} used at start of tag`):l.length?FS(u,`Tag ${u} used as modifier`):l=Array.isArray(c)?c:[c]:FS(u,`Unknown highlighting tag ${u}`)}for(let u of l)n.push(u)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),i=r+" "+n.map(a=>a.id),s=e7[i];if(s)return s.id;let o=e7[i]=zr.define({id:KP.length,name:r,props:[tc({[r]:n})]});return KP.push(o),o.id}Xn.RTL,Xn.LTR;class FA{constructor(e,n,r,i){this.state=e,this.pos=n,this.explicit=r,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=hn(this.state).resolveInner(this.pos,-1);for(;n&&e.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(e){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(SU(e,!1));return s<0?null:{from:r+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function t7(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Ofe(t){let e=Object.create(null),n=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let s=1;stypeof i=="string"?{label:i}:i),[n,r]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:Ofe(e);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:n}:null}}function _U(t,e){return n=>{for(let r=hn(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(t.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(n)}}class n7{constructor(e,n,r,i){this.completion=e,this.source=n,this.match=r,this.score=i}}function ph(t){return t.selection.main.from}function SU(t,e){var n;let{source:r}=t,i=e&&r[0]!="^",s=r[r.length-1]!="$";return!i&&!s?t:new RegExp(`${i?"^":""}(?:${r})${s?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const MA=Ju.define();function vfe(t,e,n,r){let{main:i}=t.selection,s=n-i.from,o=r-i.from;return{...t.changeByRange(a=>{if(a!=i&&n!=r&&t.sliceDoc(a.from+s,a.from+o)!=t.sliceDoc(n,r))return{range:a};let l=t.toText(e);return{changes:{from:a.from+s,to:r==i.from?a.to:a.from+o,insert:l},range:re.cursor(a.from+s+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const r7=new WeakMap;function wfe(t){if(!Array.isArray(t))return t;let e=r7.get(t);return e||r7.set(t,e=$A(t)),e}const w2=wt.define(),p1=wt.define();class xfe{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n=48&&x<=57||x>=97&&x<=122?2:x>=65&&x<=90?1:0:(S=cA(x))!=S.toLowerCase()?1:S!=S.toUpperCase()?2:0;(!O||_==1&&g||w==0&&_!=0)&&(n[f]==x||r[f]==x&&(h=!0)?o[f++]=O:o.length&&(y=!1)),w=_,O+=Ya(x)}return f==l&&o[0]==0&&y?this.result(-100+(h?-200:0),o,e):d==l&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):d==l?this.ret(-900-e.length,[p,m]):f==l?this.result(-100+(h?-200:0)+-700+(y?0:-1100),o,e):n.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,n,r){let i=[],s=0;for(let o of n){let a=o+(this.astral?Ya(ds(r,o)):1);s&&i[s-1]==o?i[s-1]=a:(i[s++]=o,i[s++]=a)}return this.ret(e-r.length,i)}}class _fe{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Sfe,filterStrict:!1,compareCompletions:(e,n)=>e.label.localeCompare(n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>i7(e(r),n(r)),optionClass:(e,n)=>r=>i7(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function i7(t,e){return t?e?t+" "+e:t:e}function Sfe(t,e,n,r,i,s){let o=t.textDirection==Xn.RTL,a=o,l=!1,u="top",c,f,h=e.left-i.left,d=i.right-e.right,p=r.right-r.left,m=r.bottom-r.top;if(a&&h=m||O>e.top?c=n.bottom-e.top:(u="bottom",c=e.bottom-n.top)}let g=(e.bottom-e.top)/s.offsetHeight,y=(e.right-e.left)/s.offsetWidth;return{style:`${u}: ${c/g}px; max-width: ${f/y}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}function kfe(t){let e=t.addToOptions.slice();return t.icons&&e.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}),e.push({render(n,r,i,s){let o=document.createElement("span");o.className="cm-completionLabel";let a=n.displayLabel||n.label,l=0;for(let u=0;ul&&o.appendChild(document.createTextNode(a.slice(l,c)));let h=o.appendChild(document.createElement("span"));h.appendChild(document.createTextNode(a.slice(c,f))),h.className="cm-completionMatchedText",l=f}return ln.position-r.position).map(n=>n.render)}function $S(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let i=Math.floor(e/n);return{from:i*n,to:(i+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class Cfe{constructor(e,n,r){this.view=e,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=e.state.field(n),{options:s,selected:o}=i.open,a=e.state.facet(Gr);this.optionContent=kfe(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=$S(s.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:u}=e.state.field(n).open;for(let c=l.target,f;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]{let u=e.state.field(this.stateField,!1);u&&u.tooltip&&e.state.facet(Gr).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:p1.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=i){let{options:s,selected:o,disabled:a}=r.open;(!i.open||i.open.options!=s)&&(this.range=$S(s.length,o,e.state.facet(Gr).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),a!=((n=i.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let n=this.tooltipClass(e);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(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected=this.range.to)&&(this.range=$S(n.options.length,n.selected,this.view.state.facet(Gr).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:i}=n.options[n.selected],{info:s}=i;if(!s)return;let o=typeof s=="string"?document.createTextNode(s):s(i);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,i)}).catch(a=>Wi(this.view.state,a,"completion info")):(this.addInfoPane(o,i),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:s}=e;r.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){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==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&Efe(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return i.top>Math.min(s.bottom,n.bottom)-10||i.bottom{o.target==i&&o.preventDefault()});let s=null;for(let o=r.from;or.from||r.from==0))if(s=h,typeof u!="string"&&u.header)i.appendChild(u.header(u));else{let d=i.appendChild(document.createElement("completion-section"));d.textContent=h}}const c=i.appendChild(document.createElement("li"));c.id=n+"-"+o,c.setAttribute("role","option");let f=this.optionClass(a);f&&(c.className=f);for(let h of this.optionContent){let d=h(a,this.view.state,this.view,l);d&&c.appendChild(d)}}return r.from&&i.classList.add("cm-completionListIncompleteTop"),r.tonew Cfe(n,t,e)}function Efe(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=n.height/t.offsetHeight;r.topn.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/i)}function s7(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function Tfe(t,e){let n=[],r=null,i=null,s=c=>{n.push(c);let{section:f}=c.completion;if(f){r||(r=[]);let h=typeof f=="string"?f:f.name;r.some(d=>d.name==h)||r.push(typeof f=="string"?{name:h}:f)}},o=e.facet(Gr);for(let c of t)if(c.hasResult()){let f=c.result.getMatch;if(c.result.filter===!1)for(let h of c.result.options)s(new n7(h,c.source,f?f(h):[],1e9-n.length));else{let h=e.sliceDoc(c.from,c.to),d,p=o.filterStrict?new _fe(h):new xfe(h);for(let m of c.result.options)if(d=p.match(m.label)){let g=m.displayLabel?f?f(m,d.matched):[]:d.matched,y=d.score+(m.boost||0);if(s(new n7(m,c.source,g,y)),typeof m.section=="object"&&m.section.rank==="dynamic"){let{name:O}=m.section;i||(i=Object.create(null)),i[O]=Math.max(y,i[O]||-1e9)}}}}if(r){let c=Object.create(null),f=0,h=(d,p)=>(d.rank==="dynamic"&&p.rank==="dynamic"?i[p.name]-i[d.name]:0)||(typeof d.rank=="number"?d.rank:1e9)-(typeof p.rank=="number"?p.rank:1e9)||(d.nameh.score-f.score||u(f.completion,h.completion))){let f=c.completion;!l||l.label!=f.label||l.detail!=f.detail||l.type!=null&&f.type!=null&&l.type!=f.type||l.apply!=f.apply||l.boost!=f.boost?a.push(c):s7(c.completion)>s7(l)&&(a[a.length-1]=c),l=c.completion}return a}class Kd{constructor(e,n,r,i,s,o){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=i,this.selected=s,this.disabled=o}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new Kd(this.options,o7(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,i,s,o){if(i&&!o&&e.some(u=>u.isPending))return i.setDisabled();let a=Tfe(e,n);if(!a.length)return i&&e.some(u=>u.isPending)?i.setDisabled():null;let l=n.facet(Gr).selectOnOpen?0:-1;if(i&&i.selected!=l&&i.selected!=-1){let u=i.options[i.selected].completion;for(let c=0;cc.hasResult()?Math.min(u,c.from):u,1e8),create:$fe,above:s.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new Kd(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Kd(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class x2{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new x2(Ife,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(Gr),s=(r.override||n.languageDataAt("autocomplete",ph(n)).map(wfe)).map(l=>(this.active.find(c=>c.source==l)||new vo(l,this.active.some(c=>c.state!=0)?1:0)).update(e,r));s.length==this.active.length&&s.every((l,u)=>l==this.active[u])&&(s=this.active);let o=this.open,a=e.effects.some(l=>l.is(LA));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!Dfe(s,this.active)||a?o=Kd.build(s,n,this.id,o,r,a):o&&o.disabled&&!s.some(l=>l.isPending)&&(o=null),!o&&s.every(l=>!l.isPending)&&s.some(l=>l.hasResult())&&(s=s.map(l=>l.hasResult()?new vo(l.source,0):l));for(let l of e.effects)l.is(CU)&&(o=o&&o.setSelected(l.value,this.id));return s==this.active&&o==this.open?this:new x2(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Pfe:Rfe}}function Dfe(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n-1&&(n["aria-activedescendant"]=t+"-"+e),n}const Ife=[];function kU(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(MA);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class vo{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=kU(e,n),i=this;(r&8||r&16&&this.touches(e))&&(i=new vo(i.source,0)),r&4&&i.state==0&&(i=new vo(this.source,1)),i=i.updateFor(e,r);for(let s of e.effects)if(s.is(w2))i=new vo(i.source,1,s.value);else if(s.is(p1))i=new vo(i.source,0);else if(s.is(LA))for(let o of s.value)o.source==i.source&&(i=o);return i}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(ph(e.state))}}class vp extends vo{constructor(e,n,r,i,s,o){super(e,3,n),this.limit=r,this.result=i,this.from=s,this.to=o}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let s=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=ph(e.state);if(a>o||!i||n&2&&(ph(e.startState)==this.from||an.map(e))}}),CU=wt.define(),ps=Pr.define({create(){return x2.start()},update(t,e){return t.update(e)},provide:t=>[SA.from(t,e=>e.tooltip),Te.contentAttributes.from(t,e=>e.attrs)]});function NA(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(ps).active.find(i=>i.source==e.source);return r instanceof vp?(typeof n=="string"?t.dispatch({...vfe(t.state,n,r.from,r.to),annotations:MA.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const $fe=Afe(ps,NA);function Ob(t,e="option"){return n=>{let r=n.state.field(ps,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+i*(t?1:-1):t?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),n.dispatch({effects:CU.of(a)}),!0}}const Mfe=t=>{let e=t.state.field(ps,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(ps,!1)?(t.dispatch({effects:w2.of(!0)}),!0):!1,Lfe=t=>{let e=t.state.field(ps,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:p1.of(null)}),!0)};class Nfe{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const Qfe=50,Bfe=1e3,zfe=Tr.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(ps).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(ps),n=t.state.facet(Gr);if(!t.selectionSet&&!t.docChanged&&t.startState.field(ps)==e)return;let r=t.transactions.some(s=>{let o=kU(s,n);return o&8||(s.selection||s.docChanged)&&!(o&3)});for(let s=0;sQfe&&Date.now()-o.time>Bfe){for(let a of o.context.abortListeners)try{a()}catch(l){Wi(this.view.state,l)}o.context.abortListeners=null,this.running.splice(s--,1)}else o.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(s=>s.effects.some(o=>o.is(w2)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!this.running.some(o=>o.active.source==s.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let s of t.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:t}=this.view,e=t.field(ps);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Gr).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=ph(e),r=new FA(e,n,t.explicit,this.view),i=new Nfe(t,r);this.running.push(i),Promise.resolve(t.source(r)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:p1.of(null)}),Wi(this.view.state,s)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Gr).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(Gr),r=this.view.state.field(ps);for(let i=0;ia.source==s.active.source);if(o&&o.isPending)if(s.done==null){let a=new vo(s.active.source,0);for(let l of s.updates)a=a.update(l,n);a.isPending||e.push(a)}else this.startQuery(o)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:LA.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(ps,!1);if(e&&e.tooltip&&this.view.state.facet(Gr).closeOnBlur){let n=e.open&&rU(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:p1.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:w2.of(!1)}),20),this.composing=0}}}),Ufe=typeof navigator=="object"&&/Win/.test(navigator.platform),jfe=Ku.highest(Te.domEventHandlers({keydown(t,e){let n=e.state.field(ps,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(Ufe&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(o=>o.source==r.source),s=r.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(t.key)>-1&&NA(e,r),!1}})),AU=Te.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 qfe{constructor(e,n,r,i){this.field=e,this.line=n,this.from=r,this.to=i}}class QA{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,si.TrackDel),r=e.mapPos(this.to,1,si.TrackDel);return n==null||r==null?null:new QA(this.field,n,r)}}class BA{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],i=[n],s=e.doc.lineAt(n),o=/^\s*/.exec(s.text)[0];for(let l of this.lines){if(r.length){let u=o,c=/^\t*/.exec(l)[0].length;for(let f=0;fnew QA(l.field,i[l.line]+l.from,i[l.line]+l.to));return{text:r,ranges:a}}static parse(e){let n=[],r=[],i=[],s;for(let o of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let a=s[1]?+s[1]:null,l=s[2]||s[3]||"",u=-1,c=l.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f=u&&h.field++}for(let f of i)if(f.line==r.length&&f.from>s.index){let h=s[2]?3+(s[1]||"").length:2;f.from-=h,f.to-=h}i.push(new qfe(u,r.length,s.index,s.index+c.length)),o=o.slice(0,s.index)+l+o.slice(s.index+s[0].length)}o=o.replace(/\\([{}])/g,(a,l,u)=>{for(let c of i)c.line==r.length&&c.from>u&&(c.from--,c.to--);return l}),r.push(o)}return new BA(r,i)}}let Vfe=st.widget({widget:new class extends ed{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Zfe=st.mark({class:"cm-snippetField"});class U0{constructor(e,n){this.ranges=e,this.active=n,this.deco=st.set(e.map(r=>(r.from==r.to?Vfe:Zfe).range(r.from,r.to)),!0)}map(e){let n=[];for(let r of this.ranges){let i=r.map(e);if(!i)return null;n.push(i)}return new U0(n,this.active)}selectionInsideField(e){return e.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const gy=wt.define({map(t,e){return t&&t.map(e)}}),Xfe=wt.define(),m1=Pr.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(gy))return n.value;if(n.is(Xfe)&&t)return new U0(t.ranges,n.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>Te.decorations.from(t,e=>e?e.deco:st.none)});function zA(t,e){return re.create(t.filter(n=>n.field==e).map(n=>re.range(n.from,n.to)))}function Wfe(t){let e=BA.parse(t);return(n,r,i,s)=>{let{text:o,ranges:a}=e.instantiate(n.state,i),{main:l}=n.state.selection,u={changes:{from:i,to:s==l.from?l.to:s,insert:en.of(o)},scrollIntoView:!0,annotations:r?[MA.of(r),Ar.userEvent.of("input.complete")]:void 0};if(a.length&&(u.selection=zA(a,0)),a.some(c=>c.field>0)){let c=new U0(a,0),f=u.effects=[gy.of(c)];n.state.field(m1,!1)===void 0&&f.push(wt.appendConfig.of([m1,Jfe,ehe,AU]))}n.dispatch(n.state.update(u))}}function EU(t){return({state:e,dispatch:n})=>{let r=e.field(m1,!1);if(!r||t<0&&r.active==0)return!1;let i=r.active+t,s=t>0&&!r.ranges.some(o=>o.field==i+t);return n(e.update({selection:zA(r.ranges,i),effects:gy.of(s?null:new U0(r.ranges,i)),scrollIntoView:!0})),!0}}const Yfe=({state:t,dispatch:e})=>t.field(m1,!1)?(e(t.update({effects:gy.of(null)})),!0):!1,Gfe=EU(1),Hfe=EU(-1),Kfe=[{key:"Tab",run:Gfe,shift:Hfe},{key:"Escape",run:Yfe}],a7=Ie.define({combine(t){return t.length?t[0]:Kfe}}),Jfe=Ku.highest(fy.compute([a7],t=>t.facet(a7)));function Li(t,e){return{...e,apply:Wfe(t)}}const ehe=Te.domEventHandlers({mousedown(t,e){let n=e.state.field(m1,!1),r;if(!n||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let i=n.ranges.find(s=>s.from<=r&&s.to>=r);return!i||i.field==n.active?!1:(e.dispatch({selection:zA(n.ranges,i.field),effects:gy.of(n.ranges.some(s=>s.field>i.field)?new U0(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),g1={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Hf=wt.define({map(t,e){let n=e.mapPos(t,-1,si.TrackAfter);return n??void 0}}),UA=new class extends Fh{};UA.startSide=1;UA.endSide=-1;const TU=Pr.define({create(){return on.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(Hf)&&(t=t.update({add:[UA.range(n.value,n.value+1)]}));return t}});function the(){return[rhe,TU]}const LS="()[]{}<>«»»«[]{}";function DU(t){for(let e=0;e{if((nhe?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let i=t.state.selection.main;if(r.length>2||r.length==2&&Ya(ds(r,0))==1||e!=i.from||n!=i.to)return!1;let s=ohe(t.state,r);return s?(t.dispatch(s),!0):!1}),ihe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=PU(t,t.selection.main.head).brackets||g1.brackets,i=null,s=t.changeByRange(o=>{if(o.empty){let a=ahe(t.doc,o.head);for(let l of r)if(l==a&&Mx(t.doc,o.head)==DU(ds(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:re.cursor(o.head-l.length)}}return{range:i=o}});return i||e(t.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},she=[{key:"Backspace",run:ihe}];function ohe(t,e){let n=PU(t,t.selection.main.head),r=n.brackets||g1.brackets;for(let i of r){let s=DU(ds(i,0));if(e==i)return s==i?che(t,i,r.indexOf(i+i+i)>-1,n):lhe(t,i,s,n.before||g1.before);if(e==s&&RU(t,t.selection.main.from))return uhe(t,i,s)}return null}function RU(t,e){let n=!1;return t.field(TU).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function Mx(t,e){let n=t.sliceString(e,e+2);return n.slice(0,Ya(ds(n,0)))}function ahe(t,e){let n=t.sliceString(e-2,e);return Ya(ds(n,0))==n.length?n:n.slice(1)}function lhe(t,e,n,r){let i=null,s=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:n,from:o.to}],effects:Hf.of(o.to+e.length),range:re.range(o.anchor+e.length,o.head+e.length)};let a=Mx(t.doc,o.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+n,from:o.head},effects:Hf.of(o.head+e.length),range:re.cursor(o.head+e.length)}:{range:i=o}});return i?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function uhe(t,e,n){let r=null,i=t.changeByRange(s=>s.empty&&Mx(t.doc,s.head)==n?{changes:{from:s.head,to:s.head+n.length,insert:n},range:re.cursor(s.head+n.length)}:r={range:s});return r?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function che(t,e,n,r){let i=r.stringPrefixes||g1.stringPrefixes,s=null,o=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:Hf.of(a.to+e.length),range:re.range(a.anchor+e.length,a.head+e.length)};let l=a.head,u=Mx(t.doc,l),c;if(u==e){if(l7(t,l))return{changes:{insert:e+e,from:l},effects:Hf.of(l+e.length),range:re.cursor(l+e.length)};if(RU(t,l)){let h=n&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+h.length,insert:h},range:re.cursor(l+h.length)}}}else{if(n&&t.sliceDoc(l-2*e.length,l)==e+e&&(c=u7(t,l-2*e.length,i))>-1&&l7(t,c))return{changes:{insert:e+e+e+e,from:l},effects:Hf.of(l+e.length),range:re.cursor(l+e.length)};if(t.charCategorizer(l)(u)!=Kn.Word&&u7(t,l,i)>-1&&!fhe(t,l,e,i))return{changes:{insert:e+e,from:l},effects:Hf.of(l+e.length),range:re.cursor(l+e.length)}}return{range:s=a}});return s?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function l7(t,e){let n=hn(t).resolveInner(e+1);return n.parent&&n.from==e}function fhe(t,e,n,r){let i=hn(t).resolveInner(e,-1),s=r.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=t.sliceDoc(i.from,Math.min(i.to,i.from+n.length+s)),l=a.indexOf(n);if(!l||l>-1&&r.indexOf(a.slice(0,l))>-1){let c=i.firstChild;for(;c&&c.from==i.from&&c.to-c.from>n.length+l;){if(t.sliceDoc(c.to-n.length,c.to)==n)return!1;c=c.firstChild}return!0}let u=i.to==e&&i.parent;if(!u)break;i=u}return!1}function u7(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Kn.Word)return e;for(let i of n){let s=e-i.length;if(t.sliceDoc(s,e)==i&&r(t.sliceDoc(s-1,s))!=Kn.Word)return s}return-1}function hhe(t={}){return[jfe,ps,Gr.of(t),zfe,dhe,AU]}const IU=[{key:"Ctrl-Space",run:MS},{mac:"Alt-`",run:MS},{mac:"Alt-i",run:MS},{key:"Escape",run:Lfe},{key:"ArrowDown",run:Ob(!0)},{key:"ArrowUp",run:Ob(!1)},{key:"PageDown",run:Ob(!0,"page")},{key:"PageUp",run:Ob(!1,"page")},{key:"Enter",run:Mfe}],dhe=Ku.highest(fy.computeN([Gr],t=>t.facet(Gr).defaultKeymap?[IU]:[])),phe=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=qA(t.state,n.from);return r.line?mhe(t):r.block?yhe(t):!1};function jA(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=t(e,n);return i?(r(n.update(i)),!0):!1}}const mhe=jA(vhe,0),ghe=jA(FU,0),yhe=jA((t,e)=>FU(t,e,Ohe(e)),0);function qA(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const bm=50;function bhe(t,{open:e,close:n},r,i){let s=t.sliceDoc(r-bm,r),o=t.sliceDoc(i,i+bm),a=/\s*$/.exec(s)[0].length,l=/^\s*/.exec(o)[0].length,u=s.length-a;if(s.slice(u-e.length,u)==e&&o.slice(l,l+n.length)==n)return{open:{pos:r-a,margin:a&&1},close:{pos:i+l,margin:l&&1}};let c,f;i-r<=2*bm?c=f=t.sliceDoc(r,i):(c=t.sliceDoc(r,r+bm),f=t.sliceDoc(i-bm,i));let h=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,p=f.length-d-n.length;return c.slice(h,h+e.length)==e&&f.slice(p,p+n.length)==n?{open:{pos:r+h+e.length,margin:/\s/.test(c.charAt(h+e.length))?1:0},close:{pos:i-d-n.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function Ohe(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),i=n.to<=r.to?r:t.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let s=e.length-1;s>=0&&e[s].to>r.from?e[s].to=i.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return e}function FU(t,e,n=e.selection.ranges){let r=n.map(s=>qA(e,s.from).block);if(!r.every(s=>s))return null;let i=n.map((s,o)=>bhe(e,r[o],s.from,s.to));if(t!=2&&!i.every(s=>s))return{changes:e.changes(n.map((s,o)=>i[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(t!=1&&i.some(s=>s)){let s=[];for(let o=0,a;oi&&(s==o||o>f.from)){i=f.from;let h=/^\s*/.exec(f.text)[0].length,d=h==f.length,p=f.text.slice(h,h+u.length)==u?h:-1;hs.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:l,indent:u,empty:c,single:f}of r)(f||!c)&&s.push({from:a.from+u,insert:l+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(t!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let u=o.from+a,c=u+l.length;o.text[c-o.from]==" "&&c++,s.push({from:u,to:c})}return{changes:s}}return null}const j5=Ju.define(),whe=Ju.define(),xhe=Ie.define(),$U=Ie.define({combine(t){return ec(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,i)=>e(r,i)||n(r,i)})}}),MU=Pr.define({create(){return rl.empty},update(t,e){let n=e.state.facet($U),r=e.annotation(j5);if(r){let l=bs.fromTransaction(e,r.selection),u=r.side,c=u==0?t.undone:t.done;return l?c=_2(c,c.length,n.minDepth,l):c=QU(c,e.startState.selection),new rl(u==0?r.rest:c,u==0?c:r.rest)}let i=e.annotation(whe);if((i=="full"||i=="before")&&(t=t.isolate()),e.annotation(Ar.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let s=bs.fromTransaction(e),o=e.annotation(Ar.time),a=e.annotation(Ar.userEvent);return s?t=t.addChanges(s,o,a,n,e):e.selection&&(t=t.addSelection(e.startState.selection,o,a,n.newGroupDelay)),(i=="full"||i=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new rl(t.done.map(bs.fromJSON),t.undone.map(bs.fromJSON))}});function _he(t={}){return[MU,$U.of(t),Te.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?LU:e.inputType=="historyRedo"?q5:null;return r?(e.preventDefault(),r(n)):!1}})]}function Lx(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let i=n.field(MU,!1);if(!i)return!1;let s=i.pop(t,n,e);return s?(r(s),!0):!1}}const LU=Lx(0,!1),q5=Lx(1,!1),She=Lx(0,!0),khe=Lx(1,!0);class bs{constructor(e,n,r,i,s){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new bs(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(e){return new bs(e.changes&&Lr.fromJSON(e.changes),[],e.mapped&&hl.fromJSON(e.mapped),e.startSelection&&re.fromJSON(e.startSelection),e.selectionsAfter.map(re.fromJSON))}static fromTransaction(e,n){let r=wo;for(let i of e.startState.facet(xhe)){let s=i(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new bs(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,wo)}static selection(e){return new bs(void 0,wo,void 0,void 0,e)}}function _2(t,e,n,r){let i=e+1>n+20?e-n-1:0,s=t.slice(i,e);return s.push(r),s}function Che(t,e){let n=[],r=!1;return t.iterChangedRanges((i,s)=>n.push(i,s)),e.iterChangedRanges((i,s,o,a)=>{for(let l=0;l=u&&o<=c&&(r=!0)}}),r}function Ahe(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function NU(t,e){return t.length?e.length?t.concat(e):t:e}const wo=[],Ehe=200;function QU(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Ehe));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),_2(t,t.length-1,1e9,n.setSelAfter(r)))}else return[bs.selection([e])]}function The(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function NS(t,e){if(!t.length)return t;let n=t.length,r=wo;for(;n;){let i=Dhe(t[n-1],e,r);if(i.changes&&!i.changes.empty||i.effects.length){let s=t.slice(0,n);return s[n-1]=i,s}else e=i.mapped,n--,r=i.selectionsAfter}return r.length?[bs.selection(r)]:wo}function Dhe(t,e,n){let r=NU(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):wo,n);if(!t.changes)return bs.selection(r);let i=t.changes.map(e),s=e.mapDesc(t.changes,!0),o=t.mapped?t.mapped.composeDesc(s):s;return new bs(i,wt.mapEffects(t.effects,e),o,t.startSelection.map(s),r)}const Phe=/^(input\.type|delete)($|\.)/;class rl{constructor(e,n,r=0,i=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=i}isolate(){return this.prevTime?new rl(this.done,this.undone):this}addChanges(e,n,r,i,s){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||Phe.test(r))&&(!a.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?t.moveByChar(n,e):Nx(n,e))}function Pi(t){return t.textDirectionAt(t.state.selection.main.head)==Xn.LTR}const zU=t=>BU(t,!Pi(t)),UU=t=>BU(t,Pi(t));function jU(t,e){return wa(t,n=>n.empty?t.moveByGroup(n,e):Nx(n,e))}const Ihe=t=>jU(t,!Pi(t)),Fhe=t=>jU(t,Pi(t));function $he(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Qx(t,e,n){let r=hn(t).resolveInner(e.head),i=n?pt.closedBy:pt.openedBy;for(let l=e.head;;){let u=n?r.childAfter(l):r.childBefore(l);if(!u)break;$he(t,u,i)?r=u:l=n?u.to:u.from}let s=r.type.prop(i),o,a;return s&&(o=n?nl(t,r.from,1):nl(t,r.to,-1))&&o.matched?a=n?o.end.to:o.end.from:a=n?r.to:r.from,re.cursor(a,n?-1:1)}const Mhe=t=>wa(t,e=>Qx(t.state,e,!Pi(t))),Lhe=t=>wa(t,e=>Qx(t.state,e,Pi(t)));function qU(t,e){return wa(t,n=>{if(!n.empty)return Nx(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const VU=t=>qU(t,!1),ZU=t=>qU(t,!0);function XU(t){let e=t.scrollDOM.clientHeighto.empty?t.moveVertically(o,e,n.height):Nx(o,e));if(i.eq(r.selection))return!1;let s;if(n.selfScroll){let o=t.coordsAtPos(r.selection.main.head),a=t.scrollDOM.getBoundingClientRect(),l=a.top+n.marginTop,u=a.bottom-n.marginBottom;o&&o.top>l&&o.bottomWU(t,!1),V5=t=>WU(t,!0);function gf(t,e,n){let r=t.lineBlockAt(e.head),i=t.moveToLineBoundary(e,n);if(i.head==e.head&&i.head!=(n?r.to:r.from)&&(i=t.moveToLineBoundary(e,n,!1)),!n&&i.head==r.from&&r.length){let s=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&e.head!=r.from+s&&(i=re.cursor(r.from+s))}return i}const Nhe=t=>wa(t,e=>gf(t,e,!0)),Qhe=t=>wa(t,e=>gf(t,e,!1)),Bhe=t=>wa(t,e=>gf(t,e,!Pi(t))),zhe=t=>wa(t,e=>gf(t,e,Pi(t))),Uhe=t=>wa(t,e=>re.cursor(t.lineBlockAt(e.head).from,1)),jhe=t=>wa(t,e=>re.cursor(t.lineBlockAt(e.head).to,-1));function qhe(t,e,n){let r=!1,i=j0(t.selection,s=>{let o=nl(t,s.head,-1)||nl(t,s.head,1)||s.head>0&&nl(t,s.head-1,1)||s.headqhe(t,e);function No(t,e){let n=j0(t.state.selection,r=>{let i=e(r);return re.range(r.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(va(t.state,n)),!0)}function YU(t,e){return No(t,n=>t.moveByChar(n,e))}const GU=t=>YU(t,!Pi(t)),HU=t=>YU(t,Pi(t));function KU(t,e){return No(t,n=>t.moveByGroup(n,e))}const Zhe=t=>KU(t,!Pi(t)),Xhe=t=>KU(t,Pi(t)),Whe=t=>No(t,e=>Qx(t.state,e,!Pi(t))),Yhe=t=>No(t,e=>Qx(t.state,e,Pi(t)));function JU(t,e){return No(t,n=>t.moveVertically(n,e))}const ej=t=>JU(t,!1),tj=t=>JU(t,!0);function nj(t,e){return No(t,n=>t.moveVertically(n,e,XU(t).height))}const f7=t=>nj(t,!1),h7=t=>nj(t,!0),Ghe=t=>No(t,e=>gf(t,e,!0)),Hhe=t=>No(t,e=>gf(t,e,!1)),Khe=t=>No(t,e=>gf(t,e,!Pi(t))),Jhe=t=>No(t,e=>gf(t,e,Pi(t))),ede=t=>No(t,e=>re.cursor(t.lineBlockAt(e.head).from)),tde=t=>No(t,e=>re.cursor(t.lineBlockAt(e.head).to)),d7=({state:t,dispatch:e})=>(e(va(t,{anchor:0})),!0),p7=({state:t,dispatch:e})=>(e(va(t,{anchor:t.doc.length})),!0),m7=({state:t,dispatch:e})=>(e(va(t,{anchor:t.selection.main.anchor,head:0})),!0),g7=({state:t,dispatch:e})=>(e(va(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),nde=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),rde=({state:t,dispatch:e})=>{let n=Bx(t).map(({from:r,to:i})=>re.range(r,Math.min(i+1,t.doc.length)));return e(t.update({selection:re.create(n),userEvent:"select"})),!0},ide=({state:t,dispatch:e})=>{let n=j0(t.selection,r=>{let i=hn(t),s=i.resolveStack(r.from,1);if(r.empty){let o=i.resolveStack(r.from,-1);o.node.from>=s.node.from&&o.node.to<=s.node.to&&(s=o)}for(let o=s;o;o=o.next){let{node:a}=o;if((a.from=r.to||a.to>r.to&&a.from<=r.from)&&o.next)return re.range(a.to,a.from)}return r});return n.eq(t.selection)?!1:(e(va(t,n)),!0)};function rj(t,e){let{state:n}=t,r=n.selection,i=n.selection.ranges.slice();for(let s of n.selection.ranges){let o=n.doc.lineAt(s.head);if(e?o.to0)for(let a=s;;){let l=t.moveVertically(a,e);if(l.heado.to){i.some(u=>u.head==l.head)||i.push(l);break}else{if(l.head==a.head)break;a=l}}}return i.length==r.ranges.length?!1:(t.dispatch(va(n,re.create(i,i.length-1))),!0)}const sde=t=>rj(t,!1),ode=t=>rj(t,!0),ade=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=re.create([n.main]):n.main.empty||(r=re.create([re.cursor(n.main.head)])),r?(e(va(t,r)),!0):!1};function yy(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,i=r.changeByRange(s=>{let{from:o,to:a}=s;if(o==a){let l=e(s);lo&&(n="delete.forward",l=vb(t,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=vb(t,o,!1),a=vb(t,a,!0);return o==a?{range:s}:{changes:{from:o,to:a},range:re.cursor(o,oi(t)))r.between(e,e,(i,s)=>{ie&&(e=n?s:i)});return e}const ij=(t,e,n)=>yy(t,r=>{let i=r.from,{state:s}=t,o=s.doc.lineAt(i),a,l;if(n&&!e&&i>o.from&&iij(t,!1,!0),sj=t=>ij(t,!0,!1),oj=(t,e)=>yy(t,n=>{let r=n.head,{state:i}=t,s=i.doc.lineAt(r),o=i.charCategorizer(r);for(let a=null;;){if(r==(e?s.to:s.from)){r==n.head&&s.number!=(e?i.doc.lines:1)&&(r+=e?1:-1);break}let l=ai(s.text,r-s.from,e)+s.from,u=s.text.slice(Math.min(r,l)-s.from,Math.max(r,l)-s.from),c=o(u);if(a!=null&&c!=a)break;(u!=" "||r!=n.head)&&(a=c),r=l}return r}),aj=t=>oj(t,!1),lde=t=>oj(t,!0),ude=t=>yy(t,e=>{let n=t.lineBlockAt(e.head).to;return e.headyy(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),fde=t=>yy(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:en.of(["",""])},range:re.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},dde=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let i=r.from,s=t.doc.lineAt(i),o=i==s.from?i-1:ai(s.text,i-s.from,!1)+s.from,a=i==s.to?i+1:ai(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:a,insert:t.doc.slice(i,a).append(t.doc.slice(o,i))},range:re.cursor(a)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Bx(t){let e=[],n=-1;for(let r of t.selection.ranges){let i=t.doc.lineAt(r.from),s=t.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=t.doc.lineAt(r.to-1)),n>=i.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(r)}else e.push({from:i.from,to:s.to,ranges:[r]});n=s.number+1}return e}function lj(t,e,n){if(t.readOnly)return!1;let r=[],i=[];for(let s of Bx(t)){if(n?s.to==t.doc.length:s.from==0)continue;let o=t.doc.lineAt(n?s.to+1:s.from-1),a=o.length+1;if(n){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+t.lineBreak});for(let l of s.ranges)i.push(re.range(Math.min(t.doc.length,l.anchor+a),Math.min(t.doc.length,l.head+a)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:t.lineBreak+o.text});for(let l of s.ranges)i.push(re.range(l.anchor-a,l.head-a))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:re.create(i,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const pde=({state:t,dispatch:e})=>lj(t,e,!1),mde=({state:t,dispatch:e})=>lj(t,e,!0);function uj(t,e,n){if(t.readOnly)return!1;let r=[];for(let i of Bx(t))n?r.push({from:i.from,insert:t.doc.slice(i.from,i.to)+t.lineBreak}):r.push({from:i.to,insert:t.lineBreak+t.doc.slice(i.from,i.to)});return e(t.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const gde=({state:t,dispatch:e})=>uj(t,e,!1),yde=({state:t,dispatch:e})=>uj(t,e,!0),bde=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(Bx(e).map(({from:i,to:s})=>(i>0?i--:s{let s;if(t.lineWrapping){let o=t.lineBlockAt(i.head),a=t.coordsAtPos(i.head,i.assoc||1);a&&(s=o.bottom+t.documentTop-a.bottom+t.defaultLineHeight/2)}return t.moveVertically(i,!0,s)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Ode(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=hn(t).resolveInner(e),r=n.childBefore(e),i=n.childAfter(e),s;return r&&i&&r.to<=e&&i.from>=e&&(s=r.type.prop(pt.closedBy))&&s.indexOf(i.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(i.from).from&&!/\S/.test(t.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}const y7=cj(!1),vde=cj(!0);function cj(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(i=>{let{from:s,to:o}=i,a=e.doc.lineAt(s),l=!t&&s==o&&Ode(e,s);t&&(s=o=(o<=a.to?a:e.doc.lineAt(o)).to);let u=new Fx(e,{simulateBreak:s,simulateDoubleBreak:!!l}),c=RA(u,s);for(c==null&&(c=ca(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));oa.from&&s{let i=[];for(let o=r.from;o<=r.to;){let a=t.doc.lineAt(o);a.number>n&&(r.empty||r.to>a.from)&&(e(a,i,r),n=a.number),o=a.to+1}let s=t.changes(i);return{changes:i,range:re.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}const wde=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new Fx(t,{overrideIndentation:s=>{let o=n[s];return o??-1}}),i=VA(t,(s,o,a)=>{let l=RA(r,s.from);if(l==null)return;/\S/.test(s.text)||(l=0);let u=/^\s*/.exec(s.text)[0],c=d1(t,l);(u!=c||a.fromt.readOnly?!1:(e(t.update(VA(t,(n,r)=>{r.push({from:n.from,insert:t.facet(py)})}),{userEvent:"input.indent"})),!0),hj=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(VA(t,(n,r)=>{let i=/^\s*/.exec(n.text)[0];if(!i)return;let s=ca(i,t.tabSize),o=0,a=d1(t,Math.max(0,s-v2(t)));for(;o(t.setTabFocusMode(),!0),_de=({state:t,dispatch:e})=>t.selection.ranges.some(n=>!n.empty)?fj({state:t,dispatch:e}):(e(t.update(t.replaceSelection(" "),{scrollIntoView:!0,userEvent:"input"})),!0),Sde=[{key:"Ctrl-b",run:zU,shift:GU,preventDefault:!0},{key:"Ctrl-f",run:UU,shift:HU},{key:"Ctrl-p",run:VU,shift:ej},{key:"Ctrl-n",run:ZU,shift:tj},{key:"Ctrl-a",run:Uhe,shift:ede},{key:"Ctrl-e",run:jhe,shift:tde},{key:"Ctrl-d",run:sj},{key:"Ctrl-h",run:Z5},{key:"Ctrl-k",run:ude},{key:"Ctrl-Alt-h",run:aj},{key:"Ctrl-o",run:hde},{key:"Ctrl-t",run:dde},{key:"Ctrl-v",run:V5}],kde=[{key:"ArrowLeft",run:zU,shift:GU,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Ihe,shift:Zhe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Bhe,shift:Khe,preventDefault:!0},{key:"ArrowRight",run:UU,shift:HU,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Fhe,shift:Xhe,preventDefault:!0},{mac:"Cmd-ArrowRight",run:zhe,shift:Jhe,preventDefault:!0},{key:"ArrowUp",run:VU,shift:ej,preventDefault:!0},{mac:"Cmd-ArrowUp",run:d7,shift:m7},{mac:"Ctrl-ArrowUp",run:c7,shift:f7},{key:"ArrowDown",run:ZU,shift:tj,preventDefault:!0},{mac:"Cmd-ArrowDown",run:p7,shift:g7},{mac:"Ctrl-ArrowDown",run:V5,shift:h7},{key:"PageUp",run:c7,shift:f7},{key:"PageDown",run:V5,shift:h7},{key:"Home",run:Qhe,shift:Hhe,preventDefault:!0},{key:"Mod-Home",run:d7,shift:m7},{key:"End",run:Nhe,shift:Ghe,preventDefault:!0},{key:"Mod-End",run:p7,shift:g7},{key:"Enter",run:y7,shift:y7},{key:"Mod-a",run:nde},{key:"Backspace",run:Z5,shift:Z5,preventDefault:!0},{key:"Delete",run:sj,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:aj,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:lde,preventDefault:!0},{mac:"Mod-Backspace",run:cde,preventDefault:!0},{mac:"Mod-Delete",run:fde,preventDefault:!0}].concat(Sde.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),Cde=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Mhe,shift:Whe},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Lhe,shift:Yhe},{key:"Alt-ArrowUp",run:pde},{key:"Shift-Alt-ArrowUp",run:gde},{key:"Alt-ArrowDown",run:mde},{key:"Shift-Alt-ArrowDown",run:yde},{key:"Mod-Alt-ArrowUp",run:sde},{key:"Mod-Alt-ArrowDown",run:ode},{key:"Escape",run:ade},{key:"Mod-Enter",run:vde},{key:"Alt-l",mac:"Ctrl-l",run:rde},{key:"Mod-i",run:ide,preventDefault:!0},{key:"Mod-[",run:hj},{key:"Mod-]",run:fj},{key:"Mod-Alt-\\",run:wde},{key:"Shift-Mod-k",run:bde},{key:"Shift-Mod-\\",run:Vhe},{key:"Mod-/",run:phe},{key:"Alt-A",run:ghe},{key:"Ctrl-m",mac:"Shift-Alt-m",run:xde}].concat(kde);class b7{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class Qf{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let i=r.facet(il).markerFilter;i&&(e=i(e,r));let s=e.slice().sort((d,p)=>d.from-p.from||d.to-p.to),o=new ef,a=[],l=0,u=r.doc.iter(),c=0,f=r.doc.length;for(let d=0;;){let p=d==s.length?null:s[d];if(!p&&!a.length)break;let m,g;if(a.length)m=l,g=a.reduce((v,w)=>Math.min(v,w.to),p&&p.from>m?p.from:1e8);else{if(m=p.from,m>f)break;g=p.to,a.push(p),d++}for(;dv.from||v.to==m))a.push(v),d++,g=Math.min(v.to,g);else{g=Math.min(v.from,g);break}}g=Math.min(g,f);let y=!1;if(a.some(v=>v.from==m&&(v.to==g||g==f))&&(y=m==g,!y&&g-m<10)){let v=m-(c+u.value.length);v>0&&(u.next(v),c=m);for(let w=m;;){if(w>=g){y=!0;break}if(!u.lineBreak&&c+u.value.length>w)break;w=c+u.value.length,c+=u.value.length,u.next()}}let O=zde(a);if(y)o.add(m,m,st.widget({widget:new Lde(O),diagnostics:a.slice()}));else{let v=a.reduce((w,x)=>x.markClass?w+" "+x.markClass:w,"");o.add(m,g,st.mark({class:"cm-lintRange cm-lintRange-"+O+v,diagnostics:a.slice(),inclusiveEnd:a.some(w=>w.to>g)}))}if(l=g,l==f)break;for(let v=0;v{if(!(e&&o.diagnostics.indexOf(e)<0))if(!r)r=new b7(i,s,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new b7(r.from,s,r.diagnostic)}}),r}function Ade(t,e){let n=e.pos,r=e.end||n,i=t.state.facet(il).hideOn(t,n,r);if(i!=null)return i;let s=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(o=>o.is(ZA))||t.changes.touchesRange(s.from,Math.max(s.to,r)))}function dj(t,e){return t.field(Ys,!1)?e:e.concat(wt.appendConfig.of(yj))}function Ede(t,e){return{effects:dj(t,[ZA.of(e)])}}const ZA=wt.define(),XA=wt.define(),pj=wt.define(),Ys=Pr.define({create(){return new Qf(st.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,i=t.panel;if(t.selected){let s=e.changes.mapPos(t.selected.from,1);r=o0(n,t.selected.diagnostic,s)||o0(n,null,s)}!n.size&&i&&e.state.facet(il).autoPanel&&(i=null),t=new Qf(n,i,r)}for(let n of e.effects)if(n.is(ZA)){let r=e.state.facet(il).autoPanel?n.value.length?y1.open:null:t.panel;t=Qf.init(n.value,r,e.state)}else n.is(XA)?t=new Qf(t.diagnostics,n.value?y1.open:null,t.selected):n.is(pj)&&(t=new Qf(t.diagnostics,t.panel,n.value));return t},provide:t=>[l1.from(t,e=>e.panel),Te.decorations.from(t,e=>e.diagnostics)]}),Tde=st.mark({class:"cm-lintRange cm-lintRange-active"});function Dde(t,e,n){let{diagnostics:r}=t.state.field(Ys),i,s=-1,o=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(l,u,{spec:c})=>{if(e>=l&&e<=u&&(l==u||(e>l||n>0)&&(egj(t,n,!1)))}const Rde=t=>{let e=t.state.field(Ys,!1);(!e||!e.panel)&&t.dispatch({effects:dj(t.state,[XA.of(!0)])});let n=a1(t,y1.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},O7=t=>{let e=t.state.field(Ys,!1);return!e||!e.panel?!1:(t.dispatch({effects:XA.of(!1)}),!0)},Ide=t=>{let e=t.state.field(Ys,!1);if(!e)return!1;let n=t.state.selection.main,r=e.diagnostics.iter(n.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},Fde=[{key:"Mod-Shift-m",run:Rde,preventDefault:!0},{key:"F8",run:Ide}],$de=Tr.fromClass(class{constructor(t){this.view=t,this.timeout=-1,this.set=!0;let{delay:e}=t.state.facet(il);this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}run(){clearTimeout(this.timeout);let t=Date.now();if(tPromise.resolve(r(this.view))),r=>{this.view.state.doc==e.doc&&this.view.dispatch(Ede(this.view.state,r.reduce((i,s)=>i.concat(s))))},r=>{Wi(this.view.state,r)})}}update(t){let e=t.state.facet(il);(t.docChanged||e!=t.startState.facet(il)||e.needsRefresh&&e.needsRefresh(t))&&(this.lintTime=Date.now()+e.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,e.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}});function Mde(t,e,n){let r=[],i=-1;for(let s of t)s.then(o=>{r.push(o),clearTimeout(i),r.length==t.length?e(r):i=setTimeout(()=>e(r),200)},n)}const il=Ie.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...ec(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:v7,tooltipFilter:v7,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,i,s)=>e(r,i,s)||n(r,i,s):e:n,autoPanel:(e,n)=>e||n})}}});function v7(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function S2(t,e={}){return[il.of({source:t,config:e}),$de,yj]}function mj(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;rs.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function gj(t,e,n){var r;let i=n?mj(e.actions):[];return _n("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},_n("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((s,o)=>{let a=!1,l=d=>{if(d.preventDefault(),a)return;a=!0;let p=o0(t.state.field(Ys).diagnostics,e);p&&s.apply(t,p.from,p.to)},{name:u}=s,c=i[o]?u.indexOf(i[o]):-1,f=c<0?u:[u.slice(0,c),_n("u",u.slice(c,c+1)),u.slice(c+1)],h=s.markClass?" "+s.markClass:"";return _n("button",{type:"button",class:"cm-diagnosticAction"+h,onclick:l,onmousedown:l,"aria-label":` Action: ${u}${c<0?"":` (access key "${i[o]})"`}.`},f)}),e.source&&_n("div",{class:"cm-diagnosticSource"},e.source))}class Lde extends ed{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return _n("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class w7{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=gj(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class y1{constructor(e){this.view=e,this.items=[];let n=i=>{if(i.keyCode==27)O7(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=mj(s.actions);for(let a=0;a{for(let s=0;sO7(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Ys).selected;if(!e)return-1;for(let n=0;n{for(let c of u.diagnostics){if(o.has(c))continue;o.add(c);let f=-1,h;for(let d=r;dr&&(this.items.splice(r,f-r),i=!0)),n&&h.diagnostic==n.diagnostic?h.dom.hasAttribute("aria-selected")||(h.dom.setAttribute("aria-selected","true"),s=h):h.dom.hasAttribute("aria-selected")&&h.dom.removeAttribute("aria-selected"),r++}});r({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:a,panel:l})=>{let u=l.height/this.list.offsetHeight;a.topl.bottom&&(this.list.scrollTop+=(a.bottom-l.bottom)/u)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(Ys),r=o0(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:pj.of(r)})}static open(e){return new y1(e)}}function Nde(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function wb(t){return Nde(``,'width="6" height="3"')}const Qde=Te.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:wb("#d11")},".cm-lintRange-warning":{backgroundImage:wb("orange")},".cm-lintRange-info":{backgroundImage:wb("#999")},".cm-lintRange-hint":{backgroundImage:wb("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function Bde(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function zde(t){let e="hint",n=1;for(let r of t){let i=Bde(r.severity);i>n&&(n=i,e=r.severity)}return e}const yj=[Ys,Te.decorations.compute([Ys],t=>{let{selected:e,panel:n}=t.field(Ys);return!e||!n||e.from==e.to?st.none:st.set([Tde.range(e.from,e.to)])}),kA(Dde,{hideOn:Ade}),Qde],x7=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class a0{constructor(e,n,r=0,i=e.length,s,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,i),this.bufferStart=r,this.normalize=s?a=>s(x7(a)):x7,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return ds(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=cA(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Ya(e);let i=this.normalize(n);if(i.length)for(let s=0,o=r;;s++){let a=i.charCodeAt(s),l=this.match(a,o,this.bufferPos+this.bufferStart);if(s==i.length-1){if(l)return this.value=l,this;break}o==r&&sthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,i=r+n[0].length;if(this.matchPos=k2(this.text,i+(r==i?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||i.to<=n){let a=new wp(n,e.sliceString(n,r));return QS.set(e,a),a}if(i.from==n&&i.to==r)return i;let{text:s,from:o}=i;return o>n&&(s=e.sliceString(n,o)+s,o=n),i.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,i=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,i,n)))return this.value={from:r,to:i,match:n},this.matchPos=k2(this.text,i+(r==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=wp.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Oj.prototype[Symbol.iterator]=vj.prototype[Symbol.iterator]=function(){return this});function Ude(t){try{return new RegExp(t,WA),!0}catch{return!1}}function k2(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e=56320&&r<57344;)e++;return e}function X5(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=_n("input",{class:"cm-textfield",name:"line",value:e}),r=_n("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),t.dispatch({effects:Ag.of(!1)}),t.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},_n("label",t.state.phrase("Go to line"),": ",n)," ",_n("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),_n("button",{name:"close",onclick:()=>{t.dispatch({effects:Ag.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["×"]));function i(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!s)return;let{state:o}=t,a=o.doc.lineAt(o.selection.main.head),[,l,u,c,f]=s,h=c?+c.slice(1):0,d=u?+u:a.number;if(u&&f){let g=d/100;l&&(g=g*(l=="-"?-1:1)+a.number/o.doc.lines),d=Math.round(o.doc.lines*g)}else u&&l&&(d=d*(l=="-"?-1:1)+a.number);let p=o.doc.line(Math.max(1,Math.min(o.doc.lines,d))),m=re.cursor(p.from+Math.max(0,Math.min(h,p.length)));t.dispatch({effects:[Ag.of(!1),Te.scrollIntoView(m.from,{y:"center"})],selection:m}),t.focus()}return{dom:r}}const Ag=wt.define(),_7=Pr.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(Ag)&&(t=n.value);return t},provide:t=>l1.from(t,e=>e?X5:null)}),jde=t=>{let e=a1(t,X5);if(!e){let n=[Ag.of(!0)];t.state.field(_7,!1)==null&&n.push(wt.appendConfig.of([_7,qde])),t.dispatch({effects:n}),e=a1(t,X5)}return e&&e.dom.querySelector("input").select(),!0},qde=Te.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),Vde={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Zde=Ie.define({combine(t){return ec(t,Vde,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Xde(t){return[Kde,Hde]}const Wde=st.mark({class:"cm-selectionMatch"}),Yde=st.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function S7(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=Kn.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=Kn.Word)}function Gde(t,e,n,r){return t(e.sliceDoc(n,n+1))==Kn.Word&&t(e.sliceDoc(r-1,r))==Kn.Word}const Hde=Tr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Zde),{state:n}=t,r=n.selection;if(r.ranges.length>1)return st.none;let i=r.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return st.none;let l=n.wordAt(i.head);if(!l)return st.none;o=n.charCategorizer(i.head),s=n.sliceDoc(l.from,l.to)}else{let l=i.to-i.from;if(l200)return st.none;if(e.wholeWords){if(s=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(S7(o,n,i.from,i.to)&&Gde(o,n,i.from,i.to)))return st.none}else if(s=n.sliceDoc(i.from,i.to),!s)return st.none}let a=[];for(let l of t.visibleRanges){let u=new a0(n.doc,s,l.from,l.to);for(;!u.next().done;){let{from:c,to:f}=u.value;if((!o||S7(o,n,c,f))&&(i.empty&&c<=i.from&&f>=i.to?a.push(Yde.range(c,f)):(c>=i.to||f<=i.from)&&a.push(Wde.range(c,f)),a.length>e.maxMatches))return st.none}}return st.set(a)}},{decorations:t=>t.decorations}),Kde=Te.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Jde=({state:t,dispatch:e})=>{let{selection:n}=t,r=re.create(n.ranges.map(i=>t.wordAt(i.head)||re.cursor(i.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function epe(t,e){let{main:n,ranges:r}=t.selection,i=t.wordAt(n.head),s=i&&i.from==n.from&&i.to==n.to;for(let o=!1,a=new a0(t.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new a0(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(l=>l.from==a.value.from))continue;if(s){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const tpe=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(s=>s.from===s.to))return Jde({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(s=>t.sliceDoc(s.from,s.to)!=r))return!1;let i=epe(t,r);return i?(e(t.update({selection:t.selection.addRange(re.range(i.from,i.to),!1),effects:Te.scrollIntoView(i.to)})),!0):!1},q0=Ie.define({combine(t){return ec(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new dpe(e),scrollToMatch:e=>Te.scrollIntoView(e)})}});class wj{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Ude(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?` `:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new spe(this):new rpe(this)}getCursor(e,n=0,r){let i=e.doc?e:Zt.create({doc:e});return r==null&&(r=i.doc.length),this.regexp?jd(this,i,n,r):Ud(this,i,n,r)}}class xj{constructor(e){this.spec=e}}function Ud(t,e,n,r){return new a0(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:i=>i.toLowerCase(),t.wholeWord?npe(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function npe(t,e){return(n,r,i,s)=>((s>n||s+i.length=n)return null;i.push(r.value)}return i}highlight(e,n,r,i){let s=Ud(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function jd(t,e,n,r){return new Oj(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?ipe(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function C2(t,e){return t.slice(ai(t,e,!1),e)}function A2(t,e){return t.slice(e,ai(t,e))}function ipe(t){return(e,n,r)=>!r[0].length||(t(C2(r.input,r.index))!=Kn.Word||t(A2(r.input,r.index))!=Kn.Word)&&(t(A2(r.input,r.index+r[0].length))!=Kn.Word||t(C2(r.input,r.index+r[0].length))!=Kn.Word)}class spe extends xj{nextMatch(e,n,r){let i=jd(this.spec,e,r,e.doc.length).next();return i.done&&(i=jd(this.spec,e,0,n).next()),i.done?null:i.value}prevMatchInRange(e,n,r){for(let i=1;;i++){let s=Math.max(n,r-i*1e4),o=jd(this.spec,e,s,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(s==n||a.from>s+10))return a;if(s==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let i=r.length;i>0;i--){let s=+r.slice(0,i);if(s>0&&s=n)return null;i.push(r.value)}return i}highlight(e,n,r,i){let s=jd(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const b1=wt.define(),YA=wt.define(),$c=Pr.define({create(t){return new BS(W5(t).create(),null)},update(t,e){for(let n of e.effects)n.is(b1)?t=new BS(n.value.create(),t.panel):n.is(YA)&&(t=new BS(t.query,n.value?GA:null));return t},provide:t=>l1.from(t,e=>e.panel)});class BS{constructor(e,n){this.query=e,this.panel=n}}const ope=st.mark({class:"cm-searchMatch"}),ape=st.mark({class:"cm-searchMatch cm-searchMatch-selected"}),lpe=Tr.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field($c))}update(t){let e=t.state.field($c);(e!=t.startState.field($c)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return st.none;let{view:n}=this,r=new ef;for(let i=0,s=n.visibleRanges,o=s.length;is[i+1].from-500;)l=s[++i].to;t.highlight(n.state,a,l,(u,c)=>{let f=n.state.selection.ranges.some(h=>h.from==u&&h.to==c);r.add(u,c,f?ape:ope)})}return r.finish()}},{decorations:t=>t.decorations});function by(t){return e=>{let n=e.state.field($c,!1);return n&&n.query.spec.valid?t(e,n):kj(e)}}const E2=by((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let i=re.single(r.from,r.to),s=t.state.facet(q0);return t.dispatch({selection:i,effects:[HA(t,r),s.scrollToMatch(i.main,t)],userEvent:"select.search"}),Sj(t),!0}),T2=by((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,i=e.prevMatch(n,r,r);if(!i)return!1;let s=re.single(i.from,i.to),o=t.state.facet(q0);return t.dispatch({selection:s,effects:[HA(t,i),o.scrollToMatch(s.main,t)],userEvent:"select.search"}),Sj(t),!0}),upe=by((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:re.create(n.map(r=>re.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),cpe=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,s=[],o=0;for(let a=new a0(t.doc,t.sliceDoc(r,i));!a.next().done;){if(s.length>1e3)return!1;a.value.from==r&&(o=s.length),s.push(re.range(a.value.from,a.value.to))}return e(t.update({selection:re.create(s,o),userEvent:"select.search.matches"})),!0},k7=by((t,{query:e})=>{let{state:n}=t,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let s=e.nextMatch(n,r,r);if(!s)return!1;let o=s,a=[],l,u,c=[];o.from==r&&o.to==i&&(u=n.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:u}),o=e.nextMatch(n,o.from,o.to),c.push(Te.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let f=t.state.changes(a);return o&&(l=re.single(o.from,o.to).map(f),c.push(HA(t,o)),c.push(n.facet(q0).scrollToMatch(l.main,t))),t.dispatch({changes:f,selection:l,effects:c,userEvent:"input.replace"}),!0}),fpe=by((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(i=>{let{from:s,to:o}=i;return{from:s,to:o,insert:e.getReplacement(i)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:Te.announce.of(r),userEvent:"input.replace.all"}),!0});function GA(t){return t.state.facet(q0).createPanel(t)}function W5(t,e){var n,r,i,s,o;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let u=t.facet(q0);return new wj({search:((n=e?.literal)!==null&&n!==void 0?n:u.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:u.caseSensitive,literal:(i=e?.literal)!==null&&i!==void 0?i:u.literal,regexp:(s=e?.regexp)!==null&&s!==void 0?s:u.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:u.wholeWord})}function _j(t){let e=a1(t,GA);return e&&e.dom.querySelector("[main-field]")}function Sj(t){let e=_j(t);e&&e==t.root.activeElement&&e.select()}const kj=t=>{let e=t.state.field($c,!1);if(e&&e.panel){let n=_j(t);if(n&&n!=t.root.activeElement){let r=W5(t.state,e.query.spec);r.valid&&t.dispatch({effects:b1.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[YA.of(!0),e?b1.of(W5(t.state,e.query.spec)):wt.appendConfig.of(mpe)]});return!0},Cj=t=>{let e=t.state.field($c,!1);if(!e||!e.panel)return!1;let n=a1(t,GA);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:YA.of(!1)}),!0},hpe=[{key:"Mod-f",run:kj,scope:"editor search-panel"},{key:"F3",run:E2,shift:T2,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:E2,shift:T2,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Cj,scope:"editor search-panel"},{key:"Mod-Shift-l",run:cpe},{key:"Mod-Alt-g",run:jde},{key:"Mod-d",run:tpe,preventDefault:!0}];class dpe{constructor(e){this.view=e;let n=this.query=e.state.field($c).query.spec;this.commit=this.commit.bind(this),this.searchField=_n("input",{value:n.search,placeholder:$s(e,"Find"),"aria-label":$s(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=_n("input",{value:n.replace,placeholder:$s(e,"Replace"),"aria-label":$s(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=_n("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=_n("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=_n("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(i,s,o){return _n("button",{class:"cm-button",name:i,onclick:s,type:"button"},o)}this.dom=_n("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,r("next",()=>E2(e),[$s(e,"next")]),r("prev",()=>T2(e),[$s(e,"previous")]),r("select",()=>upe(e),[$s(e,"all")]),_n("label",null,[this.caseField,$s(e,"match case")]),_n("label",null,[this.reField,$s(e,"regexp")]),_n("label",null,[this.wordField,$s(e,"by word")]),...e.state.readOnly?[]:[_n("br"),this.replaceField,r("replace",()=>k7(e),[$s(e,"replace")]),r("replaceAll",()=>fpe(e),[$s(e,"replace all")])],_n("button",{name:"close",onclick:()=>Cj(e),"aria-label":$s(e,"close"),type:"button"},["×"])])}commit(){let e=new wj({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:b1.of(e)}))}keydown(e){_ue(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?T2:E2)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),k7(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(b1)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(q0).top}}function $s(t,e){return t.state.phrase(e)}const xb=30,_b=/[\s\.,:;?!]/;function HA(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),i=t.state.doc.lineAt(n).to,s=Math.max(r.from,e-xb),o=Math.min(i,n+xb),a=t.state.sliceDoc(s,o);if(s!=r.from){for(let l=0;la.length-xb;l--)if(!_b.test(a[l-1])&&_b.test(a[l])){a=a.slice(0,l);break}}return Te.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${r.number}.`)}const ppe=Te.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),mpe=[$c,Ku.low(lpe),ppe];class D2{static create(e,n,r,i,s){let o=i+(i<<8)+e+(n<<4)|0;return new D2(e,n,r,o,s,[],[])}constructor(e,n,r,i,s,o,a){this.type=e,this.value=n,this.from=r,this.hash=i,this.end=s,this.children=o,this.positions=a,this.hashProp=[[pt.contextHash,i]]}addChild(e,n){e.prop(pt.contextHash)!=this.hash&&(e=new fn(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(n)}toTree(e,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 fn(e.types[this.type],this.children,this.positions,n-this.from).balance({makeTree:(i,s,o)=>new fn(zr.none,i,s,o,this.hashProp)})}}var Oe;(function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.Autolink=33]="Autolink",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel",t[t.URL=44]="URL"})(Oe||(Oe={}));class gpe{constructor(e,n){this.start=e,this.content=n,this.marks=[],this.parsers=[]}}class ype{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 e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return Eg(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,n=0,r=0){for(let i=n;i=e.stack[n.depth+1].value+n.baseIndent)return!0;if(n.indent>=n.baseIndent+4)return!1;let r=(t.type==Oe.OrderedList?eE:JA)(n,e,!1);return r>0&&(t.type!=Oe.BulletList||KA(n,e,!1)<0)&&n.text.charCodeAt(n.pos+r-1)==t.value}const Aj={[Oe.Blockquote](t,e,n){return n.next!=62?!1:(n.markers.push(Ut(Oe.QuoteMark,e.lineStart+n.pos,e.lineStart+n.pos+1)),n.moveBase(n.pos+(Qo(n.text.charCodeAt(n.pos+1))?2:1)),t.end=e.lineStart+n.text.length,!0)},[Oe.ListItem](t,e,n){return n.indent-1?!1:(n.moveBaseColumn(n.baseIndent+t.value),!0)},[Oe.OrderedList]:C7,[Oe.BulletList]:C7,[Oe.Document](){return!0}};function Qo(t){return t==32||t==9||t==10||t==13}function Eg(t,e=0){for(;en&&Qo(t.charCodeAt(e-1));)e--;return e}function Ej(t){if(t.next!=96&&t.next!=126)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length&&e.parser.leafBlockParsers.indexOf(Mj.SetextHeading)>-1||r<3?-1:1}function Dj(t,e){for(let n=t.stack.length-1;n>=0;n--)if(t.stack[n].type==e)return!0;return!1}function JA(t,e,n){return(t.next==45||t.next==43||t.next==42)&&(t.pos==t.text.length-1||Qo(t.text.charCodeAt(t.pos+1)))&&(!n||Dj(e,Oe.BulletList)||t.skipSpace(t.pos+2)=48&&i<=57;){r++;if(r==t.text.length)return-1;i=t.text.charCodeAt(r)}return r==t.pos||r>t.pos+9||i!=46&&i!=41||rt.pos+1||t.next!=49)?-1:r+1-t.pos}function Pj(t){if(t.next!=35)return-1;let e=t.pos+1;for(;e6?-1:n}function Rj(t){if(t.next!=45&&t.next!=61||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,Fj=/\?>/,G5=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*/i.exec(r);if(s)return t.append(Ut(Oe.Comment,n,n+1+s[0].length));let o=/^\?[^]*?\?>/.exec(r);if(o)return t.append(Ut(Oe.ProcessingInstruction,n,n+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/\s*[a-zA-Z][\w-]*\s*>|\s*[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*(\/\s*)?>)/.exec(r);return a?t.append(Ut(Oe.HTMLTag,n,n+1+a[0].length)):-1},Emphasis(t,e,n){if(e!=95&&e!=42)return-1;let r=n+1;for(;t.char(r)==e;)r++;let i=t.slice(n-1,n),s=t.slice(r,r+1),o=v1.test(i),a=v1.test(s),l=/\s|^$/.test(i),u=/\s|^$/.test(s),c=!u&&(!a||l||o),f=!l&&(!o||u||a),h=c&&(e==42||!f||o),d=f&&(e==42||!c||a);return t.append(new js(e==95?zj:Uj,n,r,(h?1:0)|(d?2:0)))},HardBreak(t,e,n){if(e==92&&t.char(n+1)==10)return t.append(Ut(Oe.HardBreak,n,n+2));if(e==32){let r=n+1;for(;t.char(r)==32;)r++;if(t.char(r)==10&&r>=n+2)return t.append(Ut(Oe.HardBreak,n,r+1))}return-1},Link(t,e,n){return e==91?t.append(new js(Bf,n,n+1,1)):-1},Image(t,e,n){return e==33&&t.char(n+1)==91?t.append(new js(P2,n,n+2,1)):-1},LinkEnd(t,e,n){if(e!=93)return-1;for(let r=t.parts.length-1;r>=0;r--){let i=t.parts[r];if(i instanceof js&&(i.type==Bf||i.type==P2)){if(!i.side||t.skipSpace(i.to)==n&&!/[(\[]/.test(t.slice(n+1,n+2)))return t.parts[r]=null,-1;let s=t.takeContent(r),o=t.parts[r]=_pe(t,s,i.type==Bf?Oe.Link:Oe.Image,i.from,n+1);if(i.type==Bf)for(let a=0;ae?Ut(Oe.URL,e+n,s+n):s==t.length?null:!1}}function qj(t,e,n){let r=t.charCodeAt(e);if(r!=39&&r!=34&&r!=40)return!1;let i=r==40?41:r;for(let s=e+1,o=!1;s=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,n){return this.text.slice(e-this.offset,n-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,n,r,i,s){return this.append(new js(e,n,r,(i?1:0)|(s?2:0)))}get hasOpenLink(){for(let e=this.parts.length-1;e>=0;e--){let n=this.parts[e];if(n instanceof js&&(n.type==Bf||n.type==P2))return!0}return!1}addElement(e){return this.append(e)}resolveMarkers(e){for(let r=e;r=e;l--){let m=this.parts[l];if(m instanceof js&&m.side&1&&m.type==i.type&&!(s&&(i.side&1||m.side&2)&&(m.to-m.from+o)%3==0&&((m.to-m.from)%3||o%3))){a=m;break}}if(!a)continue;let u=i.type.resolve,c=[],f=a.from,h=i.to;if(s){let m=Math.min(2,a.to-a.from,o);f=a.to-m,h=i.from+m,u=m==1?"Emphasis":"StrongEmphasis"}a.type.mark&&c.push(this.elt(a.type.mark,f,a.to));for(let m=l+1;m=0;n--){let r=this.parts[n];if(r instanceof js&&r.type==e&&r.side&1)return n}return null}takeContent(e){let n=this.resolveMarkers(e);return this.parts.length=e,n}getDelimiterAt(e){let n=this.parts[e];return n instanceof js?n:null}skipSpace(e){return Eg(this.text,e-this.offset)+this.offset}elt(e,n,r,i){return typeof e=="string"?Ut(this.parser.getNodeType(e),n,r,i):new Bj(e,n)}}tE.linkStart=Bf;tE.imageStart=P2;function K5(t,e){if(!e.length)return t;if(!t.length)return e;let n=t.slice(),r=0;for(let i of e){for(;r(e?e-1:0))return!1;if(this.fragmentEnd<0){let s=this.fragment.to;for(;s>0&&this.input.read(s-1,s)!=` `;)s--;this.fragmentEnd=s?s-1:0}let r=this.cursor;r||(r=this.cursor=this.fragment.tree.cursor(),r.firstChild());let i=e+this.fragment.offset;for(;r.to<=i;)if(!r.parent())return!1;for(;;){if(r.from>=i)return this.fragment.from<=n;if(!r.childAfter(i))return!1}}matches(e){let n=this.cursor.tree;return n&&n.prop(pt.contextHash)==e}takeNodes(e){let n=this.cursor,r=this.fragment.offset,i=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,o=s,a=e.block.children.length,l=o,u=a;for(;;){if(n.to-r>i){if(n.type.isAnonymous&&n.firstChild())continue;break}let c=Zj(n.from-r,e.ranges);if(n.to-r<=e.ranges[e.rangeI].to)e.addNode(n.tree,c);else{let f=new fn(e.parser.nodeSet.types[Oe.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(f,n.tree),e.addNode(f,c)}if(n.type.is("Block")&&(Spe.indexOf(n.type.id)<0?(o=n.to-r,a=e.block.children.length):(o=l,a=u,l=n.to-r,u=e.block.children.length)),!n.nextSibling())break}for(;e.block.children.length>a;)e.block.children.pop(),e.block.positions.pop();return o-s}};function Zj(t,e){let n=t;for(let r=1;rSb[t]),Object.keys(Sb).map(t=>Mj[t]),Object.keys(Sb),vpe,Aj,Object.keys(US).map(t=>US[t]),Object.keys(US),[]);function Epe(t,e,n){let r=[];for(let i=t.firstChild,s=e;;i=i.nextSibling){let o=i?i.from:n;if(o>s&&r.push({from:s,to:o}),!i)break;s=i.to}return r}function Tpe(t){let{codeParser:e,htmlParser:n}=t;return{wrap:fU((i,s)=>{let o=i.type.id;if(e&&(o==Oe.CodeBlock||o==Oe.FencedCode)){let a="";if(o==Oe.FencedCode){let u=i.node.getChild(Oe.CodeInfo);u&&(a=s.read(u.from,u.to))}let l=e(a);if(l)return{parser:l,overlay:u=>u.type.id==Oe.CodeText}}else if(n&&(o==Oe.HTMLBlock||o==Oe.HTMLTag||o==Oe.CommentBlock))return{parser:n,overlay:Epe(i.node,i.from,i.to)};return null})}}const Dpe={resolve:"Strikethrough",mark:"StrikethroughMark"},Ppe={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":P.strikethrough}},{name:"StrikethroughMark",style:P.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,n){if(e!=126||t.char(n+1)!=126||t.char(n+2)==126)return-1;let r=t.slice(n-1,n),i=t.slice(n+2,n+3),s=/\s|^$/.test(r),o=/\s|^$/.test(i),a=v1.test(r),l=v1.test(i);return t.addDelimiter(Dpe,n,n+2,!o&&(!l||s||a),!s&&(!a||o||l))},after:"Emphasis"}]};function Tg(t,e,n=0,r,i=0){let s=0,o=!0,a=-1,l=-1,u=!1,c=()=>{r.push(t.elt("TableCell",i+a,i+l,t.parser.parseInline(e.slice(a,l),i+a)))};for(let f=n;f-1)&&s++,o=!1,r&&(a>-1&&c(),r.push(t.elt("TableDelimiter",f+i,f+i+1))),a=l=-1):(u||h!=32&&h!=9)&&(a<0&&(a=f),l=f+1),u=!u&&h==92}return a>-1&&(s++,r&&c()),s}function D7(t,e){for(let n=e;ni instanceof P7)||!D7(e.text,e.basePos))return!1;let r=t.peekLine();return Xj.test(r)&&Tg(t,e.text,e.basePos)==Tg(t,r,e.basePos)},before:"SetextHeading"}]};class Ipe{nextLine(){return!1}finish(e,n){return e.addLeafElement(n,e.elt("Task",n.start,n.start+n.content.length,[e.elt("TaskMarker",n.start,n.start+3),...e.parser.parseInline(n.content.slice(3),n.start+3)])),!0}}const Fpe={defineNodes:[{name:"Task",block:!0,style:P.list},{name:"TaskMarker",style:P.atom}],parseBlock:[{name:"TaskList",leaf(t,e){return/^\[[ xX]\][ \t]/.test(e.content)&&t.parentType().name=="ListItem"?new Ipe:null},after:"SetextHeading"}]},R7=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,I7=/[\w-]+(\.[\w-]+)+(\/[^\s<]*)?/gy,$pe=/[\w-]+\.[\w-]+($|\/)/,F7=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,$7=/\/[a-zA-Z\d@.]+/gy;function M7(t,e,n,r){let i=0;for(let s=e;s-1)return-1;let r=e+n[0].length;for(;;){let i=t[r-1],s;if(/[?!.,:*_~]/.test(i)||i==")"&&M7(t,e,r,")")>M7(t,e,r,"("))r--;else if(i==";"&&(s=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(t.slice(e,r))))r=e+s.index;else break}return r}function L7(t,e){F7.lastIndex=e;let n=F7.exec(t);if(!n)return-1;let r=n[0][n[0].length-1];return r=="_"||r=="-"?-1:e+n[0].length-(r=="."?1:0)}const Lpe={parseInline:[{name:"Autolink",parse(t,e,n){let r=n-t.offset;if(r&&/\w/.test(t.text[r-1]))return-1;R7.lastIndex=r;let i=R7.exec(t.text),s=-1;if(!i)return-1;if(i[1]||i[2]){if(s=Mpe(t.text,r+i[0].length),s>-1&&t.hasOpenLink){let o=/([^\[\]]|\[[^\]]*\])*/.exec(t.text.slice(r,s));s=r+o[0].length}}else i[3]?s=L7(t.text,r):(s=L7(t.text,r+i[0].length),s>-1&&i[0]=="xmpp:"&&($7.lastIndex=s,i=$7.exec(t.text),i&&(s=i.index+i[0].length)));return s<0?-1:(t.addElement(t.elt("URL",n,s+t.offset)),s+t.offset)}}]},Npe=[Rpe,Fpe,Ppe,Lpe];function Wj(t,e,n){return(r,i,s)=>{if(i!=t||r.char(s+1)==t)return-1;let o=[r.elt(n,s,s+1)];for(let a=s+1;an%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let i=e.parser.context;return new R2(e,[],n,r,r,0,[],0,i?new Q7(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,i=e&65535,{parser:s}=this.p,o=this.reducePos=2e3&&!(!((n=this.p.parser.nodeSet.types[i])===null||n===void 0)&&n.isAnonymous)&&(u==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizel;)this.stack.pop();this.reduceContext(i,u)}storeNode(e,n,r,i=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&o.buffer[a-4]==0&&o.buffer[a-1]>-1){if(n==r)return;if(o.buffer[a-2]>=n){o.buffer[a-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(e,n,r,i);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let a=!1;for(let l=o;l>0&&this.buffer[l-2]>r;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,i>4&&(i-=4)}this.buffer[o]=e,this.buffer[o+1]=n,this.buffer[o+2]=r,this.buffer[o+3]=i}}shift(e,n,r,i){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let s=e,{parser:o}=this.p;(i>this.pos||n<=o.maxNode)&&(this.pos=i,o.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,r),this.shiftContext(n,r),n<=o.maxNode&&this.buffer.push(n,r,i,4)}else this.pos=i,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,i,4)}apply(e,n,r,i){e&65536?this.reduce(e):this.shift(e,n,r,i)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(n,i),this.buffer.push(r,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),i=e.bufferBase+n;for(;e&&i==e.bufferBase;)e=e.parent;return new R2(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new Upe(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let i=[];for(let s=0,o;sl&1&&a==o)||i.push(n[s],o)}n=i}let r=[];for(let i=0;i>19,i=n&65535,s=this.stack.length-r*3;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;n=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(i,s)=>{if(!n.includes(i))return n.push(i),e.allActions(i,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-s;if(a>1){let l=o&65535,u=this.stack.length-a*3;if(u>=0&&e.getGoto(this.stack[u],l,!1)>=0)return a<<19|65536|l}}else{let a=r(o,s+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;nthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Q7{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class Upe{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=i}}class I2{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new I2(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new I2(this.stack,this.pos,this.index)}}function og(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,i=0;r=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),s+=l,a)break;s*=46}n?n[i++]=s:n=new e(s)}return n}class $O{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const B7=new $O;class jpe{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=B7,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,i=this.rangeIndex,s=this.pos+e;for(;sr.to:s>=r.to;){if(i==this.ranges.length-1)return null;let o=this.ranges[++i];s+=o.from-r.to,r=o}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,i;if(n>=0&&n=this.chunk2Pos&&ra.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),i=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),i}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=B7,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let i of this.ranges){if(i.from>=n)break;i.to>e&&(r+=this.input.read(Math.max(i.from,e),Math.min(i.to,n)))}return r}}class xp{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;Yj(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}xp.prototype.contextual=xp.prototype.fallback=xp.prototype.extend=!1;class F2{constructor(e,n,r){this.precTable=n,this.elseToken=r,this.data=typeof e=="string"?og(e):e}token(e,n){let r=e.pos,i=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(Yj(this.data,e,n,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||i++,o==null)break;e.reset(o,e.token)}i&&(e.reset(r,e.token),e.acceptToken(this.elseToken,i))}}F2.prototype.contextual=xp.prototype.fallback=xp.prototype.extend=!1;class Ps{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function Yj(t,e,n,r,i,s){let o=0,a=1<0){let p=t[d];if(l.allows(p)&&(e.token.value==-1||e.token.value==p||qpe(p,e.token.value,i,s))){e.acceptToken(p);break}}let c=e.next,f=0,h=t[o+2];if(e.next<0&&h>f&&t[u+h*3-3]==65535){o=t[u+h*3-1];continue e}for(;f>1,p=u+d+(d<<1),m=t[p],g=t[p+1]||65536;if(c=g)f=d+1;else{o=t[p+2],e.advance();continue e}}break}}function z7(t,e,n){for(let r=e,i;(i=t[r])!=65535;r++)if(i==n)return r-e;return-1}function qpe(t,e,n,r){let i=z7(n,r,e);return i<0||z7(n,r,t)e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class Vpe{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?U7(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?U7(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(s instanceof fn){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[n]++,this.nextStart=o+s.length}}}class Zpe{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new $O)}getActions(e){let n=0,r=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let u=0;uf.end+25&&(l=Math.max(f.lookAhead,l)),f.value!=0)){let h=n;if(f.extended>-1&&(n=this.addActions(e,f.extended,f.end,n)),n=this.addActions(e,f.value,f.end,n),!c.extend&&(r=f,n>h))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new $O,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new $O,{pos:r,p:i}=e;return n.start=r,n.end=Math.min(r+1,i.stream.end),n.value=r==i.stream.end?i.parser.eofTerm:0,n}updateCachedToken(e,n,r){let i=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(i,e),r),e.value>-1){let{parser:s}=r.p;for(let o=0;o=0&&r.p.parser.dialect.allows(a>>1)){(a&1)==0?e.value=a>>1:e.extended=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,n,r,i){for(let s=0;se.bufferLength*4?new Vpe(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],i,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;on)r.push(a);else{if(this.advanceStack(a,r,e))continue;{i||(i=[],s=[]),i.push(a);let l=this.tokens.getMainToken(a);s.push(l.value,l.end)}}break}}if(!r.length){let o=i&&Ype(i);if(o)return Ms&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Ms&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&i){let o=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,r);if(o)return Ms&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((a,l)=>l.score-a.score);r.length>o;)r.pop();r.some(a=>a.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let o=0;o500&&u.buffer.length>500)if((a.score-u.score||a.buffer.length-u.buffer.length)>0)r.splice(l--,1);else{r.splice(o--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let u=e.curContext&&e.curContext.tracker.strict,c=u?e.curContext.hash:0;for(let f=this.fragments.nodeAt(i);f;){let h=this.parser.nodeSet.types[f.type.id]==f.type?s.getGoto(e.state,f.type.id):-1;if(h>-1&&f.length&&(!u||(f.prop(pt.contextHash)||0)==c))return e.useNode(f,h),Ms&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(f.type.id)})`),!0;if(!(f instanceof fn)||f.children.length==0||f.positions[0]>0)break;let d=f.children[0];if(d instanceof fn&&f.positions[0]==0)f=d;else break}}let a=s.stateSlot(e.state,4);if(a>0)return e.reduce(a),Ms&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let u=0;ui?n.push(p):r.push(p)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return j7(e,n),!0}}runRecovery(e,n,r){let i=null,s=!1;for(let o=0;o ":"";if(a.deadEnd&&(s||(s=!0,a.restart(),Ms&&console.log(c+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let f=a.split(),h=c;for(let d=0;d<10&&f.forceReduce()&&(Ms&&console.log(h+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,r));d++)Ms&&(h=this.stackID(f)+" -> ");for(let d of a.recoverByInsert(l))Ms&&console.log(c+this.stackID(d)+" (via recover-insert)"),this.advanceFully(d,r);this.stream.end>a.pos?(u==a.pos&&(u++,l=0),a.recoverByDelete(l,u),Ms&&console.log(c+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),j7(a,r)):(!i||i.scoret;class Gj{constructor(e){this.start=e.start,this.shift=e.shift||qS,this.reduce=e.reduce||qS,this.reuse=e.reuse||qS,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class ju extends TA{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let a=0;ae.topRules[a][1]),i=[];for(let a=0;a=0)s(c,l,a[u++]);else{let f=a[u+-c];for(let h=-c;h>0;h--)s(a[u++],l,f);u++}}}this.nodeSet=new dy(n.map((a,l)=>zr.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:i[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=oU;let o=og(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;atypeof a=="number"?new xp(o,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let i=new Xpe(this,e,n,r);for(let s of this.wrappers)i=s(i,e,n,r);return i}getGoto(e,n,r=!1){let i=this.goto;if(n>=i[0])return-1;for(let s=i[n+1];;){let o=i[s++],a=o&1,l=i[s++];if(a&&r)return l;for(let u=s+(o>>1);s0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),i=r?n(r):void 0;for(let s=this.stateSlot(e,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=lu(this.data,s+2);else break;i=n(lu(this.data,s+1))}return i}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=lu(this.data,r+2);else break;if((this.data[r+2]&1)==0){let i=this.data[r+1];n.some((s,o)=>o&1&&s==i)||n.push(this.data[r],i)}}return n}configure(e){let n=Object.assign(Object.create(ju.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let i=e.tokenizers.find(s=>s.from==r);return i?i.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,i)=>{let s=e.specializers.find(a=>a.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return n.specializers[i]=q7(o),o})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let s of e.split(" ")){let o=n.indexOf(s);o>=0&&(r[o]=!0)}let i=null;for(let s=0;sr)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.scoret.external(n,r)<<1|e}return t.get}const Gpe=55,Hpe=1,Kpe=56,Jpe=2,e0e=57,t0e=3,V7=4,n0e=5,nE=6,Hj=7,Kj=8,Jj=9,eq=10,r0e=11,i0e=12,s0e=13,VS=58,o0e=14,a0e=15,Z7=59,tq=21,l0e=23,nq=24,u0e=25,J5=27,rq=28,c0e=29,f0e=32,h0e=35,d0e=37,p0e=38,m0e=0,g0e=1,y0e={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},b0e={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},X7={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function O0e(t){return t==45||t==46||t==58||t>=65&&t<=90||t==95||t>=97&&t<=122||t>=161}let W7=null,Y7=null,G7=0;function e4(t,e){let n=t.pos+e;if(G7==n&&Y7==t)return W7;let r=t.peek(e),i="";for(;O0e(r);)i+=String.fromCharCode(r),r=t.peek(++e);return Y7=t,G7=n,W7=i?i.toLowerCase():r==v0e||r==w0e?void 0:null}const iq=60,$2=62,rE=47,v0e=63,w0e=33,x0e=45;function H7(t,e){this.name=t,this.parent=e}const _0e=[nE,eq,Hj,Kj,Jj],S0e=new Gj({start:null,shift(t,e,n,r){return _0e.indexOf(e)>-1?new H7(e4(r,1)||"",t):t},reduce(t,e){return e==tq&&t?t.parent:t},reuse(t,e,n,r){let i=e.type.id;return i==nE||i==d0e?new H7(e4(r,1)||"",t):t},strict:!1}),k0e=new Ps((t,e)=>{if(t.next!=iq){t.next<0&&e.context&&t.acceptToken(VS);return}t.advance();let n=t.next==rE;n&&t.advance();let r=e4(t,0);if(r===void 0)return;if(!r)return t.acceptToken(n?a0e:o0e);let i=e.context?e.context.name:null;if(n){if(r==i)return t.acceptToken(r0e);if(i&&b0e[i])return t.acceptToken(VS,-2);if(e.dialectEnabled(m0e))return t.acceptToken(i0e);for(let s=e.context;s;s=s.parent)if(s.name==r)return;t.acceptToken(s0e)}else{if(r=="script")return t.acceptToken(Hj);if(r=="style")return t.acceptToken(Kj);if(r=="textarea")return t.acceptToken(Jj);if(y0e.hasOwnProperty(r))return t.acceptToken(eq);i&&X7[i]&&X7[i][r]?t.acceptToken(VS,-1):t.acceptToken(nE)}},{contextual:!0}),C0e=new Ps(t=>{for(let e=0,n=0;;n++){if(t.next<0){n&&t.acceptToken(Z7);break}if(t.next==x0e)e++;else if(t.next==$2&&e>=2){n>=3&&t.acceptToken(Z7,-2);break}else e=0;t.advance()}});function A0e(t){for(;t;t=t.parent)if(t.name=="svg"||t.name=="math")return!0;return!1}const E0e=new Ps((t,e)=>{if(t.next==rE&&t.peek(1)==$2){let n=e.dialectEnabled(g0e)||A0e(e.context);t.acceptToken(n?n0e:V7,2)}else t.next==$2&&t.acceptToken(V7,1)});function iE(t,e,n){let r=2+t.length;return new Ps(i=>{for(let s=0,o=0,a=0;;a++){if(i.next<0){a&&i.acceptToken(e);break}if(s==0&&i.next==iq||s==1&&i.next==rE||s>=2&&so?i.acceptToken(e,-o):i.acceptToken(n,-(o-2));break}else if((i.next==10||i.next==13)&&a){i.acceptToken(e,1);break}else s=o=0;i.advance()}})}const T0e=iE("script",Gpe,Hpe),D0e=iE("style",Kpe,Jpe),P0e=iE("textarea",e0e,t0e),R0e=tc({"Text RawText IncompleteTag IncompleteCloseTag":P.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":P.angleBracket,TagName:P.tagName,"MismatchedCloseTag/TagName":[P.tagName,P.invalid],AttributeName:P.attributeName,"AttributeValue UnquotedAttributeValue":P.attributeValue,Is:P.definitionOperator,"EntityReference CharacterReference":P.character,Comment:P.blockComment,ProcessingInst:P.processingInstruction,DoctypeDecl:P.documentMeta}),I0e=ju.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!`Q#tO'#C{O!eQ#tO'#DOO!jQ#tO'#DRO!oQ#tO'#DTO!tOaO'#CqO#PObO'#CqO#[OdO'#CqO$kO!rO'#CqOOO`'#Cq'#CqO$rO$fO'#DUO$zQ#tO'#DWO%PQ#tO'#DXOOO`'#Dl'#DlOOO`'#DZ'#DZQVO!rOOO%UQ&rO,59^O%aQ&rO,59gO%lQ&rO,59jO%wQ&rO,59mO&SQ&rO,59oOOOa'#D_'#D_O&_OaO'#CyO&jOaO,59]OOOb'#D`'#D`O&rObO'#C|O&}ObO,59]OOOd'#Da'#DaO'VOdO'#DPO'bOdO,59]OOO`'#Db'#DbO'jO!rO,59]O'qQ#tO'#DSOOO`,59],59]OOOp'#Dc'#DcO'vO$fO,59pOOO`,59p,59pO(OQ#|O,59rO(TQ#|O,59sOOO`-E7X-E7XO(YQ&rO'#CtOOQW'#D['#D[O(hQ&rO1G.xOOOa1G.x1G.xOOO`1G/Z1G/ZO(sQ&rO1G/ROOOb1G/R1G/RO)OQ&rO1G/UOOOd1G/U1G/UO)ZQ&rO1G/XOOO`1G/X1G/XO)fQ&rO1G/ZOOOa-E7]-E7]O)qQ#tO'#CzOOO`1G.w1G.wOOOb-E7^-E7^O)vQ#tO'#C}OOOd-E7_-E7_O){Q#tO'#DQOOO`-E7`-E7`O*QQ#|O,59nOOOp-E7a-E7aOOO`1G/[1G/[OOO`1G/^1G/^OOO`1G/_1G/_O*VQ,UO,59`OOQW-E7Y-E7YOOOa7+$d7+$dOOO`7+$u7+$uOOOb7+$m7+$mOOOd7+$p7+$pOOO`7+$s7+$sO*bQ#|O,59fO*gQ#|O,59iO*lQ#|O,59lOOO`1G/Y1G/YO*qO7[O'#CwO+SOMhO'#CwOOQW1G.z1G.zOOO`1G/Q1G/QOOO`1G/T1G/TOOO`1G/W1G/WOOOO'#D]'#D]O+eO7[O,59cOOQW,59c,59cOOOO'#D^'#D^O+vOMhO,59cOOOO-E7Z-E7ZOOQW1G.}1G.}OOOO-E7[-E7[",stateData:",c~O!_OS~OUSOVPOWQOXROYTO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O|_O!eZO~OgaO~OgbO~OgcO~OgdO~OgeO~O!XfOPmP![mP~O!YiOQpP![pP~O!ZlORsP![sP~OUSOVPOWQOXROYTOZqO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O!eZO~O![rO~P#gO!]sO!fuO~OgvO~OgwO~OS|OT}OiyO~OS!POT}OiyO~OS!ROT}OiyO~OS!TOT}OiyO~OS}OT}OiyO~O!XfOPmX![mX~OP!WO![!XO~O!YiOQpX![pX~OQ!ZO![!XO~O!ZlORsX![sX~OR!]O![!XO~O![!XO~P#gOg!_O~O!]sO!f!aO~OS!bO~OS!cO~Oj!dOShXThXihX~OS!fOT!gOiyO~OS!hOT!gOiyO~OS!iOT!gOiyO~OS!jOT!gOiyO~OS!gOT!gOiyO~Og!kO~Og!lO~Og!mO~OS!nO~Ol!qO!a!oO!c!pO~OS!rO~OS!sO~OS!tO~Ob!uOc!uOd!uO!a!wO!b!uO~Ob!xOc!xOd!xO!c!wO!d!xO~Ob!uOc!uOd!uO!a!{O!b!uO~Ob!xOc!xOd!xO!c!{O!d!xO~OT~cbd!ey|!e~",goto:"%q!aPPPPPPPPPPPPPPPPPPPPP!b!hP!nPP!zP!}#Q#T#Z#^#a#g#j#m#s#y!bP!b!bP$P$V$m$s$y%P%V%]%cPPPPPPPP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:68,context:S0e,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,22,31,34,37,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,30,33,36,38,"OpenTag"],["group",-10,14,15,18,19,20,21,40,41,42,43,"Entity",17,"Entity TextContent",-3,29,32,35,"TextContent Entity"],["isolate",-11,22,30,31,33,34,36,37,38,39,42,43,"ltr",-3,27,28,40,""]],propSources:[R0e],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zblWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOb!R!R7tP;=`<%l7S!Z8OYlWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{iiSlWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbiSlWb!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VP<%l?Ah;{?Ah?BY7S?BY?Mn;{?MnO7S!V=dXiSb!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!V>SP;=`<%l;{!_>YP;=`<%l8t!_>dhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^/^!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!Z@TalWOX@OXZAYZ[@O[^AY^p@Oqr@OrsAYsw@OwxAYx!]@O!]!^Az!^!aAY!a#S@O#S#TAY#T;'S@O;'S;=`Bq<%lO@O!RA]UOpAYq!]AY!]!^Ao!^;'SAY;'S;=`At<%lOAY!RAtOc!R!RAwP;=`<%lAY!ZBRYlWc!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!ZBtP;=`<%l@O!_COhiSlWOX@OXZAYZ[@O[^AY^p@OqrBwrsAYswBwwxAYx!PBw!P!Q@O!Q!]Bw!]!^Dj!^!aAY!a#SBw#S#TE{#T#sBw#s$f@O$f;'SBw;'S;=`HS<%l?AhBw?Ah?BY@O?BY?MnBw?MnO@O!_DsbiSlWc!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'S;=`1e<%l?Ah/^?Ah?BY+P?BY?Mn/^?MnO+P!VFQbiSOpAYqrE{rsAYswE{wxAYx!PE{!P!QAY!Q!]E{!]!^GY!^!aAY!a#sE{#s$fAY$f;'SE{;'S;=`G|<%l?AhE{?Ah?BYAY?BY?MnE{?MnOAY!VGaXiSc!Rqr0msw0mx!P0m!Q!^0m!a#s0m$f;'S0m;'S;=`1_<%l?Ah0m?BY?Mn0m!VHPP;=`<%lE{!_HVP;=`<%lBw!ZHcW!cxaP!b`Or(trs'ksv(tw!^(t!^!_)e!_;'S(t;'S;=`*P<%lO(t!aIYliSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OKQ!O!P-_!P!Q$q!Q!^-_!^!_*V!_!a&X!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!aK_kiSaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx!P-_!P!Q$q!Q!^-_!^!_*V!_!`&X!`!aMS!a#S-_#S#T1k#T#s-_#s$f$q$f;'S-_;'S;=`3X<%l?Ah-_?Ah?BY$q?BY?Mn-_?MnO$q!TM_XaP!b`!dp!fQOr&Xrs&}sv&Xwx(tx!^&X!^!_*V!_;'S&X;'S;=`*y<%lO&X!aNZ!ZiSgQaPlW!b`!dpOX$qXZ&XZ[$q[^&X^p$qpq&Xqr-_rs&}sv-_vw/^wx(tx}-_}!OMz!O!PMz!P!Q$q!Q![Mz![!]Mz!]!^-_!^!_*V!_!a&X!a!c-_!c!}Mz!}#R-_#R#SMz#S#T1k#T#oMz#o#s-_#s$f$q$f$}-_$}%OMz%O%W-_%W%oMz%o%p-_%p&aMz&a&b-_&b1pMz1p4UMz4U4dMz4d4e-_4e$ISMz$IS$I`-_$I`$IbMz$Ib$Je-_$Je$JgMz$Jg$Kh-_$Kh%#tMz%#t&/x-_&/x&EtMz&Et&FV-_&FV;'SMz;'S;:j!#|;:j;=`3X<%l?&r-_?&r?AhMz?Ah?BY$q?BY?MnMz?MnO$q!a!$PP;=`<%lMz!R!$ZY!b`!dpOq*Vqr!$yrs(Vsv*Vwx)ex!a*V!a!b!4t!b;'S*V;'S;=`*s<%lO*V!R!%Q]!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!%y!O!f*V!f!g!']!g#W*V#W#X!0`#X;'S*V;'S;=`*s<%lO*V!R!&QX!b`!dpOr*Vrs(Vsv*Vwx)ex}*V}!O!&m!O;'S*V;'S;=`*s<%lO*V!R!&vV!b`!dp!ePOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!'dX!b`!dpOr*Vrs(Vsv*Vwx)ex!q*V!q!r!(P!r;'S*V;'S;=`*s<%lO*V!R!(WX!b`!dpOr*Vrs(Vsv*Vwx)ex!e*V!e!f!(s!f;'S*V;'S;=`*s<%lO*V!R!(zX!b`!dpOr*Vrs(Vsv*Vwx)ex!v*V!v!w!)g!w;'S*V;'S;=`*s<%lO*V!R!)nX!b`!dpOr*Vrs(Vsv*Vwx)ex!{*V!{!|!*Z!|;'S*V;'S;=`*s<%lO*V!R!*bX!b`!dpOr*Vrs(Vsv*Vwx)ex!r*V!r!s!*}!s;'S*V;'S;=`*s<%lO*V!R!+UX!b`!dpOr*Vrs(Vsv*Vwx)ex!g*V!g!h!+q!h;'S*V;'S;=`*s<%lO*V!R!+xY!b`!dpOr!+qrs!,hsv!+qvw!-Swx!.[x!`!+q!`!a!/j!a;'S!+q;'S;=`!0Y<%lO!+qq!,mV!dpOv!,hvx!-Sx!`!,h!`!a!-q!a;'S!,h;'S;=`!.U<%lO!,hP!-VTO!`!-S!`!a!-f!a;'S!-S;'S;=`!-k<%lO!-SP!-kO|PP!-nP;=`<%l!-Sq!-xS!dp|POv(Vx;'S(V;'S;=`(h<%lO(Vq!.XP;=`<%l!,ha!.aX!b`Or!.[rs!-Ssv!.[vw!-Sw!`!.[!`!a!.|!a;'S!.[;'S;=`!/d<%lO!.[a!/TT!b`|POr)esv)ew;'S)e;'S;=`)y<%lO)ea!/gP;=`<%l!.[!R!/sV!b`!dp|POr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!0]P;=`<%l!+q!R!0gX!b`!dpOr*Vrs(Vsv*Vwx)ex#c*V#c#d!1S#d;'S*V;'S;=`*s<%lO*V!R!1ZX!b`!dpOr*Vrs(Vsv*Vwx)ex#V*V#V#W!1v#W;'S*V;'S;=`*s<%lO*V!R!1}X!b`!dpOr*Vrs(Vsv*Vwx)ex#h*V#h#i!2j#i;'S*V;'S;=`*s<%lO*V!R!2qX!b`!dpOr*Vrs(Vsv*Vwx)ex#m*V#m#n!3^#n;'S*V;'S;=`*s<%lO*V!R!3eX!b`!dpOr*Vrs(Vsv*Vwx)ex#d*V#d#e!4Q#e;'S*V;'S;=`*s<%lO*V!R!4XX!b`!dpOr*Vrs(Vsv*Vwx)ex#X*V#X#Y!+q#Y;'S*V;'S;=`*s<%lO*V!R!4{Y!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!a!4t!a!b!:]!b;'S!4t;'S;=`!;r<%lO!4tq!5pV!dpOv!5kvx!6Vx!a!5k!a!b!7W!b;'S!5k;'S;=`!8V<%lO!5kP!6YTO!a!6V!a!b!6i!b;'S!6V;'S;=`!7Q<%lO!6VP!6lTO!`!6V!`!a!6{!a;'S!6V;'S;=`!7Q<%lO!6VP!7QOyPP!7TP;=`<%l!6Vq!7]V!dpOv!5kvx!6Vx!`!5k!`!a!7r!a;'S!5k;'S;=`!8V<%lO!5kq!7yS!dpyPOv(Vx;'S(V;'S;=`(h<%lO(Vq!8YP;=`<%l!5ka!8bX!b`Or!8]rs!6Vsv!8]vw!6Vw!a!8]!a!b!8}!b;'S!8];'S;=`!:V<%lO!8]a!9SX!b`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!b`yPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!b`!dpyPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!{let u=a.type.id;if(u==c0e)return ZS(a,l,n);if(u==f0e)return ZS(a,l,r);if(u==h0e)return ZS(a,l,i);if(u==tq&&s.length){let c=a.node,f=c.firstChild,h=f&&K7(f,l),d;if(h){for(let p of s)if(p.tag==h&&(!p.attrs||p.attrs(d||(d=sq(f,l))))){let m=c.lastChild,g=m.type.id==p0e?m.from:c.to;if(g>f.to)return{parser:p.parser,overlay:[{from:f.to,to:g}]}}}}if(o&&u==nq){let c=a.node,f;if(f=c.firstChild){let h=o[l.read(f.from,f.to)];if(h)for(let d of h){if(d.tagName&&d.tagName!=K7(c.parent,l))continue;let p=c.lastChild;if(p.type.id==J5){let m=p.from+1,g=p.lastChild,y=p.to-(g&&g.isError?0:1);if(y>m)return{parser:d.parser,overlay:[{from:m,to:y}]}}else if(p.type.id==rq)return{parser:d.parser,overlay:[{from:p.from,to:p.to}]}}}}return null})}const F0e=122,J7=1,$0e=123,M0e=124,aq=2,L0e=125,N0e=3,Q0e=4,lq=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],B0e=58,z0e=40,uq=95,U0e=91,MO=45,j0e=46,q0e=35,V0e=37,Z0e=38,X0e=92,W0e=10,Y0e=42;function w1(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}function sE(t){return t>=48&&t<=57}function e9(t){return sE(t)||t>=97&&t<=102||t>=65&&t<=70}const cq=(t,e,n)=>(r,i)=>{for(let s=!1,o=0,a=0;;a++){let{next:l}=r;if(w1(l)||l==MO||l==uq||s&&sE(l))!s&&(l!=MO||a>0)&&(s=!0),o===a&&l==MO&&o++,r.advance();else if(l==X0e&&r.peek(1)!=W0e){if(r.advance(),e9(r.next)){do r.advance();while(e9(r.next));r.next==32&&r.advance()}else r.next>-1&&r.advance();s=!0}else{s&&r.acceptToken(o==2&&i.canShift(aq)?e:l==z0e?n:t);break}}},G0e=new Ps(cq($0e,aq,M0e)),H0e=new Ps(cq(L0e,N0e,Q0e)),K0e=new Ps(t=>{if(lq.includes(t.peek(-1))){let{next:e}=t;(w1(e)||e==uq||e==q0e||e==j0e||e==Y0e||e==U0e||e==B0e&&w1(t.peek(1))||e==MO||e==Z0e)&&t.acceptToken(F0e)}}),J0e=new Ps(t=>{if(!lq.includes(t.peek(-1))){let{next:e}=t;if(e==V0e&&(t.advance(),t.acceptToken(J7)),w1(e)){do t.advance();while(w1(t.next)||sE(t.next));t.acceptToken(J7)}}}),eme=tc({"AtKeyword import charset namespace keyframes media supports":P.definitionKeyword,"from to selector":P.keyword,NamespaceName:P.namespace,KeyframeName:P.labelName,KeyframeRangeName:P.operatorKeyword,TagName:P.tagName,ClassName:P.className,PseudoClassName:P.constant(P.className),IdName:P.labelName,"FeatureName PropertyName":P.propertyName,AttributeName:P.attributeName,NumberLiteral:P.number,KeywordQuery:P.keyword,UnaryQueryOp:P.operatorKeyword,"CallTag ValueName":P.atom,VariableName:P.variableName,Callee:P.operatorKeyword,Unit:P.unit,"UniversalSelector NestingSelector":P.definitionOperator,"MatchOp CompareOp":P.compareOperator,"ChildOp SiblingOp, LogicOp":P.logicOperator,BinOp:P.arithmeticOperator,Important:P.modifier,Comment:P.blockComment,ColorLiteral:P.color,"ParenthesizedContent StringLiteral":P.string,":":P.punctuation,"PseudoOp #":P.derefOperator,"; ,":P.separator,"( )":P.paren,"[ ]":P.squareBracket,"{ }":P.brace}),tme={__proto__:null,lang:38,"nth-child":38,"nth-last-child":38,"nth-of-type":38,"nth-last-of-type":38,dir:38,"host-context":38,if:84,url:124,"url-prefix":124,domain:124,regexp:124},nme={__proto__:null,or:98,and:98,not:106,only:106,layer:170},rme={__proto__:null,selector:112,layer:166},ime={__proto__:null,"@import":162,"@media":174,"@charset":178,"@namespace":182,"@keyframes":188,"@supports":200,"@scope":204},sme={__proto__:null,to:207},ome=ju.deserialize({version:14,states:"EbQYQdOOO#qQdOOP#xO`OOOOQP'#Cf'#CfOOQP'#Ce'#CeO#}QdO'#ChO$nQaO'#CcO$xQdO'#CkO%TQdO'#DpO%YQdO'#DrO%_QdO'#DuO%_QdO'#DxOOQP'#FV'#FVO&eQhO'#EhOOQS'#FU'#FUOOQS'#Ek'#EkQYQdOOO&lQdO'#EOO&PQhO'#EUO&lQdO'#EWO'aQdO'#EYO'lQdO'#E]O'tQhO'#EcO(VQdO'#EeO(bQaO'#CfO)VQ`O'#D{O)[Q`O'#F`O)gQdO'#F`QOQ`OOP)qO&jO'#CaPOOO)C@t)C@tOOQP'#Cj'#CjOOQP,59S,59SO#}QdO,59SO)|QdO,59VO%TQdO,5:[O%YQdO,5:^O%_QdO,5:aO%_QdO,5:cO%_QdO,5:dO%_QdO'#ErO*XQ`O,58}O*aQdO'#DzOOQS,58},58}OOQP'#Cn'#CnOOQO'#Dn'#DnOOQP,59V,59VO*hQ`O,59VO*mQ`O,59VOOQP'#Dq'#DqOOQP,5:[,5:[OOQO'#Ds'#DsO*rQpO,5:^O+]QaO,5:aO+sQaO,5:dOOQW'#DZ'#DZO,ZQhO'#DdO,xQhO'#FaO'tQhO'#DbO-WQ`O'#DhOOQW'#F['#F[O-]Q`O,5;SO-eQ`O'#DeOOQS-E8i-E8iOOQ['#Cs'#CsO-jQdO'#CtO.QQdO'#CzO.hQdO'#C}O/OQ!pO'#DPO1RQ!jO,5:jOOQO'#DU'#DUO*mQ`O'#DTO1cQ!nO'#FXO3`Q`O'#DVO3eQ`O'#DkOOQ['#FX'#FXO-`Q`O,5:pO3jQ!bO,5:rOOQS'#E['#E[O3rQ`O,5:tO3wQdO,5:tOOQO'#E_'#E_O4PQ`O,5:wO4UQhO,5:}O%_QdO'#DgOOQS,5;P,5;PO-eQ`O,5;PO4^QdO,5;PO4fQdO,5:gO4vQdO'#EtO5TQ`O,5;zO5TQ`O,5;zPOOO'#Ej'#EjP5`O&jO,58{POOO,58{,58{OOQP1G.n1G.nOOQP1G.q1G.qO*hQ`O1G.qO*mQ`O1G.qOOQP1G/v1G/vO5kQpO1G/xO5sQaO1G/{O6ZQaO1G/}O6qQaO1G0OO7XQaO,5;^OOQO-E8p-E8pOOQS1G.i1G.iO7cQ`O,5:fO7hQdO'#DoO7oQdO'#CrOOQP1G/x1G/xO&lQdO1G/xO7vQ!jO'#DZO8UQ!bO,59vO8^QhO,5:OOOQO'#F]'#F]O8XQ!bO,59zO'tQhO,59xO8fQhO'#EvO8sQ`O,5;{O9OQhO,59|O9uQhO'#DiOOQW,5:S,5:SOOQS1G0n1G0nOOQW,5:P,5:PO9|Q!fO'#FYOOQS'#FY'#FYOOQS'#Em'#EmO;^QdO,59`OOQ[,59`,59`O;tQdO,59fOOQ[,59f,59fO<[QdO,59iOOQ[,59i,59iOOQ[,59k,59kO&lQdO,59mOPQ!fO1G0ROOQO1G0R1G0ROOQO,5;`,5;`O>gQdO,5;`OOQO-E8r-E8rO>tQ`O1G1fPOOO-E8h-E8hPOOO1G.g1G.gOOQP7+$]7+$]OOQP7+%d7+%dO&lQdO7+%dOOQS1G0Q1G0QO?PQaO'#F_O?ZQ`O,5:ZO?`Q!fO'#ElO@^QdO'#FWO@hQ`O,59^O@mQ!bO7+%dO&lQdO1G/bO@uQhO1G/fOOQW1G/j1G/jOOQW1G/d1G/dOAWQhO,5;bOOQO-E8t-E8tOAfQhO'#DZOAtQhO'#F^OBPQ`O'#F^OBUQ`O,5:TOOQS-E8k-E8kOOQ[1G.z1G.zOOQ[1G/Q1G/QOOQ[1G/T1G/TOOQ[1G/X1G/XOBZQdO,5:lOOQS7+%p7+%pOB`Q`O7+%pOBeQhO'#DYOBmQ`O,59sO'tQhO,59sOOQ[1G/q1G/qOBuQ`O1G/qOOQS7+%z7+%zOBzQbO'#DPOOQO'#Eb'#EbOCYQ`O'#EaOOQO'#Ea'#EaOCeQ`O'#EwOCmQdO,5:zOOQS,5:z,5:zOOQ[1G/m1G/mOOQS7+&V7+&VO-`Q`O7+&VOCxQ!fO'#EsO&lQdO'#EsOEPQdO7+%mOOQO7+%m7+%mOOQO1G0z1G0zOEdQ!bO<jAN>jOIUQaO,5;]OOQO-E8o-E8oOI`QdO,5;[OOQO-E8n-E8nOOQW<WO&lQdO1G0uOK]Q`O7+'OOOQO,5;a,5;aOOQO-E8s-E8sOOQW<t}!O?V!O!P?t!P!Q@]!Q![AU![!]BP!]!^B{!^!_C^!_!`DY!`!aDm!a!b$q!b!cEn!c!}$q!}#OG{#O#P$q#P#QH^#Q#R6W#R#o$q#o#pHo#p#q6W#q#rIQ#r#sIc#s#y$q#y#z%i#z$f$q$f$g%i$g#BY$q#BY#BZ%i#BZ$IS$q$IS$I_%i$I_$I|$q$I|$JO%i$JO$JT$q$JT$JU%i$JU$KV$q$KV$KW%i$KW&FU$q&FU&FV%i&FV;'S$q;'S;=`Iz<%lO$q`$tSOy%Qz;'S%Q;'S;=`%c<%lO%Q`%VS!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Q`%fP;=`<%l%Q~%nh#s~OX%QX^'Y^p%Qpq'Yqy%Qz#y%Q#y#z'Y#z$f%Q$f$g'Y$g#BY%Q#BY#BZ'Y#BZ$IS%Q$IS$I_'Y$I_$I|%Q$I|$JO'Y$JO$JT%Q$JT$JU'Y$JU$KV%Q$KV$KW'Y$KW&FU%Q&FU&FV'Y&FV;'S%Q;'S;=`%c<%lO%Q~'ah#s~!a`OX%QX^'Y^p%Qpq'Yqy%Qz#y%Q#y#z'Y#z$f%Q$f$g'Y$g#BY%Q#BY#BZ'Y#BZ$IS%Q$IS$I_'Y$I_$I|%Q$I|$JO'Y$JO$JT%Q$JT$JU'Y$JU$KV%Q$KV$KW'Y$KW&FU%Q&FU&FV'Y&FV;'S%Q;'S;=`%c<%lO%Qj)OUOy%Qz#]%Q#]#^)b#^;'S%Q;'S;=`%c<%lO%Qj)gU!a`Oy%Qz#a%Q#a#b)y#b;'S%Q;'S;=`%c<%lO%Qj*OU!a`Oy%Qz#d%Q#d#e*b#e;'S%Q;'S;=`%c<%lO%Qj*gU!a`Oy%Qz#c%Q#c#d*y#d;'S%Q;'S;=`%c<%lO%Qj+OU!a`Oy%Qz#f%Q#f#g+b#g;'S%Q;'S;=`%c<%lO%Qj+gU!a`Oy%Qz#h%Q#h#i+y#i;'S%Q;'S;=`%c<%lO%Qj,OU!a`Oy%Qz#T%Q#T#U,b#U;'S%Q;'S;=`%c<%lO%Qj,gU!a`Oy%Qz#b%Q#b#c,y#c;'S%Q;'S;=`%c<%lO%Qj-OU!a`Oy%Qz#h%Q#h#i-b#i;'S%Q;'S;=`%c<%lO%Qj-iS!qY!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Q~-xWOY-uZr-urs.bs#O-u#O#P.g#P;'S-u;'S;=`/c<%lO-u~.gOt~~.jRO;'S-u;'S;=`.s;=`O-u~.vXOY-uZr-urs.bs#O-u#O#P.g#P;'S-u;'S;=`/c;=`<%l-u<%lO-u~/fP;=`<%l-uj/nYjYOy%Qz!Q%Q!Q![0^![!c%Q!c!i0^!i#T%Q#T#Z0^#Z;'S%Q;'S;=`%c<%lO%Qj0cY!a`Oy%Qz!Q%Q!Q![1R![!c%Q!c!i1R!i#T%Q#T#Z1R#Z;'S%Q;'S;=`%c<%lO%Qj1WY!a`Oy%Qz!Q%Q!Q![1v![!c%Q!c!i1v!i#T%Q#T#Z1v#Z;'S%Q;'S;=`%c<%lO%Qj1}YrY!a`Oy%Qz!Q%Q!Q![2m![!c%Q!c!i2m!i#T%Q#T#Z2m#Z;'S%Q;'S;=`%c<%lO%Qj2tYrY!a`Oy%Qz!Q%Q!Q![3d![!c%Q!c!i3d!i#T%Q#T#Z3d#Z;'S%Q;'S;=`%c<%lO%Qj3iY!a`Oy%Qz!Q%Q!Q![4X![!c%Q!c!i4X!i#T%Q#T#Z4X#Z;'S%Q;'S;=`%c<%lO%Qj4`YrY!a`Oy%Qz!Q%Q!Q![5O![!c%Q!c!i5O!i#T%Q#T#Z5O#Z;'S%Q;'S;=`%c<%lO%Qj5TY!a`Oy%Qz!Q%Q!Q![5s![!c%Q!c!i5s!i#T%Q#T#Z5s#Z;'S%Q;'S;=`%c<%lO%Qj5zSrY!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Qd6ZUOy%Qz!_%Q!_!`6m!`;'S%Q;'S;=`%c<%lO%Qd6tS!hS!a`Oy%Qz;'S%Q;'S;=`%c<%lO%Qb7VSZQOy%Qz;'S%Q;'S;=`%c<%lO%Q~7fWOY7cZw7cwx.bx#O7c#O#P8O#P;'S7c;'S;=`8z<%lO7c~8RRO;'S7c;'S;=`8[;=`O7c~8_XOY7cZw7cwx.bx#O7c#O#P8O#P;'S7c;'S;=`8z;=`<%l7c<%lO7c~8}P;=`<%l7cj9VSeYOy%Qz;'S%Q;'S;=`%c<%lO%Q~9hOd~n9oUWQvWOy%Qz!_%Q!_!`6m!`;'S%Q;'S;=`%c<%lO%Qj:YWvW!mQOy%Qz!O%Q!O!P:r!P!Q%Q!Q![=w![;'S%Q;'S;=`%c<%lO%Qj:wU!a`Oy%Qz!Q%Q!Q![;Z![;'S%Q;'S;=`%c<%lO%Qj;bY!a`#}YOy%Qz!Q%Q!Q![;Z![!g%Q!g!hO[!a`#}YOy%Qz!O%Q!O!P;Z!P!Q%Q!Q![=w![!g%Q!g!hyS!^YOy%Qz;'S%Q;'S;=`%c<%lO%Qj?[WvWOy%Qz!O%Q!O!P:r!P!Q%Q!Q![=w![;'S%Q;'S;=`%c<%lO%Qj?yU]YOy%Qz!Q%Q!Q![;Z![;'S%Q;'S;=`%c<%lO%Q~@bTvWOy%Qz{@q{;'S%Q;'S;=`%c<%lO%Q~@xS!a`#t~Oy%Qz;'S%Q;'S;=`%c<%lO%QjAZ[#}YOy%Qz!O%Q!O!P;Z!P!Q%Q!Q![=w![!g%Q!g!htme[t]||-1},{term:125,get:t=>nme[t]||-1},{term:4,get:t=>rme[t]||-1},{term:25,get:t=>ime[t]||-1},{term:123,get:t=>sme[t]||-1}],tokenPrec:1963});let XS=null;function WS(){if(!XS&&typeof document=="object"&&document.body){let{style:t}=document.body,e=[],n=new Set;for(let r in t)r!="cssText"&&r!="cssFloat"&&typeof t[r]=="string"&&(/[A-Z]/.test(r)&&(r=r.replace(/[A-Z]/g,i=>"-"+i.toLowerCase())),n.has(r)||(e.push(r),n.add(r)));XS=e.sort().map(r=>({type:"property",label:r,apply:r+": "}))}return XS||[]}const t9=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(t=>({type:"class",label:t})),n9=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(t=>({type:"keyword",label:t})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(t=>({type:"constant",label:t}))),ame=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(t=>({type:"type",label:t})),lme=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map(t=>({type:"keyword",label:t})),Yl=/^(\w[\w-]*|-\w[\w-]*|)$/,ume=/^-(-[\w-]*)?$/;function cme(t,e){var n;if((t.name=="("||t.type.isError)&&(t=t.parent||t),t.name!="ArgList")return!1;let r=(n=t.parent)===null||n===void 0?void 0:n.firstChild;return r?.name!="Callee"?!1:e.sliceString(r.from,r.to)=="var"}const r9=new cU,fme=["Declaration"];function hme(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function fq(t,e,n){if(e.to-e.from>4096){let r=r9.get(e);if(r)return r;let i=[],s=new Set,o=e.cursor(Ln.IncludeAnonymous);if(o.firstChild())do for(let a of fq(t,o.node,n))s.has(a.label)||(s.add(a.label),i.push(a));while(o.nextSibling());return r9.set(e,i),i}else{let r=[],i=new Set;return e.cursor().iterate(s=>{var o;if(n(s)&&s.matchContext(fme)&&((o=s.node.nextSibling)===null||o===void 0?void 0:o.name)==":"){let a=t.sliceString(s.from,s.to);i.has(a)||(i.add(a),r.push({label:a,type:"variable"}))}}),r}}const dme=t=>e=>{let{state:n,pos:r}=e,i=hn(n).resolveInner(r,-1),s=i.type.isError&&i.from==i.to-1&&n.doc.sliceString(i.from,i.to)=="-";if(i.name=="PropertyName"||(s||i.name=="TagName")&&/^(Block|Styles)$/.test(i.resolve(i.to).name))return{from:i.from,options:WS(),validFor:Yl};if(i.name=="ValueName")return{from:i.from,options:n9,validFor:Yl};if(i.name=="PseudoClassName")return{from:i.from,options:t9,validFor:Yl};if(t(i)||(e.explicit||s)&&cme(i,n.doc))return{from:t(i)||s?i.from:r,options:fq(n.doc,hme(i),t),validFor:ume};if(i.name=="TagName"){for(let{parent:l}=i;l;l=l.parent)if(l.name=="Block")return{from:i.from,options:WS(),validFor:Yl};return{from:i.from,options:ame,validFor:Yl}}if(i.name=="AtKeyword")return{from:i.from,options:lme,validFor:Yl};if(!e.explicit)return null;let o=i.resolve(r),a=o.childBefore(r);return a&&a.name==":"&&o.name=="PseudoClassSelector"?{from:r,options:t9,validFor:Yl}:a&&a.name==":"&&o.name=="Declaration"||o.name=="ArgList"?{from:r,options:n9,validFor:Yl}:o.name=="Block"||o.name=="Styles"?{from:r,options:WS(),validFor:Yl}:null},pme=dme(t=>t.name=="VariableName"),M2=Uu.define({name:"css",parser:ome.configure({props:[pf.add({Declaration:Ru()}),mf.add({"Block KeyframeList":$x})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function mme(){return new af(M2,M2.data.of({autocomplete:pme}))}const gme=316,yme=317,i9=1,bme=2,Ome=3,vme=4,wme=318,xme=320,_me=321,Sme=5,kme=6,Cme=0,t4=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],hq=125,Ame=59,n4=47,Eme=42,Tme=43,Dme=45,Pme=60,Rme=44,Ime=63,Fme=46,$me=91,Mme=new Gj({start:!1,shift(t,e){return e==Sme||e==kme||e==xme?t:e==_me},strict:!1}),Lme=new Ps((t,e)=>{let{next:n}=t;(n==hq||n==-1||e.context)&&t.acceptToken(wme)},{contextual:!0,fallback:!0}),Nme=new Ps((t,e)=>{let{next:n}=t,r;t4.indexOf(n)>-1||n==n4&&((r=t.peek(1))==n4||r==Eme)||n!=hq&&n!=Ame&&n!=-1&&!e.context&&t.acceptToken(gme)},{contextual:!0}),Qme=new Ps((t,e)=>{t.next==$me&&!e.context&&t.acceptToken(yme)},{contextual:!0}),Bme=new Ps((t,e)=>{let{next:n}=t;if(n==Tme||n==Dme){if(t.advance(),n==t.next){t.advance();let r=!e.context&&e.canShift(i9);t.acceptToken(r?i9:bme)}}else n==Ime&&t.peek(1)==Fme&&(t.advance(),t.advance(),(t.next<48||t.next>57)&&t.acceptToken(Ome))},{contextual:!0});function YS(t,e){return t>=65&&t<=90||t>=97&&t<=122||t==95||t>=192||!e&&t>=48&&t<=57}const zme=new Ps((t,e)=>{if(t.next!=Pme||!e.dialectEnabled(Cme)||(t.advance(),t.next==n4))return;let n=0;for(;t4.indexOf(t.next)>-1;)t.advance(),n++;if(YS(t.next,!0)){for(t.advance(),n++;YS(t.next,!1);)t.advance(),n++;for(;t4.indexOf(t.next)>-1;)t.advance(),n++;if(t.next==Rme)return;for(let r=0;;r++){if(r==7){if(!YS(t.next,!0))return;break}if(t.next!="extends".charCodeAt(r))break;t.advance(),n++}}t.acceptToken(vme,-n)}),Ume=tc({"get set async static":P.modifier,"for while do if else switch try catch finally return throw break continue default case defer":P.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":P.operatorKeyword,"let var const using function class extends":P.definitionKeyword,"import export from":P.moduleKeyword,"with debugger new":P.keyword,TemplateString:P.special(P.string),super:P.atom,BooleanLiteral:P.bool,this:P.self,null:P.null,Star:P.modifier,VariableName:P.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":P.function(P.variableName),VariableDefinition:P.definition(P.variableName),Label:P.labelName,PropertyName:P.propertyName,PrivatePropertyName:P.special(P.propertyName),"CallExpression/MemberExpression/PropertyName":P.function(P.propertyName),"FunctionDeclaration/VariableDefinition":P.function(P.definition(P.variableName)),"ClassDeclaration/VariableDefinition":P.definition(P.className),"NewExpression/VariableName":P.className,PropertyDefinition:P.definition(P.propertyName),PrivatePropertyDefinition:P.definition(P.special(P.propertyName)),UpdateOp:P.updateOperator,"LineComment Hashbang":P.lineComment,BlockComment:P.blockComment,Number:P.number,String:P.string,Escape:P.escape,ArithOp:P.arithmeticOperator,LogicOp:P.logicOperator,BitOp:P.bitwiseOperator,CompareOp:P.compareOperator,RegExp:P.regexp,Equals:P.definitionOperator,Arrow:P.function(P.punctuation),": Spread":P.punctuation,"( )":P.paren,"[ ]":P.squareBracket,"{ }":P.brace,"InterpolationStart InterpolationEnd":P.special(P.brace),".":P.derefOperator,", ;":P.separator,"@":P.meta,TypeName:P.typeName,TypeDefinition:P.definition(P.typeName),"type enum interface implements namespace module declare":P.definitionKeyword,"abstract global Privacy readonly override":P.modifier,"is keyof unique infer asserts":P.operatorKeyword,JSXAttributeValue:P.attributeValue,JSXText:P.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":P.angleBracket,"JSXIdentifier JSXNameSpacedName":P.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":P.attributeName,"JSXBuiltin/JSXIdentifier":P.standard(P.tagName)}),jme={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:235,private:235,protected:235,readonly:237,instanceof:256,satisfies:259,import:292,keyof:349,unique:353,infer:359,asserts:395,is:397,abstract:417,implements:419,type:421,let:424,var:426,using:429,interface:435,enum:439,namespace:445,module:447,declare:451,global:455,defer:471,for:476,of:485,while:488,with:492,do:496,if:500,else:502,switch:506,case:512,try:518,catch:522,finally:526,return:530,throw:534,break:538,continue:542,debugger:546},qme={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:401},Vme={__proto__:null,"<":193},Zme=ju.deserialize({version:14,states:"$F|Q%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Il'#IlO1XQ`O'#GsO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JrO6[Q!0MxO'#JsO6uQ`O'#F]O6zQ,UO'#FtOOQ!0Lf'#Ff'#FfO7VO7dO'#FfO9XQMhO'#F|O9`Q`O'#F{OOQ!0Lf'#Js'#JsOOQ!0Lb'#Jr'#JrO9eQ`O'#GwOOQ['#K_'#K_O9pQ`O'#IYO9uQ!0LrO'#IZOOQ['#J`'#J`OOQ['#I_'#I_Q`QlOOQ`QlOOO9}Q!L^O'#DvO:UQlO'#EOO:]QlO'#EQO9kQ`O'#GsO:dQMhO'#CoO:rQ`O'#EnO:}Q`O'#EyO;hQMhO'#FeO;xQ`O'#GsOOQO'#K`'#K`O;}Q`O'#K`O<]Q`O'#G{O<]Q`O'#G|O<]Q`O'#HOO9kQ`O'#HRO=SQ`O'#HUO>kQ`O'#CeO>{Q`O'#HcO?TQ`O'#HiO?TQ`O'#HkO`QlO'#HmO?TQ`O'#HoO?TQ`O'#HrO?YQ`O'#HxO?_Q!0LsO'#IOO%[QlO'#IQO?jQ!0LsO'#ISO?uQ!0LsO'#IUO9uQ!0LrO'#IWO@QQ!0MxO'#CiOASQpO'#DlQOQ`OOO%[QlO'#EQOAjQ`O'#ETO:dQMhO'#EnOAuQ`O'#EnOBQQ!bO'#FeOOQ['#Cg'#CgOOQ!0Lb'#Dq'#DqOOQ!0Lb'#Jv'#JvO%[QlO'#JvOOQO'#Jy'#JyOOQO'#Ih'#IhOCQQpO'#EgOOQ!0Lb'#Ef'#EfOOQ!0Lb'#J}'#J}OC|Q!0MSO'#EgODWQpO'#EWOOQO'#Jx'#JxODlQpO'#JyOEyQpO'#EWODWQpO'#EgPFWO&2DjO'#CbPOOO)CD})CD}OOOO'#I`'#I`OFcO#tO,59UOOQ!0Lh,59U,59UOOOO'#Ia'#IaOFqO&jO,59UOGPQ!L^O'#DcOOOO'#Ic'#IcOGWO#@ItO,59{OOQ!0Lf,59{,59{OGfQlO'#IdOGyQ`O'#JtOIxQ!fO'#JtO+}QlO'#JtOJPQ`O,5:ROJgQ`O'#EpOJtQ`O'#KTOKPQ`O'#KSOKPQ`O'#KSOKXQ`O,5;^OK^Q`O'#KROOQ!0Ln,5:^,5:^OKeQlO,5:^OMcQ!0MxO,5:fONSQ`O,5:nONmQ!0LrO'#KQONtQ`O'#KPO9eQ`O'#KPO! YQ`O'#KPO! bQ`O,5;]O! gQ`O'#KPO!#lQ!fO'#JsOOQ!0Lh'#Ci'#CiO%[QlO'#ESO!$[Q!fO,5:sOOQS'#Jz'#JzOOQO-EtOOQ['#Jh'#JhOOQ[,5>u,5>uOOQ[-E<]-E<]O!TO`QlO,5>VO!LOQ`O,5>XO`QlO,5>ZO!LTQ`O,5>^O!LYQlO,5>dOOQ[,5>j,5>jO%[QlO,5>jO9uQ!0LrO,5>lOOQ[,5>n,5>nO#!dQ`O,5>nOOQ[,5>p,5>pO#!dQ`O,5>pOOQ[,5>r,5>rO##QQpO'#D_O%[QlO'#JvO##sQpO'#JvO##}QpO'#DmO#$`QpO'#DmO#&qQlO'#DmO#&xQ`O'#JuO#'QQ`O,5:WO#'VQ`O'#EtO#'eQ`O'#KUO#'mQ`O,5;_O#'rQpO'#DmO#(PQpO'#EVOOQ!0Lf,5:o,5:oO%[QlO,5:oO#(WQ`O,5:oO?YQ`O,5;YO!CUQpO,5;YO!C^QMhO,5;YO:dQMhO,5;YO#(`Q`O,5@bO#(eQ07dO,5:sOOQO-EPO$6^Q`O,5>POOQ[1G3i1G3iO`QlO1G3iOOQ[1G3o1G3oOOQ[1G3q1G3qO?TQ`O1G3sO$6cQlO1G3uO$:gQlO'#HtOOQ[1G3x1G3xO$:tQ`O'#HzO?YQ`O'#H|OOQ[1G4O1G4OO$:|QlO1G4OO9uQ!0LrO1G4UOOQ[1G4W1G4WOOQ!0Lb'#G_'#G_O9uQ!0LrO1G4YO9uQ!0LrO1G4[O$?TQ`O,5@bO!)[QlO,5;`O9eQ`O,5;`O?YQ`O,5:XO!)[QlO,5:XO!CUQpO,5:XO$?YQ?MtO,5:XOOQO,5;`,5;`O$?dQpO'#IeO$?zQ`O,5@aOOQ!0Lf1G/r1G/rO$@SQpO'#IkO$@^Q`O,5@pOOQ!0Lb1G0y1G0yO#$`QpO,5:XOOQO'#Ig'#IgO$@fQpO,5:qOOQ!0Ln,5:q,5:qO#(ZQ`O1G0ZOOQ!0Lf1G0Z1G0ZO%[QlO1G0ZOOQ!0Lf1G0t1G0tO?YQ`O1G0tO!CUQpO1G0tO!C^QMhO1G0tOOQ!0Lb1G5|1G5|O!ByQ!0LrO1G0^OOQO1G0m1G0mO%[QlO1G0mO$@mQ!0LrO1G0mO$@xQ!0LrO1G0mO!CUQpO1G0^ODWQpO1G0^O$AWQ!0LrO1G0mOOQO1G0^1G0^O$AlQ!0MxO1G0mPOOO-E<[-E<[POOO1G.h1G.hOOOO1G/i1G/iO$AvQ!bO,5QQpO,5@}OOQ!0Lb1G3c1G3cOOQ[7+$V7+$VO@zQ`O7+$VO9uQ!0LrO7+$VO%>]Q`O7+$VO%[QlO1G6lO%[QlO1G6mO%>bQ!0LrO1G6lO%>lQlO1G3kO%>sQ`O1G3kO%>xQlO1G3kOOQ[7+)T7+)TO9uQ!0LrO7+)_O`QlO7+)aOOQ['#Kh'#KhOOQ['#JS'#JSO%?PQlO,5>`OOQ[,5>`,5>`O%[QlO'#HuO%?^Q`O'#HwOOQ[,5>f,5>fO9eQ`O,5>fOOQ[,5>h,5>hOOQ[7+)j7+)jOOQ[7+)p7+)pOOQ[7+)t7+)tOOQ[7+)v7+)vO%?cQpO1G5|O%?}Q?MtO1G0zO%@XQ`O1G0zOOQO1G/s1G/sO%@dQ?MtO1G/sO?YQ`O1G/sO!)[QlO'#DmOOQO,5?P,5?POOQO-ERQ`O7+,WO&>WQ`O7+,XO%[QlO7+,WO%[QlO7+,XOOQ[7+)V7+)VO&>]Q`O7+)VO&>bQlO7+)VO&>iQ`O7+)VOOQ[<nQ`O,5>aOOQ[,5>c,5>cO&>sQ`O1G4QO9eQ`O7+&fO!)[QlO7+&fOOQO7+%_7+%_O&>xQ?MtO1G6ZO?YQ`O7+%_OOQ!0Lf<yQ?MvO,5?aO'@|Q?MvO,5?cO'CPQ?MvO7+'|O'DuQMjOG27TOOQO<VO!l$xO#jROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]$_Oa$qa'z$qa'w$qa!k$qa!Y$qa!_$qa%i$qa!g$qa~Ol)dO~P!&zOh%VOp%WOr%XOs$tOt$tOz%YO|%ZO!O%]O!S${O!_$|O!i%bO!l$xO#j%cO$W%`O$t%^O$v%_O$y%aO(T(vO(VTO(YUO(a$uO(y$}O(z%PO~Og(pP~P!,TO!Q)iO!g)hO!_$^X$Z$^X$]$^X$_$^X$f$^X~O!g)hO!_({X$Z({X$]({X$_({X$f({X~O!Q)iO~P!.^O!Q)iO!_({X$Z({X$]({X$_({X$f({X~O!_)kO$Z)oO$])jO$_)jO$f)pO~O![)sO~P!)[O$]$hO$_$gO$f)wO~On$zX!Q$zX#S$zX'y$zX(y$zX(z$zX~OgmXg$zXnmX!]mX#`mX~P!0SOx)yO(b)zO(c)|O~On*VO!Q*OO'y*PO(y$}O(z%PO~Og)}O~P!1WOg*WO~Oh%VOr%XOs$tOt$tOz%YO|%ZO!OVO!l$xO#jVO!l$xO#jROe!iOpkOrPO(VTO(YUO(aVO(o[O~O(T=QO~P#$qO!]-]O!^(iX~O!^-_O~O!g-VO#`-UO!]#hX!^#hX~O!]-`O!^(xX~O!^-bO~O!c-cO!d-cO(U!lO~P#$`O!^-fO~P'_On-iO!_'`O~O!Y-nO~Os!{a!b!{a!c!{a!d!{a#T!{a#U!{a#V!{a#W!{a#X!{a#[!{a#]!{a(U!{a(V!{a(Y!{a(e!{a(o!{a~P!#vO!p-sO#`-qO~PChO!c-uO!d-uO(U!lO~PDWOa%nO#`-qO'z%nO~Oa%nO!g#vO#`-qO'z%nO~Oa%nO!g#vO!p-sO#`-qO'z%nO(r'pO~O(P'xO(Q'xO(R-zO~Ov-{O~O!Y'Wa!]'Wa~P!:tO![.PO!Y'WX!]'WX~P%[O!](VO!Y(ha~O!Y(ha~PHRO!](^O!Y(va~O!S%hO![.TO!_%iO(T%gO!Y'^X!]'^X~O#`.VO!](ta!k(taa(ta'z(ta~O!g#vO~P#,wO!](jO!k(sa~O!S%hO!_%iO#j.ZO(T%gO~Op.`O!S%hO![.]O!_%iO!|]O#i._O#j.]O(T%gO!]'aX!k'aX~OR.dO!l#xO~Oh%VOn.gO!_'`O%i.fO~Oa#ci!]#ci'z#ci'w#ci!Y#ci!k#civ#ci!_#ci%i#ci!g#ci~P!:tOn>]O!Q*OO'y*PO(y$}O(z%PO~O#k#_aa#_a#`#_a'z#_a!]#_a!k#_a!_#_a!Y#_a~P#/sO#k(`XP(`XR(`X[(`Xa(`Xj(`Xr(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X'z(`X(a(`X(r(`X!k(`X!Y(`X'w(`Xv(`X!_(`X%i(`X!g(`X~P!6kO!].tO!k(kX~P!:tO!k.wO~O!Y.yO~OP$[OR#zO!Q#yO!S#{O!l#xO!p$[O(aVO[#mia#mij#mir#mi!]#mi#R#mi#o#mi#p#mi#q#mi#r#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#n#mi~P#3cO#n$OO~P#3cOP$[OR#zOr$aO!Q#yO!S#{O!l#xO!p$[O#n$OO#o$PO#p$PO#q$PO(aVO[#mia#mij#mi!]#mi#R#mi#s#mi#t#mi#u#mi#v#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#r#mi~P#6QO#r$QO~P#6QOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO(aVOa#mi!]#mi#x#mi#z#mi#{#mi'z#mi(r#mi(y#mi(z#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#v#mi~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO(aVO(z#}Oa#mi!]#mi#z#mi#{#mi'z#mi(r#mi(y#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#x$UO~P#;VO#x#mi~P#;VO#v$SO~P#8oOP$[OR#zO[$cOj$ROr$aO!Q#yO!S#{O!l#xO!p$[O#R$RO#n$OO#o$PO#p$PO#q$PO#r$QO#s$RO#t$RO#u$bO#v$SO#x$UO(aVO(y#|O(z#}Oa#mi!]#mi#{#mi'z#mi(r#mi'w#mi!Y#mi!k#miv#mi!_#mi%i#mi!g#mi~O#z#mi~P#={O#z$WO~P#={OP]XR]X[]Xj]Xr]X!Q]X!S]X!l]X!p]X#R]X#S]X#`]X#kfX#n]X#o]X#p]X#q]X#r]X#s]X#t]X#u]X#v]X#x]X#z]X#{]X$Q]X(a]X(r]X(y]X(z]X!]]X!^]X~O$O]X~P#@jOP$[OR#zO[]O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P#EyO!]/POg(pX~P!1WOg/RO~Oa$Pi!]$Pi'z$Pi'w$Pi!Y$Pi!k$Piv$Pi!_$Pi%i$Pi!g$Pi~P!:tO$]/SO$_/SO~O$]/TO$_/TO~O!g)hO#`/UO!_$cX$Z$cX$]$cX$_$cX$f$cX~O![/VO~O!_)kO$Z/XO$])jO$_)jO$f/YO~O!]VO!l$xO#j^O!Q*OO'y*PO(y$}O(z%POP#miR#mi!S#mi!l#mi!p#mi#n#mi#o#mi#p#mi#q#mi(a#mi~P&,QO#S$dOP(`XR(`X[(`Xj(`Xn(`Xr(`X!Q(`X!S(`X!l(`X!p(`X#R(`X#n(`X#o(`X#p(`X#q(`X#r(`X#s(`X#t(`X#u(`X#v(`X#x(`X#z(`X#{(`X$O(`X'y(`X(a(`X(r(`X(y(`X(z(`X!](`X!^(`X~O$O$Pi!]$Pi!^$Pi~P#BwO$O!ri!^!ri~P$+oOg']a!]']a~P!1WO!^7nO~O!]'da!^'da~P#BwO!Y7oO~P#/sO!g#vO(r'pO!]'ea!k'ea~O!]/pO!k)Oi~O!]/pO!g#vO!k)Oi~Og$|q!]$|q#`$|q$O$|q~P!1WO!Y'ga!]'ga~P#/sO!g7vO~O!]/yO!Y)Pi~P#/sO!]/yO!Y)Pi~O!Y7yO~Oh%VOr8OO!l%eO(r'pO~Oj8QO!g#vO~Or8TO!g#vO(r'pO~O!Q*OO'y*PO(z%POn'ja(y'ja!]'ja#`'ja~Og'ja$O'ja~P&5RO!Q*OO'y*POn'la(y'la(z'la!]'la#`'la~Og'la$O'la~P&5tOg(_q!](_q~P!1WO#`8VOg(_q!](_q~P!1WO!Y8WO~Og%Oq!]%Oq#`%Oq$O%Oq~P!1WOa$oy!]$oy'z$oy'w$oy!Y$oy!k$oyv$oy!_$oy%i$oy!g$oy~P!:tO!g6rO~O!]5[O!_)Qa~O!_'`OP$TaR$Ta[$Taj$Tar$Ta!Q$Ta!S$Ta!]$Ta!l$Ta!p$Ta#R$Ta#n$Ta#o$Ta#p$Ta#q$Ta#r$Ta#s$Ta#t$Ta#u$Ta#v$Ta#x$Ta#z$Ta#{$Ta(a$Ta(r$Ta(y$Ta(z$Ta~O%i7WO~P&8fO%^8[Oa%[i!_%[i'z%[i!]%[i~Oa#cy!]#cy'z#cy'w#cy!Y#cy!k#cyv#cy!_#cy%i#cy!g#cy~P!:tO[8^O~Ob8`O(T+qO(VTO(YUO~O!]1TO!^)Xi~O`8dO~O(e(|O!]'pX!^'pX~O!]5uO!^)Ua~O!^8nO~P%;eO(o!sO~P$&YO#[8oO~O!_1oO~O!_1oO%i8qO~On8tO!_1oO%i8qO~O[8yO!]'sa!^'sa~O!]1zO!^)Vi~O!k8}O~O!k9OO~O!k9RO~O!k9RO~P%[Oa9TO~O!g9UO~O!k9VO~O!](wi!^(wi~P#BwOa%nO#`9_O'z%nO~O!](ty!k(tya(ty'z(ty~P!:tO!](jO!k(sy~O%i9bO~P&8fO!_'`O%i9bO~O#k$|qP$|qR$|q[$|qa$|qj$|qr$|q!S$|q!]$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q'z$|q(a$|q(r$|q!k$|q!Y$|q'w$|q#`$|qv$|q!_$|q%i$|q!g$|q~P#/sO#k'jaP'jaR'ja['jaa'jaj'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja'z'ja(a'ja(r'ja!k'ja!Y'ja'w'jav'ja!_'ja%i'ja!g'ja~P&5RO#k'laP'laR'la['laa'laj'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la'z'la(a'la(r'la!k'la!Y'la'w'lav'la!_'la%i'la!g'la~P&5tO#k%OqP%OqR%Oq[%Oqa%Oqj%Oqr%Oq!S%Oq!]%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq'z%Oq(a%Oq(r%Oq!k%Oq!Y%Oq'w%Oq#`%Oqv%Oq!_%Oq%i%Oq!g%Oq~P#/sO!]'Yi!k'Yi~P!:tO$O#cq!]#cq!^#cq~P#BwO(y$}OP%aaR%aa[%aaj%aar%aa!S%aa!l%aa!p%aa#R%aa#n%aa#o%aa#p%aa#q%aa#r%aa#s%aa#t%aa#u%aa#v%aa#x%aa#z%aa#{%aa$O%aa(a%aa(r%aa!]%aa!^%aa~On%aa!Q%aa'y%aa(z%aa~P&IyO(z%POP%caR%ca[%caj%car%ca!S%ca!l%ca!p%ca#R%ca#n%ca#o%ca#p%ca#q%ca#r%ca#s%ca#t%ca#u%ca#v%ca#x%ca#z%ca#{%ca$O%ca(a%ca(r%ca!]%ca!^%ca~On%ca!Q%ca'y%ca(y%ca~P&LQOn>^O!Q*OO'y*PO(z%PO~P&IyOn>^O!Q*OO'y*PO(y$}O~P&LQOR0kO!Q0kO!S0lO#S$dOP}a[}aj}an}ar}a!l}a!p}a#R}a#n}a#o}a#p}a#q}a#r}a#s}a#t}a#u}a#v}a#x}a#z}a#{}a$O}a'y}a(a}a(r}a(y}a(z}a!]}a!^}a~O!Q*OO'y*POP$saR$sa[$saj$san$sar$sa!S$sa!l$sa!p$sa#R$sa#n$sa#o$sa#p$sa#q$sa#r$sa#s$sa#t$sa#u$sa#v$sa#x$sa#z$sa#{$sa$O$sa(a$sa(r$sa(y$sa(z$sa!]$sa!^$sa~O!Q*OO'y*POP$uaR$ua[$uaj$uan$uar$ua!S$ua!l$ua!p$ua#R$ua#n$ua#o$ua#p$ua#q$ua#r$ua#s$ua#t$ua#u$ua#v$ua#x$ua#z$ua#{$ua$O$ua(a$ua(r$ua(y$ua(z$ua!]$ua!^$ua~On>^O!Q*OO'y*PO(y$}O(z%PO~OP%TaR%Ta[%Taj%Tar%Ta!S%Ta!l%Ta!p%Ta#R%Ta#n%Ta#o%Ta#p%Ta#q%Ta#r%Ta#s%Ta#t%Ta#u%Ta#v%Ta#x%Ta#z%Ta#{%Ta$O%Ta(a%Ta(r%Ta!]%Ta!^%Ta~P''VO$O$mq!]$mq!^$mq~P#BwO$O$oq!]$oq!^$oq~P#BwO!^9oO~O$O9pO~P!1WO!g#vO!]'ei!k'ei~O!g#vO(r'pO!]'ei!k'ei~O!]/pO!k)Oq~O!Y'gi!]'gi~P#/sO!]/yO!Y)Pq~Or9wO!g#vO(r'pO~O[9yO!Y9xO~P#/sO!Y9xO~Oj:PO!g#vO~Og(_y!](_y~P!1WO!]'na!_'na~P#/sOa%[q!_%[q'z%[q!]%[q~P#/sO[:UO~O!]1TO!^)Xq~O`:YO~O#`:ZO!]'pa!^'pa~O!]5uO!^)Ui~P#BwO!S:]O~O!_1oO%i:`O~O(VTO(YUO(e:eO~O!]1zO!^)Vq~O!k:hO~O!k:iO~O!k:jO~O!k:jO~P%[O#`:mO!]#hy!^#hy~O!]#hy!^#hy~P#BwO%i:rO~P&8fO!_'`O%i:rO~O$O#|y!]#|y!^#|y~P#BwOP$|iR$|i[$|ij$|ir$|i!S$|i!l$|i!p$|i#R$|i#n$|i#o$|i#p$|i#q$|i#r$|i#s$|i#t$|i#u$|i#v$|i#x$|i#z$|i#{$|i$O$|i(a$|i(r$|i!]$|i!^$|i~P''VO!Q*OO'y*PO(z%POP'iaR'ia['iaj'ian'iar'ia!S'ia!l'ia!p'ia#R'ia#n'ia#o'ia#p'ia#q'ia#r'ia#s'ia#t'ia#u'ia#v'ia#x'ia#z'ia#{'ia$O'ia(a'ia(r'ia(y'ia!]'ia!^'ia~O!Q*OO'y*POP'kaR'ka['kaj'kan'kar'ka!S'ka!l'ka!p'ka#R'ka#n'ka#o'ka#p'ka#q'ka#r'ka#s'ka#t'ka#u'ka#v'ka#x'ka#z'ka#{'ka$O'ka(a'ka(r'ka(y'ka(z'ka!]'ka!^'ka~O(y$}OP%aiR%ai[%aij%ain%air%ai!Q%ai!S%ai!l%ai!p%ai#R%ai#n%ai#o%ai#p%ai#q%ai#r%ai#s%ai#t%ai#u%ai#v%ai#x%ai#z%ai#{%ai$O%ai'y%ai(a%ai(r%ai(z%ai!]%ai!^%ai~O(z%POP%ciR%ci[%cij%cin%cir%ci!Q%ci!S%ci!l%ci!p%ci#R%ci#n%ci#o%ci#p%ci#q%ci#r%ci#s%ci#t%ci#u%ci#v%ci#x%ci#z%ci#{%ci$O%ci'y%ci(a%ci(r%ci(y%ci!]%ci!^%ci~O$O$oy!]$oy!^$oy~P#BwO$O#cy!]#cy!^#cy~P#BwO!g#vO!]'eq!k'eq~O!]/pO!k)Oy~O!Y'gq!]'gq~P#/sOr:|O!g#vO(r'pO~O[;QO!Y;PO~P#/sO!Y;PO~Og(_!R!](_!R~P!1WOa%[y!_%[y'z%[y!]%[y~P#/sO!]1TO!^)Xy~O!]5uO!^)Uq~O(T;XO~O!_1oO%i;[O~O!k;_O~O%i;dO~P&8fOP$|qR$|q[$|qj$|qr$|q!S$|q!l$|q!p$|q#R$|q#n$|q#o$|q#p$|q#q$|q#r$|q#s$|q#t$|q#u$|q#v$|q#x$|q#z$|q#{$|q$O$|q(a$|q(r$|q!]$|q!^$|q~P''VO!Q*OO'y*PO(z%POP'jaR'ja['jaj'jan'jar'ja!S'ja!l'ja!p'ja#R'ja#n'ja#o'ja#p'ja#q'ja#r'ja#s'ja#t'ja#u'ja#v'ja#x'ja#z'ja#{'ja$O'ja(a'ja(r'ja(y'ja!]'ja!^'ja~O!Q*OO'y*POP'laR'la['laj'lan'lar'la!S'la!l'la!p'la#R'la#n'la#o'la#p'la#q'la#r'la#s'la#t'la#u'la#v'la#x'la#z'la#{'la$O'la(a'la(r'la(y'la(z'la!]'la!^'la~OP%OqR%Oq[%Oqj%Oqr%Oq!S%Oq!l%Oq!p%Oq#R%Oq#n%Oq#o%Oq#p%Oq#q%Oq#r%Oq#s%Oq#t%Oq#u%Oq#v%Oq#x%Oq#z%Oq#{%Oq$O%Oq(a%Oq(r%Oq!]%Oq!^%Oq~P''VOg%e!Z!]%e!Z#`%e!Z$O%e!Z~P!1WO!Y;hO~P#/sOr;iO!g#vO(r'pO~O[;kO!Y;hO~P#/sO!]'pq!^'pq~P#BwO!]#h!Z!^#h!Z~P#BwO#k%e!ZP%e!ZR%e!Z[%e!Za%e!Zj%e!Zr%e!Z!S%e!Z!]%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z'z%e!Z(a%e!Z(r%e!Z!k%e!Z!Y%e!Z'w%e!Z#`%e!Zv%e!Z!_%e!Z%i%e!Z!g%e!Z~P#/sOr;tO!g#vO(r'pO~O!Y;uO~P#/sOr;|O!g#vO(r'pO~O!Y;}O~P#/sOP%e!ZR%e!Z[%e!Zj%e!Zr%e!Z!S%e!Z!l%e!Z!p%e!Z#R%e!Z#n%e!Z#o%e!Z#p%e!Z#q%e!Z#r%e!Z#s%e!Z#t%e!Z#u%e!Z#v%e!Z#x%e!Z#z%e!Z#{%e!Z$O%e!Z(a%e!Z(r%e!Z!]%e!Z!^%e!Z~P''VOrROe!iOpkOrPO(T)]O(VTO(YUO(aVO(o[O~O!]WO!l$xO#jgPPP!>oI[PPPPPPPPP!BOP!C]PPI[!DnPI[PI[I[I[I[I[PI[!FQP!I[P!LbP!Lf!Lp!Lt!LtP!IXP!Lx!LxP#!OP#!SI[PI[#!Y#%_CjA^PA^PA^A^P#&lA^A^#)OA^#+vA^#.SA^A^#.r#1W#1W#1]#1f#1W#1qPP#1WPA^#2ZA^#6YA^A^6mPPP#:_PPP#:x#:xP#:xP#;`#:xPP#;fP#;]P#;]#;y#;]#P#>V#>]#>k#>q#>{#?R#?]#?c#?s#?y#@k#@}#AT#AZ#Ai#BO#Cs#DR#DY#Et#FS#Gt#HS#HY#H`#Hf#Hp#Hv#H|#IW#Ij#IpPPPPPPPPPPP#IvPPPPPPP#Jk#Mx$ b$ i$ qPPP$']P$'f$*_$0x$0{$1O$1}$2Q$2X$2aP$2g$2jP$3W$3[$4S$5b$5g$5}PP$6S$6Y$6^$6a$6e$6i$7e$7|$8e$8i$8l$8o$8y$8|$9Q$9UR!|RoqOXst!Z#d%m&r&t&u&w,s,x2[2_Y!vQ'`-e1o5{Q%tvQ%|yQ&T|Q&j!VS'W!e-]Q'f!iS'l!r!yU*k$|*Z*oQ+o%}S+|&V&WQ,d&dQ-c'_Q-m'gQ-u'mQ0[*qQ1b,OQ1y,eR<{SU+P%]S!S!nQ!r!v!y!z$|'W'_'`'l'm'n*k*o*q*r-]-c-e-u0[0_1o5{5}%[$ti#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^Q&X|Q'U!eS'[%i-`Q+t&PQ,P&WQ,f&gQ0n+SQ1Y+uQ1_+{Q2Q,jQ2R,kQ5f1TQ5o1aQ6[1zQ6_1|Q6`2PQ8`5gQ8c5lQ8|6bQ:X8dQ:f8yQ;V:YR<}*ZrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R,h&k&z^OPXYstuvwz!Z!`!g!j!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'b'r(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mR>S[#]WZ#W#Z'X(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ%wxQ%{yW&Q|&V&W,OQ&_!TQ'c!hQ'e!iQ(q#sS+n%|%}Q+r&PQ,_&bQ,c&dS-l'f'gQ.i(rQ1R+oQ1X+uQ1Z+vQ1^+zQ1t,`S1x,d,eQ2|-mQ5e1TQ5i1WQ5n1`Q6Z1yQ8_5gQ8b5kQ8f5pQ:T8^R;T:U!U$zi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y!^%yy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{Q+h%wQ,T&[Q,W&]Q,b&dQ.h(qQ1s,_U1w,c,d,eQ3e.iQ6U1tS6Y1x1yQ8x6Z#f>T#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o>UPS&[!Q&iQ&]!RQ&^!SU*}%[%d=sR,R&Y%]%Si#v$b$c$d$x${%O%Q%^%_%c)y*R*T*V*Y*a*g*w*x+f+i,S,V.f/P/d/m/x/y/{0`0b0i0j0o1f1i1q3c4^4_4j4o5Q5[5_6S7W7v8Q8V8[8q9b9p9y:P:`:r;Q;[;d;kP>X>Y>]>^T)z$u){V+P%]S$i$^c#Y#e%q%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.|.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SQ'Y!eR2q-]!W!nQ!e!r!v!y!z$|'W'_'`'l'm'n*Z*k*o*q*r-]-c-e-u0[0_1o5{5}R1l,ZnqOXst!Z#d%m&r&t&u&w,s,x2[2_Q&y!^Q'v!xS(s#u<^Q+l%zQ,]&_Q,^&aQ-j'dQ-w'oS.r(x=PS0q+X=ZQ1P+mQ1n,[Q2c,zQ2e,{Q2m-WQ2z-kQ2}-oS5Y0r=eQ5a1QS5d1S=fQ6t2oQ6x2{Q6}3SQ8]5bQ9Y6vQ9Z6yQ9^7OR:l9V$d$]c#Y#e%s%u(S(Y(t(y)R)S)T)U)V)W)X)Y)Z)[)^)`)b)g)q+d+x-Z-x-}.S.U.s.v.z.}/O/b0p2k2n3O3V3k3p3q3r3s3t3u3v3w3x3y3z3{3|4P4Q4X5X5c6u6{7Q7a7b7k7l8k9X9]9g9m9n:o;W;`SS#q]SU$fd)_,mS(p#p'iU*v%R(w4OU0m+O.n7gQ5^0xQ7V3`Q9d7YR:s9em!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}Q't!uS(f#g2US-s'k'wQ/s*]Q0R*jQ3U-vQ4f/tQ4r0TQ4s0UQ4x0^Q7r4`S7}4t4vS8R4y4{Q9r7sQ9v7yQ9{8OQ:Q8TS:{9w9xS;g:|;PS;s;h;iS;{;t;uSSR=o>R%^bOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Q%fj!^%xy!i!u%{%|%}'V'e'f'g'k'u*j+n+o-Y-l-m-t0R0U1R2u2|3T4r4s4v7}9{S&Oz!jQ+k%yQ,a&dW1v,b,c,d,eU6X1w1x1yS8w6Y6ZQ:d8x!r=j$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ=t>QR=u>R%QeOPXYstuvw!Z!`!g!o#S#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_Y#bWZ#W#Z(T!b%jm#h#i#l$x%e%h(^(h(i(j*Y*^*b+Z+[+^,o-V.T.Z.[.]._/m/p2d3[3]4a6r7TQ,n&o!p=k$Z$n)s-U-X/V2p4T5w6s:Z:mSR=n'XU']!e%i*ZR2s-`%SdOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+],p,s,x-i-q.P.V.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3l4z6T6e6f6i6|8t9T9_!r)_$Z$n'X)s-U-X/V2p4T5w6s:Z:mSQ,m&oQ0x+gQ3`.gQ7Y3dR9e7[!b$Tc#Y%q(S(Y(t(y)Z)[)`)g+x-x-}.S.U.s.v/b0p3O3V3k3{5X5c6{7Q7a9]:oS)^)q-Z.|2k2n3p4P4X6u7b7k7l8k9X9g9m9n;W;`=vQ>X>ZR>Y>['QkOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mSS$oh$pR4U/U'XgOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$kf$qQ$ifS)j$l)nR)v$qT$jf$qT)l$l)n'XhOPWXYZhstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$Z$_$a$e$n$p%m%t&R&k&n&o&r&t&u&w&{'T'X'b'r(T(V(](d(x(z)O)s)}*i+X+]+g,p,s,x-U-X-i-q.P.V.g.t.{/U/V/n0]0l0r1S1r2S2T2V2X2[2_2a2p3Q3W3d3l4T4z5w6T6e6f6i6s6|7[8t9T9_:Z:mST$oh$pQ$rhR)u$p%^jOPWXYZstuvw!Z!`!g!o#S#W#Z#d#o#u#x#{$O$P$Q$R$S$T$U$V$W$X$_$a$e%m%t&R&k&n&o&r&t&u&w&{'T'b'r(T(V(](d(x(z)O)}*i+X+]+g,p,s,x-i-q.P.V.g.t.{/n0]0l0r1S1r2S2T2V2X2[2_2a3Q3W3d3l4z6T6e6f6i6|7[8t9T9_!s>Q$Z$n'X)s-U-X/V2p4T5w6s:Z:mS#glOPXZst!Z!`!o#S#d#o#{$n%m&k&n&o&r&t&u&w&{'T'b)O)s*i+]+g,p,s,x-i.g/V/n0]0l1r2S2T2V2X2[2_2a3d4T4z6T6e6f6i7[8t9T!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^Q+T%aQ/c*Oo4OP>X>YQ*c$zU*l$|*Z*oQ+U%bQ0W*m#f=q#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^n=rTQ=x>UQ=y>VR=z>W!U%Ri$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y#f(w#v$b$c$x${)y*V*Y*g+f+i,S,V.f/d/m/y/{1f1i1q3c4^4j4o5[5_6S7W7v8Q8[8q9b9y:P:`:r;Q;[;d;k]>^o4OP>X>Y>]>^Q,U&]Q1h,WQ5s1gR8h5tV*n$|*Z*oU*n$|*Z*oT5z1o5{S0P*i/nQ4w0]T8S4z:]Q+j%xQ0V*lQ1O+kQ1u,aQ6W1vQ8v6XQ:c8wR;^:d!U%Oi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Yx*R$v)e*S*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>OS0`*t0a#f]>^nZ>[`=T3}7c7f7j9h:t:w;yS=_.l3iT=`7e9k!U%Qi$d%O%Q%^%_%c*R*T*a*w*x/P/x0`0b0i0j0o4_5Q8V9p>P>X>Y|*T$v)e*U*t+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>OS0b*u0c#f]>^nZ>[d=V3}7d7e7j9h9i:t:u:w;yS=a.m3jT=b7f9lrnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q&f!UR,p&ornOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_R&f!UQ,Y&^R1d,RsnOXst!V!Z#d%m&i&r&t&u&w,s,x2[2_Q1p,_S6R1s1tU8p6P6Q6US:_8r8sS;Y:^:aQ;m;ZR;w;nQ&m!VR,i&iR6_1|R:f8yW&Q|&V&W,OR1Z+vQ&r!WR,s&sR,y&xT2],x2_R,}&yQ,|&yR2f,}Q'y!{R-y'ySsOtQ#dXT%ps#dQ#OTR'{#OQ#RUR'}#RQ){$uR/`){Q#UVR(Q#UQ#XWU(W#X(X.QQ(X#YR.Q(YQ-^'YR2r-^Q.u(yS3m.u3nR3n.vQ-e'`R2v-eY!rQ'`-e1o5{R'j!rQ/Q)eR4S/QU#_W%h*YU(_#_(`.RQ(`#`R.R(ZQ-a']R2t-at`OXst!V!Z#d%m&i&k&r&t&u&w,s,x2[2_S#hZ%eU#r`#h.[R.[(jQ(k#jQ.X(gW.a(k.X3X7RQ3X.YR7R3YQ)n$lR/W)nQ$phR)t$pQ$`cU)a$`-|O>Z>[Q/z*eU4k/z4m7xQ4m/|R7x4lS*o$|*ZR0Y*ox*S$v)e*t*u+V/v0d0e4R4g5R5S5W7p8U:R:x=p=}>O!d.j(u)c*[*e.l.m.q/_/k/|0v1e3h4[4h4l5r7]7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/h*S.j7ca7c3}7e7f7j9h:t:w;yQ0a*tQ3i.lU4}0a3i9kR9k7e|*U$v)e*t*u+V/g/v0d0e4R4g4|5R5S5W7p8U:R:x=p=}>O!h.k(u)c*[*e.l.m.q/_/k/|0v1e3f3h4[4h4l5r7]7^7`7w7z8X8Z9t9|:S:};R;e;j;v>Z>[U/j*U.k7de7d3}7e7f7j9h9i:t:u:w;yQ0c*uQ3j.mU5P0c3j9lR9l7fQ*z%UR0g*zQ5]0vR8Y5]Q+_%kR0u+_Q5v1jS8j5v:[R:[8kQ,[&_R1m,[Q5{1oR8m5{Q1{,fS6]1{8zR8z6_Q1U+rW5h1U5j8a:VQ5j1XQ8a5iR:V8bQ+w&QR1[+wQ2_,xR6m2_YrOXst#dQ&v!ZQ+a%mQ,r&rQ,t&tQ,u&uQ,w&wQ2Y,sS2],x2_R6l2[Q%opQ&z!_Q&}!aQ'P!bQ'R!cQ'q!uQ+`%lQ+l%zQ,Q&XQ,h&mQ-P&|W-p'k's't'wQ-w'oQ0X*nQ1P+mQ1c,PS2O,i,lQ2g-OQ2h-RQ2i-SQ2}-oW3P-r-s-v-xQ5a1QQ5m1_Q5q1eQ6V1uQ6a2QQ6k2ZU6z3O3R3UQ6}3SQ8]5bQ8e5oQ8g5rQ8l5zQ8u6WQ8{6`S9[6{7PQ9^7OQ:W8cQ:b8vQ:g8|Q:n9]Q;U:XQ;]:cQ;a:oQ;l;VR;o;^Q%zyQ'd!iQ'o!uU+m%{%|%}Q-W'VU-k'e'f'gS-o'k'uQ0Q*jS1Q+n+oQ2o-YS2{-l-mQ3S-tS4p0R0UQ5b1RQ6v2uQ6y2|Q7O3TU7{4r4s4vQ9z7}R;O9{S$wi>PR*{%VU%Ui%V>PR0f*yQ$viS(u#v+iS)c$b$cQ)e$dQ*[$xS*e${*YQ*t%OQ*u%QQ+Q%^Q+R%_Q+V%cQ.lPQ=}>XQ>O>YQ>Z>]R>[>^Q+O%]Q.nSR#[WR'Z!el!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}S'V!e-]U*j$|*Z*oS-Y'W'_S0U*k*qQ0^*rQ2u-cQ4v0[R4{0_R({#xQ!fQT-d'`-e]!qQ!r'`-e1o5{Q#p]R'i < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:380,context:Mme,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,207,211,215,216,218,221,224,234,237,243,245,247,249,252,258,264,266,268,270,272,274,275,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,120,121,136,139,141,142,143,144,145,147,148,167,169,171,"Expression",-23,31,33,37,41,43,45,173,175,177,178,180,181,182,184,185,186,188,189,190,201,203,205,206,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",160,"JSXStartCloseTag"],["closedBy",-2,24,168,">",40,"InterpolationEnd",50,"]",61,"}",74,")",165,"JSXEndTag"]],propSources:[Ume],skippedNodes:[0,5,6,278],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr(n%d_$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!b(SU(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!b(iP;=`<%l'}'|(oP;=`<%l&}'[(y]$i&j(WpOY(rYZ&cZr(rrs&cs!^(r!^!_)r!_#O(r#O#P&c#P#o(r#o#p)r#p;'S(r;'S;=`*a<%lO(rp)wU(WpOY)rZr)rs#O)r#P;'S)r;'S;=`*Z<%lO)rp*^P;=`<%l)r'[*dP;=`<%l(r#S*nX(Wp(Z!bOY*gZr*grs'}sw*gwx)rx#O*g#P;'S*g;'S;=`+Z<%lO*g#S+^P;=`<%l*g(n+dP;=`<%l%Z07[+rq$i&j(Wp(Z!b'|0/lOX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p$f%Z$f$g+g$g#BY%Z#BY#BZ+g#BZ$IS%Z$IS$I_+g$I_$JT%Z$JT$JU+g$JU$KV%Z$KV$KW+g$KW&FU%Z&FU&FV+g&FV;'S%Z;'S;=`+a<%l?HT%Z?HT?HU+g?HUO%Z07[.ST(X#S$i&j'}0/lO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c07[.n_$i&j(Wp(Z!b'}0/lOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)3p/x`$i&j!p),Q(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`0z!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW1V`#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_!`2X!`#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z(KW2d_#v(Ch$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'At3l_(V':f$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k(^4r_$i&j(Z!bOY4kYZ5qZr4krs7nsw4kwx5qx!^4k!^!_8p!_#O4k#O#P5q#P#o4k#o#p8p#p;'S4k;'S;=`:X<%lO4k&z5vX$i&jOr5qrs6cs!^5q!^!_6y!_#o5q#o#p6y#p;'S5q;'S;=`7h<%lO5q&z6jT$d`$i&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c`6|TOr6yrs7]s;'S6y;'S;=`7b<%lO6y`7bO$d``7eP;=`<%l6y&z7kP;=`<%l5q(^7w]$d`$i&j(Z!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}!r8uZ(Z!bOY8pYZ6yZr8prs9hsw8pwx6yx#O8p#O#P6y#P;'S8p;'S;=`:R<%lO8p!r9oU$d`(Z!bOY'}Zw'}x#O'}#P;'S'};'S;=`(f<%lO'}!r:UP;=`<%l8p(^:[P;=`<%l4k%9[:hh$i&j(Wp(Z!bOY%ZYZ&cZq%Zqr`#P#o`x!^=^!^!_?q!_#O=^#O#P>`#P#o=^#o#p?q#p;'S=^;'S;=`@h<%lO=^&n>gXWS$i&jOY>`YZ&cZ!^>`!^!_?S!_#o>`#o#p?S#p;'S>`;'S;=`?k<%lO>`S?XSWSOY?SZ;'S?S;'S;=`?e<%lO?SS?hP;=`<%l?S&n?nP;=`<%l>`!f?xWWS(Z!bOY?qZw?qwx?Sx#O?q#O#P?S#P;'S?q;'S;=`@b<%lO?q!f@eP;=`<%l?q(Q@kP;=`<%l=^'`@w]WS$i&j(WpOY@nYZ&cZr@nrs>`s!^@n!^!_Ap!_#O@n#O#P>`#P#o@n#o#pAp#p;'S@n;'S;=`Bg<%lO@ntAwWWS(WpOYApZrAprs?Ss#OAp#O#P?S#P;'SAp;'S;=`Ba<%lOAptBdP;=`<%lAp'`BjP;=`<%l@n#WBvYWS(Wp(Z!bOYBmZrBmrs?qswBmwxApx#OBm#O#P?S#P;'SBm;'S;=`Cf<%lOBm#WCiP;=`<%lBm(rCoP;=`<%l^!Q^$i&j!X7`OY!=yYZ&cZ!P!=y!P!Q!>|!Q!^!=y!^!_!@c!_!}!=y!}#O!CW#O#P!Dy#P#o!=y#o#p!@c#p;'S!=y;'S;=`!Ek<%lO!=y|#X#Z&c#Z#[!>|#[#]&c#]#^!>|#^#a&c#a#b!>|#b#g&c#g#h!>|#h#i&c#i#j!>|#j#k!>|#k#m&c#m#n!>|#n#o&c#p;'S&c;'S;=`&w<%lO&c7`!@hX!X7`OY!@cZ!P!@c!P!Q!AT!Q!}!@c!}#O!Ar#O#P!Bq#P;'S!@c;'S;=`!CQ<%lO!@c7`!AYW!X7`#W#X!AT#Z#[!AT#]#^!AT#a#b!AT#g#h!AT#i#j!AT#j#k!AT#m#n!AT7`!AuVOY!ArZ#O!Ar#O#P!B[#P#Q!@c#Q;'S!Ar;'S;=`!Bk<%lO!Ar7`!B_SOY!ArZ;'S!Ar;'S;=`!Bk<%lO!Ar7`!BnP;=`<%l!Ar7`!BtSOY!@cZ;'S!@c;'S;=`!CQ<%lO!@c7`!CTP;=`<%l!@c^!Ezl$i&j(Z!b!X7`OY&}YZ&cZw&}wx&cx!^&}!^!_'}!_#O&}#O#P&c#P#W&}#W#X!Eq#X#Z&}#Z#[!Eq#[#]&}#]#^!Eq#^#a&}#a#b!Eq#b#g&}#g#h!Eq#h#i&}#i#j!Eq#j#k!Eq#k#m&}#m#n!Eq#n#o&}#o#p'}#p;'S&};'S;=`(l<%lO&}8r!GyZ(Z!b!X7`OY!GrZw!Grwx!@cx!P!Gr!P!Q!Hl!Q!}!Gr!}#O!JU#O#P!Bq#P;'S!Gr;'S;=`!J|<%lO!Gr8r!Hse(Z!b!X7`OY'}Zw'}x#O'}#P#W'}#W#X!Hl#X#Z'}#Z#[!Hl#[#]'}#]#^!Hl#^#a'}#a#b!Hl#b#g'}#g#h!Hl#h#i'}#i#j!Hl#j#k!Hl#k#m'}#m#n!Hl#n;'S'};'S;=`(f<%lO'}8r!JZX(Z!bOY!JUZw!JUwx!Arx#O!JU#O#P!B[#P#Q!Gr#Q;'S!JU;'S;=`!Jv<%lO!JU8r!JyP;=`<%l!JU8r!KPP;=`<%l!Gr>^!KZ^$i&j(Z!bOY!KSYZ&cZw!KSwx!CWx!^!KS!^!_!JU!_#O!KS#O#P!DR#P#Q!^!LYP;=`<%l!KS>^!L`P;=`<%l!_#c#d#Bq#d#l%Z#l#m#Es#m#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#>j_$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#?rd$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#A]f$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!R#AQ!R!S#AQ!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#AQ#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Bzc$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Dbe$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q!Y#DV!Y!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#DV#S#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#E|g$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z'Ad#Gpi$i&j(Wp(Z!bs'9tOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!Q%Z!Q![#Ge![!^%Z!^!_*g!_!c%Z!c!i#Ge!i#O%Z#O#P&c#P#R%Z#R#S#Ge#S#T%Z#T#Z#Ge#Z#b%Z#b#c#>_#c#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z*)x#Il_!g$b$i&j$O)Lv(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z)[#Jv_al$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z04f#LS^h#)`#R-v$?V_!^(CdvBr$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z?O$@a_!q7`$i&j(Wp(Z!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z07[$Aq|$i&j(Wp(Z!b'|0/l$]#t(T,2j(e$I[OX%ZXY+gYZ&cZ[+g[p%Zpq+gqr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr07[$D|k$i&j(Wp(Z!b'}0/l$]#t(T,2j(e$I[OY%ZYZ&cZr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr",tokenizers:[Nme,Qme,Bme,zme,2,3,4,5,6,7,8,9,10,11,12,13,14,Lme,new F2("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(c~~",141,340),new F2("j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~",25,323)],topRules:{Script:[0,7],SingleExpression:[1,276],SingleClassItem:[2,277]},dialects:{jsx:0,ts:15175},dynamicPrecedences:{80:1,82:1,94:1,169:1,199:1},specialized:[{term:327,get:t=>jme[t]||-1},{term:343,get:t=>qme[t]||-1},{term:95,get:t=>Vme[t]||-1}],tokenPrec:15201}),dq=[Li("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),Li("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),Li("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Li("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Li("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),Li(`try { \${} } catch (\${error}) { \${} }`,{label:"try",detail:"/ catch block",type:"keyword"}),Li("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),Li(`if (\${}) { \${} } else { \${} }`,{label:"if",detail:"/ else block",type:"keyword"}),Li(`class \${name} { constructor(\${params}) { \${} } }`,{label:"class",detail:"definition",type:"keyword"}),Li('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Li('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Xme=dq.concat([Li("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Li("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Li("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),s9=new cU,pq=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function vm(t){return(e,n)=>{let r=e.node.getChild("VariableDefinition");return r&&n(r,t),!0}}const Wme=["FunctionDeclaration"],Yme={FunctionDeclaration:vm("function"),ClassDeclaration:vm("class"),ClassExpression:()=>!0,EnumDeclaration:vm("constant"),TypeAliasDeclaration:vm("type"),NamespaceDeclaration:vm("namespace"),VariableDefinition(t,e){t.matchContext(Wme)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function mq(t,e){let n=s9.get(e);if(n)return n;let r=[],i=!0;function s(o,a){let l=t.sliceString(o.from,o.to);r.push({label:l,type:a})}return e.cursor(Ln.IncludeAnonymous).iterate(o=>{if(i)i=!1;else if(o.name){let a=Yme[o.name];if(a&&a(o,s)||pq.has(o.name))return!1}else if(o.to-o.from>8192){for(let a of mq(t,o.node))r.push(a);return!1}}),s9.set(e,r),r}const o9=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,gq=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function Gme(t){let e=hn(t.state).resolveInner(t.pos,-1);if(gq.indexOf(e.name)>-1)return null;let n=e.name=="VariableName"||e.to-e.from<20&&o9.test(t.state.sliceDoc(e.from,e.to));if(!n&&!t.explicit)return null;let r=[];for(let i=e;i;i=i.parent)pq.has(i.name)&&(r=r.concat(mq(t.state.doc,i)));return{options:r,from:n?e.from:t.pos,validFor:o9}}const dl=Uu.define({name:"javascript",parser:Zme.configure({props:[pf.add({IfStatement:Ru({except:/^\s*({|else\b)/}),TryStatement:Ru({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:efe,SwitchBody:t=>{let e=t.textAfter,n=/^\s*\}/.test(e),r=/^\s*(case|default)\b/.test(e);return t.baseIndent+(n?0:r?1:2)*t.unit},Block:Jce({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":Ru({except:/^\s*{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag"(t){return t.column(t.node.from)+t.unit}}),mf.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":$x,BlockComment(t){return{from:t.from+2,to:t.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),yq={test:t=>/^JSX/.test(t.name),facet:DA({commentTokens:{block:{open:"{/*",close:"*/}"}}})},bq=dl.configure({dialect:"ts"},"typescript"),Oq=dl.configure({dialect:"jsx",props:[PA.add(t=>t.isTop?[yq]:void 0)]}),vq=dl.configure({dialect:"jsx ts",props:[PA.add(t=>t.isTop?[yq]:void 0)]},"typescript");let wq=t=>({label:t,type:"keyword"});const xq="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(wq),Hme=xq.concat(["declare","implements","private","protected","public"].map(wq));function Kme(t={}){let e=t.jsx?t.typescript?vq:Oq:t.typescript?bq:dl,n=t.typescript?Xme.concat(Hme):dq.concat(xq);return new af(e,[dl.data.of({autocomplete:_U(gq,$A(n))}),dl.data.of({autocomplete:Gme}),t.jsx?tge:[]])}function Jme(t){for(;;){if(t.name=="JSXOpenTag"||t.name=="JSXSelfClosingTag"||t.name=="JSXFragmentTag")return t;if(t.name=="JSXEscape"||!t.parent)return null;t=t.parent}}function a9(t,e,n=t.length){for(let r=e?.firstChild;r;r=r.nextSibling)if(r.name=="JSXIdentifier"||r.name=="JSXBuiltin"||r.name=="JSXNamespacedName"||r.name=="JSXMemberExpression")return t.sliceString(r.from,Math.min(r.to,n));return""}const ege=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),tge=Te.inputHandler.of((t,e,n,r,i)=>{if((ege?t.composing:t.compositionStarted)||t.state.readOnly||e!=n||r!=">"&&r!="/"||!dl.isActiveAt(t.state,e,-1))return!1;let s=i(),{state:o}=s,a=o.changeByRange(l=>{var u;let{head:c}=l,f=hn(o).resolveInner(c-1,-1),h;if(f.name=="JSXStartTag"&&(f=f.parent),!(o.doc.sliceString(c-1,c)!=r||f.name=="JSXAttributeValue"&&f.to>c)){if(r==">"&&f.name=="JSXFragmentTag")return{range:l,changes:{from:c,insert:""}};if(r=="/"&&f.name=="JSXStartCloseTag"){let d=f.parent,p=d.parent;if(p&&d.from==c-2&&((h=a9(o.doc,p.firstChild,c))||((u=p.firstChild)===null||u===void 0?void 0:u.name)=="JSXFragmentTag")){let m=`${h}>`;return{range:re.cursor(c+m.length,-1),changes:{from:c,insert:m}}}}else if(r==">"){let d=Jme(f);if(d&&d.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(c,c+2))&&(h=a9(o.doc,d,c)))return{range:l,changes:{from:c,insert:``}}}}return{range:l}});return a.changes.empty?!1:(t.dispatch([s,o.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),wm=["_blank","_self","_top","_parent"],GS=["ascii","utf-8","utf-16","latin1","latin1"],HS=["get","post","put","delete"],KS=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Ls=["true","false"],ze={},nge={a:{attrs:{href:null,ping:null,type:null,media:null,target:wm,hreflang:null}},abbr:ze,address:ze,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:ze,aside:ze,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:ze,base:{attrs:{href:null,target:wm}},bdi:ze,bdo:ze,blockquote:{attrs:{cite:null}},body:ze,br:ze,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:KS,formmethod:HS,formnovalidate:["novalidate"],formtarget:wm,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:ze,center:ze,cite:ze,code:ze,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:ze,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:ze,div:ze,dl:ze,dt:ze,em:ze,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:ze,figure:ze,footer:ze,form:{attrs:{action:null,name:null,"accept-charset":GS,autocomplete:["on","off"],enctype:KS,method:HS,novalidate:["novalidate"],target:wm}},h1:ze,h2:ze,h3:ze,h4:ze,h5:ze,h6:ze,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:ze,hgroup:ze,hr:ze,html:{attrs:{manifest:null}},i:ze,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:KS,formmethod:HS,formnovalidate:["novalidate"],formtarget:wm,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:ze,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:ze,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:ze,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:GS,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:ze,noscript:ze,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:ze,param:{attrs:{name:null,value:null}},pre:ze,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:ze,rt:ze,ruby:ze,samp:ze,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:GS}},section:ze,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:ze,source:{attrs:{src:null,type:null,media:null}},span:ze,strong:ze,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:ze,summary:ze,sup:ze,table:ze,tbody:ze,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:ze,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:ze,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:ze,time:{attrs:{datetime:null}},title:ze,tr:ze,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:ze,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:ze},_q={accesskey:null,class:null,contenteditable:Ls,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Ls,autocorrect:Ls,autocapitalize:Ls,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Ls,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Ls,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Ls,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Ls,"aria-hidden":Ls,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Ls,"aria-multiselectable":Ls,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Ls,"aria-relevant":null,"aria-required":Ls,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Sq="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(t=>"on"+t);for(let t of Sq)_q[t]=null;let x1=class{constructor(e,n){this.tags={...nge,...e},this.globalAttrs={..._q,...n},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};x1.default=new x1;function u0(t,e,n=t.length){if(!e)return"";let r=e.firstChild,i=r&&r.getChild("TagName");return i?t.sliceString(i.from,Math.min(i.to,n)):""}function c0(t,e=!1){for(;t;t=t.parent)if(t.name=="Element")if(e)e=!1;else return t;return null}function kq(t,e,n){let r=n.tags[u0(t,c0(e))];return r?.children||n.allTags}function oE(t,e){let n=[];for(let r=c0(e);r&&!r.type.isTop;r=c0(r.parent)){let i=u0(t,r);if(i&&r.lastChild.name=="CloseTag")break;i&&n.indexOf(i)<0&&(e.name=="EndTag"||e.from>=r.firstChild.to)&&n.push(i)}return n}const Cq=/^[:\-\.\w\u00b7-\uffff]*$/;function l9(t,e,n,r,i){let s=/\s*>/.test(t.sliceDoc(i,i+5))?"":">",o=c0(n,n.name=="StartTag"||n.name=="TagName");return{from:r,to:i,options:kq(t.doc,o,e).map(a=>({label:a,type:"type"})).concat(oE(t.doc,n).map((a,l)=>({label:"/"+a,apply:"/"+a+s,type:"type",boost:99-l}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function u9(t,e,n,r){let i=/\s*>/.test(t.sliceDoc(r,r+5))?"":">";return{from:n,to:r,options:oE(t.doc,e).map((s,o)=>({label:s,apply:s+i,type:"type",boost:99-o})),validFor:Cq}}function rge(t,e,n,r){let i=[],s=0;for(let o of kq(t.doc,n,e))i.push({label:"<"+o,type:"type"});for(let o of oE(t.doc,n))i.push({label:"",type:"type",boost:99-s++});return{from:r,to:r,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function ige(t,e,n,r,i){let s=c0(n),o=s?e.tags[u0(t.doc,s)]:null,a=o&&o.attrs?Object.keys(o.attrs):[],l=o&&o.globalAttrs===!1?a:a.length?a.concat(e.globalAttrNames):e.globalAttrNames;return{from:r,to:i,options:l.map(u=>({label:u,type:"property"})),validFor:Cq}}function sge(t,e,n,r,i){var s;let o=(s=n.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),a=[],l;if(o){let u=t.sliceDoc(o.from,o.to),c=e.globalAttrs[u];if(!c){let f=c0(n),h=f?e.tags[u0(t.doc,f)]:null;c=h?.attrs&&h.attrs[u]}if(c){let f=t.sliceDoc(r,i).toLowerCase(),h='"',d='"';/^['"]/.test(f)?(l=f[0]=='"'?/^[^"]*$/:/^[^']*$/,h="",d=t.sliceDoc(i,i+1)==f[0]?"":f[0],f=f.slice(1),r++):l=/^[^\s<>='"]*$/;for(let p of c)a.push({label:p,apply:h+p+d,type:"constant"})}}return{from:r,to:i,options:a,validFor:l}}function Aq(t,e){let{state:n,pos:r}=e,i=hn(n).resolveInner(r,-1),s=i.resolve(r);for(let o=r,a;s==i&&(a=i.childBefore(o));){let l=a.lastChild;if(!l||!l.type.isError||l.fromAq(r,i)}const lge=dl.parser.configure({top:"SingleExpression"}),Eq=[{tag:"script",attrs:t=>t.type=="text/typescript"||t.lang=="ts",parser:bq.parser},{tag:"script",attrs:t=>t.type=="text/babel"||t.type=="text/jsx",parser:Oq.parser},{tag:"script",attrs:t=>t.type=="text/typescript-jsx",parser:vq.parser},{tag:"script",attrs(t){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(t.type)},parser:lge},{tag:"script",attrs(t){return!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type)},parser:dl.parser},{tag:"style",attrs(t){return(!t.lang||t.lang=="css")&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type))},parser:M2.parser}],Tq=[{name:"style",parser:M2.parser.configure({top:"Styles"})}].concat(Sq.map(t=>({name:t,parser:dl.parser}))),Dq=Uu.define({name:"html",parser:I0e.configure({props:[pf.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag"(t){return t.column(t.node.from)+t.unit},Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),LO=Dq.configure({wrap:oq(Eq,Tq)});function uge(t={}){let e="",n;t.matchClosingTags===!1&&(e="noMatch"),t.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(n=oq((t.nestedLanguages||[]).concat(Eq),(t.nestedAttributes||[]).concat(Tq)));let r=n?Dq.configure({wrap:n,dialect:e}):e?LO.configure({dialect:e}):LO;return new af(r,[LO.data.of({autocomplete:age(t)}),t.autoCloseTags!==!1?cge:[],Kme().support,mme().support])}const c9=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),cge=Te.inputHandler.of((t,e,n,r,i)=>{if(t.composing||t.state.readOnly||e!=n||r!=">"&&r!="/"||!LO.isActiveAt(t.state,e,-1))return!1;let s=i(),{state:o}=s,a=o.changeByRange(l=>{var u,c,f;let h=o.doc.sliceString(l.from-1,l.to)==r,{head:d}=l,p=hn(o).resolveInner(d,-1),m;if(h&&r==">"&&p.name=="EndTag"){let g=p.parent;if(((c=(u=g.parent)===null||u===void 0?void 0:u.lastChild)===null||c===void 0?void 0:c.name)!="CloseTag"&&(m=u0(o.doc,g.parent,d))&&!c9.has(m)){let y=d+(o.doc.sliceString(d,d+1)===">"?1:0),O=``;return{range:l,changes:{from:d,to:y,insert:O}}}}else if(h&&r=="/"&&p.name=="IncompleteCloseTag"){let g=p.parent;if(p.from==d-2&&((f=g.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(m=u0(o.doc,g,d))&&!c9.has(m)){let y=d+(o.doc.sliceString(d,d+1)===">"?1:0),O=`${m}>`;return{range:re.cursor(d+O.length,-1),changes:{from:d,to:y,insert:O}}}}return{range:l}});return a.changes.empty?!1:(t.dispatch([s,o.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),Pq=DA({commentTokens:{block:{open:""}}}),Rq=new pt,Iq=Ape.configure({props:[mf.add(t=>!t.is("Block")||t.is("Document")||r4(t)!=null||fge(t)?void 0:(e,n)=>({from:n.doc.lineAt(e.from).to,to:e.to})),Rq.add(r4),pf.add({Document:()=>null}),Gf.add({Document:Pq})]});function r4(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function fge(t){return t.name=="OrderedList"||t.name=="BulletList"}function hge(t,e){let n=t;for(;;){let r=n.nextSibling,i;if(!r||(i=r4(r.type))!=null&&i<=e)break;n=r}return n.to}const dge=rfe.of((t,e,n)=>{for(let r=hn(t).resolveInner(n,-1);r&&!(r.fromn)return{from:n,to:s}}return null});function aE(t){return new Oo(Pq,t,[],"markdown")}const pge=aE(Iq),mge=Iq.configure([Npe,Bpe,Qpe,zpe,{props:[mf.add({Table:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}]),L2=aE(mge);function gge(t,e){return n=>{if(n&&t){let r=null;if(n=/\S*/.exec(n)[0],typeof t=="function"?r=t(n):r=O2.matchLanguageName(t,n,!0),r instanceof O2)return r.support?r.support.language.parser:h1.getSkippingParser(r.load());if(r)return r.parser}return e?e.parser:null}}let JS=class{constructor(e,n,r,i,s,o,a){this.node=e,this.from=n,this.to=r,this.spaceBefore=i,this.spaceAfter=s,this.type=o,this.item=a}blank(e,n=!0){let r=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;r.length0;i--)r+=" ";return r+(n?this.spaceAfter:"")}}marker(e,n){let r=this.node.name=="OrderedList"?String(+$q(this.item,e)[2]+n):"";return this.spaceBefore+r+this.type+this.spaceAfter}};function Fq(t,e){let n=[],r=[];for(let i=t;i;i=i.parent){if(i.name=="FencedCode")return r;(i.name=="ListItem"||i.name=="Blockquote")&&n.push(i)}for(let i=n.length-1;i>=0;i--){let s=n[i],o,a=e.lineAt(s.from),l=s.from-a.from;if(s.name=="Blockquote"&&(o=/^ *>( ?)/.exec(a.text.slice(l))))r.push(new JS(s,l,l+o[0].length,"",o[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(a.text.slice(l)))){let u=o[3],c=o[0].length;u.length>=4&&(u=u.slice(0,u.length-4),c-=4),r.push(new JS(s.parent,l,l+c,o[1],u,o[2],s))}else if(s.name=="ListItem"&&s.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(a.text.slice(l)))){let u=o[4],c=o[0].length;u.length>4&&(u=u.slice(0,u.length-4),c-=4);let f=o[2];o[3]&&(f+=o[3].replace(/[xX]/," ")),r.push(new JS(s.parent,l,l+c,o[1],u,f,s))}}return r}function $q(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function e3(t,e,n,r=0){for(let i=-1,s=t;;){if(s.name=="ListItem"){let a=$q(s,e),l=+a[2];if(i>=0){if(l!=i+1)return;n.push({from:s.from+a[1].length,to:s.from+a[0].length,insert:String(i+2+r)})}i=l}let o=s.nextSibling;if(!o)break;s=o}}function lE(t,e){let n=/^[ \t]*/.exec(t)[0].length;if(!n||e.facet(py)!=" ")return t;let r=ca(t,4,n),i="";for(let s=r;s>0;)s>=4?(i+=" ",s-=4):(i+=" ",s--);return i+t.slice(n)}const yge=(t={})=>({state:e,dispatch:n})=>{let r=hn(e),{doc:i}=e,s=null,o=e.changeByRange(a=>{if(!a.empty||!L2.isActiveAt(e,a.from,-1)&&!L2.isActiveAt(e,a.from,1))return s={range:a};let l=a.from,u=i.lineAt(l),c=Fq(r.resolveInner(l,-1),i);for(;c.length&&c[c.length-1].from>l-u.from;)c.pop();if(!c.length)return s={range:a};let f=c[c.length-1];if(f.to-f.spaceAfter.length>l-u.from)return s={range:a};let h=l>=f.to-f.spaceAfter.length&&!/\S/.test(u.text.slice(f.to));if(f.item&&h){let y=f.node.firstChild,O=f.node.getChild("ListItem","ListItem");if(y.to>=l||O&&O.to0&&!/[^\s>]/.test(i.lineAt(u.from-1).text)||t.nonTightLists===!1){let v=c.length>1?c[c.length-2]:null,w,x="";v&&v.item?(w=u.from+v.from,x=v.marker(i,1)):w=u.from+(v?v.to:0);let S=[{from:w,to:l,insert:x}];return f.node.name=="OrderedList"&&e3(f.item,i,S,-2),v&&v.node.name=="OrderedList"&&e3(v.item,i,S),{range:re.cursor(w+x.length),changes:S}}else{let v=h9(c,e,u);return{range:re.cursor(l+v.length+1),changes:{from:u.from,insert:v+e.lineBreak}}}}if(f.node.name=="Blockquote"&&h&&u.from){let y=i.lineAt(u.from-1),O=/>\s*$/.exec(y.text);if(O&&O.index==f.from){let v=e.changes([{from:y.from+O.index,to:y.to},{from:u.from+f.from,to:u.to}]);return{range:a.map(v),changes:v}}}let d=[];f.node.name=="OrderedList"&&e3(f.item,i,d);let p=f.item&&f.item.from]*/.exec(u.text)[0].length>=f.to)for(let y=0,O=c.length-1;y<=O;y++)m+=y==O&&!p?c[y].marker(i,1):c[y].blank(yu.from&&/\s/.test(u.text.charAt(g-u.from-1));)g--;return m=lE(m,e),Oge(f.node,e.doc)&&(m=h9(c,e,u)+e.lineBreak+m),d.push({from:g,to:l,insert:e.lineBreak+m}),{range:re.cursor(g+m.length+1),changes:d}});return s?!1:(n(e.update(o,{scrollIntoView:!0,userEvent:"input"})),!0)},bge=yge();function f9(t){return t.name=="QuoteMark"||t.name=="ListMark"}function Oge(t,e){if(t.name!="OrderedList"&&t.name!="BulletList")return!1;let n=t.firstChild,r=t.getChild("ListItem","ListItem");if(!r)return!1;let i=e.lineAt(n.to),s=e.lineAt(r.from),o=/^[\s>]*$/.test(i.text);return i.number+(o?0:1){let n=hn(t),r=null,i=t.changeByRange(s=>{let o=s.from,{doc:a}=t;if(s.empty&&L2.isActiveAt(t,s.from)){let l=a.lineAt(o),u=Fq(vge(n,o),a);if(u.length){let c=u[u.length-1],f=c.to-c.spaceAfter.length+(c.spaceAfter?1:0);if(o-l.from>f&&!/\S/.test(l.text.slice(f,o-l.from)))return{range:re.cursor(l.from+f),changes:{from:l.from+f,to:o}};if(o-l.from==f&&(!c.item||l.from<=c.item.from||!/\S/.test(l.text.slice(0,c.to)))){let h=l.from+c.from;if(c.item&&c.node.from{var n;let{main:r}=e.state.selection;if(r.empty)return!1;let i=(n=t.clipboardData)===null||n===void 0?void 0:n.getData("text/plain");if(!i||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(i)||(/^www\./.test(i)&&(i="https://"+i),!L2.isActiveAt(e.state,r.from,1)))return!1;let s=hn(e.state),o=!1;return s.iterate({from:r.from,to:r.to,enter:a=>{(a.from>r.from||Cge.test(a.name))&&(o=!0)},leave:a=>{a.to=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57}function Zge(t){return t>=48&&t<=57||t>=97&&t<=102||t>=65&&t<=70}function If(t,e,n){for(let r=!1;;){if(t.next<0)return;if(t.next==e&&!r){t.advance();return}r=n&&!r&&t.next==92,t.advance()}}function Xge(t,e){e:for(;;){if(t.next<0)return;if(t.next==36){t.advance();for(let n=0;n)".charCodeAt(n);for(;;){if(t.next<0)return;if(t.next==r&&t.peek(1)==39){t.advance(2);return}t.advance()}}function s4(t,e){for(;!(t.next!=95&&!i4(t.next));)e!=null&&(e+=String.fromCharCode(t.next)),t.advance();return e}function Yge(t){if(t.next==39||t.next==34||t.next==96){let e=t.next;t.advance(),If(t,e,!1)}else s4(t)}function g9(t,e){for(;t.next==48||t.next==49;)t.advance();e&&t.next==e&&t.advance()}function y9(t,e){for(;;){if(t.next==46){if(e)break;e=!0}else if(t.next<48||t.next>57)break;t.advance()}if(t.next==69||t.next==101)for(t.advance(),(t.next==43||t.next==45)&&t.advance();t.next>=48&&t.next<=57;)t.advance()}function b9(t){for(;!(t.next<0||t.next==10);)t.advance()}function Ef(t,e){for(let n=0;n!=&|~^/",specialVar:"?",identifierQuotes:'"',caseInsensitiveIdentifiers:!1,words:Qq(zq,Bq)};function Gge(t,e,n,r){let i={};for(let s in o4)i[s]=(t.hasOwnProperty(s)?t:o4)[s];return e&&(i.words=Qq(e,n||"",r)),i}function Uq(t){return new Ps(e=>{var n;let{next:r}=e;if(e.advance(),Ef(r,r3)){for(;Ef(e.next,r3);)e.advance();e.acceptToken(Ege)}else if(r==36&&t.doubleDollarQuotedStrings){let i=s4(e,"");e.next==36&&(e.advance(),Xge(e,i),e.acceptToken(xd))}else if(r==39||r==34&&t.doubleQuotedStrings)If(e,r,t.backslashEscapes),e.acceptToken(xd);else if(r==35&&t.hashComments||r==47&&e.next==47&&t.slashComments)b9(e),e.acceptToken(d9);else if(r==45&&e.next==45&&(!t.spaceAfterDashes||e.peek(1)==32))b9(e),e.acceptToken(d9);else if(r==47&&e.next==42){e.advance();for(let i=1;;){let s=e.next;if(e.next<0)break;if(e.advance(),s==42&&e.next==47){if(i--,e.advance(),!i)break}else s==47&&e.next==42&&(i++,e.advance())}e.acceptToken(Tge)}else if((r==101||r==69)&&e.next==39)e.advance(),If(e,39,!0),e.acceptToken(xd);else if((r==110||r==78)&&e.next==39&&t.charSetCasts)e.advance(),If(e,39,t.backslashEscapes),e.acceptToken(xd);else if(r==95&&t.charSetCasts)for(let i=0;;i++){if(e.next==39&&i>1){e.advance(),If(e,39,t.backslashEscapes),e.acceptToken(xd);break}if(!i4(e.next))break;e.advance()}else if(t.plsqlQuotingMechanism&&(r==113||r==81)&&e.next==39&&e.peek(1)>0&&!Ef(e.peek(1),r3)){let i=e.peek(1);e.advance(2),Wge(e,i),e.acceptToken(xd)}else if(Ef(r,t.identifierQuotes)){const i=r==91?93:r;If(e,i,!1),e.acceptToken(jge)}else if(r==40)e.acceptToken(Rge);else if(r==41)e.acceptToken(Ige);else if(r==123)e.acceptToken(Fge);else if(r==125)e.acceptToken($ge);else if(r==91)e.acceptToken(Mge);else if(r==93)e.acceptToken(Lge);else if(r==59)e.acceptToken(Nge);else if(t.unquotedBitLiterals&&r==48&&e.next==98)e.advance(),g9(e),e.acceptToken(m9);else if((r==98||r==66)&&(e.next==39||e.next==34)){const i=e.next;e.advance(),t.treatBitsAsBytes?(If(e,i,t.backslashEscapes),e.acceptToken(qge)):(g9(e,i),e.acceptToken(m9))}else if(r==48&&(e.next==120||e.next==88)||(r==120||r==88)&&e.next==39){let i=e.next==39;for(e.advance();Zge(e.next);)e.advance();i&&e.next==39&&e.advance(),e.acceptToken(n3)}else if(r==46&&e.next>=48&&e.next<=57)y9(e,!0),e.acceptToken(n3);else if(r==46)e.acceptToken(Qge);else if(r>=48&&r<=57)y9(e,!1),e.acceptToken(n3);else if(Ef(r,t.operatorChars)){for(;Ef(e.next,t.operatorChars);)e.advance();e.acceptToken(Bge)}else if(Ef(r,t.specialVar))e.next==r&&e.advance(),Yge(e),e.acceptToken(Uge);else if(r==58||r==44)e.acceptToken(zge);else if(i4(r)){let i=s4(e,String.fromCharCode(r));e.acceptToken(e.next==46||e.peek(-i.length-1)==46?p9:(n=t.words[i.toLowerCase()])!==null&&n!==void 0?n:p9)}})}const jq=Uq(o4),Hge=ju.deserialize({version:14,states:"%vQ]QQOOO#wQRO'#DSO$OQQO'#CwO%eQQO'#CxO%lQQO'#CyO%sQQO'#CzOOQQ'#DS'#DSOOQQ'#C}'#C}O'UQRO'#C{OOQQ'#Cv'#CvOOQQ'#C|'#C|Q]QQOOQOQQOOO'`QQO'#DOO(xQRO,59cO)PQQO,59cO)UQQO'#DSOOQQ,59d,59dO)cQQO,59dOOQQ,59e,59eO)jQQO,59eOOQQ,59f,59fO)qQQO,59fOOQQ-E6{-E6{OOQQ,59b,59bOOQQ-E6z-E6zOOQQ,59j,59jOOQQ-E6|-E6|O+VQRO1G.}O+^QQO,59cOOQQ1G/O1G/OOOQQ1G/P1G/POOQQ1G/Q1G/QP+kQQO'#C}O+rQQO1G.}O)PQQO,59cO,PQQO'#Cw",stateData:",[~OtOSPOSQOS~ORUOSUOTUOUUOVROXSOZTO]XO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O^]ORvXSvXTvXUvXVvXXvXZvX]vX_vX`vXavXbvXcvXdvXevXfvXgvXhvX~OsvX~P!jOa_Ob_Oc_O~ORUOSUOTUOUUOVROXSOZTO^tO_UO`UOa`Ob`Oc`OdUOeUOfUOgUOhUO~OWaO~P$ZOYcO~P$ZO[eO~P$ZORUOSUOTUOUUOVROXSOZTO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O]hOsoX~P%zOajObjOcjO~O^]ORkaSkaTkaUkaVkaXkaZka]ka_ka`kaakabkackadkaekafkagkahka~Oska~P'kO^]O~OWvXYvX[vX~P!jOWnO~P$ZOYoO~P$ZO[pO~P$ZO^]ORkiSkiTkiUkiVkiXkiZki]ki_ki`kiakibkickidkiekifkigkihki~Oski~P)xOWkaYka[ka~P'kO]hO~P$ZOWkiYki[ki~P)xOasObsOcsO~O",goto:"#hwPPPPPPPPPPPPPPPPPPPPPPPPPPx||||!Y!^!d!xPPP#[TYOZeUORSTWZbdfqT[OZQZORiZSWOZQbRQdSQfTZgWbdfqQ^PWk^lmrQl_Qm`RrseVORSTWZbdfq",nodeNames:"⚠ LineComment BlockComment String Number Bool Null ( ) { } [ ] ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement",maxTerm:38,nodeProps:[["isolate",-4,1,2,3,19,""]],skippedNodes:[0,1,2],repeatNodeCount:3,tokenData:"RORO",tokenizers:[0,jq],topRules:{Script:[0,25]},tokenPrec:0});function a4(t){let e=t.cursor().moveTo(t.from,-1);for(;/Comment/.test(e.name);)e.moveTo(e.from,-1);return e.node}function _1(t,e){let n=t.sliceString(e.from,e.to),r=/^([`'"\[])(.*)([`'"\]])$/.exec(n);return r?r[2]:n}function N2(t){return t&&(t.name=="Identifier"||t.name=="QuotedIdentifier")}function Kge(t,e){if(e.name=="CompositeIdentifier"){let n=[];for(let r=e.firstChild;r;r=r.nextSibling)N2(r)&&n.push(_1(t,r));return n}return[_1(t,e)]}function O9(t,e){for(let n=[];;){if(!e||e.name!=".")return n;let r=a4(e);if(!N2(r))return n;n.unshift(_1(t,r)),e=a4(r)}}function Jge(t,e){let n=hn(t).resolveInner(e,-1),r=t1e(t.doc,n);return n.name=="Identifier"||n.name=="QuotedIdentifier"||n.name=="Keyword"?{from:n.from,quoted:n.name=="QuotedIdentifier"?t.doc.sliceString(n.from,n.from+1):null,parents:O9(t.doc,a4(n)),aliases:r}:n.name=="."?{from:e,quoted:null,parents:O9(t.doc,n),aliases:r}:{from:e,quoted:null,parents:[],empty:!0,aliases:r}}const e1e=new Set("where group having order union intersect except all distinct limit offset fetch for".split(" "));function t1e(t,e){let n;for(let i=e;!n;i=i.parent){if(!i)return null;i.name=="Statement"&&(n=i)}let r=null;for(let i=n.firstChild,s=!1,o=null;i;i=i.nextSibling){let a=i.name=="Keyword"?t.sliceString(i.from,i.to).toLowerCase():null,l=null;if(!s)s=a=="from";else if(a=="as"&&o&&N2(i.nextSibling))l=_1(t,i.nextSibling);else{if(a&&e1e.has(a))break;o&&N2(i)&&(l=_1(t,i))}l&&(r||(r=Object.create(null)),r[l]=Kge(t,o)),o=/Identifier$/.test(i.name)?i:null}return r}function n1e(t,e,n){return n.map(r=>({...r,label:r.label[0]==t?r.label:t+r.label+e,apply:void 0}))}const r1e=/^\w*$/,i1e=/^[`'"\[]?\w*[`'"\]]?$/;function v9(t){return t.self&&typeof t.self.label=="string"}class uE{constructor(e,n){this.idQuote=e,this.idCaseInsensitive=n,this.list=[],this.children=void 0}child(e){let n=this.children||(this.children=Object.create(null)),r=n[e];return r||(e&&!this.list.some(i=>i.label==e)&&this.list.push(w9(e,"type",this.idQuote,this.idCaseInsensitive)),n[e]=new uE(this.idQuote,this.idCaseInsensitive))}maybeChild(e){return this.children?this.children[e]:null}addCompletion(e){let n=this.list.findIndex(r=>r.label==e.label);n>-1?this.list[n]=e:this.list.push(e)}addCompletions(e){for(let n of e)this.addCompletion(typeof n=="string"?w9(n,"property",this.idQuote,this.idCaseInsensitive):n)}addNamespace(e){Array.isArray(e)?this.addCompletions(e):v9(e)?this.addNamespace(e.children):this.addNamespaceObject(e)}addNamespaceObject(e){for(let n of Object.keys(e)){let r=e[n],i=null,s=n.replace(/\\?\./g,a=>a=="."?"\0":a).split("\0"),o=this;v9(r)&&(i=r.self,r=r.children);for(let a=0;a{let{parents:f,from:h,quoted:d,empty:p,aliases:m}=Jge(c.state,c.pos);if(p&&!c.explicit)return null;m&&f.length==1&&(f=m[f[0]]||f);let g=l;for(let O of f){for(;!g.children||!g.children[O];)if(g==l&&u)g=u;else if(g==u&&r)g=g.child(r);else return null;let v=g.maybeChild(O);if(!v)return null;g=v}let y=g.list;if(g==l&&m&&(y=y.concat(Object.keys(m).map(O=>({label:O,type:"constant"})))),d){let O=d[0],v=qq(O),w=c.state.sliceDoc(c.pos,c.pos+1)==v;return{from:h,to:w?c.pos+1:void 0,options:n1e(O,v,y),validFor:i1e}}else return{from:h,options:y,validFor:r1e}}}function o1e(t){return t==Nq?"type":t==Lq?"keyword":"variable"}function a1e(t,e,n){let r=Object.keys(t).map(i=>n(e?i.toUpperCase():i,o1e(t[i])));return _U(["QuotedIdentifier","String","LineComment","BlockComment","."],$A(r))}let l1e=Hge.configure({props:[pf.add({Statement:Ru()}),mf.add({Statement(t,e){return{from:Math.min(t.from+100,e.doc.lineAt(t.from).to),to:t.to}},BlockComment(t){return{from:t.from+2,to:t.to-2}}}),tc({Keyword:P.keyword,Type:P.typeName,Builtin:P.standard(P.name),Bits:P.number,Bytes:P.string,Bool:P.bool,Null:P.null,Number:P.number,String:P.string,Identifier:P.name,QuotedIdentifier:P.special(P.string),SpecialVar:P.special(P.name),LineComment:P.lineComment,BlockComment:P.blockComment,Operator:P.operator,"Semi Punctuation":P.punctuation,"( )":P.paren,"{ }":P.brace,"[ ]":P.squareBracket})]});class S1{constructor(e,n,r){this.dialect=e,this.language=n,this.spec=r}get extension(){return this.language.extension}configureLanguage(e,n){return new S1(this.dialect,this.language.configure(e,n),this.spec)}static define(e){let n=Gge(e,e.keywords,e.types,e.builtin),r=Uu.define({name:"sql",parser:l1e.configure({tokenizers:[{from:jq,to:Uq(n)}]}),languageData:{commentTokens:{line:"--",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]}}});return new S1(n,r,e)}}function u1e(t,e){return{label:t,type:e,boost:-1}}function c1e(t,e=!1,n){return a1e(t.dialect.words,e,n||u1e)}function f1e(t){return t.schema?s1e(t.schema,t.tables,t.schemas,t.defaultTable,t.defaultSchema,t.dialect||cE):()=>null}function h1e(t){return t.schema?(t.dialect||cE).language.data.of({autocomplete:f1e(t)}):[]}function d1e(t={}){let e=t.dialect||cE;return new af(e.language,[h1e(t),e.language.data.of({autocomplete:c1e(e,t.upperCaseKeywords,t.keywordCompletion)})])}const cE=S1.define({}),p1e=S1.define({charSetCasts:!0,doubleDollarQuotedStrings:!0,operatorChars:"+-*/<>=~!@#%^&|`?",specialVar:"",keywords:zq+"abort abs absent access according ada admin aggregate alias also always analyse analyze array_agg array_max_cardinality asensitive assert assignment asymmetric atomic attach attribute attributes avg backward base64 begin_frame begin_partition bernoulli bit_length blocked bom cache called cardinality catalog_name ceil ceiling chain char_length character_length character_set_catalog character_set_name character_set_schema characteristics characters checkpoint class class_origin cluster coalesce cobol collation_catalog collation_name collation_schema collect column_name columns command_function command_function_code comment comments committed concurrently condition_number configuration conflict connection_name constant constraint_catalog constraint_name constraint_schema contains content control conversion convert copy corr cost covar_pop covar_samp csv cume_dist current_catalog current_row current_schema cursor_name database datalink datatype datetime_interval_code datetime_interval_precision db debug defaults defined definer degree delimiter delimiters dense_rank depends derived detach detail dictionary disable discard dispatch dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue document dump dynamic_function dynamic_function_code element elsif empty enable encoding encrypted end_frame end_partition endexec enforced enum errcode error event every exclude excluding exclusive exp explain expression extension extract family file filter final first_value flag floor following force foreach fortran forward frame_row freeze fs functions fusion generated granted greatest groups handler header hex hierarchy hint id ignore ilike immediately immutable implementation implicit import include including increment indent index indexes info inherit inherits inline insensitive instance instantiable instead integrity intersection invoker isnull key_member key_type label lag last_value lead leakproof least length library like_regex link listen ln load location lock locked log logged lower mapping matched materialized max max_cardinality maxvalue member merge message message_length message_octet_length message_text min minvalue mod mode more move multiset mumps name namespace nfc nfd nfkc nfkd nil normalize normalized nothing notice notify notnull nowait nth_value ntile nullable nullif nulls number occurrences_regex octet_length octets off offset oids operator options ordering others over overlay overriding owned owner parallel parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partition pascal passing passthrough password percent percent_rank percentile_cont percentile_disc perform period permission pg_context pg_datatype_name pg_exception_context pg_exception_detail pg_exception_hint placing plans pli policy portion position position_regex power precedes preceding prepared print_strict_params procedural procedures program publication query quote raise range rank reassign recheck recovery refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex rename repeatable replace replica requiring reset respect restart restore result_oid returned_cardinality returned_length returned_octet_length returned_sqlstate returning reverse routine_catalog routine_name routine_schema routines row_count row_number rowtype rule scale schema_name schemas scope scope_catalog scope_name scope_schema security selective self sensitive sequence sequences serializable server server_name setof share show simple skip slice snapshot source specific_name sqlcode sqlerror sqrt stable stacked standalone statement statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset subscription substring substring_regex succeeds sum symmetric sysid system system_time table_name tables tablesample tablespace temp template ties token top_level_count transaction_active transactions_committed transactions_rolled_back transform transforms translate translate_regex trigger_catalog trigger_name trigger_schema trim trim_array truncate trusted type types uescape unbounded uncommitted unencrypted unlink unlisten unlogged unnamed untyped upper uri use_column use_variable user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema vacuum valid validate validator value_of var_pop var_samp varbinary variable_conflict variadic verbose version versioning views volatile warning whitespace width_bucket window within wrapper xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate yes",types:Bq+"bigint int8 bigserial serial8 varbit bool box bytea cidr circle precision float8 inet int4 json jsonb line lseg macaddr macaddr8 money numeric pg_lsn point polygon float4 int2 smallserial serial2 serial serial4 text timetz timestamptz tsquery tsvector txid_snapshot uuid xml"});function td(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var NO={exports:{}},m1e=NO.exports,x9;function g1e(){return x9||(x9=1,(function(t){(function(e,n){t.exports?t.exports=n():e.log=n()})(m1e,function(){var e=function(){},n="undefined",r=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],s={},o=null;function a(m,g){var y=m[g];if(typeof y.bind=="function")return y.bind(m);try{return Function.prototype.bind.call(y,m)}catch{return function(){return Function.prototype.apply.apply(y,[m,arguments])}}}function l(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function u(m){return m==="debug"&&(m="log"),typeof console===n?!1:m==="trace"&&r?l:console[m]!==void 0?a(console,m):console.log!==void 0?a(console,"log"):e}function c(){for(var m=this.getLevel(),g=0;g=0&&E<=y.levels.SILENT)return E;throw new TypeError("log.setLevel() called with invalid level: "+A)}y.name=m,y.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},y.methodFactory=g||h,y.getLevel=function(){return w??v??O},y.setLevel=function(A,E){return w=C(A),E!==!1&&S(w),c.call(y)},y.setDefaultLevel=function(A){v=C(A),_()||y.setLevel(A,!1)},y.resetLevel=function(){w=null,k(),c.call(y)},y.enableAll=function(A){y.setLevel(y.levels.TRACE,A)},y.disableAll=function(A){y.setLevel(y.levels.SILENT,A)},y.rebuild=function(){if(o!==y&&(O=C(o.getLevel())),c.call(y),o===y)for(var A in s)s[A].rebuild()},O=C(o?o.getLevel():"WARN");var D=_();D!=null&&(w=C(D)),c.call(y)}o=new d,o.getLogger=function(g){if(typeof g!="symbol"&&typeof g!="string"||g==="")throw new TypeError("You must supply a name when creating a logger.");var y=s[g];return y||(y=s[g]=new d(g,o.methodFactory)),y};var p=typeof window!==n?window.log:void 0;return o.noConflict=function(){return typeof window!==n&&window.log===o&&(window.log=p),o},o.getLoggers=function(){return s},o.default=o,o})})(NO)),NO.exports}var y1e=g1e();const Vq=td(y1e);Vq.setLevel("silent");const rr=Vq,bt={STRING:"String",NUMBER:"Number",TRUE:"True",FALSE:"False",NULL:"Null",OBJECT:"Object",ARRAY:"Array",PROPERTY:"Property",PROPERTY_NAME:"PropertyName",PROPERTY_COLON:"PropertyColon",ITEM:"Item",JSON_TEXT:"JsonText",INVALID:"⚠"},b1e={Pair:bt.PROPERTY,Key:bt.PROPERTY_NAME,BlockSequence:bt.ARRAY,BlockMapping:bt.OBJECT,FlowSequence:bt.ARRAY,FlowMapping:bt.OBJECT,QuotedLiteral:bt.STRING,Literal:bt.STRING,Stream:bt.JSON_TEXT,Document:bt.OBJECT},O1e={File:bt.JSON_TEXT},fE=[bt.STRING,bt.NUMBER,bt.TRUE,bt.FALSE,bt.NULL],Zq=[bt.OBJECT,bt.ARRAY,bt.ITEM],Sn={JSON5:"json5",JSON:"json4",YAML:"yaml"},br=(t,e)=>{var n,r;switch(e){case Sn.YAML:return(n=b1e[t])!==null&&n!==void 0?n:t;case Sn.JSON5:return(r=O1e[t])!==null&&r!==void 0?r:t;default:return t}};function Xq(t,e,n){const r=[];for(let i=e;i?.parent;i=i.parent)switch(br(i.parent.name,n)){case bt.PROPERTY:{const s=l4(i.parent,bt.PROPERTY_NAME,n);if(s){let o=qd(t,s).replace(/[/~]/g,a=>a==="~"?"~0":"~1");r.unshift(o)}break}case bt.ARRAY:{if(w1e(i,n)){const s=Gq(i.parent,i,n);r.unshift(`${s}`)}break}}return r.length===0?"":"/"+r.join("/")}const Wq=(t,e,n=-1,r)=>Xq(t.doc,hn(t).resolve(e,n),r),hE=(t,e)=>{const n=hn(t),r=new Map;return n.iterate({enter:i=>{var s,o,a,l,u,c,f,h;if([bt.PROPERTY_NAME,bt.OBJECT].includes(br(i.name,e))){const d=Xq(t.doc,i.node,e),{from:p,to:m}=i.node;if(!(!((o=(s=i.node)===null||s===void 0?void 0:s.nextSibling)===null||o===void 0)&&o.node))return r.set(d,{keyFrom:p,keyTo:m}),!0;const g=e===Sn.JSON?(l=(a=i.node)===null||a===void 0?void 0:a.nextSibling)===null||l===void 0?void 0:l.node:(h=(f=(c=(u=i.node)===null||u===void 0?void 0:u.nextSibling)===null||c===void 0?void 0:c.node)===null||f===void 0?void 0:f.nextSibling)===null||h===void 0?void 0:h.node;if(!g)return r.set(d,{keyFrom:p,keyTo:m}),!0;const{from:y,to:O}=g;return r.set(d,{keyFrom:p,keyTo:m,valueFrom:y,valueTo:O}),!0}}}),r},i3=(t,e,n=-1)=>hn(t).resolveInner(e,n),QO=t=>t.replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1"),v1e=t=>t.replace(/^"(.*)"$/,"'$1'"),qd=(t,e,n=!0,r=!0)=>{const i=e?t.sliceString(e.from,e.to):"";return n?r?QO(i):i.replace(/(^["'])|(["']$)/g,""):i},Yq=(t,e)=>{var n,r,i,s;return br(t.name,e)===bt.INVALID&&(br((r=(n=t.prevSibling)===null||n===void 0?void 0:n.name)!==null&&r!==void 0?r:"",e)===bt.PROPERTY_NAME||br((s=(i=t.prevSibling)===null||i===void 0?void 0:i.name)!==null&&s!==void 0?s:"",e)===bt.PROPERTY_COLON)},BO=(t,e)=>fE.includes(br(t.name,e))||Yq(t,e),w1e=(t,e)=>[...fE,...Zq].includes(br(t.name,e))||Yq(t,e),Cb=(t,e)=>{var n,r,i,s,o,a;return br(t.name,e)===bt.PROPERTY_NAME||br(t.name,e)===bt.INVALID&&(br((r=(n=t.prevSibling)===null||n===void 0?void 0:n.name)!==null&&r!==void 0?r:"",e)===bt.PROPERTY||br((s=(i=t.prevSibling)===null||i===void 0?void 0:i.name)!==null&&s!==void 0?s:"",e)==="{")||e===Sn.YAML&&br((a=(o=t.parent)===null||o===void 0?void 0:o.name)!==null&&a!==void 0?a:"",e)===bt.OBJECT},Oy=t=>{const e=[];let n=t.firstChild;for(;n;)n&&e.push(n),n=n?.nextSibling;return e},x1e=(t,e,n)=>Oy(t).filter(r=>br(r.name,n)===e),l4=(t,e,n)=>{var r;return(r=Oy(t).find(i=>br(i.name,n)===e))!==null&&r!==void 0?r:null},_9=(t,e)=>Oy(t).find(n=>BO(n,e)),_1e=(t,e)=>Oy(t).filter(n=>fE.includes(br(n.name,e))||Zq.includes(br(n.name,e))),Gq=(t,e,n)=>_1e(t,n).findIndex(r=>r.from===e.from&&r.to===e.to),S9=(t,e,n,r=1/0)=>{let i=t;for(;i&&r>0;){if(br(i.name,n)===e)return i;i=i.parent,r--}return null},S1e=wt.define(),Q2=Pr.define({create(){},update(t,e){for(const n of e.effects)if(n.is(S1e))return n.value;return t}}),dE=t=>t.field(Q2),Hq=t=>[Q2.init(()=>t)],k1e={AdditionalItemsError:"Array at `{{pointer}}` may not have an additional item `{{key}}`",AdditionalPropertiesError:"Additional property `{{property}}` on `{{pointer}}` does not match schema `{{schema}}`",AllOfError:"Value `{{value}}` at `{{pointer}}` does not match schema of `{{allOf}}`",AnyOfError:"Value `{{value}}` at `{{pointer}}` does not match any schema of `{{anyOf}}`",ConstError:"Expected value at `{{pointer}}` to be `{{expected}}`, but value given is `{{value}}`",containsAnyError:"The array at `{{pointer}}` must contain at least one item",ContainsArrayError:"The property at `{{pointer}}` must not be an array",ContainsError:"The array at `{{pointer}}` must contain an element that matches `{{schema}}`",EnumError:"Expected given value `{{value}}` in `{{pointer}}` to be one of `{{values}}`",ForbiddenPropertyError:"Property name `{{property}}` at `{{pointer}}` is not allowed",FormatDateError:"Value `{{value}}` at `{{pointer}}` is not a valid date",FormatDateTimeError:"Value `{{value}}` at `{{pointer}}` is not a valid date-time",FormatEmailError:"Value `{{value}}` at `{{pointer}}` is not a valid email",FormatHostnameError:"Value `{{value}}` at `{{pointer}}` is not a valid hostname",FormatIPV4Error:"Value `{{value}}` at `{{pointer}}` is not a valid IPv4 address",FormatIPV4LeadingZeroError:"IPv4 addresses starting with zero are invalid, since they are interpreted as octals",FormatIPV6Error:"Value `{{value}}` at `{{pointer}}` is not a valid IPv6 address",FormatIPV6LeadingZeroError:"IPv6 addresses starting with zero are invalid, since they are interpreted as octals",FormatJsonPointerError:"Value `{{value}}` at `{{pointer}}` is not a valid json-pointer",FormatRegExError:"Value `{{value}}` at `{{pointer}}` is not a valid regular expression",FormatTimeError:"Value `{{value}}` at `{{pointer}}` is not a valid time",FormatURIError:"Value `{{value}}` at `{{pointer}}` is not a valid uri",FormatURIReferenceError:"Value `{{value}}` at `{{pointer}}` is not a valid uri-reference",FormatURITemplateError:"Value `{{value}}` at `{{pointer}}` is not a valid uri-template",FormatURLError:"Value `{{value}}` at `{{pointer}}` is not a valid url",InvalidDataError:"No value may be specified in `{{pointer}}`",InvalidPropertyNameError:"Invalid property name `{{property}}` at `{{pointer}}`",MaximumError:"Value in `{{pointer}}` is `{{length}}`, but should be `{{maximum}}` at maximum",MaxItemsError:"Too many items in `{{pointer}}`, should be `{{maximum}}` at most, but got `{{length}}`",MaxLengthError:"Value `{{pointer}}` should have a maximum length of `{{maxLength}}`, but got `{{length}}`.",MaxPropertiesError:"Too many properties in `{{pointer}}`, should be `{{maximum}}` at most, but got `{{length}}`",MinimumError:"Value in `{{pointer}}` is `{{length}}`, but should be `{{minimum}}` at minimum",MinItemsError:"Too few items in `{{pointer}}`, should be at least `{{minItems}}`, but got `{{length}}`",MinItemsOneError:"At least one item is required in `{{pointer}}`",MinLengthError:"Value `{{pointer}}` should have a minimum length of `{{minLength}}`, but got `{{length}}`.",MinLengthOneError:"A value is required in `{{pointer}}`",MinPropertiesError:"Too few properties in `{{pointer}}`, should be at least `{{minimum}}`, but got `{{length}}`",MissingDependencyError:"The required propery '{{missingProperty}}' in `{{pointer}}` is missing",MissingOneOfPropertyError:"Value at `{{pointer}}` property: `{{property}}`",MultipleOfError:"Expected `{{value}}` in `{{pointer}}` to be multiple of `{{multipleOf}}`",MultipleOneOfError:"Value `{{value}}` should not match multiple schemas in oneOf `{{matches}}`",NoAdditionalPropertiesError:"Additional property `{{property}}` in `{{pointer}}` is not allowed",NotError:"Value `{{value}}` at pointer should not match schema `{{not}}`",OneOfError:"Value `{{value}}` in `{{pointer}}` does not match any given oneof schema",OneOfPropertyError:"Failed finding a matching oneOfProperty schema in `{{pointer}}` where `{{property}}` matches `{{value}}`",PatternError:"Value in `{{pointer}}` should match `{{description}}`, but received `{{received}}`",PatternPropertiesError:"Property `{{key}}` does not match any patterns in `{{pointer}}`. Valid patterns are: {{patterns}}",RequiredPropertyError:"The required property `{{key}}` is missing at `{{pointer}}`",SchemaWarning:"Failed retrieving a schema from '{{pointer}}' to key '{{key}}'",TypeError:"Expected `{{value}}` ({{received}}) in `{{pointer}}` to be of type `{{expected}}`",UndefinedValueError:"Value must not be undefined in `{{pointer}}`",UniqueItemsError:"Items in array must be unique. Value `{{value}}` in `{{pointer}}` is a duplicate of {{duplicatePointer}}.",UnknownPropertyError:"Could not find a valid schema for property `{{pointer}}` within object",ValueNotEmptyError:"A value for `{{property}}` is required at `{{pointer}}`"},C1e=Object.prototype.toString;function Gt(t){const e=C1e.call(t).match(/\s([^\]]+)\]/).pop().toLowerCase();return e==="file"?"object":e}const A1e="object",E1e="array";function T1e(t,e={}){return t.replace(/\{\{\w+\}\}/g,n=>{const r=n.replace(/[{}]/g,""),i=e[r],s=Gt(i);return s===A1e||s===E1e?JSON.stringify(i):i})}function D1e(t,e,n=t){var r;const i=(r=k1e[t])!==null&&r!==void 0?r:n;return T1e(i,e)}function P1e(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function R1e(t,e){return{type:"error",name:t,code:P1e(t),message:D1e(t,e),data:e}}function je(t){return R1e.bind(null,t)}function k1(t,e=[]){for(let n=0;n({index:n,schema:t})}),r}function Ei(t){return t?.type==="error"}function I1e(t){return t instanceof Promise}function B2(t){return Ei(t)||I1e(t)}const{DECLARATOR_ONEOF:_p}=V0;function Kq(t,e,n=t.rootSchema,r="#"){if(e!=null&&n[_p]){const o=[],a=n[_p],l=e[n[_p]];if(l===void 0)return t.errors.missingOneOfPropertyError({property:a,pointer:r,schema:n,value:e});for(let u=0;u0)o.push(...h);else return Dg(n,c,u)}return t.errors.oneOfPropertyError({property:a,value:l,pointer:r,schema:n,errors:o})}const i=[],s=[];for(let o=0;o0?s.push(...l):i.push({index:o,schema:a})}return i.length===1?Dg(n,i[0].schema,i[0].index):i.length>1?t.errors.multipleOneOfError({value:e,pointer:r,schema:n,matches:i}):t.errors.oneOfError({value:JSON.stringify(e),pointer:r,schema:n,oneOf:n.oneOf,errors:s})}function F1e(t,e,n,r){if(n==null||e.properties==null)return-1;let i=0;const s=Object.keys(e.properties);for(let o=0;o0)s.push(...f);else return Dg(n,u,l)}return t.errors.oneOfPropertyError({property:o,value:a,pointer:r,schema:n,errors:s})}const i=[];for(let s=0;s1?t.errors.multipleOneOfError({matches:i,pointer:r,schema:n,value:e}):t.errors.oneOfError({value:JSON.stringify(e),pointer:r,schema:n,oneOf:n.oneOf})}const $1e=(t,e,n,r)=>{if(Array.isArray(e.oneOf)){const i=t.resolveOneOf(n,e,r);if(Ei(i))return i}};var s3,k9;function M1e(){if(k9)return s3;k9=1;var t=function(O){return e(O)&&!n(O)};function e(y){return!!y&&typeof y=="object"}function n(y){var O=Object.prototype.toString.call(y);return O==="[object RegExp]"||O==="[object Date]"||s(y)}var r=typeof Symbol=="function"&&Symbol.for,i=r?Symbol.for("react.element"):60103;function s(y){return y.$$typeof===i}function o(y){return Array.isArray(y)?[]:{}}function a(y,O){return O.clone!==!1&&O.isMergeableObject(y)?m(o(y),y,O):y}function l(y,O,v){return y.concat(O).map(function(w){return a(w,v)})}function u(y,O){if(!O.customMerge)return m;var v=O.customMerge(y);return typeof v=="function"?v:m}function c(y){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(y).filter(function(O){return Object.propertyIsEnumerable.call(y,O)}):[]}function f(y){return Object.keys(y).concat(c(y))}function h(y,O){try{return O in y}catch{return!1}}function d(y,O){return h(y,O)&&!(Object.hasOwnProperty.call(y,O)&&Object.propertyIsEnumerable.call(y,O))}function p(y,O,v){var w={};return v.isMergeableObject(y)&&f(y).forEach(function(x){w[x]=a(y[x],v)}),f(O).forEach(function(x){d(y,x)||(h(y,x)&&v.isMergeableObject(O[x])?w[x]=u(x,v)(y[x],O[x],v):w[x]=a(O[x],v))}),w}function m(y,O,v){v=v||{},v.arrayMerge=v.arrayMerge||l,v.isMergeableObject=v.isMergeableObject||t,v.cloneUnlessOtherwiseSpecified=a;var w=Array.isArray(O),x=Array.isArray(y),S=w===x;return S?w?v.arrayMerge(y,O,v):p(y,O,v):a(O,v)}m.all=function(O,v){if(!Array.isArray(O))throw new Error("first argument should be an array");return O.reduce(function(w,x){return m(w,x,v)},{})};var g=m;return s3=g,s3}var L1e=M1e();const Jq=td(L1e),N1e=(t,e)=>e,mE=(t,e)=>Jq(t,e,{arrayMerge:N1e}),Q1e=(t,e)=>{const n=t.concat(e);return n.filter((r,i)=>n.indexOf(r)===i)},B1e=(t,e)=>Jq(t,e,{arrayMerge:Q1e});function Ui(t,e){const n=Gt(t),r=Gt(e);if(n!==r)return t;const i=B1e(t,e);return t.getOneOfOrigin?Object.defineProperty(i,"getOneOfOrigin",{enumerable:!1,value:t.getOneOfOrigin}):e.getOneOfOrigin&&Object.defineProperty(i,"getOneOfOrigin",{enumerable:!1,value:e.getOneOfOrigin}),i}function C1(t,...e){const n={};return Object.keys(t).forEach(r=>{e.includes(r)||(n[r]=t[r])}),t.getOneOfOrigin&&Object.defineProperty(n,"getOneOfOrigin",{enumerable:!1,value:t.getOneOfOrigin}),n}var z1e=Function.prototype.toString,o3=Object.create,U1e=Object.prototype.toString,j1e=(function(){function t(){this._keys=[],this._values=[]}return t.prototype.has=function(e){return!!~this._keys.indexOf(e)},t.prototype.get=function(e){return this._values[this._keys.indexOf(e)]},t.prototype.set=function(e,n){this._keys.push(e),this._values.push(n)},t})();function q1e(){return new j1e}function V1e(){return new WeakMap}var Z1e=typeof WeakMap<"u"?V1e:q1e;function gE(t){if(!t)return o3(null);var e=t.constructor;if(e===Object)return t===Object.prototype?{}:o3(t);if(e&&~z1e.call(e).indexOf("[native code]"))try{return new e}catch{}return o3(t)}function X1e(t){var e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}function W1e(t){return t.flags}var Y1e=/test/g.flags==="g"?W1e:X1e;function eV(t){var e=U1e.call(t);return e.substring(8,e.length-1)}function G1e(t){return t[Symbol.toStringTag]||eV(t)}var H1e=typeof Symbol<"u"?G1e:eV,K1e=Object.defineProperty,J1e=Object.getOwnPropertyDescriptor,tV=Object.getOwnPropertyNames,yE=Object.getOwnPropertySymbols,nV=Object.prototype,rV=nV.hasOwnProperty,eye=nV.propertyIsEnumerable,iV=typeof yE=="function";function tye(t){return tV(t).concat(yE(t))}var nye=iV?tye:tV;function Ux(t,e,n){for(var r=nye(t),i=0,s=r.length,o=void 0,a=void 0;i{const i=jx(t,e,n);if(i)return t.validate(n,i,r)};function cV(t,e,n){var r;const i={...(r=t.resolveRef(e))!==null&&r!==void 0?r:{}},s=jx(t,i,n);return s||C1(i,"if","then","else")}function fV(t,e,n=t.rootSchema){let r=z2(n);for(let i=0;i{r=Ui(r,t.resolveRef(i))}),r}const wye=(t,e,n,r)=>{const{allOf:i}=e;if(!Array.isArray(i)||i.length===0)return;const s=[];return e.allOf.forEach(o=>{s.push(...t.validate(n,o,r))}),s};function dV(t,e){return t==null||t.$ref==null?t:t.getRoot?t.getRoot().getRef(t):e.getRef(t)}function xye(t){return t.filter((e,n)=>t.indexOf(e)===n)}function Mc(t){return Gt(t)==="object"}function pV(t,e,n){const{dependencies:r}=e;if(!Mc(r)||!Mc(n))return;let i=!1,s={required:[]};if(Object.keys(r).forEach(o=>{var a,l;if(n[o]==null&&!(!((a=e.required)===null||a===void 0)&&a.includes(o)||!((l=s.required)===null||l===void 0)&&l.includes(o)))return;const u=r[o];if(Array.isArray(u)){i=!0,s.required.push(...u);return}if(Mc(u)){i=!0,s=Ui(s,t.resolveRef(u));return}}),i)return s.required=xye(s.required),s}const _ye=(t,e,n,r)=>{if(Gt(e.dependencies)!=="object")return;const i=[];return Object.keys(n).forEach(s=>{if(e.dependencies[s]===void 0||e.dependencies[s]===!0)return;if(e.dependencies[s]===!1){i.push(t.errors.missingDependencyError({pointer:r,schema:e,value:n}));return}let o;const a=Gt(e.dependencies[s]);if(a==="array")o=e.dependencies[s].filter(l=>n[l]===void 0).map(l=>t.errors.missingDependencyError({missingProperty:l,pointer:r,schema:e,value:n}));else if(a==="object")o=t.validate(n,e.dependencies[s],r);else throw new Error(`Invalid dependency definition for ${r}/${s}. Must be string[] or schema`);i.push(...o)}),i.length>0?i:void 0};function mV(t,e,n){if(!Array.isArray(e.anyOf)||e.anyOf.length===0)return;let r;return e.anyOf.forEach(i=>{i=t.resolveRef(i),t.isValid(n,i)&&(r=r?Ui(r,i):i)}),r}function gV(t,e,n=t.rootSchema,r="#"){const{anyOf:i}=n;if(!Array.isArray(i)||i.length===0)return n;const s=mV(t,n,e);if(s==null)return t.errors.anyOfError({pointer:r,schema:n,value:e,anyOf:JSON.stringify(i)});const o=Ui(n,s);return C1(o,"anyOf")}const Sye=(t,e,n,r)=>{if(!(!Array.isArray(e.anyOf)||e.anyOf.length===0)){for(let i=0;ie.includes(n))!==-1}function u4(t,e,n,r){let i,s;if(e=t.resolveRef(e),e.oneOf){const c=pE(t,n,e,r);Ei(c)?s=c:c&&(i=Ui(i??{},c))}if(Array.isArray(e.allOf)){const c=e.allOf.map(f=>{if(Cye(f)){let h=u4(t,f,n,r);return h?(h=Ui(f,h),C1(h,...C9)):void 0}return f});if(c.length>0){const f=hV(t,{allOf:c});i=Ui(i??{},f)}}const o=mV(t,e,n);o&&(i=Ui(i??{},o));const a=pV(t,e,n);a&&(i=Ui(i??{},a));const l=jx(t,e,n);if(l&&(i=Ui(i??{},l)),i==null)return s;const u=u4(t,i,n,r);return u&&(i=Ui(i,u)),C1(i,...C9)}const Aye=["allOf","anyOf","oneOf","dependencies","if","then","else"];function A9(t,e,n,r){let i=u4(t,e,n,r);return i?(i=Ui(e,i),C1(i,...Aye)):e}class yV{constructor(e,n){this.remotes={},this.errors={},this.typeKeywords={},this.validateKeyword={},this.validateType={},this.validateFormat={},this.config=e,this.typeKeywords=z2(e.typeKeywords),this.validateKeyword=Object.assign({},e.validateKeyword),this.validateType=Object.assign({},e.validateType),this.validateFormat=Object.assign({},e.validateFormat),this.errors=Object.assign({},e.errors),this.setSchema(n)}get rootSchema(){return this.__rootSchema}set rootSchema(e){e!=null&&(this.__rootSchema=this.config.compileSchema(this,e))}addRemoteSchema(e,n){this.config.addRemoteSchema(this,e,n)}compileSchema(e){var n;return this.config.compileSchema(this,e,(n=this.rootSchema)!==null&&n!==void 0?n:e)}createSchemaOf(e){return this.config.createSchemaOf(e)}each(e,n,r,i){return this.config.each(this,e,n,r,i)}eachSchema(e,n=this.rootSchema){return this.config.eachSchema(n,e)}getChildSchemaSelection(e,n){return this.config.getChildSchemaSelection(this,e,n)}getSchema(e){return this.config.getSchema(this,e)}getTemplate(e,n,r=this.config.templateDefaultOptions){return this.config.getTemplate(this,e,n,r)}isValid(e,n,r){return this.config.isValid(this,e,n,r)}resolveAnyOf(e,n,r){return this.config.resolveAnyOf(this,e,n,r)}resolveAllOf(e,n){return this.config.resolveAllOf(this,e,n)}resolveRef(e){return this.config.resolveRef(e,this.rootSchema)}resolveOneOf(e,n,r){return this.config.resolveOneOf(this,e,n,r)}setSchema(e){this.rootSchema=e}step(e,n,r,i){return this.config.step(this,e,n,r,i)}validate(e,n,r){return this.config.validate(this,e,n,r)}}function bV(t,e,n){n.id=n.id||e,t.remotes[e]=t.compileSchema(n)}var UO={exports:{}},Eye=UO.exports,E9;function Tye(){return E9||(E9=1,(function(t,e){(function(n,r){t.exports=r()})(typeof self<"u"?self:Eye,(()=>(()=>{var n={d:(T,R)=>{for(var $ in R)n.o(R,$)&&!n.o(T,$)&&Object.defineProperty(T,$,{enumerable:!0,get:R[$]})},o:(T,R)=>Object.prototype.hasOwnProperty.call(T,R),r:T=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(T,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(T,"__esModule",{value:!0})}},r={};function i(T){return T==="#"||T===""||Array.isArray(T)&&T.length===0||!1}n.r(r),n.d(r,{default:()=>E,get:()=>h,isRoot:()=>i,join:()=>D,remove:()=>x,removeUndefinedItems:()=>w,set:()=>y,split:()=>f,splitLast:()=>A});const s=/~1/g,o=/~0/g,a=/\/+/g,l=/(^[#/]*|\/+$)/g;function u(T){return T.replace(s,"/").replace(o,"~")}function c(T){return u(decodeURIComponent(T))}function f(T){if(T==null||typeof T!="string"||i(T))return Array.isArray(T)?T:[];const R=T.indexOf("#")>=0?c:u,$=(T=(T=T.replace(a,"/")).replace(l,"")).split("/");for(let Q=0,B=$.length;Q0&&R[0]=="prototype"}function y(T,R,$){if(R==null)return T;const Q=f(R);if(Q.length===0)return T;T==null&&(T=p.test(Q[0])?[]:{});let B,q,z=T;for(;Q.length>1;)B=Q.shift(),q=p.test(Q[0]),g(B,Q)||(z=v(z,B,q));return B=Q.pop(),O(z,B,$),T}function O(T,R,$){let Q;const B=R.match(m);R==="[]"&&Array.isArray(T)?T.push($):B?(Q=B.pop(),T[Q]=$):T[R]=$}function v(T,R,$){if(T[R]!=null)return T[R];const Q=$?[]:{};return O(T,R,Q),Q}function w(T){let R=0,$=0;for(;R+$0?null:{type:null,text:y[0],rest:m.substr(y[0].length),start:0,end:y[0].length-1,fullText:y[0],errors:[],children:[],parent:null}:null}ss.readToken=s;function o(m){return m.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}ss.escapeRegExp=o;function a(m){m.rest="",m.children&&m.children.forEach(g=>a(g))}function l(m,g){m.start+=g,m.end+=g,m.children&&m.children.forEach(y=>l(y,m.start))}function u(m,g){g.errors&&g.errors.length&&g.errors.forEach(y=>m.push(y)),g.children&&g.children.forEach(y=>u(m,y))}function c(m){let g=e.exec(m),y=n.exec(m),O=g&&g[0]||"",v=y&&y[0]||"",w={raw:m,name:m.replace(e,"").replace(n,""),isOptional:O=="?"||O=="*",allowRepetition:O=="+"||O=="*",atLeastOne:O=="+",lookupPositive:v=="&",lookupNegative:v=="!",pinned:v=="@",lookup:!1,isLiteral:!1};return w.isLiteral=w.name[0]=="'"||w.name[0]=='"',w.lookup=w.lookupNegative||w.lookupPositive,w}ss.parseRuleName=c;function f(m,g){let y=c(m);return g.cachedRules[y.name]||null}ss.findRuleByName=f;function h(m,g){if(m.children){let y=m.children.filter(O=>O.type&&g.test(O.type));for(let O=0;Oh(O,g))}}const d=["EOF"];class p{constructor(g,y){this.grammarRules=g,this.options=y,this.cachedRules={},this.debug=y?y.debug===!0:!1;let O=[],v=[];if(g.forEach(w=>{let x=c(w.name);if(x.name in this.cachedRules){O.push("Duplicated rule "+x.name);return}else this.cachedRules[x.name]=w;if(!w.bnf||!w.bnf.length){let S="Missing rule content, rule: "+w.name;O.indexOf(S)==-1&&O.push(S)}else w.bnf.forEach(S=>{if(typeof S[0]=="string"&&c(S[0]).name==w.name){let k="Left recursion is not allowed, rule: "+w.name;O.indexOf(k)==-1&&O.push(k)}S.forEach(_=>{if(typeof _=="string"){let k=c(_);!k.isLiteral&&v.indexOf(k.name)==-1&&d.indexOf(k.name)==-1&&v.push(k.name)}})});r==w.name&&(w.implicitWs=!1),w.implicitWs&&v.indexOf(r)==-1&&v.push(r),w.recover&&v.indexOf(w.recover)==-1&&v.push(w.recover)}),v.forEach(w=>{w in this.cachedRules||O.push("Missing rule "+w)}),O.length)throw new Error(O.join(` `))}getAST(g,y){y||(y=this.grammarRules.filter(v=>!v.fragment&&v.name.indexOf("%")!=0)[0].name);let O=this.parse(g,y);if(O){u(O.errors,O),l(O,0),h(O,/^%/),(!this.options||!this.options.keepUpperRules)&&h(O,t);let v=O.rest;v&&new i.TokenError(`Unexpected end of input: `+v,O),a(O),O.rest=v}return O}emitSource(){return"CANNOT EMIT SOURCE FROM BASE Parser"}parse(g,y,O=0){let v=null,w=c(y),x,S=this.debug&&!t.test(w.name);S&&console.log(new Array(O).join("│ ")+"Trying to get "+y+" from "+JSON.stringify(g.split(` `)[0]));let _=w.name,k=f(w.name,this);if(w.name=="EOF"){if(g.length)return null;if(g.length==0)return{type:"EOF",text:"",rest:"",start:0,end:0,fullText:"",errors:[],children:[],parent:null}}try{if(!k&&w.isLiteral){let C=w.name.trim();if(C.startsWith('"')?C=JSON.parse(C):C.startsWith("'")&&(C=C.replace(/^'(.+)'$/,"$1").replace(/\\'/g,"'")),C==="")return{type:"%%EMPTY%%",text:"",rest:g,start:0,end:0,fullText:"",errors:[],children:[],parent:null};x=new RegExp(o(C)),_=null}}catch(C){return C instanceof ReferenceError&&console.error(C),null}if(x){let C=s(g,x);if(C)return C.type=_,C}else{let C=k.bnf;C instanceof Array&&C.forEach(D=>{if(v)return;let A=null,E={type:w.name,text:"",children:[],end:0,errors:[],fullText:"",parent:null,start:0,rest:g};k.fragment&&(E.fragment=!0);let T=g,R=0,$=D.length>0,Q=!1;for(let B=0;B{W.start+=R,W.end+=R,W.parent=E,E.children.push(W)}):(z.parent=E,E.children.push(z))),q.lookup&&(z.lookup=!0),S&&console.log(new Array(O+1).join("│ ")+"└─ "+z.type+" "+JSON.stringify(z.text)),!q.lookup&&!z.lookup&&(E.text=E.text+z.text,E.end=E.text.length,T=T.substr(z.text.length),R+=z.text.length),E.rest=T}while(z&&q.allowRepetition&&T.length&&!z.lookup)}else{let q=s(T,D[B]);if(!q)return;S&&console.log(new Array(O+1).join("│ ")+"└> "+JSON.stringify(q.text)+D[B].source),Q=!0,q.start+=R,q.end+=R,E.text=E.text+q.text,E.end=E.text.length,T=T.substr(q.text.length),R+=q.text.length,E.rest=T}Q&&(v=E,S&&console.log(new Array(O).join("│ ")+"├<─┴< PUSHING "+v.type+" "+JSON.stringify(v.text)))}),v&&k.simplifyWhenOneChildren&&v.children.length==1&&(v=v.children[0])}return v||S&&console.log(y+" NOT RESOLVED FROM "+g),v}parseRecovery(g,y,O){if(g.recover&&y.length){let v=this.debug;v&&console.log(new Array(O+1).join("│ ")+"Trying to recover until token "+g.recover+" from "+JSON.stringify(y.split(` `)[0]+y.split(` `)[1]));let w={type:"SyntaxError",text:"",children:[],end:0,errors:[],fullText:"",parent:null,start:0,rest:""},x;do if(x=this.parse(y,g.recover,O+1),x){new i.TokenError('Unexpected input: "'+w.text+`" Expecting: ${g.name}`,w);break}else w.text=w.text+y[0],w.end=w.text.length,y=y.substr(1);while(!x&&y.length>0);if(w.text.length>0&&x)return v&&console.log(new Array(O+1).join("│ ")+"Recovered text: "+JSON.stringify(w.text)),w}return null}}return ss.Parser=p,ss.default=p,ss}var P9;function Rye(){if(P9)return Ab;P9=1,Object.defineProperty(Ab,"__esModule",{value:!0});const t=Pye();var e;return(function(n){n.RULES=[{name:"Grammar",bnf:[["RULE_S*","%Atomic*","EOF"]]},{name:"%Atomic",bnf:[["Production","RULE_S*"]],fragment:!0},{name:"Production",bnf:[["NCName","RULE_S*",'"::="',"RULE_WHITESPACE*","Choice","RULE_WHITESPACE*","RULE_EOL+","RULE_S*"]]},{name:"NCName",bnf:[[/[a-zA-Z][a-zA-Z_0-9]*/]]},{name:"Choice",bnf:[["SequenceOrDifference","%_Choice_1*"]],fragment:!0},{name:"%_Choice_1",bnf:[["RULE_WHITESPACE*",'"|"',"RULE_WHITESPACE*","SequenceOrDifference"]],fragment:!0},{name:"SequenceOrDifference",bnf:[["Item","RULE_WHITESPACE*","%_Item_1?"]]},{name:"%_Item_1",bnf:[["Minus","Item"],["Item*"]],fragment:!0},{name:"Minus",bnf:[['"-"']]},{name:"Item",bnf:[["RULE_WHITESPACE*","%Primary","PrimaryDecoration?"]],fragment:!0},{name:"PrimaryDecoration",bnf:[['"?"'],['"*"'],['"+"']]},{name:"DecorationName",bnf:[['"ebnf://"',/[^\x5D#]+/]]},{name:"%Primary",bnf:[["NCName"],["StringLiteral"],["CharCode"],["CharClass"],["SubItem"]],fragment:!0},{name:"SubItem",bnf:[['"("',"RULE_WHITESPACE*","Choice","RULE_WHITESPACE*",'")"']]},{name:"StringLiteral",bnf:[[`'"'`,/[^"]*/,`'"'`],[`"'"`,/[^']*/,`"'"`]],pinned:1},{name:"CharCode",bnf:[['"#x"',/[0-9a-zA-Z]+/]]},{name:"CharClass",bnf:[["'['","'^'?","%RULE_CharClass_1+",'"]"']]},{name:"%RULE_CharClass_1",bnf:[["CharCodeRange"],["CharRange"],["CharCode"],["RULE_Char"]],fragment:!0},{name:"RULE_Char",bnf:[[/\x09/],[/\x0A/],[/\x0D/],[/[\x20-\x5c]/],[/[\x5e-\uD7FF]/],[/[\uE000-\uFFFD]/]]},{name:"CharRange",bnf:[["RULE_Char",'"-"',"RULE_Char"]]},{name:"CharCodeRange",bnf:[["CharCode",'"-"',"CharCode"]]},{name:"RULE_WHITESPACE",bnf:[["%RULE_WHITESPACE_CHAR*"],["Comment","RULE_WHITESPACE*"]]},{name:"RULE_S",bnf:[["RULE_WHITESPACE","RULE_S*"],["RULE_EOL","RULE_S*"]]},{name:"%RULE_WHITESPACE_CHAR",bnf:[[/\x09/],[/\x20/]],fragment:!0},{name:"Comment",bnf:[['"/*"',"%RULE_Comment_Body*",'"*/"']]},{name:"%RULE_Comment_Body",bnf:[['!"*/"',/[^*]/]],fragment:!0},{name:"RULE_EOL",bnf:[[/\x0D/,/\x0A/],[/\x0A/],[/\x0D/]]},{name:"Link",bnf:[["'['","Url","']'"]]},{name:"Url",bnf:[[/[^\x5D:/?#]/,'"://"',/[^\x5D#]+/,"%Url1?"]]},{name:"%Url1",bnf:[['"#"',"NCName"]],fragment:!0}],n.defaultParser=new t.Parser(n.RULES,{debug:!1});const r=/^(!|&)/,i=/(\?|\+|\*)$/,s=/^%/;function o(v,w){if(typeof v=="string"){if(r.test(v))return"";if(s.test(v)){let S=i.exec(v),_=S?S[0]+" ":"";return a(v,w)?u(v,w)+_:"("+u(v,w)+")"+_}return v}else return v.source.replace(/\\(?:x|u)([a-zA-Z0-9]+)/g,"#x$1").replace(/\[\\(?:x|u)([a-zA-Z0-9]+)-\\(?:x|u)([a-zA-Z0-9]+)\]/g,"[#x$1-#x$2]")}function a(v,w){let x=t.findRuleByName(v,w);return x&&x.bnf.length==1&&x.bnf[0].length==1&&(x.bnf[0][0]instanceof RegExp||x.bnf[0][0][0]=='"'||x.bnf[0][0][0]=="'")}function l(v,w){return v.map(x=>o(x,w)).join(" ")}function u(v,w){let x=t.findRuleByName(v,w);return x?x.bnf.map(S=>l(S,w)).join(" | "):"RULE_NOT_FOUND {"+v+"}"}function c(v){let w=[];return v.grammarRules.forEach(x=>{if(!/^%/.test(x.name)){let S=x.recover?" /* { recoverUntil="+x.recover+" } */":"";w.push(x.name+" ::= "+u(x.name,v)+S)}}),w.join(` `)}n.emit=c;let f=0;function h(v,w){throw console.log("reberia restar "+w+" a "+v),new Error("Difference not supported yet")}function d(v){return new RegExp(v.replace(/#x([a-zA-Z0-9]{4})/g,"\\u$1").replace(/#x([a-zA-Z0-9]{3})/g,"\\u0$1").replace(/#x([a-zA-Z0-9]{2})/g,"\\x$1").replace(/#x([a-zA-Z0-9]{1})/g,"\\x0$1"))}function p(v,w,x){let S=null,_=[];return w.children.forEach((k,C)=>{k.type=="Minus"&&h(S,k);let D=w.children[C+1];D=D&&D.type=="PrimaryDecoration"&&D.text||"";let A="";switch(k.type){case"SubItem":let E="%"+(x+f++);m(v,k,E),_.push(A+E+D);break;case"NCName":case"StringLiteral":_.push(A+k.text+D);break;case"CharCode":case"CharClass":if(D||A){let T={name:"%"+(x+f++),bnf:[[d(k.text)]]};v.push(T),_.push(A+T.name+D)}else _.push(d(k.text));break;case"PrimaryDecoration":break;default:throw new Error(" HOW SHOULD I PARSE THIS? "+k.type+" -> "+JSON.stringify(k.text))}S=k}),_}function m(v,w,x){let S=w.children.filter(C=>C.type=="SequenceOrDifference").map(C=>p(v,C,x)),_={name:x,bnf:S},k=null;S.forEach(C=>{k=k||C.recover,delete C.recover}),x.indexOf("%")==0&&(_.fragment=!0),k&&(_.recover=k),v.push(_)}function g(v,w=n.defaultParser){let x=w.getAST(v);if(!x)throw new Error("Could not parse "+v);if(x.errors&&x.errors.length)throw x.errors[0];let S=[];return x.children.filter(_=>_.type=="Production").map(_=>{let k=_.children.filter(C=>C.type=="NCName")[0].text;m(S,_,k)}),S}n.getRules=g;function y(v,w=n.defaultParser){return g(v.join(""),w)}n.Transform=y;class O extends t.Parser{constructor(w,x){const S=x&&x.debugRulesParser===!0?new t.Parser(n.RULES,{debug:!0}):n.defaultParser;super(g(w,S),x)}emitSource(){return c(this)}}n.Parser=O})(e||(e={})),Ab.default=e,Ab}var Iye=Rye();const Fye=td(Iye),$ye="[^?/{}*,()#]+",Mye=` root ::= ("#" recursion | recursion | (query | pattern) recursion* | "#" SEP? | SEP) recursion ::= (SEP query | pattern)* query ::= (ESC escaped ESC | property | all | any | regex) typecheck? lookahead? property ::= ${$ye} regex ::= "{" [^}]+ "}" SEP ::= "/" all ::= "**" any ::= "*" typecheck ::= "?:" ("value" | "boolean" | "string" | "number" | "object" | "array") lookahead ::= "?" expression ((andExpr | orExpr) expression)* andExpr ::= S? "&&" S? orExpr ::= S? "||" S? expression ::= (exprProperty | ESC escaped ESC) ((isnot | is) (exprProperty | regex | ESC escaped ESC))* exprProperty ::= [a-zA-Z0-9-_ $]+ escaped ::= [^"]+ is ::= ":" isnot ::= ":!" ESC ::= '"' pattern ::= S? "(" (SEP query | pattern (orPattern? pattern)*)* ")" quantifier? S? lookahead? quantifier ::= "+" | "*" | [0-9]+ orPattern ::= S? "," S? S ::= [ ]* `,Lye=new Fye.Parser(Mye),Nye=t=>Lye.getAST(t),cs=0,f0=3,U2=(t,e)=>`${t}/${e}`,OV=Object.prototype.toString,Qye=/Object|Array/,c4=t=>Qye.test(OV.call(t)),Bye=t=>OV.call(t).match(/\s([^\]]+)\]/).pop().toLowerCase();function vV(t){return new RegExp(t.text.replace(/(^{|}$)/g,""))}function zye(t,e){Array.isArray(t)?t.forEach(e):Object.prototype.toString.call(t)==="[object Object]"&&Object.keys(t).forEach(function(n){e(t[n],n,t)})}function R9(t){return Array.isArray(t)?t.map(function(e,n){return`${n}`}):Object.prototype.toString.call(t)==="[object Object]"?Object.keys(t):[]}const Lc={mem:[],get(t,e){const n=t[cs][e];if(!Lc.mem.includes(n))return c4(n)&&Lc.mem.push(n),[n,e,t[cs],U2(t[f0],e)]},reset(){Lc.mem.length=0}},f4={any(t,e){const n=e[cs];return R9(n).map(r=>[n[r],r,n,U2(e[f0],r)])},all(t,e){const n=[e];return zye(e[cs],(r,i)=>{const s=Lc.get(e,i);s&&n.push(...f4.all(t,s))}),n},regex(t,e){const n=vV(t),r=e[cs];return R9(r).filter(i=>n.test(i)).map(i=>[r[i],i,r,U2(e[f0],i)])}},j2={escaped:(t,e)=>j2.property(t,e),property:(t,e)=>{const n=t.text;if(e[cs]&&e[cs][n]!==void 0)return[e[cs][n],n,e[cs],U2(e[f0],n)]},typecheck:(t,e)=>{const n=t.text.replace(/^\?:/,"");if(n==="value")return c4(e[cs])?void 0:e;if(Bye(e[cs])===n)return e},lookahead:(t,e)=>{let n=!0,r=!1;return t.children.forEach(i=>{if(i.type==="expression"){const s=j2.expression(i,e)!==void 0;n=r===!0?n||s:n&&s}else r=i.type==="orExpr"}),n?e:void 0},expression:(t,e)=>{const n=t.children[0].text,r=t.children[1],i=t.children[2],s=e[cs];if(c4(s)!==!1)return Uye(s[n],r,i)?e:void 0}};function Uye(t,e,n){if(e===void 0)return t!==void 0;let r;const i=`${t}`;return n.type==="regex"?r=vV(n).test(i):r=i===n.text,e.type==="isnot"&&(r=r===!1&&t!==void 0),r}function jye(t,e,n,r){const i=[];for(let s=0,o=e.length;s{if(f4[i.type])r=jye(f4[i.type],r,i,n);else if(j2[i.type])r=qye(j2[i.type],r,i,n);else throw new Error(`Unknown filter ${i.type}`)}),r}function Zye(t,e,n){const r=[];let i=t;return e.children.forEach(s=>{if(s.type==="orPattern"){r.push(...i),i=t;return}i=OE(i,s,n)}),r.push(...i),r}function Xye(t){if(t==null)return 1;if(t==="*"||t==="+")return 1/0;const e=parseInt(t);return isNaN(e)?1:e}function Wye(t,e,n){const r=[],i=e.children.find(l=>l.type==="quantifier"),s=Xye(i&&i.text);let o=t;i&&i.text==="*"&&r.push(...o);let a=0;for(;o.length>0&&ar=OE(r,i,n)),r}function OE(t,e,n){let r;return e.type==="query"?r=Vye(t,e,n):e.type==="pattern"?r=Wye(t,e,n):r=Yye(t,e,n),Lc.reset(),Lc.mem.push(t),r}function Gye(t,e){return Lc.reset(),Lc.mem.push(t),OE([[t,null,null,"#"]],e)}const I9={value:t=>t.map(e=>e[cs]),pointer:t=>t.map(e=>e[f0]),all:t=>t,map:t=>{const e={};return t.forEach(n=>e[n[f0]]=n[cs]),e}};var Nh;(function(t){t.POINTER="pointer",t.VALUE="value",t.ALL="all",t.MAP="map"})(Nh||(Nh={}));vy.POINTER=Nh.POINTER;vy.VALUE=Nh.VALUE;vy.ALL=Nh.ALL;vy.MAP=Nh.MAP;function vy(t,e,n=Nh.VALUE){if(e==null)return[];e=e.replace(/(\/$)/g,""),e===""&&(e="#");const r=Nye(e);if(r==null)throw new Error(`empty ast for '${e}'`);if(r.rest!=="")throw new Error(`Failed parsing queryString from: '${r.rest}'`);const i=Gye(t,r);return typeof n=="function"?i.map(s=>n(...s)):I9[n]?I9[n](i):i}var q2;(function(t){t.REPLACE_ITEMS="replace",t.INSERT_ITEMS="insert"})(q2||(q2={}));q2.REPLACE_ITEMS;q2.INSERT_ITEMS;const gu={$ref:{type:!1},allOf:{type:!1,definitions:["allOf/*"]},anyOf:{type:!1,definitions:["anyOf/*"]},array:{type:!0,definitions:["allOf/*","anyOf/*","oneOf/*","not","items","items/*","additionalItems"],validationKeywords:["minItems","maxItems","uniqueItems"],keywords:["items","additionalItems","minItems","maxItems","uniqueItems"]},boolean:{type:!0},enum:{type:!1},integer:{type:!0,definitions:["allOf/*","anyOf/*","oneOf/*","not"],validationKeywords:["minimum","maximum","multipleOf"]},not:{type:!1,definitions:["not"]},number:{type:!0,definitions:["allOf/*","anyOf/*","oneOf/*","not"],validationKeywords:["minimum","maximum","multipleOf"]},null:{type:!0},object:{type:!0,definitions:["allOf/*","anyOf/*","oneOf/*","not","properties/*","additionalProperties","patternProperties/*","dependencies/*"],validationKeywords:["minProperties","maxProperties","required"],keywords:["properties","additionalProperties","patternProperties","dependencies","minProperties","maxProperties","required"]},oneOf:{type:!1,definitions:["oneOf/*"]},string:{type:!0,definitions:["allOf/*","anyOf/*","oneOf/*","not"],validationKeywords:["minLength","maxLength","pattern"]}},Hye=Object.keys(gu).filter(t=>gu[t].type===!1),F9=Object.prototype.hasOwnProperty;function $9(t){if(Mc(t)===!1)return;if(t.enum)return"enum";const e=t.type;if(Array.isArray(e)||gu[e])return e;const n=Hye.filter(r=>t[r]);if(n.length===1)return n[0];if(n.length===0){for(let r=0,i=gu.object.keywords.length;r{vy(t,i,(s,o,a,l)=>{Mc(s)&&$9(s)&&e.push({pointer:A1.join(A1.split(l),!1),def:s})})}),e}function Jye(t,e){if(this.callback(t,e)===!0)return;Kye(t).forEach(r=>this.nextTypeDefs(r.def,A1.join(e,r.pointer,!1)))}function Eb(t,e,n,r="definitions"){const i=e[r];Object.keys(i).forEach(s=>{if(i[s]===!1||Mc(i[s])){t.nextTypeDefs(i[s],A1.join(n,r,s,!1));return}})}function qx(t,e,n="#"){const r={callback:e,nextTypeDefs:Jye};r.nextTypeDefs(t,n),t.definitions!=null&&(r.callback=(i,s)=>{e(i,s),i.definitions!=null&&Eb(r,i,s)},Eb(r,t,n)),t.$defs!=null&&(r.callback=(i,s)=>{e(i,s),i.definitions!=null&&Eb(r,i,s)},Eb(r,t,n,"$defs"))}const ebe=/(#|\/)+$/,Tb=/#$/,tbe=/^[^:]+:\/\/[^/]+\//,nbe=/\/[^/]*$/,rbe=/#.*$/;function V2(t,e){return t==null&&e==null?"#":e==null?t.replace(Tb,""):t==null?e.replace(Tb,""):e[0]==="#"?`${t.replace(rbe,"")}${e.replace(ebe,"")}`:tbe.test(e)?e.replace(Tb,""):`${t.replace(nbe,"")}/${e.replace(Tb,"")}`}const _m=/(#|\/)+$/g,ibe=["",null,"#"];function sbe(t){if(ibe.includes(t))return[];if(t=t.replace(_m,""),t.indexOf("#")===-1)return[t.replace(_m,"")];if(t.indexOf("#")===0)return[t.replace(_m,"")];const e=t.split("#");return e[0]=e[0].replace(_m,""),e[1]=`#${e[1].replace(_m,"")}`,e}const obe=/(#|\/)+$/g,abe=t=>Gt(t)==="object";function ou(t,e,n){if(abe(n)&&(n=n.__ref||n.$ref),n==null)return e;let r;const i=n.replace(obe,"");if(t.remotes[i])return r=t.remotes[i],r&&r.$ref?ou(t,e,r.$ref):r;if(t.ids[n])return r=Kf.get(e,t.ids[n]),r&&r.$ref?ou(t,e,r.$ref):r;const s=sbe(n);if(s.length===0)return e;if(s.length===1){if(n=s[0],t.remotes[n])return r=t.remotes[n],ou(t,e,r.$ref);if(t.ids[n])return r=Kf.get(e,t.ids[n]),r&&r.$ref?ou(t,e,r.$ref):r}if(s.length===2){const o=s[0];if(n=s[1],t.remotes[o])return t.remotes[o].getRef?t.remotes[o].getRef(n):ou(t,t.remotes[o],n);if(t.ids[o])return ou(t,Kf.get(e,t.ids[o]),n)}return r=Kf.get(e,t.ids[n]||n),r&&r.$ref?ou(t,e,r.$ref):r}const M9="__compiled",L9="__ref",lbe="getRef",ube="getRoot",cbe=/(#|\/)+$/g;function fbe(t,e,n=e,r=!1){if(!e||e[M9]!==void 0)return e;const i={ids:{},remotes:t.remotes},s=JSON.stringify(e),o=JSON.parse(s);if(Object.defineProperty(o,M9,{enumerable:!1,value:!0}),Object.defineProperty(o,lbe,{enumerable:!1,value:ou.bind(null,i,o)}),r===!1&&s.includes("$ref")===!1)return o;e!==n&&Object.defineProperty(o,"definitions",{enumerable:!1,value:Object.assign({},n.definitions,n.$defs,e.definitions,e.$defs)});const a={},l=()=>o;return qx(o,(u,c)=>{var f;if(u.id){if(u.id.startsWith("http")&&/(allOf|anyOf|oneOf)\/\d+$/.test(c)){const g=c.replace(/\/(allOf|anyOf|oneOf)\/\d+$/,""),y=Kf.get(o,g);u.id=(f=y.id)!==null&&f!==void 0?f:u.id}i.ids[u.id.replace(cbe,"")]=c}c=`#${c}`.replace(/##+/,"#");const h=c.replace(/\/[^/]+$/,""),d=c.replace(/\/[^/]+\/[^/]+$/,""),p=a[h]||a[d],m=V2(p,u.id);a[c]=m,i.ids[m]==null&&(i.ids[m]=c),u.$ref&&!u[L9]&&(Object.defineProperty(u,L9,{enumerable:!1,value:V2(m,u.$ref)}),Object.defineProperty(u,ube,{enumerable:!1,value:l}))}),o}function wV(t,e,n,r=t.rootSchema,i="#"){r=t.resolveRef(r),n(r,e,i);const s=Gt(e);s==="object"?Object.keys(e).forEach(o=>{const a=t.step(o,r,e,i),l=e[o];t.each(l,n,a,`${i}/${o}`)}):s==="array"&&e.forEach((o,a)=>{const l=t.step(a,r,e,i);t.each(o,n,l,`${i}/${a}`)})}const xV={additionalItemsError:je("AdditionalItemsError"),additionalPropertiesError:je("AdditionalPropertiesError"),anyOfError:je("AnyOfError"),allOfError:je("AllOfError"),constError:je("ConstError"),containsError:je("ContainsError"),containsArrayError:je("ContainsArrayError"),containsAnyError:je("ContainsAnyError"),enumError:je("EnumError"),forbiddenPropertyError:je("ForbiddenPropertyError"),formatURLError:je("FormatURLError"),formatURIError:je("FormatURIError"),formatURIReferenceError:je("FormatURIReferenceError"),formatURITemplateError:je("FormatURITemplateError"),formatDateError:je("FormatDateError"),formatDateTimeError:je("FormatDateTimeError"),formatEmailError:je("FormatEmailError"),formatHostnameError:je("FormatHostnameError"),formatIPV4Error:je("FormatIPV4Error"),formatIPV4LeadingZeroError:je("FormatIPV4LeadingZeroError"),formatIPV6Error:je("FormatIPV6Error"),formatIPV6LeadingZeroError:je("FormatIPV6LeadingZeroError"),formatJsonPointerError:je("FormatJsonPointerError"),formatRegExError:je("FormatRegExError"),formatTimeError:je("FormatTimeError"),invalidSchemaError:je("InvalidSchemaError"),invalidDataError:je("InvalidDataError"),invalidTypeError:je("InvalidTypeError"),invalidPropertyNameError:je("InvalidPropertyNameError"),maximumError:je("MaximumError"),maxItemsError:je("MaxItemsError"),maxLengthError:je("MaxLengthError"),maxPropertiesError:je("MaxPropertiesError"),minimumError:je("MinimumError"),minItemsError:je("MinItemsError"),minItemsOneError:je("MinItemsOneError"),minLengthError:je("MinLengthError"),minLengthOneError:je("MinLengthOneError"),minPropertiesError:je("MinPropertiesError"),missingDependencyError:je("MissingDependencyError"),missingOneOfPropertyError:je("MissingOneOfPropertyError"),multipleOfError:je("MultipleOfError"),multipleOneOfError:je("MultipleOneOfError"),noAdditionalPropertiesError:je("NoAdditionalPropertiesError"),notError:je("NotError"),oneOfError:je("OneOfError"),oneOfPropertyError:je("OneOfPropertyError"),patternError:je("PatternError"),patternPropertiesError:je("PatternPropertiesError"),requiredPropertyError:je("RequiredPropertyError"),schemaWarning:je("SchemaWarning"),typeError:je("TypeError"),undefinedValueError:je("UndefinedValueError"),uniqueItemsError:je("UniqueItemsError"),unknownPropertyError:je("UnknownPropertyError"),valueNotEmptyError:je("ValueNotEmptyError")};var l3={exports:{}},N9;function hbe(){return N9||(N9=1,(function(t){(function(e){e.exports.is_uri=r,e.exports.is_http_uri=i,e.exports.is_https_uri=s,e.exports.is_web_uri=o,e.exports.isUri=r,e.exports.isHttpUri=i,e.exports.isHttpsUri=s,e.exports.isWebUri=o;var n=function(a){var l=a.match(/(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?/);return l};function r(a){if(a&&!/[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i.test(a)&&!/%[^0-9a-f]/i.test(a)&&!/%[0-9a-f](:?[^0-9a-f]|$)/i.test(a)){var l=[],u="",c="",f="",h="",d="",p="";if(l=n(a),u=l[1],c=l[2],f=l[3],h=l[4],d=l[5],!!(u&&u.length&&f.length>=0)){if(c&&c.length){if(!(f.length===0||/^\//.test(f)))return}else if(/^\/\//.test(f))return;if(/^[a-z][a-z0-9\+\-\.]*$/.test(u.toLowerCase()))return p+=u+":",c&&c.length&&(p+="//"+c),p+=f,h&&h.length&&(p+="?"+h),d&&d.length&&(p+="#"+d),p}}}function i(a,l){if(r(a)){var u=[],c="",f="",h="",d="",p="",m="",g="";if(u=n(a),c=u[1],f=u[2],h=u[3],p=u[4],m=u[5],!!c){if(l){if(c.toLowerCase()!="https")return}else if(c.toLowerCase()!="http")return;if(f)return/:(\d+)$/.test(f)&&(d=f.match(/:(\d+)$/)[0],f=f.replace(/:\d+$/,"")),g+=c+":",g+="//"+f,d&&(g+=d),g+=h,p&&p.length&&(g+="?"+p),m&&m.length&&(g+="#"+m),g}}}function s(a){return i(a,!0)}function o(a){return i(a)||s(a)}})(t)})(l3)),l3.exports}var dbe=hbe();const Q9=td(dbe);var $i={},jO={exports:{}},pbe=jO.exports,B9;function mbe(){return B9||(B9=1,(function(t){(function(e,n){t.exports?t.exports=n():e.nearley=n()})(pbe,function(){function e(u,c,f){return this.id=++e.highestId,this.name=u,this.symbols=c,this.postprocess=f,this}e.highestId=0,e.prototype.toString=function(u){var c=typeof u>"u"?this.symbols.map(l).join(" "):this.symbols.slice(0,u).map(l).join(" ")+" ● "+this.symbols.slice(u).map(l).join(" ");return this.name+" → "+c};function n(u,c,f,h){this.rule=u,this.dot=c,this.reference=f,this.data=[],this.wantedBy=h,this.isComplete=this.dot===u.symbols.length}n.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},n.prototype.nextState=function(u){var c=new n(this.rule,this.dot+1,this.reference,this.wantedBy);return c.left=this,c.right=u,c.isComplete&&(c.data=c.build(),c.right=void 0),c},n.prototype.build=function(){var u=[],c=this;do u.push(c.right.data),c=c.left;while(c.left);return u.reverse(),u},n.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,o.fail))};function r(u,c){this.grammar=u,this.index=c,this.states=[],this.wants={},this.scannable=[],this.completed={}}r.prototype.process=function(u){for(var c=this.states,f=this.wants,h=this.completed,d=0;d0&&c.push(" ^ "+h+" more lines identical to this"),h=0,c.push(" "+m)),f=m}},o.prototype.getSymbolDisplay=function(u){return a(u)},o.prototype.buildFirstStateStack=function(u,c){if(c.indexOf(u)!==-1)return null;if(u.wantedBy.length===0)return[u];var f=u.wantedBy[0],h=[u].concat(c),d=this.buildFirstStateStack(f,h);return d===null?null:[u].concat(d)},o.prototype.save=function(){var u=this.table[this.current];return u.lexerState=this.lexerState,u},o.prototype.restore=function(u){var c=u.index;this.current=c,this.table[c]=u,this.table.splice(c+1),this.lexerState=u.lexerState,this.results=this.finish()},o.prototype.rewind=function(u){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[u])},o.prototype.finish=function(){var u=[],c=this.grammar.start,f=this.table[this.table.length-1];return f.states.forEach(function(h){h.rule.name===c&&h.dot===h.rule.symbols.length&&h.reference===0&&h.data!==o.fail&&u.push(h)}),u.map(function(h){return h.data})};function a(u){var c=typeof u;if(c==="string")return u;if(c==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return"character matching "+u;if(u.type)return u.type+" token";if(u.test)return"token matching "+String(u.test);throw new Error("Unknown symbol type: "+u)}}function l(u){var c=typeof u;if(c==="string")return u;if(c==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return u.toString();if(u.type)return"%"+u.type;if(u.test)return"<"+String(u.test)+">";throw new Error("Unknown symbol type: "+u)}}return{Parser:o,Grammar:i,Rule:e}})})(jO)),jO.exports}var Db={},z9;function gbe(){if(z9)return Db;z9=1,Object.defineProperty(Db,"__esModule",{value:!0});function t(i){return i[0]}const e=i=>[].concat(...i.map(s=>Array.isArray(s)?e(s):s));function n(i){return i?Array.isArray(i)?e(i).join(""):i:""}const r={Lexer:void 0,ParserRules:[{name:"Reverse_path",symbols:["Path"]},{name:"Reverse_path$string$1",symbols:[{literal:"<"},{literal:">"}],postprocess:i=>i.join("")},{name:"Reverse_path",symbols:["Reverse_path$string$1"]},{name:"Forward_path$subexpression$1$subexpression$1",symbols:[{literal:"<"},/[pP]/,/[oO]/,/[sS]/,/[tT]/,/[mM]/,/[aA]/,/[sS]/,/[tT]/,/[eE]/,/[rR]/,{literal:"@"}],postprocess:function(i){return i.join("")}},{name:"Forward_path$subexpression$1",symbols:["Forward_path$subexpression$1$subexpression$1","Domain",{literal:">"}]},{name:"Forward_path",symbols:["Forward_path$subexpression$1"]},{name:"Forward_path$subexpression$2",symbols:[{literal:"<"},/[pP]/,/[oO]/,/[sS]/,/[tT]/,/[mM]/,/[aA]/,/[sS]/,/[tT]/,/[eE]/,/[rR]/,{literal:">"}],postprocess:function(i){return i.join("")}},{name:"Forward_path",symbols:["Forward_path$subexpression$2"]},{name:"Forward_path",symbols:["Path"]},{name:"Path$ebnf$1$subexpression$1",symbols:["A_d_l",{literal:":"}]},{name:"Path$ebnf$1",symbols:["Path$ebnf$1$subexpression$1"],postprocess:t},{name:"Path$ebnf$1",symbols:[],postprocess:()=>null},{name:"Path",symbols:[{literal:"<"},"Path$ebnf$1","Mailbox",{literal:">"}]},{name:"A_d_l$ebnf$1",symbols:[]},{name:"A_d_l$ebnf$1$subexpression$1",symbols:[{literal:","},"At_domain"]},{name:"A_d_l$ebnf$1",symbols:["A_d_l$ebnf$1","A_d_l$ebnf$1$subexpression$1"],postprocess:i=>i[0].concat([i[1]])},{name:"A_d_l",symbols:["At_domain","A_d_l$ebnf$1"]},{name:"At_domain",symbols:[{literal:"@"},"Domain"]},{name:"Domain$ebnf$1",symbols:[]},{name:"Domain$ebnf$1$subexpression$1",symbols:[{literal:"."},"sub_domain"]},{name:"Domain$ebnf$1",symbols:["Domain$ebnf$1","Domain$ebnf$1$subexpression$1"],postprocess:i=>i[0].concat([i[1]])},{name:"Domain",symbols:["sub_domain","Domain$ebnf$1"]},{name:"sub_domain",symbols:["U_label"]},{name:"Let_dig",symbols:["ALPHA_DIGIT"],postprocess:t},{name:"Ldh_str$ebnf$1",symbols:[]},{name:"Ldh_str$ebnf$1",symbols:["Ldh_str$ebnf$1","ALPHA_DIG_DASH"],postprocess:i=>i[0].concat([i[1]])},{name:"Ldh_str",symbols:["Ldh_str$ebnf$1","Let_dig"]},{name:"U_Let_dig",symbols:["ALPHA_DIGIT_U"],postprocess:t},{name:"U_Ldh_str$ebnf$1",symbols:[]},{name:"U_Ldh_str$ebnf$1",symbols:["U_Ldh_str$ebnf$1","ALPHA_DIG_DASH_U"],postprocess:i=>i[0].concat([i[1]])},{name:"U_Ldh_str",symbols:["U_Ldh_str$ebnf$1","U_Let_dig"]},{name:"U_label$ebnf$1$subexpression$1",symbols:["U_Ldh_str"]},{name:"U_label$ebnf$1",symbols:["U_label$ebnf$1$subexpression$1"],postprocess:t},{name:"U_label$ebnf$1",symbols:[],postprocess:()=>null},{name:"U_label",symbols:["U_Let_dig","U_label$ebnf$1"]},{name:"address_literal$subexpression$1",symbols:["IPv4_address_literal"]},{name:"address_literal$subexpression$1",symbols:["IPv6_address_literal"]},{name:"address_literal$subexpression$1",symbols:["General_address_literal"]},{name:"address_literal",symbols:[{literal:"["},"address_literal$subexpression$1",{literal:"]"}]},{name:"non_local_part",symbols:["Domain"],postprocess:function(i){return{DomainName:n(i[0])}}},{name:"non_local_part",symbols:["address_literal"],postprocess:function(i){return{AddressLiteral:n(i[0])}}},{name:"Mailbox",symbols:["Local_part",{literal:"@"},"non_local_part"],postprocess:function(i){return{localPart:n(i[0]),domainPart:n(i[2])}}},{name:"Local_part",symbols:["Dot_string"],postprocess:function(i){return{DotString:n(i[0])}}},{name:"Local_part",symbols:["Quoted_string"],postprocess:function(i){return{QuotedString:n(i[0])}}},{name:"Dot_string$ebnf$1",symbols:[]},{name:"Dot_string$ebnf$1$subexpression$1",symbols:[{literal:"."},"Atom"]},{name:"Dot_string$ebnf$1",symbols:["Dot_string$ebnf$1","Dot_string$ebnf$1$subexpression$1"],postprocess:i=>i[0].concat([i[1]])},{name:"Dot_string",symbols:["Atom","Dot_string$ebnf$1"]},{name:"Atom$ebnf$1",symbols:[/[0-9A-Za-z!#$%&'*+\-/=?^_`{|}~\u0080-\uFFFF/]/]},{name:"Atom$ebnf$1",symbols:["Atom$ebnf$1",/[0-9A-Za-z!#$%&'*+\-/=?^_`{|}~\u0080-\uFFFF/]/],postprocess:i=>i[0].concat([i[1]])},{name:"Atom",symbols:["Atom$ebnf$1"]},{name:"Quoted_string$ebnf$1",symbols:[]},{name:"Quoted_string$ebnf$1",symbols:["Quoted_string$ebnf$1","QcontentSMTP"],postprocess:i=>i[0].concat([i[1]])},{name:"Quoted_string",symbols:["DQUOTE","Quoted_string$ebnf$1","DQUOTE"]},{name:"QcontentSMTP",symbols:["qtextSMTP"]},{name:"QcontentSMTP",symbols:["quoted_pairSMTP"]},{name:"quoted_pairSMTP",symbols:[{literal:"\\"},/[\x20-\x7e]/]},{name:"qtextSMTP",symbols:[/[\x20-\x21\x23-\x5b\x5d-\x7e\u0080-\uFFFF]/],postprocess:t},{name:"IPv4_address_literal$macrocall$2",symbols:[{literal:"."},"Snum"]},{name:"IPv4_address_literal$macrocall$1",symbols:["IPv4_address_literal$macrocall$2","IPv4_address_literal$macrocall$2","IPv4_address_literal$macrocall$2"]},{name:"IPv4_address_literal",symbols:["Snum","IPv4_address_literal$macrocall$1"]},{name:"IPv6_address_literal$subexpression$1",symbols:[/[iI]/,/[pP]/,/[vV]/,{literal:"6"},{literal:":"}],postprocess:function(i){return i.join("")}},{name:"IPv6_address_literal",symbols:["IPv6_address_literal$subexpression$1","IPv6_addr"]},{name:"General_address_literal$ebnf$1",symbols:["dcontent"]},{name:"General_address_literal$ebnf$1",symbols:["General_address_literal$ebnf$1","dcontent"],postprocess:i=>i[0].concat([i[1]])},{name:"General_address_literal",symbols:["Standardized_tag",{literal:":"},"General_address_literal$ebnf$1"]},{name:"Standardized_tag",symbols:["Ldh_str"]},{name:"dcontent",symbols:[/[\x21-\x5a\x5e-\x7e]/],postprocess:t},{name:"Snum",symbols:["DIGIT"]},{name:"Snum$subexpression$1",symbols:[/[1-9]/,"DIGIT"]},{name:"Snum",symbols:["Snum$subexpression$1"]},{name:"Snum$subexpression$2",symbols:[{literal:"1"},"DIGIT","DIGIT"]},{name:"Snum",symbols:["Snum$subexpression$2"]},{name:"Snum$subexpression$3",symbols:[{literal:"2"},/[0-4]/,"DIGIT"]},{name:"Snum",symbols:["Snum$subexpression$3"]},{name:"Snum$subexpression$4",symbols:[{literal:"2"},{literal:"5"},/[0-5]/]},{name:"Snum",symbols:["Snum$subexpression$4"]},{name:"IPv6_addr",symbols:["IPv6_full"]},{name:"IPv6_addr",symbols:["IPv6_comp"]},{name:"IPv6_addr",symbols:["IPv6v4_full"]},{name:"IPv6_addr",symbols:["IPv6v4_comp"]},{name:"IPv6_hex",symbols:["HEXDIG"]},{name:"IPv6_hex$subexpression$1",symbols:["HEXDIG","HEXDIG"]},{name:"IPv6_hex",symbols:["IPv6_hex$subexpression$1"]},{name:"IPv6_hex$subexpression$2",symbols:["HEXDIG","HEXDIG","HEXDIG"]},{name:"IPv6_hex",symbols:["IPv6_hex$subexpression$2"]},{name:"IPv6_hex$subexpression$3",symbols:["HEXDIG","HEXDIG","HEXDIG","HEXDIG"]},{name:"IPv6_hex",symbols:["IPv6_hex$subexpression$3"]},{name:"IPv6_full$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6_full$macrocall$1",symbols:["IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2","IPv6_full$macrocall$2"]},{name:"IPv6_full",symbols:["IPv6_hex","IPv6_full$macrocall$1"]},{name:"IPv6_comp$ebnf$1$subexpression$1$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6_comp$ebnf$1$subexpression$1$macrocall$1",symbols:["IPv6_comp$ebnf$1$subexpression$1$macrocall$2","IPv6_comp$ebnf$1$subexpression$1$macrocall$2","IPv6_comp$ebnf$1$subexpression$1$macrocall$2","IPv6_comp$ebnf$1$subexpression$1$macrocall$2","IPv6_comp$ebnf$1$subexpression$1$macrocall$2"]},{name:"IPv6_comp$ebnf$1$subexpression$1",symbols:["IPv6_hex","IPv6_comp$ebnf$1$subexpression$1$macrocall$1"]},{name:"IPv6_comp$ebnf$1",symbols:["IPv6_comp$ebnf$1$subexpression$1"],postprocess:t},{name:"IPv6_comp$ebnf$1",symbols:[],postprocess:()=>null},{name:"IPv6_comp$string$1",symbols:[{literal:":"},{literal:":"}],postprocess:i=>i.join("")},{name:"IPv6_comp$ebnf$2$subexpression$1$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6_comp$ebnf$2$subexpression$1$macrocall$1",symbols:["IPv6_comp$ebnf$2$subexpression$1$macrocall$2","IPv6_comp$ebnf$2$subexpression$1$macrocall$2","IPv6_comp$ebnf$2$subexpression$1$macrocall$2","IPv6_comp$ebnf$2$subexpression$1$macrocall$2","IPv6_comp$ebnf$2$subexpression$1$macrocall$2"]},{name:"IPv6_comp$ebnf$2$subexpression$1",symbols:["IPv6_hex","IPv6_comp$ebnf$2$subexpression$1$macrocall$1"]},{name:"IPv6_comp$ebnf$2",symbols:["IPv6_comp$ebnf$2$subexpression$1"],postprocess:t},{name:"IPv6_comp$ebnf$2",symbols:[],postprocess:()=>null},{name:"IPv6_comp",symbols:["IPv6_comp$ebnf$1","IPv6_comp$string$1","IPv6_comp$ebnf$2"]},{name:"IPv6v4_full$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6v4_full$macrocall$1",symbols:["IPv6v4_full$macrocall$2","IPv6v4_full$macrocall$2","IPv6v4_full$macrocall$2","IPv6v4_full$macrocall$2","IPv6v4_full$macrocall$2"]},{name:"IPv6v4_full",symbols:["IPv6_hex","IPv6v4_full$macrocall$1",{literal:":"},"IPv4_address_literal"]},{name:"IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6v4_comp$ebnf$1$subexpression$1$macrocall$1",symbols:["IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2","IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2","IPv6v4_comp$ebnf$1$subexpression$1$macrocall$2"]},{name:"IPv6v4_comp$ebnf$1$subexpression$1",symbols:["IPv6_hex","IPv6v4_comp$ebnf$1$subexpression$1$macrocall$1"]},{name:"IPv6v4_comp$ebnf$1",symbols:["IPv6v4_comp$ebnf$1$subexpression$1"],postprocess:t},{name:"IPv6v4_comp$ebnf$1",symbols:[],postprocess:()=>null},{name:"IPv6v4_comp$string$1",symbols:[{literal:":"},{literal:":"}],postprocess:i=>i.join("")},{name:"IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2",symbols:[{literal:":"},"IPv6_hex"]},{name:"IPv6v4_comp$ebnf$2$subexpression$1$macrocall$1",symbols:["IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2","IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2","IPv6v4_comp$ebnf$2$subexpression$1$macrocall$2"]},{name:"IPv6v4_comp$ebnf$2$subexpression$1",symbols:["IPv6_hex","IPv6v4_comp$ebnf$2$subexpression$1$macrocall$1",{literal:":"}]},{name:"IPv6v4_comp$ebnf$2",symbols:["IPv6v4_comp$ebnf$2$subexpression$1"],postprocess:t},{name:"IPv6v4_comp$ebnf$2",symbols:[],postprocess:()=>null},{name:"IPv6v4_comp",symbols:["IPv6v4_comp$ebnf$1","IPv6v4_comp$string$1","IPv6v4_comp$ebnf$2","IPv4_address_literal"]},{name:"DIGIT",symbols:[/[0-9]/],postprocess:t},{name:"ALPHA_DIGIT_U",symbols:[/[0-9A-Za-z\u0080-\uFFFF]/],postprocess:t},{name:"ALPHA_DIGIT",symbols:[/[0-9A-Za-z]/],postprocess:t},{name:"ALPHA_DIG_DASH",symbols:[/[-0-9A-Za-z]/],postprocess:t},{name:"ALPHA_DIG_DASH_U",symbols:[/[-0-9A-Za-z\u0080-\uFFFF]/],postprocess:t},{name:"HEXDIG",symbols:[/[0-9A-Fa-f]/],postprocess:t},{name:"DQUOTE",symbols:[{literal:'"'}],postprocess:t}],ParserStart:"Reverse_path"};return Db.default=r,Db}var U9;function ybe(){if(U9)return $i;U9=1;var t=$i&&$i.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty($i,"__esModule",{value:!0}),$i.canonicalize=$i.canonicalize_quoted_string=$i.normalize=$i.normalize_dot_string=$i.parse=void 0;const e=mbe(),n=t(gbe());n.default.ParserStart="Mailbox";const r=e.Grammar.fromCompiled(n.default);function i(u){const c=new e.Parser(r);if(c.feed(u),c.results.length!==1)throw new Error("address parsing failed: ambiguous grammar");return c.results[0]}$i.parse=i;function s(u){return(function(){const h=u.indexOf("+");return h===-1?u:u.substr(0,h)})().replace(/\./g,"").toLowerCase()}$i.normalize_dot_string=s;function o(u){var c,f;const h=i(u),d=(c=h.domainPart.AddressLiteral)!==null&&c!==void 0?c:h.domainPart.DomainName.toLowerCase();return`${(f=h.localPart.QuotedString)!==null&&f!==void 0?f:s(h.localPart.DotString)}@${d}`}$i.normalize=o;function a(u){return`"${u.substr(1).substr(0,u.length-2).replace(/(?:\\(.))/g,"$1").replace(/(?:(["\\]))/g,"\\$1")}"`}$i.canonicalize_quoted_string=a;function l(u){var c;const f=i(u),h=(c=f.domainPart.AddressLiteral)!==null&&c!==void 0?c:f.domainPart.DomainName.toLowerCase();return`${f.localPart.QuotedString?a(f.localPart.QuotedString):f.localPart.DotString}@${h}`}return $i.canonicalize=l,$i}var bbe=ybe();const Obe=new RegExp("^([0-9]+)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[Tt]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\\.[0-9]+)?(([Zz])|([\\+|\\-]([01][0-9]|2[0-3]):[0-5][0-9]))$"),vbe=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,wbe=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,xbe=/^(?=.{1,255}$)[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|-){0,61}[0-9A-Za-z])?)*\.?$/,_be=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,Sbe=/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,kbe=[0,31,28,31,30,31,30,31,31,30,31,30,31],Cbe=/^(?:\/(?:[^~/]|~0|~1)*)*$/,Abe=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,Ebe=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,Tbe=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,_V={date:(t,e,n,r)=>{if(typeof n!="string"||n==="")return;const i=n.match(_be);if(!i)return t.errors.formatDateTimeError({value:n,pointer:r,schema:e});const s=+i[1],o=+i[2],a=+i[3],l=s%4===0&&(s%100!==0||s%400===0);if(!(o>=1&&o<=12&&a>=1&&a<=(o==2&&l?29:kbe[o])))return t.errors.formatDateError({value:n,pointer:r,schema:e})},"date-time":(t,e,n,r)=>{if(!(typeof n!="string"||n===""))return n===""||Obe.test(n)?new Date(n).toString()==="Invalid Date"?t.errors.formatDateTimeError({value:n,pointer:r,schema:e}):void 0:t.errors.formatDateTimeError({value:n,pointer:r,schema:e})},email:(t,e,n,r)=>{if(typeof n!="string"||n==="")return;if(n[0]==='"')return t.errors.formatEmailError({value:n,pointer:r,schema:e});const[i,s,...o]=n.split("@");if(!i||!s||o.length!==0||i.length>64||s.length>253)return t.errors.formatEmailError({value:n,pointer:r,schema:e});if(i[0]==="."||i.endsWith(".")||i.includes(".."))return t.errors.formatEmailError({value:n,pointer:r,schema:e});if(!/^[a-z0-9.-]+$/i.test(s)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(i))return t.errors.formatEmailError({value:n,pointer:r,schema:e});if(!s.split(".").every(a=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(a)))return t.errors.formatEmailError({value:n,pointer:r,schema:e})},"idn-email":(t,e,n,r)=>{if(!(typeof n!="string"||n===""))try{bbe.parse(n);return}catch{return t.errors.formatEmailError({value:n,pointer:r,schema:e})}},hostname:(t,e,n,r)=>{if(typeof n=="string"&&!(n===""||xbe.test(n)))return t.errors.formatHostnameError({value:n,pointer:r,schema:e})},ipv4:(t,e,n,r)=>{if(!(typeof n!="string"||n==="")){if(n&&n[0]==="0")return t.errors.formatIPV4LeadingZeroError({value:n,pointer:r,schema:e});if(!(n.length<=15&&vbe.test(n)))return t.errors.formatIPV4Error({value:n,pointer:r,schema:e})}},ipv6:(t,e,n,r)=>{if(!(typeof n!="string"||n==="")){if(n&&n[0]==="0")return t.errors.formatIPV6LeadingZeroError({value:n,pointer:r,schema:e});if(!(n.length<=45&&wbe.test(n)))return t.errors.formatIPV6Error({value:n,pointer:r,schema:e})}},"json-pointer":(t,e,n,r)=>{if(!(typeof n!="string"||n==="")&&!Cbe.test(n))return t.errors.formatJsonPointerError({value:n,pointer:r,schema:e})},"relative-json-pointer":(t,e,n,r)=>{if(!(typeof n!="string"||n==="")&&!Abe.test(n))return t.errors.formatJsonPointerError({value:n,pointer:r,schema:e})},regex:(t,e,n,r)=>{if(typeof n=="string"&&/\\Z$/.test(n)===!1){try{new RegExp(n);return}catch{}return t.errors.formatRegExError({value:n,pointer:r,schema:e})}if(!(typeof n=="object"||typeof n=="number"||Array.isArray(n)))return t.errors.formatRegExError({value:n,pointer:r,schema:e})},time:(t,e,n,r)=>typeof n!="string"||n===""||n.match(Sbe)?void 0:t.errors.formatDateTimeError({value:n,pointer:r,schema:e}),uri:(t,e,n,r)=>{if(!(typeof n!="string"||n==="")&&!Q9.isUri(n))return t.errors.formatURIError({value:n,pointer:r,schema:e})},"uri-reference":(t,e,n,r)=>{if(!(typeof n!="string"||n==="")&&!Ebe.test(n))return t.errors.formatURIReferenceError({value:n,pointer:r,schema:e})},"uri-template":(t,e,n,r)=>{if(!(typeof n!="string"||n==="")&&!Tbe.test(n))return t.errors.formatURITemplateError({value:n,pointer:r,schema:e})},url:(t,e,n,r)=>{if(!(n===""||Q9.isWebUri(n)))return t.errors.formatURLError({value:n,pointer:r,schema:e})}},SV={};function kV(t,e=SV){const{pointer:n="#",data:r,schema:i=t.rootSchema,withSchemaWarning:s=!1}=e,o=A1.split(n),a=CV(t,t.resolveRef(i),o,"#",r);if(!(!s&&a?.code==="schema-warning"))return a}function CV(t,e,n,r,i=SV){if(n.length===0)return t.resolveRef(e);const s=n.shift();return e=t.step(s,e,i,r),Ei(e)?e:(i=i[s],CV(t,e,n,`${r}/${s}`,i))}function Dbe(t){switch(Gt(t)){case"string":case"array":return t?.length===0;case"null":case"undefined":return!0;case"object":return Object.keys(t).length===0;default:return!1}}const j9=V0.templateDefaultOptions;let yu;function u3(t,e){const{$ref:n}=t;return n==null?!0:(yu[e]==null||yu[e][n]==null?0:yu[e][n])0){if(u3(e.anyOf[0],`${r}/anyOf/0`)){const o=q9(t,e.anyOf[0],`${r}/anyOf/0`);s=mE(s,o),s.pointer=e.anyOf[0].$ref||s.pointer}delete s.anyOf}if(Array.isArray(e.allOf)&&e.allOf.map((a,l)=>u3(a,`${r}/allOf/${l}`)).reduceRight((a,l)=>a&&l,!0)){const a=[];let l=z2(n);for(let c=0;ct&&typeof t=="object";function Wo(t,e,n,r,i){var s;if(n==null)throw new Error(`getTemplate: missing schema for data: ${JSON.stringify(e)}`);if(r==null)throw new Error("Missing pointer");let o=AV(t,n,e,r,i);if(!V9(o))return;if(r=o.pointer,o?.const)return o.const;if(Array.isArray(o.oneOf))if(Dbe(e)){const c=o.oneOf[0].type||o.type||o.const&&typeof o.const||Gt(e);o={...o.oneOf[0],type:c}}else{const c=pE(t,e,o);if(Ei(c)){if(e!=null&&i.removeInvalidData!==!0)return e;o=o.oneOf[0],e=void 0}else c.type=(s=c.type)!==null&&s!==void 0?s:o.type,o=c}if(!V9(o)||o.type==null)return;if(e instanceof File)return e;const a=Array.isArray(o.type)?Rbe(o.type,e,o.default):o.type,l=Gt(e);return e!=null&&l!==a&&!(l==="number"&&a==="integer")&&(e=Pbe(a,e)),Z9[a]==null?i.removeInvalidData?void 0:e:Z9[a](t,o,e,r,i)}function Rbe(t,e,n){if(e==null){if(n!=null){const i=Gt(n);if(t.includes(i))return i}return t[0]}const r=Gt(e);return t.includes(r)?r:t[0]}const Z9={null:(t,e,n)=>Sm(e,n,null),string:(t,e,n)=>Sm(e,n,""),number:(t,e,n)=>Sm(e,n,0),integer:(t,e,n)=>Sm(e,n,0),boolean:(t,e,n)=>Sm(e,n,!1),object:(t,e,n,r,i)=>{var s;const o=e.default===void 0?{}:e.default,a={},l=i.extendDefaults===!1&&e.default!==void 0?[]:(s=e.required)!==null&&s!==void 0?s:[];e.properties&&Object.keys(e.properties).forEach(f=>{const h=n==null||n[f]==null?o[f]:n[f],d=l.includes(f);(h!=null||d||i.addOptionalProps)&&(a[f]=Wo(t,h,e.properties[f],`${r}/properties/${f}`,i))});let u=pV(t,e,a);if(u){u=Ui(e,u),delete u.dependencies;const f=Wo(t,n,u,`${r}/dependencies`,i);Object.assign(a,f)}n&&(i.removeInvalidData===!0&&(e.additionalProperties===!1||Gt(e.additionalProperties)==="object")?Gt(e.additionalProperties)==="object"&&Object.keys(n).forEach(f=>{a[f]==null&&t.isValid(n[f],e.additionalProperties)&&(a[f]=n[f])}):Object.keys(n).forEach(f=>a[f]==null&&(a[f]=n[f])));const c=jx(t,e,a);if(c){const f=Wo(t,a,{type:"object",...c},r,i);Object.assign(a,f)}return a},array:(t,e,n,r,i)=>{var s,o;if(e.items==null)return n||[];const a=e.default===void 0?[]:e.default,l=n||a,u=i.extendDefaults===!1&&e.default!==void 0?0:e.minItems||0;if(Array.isArray(e.items)){for(let f=0,h=Math.max(u??0,(o=(s=e.items)===null||s===void 0?void 0:s.length)!==null&&o!==void 0?o:0);f0){const f=Math.max(u,l.length);for(let h=0;h(yu={},r?Wo(t,e,n,"#",{...j9,...r}):Wo(t,e,n,"#",j9));function TV(t,e,n=t.rootSchema,r="#"){return t.validate(e,n,r).length===0}function X9(t){const e=[];let n=0;const r=t.length;for(;n=55296&&i<=56319&&n!(t[e]===void 0||!$be.call(t,e)),PV={additionalProperties:(t,e,n,r)=>{if(e.additionalProperties===!0||e.additionalProperties==null||Gt(e.patternProperties)==="object"&&e.additionalProperties===!1)return;const i=[];let s=Object.keys(n).filter(a=>V0.propertyBlacklist.includes(a)===!1);const o=Object.keys(e.properties||{});if(Gt(e.patternProperties)==="object"){const a=Object.keys(e.patternProperties).map(l=>new RegExp(l));s=s.filter(l=>{for(let u=0;u{const i=Gt(n);if(i==="object"||i==="array"){const s=JSON.stringify(n);for(let o=0;o{if(t.validateFormat[e.format])return t.validateFormat[e.format](t,e,n,r)},items:(t,e,n,r)=>{if(e.items===!1)return Array.isArray(n)&&n.length===0?void 0:t.errors.invalidDataError({pointer:r,value:n,schema:e});const i=[];for(let s=0;s{if(!isNaN(e.maximum)){if(e.maximum&&e.maximum{if(!isNaN(e.maxItems)&&e.maxItems{if(isNaN(e.maxLength))return;const i=X9(n).length;if(e.maxLength{const i=Object.keys(n).length;if(isNaN(e.maxProperties)===!1&&e.maxProperties{if(isNaN(e.minLength))return;const i=X9(n).length;if(e.minLength>i)return e.minLength===1?t.errors.minLengthOneError({minLength:e.minLength,length:i,pointer:r,schema:e,value:n}):t.errors.minLengthError({minLength:e.minLength,length:i,pointer:r,schema:e,value:n})},minimum:(t,e,n,r)=>{if(!isNaN(e.minimum)){if(e.minimum>n)return t.errors.minimumError({minimum:e.minimum,length:n,pointer:r,schema:e,value:n});if(e.exclusiveMinimum===!0&&e.minimum===n)return t.errors.minimumError({minimum:e.minimum,length:n,pointer:r,schema:e,value:n})}},minItems:(t,e,n,r)=>{if(!isNaN(e.minItems)&&e.minItems>n.length)return e.minItems===1?t.errors.minItemsOneError({minItems:e.minItems,length:n.length,pointer:r,schema:e,value:n}):t.errors.minItemsError({minItems:e.minItems,length:n.length,pointer:r,schema:e,value:n})},minProperties:(t,e,n,r)=>{if(isNaN(e.minProperties))return;const i=Object.keys(n).length;if(e.minProperties>i)return t.errors.minPropertiesError({minProperties:e.minProperties,length:i,pointer:r,schema:e,value:n})},multipleOf:(t,e,n,r)=>{if(isNaN(e.multipleOf)||typeof n!="number")return;const i=W9(n),s=W9(e.multipleOf);if(i>s)return t.errors.multipleOfError({multipleOf:e.multipleOf,value:n,pointer:r,schema:e});const o=Math.pow(10,s),a=Math.round(n*o),l=Math.round(e.multipleOf*o);if(a%l/o!==0)return t.errors.multipleOfError({multipleOf:e.multipleOf,value:n,pointer:r,schema:e})},not:(t,e,n,r)=>{const i=[];return t.validate(n,e.not,r).length===0&&i.push(t.errors.notError({value:n,not:e.not,pointer:r,schema:e})),i},oneOf:$1e,pattern:(t,e,n,r)=>{if(new RegExp(e.pattern,"u").test(n)===!1)return t.errors.patternError({pattern:e.pattern,description:e.patternExample||e.pattern,received:n,schema:e,value:n,pointer:r})},patternProperties:(t,e,n,r)=>{const i=e.properties||{},s=e.patternProperties;if(Gt(s)!=="object")return;const o=[],a=Object.keys(n),l=Object.keys(s).map(u=>({regex:new RegExp(u),patternSchema:s[u]}));return a.forEach(u=>{let c=!1;for(let f=0,h=l.length;f0&&o.push(...d)}i[u]||c===!1&&e.additionalProperties===!1&&o.push(t.errors.patternPropertiesError({key:u,pointer:r,schema:e,value:n,patterns:Object.keys(s).join(",")}))}),o},properties:(t,e,n,r)=>{const i=[],s=Object.keys(e.properties||{});for(let o=0;o{const i=[],s=Object.keys(e.properties||{});for(let o=0;o{if(Array.isArray(e.required)!==!1)return e.required.map(i=>{if(!G9(n,i))return t.errors.requiredPropertyError({key:i,pointer:r,schema:e,value:n})})},requiredNotEmpty:(t,e,n,r)=>{if(Array.isArray(e.required)!==!1)return e.required.map(i=>{if(n[i]==null||n[i]==="")return t.errors.valueNotEmptyError({property:i,pointer:`${r}/${i}`,schema:e,value:n})})},uniqueItems:(t,e,n,r)=>{if((Array.isArray(n)&&e.uniqueItems)===!1)return;const i=[],s=[];return n.forEach((o,a)=>{for(let l=a+1;le.properties[n]=Ha(t[n]))),e.type==="array"&&Array.isArray(t)&&(t.length===1?e.items=Ha(t[0]):e.items=t.map(Ha)),e}const Mbe={array:(t,e,n,r,i)=>{const s=r?.[e],o=Gt(n.items);if(o==="object")return A9(t,n.items,s,`${i}/${e}`)||t.resolveRef(n.items);if(o==="array"){if(n.items[e]===!0)return Ha(s);if(n.items[e]===!1)return t.errors.invalidDataError({key:e,value:s,pointer:i,schema:n});if(n.items[e])return t.resolveRef(n.items[e]);if(n.additionalItems===!1)return t.errors.additionalItemsError({key:e,value:s,pointer:i,schema:n});if(n.additionalItems===!0||n.additionalItems===void 0)return Ha(s);if(Gt(n.additionalItems)==="object")return n.additionalItems;throw new Error(`Invalid schema ${JSON.stringify(n,null,2)} for ${JSON.stringify(r,null,2)}`)}return n.additionalItems!==!1&&s?Ha(s):new Error(`Invalid array schema for ${e} at ${i}`)},object:(t,e,n,r,i)=>{var s;n=A9(t,n,r,i);const o=(s=n?.properties)===null||s===void 0?void 0:s[e];if(o!==void 0){if(o===!1)return t.errors.forbiddenPropertyError({property:e,value:r,pointer:i,schema:n});if(o===!0)return Ha(r?.[e]);const u=t.resolveRef(o);if(Ei(u))return u;if(u&&Array.isArray(u.oneOf)){const c=t.resolveOneOf(r[e],u,`${i}/${e}`);for(const f in u)f!=="oneOf"&&c[f]===void 0&&(c[f]=u[f]);return c}if(u)return u}const{patternProperties:a}=n;if(Gt(a)==="object"){let u;const c=Object.keys(a);for(let f=0,h=c.length;ft.resolveRef(s));if(!((r=n.items)===null||r===void 0)&&r.oneOf)return n.items.oneOf.map(s=>t.resolveRef(s));const i=t.step(e,n,{},"#");return Ei(i)?i:[i]}const Lbe={array:(t,e,n,r)=>t.typeKeywords.array.filter(i=>e&&e[i]!=null).map(i=>t.validateKeyword[i](t,e,n,r)),object:(t,e,n,r)=>t.typeKeywords.object.filter(i=>e&&e[i]!=null).map(i=>t.validateKeyword[i](t,e,n,r)),string:(t,e,n,r)=>t.typeKeywords.string.filter(i=>e&&e[i]!=null).map(i=>t.validateKeyword[i](t,e,n,r)),integer:(t,e,n,r)=>t.typeKeywords.number.filter(i=>e&&e[i]!=null).map(i=>t.validateKeyword[i](t,e,n,r)),number:(t,e,n,r)=>t.typeKeywords.number.filter(i=>e&&e[i]!=null).map(i=>t.validateKeyword[i](t,e,n,r)),boolean:(t,e,n,r)=>t.typeKeywords.boolean.filter(i=>e&&e[i]!=null).map(i=>t.validateKeyword[i](t,e,n,r)),null:(t,e,n,r)=>t.typeKeywords.null.filter(i=>e&&e[i]!=null).map(i=>t.validateKeyword[i](t,e,n,r))};function Nbe(t,e){const n=Gt(t);return n==="number"&&(e==="integer"||Array.isArray(e)&&e.includes("integer"))?Number.isInteger(t)||isNaN(t)?"integer":"number":n}function FV(t,e,n=t.rootSchema,r="#"){if(n=t.resolveRef(n),Gt(n)==="boolean")return n?[]:[t.errors.invalidDataError({pointer:r,schema:n,value:e})];if(Ei(n))return[n];if(n.const!==void 0)return DV(n.const,e)?[]:[t.errors.constError({pointer:r,schema:n,value:e,expected:n.const})];const i=Nbe(e,n.type),s=n.type||i;return i!==s&&(!Array.isArray(s)||!s.includes(i))?[t.errors.typeError({pointer:r,schema:n,value:e,received:i,expected:s})]:t.validateType[i]==null?[t.errors.invalidTypeError({pointer:r,schema:n,value:e,receivedType:i})]:k1(t.validateType[i](t,n,e,r)).filter(B2)}const Qbe={typeKeywords:{array:["allOf","anyOf","enum","items","maxItems","minItems","not","oneOf","uniqueItems"],boolean:["enum","not","allOf","anyOf","oneOf"],object:["additionalProperties","dependencies","enum","format","minProperties","maxProperties","patternProperties","properties","required","not","oneOf","allOf","anyOf"],string:["allOf","anyOf","enum","format","maxLength","minLength","not","oneOf","pattern"],number:["allOf","anyOf","enum","format","maximum","minimum","multipleOf","not","oneOf"],null:["allOf","anyOf","enum","format","not","oneOf"]},validateKeyword:PV,validateType:Lbe,validateFormat:_V,errors:xV,addRemoteSchema:bV,compileSchema:fbe,createSchemaOf:Ha,each:wV,eachSchema:qx,getChildSchemaSelection:IV,getSchema:kV,getTemplate:EV,isValid:TV,resolveAllOf:fV,resolveAnyOf:gV,resolveOneOf:Kq,resolveRef:dV,step:RV,validate:FV,templateDefaultOptions:V0.templateDefaultOptions};class $V extends yV{constructor(e,n={}){super(mE(Qbe,n),e)}}const H9="__compiled",K9="__ref",Bbe="getRef",zbe="getRoot",Ube=/(#|\/)+$/g;function jbe(t,e,n=e,r=!1){if(e===!0||e===!1||e===void 0||e[H9]!==void 0)return e;const i={ids:{},remotes:t.remotes},s=JSON.stringify(e),o=JSON.parse(s);if(Object.defineProperty(o,H9,{enumerable:!1,value:!0}),Object.defineProperty(o,Bbe,{enumerable:!1,value:ou.bind(null,i,o)}),r===!1&&s.includes("$ref")===!1)return o;o!==n&&Object.defineProperty(o,"$defs",{enumerable:!0,value:Object.assign({},n.definitions,n.$defs,o.definitions,o.$defs)});const a={},l=()=>o;return qx(o,(u,c)=>{var f;if(u.$id){if(u.$id.startsWith("http")&&/(allOf|anyOf|oneOf)\/\d+$/.test(c)){const g=c.replace(/\/(allOf|anyOf|oneOf)\/\d+$/,""),y=Kf.get(o,g);u.$id=(f=y.$id)!==null&&f!==void 0?f:u.$id}i.ids[u.$id.replace(Ube,"")]=c}c=`#${c}`.replace(/##+/,"#");const h=c.replace(/\/[^/]+$/,""),d=c.replace(/\/[^/]+\/[^/]+$/,""),p=a[h]||a[d],m=V2(p,u.$id);a[c]=m,i.ids[m]==null&&(i.ids[m]=c),u.$ref&&!u[K9]&&(Object.defineProperty(u,K9,{enumerable:!1,value:V2(m,u.$ref)}),Object.defineProperty(u,zbe,{enumerable:!1,value:l}))}),o}const qbe={...PV,contains:(t,e,n,r)=>{if(e.contains===!1)return t.errors.containsArrayError({pointer:r,value:n,schema:e});if(e.contains===!0)return Array.isArray(n)&&n.length===0?t.errors.containsAnyError({pointer:r,value:n,schema:e}):void 0;if(Gt(e.contains)==="object"){for(let i=0;i{if(!isNaN(e.exclusiveMaximum)&&e.exclusiveMaximum<=n)return t.errors.maximumError({maximum:e.exclusiveMaximum,length:n,pointer:r,schema:e,value:n})},exclusiveMinimum:(t,e,n,r)=>{if(!isNaN(e.exclusiveMinimum)&&e.exclusiveMinimum>=n)return t.errors.minimumError({minimum:e.exclusiveMinimum,length:n,pointer:r,schema:e,value:n})},if:vye,maximum:(t,e,n,r)=>{if(!isNaN(e.maximum)&&e.maximum&&e.maximum{if(!isNaN(e.minimum)&&e.minimum>n)return t.errors.minimumError({minimum:e.minimum,length:n,pointer:r,schema:e,value:n})},patternProperties:(t,e,n,r)=>{const i=e.properties||{},s=e.patternProperties;if(Gt(s)!=="object")return;const o=[],a=Object.keys(n),l=Object.keys(s).map(u=>({regex:new RegExp(u),patternSchema:s[u]}));return a.forEach(u=>{let c=!1;for(let f=0,h=l.length;f0&&o.push(...d)}i[u]||c===!1&&e.additionalProperties===!1&&o.push(t.errors.patternPropertiesError({key:u,pointer:r,patterns:Object.keys(s).join(","),schema:e,value:n}))}),o},propertyNames:(t,e,n,r)=>{if(e.propertyNames===!1)return Object.keys(n).length===0?void 0:t.errors.invalidPropertyNameError({property:Object.keys(n),pointer:r,value:n,schema:e});if(e.propertyNames===!0||Gt(e.propertyNames)!=="object")return;const i=[],s=Object.keys(n),o={...e.propertyNames,type:"string"};return s.forEach(a=>{const l=t.validate(a,o,`${r}/${a}`);l.length>0&&i.push(t.errors.invalidPropertyNameError({property:a,pointer:r,validationError:l[0],value:n[a],schema:e}))}),i}},Vbe={array:(t,e,n,r)=>t.typeKeywords.array.filter(i=>e&&e[i]!=null).map(i=>t.validateKeyword[i](t,e,n,r)),object:(t,e,n,r)=>t.typeKeywords.object.filter(i=>e&&e[i]!=null).map(i=>t.validateKeyword[i](t,e,n,r)),string:(t,e,n,r)=>t.typeKeywords.string.filter(i=>e&&e[i]!=null).map(i=>t.validateKeyword[i](t,e,n,r)),integer:(t,e,n,r)=>t.typeKeywords.number.filter(i=>e&&e[i]!=null).map(i=>t.validateKeyword[i](t,e,n,r)),number:(t,e,n,r)=>t.typeKeywords.number.filter(i=>e&&e[i]!=null).map(i=>t.validateKeyword[i](t,e,n,r)),boolean:(t,e,n,r)=>t.typeKeywords.boolean.filter(i=>e&&e[i]!=null).map(i=>t.validateKeyword[i](t,e,n,r)),null:(t,e,n,r)=>t.typeKeywords.null.filter(i=>e&&e[i]!=null).map(i=>t.validateKeyword[i](t,e,n,r))},MV={typeKeywords:{array:["allOf","anyOf","contains","enum","if","items","maxItems","minItems","not","oneOf","uniqueItems"],boolean:["allOf","anyOf","enum","not","oneOf"],object:["additionalProperties","allOf","anyOf","dependencies","enum","format","if","maxProperties","minProperties","not","oneOf","patternProperties","properties","propertyNames","required"],string:["allOf","anyOf","enum","format","if","maxLength","minLength","not","oneOf","pattern"],number:["allOf","anyOf","enum","exclusiveMaximum","exclusiveMinimum","format","if","maximum","minimum","multipleOf","not","oneOf"],null:["allOf","anyOf","enum","format","not","oneOf"]},validateKeyword:qbe,validateType:Vbe,validateFormat:_V,errors:xV,addRemoteSchema:bV,compileSchema:jbe,createSchemaOf:Ha,each:wV,eachSchema:qx,getChildSchemaSelection:IV,getSchema:kV,getTemplate:EV,isValid:TV,resolveAllOf:fV,resolveAnyOf:gV,resolveOneOf:Kq,resolveRef:dV,step:RV,validate:FV,templateDefaultOptions:V0.templateDefaultOptions};class LV extends yV{constructor(e,n={}){super(mE(MV,n),e)}}({...MV});function Ua(t,e,n=[]){const r=document.createElement(t);return Object.entries(e).forEach(([i,s])=>{if(i==="text"){r.innerText=s;return}if(i==="inner"){r.innerHTML=s;return}r.setAttribute(i,s)}),n.forEach(i=>r.appendChild(i)),r}const Zbe="modulepreload",Xbe=function(t,e){return new URL(t,e).href},J9={},f3=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let u=function(c){return Promise.all(c.map(f=>Promise.resolve(f).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};const o=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),l=a?.nonce||a?.getAttribute("nonce");i=u(n.map(c=>{if(c=Xbe(c,r),c in J9)return;J9[c]=!0;const f=c.endsWith(".css"),h=f?'[rel="stylesheet"]':"";if(r)for(let p=o.length-1;p>=0;p--){const m=o[p];if(m.href===c&&(!f||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${c}"]${h}`))return;const d=document.createElement("link");if(d.rel=f?"stylesheet":Zbe,f||(d.as="script"),d.crossOrigin="",d.href=c,l&&d.setAttribute("nonce",l),document.head.appendChild(d),f)return new Promise((p,m)=>{d.addEventListener("load",p),d.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})},eR={};function Wbe(t){let e=eR[t];if(e)return e;e=eR[t]=[];for(let n=0;n<128;n++){const r=String.fromCharCode(n);e.push(r)}for(let n=0;n=55296&&c<=57343?i+="���":i+=String.fromCharCode(c),s+=6;continue}}if((a&248)===240&&s+91114111?i+="����":(f-=65536,i+=String.fromCharCode(55296+(f>>10),56320+(f&1023))),s+=9;continue}}i+="�"}return i})}h0.defaultChars=";/?:@&=+$,#";h0.componentChars="";const tR={};function Ybe(t){let e=tR[t];if(e)return e;e=tR[t]=[];for(let n=0;n<128;n++){const r=String.fromCharCode(n);/^[0-9a-z]$/i.test(r)?e.push(r):e.push("%"+("0"+n.toString(16).toUpperCase()).slice(-2))}for(let n=0;n"u"&&(n=!0);const r=Ybe(e);let i="";for(let s=0,o=t.length;s=55296&&a<=57343){if(a>=55296&&a<=56319&&s+1=56320&&l<=57343){i+=encodeURIComponent(t[s]+t[s+1]),s++;continue}}i+="%EF%BF%BD";continue}i+=encodeURIComponent(t[s])}return i}wy.defaultChars=";/?:@&=+$,-_.!~*'()#";wy.componentChars="-_.!~*'()";function vE(t){let e="";return e+=t.protocol||"",e+=t.slashes?"//":"",e+=t.auth?t.auth+"@":"",t.hostname&&t.hostname.indexOf(":")!==-1?e+="["+t.hostname+"]":e+=t.hostname||"",e+=t.port?":"+t.port:"",e+=t.pathname||"",e+=t.search||"",e+=t.hash||"",e}function Z2(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}const Gbe=/^([a-z0-9.+-]+:)/i,Hbe=/:[0-9]*$/,Kbe=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Jbe=["<",">",'"',"`"," ","\r",` `," "],eOe=["{","}","|","\\","^","`"].concat(Jbe),tOe=["'"].concat(eOe),nR=["%","/","?",";","#"].concat(tOe),rR=["/","?","#"],nOe=255,iR=/^[+a-z0-9A-Z_-]{0,63}$/,rOe=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,sR={javascript:!0,"javascript:":!0},oR={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function wE(t,e){if(t&&t instanceof Z2)return t;const n=new Z2;return n.parse(t,e),n}Z2.prototype.parse=function(t,e){let n,r,i,s=t;if(s=s.trim(),!e&&t.split("#").length===1){const u=Kbe.exec(s);if(u)return this.pathname=u[1],u[2]&&(this.search=u[2]),this}let o=Gbe.exec(s);if(o&&(o=o[0],n=o.toLowerCase(),this.protocol=o,s=s.substr(o.length)),(e||o||s.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=s.substr(0,2)==="//",i&&!(o&&sR[o])&&(s=s.substr(2),this.slashes=!0)),!sR[o]&&(i||o&&!oR[o])){let u=-1;for(let p=0;p127?O+="x":O+=y[v];if(!O.match(iR)){const v=p.slice(0,m),w=p.slice(m+1),x=y.match(rOe);x&&(v.push(x[1]),w.unshift(x[2])),w.length&&(s=w.join(".")+s),this.hostname=v.join(".");break}}}}this.hostname.length>nOe&&(this.hostname=""),d&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}const a=s.indexOf("#");a!==-1&&(this.hash=s.substr(a),s=s.slice(0,a));const l=s.indexOf("?");return l!==-1&&(this.search=s.substr(l),s=s.slice(0,l)),s&&(this.pathname=s),oR[n]&&this.hostname&&!this.pathname&&(this.pathname=""),this};Z2.prototype.parseHost=function(t){let e=Hbe.exec(t);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};const iOe=Object.freeze(Object.defineProperty({__proto__:null,decode:h0,encode:wy,format:vE,parse:wE},Symbol.toStringTag,{value:"Module"})),NV=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,QV=/[\0-\x1F\x7F-\x9F]/,sOe=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,xE=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,BV=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,zV=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,oOe=Object.freeze(Object.defineProperty({__proto__:null,Any:NV,Cc:QV,Cf:sOe,P:xE,S:BV,Z:zV},Symbol.toStringTag,{value:"Module"})),aOe=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(t=>t.charCodeAt(0))),lOe=new Uint16Array("Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map(t=>t.charCodeAt(0)));var h3;const uOe=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),cOe=(h3=String.fromCodePoint)!==null&&h3!==void 0?h3:function(t){let e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|t&1023),e+=String.fromCharCode(t),e};function fOe(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=uOe.get(t))!==null&&e!==void 0?e:t}var Hr;(function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.EQUALS=61]="EQUALS",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.LOWER_Z=122]="LOWER_Z",t[t.UPPER_A=65]="UPPER_A",t[t.UPPER_F=70]="UPPER_F",t[t.UPPER_Z=90]="UPPER_Z"})(Hr||(Hr={}));const hOe=32;var kc;(function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"})(kc||(kc={}));function h4(t){return t>=Hr.ZERO&&t<=Hr.NINE}function dOe(t){return t>=Hr.UPPER_A&&t<=Hr.UPPER_F||t>=Hr.LOWER_A&&t<=Hr.LOWER_F}function pOe(t){return t>=Hr.UPPER_A&&t<=Hr.UPPER_Z||t>=Hr.LOWER_A&&t<=Hr.LOWER_Z||h4(t)}function mOe(t){return t===Hr.EQUALS||pOe(t)}var Vr;(function(t){t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity"})(Vr||(Vr={}));var Oc;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute"})(Oc||(Oc={}));class gOe{constructor(e,n,r){this.decodeTree=e,this.emitCodePoint=n,this.errors=r,this.state=Vr.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Oc.Strict}startEntity(e){this.decodeMode=e,this.state=Vr.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,n){switch(this.state){case Vr.EntityStart:return e.charCodeAt(n)===Hr.NUM?(this.state=Vr.NumericStart,this.consumed+=1,this.stateNumericStart(e,n+1)):(this.state=Vr.NamedEntity,this.stateNamedEntity(e,n));case Vr.NumericStart:return this.stateNumericStart(e,n);case Vr.NumericDecimal:return this.stateNumericDecimal(e,n);case Vr.NumericHex:return this.stateNumericHex(e,n);case Vr.NamedEntity:return this.stateNamedEntity(e,n)}}stateNumericStart(e,n){return n>=e.length?-1:(e.charCodeAt(n)|hOe)===Hr.LOWER_X?(this.state=Vr.NumericHex,this.consumed+=1,this.stateNumericHex(e,n+1)):(this.state=Vr.NumericDecimal,this.stateNumericDecimal(e,n))}addToNumericResult(e,n,r,i){if(n!==r){const s=r-n;this.result=this.result*Math.pow(i,s)+parseInt(e.substr(n,s),i),this.consumed+=s}}stateNumericHex(e,n){const r=n;for(;n>14;for(;n>14,s!==0){if(o===Hr.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==Oc.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;const{result:n,decodeTree:r}=this,i=(r[n]&kc.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,i,this.consumed),(e=this.errors)===null||e===void 0||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,n,r){const{decodeTree:i}=this;return this.emitCodePoint(n===1?i[e]&~kc.VALUE_LENGTH:i[e+1],r),n===3&&this.emitCodePoint(i[e+2],r),r}end(){var e;switch(this.state){case Vr.NamedEntity:return this.result!==0&&(this.decodeMode!==Oc.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Vr.NumericDecimal:return this.emitNumericEntity(0,2);case Vr.NumericHex:return this.emitNumericEntity(0,3);case Vr.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Vr.EntityStart:return 0}}}function UV(t){let e="";const n=new gOe(t,r=>e+=cOe(r));return function(i,s){let o=0,a=0;for(;(a=i.indexOf("&",a))>=0;){e+=i.slice(o,a),n.startEntity(s);const u=n.write(i,a+1);if(u<0){o=a+n.end();break}o=a+u,a=u===0?o+1:o}const l=e+i.slice(o);return e="",l}}function yOe(t,e,n,r){const i=(e&kc.BRANCH_LENGTH)>>7,s=e&kc.JUMP_TABLE;if(i===0)return s!==0&&r===s?n:-1;if(s){const l=r-s;return l<0||l>=i?-1:t[n+l]-1}let o=n,a=o+i-1;for(;o<=a;){const l=o+a>>>1,u=t[l];if(ur)a=l-1;else return t[l+i]}return-1}const bOe=UV(aOe);UV(lOe);function jV(t,e=Oc.Legacy){return bOe(t,e)}function OOe(t){return Object.prototype.toString.call(t)}function _E(t){return OOe(t)==="[object String]"}const vOe=Object.prototype.hasOwnProperty;function wOe(t,e){return vOe.call(t,e)}function Vx(t){return Array.prototype.slice.call(arguments,1).forEach(function(n){if(n){if(typeof n!="object")throw new TypeError(n+"must be object");Object.keys(n).forEach(function(r){t[r]=n[r]})}}),t}function qV(t,e,n){return[].concat(t.slice(0,e),n,t.slice(e+1))}function SE(t){return!(t>=55296&&t<=57343||t>=64976&&t<=65007||(t&65535)===65535||(t&65535)===65534||t>=0&&t<=8||t===11||t>=14&&t<=31||t>=127&&t<=159||t>1114111)}function X2(t){if(t>65535){t-=65536;const e=55296+(t>>10),n=56320+(t&1023);return String.fromCharCode(e,n)}return String.fromCharCode(t)}const VV=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,xOe=/&([a-z#][a-z0-9]{1,31});/gi,_Oe=new RegExp(VV.source+"|"+xOe.source,"gi"),SOe=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function kOe(t,e){if(e.charCodeAt(0)===35&&SOe.test(e)){const r=e[1].toLowerCase()==="x"?parseInt(e.slice(2),16):parseInt(e.slice(1),10);return SE(r)?X2(r):t}const n=jV(t);return n!==t?n:t}function COe(t){return t.indexOf("\\")<0?t:t.replace(VV,"$1")}function d0(t){return t.indexOf("\\")<0&&t.indexOf("&")<0?t:t.replace(_Oe,function(e,n,r){return n||kOe(e,r)})}const AOe=/[&<>"]/,EOe=/[&<>"]/g,TOe={"&":"&","<":"<",">":">",'"':"""};function DOe(t){return TOe[t]}function lf(t){return AOe.test(t)?t.replace(EOe,DOe):t}const POe=/[.?*+^$[\]\\(){}|-]/g;function ROe(t){return t.replace(POe,"\\$&")}function Nn(t){switch(t){case 9:case 32:return!0}return!1}function E1(t){if(t>=8192&&t<=8202)return!0;switch(t){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function T1(t){return xE.test(t)||BV.test(t)}function D1(t){switch(t){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function Zx(t){return t=t.trim().replace(/\s+/g," "),"ẞ".toLowerCase()==="Ṿ"&&(t=t.replace(/ẞ/g,"ß")),t.toLowerCase().toUpperCase()}const IOe={mdurl:iOe,ucmicro:oOe},FOe=Object.freeze(Object.defineProperty({__proto__:null,arrayReplaceAt:qV,assign:Vx,escapeHtml:lf,escapeRE:ROe,fromCodePoint:X2,has:wOe,isMdAsciiPunct:D1,isPunctChar:T1,isSpace:Nn,isString:_E,isValidEntityCode:SE,isWhiteSpace:E1,lib:IOe,normalizeReference:Zx,unescapeAll:d0,unescapeMd:COe},Symbol.toStringTag,{value:"Module"}));function $Oe(t,e,n){let r,i,s,o;const a=t.posMax,l=t.pos;for(t.pos=e+1,r=1;t.pos32))return s;if(r===41){if(o===0)break;o--}i++}return e===i||o!==0||(s.str=d0(t.slice(e,i)),s.pos=i,s.ok=!0),s}function LOe(t,e,n,r){let i,s=e;const o={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(r)o.str=r.str,o.marker=r.marker;else{if(s>=n)return o;let a=t.charCodeAt(s);if(a!==34&&a!==39&&a!==40)return o;e++,s++,a===40&&(a=41),o.marker=a}for(;s"+lf(s.content)+""};Ql.code_block=function(t,e,n,r,i){const s=t[e];return""+lf(t[e].content)+` `};Ql.fence=function(t,e,n,r,i){const s=t[e],o=s.info?d0(s.info).trim():"";let a="",l="";if(o){const c=o.split(/(\s+)/g);a=c[0],l=c.slice(2).join("")}let u;if(n.highlight?u=n.highlight(s.content,a,l)||lf(s.content):u=lf(s.content),u.indexOf("${u} `}return`
${u}
`};Ql.image=function(t,e,n,r,i){const s=t[e];return s.attrs[s.attrIndex("alt")][1]=i.renderInlineAsText(s.children,n,r),i.renderToken(t,e,n)};Ql.hardbreak=function(t,e,n){return n.xhtmlOut?`
`:`
`};Ql.softbreak=function(t,e,n){return n.breaks?n.xhtmlOut?`
`:`
`:` `};Ql.text=function(t,e){return lf(t[e].content)};Ql.html_block=function(t,e){return t[e].content};Ql.html_inline=function(t,e){return t[e].content};function Z0(){this.rules=Vx({},Ql)}Z0.prototype.renderAttrs=function(e){let n,r,i;if(!e.attrs)return"";for(i="",n=0,r=e.attrs.length;n `:">",s};Z0.prototype.renderInline=function(t,e,n){let r="";const i=this.rules;for(let s=0,o=t.length;s=0&&(r=this.attrs[n][1]),r};xa.prototype.attrJoin=function(e,n){const r=this.attrIndex(e);r<0?this.attrPush([e,n]):this.attrs[r][1]=this.attrs[r][1]+" "+n};function ZV(t,e,n){this.src=t,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=e}ZV.prototype.Token=xa;const QOe=/\r\n?|\n/g,BOe=/\0/g;function zOe(t){let e;e=t.src.replace(QOe,` `),e=e.replace(BOe,"�"),t.src=e}function UOe(t){let e;t.inlineMode?(e=new t.Token("inline","",0),e.content=t.src,e.map=[0,1],e.children=[],t.tokens.push(e)):t.md.block.parse(t.src,t.md,t.env,t.tokens)}function jOe(t){const e=t.tokens;for(let n=0,r=e.length;n\s]/i.test(t)}function VOe(t){return/^<\/a\s*>/i.test(t)}function ZOe(t){const e=t.tokens;if(t.md.options.linkify)for(let n=0,r=e.length;n=0;o--){const a=i[o];if(a.type==="link_close"){for(o--;i[o].level!==a.level&&i[o].type!=="link_open";)o--;continue}if(a.type==="html_inline"&&(qOe(a.content)&&s>0&&s--,VOe(a.content)&&s++),!(s>0)&&a.type==="text"&&t.md.linkify.test(a.content)){const l=a.content;let u=t.md.linkify.match(l);const c=[];let f=a.level,h=0;u.length>0&&u[0].index===0&&o>0&&i[o-1].type==="text_special"&&(u=u.slice(1));for(let d=0;dh){const x=new t.Token("text","",0);x.content=l.slice(h,y),x.level=f,c.push(x)}const O=new t.Token("link_open","a",1);O.attrs=[["href",m]],O.level=f++,O.markup="linkify",O.info="auto",c.push(O);const v=new t.Token("text","",0);v.content=g,v.level=f,c.push(v);const w=new t.Token("link_close","a",-1);w.level=--f,w.markup="linkify",w.info="auto",c.push(w),h=u[d].lastIndex}if(h=0;n--){const r=t[n];r.type==="text"&&!e&&(r.content=r.content.replace(WOe,GOe)),r.type==="link_open"&&r.info==="auto"&&e--,r.type==="link_close"&&r.info==="auto"&&e++}}function KOe(t){let e=0;for(let n=t.length-1;n>=0;n--){const r=t[n];r.type==="text"&&!e&&XV.test(r.content)&&(r.content=r.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1—").replace(/(^|\s)--(?=\s|$)/mg,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1–")),r.type==="link_open"&&r.info==="auto"&&e--,r.type==="link_close"&&r.info==="auto"&&e++}}function JOe(t){let e;if(t.md.options.typographer)for(e=t.tokens.length-1;e>=0;e--)t.tokens[e].type==="inline"&&(XOe.test(t.tokens[e].content)&&HOe(t.tokens[e].children),XV.test(t.tokens[e].content)&&KOe(t.tokens[e].children))}const eve=/['"]/,aR=/['"]/g,lR="’";function Pb(t,e,n){return t.slice(0,e)+n+t.slice(e+1)}function tve(t,e){let n;const r=[];for(let i=0;i=0&&!(r[n].level<=o);n--);if(r.length=n+1,s.type!=="text")continue;let a=s.content,l=0,u=a.length;e:for(;l=0)p=a.charCodeAt(c.index-1);else for(n=i-1;n>=0&&!(t[n].type==="softbreak"||t[n].type==="hardbreak");n--)if(t[n].content){p=t[n].content.charCodeAt(t[n].content.length-1);break}let m=32;if(l=48&&p<=57&&(h=f=!1),f&&h&&(f=g,h=y),!f&&!h){d&&(s.content=Pb(s.content,c.index,lR));continue}if(h)for(n=r.length-1;n>=0;n--){let w=r[n];if(r[n].level=0;e--)t.tokens[e].type!=="inline"||!eve.test(t.tokens[e].content)||tve(t.tokens[e].children,t)}function rve(t){let e,n;const r=t.tokens,i=r.length;for(let s=0;s0&&this.level++,this.tokens.push(r),r};Bl.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]};Bl.prototype.skipEmptyLines=function(e){for(let n=this.lineMax;en;)if(!Nn(this.src.charCodeAt(--e)))return e+1;return e};Bl.prototype.skipChars=function(e,n){for(let r=this.src.length;er;)if(n!==this.src.charCodeAt(--e))return e+1;return e};Bl.prototype.getLines=function(e,n,r,i){if(e>=n)return"";const s=new Array(n-e);for(let o=0,a=e;ar?s[o]=new Array(l-r+1).join(" ")+this.src.slice(c,f):s[o]=this.src.slice(c,f)}return s.join("")};Bl.prototype.Token=xa;const ive=65536;function p3(t,e){const n=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];return t.src.slice(n,r)}function uR(t){const e=[],n=t.length;let r=0,i=t.charCodeAt(r),s=!1,o=0,a="";for(;rn)return!1;let i=e+1;if(t.sCount[i]=4)return!1;let s=t.bMarks[i]+t.tShift[i];if(s>=t.eMarks[i])return!1;const o=t.src.charCodeAt(s++);if(o!==124&&o!==45&&o!==58||s>=t.eMarks[i])return!1;const a=t.src.charCodeAt(s++);if(a!==124&&a!==45&&a!==58&&!Nn(a)||o===45&&Nn(a))return!1;for(;s=4)return!1;u=uR(l),u.length&&u[0]===""&&u.shift(),u.length&&u[u.length-1]===""&&u.pop();const f=u.length;if(f===0||f!==c.length)return!1;if(r)return!0;const h=t.parentType;t.parentType="table";const d=t.md.block.ruler.getRules("blockquote"),p=t.push("table_open","table",1),m=[e,0];p.map=m;const g=t.push("thead_open","thead",1);g.map=[e,e+1];const y=t.push("tr_open","tr",1);y.map=[e,e+1];for(let w=0;w=4||(u=uR(l),u.length&&u[0]===""&&u.shift(),u.length&&u[u.length-1]===""&&u.pop(),v+=f-u.length,v>ive))break;if(i===e+2){const S=t.push("tbody_open","tbody",1);S.map=O=[e+2,0]}const x=t.push("tr_open","tr",1);x.map=[i,i+1];for(let S=0;S=4){r++,i=r;continue}break}t.line=i;const s=t.push("code_block","code",0);return s.content=t.getLines(e,i,4+t.blkIndent,!1)+` `,s.map=[e,t.line],!0}function ave(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||i+3>s)return!1;const o=t.src.charCodeAt(i);if(o!==126&&o!==96)return!1;let a=i;i=t.skipChars(i,o);let l=i-a;if(l<3)return!1;const u=t.src.slice(a,i),c=t.src.slice(i,s);if(o===96&&c.indexOf(String.fromCharCode(o))>=0)return!1;if(r)return!0;let f=e,h=!1;for(;f++,!(f>=n||(i=a=t.bMarks[f]+t.tShift[f],s=t.eMarks[f],i=4)&&(i=t.skipChars(i,o),!(i-a=4||t.src.charCodeAt(i)!==62)return!1;if(r)return!0;const a=[],l=[],u=[],c=[],f=t.md.block.ruler.getRules("blockquote"),h=t.parentType;t.parentType="blockquote";let d=!1,p;for(p=e;p=s)break;if(t.src.charCodeAt(i++)===62&&!v){let x=t.sCount[p]+1,S,_;t.src.charCodeAt(i)===32?(i++,x++,_=!1,S=!0):t.src.charCodeAt(i)===9?(S=!0,(t.bsCount[p]+x)%4===3?(i++,x++,_=!1):_=!0):S=!1;let k=x;for(a.push(t.bMarks[p]),t.bMarks[p]=i;i=s,l.push(t.bsCount[p]),t.bsCount[p]=t.sCount[p]+1+(S?1:0),u.push(t.sCount[p]),t.sCount[p]=k-x,c.push(t.tShift[p]),t.tShift[p]=i-t.bMarks[p];continue}if(d)break;let w=!1;for(let x=0,S=f.length;x";const y=[e,0];g.map=y,t.md.block.tokenize(t,e,p);const O=t.push("blockquote_close","blockquote",-1);O.markup=">",t.lineMax=o,t.parentType=h,y[1]=t.line;for(let v=0;v=4)return!1;let s=t.bMarks[e]+t.tShift[e];const o=t.src.charCodeAt(s++);if(o!==42&&o!==45&&o!==95)return!1;let a=1;for(;s=r)return-1;let s=t.src.charCodeAt(i++);if(s<48||s>57)return-1;for(;;){if(i>=r)return-1;if(s=t.src.charCodeAt(i++),s>=48&&s<=57){if(i-n>=10)return-1;continue}if(s===41||s===46)break;return-1}return i=4||t.listIndent>=0&&t.sCount[l]-t.listIndent>=4&&t.sCount[l]=t.blkIndent&&(c=!0);let f,h,d;if((d=fR(t,l))>=0){if(f=!0,o=t.bMarks[l]+t.tShift[l],h=Number(t.src.slice(o,d-1)),c&&h!==1)return!1}else if((d=cR(t,l))>=0)f=!1;else return!1;if(c&&t.skipSpaces(d)>=t.eMarks[l])return!1;if(r)return!0;const p=t.src.charCodeAt(d-1),m=t.tokens.length;f?(a=t.push("ordered_list_open","ol",1),h!==1&&(a.attrs=[["start",h]])):a=t.push("bullet_list_open","ul",1);const g=[l,0];a.map=g,a.markup=String.fromCharCode(p);let y=!1;const O=t.md.block.ruler.getRules("list"),v=t.parentType;for(t.parentType="list";l=i?_=1:_=x-w,_>4&&(_=1);const k=w+_;a=t.push("list_item_open","li",1),a.markup=String.fromCharCode(p);const C=[l,0];a.map=C,f&&(a.info=t.src.slice(o,d-1));const D=t.tight,A=t.tShift[l],E=t.sCount[l],T=t.listIndent;if(t.listIndent=t.blkIndent,t.blkIndent=k,t.tight=!0,t.tShift[l]=S-t.bMarks[l],t.sCount[l]=x,S>=i&&t.isEmpty(l+1)?t.line=Math.min(t.line+2,n):t.md.block.tokenize(t,l,n,!0),(!t.tight||y)&&(u=!1),y=t.line-l>1&&t.isEmpty(t.line-1),t.blkIndent=t.listIndent,t.listIndent=T,t.tShift[l]=A,t.sCount[l]=E,t.tight=D,a=t.push("list_item_close","li",-1),a.markup=String.fromCharCode(p),l=t.line,C[1]=l,l>=n||t.sCount[l]=4)break;let R=!1;for(let $=0,Q=O.length;$=4||t.src.charCodeAt(i)!==91)return!1;function a(O){const v=t.lineMax;if(O>=v||t.isEmpty(O))return null;let w=!1;if(t.sCount[O]-t.blkIndent>3&&(w=!0),t.sCount[O]<0&&(w=!0),!w){const _=t.md.block.ruler.getRules("reference"),k=t.parentType;t.parentType="reference";let C=!1;for(let D=0,A=_.length;D"u"&&(t.env.references={}),typeof t.env.references[y]>"u"&&(t.env.references[y]={title:g,href:f}),t.line=o),!0):!1}const dve=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],pve="[a-zA-Z_:][a-zA-Z0-9:._-]*",mve="[^\"'=<>`\\x00-\\x20]+",gve="'[^']*'",yve='"[^"]*"',bve="(?:"+mve+"|"+gve+"|"+yve+")",Ove="(?:\\s+"+pve+"(?:\\s*=\\s*"+bve+")?)",WV="<[A-Za-z][A-Za-z0-9\\-]*"+Ove+"*\\s*\\/?>",YV="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",vve="",wve="<[?][\\s\\S]*?[?]>",xve="]*>",_ve="",Sve=new RegExp("^(?:"+WV+"|"+YV+"|"+vve+"|"+wve+"|"+xve+"|"+_ve+")"),kve=new RegExp("^(?:"+WV+"|"+YV+")"),_d=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^/,!0],[/^<\?/,/\?>/,!0],[/^/,!0],[/^/,!0],[new RegExp("^|$))","i"),/^$/,!0],[new RegExp(kve.source+"\\s*$"),/^$/,!1]];function Cve(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||!t.md.options.html||t.src.charCodeAt(i)!==60)return!1;let o=t.src.slice(i,s),a=0;for(;a<_d.length&&!_d[a][0].test(o);a++);if(a===_d.length)return!1;if(r)return _d[a][2];let l=e+1;if(!_d[a][1].test(o)){for(;l=4)return!1;let o=t.src.charCodeAt(i);if(o!==35||i>=s)return!1;let a=1;for(o=t.src.charCodeAt(++i);o===35&&i6||ii&&Nn(t.src.charCodeAt(l-1))&&(s=l),t.line=e+1;const u=t.push("heading_open","h"+String(a),1);u.markup="########".slice(0,a),u.map=[e,t.line];const c=t.push("inline","",0);c.content=t.src.slice(i,s).trim(),c.map=[e,t.line],c.children=[];const f=t.push("heading_close","h"+String(a),-1);return f.markup="########".slice(0,a),!0}function Eve(t,e,n){const r=t.md.block.ruler.getRules("paragraph");if(t.sCount[e]-t.blkIndent>=4)return!1;const i=t.parentType;t.parentType="paragraph";let s=0,o,a=e+1;for(;a3)continue;if(t.sCount[a]>=t.blkIndent){let d=t.bMarks[a]+t.tShift[a];const p=t.eMarks[a];if(d=p))){s=o===61?1:2;break}}if(t.sCount[a]<0)continue;let h=!1;for(let d=0,p=r.length;d3||t.sCount[s]<0)continue;let u=!1;for(let c=0,f=r.length;c=n||t.sCount[o]=s){t.line=n;break}const l=t.line;let u=!1;for(let c=0;c=t.line)throw new Error("block rule didn't increment state.line");break}if(!u)throw new Error("none of the block rules matched");t.tight=!a,t.isEmpty(t.line-1)&&(a=!0),o=t.line,o0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r};xy.prototype.scanDelims=function(t,e){const n=this.posMax,r=this.src.charCodeAt(t),i=t>0?this.src.charCodeAt(t-1):32;let s=t;for(;s0)return!1;const n=t.pos,r=t.posMax;if(n+3>r||t.src.charCodeAt(n)!==58||t.src.charCodeAt(n+1)!==47||t.src.charCodeAt(n+2)!==47)return!1;const i=t.pending.match(Rve);if(!i)return!1;const s=i[1],o=t.md.linkify.matchAtStart(t.src.slice(n-s.length));if(!o)return!1;let a=o.url;if(a.length<=s.length)return!1;a=a.replace(/\*+$/,"");const l=t.md.normalizeLink(a);if(!t.md.validateLink(l))return!1;if(!e){t.pending=t.pending.slice(0,-s.length);const u=t.push("link_open","a",1);u.attrs=[["href",l]],u.markup="linkify",u.info="auto";const c=t.push("text","",0);c.content=t.md.normalizeLinkText(a);const f=t.push("link_close","a",-1);f.markup="linkify",f.info="auto"}return t.pos+=a.length-s.length,!0}function Fve(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==10)return!1;const r=t.pending.length-1,i=t.posMax;if(!e)if(r>=0&&t.pending.charCodeAt(r)===32)if(r>=1&&t.pending.charCodeAt(r-1)===32){let s=r-1;for(;s>=1&&t.pending.charCodeAt(s-1)===32;)s--;t.pending=t.pending.slice(0,s),t.push("hardbreak","br",0)}else t.pending=t.pending.slice(0,-1),t.push("softbreak","br",0);else t.push("softbreak","br",0);for(n++;n?@[]^_`{|}~-".split("").forEach(function(t){CE[t.charCodeAt(0)]=1});function $ve(t,e){let n=t.pos;const r=t.posMax;if(t.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let i=t.src.charCodeAt(n);if(i===10){for(e||t.push("hardbreak","br",0),n++;n=55296&&i<=56319&&n+1=56320&&a<=57343&&(s+=t.src[n+1],n++)}const o="\\"+s;if(!e){const a=t.push("text_special","",0);i<256&&CE[i]!==0?a.content=s:a.content=o,a.markup=o,a.info="escape"}return t.pos=n+1,!0}function Mve(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==96)return!1;const i=n;n++;const s=t.posMax;for(;n=0;r--){const i=e[r];if(i.marker!==95&&i.marker!==42||i.end===-1)continue;const s=e[i.end],o=r>0&&e[r-1].end===i.end+1&&e[r-1].marker===i.marker&&e[r-1].token===i.token-1&&e[i.end+1].token===s.token+1,a=String.fromCharCode(i.marker),l=t.tokens[i.token];l.type=o?"strong_open":"em_open",l.tag=o?"strong":"em",l.nesting=1,l.markup=o?a+a:a,l.content="";const u=t.tokens[s.token];u.type=o?"strong_close":"em_close",u.tag=o?"strong":"em",u.nesting=-1,u.markup=o?a+a:a,u.content="",o&&(t.tokens[e[r-1].token].content="",t.tokens[e[i.end+1].token].content="",r--)}}function Bve(t){const e=t.tokens_meta,n=t.tokens_meta.length;dR(t,t.delimiters);for(let r=0;r=f)return!1;if(l=p,i=t.md.helpers.parseLinkDestination(t.src,p,t.posMax),i.ok){for(o=t.md.normalizeLink(i.str),t.md.validateLink(o)?p=i.pos:o="",l=p;p=f||t.src.charCodeAt(p)!==41)&&(u=!0),p++}if(u){if(typeof t.env.references>"u")return!1;if(p=0?r=t.src.slice(l,p++):p=d+1):p=d+1,r||(r=t.src.slice(h,d)),s=t.env.references[Zx(r)],!s)return t.pos=c,!1;o=s.href,a=s.title}if(!e){t.pos=h,t.posMax=d;const m=t.push("link_open","a",1),g=[["href",o]];m.attrs=g,a&&g.push(["title",a]),t.linkLevel++,t.md.inline.tokenize(t),t.linkLevel--,t.push("link_close","a",-1)}return t.pos=p,t.posMax=f,!0}function Uve(t,e){let n,r,i,s,o,a,l,u,c="";const f=t.pos,h=t.posMax;if(t.src.charCodeAt(t.pos)!==33||t.src.charCodeAt(t.pos+1)!==91)return!1;const d=t.pos+2,p=t.md.helpers.parseLinkLabel(t,t.pos+1,!1);if(p<0)return!1;if(s=p+1,s=h)return!1;for(u=s,a=t.md.helpers.parseLinkDestination(t.src,s,t.posMax),a.ok&&(c=t.md.normalizeLink(a.str),t.md.validateLink(c)?s=a.pos:c=""),u=s;s=h||t.src.charCodeAt(s)!==41)return t.pos=f,!1;s++}else{if(typeof t.env.references>"u")return!1;if(s=0?i=t.src.slice(u,s++):s=p+1):s=p+1,i||(i=t.src.slice(d,p)),o=t.env.references[Zx(i)],!o)return t.pos=f,!1;c=o.href,l=o.title}if(!e){r=t.src.slice(d,p);const m=[];t.md.inline.parse(r,t.md,t.env,m);const g=t.push("image","img",0),y=[["src",c],["alt",""]];g.attrs=y,g.children=m,g.content=r,l&&y.push(["title",l])}return t.pos=s,t.posMax=h,!0}const jve=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,qve=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function Vve(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==60)return!1;const r=t.pos,i=t.posMax;for(;;){if(++n>=i)return!1;const o=t.src.charCodeAt(n);if(o===60)return!1;if(o===62)break}const s=t.src.slice(r+1,n);if(qve.test(s)){const o=t.md.normalizeLink(s);if(!t.md.validateLink(o))return!1;if(!e){const a=t.push("link_open","a",1);a.attrs=[["href",o]],a.markup="autolink",a.info="auto";const l=t.push("text","",0);l.content=t.md.normalizeLinkText(s);const u=t.push("link_close","a",-1);u.markup="autolink",u.info="auto"}return t.pos+=s.length+2,!0}if(jve.test(s)){const o=t.md.normalizeLink("mailto:"+s);if(!t.md.validateLink(o))return!1;if(!e){const a=t.push("link_open","a",1);a.attrs=[["href",o]],a.markup="autolink",a.info="auto";const l=t.push("text","",0);l.content=t.md.normalizeLinkText(s);const u=t.push("link_close","a",-1);u.markup="autolink",u.info="auto"}return t.pos+=s.length+2,!0}return!1}function Zve(t){return/^\s]/i.test(t)}function Xve(t){return/^<\/a\s*>/i.test(t)}function Wve(t){const e=t|32;return e>=97&&e<=122}function Yve(t,e){if(!t.md.options.html)return!1;const n=t.posMax,r=t.pos;if(t.src.charCodeAt(r)!==60||r+2>=n)return!1;const i=t.src.charCodeAt(r+1);if(i!==33&&i!==63&&i!==47&&!Wve(i))return!1;const s=t.src.slice(r).match(Sve);if(!s)return!1;if(!e){const o=t.push("html_inline","",0);o.content=s[0],Zve(o.content)&&t.linkLevel++,Xve(o.content)&&t.linkLevel--}return t.pos+=s[0].length,!0}const Gve=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,Hve=/^&([a-z][a-z0-9]{1,31});/i;function Kve(t,e){const n=t.pos,r=t.posMax;if(t.src.charCodeAt(n)!==38||n+1>=r)return!1;if(t.src.charCodeAt(n+1)===35){const s=t.src.slice(n).match(Gve);if(s){if(!e){const o=s[1][0].toLowerCase()==="x"?parseInt(s[1].slice(1),16):parseInt(s[1],10),a=t.push("text_special","",0);a.content=SE(o)?X2(o):X2(65533),a.markup=s[0],a.info="entity"}return t.pos+=s[0].length,!0}}else{const s=t.src.slice(n).match(Hve);if(s){const o=jV(s[0]);if(o!==s[0]){if(!e){const a=t.push("text_special","",0);a.content=o,a.markup=s[0],a.info="entity"}return t.pos+=s[0].length,!0}}}return!1}function pR(t){const e={},n=t.length;if(!n)return;let r=0,i=-2;const s=[];for(let o=0;ol;u-=s[u]+1){const f=t[u];if(f.marker===a.marker&&f.open&&f.end<0){let h=!1;if((f.close||a.open)&&(f.length+a.length)%3===0&&(f.length%3!==0||a.length%3!==0)&&(h=!0),!h){const d=u>0&&!t[u-1].open?s[u-1]+1:0;s[o]=o-u+d,s[u]=d,a.open=!1,f.end=o,f.close=!1,c=-1,i=-2;break}}}c!==-1&&(e[a.marker][(a.open?3:0)+(a.length||0)%3]=c)}}function Jve(t){const e=t.tokens_meta,n=t.tokens_meta.length;pR(t.delimiters);for(let r=0;r0&&r++,i[e].type==="text"&&e+1=t.pos)throw new Error("inline rule didn't increment state.pos");break}}else t.pos=t.posMax;o||t.pos++,s[e]=t.pos};_y.prototype.tokenize=function(t){const e=this.ruler.getRules(""),n=e.length,r=t.posMax,i=t.md.options.maxNesting;for(;t.pos=t.pos)throw new Error("inline rule didn't increment state.pos");break}}if(o){if(t.pos>=r)break;continue}t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()};_y.prototype.parse=function(t,e,n,r){const i=new this.State(t,e,n,r);this.tokenize(i);const s=this.ruler2.getRules(""),o=s.length;for(let a=0;a|$))",e.tpl_email_fuzzy="(^|"+n+'|"|\\(|'+e.src_ZCc+")("+e.src_email_name+"@"+e.tpl_host_fuzzy_strict+")",e.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_fuzzy_strict+e.src_path+")",e.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_no_ip_fuzzy_strict+e.src_path+")",e}function d4(t){return Array.prototype.slice.call(arguments,1).forEach(function(n){n&&Object.keys(n).forEach(function(r){t[r]=n[r]})}),t}function Wx(t){return Object.prototype.toString.call(t)}function n2e(t){return Wx(t)==="[object String]"}function r2e(t){return Wx(t)==="[object Object]"}function i2e(t){return Wx(t)==="[object RegExp]"}function mR(t){return Wx(t)==="[object Function]"}function s2e(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const KV={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function o2e(t){return Object.keys(t||{}).reduce(function(e,n){return e||KV.hasOwnProperty(n)},!1)}const a2e={"http:":{validate:function(t,e,n){const r=t.slice(e);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(t,e,n){const r=t.slice(e);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(r)?e>=3&&t[e-3]===":"||e>=3&&t[e-3]==="/"?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(t,e,n){const r=t.slice(e);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},l2e="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",u2e="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function c2e(t){t.__index__=-1,t.__text_cache__=""}function f2e(t){return function(e,n){const r=e.slice(n);return t.test(r)?r.match(t)[0].length:0}}function gR(){return function(t,e){e.normalize(t)}}function W2(t){const e=t.re=t2e(t.__opts__),n=t.__tlds__.slice();t.onCompile(),t.__tlds_replaced__||n.push(l2e),n.push(e.src_xn),e.src_tlds=n.join("|");function r(a){return a.replace("%TLDS%",e.src_tlds)}e.email_fuzzy=RegExp(r(e.tpl_email_fuzzy),"i"),e.link_fuzzy=RegExp(r(e.tpl_link_fuzzy),"i"),e.link_no_ip_fuzzy=RegExp(r(e.tpl_link_no_ip_fuzzy),"i"),e.host_fuzzy_test=RegExp(r(e.tpl_host_fuzzy_test),"i");const i=[];t.__compiled__={};function s(a,l){throw new Error('(LinkifyIt) Invalid schema "'+a+'": '+l)}Object.keys(t.__schemas__).forEach(function(a){const l=t.__schemas__[a];if(l===null)return;const u={validate:null,link:null};if(t.__compiled__[a]=u,r2e(l)){i2e(l.validate)?u.validate=f2e(l.validate):mR(l.validate)?u.validate=l.validate:s(a,l),mR(l.normalize)?u.normalize=l.normalize:l.normalize?s(a,l):u.normalize=gR();return}if(n2e(l)){i.push(a);return}s(a,l)}),i.forEach(function(a){t.__compiled__[t.__schemas__[a]]&&(t.__compiled__[a].validate=t.__compiled__[t.__schemas__[a]].validate,t.__compiled__[a].normalize=t.__compiled__[t.__schemas__[a]].normalize)}),t.__compiled__[""]={validate:null,normalize:gR()};const o=Object.keys(t.__compiled__).filter(function(a){return a.length>0&&t.__compiled__[a]}).map(s2e).join("|");t.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+o+")","i"),t.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+o+")","ig"),t.re.schema_at_start=RegExp("^"+t.re.schema_search.source,"i"),t.re.pretest=RegExp("("+t.re.schema_test.source+")|("+t.re.host_fuzzy_test.source+")|@","i"),c2e(t)}function h2e(t,e){const n=t.__index__,r=t.__last_index__,i=t.__text_cache__.slice(n,r);this.schema=t.__schema__.toLowerCase(),this.index=n+e,this.lastIndex=r+e,this.raw=i,this.text=i,this.url=i}function p4(t,e){const n=new h2e(t,e);return t.__compiled__[n.schema].normalize(n,t),n}function ro(t,e){if(!(this instanceof ro))return new ro(t,e);e||o2e(t)&&(e=t,t={}),this.__opts__=d4({},KV,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=d4({},a2e,t),this.__compiled__={},this.__tlds__=u2e,this.__tlds_replaced__=!1,this.re={},W2(this)}ro.prototype.add=function(e,n){return this.__schemas__[e]=n,W2(this),this};ro.prototype.set=function(e){return this.__opts__=d4(this.__opts__,e),this};ro.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;let n,r,i,s,o,a,l,u,c;if(this.re.schema_test.test(e)){for(l=this.re.schema_search,l.lastIndex=0;(n=l.exec(e))!==null;)if(s=this.testSchemaAt(e,n[2],l.lastIndex),s){this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+s;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(u=e.search(this.re.host_fuzzy_test),u>=0&&(this.__index__<0||u=0&&(i=e.match(this.re.email_fuzzy))!==null&&(o=i.index+i[1].length,a=i.index+i[0].length,(this.__index__<0||othis.__last_index__)&&(this.__schema__="mailto:",this.__index__=o,this.__last_index__=a))),this.__index__>=0};ro.prototype.pretest=function(e){return this.re.pretest.test(e)};ro.prototype.testSchemaAt=function(e,n,r){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(e,r,this):0};ro.prototype.match=function(e){const n=[];let r=0;this.__index__>=0&&this.__text_cache__===e&&(n.push(p4(this,r)),r=this.__last_index__);let i=r?e.slice(r):e;for(;this.test(i);)n.push(p4(this,r)),i=i.slice(this.__last_index__),r+=this.__last_index__;return n.length?n:null};ro.prototype.matchAtStart=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return null;const n=this.re.schema_at_start.exec(e);if(!n)return null;const r=this.testSchemaAt(e,n[2],n[0].length);return r?(this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+r,p4(this,0)):null};ro.prototype.tlds=function(e,n){return e=Array.isArray(e)?e:[e],n?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(r,i,s){return r!==s[i-1]}).reverse(),W2(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,W2(this),this)};ro.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url="mailto:"+e.url)};ro.prototype.onCompile=function(){};const Sp=2147483647,sl=36,AE=1,P1=26,d2e=38,p2e=700,JV=72,eZ=128,tZ="-",m2e=/^xn--/,g2e=/[^\0-\x7F]/,y2e=/[\x2E\u3002\uFF0E\uFF61]/g,b2e={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},y3=sl-AE,ol=Math.floor,b3=String.fromCharCode;function gc(t){throw new RangeError(b2e[t])}function O2e(t,e){const n=[];let r=t.length;for(;r--;)n[r]=e(t[r]);return n}function nZ(t,e){const n=t.split("@");let r="";n.length>1&&(r=n[0]+"@",t=n[1]),t=t.replace(y2e,".");const i=t.split("."),s=O2e(i,e).join(".");return r+s}function rZ(t){const e=[];let n=0;const r=t.length;for(;n=55296&&i<=56319&&nString.fromCodePoint(...t),w2e=function(t){return t>=48&&t<58?26+(t-48):t>=65&&t<91?t-65:t>=97&&t<123?t-97:sl},yR=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},iZ=function(t,e,n){let r=0;for(t=n?ol(t/p2e):t>>1,t+=ol(t/e);t>y3*P1>>1;r+=sl)t=ol(t/y3);return ol(r+(y3+1)*t/(t+d2e))},sZ=function(t){const e=[],n=t.length;let r=0,i=eZ,s=JV,o=t.lastIndexOf(tZ);o<0&&(o=0);for(let a=0;a=128&&gc("not-basic"),e.push(t.charCodeAt(a));for(let a=o>0?o+1:0;a=n&&gc("invalid-input");const h=w2e(t.charCodeAt(a++));h>=sl&&gc("invalid-input"),h>ol((Sp-r)/c)&&gc("overflow"),r+=h*c;const d=f<=s?AE:f>=s+P1?P1:f-s;if(hol(Sp/p)&&gc("overflow"),c*=p}const u=e.length+1;s=iZ(r-l,u,l==0),ol(r/u)>Sp-i&&gc("overflow"),i+=ol(r/u),r%=u,e.splice(r++,0,i)}return String.fromCodePoint(...e)},oZ=function(t){const e=[];t=rZ(t);const n=t.length;let r=eZ,i=0,s=JV;for(const l of t)l<128&&e.push(b3(l));const o=e.length;let a=o;for(o&&e.push(tZ);a=r&&col((Sp-i)/u)&&gc("overflow"),i+=(l-r)*u,r=l;for(const c of t)if(cSp&&gc("overflow"),c===r){let f=i;for(let h=sl;;h+=sl){const d=h<=s?AE:h>=s+P1?P1:h-s;if(f=0))try{e.hostname=aZ.toASCII(e.hostname)}catch{}return wy(vE(e))}function R2e(t){const e=wE(t,!0);if(e.hostname&&(!e.protocol||lZ.indexOf(e.protocol)>=0))try{e.hostname=aZ.toUnicode(e.hostname)}catch{}return h0(vE(e),h0.defaultChars+"%")}function Io(t,e){if(!(this instanceof Io))return new Io(t,e);e||_E(t)||(e=t||{},t="default"),this.inline=new _y,this.block=new Xx,this.core=new kE,this.renderer=new Z0,this.linkify=new ro,this.validateLink=D2e,this.normalizeLink=P2e,this.normalizeLinkText=R2e,this.utils=FOe,this.helpers=Vx({},NOe),this.options={},this.configure(t),e&&this.set(e)}Io.prototype.set=function(t){return Vx(this.options,t),this};Io.prototype.configure=function(t){const e=this;if(_E(t)){const n=t;if(t=A2e[n],!t)throw new Error('Wrong `markdown-it` preset "'+n+'", check name')}if(!t)throw new Error("Wrong `markdown-it` preset, can't be empty");return t.options&&e.set(t.options),t.components&&Object.keys(t.components).forEach(function(n){t.components[n].rules&&e[n].ruler.enableOnly(t.components[n].rules),t.components[n].rules2&&e[n].ruler2.enableOnly(t.components[n].rules2)}),this};Io.prototype.enable=function(t,e){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(i){n=n.concat(this[i].ruler.enable(t,!0))},this),n=n.concat(this.inline.ruler2.enable(t,!0));const r=t.filter(function(i){return n.indexOf(i)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+r);return this};Io.prototype.disable=function(t,e){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(i){n=n.concat(this[i].ruler.disable(t,!0))},this),n=n.concat(this.inline.ruler2.disable(t,!0));const r=t.filter(function(i){return n.indexOf(i)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+r);return this};Io.prototype.use=function(t){const e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this};Io.prototype.parse=function(t,e){if(typeof t!="string")throw new Error("Input data should be a String");const n=new this.core.State(t,this,e);return this.core.process(n),n.tokens};Io.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)};Io.prototype.parseInline=function(t,e){const n=new this.core.State(t,this,e);return n.inlineMode=!0,this.core.process(n),n.tokens};Io.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};function I2e(t,e,n){const{parseMetaString:r,trimEndingNewline:i=!0,defaultLanguage:s="text",fallbackLanguage:o}=n,a=e.getLoadedLanguages();t.options.highlight=(l,u="text",c)=>{u===""&&(u=s),o&&!a.includes(u)&&(u=o);const f=r?.(c,l,u)||{},h={...n,lang:u,meta:{...n.meta,...f,__raw:c}},d=[];return d.push({name:"@shikijs/markdown-it:block-class",code(p){p.properties.class=`language-${u}`}}),i&&l.endsWith(` `)&&(l=l.slice(0,-1)),e.codeToHtml(l,{...h,transformers:[...d,...h.transformers||[]]})}}function F2e(t,e){return function(n){I2e(n,t,e)}}let mh=class extends Error{constructor(e){super(e),this.name="ShikiError"}},EE=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function $2e(){return 2147483648}function M2e(){return typeof performance<"u"?performance.now():Date.now()}const L2e=(t,e)=>t+(e-t%e)%e;async function N2e(t){let e,n;const r={};function i(d){n=d,r.HEAPU8=new Uint8Array(d),r.HEAPU32=new Uint32Array(d)}function s(d,p,m){r.HEAPU8.copyWithin(d,p,p+m)}function o(d){try{return e.grow(d-n.byteLength+65535>>>16),i(e.buffer),1}catch{}}function a(d){const p=r.HEAPU8.length;d=d>>>0;const m=$2e();if(d>m)return!1;for(let g=1;g<=4;g*=2){let y=p*(1+.2/g);y=Math.min(y,d+100663296);const O=Math.min(m,L2e(Math.max(d,y),65536));if(o(O))return!0}return!1}const l=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function u(d,p,m=1024){const g=p+m;let y=p;for(;d[y]&&!(y>=g);)++y;if(y-p>16&&d.buffer&&l)return l.decode(d.subarray(p,y));let O="";for(;p>10,56320|S&1023)}}return O}function c(d,p){return d?u(r.HEAPU8,d,p):""}const f={emscripten_get_now:M2e,emscripten_memcpy_big:s,emscripten_resize_heap:a,fd_write:()=>0};async function h(){const p=await t({env:f,wasi_snapshot_preview1:f});e=p.memory,i(e.buffer),Object.assign(r,p),r.UTF8ToString=c}return await h(),r}var Q2e=Object.defineProperty,B2e=(t,e,n)=>e in t?Q2e(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,$r=(t,e,n)=>(B2e(t,typeof e!="symbol"?e+"":e,n),n);let Xr=null;function z2e(t){throw new EE(t.UTF8ToString(t.getLastOnigError()))}class Yx{constructor(e){$r(this,"utf16Length"),$r(this,"utf8Length"),$r(this,"utf16Value"),$r(this,"utf8Value"),$r(this,"utf16OffsetToUtf8"),$r(this,"utf8OffsetToUtf16");const n=e.length,r=Yx._utf8ByteLength(e),i=r!==n,s=i?new Uint32Array(n+1):null;i&&(s[n]=r);const o=i?new Uint32Array(r+1):null;i&&(o[r]=n);const a=new Uint8Array(r);let l=0;for(let u=0;u=55296&&c<=56319&&u+1=56320&&d<=57343&&(f=(c-55296<<10)+65536|d-56320,h=!0)}i&&(s[u]=l,h&&(s[u+1]=l),f<=127?o[l+0]=u:f<=2047?(o[l+0]=u,o[l+1]=u):f<=65535?(o[l+0]=u,o[l+1]=u,o[l+2]=u):(o[l+0]=u,o[l+1]=u,o[l+2]=u,o[l+3]=u)),f<=127?a[l++]=f:f<=2047?(a[l++]=192|(f&1984)>>>6,a[l++]=128|(f&63)>>>0):f<=65535?(a[l++]=224|(f&61440)>>>12,a[l++]=128|(f&4032)>>>6,a[l++]=128|(f&63)>>>0):(a[l++]=240|(f&1835008)>>>18,a[l++]=128|(f&258048)>>>12,a[l++]=128|(f&4032)>>>6,a[l++]=128|(f&63)>>>0),h&&u++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=e,this.utf8Value=a,this.utf16OffsetToUtf8=s,this.utf8OffsetToUtf16=o}static _utf8ByteLength(e){let n=0;for(let r=0,i=e.length;r=55296&&s<=56319&&r+1=56320&&l<=57343&&(o=(s-55296<<10)+65536|l-56320,a=!0)}o<=127?n+=1:o<=2047?n+=2:o<=65535?n+=3:n+=4,a&&r++}return n}createString(e){const n=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,n),n}}const Fa=class{constructor(t){if($r(this,"id",++Fa.LAST_ID),$r(this,"_onigBinding"),$r(this,"content"),$r(this,"utf16Length"),$r(this,"utf8Length"),$r(this,"utf16OffsetToUtf8"),$r(this,"utf8OffsetToUtf16"),$r(this,"ptr"),!Xr)throw new EE("Must invoke loadWasm first.");this._onigBinding=Xr,this.content=t;const e=new Yx(t);this.utf16Length=e.utf16Length,this.utf8Length=e.utf8Length,this.utf16OffsetToUtf8=e.utf16OffsetToUtf8,this.utf8OffsetToUtf16=e.utf8OffsetToUtf16,this.utf8Length<1e4&&!Fa._sharedPtrInUse?(Fa._sharedPtr||(Fa._sharedPtr=Xr.omalloc(1e4)),Fa._sharedPtrInUse=!0,Xr.HEAPU8.set(e.utf8Value,Fa._sharedPtr),this.ptr=Fa._sharedPtr):this.ptr=e.createString(Xr)}convertUtf8OffsetToUtf16(t){return this.utf8OffsetToUtf16?t<0?0:t>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[t]:t}convertUtf16OffsetToUtf8(t){return this.utf16OffsetToUtf8?t<0?0:t>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[t]:t}dispose(){this.ptr===Fa._sharedPtr?Fa._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};let Sy=Fa;$r(Sy,"LAST_ID",0);$r(Sy,"_sharedPtr",0);$r(Sy,"_sharedPtrInUse",!1);class U2e{constructor(e){if($r(this,"_onigBinding"),$r(this,"_ptr"),!Xr)throw new EE("Must invoke loadWasm first.");const n=[],r=[];for(let a=0,l=e.length;a{let r=t;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),j2e(r)?r=await r.instantiator(n):q2e(r)?r=await r.default(n):(V2e(r)&&(r=r.data),Z2e(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await Y2e(r)(n):r=await G2e(r)(n):X2e(r)?r=await O3(r)(n):r instanceof WebAssembly.Module?r=await O3(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await O3(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return Ib=e(),Ib}function O3(t){return e=>WebAssembly.instantiate(t,e)}function Y2e(t){return e=>WebAssembly.instantiateStreaming(t,e)}function G2e(t){return async e=>{const n=await t.arrayBuffer();return WebAssembly.instantiate(n,e)}}let H2e;function K2e(){return H2e}async function J2e(t){return t&&await W2e(t),{createScanner(e){return new U2e(e.map(n=>typeof n=="string"?n:n.source))},createString(e){return new Sy(e)}}}function ewe(t){return TE(t)}function TE(t){return Array.isArray(t)?twe(t):t instanceof RegExp?t:typeof t=="object"?nwe(t):t}function twe(t){let e=[];for(let n=0,r=t.length;n{for(let r in n)t[r]=n[r]}),t}function cZ(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?cZ(t.substring(0,t.length-1)):t.substr(~e+1)}var v3=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Fb=class{static hasCaptures(t){return t===null?!1:(v3.lastIndex=0,v3.test(t))}static replaceCaptures(t,e,n){return t.replace(v3,(r,i,s,o)=>{let a=n[parseInt(i||s,10)];if(a){let l=e.substring(a.start,a.end);for(;l[0]===".";)l=l.substring(1);switch(o){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}else return r})}};function fZ(t,e){return te?1:0}function hZ(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,r=e.length;if(n===r){for(let i=0;ithis._root.match(t));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;const e=t.scopeName,r=this._cachedMatchRoot.get(e).find(i=>rwe(t.parent,i.parentScopes));return r?new mZ(r.fontStyle,r.foreground,r.background):null}},w3=class qO{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const r of n)e=new qO(e,r);return e}static from(...e){let n=null;for(let r=0;r"){if(n===e.length-1)return!1;r=e[++n],i=!0}for(;t&&!iwe(t.scopeName,r);){if(i)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function iwe(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var mZ=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function swe(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],r=0;for(let i=0,s=e.length;i1&&(g=p.slice(0,p.length-1),g.reverse()),n[r++]=new owe(m,g,i,l,u,c)}}return n}var owe=class{constructor(t,e,n,r,i,s){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=r,this.foreground=i,this.background=s}},xu=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(xu||{});function awe(t,e){t.sort((l,u)=>{let c=fZ(l.scope,u.scope);return c!==0||(c=hZ(l.parentScopes,u.parentScopes),c!==0)?c:l.index-u.index});let n=0,r="#000000",i="#ffffff";for(;t.length>=1&&t[0].scope==="";){let l=t.shift();l.fontStyle!==-1&&(n=l.fontStyle),l.foreground!==null&&(r=l.foreground),l.background!==null&&(i=l.background)}let s=new lwe(e),o=new mZ(n,s.getId(r),s.getId(i)),a=new cwe(new m4(0,null,-1,0,0),[]);for(let l=0,u=t.length;le?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),i!==0&&(this.background=i)}},cwe=class g4{constructor(e,n=[],r={}){this._mainRule=e,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let r=0,i=0;for(;e.parentScopes[r]===">"&&r++,n.parentScopes[i]===">"&&i++,!(r>=e.parentScopes.length||i>=n.parentScopes.length);){const s=n.parentScopes[i].length-e.parentScopes[r].length;if(s!==0)return s;r++,i++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let r=e.indexOf("."),i,s;if(r===-1?(i=e,s=""):(i=e.substring(0,r),s=e.substring(r+1)),this._children.hasOwnProperty(i))return this._children[i].match(s)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(g4._cmpBySpecificity),n}insert(e,n,r,i,s,o){if(n===""){this._doInsertHere(e,r,i,s,o);return}let a=n.indexOf("."),l,u;a===-1?(l=n,u=""):(l=n.substring(0,a),u=n.substring(a+1));let c;this._children.hasOwnProperty(l)?c=this._children[l]:(c=new g4(this._mainRule.clone(),m4.cloneArr(this._rulesWithParentScopes)),this._children[l]=c),c.insert(e+1,u,r,i,s,o)}_doInsertHere(e,n,r,i,s){if(n===null){this._mainRule.acceptOverwrite(e,r,i,s);return}for(let o=0,a=this._rulesWithParentScopes.length;o>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,n,r,i,s,o,a){let l=uo.getLanguageId(e),u=uo.getTokenType(e),c=uo.containsBalancedBrackets(e)?1:0,f=uo.getFontStyle(e),h=uo.getForeground(e),d=uo.getBackground(e);return n!==0&&(l=n),r!==8&&(u=r),i!==null&&(c=i?1:0),s!==-1&&(f=s),o!==0&&(h=o),a!==0&&(d=a),(l<<0|u<<8|c<<10|f<<11|h<<15|d<<24)>>>0}};function G2(t,e){const n=[],r=fwe(t);let i=r.next();for(;i!==null;){let l=0;if(i.length===2&&i.charAt(1)===":"){switch(i.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let u=o();if(n.push({matcher:u,priority:l}),i!==",")break;i=r.next()}return n;function s(){if(i==="-"){i=r.next();const l=s();return u=>!!l&&!l(u)}if(i==="("){i=r.next();const l=a();return i===")"&&(i=r.next()),l}if(OR(i)){const l=[];do l.push(i),i=r.next();while(OR(i));return u=>e(l,u)}return null}function o(){const l=[];let u=s();for(;u;)l.push(u),u=s();return c=>l.every(f=>f(c))}function a(){const l=[];let u=o();for(;u&&(l.push(u),i==="|"||i===",");){do i=r.next();while(i==="|"||i===",");u=o()}return c=>l.some(f=>f(c))}}function OR(t){return!!t&&!!t.match(/[\w\.:]+/)}function fwe(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const r=n[0];return n=e.exec(t),r}}}function yZ(t){typeof t.dispose=="function"&&t.dispose()}var R1=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},hwe=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},dwe=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},pwe=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new R1(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const t=this.Q;this.Q=[];const e=new dwe;for(const n of t)mwe(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof R1){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function mwe(t,e,n,r){const i=n.lookup(t.scopeName);if(!i){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const s=n.lookup(e);t instanceof R1?VO({baseGrammar:s,selfGrammar:i},r):y4(t.ruleName,{baseGrammar:s,selfGrammar:i,repository:i.repository},r);const o=n.injections(t.scopeName);if(o)for(const a of o)r.add(new R1(a))}function y4(t,e,n){if(e.repository&&e.repository[t]){const r=e.repository[t];H2([r],e,n)}}function VO(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&H2(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&H2(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function H2(t,e,n){for(const r of t){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const i=r.repository?uZ({},e.repository,r.repository):e.repository;Array.isArray(r.patterns)&&H2(r.patterns,{...e,repository:i},n);const s=r.include;if(!s)continue;const o=bZ(s);switch(o.kind){case 0:VO({...e,selfGrammar:e.baseGrammar},n);break;case 1:VO(e,n);break;case 2:y4(o.ruleName,{...e,repository:i},n);break;case 3:case 4:const a=o.scopeName===e.selfGrammar.scopeName?e.selfGrammar:o.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(a){const l={baseGrammar:e.baseGrammar,selfGrammar:a,repository:i};o.kind===4?y4(o.ruleName,l,n):VO(l,n)}else o.kind===4?n.add(new hwe(o.scopeName,o.ruleName)):n.add(new R1(o.scopeName));break}}}var gwe=class{kind=0},ywe=class{kind=1},bwe=class{constructor(t){this.ruleName=t}kind=2},Owe=class{constructor(t){this.scopeName=t}kind=3},vwe=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function bZ(t){if(t==="$base")return new gwe;if(t==="$self")return new ywe;const e=t.indexOf("#");if(e===-1)return new Owe(t);if(e===0)return new bwe(t.substring(1));{const n=t.substring(0,e),r=t.substring(e+1);return new vwe(n,r)}}var wwe=/\\(\d+)/,vR=/\\(\d+)/g,xwe=-1,OZ=-2;var ky=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,r){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=Fb.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=Fb.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${cZ(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,e){return!this._nameIsCapturing||this._name===null||t===null||e===null?this._name:Fb.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Fb.replaceCaptures(this._contentName,t,e)}},_we=class extends ky{retokenizeCapturedWithRuleId;constructor(t,e,n,r,i){super(t,e,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(t,e){throw new Error("Not supported!")}compile(t,e){throw new Error("Not supported!")}compileAG(t,e,n,r){throw new Error("Not supported!")}},Swe=class extends ky{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,r,i){super(t,e,n,null),this._match=new I1(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new F1,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},wR=class extends ky{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,i){super(t,e,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,e){for(const n of this.patterns)t.getRule(n).collectPatterns(t,e)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new F1,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},b4=class extends ky{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,i,s,o,a,l,u){super(t,e,n,r),this._begin=new I1(i,this.id),this.beginCaptures=s,this._end=new I1(o||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=l||!1,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,e){return this._end.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t,e).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,r)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new F1;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,e):this._cachedCompiledPatterns.setSource(0,e)),this._cachedCompiledPatterns}},K2=class extends ky{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,r,i,s,o,a,l){super(t,e,n,r),this._begin=new I1(i,this.id),this.beginCaptures=s,this.whileCaptures=a,this._while=new I1(o,OZ),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,e){return this._while.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new F1;for(const e of this.patterns)t.getRule(e).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,e){return this._getCachedCompiledWhilePatterns(t,e).compile(t)}compileWhileAG(t,e,n,r){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,r)}_getCachedCompiledWhilePatterns(t,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new F1,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||"￿"),this._cachedCompiledWhilePatterns}},vZ=class di{static createCaptureRule(e,n,r,i,s){return e.registerRule(o=>new _we(n,o,r,i,s))}static getCompiledRuleId(e,n,r){return e.id||n.registerRule(i=>{if(e.id=i,e.match)return new Swe(e.$vscodeTextmateLocation,e.id,e.name,e.match,di._compileCaptures(e.captures,n,r));if(typeof e.begin>"u"){e.repository&&(r=uZ({},r,e.repository));let s=e.patterns;return typeof s>"u"&&e.include&&(s=[{include:e.include}]),new wR(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,di._compilePatterns(s,n,r))}return e.while?new K2(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,di._compileCaptures(e.beginCaptures||e.captures,n,r),e.while,di._compileCaptures(e.whileCaptures||e.captures,n,r),di._compilePatterns(e.patterns,n,r)):new b4(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,di._compileCaptures(e.beginCaptures||e.captures,n,r),e.end,di._compileCaptures(e.endCaptures||e.captures,n,r),e.applyEndPatternLast,di._compilePatterns(e.patterns,n,r))}),e.id}static _compileCaptures(e,n,r){let i=[];if(e){let s=0;for(const o in e){if(o==="$vscodeTextmateLocation")continue;const a=parseInt(o,10);a>s&&(s=a)}for(let o=0;o<=s;o++)i[o]=null;for(const o in e){if(o==="$vscodeTextmateLocation")continue;const a=parseInt(o,10);let l=0;e[o].patterns&&(l=di.getCompiledRuleId(e[o],n,r)),i[a]=di.createCaptureRule(n,e[o].$vscodeTextmateLocation,e[o].name,e[o].contentName,l)}}return i}static _compilePatterns(e,n,r){let i=[];if(e)for(let s=0,o=e.length;se.substring(i.start,i.end));return vR.lastIndex=0,this.source.replace(vR,(i,s)=>dZ(r[parseInt(s,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],n=[],r=[],i=[],s,o,a,l;for(s=0,o=this.source.length;sn.source);this._cached=new xR(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let r=this._items.map(i=>i.resolveAnchors(e,n));return new xR(t,r,this._items.map(i=>i.ruleId))}},xR=class{constructor(t,e,n){this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,n=this.rules.length;e{const n=this._scopeToLanguage(e),r=this._toStandardTokenType(e);return new x3(n,r)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const n=e.match(O4.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Cwe=class{values;scopesRegExp;constructor(t){if(t.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(t);const e=t.map(([n,r])=>dZ(n));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(t){if(!this.scopesRegExp)return;const e=t.match(this.scopesRegExp);if(e)return this.values.get(e[1])}},_R=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function xZ(t,e,n,r,i,s,o,a){const l=e.content.length;let u=!1,c=-1;if(o){const d=Awe(t,e,n,r,i,s);i=d.stack,r=d.linePos,n=d.isFirstLine,c=d.anchorPosition}const f=Date.now();for(;!u;){if(a!==0&&Date.now()-f>a)return new _R(i,!0);h()}return new _R(i,!1);function h(){const d=Ewe(t,e,n,r,i,c);if(!d){s.produce(i,l),u=!0;return}const p=d.captureIndices,m=d.matchedRuleId,g=p&&p.length>0?p[0].end>r:!1;if(m===xwe){const y=i.getRule(t);s.produce(i,p[0].start),i=i.withContentNameScopesList(i.nameScopesList),ag(t,e,n,i,s,y.endCaptures,p),s.produce(i,p[0].end);const O=i;if(i=i.parent,c=O.getAnchorPos(),!g&&O.getEnterPos()===r){i=O,s.produce(i,l),u=!0;return}}else{const y=t.getRule(m);s.produce(i,p[0].start);const O=i,v=y.getName(e.content,p),w=i.contentNameScopesList.pushAttributed(v,t);if(i=i.push(m,r,c,p[0].end===l,null,w,w),y instanceof b4){const x=y;ag(t,e,n,i,s,x.beginCaptures,p),s.produce(i,p[0].end),c=p[0].end;const S=x.getContentName(e.content,p),_=w.pushAttributed(S,t);if(i=i.withContentNameScopesList(_),x.endHasBackReferences&&(i=i.withEndRule(x.getEndWithResolvedBackReferences(e.content,p))),!g&&O.hasSameRuleAs(i)){i=i.pop(),s.produce(i,l),u=!0;return}}else if(y instanceof K2){const x=y;ag(t,e,n,i,s,x.beginCaptures,p),s.produce(i,p[0].end),c=p[0].end;const S=x.getContentName(e.content,p),_=w.pushAttributed(S,t);if(i=i.withContentNameScopesList(_),x.whileHasBackReferences&&(i=i.withEndRule(x.getWhileWithResolvedBackReferences(e.content,p))),!g&&O.hasSameRuleAs(i)){i=i.pop(),s.produce(i,l),u=!0;return}}else if(ag(t,e,n,i,s,y.captures,p),s.produce(i,p[0].end),i=i.pop(),!g){i=i.safePop(),s.produce(i,l),u=!0;return}}p[0].end>r&&(r=p[0].end,n=!1)}}function Awe(t,e,n,r,i,s){let o=i.beginRuleCapturedEOL?0:-1;const a=[];for(let l=i;l;l=l.pop()){const u=l.getRule(t);u instanceof K2&&a.push({rule:u,stack:l})}for(let l=a.pop();l;l=a.pop()){const{ruleScanner:u,findOptions:c}=Pwe(l.rule,t,l.stack.endRule,n,r===o),f=u.findNextMatchSync(e,r,c);if(f){if(f.ruleId!==OZ){i=l.stack.pop();break}f.captureIndices&&f.captureIndices.length&&(s.produce(l.stack,f.captureIndices[0].start),ag(t,e,n,l.stack,s,l.rule.whileCaptures,f.captureIndices),s.produce(l.stack,f.captureIndices[0].end),o=f.captureIndices[0].end,f.captureIndices[0].end>r&&(r=f.captureIndices[0].end,n=!1))}else{i=l.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function Ewe(t,e,n,r,i,s){const o=Twe(t,e,n,r,i,s),a=t.getInjections();if(a.length===0)return o;const l=Dwe(a,t,e,n,r,i,s);if(!l)return o;if(!o)return l;const u=o.captureIndices[0].start,c=l.captureIndices[0].start;return c=a)&&(a=v,l=O.captureIndices,u=O.ruleId,c=p.priority,a===i))break}return l?{priorityMatch:c===-1,captureIndices:l,matchedRuleId:u}:null}function _Z(t,e,n,r,i){return{ruleScanner:t.compileAG(e,n,r,i),findOptions:0}}function Pwe(t,e,n,r,i){return{ruleScanner:t.compileWhileAG(e,n,r,i),findOptions:0}}function ag(t,e,n,r,i,s,o){if(s.length===0)return;const a=e.content,l=Math.min(s.length,o.length),u=[],c=o[0].end;for(let f=0;fc)break;for(;u.length>0&&u[u.length-1].endPos<=d.start;)i.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop();if(u.length>0?i.produceFromScopes(u[u.length-1].scopes,d.start):i.produce(r,d.start),h.retokenizeCapturedWithRuleId){const m=h.getName(a,o),g=r.contentNameScopesList.pushAttributed(m,t),y=h.getContentName(a,o),O=g.pushAttributed(y,t),v=r.push(h.retokenizeCapturedWithRuleId,d.start,-1,!1,null,g,O),w=t.createOnigString(a.substring(0,d.end));xZ(t,w,n&&d.start===0,d.start,v,i,!1,0),yZ(w);continue}const p=h.getName(a,o);if(p!==null){const g=(u.length>0?u[u.length-1].scopes:r.contentNameScopesList).pushAttributed(p,t);u.push(new Rwe(g,d.end))}}for(;u.length>0;)i.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop()}var Rwe=class{scopes;endPos;constructor(t,e){this.scopes=t,this.endPos=e}};function Iwe(t,e,n,r,i,s,o,a){return new $we(t,e,n,r,i,s,o,a)}function SR(t,e,n,r,i){const s=G2(e,J2),o=vZ.getCompiledRuleId(n,r,i.repository);for(const a of s)t.push({debugSelector:e,matcher:a.matcher,ruleId:o,grammar:i,priority:a.priority})}function J2(t,e){if(e.length{for(let i=n;in&&t.substr(0,n)===e&&t[n]==="."}var $we=class{constructor(t,e,n,r,i,s,o,a){if(this._rootScopeName=t,this.balancedBracketSelectors=s,this._onigLib=a,this._basicScopeAttributesProvider=new kwe(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=kR(e,null),this._injections=null,this._tokenTypeMatchers=[],i)for(const l of Object.keys(i)){const u=G2(l,J2);for(const c of u)this._tokenTypeMatchers.push({matcher:c.matcher,type:i[l]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const t of this._ruleId2desc)t&&t.dispose()}createOnigScanner(t){return this._onigLib.createOnigScanner(t)}createOnigString(t){return this._onigLib.createOnigString(t)}getMetadataForScope(t){return this._basicScopeAttributesProvider.getBasicScopeAttributes(t)}_collectInjections(){const t={lookup:i=>i===this._rootScopeName?this._grammar:this.getExternalGrammar(i),injections:i=>this._grammarRepository.injections(i)},e=[],n=this._rootScopeName,r=t.lookup(n);if(r){const i=r.injections;if(i)for(let o in i)SR(e,o,i[o],this,r);const s=this._grammarRepository.injections(n);s&&s.forEach(o=>{const a=this.getExternalGrammar(o);if(a){const l=a.injectionSelector;l&&SR(e,l,a,this,a)}})}return e.sort((i,s)=>i.priority-s.priority),e}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(t){const e=++this._lastRuleId,n=t(e);return this._ruleId2desc[e]=n,n}getRule(t){return this._ruleId2desc[t]}getExternalGrammar(t,e){if(this._includedGrammars[t])return this._includedGrammars[t];if(this._grammarRepository){const n=this._grammarRepository.lookup(t);if(n)return this._includedGrammars[t]=kR(n,e&&e.$base),this._includedGrammars[t]}}tokenizeLine(t,e,n=0){const r=this._tokenize(t,e,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(t,e,n=0){const r=this._tokenize(t,e,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(t,e,n,r){this._rootId===-1&&(this._rootId=vZ.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!e||e===v4.NULL){i=!0;const u=this._basicScopeAttributesProvider.getDefaultAttributes(),c=this.themeProvider.getDefaults(),f=p0.set(0,u.languageId,u.tokenType,null,c.fontStyle,c.foregroundId,c.backgroundId),h=this.getRule(this._rootId).getName(null,null);let d;h?d=Pg.createRootAndLookUpScopeName(h,f,this):d=Pg.createRoot("unknown",f),e=new v4(null,this._rootId,-1,-1,!1,null,d,d)}else i=!1,e.reset();t=t+` `;const s=this.createOnigString(t),o=s.content.length,a=new Lwe(n,t,this._tokenTypeMatchers,this.balancedBracketSelectors),l=xZ(this,s,i,0,e,a,!0,r);return yZ(s),{lineLength:o,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function kR(t,e){return t=ewe(t),t.repository=t.repository||{},t.repository.$self={$vscodeTextmateLocation:t.$vscodeTextmateLocation,patterns:t.patterns,name:t.scopeName},t.repository.$base=e||t.repository.$self,t}var Pg=class $a{constructor(e,n,r){this.parent=e,this.scopePath=n,this.tokenAttributes=r}static fromExtension(e,n){let r=e,i=e?.scopePath??null;for(const s of n)i=w3.push(i,s.scopeNames),r=new $a(r,i,s.encodedTokenAttributes);return r}static createRoot(e,n){return new $a(null,new w3(null,e),n)}static createRootAndLookUpScopeName(e,n,r){const i=r.getMetadataForScope(e),s=new w3(null,e),o=r.themeProvider.themeMatch(s),a=$a.mergeAttributes(n,i,o);return new $a(null,s,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return $a.equals(this,e)}static equals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.scopeName!==n.scopeName||e.tokenAttributes!==n.tokenAttributes)return!1;e=e.parent,n=n.parent}while(!0)}static mergeAttributes(e,n,r){let i=-1,s=0,o=0;return r!==null&&(i=r.fontStyle,s=r.foregroundId,o=r.backgroundId),p0.set(e,n.languageId,n.tokenType,null,i,s,o)}pushAttributed(e,n){if(e===null)return this;if(e.indexOf(" ")===-1)return $a._pushAttributed(this,e,n);const r=e.split(/ /g);let i=this;for(const s of r)i=$a._pushAttributed(i,s,n);return i}static _pushAttributed(e,n,r){const i=r.getMetadataForScope(n),s=e.scopePath.push(n),o=r.themeProvider.themeMatch(s),a=$a.mergeAttributes(e.tokenAttributes,i,o);return new $a(e,s,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const n=[];let r=this;for(;r&&r!==e;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===e?n.reverse():void 0}},v4=class Ff{constructor(e,n,r,i,s,o,a,l){this.parent=e,this.ruleId=n,this.beginRuleCapturedEOL=s,this.endRule=o,this.nameScopesList=a,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=i}_stackElementBrand=void 0;static NULL=new Ff(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(e){return e===null?!1:Ff._equals(this,e)}static _equals(e,n){return e===n?!0:this._structuralEquals(e,n)?Pg.equals(e.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.depth!==n.depth||e.ruleId!==n.ruleId||e.endRule!==n.endRule)return!1;e=e.parent,n=n.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){Ff._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,r,i,s,o,a){return new Ff(this,e,n,r,i,s,o,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,n){return this.parent&&(n=this.parent._writeString(e,n)),e[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){return this.endRule===e?this:new Ff(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let n=this;for(;n&&n._enterPos===e._enterPos;){if(n.ruleId===e.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(e,n){const r=Pg.fromExtension(e?.nameScopesList??null,n.nameScopesList);return new Ff(e,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Pg.fromExtension(r,n.contentNameScopesList))}},Mwe=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(t,e){this.balancedBracketScopes=t.flatMap(n=>n==="*"?(this.allowAny=!0,[]):G2(n,J2).map(r=>r.matcher)),this.unbalancedBracketScopes=e.flatMap(n=>G2(n,J2).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(t){for(const e of this.unbalancedBracketScopes)if(e(t))return!1;for(const e of this.balancedBracketScopes)if(e(t))return!0;return this.allowAny}},Lwe=class{constructor(t,e,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=t,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(t,e){this.produceFromScopes(t.contentNameScopesList,e)}produceFromScopes(t,e){if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let r=t?.tokenAttributes??0,i=!1;if(this.balancedBracketSelectors?.matchesAlways&&(i=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const s=t?.getScopeNames()??[];for(const o of this._tokenTypeOverrides)o.matcher(s)&&(r=p0.set(r,0,o.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(s))}if(i&&(r=p0.set(r,0,8,i,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=e;return}const n=t?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:n}),this._lastTokenEndIndex=e}getResult(t,e){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===e-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(t,e){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===e-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let r=0,i=this._binaryTokens.length;r0;)o.Q.map(a=>this._loadSingleGrammar(a.scopeName)),o.processQueue();return this._grammarForScopeName(e,n,r,i,s)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const n=this._options.loadGrammar(e);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(e,n=[],r=0,i=null){return this._syncRegistry.addGrammar(e,n),this._grammarForScopeName(e.scopeName,r,i)}_grammarForScopeName(e,n=0,r=null,i=null,s=null){return this._syncRegistry.grammarForScopeName(e,n,r,i,s)}},w4=v4.NULL;const Bwe=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];let Cy=class{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}};Cy.prototype.normal={};Cy.prototype.property={};Cy.prototype.space=void 0;function SZ(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new Cy(n,r,e)}function x4(t){return t.toLowerCase()}class Rs{constructor(e,n){this.attribute=n,this.property=e}}Rs.prototype.attribute="";Rs.prototype.booleanish=!1;Rs.prototype.boolean=!1;Rs.prototype.commaOrSpaceSeparated=!1;Rs.prototype.commaSeparated=!1;Rs.prototype.defined=!1;Rs.prototype.mustUseProperty=!1;Rs.prototype.number=!1;Rs.prototype.overloadedBoolean=!1;Rs.prototype.property="";Rs.prototype.spaceSeparated=!1;Rs.prototype.space=void 0;let zwe=0;const xt=nd(),_r=nd(),_4=nd(),ge=nd(),$n=nd(),kp=nd(),Ns=nd();function nd(){return 2**++zwe}const S4=Object.freeze(Object.defineProperty({__proto__:null,boolean:xt,booleanish:_r,commaOrSpaceSeparated:Ns,commaSeparated:kp,number:ge,overloadedBoolean:_4,spaceSeparated:$n},Symbol.toStringTag,{value:"Module"})),_3=Object.keys(S4);class DE extends Rs{constructor(e,n,r,i){let s=-1;if(super(e,n),CR(this,"space",i),typeof r=="number")for(;++s<_3.length;){const o=_3[s];CR(this,_3[s],(r&S4[o])===S4[o])}}}DE.prototype.defined=!0;function CR(t,e,n){n&&(t[e]=n)}function X0(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const s=new DE(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[x4(r)]=r,n[x4(s.attribute)]=r}return new Cy(e,n,t.space)}const kZ=X0({properties:{ariaActiveDescendant:null,ariaAtomic:_r,ariaAutoComplete:null,ariaBusy:_r,ariaChecked:_r,ariaColCount:ge,ariaColIndex:ge,ariaColSpan:ge,ariaControls:$n,ariaCurrent:null,ariaDescribedBy:$n,ariaDetails:null,ariaDisabled:_r,ariaDropEffect:$n,ariaErrorMessage:null,ariaExpanded:_r,ariaFlowTo:$n,ariaGrabbed:_r,ariaHasPopup:null,ariaHidden:_r,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:$n,ariaLevel:ge,ariaLive:null,ariaModal:_r,ariaMultiLine:_r,ariaMultiSelectable:_r,ariaOrientation:null,ariaOwns:$n,ariaPlaceholder:null,ariaPosInSet:ge,ariaPressed:_r,ariaReadOnly:_r,ariaRelevant:null,ariaRequired:_r,ariaRoleDescription:$n,ariaRowCount:ge,ariaRowIndex:ge,ariaRowSpan:ge,ariaSelected:_r,ariaSetSize:ge,ariaSort:null,ariaValueMax:ge,ariaValueMin:ge,ariaValueNow:ge,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function CZ(t,e){return e in t?t[e]:e}function AZ(t,e){return CZ(t,e.toLowerCase())}const Uwe=X0({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:kp,acceptCharset:$n,accessKey:$n,action:null,allow:null,allowFullScreen:xt,allowPaymentRequest:xt,allowUserMedia:xt,alt:null,as:null,async:xt,autoCapitalize:null,autoComplete:$n,autoFocus:xt,autoPlay:xt,blocking:$n,capture:null,charSet:null,checked:xt,cite:null,className:$n,cols:ge,colSpan:null,content:null,contentEditable:_r,controls:xt,controlsList:$n,coords:ge|kp,crossOrigin:null,data:null,dateTime:null,decoding:null,default:xt,defer:xt,dir:null,dirName:null,disabled:xt,download:_4,draggable:_r,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:xt,formTarget:null,headers:$n,height:ge,hidden:_4,high:ge,href:null,hrefLang:null,htmlFor:$n,httpEquiv:$n,id:null,imageSizes:null,imageSrcSet:null,inert:xt,inputMode:null,integrity:null,is:null,isMap:xt,itemId:null,itemProp:$n,itemRef:$n,itemScope:xt,itemType:$n,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:xt,low:ge,manifest:null,max:null,maxLength:ge,media:null,method:null,min:null,minLength:ge,multiple:xt,muted:xt,name:null,nonce:null,noModule:xt,noValidate:xt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:xt,optimum:ge,pattern:null,ping:$n,placeholder:null,playsInline:xt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:xt,referrerPolicy:null,rel:$n,required:xt,reversed:xt,rows:ge,rowSpan:ge,sandbox:$n,scope:null,scoped:xt,seamless:xt,selected:xt,shadowRootClonable:xt,shadowRootDelegatesFocus:xt,shadowRootMode:null,shape:null,size:ge,sizes:null,slot:null,span:ge,spellCheck:_r,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ge,step:null,style:null,tabIndex:ge,target:null,title:null,translate:null,type:null,typeMustMatch:xt,useMap:null,value:_r,width:ge,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:$n,axis:null,background:null,bgColor:null,border:ge,borderColor:null,bottomMargin:ge,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:xt,declare:xt,event:null,face:null,frame:null,frameBorder:null,hSpace:ge,leftMargin:ge,link:null,longDesc:null,lowSrc:null,marginHeight:ge,marginWidth:ge,noResize:xt,noHref:xt,noShade:xt,noWrap:xt,object:null,profile:null,prompt:null,rev:null,rightMargin:ge,rules:null,scheme:null,scrolling:_r,standby:null,summary:null,text:null,topMargin:ge,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ge,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:xt,disableRemotePlayback:xt,prefix:null,property:null,results:ge,security:null,unselectable:null},space:"html",transform:AZ}),jwe=X0({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ns,accentHeight:ge,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ge,amplitude:ge,arabicForm:null,ascent:ge,attributeName:null,attributeType:null,azimuth:ge,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ge,by:null,calcMode:null,capHeight:ge,className:$n,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ge,diffuseConstant:ge,direction:null,display:null,dur:null,divisor:ge,dominantBaseline:null,download:xt,dx:null,dy:null,edgeMode:null,editable:null,elevation:ge,enableBackground:null,end:null,event:null,exponent:ge,externalResourcesRequired:null,fill:null,fillOpacity:ge,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:kp,g2:kp,glyphName:kp,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ge,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ge,horizOriginX:ge,horizOriginY:ge,id:null,ideographic:ge,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ge,k:ge,k1:ge,k2:ge,k3:ge,k4:ge,kernelMatrix:Ns,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ge,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ge,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ge,overlineThickness:ge,paintOrder:null,panose1:null,path:null,pathLength:ge,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:$n,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ge,pointsAtY:ge,pointsAtZ:ge,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ns,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ns,rev:Ns,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ns,requiredFeatures:Ns,requiredFonts:Ns,requiredFormats:Ns,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ge,specularExponent:ge,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ge,strikethroughThickness:ge,string:null,stroke:null,strokeDashArray:Ns,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ge,strokeOpacity:ge,strokeWidth:null,style:null,surfaceScale:ge,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ns,tabIndex:ge,tableValues:null,target:null,targetX:ge,targetY:ge,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ns,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ge,underlineThickness:ge,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ge,values:null,vAlphabetic:ge,vMathematical:ge,vectorEffect:null,vHanging:ge,vIdeographic:ge,version:null,vertAdvY:ge,vertOriginX:ge,vertOriginY:ge,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ge,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:CZ}),EZ=X0({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),TZ=X0({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:AZ}),DZ=X0({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),qwe=/[A-Z]/g,AR=/-[a-z]/g,Vwe=/^data[-\w.:]+$/i;function Zwe(t,e){const n=x4(e);let r=e,i=Rs;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Vwe.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(AR,Wwe);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!AR.test(s)){let o=s.replace(qwe,Xwe);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=DE}return new i(r,e)}function Xwe(t){return"-"+t.toLowerCase()}function Wwe(t){return t.charAt(1).toUpperCase()}const Ywe=SZ([kZ,Uwe,EZ,TZ,DZ],"html"),PZ=SZ([kZ,jwe,EZ,TZ,DZ],"svg"),ER={}.hasOwnProperty;function Gwe(t,e){const n=e||{};function r(i,...s){let o=r.invalid;const a=r.handlers;if(i&&ER.call(i,t)){const l=String(i[t]);o=ER.call(a,l)?a[l]:r.unknown}if(o)return o.call(this,i,...s)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const Hwe=/["&'<>`]/g,Kwe=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Jwe=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,exe=/[|\\{}()[\]^$+*?.]/g,TR=new WeakMap;function txe(t,e){if(t=t.replace(e.subset?nxe(e.subset):Hwe,r),e.subset||e.escapeOnly)return t;return t.replace(Kwe,n).replace(Jwe,r);function n(i,s,o){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,o.charCodeAt(s+2),e)}function r(i,s,o){return e.format(i.charCodeAt(0),o.charCodeAt(s+1),e)}}function nxe(t){let e=TR.get(t);return e||(e=rxe(t),TR.set(t,e)),e}function rxe(t){const e=[];let n=-1;for(;++n",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},uxe=["cent","copy","divide","gt","lt","not","para","times"],RZ={}.hasOwnProperty,k4={};let $b;for($b in S3)RZ.call(S3,$b)&&(k4[S3[$b]]=$b);const cxe=/[^\dA-Za-z]/;function fxe(t,e,n,r){const i=String.fromCharCode(t);if(RZ.call(k4,i)){const s=k4[i],o="&"+s;return n&&lxe.includes(s)&&!uxe.includes(s)&&(!r||e&&e!==61&&cxe.test(String.fromCharCode(e)))?o:o+";"}return""}function hxe(t,e,n){let r=sxe(t,e,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=fxe(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){const s=axe(t,e,n.omitOptionalSemicolons);s.length|^->||--!>|"],mxe=["<",">"];function gxe(t,e,n,r){return r.settings.bogusComments?"":"";function i(s){return Cp(s,Object.assign({},r.settings.characterReferences,{subset:mxe}))}}function yxe(t,e,n,r){return""}function DR(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(e);for(;i!==-1;)r++,i=n.indexOf(e,i+e.length);return r}function bxe(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function Oxe(t){return t.join(" ").trim()}const vxe=/[ \t\n\f\r]/g;function PE(t){return typeof t=="object"?t.type==="text"?PR(t.value):!1:PR(t)}function PR(t){return t.replace(vxe,"")===""}const Ur=FZ(1),IZ=FZ(-1),wxe=[];function FZ(t){return e;function e(n,r,i){const s=n?n.children:wxe;let o=(r||0)+t,a=s[o];if(!i)for(;a&&PE(a);)o+=t,a=s[o];return a}}const xxe={}.hasOwnProperty;function $Z(t){return e;function e(n,r,i){return xxe.call(t,n.tagName)&&t[n.tagName](n,r,i)}}const RE=$Z({body:Sxe,caption:k3,colgroup:k3,dd:Exe,dt:Axe,head:k3,html:_xe,li:Cxe,optgroup:Txe,option:Dxe,p:kxe,rp:RR,rt:RR,tbody:Rxe,td:IR,tfoot:Ixe,th:IR,thead:Pxe,tr:Fxe});function k3(t,e,n){const r=Ur(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&PE(r.value.charAt(0)))}function _xe(t,e,n){const r=Ur(n,e);return!r||r.type!=="comment"}function Sxe(t,e,n){const r=Ur(n,e);return!r||r.type!=="comment"}function kxe(t,e,n){const r=Ur(n,e);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function Cxe(t,e,n){const r=Ur(n,e);return!r||r.type==="element"&&r.tagName==="li"}function Axe(t,e,n){const r=Ur(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function Exe(t,e,n){const r=Ur(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function RR(t,e,n){const r=Ur(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Txe(t,e,n){const r=Ur(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function Dxe(t,e,n){const r=Ur(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function Pxe(t,e,n){const r=Ur(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function Rxe(t,e,n){const r=Ur(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Ixe(t,e,n){return!Ur(n,e)}function Fxe(t,e,n){const r=Ur(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function IR(t,e,n){const r=Ur(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const $xe=$Z({body:Nxe,colgroup:Qxe,head:Lxe,html:Mxe,tbody:Bxe});function Mxe(t){const e=Ur(t,-1);return!e||e.type!=="comment"}function Lxe(t){const e=new Set;for(const r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}const n=t.children[0];return!n||n.type==="element"}function Nxe(t){const e=Ur(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&PE(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function Qxe(t,e,n){const r=IZ(n,e),i=Ur(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&RE(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function Bxe(t,e,n){const r=IZ(n,e),i=Ur(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&RE(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}const Mb={name:[[` \f\r &/=>`.split(""),` \f\r "&'/=>\``.split("")],[`\0 \f\r "&'/<=>`.split(""),`\0 \f\r "&'/<=>\``.split("")]],unquoted:[[` \f\r &>`.split(""),`\0 \f\r "&'<=>\``.split("")],[`\0 \f\r "&'<=>\``.split(""),`\0 \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function zxe(t,e,n,r){const i=r.schema,s=i.space==="svg"?!1:r.settings.omitOptionalTags;let o=i.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const a=[];let l;i.space==="html"&&t.tagName==="svg"&&(r.schema=PZ);const u=Uxe(r,t.properties),c=r.all(i.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=i,c&&(o=!1),(u||!s||!$xe(t,e,n))&&(a.push("<",t.tagName,u?" "+u:""),o&&(i.space==="svg"||r.settings.closeSelfClosing)&&(l=u.charAt(u.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(c),!o&&(!s||!RE(t,e,n))&&a.push(""),a.join("")}function Uxe(t,e){const n=[];let r=-1,i;if(e){for(i in e)if(e[i]!==null&&e[i]!==void 0){const s=jxe(t,i,e[i]);s&&n.push(s)}}for(;++rDR(n,t.alternative)&&(o=t.alternative),a=o+Cp(n,Object.assign({},t.settings.characterReferences,{subset:(o==="'"?Mb.single:Mb.double)[i][s],attribute:!0}))+o),l+(a&&"="+a))}const qxe=["<","&"];function MZ(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:Cp(t.value,Object.assign({},r.settings.characterReferences,{subset:qxe}))}function Vxe(t,e,n,r){return r.settings.allowDangerousHtml?t.value:MZ(t,e,n,r)}function Zxe(t,e,n,r){return r.all(t)}const Xxe=Gwe("type",{invalid:Wxe,unknown:Yxe,handlers:{comment:gxe,doctype:yxe,element:zxe,raw:Vxe,root:Zxe,text:MZ}});function Wxe(t){throw new Error("Expected node, not `"+t+"`")}function Yxe(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const Gxe={},Hxe={},Kxe=[];function Jxe(t,e){const n=Gxe,r=n.quote||'"',i=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:e_e,all:t_e,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||Bwe,characterReferences:n.characterReferences||Hxe,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?PZ:Ywe,quote:r,alternative:i}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function e_e(t,e,n){return Xxe(t,e,n,this)}function t_e(t){const e=[],n=t&&t.children||Kxe;let r=-1;for(;++rn&&r.push({...t,content:t.content.slice(n,i),offset:t.offset+n}),n=i;return nr-i);return n.length?t.map(r=>r.flatMap(i=>{const s=n.filter(o=>i.offseto-i.offset).sort((o,a)=>o-a);return s.length?s_e(i,s):i})):t}async function NZ(t){return Promise.resolve(typeof t=="function"?t():t).then(e=>e.default||e)}function ew(t,e){const n=typeof t=="string"?{}:{...t.colorReplacements},r=typeof t=="string"?t:t.name;for(const[i,s]of Object.entries(e?.colorReplacements||{}))typeof s=="string"?n[i]=s:i===r&&Object.assign(n,s);return n}function Jf(t,e){return t&&(e?.[t?.toLowerCase()]||t)}function QZ(t){const e={};return t.color&&(e.color=t.color),t.bgColor&&(e["background-color"]=t.bgColor),t.fontStyle&&(t.fontStyle&xu.Italic&&(e["font-style"]="italic"),t.fontStyle&xu.Bold&&(e["font-weight"]="bold"),t.fontStyle&xu.Underline&&(e["text-decoration"]="underline")),e}function a_e(t){return typeof t=="string"?t:Object.entries(t).map(([e,n])=>`${e}:${n}`).join(";")}function l_e(t){const e=Gx(t,!0).map(([i])=>i);function n(i){if(i===t.length)return{line:e.length-1,character:e[e.length-1].length};let s=i,o=0;for(const a of e){if(s[r,w4])),e)}constructor(...e){if(e.length===2){const[n,r]=e;this.lang=r,this._stacks=n}else{const[n,r,i]=e;this.lang=r,this._stacks={[i]:n}}}getInternalStack(e=this.theme){return this._stacks[e]}get scopes(){return FR(this._stacks[this.theme])}getScopes(e=this.theme){return FR(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function FR(t){const e=[],n=new Set;function r(i){if(n.has(i))return;n.add(i);const s=i?.nameScopesList?.scopeName;s&&e.push(s),i.parent&&r(i.parent)}return r(t),e}function u_e(t,e){if(!(t instanceof W0))throw new ji("Invalid grammar state");return t.getInternalStack(e)}function c_e(){const t=new WeakMap;function e(n){if(!t.has(n.meta)){let r=function(o){if(typeof o=="number"){if(o<0||o>n.source.length)throw new ji(`Invalid decoration offset: ${o}. Code length: ${n.source.length}`);return{...i.indexToPos(o),offset:o}}else{const a=i.lines[o.line];if(a===void 0)throw new ji(`Invalid decoration position ${JSON.stringify(o)}. Lines length: ${i.lines.length}`);if(o.character<0||o.character>a.length)throw new ji(`Invalid decoration position ${JSON.stringify(o)}. Line ${o.line} length: ${a.length}`);return{...o,offset:i.posToIndex(o.line,o.character)}}};const i=l_e(n.source),s=(n.options.decorations||[]).map(o=>({...o,start:r(o.start),end:r(o.end)}));f_e(s),t.set(n.meta,{decorations:s,converter:i,source:n.source})}return t.get(n.meta)}return{name:"shiki:decorations",tokens(n){if(!this.options.decorations?.length)return;const i=e(this).decorations.flatMap(o=>[o.start.offset,o.end.offset]);return o_e(n,i)},code(n){if(!this.options.decorations?.length)return;const r=e(this),i=Array.from(n.children).filter(c=>c.type==="element"&&c.tagName==="span");if(i.length!==r.converter.lines.length)throw new ji(`Number of lines in code element (${i.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function s(c,f,h,d){const p=i[c];let m="",g=-1,y=-1;if(f===0&&(g=0),h===0&&(y=0),h===Number.POSITIVE_INFINITY&&(y=p.children.length),g===-1||y===-1)for(let v=0;vm);return c.tagName=f.tagName||"span",c.properties={...c.properties,...d,class:c.properties.class},f.properties?.class&&LZ(c,f.properties.class),c=p(c,h)||c,c}const l=[],u=r.decorations.sort((c,f)=>f.start.offset-c.start.offset);for(const c of u){const{start:f,end:h}=c;if(f.line===h.line)s(f.line,f.character,h.character,c);else if(f.lineo(d,c));s(h.line,0,h.character,c)}}l.forEach(c=>c())}}}function f_e(t){for(let e=0;en.end.offset)throw new ji(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=e+1;rNumber.parseInt(o));s.length===3&&!s.some(o=>Number.isNaN(o))&&(i={type:"rgb",rgb:s})}else if(r==="5"){const s=Number.parseInt(t[e+n]);Number.isNaN(s)||(i={type:"table",index:Number(s)})}return[n,i]}function p_e(t){const e=[];for(let n=0;n=90&&i<=97?e.push({type:"setForegroundColor",value:{type:"named",name:eh[i-90+8]}}):i>=100&&i<=107&&e.push({type:"setBackgroundColor",value:{type:"named",name:eh[i-100+8]}})}return e}function m_e(){let t=null,e=null,n=new Set;return{parse(r){const i=[];let s=0;do{const o=d_e(r,s),a=o.sequence?r.substring(s,o.startPosition):r.substring(s);if(a.length>0&&i.push({value:a,foreground:t,background:e,decorations:new Set(n)}),o.sequence){const l=p_e(o.sequence);for(const u of l)u.type==="resetAll"?(t=null,e=null,n.clear()):u.type==="resetForegroundColor"?t=null:u.type==="resetBackgroundColor"?e=null:u.type==="resetDecoration"&&n.delete(u.value);for(const u of l)u.type==="setForegroundColor"?t=u.value:u.type==="setBackgroundColor"?e=u.value:u.type==="setDecoration"&&n.add(u.value)}s=o.position}while(sMath.max(0,Math.min(l,255)).toString(16).padStart(2,"0")).join("")}`}let r;function i(){if(r)return r;r=[];for(let u=0;u[a,t.colors?.[`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`]]))),o=m_e();return i.map(a=>o.parse(a[0]).map(l=>{let u,c;l.decorations.has("reverse")?(u=l.background?s.value(l.background):t.bg,c=l.foreground?s.value(l.foreground):t.fg):(u=l.foreground?s.value(l.foreground):t.fg,c=l.background?s.value(l.background):void 0),u=Jf(u,r),c=Jf(c,r),l.decorations.has("dim")&&(u=O_e(u));let f=xu.None;return l.decorations.has("bold")&&(f|=xu.Bold),l.decorations.has("italic")&&(f|=xu.Italic),l.decorations.has("underline")&&(f|=xu.Underline),{content:l.value,offset:a[1],color:u,bgColor:c,fontStyle:f}}))}function O_e(t){const e=t.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);if(e)if(e[3]){const r=Math.round(Number.parseInt(e[3],16)/2).toString(16).padStart(2,"0");return`#${e[1]}${e[2]}${r}`}else return e[2]?`#${e[1]}${e[2]}80`:`#${Array.from(e[1]).map(r=>`${r}${r}`).join("")}80`;const n=t.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:t}function $E(t,e,n={}){const{lang:r="text",theme:i=t.getLoadedThemes()[0]}=n;if(IE(r)||FE(i))return Gx(e).map(l=>[{content:l[0],offset:l[1]}]);const{theme:s,colorMap:o}=t.setTheme(i);if(r==="ansi")return b_e(s,e,n);const a=t.getLanguage(r);if(n.grammarState){if(n.grammarState.lang!==a.name)throw new mh(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${a.name}"`);if(!n.grammarState.themes.includes(s.name))throw new mh(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${s.name}"`)}return w_e(e,a,s,o,n)}function v_e(...t){if(t.length===2)return $1(t[1]);const[e,n,r={}]=t,{lang:i="text",theme:s=e.getLoadedThemes()[0]}=r;if(IE(i)||FE(s))throw new mh("Plain language does not have grammar state");if(i==="ansi")throw new mh("ANSI language does not have grammar state");const{theme:o,colorMap:a}=e.setTheme(s),l=e.getLanguage(i);return new W0(nw(n,l,o,a,r).stateStack,l.name,o.name)}function w_e(t,e,n,r,i){const s=nw(t,e,n,r,i),o=new W0(nw(t,e,n,r,i).stateStack,e.name,n.name);return Hx(s.tokens,o),s.tokens}function nw(t,e,n,r,i){const s=ew(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:a=500}=i,l=Gx(t);let u=i.grammarState?u_e(i.grammarState,n.name)??w4:i.grammarContextCode!=null?nw(i.grammarContextCode,e,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack:w4,c=[];const f=[];for(let h=0,d=l.length;h0&&p.length>=o){c=[],f.push([{content:p,offset:m,color:"",fontStyle:0}]);continue}let g,y,O;i.includeExplanation&&(g=e.tokenizeLine(p,u),y=g.tokens,O=0);const v=e.tokenizeLine2(p,u,a),w=v.tokens.length/2;for(let x=0;xQ.trim());break;case"object":$=R.scope;break;default:continue}E.push({settings:R,selectors:$.map(Q=>Q.split(/ /))})}A.explanation=[];let T=0;for(;S+T<_;){const R=y[O],$=p.substring(R.startIndex,R.endIndex);T+=$.length,A.explanation.push({content:$,scopes:i.includeExplanation==="scopeName"?x_e(R.scopes):__e(E,R.scopes)}),O+=1}}c.push(A)}f.push(c),c=[],u=v.ruleStack}return{tokens:f,stateStack:u}}function x_e(t){return t.map(e=>({scopeName:e}))}function __e(t,e){const n=[];for(let r=0,i=e.length;r=0&&i>=0;)MR(t[r],n[i])&&(r-=1),i-=1;return r===-1}function k_e(t,e,n){const r=[];for(const{selectors:i,settings:s}of t)for(const o of i)if(S_e(o,e,n)){r.push(s);break}return r}function UZ(t,e,n){const r=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),i=r.map(l=>{const u=$E(t,e,{...n,theme:l.theme}),c=$1(u),f=typeof l.theme=="string"?l.theme:l.theme.name;return{tokens:u,state:c,theme:f}}),s=C_e(...i.map(l=>l.tokens)),o=s[0].map((l,u)=>l.map((c,f)=>{const h={content:c.content,variants:{},offset:c.offset};return"includeExplanation"in n&&n.includeExplanation&&(h.explanation=c.explanation),s.forEach((d,p)=>{const{content:m,explanation:g,offset:y,...O}=d[u][f];h.variants[r[p].color]=O}),h})),a=i[0].state?new W0(Object.fromEntries(i.map(l=>[l.theme,l.state?.getInternalStack(l.theme)])),i[0].state.lang):void 0;return a&&Hx(o,a),o}function C_e(...t){const e=t.map(()=>[]),n=t.length;for(let r=0;rl[r]),s=e.map(()=>[]);e.forEach((l,u)=>l.push(s[u]));const o=i.map(()=>0),a=i.map(l=>l[0]);for(;a.every(l=>l);){const l=Math.min(...a.map(u=>u.content.length));for(let u=0;ug[1]).map(g=>({color:g[0],theme:g[1]})).sort((g,y)=>g.color===u?-1:y.color===u?1:0);if(f.length===0)throw new mh("`themes` option must not be empty");const h=UZ(t,e,n);if(l=$1(h),u&&!f.find(g=>g.color===u))throw new mh(`\`themes\` option must contain the defaultColor key \`${u}\``);const d=f.map(g=>t.getTheme(g.theme)),p=f.map(g=>g.color);s=h.map(g=>g.map(y=>A_e(y,p,c,u))),l&&Hx(s,l);const m=f.map(g=>ew(g.theme,n));i=f.map((g,y)=>(y===0&&u?"":`${c+g.color}:`)+(Jf(d[y].fg,m[y])||"inherit")).join(";"),r=f.map((g,y)=>(y===0&&u?"":`${c+g.color}-bg:`)+(Jf(d[y].bg,m[y])||"inherit")).join(";"),o=`shiki-themes ${d.map(g=>g.name).join(" ")}`,a=u?void 0:[i,r].join(";")}else if("theme"in n){const u=ew(n.theme,n);s=$E(t,e,n);const c=t.getTheme(n.theme);r=Jf(c.bg,u),i=Jf(c.fg,u),o=c.name,l=$1(s)}else throw new mh("Invalid options, either `theme` or `themes` must be provided");return{tokens:s,fg:i,bg:r,themeName:o,rootStyle:a,grammarState:l}}function A_e(t,e,n,r){const i={content:t.content,explanation:t.explanation,offset:t.offset},s=e.map(l=>QZ(t.variants[l])),o=new Set(s.flatMap(l=>Object.keys(l))),a={};return s.forEach((l,u)=>{for(const c of o){const f=l[c]||"inherit";if(u===0&&r)a[c]=f;else{const h=c==="color"?"":c==="background-color"?"-bg":`-${c}`,d=n+e[u]+(c==="color"?"":h);a[d]=f}}}),i.htmlStyle=a,i}function iw(t,e,n,r={meta:{},options:n,codeToHast:(i,s)=>iw(t,i,s),codeToTokens:(i,s)=>rw(t,i,s)}){let i=e;for(const d of tw(n))i=d.preprocess?.call(r,i,n)||i;let{tokens:s,fg:o,bg:a,themeName:l,rootStyle:u,grammarState:c}=rw(t,i,n);const{mergeWhitespaces:f=!0}=n;f===!0?s=T_e(s):f==="never"&&(s=D_e(s));const h={...r,get source(){return i}};for(const d of tw(n))s=d.tokens?.call(h,s)||s;return E_e(s,{...n,fg:o,bg:a,themeName:l,rootStyle:u},h,c)}function E_e(t,e,n,r=$1(t)){const i=tw(e),s=[],o={type:"root",children:[]},{structure:a="classic",tabindex:l="0"}=e;let u={type:"element",tagName:"pre",properties:{class:`shiki ${e.themeName||""}`,style:e.rootStyle||`background-color:${e.bg};color:${e.fg}`,...l!==!1&&l!=null?{tabindex:l.toString()}:{},...Object.fromEntries(Array.from(Object.entries(e.meta||{})).filter(([p])=>!p.startsWith("_")))},children:[]},c={type:"element",tagName:"code",properties:{},children:s};const f=[],h={...n,structure:a,addClassToHast:LZ,get source(){return n.source},get tokens(){return t},get options(){return e},get root(){return o},get pre(){return u},get code(){return c},get lines(){return f}};if(t.forEach((p,m)=>{m&&(a==="inline"?o.children.push({type:"element",tagName:"br",properties:{},children:[]}):a==="classic"&&s.push({type:"text",value:` `}));let g={type:"element",tagName:"span",properties:{class:"line"},children:[]},y=0;for(const O of p){let v={type:"element",tagName:"span",properties:{...O.htmlAttrs},children:[{type:"text",value:O.content}]};O.htmlStyle;const w=a_e(O.htmlStyle||QZ(O));w&&(v.properties.style=w);for(const x of i)v=x?.span?.call(h,v,m+1,y,g,O)||v;a==="inline"?o.children.push(v):a==="classic"&&g.children.push(v),y+=O.content.length}if(a==="classic"){for(const O of i)g=O?.line?.call(h,g,m+1)||g;f.push(g),s.push(g)}}),a==="classic"){for(const p of i)c=p?.code?.call(h,c)||c;u.children.push(c);for(const p of i)u=p?.pre?.call(h,u)||u;o.children.push(u)}let d=o;for(const p of i)d=p?.root?.call(h,d)||d;return r&&Hx(d,r),d}function T_e(t){return t.map(e=>{const n=[];let r="",i=0;return e.forEach((s,o)=>{const l=!(s.fontStyle&&s.fontStyle&xu.Underline);l&&s.content.match(/^\s+$/)&&e[o+1]?(i||(i=s.offset),r+=s.content):r?(l?n.push({...s,offset:i,content:r+s.content}):n.push({content:r,offset:i},s),i=0,r=""):n.push(s)}),n})}function D_e(t){return t.map(e=>e.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const r=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!r)return n;const[,i,s,o]=r;if(!i&&!o)return n;const a=[{...n,offset:n.offset+i.length,content:s}];return i&&a.unshift({content:i,offset:n.offset}),o&&a.push({content:o,offset:n.offset+i.length+s.length}),a}))}function P_e(t,e,n){const r={meta:{},options:n,codeToHast:(s,o)=>iw(t,s,o),codeToTokens:(s,o)=>rw(t,s,o)};let i=Jxe(iw(t,e,n,r));for(const s of tw(n))i=s.postprocess?.call(r,i,n)||i;return i}const LR={light:"#333333",dark:"#bbbbbb"},NR={light:"#fffffe",dark:"#1e1e1e"},QR="__shiki_resolved";function ME(t){if(t?.[QR])return t;const e={...t};e.tokenColors&&!e.settings&&(e.settings=e.tokenColors,delete e.tokenColors),e.type||="dark",e.colorReplacements={...e.colorReplacements},e.settings||=[];let{bg:n,fg:r}=e;if(!n||!r){const a=e.settings?e.settings.find(l=>!l.name&&!l.scope):void 0;a?.settings?.foreground&&(r=a.settings.foreground),a?.settings?.background&&(n=a.settings.background),!r&&e?.colors?.["editor.foreground"]&&(r=e.colors["editor.foreground"]),!n&&e?.colors?.["editor.background"]&&(n=e.colors["editor.background"]),r||(r=e.type==="light"?LR.light:LR.dark),n||(n=e.type==="light"?NR.light:NR.dark),e.fg=r,e.bg=n}e.settings[0]&&e.settings[0].settings&&!e.settings[0].scope||e.settings.unshift({settings:{foreground:e.fg,background:e.bg}});let i=0;const s=new Map;function o(a){if(s.has(a))return s.get(a);i+=1;const l=`#${i.toString(16).padStart(8,"0").toLowerCase()}`;return e.colorReplacements?.[`#${l}`]?o(a):(s.set(a,l),l)}e.settings=e.settings.map(a=>{const l=a.settings?.foreground&&!a.settings.foreground.startsWith("#"),u=a.settings?.background&&!a.settings.background.startsWith("#");if(!l&&!u)return a;const c={...a,settings:{...a.settings}};if(l){const f=o(a.settings.foreground);e.colorReplacements[f]=a.settings.foreground,c.settings.foreground=f}if(u){const f=o(a.settings.background);e.colorReplacements[f]=a.settings.background,c.settings.background=f}return c});for(const a of Object.keys(e.colors||{}))if((a==="editor.foreground"||a==="editor.background"||a.startsWith("terminal.ansi"))&&!e.colors[a]?.startsWith("#")){const l=o(e.colors[a]);e.colorReplacements[l]=e.colors[a],e.colors[a]=l}return Object.defineProperty(e,QR,{enumerable:!1,writable:!1,value:!0}),e}async function jZ(t){return Array.from(new Set((await Promise.all(t.filter(e=>!r_e(e)).map(async e=>await NZ(e).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function qZ(t){return(await Promise.all(t.map(async n=>i_e(n)?null:ME(await NZ(n))))).filter(n=>!!n)}class R_e extends Qwe{constructor(e,n,r,i={}){super(e),this._resolver=e,this._themes=n,this._langs=r,this._alias=i,this._themes.map(s=>this.loadTheme(s)),this.loadLanguages(this._langs)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(e){return typeof e=="string"?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const n=ME(e);return n.name&&(this._resolvedThemes.set(n.name,n),this._loadedThemesCache=null),n}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let n=this._textmateThemeCache.get(e);n||(n=Y2.createFromRawTheme(e),this._textmateThemeCache.set(e,n)),this._syncRegistry.setTheme(n)}getGrammar(e){if(this._alias[e]){const n=new Set([e]);for(;this._alias[e];){if(e=this._alias[e],n.has(e))throw new ji(`Circular alias \`${Array.from(n).join(" -> ")} -> ${e}\``);n.add(e)}}return this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const n=new Set([...this._langMap.values()].filter(s=>s.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);const r={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const i=this.loadGrammarWithConfiguration(e.scopeName,1,r);if(i.name=e.name,this._resolvedGrammars.set(e.name,i),e.aliases&&e.aliases.forEach(s=>{this._alias[s]=e.name}),this._loadedLanguagesCache=null,n.size)for(const s of n)this._resolvedGrammars.delete(s.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(s.scopeName),this._syncRegistry?._grammars?.delete(s.scopeName),this.loadLanguage(this._langMap.get(s.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const i of e)this.resolveEmbeddedLanguages(i);const n=Array.from(this._langGraph.entries()),r=n.filter(([i,s])=>!s);if(r.length){const i=n.filter(([s,o])=>o&&o.embeddedLangs?.some(a=>r.map(([l])=>l).includes(a))).filter(s=>!r.includes(s));throw new ji(`Missing languages ${r.map(([s])=>`\`${s}\``).join(", ")}, required by ${i.map(([s])=>`\`${s}\``).join(", ")}`)}for(const[i,s]of n)this._resolver.addLanguage(s);for(const[i,s]of n)this.loadLanguage(s)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){if(this._langMap.set(e.name,e),this._langGraph.set(e.name,e),e.embeddedLangs)for(const n of e.embeddedLangs)this._langGraph.set(n,this._langMap.get(n))}}class I_e{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,n){this._onigLib={createOnigScanner:r=>e.createScanner(r),createOnigString:r=>e.createString(r)},n.forEach(r=>this.addLanguage(r))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(n=>{this._langs.set(n,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(n=>{this._injections.get(n)||this._injections.set(n,[]),this._injections.get(n).push(e.scopeName)})}getInjections(e){const n=e.split(".");let r=[];for(let i=1;i<=n.length;i++){const s=n.slice(0,i).join(".");r=[...r,...this._injections.get(s)||[]]}return r}}let km=0;function F_e(t){km+=1,t.warnings!==!1&&km>=10&&km%10===0&&console.warn(`[Shiki] ${km} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let e=!1;if(!t.engine)throw new ji("`engine` option is required for synchronous mode");const n=(t.langs||[]).flat(1),r=(t.themes||[]).flat(1).map(ME),i=new I_e(t.engine,n),s=new R_e(i,r,n,t.langAlias);let o;function a(O){g();const v=s.getGrammar(typeof O=="string"?O:O.name);if(!v)throw new ji(`Language \`${O}\` not found, you may need to load it first`);return v}function l(O){if(O==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};g();const v=s.getTheme(O);if(!v)throw new ji(`Theme \`${O}\` not found, you may need to load it first`);return v}function u(O){g();const v=l(O);o!==O&&(s.setTheme(v),o=O);const w=s.getColorMap();return{theme:v,colorMap:w}}function c(){return g(),s.getLoadedThemes()}function f(){return g(),s.getLoadedLanguages()}function h(...O){g(),s.loadLanguages(O.flat(1))}async function d(...O){return h(await jZ(O))}function p(...O){g();for(const v of O.flat(1))s.loadTheme(v)}async function m(...O){return g(),p(await qZ(O))}function g(){if(e)throw new ji("Shiki instance has been disposed")}function y(){e||(e=!0,s.dispose(),km-=1)}return{setTheme:u,getTheme:l,getLanguage:a,getLoadedThemes:c,getLoadedLanguages:f,loadLanguage:d,loadLanguageSync:h,loadTheme:m,loadThemeSync:p,dispose:y,[Symbol.dispose]:y}}async function $_e(t={}){t.loadWasm;const[e,n,r]=await Promise.all([qZ(t.themes||[]),jZ(t.langs||[]),t.engine||J2e(t.loadWasm||K2e())]);return F_e({...t,themes:e,langs:n,engine:r})}async function M_e(t={}){const e=await $_e(t);return{getLastGrammarState:(...n)=>v_e(e,...n),codeToTokensBase:(n,r)=>$E(e,n,r),codeToTokensWithThemes:(n,r)=>UZ(e,n,r),codeToTokens:(n,r)=>rw(e,n,r),codeToHast:(n,r)=>iw(e,n,r),codeToHtml:(n,r)=>P_e(e,n,r),...e,getInternalContext:()=>e}}const C4=Io({linkify:!0,typographer:!0});(async()=>{const t=await M_e({themes:[f3(()=>import("./vitesse-light-CVO1_9PV.js"),[],import.meta.url),f3(()=>import("./vitesse-dark-D0r3Knsf.js"),[],import.meta.url)],langs:[f3(()=>import("./javascript-ySlJ1b_l.js"),[],import.meta.url)]});C4.use(F2e(t,{themes:{light:"vitesse-light",dark:"vitesse-dark"}}))})();function Ap(t,e=!0){return e?C4.renderInline(t):C4.render(t)}const L_e=tc({String:P.string,Number:P.number,"True False":P.bool,PropertyName:P.propertyName,Null:P.null,", :":P.separator,"[ ]":P.squareBracket,"{ }":P.brace}),N_e=ju.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[L_e],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),Q_e=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=B_e(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function B_e(t,e){let n;return(n=t.message.match(/at position (\d+)/))?Math.min(+n[1],e.length):(n=t.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+n[1]).from+ +n[2]-1,e.length):0}const VZ=Uu.define({name:"json",parser:N_e.configure({props:[pf.add({Object:Ru({except:/^\s*\}/}),Array:Ru({except:/^\s*\]/})}),mf.add({"Object Array":$x})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function z_e(){return new af(VZ)}var A3={},BR;function U_e(){return BR||(BR=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.parse=t.enableErrorLogging=t.disableErrorLogging=t.setErrorLogger=void 0;let e=console.error;function n(_){e=_}t.setErrorLogger=n;function r(){e=()=>{}}t.disableErrorLogging=r;function i(){e=console.error}t.enableErrorLogging=i;function s(_){if(_!==void 0){if(_===null)return null;if(_==="")return"";_=_.replace(/\\+$/,k=>k.length%2===0?k:k.slice(0,-1));try{return JSON.parse(_)}catch(k){const[C,D]=_.trimLeft()[0]===":"?o(_,k):o(_,k,y);if(s.lastParseReminding=D,s.onExtraToken&&D.length>0){const A=D.trimRight();s.lastParseReminding=A,A.length>0&&s.onExtraToken(_,C,A)}return C}}}t.parse=s,(function(_){_.onExtraToken=(k,C,D)=>{e("parsed json with extra tokens:",{text:k,data:C,reminding:D})}})(s=t.parse||(t.parse={}));function o(_,k,C){const D=l[_[0]]||C;if(!D)throw e(`no parser registered for ${JSON.stringify(_[0])}:`,{s:_}),k;return D(_,k)}function a(_,k,C){return _[0]==='"'?p(_):_[0]==="'"?g(_):y(_,k,C)}const l={};function u(_){return _.trimLeft()}l[" "]=c,l["\r"]=c,l[` `]=c,l[" "]=c;function c(_,k){return _=u(_),o(_,k)}l["["]=f;function f(_,k){_=_.substr(1);const C=[];for(_=u(_);_.length>0;){if(_[0]==="]"){_=_.substr(1);break}const D=o(_,k,(A,E)=>y(A,E,[",","]"]));C.push(D[0]),_=D[1],_=u(_),_[0]===","&&(_=_.substring(1),_=u(_))}return[C,_]}for(const _ of"0123456789.-".slice())l[_]=h;function h(_){for(let k=0;k<_.length;k++){const C=_[k];if(l[C]===h)continue;const D=_.substring(0,k);return _=_.substring(k),[d(D),_]}return[d(_),""]}function d(_){if(_==="-")return-0;const k=+_;return Number.isNaN(k)?_:k}l['"']=p;function p(_){for(let k=1;k<_.length;k++){const C=_[k];if(C==="\\"){k++;continue}if(C==='"'){const D=m(_.substring(0,k+1));return _=_.substring(k+1),[JSON.parse(D),_]}}return[JSON.parse(m(_)+'"'),""]}function m(_){return _.replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")}l["'"]=g;function g(_){for(let k=1;k<_.length;k++){const C=_[k];if(C==="\\"){k++;continue}if(C==="'"){const D=m(_.substring(0,k+1));return _=_.substring(k+1),[JSON.parse('"'+D.slice(1,-1)+'"'),_]}}return[JSON.parse('"'+m(_.slice(1))+'"'),""]}function y(_,k,C=[" "]){const D=Math.min(...C.map(T=>{const R=_.indexOf(T);return R===-1?_.length:R})),A=_.substring(0,D).trim(),E=_.substring(D);return[A,E]}l["{"]=O;function O(_,k){_=_.substr(1);const C={};for(_=u(_);_.length>0;){if(_[0]==="}"){_=_.substr(1);break}const D=a(_,k,[":","}"]),A=D[0];if(_=D[1],_=u(_),_[0]!==":"){C[A]=void 0;break}if(_=_.substr(1),_=u(_),_.length===0){C[A]=void 0;break}const E=o(_,k);C[A]=E[0],_=E[1],_=u(_),_[0]===","&&(_=_.substr(1),_=u(_))}return[C,_]}l.t=v;function v(_,k){return S(_,"true",!0,k)}l.f=w;function w(_,k){return S(_,"false",!1,k)}l.n=x;function x(_,k){return S(_,"null",null,k)}function S(_,k,C,D){for(let A=k.length;A>=1;A--)if(_.startsWith(k.slice(0,A)))return[C,_.slice(A)];{const A=JSON.stringify(_.slice(0,k.length));throw e(`unknown token starting with ${A}:`,{s:_}),D}}})(A3)),A3}var ZZ=U_e();function j_e(t){let e=null;try{e=JSON.parse(t.doc.toString())}catch{try{e=ZZ.parse(t.doc.toString())}catch{}}const n=hE(t,Sn.JSON);return{data:e,pointers:n}}const q_e=ju.deserialize({version:14,states:"%WO`QPOOOwQQO'#CbO!SQPO'#ChOOQO'#Cj'#CjOOQO'#Ct'#CtQOQPOOOOQO'#Cd'#CdO!ZQPO'#CcOOQO,58|,58|O!`QPO,58|OOQO,59S,59SO!hQPO,59SO`QPO,58}O!pQQO1G.hO!{QPO1G.hOOQO1G.h1G.hO#TQPO1G.nO#[QPO1G.nOOQO1G.n1G.nOOQO1G.i1G.iOOQO,59Y,59YOOQO7+$S7+$SO#dQQO7+$SOOQO-E6l-E6lOOQO,59Z,59ZOOQO7+$Y7+$YO#oQPO7+$YOOQO-E6m-E6mOOQO<X~R!TXY$bYZ%YZ[$b[]$b]^%Ypq$brs%_tu&owx'W{|(c|},O}!O(c!O!P(r!P!Q,T!Q!R)l!R![*l![!]-d!c!k&o!k!l-i!l!p&o!p!q2g!q!}&o!}#O3p#P#Q3u#R#S&o#T#Y&o#Y#Z3z#Z#b&o#b#c6z#c#h&o#h#i9`#i#o&o#o#p;t#q#r;y$f$g$b$g#BY&o#BY#BZ{var n,r;let i=e.state.doc,s=e.state.field(WZ,!1);if(s){if(s.err)return zR(i,s.err);if(s.obj!==void 0)return(n=void 0)!==null&&n!==void 0?n:[]}try{let o=Jp.parse(i.toString());return(r=t?.(e,o))!==null&&r!==void 0?r:[]}catch(o){return zR(i,o)}}}const WZ=Pr.define({create(){return null},update(t,e){if(!e.docChanged)return t;try{return{err:null,obj:Jp.parse(e.newDoc.toString())}}catch(n){return{err:n,obj:t?.obj}}}}),J_e=Pr.define({create(){return{path:null,node:null}},update(t,e){let n=e.state.selection.main.to,r=G_e(e.state,n),i=r?W_e(e.state,r):null;return{path:i??null,node:r}}});function YZ(t){const e=t.doc.toString();let n=null;try{n=Jp.parse(e)}catch{try{n=ZZ.parse(e)}catch{}}const r=hE(t,Sn.JSON5);return{data:n,pointers:r}}const LE=Symbol.for("yaml.alias"),A4=Symbol.for("yaml.document"),Nc=Symbol.for("yaml.map"),GZ=Symbol.for("yaml.pair"),Cl=Symbol.for("yaml.scalar"),Y0=Symbol.for("yaml.seq"),Fo=Symbol.for("yaml.node.type"),yf=t=>!!t&&typeof t=="object"&&t[Fo]===LE,rd=t=>!!t&&typeof t=="object"&&t[Fo]===A4,G0=t=>!!t&&typeof t=="object"&&t[Fo]===Nc,Jn=t=>!!t&&typeof t=="object"&&t[Fo]===GZ,Tn=t=>!!t&&typeof t=="object"&&t[Fo]===Cl,H0=t=>!!t&&typeof t=="object"&&t[Fo]===Y0;function or(t){if(t&&typeof t=="object")switch(t[Fo]){case Nc:case Y0:return!0}return!1}function ur(t){if(t&&typeof t=="object")switch(t[Fo]){case LE:case Nc:case Cl:case Y0:return!0}return!1}const HZ=t=>(Tn(t)||or(t))&&!!t.anchor,ms=Symbol("break visit"),KZ=Symbol("skip children"),pl=Symbol("remove node");function id(t,e){const n=JZ(e);rd(t)?Jd(null,t.contents,n,Object.freeze([t]))===pl&&(t.contents=null):Jd(null,t,n,Object.freeze([]))}id.BREAK=ms;id.SKIP=KZ;id.REMOVE=pl;function Jd(t,e,n,r){const i=eX(t,e,n,r);if(ur(i)||Jn(i))return tX(t,r,i),Jd(t,i,n,r);if(typeof i!="symbol"){if(or(e)){r=Object.freeze(r.concat(e));for(let s=0;st.replace(/[!,[\]{}]/g,e=>eSe[e]);class Qi{constructor(e,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},Qi.defaultYaml,e),this.tags=Object.assign({},Qi.defaultTags,n)}clone(){const e=new Qi(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){const e=new Qi(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:Qi.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},Qi.defaultTags);break}return e}add(e,n){this.atNextDocument&&(this.yaml={explicit:Qi.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},Qi.defaultTags),this.atNextDocument=!1);const r=e.trim().split(/[ \t]+/),i=r.shift();switch(i){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;const[s,o]=r;return this.tags[s]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[s]=r;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{const o=/^\d+\.\d+$/.test(s);return n(6,`Unsupported YAML version ${s}`,o),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,n){if(e==="!")return"!";if(e[0]!=="!")return n(`Not a valid tag: ${e}`),null;if(e[1]==="<"){const o=e.slice(2,-1);return o==="!"||o==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),o)}const[,r,i]=e.match(/^(.*!)([^!]*)$/s);i||n(`The ${e} tag has no suffix`);const s=this.tags[r];if(s)try{return s+decodeURIComponent(i)}catch(o){return n(String(o)),null}return r==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(const[n,r]of Object.entries(this.tags))if(e.startsWith(r))return n+tSe(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags);let i;if(e&&r.length>0&&ur(e.contents)){const s={};id(e.contents,(o,a)=>{ur(a)&&a.tag&&(s[a.tag]=!0)}),i=Object.keys(s)}else i=[];for(const[s,o]of r)s==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(o)))&&n.push(`%TAG ${s} ${o}`);return n.join(` `)}}Qi.defaultYaml={explicit:!1,version:"1.2"};Qi.defaultTags={"!!":"tag:yaml.org,2002:"};function nX(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){const n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(n)}return!0}function rX(t){const e=new Set;return id(t,{Value(n,r){r.anchor&&e.add(r.anchor)}}),e}function iX(t,e){for(let n=1;;++n){const r=`${t}${n}`;if(!e.has(r))return r}}function nSe(t,e){const n=[],r=new Map;let i=null;return{onAnchor:s=>{n.push(s),i??(i=rX(t));const o=iX(e,i);return i.add(o),o},setAnchors:()=>{for(const s of n){const o=r.get(s);if(typeof o=="object"&&o.anchor&&(Tn(o.node)||or(o.node)))o.node.anchor=o.anchor;else{const a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=s,a}}},sourceObjects:r}}function tp(t,e,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let i=0,s=r.length;iCo(r,String(i),n));if(t&&typeof t.toJSON=="function"){if(!n||!HZ(t))return t.toJSON(e,n);const r={aliasCount:0,count:1,res:void 0};n.anchors.set(t,r),n.onCreate=s=>{r.res=s,delete n.onCreate};const i=t.toJSON(e,n);return n.onCreate&&n.onCreate(i),i}return typeof t=="bigint"&&!n?.keep?Number(t):t}class NE{constructor(e){Object.defineProperty(this,Fo,{value:e})}clone(){const e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:s}={}){if(!rd(e))throw new TypeError("A document argument is required");const o={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=Co(this,"",o);if(typeof i=="function")for(const{count:l,res:u}of o.anchors.values())i(u,l);return typeof s=="function"?tp(s,{"":a},"",a):a}}class Jx extends NE{constructor(e){super(LE),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,n){let r;n?.aliasResolveCache?r=n.aliasResolveCache:(r=[],id(e,{Node:(s,o)=>{(yf(o)||HZ(o))&&r.push(o)}}),n&&(n.aliasResolveCache=r));let i;for(const s of r){if(s===this)break;s.anchor===this.source&&(i=s)}return i}toJSON(e,n){if(!n)return{source:this.source};const{anchors:r,doc:i,maxAliasCount:s}=n,o=this.resolve(i,n);if(!o){const l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=r.get(o);if(a||(Co(o,null,n),a=r.get(o)),!a||a.res===void 0){const l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(s>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=ZO(i,o,r)),a.count*a.aliasCount>s)){const l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,n,r){const i=`*${this.source}`;if(e){if(nX(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){const s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(e.implicitKey)return`${i} `}return i}}function ZO(t,e,n){if(yf(e)){const r=e.resolve(t),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(or(e)){let r=0;for(const i of e.items){const s=ZO(t,i,n);s>r&&(r=s)}return r}else if(Jn(e)){const r=ZO(t,e.key,n),i=ZO(t,e.value,n);return Math.max(r,i)}return 1}const sX=t=>!t||typeof t!="function"&&typeof t!="object";class mt extends NE{constructor(e){super(Cl),this.value=e}toJSON(e,n){return n?.keep?this.value:Co(this.value,e,n)}toString(){return String(this.value)}}mt.BLOCK_FOLDED="BLOCK_FOLDED";mt.BLOCK_LITERAL="BLOCK_LITERAL";mt.PLAIN="PLAIN";mt.QUOTE_DOUBLE="QUOTE_DOUBLE";mt.QUOTE_SINGLE="QUOTE_SINGLE";const rSe="tag:yaml.org,2002:";function iSe(t,e,n){if(e){const r=n.filter(s=>s.tag===e),i=r.find(s=>!s.format)??r[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return n.find(r=>r.identify?.(t)&&!r.format)}function M1(t,e,n){if(rd(t)&&(t=t.contents),ur(t))return t;if(Jn(t)){const f=n.schema[Nc].createNode?.(n.schema,null,n);return f.items.push(t),f}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());const{aliasDuplicateObjects:r,onAnchor:i,onTagObj:s,schema:o,sourceObjects:a}=n;let l;if(r&&t&&typeof t=="object"){if(l=a.get(t),l)return l.anchor??(l.anchor=i(t)),new Jx(l.anchor);l={anchor:null,node:null},a.set(t,l)}e?.startsWith("!!")&&(e=rSe+e.slice(2));let u=iSe(t,e,o.tags);if(!u){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){const f=new mt(t);return l&&(l.node=f),f}u=t instanceof Map?o[Nc]:Symbol.iterator in Object(t)?o[Y0]:o[Nc]}s&&(s(u),delete n.onTagObj);const c=u?.createNode?u.createNode(n.schema,t,n):typeof u?.nodeClass?.from=="function"?u.nodeClass.from(n.schema,t,n):new mt(t);return e?c.tag=e:u.default||(c.tag=u.tag),l&&(l.node=c),c}function sw(t,e,n){let r=n;for(let i=e.length-1;i>=0;--i){const s=e[i];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){const o=[];o[s]=r,r=o}else r=new Map([[s,r]])}return M1(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}const lg=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done;class oX extends NE{constructor(e,n){super(e),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(e){const n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(n.schema=e),n.items=n.items.map(r=>ur(r)||Jn(r)?r.clone(e):r),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(lg(e))this.add(n);else{const[r,...i]=e,s=this.get(r,!0);if(or(s))s.addIn(i,n);else if(s===void 0&&this.schema)this.set(r,sw(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}deleteIn(e){const[n,...r]=e;if(r.length===0)return this.delete(n);const i=this.get(n,!0);if(or(i))return i.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(e,n){const[r,...i]=e,s=this.get(r,!0);return i.length===0?!n&&Tn(s)?s.value:s:or(s)?s.getIn(i,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!Jn(n))return!1;const r=n.value;return r==null||e&&Tn(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){const[n,...r]=e;if(r.length===0)return this.has(n);const i=this.get(n,!0);return or(i)?i.hasIn(r):!1}setIn(e,n){const[r,...i]=e;if(i.length===0)this.set(r,n);else{const s=this.get(r,!0);if(or(s))s.setIn(i,n);else if(s===void 0&&this.schema)this.set(r,sw(this.schema,i,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${i}`)}}}const sSe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function _u(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}const th=(t,e,n)=>t.endsWith(` `)?_u(n,e):n.includes(` `)?` `+_u(n,e):(t.endsWith(" ")?"":" ")+n,aX="flow",E4="block",XO="quoted";function e_(t,e,n="flow",{indentAtStart:r,lineWidth:i=80,minContentWidth:s=20,onFold:o,onOverflow:a}={}){if(!i||i<0)return t;ii-Math.max(2,s)?u.push(0):f=i-r);let h,d,p=!1,m=-1,g=-1,y=-1;n===E4&&(m=UR(t,m,e.length),m!==-1&&(f=m+l));for(let v;v=t[m+=1];){if(n===XO&&v==="\\"){switch(g=m,t[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}y=m}if(v===` `)n===E4&&(m=UR(t,m,e.length)),f=m+e.length+l,h=void 0;else{if(v===" "&&d&&d!==" "&&d!==` `&&d!==" "){const w=t[m+1];w&&w!==" "&&w!==` `&&w!==" "&&(h=m)}if(m>=f)if(h)u.push(h),f=h+l,h=void 0;else if(n===XO){for(;d===" "||d===" ";)d=v,v=t[m+=1],p=!0;const w=m>y+1?m-2:g-1;if(c[w])return t;u.push(w),c[w]=!0,f=w+l,h=void 0}else p=!0}d=v}if(p&&a&&a(),u.length===0)return t;o&&o();let O=t.slice(0,u[0]);for(let v=0;v({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),n_=t=>/^(%|---|\.\.\.)/m.test(t);function oSe(t,e,n){if(!e||e<0)return!1;const r=e-n,i=t.length;if(i<=r)return!1;for(let s=0,o=0;sr)return!0;if(o=s+1,i-o<=r)return!1}return!0}function Rg(t,e){const n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;const{implicitKey:r}=e,i=e.options.doubleQuotedMinMultiLineLength,s=e.indent||(n_(t)?" ":"");let o="",a=0;for(let l=0,u=n[l];u;u=n[++l])if(u===" "&&n[l+1]==="\\"&&n[l+2]==="n"&&(o+=n.slice(a,l)+"\\ ",l+=1,a=l,u="\\"),u==="\\")switch(n[l+1]){case"u":{o+=n.slice(a,l);const c=n.substr(l+2,4);switch(c){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:c.substr(0,2)==="00"?o+="\\x"+c.substr(2):o+=n.substr(l,6)}l+=5,a=l+1}break;case"n":if(r||n[l+2]==='"'||n.length `;let f,h;for(h=n.length;h>0;--h){const x=n[h-1];if(x!==` `&&x!==" "&&x!==" ")break}let d=n.substring(h);const p=d.indexOf(` `);p===-1?f="-":n===d||p!==d.length-1?(f="+",s&&s()):f="",d&&(n=n.slice(0,-d.length),d[d.length-1]===` `&&(d=d.slice(0,-1)),d=d.replace(D4,`$&${u}`));let m=!1,g,y=-1;for(g=0;g{S=!0});const k=e_(`${O}${x}${d}`,u,E4,_);if(!S)return`>${w} ${u}${k}`}return n=n.replace(/\n+/g,`$&${u}`),`|${w} ${u}${O}${n}${d}`}function aSe(t,e,n,r){const{type:i,value:s}=t,{actualString:o,implicitKey:a,indent:l,indentStep:u,inFlow:c}=e;if(a&&s.includes(` `)||c&&/[[\]{},]/.test(s))return np(s,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return a||c||!s.includes(` `)?np(s,e):WO(t,e,n,r);if(!a&&!c&&i!==mt.PLAIN&&s.includes(` `))return WO(t,e,n,r);if(n_(s)){if(l==="")return e.forceBlockIndent=!0,WO(t,e,n,r);if(a&&l===u)return np(s,e)}const f=s.replace(/\n+/g,`$& ${l}`);if(o){const h=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(f),{compat:d,tags:p}=e.doc.schema;if(p.some(h)||d?.some(h))return np(s,e)}return a?f:e_(f,l,aX,t_(e,!1))}function Ay(t,e,n,r){const{implicitKey:i,inFlow:s}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)});let{type:a}=t;a!==mt.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=mt.QUOTE_DOUBLE);const l=c=>{switch(c){case mt.BLOCK_FOLDED:case mt.BLOCK_LITERAL:return i||s?np(o.value,e):WO(o,e,n,r);case mt.QUOTE_DOUBLE:return Rg(o.value,e);case mt.QUOTE_SINGLE:return T4(o.value,e);case mt.PLAIN:return aSe(o,e,n,r);default:return null}};let u=l(a);if(u===null){const{defaultKeyType:c,defaultStringType:f}=e.options,h=i&&c||f;if(u=l(h),u===null)throw new Error(`Unsupported default string type ${h}`)}return u}function lX(t,e){const n=Object.assign({blockQuote:!0,commentString:sSe,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e);let r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function lSe(t,e){if(e.tag){const i=t.filter(s=>s.tag===e.tag);if(i.length>0)return i.find(s=>s.format===e.format)??i[0]}let n,r;if(Tn(e)){r=e.value;let i=t.filter(s=>s.identify?.(r));if(i.length>1){const s=i.filter(o=>o.test);s.length>0&&(i=s)}n=i.find(s=>s.format===e.format)??i.find(s=>!s.format)}else r=e,n=t.find(i=>i.nodeClass&&r instanceof i.nodeClass);if(!n){const i=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${i} value`)}return n}function uSe(t,e,{anchors:n,doc:r}){if(!r.directives)return"";const i=[],s=(Tn(t)||or(t))&&t.anchor;s&&nX(s)&&(n.add(s),i.push(`&${s}`));const o=t.tag??(e.default?null:e.tag);return o&&i.push(r.directives.tagString(o)),i.join(" ")}function m0(t,e,n,r){if(Jn(t))return t.toString(e,n,r);if(yf(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i;const s=ur(t)?t:e.doc.createNode(t,{onTagObj:l=>i=l});i??(i=lSe(e.doc.schema.tags,s));const o=uSe(s,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);const a=typeof i.stringify=="function"?i.stringify(s,e,n,r):Tn(s)?Ay(s,e,n,r):s.toString(e,n,r);return o?Tn(s)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o} ${e.indent}${a}`:a}function cSe({key:t,value:e},n,r,i){const{allNullValues:s,doc:o,indent:a,indentStep:l,options:{commentString:u,indentSeq:c,simpleKeys:f}}=n;let h=ur(t)&&t.comment||null;if(f){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(or(t)||!ur(t)&&typeof t=="object"){const _="With simple keys, collection cannot be used as a key value";throw new Error(_)}}let d=!f&&(!t||h&&e==null&&!n.inFlow||or(t)||(Tn(t)?t.type===mt.BLOCK_FOLDED||t.type===mt.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!d&&(f||!s),indent:a+l});let p=!1,m=!1,g=m0(t,n,()=>p=!0,()=>m=!0);if(!d&&!n.inFlow&&g.length>1024){if(f)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");d=!0}if(n.inFlow){if(s||e==null)return p&&r&&r(),g===""?"?":d?`? ${g}`:g}else if(s&&!f||e==null&&d)return g=`? ${g}`,h&&!p?g+=th(g,n.indent,u(h)):m&&i&&i(),g;p&&(h=null),d?(h&&(g+=th(g,n.indent,u(h))),g=`? ${g} ${a}:`):(g=`${g}:`,h&&(g+=th(g,n.indent,u(h))));let y,O,v;ur(e)?(y=!!e.spaceBefore,O=e.commentBefore,v=e.comment):(y=!1,O=null,v=null,e&&typeof e=="object"&&(e=o.createNode(e))),n.implicitKey=!1,!d&&!h&&Tn(e)&&(n.indentAtStart=g.length+1),m=!1,!c&&l.length>=2&&!n.inFlow&&!d&&H0(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let w=!1;const x=m0(e,n,()=>w=!0,()=>m=!0);let S=" ";if(h||y||O){if(S=y?` `:"",O){const _=u(O);S+=` ${_u(_,n.indent)}`}x===""&&!n.inFlow?S===` `&&(S=` `):S+=` ${n.indent}`}else if(!d&&or(e)){const _=x[0],k=x.indexOf(` `),C=k!==-1,D=n.inFlow??e.flow??e.items.length===0;if(C||!D){let A=!1;if(C&&(_==="&"||_==="!")){let E=x.indexOf(" ");_==="&"&&E!==-1&&Et===Lb||typeof t=="symbol"&&t.description===Lb,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new mt(Symbol(Lb)),{addToJSMap:cX}),stringify:()=>Lb},fSe=(t,e)=>(Iu.identify(e)||Tn(e)&&(!e.type||e.type===mt.PLAIN)&&Iu.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===Iu.tag&&n.default);function cX(t,e,n){if(n=t&&yf(n)?n.resolve(t.doc):n,H0(n))for(const r of n.items)E3(t,e,r);else if(Array.isArray(n))for(const r of n)E3(t,e,r);else E3(t,e,n)}function E3(t,e,n){const r=t&&yf(n)?n.resolve(t.doc):n;if(!G0(r))throw new Error("Merge sources must be maps or map aliases");const i=r.toJSON(null,t,Map);for(const[s,o]of i)e instanceof Map?e.has(s)||e.set(s,o):e instanceof Set?e.add(s):Object.prototype.hasOwnProperty.call(e,s)||Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function fX(t,e,{key:n,value:r}){if(ur(n)&&n.addToJSMap)n.addToJSMap(t,e,r);else if(fSe(t,n))cX(t,e,r);else{const i=Co(n,"",t);if(e instanceof Map)e.set(i,Co(r,i,t));else if(e instanceof Set)e.add(i);else{const s=hSe(n,i,t),o=Co(r,s,t);s in e?Object.defineProperty(e,s,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[s]=o}}return e}function hSe(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(ur(t)&&n?.doc){const r=lX(n.doc,{});r.anchors=new Set;for(const s of n.anchors.keys())r.anchors.add(s.anchor);r.inFlow=!0,r.inStringifyKey=!0;const i=t.toString(r);if(!n.mapKeyWarned){let s=JSON.stringify(i);s.length>40&&(s=s.substring(0,36)+'..."'),uX(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return i}return JSON.stringify(e)}function QE(t,e,n){const r=M1(t,void 0,n),i=M1(e,void 0,n);return new xi(r,i)}class xi{constructor(e,n=null){Object.defineProperty(this,Fo,{value:GZ}),this.key=e,this.value=n}clone(e){let{key:n,value:r}=this;return ur(n)&&(n=n.clone(e)),ur(r)&&(r=r.clone(e)),new xi(n,r)}toJSON(e,n){const r=n?.mapAsMap?new Map:{};return fX(n,r,this)}toString(e,n,r){return e?.doc?cSe(this,e,n,r):JSON.stringify(this)}}function hX(t,e,n){return(e.inFlow??t.flow?pSe:dSe)(t,e,n)}function dSe({comment:t,items:e},n,{blockItemPrefix:r,flowChars:i,itemIndent:s,onChompKeep:o,onComment:a}){const{indent:l,options:{commentString:u}}=n,c=Object.assign({},n,{indent:s,type:null});let f=!1;const h=[];for(let p=0;pg=null,()=>f=!0);g&&(y+=th(y,s,u(g))),f&&g&&(f=!1),h.push(r+y)}let d;if(h.length===0)d=i.start+i.end;else{d=h[0];for(let p=1;pg=null);pc||y.includes(` `))&&(u=!0),f.push(y),c=f.length}const{start:h,end:d}=n;if(f.length===0)return h+d;if(!u){const p=f.reduce((m,g)=>m+g.length+2,2);u=e.options.lineWidth>0&&p>e.options.lineWidth}if(u){let p=h;for(const m of f)p+=m?` ${s}${i}${m}`:` `;return`${p} ${i}${d}`}else return`${h}${o}${f.join(" ")}${o}${d}`}function ow({indent:t,options:{commentString:e}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,"")),r){const s=_u(e(r),t);n.push(s.trimStart())}}function nh(t,e){const n=Tn(e)?e.value:e;for(const r of t)if(Jn(r)&&(r.key===e||r.key===n||Tn(r.key)&&r.key.value===n))return r}class Xs extends oX{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Nc,e),this.items=[]}static from(e,n,r){const{keepUndefined:i,replacer:s}=r,o=new this(e),a=(l,u)=>{if(typeof s=="function")u=s.call(n,l,u);else if(Array.isArray(s)&&!s.includes(l))return;(u!==void 0||i)&&o.items.push(QE(l,u,r))};if(n instanceof Map)for(const[l,u]of n)a(l,u);else if(n&&typeof n=="object")for(const l of Object.keys(n))a(l,n[l]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,n){let r;Jn(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new xi(e,e?.value):r=new xi(e.key,e.value);const i=nh(this.items,r.key),s=this.schema?.sortMapEntries;if(i){if(!n)throw new Error(`Key ${r.key} already set`);Tn(i.value)&&sX(r.value)?i.value.value=r.value:i.value=r.value}else if(s){const o=this.items.findIndex(a=>s(r,a)<0);o===-1?this.items.push(r):this.items.splice(o,0,r)}else this.items.push(r)}delete(e){const n=nh(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){const i=nh(this.items,e)?.value;return(!n&&Tn(i)?i.value:i)??void 0}has(e){return!!nh(this.items,e)}set(e,n){this.add(new xi(e,n),!0)}toJSON(e,n,r){const i=r?new r:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(i);for(const s of this.items)fX(n,i,s);return i}toString(e,n,r){if(!e)return JSON.stringify(this);for(const i of this.items)if(!Jn(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),hX(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:n})}}const K0={collection:"map",default:!0,nodeClass:Xs,tag:"tag:yaml.org,2002:map",resolve(t,e){return G0(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>Xs.from(t,e,n)};class uf extends oX{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Y0,e),this.items=[]}add(e){this.items.push(e)}delete(e){const n=Nb(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){const r=Nb(e);if(typeof r!="number")return;const i=this.items[r];return!n&&Tn(i)?i.value:i}has(e){const n=Nb(e);return typeof n=="number"&&n=0?e:null}const J0={collection:"seq",default:!0,nodeClass:uf,tag:"tag:yaml.org,2002:seq",resolve(t,e){return H0(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>uf.from(t,e,n)},r_={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,r){return e=Object.assign({actualString:!0},e),Ay(t,e,n,r)}},i_={identify:t=>t==null,createNode:()=>new mt(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new mt(null),stringify:({source:t},e)=>typeof t=="string"&&i_.test.test(t)?t:e.options.nullStr},BE={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new mt(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&BE.test.test(t)){const r=t[0]==="t"||t[0]==="T";if(e===r)return t}return e?n.options.trueStr:n.options.falseStr}};function _a({format:t,minFractionDigits:e,tag:n,value:r}){if(typeof r=="bigint")return String(r);const i=typeof r=="number"?r:Number(r);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let s=JSON.stringify(r);if(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^\d/.test(s)){let o=s.indexOf(".");o<0&&(o=s.length,s+=".");let a=e-(s.length-o-1);for(;a-- >0;)s+="0"}return s}const dX={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:_a},pX={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){const e=Number(t.value);return isFinite(e)?e.toExponential():_a(t)}},mX={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){const e=new mt(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:_a},s_=t=>typeof t=="bigint"||Number.isInteger(t),zE=(t,e,n,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),n);function gX(t,e,n){const{value:r}=t;return s_(r)&&r>=0?n+r.toString(e):_a(t)}const yX={identify:t=>s_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>zE(t,2,8,n),stringify:t=>gX(t,8,"0o")},bX={identify:s_,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>zE(t,0,10,n),stringify:_a},OX={identify:t=>s_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>zE(t,2,16,n),stringify:t=>gX(t,16,"0x")},mSe=[K0,J0,r_,i_,BE,yX,bX,OX,dX,pX,mX];function jR(t){return typeof t=="bigint"||Number.isInteger(t)}const Qb=({value:t})=>JSON.stringify(t),gSe=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:Qb},{identify:t=>t==null,createNode:()=>new mt(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Qb},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:Qb},{identify:jR,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:n})=>n?BigInt(t):parseInt(t,10),stringify:({value:t})=>jR(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:Qb}],ySe={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},bSe=[K0,J0].concat(gSe,ySe),UE={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof atob=="function"){const n=atob(t.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let i=0;i1&&e("Each pair must have its own sequence indicator");const i=r.items[0]||new xi(new mt(null));if(r.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${r.commentBefore} ${i.key.commentBefore}`:r.commentBefore),r.comment){const s=i.value??i.key;s.comment=s.comment?`${r.comment} ${s.comment}`:r.comment}r=i}t.items[n]=Jn(r)?r:new xi(r)}}else e("Expected a sequence for this tag");return t}function wX(t,e,n){const{replacer:r}=n,i=new uf(t);i.tag="tag:yaml.org,2002:pairs";let s=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof r=="function"&&(o=r.call(e,String(s++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){const u=Object.keys(o);if(u.length===1)a=u[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else a=o;i.items.push(QE(a,l,n))}return i}const jE={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:vX,createNode:wX};class Ep extends uf{constructor(){super(),this.add=Xs.prototype.add.bind(this),this.delete=Xs.prototype.delete.bind(this),this.get=Xs.prototype.get.bind(this),this.has=Xs.prototype.has.bind(this),this.set=Xs.prototype.set.bind(this),this.tag=Ep.tag}toJSON(e,n){if(!n)return super.toJSON(e);const r=new Map;n?.onCreate&&n.onCreate(r);for(const i of this.items){let s,o;if(Jn(i)?(s=Co(i.key,"",n),o=Co(i.value,s,n)):s=Co(i,"",n),r.has(s))throw new Error("Ordered maps must not include duplicate keys");r.set(s,o)}return r}static from(e,n,r){const i=wX(e,n,r),s=new this;return s.items=i.items,s}}Ep.tag="tag:yaml.org,2002:omap";const qE={collection:"seq",identify:t=>t instanceof Map,nodeClass:Ep,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){const n=vX(t,e),r=[];for(const{key:i}of n.items)Tn(i)&&(r.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):r.push(i.value));return Object.assign(new Ep,n)},createNode:(t,e,n)=>Ep.from(t,e,n)};function xX({value:t,source:e},n){return e&&(t?_X:SX).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}const _X={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new mt(!0),stringify:xX},SX={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new mt(!1),stringify:xX},OSe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:_a},vSe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){const e=Number(t.value);return isFinite(e)?e.toExponential():_a(t)}},wSe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){const e=new mt(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){const r=t.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:_a},Ey=t=>typeof t=="bigint"||Number.isInteger(t);function o_(t,e,n,{intAsBigInt:r}){const i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}const o=BigInt(t);return i==="-"?BigInt(-1)*o:o}const s=parseInt(t,n);return i==="-"?-1*s:s}function VE(t,e,n){const{value:r}=t;if(Ey(r)){const i=r.toString(e);return r<0?"-"+n+i.substr(1):n+i}return _a(t)}const xSe={identify:Ey,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>o_(t,2,2,n),stringify:t=>VE(t,2,"0b")},_Se={identify:Ey,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>o_(t,1,8,n),stringify:t=>VE(t,8,"0")},SSe={identify:Ey,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>o_(t,0,10,n),stringify:_a},kSe={identify:Ey,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>o_(t,2,16,n),stringify:t=>VE(t,16,"0x")};class Tp extends Xs{constructor(e){super(e),this.tag=Tp.tag}add(e){let n;Jn(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new xi(e.key,null):n=new xi(e,null),nh(this.items,n.key)||this.items.push(n)}get(e,n){const r=nh(this.items,e);return!n&&Jn(r)?Tn(r.key)?r.key.value:r.key:r}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);const r=nh(this.items,e);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new xi(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(e,n,r){const{replacer:i}=r,s=new this(e);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof i=="function"&&(o=i.call(n,o,o)),s.items.push(QE(o,null,r));return s}}Tp.tag="tag:yaml.org,2002:set";const ZE={collection:"map",identify:t=>t instanceof Set,nodeClass:Tp,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>Tp.from(t,e,n),resolve(t,e){if(G0(t)){if(t.hasAllNullValues(!0))return Object.assign(new Tp,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};function XE(t,e){const n=t[0],r=n==="-"||n==="+"?t.substring(1):t,i=o=>e?BigInt(o):Number(o),s=r.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return n==="-"?i(-1)*s:s}function kX(t){let{value:e}=t,n=o=>o;if(typeof e=="bigint")n=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return _a(t);let r="";e<0&&(r="-",e*=n(-1));const i=n(60),s=[e%i];return e<60?s.unshift(0):(e=(e-s[0])/i,s.unshift(e%i),e>=60&&(e=(e-s[0])/i,s.unshift(e))),r+s.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const CX={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:n})=>XE(t,n),stringify:kX},AX={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>XE(t,!1),stringify:kX},a_={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){const e=t.match(a_.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,r,i,s,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0;let u=Date.UTC(n,r-1,i,s||0,o||0,a||0,l);const c=e[8];if(c&&c!=="Z"){let f=XE(c,!1);Math.abs(f)<30&&(f*=60),u-=6e4*f}return new Date(u)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""},qR=[K0,J0,r_,i_,_X,SX,xSe,_Se,SSe,kSe,OSe,vSe,wSe,UE,Iu,qE,jE,ZE,CX,AX,a_],VR=new Map([["core",mSe],["failsafe",[K0,J0,r_]],["json",bSe],["yaml11",qR],["yaml-1.1",qR]]),ZR={binary:UE,bool:BE,float:mX,floatExp:pX,floatNaN:dX,floatTime:AX,int:bX,intHex:OX,intOct:yX,intTime:CX,map:K0,merge:Iu,null:i_,omap:qE,pairs:jE,seq:J0,set:ZE,timestamp:a_},CSe={"tag:yaml.org,2002:binary":UE,"tag:yaml.org,2002:merge":Iu,"tag:yaml.org,2002:omap":qE,"tag:yaml.org,2002:pairs":jE,"tag:yaml.org,2002:set":ZE,"tag:yaml.org,2002:timestamp":a_};function T3(t,e,n){const r=VR.get(e);if(r&&!t)return n&&!r.includes(Iu)?r.concat(Iu):r.slice();let i=r;if(!i)if(Array.isArray(t))i=[];else{const s=Array.from(VR.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${s} or define customTags array`)}if(Array.isArray(t))for(const s of t)i=i.concat(s);else typeof t=="function"&&(i=t(i.slice()));return n&&(i=i.concat(Iu)),i.reduce((s,o)=>{const a=typeof o=="string"?ZR[o]:o;if(!a){const l=JSON.stringify(o),u=Object.keys(ZR).map(c=>JSON.stringify(c)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${u}`)}return s.includes(a)||s.push(a),s},[])}const ASe=(t,e)=>t.keye.key?1:0;class l_{constructor({compat:e,customTags:n,merge:r,resolveKnownTags:i,schema:s,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?T3(e,"compat"):e?T3(null,e):null,this.name=typeof s=="string"&&s||"core",this.knownTags=i?CSe:{},this.tags=T3(n,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,Nc,{value:K0}),Object.defineProperty(this,Cl,{value:r_}),Object.defineProperty(this,Y0,{value:J0}),this.sortMapEntries=typeof o=="function"?o:o===!0?ASe:null}clone(){const e=Object.create(l_.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}function ESe(t,e){const n=[];let r=e.directives===!0;if(e.directives!==!1&&t.directives){const l=t.directives.toString(t);l?(n.push(l),r=!0):t.directives.docStart&&(r=!0)}r&&n.push("---");const i=lX(t,e),{commentString:s}=i.options;if(t.commentBefore){n.length!==1&&n.unshift("");const l=s(t.commentBefore);n.unshift(_u(l,""))}let o=!1,a=null;if(t.contents){if(ur(t.contents)){if(t.contents.spaceBefore&&r&&n.push(""),t.contents.commentBefore){const c=s(t.contents.commentBefore);n.push(_u(c,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}const l=a?void 0:()=>o=!0;let u=m0(t.contents,i,()=>a=null,l);a&&(u+=th(u,"",s(a))),(u[0]==="|"||u[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${u}`:n.push(u)}else n.push(m0(t.contents,i));if(t.directives?.docEnd)if(t.comment){const l=s(t.comment);l.includes(` `)?(n.push("..."),n.push(_u(l,""))):n.push(`... ${l}`)}else n.push("...");else{let l=t.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&n[n.length-1]!==""&&n.push(""),n.push(_u(s(l),"")))}return n.join(` `)+` `}class em{constructor(e,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Fo,{value:A4});let i=null;typeof n=="function"||Array.isArray(n)?i=n:r===void 0&&n&&(r=n,n=void 0);const s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=s;let{version:o}=s;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new Qi({version:o}),this.setSchema(o,r),this.contents=e===void 0?null:this.createNode(e,i,r)}clone(){const e=Object.create(em.prototype,{[Fo]:{value:A4}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=ur(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Sd(this.contents)&&this.contents.add(e)}addIn(e,n){Sd(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){const r=rX(this);e.anchor=!n||r.has(n)?iX(n||"a",r):n}return new Jx(e.anchor)}createNode(e,n,r){let i;if(typeof n=="function")e=n.call({"":e},"",e),i=n;else if(Array.isArray(n)){const g=O=>typeof O=="number"||O instanceof String||O instanceof Number,y=n.filter(g).map(String);y.length>0&&(n=n.concat(y)),i=n}else r===void 0&&n&&(r=n,n=void 0);const{aliasDuplicateObjects:s,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:u,tag:c}=r??{},{onAnchor:f,setAnchors:h,sourceObjects:d}=nSe(this,o||"a"),p={aliasDuplicateObjects:s??!0,keepUndefined:l??!1,onAnchor:f,onTagObj:u,replacer:i,schema:this.schema,sourceObjects:d},m=M1(e,c,p);return a&&or(m)&&(m.flow=!0),h(),m}createPair(e,n,r={}){const i=this.createNode(e,null,r),s=this.createNode(n,null,r);return new xi(i,s)}delete(e){return Sd(this.contents)?this.contents.delete(e):!1}deleteIn(e){return lg(e)?this.contents==null?!1:(this.contents=null,!0):Sd(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return or(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return lg(e)?!n&&Tn(this.contents)?this.contents.value:this.contents:or(this.contents)?this.contents.getIn(e,n):void 0}has(e){return or(this.contents)?this.contents.has(e):!1}hasIn(e){return lg(e)?this.contents!==void 0:or(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=sw(this.schema,[e],n):Sd(this.contents)&&this.contents.set(e,n)}setIn(e,n){lg(e)?this.contents=n:this.contents==null?this.contents=sw(this.schema,Array.from(e),n):Sd(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Qi({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new Qi({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{const i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new l_(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:r,maxAliasCount:i,onAnchor:s,reviver:o}={}){const a={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},l=Co(this.contents,n??"",a);if(typeof s=="function")for(const{count:u,res:c}of a.anchors.values())s(c,u);return typeof o=="function"?tp(o,{"":l},"",l):l}toJSON(e,n){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:n})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){const n=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return ESe(this,e)}}function Sd(t){if(or(t))return!0;throw new Error("Expected a YAML collection as document contents")}class WE extends Error{constructor(e,n,r,i){super(),this.name=e,this.code=r,this.message=i,this.pos=n}}class rh extends WE{constructor(e,n,r){super("YAMLParseError",e,n,r)}}class EX extends WE{constructor(e,n,r){super("YAMLWarning",e,n,r)}}const aw=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));const{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let s=i-1,o=t.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(s>=60&&o.length>80){const a=Math.min(s-39,o.length-79);o="…"+o.substring(a),s-=a-1}if(o.length>80&&(o=o.substring(0,79)+"…"),r>1&&/^ *$/.test(o.substring(0,s))){let a=t.substring(e.lineStarts[r-2],e.lineStarts[r-1]);a.length>80&&(a=a.substring(0,79)+`… `),o=a+o}if(/[^ ]/.test(o)){let a=1;const l=n.linePos[1];l&&l.line===r&&l.col>i&&(a=Math.max(1,Math.min(l.col-i,80-s)));const u=" ".repeat(s)+"^".repeat(a);n.message+=`: ${o} ${u} `}};function g0(t,{flow:e,indicator:n,next:r,offset:i,onError:s,parentIndent:o,startOnNewline:a}){let l=!1,u=a,c=a,f="",h="",d=!1,p=!1,m=null,g=null,y=null,O=null,v=null,w=null,x=null;for(const k of t)switch(p&&(k.type!=="space"&&k.type!=="newline"&&k.type!=="comma"&&s(k.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),p=!1),m&&(u&&k.type!=="comment"&&k.type!=="newline"&&s(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),k.type){case"space":!e&&(n!=="doc-start"||r?.type!=="flow-collection")&&k.source.includes(" ")&&(m=k),c=!0;break;case"comment":{c||s(k,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const C=k.source.substring(1)||" ";f?f+=h+C:f=C,h="",u=!1;break}case"newline":u?f?f+=k.source:(!w||n!=="seq-item-ind")&&(l=!0):h+=k.source,u=!0,d=!0,(g||y)&&(O=k),c=!0;break;case"anchor":g&&s(k,"MULTIPLE_ANCHORS","A node can have at most one anchor"),k.source.endsWith(":")&&s(k.offset+k.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=k,x??(x=k.offset),u=!1,c=!1,p=!0;break;case"tag":{y&&s(k,"MULTIPLE_TAGS","A node can have at most one tag"),y=k,x??(x=k.offset),u=!1,c=!1,p=!0;break}case n:(g||y)&&s(k,"BAD_PROP_ORDER",`Anchors and tags must be after the ${k.source} indicator`),w&&s(k,"UNEXPECTED_TOKEN",`Unexpected ${k.source} in ${e??"collection"}`),w=k,u=n==="seq-item-ind"||n==="explicit-key-ind",c=!1;break;case"comma":if(e){v&&s(k,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),v=k,u=!1,c=!1;break}default:s(k,"UNEXPECTED_TOKEN",`Unexpected ${k.type} token`),u=!1,c=!1}const S=t[t.length-1],_=S?S.offset+S.source.length:i;return p&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&s(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(u&&m.indent<=o||r?.type==="block-map"||r?.type==="block-seq")&&s(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:v,found:w,spaceBefore:l,comment:f,hasNewline:d,anchor:g,tag:y,newlineAfterProp:O,end:_,start:x??_}}function L1(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(` `))return!0;if(t.end){for(const e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(const e of t.items){for(const n of e.start)if(n.type==="newline")return!0;if(e.sep){for(const n of e.sep)if(n.type==="newline")return!0}if(L1(e.key)||L1(e.value))return!0}return!1;default:return!0}}function P4(t,e,n){if(e?.type==="flow-collection"){const r=e.end[0];r.indent===t&&(r.source==="]"||r.source==="}")&&L1(e)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function TX(t,e,n){const{uniqueKeys:r}=t.options;if(r===!1)return!1;const i=typeof r=="function"?r:(s,o)=>s===o||Tn(s)&&Tn(o)&&s.value===o.value;return e.some(s=>i(s.key,n))}const XR="All mapping items must start at the same column";function TSe({composeNode:t,composeEmptyNode:e},n,r,i,s){const o=s?.nodeClass??Xs,a=new o(n.schema);n.atRoot&&(n.atRoot=!1);let l=r.offset,u=null;for(const c of r.items){const{start:f,key:h,sep:d,value:p}=c,m=g0(f,{indicator:"explicit-key-ind",next:h??d?.[0],offset:l,onError:i,parentIndent:r.indent,startOnNewline:!0}),g=!m.found;if(g){if(h&&(h.type==="block-seq"?i(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in h&&h.indent!==r.indent&&i(l,"BAD_INDENT",XR)),!m.anchor&&!m.tag&&!d){u=m.end,m.comment&&(a.comment?a.comment+=` `+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||L1(h))&&i(h??f[f.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else m.found?.indent!==r.indent&&i(l,"BAD_INDENT",XR);n.atKey=!0;const y=m.end,O=h?t(n,h,m,i):e(n,y,f,null,m,i);n.schema.compat&&P4(r.indent,h,i),n.atKey=!1,TX(n,a.items,O)&&i(y,"DUPLICATE_KEY","Map keys must be unique");const v=g0(d??[],{indicator:"map-value-ind",next:p,offset:O.range[2],onError:i,parentIndent:r.indent,startOnNewline:!h||h.type==="block-scalar"});if(l=v.end,v.found){g&&(p?.type==="block-map"&&!v.hasNewline&&i(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&m.startt&&(t.type==="block-map"||t.type==="block-seq");function PSe({composeNode:t,composeEmptyNode:e},n,r,i,s){const o=r.start.source==="{",a=o?"flow map":"flow sequence",l=s?.nodeClass??(o?Xs:uf),u=new l(n.schema);u.flow=!0;const c=n.atRoot;c&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let f=r.offset+r.start.source.length;for(let g=0;g0){const g=Ty(p,m,n.options.strict,i);g.comment&&(u.comment?u.comment+=` `+g.comment:u.comment=g.comment),u.range=[r.offset,m,g.offset]}else u.range=[r.offset,m,m];return u}function R3(t,e,n,r,i,s){const o=n.type==="block-map"?TSe(t,e,n,r,s):n.type==="block-seq"?DSe(t,e,n,r,s):PSe(t,e,n,r,s),a=o.constructor;return i==="!"||i===a.tagName?(o.tag=a.tagName,o):(i&&(o.tag=i),o)}function RSe(t,e,n,r,i){const s=r.tag,o=s?e.directives.tagName(s.source,h=>i(s,"TAG_RESOLVE_FAILED",h)):null;if(n.type==="block-seq"){const{anchor:h,newlineAfterProp:d}=r,p=h&&s?h.offset>s.offset?h:s:h??s;p&&(!d||d.offseth.tag===o&&h.collection===a);if(!l){const h=e.schema.knownTags[o];if(h&&h.collection===a)e.schema.tags.push(Object.assign({},h,{default:!1})),l=h;else return h?i(s,"BAD_COLLECTION_TYPE",`${h.tag} used for ${a} collection, but expects ${h.collection??"scalar"}`,!0):i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),R3(t,e,n,i,o)}const u=R3(t,e,n,i,o,l),c=l.resolve?.(u,h=>i(s,"TAG_RESOLVE_FAILED",h),e.options)??u,f=ur(c)?c:new mt(c);return f.range=u.range,f.tag=o,l?.format&&(f.format=l.format),f}function DX(t,e,n){const r=e.offset,i=ISe(e,t.options.strict,n);if(!i)return{value:"",type:null,comment:"",range:[r,r,r]};const s=i.mode===">"?mt.BLOCK_FOLDED:mt.BLOCK_LITERAL,o=e.source?FSe(e.source):[];let a=o.length;for(let m=o.length-1;m>=0;--m){const g=o[m][1];if(g===""||g==="\r")a=m;else break}if(a===0){const m=i.chomp==="+"&&o.length>0?` `.repeat(Math.max(1,o.length-1)):"";let g=r+i.length;return e.source&&(g+=e.source.length),{value:m,type:s,comment:i.comment,range:[r,g,g]}}let l=e.indent+i.indent,u=e.offset+i.length,c=0;for(let m=0;ml&&(l=g.length);else{g.length=a;--m)o[m][0].length>l&&(a=m+1);let f="",h="",d=!1;for(let m=0;ml||y[0]===" "?(h===" "?h=` `:!d&&h===` `&&(h=` `),f+=h+g.slice(l)+y,h=` `,d=!0):y===""?h===` `?f+=` `:h=` `:(f+=h+y,h=" ",d=!1)}switch(i.chomp){case"-":break;case"+":for(let m=a;mn(r+h,d,p);switch(i){case"scalar":a=mt.PLAIN,l=$Se(s,u);break;case"single-quoted-scalar":a=mt.QUOTE_SINGLE,l=MSe(s,u);break;case"double-quoted-scalar":a=mt.QUOTE_DOUBLE,l=LSe(s,u);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[r,r+s.length,r+s.length]}}const c=r+s.length,f=Ty(o,c,e,n);return{value:l,type:a,comment:f.comment,range:[r,c,f.offset]}}function $Se(t,e){let n="";switch(t[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${t[0]}`;break}case"@":case"`":{n=`reserved character ${t[0]}`;break}}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),RX(t)}function MSe(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),RX(t.slice(1,-1)).replace(/''/g,"'")}function RX(t){let e,n;try{e=new RegExp(`(.*?)(?s?t.slice(s,r+1):i)}else n+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function NSe(t,e){let n="",r=t[e+1];for(;(r===" "||r===" "||r===` `||r==="\r")&&!(r==="\r"&&t[e+2]!==` `);)r===` `&&(n+=` `),e+=1,r=t[e+1];return n||(n=" "),{fold:n,offset:e}}const QSe={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function BSe(t,e,n,r){const i=t.substr(e,n),o=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(o)){const a=t.substr(e-2,n+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}function IX(t,e,n,r){const{value:i,type:s,comment:o,range:a}=e.type==="block-scalar"?DX(t,e,r):PX(e,t.options.strict,r),l=n?t.directives.tagName(n.source,f=>r(n,"TAG_RESOLVE_FAILED",f)):null;let u;t.options.stringKeys&&t.atKey?u=t.schema[Cl]:l?u=zSe(t.schema,i,l,n,r):e.type==="scalar"?u=USe(t,i,e,r):u=t.schema[Cl];let c;try{const f=u.resolve(i,h=>r(n??e,"TAG_RESOLVE_FAILED",h),t.options);c=Tn(f)?f:new mt(f)}catch(f){const h=f instanceof Error?f.message:String(f);r(n??e,"TAG_RESOLVE_FAILED",h),c=new mt(i)}return c.range=a,c.source=i,s&&(c.type=s),l&&(c.tag=l),u.format&&(c.format=u.format),o&&(c.comment=o),c}function zSe(t,e,n,r,i){if(n==="!")return t[Cl];const s=[];for(const a of t.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)s.push(a);else return a;for(const a of s)if(a.test?.test(e))return a;const o=t.knownTags[n];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[Cl])}function USe({atKey:t,directives:e,schema:n},r,i,s){const o=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(r))||n[Cl];if(n.compat){const a=n.compat.find(l=>l.default&&l.test?.test(r))??n[Cl];if(o.tag!==a.tag){const l=e.tagString(o.tag),u=e.tagString(a.tag),c=`Value may be parsed as either ${l} or ${u}`;s(i,"TAG_RESOLVE_FAILED",c,!0)}}return o}function jSe(t,e,n){if(e){n??(n=e.length);for(let r=n-1;r>=0;--r){let i=e[r];switch(i.type){case"space":case"comment":case"newline":t-=i.source.length;continue}for(i=e[++r];i?.type==="space";)t+=i.source.length,i=e[++r];break}}return t}const qSe={composeNode:FX,composeEmptyNode:YE};function FX(t,e,n,r){const i=t.atKey,{spaceBefore:s,comment:o,anchor:a,tag:l}=n;let u,c=!0;switch(e.type){case"alias":u=VSe(t,e,r),(a||l)&&r(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":u=IX(t,e,l,r),a&&(u.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":u=RSe(qSe,t,e,n,r),a&&(u.anchor=a.source.substring(1));break;default:{const f=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",f),u=YE(t,e.offset,void 0,null,n,r),c=!1}}return a&&u.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&t.options.stringKeys&&(!Tn(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&r(l??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),s&&(u.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?u.comment=o:u.commentBefore=o),t.options.keepSourceTokens&&c&&(u.srcToken=e),u}function YE(t,e,n,r,{spaceBefore:i,comment:s,anchor:o,tag:a,end:l},u){const c={type:"scalar",offset:jSe(e,n,r),indent:-1,source:""},f=IX(t,c,a,u);return o&&(f.anchor=o.source.substring(1),f.anchor===""&&u(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(f.spaceBefore=!0),s&&(f.comment=s,f.range[2]=l),f}function VSe({options:t},{offset:e,source:n,end:r},i){const s=new Jx(n.substring(1));s.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&i(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const o=e+n.length,a=Ty(r,o,t.strict,i);return s.range=[e,o,a.offset],a.comment&&(s.comment=a.comment),s}function ZSe(t,e,{offset:n,start:r,value:i,end:s},o){const a=Object.assign({_directives:e},t),l=new em(void 0,a),u={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},c=g0(r,{indicator:"doc-start",next:i??s?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});c.found&&(l.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!c.hasNewline&&o(c.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?FX(u,i,c,o):YE(u,c.end,r,null,c,o);const f=l.contents.range[2],h=Ty(s,f,!1,o);return h.comment&&(l.comment=h.comment),l.range=[n,f,h.offset],l}function Cm(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];const{offset:e,source:n}=t;return[e,e+(typeof n=="string"?n.length:1)]}function WR(t){let e="",n=!1,r=!1;for(let i=0;i{const o=Cm(n);s?this.warnings.push(new EX(o,r,i)):this.errors.push(new rh(o,r,i))},this.directives=new Qi({version:e.version||"1.2"}),this.options=e}decorate(e,n){const{comment:r,afterEmptyLine:i}=WR(this.prelude);if(r){const s=e.contents;if(n)e.comment=e.comment?`${e.comment} ${r}`:r;else if(i||e.directives.docStart||!s)e.commentBefore=r;else if(or(s)&&!s.flow&&s.items.length>0){let o=s.items[0];Jn(o)&&(o=o.key);const a=o.commentBefore;o.commentBefore=a?`${r} ${a}`:r}else{const o=s.commentBefore;s.commentBefore=o?`${r} ${o}`:r}}n?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:WR(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,r=-1){for(const i of e)yield*this.next(i);yield*this.end(n,r)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(n,r,i)=>{const s=Cm(e);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",r,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{const n=ZSe(this.options,this.directives,e,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{const n=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new rh(Cm(e),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){const r="Unexpected doc-end without preceding document";this.errors.push(new rh(Cm(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;const n=Ty(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){const r=this.doc.comment;this.doc.comment=r?`${r} ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new rh(Cm(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){const r=Object.assign({_directives:this.directives},this.options),i=new em(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,n,n],this.decorate(i,!1),yield i}}}function XSe(t,e=!0,n){if(t){const r=(i,s,o)=>{const a=typeof i=="number"?i:Array.isArray(i)?i[0]:i.offset;if(n)n(a,s,o);else throw new rh([a,a+1],s,o)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return PX(t,e,r);case"block-scalar":return DX({options:{strict:e}},t,r)}}return null}function WSe(t,e){const{implicitKey:n=!1,indent:r,inFlow:i=!1,offset:s=-1,type:o="PLAIN"}=e,a=Ay({type:o,value:t},{implicitKey:n,indent:r>0?" ".repeat(r):"",inFlow:i,options:{blockQuote:!0,lineWidth:-1}}),l=e.end??[{type:"newline",offset:-1,indent:r,source:` `}];switch(a[0]){case"|":case">":{const u=a.indexOf(` `),c=a.substring(0,u),f=a.substring(u+1)+` `,h=[{type:"block-scalar-header",offset:s,indent:r,source:c}];return $X(h,l)||h.push({type:"newline",offset:-1,indent:r,source:` `}),{type:"block-scalar",offset:s,indent:r,props:h,source:f}}case'"':return{type:"double-quoted-scalar",offset:s,indent:r,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:s,indent:r,source:a,end:l};default:return{type:"scalar",offset:s,indent:r,source:a,end:l}}}function YSe(t,e,n={}){let{afterKey:r=!1,implicitKey:i=!1,inFlow:s=!1,type:o}=n,a="indent"in t?t.indent:null;if(r&&typeof a=="number"&&(a+=2),!o)switch(t.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{const u=t.props[0];if(u.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=u.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}const l=Ay({type:o,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:s,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":GSe(t,l);break;case'"':I3(t,l,"double-quoted-scalar");break;case"'":I3(t,l,"single-quoted-scalar");break;default:I3(t,l,"scalar")}}function GSe(t,e){const n=e.indexOf(` `),r=e.substring(0,n),i=e.substring(n+1)+` `;if(t.type==="block-scalar"){const s=t.props[0];if(s.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s.source=r,t.source=i}else{const{offset:s}=t,o="indent"in t?t.indent:-1,a=[{type:"block-scalar-header",offset:s,indent:o,source:r}];$X(a,"end"in t?t.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:` `});for(const l of Object.keys(t))l!=="type"&&l!=="offset"&&delete t[l];Object.assign(t,{type:"block-scalar",indent:o,props:a,source:i})}}function $X(t,e){if(e)for(const n of e)switch(n.type){case"space":case"comment":t.push(n);break;case"newline":return t.push(n),!0}return!1}function I3(t,e,n){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=n,t.source=e;break;case"block-scalar":{const r=t.props.slice(1);let i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(const s of r)s.offset+=i;delete t.props,Object.assign(t,{type:n,source:e,end:r});break}case"block-map":case"block-seq":{const i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:` `};delete t.items,Object.assign(t,{type:n,source:e,end:[i]});break}default:{const r="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(s=>s.type==="space"||s.type==="comment"||s.type==="newline"):[];for(const s of Object.keys(t))s!=="type"&&s!=="offset"&&delete t[s];Object.assign(t,{type:n,indent:r,source:e,end:i})}}}const HSe=t=>"type"in t?lw(t):YO(t);function lw(t){switch(t.type){case"block-scalar":{let e="";for(const n of t.props)e+=lw(n);return e+t.source}case"block-map":case"block-seq":{let e="";for(const n of t.items)e+=YO(n);return e}case"flow-collection":{let e=t.start.source;for(const n of t.items)e+=YO(n);for(const n of t.end)e+=n.source;return e}case"document":{let e=YO(t);if(t.end)for(const n of t.end)e+=n.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(const n of t.end)e+=n.source;return e}}}function YO({start:t,key:e,sep:n,value:r}){let i="";for(const s of t)i+=s.source;if(e&&(i+=lw(e)),n)for(const s of n)i+=s.source;return r&&(i+=lw(r)),i}const R4=Symbol("break visit"),KSe=Symbol("skip children"),MX=Symbol("remove item");function Qh(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),LX(Object.freeze([]),t,e)}Qh.BREAK=R4;Qh.SKIP=KSe;Qh.REMOVE=MX;Qh.itemAtPath=(t,e)=>{let n=t;for(const[r,i]of e){const s=n?.[r];if(s&&"items"in s)n=s.items[i];else return}return n};Qh.parentCollection=(t,e)=>{const n=Qh.itemAtPath(t,e.slice(0,-1)),r=e[e.length-1][0],i=n?.[r];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function LX(t,e,n){let r=n(e,t);if(typeof r=="symbol")return r;for(const i of["key","value"]){const s=e[i];if(s&&"items"in s){for(let o=0;o!!t&&"items"in t,e3e=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function t3e(t){switch(t){case u_:return"";case c_:return"";case f_:return"";case N1:return"";default:return JSON.stringify(t)}}function NX(t){switch(t){case u_:return"byte-order-mark";case c_:return"doc-mode";case f_:return"flow-error-end";case N1:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` `:case`\r `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}const n3e=Object.freeze(Object.defineProperty({__proto__:null,BOM:u_,DOCUMENT:c_,FLOW_END:f_,SCALAR:N1,createScalarToken:WSe,isCollection:JSe,isScalar:e3e,prettyToken:t3e,resolveAsScalar:XSe,setScalarValue:YSe,stringify:HSe,tokenType:NX,visit:Qh},Symbol.toStringTag,{value:"Module"}));function jo(t){switch(t){case void 0:case" ":case` `:case"\r":case" ":return!0;default:return!1}}const YR=new Set("0123456789ABCDEFabcdef"),r3e=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Bb=new Set(",[]{}"),i3e=new Set(` ,[]{} \r `),F3=t=>!t||i3e.has(t);class QX{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,n=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,n=this.buffer[e];for(;n===" "||n===" ";)n=this.buffer[++e];return!n||n==="#"||n===` `?!0:n==="\r"?this.buffer[e+1]===` `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let n=this.buffer[e];if(this.indentNext>0){let r=0;for(;n===" ";)n=this.buffer[++r+e];if(n==="\r"){const i=this.buffer[r+e+1];if(i===` `||!i&&!this.atEnd)return e+r+1}return n===` `||r>=this.indentNext||!n&&!this.atEnd?e+r:-1}if(n==="-"||n==="."){const r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&jo(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&ethis.indentValue&&!jo(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[e,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&jo(n)){const r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const e=this.getLine();if(e===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(F3),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,n,r=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);const i=this.getLine();if(i===null)return this.setNext("flow");if((r!==-1&&r"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>jo(n)||n==="#")}*parseBlockScalar(){let e=this.pos-1,n=0,r;e:for(let s=this.pos;r=this.buffer[s];++s)switch(r){case" ":n+=1;break;case` `:e=s,n=0;break;case"\r":{const o=this.buffer[s+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===` `)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{const s=this.continueScalar(e+1);if(s===-1)break;e=this.buffer.indexOf(` `,s)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(r=this.buffer[i];r===" ";)r=this.buffer[++i];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===` `;)r=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let s=e-1,o=this.buffer[s];o==="\r"&&(o=this.buffer[--s]);const a=s;for(;o===" ";)o=this.buffer[--s];if(o===` `&&s>=this.pos&&s+1+n>a)e=s;else break}while(!0);return yield N1,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const e=this.flowLevel>0;let n=this.pos-1,r=this.pos-1,i;for(;i=this.buffer[++r];)if(i===":"){const s=this.buffer[r+1];if(jo(s)||e&&Bb.has(s))break;n=r}else if(jo(i)){let s=this.buffer[r+1];if(i==="\r"&&(s===` `?(r+=1,i=` `,s=this.buffer[r+1]):n=r),s==="#"||e&&Bb.has(s))break;if(i===` `){const o=this.continueScalar(r+1);if(o===-1)break;r=Math.max(r,o-2)}}else{if(e&&Bb.has(i))break;n=r}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield N1,yield*this.pushToIndex(n+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,n){const r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(n&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(F3))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{const e=this.flowLevel>0,n=this.charAt(1);if(jo(n)||e&&Bb.has(n))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,n=this.buffer[e];for(;!jo(n)&&n!==">";)n=this.buffer[++e];return yield*this.pushToIndex(n===">"?e+1:e,!1)}else{let e=this.pos+1,n=this.buffer[e];for(;n;)if(r3e.has(n))n=this.buffer[++e];else if(n==="%"&&YR.has(this.buffer[e+1])&&YR.has(this.buffer[e+2]))n=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){const e=this.buffer[this.pos];return e===` `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===` `?yield*this.pushCount(2):0}*pushSpaces(e){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||e&&r===" ");const i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),i}*pushUntil(e){let n=this.pos,r=this.buffer[n];for(;!e(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}class BX{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,r=this.lineStarts.length;for(;n>1;this.lineStarts[s]=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function HR(t){if(t.start.type==="flow-seq-start")for(const e of t.items)e.sep&&!e.value&&!yc(e.start,"explicit-key-ind")&&!yc(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,zX(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}let HE=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new QX,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(const r of this.lexer.lex(e,n))yield*this.next(r);n||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}const n=NX(e);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{const r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const e=this.peek(1);if(this.type==="doc-end"&&(!e||e.type!=="doc-end")){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){const n=e??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{const r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&HR(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{const i=r.items[r.items.length-1];if(i.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=n;else{Object.assign(i,{key:n,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{const i=r.items[r.items.length-1];i.value?r.items.push({start:[],value:n}):i.value=n;break}case"flow-collection":{const i=r.items[r.items.length-1];!i||i.value?r.items.push({start:[],key:n,sep:[]}):i.sep?i.value=n:Object.assign(i,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){const i=n.items[n.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&GR(i.start)===-1&&(n.indent===0||i.start.every(s=>s.type!=="comment"||s.indent=e.indent){const r=!this.onKeyLine&&this.indent===e.indent,i=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let s=[];if(i&&n.sep&&!n.value){const o=[];for(let a=0;ae.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(s=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||n.value?(s.push(this.sourceToken),e.items.push({start:s}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):i||n.value?(s.push(this.sourceToken),e.items.push({start:s,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(yc(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(zX(n.key)&&!yc(n.sep,"newline")){const o=kd(n.start),a=n.key,l=n.sep;l.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else s.length>0?n.sep=n.sep.concat(s,this.sourceToken):n.sep.push(this.sourceToken);else if(yc(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const o=kd(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||i?e.items.push({start:s,key:null,sep:[this.sourceToken]}):yc(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const o=this.flowScalar(this.type);i||n.value?(e.items.push({start:s,key:o,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(o):(Object.assign(n,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{const o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!n.explicitKey&&n.sep&&!yc(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&e.items.push({start:s});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){const n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){const r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){const i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,n.start),i.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||yc(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){const r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){const n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r&&r.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const i=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:i,sep:[]}):n.sep?this.stack.push(i):Object.assign(n,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}const r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{const r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){const i=zb(r),s=kd(i);HR(e);const o=e.end.splice(1,e.end.length);o.push(this.sourceToken);const a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let n=this.source.indexOf(` `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(` `,n)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const n=zb(e),r=kd(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=zb(e),r=kd(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function UX(t){const e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new BX||null,prettyErrors:e}}function s3e(t,e={}){const{lineCounter:n,prettyErrors:r}=UX(e),i=new HE(n?.addNewLine),s=new GE(e),o=Array.from(s.compose(i.parse(t)));if(r&&n)for(const a of o)a.errors.forEach(aw(t,n)),a.warnings.forEach(aw(t,n));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function jX(t,e={}){const{lineCounter:n,prettyErrors:r}=UX(e),i=new HE(n?.addNewLine),s=new GE(e);let o=null;for(const a of s.compose(i.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new rh(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(o.errors.forEach(aw(t,n)),o.warnings.forEach(aw(t,n))),o}function o3e(t,e,n){let r;typeof e=="function"?r=e:n===void 0&&e&&typeof e=="object"&&(n=e);const i=jX(t,n);if(!i)return null;if(i.warnings.forEach(s=>uX(i.options.logLevel,s)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}function a3e(t,e,n){let r=null;if(typeof e=="function"||Array.isArray(e)?r=e:n===void 0&&e&&(n=e),typeof n=="string"&&(n=n.length),typeof n=="number"){const i=Math.round(n);n=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){const{keepUndefined:i}=n??e??{};if(!i)return}return rd(t)&&!r?t.toString(n):new em(t,r,n).toString(n)}const l3e=Object.freeze(Object.defineProperty({__proto__:null,Alias:Jx,CST:n3e,Composer:GE,Document:em,Lexer:QX,LineCounter:BX,Pair:xi,Parser:HE,Scalar:mt,Schema:l_,YAMLError:WE,YAMLMap:Xs,YAMLParseError:rh,YAMLSeq:uf,YAMLWarning:EX,isAlias:yf,isCollection:or,isDocument:rd,isMap:G0,isNode:ur,isPair:Jn,isScalar:Tn,isSeq:H0,parse:o3e,parseAllDocuments:s3e,parseDocument:jX,stringify:a3e,visit:id,visitAsync:Kx},Symbol.toStringTag,{value:"Module"}));function u3e(t){let e=null;try{e=l3e.parse(t.doc.toString())}catch{}const n=hE(t,Sn.YAML);return{data:e,pointers:n}}const qX=t=>{switch(t){case Sn.JSON:return j_e;case Sn.JSON5:return YZ;case Sn.YAML:return u3e}};function c3e(t){return Object.entries(t)}function ug(t,e){if(typeof t=="string"||typeof t!="object"||t===null)return t;if(Array.isArray(t))return t.map(i=>ug(i,e));if(t instanceof Map){const i=new Map;for(const[s,o]of t){const a=s,l=ug(o,e);i.set(a,l)}return i}if(t instanceof Set){const i=new Set;for(const s of t){const o=ug(s,e);i.add(o)}return i}const n={};function r(i,s,o,a){o===i&&a===s?n[o]=ug(s,e):n[o]=a}for(const[i,s]of c3e(t)){const o=e(i,s);if(o.length===2&&typeof o[0]=="string")r(i,s,o[0],o[1]);else for(const[a,l]of o)r(i,s,a,l)}return n}var f3e=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i",o[m-1],"..",o[m],"..",o),s.from=a.name===bt.INVALID?(r=p?.from)!==null&&r!==void 0?r:e.pos:m,s.to=e.pos}const f=new h3e;let h=!0;const d=S9(a,bt.PROPERTY_NAME,this.mode);if(d&&(rr.log("xxx","closestPropertyNameNode",d,"node",a),a=d),Cb(a,this.mode)){rr.log("xxx","isPropertyNameNode",a);const p=a.parent;if(p){const m=_9(p,this.mode);h=!m||m.name===bt.INVALID&&m.from-m.to===0||(m.parent?Oy(m.parent).length<=1:!1),rr.log("xxx","addValue",h,_9(p,this.mode),a),a=(i=S9(p,bt.OBJECT,this.mode))!==null&&i!==void 0?i:null}}if(rr.log("xxx",a,u,e,"node at pos",i3(e.state,e.pos)),a&&[bt.OBJECT,bt.JSON_TEXT].includes(br(a.name,this.mode))&&(Cb(i3(e.state,e.pos),this.mode)||d)){if(a.from===e.pos)return rr.log("xxx","no completions for just before opening brace"),s;this.getPropertyCompletions(n,e,a,f,h,c)}else{const p={},m=this.getValueCompletions(n,e,p,f);rr.log("xxx","getValueCompletions res",m)}return s.options=Array.from(f.completions.values()).filter(p=>QO(p.label).startsWith(l)),rr.log("xxx","result",s,"prefix",l,"collector.completions",f.completions,"reservedKeys",f.reservedKeys),s}applySnippetCompletion(e){return Li(typeof e.apply!="string"?e.label:e.apply,e)}getPropertyCompletions(e,n,r,i,s,o){const a=x1e(r,bt.PROPERTY,this.mode);rr.log("xxx","getPropertyCompletions",r,n,a),a.forEach(u=>{const c=qd(n.state.doc,l4(u,bt.PROPERTY_NAME,this.mode));i.reserve(QO(c))});const l=this.getSchemas(e,n);rr.log("xxx","propertyCompletion schemas",l),l.forEach(u=>{if(typeof u!="object")return;const c=u.properties;c&&Object.entries(c).forEach(([h,d])=>{var p,m;if(typeof d=="object"){const g=(p=d.description)!==null&&p!==void 0?p:"",y=(m=d.type)!==null&&m!==void 0?m:"",O=Array.isArray(y)?y.toString():y,v={label:h,apply:this.getInsertTextForProperty(h,s,o,e,d),type:"property",detail:O,info:()=>Ua("div",{inner:Ap(g)})};i.add(this.applySnippetCompletion(v))}});const f=u.propertyNames;if(typeof f=="object"&&(f.enum&&f.enum.forEach(h=>{const d=h?.toString();if(d){const p={label:d,apply:this.getInsertTextForProperty(d,s,o,e),type:"property"};i.add(this.applySnippetCompletion(p))}}),f.const)){const h=f.const.toString(),d={label:h,apply:this.getInsertTextForProperty(h,s,o,e),type:"property"};i.add(this.applySnippetCompletion(d))}})}getInsertTextForProperty(e,n,r,i,s){s=s&&$f(s,i);let o=this.getInsertTextForPropertyName(e,r);if(!n)return o;o+=": ";let a,l=0;if(typeof s=="object"){if(typeof s.default<"u")a||(a=this.getInsertTextForGuessedValue(s.default,"")),l++;else if(s.enum&&(!a&&s.enum.length===1&&(a=this.getInsertTextForGuessedValue(s.enum[0],"")),l+=s.enum.length),typeof s.const<"u"&&(a||(a=this.getInsertTextForGuessedValue(s.const,"")),l++),Array.isArray(s.examples)&&s.examples.length&&(a||(a=this.getInsertTextForGuessedValue(s.examples[0],"")),l+=s.examples.length),a===void 0&&l===0){let u=Array.isArray(s.type)?s.type[0]:s.type;switch(u||(s.properties?u="object":s.items&&(u="array")),u){case"boolean":a="#{}";break;case"string":a=this.getInsertTextForString("");break;case"object":switch(this.mode){case Sn.JSON5:a="{#{}}";break;case Sn.YAML:a="#{}";break;default:a="{#{}}";break}break;case"array":a="[#{}]";break;case"number":case"integer":a="#{0}";break;case"null":a="#{null}";break;default:a="#{}";break}}}return(!a||l>1)&&(rr.log("xxx","value",a,"nValueProposals",l,s),a="#{}"),o+a}getInsertTextForPropertyName(e,n){switch(this.mode){case Sn.JSON5:case Sn.YAML:return n.startsWith('"')?`"${e}"`:n.startsWith("'")?`'${e}'`:e;default:return`"${e}"`}}getInsertTextForString(e,n="#"){switch(this.mode){case Sn.JSON5:return`'${n}{${e}}'`;case Sn.YAML:return`${n}{${e}}`;default:return`"${n}{${e}}"`}}getInsertTextForGuessedValue(e,n=""){switch(typeof e){case"object":return e===null?"${null}"+n:this.getInsertTextForValue(e,n);case"string":{let r=JSON.stringify(e);return r=r.substr(1,r.length-2),r=this.getInsertTextForPlainText(r),this.getInsertTextForString(r,"$")+n}case"number":case"boolean":return"${"+JSON.stringify(e)+"}"+n}return this.getInsertTextForValue(e,n)}getInsertTextForPlainText(e){return e.replace(/[\\$}]/g,"\\$&")}getInsertTextForValue(e,n){const r=JSON.stringify(e,null," ");return r==="{}"?"{#{}}"+n:r==="[]"?"[#{}]"+n:this.getInsertTextForPlainText(r+n)}getValueCompletions(e,n,r,i){let s=hn(n.state).resolveInner(n.pos,-1),o=null,a;if(rr.log("xxx","getValueCompletions",s,n),s&&BO(s,this.mode)&&(o=s,s=s.parent),!s){this.addSchemaValueCompletions(e,r,i);return}if(br(s.name,this.mode)===bt.PROPERTY){const u=l4(s,bt.PROPERTY_NAME,this.mode);u&&(a=qd(n.state.doc,u),s=s.parent)}if(rr.log("xxx","node",s,"parentKey",a),s&&(a!==void 0||br(s.name,this.mode)===bt.ARRAY)){const u=this.getSchemas(e,n);for(const c of u){if(typeof c!="object")return;if(br(s.name,this.mode)===bt.ARRAY&&c.items){let f=i;if(c.uniqueItems&&(f=Object.assign(Object.assign({},f),{add(h){f.completions.has(h.label)||i.add(h)},reserve(h){i.reserve(h)}})),Array.isArray(c.items)){let h=0;if(o){const p=Gq(s,o,this.mode);p>=0&&(h=p)}const d=c.items[h];d&&this.addSchemaValueCompletions(d,r,f)}else this.addSchemaValueCompletions(c.items,r,f)}if((c.type==null||c.type!=="object")&&this.addSchemaValueCompletions(c,r,i),a!==void 0){let f=!1;if(c.properties){const h=c.properties[a];h&&(f=!0,this.addSchemaValueCompletions(h,r,i))}if(c.patternProperties&&!f)for(const h of Object.keys(c.patternProperties)){const d=this.extendedRegExp(h);if(d?.test(a)){f=!0;const p=c.patternProperties[h];p&&this.addSchemaValueCompletions(p,r,i)}}if(c.additionalProperties&&!f){const h=c.additionalProperties;this.addSchemaValueCompletions(h,r,i)}}r.boolean&&(this.addBooleanValueCompletion(!0,i),this.addBooleanValueCompletion(!1,i)),r.null&&this.addNullValueCompletion(i)}}return{valuePrefix:o?qd(n.state.doc,o,!0,!1):""}}addSchemaValueCompletions(e,n,r){typeof e=="object"&&(this.addEnumValueCompletions(e,r),this.addDefaultValueCompletions(e,r),this.collectTypes(e,n),Array.isArray(e.allOf)&&e.allOf.forEach(i=>this.addSchemaValueCompletions(i,n,r)),Array.isArray(e.anyOf)&&e.anyOf.forEach(i=>this.addSchemaValueCompletions(i,n,r)),Array.isArray(e.oneOf)&&e.oneOf.forEach(i=>this.addSchemaValueCompletions(i,n,r)))}addDefaultValueCompletions(e,n,r=0){let i=!1;if(typeof e.default<"u"){let s=e.type,o=e.default;for(let l=r;l>0;l--)o=[o],s="array";const a=Object.assign(Object.assign({type:s?.toString()},this.getAppliedValue(o)),{detail:"Default value"});n.add(a),i=!0}Array.isArray(e.examples)&&e.examples.forEach(s=>{let o=e.type,a=s;for(let l=r;l>0;l--)a=[a],o="array";n.add(Object.assign({type:o?.toString()},this.getAppliedValue(a))),i=!0}),!i&&typeof e.items=="object"&&!Array.isArray(e.items)&&r<5&&this.addDefaultValueCompletions(e.items,n,r+1)}addEnumValueCompletions(e,n){var r,i;if(typeof e.const<"u"&&n.add(Object.assign(Object.assign({type:(r=e.type)===null||r===void 0?void 0:r.toString()},this.getAppliedValue(e.const)),{info:e.description})),Array.isArray(e.enum))for(let s=0,o=e.enum.length;sn[i]=!0):r&&(n[r]=!0)}getSchemas(e,n){var r,i,s;const{data:o}=this.parser(n.state),a=new LV(e);let l=Wq(n.state,n.pos,-1,this.mode);if(l===""&&(l=void 0),l!=null&&l.endsWith("/")){l=l.substring(0,l.length-1);const p=KR(e,o,l);if(p!=null)return[p]}let u=l?.replace(/\/[^/]*$/,"");u===""&&(u=void 0);const c=KR(e,o,u),f=l?.split("/").pop(),h=f==null||f in((r=c?.properties)!==null&&r!==void 0?r:{});let d=a.getSchema({pointer:l,data:o??void 0});return!h&&d?.type==="null"&&this.mode==="yaml"&&(d=void 0),rr.log("xxxx","draft.getSchema",d,"data",o,"pointer",l,"pointerPointsToKnownProperty",h),Ei(d)&&(d=(i=d.data)===null||i===void 0?void 0:i.schema),!Ig(d)&&c?[c]:(Ig(d)||(d=a.getSchema({pointer:u}),l=u),rr.log("xxx","pointer..",JSON.stringify(l)),!Ig(d)&&(!l||l==="/")&&(d=(s=$f(e,e))!==null&&s!==void 0?s:e),rr.log("xxx","subSchema..",d),d?Array.isArray(d.allOf)?[d,...d.allOf.map(p=>$f(p,e))]:Array.isArray(d.oneOf)?[d,...d.oneOf.map(p=>$f(p,e))]:Array.isArray(d.anyOf)?[d,...d.anyOf.map(p=>$f(p,e))]:[d]:[])}getAppliedValue(e){const n=QO(JSON.stringify(e));switch(this.mode){case Sn.JSON5:return{label:n,apply:v1e(JSON.stringify(e))};case Sn.YAML:return{label:n,apply:n};default:return{label:n,apply:JSON.stringify(e)}}}getValueFromLabel(e){return JSON.parse(e)}extendedRegExp(e){let n="";e.startsWith("(?i)")&&(e=e.substring(4),n="i");try{return new RegExp(e,n+"u")}catch{try{return new RegExp(e,n)}catch{return}}}}function d3e(t={}){const e=new VX(t);return function(r){return e.doComplete(r)}}function p3e(t){return ug(t,(e,n)=>e==="additionalProperties"&&n===!1?[]:e==="required"&&Array.isArray(n)?[]:e==="unevaluatedProperties"&&n===!1?[]:e==="unevaluatedItems"&&n===!1?[]:[e,n])}function KR(t,e,n){const r=new LV(t),i=r.getSchema({pointer:n,data:e??void 0});if(!Ig(i))return;const s=ZX(r,i),o={};for(let h of s){let d=g3e(n,h);const p=r.getSchema({pointer:d,data:e??void 0});Ig(p)&&Object.assign(o,{[h]:p})}if(s.length===0||Object.keys(o).length===0)return;const a=i,{allOf:l,anyOf:u,oneOf:c}=a,f=f3e(a,["allOf","anyOf","oneOf"]);return Object.assign(Object.assign({},f),{properties:o})}function ZX(t,e){if(e=$f(e,t.rootSchema),typeof e!="object"||e==null)return[];const n=[];function r(i){const s=ZX(t,i);n.push(...s)}if(typeof e.properties=="object"&&e.properties!=null&&n.push(...Object.keys(e.properties)),typeof e.then=="object"&&e.then!=null&&r(e.then),Array.isArray(e.allOf))for(const i of e.allOf)r(i);if(Array.isArray(e.anyOf))for(const i of e.anyOf)r(i);if(Array.isArray(e.oneOf))for(const i of e.oneOf)r(i);return n}function $f(t,e){if(typeof t=="object"&&t.$ref){const n=m3e(e,t.$ref);if(typeof n=="object"){const r=Object.assign(Object.assign({},t),n);return Reflect.deleteProperty(r,"$ref"),r}}return t}function m3e(t,e){const n=e.split("/");let r=t;return n.forEach(i=>{if(i){if(i==="#"){r=t;return}typeof r=="object"&&(r=r[i])}}),r}function g3e(t,e){return t===void 0?`/${e}`:`${t}/${e}`}const Q1=(t,e)=>{const n=t.length>2;let r=t.map((i,s)=>{const o="`"+(e?e(i):i)+"`";return s===t.length-1?"or "+o:o});return n?r.join(", "):r.join(" ")},y3e=t=>{var e,n,r;return!((e=t?.data)===null||e===void 0)&&e.pointer&&((n=t?.data)===null||n===void 0?void 0:n.pointer)!=="#"?t.data.pointer.slice(1):!((r=t?.data)===null||r===void 0)&&r.property?`/${t.data.property}`:""},XX=t=>t.startState.field(Q2)!==t.state.field(Q2);function b3e(t){const e=new WX(t);return n=>e.doValidation(n)}const O3e=["NoAdditionalPropertiesError","RequiredPropertyError","InvalidPropertyNameError","ForbiddenPropertyError","UndefinedValueError"];class WX{constructor(e){var n,r,i,s;this.options=e,this.schema=null,this.mode=Sn.JSON,this.rewriteError=o=>{var a,l,u,c,f;const h=o?.data,d=h?.errors;return o.code==="one-of-error"&&d?.length?`Expected one of ${Q1(d,m=>m.data.expected)}`:o.code==="type-error"?`Expected \`${!((a=o?.data)===null||a===void 0)&&a.expected&&Array.isArray((l=o?.data)===null||l===void 0?void 0:l.expected)?Q1((u=o?.data)===null||u===void 0?void 0:u.expected):(c=o?.data)===null||c===void 0?void 0:c.expected}\` but received \`${(f=o?.data)===null||f===void 0?void 0:f.received}\``:o.message.replaceAll("in `#` ","").replaceAll("at `#`","").replaceAll("/",".").replaceAll("#.","")},this.mode=(r=(n=this.options)===null||n===void 0?void 0:n.mode)!==null&&r!==void 0?r:Sn.JSON,this.parser=(s=(i=this.options)===null||i===void 0?void 0:i.jsonParser)!==null&&s!==void 0?s:qX(this.mode)}get schemaTitle(){var e,n,r;return(r=(n=(e=this.schema)===null||e===void 0?void 0:e.getSchema())===null||n===void 0?void 0:n.title)!==null&&r!==void 0?r:"json-schema"}doValidation(e){const n=dE(e.state);if(!n)return[];if(this.schema=new $V(n),!this.schema)return[];const r=e.state.doc.toString();if(!r?.length)return[];const i=this.parser(e.state);if(i.data==null)return[];let s=[];try{s=this.schema.validate(i.data)}catch{}return rr.log("xxx","validation errors",s,i.data),s.length?s.reduce((o,a)=>{const l=()=>{const f=this.rewriteError(a);o.push({from:0,to:0,message:f,severity:"error",source:this.schemaTitle,renderMessage:()=>{const h=Ua("div",{});return h.innerHTML=Ap(f),h}})},u=y3e(a),c=i.pointers.get(u);if(a.name==="MaxPropertiesError"||a.name==="MinPropertiesError"||u==="")l();else if(c){const f=O3e.includes(a.name),h=this.rewriteError(a),d=f?c.keyFrom:c.valueFrom,p=f?c.keyTo:c.valueTo;p!==void 0&&d!==void 0&&o.push({from:d,to:p,message:h,renderMessage:()=>{const m=Ua("div",{});return m.innerHTML=Ap(h),m},severity:"error",source:this.schemaTitle})}else l();return o},[]):[]}}function v3e(t){const e=new YX(t);return async function(r,i,s){return e.doHover(r,i,s)}}function JR(t){if(t.type)return t.$ref?`${t.$ref} (${t.type})`:t.type;if(t.$ref)return`${t.$ref}`}function $3(t,e,n){return`${e}: ${Q1(t[e].map(r=>{try{const{data:i}=n.resolveRef({data:r,pointer:r.$ref});return JR(i||r)}catch{return r.type}}))}`}class YX{constructor(e){var n,r;this.opts=e,this.schema=null,this.mode=Sn.JSON,this.opts=Object.assign({parser:JSON.parse},this.opts),this.mode=(r=(n=this.opts)===null||n===void 0?void 0:n.mode)!==null&&r!==void 0?r:Sn.JSON}getDataForCursor(e,n,r){const i=dE(e.state);if(!i)return null;this.schema=new $V(i);const s=Wq(e.state,n,r,this.mode);let o;try{o=this.opts.parser(e.state.doc.toString())}catch{}if(!s)return null;let a=this.schema.getSchema({pointer:s,data:o,withSchemaWarning:!0});return Ei(a)&&(a?.data.schema.$ref?a=this.schema.resolveRef(a):a=a?.data.schema),{schema:a,pointer:s}}formatMessage(e){const{message:n,typeInfo:r}=e;return n?Ua("div",{class:"cm6-json-schema-hover"},[Ua("div",{class:"cm6-json-schema-hover--description",inner:Ap(n,!1)}),Ua("div",{class:"cm6-json-schema-hover--code-wrapper"},[Ua("div",{class:"cm6-json-schema-hover--code",inner:Ap(r,!1)})])]):Ua("div",{class:"cm6-json-schema-hover"},[Ua("div",{class:"cm6-json-schema-hover--code-wrapper"},[Ua("code",{class:"cm6-json-schema-hover--code",inner:Ap(r,!1)})])])}getHoverTexts(e,n){let r="",i=null;const{schema:s}=e;return s.oneOf&&(r=$3(s,"oneOf",n)),s.anyOf&&(r=$3(s,"anyOf",n)),s.allOf&&(r=$3(s,"allOf",n)),s.type&&(r=Array.isArray(s.type)?Q1(s.type):s.type),s.$ref&&(r=` Reference: ${s.$ref}`),s.enum&&(r=`\`enum\`: ${Q1(s.enum)}`),s.format&&(r+=`\`format\`: ${s.format}`),s.pattern&&(r+=`\`pattern\`: ${s.pattern}`),s.description&&(i=s.description),{message:i,typeInfo:r}}async doHover(e,n,r){var i,s,o,a;const l=n,u=n;try{const c=this.getDataForCursor(e,n,r);if(rr.log("cursorData",c),!c?.schema)return null;const h=((s=(i=this.opts)===null||i===void 0?void 0:i.getHoverTexts)!==null&&s!==void 0?s:this.getHoverTexts)(c,this.schema),p=((a=(o=this.opts)===null||o===void 0?void 0:o.formatHover)!==null&&a!==void 0?a:this.formatMessage)(h);return{pos:l,end:u,arrow:!0,above:!0,create:m=>({dom:p})}}catch(c){return rr.log(c),null}}}function w3e(t){return[z_e(),S2(Q_e()),S2(b3e(),{needsRefresh:XX}),VZ.data.of({autocomplete:d3e()}),kA(v3e()),Hq(t)]}function x3e(t){const e=new WX(Object.assign({jsonParser:YZ,mode:Sn.JSON5},t));return n=>e.doValidation(n)}function _3e(t){const e=new YX(Object.assign(Object.assign({},t),{parser:Jp.parse,mode:Sn.JSON5}));return async function(r,i,s){return e.doHover(r,i,s)}}function S3e(t={}){const e=new VX(Object.assign(Object.assign({},t),{mode:Sn.JSON5}));return function(r){return e.doComplete(r)}}function k3e(t){return[H_e(),S2(K_e()),S2(x3e(),{needsRefresh:XX}),XZ.data.of({autocomplete:S3e()}),kA(_3e()),Hq(t)]}const C3e="#e5c07b",eI="#e06c75",A3e="#56b6c2",E3e="#ffffff",GO="#abb2bf",I4="#7d8799",T3e="#61afef",D3e="#98c379",tI="#d19a66",P3e="#c678dd",R3e="#21252b",nI="#2c313a",rI="#282c34",M3="#353a42",I3e="#3E4451",iI="#528bff",F3e=Te.theme({"&":{color:GO,backgroundColor:rI},".cm-content":{caretColor:iI},".cm-cursor, .cm-dropCursor":{borderLeftColor:iI},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:I3e},".cm-panels":{backgroundColor:R3e,color:GO},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:rI,color:I4,border:"none"},".cm-activeLineGutter":{backgroundColor:nI},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:M3},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:M3,borderBottomColor:M3},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:nI,color:GO}}},{dark:!0}),$3e=my.define([{tag:P.keyword,color:P3e},{tag:[P.name,P.deleted,P.character,P.propertyName,P.macroName],color:eI},{tag:[P.function(P.variableName),P.labelName],color:T3e},{tag:[P.color,P.constant(P.name),P.standard(P.name)],color:tI},{tag:[P.definition(P.name),P.separator],color:GO},{tag:[P.typeName,P.className,P.number,P.changed,P.annotation,P.modifier,P.self,P.namespace],color:C3e},{tag:[P.operator,P.operatorKeyword,P.url,P.escape,P.regexp,P.link,P.special(P.string)],color:A3e},{tag:[P.meta,P.comment],color:I4},{tag:P.strong,fontWeight:"bold"},{tag:P.emphasis,fontStyle:"italic"},{tag:P.strikethrough,textDecoration:"line-through"},{tag:P.link,color:I4,textDecoration:"underline"},{tag:P.heading,fontWeight:"bold",color:eI},{tag:[P.atom,P.bool,P.special(P.variableName)],color:tI},{tag:[P.processingInstruction,P.string,P.inserted],color:D3e},{tag:P.invalid,color:E3e}]),M3e=[F3e,bU($3e)];function L3e(){return[Oce(),xce(),Bue(),_he(),Tue(),Fue(),Zt.allowMultipleSelections.of(!0),nfe(),bU(ofe,{fallback:!0}),dfe(),the(),hhe(),Kue(),tce(),Zue(),Xde(),Te.domEventHandlers({keydown(t){t.stopPropagation()}}),fy.of([...she,...Cde,...hpe,...Rhe,...IU,...Fde,{key:"Tab",preventDefault:!0,run:_de},{key:"Shift-Tab",preventDefault:!0,run:hj}])]}function N3e(t,e){const n=Te.theme({"&.cm-editor":{height:"100%"},".cm-scroller":{overflow:"auto"},"&.cm-focused":{outline:"none"},".cm-content":{fontFamily:"var(--font-mono)"},".cm-tooltip":{boxShadow:e.colorScheme=="light"?"0 2px 5px rgba(0,0,0,0.2)":"0 2px 5px rgba(0,0,0,1)"},".cm6-json-schema-hover":{padding:"6px"}}),r=Te.updateListener.of(o=>{if(o.docChanged&&e.onChange){const a=o.state.doc.toString();e.onChange(a)}}),i=[];if(e.language=="json"&&i.push(w3e(e.json?.schema??{})),e.language=="json5"&&i.push(k3e(e.json?.schema??{})),e.language=="sql"){let o=e.sql?.table,a=e.sql?.columns;i.push(d1e({dialect:p1e,upperCaseKeywords:!0,schema:o!=null?{[o]:a?.map(l=>({label:l.name,detail:l.type,type:"property"}))??[]}:void 0,defaultTable:o}))}e.language=="markdown"&&i.push(_ge());const s=new Te({doc:e.initialText,parent:t,extensions:[...L3e(),nce({parent:t.parentElement}),...i,...e.colorScheme=="dark"?[M3e]:[],n,r]});return{set:o=>{s.dispatch({changes:{from:0,to:s.state.doc.length,insert:o}})},destroy:()=>{s.destroy()}}}var Q3e=G('
');function Dy(t,e){De(e,!0);let n=Ht(e,["$$slots","$$events","$$legacy"]),r;ki(()=>{let o=Br(()=>e.value)??"",a=N3e(r,{language:e.language??"plain",colorScheme:e.colorScheme??"light",initialText:Br(()=>e.value)??"",json:e.json,sql:e.sql,onChange:l=>{o=l,e.onChange?.(l)}});return An(()=>{e.value!=null&&e.value!=o&&(o=n.value,a.set(o))}),()=>{a.destroy()}});var i=Q3e(),s=M(i);lr(s,o=>r=o,()=>r),F(i),de(()=>Qt(i,1,sx(e.class??""))),I(t,i),Pe()}const HO={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/BuiltinChartSpec",definitions:{BuiltinChartSpec:{anyOf:[{$ref:"#/definitions/ChartSpec"},{$ref:"#/definitions/ContentViewerSpec"},{$ref:"#/definitions/CountPlotSpec"},{$ref:"#/definitions/EmbeddingSpec"},{$ref:"#/definitions/InstancesSpec"},{$ref:"#/definitions/MarkdownSpec"},{$ref:"#/definitions/PredicatesSpec"}]},ChartSpec:{type:"object",properties:{title:{type:"string",description:"The title of the chart"},plotSize:{type:"object",properties:{width:{type:"number",description:"Width of the plot area"},height:{type:"number",description:"Height of the plot area"},aspectRatio:{type:"number",description:"Aspect ratio of the plot area"}},additionalProperties:!1,description:"Size configuration"},layers:{type:"array",items:{$ref:"#/definitions/Layer"},description:"Layers"},scale:{type:"object",properties:{x:{$ref:"#/definitions/Scale"},y:{$ref:"#/definitions/Scale"},color:{$ref:"#/definitions/Scale"},size:{$ref:"#/definitions/Scale"}},additionalProperties:!1,description:"Scale configurations"},axis:{type:"object",properties:{x:{$ref:"#/definitions/Axis"},y:{$ref:"#/definitions/Axis"}},additionalProperties:!1,description:"Axis configurations"},selection:{type:"object",additionalProperties:{$ref:"#/definitions/Selection"},description:"Selections"},widgets:{type:"array",items:{$ref:"#/definitions/Widget"},description:"Widgets"}},additionalProperties:!1,description:"Chart specification"},Layer:{type:"object",properties:{from:{$ref:"#/definitions/SQLTable",description:"Data source, default to the main data table"},filter:{type:"string",const:"$filter",description:"Filter the data. Use $filter to refer to the shared filter (a cross-filter)"},mark:{$ref:"#/definitions/MarkType",description:"Mark type"},style:{$ref:"#/definitions/MarkStyle",description:"Mark style"},zIndex:{type:"number",description:"z-index indicating the layer order. Default value is 0. If the value is negative, the mark will be drawn below grid lines."},orientation:{type:"string",enum:["vertical","horizontal"],description:"Orientation of bar marks"},interpolate:{$ref:"#/definitions/Interpolate",description:"Interpolate method for line and area marks"},width:{$ref:"#/definitions/Dimension",description:"Width of bar / rect marks"},height:{$ref:"#/definitions/Dimension",description:"Height of bar / rect marks"},size:{type:"number",description:"Size (area) of point marks, default 100."},encoding:{type:"object",properties:{x:{$ref:"#/definitions/Encoding"},y:{$ref:"#/definitions/Encoding"},x1:{$ref:"#/definitions/Encoding"},x2:{$ref:"#/definitions/Encoding"},y1:{$ref:"#/definitions/Encoding"},y2:{$ref:"#/definitions/Encoding"},color:{$ref:"#/definitions/Encoding"},size:{$ref:"#/definitions/Encoding"},group:{$ref:"#/definitions/Encoding"}},additionalProperties:!1,description:"Encoding"}},required:["mark"],additionalProperties:!1},SQLTable:{anyOf:[{type:"string"},{type:"object",properties:{sql:{type:"string"}},required:["sql"],additionalProperties:!1}],description:"Table name or SQL expression that produces a table"},MarkType:{type:"string",enum:["bar","rect","line","area","point","rule"],description:"Mark type"},MarkStyle:{type:"object",properties:{fillColor:{type:["string","null"],description:"Fill color. If `null`, disable fill. Default is based on mark type."},fillOpacity:{type:"number",description:"Fill opacity"},strokeColor:{type:["string","null"],description:"Stroke color. If `null`, disable stroke. Default is based on mark type."},strokeWidth:{type:"number",description:"Stroke width"},strokeOpacity:{type:"number",description:"Stroke opacity"},strokeCap:{type:"string",enum:["butt","round","square"],description:"Stroke cap"},strokeJoin:{type:"string",enum:["round","miter","bevel"],description:"Stroke join"},paintOrder:{type:"string",enum:["fill stroke","stroke fill"],description:"Paint order, default is `fill stroke`, fill first, then stroke."},opacity:{type:"number",description:"Opacity"}},additionalProperties:!1,description:"Mark style"},Interpolate:{type:"string",enum:["linear","cardinal","catmull-rom","natural","monotone","basis","step","step-before","step-after"],description:"Interpolate method for line or area"},Dimension:{anyOf:[{type:"object",properties:{gap:{type:"number"},clampToRatio:{type:"number"}},required:["gap"],additionalProperties:!1},{type:"object",properties:{ratio:{type:"number"}},required:["ratio"],additionalProperties:!1},{type:"number"}],description:"Mark dimension for width and height"},Encoding:{anyOf:[{type:"object",properties:{field:{$ref:"#/definitions/SQLField",description:"The data field to encode"},bin:{type:"object",properties:{desiredCount:{type:"number",description:"Desired bin count"}},additionalProperties:!1}},required:["field"],additionalProperties:!1},{type:"object",properties:{aggregate:{anyOf:[{$ref:"#/definitions/AggregateFn"},{type:"object",properties:{sql:{type:"string"}},required:["sql"],additionalProperties:!1}],description:"Aggregate type"},field:{$ref:"#/definitions/SQLField",description:"The data field for the aggregate"},quantile:{type:"number",description:'For "quantile" aggregate, the quantile value (0-1)'},normalize:{type:"string",enum:["x","y"],description:"Normalize the value by x or y"}},required:["aggregate"],additionalProperties:!1},{type:"object",properties:{value:{$ref:"#/definitions/DataValue",description:"The data value to encode"}},required:["value"],additionalProperties:!1}],description:"Encoding"},SQLField:{anyOf:[{type:"string"},{type:"object",properties:{sql:{type:"string"}},required:["sql"],additionalProperties:!1}],description:"Field from the data table, can be a column name or a SQL expression"},AggregateFn:{type:"string",enum:["count","distinct","min","max","mean","average","median","stdev","stdevp","variance","variancep","sum","product","quantile","ecdf-value","ecdf-rank"]},DataValue:{anyOf:[{type:"string"},{type:"number"},{type:"array",items:{type:"number"},minItems:2,maxItems:2}],description:"Data value (a value in the data domain, which can be mapped to the visual domain through a scale)"},Scale:{type:"object",properties:{type:{$ref:"#/definitions/ScaleType",description:"Scale type for quantitative scales"},domain:{type:"array",items:{$ref:"#/definitions/DataValue"},description:"Scale domain"},specialValues:{type:"array",items:{type:"string"},description:"Special values. All represented as strings."},constant:{type:"number",description:"symlog constant."},range:{anyOf:[{type:"array",items:{type:["string","number"]}},{type:"string"}],description:"Scale range. Currently do not apply for x and y scales. For size scales, this should be [min, max] size. For nominal color scales, this should be a list of colors. For quantitative color scales, this should be a predefined interpolate scheme, or a list of colors to interpolate."}},additionalProperties:!1,description:"Scale"},ScaleType:{type:"string",enum:["linear","log","symlog","band"],description:"Scale type"},Axis:{type:"object",properties:{title:{type:"string",description:"Axis title"},values:{type:"array",items:{},description:"Values for ticks, grid lines, and labels"},desiredTickCount:{type:"number",description:"Desired number of ticks. Default 5."},extendScaleToTicks:{type:"boolean",description:"Extend scale to ticks. Default true."},labelPadding:{type:"number",description:"Padding to label"},labelFontFamily:{type:"string",description:"Label font family"},labelFontSize:{type:"number",description:"Label font size"},labelMaxWidth:{type:"number",description:"Label max width"}},additionalProperties:!1},Selection:{type:"object",properties:{encoding:{type:"string",enum:["x","y","xy"]}},required:["encoding"],additionalProperties:!1,description:"Chart selection"},Widget:{anyOf:[{type:"object",properties:{type:{type:"string",const:"scale.type"},channel:{$ref:"#/definitions/Channel"}},required:["type","channel"],additionalProperties:!1},{type:"object",properties:{type:{type:"string",const:"encoding.normalize"},layer:{anyOf:[{type:"number"},{type:"array",items:{type:"number"}}]},attribute:{$ref:"#/definitions/Attribute"},options:{type:"array",items:{type:"string",enum:["x","y"]}}},required:["type","layer","attribute","options"],additionalProperties:!1}],description:"Widget for editing a chart"},Channel:{type:"string",enum:["x","y","color","size"],description:"Encoding channel"},Attribute:{type:"string",enum:["x","y","x1","x2","y1","y2","color","size","group"],description:"Mark attribute"},ContentViewerSpec:{type:"object",properties:{type:{type:"string",const:"content-viewer"},title:{type:"string"},field:{type:"string"}},required:["type","field"],additionalProperties:!1},CountPlotSpec:{type:"object",properties:{type:{type:"string",const:"count-plot"},title:{type:"string"},data:{type:"object",properties:{field:{$ref:"#/definitions/SQLField",description:"The data field"},isList:{type:"boolean",description:"Indicate if the field contains list[str] data, default false"}},required:["field"],additionalProperties:!1},limit:{type:"number",description:"The max number of categories to show, default 10"},labels:{type:"string",enum:["%","#","#/#"],description:"Labeling method, '%': percentage, '#': count, '#/#': selected count over total count"},order:{anyOf:[{type:"string",const:"total-descending"},{type:"string",const:"total-ascending"},{type:"string",const:"selected-descending"},{type:"string",const:"selected-ascending"},{type:"string",const:"alphabetical"},{type:"array",items:{type:"string"}}],description:"Order the categories by total count, selected count, alphabetical, or custom order, default 'total-descending'"}},required:["type","data"],additionalProperties:!1},EmbeddingSpec:{type:"object",properties:{type:{type:"string",const:"embedding"},title:{type:"string"},data:{type:"object",properties:{x:{type:"string"},y:{type:"string"},text:{type:["string","null"]},category:{type:["string","null"]}},required:["x","y"],additionalProperties:!1},mode:{type:"string",enum:["points","density"]},minimumDensity:{type:"number"},pointSize:{type:"number"},downsampleMaxPoints:{type:["number","null"],description:"Maximum number of points to render (for downsampling). Default: 4000000. Set to null to disable."},config:{$ref:"#/definitions/EmbeddingViewConfig"}},required:["type","data"],additionalProperties:!1},EmbeddingViewConfig:{type:"object",properties:{colorScheme:{type:["string","null"],enum:["light","dark",null],description:"Color scheme."},mode:{type:["string","null"],enum:["points","density",null],description:"View mode."},minimumDensity:{type:["number","null"],description:"Minimum average density for density contours to show up. The density is measured as number of points per square points (aka., px in CSS units)."},pointSize:{type:["number","null"],description:"Override the automatically calculated point size. If not specified, point size is calculated based on density."},autoLabelEnabled:{type:["boolean","null"],description:"Generate labels automatically. By default labels are generated automatically if the `labels` prop is not specified, and a `text` column is specified in the Mosaic view, or a `queryClusterLabels` callback is specified in the non-Mosaic view. Set this to `false` to disable automatic labels."},autoLabelDensityThreshold:{type:["number","null"],description:"The density threshold to filter the clusters before generating automatic labels. The value is relative to the max density."},autoLabelStopWords:{anyOf:[{type:"array",items:{type:"string"}},{type:"null"}],description:"The stop words for automatic label generation. By default use NLTK stop words."},downsampleMaxPoints:{type:["number","null"],description:"Approximate maximum number of points to render when downsampling is active. Points are sampled with bias toward sparse regions (fewer points kept in dense areas). The sampling probability is given by this formula: P(i) = (downsampleMaxPoints / numPointsInViewport) * (2 / (1 + density(p_i) / maxDensity * downsampleDensityWeight)) Default: 4,000,000. Set to null or Infinity to disable downsampling."},downsampleDensityWeight:{type:["number","null"],description:"Density weight for downsampling (0-10). Higher values mean more aggressive culling in dense areas. Default: 5"}},additionalProperties:!1},InstancesSpec:{type:"object",properties:{type:{type:"string",const:"instances"},title:{type:"string"},columns:{type:"array",items:{type:"string"},description:"Columns to show in the instance view. If specified, the table and card views will be limited to the given columns, and custom card template will only receive the given columns as data. If not specified, include all columns from the dataset (or query result is `query` is specified)."},sort:{$ref:"#/definitions/SortOrder",description:"Sort order. If not specified, use original data order."},viewMode:{type:"string",enum:["table","cards"],description:'View mode, defaults to "table"'},query:{type:"string",description:"Optional custom SQL query to filter or transform the data"},pageSize:{type:"number",description:"Number of items per page, defaults to 100"},defaultHeight:{type:"number",description:"Default height in pixels, defaults to 500. This value is used when the view's height is flexible."},columnStyles:{type:"object",additionalProperties:{$ref:"#/definitions/ColumnStyle"},description:"Column styles specific to this instance view. These will override global column styles."},cardTemplate:{type:"string",description:"Liquid template for the cards (rendered with liquidjs). Use a Liquid template instead of column styles for custom cards. If not specified, use the tooltip view as card."}},required:["type"],additionalProperties:!1},SortOrder:{type:"array",items:{type:"object",properties:{column:{type:"string"},direction:{type:"string",enum:["ascending","descending"]}},required:["column","direction"],additionalProperties:!1}},ColumnStyle:{type:"object",properties:{renderer:{type:"string",description:`The renderer name. Builtin options: - "markdown": Render the value as Markdown - "liquid-template": Render the value with a Liquid template (rendered with liquidjs). Options: template (string): the template, default to "{{ value }}". - "image": Render an image. Options: size (number): the max width/height of the image. - "url": Render the value as a link - "json": Render the value as a JSON string - "messages": Render chat messages (OpenAI format)`},options:{type:"object",description:"Options passed to the renderer class as props"},display:{type:"string",enum:["full","badge","hidden"],description:"Display style in the tooltip"}},additionalProperties:!1,description:"A type describing how to display a column in the table, tooltip, and search results"},MarkdownSpec:{type:"object",properties:{type:{type:"string",const:"markdown"},title:{type:"string"},content:{type:"string"}},required:["type","content"],additionalProperties:!1},PredicatesSpec:{type:"object",properties:{type:{type:"string",const:"predicates"},title:{type:"string"},items:{type:"array",items:{type:"object",properties:{name:{type:"string"},predicate:{type:"string"}},required:["name","predicate"],additionalProperties:!1}}},required:["type"],additionalProperties:!1}}},B3e={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/BuiltinChartState",definitions:{BuiltinChartState:{anyOf:[{$ref:"#/definitions/ChartState"},{$ref:"#/definitions/EmbeddingState"},{$ref:"#/definitions/CountPlotState"},{$ref:"#/definitions/PredicatesState"}]},ChartState:{type:"object",additionalProperties:{type:"object",properties:{x:{$ref:"#/definitions/XYSelectionValue",description:"The x value for the selection."},y:{$ref:"#/definitions/XYSelectionValue",description:"The y value for the selection."}},additionalProperties:!1},description:"Chart state. A dictionary mapping selection keys to selection states."},XYSelectionValue:{anyOf:[{type:"string"},{type:"array",items:{type:"number"},minItems:2,maxItems:2}]},EmbeddingState:{type:"object",properties:{viewport:{$ref:"#/definitions/ViewportState",description:"The viewport state"},legend:{type:"object",properties:{selection:{type:"array",items:{type:"string"},description:"Selected categories"}},additionalProperties:!1,description:"State of the legend"},brush:{anyOf:[{$ref:"#/definitions/Rectangle"},{type:"array",items:{$ref:"#/definitions/Point"}}],description:"State of the brush selection. Can be a rectangle or a list of points for a lasso selection. Coordinates should be in data units."}},additionalProperties:!1},ViewportState:{type:"object",properties:{x:{type:"number",description:"The x coordinate of the center of the viewport in data units."},y:{type:"number",description:"The y coordinate of the center of the viewport in data units."},scale:{type:"number",description:"The scale of the viewport. This scales data units to [-1, 1]."}},required:["x","y","scale"],additionalProperties:!1,description:"A state describing the viewport's pan and zoom state. The screen coordinate of a point is calculated as follows: px = ((x - viewport.x) * viewport.scale + 1) / 2 * width py = ((y - viewport.y) * viewport.scale + 1) / 2 * height"},Rectangle:{type:"object",properties:{xMin:{type:"number"},yMin:{type:"number"},xMax:{type:"number"},yMax:{type:"number"}},required:["xMin","yMin","xMax","yMax"],additionalProperties:!1,description:"A rectangle with min, max coordinate for each dimension. It is required that xMin <= xMax and yMin <= yMax."},Point:{type:"object",properties:{x:{type:"number"},y:{type:"number"}},required:["x","y"],additionalProperties:!1,description:"A point with x and y coordinates."},CountPlotState:{type:"object",properties:{selection:{type:"array",items:{type:"string"},description:"List of selected categories"}},additionalProperties:!1},PredicatesState:{type:"object",properties:{selection:{type:"array",items:{type:"string"},description:"List of selected predicates. Values in this list should be the exact predicates."}},additionalProperties:!1}}},z3e={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/DashboardLayoutState",definitions:{DashboardLayoutState:{type:"object",properties:{numColumns:{type:"number",description:"The number of columns in the dashboard grid, default is 24"},numRows:{type:"number",description:"The number of rows in the dashboard grid, default is 16"},grids:{type:"object",additionalProperties:{type:"object",properties:{placements:{type:"object",additionalProperties:{$ref:"#/definitions/Placement"},description:"Placements of charts, keyed by chart ids, value is a Placement struct."},order:{type:"array",items:{type:"string"},description:"Order of the charts, affects overlapping charts."}},additionalProperties:!1},description:'The grid, keyed by `${numColumns}x${numRows}`, e.g., "24x16". Charts can be placed in additional rows, but the user would need to scroll down to view them.'}},additionalProperties:!1},Placement:{type:"object",properties:{x:{type:"number",description:"Start x location (in grid index) of the chart"},y:{type:"number",description:"Start y location (in grid index) of the chart"},width:{type:"number",description:"Width (in grid cell count) of the chart"},height:{type:"number",description:"Height (in grid cell count) of the chart"}},required:["x","y","width","height"],additionalProperties:!1}}},U3e={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/ListLayoutState",definitions:{ListLayoutState:{type:"object",properties:{showTable:{type:"boolean"},showEmbedding:{type:"boolean"},showCharts:{type:"boolean"},chartsOrder:{type:"array",items:{type:"string"}},chartVisibility:{type:"object",additionalProperties:{type:"boolean"}},placements:{type:"object",additionalProperties:{$ref:"#/definitions/Section"}}},additionalProperties:!1},Section:{type:"string",enum:["embedding","table","chart"]}}},j3e={$schema:"http://json-schema.org/draft-07/schema#",$ref:"#/definitions/ColumnStyle",definitions:{ColumnStyle:{type:"object",properties:{renderer:{type:"string",description:`The renderer name. Builtin options: - "markdown": Render the value as Markdown - "liquid-template": Render the value with a Liquid template (rendered with liquidjs). Options: template (string): the template, default to "{{ value }}". - "image": Render an image. Options: size (number): the max width/height of the image. - "url": Render the value as a link - "json": Render the value as a JSON string - "messages": Render chat messages (OpenAI format)`},options:{type:"object",description:"Options passed to the renderer class as props"},display:{type:"string",enum:["full","badge","hidden"],description:"Display style in the tooltip"}},additionalProperties:!1,description:"A type describing how to display a column in the table, tooltip, and search results"}}};function KE(t,e){De(e,!0);let n=Jp.stringify(e.initialValue,{space:2,quote:'"'});function r(i){try{return JSON.parse(JSON.stringify(Jp.parse(i)))}catch{return}}{let i=L(()=>({schema:HO}));Dy(t,{get class(){return e.class},get colorScheme(){return e.colorScheme},language:"json5",get json(){return b(i)},get value(){return n},onChange:s=>{let o=r(s);o?e.onChange?.(o):e.onChange?.(void 0)}})}Pe()}var q3e=G(' '),V3e=G("");function Cc(t,e){De(e,!0);let n=Xe(e,"label",3,null),r=Xe(e,"icon",3,null),i=Xe(e,"title",3,""),s=Xe(e,"order",3,null);var o=V3e();o.__click=()=>{e.onClick?.()};let a;var l=M(o);{var u=h=>{const d=L(r);var p=ot(),m=ke(p);Bu(m,()=>b(d),(g,y)=>{y(g,{class:"w-4 h-4"})}),I(h,p)};oe(l,h=>{r()!=null&&h(u)})}var c=V(l,2);{var f=h=>{var d=q3e(),p=M(d,!0);F(d),de(()=>ut(p,n())),I(h,d)};oe(c,h=>{n()!=null&&n()!=""&&h(f)})}F(o),de(()=>{Qt(o,1,`rounded-md flex select-none items-center px-1 py-1 text-slate-500 bg-slate-100 dark:text-slate-400 dark:bg-slate-800 focus-visible:outline-2 outline-blue-600 -outline-offset-1 ${e.class??""??""}`),ne(o,"title",i()),a=Ve(o,"",a,{order:s()})}),I(t,o),Pe()}dn(["click"]);var Z3e=ft('');function GX(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=Z3e();Dn(r,()=>({viewBox:"0 0 16 16",width:"1.2em",height:"1.2em",...n})),I(t,r)}var X3e=ft('');function W3e(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=X3e();Dn(r,()=>({viewBox:"0 0 16 16",width:"1.2em",height:"1.2em",...n})),I(t,r)}var Y3e=ft('');function G3e(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=Y3e();Dn(r,()=>({viewBox:"0 0 20 20",width:"1.2em",height:"1.2em",...n})),I(t,r)}var H3e=ft('');function HX(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=H3e();Dn(r,()=>({viewBox:"0 0 20 20",width:"1.2em",height:"1.2em",...n})),I(t,r)}var K3e=ft('');function KX(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=K3e();Dn(r,()=>({viewBox:"0 0 20 20",width:"1.2em",height:"1.2em",...n})),I(t,r)}var J3e=ft('');function eke(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=J3e();Dn(r,()=>({viewBox:"0 0 20 20",width:"1.2em",height:"1.2em",...n})),I(t,r)}var tke=ft('');function JE(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=tke();Dn(r,()=>({viewBox:"0 0 16 16",width:"1.2em",height:"1.2em",...n})),I(t,r)}var nke=ft('');function sI(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=nke();Dn(r,()=>({viewBox:"0 0 16 16",width:"1.2em",height:"1.2em",...n})),I(t,r)}var rke=ft('');function ike(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=rke();Dn(r,()=>({viewBox:"0 0 16 16",width:"1.2em",height:"1.2em",...n})),I(t,r)}var ske=ft('');function F4(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=ske();Dn(r,()=>({viewBox:"0 0 16 16",width:"1.2em",height:"1.2em",...n})),I(t,r)}var oke=ft('');function oI(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=oke();Dn(r,()=>({viewBox:"0 0 16 16",width:"1.2em",height:"1.2em",...n})),I(t,r)}var ake=ft('');function lke(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=ake();Dn(r,()=>({viewBox:"0 0 20 20",width:"1.2em",height:"1.2em",...n})),I(t,r)}var uke=ft('');function sd(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=uke();Dn(r,()=>({viewBox:"0 0 16 16",width:"1.2em",height:"1.2em",...n})),I(t,r)}var cke=ft('');function L3(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=cke();Dn(r,()=>({viewBox:"0 0 16 16",width:"1.2em",height:"1.2em",...n})),I(t,r)}var fke=ft('');function e8(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=fke();Dn(r,()=>({viewBox:"0 0 16 16",width:"1.2em",height:"1.2em",...n})),I(t,r)}var hke=ft('');function JX(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=hke();Dn(r,()=>({viewBox:"0 0 16 16",width:"1.2em",height:"1.2em",...n})),I(t,r)}var dke=ft('');function pke(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=dke();Dn(r,()=>({viewBox:"0 0 20 20",width:"1.2em",height:"1.2em",...n})),I(t,r)}var mke=ft('');function gke(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=mke();Dn(r,()=>({viewBox:"0 0 20 20",width:"1.2em",height:"1.2em",...n})),I(t,r)}var yke=ft('');function bke(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=yke();Dn(r,()=>({viewBox:"0 0 20 20",width:"1.2em",height:"1.2em",...n})),I(t,r)}var Oke=ft('');function vke(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=Oke();Dn(r,()=>({viewBox:"0 0 20 20",width:"1.2em",height:"1.2em",...n})),I(t,r)}var wke=ft('');function xke(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=wke();Dn(r,()=>({viewBox:"0 0 20 20",width:"1.2em",height:"1.2em",...n})),I(t,r)}var _ke=ft('');function Ske(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=_ke();Dn(r,()=>({viewBox:"0 0 20 20",width:"1.2em",height:"1.2em",...n})),I(t,r)}var kke=ft('');function Cke(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=kke();Dn(r,()=>({viewBox:"0 0 16 16",width:"1.2em",height:"1.2em",...n})),I(t,r)}var Ake=ft('');function t8(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=Ake();Dn(r,()=>({viewBox:"0 0 16 16",width:"1.2em",height:"1.2em",...n})),I(t,r)}var Eke=ft('');function Tke(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=Eke();Dn(r,()=>({viewBox:"0 0 16 16",width:"1.2em",height:"1.2em",...n})),I(t,r)}var Dke=ft('');function Pke(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=Dke();Dn(r,()=>({viewBox:"0 0 16 16",width:"1.2em",height:"1.2em",...n})),I(t,r)}var Rke=ft('');function n8(t,e){const n=Ht(e,["$$slots","$$events","$$legacy"]);var r=Rke();Dn(r,()=>({viewBox:"0 0 24 24",width:"1.2em",height:"1.2em",...n})),I(t,r)}function Ike(t){let e="";for(let n=0;nn.charCodeAt(0)))}function Cd(t,e){if(t.length
');function KO(t,e){De(e,!0);let n=Xe(e,"value",15,0),r=Xe(e,"min",3,0),i=Xe(e,"max",3,100),s=Xe(e,"step",3,void 0),o=Xe(e,"width",3,100),a=15,l=L(()=>x=>(x-r())/(i()-r())*(o()-a)),u=L(()=>x=>x/(o()-a)*(i()-r())+r()),c=L(()=>b(l)(n())),f=pe(void 0);function h(x){let S=b(u)(x-a/2);S=Math.max(r(),Math.min(i(),S)),s()!=null&&(S=Math.round(S/s())*s()),n(S)}function d(x){h(x.clientX-b(f).getBoundingClientRect().left);let S=k=>{h(k.clientX-b(f).getBoundingClientRect().left)},_=()=>{window.removeEventListener("mousemove",S),window.removeEventListener("mouseup",_)};window.addEventListener("mousemove",S),window.addEventListener("mouseup",_)}function p(x){x.key=="ArrowLeft"?n(Math.max(n()-(s()??1),r())):x.key=="ArrowRight"&&n(Math.min(n()+(s()??1),i()))}var m=$ke();m.__mousedown=d,m.__keydown=p;let g;var y=M(m);let O;var v=V(y,2);let w;F(m),lr(m,x=>X(f,x),()=>b(f)),de(()=>{ne(m,"aria-valuenow",n()),ne(m,"aria-valuemin",r()),ne(m,"aria-valuemax",i()),g=Ve(m,"",g,{width:`${o()??""}px`,height:"28px"}),O=Ve(y,"",O,{left:"0px",top:"12px",width:`${o()??""}px`,height:"4px"}),w=Ve(v,"",w,{left:`${b(c)??""}px`,top:"6.5px",width:"15px",height:"15px"})}),I(t,m),Pe()}dn(["mousedown","keydown"]);var Mke=G('
Size
');function Lke(t,e){var n=Mke(),r=V(M(n),2),i=()=>e.options?.size??100,s=o=>{e.onChange?.({size:o})};KO(r,{get value(){return i()},set value(o){s(o)},width:80,min:16,max:400,step:1}),F(n),I(t,n)}function Nke(t,e){De(e,!0);{let n=L(()=>e.options?.template??"");Dy(t,{class:"w-96 h-64 bg-white dark:bg-black rounded-md",get value(){return b(n)},onChange:r=>{e.onChange?.({template:r})}})}Pe()}class Bo{constructor(e,n,r,i,s){this.kind=e,this.input=n,this.begin=r,this.end=i,this.file=s}getText(){return this.input.slice(this.begin,this.end)}getPosition(){let[e,n]=[1,1];for(let r=0;rMe(e)).join(""):String(t)}function Py(t){return t=Nt(t),ci(t)?t:Ct(t)&&t.length>0?[t]:jke(t)?Array.from(t):d_(t)?Object.keys(t).map(e=>[e,t[e]]):[]}function ui(t){return t=Nt(t),$o(t)?[]:ci(t)?t:[t]}function Nt(t){return t instanceof od&&Qr(t.valueOf)?t.valueOf():t}function $4(t){return+Nt(t)||0}function h_(t){return typeof t=="number"}function tW(t){return t&&Qr(t.toLiquid)?tW(t.toLiquid()):t}function $o(t){return t==null}function Uke(t){return t===void 0}function ci(t){return Qke.call(t)==="[object Array]"}function nW(t){return t&&h_(t.length)}function jke(t){return d_(t)&&Symbol.iterator in t}function uI(t,e){t=t||{};for(const n in t)if(r8.call(t,n)&&e(t[n],n,t)===!1)break;return t}function rW(t){return t[t.length-1]}function d_(t){const e=typeof t;return t!==null&&(e==="object"||e==="function")}function iW(t,e,n=1){const r=[];for(let i=t;ii+r)}function qke(t,e,n=" "){return sW(t,e,n,(r,i)=>r+i)}function sW(t,e,n,r){t=String(t);let i=e-t.length;for(;i-- >0;)t=r(t,n);return t}function oW(t){return t}function Vke(t){return[...t].some(n=>n>="a"&&n<="z")?t.toUpperCase():t.toLowerCase()}function Zke(t,e){return t.length>e?t.slice(0,e-3)+"...":t}function cI(t,e){return t==null&&e==null?0:t==null?1:e==null||(t=lI.call(t),e=lI.call(e),te?1:0}function p_(t){return function(...e){return t.call(this,...e.map(Nt))}}function zl(t){return function(...e){return t.call(this,...e.map($4))}}function i8(t){return t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}function*Ub(t){const e=new Set;for(const n of t){const r=JSON.stringify(n);e.has(r)||(e.add(r),yield n)}}const fI="__liquidClass__";class ad extends Error{constructor(e,n){super(typeof e=="string"?e:e.message),this.context="",typeof e!="string"&&Object.defineProperty(this,"originalError",{value:e,enumerable:!1}),Object.defineProperty(this,"token",{value:n,enumerable:!1}),Object.defineProperty(this,fI,{value:"LiquidError",enumerable:!1})}update(){Object.defineProperty(this,"context",{value:Jke(this.token),enumerable:!1}),this.message=e5e(this.message,this.token),this.stack=this.message+` `+this.context+` `+this.stack,this.originalError&&(this.stack+=` From `+this.originalError.stack)}static is(e){return e?.[fI]==="LiquidError"}}class Xke extends ad{constructor(e,n){super(e,n),this.name="TokenizationError",super.update()}}class Wke extends ad{constructor(e,n){super(e,n),this.name="ParseError",this.message=e.message,super.update()}}class Yke extends ad{constructor(e,n){super(e,n.token),this.name="RenderError",this.message=e.message,super.update()}static is(e){return e.name==="RenderError"}}class aW extends ad{constructor(e){super(e[0],e[0].token),this.errors=e,this.name="LiquidErrors";const n=e.length>1?"s":"";this.message=`${e.length} error${n} found`,super.update()}static is(e){return e.name==="LiquidErrors"}}class Gke extends ad{constructor(e,n){super(e,n),this.name="UndefinedVariableError",this.message=e.message,super.update()}}class Hke extends Error{constructor(e){super(`undefined variable: ${e}`),this.name="InternalUndefinedVariableError",this.variableName=e}}class Kke extends Error{constructor(e){super(e),this.name="AssertionError",this.message=e+""}}function Jke(t){const[e,n]=t.getPosition(),r=t.input.split(` `),i=Math.max(e-2,1),s=Math.min(e+3,r.length);return iW(i,s+1).map(a=>{const l=a===e?">> ":" ",u=B1(String(a),String(s).length);let c=`${l}${u}| `;const f=a===e?` `+B1("^",n+c.length):"";return c+=r[a-1],c+=f,c}).join(` `)}function e5e(t,e){e.file&&(t+=`, file:${e.file}`);const[n,r]=e.getPosition();return t+=`, line:${n}, col:${r}`,t}const On=[0,0,0,0,0,0,0,0,0,20,4,4,4,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,2,8,0,0,0,0,8,0,0,0,64,0,65,0,0,33,33,33,33,33,33,33,33,33,33,0,0,2,2,2,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0],t5e=1,y0=4,hI=8,lW=16,n5e=32,r5e=64,i5e=128;function JO(t){const e=t.charCodeAt(0);return e>=128?!On[e]:!!(On[e]&t5e)}On[160]=On[5760]=On[6158]=On[8192]=On[8193]=On[8194]=On[8195]=On[8196]=On[8197]=On[8198]=On[8199]=On[8200]=On[8201]=On[8202]=On[8232]=On[8233]=On[8239]=On[8287]=On[12288]=y0;On[8220]=On[8221]=i5e;function Ti(t,e){if(!t){const n=typeof e=="function"?e():e||`expect ${t} to be true`;throw new Kke(n)}}function cw(t,e=`unexpected ${JSON.stringify(t)}`){Ti(!t,e)}class s5e extends od{equals(e){return $o(Nt(e))}gt(){return!1}geq(){return!1}lt(){return!1}leq(){return!1}valueOf(){return null}}class b0 extends od{equals(e){return e instanceof b0?!1:(e=Nt(e),Ct(e)||ci(e)?e.length===0:d_(e)?Object.keys(e).length===0:!1)}gt(){return!1}geq(){return!1}lt(){return!1}leq(){return!1}valueOf(){return""}static is(e){return e instanceof b0}}class s8 extends b0{equals(e){return e===!1||$o(Nt(e))?!0:Ct(e)?/^\s*$/.test(e):super.equals(e)}static is(e){return e instanceof s8}}class o8 extends od{constructor(e,n,r){super(),this.i=0,this.length=e,this.name=`${r}-${n}`}next(){this.i++}index0(){return this.i}index(){return this.i+1}first(){return this.i===0}last(){return this.i===this.length-1}rindex(){return this.length-this.i}rindex0(){return this.length-this.i-1}valueOf(){return JSON.stringify(this)}}class uW{constructor(){this.buffer=""}write(e){this.buffer+=Me(e)}}class o5e{constructor(){throw this.buffer="",this.stream=null,new Error("streaming not supported in browser")}}class a5e{constructor(){this.buffer=""}write(e){e=Nt(e),typeof e!="string"&&this.buffer===""?this.buffer=e:this.buffer=Me(this.buffer)+Me(e)}}class dI extends od{constructor(e=()=>""){super(),this.superBlockRender=e}*super(){const e=new uW;return yield this.superBlockRender(e),e.buffer}}function Ba(t){return t&&Qr(t.equals)&&Qr(t.gt)&&Qr(t.geq)&&Qr(t.lt)&&Qr(t.leq)}const pI=new s5e,cW={true:!0,false:!1,nil:pI,null:pI,empty:new b0,blank:new s8};function mI(t){const e={};for(const[n,r]of Object.entries(t)){let i=e;for(let s=0;s0?"-":"+")+B1(r,2,"0")+(e.flags[":"]?":":"")+B1(i,2,"0")}const M4={a:t=>t.getShortWeekdayName(),A:t=>t.getLongWeekdayName(),b:t=>t.getShortMonthName(),B:t=>t.getLongMonthName(),c:t=>t.toLocaleString(),C:t=>h5e(t),d:t=>t.getDate(),e:t=>t.getDate(),H:t=>t.getHours(),I:t=>String(t.getHours()%12||12),j:t=>fW(t),k:t=>t.getHours(),l:t=>String(t.getHours()%12||12),L:t=>t.getMilliseconds(),m:t=>t.getMonth()+1,M:t=>t.getMinutes(),N:(t,e)=>{const n=Number(e.width)||9,r=String(t.getMilliseconds()).slice(0,n);return qke(r,n,"0")},p:t=>t.getHours()<12?"AM":"PM",P:t=>t.getHours()<12?"am":"pm",q:t=>f5e(t),s:t=>Math.round(t.getTime()/1e3),S:t=>t.getSeconds(),u:t=>t.getDay()||7,U:t=>gI(t,0),w:t=>t.getDay(),W:t=>gI(t,1),x:t=>t.toLocaleDateString(),X:t=>t.toLocaleTimeString(),y:t=>t.getFullYear().toString().slice(2,4),Y:t=>t.getFullYear(),z:yI,Z:(t,e)=>t.getTimeZoneName()||yI(t,e),t:()=>" ",n:()=>` `,"%":()=>"%"};M4.h=M4.b;function ev(t,e){let n="",r=e,i;for(;i=l5e.exec(r);)n+=r.slice(0,i.index),r=r.slice(i.index+i[0].length),n+=m5e(t,i);return n+r}function m5e(t,e){const[n,r="",i,s,o]=e,a=M4[o];if(!a)return n;const l={};for(const h of r)l[h]=!0;let u=String(a(t,{flags:l,width:i,modifier:s})),c=p5e.has(o)?" ":"0",f=i||d5e[o]||0;return l["^"]?u=u.toUpperCase():l["#"]&&(u=Vke(u)),l._?c=" ":l[0]&&(c="0"),l["-"]&&(f=0),B1(u,f,c)}function hW(){return typeof Intl<"u"?Intl.DateTimeFormat:void 0}const g5e=6e4,y5e=/([zZ]|([+-])(\d{2}):?(\d{2}))$/,dW=["January","February","March","April","May","June","July","August","September","October","November","December"],b5e=dW.map(t=>t.slice(0,3)),pW=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],O5e=pW.map(t=>t.slice(0,3));class Ho{constructor(e,n,r){this.locale=n,this.DateTimeFormat=hW(),this.date=new Date(e),this.timezoneFixed=r!==void 0,r===void 0&&(r=this.date.getTimezoneOffset()),this.timezoneOffset=Ct(r)?Ho.getTimezoneOffset(r,this.date):r,this.timezoneName=Ct(r)?r:"";const i=(this.date.getTimezoneOffset()-this.timezoneOffset)*g5e,s=this.date.getTime()+i;this.displayDate=new Date(s)}getTime(){return this.displayDate.getTime()}getMilliseconds(){return this.displayDate.getMilliseconds()}getSeconds(){return this.displayDate.getSeconds()}getMinutes(){return this.displayDate.getMinutes()}getHours(){return this.displayDate.getHours()}getDay(){return this.displayDate.getDay()}getDate(){return this.displayDate.getDate()}getMonth(){return this.displayDate.getMonth()}getFullYear(){return this.displayDate.getFullYear()}toLocaleString(e,n){return n?.timeZone?this.date.toLocaleString(e,n):this.displayDate.toLocaleString(e,n)}toLocaleTimeString(e){return this.displayDate.toLocaleTimeString(e)}toLocaleDateString(e){return this.displayDate.toLocaleDateString(e)}getTimezoneOffset(){return this.timezoneOffset}getTimeZoneName(){if(this.timezoneFixed)return this.timezoneName;if(this.DateTimeFormat)return this.DateTimeFormat().resolvedOptions().timeZone}getLongMonthName(){var e;return(e=this.format({month:"long"}))!==null&&e!==void 0?e:dW[this.getMonth()]}getShortMonthName(){var e;return(e=this.format({month:"short"}))!==null&&e!==void 0?e:b5e[this.getMonth()]}getLongWeekdayName(){var e;return(e=this.format({weekday:"long"}))!==null&&e!==void 0?e:pW[this.displayDate.getDay()]}getShortWeekdayName(){var e;return(e=this.format({weekday:"short"}))!==null&&e!==void 0?e:O5e[this.displayDate.getDay()]}valid(){return!isNaN(this.getTime())}format(e){return this.DateTimeFormat&&this.DateTimeFormat(this.locale,e).format(this.displayDate)}static createDateFixedToTimezone(e,n){const r=e.match(y5e);if(r&&r[1]==="Z")return new Ho(+new Date(e),n,0);if(r&&r[2]&&r[3]&&r[4]){const[,,i,s,o]=r,a=(i==="+"?-1:1)*(parseInt(s,10)*60+parseInt(o,10));return new Ho(+new Date(e),n,a)}return new Ho(e,n)}static getTimezoneOffset(e,n){const r=n.toLocaleString("en-US",{timeZone:e}),i=n.toLocaleString("en-US",{timeZone:"UTC"}),s=new Date(r);return(+new Date(i)-+s)/(60*1e3)}}class L4{constructor(e,n){this.base=0,this.message=`${e} limit exceeded`,this.limit=n}use(e){e=+e||0,Ti(this.base+e<=this.limit,this.message),this.base+=e}check(e){e=+e||0,Ti(e<=this.limit,this.message)}}class a8 extends Bo{constructor(e,[n,r],i,s,o,a,l,u){super(e,i,s,o,u),this.trimLeft=!1,this.trimRight=!1;const c=i[n]==="-",f=i[r-1]==="-";let h=c?n+1:n,d=f?r-1:r;for(;hh&&On[i.charCodeAt(d-1)]&y0;)d--;this.contentRange=[h,d],this.trimLeft=c||a,this.trimRight=f||l}get content(){return this.input.slice(this.contentRange[0],this.contentRange[1])}}class bI extends a8{constructor(e,n,r,i,s){const{trimTagLeft:o,trimTagRight:a,tagDelimiterLeft:l,tagDelimiterRight:u}=i,[c,f]=[n+l.length,r-u.length];super(Qn.Tag,[c,f],e,n,r,o,a,s),this.tokenizer=new Al(e,i.operators,s,this.contentRange),this.name=this.tokenizer.readTagName(),this.tokenizer.assert(this.name,"illegal tag syntax, tag name expected"),this.tokenizer.skipBlank(),this.args=this.tokenizer.input.slice(this.tokenizer.p,this.contentRange[1])}}class v5e extends a8{constructor(e,n,r,i,s){const{trimOutputLeft:o,trimOutputRight:a,outputDelimiterLeft:l,outputDelimiterRight:u}=i,c=[n+l.length,r-u.length];super(Qn.Output,c,e,n,r,o,a,s)}}class OI extends Bo{constructor(e,n,r,i){super(Qn.HTML,e,n,r,i),this.input=e,this.begin=n,this.end=r,this.file=i,this.trimLeft=0,this.trimRight=0}getContent(){return this.input.slice(this.begin+this.trimLeft,this.end-this.trimRight)}}class w5e extends Bo{constructor(e,n,r,i){super(Qn.Number,e,n,r,i),this.input=e,this.begin=n,this.end=r,this.file=i,this.content=Number(this.getText())}}class N3 extends Bo{constructor(e,n,r,i){super(Qn.Word,e,n,r,i),this.input=e,this.begin=n,this.end=r,this.file=i,this.content=this.getText()}}class x5e extends Bo{constructor(e,n,r,i){super(Qn.Literal,e,n,r,i),this.input=e,this.begin=n,this.end=r,this.file=i,this.literal=this.getText(),this.content=cW[this.literal]}}const vI={"==":2,"!=":2,">":2,"<":2,">=":2,"<=":2,contains:2,not:1,and:0,or:0},_5e={"==":0,"!=":0,">":0,"<":0,">=":0,"<=":0,contains:0,not:1,and:0,or:0};class S5e extends Bo{constructor(e,n,r,i){super(Qn.Operator,e,n,r,i),this.input=e,this.begin=n,this.end=r,this.file=i,this.operator=this.getText()}getPrecedence(){const e=this.getText();return e in vI?vI[e]:1}}class wI extends Bo{constructor(e,n,r,i,s,o){super(Qn.PropertyAccess,r,i,s,o),this.variable=e,this.props=n}}class mW extends Bo{constructor(e,n,r,i,s,o){super(Qn.Filter,r,i,s,o),this.name=e,this.args=n}}class k5e extends Bo{constructor(e,n,r,i,s,o){super(Qn.Hash,e,n,r,o),this.input=e,this.begin=n,this.end=r,this.name=i,this.value=s,this.file=o}}const C5e=/[\da-fA-F]/,xI=/[0-7]/,_I={b:"\b",f:"\f",n:` `,r:"\r",t:" ",v:"\v"};function SI(t){const e=t.charCodeAt(0);return e>=97?e-87:e>=65?e-55:e-48}function A5e(t){let e="";for(let n=1;nDate.now()};function gW(){return typeof global=="object"&&global.performance||typeof window=="object"&&window.performance||R5e}class I5e{renderTemplatesToNodeStream(e,n){const r=new o5e;return Promise.resolve().then(()=>bu(this.renderTemplates(e,n,r))).then(()=>r.end(),i=>r.error(i)),r.stream}*renderTemplates(e,n,r){r||(r=n.opts.keepOutputType?new a5e:new uW);const i=[];for(const s of e){n.renderLimit.check(gW().now());try{const o=yield s.render(n,r);if(o&&r.write(o),n.breakCalled||n.continueCalled)break}catch(o){const a=ad.is(o)?o:new Yke(o,s);if(n.opts.catchAllErrors)i.push(a);else throw a}}if(i.length)throw new aW(i);return r.buffer}}class F5e{constructor(e){this.postfix=[...N5e(e)]}*evaluate(e,n){Ti(e,"unable to evaluate: context not defined");const r=[];for(const i of this.postfix)if(_W(i)){const s=r.pop();let o;if(_5e[i.operator]===1)o=yield e.opts.operators[i.operator](s,e);else{const a=r.pop();o=yield e.opts.operators[i.operator](a,s,e)}r.push(o)}else r.push(yield Dr(i,e,n));return r[0]}valid(){return!!this.postfix.length}}function*Dr(t,e,n=!1){if(t){if("content"in t)return t.content;if(dw(t))return yield $5e(t,e,n);if(SW(t))return yield L5e(t,e)}}function*$5e(t,e,n){const r=[];for(const i of t.props)r.push(yield Dr(i,e,!1));try{if(t.variable){const i=yield Dr(t.variable,e,n);return yield e._getFromScope(i,r)}else return yield e._get(r)}catch(i){if(n&&i.name==="InternalUndefinedVariableError")return null;throw new Gke(i,t)}}function M5e(t){return t.content}function*L5e(t,e){const n=yield Dr(t.lhs,e),r=yield Dr(t.rhs,e);return e.memoryLimit.use(r-n+1),iW(+n,+r+1)}function*N5e(t){const e=[];for(const n of t)if(_W(n)){for(;e.length&&e[e.length-1].getPrecedence()>n.getPrecedence();)yield e.pop();e.push(n)}else yield n;for(;e.length;)yield e.pop()}function ih(t,e){return!m_(t,e)}function m_(t,e){return t=Nt(t),e.opts.jsTruthy?!t:t===!1||t===void 0||t===null}const Q5e={"==":Fu,"!=":(t,e)=>!Fu(t,e),">":(t,e)=>Ba(t)?t.gt(e):Ba(e)?e.lt(t):Nt(t)>Nt(e),"<":(t,e)=>Ba(t)?t.lt(e):Ba(e)?e.gt(t):Nt(t)=":(t,e)=>Ba(t)?t.geq(e):Ba(e)?e.leq(t):Nt(t)>=Nt(e),"<=":(t,e)=>Ba(t)?t.leq(e):Ba(e)?e.geq(t):Nt(t)<=Nt(e),contains:(t,e)=>(t=Nt(t),ci(t)?t.some(n=>Fu(n,e)):Qr(t?.indexOf)?t.indexOf(Nt(e))>-1:!1),not:(t,e)=>m_(Nt(t),e),and:(t,e,n)=>ih(Nt(t),n)&&ih(Nt(e),n),or:(t,e,n)=>ih(Nt(t),n)||ih(Nt(e),n)};function Fu(t,e){return Ba(t)?t.equals(e):Ba(e)?e.equals(t):(t=Nt(t),e=Nt(e),ci(t)?ci(e)&&B5e(t,e):t===e)}function B5e(t,e){return t.length!==e.length?!1:!t.some((n,r)=>!Fu(n,e[r]))}function z5e(t,e){return t.some(n=>Fu(n,e))}let Q3=class{constructor(e,n,r,i){this.key=e,this.value=n,this.next=r,this.prev=i}};class kI{constructor(e,n=0){this.limit=e,this.size=n,this.cache={},this.head=new Q3("HEAD",null,null,null),this.tail=new Q3("TAIL",null,null,null),this.head.next=this.tail,this.tail.prev=this.head}write(e,n){if(this.cache[e])this.cache[e].value=n;else{const r=new Q3(e,n,this.head.next,this.head);this.head.next.prev=r,this.head.next=r,this.cache[e]=r,this.size++,this.ensureLimit()}}read(e){if(!this.cache[e])return;const{value:n}=this.cache[e];return this.remove(e),this.write(e,n),n}remove(e){const n=this.cache[e];n.prev.next=n.next,n.next.prev=n.prev,delete this.cache[e],this.size--}clear(){this.head.next=this.tail,this.tail.prev=this.head,this.size=0,this.cache={}}ensureLimit(){this.size>this.limit&&this.remove(this.tail.prev.key)}}function yW(t,e){const n=document.createElement("base");n.href=t;const r=document.getElementsByTagName("head")[0];r.insertBefore(n,r.firstChild);const i=document.createElement("a");i.href=e;const s=i.href;return r.removeChild(n),s}function U5e(t,e,n){return t.length&&rW(t)!=="/"&&(t+="/"),yW(t,e).replace(/^(\w+:\/\/[^/]+)(\/[^?]+)/,(i,s,o)=>{const a=o.split("/").pop();return/\.\w+$/.test(a)?i:s+o+n})}function j5e(t){return Ir(this,void 0,void 0,function*(){return new Promise((e,n)=>{const r=new XMLHttpRequest;r.onload=()=>{r.status>=200&&r.status<300?e(r.responseText):n(new Error(r.statusText))},r.onerror=()=>{n(new Error("An error occurred whilst receiving the response."))},r.open("GET",t),r.send()})})}function q5e(t){const e=new XMLHttpRequest;if(e.open("GET",t,!1),e.send(),e.status<200||e.status>=300)throw new Error(e.statusText);return e.responseText}function V5e(t){return Ir(this,void 0,void 0,function*(){return!0})}function Z5e(t){return!0}function X5e(t){return yW(t,".")}const W5e="/";var Y5e=Object.freeze({__proto__:null,resolve:U5e,readFile:j5e,readFileSync:q5e,exists:V5e,existsSync:Z5e,dirname:X5e,sep:W5e});function G5e(t,e,...n){return t=Nt(t),ci(t)||Ct(t)?t.length?t:e:t===!1&&new Map(n).get("allow_false")?!1:m_(t,this.context)?e:t}function CI(t,e=0){return JSON.stringify(t,null,e)}function H5e(t,e=0){const n=[];return JSON.stringify(t,function(r,i){if(typeof i!="object"||i===null)return i;for(;n.length>0&&n[n.length-1]!==this;)n.pop();return n.includes(i)?"[Circular]":(n.push(i),i)},e)}function K5e(t){return Number(t)}const J5e={raw:!0,handler:oW};var bW={default:G5e,raw:J5e,jsonify:CI,to_integer:K5e,json:CI,inspect:H5e};const e4e={"&":"&","<":"<",">":">",'"':""","'":"'"},t4e={"&":"&","<":"<",">":">",""":'"',"'":"'"};function g_(t){return t=Me(t),this.context.memoryLimit.use(t.length),t.replace(/&|<|>|"|'/g,e=>e4e[e])}function n4e(t){return g_.call(this,t)}function r4e(t){return t=Me(t),this.context.memoryLimit.use(t.length),t.replace(/&(amp|lt|gt|#34|#39);/g,e=>t4e[e])}function i4e(t){return g_.call(this,r4e.call(this,t))}function s4e(t){const e=Me(t);return this.context.memoryLimit.use(e.length),e.replace(/\r?\n/gm,`
`)}function o4e(t){const e=Me(t);return this.context.memoryLimit.use(e.length),e.replace(/||<.*?>|/g,"")}var a4e=Object.freeze({__proto__:null,escape:g_,xml_escape:n4e,escape_once:i4e,newline_to_br:s4e,strip_html:o4e});class l4e{constructor(e){this.mapping=e,this.sep="/"}exists(e){return Ir(this,void 0,void 0,function*(){return this.existsSync(e)})}existsSync(e){return!$o(this.mapping[e])}readFile(e){return Ir(this,void 0,void 0,function*(){return this.readFileSync(e)})}readFileSync(e){const n=this.mapping[e];if($o(n))throw new Error(`ENOENT: ${e}`);return n}dirname(e){const n=e.split(this.sep);return n.pop(),n.join(this.sep)}resolve(e,n,r){if(n+=r,e===".")return n;const i=e.split(/\/+/);for(const s of n.split(this.sep))s==="."||s===""||(s===".."?(i.length>1||i[0]!=="")&&i.pop():i.push(s));return i.join(this.sep)}}const rp={root:["."],layouts:["."],partials:["."],relativeReference:!0,jekyllInclude:!1,keyValueSeparator:":",cache:void 0,extname:"",fs:Y5e,dynamicPartials:!0,jsTruthy:!1,dateFormat:"%A, %B %-e, %Y at %-l:%M %P %z",locale:"",trimTagRight:!1,trimTagLeft:!1,trimOutputRight:!1,trimOutputLeft:!1,greedy:!0,tagDelimiterLeft:"{%",tagDelimiterRight:"%}",outputDelimiterLeft:"{{",outputDelimiterRight:"}}",preserveTimezones:!1,strictFilters:!1,strictVariables:!1,ownPropertyOnly:!0,lenientIf:!1,globals:{},keepOutputType:!1,operators:Q5e,memoryLimit:1/0,parseLimit:1/0,renderLimit:1/0};function u4e(t){var e,n;if(t.hasOwnProperty("root")&&(t.hasOwnProperty("partials")||(t.partials=t.root),t.hasOwnProperty("layouts")||(t.layouts=t.root)),t.hasOwnProperty("cache")){let r;typeof t.cache=="number"?r=t.cache>0?new kI(t.cache):void 0:typeof t.cache=="object"?r=t.cache:r=t.cache?new kI(1024):void 0,t.cache=r}return t=Object.assign(Object.assign(Object.assign({},rp),t.jekyllInclude?{dynamicPartials:!1}:{}),t),(!t.fs.dirname||!t.fs.sep)&&t.relativeReference&&(console.warn("[LiquidJS] `fs.dirname` and `fs.sep` are required for relativeReference, set relativeReference to `false` to suppress this warning"),t.relativeReference=!1),t.root=tv(t.root),t.partials=tv(t.partials),t.layouts=tv(t.layouts),t.outputEscape=t.outputEscape&&c4e(t.outputEscape),t.locale||(t.locale=(n=(e=hW())===null||e===void 0?void 0:e().resolvedOptions().locale)!==null&&n!==void 0?n:"en-US"),t.templates&&(t.fs=new l4e(t.templates),t.relativeReference=!0,t.root=t.partials=t.layouts="."),t}function c4e(t){return t==="escape"?g_:t==="json"?bW.json:(Ti(Qr(t),"`outputEscape` need to be of type string or function"),t)}function tv(t){let e=[];return ci(t)&&(e=t),Ct(t)&&(e=[t]),e}function f4e(t,e){let n=!1;for(let r=0;r`unexpected character ${this.snapshot()}`)}while(this.peek()===",");else if(!(this.peek()==="|"||this.end()))throw this.error('expected ":" after filter name');return new mW(e.getText(),n,this.input,e.begin,this.p,this.file)}readFilterArg(){const e=this.readValue();if(!e)return;if(this.skipBlank(),this.peek()!==":")return e;++this.p;const n=this.readValue();return[e.getText(),n]}readTopLevelTokens(e=rp){const n=[];for(;this.p-1?this.readEndrawOrRawContent(e):this.match(n)?this.readTagToken(e):this.match(r)?this.readOutputToken(e):this.readHTMLToken([n,r])}readHTMLToken(e){const n=this.p;for(;this.pthis.match(r));)++this.p;return new OI(this.input,n,this.p,this.file)}readTagToken(e){const{file:n,input:r}=this,i=this.p;if(this.readToDelimiter(e.tagDelimiterRight)===-1)throw this.error(`tag ${this.snapshot(i)} not closed`,i);const s=new bI(r,i,this.p,e,n);return s.name==="raw"&&(this.rawBeginAt=i),s}readToDelimiter(e,n=!1){for(this.skipBlank();this.p=this.N}read(){return this.input[this.p++]}readTo(e){for(;this.p`unexpected token ${this.snapshot()}, value expected`),e}readQuoted(){this.skipBlank();const e=this.p;if(!(this.peekType()&hI))return;++this.p;let n=!1;for(;this.p=this.N?0:On[this.input.charCodeAt(this.p+e)]}peek(e=0){return this.p+e>=this.N?"":this.input[this.p+e]}skipBlank(){for(;this.peekType()&y0;)++this.p}}class p4e{constructor(e,n){this.handlers={},this.stopRequested=!1,this.tokens=e,this.parseToken=n}on(e,n){return this.handlers[e]=n,this}trigger(e,n){const r=this.handlers[e];return r?(r.call(this,n),!0):!1}start(){this.trigger("start");let e;for(;!this.stopRequested&&(e=this.tokens.shift());){if(this.trigger("token",e)||ld(e)&&this.trigger(`tag:${e.name}`,e))continue;const n=this.parseToken(e,this.tokens);this.trigger("template",n)}return this.stopRequested||this.trigger("end"),this}stop(){return this.stopRequested=!0,this}}class l8{constructor(e){this.token=e}}class pr extends l8{constructor(e,n,r){super(e),this.name=e.name,this.liquid=r,this.tokenizer=e.tokenizer}}class tm{constructor(e,n){this.hash={};const r=e instanceof Al?e:new Al(e,{});for(const i of r.readHashes(n))this.hash[i.name.content]=i.value}*render(e){const n={};for(const r of Object.keys(this.hash))n[r]=this.hash[r]===void 0?!0:yield Dr(this.hash[r],e);return n}}function m4e(t){return class extends pr{constructor(e,n,r){super(e,n,r),Qr(t.parse)&&t.parse.call(this,e,n)}*render(e,n){const r=yield new tm(this.token.args,e.opts.keyValueSeparator).render(e);return yield t.render.call(this,e,n,r)}}}function OW(t){return ci(t)}class vW{constructor(e,n,r){this.token=e,this.name=e.name,this.handler=Qr(n)?n:Qr(n?.handler)?n.handler:oW,this.raw=!Qr(n)&&!!n?.raw,this.args=e.args,this.liquid=r}*render(e,n){const r=[];for(const i of this.args)OW(i)?r.push([i[0],yield Dr(i[1],n)]):r.push(yield Dr(i,n));return yield this.handler.apply({context:n,token:this.token,liquid:this.liquid},[e,...r])}}class io{constructor(e,n){this.filters=[];const r=typeof e=="string"?new Al(e,n.options.operators).readFilteredValue():e;this.initial=r.initial,this.filters=r.filters.map(i=>new vW(i,this.getFilter(n,i.name),n))}*value(e,n){n=n||e.opts.lenientIf&&this.filters.length>0&&this.filters[0].name==="default";let r=yield this.initial.evaluate(e,n);for(const i of this.filters)r=yield i.render(r,e);return r}getFilter(e,n){const r=e.filters[n];return Ti(r||!e.options.strictFilters,()=>`undefined filter: ${n}`),r}}class g4e extends l8{constructor(e,n){var r;super(e);const i=new Al(e.input,n.options.operators,e.file,e.contentRange);this.value=new io(i.readFilteredValue(),n);const s=this.value.filters,o=n.options.outputEscape;if(!(!((r=s[s.length-1])===null||r===void 0)&&r.raw)&&o){const a=new mW(toString.call(o),[],"",0,0);s.push(new vW(a,o,n))}}*render(e,n){const r=yield this.value.value(e,!1);n.write(r)}*arguments(){yield this.value}}class y4e extends l8{constructor(e){super(e),this.str=e.getContent()}*render(e,n){n.write(this.str)}}class Bh{constructor(e,n){this.segments=e,this.location=n}toString(){return hw(this.segments,!0)}toArray(){function*e(...n){for(const r of n)r instanceof Bh?yield Array.from(e(...r.segments)):yield r}return Array.from(e(...this.segments))}}class B3{constructor(){this.map=new Map}get(e){const n=hw([e.segments[0]]);return this.map.has(n)||this.map.set(n,[]),this.map.get(n)}has(e){return this.map.has(hw([e.segments[0]]))}push(e){this.get(e).push(e)}asObject(){return Object.fromEntries(this.map)}}const wW={partials:!0};function*xW(t,e,n){const r=new B3,i=new B3,s=new B3,o=new AI(new Set),a=new Set;function l(c,f){r.push(c);const h=f.alias(c);if(h!==void 0){const d=h.segments[0];Ct(d)&&!o.has(d)&&i.push(h)}else{const d=c.segments[0];Ct(d)&&!f.has(d)&&i.push(c)}for(const d of c.segments)d instanceof Bh&&l(d,f)}function*u(c,f){if(c.arguments)for(const h of c.arguments())for(const d of EI(h))l(d,f);if(c.localScope)for(const h of c.localScope()){f.add(h.content),f.deleteAlias(h.content);const[d,p]=h.getPosition();s.push(new Bh([h.content],{row:d,col:p,file:h.file}))}if(c.children)if(c.partialScope){const h=c.partialScope();if(h===void 0){for(const m of yield c.children(e,n))yield u(m,f);return}if(a.has(h.name))return;const d=new Set,p=h.isolated?new AI(d):f.push(d);for(const m of h.scope)if(Ct(m))d.add(m);else{const[g,y]=m;d.add(g);const O=Array.from(EI(y));O.length&&p.setAlias(g,O[0].segments)}for(const m of yield c.children(e,n))yield u(m,p),a.add(h.name);p.pop()}else{c.blockScope&&f.push(new Set(c.blockScope()));for(const h of yield c.children(e,n))yield u(h,f);c.blockScope&&f.pop()}}for(const c of t)yield u(c,o);return{variables:r.asObject(),globals:i.asObject(),locals:s.asObject()}}function uc(t,e={}){const n=Object.assign(Object.assign({},wW),e);return bu(xW(t,n.partials,!1))}function cc(t,e={}){const n=Object.assign(Object.assign({},wW),e);return Ou(xW(t,n.partials,!0))}class AI{constructor(e){this.stack=[{names:e,aliases:new Map}]}has(e){for(const n of this.stack)if(n.names.has(e))return!0;return!1}push(e){return this.stack.push({names:e,aliases:new Map}),this}pop(){var e;return(e=this.stack.pop())===null||e===void 0?void 0:e.names}add(e){this.stack[0].names.add(e)}alias(e){const n=e.segments[0];if(!Ct(n))return;const r=this.getAlias(n);if(r!==void 0)return new Bh([...r,...e.segments.slice(1)],e.location)}setAlias(e,n){this.stack[this.stack.length-1].aliases.set(e,n)}deleteAlias(e){this.stack[this.stack.length-1].aliases.delete(e)}getAlias(e){for(const n of this.stack){if(n.aliases.has(e))return n.aliases.get(e);if(n.names.has(e))return}}}function*EI(t){Ks(t)?yield*Dp(t):t instanceof io&&(yield*b4e(t))}function*b4e(t){for(const e of t.initial.postfix)Ks(e)&&(yield*Dp(e));for(const e of t.filters)for(const n of e.args)OW(n)&&n[1]?yield*Dp(n[1]):Ks(n)&&(yield*Dp(n))}function*Dp(t){SW(t)?(yield*Dp(t.lhs),yield*Dp(t.rhs)):dw(t)&&(yield N4(t))}function N4(t){const e=[];let n=t.file;const r=t.props[0];n=n||r.file,Q4(r)||DI(r)||PI(r)?e.push(r.content):dw(r)&&e.push(...N4(r).segments);for(const o of t.props.slice(1))n=n||o.file,Q4(o)||DI(o)||PI(o)?e.push(o.content):dw(o)&&e.push(N4(o));const[i,s]=t.getPosition();return new Bh(e,{row:i,col:s,file:n})}const TI=/^[\u0080-\uFFFFa-zA-Z_][\u0080-\uFFFFa-zA-Z0-9_-]*$/;function hw(t,e=!1){const n=[],r=t[0];Ct(r)&&(!e||r.match(TI)?n.push(`${r}`):n.push(`['${r}']`));for(const i of t.slice(1))i instanceof Bh?n.push(`[${hw(i.segments)}]`):Ct(i)?i.match(TI)?n.push(`.${i}`):n.push(`['${i}']`):n.push(`[${i}]`);return n.join("")}var zh;(function(t){t.Partials="partials",t.Layouts="layouts",t.Root="root"})(zh||(zh={}));class O4e{constructor(e){if(this.options=e,e.relativeReference){const n=e.fs.sep;Ti(n,"`fs.sep` is required for relative reference");const r=new RegExp(["."+n,".."+n,"./","../"].map(i=>zke(i)).join("|"));this.shouldLoadRelative=i=>r.test(i)}else this.shouldLoadRelative=n=>!1;this.contains=this.options.fs.contains||(()=>!0)}*lookup(e,n,r,i){const{fs:s}=this.options,o=this.options[n];for(const a of this.candidates(e,o,i,n!==zh.Root))if(r?s.existsSync(a):yield s.exists(a))return a;throw this.lookupError(e,o)}*candidates(e,n,r,i){const{fs:s,extname:o}=this.options;if(this.shouldLoadRelative(e)&&r){const a=s.resolve(this.dirname(r),e,o);for(const l of n)if(!i||this.contains(l,a)){yield a;break}}for(const a of n){const l=s.resolve(a,e,o);(!i||this.contains(a,l))&&(yield l)}if(s.fallback!==void 0){const a=s.fallback(e);a!==void 0&&(yield a)}}dirname(e){const n=this.options.fs;return Ti(n.dirname,"`fs.dirname` is required for relative reference"),n.dirname(e)}lookupError(e,n){const r=new Error("ENOENT");return r.message=`ENOENT: Failed to lookup "${e}" in "${n}"`,r.code="ENOENT",r}}class Tf{constructor(e){this.liquid=e,this.cache=this.liquid.options.cache,this.fs=this.liquid.options.fs,this.parseFile=this.cache?this._parseFileCached:this._parseFile,this.loader=new O4e(this.liquid.options),this.parseLimit=new L4("parse length",e.options.parseLimit)}parse(e,n){e=String(e),this.parseLimit.use(e.length);const i=new Al(e,this.liquid.options.operators,n).readTopLevelTokens(this.liquid.options);return this.parseTokens(i)}parseTokens(e){let n;const r=[],i=[];for(;n=e.shift();)try{r.push(this.parseToken(n,e))}catch(s){if(this.liquid.options.catchAllErrors)i.push(s);else throw s}if(i.length)throw new aW(i);return r}parseToken(e,n){try{if(ld(e)){const r=this.liquid.tags[e.name];return Ti(r,`tag "${e.name}" not found`),new r(e,n,this.liquid,this)}return w4e(e)?new g4e(e,this.liquid):new y4e(e)}catch(r){throw ad.is(r)?r:new Wke(r,e)}}parseStream(e){return new p4e(e,(n,r)=>this.parseToken(n,r))}*_parseFileCached(e,n,r=zh.Root,i){const s=this.cache,o=this.loader.shouldLoadRelative(e)?i+","+e:r+":"+e,a=yield s.read(o);if(a)return a;const l=this._parseFile(e,n,r,i),u=n?yield l:bu(l);s.write(o,u);try{return yield u}catch(c){throw s.remove(o),c}}*_parseFile(e,n,r=zh.Root,i){const s=yield this.loader.lookup(e,r,n,i);return this.parse(n?this.fs.readFileSync(s):yield this.fs.readFile(s),s)}}var Qn;(function(t){t[t.Number=1]="Number",t[t.Literal=2]="Literal",t[t.Tag=4]="Tag",t[t.Output=8]="Output",t[t.HTML=16]="HTML",t[t.Filter=32]="Filter",t[t.Hash=64]="Hash",t[t.PropertyAccess=128]="PropertyAccess",t[t.Word=256]="Word",t[t.Range=512]="Range",t[t.Quoted=1024]="Quoted",t[t.Operator=2048]="Operator",t[t.FilteredValue=4096]="FilteredValue",t[t.Delimited=12]="Delimited"})(Qn||(Qn={}));function v4e(t){return!!(Sa(t)&Qn.Delimited)}function _W(t){return Sa(t)===Qn.Operator}function u8(t){return Sa(t)===Qn.HTML}function w4e(t){return Sa(t)===Qn.Output}function ld(t){return Sa(t)===Qn.Tag}function Q4(t){return Sa(t)===Qn.Quoted}function DI(t){return Sa(t)===Qn.Number}function dw(t){return Sa(t)===Qn.PropertyAccess}function PI(t){return Sa(t)===Qn.Word}function SW(t){return Sa(t)===Qn.Range}function Ks(t){return(Sa(t)&1667)>0}function Sa(t){return t?t.kind:-1}class zf{constructor(e={},n=rp,r={},{memoryLimit:i,renderLimit:s}={}){var o,a,l,u,c;this.scopes=[{}],this.registers={},this.breakCalled=!1,this.continueCalled=!1,this.sync=!!r.sync,this.opts=n,this.globals=(o=r.globals)!==null&&o!==void 0?o:n.globals,this.environments=d_(e)?e:Object(e),this.strictVariables=(a=r.strictVariables)!==null&&a!==void 0?a:this.opts.strictVariables,this.ownPropertyOnly=(l=r.ownPropertyOnly)!==null&&l!==void 0?l:n.ownPropertyOnly,this.memoryLimit=i??new L4("memory alloc",(u=r.memoryLimit)!==null&&u!==void 0?u:n.memoryLimit),this.renderLimit=s??new L4("template render",gW().now()+((c=r.renderLimit)!==null&&c!==void 0?c:n.renderLimit))}getRegister(e){return this.registers[e]=this.registers[e]||{}}setRegister(e,n){return this.registers[e]=n}saveRegister(...e){return e.map(n=>[n,this.getRegister(n)])}restoreRegister(e){return e.forEach(([n,r])=>this.setRegister(n,r))}getAll(){return[this.globals,this.environments,...this.scopes].reduce((e,n)=>fw(e,n),{})}get(e){return this.getSync(e)}getSync(e){return Ou(this._get(e))}*_get(e){const n=this.findScope(e[0]);return yield this._getFromScope(n,e)}getFromScope(e,n){return Ou(this._getFromScope(e,n))}*_getFromScope(e,n,r=this.strictVariables){Ct(n)&&(n=n.split("."));for(let i=0;i=0;n--){const r=this.scopes[n];if(e in r)return r}return e in this.environments?this.environments:this.globals}readProperty(e,n){if(e=tW(e),n=Nt(n),$o(e))return e;if(ci(e)&&n<0)return e[e.length+ +n];const r=x4e(e,n,this.ownPropertyOnly);return r===void 0&&e instanceof od?e.liquidMethodMissing(n,this):Qr(r)?r.call(e):n==="size"?k4e(e):n==="first"?_4e(e):n==="last"?S4e(e):r}}function x4e(t,e,n){if(!(n&&!r8.call(t,e)&&!(t instanceof od)))return t[e]}function _4e(t){return ci(t)?t[0]:t.first}function S4e(t){return ci(t)?t[t.length-1]:t.last}function k4e(t){if(r8.call(t,"size")||t.size!==void 0)return t.size;if(ci(t)||Ct(t))return t.length;if(typeof t=="object")return Object.keys(t).length}var gh;(function(t){t[t.OUTPUT=0]="OUTPUT",t[t.STORE=1]="STORE"})(gh||(gh={}));const C4e=zl(Math.abs),A4e=zl(Math.max),E4e=zl(Math.min),T4e=zl(Math.ceil),D4e=zl((t,e,n=!1)=>n?Math.floor(t/e):t/e),P4e=zl(Math.floor),R4e=zl((t,e)=>t-e),I4e=zl((t,e)=>t+e),F4e=zl((t,e)=>t%e),$4e=zl((t,e)=>t*e);function M4e(t,e=0){t=$4(t),e=$4(e);const n=Math.pow(10,e);return Math.round(t*n)/n}var L4e=Object.freeze({__proto__:null,abs:C4e,at_least:A4e,at_most:E4e,ceil:T4e,divided_by:D4e,floor:P4e,minus:R4e,plus:I4e,modulo:F4e,times:$4e,round:M4e});const N4e=t=>decodeURIComponent(Me(t)).replace(/\+/g," "),Q4e=t=>encodeURIComponent(Me(t)).replace(/%20/g,"+"),B4e=t=>encodeURIComponent(Me(t)).replace(/%20/g,"+").replace(/[!'()*]/g,e=>"%"+e.charCodeAt(0).toString(16).toUpperCase()),z4e=t=>encodeURI(Me(t)).replace(/%5B/g,"[").replace(/%5D/g,"]"),RI=/[^\p{M}\p{L}\p{Nd}]+/ug,U4e={raw:/\s+/g,default:RI,pretty:/[^\p{M}\p{L}\p{Nd}._~!$&'()+,;=@]+/ug,ascii:/[^A-Za-z0-9]+/g,latin:RI,none:null};function j4e(t,e="default",n=!1){t=Me(t);const r=U4e[e];return r&&(e==="latin"&&(t=q4e(t)),t=t.replace(r,"-").replace(/^-|-$/g,"")),n?t:t.toLowerCase()}function q4e(t){return t.replace(/[àáâãäå]/g,"a").replace(/[æ]/g,"ae").replace(/[ç]/g,"c").replace(/[èéêë]/g,"e").replace(/[ìíîï]/g,"i").replace(/[ð]/g,"d").replace(/[ñ]/g,"n").replace(/[òóôõöø]/g,"o").replace(/[ùúûü]/g,"u").replace(/[ýÿ]/g,"y").replace(/[ß]/g,"ss").replace(/[œ]/g,"oe").replace(/[þ]/g,"th").replace(/[ẞ]/g,"SS").replace(/[Œ]/g,"OE").replace(/[Þ]/g,"TH")}var V4e=Object.freeze({__proto__:null,url_decode:N4e,url_encode:Q4e,cgi_escape:B4e,uri_escape:z4e,slugify:j4e});const Z4e=p_(function(t,e){const n=ui(t),r=$o(e)?" ":Me(e),i=n.length*(1+r.length);return this.context.memoryLimit.use(i),n.join(r)}),X4e=p_(t=>nW(t)?rW(t):""),W4e=p_(t=>nW(t)?t[0]:""),Y4e=p_(function(t){const e=ui(t);return this.context.memoryLimit.use(e.length),[...e].reverse()});function*G4e(t,e){const n=[],r=ui(t);this.context.memoryLimit.use(r.length);for(const i of r)n.push([i,e?yield this.context._getFromScope(i,Me(e).split("."),!1):i]);return n.sort((i,s)=>{const o=i[1],a=s[1];return oa?1:0}).map(i=>i[0])}function H4e(t,e){const n=Me(e),r=e===void 0?cI:(s,o)=>cI(s[n],o[n]),i=ui(t);return this.context.memoryLimit.use(i.length),[...i].sort(r)}const K4e=t=>t&&t.length||0;function*J4e(t,e){const n=[],r=ui(t);this.context.memoryLimit.use(r.length);for(const i of r)n.push(yield this.context._getFromScope(i,Me(e),!1));return n}function*eCe(t,e){let n=0;const r=ui(t);for(const i of r){const s=Number(e?yield this.context._getFromScope(i,Me(e),!1):i);n+=Number.isNaN(s)?0:s}return n}function tCe(t){const e=ui(t);return this.context.memoryLimit.use(e.length),e.filter(n=>!$o(Nt(n)))}function kW(t,e=[]){const n=ui(t),r=ui(e);return this.context.memoryLimit.use(n.length+r.length),n.concat(r)}function nCe(t,e){return kW.call(this,t,[e])}function rCe(t,e){const n=ui(t);this.context.memoryLimit.use(n.length);const r=[...n];return r.unshift(e),r}function iCe(t){const e=[...ui(t)];return e.pop(),e}function sCe(t){const e=ui(t);this.context.memoryLimit.use(e.length);const n=[...e];return n.shift(),n}function oCe(t,e,n=1){return t=Nt(t),$o(t)?[]:(ci(t)||(t=Me(t)),e=e<0?t.length+e:e,this.context.memoryLimit.use(n),t.slice(e,e+n))}function CW(t){return this.context.opts.jekyllWhere?e=>b0.is(t)?Fu(e,t):ci(e)?z5e(e,t):Fu(e,t):t===void 0?e=>ih(e,this.context):e=>Fu(e,t)}function*AW(t,e,n,r){const i=[];e=ui(e),this.context.memoryLimit.use(e.length);const s=new Al(Me(n)).readScopeValue();for(const a of e)i.push(yield Dr(s,this.context.spawn(a)));const o=CW.call(this,r);return e.filter((a,l)=>o(i[l])===t)}function*EW(t,e,n,r){const i=[],s=new io(Me(r),this.liquid),o=ui(e);this.context.memoryLimit.use(o.length);for(const a of o){this.context.push({[n]:a});const l=yield s.value(this.context);this.context.pop(),l===t&&i.push(a)}return i}function*aCe(t,e,n){return yield*AW.call(this,!0,t,e,n)}function*lCe(t,e,n){return yield*AW.call(this,!1,t,e,n)}function*uCe(t,e,n){return yield*EW.call(this,!0,t,e,n)}function*cCe(t,e,n){return yield*EW.call(this,!1,t,e,n)}function*fCe(t,e){const n=new Map;t=Py(t);const r=new Al(Me(e)).readScopeValue();this.context.memoryLimit.use(t.length);for(const i of t){const s=yield Dr(r,this.context.spawn(i));n.has(s)||n.set(s,[]),n.get(s).push(i)}return[...n.entries()].map(([i,s])=>({name:i,items:s}))}function*hCe(t,e,n){const r=new Map,i=new io(Me(n),this.liquid);t=Py(t),this.context.memoryLimit.use(t.length);for(const s of t){this.context.push({[e]:s});const o=yield i.value(this.context);this.context.pop(),r.has(o)||r.set(o,[]),r.get(o).push(s)}return[...r.entries()].map(([s,o])=>({name:s,items:o}))}function*c8(t,e,n){const r=new Al(Me(e)).readScopeValue(),i=ui(t),s=CW.call(this,n);for(let o=0;oMath.random()-.5);return e===1?n[0]:n.slice(0,e)}var wCe=Object.freeze({__proto__:null,join:Z4e,last:X4e,first:W4e,reverse:Y4e,sort:G4e,sort_natural:H4e,size:K4e,map:J4e,sum:eCe,compact:tCe,concat:kW,push:nCe,unshift:rCe,pop:iCe,shift:sCe,slice:oCe,where:aCe,reject:lCe,where_exp:uCe,reject_exp:cCe,group_by:fCe,group_by_exp:hCe,has:dCe,has_exp:pCe,find_index:mCe,find_index_exp:gCe,find:yCe,find_exp:bCe,uniq:OCe,sample:vCe});function h8(t,e,n){var r,i,s;const o=((r=t?.length)!==null&&r!==void 0?r:0)+((i=e?.length)!==null&&i!==void 0?i:0)+((s=n?.length)!==null&&s!==void 0?s:0);this.context.memoryLimit.use(o);const a=DW(t,this.context.opts,n);return a?(e=Nt(e),e=$o(e)?this.context.opts.dateFormat:Me(e),ev(a,e)):t}function xCe(t){return h8.call(this,t,"%Y-%m-%dT%H:%M:%S%:z")}function _Ce(t){return h8.call(this,t,"%a, %d %b %Y %H:%M:%S %z")}function SCe(t,e,n){return TW.call(this,t,"%b",e,n)}function kCe(t,e,n){return TW.call(this,t,"%B",e,n)}function TW(t,e,n,r){const i=DW(t,this.context.opts);if(!i)return t;if(n==="ordinal"){const s=i.getDate();return r==="US"?ev(i,`${e} ${s}%q, %Y`):ev(i,`${s}%q ${e} %Y`)}return ev(i,`%d ${e} %Y`)}function DW(t,e,n){let r;const i=n??e.timezoneOffset,s=e.locale;return t=Nt(t),t==="now"||t==="today"?r=new Ho(Date.now(),s,i):h_(t)?r=new Ho(t*1e3,s,i):Ct(t)?/^\d+$/.test(t)?r=new Ho(+t*1e3,s,i):e.preserveTimezones&&n===void 0?r=Ho.createDateFixedToTimezone(t,s):r=new Ho(t,s,i):r=new Ho(t,s,i),r.valid()?r:void 0}var CCe=Object.freeze({__proto__:null,date:h8,date_to_xmlschema:xCe,date_to_rfc822:_Ce,date_to_string:SCe,date_to_long_string:kCe});const z3=/[\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF\u3040-\u309F\u30A0-\u30FF\uAC00-\uD7AF]/gu,II=/[^\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF\u3040-\u309F\u30A0-\u30FF\uAC00-\uD7AF\s]+/gu;function ACe(t,e){Ti(arguments.length===2,"append expect 2 arguments");const n=Me(t),r=Me(e);return this.context.memoryLimit.use(n.length+r.length),n+r}function ECe(t,e){Ti(arguments.length===2,"prepend expect 2 arguments");const n=Me(t),r=Me(e);return this.context.memoryLimit.use(n.length+r.length),r+n}function TCe(t,e){const n=Me(t);return this.context.memoryLimit.use(n.length),e?(e=i8(Me(e)),n.replace(new RegExp(`^[${e}]+`,"g"),"")):n.replace(/^\s+/,"")}function DCe(t){const e=Me(t);return this.context.memoryLimit.use(e.length),e.toLowerCase()}function PCe(t){const e=Me(t);return this.context.memoryLimit.use(e.length),Me(e).toUpperCase()}function RCe(t,e){const n=Me(t);return this.context.memoryLimit.use(n.length),n.split(Me(e)).join("")}function ICe(t,e){const n=Me(t);return this.context.memoryLimit.use(n.length),n.replace(Me(e),"")}function FCe(t,e){const n=Me(t);this.context.memoryLimit.use(n.length);const r=Me(e),i=n.lastIndexOf(r);return i===-1?n:n.substring(0,i)+n.substring(i+r.length)}function $Ce(t,e){return t=Me(t),this.context.memoryLimit.use(t.length),e?(e=i8(Me(e)),t.replace(new RegExp(`[${e}]+$`,"g"),"")):t.replace(/\s+$/,"")}function MCe(t,e){const n=Me(t);this.context.memoryLimit.use(n.length);const r=n.split(Me(e));for(;r.length&&r[r.length-1]==="";)r.pop();return r}function LCe(t,e){const n=Me(t);return this.context.memoryLimit.use(n.length),e?(e=i8(Me(e)),n.replace(new RegExp(`^[${e}]+`,"g"),"").replace(new RegExp(`[${e}]+$`,"g"),"")):n.trim()}function NCe(t){const e=Me(t);return this.context.memoryLimit.use(e.length),e.replace(/\r?\n/gm,"")}function QCe(t){return t=Me(t),this.context.memoryLimit.use(t.length),t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function BCe(t,e,n){const r=Me(t);return this.context.memoryLimit.use(r.length),r.split(Me(e)).join(n)}function zCe(t,e,n){const r=Me(t);return this.context.memoryLimit.use(r.length),r.replace(Me(e),n)}function UCe(t,e,n){const r=Me(t);this.context.memoryLimit.use(r.length);const i=Me(e),s=r.lastIndexOf(i);if(s===-1)return r;const o=Me(n);return r.substring(0,s)+o+r.substring(s+i.length)}function jCe(t,e=50,n="..."){const r=Me(t);return this.context.memoryLimit.use(r.length),r.length<=e?t:r.substring(0,e-n.length)+n}function qCe(t,e=15,n="..."){const r=Me(t);this.context.memoryLimit.use(r.length);const i=r.split(/\s+/);e<=0&&(e=1);let s=i.slice(0,e).join(" ");return i.length>=e&&(s+=n),s}function VCe(t){const e=Me(t);return this.context.memoryLimit.use(e.length),e.replace(/\s+/g," ")}function ZCe(t,e){const n=Me(t);if(this.context.memoryLimit.use(n.length),t=n.trim(),!t)return 0;switch(e){case"cjk":return(t.match(z3)||[]).length+(t.match(II)||[]).length;case"auto":return z3.test(t)?t.match(z3).length+(t.match(II)||[]).length:t.split(/\s+/).length;default:return t.split(/\s+/).length}}function XCe(t,e="and"){switch(this.context.memoryLimit.use(t.length),t.length){case 0:return"";case 1:return t[0];case 2:return`${t[0]} ${e} ${t[1]}`;default:return`${t.slice(0,-1).join(", ")}, ${e} ${t[t.length-1]}`}}var WCe=Object.freeze({__proto__:null,append:ACe,prepend:ECe,lstrip:TCe,downcase:DCe,upcase:PCe,remove:RCe,remove_first:ICe,remove_last:FCe,rstrip:$Ce,split:MCe,strip:LCe,strip_newlines:NCe,capitalize:QCe,replace:BCe,replace_first:zCe,replace_last:UCe,truncate:jCe,truncatewords:qCe,normalize_whitespace:VCe,number_of_words:ZCe,array_to_sentence_string:XCe});function YCe(t){return btoa(String.fromCharCode(...new TextEncoder().encode(t)))}function GCe(t){return new TextDecoder().decode(Uint8Array.from(atob(t),e=>e.charCodeAt(0)))}function HCe(t){const e=Me(t);return this.context.memoryLimit.use(e.length),YCe(e)}function KCe(t){const e=Me(t);return this.context.memoryLimit.use(e.length),GCe(e)}var JCe=Object.freeze({__proto__:null,base64_encode:HCe,base64_decode:KCe});const e6e=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},a4e),L4e),V4e),wCe),CCe),WCe),JCe),bW);class t6e extends pr{constructor(e,n,r){super(e,n,r),this.identifier=this.tokenizer.readIdentifier(),this.key=this.identifier.content,this.tokenizer.assert(this.key,"expected variable name"),this.tokenizer.skipBlank(),this.tokenizer.assert(this.tokenizer.peek()==="=",'expected "="'),this.tokenizer.advance(),this.value=new io(this.tokenizer.readFilteredValue(),this.liquid)}*render(e){e.bottom()[this.key]=yield this.value.value(e,this.liquid.options.lenientIf)}*arguments(){yield this.value}*localScope(){yield this.identifier}}const FI=["offset","limit","reversed"];class n6e extends pr{constructor(e,n,r,i){super(e,n,r);const s=this.tokenizer.readIdentifier(),o=this.tokenizer.readIdentifier(),a=this.tokenizer.readValue();if(!s.size()||o.content!=="in"||!a)throw new Error(`illegal tag: ${e.getText()}`);this.variable=s.content,this.collection=a,this.hash=new tm(this.tokenizer,r.options.keyValueSeparator),this.templates=[],this.elseTemplates=[];let l;const u=i.parseStream(n).on("start",()=>l=this.templates).on("tag:else",c=>{cw(c.args),l=this.elseTemplates}).on("tag:endfor",c=>{cw(c.args),u.stop()}).on("template",c=>l.push(c)).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)});u.start()}*render(e,n){const r=this.liquid.renderer;let i=Py(yield Dr(this.collection,e));if(!i.length){yield r.renderTemplates(this.elseTemplates,e,n);return}const s="continue-"+this.variable+"-"+this.collection.getText();e.push({continue:e.getRegister(s)});const o=yield this.hash.render(e);e.pop(),i=(this.liquid.options.orderedFilterParameters?Object.keys(o).filter(u=>FI.includes(u)):FI.filter(u=>o[u]!==void 0)).reduce((u,c)=>c==="offset"?i6e(u,o.offset):c==="limit"?s6e(u,o.limit):r6e(u),i),e.setRegister(s,(o.offset||0)+i.length);const l={forloop:new o8(i.length,this.collection.getText(),this.variable)};e.push(l);for(const u of i){if(l[this.variable]=u,e.continueCalled=e.breakCalled=!1,yield r.renderTemplates(this.templates,e,n),e.breakCalled)break;l.forloop.next()}e.continueCalled=e.breakCalled=!1,e.pop()}*children(){const e=this.templates.slice();return this.elseTemplates&&e.push(...this.elseTemplates),e}*arguments(){yield this.collection;for(const e of Object.values(this.hash.hash))Ks(e)&&(yield e)}blockScope(){return[this.variable,"forloop"]}}function r6e(t){return[...t].reverse()}function i6e(t,e){return t.slice(e)}function s6e(t,e){return t.slice(0,e)}class o6e extends pr{constructor(e,n,r,i){for(super(e,n,r),this.templates=[],this.identifier=this.readVariable(),this.variable=this.identifier.content;n.length;){const s=n.shift();if(ld(s)&&s.name==="endcapture")return;this.templates.push(i.parseToken(s,n))}throw new Error(`tag ${e.getText()} not closed`)}readVariable(){let e=this.tokenizer.readIdentifier();if(e.content||(e=this.tokenizer.readQuoted(),e))return e;throw this.tokenizer.error("invalid capture name")}*render(e){const r=yield this.liquid.renderer.renderTemplates(this.templates,e);e.bottom()[this.variable]=r}*children(){return this.templates}*localScope(){yield this.identifier}}class a6e extends pr{constructor(e,n,r,i){super(e,n,r),this.branches=[],this.elseTemplates=[],this.value=new io(this.tokenizer.readFilteredValue(),this.liquid),this.elseTemplates=[];let s=[],o=0;const a=i.parseStream(n).on("tag:when",l=>{if(o>0)return;s=[];const u=[];for(;!l.tokenizer.end();)u.push(l.tokenizer.readValueOrThrow()),l.tokenizer.skipBlank(),l.tokenizer.peek()===","?l.tokenizer.readTo(","):l.tokenizer.readTo("or");this.branches.push({values:u,templates:s})}).on("tag:else",()=>{o++,s=this.elseTemplates}).on("tag:endcase",()=>a.stop()).on("template",l=>{(s!==this.elseTemplates||o===1)&&s.push(l)}).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)});a.start()}*render(e,n){const r=this.liquid.renderer,i=Nt(yield this.value.value(e,e.opts.lenientIf));let s=!1;for(const o of this.branches)for(const a of o.values){const l=yield Dr(a,e,e.opts.lenientIf);if(Fu(i,l)){yield r.renderTemplates(o.templates,e,n),s=!0;break}}s||(yield r.renderTemplates(this.elseTemplates,e,n))}*arguments(){yield this.value,yield*this.branches.flatMap(e=>e.values)}*children(){const e=this.branches.flatMap(n=>n.templates);return this.elseTemplates&&e.push(...this.elseTemplates),e}}class l6e extends pr{constructor(e,n,r){for(super(e,n,r);n.length;){const i=n.shift();if(ld(i)&&i.name==="endcomment")return}throw new Error(`tag ${e.getText()} not closed`)}render(){}}class u6e extends pr{constructor(e,n,r,i){super(e,n,r);const s=this.tokenizer;for(this.file=d8(s,this.liquid,i),this.currentFile=e.file;!s.end();){s.skipBlank();const o=s.p,a=s.readIdentifier();if((a.content==="with"||a.content==="for")&&(s.skipBlank(),s.peek()!==":")){const l=s.readValue();if(l){const u=s.p,c=s.readIdentifier();let f;c.content==="as"?f=s.readIdentifier():s.p=u,this[a.content]={value:l,alias:f&&f.content},s.skipBlank(),s.peek()===","&&s.advance();continue}}s.p=o;break}this.hash=new tm(s,r.options.keyValueSeparator)}*render(e,n){const{liquid:r,hash:i}=this,s=yield p8(this.file,e,r);Ti(s,()=>`illegal file path "${s}"`);const o=e.spawn(),a=o.bottom();if(fw(a,yield i.render(e)),this.with){const{value:l,alias:u}=this.with;a[u||s]=yield Dr(l,e)}if(this.for){const{value:l,alias:u}=this.for,c=Py(yield Dr(l,e));a.forloop=new o8(c.length,l.getText(),u);for(const f of c){a[u]=f;const h=yield r._parsePartialFile(s,o.sync,this.currentFile);yield r.renderer.renderTemplates(h,o,n),a.forloop.next()}}else{const l=yield r._parsePartialFile(s,o.sync,this.currentFile);yield r.renderer.renderTemplates(l,o,n)}}*children(e,n){return e&&Ct(this.file)?yield this.liquid._parsePartialFile(this.file,n,this.currentFile):[]}partialScope(){if(Ct(this.file)){const e=Object.keys(this.hash.hash);if(this.with){const{value:n,alias:r}=this.with;Ct(r)?e.push([r,n]):Ct(this.file)&&e.push([this.file,n])}if(this.for){const{value:n,alias:r}=this.for;Ct(r)?e.push([r,n]):Ct(this.file)&&e.push([this.file,n])}return{name:this.file,isolated:!0,scope:e}}}*arguments(){for(const e of Object.values(this.hash.hash))Ks(e)&&(yield e);if(this.with){const{value:e}=this.with;Ks(e)&&(yield e)}if(this.for){const{value:e}=this.for;Ks(e)&&(yield e)}}}function d8(t,e,n){if(e.options.dynamicPartials){const s=t.readValue();if(t.assert(s,"illegal file path"),s.getText()==="none")return;if(Q4(s)){const o=n.parse(M5e(s));return $I(o)}return s}const r=[...t.readFileNameTemplate(e.options)],i=$I(n.parseTokens(r));return i==="none"?void 0:i}function $I(t){return t.length===1&&u8(t[0].token)?t[0].token.getContent():t}function*p8(t,e,n){return typeof t=="string"?t:Array.isArray(t)?n.renderer.renderTemplates(t,e):yield Dr(t,e)}class c6e extends pr{constructor(e,n,r,i){super(e,n,r);const{tokenizer:s}=e;this.file=d8(s,this.liquid,i),this.currentFile=e.file;const o=s.p;s.readIdentifier().content==="with"?(s.skipBlank(),s.peek()!==":"?this.withVar=s.readValue():s.p=o):s.p=o,this.hash=new tm(s,r.options.jekyllInclude||r.options.keyValueSeparator)}*render(e,n){const{liquid:r,hash:i,withVar:s}=this,{renderer:o}=r,a=yield p8(this.file,e,r);Ti(a,()=>`illegal file path "${a}"`);const l=e.saveRegister("blocks","blockMode");e.setRegister("blocks",{}),e.setRegister("blockMode",gh.OUTPUT);const u=yield i.render(e);s&&(u[a]=yield Dr(s,e));const c=yield r._parsePartialFile(a,e.sync,this.currentFile);e.push(e.opts.jekyllInclude?{include:u}:u),yield o.renderTemplates(c,e,n),e.pop(),e.restoreRegister(l)}*children(e,n){return e&&Ct(this.file)?yield this.liquid._parsePartialFile(this.file,n,this.currentFile):[]}partialScope(){if(Ct(this.file)){let e;return this.liquid.options.jekyllInclude?e=["include"]:(e=Object.keys(this.hash.hash),this.withVar&&e.push([this.file,this.withVar])),{name:this.file,isolated:!1,scope:e}}}*arguments(){yield*Object.values(this.hash.hash).filter(Ks),Ks(this.file)&&(yield this.file),Ks(this.withVar)&&(yield this.withVar)}}class f6e extends pr{constructor(e,n,r){super(e,n,r),this.identifier=this.tokenizer.readIdentifier(),this.variable=this.identifier.content}render(e,n){const r=e.environments;h_(r[this.variable])||(r[this.variable]=0),n.write(Me(--r[this.variable]))}*localScope(){yield this.identifier}}class h6e extends pr{constructor(e,n,r){super(e,n,r),this.candidates=[];const i=this.tokenizer.readValue();for(this.tokenizer.skipBlank(),i&&(this.tokenizer.peek()===":"?(this.group=i,this.tokenizer.advance()):this.candidates.push(i));!this.tokenizer.end();){const s=this.tokenizer.readValue();s&&this.candidates.push(s),this.tokenizer.readTo(",")}this.tokenizer.assert(this.candidates.length,()=>`empty candidates: "${e.getText()}"`)}*render(e,n){const i=`cycle:${yield Dr(this.group,e)}:`+this.candidates.join(","),s=e.getRegister("cycle");let o=s[i];o===void 0&&(o=s[i]=0);const a=this.candidates[o];return o=(o+1)%this.candidates.length,s[i]=o,yield Dr(a,e)}*arguments(){yield*this.candidates,this.group&&(yield this.group)}}class d6e extends pr{constructor(e,n,r,i){super(e,n,r),this.branches=[];let s=[];i.parseStream(n).on("start",()=>this.branches.push({value:new io(e.tokenizer.readFilteredValue(),this.liquid),templates:s=[]})).on("tag:elsif",o=>{Ti(!this.elseTemplates,"unexpected elsif after else"),this.branches.push({value:new io(o.tokenizer.readFilteredValue(),this.liquid),templates:s=[]})}).on("tag:else",o=>{cw(o.args),Ti(!this.elseTemplates,"duplicated else"),s=this.elseTemplates=[]}).on("tag:endif",function(o){cw(o.args),this.stop()}).on("template",o=>s.push(o)).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)}).start()}*render(e,n){const r=this.liquid.renderer;for(const{value:i,templates:s}of this.branches){const o=yield i.value(e,e.opts.lenientIf);if(ih(o,e)){yield r.renderTemplates(s,e,n);return}}yield r.renderTemplates(this.elseTemplates||[],e,n)}*children(){const e=this.branches.flatMap(n=>n.templates);return this.elseTemplates&&e.push(...this.elseTemplates),e}arguments(){return this.branches.map(e=>e.value)}}class p6e extends pr{constructor(e,n,r){super(e,n,r),this.identifier=this.tokenizer.readIdentifier(),this.variable=this.identifier.content}render(e,n){const r=e.environments;h_(r[this.variable])||(r[this.variable]=0);const i=r[this.variable];r[this.variable]++,n.write(Me(i))}*localScope(){yield this.identifier}}class m6e extends pr{constructor(e,n,r,i){super(e,n,r),this.file=d8(this.tokenizer,this.liquid,i),this.currentFile=e.file,this.args=new tm(this.tokenizer,r.options.keyValueSeparator),this.templates=i.parseTokens(n)}*render(e,n){const{liquid:r,args:i,file:s}=this,{renderer:o}=r;if(s===void 0){e.setRegister("blockMode",gh.OUTPUT),yield o.renderTemplates(this.templates,e,n);return}const a=yield p8(this.file,e,r);Ti(a,()=>`illegal file path "${a}"`);const l=yield r._parseLayoutFile(a,e.sync,this.currentFile);e.setRegister("blockMode",gh.STORE);const u=yield o.renderTemplates(this.templates,e),c=e.getRegister("blocks");c[""]===void 0&&(c[""]=(f,h)=>h.write(u)),e.setRegister("blockMode",gh.OUTPUT),e.push(yield i.render(e)),yield o.renderTemplates(l,e,n),e.pop()}*children(e){const n=this.templates.slice();return e&&Ct(this.file)&&n.push(...yield this.liquid._parsePartialFile(this.file,!0,this.currentFile)),n}*arguments(){for(const e of Object.values(this.args.hash))Ks(e)&&(yield e);Ks(this.file)&&(yield this.file)}partialScope(){if(Ct(this.file))return{name:this.file,isolated:!1,scope:Object.keys(this.args.hash)}}}class g6e extends pr{constructor(e,n,r,i){super(e,n,r),this.templates=[];const s=/\w+/.exec(e.args);for(this.block=s?s[0]:"";n.length;){const o=n.shift();if(ld(o)&&o.name==="endblock")return;const a=i.parseToken(o,n);this.templates.push(a)}throw new Error(`tag ${e.getText()} not closed`)}*render(e,n){const r=this.getBlockRender(e);e.getRegister("blockMode")===gh.STORE?e.getRegister("blocks")[this.block]=r:yield r(new dI,n)}getBlockRender(e){const{liquid:n,templates:r}=this,i=e.getRegister("blocks")[this.block],s=function*(o,a){e.push({block:o}),yield n.renderer.renderTemplates(r,e,a),e.pop()};return i?(o,a)=>i(new dI(l=>s(o,l)),a):s}*children(){return this.templates}blockScope(){return["block"]}}class y6e extends pr{constructor(e,n,r){for(super(e,n,r),this.tokens=[];n.length;){const i=n.shift();if(ld(i)&&i.name==="endraw")return;this.tokens.push(i)}throw new Error(`tag ${e.getText()} not closed`)}render(){return this.tokens.map(e=>e.getText()).join("")}}class b6e extends o8{constructor(e,n,r,i){super(e,r,i),this.length=e,this.cols=n}row(){return Math.floor(this.i/this.cols)+1}col0(){return this.i%this.cols}col(){return this.col0()+1}col_first(){return this.col0()===0}col_last(){return this.col()===this.cols}}class O6e extends pr{constructor(e,n,r,i){super(e,n,r);const s=this.tokenizer.readIdentifier();this.tokenizer.skipBlank();const o=this.tokenizer.readIdentifier(),a=this.tokenizer.readValue();if(o.content!=="in"||!a)throw new Error(`illegal tag: ${e.getText()}`);this.variable=s.content,this.collection=a,this.args=new tm(this.tokenizer,r.options.keyValueSeparator),this.templates=[];let l;const u=i.parseStream(n).on("start",()=>l=this.templates).on("tag:endtablerow",()=>u.stop()).on("template",c=>l.push(c)).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)});u.start()}*render(e,n){let r=Py(yield Dr(this.collection,e));const i=yield this.args.render(e),s=i.offset||0,o=i.limit===void 0?r.length:i.limit;r=r.slice(s,s+o);const a=i.cols||r.length,l=this.liquid.renderer,u=new b6e(r.length,a,this.collection.getText(),this.variable),c={tablerowloop:u};e.push(c);for(let f=0;f"),n.write(``)),n.write(``),yield l.renderTemplates(this.templates,e,n),n.write("");r.length&&n.write(""),e.pop()}*children(){return this.templates}*arguments(){yield this.collection;for(const e of Object.values(this.args.hash))Ks(e)&&(yield e)}blockScope(){return[this.variable,"tablerowloop"]}}class v6e extends pr{constructor(e,n,r,i){super(e,n,r),this.branches=[],this.elseTemplates=[];let s=[],o=0;i.parseStream(n).on("start",()=>this.branches.push({value:new io(e.tokenizer.readFilteredValue(),this.liquid),test:m_,templates:s=[]})).on("tag:elsif",a=>{if(o>0){s=[];return}this.branches.push({value:new io(a.tokenizer.readFilteredValue(),this.liquid),test:ih,templates:s=[]})}).on("tag:else",()=>{o++,s=this.elseTemplates}).on("tag:endunless",function(){this.stop()}).on("template",a=>{(s!==this.elseTemplates||o===1)&&s.push(a)}).on("end",()=>{throw new Error(`tag ${e.getText()} not closed`)}).start()}*render(e,n){const r=this.liquid.renderer;for(const{value:i,test:s,templates:o}of this.branches){const a=yield i.value(e,e.opts.lenientIf);if(s(a,e)){yield r.renderTemplates(o,e,n);return}}yield r.renderTemplates(this.elseTemplates,e,n)}*children(){const e=this.branches.flatMap(n=>n.templates);return this.elseTemplates&&e.push(...this.elseTemplates),e}arguments(){return this.branches.map(e=>e.value)}}class w6e extends pr{render(e,n){e.breakCalled=!0}}class x6e extends pr{render(e,n){e.continueCalled=!0}}class _6e extends pr{constructor(e,n,r){super(e,n,r),this.tokenizer.skipBlank(),this.tokenizer.end()||(this.value=new io(this.tokenizer.readFilteredValue(),this.liquid))}*render(e,n){if(!this.value)return;const r=yield this.value.value(e,!1);n.write(r)}*arguments(){this.value&&(yield this.value)}}class S6e extends pr{constructor(e,n,r,i){super(e,n,r);const s=this.tokenizer.readLiquidTagTokens(this.liquid.options);this.templates=i.parseTokens(s)}*render(e,n){yield this.liquid.renderer.renderTemplates(this.templates,e,n)}*children(){return this.templates}}class k6e extends pr{constructor(e,n,r){if(super(e,n,r),e.args.search(/\n\s*[^#\s]/g)!==-1)throw new Error("every line of an inline comment must start with a '#' character")}render(){}}const C6e={assign:t6e,for:n6e,capture:o6e,case:a6e,comment:l6e,include:c6e,render:u6e,decrement:f6e,increment:p6e,cycle:h6e,if:d6e,layout:m6e,block:g6e,raw:y6e,tablerow:O6e,unless:v6e,break:w6e,continue:x6e,echo:_6e,liquid:S6e,"#":k6e};class m8{constructor(e={}){this.renderer=new I5e,this.filters={},this.tags={},this.options=u4e(e),this.parser=new Tf(this),uI(C6e,(n,r)=>this.registerTag(r,n)),uI(e6e,(n,r)=>this.registerFilter(r,n))}parse(e,n){return new Tf(this).parse(e,n)}_render(e,n,r){const i=n instanceof zf?n:new zf(n,this.options,r);return this.renderer.renderTemplates(e,i)}render(e,n,r){return Ir(this,void 0,void 0,function*(){return bu(this._render(e,n,Object.assign(Object.assign({},r),{sync:!1})))})}renderSync(e,n,r){return Ou(this._render(e,n,Object.assign(Object.assign({},r),{sync:!0})))}renderToNodeStream(e,n,r={}){const i=new zf(n,this.options,r);return this.renderer.renderTemplatesToNodeStream(e,i)}_parseAndRender(e,n,r){const i=this.parse(e);return this._render(i,n,r)}parseAndRender(e,n,r){return Ir(this,void 0,void 0,function*(){return bu(this._parseAndRender(e,n,Object.assign(Object.assign({},r),{sync:!1})))})}parseAndRenderSync(e,n,r){return Ou(this._parseAndRender(e,n,Object.assign(Object.assign({},r),{sync:!0})))}_parsePartialFile(e,n,r){return new Tf(this).parseFile(e,n,zh.Partials,r)}_parseLayoutFile(e,n,r){return new Tf(this).parseFile(e,n,zh.Layouts,r)}_parseFile(e,n,r,i){return new Tf(this).parseFile(e,n,r,i)}parseFile(e,n){return Ir(this,void 0,void 0,function*(){return bu(new Tf(this).parseFile(e,!1,n))})}parseFileSync(e,n){return Ou(new Tf(this).parseFile(e,!0,n))}*_renderFile(e,n,r){const i=yield this._parseFile(e,r.sync,r.lookupType);return yield this._render(i,n,r)}renderFile(e,n,r){return Ir(this,void 0,void 0,function*(){return bu(this._renderFile(e,n,Object.assign(Object.assign({},r),{sync:!1})))})}renderFileSync(e,n,r){return Ou(this._renderFile(e,n,Object.assign(Object.assign({},r),{sync:!0})))}renderFileToNodeStream(e,n,r){return Ir(this,void 0,void 0,function*(){const i=yield this.parseFile(e);return this.renderToNodeStream(i,n,r)})}_evalValue(e,n){const r=new io(e,this),i=n instanceof zf?n:new zf(n,this.options);return r.value(i)}evalValue(e,n){return Ir(this,void 0,void 0,function*(){return bu(this._evalValue(e,n))})}evalValueSync(e,n){return Ou(this._evalValue(e,n))}registerFilter(e,n){this.filters[e]=n}registerTag(e,n){this.tags[e]=Qr(n)?n:m4e(n)}plugin(e){return e.call(this,m8)}express(){const e=this;let n=!0;return function(r,i,s){if(n){n=!1;const o=tv(this.root);e.options.root.unshift(...o),e.options.layouts.unshift(...o),e.options.partials.unshift(...o)}e.renderFile(r,i).then(o=>s(null,o),s)}}analyze(e,n={}){return Ir(this,void 0,void 0,function*(){return uc(e,n)})}analyzeSync(e,n={}){return cc(e,n)}parseAndAnalyze(e,n,r={}){return Ir(this,void 0,void 0,function*(){return uc(this.parse(e,n),r)})}parseAndAnalyzeSync(e,n,r={}){return cc(this.parse(e,n),r)}variables(e,n={}){return Ir(this,void 0,void 0,function*(){const r=yield uc(Ct(e)?this.parse(e):e,n);return Object.keys(r.variables)})}variablesSync(e,n={}){const r=cc(Ct(e)?this.parse(e):e,n);return Object.keys(r.variables)}fullVariables(e,n={}){return Ir(this,void 0,void 0,function*(){const r=yield uc(Ct(e)?this.parse(e):e,n);return Array.from(new Set(Object.values(r.variables).flatMap(i=>i.map(s=>String(s)))))})}fullVariablesSync(e,n={}){const r=cc(Ct(e)?this.parse(e):e,n);return Array.from(new Set(Object.values(r.variables).flatMap(i=>i.map(s=>String(s)))))}variableSegments(e,n={}){return Ir(this,void 0,void 0,function*(){const r=yield uc(Ct(e)?this.parse(e):e,n);return Array.from(Ub(Object.values(r.variables).flatMap(i=>i.map(s=>s.toArray()))))})}variableSegmentsSync(e,n={}){const r=cc(Ct(e)?this.parse(e):e,n);return Array.from(Ub(Object.values(r.variables).flatMap(i=>i.map(s=>s.toArray()))))}globalVariables(e,n={}){return Ir(this,void 0,void 0,function*(){const r=yield uc(Ct(e)?this.parse(e):e,n);return Object.keys(r.globals)})}globalVariablesSync(e,n={}){const r=cc(Ct(e)?this.parse(e):e,n);return Object.keys(r.globals)}globalFullVariables(e,n={}){return Ir(this,void 0,void 0,function*(){const r=yield uc(Ct(e)?this.parse(e):e,n);return Array.from(new Set(Object.values(r.globals).flatMap(i=>i.map(s=>String(s)))))})}globalFullVariablesSync(e,n={}){const r=cc(Ct(e)?this.parse(e):e,n);return Array.from(new Set(Object.values(r.globals).flatMap(i=>i.map(s=>String(s)))))}globalVariableSegments(e,n={}){return Ir(this,void 0,void 0,function*(){const r=yield uc(Ct(e)?this.parse(e):e,n);return Array.from(Ub(Object.values(r.globals).flatMap(i=>i.map(s=>s.toArray()))))})}globalVariableSegmentsSync(e,n={}){const r=cc(Ct(e)?this.parse(e):e,n);return Array.from(Ub(Object.values(r.globals).flatMap(i=>i.map(s=>s.toArray()))))}}function g8(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ud=g8();function PW(t){ud=t}var Fg={exec:()=>null};function nn(t,e=""){let n=typeof t=="string"?t:t.source,r={replace:(i,s)=>{let o=typeof s=="string"?s:s.source;return o=o.replace(Yi.caret,"$1"),n=n.replace(i,o),r},getRegex:()=>new RegExp(n,e)};return r}var A6e=(()=>{try{return!!new RegExp("(?<=1)(?/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},E6e=/^(?:[ \t]*(?:\n|$))+/,T6e=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,D6e=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ry=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,P6e=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,y8=/(?:[*+-]|\d{1,9}[.)])/,RW=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,IW=nn(RW).replace(/bull/g,y8).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),R6e=nn(RW).replace(/bull/g,y8).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),b8=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,I6e=/^[^\n]+/,O8=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,F6e=nn(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",O8).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),$6e=nn(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,y8).getRegex(),y_="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",v8=/|$))/,M6e=nn("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",v8).replace("tag",y_).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),FW=nn(b8).replace("hr",Ry).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",y_).getRegex(),L6e=nn(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",FW).getRegex(),w8={blockquote:L6e,code:T6e,def:F6e,fences:D6e,heading:P6e,hr:Ry,html:M6e,lheading:IW,list:$6e,newline:E6e,paragraph:FW,table:Fg,text:I6e},MI=nn("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ry).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",y_).getRegex(),N6e={...w8,lheading:R6e,table:MI,paragraph:nn(b8).replace("hr",Ry).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",MI).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",y_).getRegex()},Q6e={...w8,html:nn(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",v8).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Fg,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:nn(b8).replace("hr",Ry).replace("heading",` *#{1,6} *[^ ]`).replace("lheading",IW).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},B6e=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,z6e=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,$W=/^( {2,}|\\)\n(?!\s*$)/,U6e=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`+)[^`]+\k(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",A6e?"(?`+)[^`]+\k(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),NW=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,X6e=nn(NW,"u").replace(/punct/g,b_).getRegex(),W6e=nn(NW,"u").replace(/punct/g,LW).getRegex(),QW="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Y6e=nn(QW,"gu").replace(/notPunctSpace/g,MW).replace(/punctSpace/g,x8).replace(/punct/g,b_).getRegex(),G6e=nn(QW,"gu").replace(/notPunctSpace/g,V6e).replace(/punctSpace/g,q6e).replace(/punct/g,LW).getRegex(),H6e=nn("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,MW).replace(/punctSpace/g,x8).replace(/punct/g,b_).getRegex(),K6e=nn(/\\(punct)/,"gu").replace(/punct/g,b_).getRegex(),J6e=nn(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),eAe=nn(v8).replace("(?:-->|$)","-->").getRegex(),tAe=nn("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",eAe).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),pw=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,nAe=nn(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",pw).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),BW=nn(/^!?\[(label)\]\[(ref)\]/).replace("label",pw).replace("ref",O8).getRegex(),zW=nn(/^!?\[(ref)\](?:\[\])?/).replace("ref",O8).getRegex(),rAe=nn("reflink|nolink(?!\\()","g").replace("reflink",BW).replace("nolink",zW).getRegex(),LI=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,_8={_backpedal:Fg,anyPunctuation:K6e,autolink:J6e,blockSkip:Z6e,br:$W,code:z6e,del:Fg,emStrongLDelim:X6e,emStrongRDelimAst:Y6e,emStrongRDelimUnd:H6e,escape:B6e,link:nAe,nolink:zW,punctuation:j6e,reflink:BW,reflinkSearch:rAe,tag:tAe,text:U6e,url:Fg},iAe={..._8,link:nn(/^!?\[(label)\]\((.*?)\)/).replace("label",pw).getRegex(),reflink:nn(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",pw).getRegex()},B4={..._8,emStrongRDelimAst:G6e,emStrongLDelim:W6e,url:nn(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",LI).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:nn(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},NI=t=>oAe[t];function Jl(t,e){if(e){if(Yi.escapeTest.test(t))return t.replace(Yi.escapeReplace,NI)}else if(Yi.escapeTestNoEncode.test(t))return t.replace(Yi.escapeReplaceNoEncode,NI);return t}function QI(t){try{t=encodeURI(t).replace(Yi.percentDecode,"%")}catch{return null}return t}function BI(t,e){let n=t.replace(Yi.findPipe,(s,o,a)=>{let l=!1,u=o;for(;--u>=0&&a[u]==="\\";)l=!l;return l?"|":" |"}),r=n.split(Yi.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length0?-2:-1}function zI(t,e,n,r,i){let s=e.href,o=e.title||null,a=t[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:s,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}function lAe(t,e,n){let r=t.match(n.other.indentCodeCompensation);if(r===null)return e;let i=r[1];return e.split(` `).map(s=>{let o=s.match(n.other.beginningSpace);if(o===null)return s;let[a]=o;return a.length>=i.length?s.slice(i.length):s}).join(` `)}var mw=class{options;rules;lexer;constructor(e){this.options=e||ud}space(e){let n=this.rules.block.newline.exec(e);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(e){let n=this.rules.block.code.exec(e);if(n){let r=n[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?r:Em(r,` `)}}}fences(e){let n=this.rules.block.fences.exec(e);if(n){let r=n[0],i=lAe(r,n[3]||"",this.rules);return{type:"code",raw:r,lang:n[2]?n[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):n[2],text:i}}}heading(e){let n=this.rules.block.heading.exec(e);if(n){let r=n[2].trim();if(this.rules.other.endingHash.test(r)){let i=Em(r,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(r=i.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){let n=this.rules.block.hr.exec(e);if(n)return{type:"hr",raw:Em(n[0],` `)}}blockquote(e){let n=this.rules.block.blockquote.exec(e);if(n){let r=Em(n[0],` `).split(` `),i="",s="",o=[];for(;r.length>0;){let a=!1,l=[],u;for(u=0;u1,s={type:"list",raw:"",ordered:i,start:i?+r.slice(0,-1):"",loose:!1,items:[]};r=i?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=i?r:"[*+-]");let o=this.rules.other.listItemRegex(r),a=!1;for(;e;){let u=!1,c="",f="";if(!(n=o.exec(e))||this.rules.block.hr.test(e))break;c=n[0],e=e.substring(c.length);let h=n[2].split(` `,1)[0].replace(this.rules.other.listReplaceTabs,y=>" ".repeat(3*y.length)),d=e.split(` `,1)[0],p=!h.trim(),m=0;if(this.options.pedantic?(m=2,f=h.trimStart()):p?m=n[1].length+1:(m=n[2].search(this.rules.other.nonSpaceChar),m=m>4?1:m,f=h.slice(m),m+=n[1].length),p&&this.rules.other.blankLine.test(d)&&(c+=d+` `,e=e.substring(d.length+1),u=!0),!u){let y=this.rules.other.nextBulletRegex(m),O=this.rules.other.hrRegex(m),v=this.rules.other.fencesBeginRegex(m),w=this.rules.other.headingBeginRegex(m),x=this.rules.other.htmlBeginRegex(m);for(;e;){let S=e.split(` `,1)[0],_;if(d=S,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting," "),_=d):_=d.replace(this.rules.other.tabCharGlobal," "),v.test(d)||w.test(d)||x.test(d)||y.test(d)||O.test(d))break;if(_.search(this.rules.other.nonSpaceChar)>=m||!d.trim())f+=` `+_.slice(m);else{if(p||h.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||v.test(h)||w.test(h)||O.test(h))break;f+=` `+d}!p&&!d.trim()&&(p=!0),c+=S+` `,e=e.substring(S.length+1),h=_.slice(m)}}s.loose||(a?s.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(a=!0));let g=null;this.options.gfm&&(g=this.rules.other.listIsTask.exec(f),g&&(f=f.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:c,task:!!g,loose:!1,text:f,tokens:[]}),s.raw+=c}let l=s.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let u of s.items){if(this.lexer.state.top=!1,u.tokens=this.lexer.blockTokens(u.text,[]),u.task){let c=this.rules.other.listTaskCheckbox.exec(u.raw);if(c){let f={type:"checkbox",raw:c[0]+" ",checked:c[0]!=="[ ]"};u.checked=f.checked,s.loose?u.tokens[0]&&["paragraph","text"].includes(u.tokens[0].type)&&"tokens"in u.tokens[0]&&u.tokens[0].tokens?(u.tokens[0].raw=f.raw+u.tokens[0].raw,u.tokens[0].text=f.raw+u.tokens[0].text,u.tokens[0].tokens.unshift(f)):u.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):u.tokens.unshift(f)}}if(!s.loose){let c=u.tokens.filter(h=>h.type==="space"),f=c.length>0&&c.some(h=>this.rules.other.anyLine.test(h.raw));s.loose=f}}if(s.loose)for(let u of s.items){u.loose=!0;for(let c of u.tokens)c.type==="text"&&(c.type="paragraph")}return s}}html(e){let n=this.rules.block.html.exec(e);if(n)return{type:"html",block:!0,raw:n[0],pre:n[1]==="pre"||n[1]==="script"||n[1]==="style",text:n[0]}}def(e){let n=this.rules.block.def.exec(e);if(n){let r=n[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=n[2]?n[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):n[3];return{type:"def",tag:r,raw:n[0],href:i,title:s}}}table(e){let n=this.rules.block.table.exec(e);if(!n||!this.rules.other.tableDelimiter.test(n[2]))return;let r=BI(n[1]),i=n[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=n[3]?.trim()?n[3].replace(this.rules.other.tableRowBlankLine,"").split(` `):[],o={type:"table",raw:n[0],header:[],align:[],rows:[]};if(r.length===i.length){for(let a of i)this.rules.other.tableAlignRight.test(a)?o.align.push("right"):this.rules.other.tableAlignCenter.test(a)?o.align.push("center"):this.rules.other.tableAlignLeft.test(a)?o.align.push("left"):o.align.push(null);for(let a=0;a({text:l,tokens:this.lexer.inline(l),header:!1,align:o.align[u]})));return o}}lheading(e){let n=this.rules.block.lheading.exec(e);if(n)return{type:"heading",raw:n[0],depth:n[2].charAt(0)==="="?1:2,text:n[1],tokens:this.lexer.inline(n[1])}}paragraph(e){let n=this.rules.block.paragraph.exec(e);if(n){let r=n[1].charAt(n[1].length-1)===` `?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:r,tokens:this.lexer.inline(r)}}}text(e){let n=this.rules.block.text.exec(e);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(e){let n=this.rules.inline.escape.exec(e);if(n)return{type:"escape",raw:n[0],text:n[1]}}tag(e){let n=this.rules.inline.tag.exec(e);if(n)return!this.lexer.state.inLink&&this.rules.other.startATag.test(n[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:n[0]}}link(e){let n=this.rules.inline.link.exec(e);if(n){let r=n[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let o=Em(r.slice(0,-1),"\\");if((r.length-o.length)%2===0)return}else{let o=aAe(n[2],"()");if(o===-2)return;if(o>-1){let a=(n[0].indexOf("!")===0?5:4)+n[1].length+o;n[2]=n[2].substring(0,o),n[0]=n[0].substring(0,a).trim(),n[3]=""}}let i=n[2],s="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(i);o&&(i=o[1],s=o[3])}else s=n[3]?n[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i=i.slice(1):i=i.slice(1,-1)),zI(n,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer,this.rules)}}reflink(e,n){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let i=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=n[i.toLowerCase()];if(!s){let o=r[0].charAt(0);return{type:"text",raw:o,text:o}}return zI(r,s,r[0],this.lexer,this.rules)}}emStrong(e,n,r=""){let i=this.rules.inline.emStrongLDelim.exec(e);if(!(!i||i[3]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[2])||!r||this.rules.inline.punctuation.exec(r))){let s=[...i[0]].length-1,o,a,l=s,u=0,c=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,n=n.slice(-1*e.length+s);(i=c.exec(n))!=null;){if(o=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!o)continue;if(a=[...o].length,i[3]||i[4]){l+=a;continue}else if((i[5]||i[6])&&s%3&&!((s+a)%3)){u+=a;continue}if(l-=a,l>0)continue;a=Math.min(a,a+l+u);let f=[...i[0]][0].length,h=e.slice(0,s+i.index+f+a);if(Math.min(s,a)%2){let p=h.slice(1,-1);return{type:"em",raw:h,text:p,tokens:this.lexer.inlineTokens(p)}}let d=h.slice(2,-2);return{type:"strong",raw:h,text:d,tokens:this.lexer.inlineTokens(d)}}}}codespan(e){let n=this.rules.inline.code.exec(e);if(n){let r=n[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(r),s=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return i&&s&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:n[0],text:r}}}br(e){let n=this.rules.inline.br.exec(e);if(n)return{type:"br",raw:n[0]}}del(e){let n=this.rules.inline.del.exec(e);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(e){let n=this.rules.inline.autolink.exec(e);if(n){let r,i;return n[2]==="@"?(r=n[1],i="mailto:"+r):(r=n[1],i=r),{type:"link",raw:n[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}url(e){let n;if(n=this.rules.inline.url.exec(e)){let r,i;if(n[2]==="@")r=n[0],i="mailto:"+r;else{let s;do s=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])?.[0]??"";while(s!==n[0]);r=n[0],n[1]==="www."?i="http://"+n[0]:i=n[0]}return{type:"link",raw:n[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let n=this.rules.inline.text.exec(e);if(n){let r=this.lexer.state.inRawBlock;return{type:"text",raw:n[0],text:n[0],escaped:r}}}},Ko=class z4{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||ud,this.options.tokenizer=this.options.tokenizer||new mw,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let n={other:Yi,block:jb.normal,inline:Am.normal};this.options.pedantic?(n.block=jb.pedantic,n.inline=Am.pedantic):this.options.gfm&&(n.block=jb.gfm,this.options.breaks?n.inline=Am.breaks:n.inline=Am.gfm),this.tokenizer.rules=n}static get rules(){return{block:jb,inline:Am}}static lex(e,n){return new z4(n).lex(e)}static lexInline(e,n){return new z4(n).inlineTokens(e)}lex(e){e=e.replace(Yi.carriageReturn,` `),this.blockTokens(e,this.tokens);for(let n=0;n(i=o.call({lexer:this},e,n))?(e=e.substring(i.raw.length),n.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let o=n.at(-1);i.raw.length===1&&o!==void 0?o.raw+=` `:n.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(` `)?"":` `)+i.raw,o.text+=` `+i.text,this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let o=n.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(` `)?"":` `)+i.raw,o.text+=` `+i.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},n.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),n.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),n.push(i);continue}let s=e;if(this.options.extensions?.startBlock){let o=1/0,a=e.slice(1),l;this.options.extensions.startBlock.forEach(u=>{l=u.call({lexer:this},a),typeof l=="number"&&l>=0&&(o=Math.min(o,l))}),o<1/0&&o>=0&&(s=e.substring(0,o+1))}if(this.state.top&&(i=this.tokenizer.paragraph(s))){let o=n.at(-1);r&&o?.type==="paragraph"?(o.raw+=(o.raw.endsWith(` `)?"":` `)+i.raw,o.text+=` `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i),r=s.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let o=n.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(` `)?"":` `)+i.raw,o.text+=` `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):n.push(i);continue}if(e){let o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){let r=e,i=null;if(this.tokens.links){let l=Object.keys(this.tokens.links);if(l.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)l.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let s;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)s=i[2]?i[2].length:0,r=r.slice(0,i.index+s)+"["+"a".repeat(i[0].length-s-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let o=!1,a="";for(;e;){o||(a=""),o=!1;let l;if(this.options.extensions?.inline?.some(c=>(l=c.call({lexer:this},e,n))?(e=e.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.escape(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.tag(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.link(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(l.raw.length);let c=n.at(-1);l.type==="text"&&c?.type==="text"?(c.raw+=l.raw,c.text+=l.text):n.push(l);continue}if(l=this.tokenizer.emStrong(e,r,a)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.codespan(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.br(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.del(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.autolink(e)){e=e.substring(l.raw.length),n.push(l);continue}if(!this.state.inLink&&(l=this.tokenizer.url(e))){e=e.substring(l.raw.length),n.push(l);continue}let u=e;if(this.options.extensions?.startInline){let c=1/0,f=e.slice(1),h;this.options.extensions.startInline.forEach(d=>{h=d.call({lexer:this},f),typeof h=="number"&&h>=0&&(c=Math.min(c,h))}),c<1/0&&c>=0&&(u=e.substring(0,c+1))}if(l=this.tokenizer.inlineText(u)){e=e.substring(l.raw.length),l.raw.slice(-1)!=="_"&&(a=l.raw.slice(-1)),o=!0;let c=n.at(-1);c?.type==="text"?(c.raw+=l.raw,c.text+=l.text):n.push(l);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return n}},gw=class{options;parser;constructor(t){this.options=t||ud}space(t){return""}code({text:t,lang:e,escaped:n}){let r=(e||"").match(Yi.notSpaceStart)?.[0],i=t.replace(Yi.endingNewline,"")+` `;return r?'
'+(n?i:Jl(i,!0))+`
`:"
"+(n?i:Jl(i,!0))+`
`}blockquote({tokens:t}){return`
${this.parser.parse(t)}
`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`${this.parser.parseInline(t)} `}hr(t){return`
`}list(t){let e=t.ordered,n=t.start,r="";for(let o=0;o `+r+" `}listitem(t){return`
  • ${this.parser.parse(t.tokens)}
  • `}checkbox({checked:t}){return" '}paragraph({tokens:t}){return`

    ${this.parser.parseInline(t)}

    `}table(t){let e="",n="";for(let i=0;i${r}`),` `+e+` `+r+`
    `}tablerow({text:t}){return` ${t} `}tablecell(t){let e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+` `}strong({tokens:t}){return`${this.parser.parseInline(t)}`}em({tokens:t}){return`${this.parser.parseInline(t)}`}codespan({text:t}){return`${Jl(t,!0)}`}br(t){return"
    "}del({tokens:t}){return`${this.parser.parseInline(t)}`}link({href:t,title:e,tokens:n}){let r=this.parser.parseInline(n),i=QI(t);if(i===null)return r;t=i;let s='
    ",s}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=QI(t);if(i===null)return Jl(n);t=i;let s=`${n}{let a=s[o].flat(1/0);r=r.concat(this.walkTokens(a,n))}):s.tokens&&(r=r.concat(this.walkTokens(s.tokens,n)))}}return r}use(...e){let n=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{let i={...r};if(i.async=this.defaults.async||i.async||!1,r.extensions&&(r.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let o=n.renderers[s.name];o?n.renderers[s.name]=function(...a){let l=s.renderer.apply(this,a);return l===!1&&(l=o.apply(this,a)),l}:n.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=n[s.level];o?o.unshift(s.tokenizer):n[s.level]=[s.tokenizer],s.start&&(s.level==="block"?n.startBlock?n.startBlock.push(s.start):n.startBlock=[s.start]:s.level==="inline"&&(n.startInline?n.startInline.push(s.start):n.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(n.childTokens[s.name]=s.childTokens)}),i.extensions=n),r.renderer){let s=this.defaults.renderer||new gw(this.defaults);for(let o in r.renderer){if(!(o in s))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let a=o,l=r.renderer[a],u=s[a];s[a]=(...c)=>{let f=l.apply(s,c);return f===!1&&(f=u.apply(s,c)),f||""}}i.renderer=s}if(r.tokenizer){let s=this.defaults.tokenizer||new mw(this.defaults);for(let o in r.tokenizer){if(!(o in s))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let a=o,l=r.tokenizer[a],u=s[a];s[a]=(...c)=>{let f=l.apply(s,c);return f===!1&&(f=u.apply(s,c)),f}}i.tokenizer=s}if(r.hooks){let s=this.defaults.hooks||new cg;for(let o in r.hooks){if(!(o in s))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let a=o,l=r.hooks[a],u=s[a];cg.passThroughHooks.has(o)?s[a]=c=>{if(this.defaults.async&&cg.passThroughHooksRespectAsync.has(o))return(async()=>{let h=await l.call(s,c);return u.call(s,h)})();let f=l.call(s,c);return u.call(s,f)}:s[a]=(...c)=>{if(this.defaults.async)return(async()=>{let h=await l.apply(s,c);return h===!1&&(h=await u.apply(s,c)),h})();let f=l.apply(s,c);return f===!1&&(f=u.apply(s,c)),f}}i.hooks=s}if(r.walkTokens){let s=this.defaults.walkTokens,o=r.walkTokens;i.walkTokens=function(a){let l=[];return l.push(o.call(this,a)),s&&(l=l.concat(s.call(this,a))),l}}this.defaults={...this.defaults,...i}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,n){return Ko.lex(e,n??this.defaults)}parser(e,n){return Jo.parse(e,n??this.defaults)}parseMarkdown(e){return(n,r)=>{let i={...r},s={...this.defaults,...i},o=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&i.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return(async()=>{let a=s.hooks?await s.hooks.preprocess(n):n,l=await(s.hooks?await s.hooks.provideLexer():e?Ko.lex:Ko.lexInline)(a,s),u=s.hooks?await s.hooks.processAllTokens(l):l;s.walkTokens&&await Promise.all(this.walkTokens(u,s.walkTokens));let c=await(s.hooks?await s.hooks.provideParser():e?Jo.parse:Jo.parseInline)(u,s);return s.hooks?await s.hooks.postprocess(c):c})().catch(o);try{s.hooks&&(n=s.hooks.preprocess(n));let a=(s.hooks?s.hooks.provideLexer():e?Ko.lex:Ko.lexInline)(n,s);s.hooks&&(a=s.hooks.processAllTokens(a)),s.walkTokens&&this.walkTokens(a,s.walkTokens);let l=(s.hooks?s.hooks.provideParser():e?Jo.parse:Jo.parseInline)(a,s);return s.hooks&&(l=s.hooks.postprocess(l)),l}catch(a){return o(a)}}}onError(e,n){return r=>{if(r.message+=` Please report this to https://github.com/markedjs/marked.`,e){let i="

    An error occurred:

    "+Jl(r.message+"",!0)+"
    ";return n?Promise.resolve(i):i}if(n)return Promise.reject(r);throw r}}},Uh=new uAe;function bn(t,e){return Uh.parse(t,e)}bn.options=bn.setOptions=function(t){return Uh.setOptions(t),bn.defaults=Uh.defaults,PW(bn.defaults),bn};bn.getDefaults=g8;bn.defaults=ud;bn.use=function(...t){return Uh.use(...t),bn.defaults=Uh.defaults,PW(bn.defaults),bn};bn.walkTokens=function(t,e){return Uh.walkTokens(t,e)};bn.parseInline=Uh.parseInline;bn.Parser=Jo;bn.parser=Jo.parse;bn.Renderer=gw;bn.TextRenderer=S8;bn.Lexer=Ko;bn.lexer=Ko.lex;bn.Tokenizer=mw;bn.Hooks=cg;bn.parse=bn;bn.options;bn.setOptions;bn.use;bn.walkTokens;bn.parseInline;Jo.parse;Ko.lex;const{entries:UW,setPrototypeOf:UI,isFrozen:cAe,getPrototypeOf:fAe,getOwnPropertyDescriptor:hAe}=Object;let{freeze:Ji,seal:Mo,create:j4}=Object,{apply:q4,construct:V4}=typeof Reflect<"u"&&Reflect;Ji||(Ji=function(e){return e});Mo||(Mo=function(e){return e});q4||(q4=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),s=2;s1?n-1:0),i=1;i1?n-1:0),i=1;i2&&arguments[2]!==void 0?arguments[2]:nv;UI&&UI(t,null);let r=e.length;for(;r--;){let i=e[r];if(typeof i=="string"){const s=n(i);s!==i&&(cAe(e)||(e[r]=s),i=s)}t[i]=!0}return t}function bAe(t){for(let e=0;e/gm),_Ae=Mo(/\$\{[\w\W]*/gm),SAe=Mo(/^data-[\-\w.\u00B7-\uFFFF]+$/),kAe=Mo(/^aria-[\-\w]+$/),jW=Mo(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),CAe=Mo(/^(?:\w+script|data):/i),AAe=Mo(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),qW=Mo(/^html$/i),EAe=Mo(/^[a-z][.\w]*(-[.\w]+)+$/i);var WI=Object.freeze({__proto__:null,ARIA_ATTR:kAe,ATTR_WHITESPACE:AAe,CUSTOM_ELEMENT:EAe,DATA_ATTR:SAe,DOCTYPE_NAME:qW,ERB_EXPR:xAe,IS_ALLOWED_URI:jW,IS_SCRIPT_OR_DATA:CAe,MUSTACHE_EXPR:wAe,TMPLIT_EXPR:_Ae});const Im={element:1,text:3,progressingInstruction:7,comment:8,document:9},TAe=function(){return typeof window>"u"?null:window},DAe=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(r=n.getAttribute(i));const s="dompurify"+(r?"#"+r:"");try{return e.createPolicy(s,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},YI=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function VW(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:TAe();const e=be=>VW(be);if(e.version="3.3.0",e.removed=[],!t||!t.document||t.document.nodeType!==Im.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t;const r=n,i=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:o,Node:a,Element:l,NodeFilter:u,NamedNodeMap:c=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:f,DOMParser:h,trustedTypes:d}=t,p=l.prototype,m=Rm(p,"cloneNode"),g=Rm(p,"remove"),y=Rm(p,"nextSibling"),O=Rm(p,"childNodes"),v=Rm(p,"parentNode");if(typeof o=="function"){const be=n.createElement("template");be.content&&be.content.ownerDocument&&(n=be.content.ownerDocument)}let w,x="";const{implementation:S,createNodeIterator:_,createDocumentFragment:k,getElementsByTagName:C}=n,{importNode:D}=r;let A=YI();e.isSupported=typeof UW=="function"&&typeof v=="function"&&S&&S.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:E,ERB_EXPR:T,TMPLIT_EXPR:R,DATA_ATTR:$,ARIA_ATTR:Q,IS_SCRIPT_OR_DATA:B,ATTR_WHITESPACE:q,CUSTOM_ELEMENT:z}=WI;let{IS_ALLOWED_URI:ee}=WI,W=null;const K=Dt({},[...qI,...q3,...V3,...Z3,...VI]);let H=null;const J=Dt({},[...ZI,...X3,...XI,...Vb]);let Y=Object.seal(j4(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Z=null,he=null;const me=Object.seal(j4(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let te=!0,le=!0,ve=!1,xe=!0,ue=!1,Ee=!0,Le=!1,qe=!1,Fe=!1,it=!1,St=!1,Se=!1,gt=!0,Kt=!1;const Rn="user-content-";let Ri=!0,Bn=!1,er={},jt=null;const jr=Dt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Zl=null;const yd=Dt({},["audio","video","img","source","image","track"]);let vf=null;const bd=Dt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),zo="http://www.w3.org/1998/Math/MathML",Ca="http://www.w3.org/2000/svg",ns="http://www.w3.org/1999/xhtml";let oo=ns,oc=!1,wf=null;const cm=Dt({},[zo,Ca,ns],U3);let un=Dt({},["mi","mo","mn","ms","mtext"]),Yn=Dt({},["annotation-xml"]);const qr=Dt({},["title","style","font","a","script"]);let In=null;const Ii=["application/xhtml+xml","text/html"],rs="text/html";let qt=null,Vt=null;const Rr=n.createElement("form"),ti=function(j){return j instanceof RegExp||j instanceof Function},Aa=function(){let j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Vt&&Vt===j)){if((!j||typeof j!="object")&&(j={}),j=eu(j),In=Ii.indexOf(j.PARSER_MEDIA_TYPE)===-1?rs:j.PARSER_MEDIA_TYPE,qt=In==="application/xhtml+xml"?U3:nv,W=Vo(j,"ALLOWED_TAGS")?Dt({},j.ALLOWED_TAGS,qt):K,H=Vo(j,"ALLOWED_ATTR")?Dt({},j.ALLOWED_ATTR,qt):J,wf=Vo(j,"ALLOWED_NAMESPACES")?Dt({},j.ALLOWED_NAMESPACES,U3):cm,vf=Vo(j,"ADD_URI_SAFE_ATTR")?Dt(eu(bd),j.ADD_URI_SAFE_ATTR,qt):bd,Zl=Vo(j,"ADD_DATA_URI_TAGS")?Dt(eu(yd),j.ADD_DATA_URI_TAGS,qt):yd,jt=Vo(j,"FORBID_CONTENTS")?Dt({},j.FORBID_CONTENTS,qt):jr,Z=Vo(j,"FORBID_TAGS")?Dt({},j.FORBID_TAGS,qt):eu({}),he=Vo(j,"FORBID_ATTR")?Dt({},j.FORBID_ATTR,qt):eu({}),er=Vo(j,"USE_PROFILES")?j.USE_PROFILES:!1,te=j.ALLOW_ARIA_ATTR!==!1,le=j.ALLOW_DATA_ATTR!==!1,ve=j.ALLOW_UNKNOWN_PROTOCOLS||!1,xe=j.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ue=j.SAFE_FOR_TEMPLATES||!1,Ee=j.SAFE_FOR_XML!==!1,Le=j.WHOLE_DOCUMENT||!1,it=j.RETURN_DOM||!1,St=j.RETURN_DOM_FRAGMENT||!1,Se=j.RETURN_TRUSTED_TYPE||!1,Fe=j.FORCE_BODY||!1,gt=j.SANITIZE_DOM!==!1,Kt=j.SANITIZE_NAMED_PROPS||!1,Ri=j.KEEP_CONTENT!==!1,Bn=j.IN_PLACE||!1,ee=j.ALLOWED_URI_REGEXP||jW,oo=j.NAMESPACE||ns,un=j.MATHML_TEXT_INTEGRATION_POINTS||un,Yn=j.HTML_INTEGRATION_POINTS||Yn,Y=j.CUSTOM_ELEMENT_HANDLING||{},j.CUSTOM_ELEMENT_HANDLING&&ti(j.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Y.tagNameCheck=j.CUSTOM_ELEMENT_HANDLING.tagNameCheck),j.CUSTOM_ELEMENT_HANDLING&&ti(j.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Y.attributeNameCheck=j.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),j.CUSTOM_ELEMENT_HANDLING&&typeof j.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Y.allowCustomizedBuiltInElements=j.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),ue&&(le=!1),St&&(it=!0),er&&(W=Dt({},VI),H=[],er.html===!0&&(Dt(W,qI),Dt(H,ZI)),er.svg===!0&&(Dt(W,q3),Dt(H,X3),Dt(H,Vb)),er.svgFilters===!0&&(Dt(W,V3),Dt(H,X3),Dt(H,Vb)),er.mathMl===!0&&(Dt(W,Z3),Dt(H,XI),Dt(H,Vb))),j.ADD_TAGS&&(typeof j.ADD_TAGS=="function"?me.tagCheck=j.ADD_TAGS:(W===K&&(W=eu(W)),Dt(W,j.ADD_TAGS,qt))),j.ADD_ATTR&&(typeof j.ADD_ATTR=="function"?me.attributeCheck=j.ADD_ATTR:(H===J&&(H=eu(H)),Dt(H,j.ADD_ATTR,qt))),j.ADD_URI_SAFE_ATTR&&Dt(vf,j.ADD_URI_SAFE_ATTR,qt),j.FORBID_CONTENTS&&(jt===jr&&(jt=eu(jt)),Dt(jt,j.FORBID_CONTENTS,qt)),Ri&&(W["#text"]=!0),Le&&Dt(W,["html","head","body"]),W.table&&(Dt(W,["tbody"]),delete Z.tbody),j.TRUSTED_TYPES_POLICY){if(typeof j.TRUSTED_TYPES_POLICY.createHTML!="function")throw Pm('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof j.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Pm('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=j.TRUSTED_TYPES_POLICY,x=w.createHTML("")}else w===void 0&&(w=DAe(d,i)),w!==null&&typeof x=="string"&&(x=w.createHTML(""));Ji&&Ji(j),Vt=j}},Xl=Dt({},[...q3,...V3,...OAe]),is=Dt({},[...Z3,...vAe]),tr=function(j){let se=v(j);(!se||!se.tagName)&&(se={namespaceURI:oo,tagName:"template"});const we=nv(j.tagName),Bt=nv(se.tagName);return wf[j.namespaceURI]?j.namespaceURI===Ca?se.namespaceURI===ns?we==="svg":se.namespaceURI===zo?we==="svg"&&(Bt==="annotation-xml"||un[Bt]):!!Xl[we]:j.namespaceURI===zo?se.namespaceURI===ns?we==="math":se.namespaceURI===Ca?we==="math"&&Yn[Bt]:!!is[we]:j.namespaceURI===ns?se.namespaceURI===Ca&&!Yn[Bt]||se.namespaceURI===zo&&!un[Bt]?!1:!is[we]&&(qr[we]||!Xl[we]):!!(In==="application/xhtml+xml"&&wf[j.namespaceURI]):!1},xn=function(j){Tm(e.removed,{element:j});try{v(j).removeChild(j)}catch{g(j)}},xr=function(j,se){try{Tm(e.removed,{attribute:se.getAttributeNode(j),from:se})}catch{Tm(e.removed,{attribute:null,from:se})}if(se.removeAttribute(j),j==="is")if(it||St)try{xn(se)}catch{}else try{se.setAttribute(j,"")}catch{}},Fi=function(j){let se=null,we=null;if(Fe)j=""+j;else{const Rt=j3(j,/^[\r\n\t ]+/);we=Rt&&Rt[0]}In==="application/xhtml+xml"&&oo===ns&&(j=''+j+"");const Bt=w?w.createHTML(j):j;if(oo===ns)try{se=new h().parseFromString(Bt,In)}catch{}if(!se||!se.documentElement){se=S.createDocument(oo,"template",null);try{se.documentElement.innerHTML=oc?x:Bt}catch{}}const rn=se.body||se.documentElement;return j&&we&&rn.insertBefore(n.createTextNode(we),rn.childNodes[0]||null),oo===ns?C.call(se,Le?"html":"body")[0]:Le?se.documentElement:rn},ao=function(j){return _.call(j.ownerDocument||j,j,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Wl=function(j){return j instanceof f&&(typeof j.nodeName!="string"||typeof j.textContent!="string"||typeof j.removeChild!="function"||!(j.attributes instanceof c)||typeof j.removeAttribute!="function"||typeof j.setAttribute!="function"||typeof j.namespaceURI!="string"||typeof j.insertBefore!="function"||typeof j.hasChildNodes!="function")},Uo=function(j){return typeof a=="function"&&j instanceof a};function ie(be,j,se){qb(be,we=>{we.call(e,j,se,Vt)})}const ye=function(j){let se=null;if(ie(A.beforeSanitizeElements,j,null),Wl(j))return xn(j),!0;const we=qt(j.nodeName);if(ie(A.uponSanitizeElement,j,{tagName:we,allowedTags:W}),Ee&&j.hasChildNodes()&&!Uo(j.firstElementChild)&&Mi(/<[/\w!]/g,j.innerHTML)&&Mi(/<[/\w!]/g,j.textContent)||j.nodeType===Im.progressingInstruction||Ee&&j.nodeType===Im.comment&&Mi(/<[/\w]/g,j.data))return xn(j),!0;if(!(me.tagCheck instanceof Function&&me.tagCheck(we))&&(!W[we]||Z[we])){if(!Z[we]&&Qe(we)&&(Y.tagNameCheck instanceof RegExp&&Mi(Y.tagNameCheck,we)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(we)))return!1;if(Ri&&!jt[we]){const Bt=v(j)||j.parentNode,rn=O(j)||j.childNodes;if(rn&&Bt){const Rt=rn.length;for(let nr=Rt-1;nr>=0;--nr){const Fs=m(rn[nr],!0);Fs.__removalCount=(j.__removalCount||0)+1,Bt.insertBefore(Fs,y(j))}}}return xn(j),!0}return j instanceof l&&!tr(j)||(we==="noscript"||we==="noembed"||we==="noframes")&&Mi(/<\/no(script|embed|frames)/i,j.innerHTML)?(xn(j),!0):(ue&&j.nodeType===Im.text&&(se=j.textContent,qb([E,T,R],Bt=>{se=Dm(se,Bt," ")}),j.textContent!==se&&(Tm(e.removed,{element:j.cloneNode()}),j.textContent=se)),ie(A.afterSanitizeElements,j,null),!1)},Re=function(j,se,we){if(gt&&(se==="id"||se==="name")&&(we in n||we in Rr))return!1;if(!(le&&!he[se]&&Mi($,se))){if(!(te&&Mi(Q,se))){if(!(me.attributeCheck instanceof Function&&me.attributeCheck(se,j))){if(!H[se]||he[se]){if(!(Qe(j)&&(Y.tagNameCheck instanceof RegExp&&Mi(Y.tagNameCheck,j)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(j))&&(Y.attributeNameCheck instanceof RegExp&&Mi(Y.attributeNameCheck,se)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(se,j))||se==="is"&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&Mi(Y.tagNameCheck,we)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(we))))return!1}else if(!vf[se]){if(!Mi(ee,Dm(we,q,""))){if(!((se==="src"||se==="xlink:href"||se==="href")&&j!=="script"&&mAe(we,"data:")===0&&Zl[j])){if(!(ve&&!Mi(B,Dm(we,q,"")))){if(we)return!1}}}}}}}return!0},Qe=function(j){return j!=="annotation-xml"&&j3(j,z)},Ne=function(j){ie(A.beforeSanitizeAttributes,j,null);const{attributes:se}=j;if(!se||Wl(j))return;const we={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:H,forceKeepAttr:void 0};let Bt=se.length;for(;Bt--;){const rn=se[Bt],{name:Rt,namespaceURI:nr,value:Fs}=rn,Ea=qt(Rt),hi=Fs;let zn=Rt==="value"?hi:gAe(hi);if(we.attrName=Ea,we.attrValue=zn,we.keepAttr=!0,we.forceKeepAttr=void 0,ie(A.uponSanitizeAttribute,j,we),zn=we.attrValue,Kt&&(Ea==="id"||Ea==="name")&&(xr(Rt,j),zn=Rn+zn),Ee&&Mi(/((--!?|])>)|<\/(style|title|textarea)/i,zn)){xr(Rt,j);continue}if(Ea==="attributename"&&j3(zn,"href")){xr(Rt,j);continue}if(we.forceKeepAttr)continue;if(!we.keepAttr){xr(Rt,j);continue}if(!xe&&Mi(/\/>/i,zn)){xr(Rt,j);continue}ue&&qb([E,T,R],yT=>{zn=Dm(zn,yT," ")});const zy=qt(j.nodeName);if(!Re(zy,Ea,zn)){xr(Rt,j);continue}if(w&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!nr)switch(d.getAttributeType(zy,Ea)){case"TrustedHTML":{zn=w.createHTML(zn);break}case"TrustedScriptURL":{zn=w.createScriptURL(zn);break}}if(zn!==hi)try{nr?j.setAttributeNS(nr,Rt,zn):j.setAttribute(Rt,zn),Wl(j)?xn(j):jI(e.removed)}catch{xr(Rt,j)}}ie(A.afterSanitizeAttributes,j,null)},Je=function be(j){let se=null;const we=ao(j);for(ie(A.beforeSanitizeShadowDOM,j,null);se=we.nextNode();)ie(A.uponSanitizeShadowNode,se,null),ye(se),Ne(se),se.content instanceof s&&be(se.content);ie(A.afterSanitizeShadowDOM,j,null)};return e.sanitize=function(be){let j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},se=null,we=null,Bt=null,rn=null;if(oc=!be,oc&&(be=""),typeof be!="string"&&!Uo(be))if(typeof be.toString=="function"){if(be=be.toString(),typeof be!="string")throw Pm("dirty is not a string, aborting")}else throw Pm("toString is not a function");if(!e.isSupported)return be;if(qe||Aa(j),e.removed=[],typeof be=="string"&&(Bn=!1),Bn){if(be.nodeName){const Fs=qt(be.nodeName);if(!W[Fs]||Z[Fs])throw Pm("root node is forbidden and cannot be sanitized in-place")}}else if(be instanceof a)se=Fi(""),we=se.ownerDocument.importNode(be,!0),we.nodeType===Im.element&&we.nodeName==="BODY"||we.nodeName==="HTML"?se=we:se.appendChild(we);else{if(!it&&!ue&&!Le&&be.indexOf("<")===-1)return w&&Se?w.createHTML(be):be;if(se=Fi(be),!se)return it?null:Se?x:""}se&&Fe&&xn(se.firstChild);const Rt=ao(Bn?be:se);for(;Bt=Rt.nextNode();)ye(Bt),Ne(Bt),Bt.content instanceof s&&Je(Bt.content);if(Bn)return be;if(it){if(St)for(rn=k.call(se.ownerDocument);se.firstChild;)rn.appendChild(se.firstChild);else rn=se;return(H.shadowroot||H.shadowrootmode)&&(rn=D.call(r,rn,!0)),rn}let nr=Le?se.outerHTML:se.innerHTML;return Le&&W["!doctype"]&&se.ownerDocument&&se.ownerDocument.doctype&&se.ownerDocument.doctype.name&&Mi(qW,se.ownerDocument.doctype.name)&&(nr=" `+nr),ue&&qb([E,T,R],Fs=>{nr=Dm(nr,Fs," ")}),w&&Se?w.createHTML(nr):nr},e.setConfig=function(){let be=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Aa(be),qe=!0},e.clearConfig=function(){Vt=null,qe=!1},e.isValidAttribute=function(be,j,se){Vt||Aa({});const we=qt(be),Bt=qt(j);return Re(we,Bt,se)},e.addHook=function(be,j){typeof j=="function"&&Tm(A[be],j)},e.removeHook=function(be,j){if(j!==void 0){const se=dAe(A[be],j);return se===-1?void 0:pAe(A[be],se,1)[0]}return jI(A[be])},e.removeHooks=function(be){A[be]=[]},e.removeAllHooks=function(){A=YI()},e}var ZW=VW();ZW.addHook("afterSanitizeAttributes",t=>{"target"in t&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer"))});function XW(t){return ZW.sanitize(t)}const GI=new m8;function O_(t){let e=bn(t,{async:!1,gfm:!0});return XW(e)}function WW(t){try{let e=GI.parse(t);return n=>{try{return XW(GI.renderSync(e,n))}catch{return"Error in Liquid template."}}}catch{return()=>"Error in Liquid template."}}function PAe(t){return typeof t=="string"&&(t.startsWith("http://")||t.startsWith("https://"))}function RAe(t){return t==null?!1:!!(typeof t=="string"&&t.startsWith("data:image/")||t.bytes&&t.bytes instanceof Uint8Array)}function k8(t,e){try{return JSON.stringify(t,(n,r)=>r instanceof Object&&ArrayBuffer.isView(r)?Array.from(r):r,e)}catch{return"(invalid)"}}function C8(t){if(t==null)return"(null)";if(typeof t=="string")return t.toString();if(typeof t=="number")return t.toLocaleString();if(Array.isArray(t))return"["+t.map(e=>C8(e)).join(", ")+"]";try{return k8(t)}catch{return t.toString()}}function YW(t,e){if(t==null)return[];if(typeof t=="string"&&t.length>0)e.push({type:"text",text:t});else if(t instanceof Array)for(let n of t)YW(n,e);else typeof t=="object"&&(t.text!=null&&typeof t.text=="string"&&t.text.length>0&&e.push({type:"text",text:t.text}),t.image!=null&&typeof t.image=="string"&&t.image.length>0&&e.push({type:"image",imageUrl:t.image}),t.image_url!=null&&typeof t.image_url=="string"&&t.image_url.length>0&&e.push({type:"image",imageUrl:t.image_url}))}function IAe(t){if(t==null||typeof t!="object")return;let e=t.role?.toString()??"(null)",n=[],r={...t};delete r.role;for(let i of["content","contents"]){let s=t[i];s!=null&&(YW(s,n),delete r[i])}for(let i in r)r[i]==null&&delete r[i];return{role:e,content:n,remaining:r}}function FAe(t,e){let n=document.createElement("div");if(e.value==null)n.innerText="(null)";else if(typeof e.value=="string")n.innerText=e.value;else if(e.value instanceof Array)for(let r of e.value){let i=IAe(r);i!=null&&n.appendChild(Fm("div",{class:"mb-1 flex flex-col gap-1",children:[Fm("div",{class:"text-xs font-bold border-b text-gray-400 dark:text-gray-500 border-gray-400 dark:border-gray-500",innerText:i.role}),...i.content.map(s=>{if(s.type=="text")return Fm("div",{class:"prose dark:prose-invert max-w-none",innerHTML:O_(s.text)});if(s.type=="image")return Fm("img",{class:"max-w-120 max-h-120 object-contain",attrs:{referrerpolicy:"no-referrer",src:s.imageUrl}})}),Object.keys(i.remaining).length>0?Fm("pre",{class:"border rounded-md p-1 bg-gray-100 border-gray-200 dark:bg-gray-800 dark:border-gray-700 text-xs",innerText:k8(i.remaining,2)}):null]}))}t.replaceChildren(n)}function Fm(t,e){let n=document.createElement(t);if(e.innerText!=null&&(n.innerText=e.innerText),e.innerHTML!=null&&(n.innerHTML=e.innerHTML),e.class!=null&&(n.className=e.class),e.attrs!=null)for(let[r,i]of Object.entries(e.attrs))n.setAttribute(r,i);return e.children!=null&&n.replaceChildren(...e.children.filter(r=>r!=null)),n}let GW={},HW={},A8=[];function nm(t){if(A8.push({renderer:t.name,label:t.label??t.name,description:t.description}),GW[t.name]=(e,n)=>(t.renderer(e,n),{update:r=>{t.renderer(e,r)}}),t.options){let e=t.options;HW[t.name]=(n,r)=>{let i=rL({component:e,target:n,props:r});return{update:s=>{i?.$set(s)},destroy:()=>{i.$destroy(),i=null}}}}}nm({name:"markdown",label:"Markdown",description:"Render the value as Markdown",renderer:(t,e)=>{t.innerHTML='
    '+O_(e.value?.toString()??"(null)")+"
    "}});nm({name:"liquid-template",label:"Liquid Template",description:"Render the value with a Liquid template (with liquidjs)",renderer:(t,e)=>{t.innerHTML="
    "+WW(e.options?.template??"{{value}}")({value:e.value})+"
    "},options:Nke});nm({name:"image",label:"Image",description:"Render the value as an image. Expect image data.",renderer:(t,e)=>{if(e.value==null){t.innerText="(null)";return}let n=eW(e.value);if(n!=null){let r=e.options?.size??100,i=document.createElement("img");i.referrerPolicy="no-referrer",i.src=n,i.style.maxHeight=r+"px",i.style.maxWidth=r+"px",t.replaceChildren(i)}else t.innerText="(unknown)"},options:Lke});nm({name:"url",label:"Link",description:"Render the value as a link. Expect a URL.",renderer:(t,e)=>{if(e.value!=null){let n=document.createElement("a");n.href=e.value,n.innerText=e.value,n.className="underline",n.target="_blank",n.rel="noopener noreferrer",t.replaceChildren(n)}else t.replaceChildren(),t.innerText="(null)"}});nm({name:"json",label:"JSON",description:"Render the value as JSON",renderer:(t,e)=>{let n=document.createElement("pre");n.className="text-sm",n.style.whiteSpace="pre-wrap",n.style.wordBreak="break-all",n.innerText=k8(e.value,2),t.replaceChildren(n)}});nm({name:"messages",label:"Messages",description:"Render the value as chat messages (OpenAI format)",renderer:FAe});var $Ae=G('
    '),MAe=G(''),LAe=G("
    ");function yw(t,e){De(e,!0);let n=Xe(e,"value",3,""),r=L(()=>e.style?.renderer),i=L(()=>e.style?.options??{}),s=L(()=>b(r)!=null?GW[b(r)]??null:null);var o=ot(),a=ke(o);{var l=c=>{var f=ot(),h=ke(f);{var d=m=>{var g=$Ae(),y=M(g,!0);F(g),de(()=>{ne(g,"href",n()),ut(y,n())}),I(m,g)},p=m=>{var g=ot(),y=ke(g);{var O=w=>{var x=MAe();de(S=>ne(x,"src",S),[()=>eW(n())]),I(w,x)},v=w=>{var x=hh();de(S=>ut(x,S),[()=>C8(n())]),I(w,x)};oe(y,w=>{RAe(n())?w(O):w(v,!1)},!0)}I(m,g)};oe(h,m=>{PAe(n())?m(d):m(p,!1)})}I(c,f)},u=c=>{var f=ot(),h=ke(f);bv(h,()=>b(s),d=>{var p=LAe();Zn(p,(m,g)=>b(s)?.(m,g),()=>({value:n(),options:b(i)})),I(d,p)}),I(c,f)};oe(a,c=>{b(s)==null?c(l):c(u,!1)})}I(t,o),Pe()}var NAe=G("
    ");function jh(t,e){let n=Xe(e,"defaultWidth",3,null),r=Xe(e,"defaultHeight",3,null),i=Xe(e,"scrollX",3,!1),s=Xe(e,"scrollY",3,!1),o=L(()=>e.width!=null?e.width:i()?void 0:n()),a=L(()=>e.height!=null?e.height:s()?void 0:r());var l=NAe();let u;var c=M(l);Eo(c,()=>e.children),F(l),de(()=>{Qt(l,1,`p-2 ${e.class??""??""}`),u=Ve(l,"",u,{width:b(o)!=null?`${b(o)}px`:void 0,height:b(a)!=null?`${b(a)}px`:void 0,"overflow-x":i()&&e.width!=null?"auto":void 0,"overflow-y":s()&&e.height!=null?"auto":void 0})}),I(t,l)}function QAe(t,e){De(e,!0);const n=()=>hr(s,"$columnStyles",r),[r,i]=Lo();let{columnStyles:s}=e.context,o=pe(void 0);An(()=>e.context.highlight.subscribe(async a=>{if(a==null)return;let l=await e.context.coordinator.query(Be.from(e.context.table).select({value:e.spec.field}).where(qs(ae(e.context.id,e.context.table),Ae(a))));X(o,l.get(0)?.value??void 0,!0)})),jh(t,{get width(){return e.width},get height(){return e.height},scrollY:!0,children:(a,l)=>{var u=ot(),c=ke(u);{var f=d=>{yw(d,{get value(){return b(o)},get style(){return n()[e.spec.field]}})},h=d=>{var p=hh("(null)");I(d,p)};oe(c,d=>{b(o)!=null?d(f):d(h,!1)})}I(a,u)},$$slots:{default:!0}}),Pe(),i()}var uu={slate:{300:"oklch(86.9% 0.022 252.894)",400:"oklch(70.4% 0.04 256.788)",500:"oklch(55.4% 0.046 257.417)",700:"oklch(37.2% 0.044 257.287)"},gray:{500:"oklch(55.1% 0.027 264.364)"}};function HI(t){return t===void 0?"undefined":JSON.stringify(t)}function BAe(t){if(t!=="undefined")return JSON.parse(t)}var zAe=G(""),UAe=G("
    "),jAe=G(""),qAe=G("");function Z4(t,e){De(e,!0);let n=Xe(e,"disabled",3,!1),r=Xe(e,"placeholder",3,null),i=Xe(e,"options",19,()=>[]),s=Xe(e,"onChange",3,void 0),o,a=L(()=>i().filter(d=>d!=="---"&&d.value===void 0)[0]);var l=qAe();l.__change=()=>{o&&s()&&s()(BAe(o.value))};var u=M(l);{var c=d=>{var p=zAe(),m=M(p,!0);F(p),p.value=p.__value="undefined",de(()=>ut(m,r())),I(d,p)};oe(u,d=>{r()!=null&&!b(a)&&d(c)})}var f=V(u);Ot(f,17,i,Wt,(d,p)=>{var m=ot(),g=ke(m);{var y=v=>{var w=UAe();I(v,w)},O=v=>{var w=jAe(),x=M(w,!0);F(w);var S={};de(_=>{ut(x,b(p).label),S!==(S=_)&&(w.value=(w.__value=_)??"")},[()=>HI(b(p).value)]),I(v,w)};oe(g,v=>{b(p)==="---"?v(y):v(O,!1)})}I(d,m)}),F(l),lr(l,d=>o=d,()=>o);var h;YM(l),de(d=>{Qt(l,1,sx(e.class)),Ve(l,e.style),l.disabled=n(),h!==(h=d)&&(l.value=(l.__value=d)??"",Ov(l,d))},[()=>HI(e.value)]),I(t,l),Pe()}dn(["change"]);function bw(t,e){De(e,!0);let n=Ht(e,["$$slots","$$events","$$legacy"]);const r="data:image/svg+xml;base64,"+btoa(` `);Z4(t,Ch(()=>n,{class:"form-select select-none text-center pl-[4px] pr-[16px] py-0 my-0 border-0 rounded text-sm! text-slate-500 bg-slate-100 dark:text-slate-400 dark:bg-slate-900",get style(){return`background-image:url(${r});background-position:right center`}})),Pe()}var VAe=G('
    '),ZAe=G('
    '),XAe=G('
    '),WAe=G('
    '),YAe=G('
    ',1);function GAe(t,e){De(e,!0);var n=YAe(),r=ke(n);{var i=c=>{var f=XAe(),h=M(f);Ot(h,17,()=>e.bars,Wt,(m,g)=>{const y=L(()=>Math.max(b(g).value/e.maxValue*e.width,b(g).value>0?.25:0));var O=VAe();let v;de(w=>v=Ve(O,"",v,w),[()=>({background:b(g).color,width:`${Math.min(b(y),e.width)}px`})]),I(m,O)});var d=V(h,2);{var p=m=>{var g=ot(),y=ke(g);Ot(y,16,()=>({length:3}),Wt,(O,v,w)=>{var x=ZAe();let S;de(()=>S=Ve(x,"",S,{left:`${e.width-w*3-4}px`})),I(O,x)}),I(m,g)};oe(d,m=>{e.bars.every(g=>g.value<=e.maxValue)||m(p)})}F(f),I(c,f)},s=c=>{var f=WAe();I(c,f)};oe(r,c=>{e.width>10?c(i):c(s,!1)})}var o=V(r,2),a=M(o);let l;var u=M(a,!0);F(a),F(o),de(()=>{l=Qt(a,1,"text-slate-400 dark:text-slate-500",null,l,{"!text-gray-200":!e.selected,"dark:!text-gray-600":!e.selected}),ne(a,"title",e.title),ut(u,e.label)}),I(t,n),Pe()}function KW(){return!(navigator.gpu==null||navigator.gpu.requestAdapter==null||navigator.gpu.wgslLanguageFeatures==null||!navigator.gpu.wgslLanguageFeatures.has("unrestricted_pointer_parameters"))}async function HAe(){if(!KW())return null;let t=await navigator.gpu.requestAdapter();if(!t)return console.error("Could not request WebGPU adapter"),null;let e=[{requiredLimits:{maxBufferSize:t.limits.maxBufferSize,maxStorageBufferBindingSize:t.limits.maxStorageBufferBindingSize},requiredFeatures:["shader-f16"]},...[512,256,128,64,32].map(n=>({requiredLimits:{maxBufferSize:Math.min(n*1048576,t.limits.maxBufferSize),maxStorageBufferBindingSize:Math.min(n*1048576,t.limits.maxStorageBufferBindingSize)},requiredFeatures:["shader-f16"]}))];for(let n of e)try{return await t.requestDevice(n)}catch(r){console.error(r);continue}return null}function KAe(t){return t==0&&(t=4),t%4!=0&&(t+=4-t%4),t}function $u(t,e,n,r){return(t.buffer==null||t.byteSize!=n||t.usage!=r)&&(t.buffer!=null&&t.buffer.destroy(),t.buffer=e.createBuffer({size:KAe(n),usage:r}),t.byteSize=n,t.destroy=()=>{t.buffer?.destroy()}),t.buffer}function W3(t,e,n,r){if(t.buffer!==n||t.data!==r){if(r!=null)if(r.byteLength%4!=0){let i=r.byteLength-r.byteLength%4;if(e.queue.writeBuffer(n,0,r,0,i),r instanceof Uint8Array){let s=new Uint8Array(4);for(let o=0;o<4;o++)i+o{t.texture?.destroy()}),t.texture}const Di=2,v_=4,w_=8,nc=16,rc=32,cd=64,x_=128,bi=1024,Ts=2048,ic=4096,Js=8192,Mu=16384,E8=32768,O0=65536,JI=1<<17,JW=1<<18,rm=1<<19,eY=1<<20,Ao=256,Ow=512,vw=32768,X4=1<<21,T8=1<<22,Qc=1<<23,yh=Symbol("$state"),tY=Symbol("legacy props"),JAe=Symbol(""),ip=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},D8=3,im=8,eEe=!1;var nY=Array.isArray,tEe=Array.prototype.indexOf,P8=Array.from,rY=Object.defineProperty,Pp=Object.getOwnPropertyDescriptor,iY=Object.getOwnPropertyDescriptors,nEe=Object.prototype,rEe=Array.prototype,R8=Object.getPrototypeOf,eF=Object.isExtensible;function iEe(t){for(var e=0;e{t=r,e=i});return{promise:n,resolve:t,reject:e}}function oY(t){return t===this.v}function aY(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function lY(t){return!aY(t,this.v)}function uY(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function sEe(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function oEe(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function aEe(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function lEe(t){throw new Error("https://svelte.dev/e/effect_orphan")}function uEe(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function cEe(){throw new Error("https://svelte.dev/e/hydration_failed")}function fEe(t){throw new Error("https://svelte.dev/e/props_invalid_value")}function hEe(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function dEe(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function pEe(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function mEe(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}let gEe=!1;const I8=1,F8=2,cY=4,yEe=8,bEe=16,OEe=1,vEe=4,wEe=8,xEe=16,_Ee=1,SEe=2,fY="[",__="[!",$8="]",v0={},pi=Symbol(),kEe="http://www.w3.org/1999/xhtml";let Ds=null;function w0(t){Ds=t}function fd(t,e=!1,n){Ds={p:Ds,i:!1,c:null,e:null,s:t,x:null,l:null}}function hd(t){var e=Ds,n=e.e;if(n!==null){e.e=null;for(var r of n)NY(r)}return e.i=!0,Ds=e.p,{}}function hY(){return!0}let sh=[];function dY(){var t=sh;sh=[],iEe(t)}function sm(t){if(sh.length===0&&!$g){var e=sh;queueMicrotask(()=>{e===sh&&dY()})}sh.push(t)}function CEe(){for(;sh.length>0;)dY()}function S_(t){console.warn("https://svelte.dev/e/hydration_mismatch")}function AEe(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let tn=!1;function Su(t){tn=t}let Yt;function _s(t){if(t===null)throw S_(),v0;return Yt=t}function Iy(){return _s(Ul(Yt))}function kr(t){if(tn){if(Ul(Yt)!==null)throw S_(),v0;Yt=t}}function pY(t=1){if(tn){for(var e=t,n=Yt;e--;)n=Ul(n);Yt=n}}function ww(t=!0){for(var e=0,n=Yt;;){if(n.nodeType===im){var r=n.data;if(r===$8){if(e===0)return n;e-=1}else(r===fY||r===__)&&(e+=1)}var i=Ul(n);t&&n.remove(),n=i}}function mY(t){if(!t||t.nodeType!==im)throw S_(),v0;return t.data}function oh(t){if(typeof t!="object"||t===null||yh in t)return t;const e=R8(t);if(e!==nEe&&e!==rEe)return t;var n=new Map,r=nY(t),i=Mn(0),s=bh,o=a=>{if(bh===s)return a();var l=$t,u=bh;Os(null),sF(s);var c=a();return Os(l),sF(u),c};return r&&n.set("length",Mn(t.length)),new Proxy(t,{defineProperty(a,l,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&hEe();var c=n.get(l);return c===void 0?c=o(()=>{var f=Mn(u.value);return n.set(l,f),f}):ct(c,u.value,!0),!0},deleteProperty(a,l){var u=n.get(l);if(u===void 0){if(l in a){const c=o(()=>Mn(pi));n.set(l,c),Mg(i)}}else ct(u,pi),Mg(i);return!0},get(a,l,u){if(l===yh)return t;var c=n.get(l),f=l in a;if(c===void 0&&(!f||Pp(a,l)?.writable)&&(c=o(()=>{var d=oh(f?a[l]:pi),p=Mn(d);return p}),n.set(l,c)),c!==void 0){var h=N(c);return h===pi?void 0:h}return Reflect.get(a,l,u)},getOwnPropertyDescriptor(a,l){var u=Reflect.getOwnPropertyDescriptor(a,l);if(u&&"value"in u){var c=n.get(l);c&&(u.value=N(c))}else if(u===void 0){var f=n.get(l),h=f?.v;if(f!==void 0&&h!==pi)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return u},has(a,l){if(l===yh)return!0;var u=n.get(l),c=u!==void 0&&u.v!==pi||Reflect.has(a,l);if(u!==void 0||Pt!==null&&(!c||Pp(a,l)?.writable)){u===void 0&&(u=o(()=>{var h=c?oh(a[l]):pi,d=Mn(h);return d}),n.set(l,u));var f=N(u);if(f===pi)return!1}return c},set(a,l,u,c){var f=n.get(l),h=l in a;if(r&&l==="length")for(var d=u;dMn(pi)),n.set(d+"",p))}if(f===void 0)(!h||Pp(a,l)?.writable)&&(f=o(()=>Mn(void 0)),ct(f,oh(u)),n.set(l,f));else{h=f.v!==pi;var m=o(()=>oh(u));ct(f,m)}var g=Reflect.getOwnPropertyDescriptor(a,l);if(g?.set&&g.set.call(c,u),!h){if(r&&typeof l=="string"){var y=n.get("length"),O=Number(l);Number.isInteger(O)&&O>=y.v&&ct(y,O+1)}Mg(i)}return!0},ownKeys(a){N(i);var l=Reflect.ownKeys(a).filter(f=>{var h=n.get(f);return h===void 0||h.v!==pi});for(var[u,c]of n)c.v!==pi&&!(u in a)&&l.push(u);return l},setPrototypeOf(){dEe()}})}var tF,gY,yY,bY;function W4(){if(tF===void 0){tF=window,gY=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,n=Text.prototype;yY=Pp(e,"firstChild").get,bY=Pp(e,"nextSibling").get,eF(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),eF(n)&&(n.__t=void 0)}}function El(t=""){return document.createTextNode(t)}function qu(t){return yY.call(t)}function Ul(t){return bY.call(t)}function Yr(t,e){if(!tn)return qu(t);var n=qu(Yt);if(n===null)n=Yt.appendChild(El());else if(e&&n.nodeType!==D8){var r=El();return n?.before(r),_s(r),r}return _s(n),n}function Vd(t,e=!1){if(!tn){var n=qu(t);return n instanceof Comment&&n.data===""?Ul(n):n}if(e&&Yt?.nodeType!==D8){var r=El();return Yt?.before(r),_s(r),r}return Yt}function Gn(t,e=1,n=!1){let r=tn?Yt:t;for(var i;e--;)i=r,r=Ul(r);if(!tn)return r;if(n&&r?.nodeType!==D8){var s=El();return r===null?i?.after(s):r.before(s),_s(s),s}return _s(r),r}function OY(t){t.textContent=""}function EEe(){return!1}function vY(t){var e=Pt;if(e===null)return $t.f|=Qc,t;if((e.f&E8)===0){if((e.f&x_)===0)throw t;e.b.error(t)}else x0(t,e)}function x0(t,e){for(;e!==null;){if((e.f&x_)!==0)try{e.b.error(t);return}catch(n){t=n}e=e.parent}throw t}const Zb=new Set;let Fr=null,ra=null,Ka=[],k_=null,Y4=!1,$g=!1;class al{committed=!1;current=new Map;previous=new Map;#t=new Set;#e=new Set;#n=0;#r=0;#l=null;#a=[];#o=[];skipped_effects=new Set;is_fork=!1;process(e){Ka=[],this.apply();var n={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(const r of e)this.#i(r,n);this.is_fork||this.#u(),this.#r>0||this.is_fork?(this.#s(n.effects),this.#s(n.render_effects),this.#s(n.block_effects)):(Fr=null,nF(n.render_effects),nF(n.effects),this.#l?.resolve()),ra=null}#i(e,n){e.f^=bi;for(var r=e.first;r!==null;){var i=r.f,s=(i&(rc|cd))!==0,o=s&&(i&bi)!==0,a=o||(i&Js)!==0||this.skipped_effects.has(r);if((r.f&x_)!==0&&r.b?.is_pending()&&(n={parent:n,effect:r,effects:[],render_effects:[],block_effects:[]}),!a&&r.fn!==null){s?r.f^=bi:(i&v_)!==0?n.effects.push(r):Fy(r)&&((r.f&nc)!==0&&n.block_effects.push(r),U1(r));var l=r.first;if(l!==null){r=l;continue}}var u=r.parent;for(r=r.next;r===null&&u!==null;)u===n.effect&&(this.#s(n.effects),this.#s(n.render_effects),this.#s(n.block_effects),n=n.parent),r=u.next,u=u.parent}}#s(e){for(const n of e)((n.f&Ts)!==0?this.#a:this.#o).push(n),_i(n,bi)}capture(e,n){this.previous.has(e)||this.previous.set(e,n),(e.f&Qc)===0&&(this.current.set(e,e.v),ra?.set(e,e.v))}activate(){Fr=this,this.apply()}deactivate(){Fr=null,ra=null}flush(){if(this.activate(),Ka.length>0){if(wY(),Fr!==null&&Fr!==this)return}else this.#n===0&&this.process([]);this.deactivate()}discard(){for(const e of this.#e)e(this);this.#e.clear()}#u(){if(this.#r===0){for(const e of this.#t)e();this.#t.clear()}this.#n===0&&this.#c()}#c(){if(Zb.size>1){this.previous.clear();var e=ra,n=!0,r={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(const i of Zb){if(i===this){n=!1;continue}const s=[];for(const[a,l]of this.current){if(i.current.has(a))if(n&&l!==i.current.get(a))i.current.set(a,l);else continue;s.push(a)}if(s.length===0)continue;const o=[...i.current.keys()].filter(a=>!this.current.has(a));if(o.length>0){const a=new Set,l=new Map;for(const u of s)xY(u,o,a,l);if(Ka.length>0){Fr=i,i.apply();for(const u of Ka)i.#i(u,r);Ka=[],i.deactivate()}}}Fr=null,ra=e}this.committed=!0,Zb.delete(this)}increment(e){this.#n+=1,e&&(this.#r+=1)}decrement(e){this.#n-=1,e&&(this.#r-=1),this.revive()}revive(){for(const e of this.#a)_i(e,Ts),qh(e);for(const e of this.#o)_i(e,ic),qh(e);this.#a=[],this.#o=[],this.flush()}oncommit(e){this.#t.add(e)}ondiscard(e){this.#e.add(e)}settled(){return(this.#l??=sY()).promise}static ensure(){if(Fr===null){const e=Fr=new al;Zb.add(Fr),$g||al.enqueue(()=>{Fr===e&&e.flush()})}return Fr}static enqueue(e){sm(e)}apply(){}}function TEe(t){var e=$g;$g=!0;try{for(var n;;){if(CEe(),Ka.length===0&&(Fr?.flush(),Ka.length===0))return k_=null,n;wY()}}finally{$g=e}}function wY(){var t=Rp;Y4=!0;try{var e=0;for(rF(!0);Ka.length>0;){var n=al.ensure();if(e++>1e3){var r,i;DEe()}n.process(Ka),Bc.clear()}}finally{Y4=!1,rF(t),k_=null}}function DEe(){try{uEe()}catch(t){x0(t,k_)}}let au=null;function nF(t){var e=t.length;if(e!==0){for(var n=0;n0)){Bc.clear();for(const i of au){if((i.f&(Mu|Js))!==0)continue;const s=[i];let o=i.parent;for(;o!==null;)au.has(o)&&(au.delete(o),s.push(o)),o=o.parent;for(let a=s.length-1;a>=0;a--){const l=s[a];(l.f&(Mu|Js))===0&&U1(l)}}au.clear()}}au=null}}function xY(t,e,n,r){if(!n.has(t)&&(n.add(t),t.reactions!==null))for(const i of t.reactions){const s=i.f;(s&Di)!==0?xY(i,e,n,r):(s&(T8|nc))!==0&&(s&Ts)===0&&_Y(i,e,r)&&(_i(i,Ts),qh(i))}}function _Y(t,e,n){const r=n.get(t);if(r!==void 0)return r;if(t.deps!==null)for(const i of t.deps){if(e.includes(i))return!0;if((i.f&Di)!==0&&_Y(i,e,n))return n.set(i,!0),!0}return n.set(t,!1),!1}function qh(t){for(var e=k_=t;e.parent!==null;){e=e.parent;var n=e.f;if(Y4&&e===Pt&&(n&nc)!==0&&(n&JW)===0)return;if((n&(cd|rc))!==0){if((n&bi)===0)return;e.f^=bi}}Ka.push(e)}function PEe(t){let e=0,n=Vh(0),r;return()=>{VEe()&&(N(n),N8(()=>(e===0&&(r=pd(()=>t(()=>Mg(n)))),e+=1,()=>{sm(()=>{e-=1,e===0&&(r?.(),r=void 0,Mg(n))})})))}}var REe=O0|rm|x_;function IEe(t,e,n){new FEe(t,e,n)}class FEe{parent;#t=!1;#e;#n=tn?Yt:null;#r;#l;#a;#o=null;#i=null;#s=null;#u=null;#c=null;#d=0;#f=0;#p=!1;#h=null;#O=PEe(()=>(this.#h=Vh(this.#d),()=>{this.#h=null}));constructor(e,n,r){this.#e=e,this.#r=n,this.#l=r,this.parent=Pt.b,this.#t=!!this.#r.pending,this.#a=A_(()=>{if(Pt.b=this,tn){const s=this.#n;Iy(),s.nodeType===im&&s.data===__?this.#w():this.#v()}else{var i=this.#y();try{this.#o=Go(()=>r(i))}catch(s){this.error(s)}this.#f>0?this.#g():this.#t=!1}return()=>{this.#c?.remove()}},REe),tn&&(this.#e=Yt)}#v(){try{this.#o=Go(()=>this.#l(this.#e))}catch(e){this.error(e)}this.#t=!1}#w(){const e=this.#r.pending;e&&(this.#i=Go(()=>e(this.#e)),al.enqueue(()=>{var n=this.#y();this.#o=this.#m(()=>(al.ensure(),Go(()=>this.#l(n)))),this.#f>0?this.#g():(Ip(this.#i,()=>{this.#i=null}),this.#t=!1)}))}#y(){var e=this.#e;return this.#t&&(this.#c=El(),this.#e.before(this.#c),e=this.#c),e}is_pending(){return this.#t||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!this.#r.pending}#m(e){var n=Pt,r=$t,i=Ds;Tl(this.#a),Os(this.#a),w0(this.#a.ctx);try{return e()}catch(s){return vY(s),null}finally{Tl(n),Os(r),w0(i)}}#g(){const e=this.#r.pending;this.#o!==null&&(this.#u=document.createDocumentFragment(),this.#u.append(this.#c),VY(this.#o,this.#u)),this.#i===null&&(this.#i=Go(()=>e(this.#e)))}#b(e){if(!this.has_pending_snippet()){this.parent&&this.parent.#b(e);return}this.#f+=e,this.#f===0&&(this.#t=!1,this.#i&&Ip(this.#i,()=>{this.#i=null}),this.#u&&(this.#e.before(this.#u),this.#u=null))}update_pending_count(e){this.#b(e),this.#d+=e,this.#h&&_0(this.#h,this.#d)}get_effect_pending(){return this.#O(),N(this.#h)}error(e){var n=this.#r.onerror;let r=this.#r.failed;if(this.#p||!n&&!r)throw e;this.#o&&(Ki(this.#o),this.#o=null),this.#i&&(Ki(this.#i),this.#i=null),this.#s&&(Ki(this.#s),this.#s=null),tn&&(_s(this.#n),pY(),_s(ww()));var i=!1,s=!1;const o=()=>{if(i){AEe();return}i=!0,s&&mEe(),al.ensure(),this.#d=0,this.#s!==null&&Ip(this.#s,()=>{this.#s=null}),this.#t=this.has_pending_snippet(),this.#o=this.#m(()=>(this.#p=!1,Go(()=>this.#l(this.#e)))),this.#f>0?this.#g():this.#t=!1};var a=$t;try{Os(null),s=!0,n?.(e,o),s=!1}catch(l){x0(l,this.#a&&this.#a.parent)}finally{Os(a)}r&&sm(()=>{this.#s=this.#m(()=>{al.ensure(),this.#p=!0;try{return Go(()=>{r(this.#e,()=>e,()=>o)})}catch(l){return x0(l,this.#a.parent),null}finally{this.#p=!1}})})}}function $Ee(t,e,n,r){const i=C_;if(n.length===0&&t.length===0){r(e.map(i));return}var s=Fr,o=Pt,a=MEe();function l(){Promise.all(n.map(u=>LEe(u))).then(u=>{a();try{r([...e.map(i),...u])}catch(c){(o.f&Mu)===0&&x0(c,o)}s?.deactivate(),xw()}).catch(u=>{x0(u,o)})}t.length>0?Promise.all(t).then(()=>{a();try{return l()}finally{s?.deactivate(),xw()}}):l()}function MEe(){var t=Pt,e=$t,n=Ds,r=Fr;return function(i=!0){Tl(t),Os(e),w0(n),i&&r?.activate()}}function xw(){Tl(null),Os(null),w0(null)}function C_(t){var e=Di|Ts,n=$t!==null&&($t.f&Di)!==0?$t:null;return Pt===null||n!==null&&(n.f&Ao)!==0?e|=Ao:Pt.f|=rm,{ctx:Ds,deps:null,effects:null,equals:oY,f:e,fn:t,reactions:null,rv:0,v:pi,wv:0,parent:n??Pt,ac:null}}function LEe(t,e){let n=Pt;n===null&&sEe();var r=n.b,i=void 0,s=Vh(pi),o=!$t,a=new Map;return XEe(()=>{var l=sY();i=l.promise;try{Promise.resolve(t()).then(l.resolve,l.reject).then(()=>{u===Fr&&u.committed&&u.deactivate(),xw()})}catch(h){l.reject(h),xw()}var u=Fr;if(o){var c=!r.is_pending();r.update_pending_count(1),u.increment(c),a.get(u)?.reject(ip),a.delete(u),a.set(u,l)}const f=(h,d=void 0)=>{if(u.activate(),d)d!==ip&&(s.f|=Qc,_0(s,d));else{(s.f&Qc)!==0&&(s.f^=Qc),_0(s,h);for(const[p,m]of a){if(a.delete(p),p===u)break;m.reject(ip)}}o&&(r.update_pending_count(-1),u.decrement(c))};l.promise.then(f,h=>f(null,h||"unknown"))}),LY(()=>{for(const l of a.values())l.reject(ip)}),new Promise(l=>{function u(c){function f(){c===i?l(s):u(i)}c.then(f,f)}u(i)})}function lt(t){const e=C_(t);return DY(e),e}function SY(t){const e=C_(t);return e.equals=lY,e}function kY(t){var e=t.effects;if(e!==null){t.effects=null;for(var n=0;n0&&!AY&&QEe()}return e}function QEe(){AY=!1;const t=Array.from(G4);for(const e of t)(e.f&bi)!==0&&_i(e,ic),Fy(e)&&U1(e);G4.clear()}function Mg(t){ct(t,t.v+1)}function TY(t,e){var n=t.reactions;if(n!==null)for(var r=n.length,i=0;it.wv)return!0}(!r||Pt!==null&&!Ac)&&_i(t,bi)}return!1}function IY(t,e,n=!0){var r=t.reactions;if(r!==null&&!Lu?.includes(t))for(var i=0;i{t.ac.abort(ip)}),t.ac=null);try{t.f|=X4;var f=t.fn,h=f(),d=t.deps;if(Bi!==null){var p;if(_w(t,Bs),d!==null&&Bs>0)for(d.length=Bs+Bi.length,p=0;pnew Promise(r=>{n.outro?Ip(e,()=>{Ki(e),r(void 0)}):(Ki(e),r(void 0))})}function QY(t){return jl(v_,t,!1)}function XEe(t){return jl(T8|rm,t,!0)}function N8(t,e=0){return jl(w_|e,t,!0)}function Ws(t,e=[],n=[],r=[],i=!1){$Ee(r,e,n,s=>{jl(i?v_:w_,()=>t(...s.map(N)),!0)})}function A_(t,e=0){var n=jl(nc|e,t,!0);return n}function Go(t,e=!0){return jl(rc|rm,t,!0,e)}function BY(t){var e=t.teardown;if(e!==null){const n=dd,r=$t;iF(!0),Os(null);try{e.call(null)}finally{iF(n),Os(r)}}}function zY(t,e=!1){var n=t.first;for(t.first=t.last=null;n!==null;){const i=n.ac;i!==null&&L8(()=>{i.abort(ip)});var r=n.next;(n.f&cd)!==0?n.parent=null:Ki(n,e),n=r}}function WEe(t){for(var e=t.first;e!==null;){var n=e.next;(e.f&rc)===0&&Ki(e),e=n}}function Ki(t,e=!0){var n=!1;(e||(t.f&JW)!==0)&&t.nodes_start!==null&&t.nodes_end!==null&&(YEe(t.nodes_start,t.nodes_end),n=!0),zY(t,e&&!n),_w(t,0),_i(t,Mu);var r=t.transitions;if(r!==null)for(const s of r)s.stop();BY(t);var i=t.parent;i!==null&&i.first!==null&&UY(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes_start=t.nodes_end=t.ac=null}function YEe(t,e){for(;t!==null;){var n=t===e?null:Ul(t);t.remove(),t=n}}function UY(t){var e=t.parent,n=t.prev,r=t.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),e!==null&&(e.first===t&&(e.first=r),e.last===t&&(e.last=n))}function Ip(t,e,n=!0){var r=[];Q8(t,r,!0),jY(r,()=>{n&&Ki(t),e&&e()})}function jY(t,e){var n=t.length;if(n>0){var r=()=>--n||e();for(var i of t)i.out(r)}else e()}function Q8(t,e,n){if((t.f&Js)===0){if(t.f^=Js,t.transitions!==null)for(const o of t.transitions)(o.is_global||n)&&e.push(o);for(var r=t.first;r!==null;){var i=r.next,s=(r.f&O0)!==0||(r.f&rc)!==0&&(t.f&nc)!==0;Q8(r,e,s?n:!1),r=i}}}function B8(t){qY(t,!0)}function qY(t,e){if((t.f&Js)!==0){t.f^=Js,(t.f&bi)===0&&(_i(t,Ts),qh(t));for(var n=t.first;n!==null;){var r=n.next,i=(n.f&O0)!==0||(n.f&rc)!==0;qY(n,i?e:!1),n=r}if(t.transitions!==null)for(const s of t.transitions)(s.is_global||e)&&s.in()}}function VY(t,e){for(var n=t.nodes_start,r=t.nodes_end;n!==null;){var i=n===r?null:Ul(n);e.append(n),n=i}}const ZY=new Set,K4=new Set;function GEe(t,e,n,r={}){function i(s){if(r.capture||fg.call(e,s),!s.cancelBubble)return L8(()=>n?.call(this,s))}return sm(()=>{e.addEventListener(t,i,r)}),i}function HEe(t,e,n,r,i){var s={capture:r,passive:i},o=GEe(t,e,n,s);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&LY(()=>{e.removeEventListener(t,o,s)})}function KEe(t){for(var e=0;e{throw g});throw h}}finally{t.__root=e,delete t.currentTarget,Os(c),Tl(f)}}}function XY(t){var e=document.createElement("template");return e.innerHTML=t.replaceAll("",""),e.content}function zc(t,e){var n=Pt;n.nodes_start===null&&(n.nodes_start=t,n.nodes_end=e)}function bf(t,e){var n=(e&_Ee)!==0,r=(e&SEe)!==0,i,s=!t.startsWith("");return()=>{if(tn)return zc(Yt,null),Yt;i===void 0&&(i=XY(s?t:""+t),n||(i=qu(i)));var o=r||gY?document.importNode(i,!0):i.cloneNode(!0);if(n){var a=qu(o),l=o.lastChild;zc(a,l)}else zc(o,o);return o}}function JEe(t,e,n="svg"){var r=!t.startsWith(""),i=`<${n}>${r?t:""+t}`,s;return()=>{if(tn)return zc(Yt,null),Yt;if(!s){var o=XY(i),a=qu(o);s=qu(a)}var l=s.cloneNode(!0);return zc(l,l),l}}function sc(t,e){return JEe(t,e,"svg")}function $m(){if(tn)return zc(Yt,null),Yt;var t=document.createDocumentFragment(),e=document.createComment(""),n=El();return t.append(e,n),zc(e,n),t}function fr(t,e){if(tn){Pt.nodes_end=Yt,Iy();return}t!==null&&t.before(e)}const e8e=["touchstart","touchmove"];function t8e(t){return e8e.includes(t)}function Ng(t,e){var n=e==null?"":typeof e=="object"?e+"":e;n!==(t.__t??=t.nodeValue)&&(t.__t=n,t.nodeValue=n+"")}function WY(t,e){return YY(t,e)}function n8e(t,e){W4(),e.intro=e.intro??!1;const n=e.target,r=tn,i=Yt;try{for(var s=qu(n);s&&(s.nodeType!==im||s.data!==fY);)s=Ul(s);if(!s)throw v0;Su(!0),_s(s);const o=YY(t,{...e,anchor:s});return Su(!1),o}catch(o){if(o instanceof Error&&o.message.split(` `).some(a=>a.startsWith("https://svelte.dev/e/")))throw o;return o!==v0&&console.warn("Failed to hydrate: ",o),e.recover===!1&&cEe(),W4(),OY(n),Su(!1),WY(t,e)}finally{Su(r),_s(i)}}const Ad=new Map;function YY(t,{target:e,anchor:n,props:r={},events:i,context:s,intro:o=!0}){W4();var a=new Set,l=f=>{for(var h=0;h{var f=n??e.appendChild(El());return IEe(f,{pending:()=>{}},h=>{if(s){fd({});var d=Ds;d.c=s}if(i&&(r.$$events=i),tn&&zc(h,null),u=t(h,r)||{},tn&&(Pt.nodes_end=Yt,Yt===null||Yt.nodeType!==im||Yt.data!==$8))throw S_(),v0;s&&hd()}),()=>{for(var h of a){e.removeEventListener(h,fg);var d=Ad.get(h);--d===0?(document.removeEventListener(h,fg),Ad.delete(h)):Ad.set(h,d)}K4.delete(l),f!==n&&f.parentNode?.removeChild(f)}});return J4.set(u,c),u}let J4=new WeakMap;function r8e(t,e){const n=J4.get(t);return n?(J4.delete(t),n(e)):Promise.resolve()}function i8e(t){return new s8e(t)}class s8e{#t;#e;constructor(e){var n=new Map,r=(s,o)=>{var a=EY(o,!1,!1);return n.set(s,a),a};const i=new Proxy({...e.props||{},$$events:{}},{get(s,o){return N(n.get(o)??r(o,Reflect.get(s,o)))},has(s,o){return o===tY?!0:(N(n.get(o)??r(o,Reflect.get(s,o))),Reflect.has(s,o))},set(s,o,a){return ct(n.get(o)??r(o,a),a),Reflect.set(s,o,a)}});this.#e=(e.hydrate?n8e:WY)(e.component,{target:e.target,anchor:e.anchor,props:i,context:e.context,intro:e.intro??!1,recover:e.recover}),(!e?.props?.$$host||e.sync===!1)&&TEe(),this.#t=i.$$events;for(const s of Object.keys(this.#e))s==="$set"||s==="$destroy"||s==="$on"||rY(this,s,{get(){return this.#e[s]},set(o){this.#e[s]=o},enumerable:!0});this.#e.$set=s=>{Object.assign(i,s)},this.#e.$destroy=()=>{r8e(this.#e)}}$set(e){this.#e.$set(e)}$on(e,n){this.#t[e]=this.#t[e]||[];const r=(...i)=>n.call(this,...i);return this.#t[e].push(r),()=>{this.#t[e]=this.#t[e].filter(i=>i!==r)}}$destroy(){this.#e.$destroy()}}const o8e="5";typeof window<"u"&&((window.__svelte??={}).v??=new Set).add(o8e);class GY{anchor;#t=new Map;#e=new Map;#n=new Map;#r=!0;constructor(e,n=!0){this.anchor=e,this.#r=n}#l=()=>{var e=Fr;if(this.#t.has(e)){var n=this.#t.get(e),r=this.#e.get(n);if(r)B8(r);else{var i=this.#n.get(n);i&&(this.#e.set(n,i.effect),this.#n.delete(n),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),r=i.effect)}for(const[s,o]of this.#t){if(this.#t.delete(s),s===e)break;const a=this.#n.get(o);a&&(Ki(a.effect),this.#n.delete(o))}for(const[s,o]of this.#e){if(s===n)continue;const a=()=>{if(Array.from(this.#t.values()).includes(s)){var l=document.createDocumentFragment();VY(o,l),l.append(El()),this.#n.set(s,{effect:o,fragment:l})}else Ki(o);this.#e.delete(s)};this.#r||!r?Ip(o,a,!1):a()}}};#a=e=>{this.#t.delete(e);const n=Array.from(this.#t.values());for(const[r,i]of this.#n)n.includes(r)||(Ki(i.effect),this.#n.delete(r))};ensure(e,n){var r=Fr,i=EEe();n&&!this.#e.has(e)&&!this.#n.has(e)&&this.#e.set(e,Go(()=>n(this.anchor))),this.#t.set(r,e),i||(tn&&(this.anchor=Yt),this.#l())}}function z8(t){Ds===null&&uY(),tu(()=>{const e=pd(t);if(typeof e=="function")return e})}function a8e(t){Ds===null&&uY(),z8(()=>()=>pd(t))}function as(t,e,n=!1){tn&&Iy();var r=new GY(t),i=n?O0:0;function s(o,a){if(tn){const u=mY(t)===__;if(o===u){var l=ww();_s(l),r.anchor=l,Su(!1),r.ensure(o,a),Su(!0);return}}r.ensure(o,a)}A_(()=>{var o=!1;e((a,l=!0)=>{o=!0,s(l,a)}),o||s(!1,null)},i)}function l8e(t,e,n){tn&&Iy();var r=new GY(t);A_(()=>{var i=e();r.ensure(i,n)})}function Y3(t,e){return e}function u8e(t,e,n){for(var r=t.items,i=[],s=e.length,o=0;o0&&i.length===0&&n!==null;if(a){var l=n.parentNode;OY(l),l.append(n),r.clear(),za(t,e[0].prev,e[s-1].next)}jY(i,()=>{for(var u=0;u{var y=n();return nY(y)?y:y==null?[]:P8(y)}),p,m;function g(){c8e(m,p,a,h,o,i,e,r,n),s!==null&&(p.length===0?c?B8(c):c=Go(()=>s(o)):c!==null&&Ip(c,()=>{c=null}))}A_(()=>{m??=Pt,p=N(d);var y=p.length;if(f&&y===0)return;f=y===0;let O=!1;if(tn){var v=mY(o)===__;v!==(y===0)&&(o=ww(),_s(o),Su(!1),O=!0)}if(tn){for(var w=null,x,S=0;S0&&_s(ww())}tn?y===0&&s&&(c=Go(()=>s(o))):g(),O&&Su(!0),N(d)}),tn&&(o=Yt)}function c8e(t,e,n,r,i,s,o,a,l){var u=(o&yEe)!==0,c=(o&(I8|F8))!==0,f=e.length,h=n.items,d=n.first,p=d,m,g=null,y,O=[],v=[],w,x,S,_;if(u)for(_=0;_0){var B=(o&cY)!==0&&f===0?i:null;if(u){for(_=0;_{if(y!==void 0)for(S of y)S.a?.apply()}),t.first=n.first&&n.first.e,t.last=g&&g.e;for(var q of r.values())Ki(q.e);r.clear()}function f8e(t,e,n,r){(r&I8)!==0&&_0(t.v,e),(r&F8)!==0?_0(t.i,n):t.i=n}function HY(t,e,n,r,i,s,o,a,l,u,c){var f=(l&I8)!==0,h=(l&bEe)===0,d=f?h?EY(i,!1,!1):Vh(i):i,p=(l&F8)===0?o:Vh(o),m={i:p,v:d,k:s,a:null,e:null,prev:n,next:r};try{if(t===null){var g=document.createDocumentFragment();g.append(t=El())}return m.e=Go(()=>a(t,d,p,u),tn),m.e.prev=n&&n.e,m.e.next=r&&r.e,n===null?c||(e.first=m):(n.next=m,n.e.next=m.e),r!==null&&(r.prev=m,r.e.prev=m.e),m}finally{}}function H3(t,e,n){for(var r=t.next?t.next.e.nodes_start:n,i=e?e.e.nodes_start:n,s=t.e.nodes_start;s!==null&&s!==r;){var o=Ul(s);i.before(s),s=o}}function za(t,e,n){e===null?t.first=n:(e.next=n,e.e.next=n&&n.e),n!==null&&(n.prev=e,n.e.prev=e&&e.e)}function Zo(t,e,n){QY(()=>{var r=pd(()=>e(t,n?.())||{});if(n&&r?.update){var i=!1,s={};N8(()=>{var o=n();jEe(o),i&&aY(s,o)&&(s=o,r.update(o))}),i=!0}if(r?.destroy)return()=>r.destroy()})}function aF(t,e=!1){var n=e?" !important;":";",r="";for(var i in t){var s=t[i];s!=null&&s!==""&&(r+=" "+i+": "+s+n)}return r}function h8e(t,e){if(e){var n="",r,i;return Array.isArray(e)?(r=e[0],i=e[1]):r=e,r&&(n+=aF(r)),i&&(n+=aF(i,!0)),n=n.trim(),n===""?null:n}return String(t)}function K3(t,e={},n,r){for(var i in n){var s=n[i];e[i]!==s&&(n[i]==null?t.style.removeProperty(i):t.style.setProperty(i,s,r))}}function Xt(t,e,n,r){var i=t.__style;if(tn||i!==e){var s=h8e(e,r);(!tn||s!==t.getAttribute("style"))&&(s==null?t.removeAttribute("style"):t.style.cssText=s),t.__style=e}else r&&(Array.isArray(r)?(K3(t,n?.[0],r[0]),K3(t,n?.[1],r[1],"important")):K3(t,n,r));return r}const d8e=Symbol("is custom element"),p8e=Symbol("is html");function $e(t,e,n,r){var i=m8e(t);tn&&(i[e]=t.getAttribute(e),e==="src"||e==="srcset"||e==="href"&&t.nodeName==="LINK")||i[e]!==(i[e]=n)&&(e==="loading"&&(t[JAe]=n),n==null?t.removeAttribute(e):typeof n!="string"&&g8e(t).includes(e)?t[e]=n:t.setAttribute(e,n))}function m8e(t){return t.__attributes??={[d8e]:t.nodeName.includes("-"),[p8e]:t.namespaceURI===kEe}}var lF=new Map;function g8e(t){var e=t.getAttribute("is")||t.nodeName,n=lF.get(e);if(n)return n;lF.set(e,n=[]);for(var r,i=t,s=Element.prototype;s!==i;){r=iY(i);for(var o in r)r[o].set&&n.push(o);i=R8(i)}return n}function uF(t,e){return t===e||t?.[yh]===e}function eC(t={},e,n,r){return QY(()=>{var i,s;return N8(()=>{i=s,s=[],pd(()=>{t!==n(...s)&&(e(t,...s),i&&uF(n(...i),t)&&e(null,...i))})}),()=>{sm(()=>{s&&uF(n(...s),t)&&e(null,...s)})}}),t}let Xb=!1;function y8e(t){var e=Xb;try{return Xb=!1,[t(),Xb]}finally{Xb=e}}function We(t,e,n,r){var i=(n&wEe)!==0,s=(n&xEe)!==0,o=r,a=!0,l=()=>(a&&(a=!1,o=s?pd(r):r),o),u;if(i){var c=yh in t||tY in t;u=Pp(t,e)?.set??(c&&e in t?O=>t[e]=O:void 0)}var f,h=!1;i?[f,h]=y8e(()=>t[e]):f=t[e],f===void 0&&r!==void 0&&(f=l(),u&&(fEe(),u(f)));var d;if(d=()=>{var O=t[e];return O===void 0?l():(a=!0,O)},(n&vEe)===0)return d;if(u){var p=t.$$legacy;return(function(O,v){return arguments.length>0?((!v||p||h)&&u(v?d():O),O):d()})}var m=!1,g=((n&OEe)!==0?C_:SY)(()=>(m=!1,d()));i&&N(g);var y=Pt;return(function(O,v){if(arguments.length>0){const w=v?N(g):i?oh(O):O;return ct(g,w),m=!0,o!==void 0&&(o=w),O}return dd&&m||(y.f&Mu)!==0?g.v:N(g)})}var b8e=sc('');function O8e(t,e){fd(e,!0);let n=lt(()=>e.pointLocation(e.value.xMin,e.value.yMin)),r=lt(()=>e.pointLocation(e.value.xMax,e.value.yMax));const i=8;function s(g){return y=>{e.preventHover(!0);let O=[N(n).x,N(n).y,N(r).x,N(r).y];return{move:v=>{let w=v.pageX-y.pageX,x=v.pageY-y.pageY,S=[w,x,w,x].map((C,D)=>O[D]+C*g[D]),_=e.coordinateAtPoint(S[0],S[1]),k=e.coordinateAtPoint(S[2],S[3]);e.onChange({xMin:Math.min(_.x,k.x),xMax:Math.max(_.x,k.x),yMin:Math.min(_.y,k.y),yMax:Math.max(_.y,k.y)})},up:()=>{e.preventHover(!1)},cancel:()=>{e.preventHover(!1)}}}}var o=b8e(),a=Yr(o);Xt(a,"",{},{stroke:"#fff",fill:"rgba(128,128,128,0.25)",cursor:"move"}),Zo(a,(g,y)=>sn?.(g,y),()=>({drag:s([1,1,1,1])}));var l=Gn(a);$e(l,"width",i),Xt(l,"",{},{cursor:"ew-resize",stroke:"none",fill:"none","pointer-events":"all"}),Zo(l,(g,y)=>sn?.(g,y),()=>({drag:s([1,0,0,0])}));var u=Gn(l);$e(u,"width",i),Xt(u,"",{},{cursor:"ew-resize",stroke:"none",fill:"none","pointer-events":"all"}),Zo(u,(g,y)=>sn?.(g,y),()=>({drag:s([0,0,1,0])}));var c=Gn(u);$e(c,"height",i),Xt(c,"",{},{cursor:"ns-resize",stroke:"none",fill:"none","pointer-events":"all"}),Zo(c,(g,y)=>sn?.(g,y),()=>({drag:s([0,1,0,0])}));var f=Gn(c);$e(f,"height",i),Xt(f,"",{},{cursor:"ns-resize",stroke:"none",fill:"none","pointer-events":"all"}),Zo(f,(g,y)=>sn?.(g,y),()=>({drag:s([0,0,0,1])}));var h=Gn(f);$e(h,"width",i),$e(h,"height",i),Xt(h,"",{},{cursor:"nesw-resize",stroke:"none",fill:"none","pointer-events":"all"}),Zo(h,(g,y)=>sn?.(g,y),()=>({drag:s([1,1,0,0])}));var d=Gn(h);$e(d,"width",i),$e(d,"height",i),Xt(d,"",{},{cursor:"nwse-resize",stroke:"none",fill:"none","pointer-events":"all"}),Zo(d,(g,y)=>sn?.(g,y),()=>({drag:s([1,0,0,1])}));var p=Gn(d);$e(p,"width",i),$e(p,"height",i),Xt(p,"",{},{cursor:"nwse-resize",stroke:"none",fill:"none","pointer-events":"all"}),Zo(p,(g,y)=>sn?.(g,y),()=>({drag:s([0,1,1,0])}));var m=Gn(p);$e(m,"width",i),$e(m,"height",i),Xt(m,"",{},{cursor:"nesw-resize",stroke:"none",fill:"none","pointer-events":"all"}),Zo(m,(g,y)=>sn?.(g,y),()=>({drag:s([0,0,1,1])})),kr(o),Ws((g,y,O,v,w,x,S,_,k,C,D,A)=>{$e(a,"x",g),$e(a,"width",y),$e(a,"y",O),$e(a,"height",v),$e(l,"x",N(n).x-i/2),$e(l,"y",w),$e(l,"height",x),$e(u,"x",N(r).x-i/2),$e(u,"y",S),$e(u,"height",_),$e(c,"x",k),$e(c,"width",C),$e(c,"y",N(n).y-i/2),$e(f,"x",D),$e(f,"width",A),$e(f,"y",N(r).y-i/2),$e(h,"x",N(n).x-i/2),$e(h,"y",N(n).y-i/2),$e(d,"x",N(n).x-i/2),$e(d,"y",N(r).y-i/2),$e(p,"x",N(r).x-i/2),$e(p,"y",N(n).y-i/2),$e(m,"x",N(r).x-i/2),$e(m,"y",N(r).y-i/2)},[()=>Math.min(N(n).x,N(r).x),()=>Math.abs(N(n).x-N(r).x),()=>Math.min(N(n).y,N(r).y),()=>Math.abs(N(n).y-N(r).y),()=>Math.min(N(n).y,N(r).y),()=>Math.abs(N(n).y-N(r).y),()=>Math.min(N(n).y,N(r).y),()=>Math.abs(N(n).y-N(r).y),()=>Math.min(N(n).x,N(r).x),()=>Math.abs(N(n).x-N(r).x),()=>Math.min(N(n).x,N(r).x),()=>Math.abs(N(n).x-N(r).x)]),fr(t,o),hd()}function v8e(t,e){let n=!1,r,i,s,o=300,a=300,l=async c=>{n=!0;try{await t(c)}catch(f){console.error(f)}if(n=!1,r!==void 0){let f=r;r=void 0,u(f)}},u=async c=>{if(n){r=c;return}let f=new Date().getTime();e()&&(i=f);let h=!0;(i==null||f-il(c),o)):l(c)};return u}function w8e(t,e){let n=t.x-e.x,r=t.y-e.y;return Math.sqrt(n*n+r*r)}function x8e(t){return"M "+t.map(({x:e,y:n})=>`${e},${n}`).join(" L ")+" Z"}function KY(t){let e=1/0,n=-1/0,r=1/0,i=-1/0;for(let{x:s,y:o}of t)e=Math.min(e,s),r=Math.min(r,o),n=Math.max(n,s),i=Math.max(i,o);return{xMin:e,yMin:r,xMax:n,yMax:i}}async function _8e(t){let e=JSON.stringify(t);return k8e(e)}function Ec(t,e){if(t===e)return!0;if(t===null||e===null||typeof t!="object"||typeof e!="object"||Object.keys(t).length!==Object.keys(e).length)return!1;for(let n in t)if(e.hasOwnProperty(n)){if(!Ec(t[n],e[n]))return!1}else return!1;return!0}function S8e(t,e=0){let n=3735928559^e,r=1103547991^e;for(let i=0;i>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),[r>>>0,n>>>0]}function k8e(t){let e=new TextEncoder().encode(t),n=S8e(e);return n[0].toString(16).padStart(8,"0")+n[1].toString(16).padStart(8,"0")}var C8e=sc("");function A8e(t,e){fd(e,!0);let n=lt(()=>e.value.map(({x:i,y:s})=>e.pointLocation(i,s)));var r=C8e();Xt(r,"",{},{stroke:"#fff",fill:"rgba(128,128,128,0.25)"}),Ws(i=>$e(r,"d",i),[()=>x8e(N(n))]),fr(t,r),hd()}const E8e={marquee:"M7 5a2 2 0 1 1-4 0a2 2 0 0 1 4 0m1-.25c0 .414.336.75.75.75h6.5a.75.75 0 0 0 0-1.5h-6.5a.75.75 0 0 0-.75.75M4.75 8a.75.75 0 0 0-.75.75v6.5a.75.75 0 0 0 1.5 0v-6.5A.75.75 0 0 0 4.75 8m14.5 0a.75.75 0 0 0-.75.75v6.5a.75.75 0 0 0 1.5 0v-6.5a.75.75 0 0 0-.75-.75M8.75 20a.75.75 0 0 1 0-1.5h6.5a.75.75 0 0 1 0 1.5zM5 21a2 2 0 1 0 0-4a2 2 0 0 0 0 4M21 5a2 2 0 1 1-4 0a2 2 0 0 1 4 0m-2 16a2 2 0 1 0 0-4a2 2 0 0 0 0 4",lasso:"M9.703 2.265A10 10 0 0 1 12 2c.79 0 1.559.092 2.297.265a.75.75 0 1 1-.343 1.46A8.5 8.5 0 0 0 12 3.5a8.6 8.6 0 0 0-1.954.225a.75.75 0 1 1-.343-1.46m-1.93 1.47a.75.75 0 0 1-.242 1.033a8.55 8.55 0 0 0-2.763 2.763a.75.75 0 1 1-1.275-.79a10.05 10.05 0 0 1 3.248-3.248a.75.75 0 0 1 1.032.243m8.454 0a.75.75 0 0 1 1.032-.242a10.05 10.05 0 0 1 3.248 3.248a.75.75 0 1 1-1.275.79a8.55 8.55 0 0 0-2.763-2.763a.75.75 0 0 1-.242-1.032m-13.06 5.41a.75.75 0 0 1 .558.901A8.5 8.5 0 0 0 3.5 12c0 .673.078 1.327.225 1.954a.75.75 0 1 1-1.46.343A10 10 0 0 1 2 12c0-.79.092-1.559.265-2.297a.75.75 0 0 1 .902-.559m17.666 0a.75.75 0 0 1 .902.558a10.1 10.1 0 0 1 0 4.595a.75.75 0 1 1-1.46-.343a8.54 8.54 0 0 0-.001-3.908a.75.75 0 0 1 .559-.902M3.736 16.226a.75.75 0 0 1 1.032.242a8.55 8.55 0 0 0 2.763 2.763a.75.75 0 0 1-.79 1.275a10.05 10.05 0 0 1-3.248-3.248a.75.75 0 0 1 .243-1.032m16.685.858a.75.75 0 1 0-1.342-.67l-.002.004l-.015.029l-.069.123a8 8 0 0 1-.289.466a9.6 9.6 0 0 1-.965 1.219c-1.17-1.073-2.756-2.006-4.74-2.006c-2.347 0-3.99 1.203-3.99 2.875S10.653 22 13 22c1.942 0 3.495-.75 4.658-1.645a11.7 11.7 0 0 1 1.315 2.01q.05.099.073.149l.017.035l.004.009a.75.75 0 0 0 1.368-.615c-.087-.183 0-.001 0-.001v-.002l-.003-.004l-.007-.015l-.024-.052l-.091-.184a13.2 13.2 0 0 0-1.538-2.337a11 11 0 0 0 1.525-2.032l.09-.162l.024-.047l.007-.014l.002-.005zM13 17.75c1.433 0 2.644.652 3.616 1.512c-.95.7-2.155 1.238-3.616 1.238c-1.973 0-2.49-.922-2.49-1.375s.517-1.375 2.49-1.375"};var T8e=sc(''),D8e=bf("");function cF(t,e){let n=We(e,"active",3,!1);var r=D8e();r.__click=function(...a){e.onClick?.apply(this,a)};let i;var s=Yr(r);{var o=a=>{var l=T8e();Xt(l,"",{},{width:"14px",height:"14px"});var u=Yr(l);Xt(u,"",{},{fill:"currentColor"}),kr(l),Ws(()=>$e(u,"d",E8e[e.icon])),fr(a,l)};as(s,a=>{e.icon!=null&&a(o)})}kr(r),Ws(()=>{$e(r,"title",e.title),i=Xt(r,"",i,{border:"none",appearance:"none",background:n()?"color-mix(in srgb, currentColor 20%, transparent)":"none","border-radius":"2px",height:"16px",width:"16px",padding:"0",margin:"0","font-family":"inherit","font-size":"1em",color:"currentColor",display:"flex","flex-direction":"row","align-items":"center","justify-content":"center"})}),fr(t,r)}KEe(["click"]);var P8e=bf('
    ');function R8e(t,e){function n(h,d){let p=Math.log10(d*h),m=Math.round(p),g=[.1,.2,.5,1,2,5,10],y=0,O=1e10;for(let v of g){let w=Math.abs(Math.log10(v)+m-p);wn(e.distancePerPoint,30)),i=lt(()=>N(r)/e.distancePerPoint);var s=P8e();Xt(s,"",{},{display:"flex","align-items":"center"});var o=Yr(s);Xt(o,"",{},{"padding-right":"4px"});var a=Yr(o,!0);kr(o);var l=Gn(o,2),u=Yr(l);$e(u,"x1",1),$e(u,"y1",3),$e(u,"y2",3),Xt(u,"",{},{stroke:"currentColor","stroke-width":"2","stroke-cap":"butt"});var c=Gn(u);$e(c,"x1",1),$e(c,"x2",1),$e(c,"y1",0),$e(c,"y2",6),Xt(c,"",{},{stroke:"currentColor"});var f=Gn(c);$e(f,"y1",0),$e(f,"y2",6),Xt(f,"",{},{stroke:"currentColor"}),kr(l),kr(s),Ws(h=>{Ng(a,h),$e(l,"width",`${N(i)+2}px`),$e(u,"x2",N(i)+1),$e(f,"x1",N(i)+1),$e(f,"x2",N(i)+1)},[()=>N(r).toLocaleString()]),fr(t,s)}var I8e=bf("
    "),F8e=bf('
    ',1),$8e=bf('
    ');function M8e(t,e){fd(e,!0);let n=We(e,"statusMessage",3,null);var r=$8e();let i;var s=Yr(r);let o;var a=Yr(s);{var l=v=>{var w=I8e();Xt(w,"",{},{display:"inline-block"});var x=Yr(w,!0);kr(w),Ws(()=>Ng(x,n())),fr(v,w)};as(a,v=>{n()!=null&&v(l)})}kr(s);var u=Gn(s,2);Xt(u,"",{},{flex:"1 1 0%"});var c=Gn(u,2);let f;var h=Yr(c);{var d=v=>{var w=F8e(),x=Vd(w);Xt(x,"",{},{color:"currentColor","text-decoration":"underline"});var S=Yr(x,!0);kr(x),pY(2),Ws(()=>{$e(x,"href",e.resolvedTheme.brandingLink.href),Ng(S,e.resolvedTheme.brandingLink.text)}),fr(v,w)};as(h,v=>{e.resolvedTheme.brandingLink!=null&&v(d)})}var p=Gn(h,2);{let v=lt(()=>e.selectionMode=="marquee");cF(p,{icon:"marquee",get active(){return N(v)},title:"Toggle rectangle selection mode. In normal mode, use shift + drag for rectangle selection.",onClick:()=>e.onSelectionMode(e.selectionMode=="marquee"?"none":"marquee")})}var m=Gn(p,2);{let v=lt(()=>e.selectionMode=="lasso");cF(m,{icon:"lasso",get active(){return N(v)},title:"Toggle lasso selection mode. In normal mode, use shift + meta + drag for lasso selection.",onClick:()=>e.onSelectionMode(e.selectionMode=="lasso"?"none":"lasso")})}var g=Gn(m,4);R8e(g,{get distancePerPoint(){return e.distancePerPoint}});var y=Gn(g,4),O=Yr(y);kr(y),kr(c),kr(r),Ws(v=>{i=Xt(r,"",i,{"font-size":"12px","line-height":"20px",height:"20px",color:e.resolvedTheme.statusBarTextColor,position:"absolute",bottom:"0px",left:"0px",right:"0px","user-select":"none","font-family":e.resolvedTheme.fontFamily,display:"flex","flex-direction":"row"}),o=Xt(s,"",o,{flex:"none",display:"flex","flex-direction":"row",gap:"4px",padding:"0px 4px","border-radius":"2px",background:e.resolvedTheme.statusBarBackgroundColor}),f=Xt(c,"",f,{flex:"none",display:"flex","flex-direction":"row","align-items":"center",gap:"4px",padding:"0px 4px","border-radius":"2px",background:e.resolvedTheme.statusBarBackgroundColor}),Ng(O,`${v??""} points`)},[()=>e.pointCount.toLocaleString()]),fr(t,r),hd()}function L8e(t){return(e,n)=>{let r=new t(e,n);return{...r.update?{update:r.update.bind(r)}:{},...r.destroy?{destroy:r.destroy.bind(r)}:{}}}}let J3=new WeakMap;function JY(t){let e=typeof t=="function"?t:t.class;if(J3.has(e))return J3.get(e);{let n=L8e(e);return J3.set(e,n),n}}function eG(t,e){return typeof t=="function"?e:{...t.props??{},...e}}var N8e=bf("
    ");function Q8e(t,e){fd(e,!0);let n=We(e,"margin",3,4),r,i,s=lt(()=>JY(e.customTooltip)),o=lt(()=>eG(e.customTooltip,{tooltip:e.tooltip}));z8(()=>{Lg(()=>{let u=N(s),c=null;return Lg(()=>{i.style.left="0px",i.style.top="0px",i.style.pointerEvents=e.allowInteraction?"all":"none",c==null?c=u(i,N(o)):c.update?.(N(o));function f(g,y,O,v){let w=e.location.x,x=e.location.y,S=2,_=g/2,k=y+(e.targetHeight+n());w-_v-g&&(_=w-v+g),x-k{m=null;let g=i.getBoundingClientRect();(g.width!=d||g.height!=p)&&f(g.width,g.height,2,h.width-2)});return()=>{m!=null&&cancelAnimationFrame(m)}}),()=>{c?.destroy?.(),i.replaceChildren()}})});var a=N8e();Xt(a,"",{},{position:"absolute",width:"100%"});var l=Yr(a);Xt(l,"",{},{display:"flex",position:"absolute",width:"fit-content",height:"fit-content","z-index":"100"}),eC(l,u=>i=u,()=>i),kr(a),eC(a,u=>r=u,()=>r),fr(t,a),hd()}function U8(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function tG(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function $y(){}var j1=.7,Sw=1/j1,Fp="\\s*([+-]?\\d+)\\s*",q1="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ml="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",B8e=/^#([0-9a-f]{3,8})$/,z8e=new RegExp(`^rgb\\(${Fp},${Fp},${Fp}\\)$`),U8e=new RegExp(`^rgb\\(${ml},${ml},${ml}\\)$`),j8e=new RegExp(`^rgba\\(${Fp},${Fp},${Fp},${q1}\\)$`),q8e=new RegExp(`^rgba\\(${ml},${ml},${ml},${q1}\\)$`),V8e=new RegExp(`^hsl\\(${q1},${ml},${ml}\\)$`),Z8e=new RegExp(`^hsla\\(${q1},${ml},${ml},${q1}\\)$`),fF={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};U8($y,j8,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:hF,formatHex:hF,formatHex8:X8e,formatHsl:W8e,formatRgb:dF,toString:dF});function hF(){return this.rgb().formatHex()}function X8e(){return this.rgb().formatHex8()}function W8e(){return rG(this).formatHsl()}function dF(){return this.rgb().formatRgb()}function j8(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=B8e.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?pF(e):n===3?new vs(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Wb(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Wb(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=z8e.exec(t))?new vs(e[1],e[2],e[3],1):(e=U8e.exec(t))?new vs(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=j8e.exec(t))?Wb(e[1],e[2],e[3],e[4]):(e=q8e.exec(t))?Wb(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=V8e.exec(t))?yF(e[1],e[2]/100,e[3]/100,1):(e=Z8e.exec(t))?yF(e[1],e[2]/100,e[3]/100,e[4]):fF.hasOwnProperty(t)?pF(fF[t]):t==="transparent"?new vs(NaN,NaN,NaN,0):null}function pF(t){return new vs(t>>16&255,t>>8&255,t&255,1)}function Wb(t,e,n,r){return r<=0&&(t=e=n=NaN),new vs(t,e,n,r)}function Y8e(t){return t instanceof $y||(t=j8(t)),t?(t=t.rgb(),new vs(t.r,t.g,t.b,t.opacity)):new vs}function nG(t,e,n,r){return arguments.length===1?Y8e(t):new vs(t,e,n,r??1)}function vs(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}U8(vs,nG,tG($y,{brighter(t){return t=t==null?Sw:Math.pow(Sw,t),new vs(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?j1:Math.pow(j1,t),new vs(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new vs(Oh(this.r),Oh(this.g),Oh(this.b),kw(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:mF,formatHex:mF,formatHex8:G8e,formatRgb:gF,toString:gF}));function mF(){return`#${ah(this.r)}${ah(this.g)}${ah(this.b)}`}function G8e(){return`#${ah(this.r)}${ah(this.g)}${ah(this.b)}${ah((isNaN(this.opacity)?1:this.opacity)*255)}`}function gF(){const t=kw(this.opacity);return`${t===1?"rgb(":"rgba("}${Oh(this.r)}, ${Oh(this.g)}, ${Oh(this.b)}${t===1?")":`, ${t})`}`}function kw(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Oh(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ah(t){return t=Oh(t),(t<16?"0":"")+t.toString(16)}function yF(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new sa(t,e,n,r)}function rG(t){if(t instanceof sa)return new sa(t.h,t.s,t.l,t.opacity);if(t instanceof $y||(t=j8(t)),!t)return new sa;if(t instanceof sa)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),s=Math.max(e,n,r),o=NaN,a=s-i,l=(s+i)/2;return a?(e===s?o=(n-r)/a+(n0&&l<1?0:o,new sa(o,a,l,t.opacity)}function H8e(t,e,n,r){return arguments.length===1?rG(t):new sa(t,e,n,r??1)}function sa(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}U8(sa,H8e,tG($y,{brighter(t){return t=t==null?Sw:Math.pow(Sw,t),new sa(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?j1:Math.pow(j1,t),new sa(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new vs(ek(t>=240?t-240:t+120,i,r),ek(t,i,r),ek(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new sa(bF(this.h),Yb(this.s),Yb(this.l),kw(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=kw(this.opacity);return`${t===1?"hsl(":"hsla("}${bF(this.h)}, ${Yb(this.s)*100}%, ${Yb(this.l)*100}%${t===1?")":`, ${t})`}`}}));function bF(t){return t=(t||0)%360,t<0?t+360:t}function Yb(t){return Math.max(0,Math.min(1,t||0))}function ek(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const OF=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Gb=["#1f77b4","#aec7e8","#ff7f0e","#ffbb78","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5","#8c564b","#c49c94","#e377c2","#f7b6d2","#7f7f7f","#c7c7c7","#bcbd22","#dbdb8d","#17becf","#9edae5"];function S0(t){if(t<1&&(t=1),t<=OF.length)return OF.slice(0,t);if(t<=Gb.length)return Gb.slice(0,t);{let e=[];for(let n=0;n({x:s*e+r,y:o*n+i})}coordinateAtPixelFunction(){let e=this._pixel_kx,n=this._pixel_ky,r=this._pixel_bx,i=this._pixel_by;return(s,o)=>({x:(s-r)/e,y:(o-i)/n})}}class tC{_needsRun=!0;_inputs=new Set;_targets=new Set;constructor(e=[]){this._inputs=new Set(e);for(let n of this._inputs)n._targets.add(this)}addInput(e){this._inputs.add(e),e._targets.add(this)}removeInput(e){e._targets.delete(this),this._inputs.delete(e)}run(){if(this._needsRun){for(let e of this._inputs)e.run();this.update(),this._needsRun=!1}}setNeedsRunDownstream(){for(let e of this._targets)e._needsRun||(e._needsRun=!0,e.setNeedsRunDownstream())}update(){}destroy(){for(let e of this._inputs)e._targets.delete(this)}}let om=class extends tC{_value=null;setValue(t){this._value!==t&&(this._value=t,this.setNeedsRunDownstream())}get value(){return this.run(),this._value}};class aG extends om{constructor(e){super([]),this.setValue(e)}get value(){return super.value}set value(e){this.setValue(e)}}class J8e extends om{fn;constructor(e,n){super(n),this.fn=e}update(){this.setValue(this.fn())}}class eTe extends om{fn;state;constructor(e,n){super(n),this.fn=e,this.state={}}update(){this.setValue(this.fn(this.state))}destroy(){super.destroy(),this.state.destroy&&this.state.destroy(),this.state={}}}class tTe extends om{parent;condition;buildTrue;buildFalse;context=null;currentCondition=null;currentNode=null;constructor(e,n,r,i){super([n]),this.parent=e,this.condition=n,this.buildTrue=r,this.buildFalse=i}update(){(this.currentNode==null||this.currentCondition!==this.condition.value)&&(this.currentNode&&this.removeInput(this.currentNode),this.context?.destroy(),this.context=new md(this.parent),this.currentCondition=this.condition.value,this.currentCondition?this.currentNode=this.buildTrue(this.context):this.currentNode=this.buildFalse(this.context),this.addInput(this.currentNode)),this.setValue(this.currentNode.value)}destroy(){super.destroy(),this.context?.destroy()}}class nTe extends om{parent;input;build;cache;constructor(e,n,r){super([n]),this.parent=e,this.input=n,this.build=r,this.cache=new Map}update(){let e=new Set,n=this.input.value.map(r=>{if(e.add(r),this.cache.has(r)){let i=this.cache.get(r);return i.input.value=r,i.output.value}else{let i=new md(this.parent),s=new aG(r),o=this.build(i,s);return this.cache.set(r,{context:i,input:s,output:o}),this.addInput(o),o.value}});for(let[r,i]of this.cache)e.has(r)||(this.cache.delete(r),this.removeInput(i.output),i.context.destroy());this.setValue(n)}destroy(){super.destroy();for(let e of this.cache.values())e.context.destroy()}}class rTe extends om{parent;input;cases;currentCase=null;currentNode=null;currentContext=null;constructor(e,n,r){super([n]),this.parent=e,this.input=n,this.cases=r}update(){(this.currentNode==null||this.input.value!==this.currentCase)&&(this.currentNode&&this.removeInput(this.currentNode),this.currentContext?.destroy(),this.currentContext=new md(this.parent),this.currentCase=this.input.value,this.currentNode=this.cases[this.currentCase](this.currentContext),this.addInput(this.currentNode)),this.setValue(this.currentNode.value)}destroy(){super.destroy(),this.currentContext?.destroy()}}class md{_children;_nodes;constructor(e=null){this._children=new Set,this._nodes=new Set,e?._children.add(this)}destroy(){for(let e of this._children)e.destroy();for(let e of this._nodes)e.destroy();this._children.clear(),this._nodes.clear()}value(e){let n=new aG(e);return this._nodes.add(n),n}derive(e,n){let r=e.map(s=>s instanceof tC?s:this.value(s)),i=new J8e(()=>n(...r.map(s=>s.value)),r);return this._nodes.add(i),i}statefulDerive(e,n){let r=e.map(s=>s instanceof tC?s:this.value(s)),i=new eTe(s=>n(s,...r.map(o=>o.value)),r);return this._nodes.add(i),i}if(e,n,r){let i=new tTe(this,e,n,r);return this._nodes.add(i),i}switch(e,n){let r=new rTe(this,e,n);return this._nodes.add(r),r}map(e,n){let r=new nTe(this,e,n);return this._nodes.add(r),r}assertNotNull(e){return e}subgraph(){return new md(this)}}function Dl(t,e,n,r){if(t.program==null||t.vsSource!=n||t.fsSource!=r){t.destroy&&t.destroy();let s=vF(e,e.VERTEX_SHADER,n),o=vF(e,e.FRAGMENT_SHADER,r),a=e.createProgram();if(e.attachShader(a,s),e.attachShader(a,o),e.linkProgram(a),!e.getProgramParameter(a,e.LINK_STATUS)){var i=e.getProgramInfoLog(a);throw new Error(`failed to link program: ${i}, vertex source: ${n}, fragment source: ${r}`)}t.program=a,t.vsSource=n,t.fsSource=r,t.destroy=()=>{e.deleteProgram(a),e.deleteShader(s),e.deleteShader(o)},t.uniforms={};for(let l of(n+r).matchAll(/uniform +[0-9a-zA-Z_]+ +([0-9a-zA-Z_]+) *(;|\[)/g)){let u=l[1];t.uniforms[u]=e.getUniformLocation(a,u)}}return{program:t.program,uniforms:t.uniforms??{}}}function vF(t,e,n){let r=t.createShader(e);if(t.shaderSource(r,n),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){var i=t.getShaderInfoLog(r);throw new Error(`failed to compile shader: ${i}, source: ${n}`)}return r}function gl(t,e,n,r){if(t.buffer==null){let i=e.createBuffer();t.buffer=i,t.destroy=()=>{e.deleteBuffer(i)}}if(t.data!==n){if(t.data=n,e.bindBuffer(e.ARRAY_BUFFER,t.buffer),n instanceof Array)switch(r??"f32"){case"f32":e.bufferData(e.ARRAY_BUFFER,new Float32Array(n),e.STATIC_DRAW);break;case"i32":e.bufferData(e.ARRAY_BUFFER,new Int32Array(n),e.STATIC_DRAW);break;case"u32":e.bufferData(e.ARRAY_BUFFER,new Uint32Array(n),e.STATIC_DRAW);break;case"i16":e.bufferData(e.ARRAY_BUFFER,new Int16Array(n),e.STATIC_DRAW);break;case"u16":e.bufferData(e.ARRAY_BUFFER,new Uint16Array(n),e.STATIC_DRAW);break;case"i8":e.bufferData(e.ARRAY_BUFFER,new Int8Array(n),e.STATIC_DRAW);break;case"u8":e.bufferData(e.ARRAY_BUFFER,new Uint8Array(n),e.STATIC_DRAW);break;default:throw new Error("invalid type")}else e.bufferData(e.ARRAY_BUFFER,n,e.STATIC_DRAW);e.bindBuffer(e.ARRAY_BUFFER,null)}return t.buffer}function iTe(t,e,n,r,i){const s={u8:{1:[t.R8,t.RED,t.UNSIGNED_BYTE],2:[t.RG8,t.RG,t.UNSIGNED_BYTE],3:[t.RGB8,t.RGB,t.UNSIGNED_BYTE],4:[t.RGBA8,t.RGBA,t.UNSIGNED_BYTE]},u16:{1:[t.R8,t.RED,t.UNSIGNED_SHORT],2:[t.RG8,t.RG,t.UNSIGNED_SHORT],3:[t.RGB8,t.RGB,t.UNSIGNED_SHORT],4:[t.RGBA8,t.RGBA,t.UNSIGNED_SHORT]},u32:{1:[t.R8,t.RED,t.UNSIGNED_INT],2:[t.RG8,t.RG,t.UNSIGNED_INT],3:[t.RGB8,t.RGB,t.UNSIGNED_INT],4:[t.RGBA8,t.RGBA,t.UNSIGNED_INT]},f32:{1:[t.R32F,t.RED,t.FLOAT],2:[t.RG32F,t.RG,t.FLOAT],3:[t.RGB32F,t.RGB,t.FLOAT],4:[t.RGBA32F,t.RGBA,t.FLOAT]}};let[o,a,l]=s[i][r];t.texImage2D(t.TEXTURE_2D,0,o,e,n,0,a,l,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)}function Tc(t,e,n,r,i,s){if(t.framebuffer==null||t.texture==null){let a=e.createFramebuffer(),l=e.createTexture();e.bindFramebuffer(e.FRAMEBUFFER,a),e.bindTexture(e.TEXTURE_2D,l),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l,0),e.bindTexture(e.TEXTURE_2D,null),e.bindFramebuffer(e.FRAMEBUFFER,null),t.framebuffer=a,t.texture=l,t.destroy=()=>{e.deleteFramebuffer(a),e.deleteTexture(l)}}let o=`${n},${r},${i},${s}`;return t.cacheKey!=o&&(t.cacheKey=o,e.bindTexture(e.TEXTURE_2D,t.texture),iTe(e,n,r,i,s),e.bindTexture(e.TEXTURE_2D,null)),{framebuffer:t.framebuffer,texture:t.texture,width:n,height:r}}function sTe(t){let e=t.squareMaxSize,n=t.samples,r=`#version 300 es precision highp float; layout(location=0) in vec2 xy; out vec2 uv; void main() { gl_Position = vec4(xy, 0, 1); uv = (xy + 1.0) / 2.0; } `,i=`#version 300 es precision highp float; uniform sampler2D image; uniform vec2 resolution; uniform vec2 direction; in vec2 uv; out vec4 outColor; void main() { vec4 color = vec4(0.0); const int count = ${e}; int i = -count; while(i + 1 <= count) { color += texture(image, uv + direction * (float(i) + 0.5) / resolution) * 2.0; i += 2; } if (i <= count) { color += texture(image, uv + direction * float(count) / resolution); } outColor = color; } `,s=`#version 300 es precision highp float; uniform sampler2D image; uniform sampler2D imageBox; uniform vec2 resolution; uniform float scaler; in vec2 uv; out vec4 outColor; void main() { vec4 color = texture(imageBox, uv); if (color != vec4(0.0)) { ${n.map(({x:o,y:a,w:l})=>`color -= texture(image, uv + vec2(${o.toFixed(8)}, ${a.toFixed(8)}) / resolution) * (${l.toFixed(8)})`).join(";")}; } outColor = color * scaler; } `;return{vertex:r,fragment1:i,fragment2:s}}function oTe(t,e,n){let r=t.derive([n],aTe),i=t.derive([r],sTe),s=t.statefulDerive([e,t.derive([i],l=>l.vertex),t.derive([i],l=>l.fragment1)],Dl),o=t.statefulDerive([e,t.derive([i],l=>l.vertex),t.derive([i],l=>l.fragment2)],Dl),a=t.statefulDerive([e,[-1,-1,-1,1,1,-1,1,1],"f32"],gl);return t.derive([e,a,s,o,n,r],(l,u,c,f,h,d)=>(p,m,g)=>{let{width:y,height:O}=m;l.disable(l.BLEND),l.enableVertexAttribArray(0),l.bindBuffer(l.ARRAY_BUFFER,u),l.vertexAttribPointer(0,2,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,null),l.useProgram(c.program),l.uniform2f(c.uniforms.resolution,y,O),l.uniform1i(c.uniforms.image,0),l.bindFramebuffer(l.FRAMEBUFFER,m.framebuffer),l.bindTexture(l.TEXTURE_2D,p),l.uniform2f(c.uniforms.direction,0,1),l.drawArrays(l.TRIANGLE_STRIP,0,4),l.bindFramebuffer(l.FRAMEBUFFER,g.framebuffer),l.bindTexture(l.TEXTURE_2D,m.texture),l.uniform2f(c.uniforms.direction,1,0),l.drawArrays(l.TRIANGLE_STRIP,0,4),l.bindFramebuffer(l.FRAMEBUFFER,m.framebuffer),l.activeTexture(l.TEXTURE1),l.bindTexture(l.TEXTURE_2D,g.texture),l.activeTexture(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,p),l.useProgram(f.program),l.uniform2f(f.uniforms.resolution,y,O),l.uniform1i(f.uniforms.image,0),l.uniform1i(f.uniforms.imageBox,1);let v=1/d.totalWeight*h*h*Math.PI;l.uniform1f(f.uniforms.scaler,v),l.drawArrays(l.TRIANGLE_STRIP,0,4),l.bindFramebuffer(l.FRAMEBUFFER,null),l.useProgram(null),l.activeTexture(l.TEXTURE1),l.bindTexture(l.TEXTURE_2D,null),l.activeTexture(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,null),l.disableVertexAttribArray(0)})}function wF(t,e,n){let r=Math.sqrt(e*e+n*n);if(rt+Math.sqrt(2)/2)return 0;let i=2,s=0;for(let o=0;o0&&a==i[i.length-1].x&&l==i[i.length-1].y+1){let c=i[i.length-1].w,f=u;i[i.length-1].y+=1-c/(c+f),i[i.length-1].w=c+f}else i.push({x:a,y:l,w:u})}i=i.sort((a,l)=>a.y!=l.y?a.y-l.y:a.x-l.x);let s=[];for(let{x:a,y:l,w:u}of i)if(s.length>0&&l==s[s.length-1].y&&a==s[s.length-1].x+1){let c=s[s.length-1].w,f=u;s[s.length-1].x+=1-c/(c+f),s[s.length-1].w=c+f}else s.push({x:a,y:l,w:u});let o=-s.reduce((a,l)=>a+l.w,0);return o+=r*(1+n*2)*(1+n*2),{squareMaxSize:n,squareWeight:r,samples:s,totalWeight:o}}function lTe(t){let e;return t?e=`#version 300 es precision highp float; uniform mat3 matrix; layout(location=0) in float x; layout(location=1) in float y; layout(location=2) in int category; out vec4 color; void main() { gl_Position = vec4(matrix * vec3(x, y, 1), 1); if (category == 0) { color = vec4(1, 0, 0, 0); } else if (category == 1) { color = vec4(0, 1, 0, 0); } else if (category == 2) { color = vec4(0, 0, 1, 0); } else if (category == 3) { color = vec4(0, 0, 0, 1); } gl_PointSize = 1.0; } `:e=`#version 300 es precision highp float; uniform mat3 matrix; layout(location=0) in float x; layout(location=1) in float y; out vec4 color; void main() { gl_Position = vec4(matrix * vec3(x, y, 1), 1); color = vec4(1, 0, 0, 0); gl_PointSize = 1.0; } `,{vertex:e,fragment:`#version 300 es precision highp float; in vec4 color; out vec4 outColor; void main() { outColor = color; } `}}function nC(t,e,n,r,i,s){let o=i!=null,a=lTe(o),l=t.statefulDerive([e,a.vertex,a.fragment],Dl);return t.derive([e,l,n,r,i,s],(u,c,f,h,d,p)=>m=>{u.enable(u.BLEND),u.blendFunc(u.ONE,u.ONE),u.useProgram(c.program),u.enableVertexAttribArray(0),u.bindBuffer(u.ARRAY_BUFFER,f),u.vertexAttribPointer(0,1,u.FLOAT,!1,0,0),u.enableVertexAttribArray(1),u.bindBuffer(u.ARRAY_BUFFER,h),u.vertexAttribPointer(1,1,u.FLOAT,!1,0,0),d!=null&&(u.enableVertexAttribArray(2),u.bindBuffer(u.ARRAY_BUFFER,d),u.vertexAttribIPointer(2,1,u.BYTE,0,0)),u.bindBuffer(u.ARRAY_BUFFER,null),u.uniformMatrix3fv(c.uniforms.matrix,!1,m),u.drawArrays(u.POINTS,0,p),u.disableVertexAttribArray(0),u.disableVertexAttribArray(1),d!=null&&u.disableVertexAttribArray(2),u.useProgram(null)})}function uTe(){return{vertex:`#version 300 es precision highp float; uniform vec2 xyScaler; layout(location=0) in vec2 xy; out vec2 uv; void main() { gl_Position = vec4(xy * xyScaler, 0, 1); uv = (xy + 1.0) / 2.0; } `,fragment:`#version 300 es precision highp float; uniform sampler2D source; uniform float gamma; in vec2 uv; out vec4 outColor; void main() { vec4 color = texture(source, uv); color.rgb = pow(color.rgb, vec3(1.0 / gamma)); outColor = color; } `}}function lG(t,e){let{vertex:n,fragment:r}=uTe(),i=t.statefulDerive([e,n,r],Dl),s=t.statefulDerive([e,[-1,-1,-1,1,1,-1,1,1],"f32"],gl);return t.derive([e,i,s],(o,a,l)=>(u,c,f,h)=>{o.disable(o.BLEND),o.enableVertexAttribArray(0),o.bindBuffer(o.ARRAY_BUFFER,l),o.vertexAttribPointer(0,2,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,null),o.bindTexture(o.TEXTURE_2D,u),o.useProgram(a.program),o.uniform1i(a.uniforms.source,0),o.uniform2f(a.uniforms.xyScaler,f??1,h??1),o.uniform1f(a.uniforms.gamma,c??2.2),o.drawArrays(o.TRIANGLE_STRIP,0,4),o.useProgram(null),o.bindTexture(o.TEXTURE_2D,null),o.disableVertexAttribArray(0)})}function uG(t){return Math.ceil(t*3)}function cTe(t){let e=uG(t),n=[];for(let a=-e;a<=e;a++)n.push(Math.exp(-a*a/t/t/2));let r=n.reduce((a,l)=>a+l,0);n=n.map(a=>a/r);let i=hTe(n).map(([a,l])=>[a-e,l]),s=`#version 300 es precision highp float; layout(location=0) in vec2 xy; out vec2 uv; void main() { gl_Position = vec4(xy, 0, 1); uv = (xy + 1.0) / 2.0; } `,o=`#version 300 es precision highp float; uniform sampler2D image; uniform vec2 resolution; uniform vec2 direction; in vec2 uv; out vec4 outColor; void main() { vec4 color = vec4(0.0); ${i.map(([a,l])=>`color += texture(image, uv + direction * vec2(${a.toFixed(10)}) / resolution) * ${l.toFixed(10)};`).join(` `)} outColor = color; } `;return{vertex:s,fragment:o}}function fTe(t,e,n){let r=t.derive([n],cTe),i=t.statefulDerive([e,t.derive([r],o=>o.vertex),t.derive([r],o=>o.fragment)],Dl),s=t.statefulDerive([e,[-1,-1,-1,1,1,-1,1,1],"f32"],gl);return t.derive([e,s,i,n],(o,a,l,u)=>(c,f,h)=>{let{width:d,height:p}=f;o.disable(o.BLEND),o.enableVertexAttribArray(0),o.bindBuffer(o.ARRAY_BUFFER,a),o.vertexAttribPointer(0,2,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,null),o.useProgram(l.program),o.uniform2f(l.uniforms.resolution,d,p),o.uniform1i(l.uniforms.image,0),o.bindFramebuffer(o.FRAMEBUFFER,h.framebuffer),o.bindTexture(o.TEXTURE_2D,c),o.uniform2f(l.uniforms.direction,0,1),o.drawArrays(o.TRIANGLE_STRIP,0,4),o.bindFramebuffer(o.FRAMEBUFFER,f.framebuffer),o.bindTexture(o.TEXTURE_2D,h.texture),o.uniform2f(l.uniforms.direction,1,0),o.drawArrays(o.TRIANGLE_STRIP,0,4),o.bindFramebuffer(o.FRAMEBUFFER,null),o.useProgram(null),o.bindTexture(o.TEXTURE_2D,null),o.disableVertexAttribArray(0)})}function hTe(t){let e=[];for(let n=0;n=0&&s<=1){let o=r+i;o!=0&&e.push([n+s,o])}else e.push([n,t[n]]),e.push([n+1,t[n+1]])}else e.push([n,t[n]]);return e}function dTe(t){return Math.ceil(t*3)}function pTe(){return{vertex:`#version 300 es precision highp float; layout(location=0) in vec2 xy; out vec2 uv; void main() { gl_Position = vec4(xy, 0, 1); uv = (xy + 1.0) / 2.0; } `,fragment:`#version 300 es precision highp float; uniform sampler2D image; uniform vec2 resolution; uniform vec2 direction; in vec2 uv; out vec4 outColor; uniform float weight0; uniform vec3 distances; uniform vec3 weights; void main() { vec4 color = texture(image, uv) * weight0; if (weights.x != 0.0) { color += texture(image, uv + direction * vec2(distances.x) / resolution) * weights.x; color += texture(image, uv - direction * vec2(distances.x) / resolution) * weights.x; } if (weights.y != 0.0) { color += texture(image, uv + direction * vec2(distances.y) / resolution) * weights.y; color += texture(image, uv - direction * vec2(distances.y) / resolution) * weights.y; } if (weights.z != 0.0) { color += texture(image, uv + direction * vec2(distances.z) / resolution) * weights.z; color += texture(image, uv - direction * vec2(distances.z) / resolution) * weights.z; } outColor = color; } `}}function mTe(t,e,n){let{vertex:r,fragment:i}=pTe(),s=t.statefulDerive([e,r,i],Dl),o=t.statefulDerive([e,[-1,-1,-1,1,1,-1,1,1],"f32"],gl);return t.derive([e,o,s],(a,l,u)=>(c,f,h)=>{let{width:d,height:p}=f;a.disable(a.BLEND),a.enableVertexAttribArray(0),a.bindBuffer(a.ARRAY_BUFFER,l),a.vertexAttribPointer(0,2,a.FLOAT,!1,0,0),a.bindBuffer(a.ARRAY_BUFFER,null),a.useProgram(u.program),a.uniform2f(u.uniforms.resolution,d,p),a.uniform1i(u.uniforms.image,0);let m=c,g=h,y=f;for(let O=0;O<2;O++){a.uniform2f(u.uniforms.direction,O,1-O);for(let[v,w,x]of gTe){a.bindFramebuffer(a.FRAMEBUFFER,g.framebuffer),a.bindTexture(a.TEXTURE_2D,m),a.uniform1fv(u.uniforms.weight0,w),a.uniform3fv(u.uniforms.distances,v),a.uniform3fv(u.uniforms.weights,x),a.drawArrays(a.TRIANGLE_STRIP,0,4),m=g.texture;let S=g;g=y,y=S}}a.bindFramebuffer(a.FRAMEBUFFER,null),a.useProgram(null),a.bindTexture(a.TEXTURE_2D,null),a.disableVertexAttribArray(0)})}const gTe=[[[1,2,3],[.2288468365182578],[.18230006506971572,.1356122230111784,.06766429365997693]],[[2,6,10],[.09116254014100238],[.23317759354726447,.18385867277788717,.03738246360434722]],[[3,10,20],[.2950645715317288],[.010918865853671198,.23773695670296047,.10381189167750389]],[[4,16,30],[.20085957073474772],[.14463019087130788,.17934533765938643,.07559468610193185]]];function yTe(){return{vertex:`#version 300 es precision highp float; layout(location=0) in vec2 xy; out vec2 uv; void main() { gl_Position = vec4(xy, 0, 1); uv = (xy + 1.0) / 2.0; } `,fragment:`#version 300 es precision highp float; uniform sampler2D source; uniform vec2 resolution; uniform float densityScaler; uniform float quantizationStep; uniform vec4 channelMask; uniform vec4 color; uniform float globalAlpha; in vec2 uv; out vec4 outColor; float sample_density(vec2 uv) { float d = dot(texture(source, uv), channelMask) * densityScaler; d = min(1.0, max(0.0, d)); d = floor(d / quantizationStep); return d; } void main() { // Run the Sobel operator. float v = sample_density(uv); float v11 = sample_density(uv + vec2(-1, -1) / resolution); float v12 = sample_density(uv + vec2(-1, 0) / resolution); float v13 = sample_density(uv + vec2(-1, +1) / resolution); float v21 = sample_density(uv + vec2( 0, -1) / resolution); float v23 = sample_density(uv + vec2( 0, +1) / resolution); float v31 = sample_density(uv + vec2(+1, -1) / resolution); float v32 = sample_density(uv + vec2(+1, 0) / resolution); float v33 = sample_density(uv + vec2(+1, +1) / resolution); float gx = v11 + v12 * 2.0 + v13 - v31 - v32 * 2.0 - v33; float gy = v11 + v21 * 2.0 + v31 - v13 - v23 * 2.0 - v33; // Derive alpha value from the result. float alpha = length(vec2(gx, gy)) * 0.2; alpha = min(1.0, max(0.0, alpha)); outColor = color * alpha * globalAlpha; } `}}function bTe(t,e){let{vertex:n,fragment:r}=yTe(),i=t.statefulDerive([e,n,r],Dl),s=t.statefulDerive([e,[-1,-1,-1,1,1,-1,1,1],"f32"],gl);return t.derive([e,i,s],(o,a,l)=>(u,c,f,h,d,p)=>{o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA),o.enableVertexAttribArray(0),o.bindBuffer(o.ARRAY_BUFFER,l),o.vertexAttribPointer(0,2,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,null),o.bindTexture(o.TEXTURE_2D,u.texture),o.useProgram(a.program),o.uniform1i(a.uniforms.source,0),o.uniform2f(a.uniforms.resolution,u.width,u.height),o.uniform1f(a.uniforms.densityScaler,c),o.uniform1f(a.uniforms.quantizationStep,f),o.uniform1f(a.uniforms.globalAlpha,h),o.uniform4fv(a.uniforms.channelMask,d),o.uniform4fv(a.uniforms.color,p),o.drawArrays(o.TRIANGLE_STRIP,0,4),o.useProgram(null),o.bindTexture(o.TEXTURE_2D,null),o.disableVertexAttribArray(0)})}function OTe(){return{vertex:`#version 300 es precision highp float; layout(location=0) in vec2 xy; out vec2 uv; void main() { gl_Position = vec4(xy, 0, 1); uv = (xy + 1.0) / 2.0; } `,fragment:`#version 300 es precision highp float; uniform sampler2D source; uniform vec2 resolution; uniform float densityScaler; uniform float quantizationStep; uniform mat4 colorMatrix; uniform int isDarkMode; uniform float globalAlpha; in vec2 uv; out vec4 outColor; /* Combine alphas with symmetric blending equation f(a, b) = a + b - ab. */ float combine_alphas(vec4 alphas) { float r = alphas.x + alphas.y - alphas.x * alphas.y; r = r + alphas.z - r * alphas.z; r = r + alphas.w - r * alphas.w; return r; } void main() { vec4 density = texture(source, uv) * densityScaler; if (density.x > 1.0 || density.y > 1.0 || density.z > 1.0 || density.w > 1.0) { density = density / max(max(max(density.x, density.y), density.z), density.w); } else { density = floor(density / quantizationStep) * quantizationStep; } if (density.x + density.y + density.z + density.w == 0.0) { discard; } float alpha = combine_alphas(density); density *= alpha / (density.x + density.y + density.z + density.w); vec3 c1 = colorMatrix[0].rgb * density.x; vec3 c2 = colorMatrix[1].rgb * density.y; vec3 c3 = colorMatrix[2].rgb * density.z; vec3 c4 = colorMatrix[3].rgb * density.w; vec3 c; if (isDarkMode == 0) { c = vec3(1.0) - alpha + c1 + c2 + c3 + c4; } else { c = c1 + c2 + c3 + c4; } outColor = vec4(c, 1.0) * alpha * globalAlpha; } `}}function vTe(t,e){let{vertex:n,fragment:r}=OTe(),i=t.statefulDerive([e,n,r],Dl),s=t.statefulDerive([e,[-1,-1,-1,1,1,-1,1,1],"f32"],gl);return t.derive([e,i,s],(o,a,l)=>(u,c,f,h,d,p)=>{o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA),o.enableVertexAttribArray(0),o.bindBuffer(o.ARRAY_BUFFER,l),o.vertexAttribPointer(0,2,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,null),o.bindTexture(o.TEXTURE_2D,u.texture),o.useProgram(a.program),o.uniform1i(a.uniforms.source,0),o.uniform2f(a.uniforms.resolution,u.width,u.height),o.uniform1f(a.uniforms.densityScaler,c),o.uniform1f(a.uniforms.quantizationStep,f),o.uniform1f(a.uniforms.globalAlpha,h),o.uniform1i(a.uniforms.isDarkMode,p=="dark"?1:0),o.uniformMatrix4fv(a.uniforms.colorMatrix,!1,d),o.drawArrays(o.TRIANGLE_STRIP,0,4),o.useProgram(null),o.bindTexture(o.TEXTURE_2D,null),o.disableVertexAttribArray(0)})}function wTe(t){let e;return t?e=`#version 300 es precision highp float; uniform mat3 matrix; uniform float point_size; uniform float alpha; uniform vec4 colorScheme[64]; layout(location=0) in float x; layout(location=1) in float y; layout(location=2) in int category; out vec4 color; void main() { gl_Position = vec4(matrix * vec3(x, y, 1), 1); if (category < 64) { color = colorScheme[category]; } else { color = vec4(0.5, 0.5, 0.5, 1); } color *= alpha; gl_PointSize = point_size; } `:e=`#version 300 es precision highp float; uniform mat3 matrix; uniform float point_size; uniform vec4 colorScheme; uniform float alpha; layout(location=0) in float x; layout(location=1) in float y; out vec4 color; void main() { gl_Position = vec4(matrix * vec3(x, y, 1), 1); color = colorScheme; color *= alpha; gl_PointSize = point_size; } `,{vertex:e,fragment:`#version 300 es precision highp float; uniform float point_size; in vec4 color; out vec4 outColor; void main() { float r = length(gl_PointCoord.xy - vec2(0.5, 0.5)) * point_size; float a = max(0.0, min(1.0, point_size / 2.0 - r)); outColor = color * a; } `}}function xF(t,e,n,r,i,s){let o=i!=null,a=wTe(o),l=t.statefulDerive([e,a.vertex,a.fragment],Dl);return t.derive([e,l,n,r,i,s],(u,c,f,h,d,p)=>(m,g,y,O)=>{u.enable(u.BLEND),u.blendFunc(u.ONE,u.ONE_MINUS_SRC_ALPHA),u.useProgram(c.program),u.enableVertexAttribArray(0),u.bindBuffer(u.ARRAY_BUFFER,f),u.vertexAttribPointer(0,1,u.FLOAT,!1,0,0),u.enableVertexAttribArray(1),u.bindBuffer(u.ARRAY_BUFFER,h),u.vertexAttribPointer(1,1,u.FLOAT,!1,0,0),d!=null&&(u.enableVertexAttribArray(2),u.bindBuffer(u.ARRAY_BUFFER,d),u.vertexAttribIPointer(2,1,u.BYTE,0,0)),u.bindBuffer(u.ARRAY_BUFFER,null),u.uniformMatrix3fv(c.uniforms.matrix,!1,m),u.uniform1f(c.uniforms.point_size,g*2),u.uniform1f(c.uniforms.alpha,y),o?u.uniform4fv(c.uniforms.colorScheme,O):u.uniform4fv(c.uniforms.colorScheme,O.slice(0,4)),u.drawArrays(u.POINTS,0,p),u.disableVertexAttribArray(0),u.disableVertexAttribArray(1),d!=null&&u.disableVertexAttribArray(2),u.useProgram(null)})}function xTe(){return{vertex:`#version 300 es precision highp float; layout(location=0) in vec2 xy; out vec2 uv; void main() { gl_Position = vec4(xy, 0, 1); uv = (xy + 1.0) / 2.0; } `,fragment:`#version 300 es precision highp float; uniform sampler2D source; uniform vec2 resolution; uniform mat4 colorMatrix; uniform float pointAlpha; uniform float globalAlpha; uniform int isDarkMode; in vec2 uv; out vec4 outColor; /* Combine alphas with symmetric blending equation f(a, b) = a + b - ab. */ float combine_alphas(vec4 alphas) { float r = alphas.x + alphas.y - alphas.x * alphas.y; r = r + alphas.z - r * alphas.z; r = r + alphas.w - r * alphas.w; return r; } void main() { vec4 count = texture(source, uv); vec4 alphas = pointAlpha >= 0.999 ? vec4(count.x > 0.0 ? 1.0 : 0.0, count.y > 0.0 ? 1.0 : 0.0, count.z > 0.0 ? 1.0 : 0.0, count.w > 0.0 ? 1.0 : 0.0) : vec4(1.0) - pow(vec4(1.0 - pointAlpha), count); float a = combine_alphas(alphas); if (a <= 0.0) { discard; } alphas *= a / (alphas.x + alphas.y + alphas.z + alphas.w); vec3 c1 = colorMatrix[0].rgb * alphas.x; vec3 c2 = colorMatrix[1].rgb * alphas.y; vec3 c3 = colorMatrix[2].rgb * alphas.z; vec3 c4 = colorMatrix[3].rgb * alphas.w; vec3 c; if (isDarkMode == 0) { c = vec3(1.0) - a + c1 + c2 + c3 + c4; } else { c = c1 + c2 + c3 + c4; } outColor = vec4(c, 1.0) * a * globalAlpha; } `}}function _Te(t,e){let{vertex:n,fragment:r}=xTe(),i=t.statefulDerive([e,n,r],Dl),s=t.statefulDerive([e,[-1,-1,-1,1,1,-1,1,1],"f32"],gl);return t.derive([e,i,s],(o,a,l)=>(u,c,f,h,d)=>{o.enable(o.BLEND),o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA),o.enableVertexAttribArray(0),o.bindBuffer(o.ARRAY_BUFFER,l),o.vertexAttribPointer(0,2,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,null),o.bindTexture(o.TEXTURE_2D,u.texture),o.useProgram(a.program),o.uniform1i(a.uniforms.source,0),o.uniform2f(a.uniforms.resolution,u.width,u.height),o.uniform1f(a.uniforms.pointAlpha,c),o.uniform1f(a.uniforms.globalAlpha,f),o.uniform1i(a.uniforms.isDarkMode,d=="dark"?1:0),o.uniformMatrix4fv(a.uniforms.colorMatrix,!1,h),o.drawArrays(o.TRIANGLE_STRIP,0,4),o.useProgram(null),o.bindTexture(o.TEXTURE_2D,null),o.disableVertexAttribArray(0)})}class STe{props;viewport;df;gl;renderInputs;dataBuffers;renderer;constructor(e,n,r){this.props={mode:"points",colorScheme:"light",x:new Float32Array,y:new Float32Array,category:null,categoryCount:1,categoryColors:null,viewportX:0,viewportY:0,viewportScale:1,pointSize:1,pointAlpha:1,pointsAlpha:1,densityScaler:1,densityBandwidth:1,densityQuantizationStep:.1,contoursAlpha:1,densityAlpha:1,gamma:2.2,width:n,height:r,downsampleMaxPoints:4e6,downsampleDensityWeight:5},this.viewport=new Cw({x:0,y:0,scale:1},n,r);let i=new md,s=i.value(e);this.df=i,this.gl=s,this.renderInputs={mode:i.value(this.props.mode),colorScheme:i.value(this.props.colorScheme),xData:i.value(this.props.x),yData:i.value(this.props.y),categoryData:i.value(this.props.category),categoryCount:i.value(this.props.categoryCount),matrix:i.value(iG()),width:i.value(n),height:i.value(r),pointSize:i.value(this.props.pointSize),densityBandwidth:i.value(this.props.densityBandwidth),downsampleMaxPoints:i.value(this.props.downsampleMaxPoints),downsampleDensityWeight:i.value(this.props.downsampleDensityWeight)},this.dataBuffers=kTe(i,s,this.renderInputs),this.renderer=CTe(i,s,this.renderInputs,this.dataBuffers)}setProps(e){let n=!1,r;for(r in e)e[r]!==this.props[r]&&(this.props[r]=e[r],n=!0);return this.viewport.update({x:this.props.viewportX,y:this.props.viewportY,scale:this.props.viewportScale},this.props.width,this.props.height),this.renderInputs.mode.value=this.props.mode,this.renderInputs.colorScheme.value=this.props.colorScheme,this.renderInputs.xData.value=this.props.x,this.renderInputs.yData.value=this.props.y,this.renderInputs.categoryData.value=this.props.category,this.props.category!=null?this.renderInputs.categoryCount.value=this.props.categoryCount:this.renderInputs.categoryCount.value=1,this.renderInputs.matrix.value=this.viewport.matrix(),this.renderInputs.width.value=this.props.width,this.renderInputs.height.value=this.props.height,this.renderInputs.pointSize.value=this.props.pointSize,this.renderInputs.densityBandwidth.value=this.props.densityBandwidth,this.renderInputs.downsampleMaxPoints.value=this.props.downsampleMaxPoints,this.renderInputs.downsampleDensityWeight.value=this.props.downsampleDensityWeight,n}render(){this.renderer.value(this.props)}destroy(){this.df.destroy()}async densityMap(e,n,r,i){let s=this.df.subgraph(),o=TTe(s,this.gl,this.dataBuffers,s.value(e),s.value(n),s.value(r)),{x:a,y:l,scale:u}=i,c=[u,0,0,0,u,0,-a*u,-l*u,1],f=o.value(c),h=oG(c);return s.destroy(),{data:f,width:e,height:n,coordinateAtPixel:(d,p)=>{let m=d/e*2-1,g=p/n*2-1,y=sG([m,g,1],h);return{x:y[0],y:y[1]}}}}}function kTe(t,e,n){const r=t.statefulDerive([e,n.xData,"f32"],gl),i=t.statefulDerive([e,n.yData,"f32"],gl),s=t.if(t.derive([n.categoryData],a=>a!=null),a=>a.statefulDerive([e,a.assertNotNull(n.categoryData),"u8"],gl),a=>a.value(null)),o=t.derive([n.xData],a=>a.length);return{x:r,y:i,category:s,count:o}}function CTe(t,e,n,r){return t.switch(n.mode,{points:i=>ATe(i,e,n,r),density:i=>ETe(i,e,n,r)})}function ATe(t,e,n,r){const i=t.derive([n.categoryCount],l=>l>1),s=t.statefulDerive([e,n.width,n.height,4,"f32"],Tc);let o=t.if(i,l=>xF(l,e,r.x,r.y,l.assertNotNull(r.category),r.count),l=>xF(l,e,r.x,r.y,null,r.count)),a=lG(t,e);return t.derive([e,s,o,a,n.colorScheme,n.matrix,n.categoryCount],(l,u,c,f,h,d,p)=>m=>{let g=[],y=m.categoryColors??S0(m.categoryCount);for(let O=0;OdTe(v)+1),s=t.derive([n.width,i],(v,w)=>v+w*2),o=t.derive([n.height,i],(v,w)=>v+w*2);const a=t.derive([n.categoryCount],v=>v>1),l=t.statefulDerive([e,s,o,4,"f32"],Tc),u=t.statefulDerive([e,s,o,4,"f32"],Tc),c=t.statefulDerive([e,s,o,4,"f32"],Tc),f=t.statefulDerive([e,s,o,4,"f32"],Tc);let h=t.if(a,v=>nC(v,e,r.x,r.y,v.assertNotNull(r.category),r.count),v=>nC(v,e,r.x,r.y,null,r.count)),d=oTe(t,e,n.pointSize),p=mTe(t,e,n.densityBandwidth),m=_Te(t,e),g=vTe(t,e),y=bTe(t,e),O=lG(t,e);return t.derive([e,l,u,c,f,n.colorScheme,n.matrix,h,d,p,m,g,y,O],(v,w,x,S,_,k,C,D,A,E,T,R,$,Q)=>B=>{let q=B.categoryColors??S0(B.categoryCount),z=[];for(let H=0;H<4;H++)if(H0&&B.pointsAlpha>0&&(A(w.texture,S,_),v.bindFramebuffer(v.FRAMEBUFFER,x.framebuffer),T(S,B.pointAlpha,B.pointsAlpha,z,k)),B.densityScaler>0&&(B.densityAlpha>0||B.contoursAlpha>0)&&(E(w.texture,S,_),v.bindFramebuffer(v.FRAMEBUFFER,x.framebuffer),B.densityAlpha>0&&R(S,B.densityScaler,B.densityQuantizationStep,B.densityAlpha,z,k),B.contoursAlpha>0))for(let H=0;HuG(p)+1),a=t.derive([r,o],(p,m)=>p+m*2),l=t.derive([i,o],(p,m)=>p+m*2);const u=t.statefulDerive([e,a,l,1,"f32"],Tc),c=t.statefulDerive([e,a,l,1,"f32"],Tc),f=t.statefulDerive([e,a,l,1,"f32"],Tc);let h=nC(t,e,n.x,n.y,null,n.count),d=fTe(t,e,s);return t.derive([e,o,r,i,u,c,f,h,d],(p,m,g,y,O,v,w,x,S)=>_=>{let k=g/O.width,C=y/O.height,D=V8([k,0,0,0,C,0,0,0,1],_);p.bindFramebuffer(p.FRAMEBUFFER,O.framebuffer),p.viewport(0,0,O.width,O.height),p.clearColor(0,0,0,0),p.clear(p.COLOR_BUFFER_BIT),x(D),S(O.texture,v,w),p.bindFramebuffer(p.FRAMEBUFFER,v.framebuffer);let A=new Float32Array(g*y);return p.readPixels(m,m,g,y,p.RED,p.FLOAT,A),p.bindFramebuffer(p.FRAMEBUFFER,null),A})}class DTe{i32View;u32View;f32View;offset;constructor(e){this.i32View=new Int32Array(e),this.u32View=new Uint32Array(e),this.f32View=new Float32Array(e),this.offset=0}align2(){this.offset%2!=0&&(this.offset+=2-this.offset%2)}align4(){this.offset%4!=0&&(this.offset+=4-this.offset%4)}f32(e){this.f32View[this.offset++]=e}u32(e){this.u32View[this.offset++]=e}i32(e){this.i32View[this.offset++]=e}vec2f(e,n){this.align2(),this.f32View[this.offset++]=e,this.f32View[this.offset++]=n}vec3f(e,n,r){this.align4(),this.f32View[this.offset++]=e,this.f32View[this.offset++]=n,this.f32View[this.offset++]=r}vec4f(e,n,r,i){this.align4(),this.f32View[this.offset++]=e,this.f32View[this.offset++]=n,this.f32View[this.offset++]=r,this.f32View[this.offset++]=i}mat3x3f(e){this.vec3f(e[0],e[1],e[2]),this.vec3f(e[3],e[4],e[5]),this.vec3f(e[6],e[7],e[8])}byteOffset(){return this.offset*4}}function PTe(t,e){let n=new ArrayBuffer(4288),r=t.statefulDerive([e,4288,GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX],$u);return{buffer:r,update:t.derive([e,r],(i,s)=>o=>{let a=new DTe(n);a.u32(o.count),a.u32(o.category_count),a.i32(o.framebuffer_width),a.i32(o.framebuffer_height),a.i32(o.density_width),a.i32(o.density_height),a.f32(o.gamma),a.f32(o.point_size),a.f32(o.point_alpha),a.f32(o.points_alpha),a.f32(o.density_scaler),a.f32(o.quantization_step),a.f32(o.density_alpha),a.f32(o.contours_alpha),a.mat3x3f(o.matrix),a.vec2f(...o.view_xy_scaler),a.vec4f(...o.kde_causal),a.vec4f(...o.kde_anticausal),a.vec4f(...o.kde_a),a.vec4f(...o.background_color);let l=o.gamma;for(let u=0;ua.createComputePipeline({layout:a.createPipelineLayout({bindGroupLayouts:[u.group0,u.group1,u.group2A]}),compute:{module:l,entryPoint:"accumulate"}}));return t.derive([o,r.group0,r.group1,r.group2A,s.countBuffer,i.count],(a,l,u,c,f,h)=>d=>{if(d.clearBuffer(f),h==0)return;let p=d.beginComputePass();p.setPipeline(a),p.setBindGroup(0,l),p.setBindGroup(1,u),p.setBindGroup(2,c),h<=tk*nk?p.dispatchWorkgroups(Math.ceil(h/tk)):p.dispatchWorkgroups(nk,Math.ceil(h/(tk*nk))),p.end()})}function RTe(t){const{COMPUTE:e,VERTEX:n,FRAGMENT:r}=GPUShaderStage;return{group0:t.createBindGroupLayout({entries:[{binding:0,visibility:e|n|r,buffer:{type:"uniform"}}]}),group1:t.createBindGroupLayout({entries:[{binding:0,visibility:e|n,buffer:{type:"read-only-storage"}},{binding:1,visibility:e|n,buffer:{type:"read-only-storage"}},{binding:2,visibility:e|n,buffer:{type:"read-only-storage"}}]}),group2A:t.createBindGroupLayout({entries:[{binding:0,visibility:e|r,buffer:{type:"storage"}}]}),group2B:t.createBindGroupLayout({entries:[{binding:1,visibility:e|r,buffer:{type:"storage"}},{binding:2,visibility:e|r,buffer:{type:"storage"}}]}),group3:t.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"non-filtering"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}}]})}}function fG(t,e,n,r,i){let s=t.derive([e],f=>RTe(f)),o=t.derive([e,s,n],(f,h,d)=>f.createBindGroup({layout:h.group0,entries:[{binding:0,resource:{buffer:d}}]})),a=t.derive([e,s,r.x,r.y,r.category],(f,h,d,p,m)=>f.createBindGroup({layout:h.group1,entries:[{binding:0,resource:{buffer:d}},{binding:1,resource:{buffer:p}},{binding:2,resource:{buffer:m??d}}]})),l=t.derive([e,s,i.countBuffer,i.blurBuffer],(f,h,d,p)=>f.createBindGroup({layout:h.group2A,entries:[{binding:0,resource:{buffer:d}}]})),u=t.derive([e,s,i.countBuffer,i.blurBuffer],(f,h,d,p)=>f.createBindGroup({layout:h.group2B,entries:[{binding:1,resource:{buffer:d}},{binding:2,resource:{buffer:p}}]})),c=t.derive([e,s,i.colorTexture,i.alphaTexture],(f,h,d,p)=>f.createBindGroup({layout:h.group3,entries:[{binding:0,resource:f.createSampler({})},{binding:1,resource:d.createView()},{binding:2,resource:p.createView()}]}));return{layouts:s,group0:o,group1:a,group2A:l,group2B:u,group3:c}}const hG=256,rC=256,ITe=rC*hG;function FTe(t){const e=Math.ceil(t/hG);if(e<=rC)return[e,1];const n=Math.ceil(t/ITe);return[rC,n]}function $Te(t,e,n,r){const i=t.statefulDerive([e,t.value(16),GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST],$u),s=t.statefulDerive([e,t.value(16),GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST],$u),o=t.derive([n],h=>Math.max(4,h*4)),a=t.statefulDerive([e,o,GPUBufferUsage.STORAGE],$u),l=t.derive([e],h=>h.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:2,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}}]})),u=t.derive([e,l,i,s,a],(h,d,p,m,g)=>h.createBindGroup({layout:d,entries:[{binding:0,resource:{buffer:p}},{binding:1,resource:{buffer:m}},{binding:2,resource:{buffer:g}}]})),c=t.derive([e],h=>h.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.VERTEX,buffer:{type:"read-only-storage"}}]})),f=t.derive([e,c,a],(h,d,p)=>h.createBindGroup({layout:d,entries:[{binding:0,resource:{buffer:p}}]}));return{uniformBuffer:i,countersBuffer:s,pointDataBuffer:a,bindGroupLayout:l,bindGroup:u,vertexBindGroupLayout:c,vertexBindGroup:f}}function MTe(t,e,n,r,i,s,o,a,l,u){const c=t.derive([e],g=>g.createBindGroupLayout({entries:[{binding:1,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}}]})),f=t.derive([e,c,s],(g,y,O)=>g.createBindGroup({layout:y,entries:[{binding:1,resource:{buffer:O}}]})),h=t.derive([e],g=>g.createBindGroupLayout({entries:[]})),d=t.derive([e,h],(g,y)=>g.createBindGroup({layout:y,entries:[]})),p=t.derive([e,n,r,i,c,l.bindGroupLayout],(g,y,O,v,w,x)=>g.createComputePipeline({layout:g.createPipelineLayout({bindGroupLayouts:[O,v,w,x]}),compute:{module:y,entryPoint:"downsample_viewport_cull"}})),m=t.derive([e,n,r,i,h,l.bindGroupLayout],(g,y,O,v,w,x)=>g.createComputePipeline({layout:g.createPipelineLayout({bindGroupLayouts:[O,v,w,x]}),compute:{module:y,entryPoint:"downsample_density_sample"}}));return t.derive([e,p,m,o,a,f,d,l.bindGroup,l.uniformBuffer,l.countersBuffer,u.count],(g,y,O,v,w,x,S,_,k,C,D)=>(A,E)=>{if(D===0||E.maxPoints<=0)return 0;const T=new ArrayBuffer(16),R=new DataView(T);R.setUint32(0,E.maxPoints,!0),R.setUint32(4,E.frameSeed,!0),R.setFloat32(8,E.densityWeight,!0),R.setFloat32(12,0,!0),g.queue.writeBuffer(k,0,T),A.clearBuffer(C);const[$,Q]=FTe(D);{const B=A.beginComputePass();B.setPipeline(y),B.setBindGroup(0,v),B.setBindGroup(1,w),B.setBindGroup(2,x),B.setBindGroup(3,_),B.dispatchWorkgroups($,Q),B.end()}{const B=A.beginComputePass();B.setPipeline(O),B.setBindGroup(0,v),B.setBindGroup(1,w),B.setBindGroup(2,S),B.setBindGroup(3,_),B.dispatchWorkgroups($,Q),B.end()}})}function LTe(t,e,n,r,i){const s=t.derive([e,n,r.layouts],(o,a,l)=>o.createRenderPipeline({layout:o.createPipelineLayout({bindGroupLayouts:[l.group0,l.group1,l.group2B]}),vertex:{entryPoint:"draw_density_map_vs",module:a},fragment:{entryPoint:"draw_density_map_fs",module:a,targets:[{format:i.colorTextureFormat,blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcFactor:"one",dstFactor:"one"}}},{format:i.alphaTextureFormat,blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcFactor:"one",dstFactor:"one"}}}]},primitive:{topology:"triangle-strip"}}));return t.derive([s,r.group0,r.group1,r.group2B,i.colorTexture,i.alphaTexture],(o,a,l,u,c,f)=>h=>{let d=h.beginRenderPass({colorAttachments:[{loadOp:"load",storeOp:"store",view:c.createView()},{loadOp:"load",storeOp:"store",view:f.createView()}]});d.setPipeline(o),d.setBindGroup(0,a),d.setBindGroup(1,l),d.setBindGroup(2,u),d.draw(4),d.end()})}function NTe(t,e,n,r,i,s){const o=t.derive([e,n,r.layouts],(a,l,u)=>a.createRenderPipeline({layout:a.createPipelineLayout({bindGroupLayouts:[u.group0,u.group1]}),vertex:{entryPoint:"points_vs",module:l},fragment:{entryPoint:"points_fs",module:l,targets:[{format:s.colorTextureFormat,blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcFactor:"one",dstFactor:"one"}}},{format:s.alphaTextureFormat,blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcFactor:"one",dstFactor:"one"}}}]},primitive:{topology:"triangle-strip"}}));return t.derive([o,r.group0,r.group1,i.count,s.colorTexture,s.alphaTexture],(a,l,u,c,f,h)=>d=>{let p=d.beginRenderPass({colorAttachments:[{clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store",view:f.createView()},{clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store",view:h.createView()}]});p.setPipeline(a),p.setBindGroup(0,l),p.setBindGroup(1,u),c>0&&p.draw(4,c),p.end()})}function QTe(t,e,n,r,i,s){const o=t.derive([e,n,r.layouts,i.vertexBindGroupLayout],(a,l,u,c)=>a.createRenderPipeline({layout:a.createPipelineLayout({bindGroupLayouts:[u.group0,u.group1,c]}),vertex:{entryPoint:"points_downsampled_vs",module:l},fragment:{entryPoint:"points_fs",module:l,targets:[{format:s.colorTextureFormat,blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcFactor:"one",dstFactor:"one"}}},{format:s.alphaTextureFormat,blend:{color:{srcFactor:"one",dstFactor:"one"},alpha:{srcFactor:"one",dstFactor:"one"}}}]},primitive:{topology:"triangle-strip"}}));return t.derive([o,r.group0,r.group1,i.vertexBindGroup,s.colorTexture,s.alphaTexture],(a,l,u,c,f,h)=>(d,p)=>{let m=d.beginRenderPass({colorAttachments:[{clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store",view:f.createView()},{clearValue:[0,0,0,0],loadOp:"clear",storeOp:"store",view:h.createView()}]});m.setPipeline(a),m.setBindGroup(0,l),m.setBindGroup(1,u),m.setBindGroup(2,c),p>0&&m.draw(4,p),m.end()})}function BTe(t,e,n,r,i){const s=t.derive([e,n,i.layouts],(o,a,l)=>o.createRenderPipeline({layout:o.createPipelineLayout({bindGroupLayouts:[l.group0,l.group1,l.group2B,l.group3]}),vertex:{entryPoint:"gamma_correction_vs",module:a},fragment:{entryPoint:"gamma_correction_fs",module:a,targets:[{format:r}]},primitive:{topology:"triangle-strip"}}));return t.derive([s,i.group0,i.group1,i.group2B,i.group3],(o,a,l,u,c)=>(f,h)=>{let d=f.beginRenderPass({colorAttachments:[{clearValue:[1,1,1,1],loadOp:"clear",storeOp:"store",view:h}]});d.setPipeline(o),d.setBindGroup(0,a),d.setBindGroup(1,l),d.setBindGroup(2,u),d.setBindGroup(3,c),d.draw(4),d.end()})}const _F=64;function dG(t,e,n,r,i,s,o){let a=t.derive([e,n,r.layouts],(u,c,f)=>u.createComputePipeline({layout:u.createPipelineLayout({bindGroupLayouts:[f.group0,f.group1,f.group2B,f.group3]}),compute:{module:c,entryPoint:"gaussian_blur_stage_1"}})),l=t.derive([e,n,r.layouts],(u,c,f)=>u.createComputePipeline({layout:u.createPipelineLayout({bindGroupLayouts:[f.group0,f.group1,f.group2B,f.group3]}),compute:{module:c,entryPoint:"gaussian_blur_stage_2"}}));return t.derive([a,l,r.group0,r.group1,r.group2B,r.group3,i,s,o],(u,c,f,h,d,p,m,g,y)=>O=>{let v=O.beginComputePass();v.setBindGroup(0,f),v.setBindGroup(1,h),v.setBindGroup(2,d),v.setBindGroup(3,p),v.setPipeline(u),v.dispatchWorkgroups(Math.ceil(m/_F),y),v.setPipeline(c),v.dispatchWorkgroups(Math.ceil(g/_F),y),v.end()})}function zTe(t,e=!1){const n=new Float64Array(5),r=new Float64Array(4);UTe(n,r,t);const i=Float64Array.of(0,r[1]-n[1]*r[0],r[2]-n[2]*r[0],r[3]-n[3]*r[0],-n[4]*r[0]),s=1+n[1]+n[2]+n[3]+n[4],o=(r[0]+r[1]+r[2]+r[3])/s,a=(i[1]+i[2]+i[3]+i[4])/s;return{sigma:t,negative:e,a:n,b_causal:r,b_anticausal:i,sum_causal:o,sum_anticausal:a}}function UTe(t,e,n){const r=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),i=Math.exp(-1.783/n),s=Math.exp(-1.723/n),o=.6318/n,a=1.997/n,l=Float64Array.of(-i*Math.cos(o),i*Math.sin(o),-i*Math.cos(-o),i*Math.sin(-o),-s*Math.cos(a),s*Math.sin(a),-s*Math.cos(-a),s*Math.sin(-a)),u=n*2.5066282746310007,c=Float64Array.of(r[0],r[1],0,0,0,0,0,0),f=Float64Array.of(1,0,l[0],l[1],0,0,0,0,0,0);let h,d;for(d=2;d<8;d+=2){for(c[d]=l[d]*c[d-2]-l[d+1]*c[d-1],c[d+1]=l[d]*c[d-1]+l[d+1]*c[d-2],h=d-2;h>0;h-=2)c[h]+=l[d]*c[h-2]-l[d+1]*c[h-1],c[h+1]+=l[d]*c[h-1]+l[d+1]*c[h-2];for(h=0;h<=d;h+=2)c[h]+=r[d]*f[h]-r[d+1]*f[h+1],c[h+1]+=r[d]*f[h+1]+r[d+1]*f[h];for(f[d+2]=l[d]*f[d]-l[d+1]*f[d+1],f[d+3]=l[d]*f[d+1]+l[d+1]*f[d],h=d;h>0;h-=2)f[h]+=l[d]*f[h-2]-l[d+1]*f[h-1],f[h+1]+=l[d]*f[h-1]+l[d+1]*f[h-2]}for(d=0;d<4;++d)h=d<<1,e[d]=c[h]/u,t[d+1]=f[h+2]}function pG(t){let e=zTe(t);return{kde_causal:[e.b_causal[0],e.b_causal[1],e.b_causal[2],e.b_causal[3]],kde_anticausal:[e.b_anticausal[1],e.b_anticausal[2],e.b_anticausal[3],e.b_anticausal[4]],kde_a:[e.a[1],e.a[2],e.a[3],e.a[4]]}}const jTe=`// Copyright (c) 2025 Apple Inc. Licensed under MIT License. enable f16; struct Uniforms { count: u32, category_count: u32, framebuffer_width: i32, framebuffer_height: i32, density_width: i32, density_height: i32, gamma: f32, point_size: f32, point_alpha: f32, points_alpha: f32, density_scaler: f32, quantization_step: f32, density_alpha: f32, contours_alpha: f32, matrix: mat3x3, view_xy_scaler: vec2, kde_causal: vec4, kde_anticausal: vec4, kde_a: vec4, background_color: vec4, category_colors: array, 256>, } struct DownsampleUniforms { render_limit: u32, frame_seed: u32, density_weight: f32, _padding: f32, } struct PointData { position: vec3, category: u32, } struct FragmentOutput { @location(0) color: vec4, @location(1) log1malpha: f32, // log(1 - alpha) } @group(0) @binding(0) var uniforms: Uniforms; @group(1) @binding(0) var x_buffer: array; @group(1) @binding(1) var y_buffer: array; @group(1) @binding(2) var category_buffer: array; @group(2) @binding(0) var count_buffer: array>; @group(2) @binding(1) var blur_buffer: array; @group(2) @binding(2) var blur_swap_buffer: array; @group(3) @binding(0) var framebuffer_sampler: sampler; @group(3) @binding(1) var color_texture: texture_2d; @group(3) @binding(2) var log1malpha_texture: texture_2d; // Downsampling bind groups (group 3 for compute shaders) // WebGPU has a default limit of 4 bind groups, so we use group 3 (not 4) // 3 storage buffers to stay within 8-buffer limit (3 from group1 + 1 from group2 + 3 from group3 = 7) @group(3) @binding(0) var downsample_uniforms: DownsampleUniforms; @group(3) @binding(1) var downsample_counters: array>; // [visible_count, max_density_fixed] @group(3) @binding(2) var point_data: array; // density (>= 0 means visible with density, < 0 means not visible or not accepted) // Separate binding for vertex shader in downsampled draw pipeline // Uses group 2 since the pipeline only needs groups 0, 1, 2 // (read-only access required by WebGPU for vertex shaders) @group(2) @binding(0) var point_data_read: array; // same as point_data above fn get_point(index: u32) -> PointData { var result: PointData; result.position = vec3(x_buffer[index], y_buffer[index], 1.0); if (uniforms.category_count > 1) { result.category = (category_buffer[index >> 2] >> ((index & 3) << 3)) & 0xff; } else { result.category = 0; } return result; } const ACCUMULATE_UNIT: u32 = 4096; fn increment_count(x: i32, y: i32, category: u32, value: u32) { let width = uniforms.density_width; let height = uniforms.density_height; if (x < 0 || x >= width || y < 0 || y >= height || category >= uniforms.category_count || value == 0) { return; } let offset = (y * width + x) + i32(category) * (width * height); atomicAdd(&count_buffer[offset], value); } @compute @workgroup_size(64, 1) fn accumulate(@builtin(global_invocation_id) id: vec3) { let width = uniforms.density_width; let height = uniforms.density_height; let index = id.y * 4096 + id.x; // 4096 = 64 * 64 if (index >= uniforms.count) { return; } let point = get_point(index); let pos = uniforms.matrix * point.position; let x = (pos.x + 1.0) / 2.0 * f32(width) - 0.5; let y = (pos.y + 1.0) / 2.0 * f32(height) - 0.5; let ix = i32(x); let iy = i32(y); let tx = x - f32(ix); let ty = y - f32(iy); let w1: u32 = u32((1 - tx) * (1 - ty) * f32(ACCUMULATE_UNIT)); let w2: u32 = u32(tx * (1 - ty) * f32(ACCUMULATE_UNIT)); let w3: u32 = u32((1 - tx) * ty * f32(ACCUMULATE_UNIT)); let w123 = w1 + w2 + w3; var w4: u32 = select(0, ACCUMULATE_UNIT - w123, w123 < ACCUMULATE_UNIT); increment_count(ix, iy, point.category, w1); increment_count(ix + 1, iy, point.category, w2); increment_count(ix, iy + 1, point.category, w3); increment_count(ix + 1, iy + 1, point.category, w4); } // ===================================================== // Draw Discrete Points // ===================================================== struct PointsVertexOutput { @builtin(position) position: vec4, @location(0) dp: vec3, @location(1) color: vec4, } @vertex fn points_vs( @builtin(instance_index) index: u32, @builtin(vertex_index) part: u32, ) -> PointsVertexOutput { let framebuffer_size = vec2(f32(uniforms.framebuffer_width), f32(uniforms.framebuffer_height)); let alpha = uniforms.point_alpha * uniforms.points_alpha; let dp = vec2(f32(part % 2), f32(part / 2)) * 2.0 - 1.0; let point = get_point(index); let pos = uniforms.matrix * point.position; var out: PointsVertexOutput; out.position = vec4(pos.xy + dp * uniforms.point_size / framebuffer_size * 2.0, 0.0, 1.0); out.dp = vec3(dp, uniforms.point_size); out.color = uniforms.category_colors[point.category] * alpha; return out; } @fragment fn points_fs(in: PointsVertexOutput) -> FragmentOutput { let r = length(in.dp.xy) * in.dp.z; let a = max(0.0, min(1.0, in.dp.z - r)); var out: FragmentOutput; out.color = in.color * a; out.log1malpha = log(1 - out.color.a); return out; } // ===================================================== // Draw Density Map // ===================================================== struct DrawDensityMapVertexOutput { @builtin(position) position: vec4, @location(0) texture_coord: vec2, } @vertex fn draw_density_map_vs( @builtin(vertex_index) part: u32, ) -> DrawDensityMapVertexOutput { let framebuffer_size = vec2(f32(uniforms.framebuffer_width), f32(uniforms.framebuffer_height)); let dp = vec2(f32(part % 2), f32(part / 2)) * 2.0 - 1.0; var out: DrawDensityMapVertexOutput; out.position = vec4(dp, 0.0, 1.0); out.texture_coord = (vec2(dp.x, dp.y) + 1.0) / 2.0 * framebuffer_size; return out; } fn get_density_raw(x: i32, y: i32, category: u32) -> f32 { let width = uniforms.density_width; let height = uniforms.density_height; let density_scaler = uniforms.density_scaler; if (x < 0 || x >= width || y < 0 || y >= height) { return 0.0; } let offset = (y * width + x) + i32(category) * (width * height); return max(0.0, f32(blur_buffer[offset]) * density_scaler); } fn get_density(x: f32, y: f32, category: u32) -> f32 { let px = x / f32(uniforms.framebuffer_width) * f32(uniforms.density_width) - 0.5; let py = y / f32(uniforms.framebuffer_height) * f32(uniforms.density_height) - 0.5; let ix = i32(px); let iy = i32(py); let tx = px - f32(ix); let ty = py - f32(iy); let v00 = get_density_raw(ix, iy, category); let v10 = get_density_raw(ix + 1, iy, category); let v01 = get_density_raw(ix, iy + 1, category); let v11 = get_density_raw(ix + 1, iy + 1, category); return mix(mix(v00, v10, tx), mix(v01, v11, tx), ty); } fn get_density_quantized(x: f32, y: f32, category: u32) -> f32 { let v = get_density(x, y, category); return floor(clamp(v, 0, 1) / uniforms.quantization_step); } fn get_density_quantized_sobel(x: f32, y: f32, category: u32) -> vec2 { let v11 = get_density_quantized(x - 1, y - 1, category); let v21 = get_density_quantized(x, y - 1, category); let v31 = get_density_quantized(x + 1, y - 1, category); let v12 = get_density_quantized(x - 1, y, category); let v22 = get_density_quantized(x, y, category); let v32 = get_density_quantized(x + 1, y, category); let v13 = get_density_quantized(x - 1, y + 1, category); let v23 = get_density_quantized(x, y + 1, category); let v33 = get_density_quantized(x + 1, y + 1, category); let gx = v11 + v12 * 2.0 + v13 - v31 - v32 * 2.0 - v33; let gy = v11 + v21 * 2.0 + v31 - v13 - v23 * 2.0 - v33; return vec2(gx, gy); } @fragment fn draw_density_map_fs(in: DrawDensityMapVertexOutput) -> FragmentOutput { let px = in.texture_coord.x; let py = in.texture_coord.y; let quantization_step: f32 = uniforms.quantization_step; var sum_color: vec4 = vec4(0); var sum_log1malpha: f32 = 0.0; for (var i: u32 = 0; i < uniforms.category_count; i++) { let density = get_density(px, py, i); var alpha = min(1.0, floor(density / quantization_step) * quantization_step); alpha *= uniforms.density_alpha; let color = uniforms.category_colors[i] * alpha; sum_color += color; sum_log1malpha += log(1 - color.a); } if (uniforms.contours_alpha > 0.0) { for (var i: u32 = 0; i < uniforms.category_count; i++) { let sobel = get_density_quantized_sobel(px, py, i); let alpha = clamp(length(sobel) * 0.2, 0.0, 1.0) * uniforms.contours_alpha; let color = uniforms.category_colors[i] * alpha; sum_color += color; sum_log1malpha += log(1 - color.a); } } var out: FragmentOutput; out.color = sum_color; out.log1malpha = sum_log1malpha; return out; } // ===================================================== // Gamma Correction // ===================================================== struct GammaCorrectionVertexOutput { @builtin(position) position: vec4, @location(0) texture_coord: vec2, } @vertex fn gamma_correction_vs( @builtin(vertex_index) part: u32, ) -> GammaCorrectionVertexOutput { let dp = vec2(f32(part % 2), f32(part / 2)) * 2.0 - 1.0; var out: GammaCorrectionVertexOutput; out.position = vec4(dp * uniforms.view_xy_scaler, 0.0, 1.0); out.texture_coord = (vec2(dp.x, -dp.y) + 1.0) / 2.0; return out; } @fragment fn gamma_correction_fs(in: GammaCorrectionVertexOutput) -> @location(0) vec4 { let sum_color = textureSample(color_texture, framebuffer_sampler, in.texture_coord); let sum_log_one_minus_alpha = textureSample(log1malpha_texture, framebuffer_sampler, in.texture_coord).r; var color: vec4; if (sum_color.a > 0.0) { color = sum_color / sum_color.a * (1.0 - exp(sum_log_one_minus_alpha)); color = color + uniforms.background_color * (1 - color.a); } else { color = uniforms.background_color; } let rgb = pow(color.rgb, vec3(1.0 / uniforms.gamma)); return vec4(rgb, 1.0); } // ===================================================== // Gaussian Blur // ===================================================== @compute @workgroup_size(64, 1) fn gaussian_blur_stage_1(@builtin(global_invocation_id) id: vec3) { let width = uniforms.density_width; let height = uniforms.density_height; let x = id.x; if (x >= u32(width)) { return; } let start = x + id.y * u32(width * height); let count = u32(height); let stride = u32(width); deriche_conv_1d( &blur_buffer, &blur_swap_buffer, start, stride, count, uniforms.kde_causal, uniforms.kde_anticausal, uniforms.kde_a, true ); } @compute @workgroup_size(64, 1) fn gaussian_blur_stage_2(@builtin(global_invocation_id) id: vec3) { let width = uniforms.density_width; let height = uniforms.density_height; let y = id.x; if (y >= u32(height)) { return; } let start = y * u32(width) + id.y * u32(width * height); let count = u32(width); let stride = u32(1); deriche_conv_1d( &blur_swap_buffer, &blur_buffer, start, stride, count, uniforms.kde_causal, uniforms.kde_anticausal, uniforms.kde_a, false ); } fn deriche_conv_1d( src: ptr, read_write>, dst: ptr, read_write>, start: u32, stride: u32, count: u32, kde_causal: vec4, kde_anticausal: vec4, kde_a: vec4, src_is_u32: bool ) { var s: vec4 = vec4(0.0); var y0: f32 = 0.0; var y1234: vec4 = vec4(0.0); var first_nonzero: u32 = count; var last_nonzero: u32 = 0; for (var i: u32 = 0; i < count; i++) { let offset = start + i * stride; var input: f32; if (src_is_u32) { input = f32(bitcast(vec2((*src)[offset * 2], (*src)[offset * 2 + 1]))) / f32(ACCUMULATE_UNIT); } else { input = f32((*src)[offset]); } if (input != 0.0) { first_nonzero = min(i, first_nonzero); last_nonzero = max(i, last_nonzero); } s = vec4(input, s.xyz); y1234 = vec4(y0, y1234.xyz); y0 = dot(kde_causal, s) - dot(kde_a, y1234); (*dst)[offset] = f16(y0); } if (first_nonzero > last_nonzero) { return; } s = vec4(0.0); y0 = 0.0; y1234 = vec4(0.0); for (var i: u32 = count - 1 - last_nonzero; i < count; i++) { let p = count - 1 - i; let offset = start + p * stride; var input: f32 = 0.0; if (p >= first_nonzero) { if (src_is_u32) { input = f32(bitcast(vec2((*src)[offset * 2], (*src)[offset * 2 + 1]))) / f32(ACCUMULATE_UNIT); } else { input = f32((*src)[offset]); } } y1234 = vec4(y0, y1234.xyz); y0 = dot(kde_anticausal, s) - dot(kde_a, y1234); s = vec4(input, s.xyz); if (y0 != 0.0) { (*dst)[offset] = f16(f32((*dst)[offset]) + y0); } } } // ===================================================== // Downsampling: PCG hash for deterministic randomness // ===================================================== fn pcg_hash(input: u32) -> u32 { var state = input * 747796405u + 2891336453u; let word = ((state >> ((state >> 28u) + 4u)) ^ state) * 277803737u; return (word >> 22u) ^ word; } fn random_float(seed: u32) -> f32 { return f32(pcg_hash(seed)) / 4294967295.0; } // ===================================================== // Downsampling Pass 1: Viewport culling + density lookup // ===================================================== // Uses 2D dispatch for large point counts (>65K workgroups) // Stride: 256 workgroups * 256 threads = 65536 threads per row const DOWNSAMPLE_STRIDE: u32 = 65536u; @compute @workgroup_size(256) fn downsample_viewport_cull(@builtin(global_invocation_id) id: vec3) { let index = id.y * DOWNSAMPLE_STRIDE + id.x; if (index >= uniforms.count) { return; } let point = get_point(index); let pos = uniforms.matrix * point.position; // Check if point is in viewport [-1, 1] let in_viewport = pos.x >= -1.0 && pos.x <= 1.0 && pos.y >= -1.0 && pos.y <= 1.0; if (in_viewport) { // Increment visible count atomicAdd(&downsample_counters[0], 1u); // Lookup density at this point's location from blur_buffer let width = uniforms.density_width; let height = uniforms.density_height; let dx = (pos.x + 1.0) / 2.0 * f32(width) - 0.5; let dy = (pos.y + 1.0) / 2.0 * f32(height) - 0.5; let ix = clamp(i32(dx), 0, width - 1); let iy = clamp(i32(dy), 0, height - 1); // Sum density across all categories at this grid cell var density: f32 = 0.0; for (var c: u32 = 0; c < uniforms.category_count; c++) { let offset = iy * width + ix + i32(c) * (width * height); density += f32(blur_buffer[offset]); } // Store density (positive = visible). Add small epsilon to ensure > 0. density = min(max(density, 0.0001), 65535.0); point_data[index] = density; // Track max density using fixed-point atomics let density_fixed = u32(density * 65536.0); atomicMax(&downsample_counters[1], density_fixed); } else { // Not visible: store -1.0 point_data[index] = -1.0; } } // ===================================================== // Downsampling Pass 2: Probabilistic acceptance // ===================================================== @compute @workgroup_size(256) fn downsample_density_sample(@builtin(global_invocation_id) id: vec3) { let index = id.y * DOWNSAMPLE_STRIDE + id.x; if (index >= uniforms.count) { return; } let density = point_data[index]; // Not visible (density < 0) if (density < 0.0) { return; } let visible_count = atomicLoad(&downsample_counters[0]); let render_limit = downsample_uniforms.render_limit; // If visible count is within limit, accept all visible points (keep positive density) if (visible_count <= render_limit) { return; // Keep positive value = accepted } // Compute acceptance probability based on density let max_density_fixed = atomicLoad(&downsample_counters[1]); let max_density = f32(max_density_fixed) / 65536.0; // Base acceptance rate let base_rate = f32(render_limit) / f32(visible_count); // Density-based modulation: lower density = higher acceptance let normalized_density = select(0.0, density / max_density, max_density > 0.0001); let density_weight = downsample_uniforms.density_weight; // Inverse density weighting: sparse areas get higher probability let inverse_weight = 1.0 / (1.0 + normalized_density * density_weight); // Compute final probability (scale by ~2 to compensate for average inverse_weight) let final_prob = min(1.0, base_rate * inverse_weight * 2.0); // Deterministic random for frame stability (based on point index + frame seed) let seed = index ^ downsample_uniforms.frame_seed; let rand = random_float(seed); // If not accepted, set to negative (marks as rejected) if (rand >= final_prob) { point_data[index] = -1.0; } } // ===================================================== // Draw points with downsampling // ===================================================== @vertex fn points_downsampled_vs( @builtin(instance_index) instance: u32, @builtin(vertex_index) part: u32, ) -> PointsVertexOutput { var out: PointsVertexOutput; let point_data = point_data_read[instance]; if (point_data < 0.0) { // To discard a point, we set a out-of-viewport position. This avoids fragment costs. out.position = vec4(-1000, -1000, 0.0, 1.0); return out; } let framebuffer_size = vec2(f32(uniforms.framebuffer_width), f32(uniforms.framebuffer_height)); let alpha = uniforms.point_alpha * uniforms.points_alpha; let dp = vec2(f32(part % 2), f32(part / 2)) * 2.0 - 1.0; let point = get_point(instance); let pos = uniforms.matrix * point.position; out.position = vec4(pos.xy + dp * uniforms.point_size / framebuffer_size * 2.0, 0.0, 1.0); out.dp = vec3(dp, uniforms.point_size); out.color = uniforms.category_colors[point.category] * alpha; return out; } `;class qTe{props;viewport;df;device;module;uniforms;context;renderInputs;dataBuffers;renderer;constructor(e,n,r,i,s){this.context=e,this.props={mode:"points",colorScheme:"light",x:new Float32Array,y:new Float32Array,category:null,categoryCount:1,categoryColors:null,viewportX:0,viewportY:0,viewportScale:1,pointSize:1,pointAlpha:1,pointsAlpha:1,densityScaler:1,densityBandwidth:1,densityQuantizationStep:.1,contoursAlpha:1,densityAlpha:1,gamma:2.2,width:i,height:s,downsampleMaxPoints:4e6,downsampleDensityWeight:5},this.viewport=new Cw({x:0,y:0,scale:1},i,s),this.df=new md;let o=this.df;this.renderInputs={mode:o.value(this.props.mode),colorScheme:o.value(this.props.colorScheme),xData:o.value(this.props.x),yData:o.value(this.props.y),categoryData:o.value(this.props.category),categoryCount:o.value(this.props.categoryCount),categoryColors:o.value(this.props.categoryColors),matrix:o.value(iG()),width:o.value(i),height:o.value(s),pointSize:o.value(this.props.pointSize),densityBandwidth:o.value(this.props.densityBandwidth),downsampleMaxPoints:o.value(this.props.downsampleMaxPoints),downsampleDensityWeight:o.value(this.props.downsampleDensityWeight)},this.device=o.value(n),this.dataBuffers=VTe(o,this.device,this.renderInputs),this.module=o.derive([this.device],a=>a.createShaderModule({code:jTe})),this.uniforms=PTe(o,this.device),this.renderer=ZTe(o,this.device,this.module,this.uniforms,r,this.renderInputs,this.dataBuffers)}setProps(e){let n=!1,r;for(r in e)e[r]!==this.props[r]&&(this.props[r]=e[r],n=!0);return this.viewport.update({x:this.props.viewportX,y:this.props.viewportY,scale:this.props.viewportScale},this.props.width,this.props.height),this.renderInputs.mode.value=this.props.mode,this.renderInputs.colorScheme.value=this.props.colorScheme,this.renderInputs.xData.value=this.props.x,this.renderInputs.yData.value=this.props.y,this.renderInputs.categoryData.value=this.props.category,this.renderInputs.categoryColors.value=this.props.categoryColors,this.props.category!=null?this.renderInputs.categoryCount.value=this.props.categoryCount:this.renderInputs.categoryCount.value=1,this.renderInputs.matrix.value=this.viewport.matrix(),this.renderInputs.width.value=this.props.width,this.renderInputs.height.value=this.props.height,this.renderInputs.pointSize.value=this.props.pointSize,this.renderInputs.densityBandwidth.value=this.props.densityBandwidth,this.renderInputs.downsampleMaxPoints.value=this.props.downsampleMaxPoints,this.renderInputs.downsampleDensityWeight.value=this.props.downsampleDensityWeight,n}render(){this.renderer.value(this.props,this.context.getCurrentTexture().createView())}destroy(){this.df.destroy()}async densityMap(e,n,r,i){let s=this.df.subgraph(),{x:o,y:a,scale:l}=i,u=[l,0,0,0,l,0,-o*l,-a*l,1],c=oG(u),f=await XTe(s,this.device,this.module,this.uniforms,s.value(e),s.value(n),s.value(r),s.value(u),this.dataBuffers).value();return s.destroy(),{data:f,width:e,height:n,coordinateAtPixel:(h,d)=>{let p=h/e*2-1,m=d/n*2-1,g=sG([p,m,1],c);return{x:g[0],y:g[1]}}}}}function VTe(t,e,n){let r=GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST;const i=t.derive([n.xData],c=>c.length),s=t.derive([i],c=>c*4),o=i,a=t.statefulDerive([e,t.statefulDerive([e,s,r],$u),n.xData],W3),l=t.statefulDerive([e,t.statefulDerive([e,s,r],$u),n.yData],W3),u=t.statefulDerive([e,t.statefulDerive([e,o,r],$u),n.categoryData],W3);return{x:a,y:l,category:u,count:i}}function mG(t,e,n,r,i,s,o){let a="rgba16float",l="r16float",u=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING,c=t.statefulDerive([e,n,r,a,u],KI),f=t.statefulDerive([e,n,r,l,u],KI),h=t.derive([i,s,o],(g,y,O)=>g*y*O*4),d=t.derive([i,s,o],(g,y,O)=>g*y*O*2),p=t.statefulDerive([e,h,GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.COPY_SRC],$u),m=t.statefulDerive([e,d,GPUBufferUsage.STORAGE],$u);return{colorTexture:c,alphaTexture:f,colorTextureFormat:a,alphaTextureFormat:l,countBuffer:p,blurBuffer:m}}function ZTe(t,e,n,r,i,s,o){let a=t.derive([s.densityBandwidth],C=>Math.ceil(C*3)+1),l=t.derive([s.width,a],(C,D)=>C+D*2),u=t.derive([s.height,a],(C,D)=>C+D*2),c=t.derive([l],C=>Math.ceil(C/4)),f=t.derive([u],C=>Math.ceil(C/4)),h=mG(t,e,l,u,c,f,s.categoryCount),d=fG(t,e,r.buffer,o,h),p=$Te(t,e,o.count,s.downsampleMaxPoints),m=cG(t,e,n,d,o,h),g=NTe(t,e,n,d,o,h),y=QTe(t,e,n,d,p,h),O=LTe(t,e,n,d,h),v=BTe(t,e,n,i,d),w=dG(t,e,n,d,l,u,s.categoryCount),x=t.derive([d.layouts],C=>C),S=MTe(t,e,n,t.derive([x],C=>C.group0),t.derive([x],C=>C.group1),h.blurBuffer,d.group0,d.group1,p,o),_=t.derive([s.densityBandwidth,l,c],(C,D,A)=>pG(C/D*A)),k=t.derive([s.categoryColors,s.categoryCount],(C,D)=>(C==null&&(C=S0(D)),C.map(A=>q8(A))));return t.derive([e,l,u,c,f,r.update,o.count,s.matrix,k,g,y,v,m,w,O,S,_],(C,D,A,E,T,R,$,Q,B,q,z,ee,W,K,H,J,Y)=>(Z,he)=>{let me=Z.colorScheme=="light"?[1,1,1,1]:[0,0,0,1],te=Z.width/D,le=Z.height/A,ve=V8([te,0,0,0,le,0,0,0,1],Q);R({count:$,category_count:Z.categoryCount,framebuffer_width:D,framebuffer_height:A,density_width:E,density_height:T,gamma:Z.gamma,point_size:Math.max(Z.mode=="points"?3:1,Z.pointSize),point_alpha:Z.pointAlpha,points_alpha:Z.pointsAlpha,density_scaler:Z.densityScaler/16,quantization_step:Z.densityQuantizationStep,density_alpha:Z.densityAlpha,contours_alpha:Z.contoursAlpha,matrix:ve,view_xy_scaler:[1/te,1/le],kde_causal:Y.kde_causal,kde_anticausal:Y.kde_anticausal,kde_a:Y.kde_a,background_color:me,category_colors:B});let xe=C.createCommandEncoder();const ue=Z.downsampleMaxPoints,Ee=ue===null||ue===1/0||!Number.isFinite(ue)||ue<=0?null:ue;if(Ee!==null&&$>Ee){W(xe),K(xe);const Le={maxPoints:Ee,densityWeight:Z.downsampleDensityWeight,frameSeed:42};J(xe,Le),z(xe,$),Z.mode=="density"&&(Z.densityAlpha>0||Z.contoursAlpha>0)&&H(xe)}else q(xe),Z.mode=="density"&&(Z.densityAlpha>0||Z.contoursAlpha>0)&&(W(xe),K(xe),H(xe));ee(xe,he),C.queue.submit([xe.finish()])})}function XTe(t,e,n,r,i,s,o,a,l){let u=mG(t,e,i,s,i,s,t.value(1)),c=fG(t,e,r.buffer,l,u),f=cG(t,e,n,c,l,u),h=dG(t,e,n,c,i,s,t.value(1));return t.derive([e,i,s,l.count,r.update,o,a,f,h,u.countBuffer],(d,p,m,g,y,O,v,w,x,S)=>()=>{let _=d.createCommandEncoder(),k=pG(O);y({count:g,category_count:1,framebuffer_width:p,framebuffer_height:m,density_width:p,density_height:m,gamma:1,point_size:0,point_alpha:0,points_alpha:0,density_scaler:0,quantization_step:0,density_alpha:0,contours_alpha:0,matrix:v,view_xy_scaler:[1,1],kde_causal:k.kde_causal,kde_anticausal:k.kde_anticausal,kde_a:k.kde_a,background_color:[0,0,0,0],category_colors:[]}),w(_),x(_);let C=d.createBuffer({size:p*m*2,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ});return _.copyBufferToBuffer(S,0,C,0,p*m*2),d.queue.submit([_.finish()]),C.mapAsync(GPUMapMode.READ,0,p*m*2).then(()=>WTe(C.getMappedRange()))})}function WTe(t){let e=new Uint16Array(t),n=new Uint32Array(e.length);for(let r=0;re.measureText(i).width),r=(t.fontSize??10)*(t.lineSpacing??1)*n.length;return{width:n.reduce((i,s)=>Math.max(i,s)),height:r}}let rk=null,iC=new Map;function HTe(){return rk==null&&(rk=new Promise((t,e)=>{let n=new Worker(new URL(""+new URL("clustering.worker-domain-labels-v1.js",import.meta.url).href,import.meta.url),{type:"module"});n.onmessage=r=>{if(r.data.ready){t(n);return}if(r.data.id!=null){let i=iC.get(r.data.id);i!=null&&(iC.delete(r.data.id),i(r.data))}}})),rk}function am(t,e,n=[]){return new Promise((r,i)=>{HTe().then(s=>{let o=new Date().getTime().toString()+"-"+Math.random().toString();iC.set(o,a=>{r(a.payload)}),s.postMessage({id:o,name:t,payload:e},n)})})}let KTe=(t,e,n,r)=>am("findClusters",[t,e,n,r],[t.buffer]),JTe=(...t)=>am("dynamicLabelPlacement",t),eDe=(...t)=>am("textSummarizerCreate",t),tDe=(...t)=>am("textSummarizerDestroy",t),nDe=(...t)=>am("textSummarizerAdd",t),rDe=(...t)=>am("textSummarizerSummarize",t);async function SF(t,e,n){let r=e.reduce((u,c)=>Math.min(u,c.level??0),0),i=e.reduce((u,c)=>Math.max(u,c.level??0),0),s=t*.5,o=t*2,a=e.map(u=>{let c={x:u.x,y:u.y},f=u.level??0,h=f==0?14:12,d=GTe({text:u.text,fontSize:h,fontFamily:n});return d.width+=4,d.height+=4,{text:u.text,fontSize:h,bounds:{xMin:c.x-d.width/2,xMax:c.x+d.width/2,yMin:c.y-d.height/2,yMax:c.y+d.height/2},locationAtZero:c,priority:u.priority,minScale:u.level==i?null:1/(o*Math.pow(2,f)*1.2),maxScale:u.level==r?null:1/(o*Math.pow(2,f-1)),coordinate:{x:u.x,y:u.y},placement:null}}),l=await JTe(a,{globalMaxScale:1/s});for(let u=0;u1?(c=u.x,f=u.y):p>0&&(c+=h*p,f+=d*p)}return h=a.x-c,d=a.y-f,h*h+d*d}function r(a,l){for(var u=a[0],c=[u],f,h=1,d=a.length;hl&&(c.push(f),u=f);return u!==f&&c.push(f),c}function i(a,l,u,c,f){for(var h=c,d,p=l+1;ph&&(d=p,h=m)}h>c&&(d-l>1&&i(a,l,d,c,f),f.push(a[d]),u-d>1&&i(a,d,u,c,f))}function s(a,l){var u=a.length-1,c=[a[0]];return i(a,0,u,l,c),c.push(a[u]),c}function o(a,l,u){if(a.length<=2)return a;var c=l!==void 0?l*l:1;return a=u?a:r(a,c),a=s(a,c),a}t.exports=o,t.exports.default=o})()})(kF)),kF.exports}var oDe=sDe();const AF=iDe(oDe);function aDe(t,e){let n=t.slice();for(let r=0;re&&o<20;)i*=1.1,o+=1,s=AF(n,i);return s}const EF={light:{fontFamily:"system-ui,sans-serif",clusterLabelColor:"#000",clusterLabelOutlineColor:"rgba(255,255,255,0.8)",clusterLabelOpacity:.8,statusBar:!0,statusBarTextColor:"#525252",statusBarBackgroundColor:"rgba(255,255,255,0.9)",brandingLink:{text:"Embedding Atlas",href:"https://apple.github.io/embedding-atlas"}},dark:{fontFamily:"system-ui,sans-serif",clusterLabelColor:"#ccc",clusterLabelOutlineColor:"rgba(0,0,0,0.8)",clusterLabelOpacity:.8,statusBar:!0,statusBarTextColor:"#d9d9d9",statusBarBackgroundColor:"rgba(0,0,0,0.9)",brandingLink:{text:"Embedding Atlas",href:"https://apple.github.io/embedding-atlas"}}};function uDe(t,e){return t==null?EF[e]:{...EF[e],...t,...t[e]!=null?t[e]:{}}}function cDe(t,e,n,r,i,s,o){let a=Math.max(r,i)/s,l=t/(n*n)/(a*a),u=1/(l/(s*s))*.2,c=Math.sqrt(t/e/(a*a)),f=Math.log(c),h=Math.log(n),d=(Math.min(Math.max((h-f)*2,-1),1)+1)/2,p;if(o!=null)p=o*s;else{let y=.25/Math.sqrt(l);p=Math.max(.2,Math.min(5,y))*s}let m=1-d,g=.5+d*.5;return{densityScaler:u,densityAlpha:m,contoursAlpha:m,pointSize:p,pointAlpha:.7,pointsAlpha:g,densityBandwidth:20}}var fDe=bf("
    "),hDe=sc(""),dDe=sc(""),pDe=sc(' '),mDe=sc(""),gDe=sc(""),yDe=sc(""),bDe=bf('
    ');function ODe(t,e){fd(e,!0);let n=We(e,"data",19,()=>({x:new Float32Array,y:new Float32Array,category:null})),r=We(e,"categoryCount",3,1),i=We(e,"categoryColors",3,null),s=We(e,"width",3,800),o=We(e,"height",3,800),a=We(e,"pixelRatio",3,2),l=We(e,"theme",3,null),u=We(e,"config",3,null),c=We(e,"totalCount",3,null),f=We(e,"maxDensity",3,null),h=We(e,"labels",3,null),d=We(e,"queryClusterLabels",3,null),p=We(e,"tooltip",7,null),m=We(e,"selection",7,null),g=We(e,"querySelection",3,null),y=We(e,"rangeSelection",7,null),O=We(e,"defaultViewportState",3,null),v=We(e,"viewportState",7,null),w=We(e,"customTooltip",3,null),x=We(e,"customOverlay",3,null),S=We(e,"onViewportState",3,null),_=We(e,"onTooltip",3,null),k=We(e,"onSelection",3,null),C=We(e,"onRangeSelection",3,null),D=We(e,"cache",3,null),A=lt(()=>u()?.colorScheme??"light"),E=lt(()=>uDe(l(),N(A))),T=lt(()=>i()??S0(r())),R=lt(()=>v()??O()??{x:0,y:0,scale:1}),$=lt(()=>new Cw(N(R),s(),o())),Q=lt(()=>N($).pixelLocationFunction()),B=lt(()=>N($).coordinateAtPixelFunction()),q=Mn(!1);function z(ie,ye){return ie.x==ye.x&&ie.y==ye.y&&ie.category==ye.category&&ie.text==ye.text}let ee=lt(()=>m()?.length==1&&p()!=null&&z(m()[0],p()));function W(ie){Ec(v(),ie)||(v(ie),S()?.(ie))}function K(ie){Ec(p(),ie)||(p(ie),_()?.(ie))}function H(ie){Ec(m(),ie)||(m(ie),k()?.(ie))}function J(ie){Ec(y(),ie)||(y(ie),C()?.(ie))}let Y=Mn(oh([])),Z=Mn(null),he=Mn("none"),me=lt(()=>s()*a()),te=lt(()=>o()*a()),le=Mn(null),ve=Mn(null),xe=Mn(null),ue=lt(()=>u()?.minimumDensity??1/16),Ee=lt(()=>u()?.pointSize??null),Le=lt(()=>u()?.mode??"points"),qe=lt(()=>u()?.autoLabelEnabled),Fe=lt(()=>u()?.downsampleMaxPoints??4e6),it=lt(()=>u()?.downsampleDensityWeight??5),St=lt(()=>cDe(f()??(c()??n().x.length)/4,N(ue),N(R).scale,N(me),N(te),a(),N(Ee))),Se=lt(()=>N(St).pointSize),gt=!0;Lg(()=>{N(ve)?.setProps({mode:N(Le),colorScheme:N(A),viewportX:N(R).x,viewportY:N(R).y,viewportScale:N(R).scale,width:N(me),height:N(te),x:n().x,y:n().y,category:n().category,categoryCount:r(),categoryColors:N(T),downsampleMaxPoints:N(Fe),downsampleDensityWeight:N(it),...N(St)})&&(Ri(),(N(qe)!==!1||h()!=null)&>&&N(ve)!=null&&n().x!=null&&n().x.length>0&&O()!=null&&(gt=!1,wf(O())))});function Kt(){Rn=null,!(!N(le)||!N(ve))&&(N(le).width=N(ve).props.width,N(le).height=N(ve).props.height,N(le).style.width=`${N(ve).props.width/a()}px`,N(le).style.height=`${N(ve).props.height/a()}px`,N(ve).render())}let Rn=null;function Ri(){Rn==null&&(Rn=requestAnimationFrame(Kt))}function Bn(ie){ct(xe,"WebGPU is unavailable. Falling back to WebGL.");let ye;function Re(){if(ye=ie.getContext("webgl2",{antialias:!1}),ye==null){console.error("Could not get WebGL 2 context");return}ye.getExtension("EXT_color_buffer_float"),ye.getExtension("EXT_float_blend"),ye.getExtension("OES_texture_float_linear"),ct(ve,new STe(ye,N(me),N(te)),!0)}Re(),ie.addEventListener("webglcontextlost",()=>{N(ve)?.destroy(),ct(ve,null),ye=null}),ie.addEventListener("webglcontextrestored",()=>{Re()})}function er(ie){let ye=!0;async function Re(){let Qe=await HAe();if(Qe==null){console.error("Could not get WebGPU device"),ye&&Bn(ie);return}let Ne=ie.getContext("webgpu");if(Ne==null){console.error("Could not get WebGPU canvas context"),ye&&Bn(ie);return}ye=!1,Qe.lost.then(async be=>{console.info(`WebGPU device was lost: ${be.message}`),be.reason!="destroyed"&&(N(ve)?.destroy(),ct(ve,null),Ne.unconfigure(),await Re())});let Je=navigator.gpu.getPreferredCanvasFormat();Ne.configure({device:Qe,format:Je,alphaMode:"premultiplied"}),ct(ve,new qTe(Ne,Qe,Je,N(me),N(te)),!0)}Re()}function jt(ie){ie!=null&&v()==null&&W(ie)}Lg(()=>jt(O())),z8(()=>{if(N(le)==null)return;er(N(le));let ie=N(le).toDataURL;N(le).toDataURL=(...ye)=>(Kt(),ie.apply(N(le),ye))}),a8e(()=>{N(ve)?.destroy(),ct(ve,null)});function jr(ie){let ye=N(le)?.getBoundingClientRect()??{left:0,top:0};return{x:ie.clientX-ye.left,y:ie.clientY-ye.top}}function Zl(ie){ie.preventDefault();let{x:ye,y:Re}=jr(ie),Qe=Math.exp(-ie.deltaY/200);yd(Qe,{x:ye,y:Re})}function yd(ie,ye){let{x:Re,y:Qe,scale:Ne}=N(R);K(null);let Je=(O()?.scale??1)*100,be=(O()?.scale??1)*.01,j=Math.min(Je,Math.max(be,Ne*ie)),se=N(le).getBoundingClientRect(),we=Math.max(se.width,se.height),Bt=(ye.x-se.width/2)/we*2,rn=(se.height/2-ye.y)/we*2,Rt=Re+Bt/Ne-Bt/j,nr=Qe+rn/Ne-rn/j;W({x:Rt,y:nr,scale:j})}function vf(ie){K(null);let ye="pan";N(he)!="none"?ie.modifiers.shift||(ye=N(he)):ie.modifiers.shift&&(ye=ie.modifiers.meta?"lasso":"marquee");let Re=jr(ie);switch(ye){case"marquee":return{move:Qe=>{if(K(null),N(ve)==null)return;let Ne=jr(Qe),Je=N(B)(Re.x,Re.y),be=N(B)(Ne.x,Ne.y);J({xMin:Math.min(Je.x,be.x),yMin:Math.min(Je.y,be.y),xMax:Math.max(Je.x,be.x),yMax:Math.max(Je.y,be.y)})}};case"lasso":{let Qe=[N(B)(Re.x,Re.y)];return{move:Ne=>{if(K(null),N(ve)==null)return;let Je=jr(Ne);Qe=[...Qe,N(B)(Je.x,Je.y)],Qe.length>=3&&J(lDe(Qe,24))}}}case"pan":{let Qe=N(B)(0,0),Ne=N(B)(1,1),Je=Qe.x-Ne.x,be=Qe.y-Ne.y,j=N(R).x,se=N(R).y;return{move:we=>{W({x:j+(we.clientX-ie.clientX)*Je,y:se+(we.clientY-ie.clientY)*be,scale:N(R).scale})}}}}}async function bd(ie){if(y()!=null)J(null);else{const ye=await ns(jr(ie));if(ye==null)H([]),K(null);else if(ie.modifiers.shift||ie.modifiers.ctrl||ie.modifiers.meta){let Re=m()?.findIndex(Qe=>Qe.x==ye.x&&Qe.y==ye.y&&Qe.category==ye.category);m()==null||Re==null||Re<0?(H([...m()??[],ye]),K(ye)):(H([...m().slice(0,Re),...m().slice(Re+1)]),K(null))}else H([ye]),K(ye)}}let zo=v8e(async ie=>{let ye=ie?jr(ie):null;if(m()!=null&&m().length==1){let Re=N(Q)(m()[0].x,m()[0].y);ye!=null&&w8e(ye,Re)<10&&K(m()[0])}else K(await ns(ye))},()=>p()!=null);function Ca(ie){ie!=null?N(q)||zo(ie):zo(null)}Lg(()=>{N(q)&&zo(null)});async function ns(ie){if(N(ve)==null||ie==null||g()==null)return null;let{x:ye,y:Re}=N(B)(ie.x,ie.y),Qe=Math.abs(N(B)(ie.x+1,ie.y).x-ye);return await g()(ye,Re,Qe)}async function oo(ie,ye,Re,Qe=.005){let Ne=await ie.densityMap(1e3,1e3,ye,Re),Je=await KTe(Ne.data,Ne.width,Ne.height),be=[];for(let se=0;se{let hi=Ne.coordinateAtPixel(Rt,nr),zn=Ne.coordinateAtPixel(Fs,Ea);return{xMin:Math.min(hi.x,zn.x),xMax:Math.max(hi.x,zn.x),yMin:Math.min(hi.y,zn.y),yMax:Math.max(hi.y,zn.y)}});be.push({x:Bt.x,y:Bt.y,sumDensity:we.sumDensity,rects:rn,bandwidth:ye})}let j=be.reduce((se,we)=>Math.max(se,we.sumDensity),0);return be.filter(se=>se.sumDensity/j>Qe)}async function oc(ie){if(N(ve)==null||d()==null)return[];let ye=await _8e({autoLabel:{version:2,viewport:ie,stopWords:u()?.autoLabelStopWords,densityThreshold:u()?.autoLabelDensityThreshold}});if(D()!=null){let Ne=await D().get(ye);if(Ne!=null)return Ne}let Re=await oo(N(ve),10,ie,u()?.autoLabelDensityThreshold??.005);if(Re=Re.concat(await oo(N(ve),5,ie)),d()){let Ne=await d()(Re.map(Je=>Je.rects));for(let Je=0;JeNe.label!=null&&Ne.label.length>0).map(Ne=>({x:Ne.x,y:Ne.y,text:Ne.label,priority:Ne.sumDensity,level:Ne.bandwidth==10?0:1}));return D()!=null&&await D().set(ye,Qe),Qe}async function wf(ie){let ye=new Cw(ie,1e3,1e3);if(N(ve)!=null)if(h()!=null)ct(Y,await SF(ye.scale(),h(),N(E).fontFamily),!0);else{ct(Z,"Generating labels...");let Re=await oc(ie);ct(Y,await SF(ye.scale(),Re,N(E).fontFamily),!0),ct(Z,null)}}class cm{content;constructor(ye,Re){let Qe=document.createElement("div");this.content=Qe,this.update(Re),ye.appendChild(Qe)}update(ye){let Re=this.content;Re.style.fontFamily=ye.fontFamily,N(A)=="light"?(Re.style.color="#000",Re.style.background="#fff",Re.style.border="1px solid #000"):(Re.style.color="#ccc",Re.style.background="#000",Re.style.border="1px solid #ccc"),Re.style.borderRadius="2px",Re.style.padding="5px",Re.style.fontSize="12px",Re.style.maxWidth="300px",Re.innerText=ye.tooltip.text??JSON.stringify(ye.tooltip)}}var un=bDe();let Yn;var qr=Yr(un);Xt(qr,"",{},{position:"absolute",top:"0",left:"0"}),eC(qr,ie=>ct(le,ie),()=>N(le));var In=Gn(qr,2);let Ii;var rs=Yr(In);{var qt=ie=>{const ye=lt(()=>JY(x())),Re=lt(()=>({location:N(Q),width:s(),height:o()}));var Qe=$m(),Ne=Vd(Qe);l8e(Ne,()=>N(ye),Je=>{var be=fDe();Zo(be,(j,se)=>N(ye)?.(j,se),()=>eG(x(),{proxy:N(Re)})),fr(Je,be)}),fr(ie,Qe)};as(rs,ie=>{x()&&ie(qt)})}kr(In);var Vt=Gn(In,2);Xt(Vt,"",{},{position:"absolute",left:"0",top:"0"});var Rr=Yr(Vt);{var ti=ie=>{const ye=lt(()=>{const{x:be,y:j}=N(Q)(p().x,p().y);return{x:be,y:j}}),Re=lt(()=>Math.max(3,N(Se)/a())+1);var Qe=$m(),Ne=Vd(Qe);{var Je=be=>{var j=hDe();let se;Ws(()=>{$e(j,"cx",N(ye).x),$e(j,"cy",N(ye).y),$e(j,"r",N(Re)),se=Xt(j,"",se,{stroke:N(A)=="light"?"#000":"#fff","stroke-width":1,fill:"none"})}),fr(be,j)};as(Ne,be=>{isFinite(N(ye).x)&&isFinite(N(ye).y)&&isFinite(N(Re))&&be(Je)})}fr(ie,Qe)};as(Rr,ie=>{p()!=null&&N(ve)!=null&&ie(ti)})}var Aa=Gn(Rr);{var Xl=ie=>{var ye=$m(),Re=Vd(ye);G3(Re,17,m,Y3,(Qe,Ne)=>{const Je=lt(()=>{const{x:rn,y:Rt}=N(Q)(N(Ne).x,N(Ne).y);return{x:rn,y:Rt}}),be=lt(()=>N(Ne).category!=null?N(T)[N(Ne).category]:N(T)[0]),j=lt(()=>Math.max(3,N(Se)/a())+1);var se=$m(),we=Vd(se);{var Bt=rn=>{var Rt=dDe();let nr;Ws(()=>{$e(Rt,"cx",N(Je).x),$e(Rt,"cy",N(Je).y),$e(Rt,"r",N(j)),nr=Xt(Rt,"",nr,{stroke:N(A)=="light"?"#000":"#fff","stroke-width":2,fill:N(be)})}),fr(rn,Rt)};as(we,rn=>{isFinite(N(Je).x)&&isFinite(N(Je).y)&&isFinite(N(j))&&rn(Bt)})}fr(Qe,se)}),fr(ie,ye)};as(Aa,ie=>{m()!=null&&N(ve)!=null&&ie(Xl)})}var is=Gn(Aa);{var tr=ie=>{var ye=yDe();G3(ye,21,()=>N(Y),Y3,(Re,Qe)=>{const Ne=lt(()=>N(Qe).text.split(` `)),Je=lt(()=>N(Q)(N(Qe).coordinate.x,N(Qe).coordinate.y)),be=lt(()=>N($).scale()),j=lt(()=>N(Qe).placement!=null&&N(Qe).placement.minScale<=N(be)&&N(be)<=N(Qe).placement.maxScale);var se=gDe(),we=Yr(se);{var Bt=rn=>{var Rt=mDe();G3(Rt,21,()=>N(Ne),Y3,(nr,Fs,Ea)=>{var hi=pDe();$e(hi,"x",0);let zn;var zy=Yr(hi,!0);kr(hi),Ws(()=>{$e(hi,"y",(Ea-(N(Ne).length-1)/2)*N(Qe).fontSize),$e(hi,"font-size",N(Qe).fontSize),zn=Xt(hi,"",zn,{"paint-order":"stroke","stroke-width":"4","stroke-linejoin":"round","stroke-linecap":"round","text-anchor":"middle",fill:N(E).clusterLabelColor,stroke:N(E).clusterLabelOutlineColor,opacity:N(E).clusterLabelOpacity,"user-select":"none","-webkit-user-select":"none","font-family":N(E).fontFamily}),Ng(zy,N(Fs))}),fr(nr,hi)}),kr(Rt),fr(rn,Rt)};as(we,rn=>{N(j)&&rn(Bt)})}kr(se),Ws(()=>$e(se,"transform",`translate(${N(Je).x??""},${N(Je).y??""})`)),fr(Re,se)}),kr(ye),fr(ie,ye)};as(is,ie=>{ie(tr)})}var xn=Gn(is);{var xr=ie=>{var ye=$m(),Re=Vd(ye);{var Qe=Je=>{A8e(Je,{get value(){return y()},get pointLocation(){return N(Q)}})},Ne=Je=>{O8e(Je,{get value(){return y()},onChange:J,get pointLocation(){return N(Q)},get coordinateAtPoint(){return N(B)},preventHover:be=>{ct(q,be,!0)}})};as(Re,Je=>{y()instanceof Array?Je(Qe):Je(Ne,!1)})}fr(ie,ye)};as(xn,ie=>{y()!=null&&N(ve)!=null&&ie(xr)})}kr(Vt),Zo(Vt,(ie,ye)=>sn?.(ie,ye),()=>({click:bd,drag:vf,hover:Ca}));var Fi=Gn(Vt,2);{var ao=ie=>{const ye=lt(()=>N(Q)(p().x,p().y));{let Re=lt(()=>Math.max(3,N(Se)/a())),Qe=lt(()=>w()??{class:cm,props:{colorScheme:N(A),fontFamily:N(E).fontFamily}});Q8e(ie,{get location(){return N(ye)},get allowInteraction(){return N(ee)},get targetHeight(){return N(Re)},get customTooltip(){return N(Qe)},get tooltip(){return p()}})}};as(Fi,ie=>{p()!=null&&N(ve)!=null&&ie(ao)})}var Wl=Gn(Fi,2);{var Uo=ie=>{{let ye=lt(()=>N(Z)??N(xe)),Re=lt(()=>1/(N(Q)(1,0).x-N(Q)(0,0).x));M8e(ie,{get resolvedTheme(){return N(E)},get statusMessage(){return N(ye)},get distancePerPoint(){return N(Re)},get pointCount(){return n().x.length},get selectionMode(){return N(he)},onSelectionMode:Qe=>ct(he,Qe,!0)})}};as(Wl,ie=>{N(E).statusBar&&ie(Uo)})}kr(un),Ws(()=>{Yn=Xt(un,"",Yn,{width:`${s()??""}px`,height:`${o()??""}px`,position:"relative"}),Ii=Xt(In,"",Ii,{width:`${s()??""}px`,height:`${o()??""}px`,position:"absolute",top:"0",left:"0"}),$e(Vt,"width",s()),$e(Vt,"height",o())}),HEe("wheel",Vt,Zl),fr(t,un),hd()}function TF(t,e){if(e.length==0)return Ae(!1);if(t.identifier!=null){let n=t.identifier;return _o(...e.map(r=>qs(ae(n),Ae(r.identifier))))}else{let n=t.x,r=t.y,i=t.category;return i!=null?_o(...e.map(s=>xs(qs(Hn(ae(n),"DOUBLE"),Ae(s.x)),qs(Hn(ae(r),"DOUBLE"),Ae(s.y)),qs(Hn(ae(i),"INTEGER"),Ae(s.category))))):_o(...e.map(s=>xs(qs(Hn(ae(n),"DOUBLE"),Ae(s.x)),qs(Hn(ae(r),"DOUBLE"),Ae(s.y)))))}}function vDe(t,e,n){let r=[];for(let s=0;sE6(s,o));return qs(Hne(i,Ae(2)),Ae(1))}function wDe(t,e){if(e instanceof Array){if(e.length<3)return Ae(!1);let n=KY(e);return xs(vu(ae(t.x),[n.xMin,n.xMax]),vu(ae(t.y),[n.yMin,n.yMax]),vDe(ae(t.x),ae(t.y),e))}else return xs(vu(ae(t.x),[e.xMin,e.xMax]),vu(ae(t.y),[e.yMin,e.yMax]))}async function xDe(t,e){let{x:n,y:r,table:i}=e,s=await t.query(Be.from(i).select({centerX:Ze`MEDIAN(${ae(n)})`,centerY:Ze`MEDIAN(${ae(r)})`,stdX:Ze`STDDEV(${ae(n)})`,stdY:Ze`STDDEV(${ae(r)})`,...e.category!=null?{maxCategory:Ze`MAX(${ae(e.category)}::UTINYINT)`}:{}})),{centerX:o,centerY:a,stdX:l,stdY:u,maxCategory:c}=s.get(0),f=1/(Math.max(l,u,.001)*3),h=.1/f,d=Ze`FLOOR((${ae(n)} - ${o}) / ${h})`,p=Ze`FLOOR((${ae(r)} - ${a}) / ${h})`,m=e.category!=null?ae(e.category):null,g=m!=null?[d,p,m]:[d,p],y=Be.from(Be.from(i).select({count:Ze`COUNT(*)`}).groupby(...g)).select({totalCount:Ze`SUM(count)::INT`,maxCount:Ze`MAX(count)::INT`});s=await t.query(y);let{maxCount:O,totalCount:v}=s.get(0),w=O/(h*h);return{centerX:o,centerY:a,scaler:f,totalCount:v,categoryCount:(c??0)+1,maxDensity:w}}class _De{coordinator;source;lastDistance;selectParams;constructor(e,n){this.coordinator=e,this.source=n,this.lastDistance=0;let{x:r,y:i,category:s,text:o,identifier:a}=this.source,l={},u=n.additionalFields??{};for(let c in u){let f=u[c];typeof f=="string"?l["field_"+c]=ae(f):l["field_"+c]=Ze`${f.sql}`}this.selectParams={x:Ze`${ae(r)}::DOUBLE`,y:Ze`${ae(i)}::DOUBLE`,...s!=null?{category:Ze`${ae(s)}::INT`}:{},...o!=null?{text:Ze`${ae(o)}`}:{},...a!=null?{identifier:Ze`${ae(a)}`}:{},...l}}_convertToDataPoint(e){let n={};for(let r in e)r.startsWith("field_")&&(n[r.slice(6)]=e[r]);return{x:e.x,y:e.y,category:e.category,text:e.text,identifier:e.identifier,fields:n}}async queryClosestPoint(e,n,r,i){let s=i*12,{x:o,y:a}=this.source;for(let l of[this.lastDistance,s]){if(l==0||l>s)continue;let u=Be.from(this.source.table).select(this.selectParams);u=u.where(Ze`${ae(o)} BETWEEN ${n-l} AND ${n+l}`),u=u.where(Ze`${ae(a)} BETWEEN ${r-l} AND ${r+l}`),e&&(u=u.where(e)),u=u.orderby(Ze`(x - (${n}))**2 + (y - (${r}))**2`).limit(1);let c=(await this.coordinator.query(u)).get(0);if(c)return this.lastDistance=Math.max(Math.abs(c.x-n),Math.abs(c.y-r))*4,this._convertToDataPoint(c)}return null}async queryPoints(e){let{table:n,identifier:r}=this.source;if(r==null)return[];let i=Be.from(n).select(this.selectParams);return i=i.where(Dh(ae(r),e.map(s=>Ae(s)))),Array.from(await this.coordinator.query(i)).map(s=>this._convertToDataPoint(s))}}function SDe(t,e){fd(e,!0);let n=We(e,"coordinator",19,_x),r=We(e,"category",3,null),i=We(e,"text",3,null),s=We(e,"identifier",3,null),o=We(e,"filter",3,null),a=We(e,"categoryColors",3,null),l=We(e,"tooltip",3,null),u=We(e,"additionalFields",3,null),c=We(e,"selection",3,null),f=We(e,"rangeSelection",3,null),h=We(e,"rangeSelectionValue",3,null),d=We(e,"width",3,null),p=We(e,"height",3,null),m=We(e,"pixelRatio",3,null),g=We(e,"config",3,null),y=We(e,"theme",3,null),O=We(e,"viewportState",3,null),v=We(e,"labels",3,null),w=We(e,"customTooltip",3,null),x=We(e,"customOverlay",3,null),S=We(e,"onViewportState",3,null),_=We(e,"onTooltip",3,null),k=We(e,"onSelection",3,null),C=We(e,"onRangeSelection",3,null),D=We(e,"cache",3,null),A=Mn(new Float32Array),E=Mn(new Float32Array),T=Mn(null),R=Mn(1),$=Mn(1),Q=Mn(1),B=Mn(null),q=Mn(null),z=Mn(null),ee=Mn(null),W=Mn(null);tu(()=>{let te={coordinator:n(),source:{table:e.table,x:e.x,y:e.y,category:r()}},le=null,ve=!1;async function xe(){let ue=te.source,Ee=await xDe(te.coordinator,ue);if(ve)return;let Le=Ee.scaler*.95;ct(B,{x:Ee.centerX,y:Ee.centerY,scale:Le}),ct($,Ee.totalCount),ct(Q,Ee.maxDensity),ct(R,Ee.categoryCount),le=Ph({coordinator:te.coordinator,selection:o()??void 0,query:qe=>Be.from(ue.table).select({x:Ze`${ae(ue.x)}::FLOAT`,y:Ze`${ae(ue.y)}::FLOAT`,...ue.category!=null?{c:Ze`${ae(ue.category)}::UTINYINT`}:{}}).where(qe),queryResult:qe=>{let Fe=qe.getChild("x").toArray(),it=qe.getChild("y").toArray(),St=qe.getChild("c")?.toArray()??null;Fe!=null&&!(Fe instanceof Float32Array)&&(Fe=new Float32Array(Fe)),it!=null&&!(it instanceof Float32Array)&&(it=new Float32Array(it)),St!=null&&!(St instanceof Uint8Array)&&(St=new Uint8Array(St)),ct(A,Fe),ct(E,it),ct(T,St),K(null),H(null)}}),le.reset=()=>{J()},ct(W,le)}return xe(),()=>{ct(W,null),ve=!0,le?.destroy()}}),tu(()=>{if(sD(l())){let te=N(W);if(te==null)return;let le=l();ct(q,le.valueFor(te)??null);let ve=()=>{ct(q,le.valueFor(te)??null)};return tu(()=>{let xe=N(q),ue={x:e.x,y:e.y,category:r(),identifier:s()};le.update({source:te,clients:new Set().add(te),predicate:xe!=null?TF(ue,[xe]):null,value:xe})}),le.addEventListener("value",ve),()=>{le.removeEventListener("value",ve),le.update({source:te,clients:new Set().add(te),value:null,predicate:null})}}else if(l()==null||typeof l()=="object")ct(q,l());else{if(N(q)?.identifier==l())return;let te=!1;return he([l()]).then(le=>{te||(le.length>0?ct(q,le[0]):ct(q,null))}),()=>{te=!0}}});function K(te){Ec(l(),te)||(ct(q,te),_()?.(te))}tu(()=>{if(sD(c())){let te=N(W);if(te==null)return;let le=c();ct(z,le.valueFor(te)??null);let ve=()=>{ct(z,le.valueFor(te)??null)};return tu(()=>{let xe=N(z),ue={x:e.x,y:e.y,category:r(),identifier:s()};le.update({source:te,clients:new Set().add(te),predicate:xe!=null?TF(ue,xe):null,value:xe})}),le.addEventListener("value",ve),()=>{le.removeEventListener("value",ve),le.update({source:te,clients:new Set().add(te),value:null,predicate:null})}}else if(c()==null)ct(z,null);else if(c().length==0)ct(z,[]);else if(c().every(te=>typeof te=="object"))ct(z,c());else{let te=!1;return he(c()).then(le=>{te||ct(z,le)}),()=>{te=!0}}});function H(te){Ec(c(),te)||(ct(z,te),k()?.(te))}tu(()=>{let te=N(W);if(te==null)return;let le=f();if(le!=null)return tu(()=>{let ve=N(ee),xe={x:e.x,y:e.y},ue={source:te,clients:new Set().add(te),predicate:ve!=null?wDe(xe,ve):null,value:ve};le.update(ue),le.activate(ue)}),()=>{le.update({source:te,clients:new Set().add(te),value:null,predicate:null})}}),tu(()=>{Ec(pd(()=>N(ee)),h())||ct(ee,h())});function J(){H(null),K(null),C()?.(null),ct(ee,null)}let Y=lt(()=>new _De(n(),{table:e.table,x:e.x,y:e.y,category:r(),text:i(),identifier:s(),additionalFields:u()}));async function Z(te,le,ve){return await N(Y).queryClosestPoint(o()?.predicate?.(N(W)),te,le,ve)}async function he(te){return await N(Y).queryPoints(te)}async function me(te){if(i()==null)return te.map(()=>null);let le=await eDe({regions:te,stopWords:g()?.autoLabelStopWords??null,categorical:!0}),ve=0,xe=1e4,ue=null;for(;;){let Le=await n().query(Be.from(e.table).select({x:ae(e.x),y:ae(e.y),text:ae("domain")}).offset(ve).limit(xe)),qe={x:Le.getChild("x").toArray(),y:Le.getChild("y").toArray(),text:Le.getChild("text").toArray()};if(ue!=null&&await ue,ue=nDe(le,qe),Le.getChild("text").lengthLe.length==0?null:Le.length>2?Le.slice(0,2).join("-")+`- `+Le.slice(2).join("-"):Le.join("-"))}{let te=lt(()=>d()??800),le=lt(()=>p()??800),ve=lt(()=>m()??2),xe=lt(()=>({x:N(A),y:N(E),category:N(T)}));ODe(t,{get width(){return N(te)},get height(){return N(le)},get pixelRatio(){return N(ve)},get theme(){return y()},get config(){return g()},get data(){return N(xe)},get totalCount(){return N($)},get maxDensity(){return N(Q)},get categoryCount(){return N(R)},get categoryColors(){return a()},get defaultViewportState(){return N(B)},querySelection:Z,queryClusterLabels:me,get labels(){return v()},get customTooltip(){return w()},get customOverlay(){return x()},get tooltip(){return N(q)},onTooltip:K,get selection(){return N(z)},onSelection:H,get viewportState(){return O()},get onViewportState(){return S()},get rangeSelection(){return N(ee)},onRangeSelection:ue=>{ct(ee,ue),C()?.(ue)},get cache(){return D()}})}hd()}class kDe{component;currentProps;constructor(e,n){this.currentProps={...n},this.component=i8e({component:SDe,target:e,props:n})}update(e){let n={};for(let r in e)e[r]!==this.currentProps[r]&&(n[r]=e[r],this.currentProps[r]=e[r]);this.component.$set(n)}destroy(){this.component.$destroy()}}function CDe(){return KW()?32:4}function rv(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function ADe(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function gG(t){let e,n,r;t.length!==2?(e=rv,n=(a,l)=>rv(t(a),l),r=(a,l)=>t(a)-l):(e=t===rv||t===ADe?t:EDe,n=t,r=t);function i(a,l,u=0,c=a.length){if(u>>1;n(a[f],l)<0?u=f+1:c=f}while(u>>1;n(a[f],l)<=0?u=f+1:c=f}while(uu&&r(a[f-1],l)>-r(a[f],l)?f-1:f}return{left:i,center:o,right:s}}function EDe(){return 0}function TDe(t){return t===null?NaN:+t}const DDe=gG(rv),PDe=DDe.right;gG(TDe).center;function RDe(t,e){let n,r;if(e===void 0)for(const i of t)i!=null&&(n===void 0?i>=i&&(n=r=i):(n>i&&(n=i),r=s&&(n=r=s):(n>s&&(n=s),r=MDe?10:s>=LDe?5:s>=NDe?2:1;let a,l,u;return i<0?(u=Math.pow(10,-i)/o,a=Math.round(t*u),l=Math.round(e*u),a/ue&&--l,u=-u):(u=Math.pow(10,i)*o,a=Math.round(t/u),l=Math.round(e/u),a*ue&&--l),l0))return[];if(t===e)return[t];const r=e=i))return[];const a=s-i+1,l=new Array(a);if(r)if(o<0)for(let u=0;u{}};function yG(){for(var t=0,e=arguments.length,n={},r;t=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}iv.prototype=yG.prototype={constructor:iv,on:function(t,e){var n=this._,r=UDe(t+"",n),i,s=-1,o=r.length;if(arguments.length<2){for(;++s0)for(var n=new Array(i),r=0,i,s;r=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),IF.hasOwnProperty(e)?{space:IF[e],local:t}:t}function qDe(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===aC&&e.documentElement.namespaceURI===aC?e.createElement(t):e.createElementNS(n,t)}}function VDe(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function bG(t){var e=E_(t);return(e.local?VDe:qDe)(e)}function ZDe(){}function Z8(t){return t==null?ZDe:function(){return this.querySelector(t)}}function XDe(t){typeof t!="function"&&(t=Z8(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i=v&&(v=O+1);!(x=g[v])&&++v=0;)(o=r[i])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function bPe(t){t||(t=OPe);function e(f,h){return f&&h?t(f.__data__,h.__data__):!f-!h}for(var n=this._groups,r=n.length,i=new Array(r),s=0;se?1:t>=e?0:NaN}function vPe(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function wPe(){return Array.from(this)}function xPe(){for(var t=this._groups,e=0,n=t.length;e1?this.each((e==null?IPe:typeof e=="function"?$Pe:FPe)(t,e,n??"")):k0(this.node(),t)}function k0(t,e){return t.style.getPropertyValue(e)||_G(t).getComputedStyle(t,null).getPropertyValue(e)}function LPe(t){return function(){delete this[t]}}function NPe(t,e){return function(){this[t]=e}}function QPe(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function BPe(t,e){return arguments.length>1?this.each((e==null?LPe:typeof e=="function"?QPe:NPe)(t,e)):this.node()[t]}function SG(t){return t.trim().split(/^|\s+/)}function X8(t){return t.classList||new kG(t)}function kG(t){this._node=t,this._names=SG(t.getAttribute("class")||"")}kG.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function CG(t,e){for(var n=X8(t),r=-1,i=e.length;++r=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function p7e(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,i=e.length,s;n>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Hb(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Hb(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=S7e.exec(t))?new Jr(e[1],e[2],e[3],1):(e=k7e.exec(t))?new Jr(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=C7e.exec(t))?Hb(e[1],e[2],e[3],e[4]):(e=A7e.exec(t))?Hb(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=E7e.exec(t))?BF(e[1],e[2]/100,e[3]/100,1):(e=T7e.exec(t))?BF(e[1],e[2]/100,e[3]/100,e[4]):FF.hasOwnProperty(t)?LF(FF[t]):t==="transparent"?new Jr(NaN,NaN,NaN,0):null}function LF(t){return new Jr(t>>16&255,t>>8&255,t&255,1)}function Hb(t,e,n,r){return r<=0&&(t=e=n=NaN),new Jr(t,e,n,r)}function W8(t){return t instanceof Of||(t=Xh(t)),t?(t=t.rgb(),new Jr(t.r,t.g,t.b,t.opacity)):new Jr}function A0(t,e,n,r){return arguments.length===1?W8(t):new Jr(t,e,n,r??1)}function Jr(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}lm(Jr,A0,Ly(Of,{brighter(t){return t=t==null?C0:Math.pow(C0,t),new Jr(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Zh:Math.pow(Zh,t),new Jr(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Jr(vh(this.r),vh(this.g),vh(this.b),Tw(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:NF,formatHex:NF,formatHex8:R7e,formatRgb:QF,toString:QF}));function NF(){return`#${lh(this.r)}${lh(this.g)}${lh(this.b)}`}function R7e(){return`#${lh(this.r)}${lh(this.g)}${lh(this.b)}${lh((isNaN(this.opacity)?1:this.opacity)*255)}`}function QF(){const t=Tw(this.opacity);return`${t===1?"rgb(":"rgba("}${vh(this.r)}, ${vh(this.g)}, ${vh(this.b)}${t===1?")":`, ${t})`}`}function Tw(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function vh(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function lh(t){return t=vh(t),(t<16?"0":"")+t.toString(16)}function BF(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new oa(t,e,n,r)}function TG(t){if(t instanceof oa)return new oa(t.h,t.s,t.l,t.opacity);if(t instanceof Of||(t=Xh(t)),!t)return new oa;if(t instanceof oa)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),s=Math.max(e,n,r),o=NaN,a=s-i,l=(s+i)/2;return a?(e===s?o=(n-r)/a+(n0&&l<1?0:o,new oa(o,a,l,t.opacity)}function I7e(t,e,n,r){return arguments.length===1?TG(t):new oa(t,e,n,r??1)}function oa(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}lm(oa,I7e,Ly(Of,{brighter(t){return t=t==null?C0:Math.pow(C0,t),new oa(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Zh:Math.pow(Zh,t),new oa(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Jr(ik(t>=240?t-240:t+120,i,r),ik(t,i,r),ik(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new oa(zF(this.h),Kb(this.s),Kb(this.l),Tw(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Tw(this.opacity);return`${t===1?"hsl(":"hsla("}${zF(this.h)}, ${Kb(this.s)*100}%, ${Kb(this.l)*100}%${t===1?")":`, ${t})`}`}}));function zF(t){return t=(t||0)%360,t<0?t+360:t}function Kb(t){return Math.max(0,Math.min(1,t||0))}function ik(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const DG=Math.PI/180,PG=180/Math.PI,Dw=18,RG=.96422,IG=1,FG=.82521,$G=4/29,Mp=6/29,MG=3*Mp*Mp,F7e=Mp*Mp*Mp;function LG(t){if(t instanceof bl)return new bl(t.l,t.a,t.b,t.opacity);if(t instanceof ku)return QG(t);t instanceof Jr||(t=W8(t));var e=lk(t.r),n=lk(t.g),r=lk(t.b),i=sk((.2225045*e+.7168786*n+.0606169*r)/IG),s,o;return e===n&&n===r?s=o=i:(s=sk((.4360747*e+.3850649*n+.1430804*r)/RG),o=sk((.0139322*e+.0971045*n+.7141733*r)/FG)),new bl(116*i-16,500*(s-i),200*(i-o),t.opacity)}function NG(t,e,n,r){return arguments.length===1?LG(t):new bl(t,e,n,r??1)}function bl(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}lm(bl,NG,Ly(Of,{brighter(t){return new bl(this.l+Dw*(t??1),this.a,this.b,this.opacity)},darker(t){return new bl(this.l-Dw*(t??1),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return e=RG*ok(e),t=IG*ok(t),n=FG*ok(n),new Jr(ak(3.1338561*e-1.6168667*t-.4906146*n),ak(-.9787684*e+1.9161415*t+.033454*n),ak(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}}));function sk(t){return t>F7e?Math.pow(t,1/3):t/MG+$G}function ok(t){return t>Mp?t*t*t:MG*(t-$G)}function ak(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function lk(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function $7e(t){if(t instanceof ku)return new ku(t.h,t.c,t.l,t.opacity);if(t instanceof bl||(t=LG(t)),t.a===0&&t.b===0)return new ku(NaN,0=1?(n=1,e-1):Math.floor(n*e),i=t[r],s=t[r+1],o=r>0?t[r-1]:2*i-s,a=r()=>t;function zG(t,e){return function(n){return t+n*e}}function B7e(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function z7e(t,e){var n=e-t;return n?zG(t,n>180||n<-180?n-360*Math.round(n/360):n):D_(isNaN(t)?e:t)}function U7e(t){return(t=+t)==1?Lp:function(e,n){return n-e?B7e(e,n,t):D_(isNaN(e)?n:e)}}function Lp(t,e){var n=e-t;return n?zG(t,n):D_(isNaN(t)?e:t)}const Pw=(function t(e){var n=U7e(e);function r(i,s){var o=n((i=A0(i)).r,(s=A0(s)).r),a=n(i.g,s.g),l=n(i.b,s.b),u=Lp(i.opacity,s.opacity);return function(c){return i.r=o(c),i.g=a(c),i.b=l(c),i.opacity=u(c),i+""}}return r.gamma=t,r})(1);function j7e(t){return function(e){var n=e.length,r=new Array(n),i=new Array(n),s=new Array(n),o,a;for(o=0;on&&(s=e.slice(n,s),a[o]?a[o]+=s:a[++o]=s),(r=r[0])===(i=i[0])?a[o]?a[o]+=i:a[++o]=i:(a[++o]=null,l.push({i:o,x:ea(r,i)})),n=uk.lastIndex;return n180?c+=360:c-u>180&&(u+=360),h.push({i:f.push(i(f)+"rotate(",null,r)-2,x:ea(u,c)})):c&&f.push(i(f)+"rotate("+c+r)}function a(u,c,f,h){u!==c?h.push({i:f.push(i(f)+"skewX(",null,r)-2,x:ea(u,c)}):c&&f.push(i(f)+"skewX("+c+r)}function l(u,c,f,h,d,p){if(u!==f||c!==h){var m=d.push(i(d)+"scale(",null,",",null,")");p.push({i:m-4,x:ea(u,f)},{i:m-2,x:ea(c,h)})}else(f!==1||h!==1)&&d.push(i(d)+"scale("+f+","+h+")")}return function(u,c){var f=[],h=[];return u=t(u),c=t(c),s(u.translateX,u.translateY,c.translateX,c.translateY,f,h),o(u.rotate,c.rotate,f,h),a(u.skewX,c.skewX,f,h),l(u.scaleX,u.scaleY,c.scaleX,c.scaleY,f,h),u=c=null,function(d){for(var p=-1,m=h.length,g;++p=0&&t._call.call(void 0,e),t=t._next;--E0}function ZF(){Wh=(Iw=X1.now())+P_,E0=hg=0;try{r9e()}finally{E0=0,s9e(),Wh=0}}function i9e(){var t=X1.now(),e=t-Iw;e>ZG&&(P_-=e,Iw=t)}function s9e(){for(var t,e=Rw,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Rw=n);dg=t,cC(r)}function cC(t){if(!E0){hg&&(hg=clearTimeout(hg));var e=t-Wh;e>24?(t<1/0&&(hg=setTimeout(ZF,t-X1.now()-P_)),Lm&&(Lm=clearInterval(Lm))):(Lm||(Iw=X1.now(),Lm=setInterval(i9e,ZG)),E0=1,XG(ZF))}}function XF(t,e,n){var r=new Fw;return e=e==null?0:+e,r.restart(i=>{r.stop(),t(i+e)},e,n),r}var o9e=yG("start","end","cancel","interrupt"),a9e=[],YG=0,WF=1,fC=2,sv=3,YF=4,hC=5,ov=6;function R_(t,e,n,r,i,s){var o=t.__transition;if(!o)t.__transition={};else if(n in o)return;l9e(t,n,{name:e,index:r,group:i,on:o9e,tween:a9e,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:YG})}function tT(t,e){var n=ka(t,e);if(n.state>YG)throw new Error("too late; already scheduled");return n}function ql(t,e){var n=ka(t,e);if(n.state>sv)throw new Error("too late; already running");return n}function ka(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function l9e(t,e,n){var r=t.__transition,i;r[e]=n,n.timer=WG(s,0,n.time);function s(u){n.state=WF,n.timer.restart(o,n.delay,n.time),n.delay<=u&&o(u-n.delay)}function o(u){var c,f,h,d;if(n.state!==WF)return l();for(c in r)if(d=r[c],d.name===n.name){if(d.state===sv)return XF(o);d.state===YF?(d.state=ov,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete r[c]):+cfC&&r.state=0&&(e=e.slice(0,n)),!e||e==="start"})}function Q9e(t,e,n){var r,i,s=N9e(e)?tT:ql;return function(){var o=s(this,t),a=o.on;a!==r&&(i=(r=a).copy()).on(e,n),o.on=i}}function B9e(t,e){var n=this._id;return arguments.length<2?ka(this.node(),n).on.on(t):this.each(Q9e(n,t,e))}function z9e(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function U9e(){return this.on("end.remove",z9e(this._id))}function j9e(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Z8(t));for(var r=this._groups,i=r.length,s=new Array(i),o=0;o=0))throw new Error(`invalid digits: ${t}`);if(e>15)return JG;const n=10**e;return function(r){this._+=r[0];for(let i=1,s=r.length;iMf)if(!(Math.abs(f*l-u*c)>Mf)||!s)this._append`L${this._x1=e},${this._y1=n}`;else{let d=r-o,p=i-a,m=l*l+u*u,g=d*d+p*p,y=Math.sqrt(m),O=Math.sqrt(h),v=s*Math.tan((dC-Math.acos((m+h-g)/(2*y*O)))/2),w=v/O,x=v/y;Math.abs(w-1)>Mf&&this._append`L${e+w*c},${n+w*f}`,this._append`A${s},${s},0,0,${+(f*d>c*p)},${this._x1=e+x*l},${this._y1=n+x*u}`}}arc(e,n,r,i,s,o){if(e=+e,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(i),l=r*Math.sin(i),u=e+a,c=n+l,f=1^o,h=o?i-s:s-i;this._x1===null?this._append`M${u},${c}`:(Math.abs(this._x1-u)>Mf||Math.abs(this._y1-c)>Mf)&&this._append`L${u},${c}`,r&&(h<0&&(h=h%pC+pC),h>pRe?this._append`A${r},${r},0,1,${f},${e-a},${n-l}A${r},${r},0,1,${f},${this._x1=u},${this._y1=c}`:h>Mf&&this._append`A${r},${r},0,${+(h>=dC)},${f},${this._x1=e+r*Math.cos(s)},${this._y1=n+r*Math.sin(s)}`)}rect(e,n,r,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function yRe(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function $w(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function T0(t){return t=$w(Math.abs(t)),t?t[1]:NaN}function bRe(t,e){return function(n,r){for(var i=n.length,s=[],o=0,a=t[0],l=0;i>0&&a>0&&(l+a+1>r&&(a=Math.max(1,r-l)),s.push(n.substring(i-=a,i+a)),!((l+=a+1)>r));)a=t[o=(o+1)%t.length];return s.reverse().join(e)}}function ORe(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var vRe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function W1(t){if(!(e=vRe.exec(t)))throw new Error("invalid format: "+t);var e;return new rT({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}W1.prototype=rT.prototype;function rT(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}rT.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function wRe(t){e:for(var e=t.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var eH;function xRe(t,e){var n=$w(t,e);if(!n)return t+"";var r=n[0],i=n[1],s=i-(eH=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return s===o?r:s>o?r+new Array(s-o+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+$w(t,Math.max(0,e+s-1))[0]}function GF(t,e){var n=$w(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const HF={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:yRe,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>GF(t*100,e),r:GF,s:xRe,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function KF(t){return t}var JF=Array.prototype.map,e$=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function _Re(t){var e=t.grouping===void 0||t.thousands===void 0?KF:bRe(JF.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",s=t.numerals===void 0?KF:ORe(JF.call(t.numerals,String)),o=t.percent===void 0?"%":t.percent+"",a=t.minus===void 0?"−":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function u(f){f=W1(f);var h=f.fill,d=f.align,p=f.sign,m=f.symbol,g=f.zero,y=f.width,O=f.comma,v=f.precision,w=f.trim,x=f.type;x==="n"?(O=!0,x="g"):HF[x]||(v===void 0&&(v=12),w=!0,x="g"),(g||h==="0"&&d==="=")&&(g=!0,h="0",d="=");var S=m==="$"?n:m==="#"&&/[boxX]/.test(x)?"0"+x.toLowerCase():"",_=m==="$"?r:/[%p]/.test(x)?o:"",k=HF[x],C=/[defgprs%]/.test(x);v=v===void 0?6:/[gprs]/.test(x)?Math.max(1,Math.min(21,v)):Math.max(0,Math.min(20,v));function D(A){var E=S,T=_,R,$,Q;if(x==="c")T=k(A)+T,A="";else{A=+A;var B=A<0||1/A<0;if(A=isNaN(A)?l:k(Math.abs(A),v),w&&(A=wRe(A)),B&&+A==0&&p!=="+"&&(B=!1),E=(B?p==="("?p:a:p==="-"||p==="("?"":p)+E,T=(x==="s"?e$[8+eH/3]:"")+T+(B&&p==="("?")":""),C){for(R=-1,$=A.length;++R<$;)if(Q=A.charCodeAt(R),48>Q||Q>57){T=(Q===46?i+A.slice(R+1):A.slice(R))+T,A=A.slice(0,R);break}}}O&&!g&&(A=e(A,1/0));var q=E.length+A.length+T.length,z=q>1)+E+A+T+z.slice(q);break;default:A=z+E+A+T;break}return s(A)}return D.toString=function(){return f+""},D}function c(f,h){var d=u((f=W1(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(T0(h)/3)))*3,m=Math.pow(10,-p),g=e$[8+p/3];return function(y){return d(m*y)+g}}return{format:u,formatPrefix:c}}var eO,Ny,tH;SRe({thousands:",",grouping:[3],currency:["$",""]});function SRe(t){return eO=_Re(t),Ny=eO.format,tH=eO.formatPrefix,eO}function kRe(t){return Math.max(0,-T0(Math.abs(t)))}function CRe(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(T0(e)/3)))*3-T0(Math.abs(t)))}function ARe(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,T0(e)-T0(t))+1}function Qy(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}const t$=Symbol("implicit");function nH(){var t=new DF,e=[],n=[],r=t$;function i(s){let o=t.get(s);if(o===void 0){if(r!==t$)return r;t.set(s,o=e.push(s)-1)}return n[o%n.length]}return i.domain=function(s){if(!arguments.length)return e.slice();e=[],t=new DF;for(const o of s)t.has(o)||t.set(o,e.push(o)-1);return i},i.range=function(s){return arguments.length?(n=Array.from(s),i):n.slice()},i.unknown=function(s){return arguments.length?(r=s,i):r},i.copy=function(){return nH(e,n).unknown(r)},Qy.apply(i,arguments),i}function rH(){var t=nH().unknown(void 0),e=t.domain,n=t.range,r=0,i=1,s,o,a=!1,l=0,u=0,c=.5;delete t.unknown;function f(){var h=e().length,d=ie&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function PRe(t,e,n){var r=t[0],i=t[1],s=e[0],o=e[1];return i2?RRe:PRe,l=u=null,f}function f(h){return h==null||isNaN(h=+h)?s:(l||(l=a(t.map(r),e,n)))(r(o(h)))}return f.invert=function(h){return o(i((u||(u=a(e,t.map(r),ea)))(h)))},f.domain=function(h){return arguments.length?(t=Array.from(h,TRe),c()):t.slice()},f.range=function(h){return arguments.length?(e=Array.from(h),c()):e.slice()},f.rangeRound=function(h){return e=Array.from(h),n=H7e,c()},f.clamp=function(h){return arguments.length?(o=h?!0:sp,c()):o!==sp},f.interpolate=function(h){return arguments.length?(n=h,c()):n},f.unknown=function(h){return arguments.length?(s=h,f):s},function(h,d){return r=h,i=d,c()}}function IRe(){return sT()(sp,sp)}function FRe(t,e,n,r){var i=QDe(t,e,n),s;switch(r=W1(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(s=CRe(i,o))&&(r.precision=s),tH(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=ARe(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=kRe(i))&&(r.precision=s-(r.type==="%")*2);break}}return Ny(r)}function iH(t){var e=t.domain;return t.ticks=function(n){var r=e();return sC(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return FRe(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,s=r.length-1,o=r[i],a=r[s],l,u,c=10;for(a0;){if(u=oC(o,a,n),u===l)return r[i]=o,r[s]=a,e(r);if(u>0)o=Math.floor(o/u)*u,a=Math.ceil(a/u)*u;else if(u<0)o=Math.ceil(o*u)/u,a=Math.floor(a*u)/u;else break;l=u}return t},t}function I_(){var t=IRe();return t.copy=function(){return iT(t,I_())},Qy.apply(t,arguments),iH(t)}function $Re(t,e){t=t.slice();var n=0,r=t.length-1,i=t[n],s=t[r],o;return sMath.pow(t,e)}function BRe(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function s$(t){return(e,n)=>-t(-e,n)}function zRe(t){const e=t(r$,i$),n=e.domain;let r=10,i,s;function o(){return i=BRe(r),s=QRe(r),n()[0]<0?(i=s$(i),s=s$(s),t(MRe,LRe)):t(r$,i$),e}return e.base=function(a){return arguments.length?(r=+a,o()):r},e.domain=function(a){return arguments.length?(n(a),o()):n()},e.ticks=a=>{const l=n();let u=l[0],c=l[l.length-1];const f=c0){for(;h<=d;++h)for(p=1;pc)break;y.push(m)}}else for(;h<=d;++h)for(p=r-1;p>=1;--p)if(m=h>0?p/s(-h):p*s(h),!(mc)break;y.push(m)}y.length*2{if(a==null&&(a=10),l==null&&(l=r===10?"s":","),typeof l!="function"&&(!(r%1)&&(l=W1(l)).precision==null&&(l.trim=!0),l=Ny(l)),a===1/0)return l;const u=Math.max(1,r*a/e.ticks().length);return c=>{let f=c/s(Math.round(i(c)));return f*rn($Re(n(),{floor:a=>s(Math.floor(i(a))),ceil:a=>s(Math.ceil(i(a)))})),e}function Y1(){const t=zRe(sT()).domain([1,10]);return t.copy=()=>iT(t,Y1()).base(t.base()),Qy.apply(t,arguments),t}function o$(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function a$(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function URe(t){var e=1,n=t(o$(e),a$(e));return n.constant=function(r){return arguments.length?t(o$(e=+r),a$(e)):e},iH(n)}function sH(){var t=URe(sT());return t.copy=function(){return iT(t,sH()).constant(t.constant())},Qy.apply(t,arguments)}function ln(t){for(var e=t.length/6|0,n=new Array(e),r=0;rH8(t[t.length-1]);var jRe=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(ln);const qRe=Pn(jRe);var VRe=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(ln);const ZRe=Pn(VRe);var XRe=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(ln);const WRe=Pn(XRe);var YRe=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(ln);const GRe=Pn(YRe);var HRe=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(ln);const KRe=Pn(HRe);var JRe=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(ln);const eIe=Pn(JRe);var tIe=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(ln);const nIe=Pn(tIe);var rIe=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(ln);const iIe=Pn(rIe);var sIe=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(ln);const oIe=Pn(sIe);var aIe=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(ln);const lIe=Pn(aIe);var uIe=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(ln);const cIe=Pn(uIe);var fIe=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(ln);const hIe=Pn(fIe);var dIe=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(ln);const pIe=Pn(dIe);var mIe=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(ln);const gIe=Pn(mIe);var yIe=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(ln);const bIe=Pn(yIe);var OIe=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(ln);const vIe=Pn(OIe);var wIe=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(ln);const xIe=Pn(wIe);var _Ie=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(ln);const SIe=Pn(_Ie);var kIe=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(ln);const CIe=Pn(kIe);var AIe=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(ln);const EIe=Pn(AIe);var TIe=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(ln);const DIe=Pn(TIe);var PIe=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(ln);const RIe=Pn(PIe);var IIe=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(ln);const FIe=Pn(IIe);var $Ie=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(ln);const MIe=Pn($Ie);var LIe=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(ln);const NIe=Pn(LIe);var QIe=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(ln);const BIe=Pn(QIe);var zIe=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(ln);const UIe=Pn(zIe);function jIe(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-t*(35.34-t*(2381.73-t*(6402.7-t*(7024.72-t*2710.57)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+t*(170.73+t*(52.82-t*(131.46-t*(176.58-t*67.37)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+t*(442.36-t*(2482.43-t*(6167.24-t*(6614.94-t*2475.67)))))))+")"}const qIe=J8(Pl(300,.5,0),Pl(-240,.5,1));var VIe=J8(Pl(-100,.75,.35),Pl(80,1.5,.8)),ZIe=J8(Pl(260,.75,.35),Pl(80,1.5,.8)),tO=Pl();function XIe(t){(t<0||t>1)&&(t-=Math.floor(t));var e=Math.abs(t-.5);return tO.h=360*t-100,tO.s=1.5-1.5*e,tO.l=.8-.9*e,tO+""}var nO=A0(),WIe=Math.PI/3,YIe=Math.PI*2/3;function GIe(t){var e;return t=(.5-t)*Math.PI,nO.r=255*(e=Math.sin(t))*e,nO.g=255*(e=Math.sin(t+WIe))*e,nO.b=255*(e=Math.sin(t+YIe))*e,nO+""}function oT(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+t*(1172.33-t*(10793.56-t*(33300.12-t*(38394.49-t*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+t*(557.33+t*(1225.33-t*(3574.96-t*(1073.77+t*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+t*(3211.1-t*(15327.97-t*(27814-t*(22569.18-t*6838.66)))))))+")"}function F_(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}}const HIe=F_(ln("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725"));var KIe=F_(ln("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),JIe=F_(ln("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),eFe=F_(ln("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function Wr(t){return function(){return t}}const l$=1e-12;function oH(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new gRe(e)}function aH(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function lH(t){this._context=t}lH.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function Mw(t){return new lH(t)}function uH(t){return t[0]}function cH(t){return t[1]}function fH(t,e){var n=Wr(!0),r=null,i=Mw,s=null,o=oH(a);t=typeof t=="function"?t:t===void 0?uH:Wr(t),e=typeof e=="function"?e:e===void 0?cH:Wr(e);function a(l){var u,c=(l=aH(l)).length,f,h=!1,d;for(r==null&&(s=i(d=o())),u=0;u<=c;++u)!(u=d;--p)a.point(v[p],w[p]);a.lineEnd(),a.areaEnd()}y&&(v[h]=+t(g,h,f),w[h]=+e(g,h,f),a.point(r?+r(g,h,f):v[h],n?+n(g,h,f):w[h]))}if(O)return a=null,O+""||null}function c(){return fH().defined(i).curve(o).context(s)}return u.x=function(f){return arguments.length?(t=typeof f=="function"?f:Wr(+f),r=null,u):t},u.x0=function(f){return arguments.length?(t=typeof f=="function"?f:Wr(+f),u):t},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Wr(+f),u):r},u.y=function(f){return arguments.length?(e=typeof f=="function"?f:Wr(+f),n=null,u):e},u.y0=function(f){return arguments.length?(e=typeof f=="function"?f:Wr(+f),u):e},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Wr(+f),u):n},u.lineX0=u.lineY0=function(){return c().x(t).y(e)},u.lineY1=function(){return c().x(t).y(n)},u.lineX1=function(){return c().x(r).y(e)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Wr(!!f),u):i},u.curve=function(f){return arguments.length?(o=f,s!=null&&(a=o(s)),u):o},u.context=function(f){return arguments.length?(f==null?s=a=null:a=o(s=f),u):s},u}function c$(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function hH(t){this._context=t}hH.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:c$(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:c$(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function tFe(t){return new hH(t)}function f$(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function aT(t,e){this._context=t,this._k=(1-e)/6}aT.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:f$(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:f$(this,t,e);break}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const nFe=(function t(e){function n(r){return new aT(r,e)}return n.tension=function(r){return t(+r)},n})(0);function rFe(t,e,n){var r=t._x1,i=t._y1,s=t._x2,o=t._y2;if(t._l01_a>l$){var a=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*a-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,i=(i*a-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>l$){var u=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,c=3*t._l23_a*(t._l23_a+t._l12_a);s=(s*u+t._x1*t._l23_2a-e*t._l12_2a)/c,o=(o*u+t._y1*t._l23_2a-n*t._l12_2a)/c}t._context.bezierCurveTo(r,i,s,o,t._x2,t._y2)}function dH(t,e){this._context=t,this._alpha=e}dH.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:rFe(this,t,e);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};const iFe=(function t(e){function n(r){return e?new dH(r,e):new aT(r,0)}return n.alpha=function(r){return t(+r)},n})(.5);function h$(t){return t<0?-1:1}function d$(t,e,n){var r=t._x1-t._x0,i=e-t._x1,s=(t._y1-t._y0)/(r||i<0&&-0),o=(n-t._y1)/(i||r<0&&-0),a=(s*i+o*r)/(r+i);return(h$(s)+h$(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function p$(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function ck(t,e,n){var r=t._x0,i=t._y0,s=t._x1,o=t._y1,a=(s-r)/3;t._context.bezierCurveTo(r+a,i+a*e,s-a,o-a*n,s,o)}function Lw(t){this._context=t}Lw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:ck(this,this._t0,p$(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,ck(this,p$(this,n=d$(this,t,e)),n);break;default:ck(this,this._t0,n=d$(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function pH(t){this._context=new mH(t)}(pH.prototype=Object.create(Lw.prototype)).point=function(t,e){Lw.prototype.point.call(this,e,t)};function mH(t){this._context=t}mH.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,s){this._context.bezierCurveTo(e,t,r,n,s,i)}};function sFe(t){return new Lw(t)}function oFe(t){return new pH(t)}function gH(t){this._context=t}gH.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var r=m$(t),i=m$(e),s=0,o=1;o=0;--e)i[e]=(o[e]-i[e+1])/s[e];for(s[n-1]=(t[n]+i[n-1])/2,e=0;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function lFe(t){return new $_(t,.5)}function uFe(t){return new $_(t,0)}function cFe(t){return new $_(t,1)}function pg(t,e,n){this.k=t,this.x=e,this.y=n}pg.prototype={constructor:pg,scale:function(t){return t===1?this:new pg(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new pg(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};pg.prototype;function rO(t,e=0){let n=NG(t);return n.l+=e,n.a=0,n.b=0,n.rgb().formatHex8()}const fFe={light:{scheme:"light",interpolate:"pubugn",categoryColors:S0,ordinalColors:g$,otherColor:"#9eabc2",nullColor:"#aaaaaa",markColor:"#3b82f6",markColorFade:"#dbeafe",markColorGray:rO("#3b82f6",20),markColorGrayFade:rO("#dbeafe"),embeddingColor:"#1f77b4",ruleColor:"#000",gridColor:uu.slate[300],labelColor:uu.slate[400],labelFontFamily:"system-ui",labelFontSize:11,labelMaxWidth:80,brushBorder:uu.slate[500],brushBorderBack:"#fff",brushFill:"rgba(0,0,0,0.1)"},dark:{scheme:"dark",interpolate:"inferno",categoryColors:S0,ordinalColors:g$,otherColor:"#9eabc2",nullColor:"#aaaaaa",markColor:"#3b82f6",markColorFade:"#3b4d7f",markColorGray:rO("#3b82f6",-20),markColorGrayFade:rO("#1f398a"),embeddingColor:"#1f77b4",ruleColor:"#fff",gridColor:uu.slate[700],labelColor:uu.slate[500],labelFontFamily:"system-ui",labelFontSize:11,labelMaxWidth:80,brushBorder:uu.slate[400],brushBorderBack:"#000",brushFill:"rgba(255,255,255,0.1)"}},hFe={blues:RIe,brbg:qRe,bugn:lIe,bupu:cIe,cividis:jIe,cool:ZIe,cubehelixdefault:qIe,gnbu:hIe,greens:FIe,greys:MIe,inferno:JIe,magma:KIe,oranges:UIe,orrd:pIe,piyg:WRe,plasma:eFe,prgn:ZRe,pubu:bIe,pubugn:gIe,puor:GRe,purd:vIe,purples:NIe,rainbow:XIe,rdbu:KRe,rdgy:eIe,rdpu:xIe,rdylbu:nIe,rdylgn:iIe,reds:BIe,sinebow:GIe,spectral:oIe,turbo:oT,viridis:HIe,warm:VIe,ylgn:CIe,ylgnbu:SIe,ylorbr:EIe,ylorrd:DIe};function lT(t,e){let n=fFe[t];return e!=null&&(n=lp(n,lp(e,{light:void 0,dark:void 0})??e)??n,e[t]!=null&&(n=lp(n,e[t])??n)),n}function dFe(t){return typeof t=="string"?hFe[t.toLowerCase()]??oT:typeof t=="function"?t:H8(t)}function g$(t){let e=[];for(let n=0;n'),mFe=G(' ',1),gFe=G('
    (Occurrences in lists)
    '),yFe=G(''),bFe=G('
    ',1),OFe=G('
    ');function vFe(t,e){De(e,!0);const n=()=>hr(u,"$colorScheme",i),r=()=>hr(c,"$themeConfig",i),[i,s]=Lo(),o="(other)",a="(null)";let{coordinator:l,colorScheme:u,theme:c}=e.context,f=L(()=>lT(n(),r())),h=L(()=>e.state.selection),d=L(()=>Y_(e.spec.limit,10)),p=L(()=>Y_(e.spec.labels,"#/#")),m=L(()=>Y_(e.spec.order,"total-descending")),g=L(()=>e.spec.data.isList??!1),y=L(()=>b(p)=="#/#"),O=pe(void 0),v=pe(400),w=L(()=>b(O)?.items.filter(E=>E.special==null).reduce((E,T)=>Math.max(E,b(y)?T.count:T.countSelected),0)??0);function x(E){return typeof E=="string"?ae(E):Ze`${E.sql}`}function S(E){return E==null?Ae(!0):E instanceof Array?E.length==0?Ae(!0):xs(...E.map(S)):typeof E=="string"?Ze`${E}`:typeof E=="boolean"?Ae(E):E}function _(E){if(E instanceof Array){let T=E.map(R=>Ae(R));return fp(Dh("value",T))}switch(E??"total-descending"){case"alphabetical":return Pd("value");case"selected-ascending":return Pd("countSelected");case"selected-descending":return fp("countSelected");case"total-ascending":return Pd("count");case"total-descending":default:return fp("count")}}function k(E,T,R,$,Q,B,q){Q instanceof Array&&(B=Math.max(B,Q.length));let z=Ph({coordinator:E,selection:$,query:K=>{if(q){let H="__count_plot_intermediate__";return Be.with({[H]:Be.from(T).select({value:Ze`UNNEST(${x(R)})::TEXT`,predicate:Hn(S(K),"INT")})}).from(H).select({value:"value",count:Cr(),countSelected:dr("predicate"),total:Ze`(${Be.from(H).select({count:Cr()})})`,totalSelected:Ze`(${Be.from(H).select({count:dr("predicate")})})`}).groupby("value").orderby(Th("value"),_(Q),Pd("value")).limit(B+1)}else{let H=Hn(x(R),"TEXT");return Be.from(T).select({value:H,count:Cr(),countSelected:dr(Hn(S(K),"INT")),total:Ze`(${Be.from(T).select({count:Cr()})})`,totalSelected:Ze`(${Be.from(T).select({count:Cr()}).where(K)})`}).groupby(H).orderby(Th(H),_(Q),Pd("value")).limit(B+1)}},queryResult:K=>{let H=K.toArray();if(H.length==0){X(O,void 0);return}let{total:J,totalSelected:Y}=H[0];J==null&&(J=0),Y==null&&(Y=0);let Z={items:[],sumSelected:Y,sumTotal:J};for(let te of H)te.value!=null&&Z.items.length{let ve=Q.indexOf(le.value);return ve<0?1/0:ve};Z.items.sort((le,ve)=>te(le)-te(ve))}for(let te of H)te.value==null&&Z.items.push({value:a,count:te.count??0,countSelected:te.countSelected??0,special:"null"});let he=Z.items.reduce((te,le)=>te+le.count,0),me=Z.items.reduce((te,le)=>te+le.countSelected,0);(he{if(Y==a)return KT(H,Ze`NULL`);if(Y==o){let Z=b(O)?.items.filter(he=>he.special==null).map(he=>Ae(he.value))??[];return Ze`len(list_filter(${H}, x -> x NOT IN (${Z.join(",")}))) > 0`}else return KT(H,Ae(Y))}))}else{let H=Hn(x(R),"TEXT");return _o(...K.map(J=>{if(J==a)return Eu(H);if(J==o){let Y=b(O)?.items.filter(Z=>Z.special==null).map(Z=>Ae(Z.value))??[];return Xp(Dh(H,Y))}else return T6(H,Ae(J))}))}}let W={filterField:R,filterTitle:e.spec.title,isListFilter:q,reset:()=>{e.onStateChange({selection:void 0})}};return An(()=>{let K={source:W,clients:new Set([z]),...b(h)!=null&&b(h).length>0?{value:b(h),predicate:ee(b(h))}:{value:null,predicate:null}};$.update(K)}),()=>{z.destroy(),$.update({source:W,clients:new Set([z]),value:null,predicate:null})}}An(()=>k(l,e.context.table,e.spec.data.field,e.context.filter,b(m),b(d),b(g)));function C(E,T){if(b(h)==null||b(h).length==0)e.onStateChange({selection:[E]});else{let R=b(h).findIndex($=>$==E)>=0;T?R?e.onStateChange({selection:b(h).filter($=>$!=E)}):e.onStateChange({selection:[...b(h),E]}):R?e.onStateChange({selection:void 0}):e.onStateChange({selection:[E]})}}function D(E,T){return T==0?"-%":(E/T*100).toFixed(1)+"%"}function A(E,T,R,$){let Q,B;switch(R??"#/#"){case"#":Q=$?E.countSelected.toLocaleString():E.count.toLocaleString();break;case"%":Q=$?D(E.countSelected,T.sumSelected):D(E.count,T.sumTotal);break;case"#/#":Q=$?E.countSelected.toLocaleString()+" / "+E.count.toLocaleString():E.count.toLocaleString();break;default:Q=""}return b(g)?B=$?[`${E.countSelected.toLocaleString()} / ${E.count.toLocaleString()} (${D(E.countSelected,E.count)})`,`${D(E.countSelected,T.sumSelected)} of selection`,"(Occurrences in the list values)"]:[`${E.count.toLocaleString()}`,`${D(E.count,T.sumTotal)} of all occurrences`,"(Occurrences in the list values)"]:B=$?[`${E.countSelected.toLocaleString()} / ${E.count.toLocaleString()} (${D(E.countSelected,E.count)})`,`${D(E.countSelected,T.sumSelected)} of selection`]:[`${E.count.toLocaleString()}`,`${D(E.count,T.sumTotal)} of all rows`],{label:Q,title:B.join(` `)}}jh(t,{get width(){return e.width},get height(){return e.height},scrollY:!0,children:(E,T)=>{var R=OFe(),$=M(R);{var Q=B=>{const q=L(()=>b(O).items.findIndex(xe=>xe.special!=null));var z=bFe(),ee=ke(z);Ot(ee,17,()=>b(O).items,Wt,(xe,ue,Ee)=>{const Le=L(()=>b(h)==null||b(h).length==0||b(h).findIndex(jt=>jt==b(ue).value)>=0),qe=L(()=>!b(O).items.every(jt=>jt.count==jt.countSelected)),Fe=L(()=>A(b(ue),b(O),b(p),b(qe)));var it=mFe(),St=ke(it);{var Se=jt=>{var jr=pFe();I(jt,jr)};oe(St,jt=>{Ee==b(q)&&jt(Se)})}var gt=V(St,2);gt.__click=jt=>C(b(ue).value,jt.shiftKey);var Kt=M(gt),Rn=M(Kt);let Ri;var Bn=M(Rn,!0);F(Rn),F(Kt);var er=V(Kt,2);{let jt=L(()=>b(Le)?[...b(y)?[{value:b(ue).count,color:b(f).markColorFade}]:[],{value:b(ue).countSelected,color:b(f).markColor}]:[...b(y)?[{value:b(ue).count,color:b(f).markColorGrayFade}]:[],{value:b(ue).countSelected,color:b(f).markColorGray}]),jr=L(()=>b(v)-250);GAe(er,{get selected(){return b(Le)},get bars(){return b(jt)},get maxValue(){return b(w)},get width(){return b(jr)},get label(){return b(Fe).label},get title(){return b(Fe).title}})}F(gt),de(()=>{ne(gt,"title",b(ue).value),Ri=Qt(Rn,1,"",null,Ri,{"text-gray-400":!b(Le),"dark:text-gray-400":!b(Le)}),ut(Bn,b(ue).value)}),I(xe,it)});var W=V(ee,2),K=M(W),H=M(K);{var J=xe=>{var ue=gFe();I(xe,ue)};oe(H,xe=>{b(g)&&xe(J)})}F(K);var Y=V(K,2),Z=M(Y);{var he=xe=>{var ue=yFe();ue.__click=()=>{let Fe=b(d)<50?100:10;e.onSpecChange({limit:Fe}),Fe{var it=hh("↓ Up to 100 values");I(Fe,it)},qe=Fe=>{var it=hh("↑ Up to 10 values");I(Fe,it)};oe(Ee,Fe=>{b(d)<50?Fe(Le):Fe(qe,!1)})}F(ue),I(xe,ue)};oe(Z,xe=>{(b(d)!=10||b(O).items.findIndex(ue=>ue.special=="other")>=0)&&xe(he)})}F(Y);var me=V(Y,2),te=M(me);{var le=xe=>{{let ue=L(()=>b(m)??"total-descending");bw(xe,{options:[{value:"total-descending",label:"↓ Total"},{value:"selected-descending",label:"↓ Selected"},{value:"total-ascending",label:"↑ Total"},{value:"selected-ascending",label:"↑ Selected"},{value:"alphabetical",label:"↓ A-Z"}],get value(){return b(ue)},onChange:Ee=>e.onSpecChange({order:Ee})})}};oe(te,xe=>{typeof b(m)=="string"&&xe(le)})}var ve=V(te,2);{let xe=L(()=>b(p)??"#/#");bw(ve,{options:[{value:"%",label:"%"},{value:"#",label:"#"},{value:"#/#",label:"#/#"}],get value(){return b(xe)},onChange:ue=>e.onSpecChange({labels:ue})})}F(me),F(W),I(B,z)};oe($,B=>{b(O)&&B(Q)})}F(R),fl(R,"clientWidth",B=>X(v,B)),I(E,R)},$$slots:{default:!0}}),Pe(),s()}dn(["click"]);var wFe=G("");function M_(t,e){De(e,!0);let n=Xe(e,"value",15),r=Xe(e,"type",3,"text"),i=Xe(e,"placeholder",3,""),s=Xe(e,"className",3,"");function o(l){l.key=="Escape"?l.stopPropagation():l.key=="Enter"&&e.onEnter?.()}var a=wFe();ox(a),a.__keydown=o,de(()=>{ne(a,"type",r()),ne(a,"placeholder",i()),Qt(a,1,`form-input rounded-md py-1 bg-white dark:bg-slate-900 border border-slate-300 dark:border-slate-600 ${s()??""??""}`)}),qJ(a,n),I(t,a),Pe()}dn(["keydown"]);var xFe=G(" ",1);function _Fe(t,e){De(e,!0);var n=ot(),r=ke(n);{var i=o=>{jh(o,{get width(){return e.width},get height(){return e.height},scrollY:!0,class:"prose dark:prose-invert max-w-none",children:(a,l)=>{var u=ot(),c=ke(u);ix(c,()=>O_(e.spec.content??"")),I(a,u)},$$slots:{default:!0}})},s=o=>{jh(o,{get width(){return e.width},get height(){return e.height},class:"flex flex-col gap-2",children:(a,l)=>{var u=xFe(),c=ke(u),f=()=>e.spec.title??"",h=p=>e.onSpecChange({title:p});M_(c,{get value(){return f()},set value(p){h(p)}});var d=V(c,2);{let p=L(()=>e.height==null?"h-64":"flex-1");Dy(d,{get value(){return e.spec.content},get class(){return b(p)},language:"markdown",onChange:m=>{e.onSpecChange({content:m})}})}I(a,u)},$$slots:{default:!0}})};oe(r,o=>{e.mode=="view"?o(i):o(s,!1)})}I(t,n),Pe()}var SFe=G('
     
    ');function y$(t,e){De(e,!0);var n=SFe(),r=M(n),i=M(r,!0);F(r),F(n),de(s=>ut(i,s),[()=>JSON.stringify(e.spec,null,2)]),I(t,n),Pe()}var kFe=G(' '),CFe=G("");function Nu(t,e){De(e,!0);let n=Xe(e,"label",3,null),r=Xe(e,"icon",3,null),i=Xe(e,"title",3,""),s=Xe(e,"order",3,null);var o=CFe();o.__click=()=>{e.onClick?.()};let a;var l=M(o);{var u=h=>{const d=L(r);var p=ot(),m=ke(p);Bu(m,()=>b(d),(g,y)=>{y(g,{class:"w-5 h-5"})}),I(h,p)};oe(l,h=>{r()!=null&&h(u)})}var c=V(l,2);{var f=h=>{var d=kFe(),p=M(d,!0);F(d),de(()=>ut(p,n())),I(h,d)};oe(c,h=>{n()!=null&&n()!=""&&h(f)})}F(o),de(()=>{Qt(o,1,`rounded-md flex select-none items-center px-1.5 py-1.5 h-[28px] border bg-white dark:bg-slate-900 border-slate-300 dark:border-slate-600 dark:text-slate-400 focus-visible:outline-2 outline-blue-600 -outline-offset-1 ${e.class??""??""}`),ne(o,"title",i()),a=Ve(o,"",a,{order:s()})}),I(t,o),Pe()}dn(["click"]);const AFe=""+new URL("duckdb-browser-mvp.worker-Bc8GfOvd.js",import.meta.url).href,EFe=""+new URL("duckdb-mvp-C5CQ5aRn.wasm",import.meta.url).href,TFe=""+new URL("duckdb-browser-eh.worker-DcYAbAi8.js",import.meta.url).href,DFe=""+new URL("duckdb-eh-CAt5YSMB.wasm",import.meta.url).href;function PFe(){let t=window.location.href;return t=t.replace(/#.*$/,""),t=t.replace(/\/[^/]*$/,"/"),t.endsWith("/")||(t+="/"),t+"duckdb-wasm"}async function RFe({log:t=!1}={}){const n=await AB({mvp:{mainModule:EFe,mainWorker:AFe},eh:{mainModule:DFe,mainWorker:TFe}}),r=new Worker(n.mainWorker),i=t?new SB:new _B,s=new CB(i,r);await s.instantiate(n.mainModule,n.pthreadWorker),await s.open({filesystem:{forceFullHTTPReads:!0}});const o=await s.connect();return await o.query(`SET custom_extension_repository = '${PFe()}';`),{duckdb:s,connection:o}}async function yH(t,e,n=void 0){const r=await RFe();if(e=="wasm"){const i=await aae({duckdb:r.duckdb,connection:r.connection});t.databaseConnector(i)}else if(e=="socket"){const i=await Hte({uri:n??""});t.databaseConnector(i)}else if(e=="rest"){const i=await Jre({uri:n??""});t.databaseConnector(i)}}function L_(t){return t==null?null:t instanceof Array?t.length==0?null:xs(t).toString().trim():typeof t=="string"?t.trim():typeof t=="boolean"?Ae(t).toString():t.toString().trim()}function gC(t,e){return t.replace(/\$([a-zA-Z][a-zA-Z0-9\_]+)/g,(n,r)=>e[r]!=null?e[r]:n)}async function bH(t,e){return Array.from(await t.query(`DESCRIBE ${e}`)).map(r=>({name:r.column_name,type:r.column_type,jsType:G1(r.column_type)}))}async function OH(t,e,n){return(await t.query(`SELECT COUNT(DISTINCT ${ae(n)}) AS count FROM ${e}`)).get(0).count}function G1(t){return IFe.has(t)?"number":FFe.has(t)?"string":t.match(/^(VARCHAR|TEXT)\[\d*\]$/)?"string[]":null}const IFe=new Set(["REAL","FLOAT4","FLOAT8","FLOAT","DOUBLE","INT","TINYINT","INT1","SMALLINT","INT2","SHORT","INTEGER","INT4","INT","SIGNED","INT8","LONG","BIGINT","UTINYINT","USMALLINT","UINTEGER","UBIGINT","UHUGEINT"]),FFe=new Set(["BOOLEAN","DATE","VARCHAR","CHAR","BPCHAR","TEXT","STRING"]);var $Fe=G('
    '),MFe=G('
    SQL Predicate
    '),LFe=G('
    ',1);function NFe(t,e){De(e,!0);const n=()=>hr(s,"$colorScheme",r),[r,i]=Lo();let{colorScheme:s}=e.context,nV3HiddenPredFields=(e.context.hiddenFields??["row_id","text","source_file","source_line","source_group","projection_x","projection_y","num_tool_calls","pass_rate","__collection_source","license","benchmark_task_id","benchmark_query_id","benchmark_row_id","benchmark_accuracy","row_kind","sub_file","row_x","row_y","Collection","collection","Collection_memberships"]).filter(m=>["num_turns","num_tool_calls","has_tools","pass_rate"].indexOf(m)<0),nV3PredicateHasHidden=m=>{let g=String(m?.predicate??m??""),y=String(m?.name??""),O=g.split(/[^A-Za-z0-9_]+/);return nV3HiddenPredFields.some(v=>O.indexOf(v)>=0||y===v||y.indexOf(v)>=0)},o=L(()=>(e.spec.items??[]).filter(m=>!nV3PredicateHasHidden(m))),a=L(()=>(e.state.selection??[]).filter(m=>!nV3PredicateHasHidden(m))),l=pe(!1),u=pe(null),c=pe(""),f=pe("");function h(){X(l,!1),X(u,null),X(f,""),X(c,"")}function d(m){e.onSpecChange({items:m}),e.onStateChange({selection:(e.state.selection??[]).filter(g=>m.find(y=>y.predicate==g)!=null)})}async function p(){let m=b(f).trim();m==""&&(m="Predicate");let g=b(c).trim();if(g=="")return null;try{await e.context.coordinator.query(Be.from(e.context.table).select({count:Cr()}).where(g))}catch(y){return alert(y.toString()),null}return{name:m,predicate:g}}An(()=>{let m=Ph({coordinator:e.context.coordinator,selection:e.context.filter,query:()=>Ze`SELECT 1`}),g={reset:()=>{e.onStateChange({selection:[]})}};return ki(()=>{if(b(a).length==0)e.context.filter.update({source:g,clients:new Set([m]),predicate:null,value:null});else{let y=b(a).map(O=>"("+O+")").join(" OR ");e.context.filter.update({source:g,clients:new Set([m]),predicate:bg(y),value:y})}}),()=>{e.context.filter.update({source:g,clients:new Set([m]),predicate:null,value:null}),m.destroy()}}),jh(t,{get width(){return e.width},get height(){return e.height},scrollY:!0,children:(m,g)=>{var y=LFe(),O=ke(y),v=M(O);Ot(v,17,()=>b(o),Wt,(_,k)=>{const C=L(()=>b(a).indexOf(b(k).predicate)>=0);var D=$Fe();let A;var E=M(D);E.__click=W=>{W.shiftKey?e.onStateChange({selection:b(C)?b(a).filter(K=>K!=b(k).predicate):[...b(a),b(k).predicate]}):b(C)?e.onStateChange({selection:[]}):e.onStateChange({selection:[b(k).predicate]})};var T=M(E),R=M(T,!0);F(T);var $=V(T,2),Q=M($),B=M(Q,!0);F(Q),F($),F(E);var q=V(E,2),z=M(q);Cc(z,{get icon(){return e8},onClick:()=>{X(u,b(k)),X(c,b(k).predicate,!0),X(f,b(k).name,!0),X(l,!0)}});var ee=V(z,2);Cc(ee,{get icon(){return sd},onClick:()=>{d(b(o).filter(W=>W!==b(k)))}}),F(q),F(D),de(()=>{A=Qt(D,1,"flex gap-4 w-full bg-white dark:bg-slate-800 p-2 rounded-md border border-slate-200 dark:border-slate-600 select-none",null,A,{"!bg-blue-100":b(C),"!border-blue-400":b(C),"dark:!bg-blue-800":b(C),"dark:!border-blue-600":b(C)}),ut(R,b(k).name),ne(Q,"title",b(k).predicate),ut(B,b(k).predicate)}),I(_,D)});var w=V(v,2);w.__click=()=>{X(l,!0),X(u,null)},F(O);var x=V(O,2);{var S=_=>{var k=MFe(),C=M(k);M_(C,{placeholder:"predicate name",className:"w-full mb-2",get value(){return b(f)},set value(q){X(f,q,!0)}});var D=V(C,4),A=M(D);{let q=L(()=>({table:e.context.table,columns:[...(e.context.predicateColumns??e.context.columns),...[{name:"num_turns",type:"DOUBLE",jsType:"number"},{name:"num_tool_calls",type:"DOUBLE",jsType:"number"},{name:"has_tools",type:"BOOLEAN",jsType:"string"},{name:"pass_rate",type:"DOUBLE",jsType:"number"}].filter(ee=>!(e.context.predicateColumns??e.context.columns).some(W=>W.name===ee.name))].filter(z=>nV3HiddenPredFields.indexOf(z.name)<0)}));Dy(A,{language:"sql",get sql(){return b(q)},class:"w-full h-full",get colorScheme(){return n()},get value(){return b(c)},onChange:z=>X(c,z,!0)})}F(D);var E=V(D,2),T=M(E);{var R=q=>{Nu(q,{label:"Update",onClick:async()=>{let z=await p();z&&(d(b(o).map(ee=>ee===b(u)?z:ee)),h())}})},$=q=>{Nu(q,{label:"Add",onClick:async()=>{let z=await p();z&&(d([...b(o),z]),h())}})};oe(T,q=>{b(u)!=null?q(R):q($,!1)})}var Q=V(T,2);Nu(Q,{label:"Cancel",onClick:()=>{X(u,null),X(l,!1)}});var B=V(Q,4);B.__click=()=>X(c,L_(e.context.filter.predicate(null))??"",!0),F(E),F(k),I(_,k)};oe(x,_=>{b(l)&&_(S)})}I(m,y)},$$slots:{default:!0}}),Pe(),i()}dn(["click"]);var QFe=G('');function Zs(t,e){De(e,!0);let n=Ht(e,["$$slots","$$events","$$legacy"]),r="form-select rounded-md py-1 bg-white dark:bg-slate-900 border border-slate-300 dark:border-slate-600 dark:text-slate-400 select-none text-ellipsis";var i=ot(),s=ke(i);{var o=l=>{var u=QFe(),c=M(u),f=M(c,!0);F(c);var h=V(c,2);{let d=L(()=>r+" "+(e.class??""));Z4(h,Ch(()=>n,{get class(){return b(d)}}))}F(u),de(()=>ut(f,e.label)),I(l,u)},a=l=>{{let u=L(()=>r+" "+(e.class??""));Z4(l,Ch(()=>n,{get class(){return b(u)}}))}};oe(s,l=>{e.label!=null?l(o):l(a,!1)})}I(t,i),Pe()}function BFe(t,e){if(t.match(/^[a-z]+:\/\//i))return t;if(t.match(/^\/\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;const n=document.implementation.createHTMLDocument(),r=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(i),e&&(r.href=e),i.href=t,i.href}const zFe=(()=>{let t=0;const e=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(t+=1,`u${e()}${t}`)})();function Uc(t){const e=[];for(let n=0,r=t.length;n{const r=new Image;r.onload=()=>{r.decode().then(()=>{requestAnimationFrame(()=>e(r))})},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=t})}async function VFe(t){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(t)).then(encodeURIComponent).then(e=>`data:image/svg+xml;charset=utf-8,${e}`)}async function ZFe(t,e,n){const r="http://www.w3.org/2000/svg",i=document.createElementNS(r,"svg"),s=document.createElementNS(r,"foreignObject");return i.setAttribute("width",`${e}`),i.setAttribute("height",`${n}`),i.setAttribute("viewBox",`0 0 ${e} ${n}`),s.setAttribute("width","100%"),s.setAttribute("height","100%"),s.setAttribute("x","0"),s.setAttribute("y","0"),s.setAttribute("externalResourcesRequired","true"),i.appendChild(s),s.appendChild(t),VFe(i)}const Ss=(t,e)=>{if(t instanceof e)return!0;const n=Object.getPrototypeOf(t);return n===null?!1:n.constructor.name===e.name||Ss(n,e)};function XFe(t){const e=t.getPropertyValue("content");return`${t.cssText} content: '${e.replace(/'|"/g,"")}';`}function WFe(t,e){return vH(e).map(n=>{const r=t.getPropertyValue(n),i=t.getPropertyPriority(n);return`${n}: ${r}${i?" !important":""};`}).join(" ")}function YFe(t,e,n,r){const i=`.${t}:${e}`,s=n.cssText?XFe(n):WFe(n,r);return document.createTextNode(`${i}{${s}}`)}function b$(t,e,n,r){const i=window.getComputedStyle(t,n),s=i.getPropertyValue("content");if(s===""||s==="none")return;const o=zFe();try{e.className=`${e.className} ${o}`}catch{return}const a=document.createElement("style");a.appendChild(YFe(o,n,i,r)),e.appendChild(a)}function GFe(t,e,n){b$(t,e,":before",n),b$(t,e,":after",n)}const O$="application/font-woff",v$="image/jpeg",HFe={woff:O$,woff2:O$,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:v$,jpeg:v$,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function KFe(t){const e=/\.([^./]*?)$/g.exec(t);return e?e[1]:""}function uT(t){const e=KFe(t).toLowerCase();return HFe[e]||""}function JFe(t){return t.split(/,/)[1]}function bC(t){return t.search(/^(data:)/)!==-1}function e$e(t,e){return`data:${e};base64,${t}`}async function wH(t,e,n){const r=await fetch(t,e);if(r.status===404)throw new Error(`Resource "${r.url}" not found`);const i=await r.blob();return new Promise((s,o)=>{const a=new FileReader;a.onerror=o,a.onloadend=()=>{try{s(n({res:r,result:a.result}))}catch(l){o(l)}},a.readAsDataURL(i)})}const fk={};function t$e(t,e,n){let r=t.replace(/\?.*/,"");return n&&(r=t),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\//,"")),e?`[${e}]${r}`:r}async function cT(t,e,n){const r=t$e(t,e,n.includeQueryParams);if(fk[r]!=null)return fk[r];n.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+new Date().getTime());let i;try{const s=await wH(t,n.fetchRequestInit,({res:o,result:a})=>(e||(e=o.headers.get("Content-Type")||""),JFe(a)));i=e$e(s,e)}catch(s){i=n.imagePlaceholder||"";let o=`Failed to fetch resource: ${t}`;s&&(o=typeof s=="string"?s:s.message),o&&console.warn(o)}return fk[r]=i,i}async function n$e(t){const e=t.toDataURL();return e==="data:,"?t.cloneNode(!1):yC(e)}async function r$e(t,e){if(t.currentSrc){const s=document.createElement("canvas"),o=s.getContext("2d");s.width=t.clientWidth,s.height=t.clientHeight,o?.drawImage(t,0,0,s.width,s.height);const a=s.toDataURL();return yC(a)}const n=t.poster,r=uT(n),i=await cT(n,r,e);return yC(i)}async function i$e(t,e){var n;try{if(!((n=t?.contentDocument)===null||n===void 0)&&n.body)return await N_(t.contentDocument.body,e,!0)}catch{}return t.cloneNode(!1)}async function s$e(t,e){return Ss(t,HTMLCanvasElement)?n$e(t):Ss(t,HTMLVideoElement)?r$e(t,e):Ss(t,HTMLIFrameElement)?i$e(t,e):t.cloneNode(xH(t))}const o$e=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SLOT",xH=t=>t.tagName!=null&&t.tagName.toUpperCase()==="SVG";async function a$e(t,e,n){var r,i;if(xH(e))return e;let s=[];return o$e(t)&&t.assignedNodes?s=Uc(t.assignedNodes()):Ss(t,HTMLIFrameElement)&&(!((r=t.contentDocument)===null||r===void 0)&&r.body)?s=Uc(t.contentDocument.body.childNodes):s=Uc(((i=t.shadowRoot)!==null&&i!==void 0?i:t).childNodes),s.length===0||Ss(t,HTMLVideoElement)||await s.reduce((o,a)=>o.then(()=>N_(a,n)).then(l=>{l&&e.appendChild(l)}),Promise.resolve()),e}function l$e(t,e,n){const r=e.style;if(!r)return;const i=window.getComputedStyle(t);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):vH(n).forEach(s=>{let o=i.getPropertyValue(s);s==="font-size"&&o.endsWith("px")&&(o=`${Math.floor(parseFloat(o.substring(0,o.length-2)))-.1}px`),Ss(t,HTMLIFrameElement)&&s==="display"&&o==="inline"&&(o="block"),s==="d"&&e.getAttribute("d")&&(o=`path(${e.getAttribute("d")})`),r.setProperty(s,o,i.getPropertyPriority(s))})}function u$e(t,e){Ss(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),Ss(t,HTMLInputElement)&&e.setAttribute("value",t.value)}function c$e(t,e){if(Ss(t,HTMLSelectElement)){const r=Array.from(e.children).find(i=>t.value===i.getAttribute("value"));r&&r.setAttribute("selected","")}}function f$e(t,e,n){return Ss(e,Element)&&(l$e(t,e,n),GFe(t,e,n),u$e(t,e),c$e(t,e)),e}async function h$e(t,e){const n=t.querySelectorAll?t.querySelectorAll("use"):[];if(n.length===0)return t;const r={};for(let s=0;ss$e(r,e)).then(r=>a$e(t,r,e)).then(r=>f$e(t,r,e)).then(r=>h$e(r,e))}const _H=/url\((['"]?)([^'"]+?)\1\)/g,d$e=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,p$e=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function m$e(t){const e=t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${e})(['"]?\\))`,"g")}function g$e(t){const e=[];return t.replace(_H,(n,r,i)=>(e.push(i),n)),e.filter(n=>!bC(n))}async function y$e(t,e,n,r,i){try{const s=n?BFe(e,n):e,o=uT(e);let a;return i||(a=await cT(s,o,r)),t.replace(m$e(e),`$1${a}$3`)}catch{}return t}function b$e(t,{preferredFontFormat:e}){return e?t.replace(p$e,n=>{for(;;){const[r,,i]=d$e.exec(n)||[];if(!i)return"";if(i===e)return`src: ${r};`}}):t}function SH(t){return t.search(_H)!==-1}async function kH(t,e,n){if(!SH(t))return t;const r=b$e(t,n);return g$e(r).reduce((s,o)=>s.then(a=>y$e(a,o,e,n)),Promise.resolve(r))}async function Td(t,e,n){var r;const i=(r=e.style)===null||r===void 0?void 0:r.getPropertyValue(t);if(i){const s=await kH(i,null,n);return e.style.setProperty(t,s,e.style.getPropertyPriority(t)),!0}return!1}async function O$e(t,e){await Td("background",t,e)||await Td("background-image",t,e),await Td("mask",t,e)||await Td("-webkit-mask",t,e)||await Td("mask-image",t,e)||await Td("-webkit-mask-image",t,e)}async function v$e(t,e){const n=Ss(t,HTMLImageElement);if(!(n&&!bC(t.src))&&!(Ss(t,SVGImageElement)&&!bC(t.href.baseVal)))return;const r=n?t.src:t.href.baseVal,i=await cT(r,uT(r),e);await new Promise((s,o)=>{t.onload=s,t.onerror=e.onImageErrorHandler?(...l)=>{try{s(e.onImageErrorHandler(...l))}catch(u){o(u)}}:o;const a=t;a.decode&&(a.decode=s),a.loading==="lazy"&&(a.loading="eager"),n?(t.srcset="",t.src=i):t.href.baseVal=i})}async function w$e(t,e){const r=Uc(t.childNodes).map(i=>CH(i,e));await Promise.all(r).then(()=>t)}async function CH(t,e){Ss(t,Element)&&(await O$e(t,e),await v$e(t,e),await w$e(t,e))}function x$e(t,e){const{style:n}=t;e.backgroundColor&&(n.backgroundColor=e.backgroundColor),e.width&&(n.width=`${e.width}px`),e.height&&(n.height=`${e.height}px`);const r=e.style;return r!=null&&Object.keys(r).forEach(i=>{n[i]=r[i]}),t}const w$={};async function x$(t){let e=w$[t];if(e!=null)return e;const r=await(await fetch(t)).text();return e={url:t,cssText:r},w$[t]=e,e}async function _$(t,e){let n=t.cssText;const r=/url\(["']?([^"')]+)["']?\)/g,s=(n.match(/url\([^)]+\)/g)||[]).map(async o=>{let a=o.replace(r,"$1");return a.startsWith("https://")||(a=new URL(a,t.url).href),wH(a,e.fetchRequestInit,({result:l})=>(n=n.replace(o,`url(${l})`),[o,l]))});return Promise.all(s).then(()=>n)}function S$(t){if(t==null)return[];const e=[],n=/(\/\*[\s\S]*?\*\/)/gi;let r=t.replace(n,"");const i=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const l=i.exec(r);if(l===null)break;e.push(l[0])}r=r.replace(i,"");const s=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,o="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",a=new RegExp(o,"gi");for(;;){let l=s.exec(r);if(l===null){if(l=a.exec(r),l===null)break;s.lastIndex=a.lastIndex}else a.lastIndex=s.lastIndex;e.push(l[0])}return e}async function _$e(t,e){const n=[],r=[];return t.forEach(i=>{if("cssRules"in i)try{Uc(i.cssRules||[]).forEach((s,o)=>{if(s.type===CSSRule.IMPORT_RULE){let a=o+1;const l=s.href,u=x$(l).then(c=>_$(c,e)).then(c=>S$(c).forEach(f=>{try{i.insertRule(f,f.startsWith("@import")?a+=1:i.cssRules.length)}catch(h){console.error("Error inserting rule from remote css",{rule:f,error:h})}})).catch(c=>{console.error("Error loading remote css",c.toString())});r.push(u)}})}catch(s){const o=t.find(a=>a.href==null)||document.styleSheets[0];i.href!=null&&r.push(x$(i.href).then(a=>_$(a,e)).then(a=>S$(a).forEach(l=>{o.insertRule(l,o.cssRules.length)})).catch(a=>{console.error("Error loading remote stylesheet",a)})),console.error("Error inlining remote css file",s)}}),Promise.all(r).then(()=>(t.forEach(i=>{if("cssRules"in i)try{Uc(i.cssRules||[]).forEach(s=>{n.push(s)})}catch(s){console.error(`Error while reading CSS rules from ${i.href}`,s)}}),n))}function S$e(t){return t.filter(e=>e.type===CSSRule.FONT_FACE_RULE).filter(e=>SH(e.style.getPropertyValue("src")))}async function k$e(t,e){if(t.ownerDocument==null)throw new Error("Provided element is not within a Document");const n=Uc(t.ownerDocument.styleSheets),r=await _$e(n,e);return S$e(r)}function AH(t){return t.trim().replace(/["']/g,"")}function C$e(t){const e=new Set;function n(r){(r.style.fontFamily||getComputedStyle(r).fontFamily).split(",").forEach(s=>{e.add(AH(s))}),Array.from(r.children).forEach(s=>{s instanceof HTMLElement&&n(s)})}return n(t),e}async function A$e(t,e){const n=await k$e(t,e),r=C$e(t);return(await Promise.all(n.filter(s=>r.has(AH(s.style.fontFamily))).map(s=>{const o=s.parentStyleSheet?s.parentStyleSheet.href:null;return kH(s.cssText,o,e)}))).join(` `)}async function E$e(t,e){const n=e.fontEmbedCSS!=null?e.fontEmbedCSS:e.skipFonts?null:await A$e(t,e);if(n){const r=document.createElement("style"),i=document.createTextNode(n);r.appendChild(i),t.firstChild?t.insertBefore(r,t.firstChild):t.appendChild(r)}}async function T$e(t,e={}){const{width:n,height:r}=qFe(t,e),i=await N_(t,e,!0);return await E$e(i,e),await CH(i,e),x$e(i,e),await ZFe(i,n,r)}async function EH(t,e={}){let n=e.maxWidth??16384,r=e.maxHeight??16384,i=e.pixelRatio??1,s=P$e(t),o=await T$e(t,{pixelRatio:i});if(s){let c=await(await fetch(o)).text();c=s(c),o="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(c)}let a=await D$e(o),l=document.createElement("canvas");if(l.width=a.width*i,l.height=a.height*i,l.width>n||l.height>r){let c=n/l.width,f=r/l.height,h=Math.min(c,f);l.width=Math.floor(l.width*h),l.height=Math.floor(l.height*h)}let u=l.getContext("2d");return u&&(e.backgroundColor!=null&&(u.fillStyle=e.backgroundColor,u.fillRect(0,0,l.width,l.height)),u.imageSmoothingEnabled=!0,u.imageSmoothingQuality="high",u.drawImage(a,0,0,l.width,l.height)),l.toDataURL("image/png")}function D$e(t){return new Promise((e,n)=>{let r=new Image;r.onload=()=>{r.decode().then(()=>{requestAnimationFrame(()=>e(r))})},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=t})}function P$e(t){let e=t.querySelectorAll("svg foreignObject > canvas"),n=new Map,r=0;for(let i of e){let s=`canvas_${Math.random().toString(36).substring(2,11)}_${r}`;n.set(s,i),i.setAttribute("data-screenshot-temp",s),r+=1}if(n.size!=0)return i=>{for(let[s,o]of n.entries()){let a=i.indexOf(s);if(a>=0){let l=i.lastIndexOf("",a)+16,c=o.parentElement,f=c.getAttribute("x"),h=c.getAttribute("y"),d=c.getAttribute("width"),p=c.getAttribute("height"),m=``;i=i.substring(0,l)+m+i.substring(u)}}return i}}var R$e=G(""),I$e=G("
    ");function TH(t,e){De(e,!0);let n=Ht(e,["$$slots","$$events","$$legacy"]),r=L(()=>lQe(e.spec)),i=pe(100),s=pe(100),o;function a(f,h){console.trace("Error happened in chart with spec",h.spec,h.error)}ki(()=>e.registerDelegate?.({screenshot:async f=>{let h=nL(e.context.colorScheme);return await EH(o,{...f,backgroundColor:h=="dark"?"#000000":"#ffffff"})}}));var l=I$e();let u;var c=M(l);gM(c,{failed:(h,d=Cn,p=Cn)=>{var m=R$e();m.__click=function(...g){p()?.apply(this,g)},Zn(m,(g,y)=>a?.(g,y),()=>({spec:e.spec,error:d()})),I(h,m)}},h=>{var d=ot(),p=ke(d);{let m=L(()=>e.width=="container"?b(i):e.width),g=L(()=>e.height=="container"?b(s):e.height);Bu(p,()=>b(r),(y,O)=>{O(y,Ch(()=>n,{get width(){return b(m)},get height(){return b(g)}}))})}I(h,d)}),F(l),lr(l,f=>o=f,()=>o),de(()=>u=Ve(l,"",u,{width:e.width=="container"?"100%":e.width!=null?`${e.width}px`:"fit-content",height:e.height=="container"?"100%":e.height!=null?`${e.height}px`:"fit-content"})),fl(l,"clientWidth",f=>X(i,f)),fl(l,"clientHeight",f=>X(s,f)),I(t,l),Pe()}dn(["click"]);const F$e=` `,$$e=` `,M$e=` `,L$e=` `,N$e=` `,Q$e=` `,B$e=` `,z$e=` `,U$e=` `,j$e=` `,q$e=` `,V$e=` `,Z$e=` `,X$e=` `,W$e=` `,Y$e={"chart-boxplot":F$e,"chart-bubble":$$e,"chart-cards":M$e,"chart-content-viewer":L$e,"chart-ecdf":N$e,"chart-embedding":Q$e,"chart-h-bar":B$e,"chart-heatmap":z$e,"chart-line":U$e,"chart-markdown":j$e,"chart-predicates":q$e,"chart-spec":V$e,"chart-stacked":Z$e,"chart-table":X$e,"chart-v-histogram":W$e};var G$e=G('
    ');function H$e(t,e){De(e,!0);function n(s,o){s=s.replace("xmlns",'style="width:100%;height:100%" xmlns');let a=o=="dark"?{black:uu.slate[400]}:{black:uu.slate[500]};for(let l in a)s=s.replaceAll(l,a[l]);return s}var r=G$e(),i=M(r);ix(i,()=>n(Y$e[e.type]??"",e.colorScheme??"light")),F(r),I(t,r),Pe()}var K$e=G(""),J$e=G('
    '),eMe=G('
    '),tMe=G('
    '),nMe=G('
    '),rMe=G(" ",1),iMe=G('
    '),sMe=G("
    "),oMe=G('
    ',1);function aMe(t,e){De(e,!0);const n=()=>hr(o,"$colorScheme",r),[r,i]=Lo();let{columns:s,colorScheme:o}=e.context;s=s.filter(y=>["row_id","text","source_file","source_line","source_group","projection_x","projection_y","__collection_source","license","benchmark_task_id","benchmark_query_id","benchmark_row_id","benchmark_accuracy","row_kind","sub_file"].indexOf(y.name)<0);let a=uQe(),l=pe(a[0]),u=pe(vc({})),c=pe(!1),f=pe(null),h=pe(null);An(()=>{b(l);let y=Br(()=>b(u)),O={};for(let v of b(l).ui)if("field"in v){let w=g(s,v.field.types),x=y[v.field.key];x!=null&&w.findIndex(({name:S})=>S==x)>=0&&(O[v.field.key]=x)}X(u,O,!0)}),An(()=>{try{let y=p();if(y==null){X(c,!1),X(h,null),X(f,null);return}let O=b(l).create(y,{table:e.context.table,id:e.context.id});X(c,O!=null),X(h,O),X(f,null)}catch(y){X(c,y.toString(),!0)}});function d(){b(h)!=null&&(e.onSpecChange(b(h),"replace"),e.onStateChange(b(f)??{},"replace"))}function p(){let y={...b(u)};for(let O of b(l).ui)if("field"in O){let v=m(y[O.field.key]);if(O.field.required&&v==null)return;y[O.field.key]=v}return y}function m(y){let O=s.find(v=>v.name==y);if(O==null)return null;switch(O.jsType){case"number":return{name:O.name,type:"continuous"};case"string":return{name:O.name,type:"discrete"};case"string[]":return{name:O.name,type:"discrete[]"};default:return{name:O.name,type:"unknown"}}}function g(y,O){return O==null?y:y.filter(v=>v.jsType!=null&&O.indexOf(v.jsType)>=0)}jh(t,{get width(){return e.width},get height(){return e.height},scrollY:!0,class:"flex flex-col gap-2",children:(y,O)=>{var v=oMe(),w=ke(v);Ot(w,21,()=>a,Wt,(R,$)=>{const Q=L(()=>b(l)==b($));var B=K$e();B.__click=()=>{X(l,b($))};let q;var z=M(B);H$e(z,{get type(){return b($).icon},get colorScheme(){return n()}}),F(B),de(()=>{ne(B,"title",b($).description),q=Qt(B,1,"rounded-md border border-slate-200 dark:border-slate-700",null,q,{"!border-slate-600":b(Q),"dark:!border-slate-400":b(Q),"!bg-slate-100":b(Q),"dark:!bg-slate-700":b(Q)})}),I(R,B)}),F(w);var x=V(w,2),S=M(x,!0);F(x);var _=V(x,2);Ot(_,17,()=>b(l).ui,Wt,(R,$)=>{var Q=rMe(),B=ke(Q);{var q=he=>{var me=J$e(),te=M(me,!0);F(me),de(()=>ut(te,b($).label)),I(he,me)};oe(B,he=>{"label"in b($)&&he(q)})}var z=V(B,2);{var ee=he=>{var me=eMe(),te=M(me,!0);F(me),de(()=>ut(te,b($).details)),I(he,me)};oe(z,he=>{"details"in b($)&&he(ee)})}var W=V(z,2);{var K=he=>{const me=L(()=>b($).field.key),te=L(()=>(b($).field.required?[]:[{value:void 0,label:"--"}]).concat(g(s,b($).field.types).map(le=>({value:le.name,label:`${le.name} (${le.type})`}))));Zs(he,{get value(){return b(u)[b(me)]},onChange:le=>b(u)[b(me)]=le,placeholder:"(select field)",class:"w-full",get options(){return b(te)}})};oe(W,he=>{"field"in b($)&&he(K)})}var H=V(W,2);{var J=he=>{const me=L(()=>b($).code.key);var te=tMe(),le=M(te);{let ve=L(()=>b($).code.language??"plain");Dy(le,{class:"w-full h-full",get value(){return b(u)[b(me)]},onChange:xe=>b(u)[b(me)]=xe,get colorScheme(){return n()},get language(){return b(ve)}})}F(te),I(he,te)};oe(H,he=>{"code"in b($)&&he(J)})}var Y=V(H,2);{var Z=he=>{const me=L(()=>b($).spec.key);var te=nMe(),le=M(te);KE(le,{class:"w-full h-full",initialValue:{title:"Chart"},onChange:ve=>b(u)[b(me)]=ve,get colorScheme(){return n()}}),F(te),I(he,te)};oe(Y,he=>{"spec"in b($)&&he(Z)})}I(R,Q)});var k=V(_,2);{var C=R=>{var $=ot(),Q=ke($);bv(Q,()=>b(h),B=>{var q=iMe(),z=M(q),ee=M(z);{let W=L(()=>b(f)??{});TH(ee,{get context(){return e.context},get spec(){return b(h)},get state(){return b(W)},width:"container",mode:"view",onStateChange:(K,H="merge")=>{qp(b(f)??{},K,H,J=>X(f,J))},onSpecChange:(K,H="merge")=>{qp(b(h)??{},K,H,J=>X(h,J))}})}F(z),F(q),I(B,q)}),I(R,$)};oe(k,R=>{b(h)!=null&&b(l).preview!==!1&&R(C)})}var D=V(k,2),A=M(D);{let R=L(()=>b(c)!==!0);lA(A,{label:"Confirm",get disabled(){return b(R)},onClick:d})}F(D);var E=V(D,2);{var T=R=>{var $=sMe(),Q=M($,!0);F($),de(()=>ut(Q,b(c))),I(R,$)};oe(E,R=>{typeof b(c)=="string"&&b(c).trim()!=""&&R(T)})}de(()=>ut(S,b(l).description)),I(y,v)},$$slots:{default:!0}}),Pe(),i()}dn(["click"]);var lMe=ft(''),uMe=ft(''),nV3SemanticCircle=ft(""),nV3BenchmarkCircle=ft(""),cMe=ft("");function fMe(t,e){De(e,!0);var n=cMe(),r=M(n),i=M(r);{var s=a=>{const l=L(()=>e.proxy.location(e.center.x,e.center.y));var u=ot(),c=ke(u);Ot(c,17,()=>e.points??[],Wt,(f,h)=>{const d=L(()=>e.proxy.location(b(h).x,b(h).y));var p=lMe();de(()=>{ne(p,"x1",b(l).x),ne(p,"y1",b(l).y),ne(p,"x2",b(d).x),ne(p,"y2",b(d).y)}),I(f,p)}),I(a,u)};oe(i,a=>{e.center!=null&&a(s)})}var o=V(i);Ot(o,17,()=>e.semanticPoints??[],Wt,(a,l)=>{const u=L(()=>e.proxy.location(b(l).x,b(l).y));var c=nV3SemanticCircle();ne(c,"r",5);let f;de(()=>{ne(c,"cx",b(u).x),ne(c,"cy",b(u).y),f=Xt(c,"",f,{fill:"#76b900",stroke:"#fff","stroke-width":2,"fill-opacity":.9})}),I(a,c)});var nV3BenchmarkAnchor=V(o);Ot(nV3BenchmarkAnchor,17,()=>e.benchmarkPoints??[],Wt,(a,l)=>{const u=L(()=>e.proxy.location(b(l).x,b(l).y)),c=L(()=>b(l).accuracy===1?"#15803d":"#b91c1c");var f=nV3BenchmarkCircle();ne(f,"r",4);let h;de(()=>{ne(f,"cx",b(u).x),ne(f,"cy",b(u).y),h=Xt(f,"",h,{fill:b(c),stroke:"#fff","stroke-width":1.5,"fill-opacity":.86})}),I(a,f)});var nV3NeighborAnchor=V(nV3BenchmarkAnchor);Ot(nV3NeighborAnchor,17,()=>e.points??[],Wt,(a,l)=>{const u=L(()=>e.proxy.location(b(l).x,b(l).y));var c=uMe();ne(c,"r",4),de(()=>{ne(c,"cx",b(u).x),ne(c,"cy",b(u).y)}),I(a,c)}),F(r),F(n),de(()=>{ne(n,"width",e.proxy.width),ne(n,"height",e.proxy.height)}),I(t,n),Pe()}var hMe=G('
    '),dMe=G('
    '),pMe=G('
    ');function fT(t,e){De(e,!0);function n(u,c){if(u==="Collections")return"full";if(u==="emb"||u==="true_rows"||u==="True_rows")return"hidden";let f=c[u]?.display;return f??(u.startsWith("__")?"hidden":"full")}let r=L(()=>e.columns??Object.keys(e.values)),i=L(()=>b(r).filter(u=>n(u,e.columnStyles)=="full")),s=L(()=>b(r).filter(u=>n(u,e.columnStyles)=="badge"));var o=pMe(),a=M(o);Ot(a,17,()=>b(i),Wt,(u,c)=>{const f=L(()=>e.values[b(c)]);var h=hMe(),d=M(h),p=M(d,!0);F(d);var m=V(d,2),g=M(m);yw(g,{get value(){return b(f)},get style(){return e.columnStyles[b(c)]}}),F(m),F(h),de(()=>ut(p,b(c))),I(u,h)});var l=V(a,2);Ot(l,21,()=>b(s),Wt,(u,c)=>{const f=L(()=>e.values[b(c)]);var h=dMe(),d=M(h),p=M(d,!0);F(d);var m=V(d,2),g=M(m);yw(g,{get value(){return b(f)}}),F(m),F(h),de(y=>{ut(p,b(c)),ne(m,"title",y)},[()=>C8(b(f))]),I(u,h)}),F(l),F(o),I(t,o),Pe()}var mMe=G('
    '),gMe=G('
    ');function yMe(t,e){De(e,!0);var n=gMe(),r=M(n);let i;Ve(r,"",{},{"max-width":"560px","max-height":"360px"});var s=M(r);{let l=L(()=>e.tooltip.text==null?e.tooltip.fields??{}:{text:e.tooltip.text,...(e.tooltip.fields??{})}),u=L(()=>e.columnStyles??{});fT(s,{get values(){return b(l)},get columnStyles(){return b(u)}})}var o=V(s,2);{var a=l=>{var u=mMe(),c=M(u);c.__click=()=>{e.onNearestNeighborSearch?.(e.tooltip.identifier)};var f=M(c);Cke(f,{}),ws(),F(c),F(u),I(l,u)};oe(o,l=>{e.onNearestNeighborSearch&&l(a)})}F(r),F(n),de(()=>i=Qt(r,1,"p-2 border flex flex-col gap-2 border-slate-300 dark:border-slate-600 shadow-md text-slate-700 dark:text-slate-300 rounded-md text-ellipsis overflow-x-hidden overflow-y-scroll bg-white/75 dark:bg-slate-800/75 backdrop-blur-sm",null,i,{dark:e.colorScheme=="dark"})),I(t,n),Pe()}dn(["click"]);function DH(t){return class{component;constructor(e,n){this.component=rL({component:t,target:e,props:n})}update(e){this.component.$set(e)}destroy(){this.component.$destroy()}}}var bMe=G("
    ");function OMe(t,e){De(e,!0);let n=Ht(e,["$$slots","$$events","$$legacy"]),r;Ah(()=>{let s=new kDe(r,n);ki(()=>{s.update(n)}),UC(()=>{s.destroy()})});var i=bMe();Ve(i,"",{},{display:"flex"}),lr(i,s=>r=s,()=>r),I(t,i),Pe()}function PH(t){const e=t-1;return e*e*e+1}var vMe=G(' '),wMe=G("");function av(t,e){De(e,!0);let n=Xe(e,"title",3,""),r=Xe(e,"checked",15),i=Xe(e,"label",3,null),s=Xe(e,"icon",3,null);var o=wMe();let a;o.__click=()=>{r(!r())};var l=M(o);{var u=h=>{const d=L(s);var p=ot(),m=ke(p);Bu(m,()=>b(d),(g,y)=>{y(g,{class:"w-5 h-5"})}),I(h,p)};oe(l,h=>{s()!=null&&h(u)})}var c=V(l,2);{var f=h=>{var d=vMe(),p=M(d,!0);F(d),de(()=>ut(p,i())),I(h,d)};oe(c,h=>{i()!=null&&h(f)})}F(o),de(()=>{a=Qt(o,1,"rounded-md px-1.5 py-1.5 bg-white dark:bg-slate-900 border border-slate-300 dark:border-slate-600 flex select-none items-center focus-visible:outline-2 outline-blue-600 -outline-offset-1",null,a,{"text-slate-400":!r(),"dark:text-slate-500":!r()}),ne(o,"title",n())}),I(t,o),Pe()}dn(["click"]);const Qw=Math.min,xh=Math.max,Bw=Math.round,iO=Math.floor,Ol=t=>({x:t,y:t});function k$(t,e,n){return xh(t,Qw(e,n))}function hT(t,e){return typeof t=="function"?t(e):t}function Q_(t){return t.split("-")[0]}function RH(t){return t.split("-")[1]}function IH(t){return t==="x"?"y":"x"}function xMe(t){return t==="y"?"height":"width"}const _Me=new Set(["top","bottom"]);function B_(t){return _Me.has(Q_(t))?"y":"x"}function SMe(t){return IH(B_(t))}function kMe(t){return{top:0,right:0,bottom:0,left:0,...t}}function CMe(t){return typeof t!="number"?kMe(t):{top:t,right:t,bottom:t,left:t}}function zw(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function C$(t,e,n){let{reference:r,floating:i}=t;const s=B_(e),o=SMe(e),a=xMe(o),l=Q_(e),u=s==="y",c=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2;let d;switch(l){case"top":d={x:c,y:r.y-i.height};break;case"bottom":d={x:c,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:f};break;case"left":d={x:r.x-i.width,y:f};break;default:d={x:r.x,y:r.y}}switch(RH(e)){case"start":d[o]-=h*(n&&u?-1:1);break;case"end":d[o]+=h*(n&&u?-1:1);break}return d}const AMe=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=s.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let u=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:c,y:f}=C$(u,r,l),h=r,d={},p=0;for(let m=0;m{let{x:y,y:O}=g;return{x:y,y:O}}},...l}=hT(t,e),u={x:n,y:r},c=await EMe(e,l),f=B_(Q_(i)),h=IH(f);let d=u[h],p=u[f];if(s){const g=h==="y"?"top":"left",y=h==="y"?"bottom":"right",O=d+c[g],v=d-c[y];d=k$(O,d,v)}if(o){const g=f==="y"?"top":"left",y=f==="y"?"bottom":"right",O=p+c[g],v=p-c[y];p=k$(O,p,v)}const m=a.fn({...e,[h]:d,[f]:p});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[h]:s,[f]:o}}}}}};function z_(){return typeof window<"u"}function um(t){return FH(t)?(t.nodeName||"").toLowerCase():"#document"}function eo(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Vl(t){var e;return(e=(FH(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function FH(t){return z_()?t instanceof Node||t instanceof eo(t).Node:!1}function pa(t){return z_()?t instanceof Element||t instanceof eo(t).Element:!1}function Rl(t){return z_()?t instanceof HTMLElement||t instanceof eo(t).HTMLElement:!1}function A$(t){return!z_()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof eo(t).ShadowRoot}const IMe=new Set(["inline","contents"]);function By(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=ma(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!IMe.has(i)}const FMe=new Set(["table","td","th"]);function $Me(t){return FMe.has(um(t))}const MMe=[":popover-open",":modal"];function U_(t){return MMe.some(e=>{try{return t.matches(e)}catch{return!1}})}const LMe=["transform","translate","scale","rotate","perspective"],NMe=["transform","translate","scale","rotate","perspective","filter"],QMe=["paint","layout","strict","content"];function dT(t){const e=pT(),n=pa(t)?ma(t):t;return LMe.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||NMe.some(r=>(n.willChange||"").includes(r))||QMe.some(r=>(n.contain||"").includes(r))}function BMe(t){let e=cf(t);for(;Rl(e)&&!D0(e);){if(dT(e))return e;if(U_(e))return null;e=cf(e)}return null}function pT(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const zMe=new Set(["html","body","#document"]);function D0(t){return zMe.has(um(t))}function ma(t){return eo(t).getComputedStyle(t)}function j_(t){return pa(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function cf(t){if(um(t)==="html")return t;const e=t.assignedSlot||t.parentNode||A$(t)&&t.host||Vl(t);return A$(e)?e.host:e}function $H(t){const e=cf(t);return D0(e)?t.ownerDocument?t.ownerDocument.body:t.body:Rl(e)&&By(e)?e:$H(e)}function H1(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=$H(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),o=eo(i);if(s){const a=OC(o);return e.concat(o,o.visualViewport||[],By(i)?i:[],a&&n?H1(a):[])}return e.concat(i,H1(i,[],n))}function OC(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function MH(t){const e=ma(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Rl(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,a=Bw(n)!==s||Bw(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function mT(t){return pa(t)?t:t.contextElement}function Np(t){const e=mT(t);if(!Rl(e))return Ol(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=MH(e);let o=(s?Bw(n.width):n.width)/r,a=(s?Bw(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const UMe=Ol(0);function LH(t){const e=eo(t);return!pT()||!e.visualViewport?UMe:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function jMe(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==eo(t)?!1:e}function Yh(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=mT(t);let o=Ol(1);e&&(r?pa(r)&&(o=Np(r)):o=Np(t));const a=jMe(s,n,r)?LH(s):Ol(0);let l=(i.left+a.x)/o.x,u=(i.top+a.y)/o.y,c=i.width/o.x,f=i.height/o.y;if(s){const h=eo(s),d=r&&pa(r)?eo(r):r;let p=h,m=OC(p);for(;m&&r&&d!==p;){const g=Np(m),y=m.getBoundingClientRect(),O=ma(m),v=y.left+(m.clientLeft+parseFloat(O.paddingLeft))*g.x,w=y.top+(m.clientTop+parseFloat(O.paddingTop))*g.y;l*=g.x,u*=g.y,c*=g.x,f*=g.y,l+=v,u+=w,p=eo(m),m=OC(p)}}return zw({width:c,height:f,x:l,y:u})}function q_(t,e){const n=j_(t).scrollLeft;return e?e.left+n:Yh(Vl(t)).left+n}function NH(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-q_(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function qMe(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=Vl(r),a=e?U_(e.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},u=Ol(1);const c=Ol(0),f=Rl(r);if((f||!f&&!s)&&((um(r)!=="body"||By(o))&&(l=j_(r)),Rl(r))){const d=Yh(r);u=Np(r),c.x=d.x+r.clientLeft,c.y=d.y+r.clientTop}const h=o&&!f&&!s?NH(o,l):Ol(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+c.x+h.x,y:n.y*u.y-l.scrollTop*u.y+c.y+h.y}}function VMe(t){return Array.from(t.getClientRects())}function ZMe(t){const e=Vl(t),n=j_(t),r=t.ownerDocument.body,i=xh(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=xh(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+q_(t);const a=-n.scrollTop;return ma(r).direction==="rtl"&&(o+=xh(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}const E$=25;function XMe(t,e){const n=eo(t),r=Vl(t),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const c=pT();(!c||c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const u=q_(r);if(u<=0){const c=r.ownerDocument,f=c.body,h=getComputedStyle(f),d=c.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,p=Math.abs(r.clientWidth-f.clientWidth-d);p<=E$&&(s-=p)}else u<=E$&&(s+=u);return{width:s,height:o,x:a,y:l}}const WMe=new Set(["absolute","fixed"]);function YMe(t,e){const n=Yh(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=Rl(t)?Np(t):Ol(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y,l=i*s.x,u=r*s.y;return{width:o,height:a,x:l,y:u}}function T$(t,e,n){let r;if(e==="viewport")r=XMe(t,n);else if(e==="document")r=ZMe(Vl(t));else if(pa(e))r=YMe(e,n);else{const i=LH(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return zw(r)}function QH(t,e){const n=cf(t);return n===e||!pa(n)||D0(n)?!1:ma(n).position==="fixed"||QH(n,e)}function GMe(t,e){const n=e.get(t);if(n)return n;let r=H1(t,[],!1).filter(a=>pa(a)&&um(a)!=="body"),i=null;const s=ma(t).position==="fixed";let o=s?cf(t):t;for(;pa(o)&&!D0(o);){const a=ma(o),l=dT(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&WMe.has(i.position)||By(o)&&!l&&QH(t,o))?r=r.filter(c=>c!==o):i=a,o=cf(o)}return e.set(t,r),r}function HMe(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?U_(e)?[]:GMe(e,this._c):[].concat(n),r],a=o[0],l=o.reduce((u,c)=>{const f=T$(e,c,i);return u.top=xh(f.top,u.top),u.right=Qw(f.right,u.right),u.bottom=Qw(f.bottom,u.bottom),u.left=xh(f.left,u.left),u},T$(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function KMe(t){const{width:e,height:n}=MH(t);return{width:e,height:n}}function JMe(t,e,n){const r=Rl(e),i=Vl(e),s=n==="fixed",o=Yh(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=Ol(0);function u(){l.x=q_(i)}if(r||!r&&!s)if((um(e)!=="body"||By(i))&&(a=j_(e)),r){const d=Yh(e,!0,s,e);l.x=d.x+e.clientLeft,l.y=d.y+e.clientTop}else i&&u();s&&!r&&i&&u();const c=i&&!r&&!s?NH(i,a):Ol(0),f=o.left+a.scrollLeft-l.x-c.x,h=o.top+a.scrollTop-l.y-c.y;return{x:f,y:h,width:o.width,height:o.height}}function hk(t){return ma(t).position==="static"}function D$(t,e){if(!Rl(t)||ma(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Vl(t)===n&&(n=n.ownerDocument.body),n}function BH(t,e){const n=eo(t);if(U_(t))return n;if(!Rl(t)){let i=cf(t);for(;i&&!D0(i);){if(pa(i)&&!hk(i))return i;i=cf(i)}return n}let r=D$(t,e);for(;r&&$Me(r)&&hk(r);)r=D$(r,e);return r&&D0(r)&&hk(r)&&!dT(r)?n:r||BMe(t)||n}const eLe=async function(t){const e=this.getOffsetParent||BH,n=this.getDimensions,r=await n(t.floating);return{reference:JMe(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function tLe(t){return ma(t).direction==="rtl"}const nLe={convertOffsetParentRelativeRectToViewportRelativeRect:qMe,getDocumentElement:Vl,getClippingRect:HMe,getOffsetParent:BH,getElementRects:eLe,getClientRects:VMe,getDimensions:KMe,getScale:Np,isElement:pa,isRTL:tLe};function zH(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function rLe(t,e){let n=null,r;const i=Vl(t);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const u=t.getBoundingClientRect(),{left:c,top:f,width:h,height:d}=u;if(a||e(),!h||!d)return;const p=iO(f),m=iO(i.clientWidth-(c+h)),g=iO(i.clientHeight-(f+d)),y=iO(c),v={rootMargin:-p+"px "+-m+"px "+-g+"px "+-y+"px",threshold:xh(0,Qw(1,l))||1};let w=!0;function x(S){const _=S[0].intersectionRatio;if(_!==l){if(!w)return o();_?o(!1,_):r=setTimeout(()=>{o(!1,1e-7)},1e3)}_===1&&!zH(u,t.getBoundingClientRect())&&o(),w=!1}try{n=new IntersectionObserver(x,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(x,v)}n.observe(t)}return o(!0),s}function iLe(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=mT(t),c=i||s?[...u?H1(u):[],...H1(e)]:[];c.forEach(y=>{i&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const f=u&&a?rLe(u,n):null;let h=-1,d=null;o&&(d=new ResizeObserver(y=>{let[O]=y;O&&O.target===u&&d&&(d.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var v;(v=d)==null||v.observe(e)})),n()}),u&&!l&&d.observe(u),d.observe(e));let p,m=l?Yh(t):null;l&&g();function g(){const y=Yh(t);m&&!zH(m,y)&&n(),m=y,p=requestAnimationFrame(g)}return n(),()=>{var y;c.forEach(O=>{i&&O.removeEventListener("scroll",n),s&&O.removeEventListener("resize",n)}),f?.(),(y=d)==null||y.disconnect(),d=null,l&&cancelAnimationFrame(p)}}const sLe=PMe,oLe=RMe,aLe=(t,e,n)=>{const r=new Map,i={platform:nLe,...n},s={...i.platform,_c:r};return AMe(t,e,{...i,platform:s})};var lLe=G('
    ');function Uw(t,e){De(e,!0);let n=Xe(e,"title",3,""),r=Xe(e,"label",3,null),i=Xe(e,"icon",3,null);Xe(e,"anchor",3,"right");let s=pe(!1);function o(){X(s,!b(s))}let a;function l(g){b(s)&&g.key=="Escape"&&(X(s,!1),g.stopPropagation())}let u;ki(()=>{b(s)&&ki(()=>{u.showPopover();function g(){aLe(a,u,{placement:"bottom",middleware:[sLe(3),oLe()]}).then(({x:y,y:O})=>{u.style.left=y+"px",u.style.top=O+"px"})}return iLe(a,u,g)})});var c=lLe();c.__keydown=l;var f=M(c);{var h=g=>{var y=ot(),O=ke(y);Eo(O,()=>e.button,()=>({visible:b(s),toggle:o})),I(g,y)},d=g=>{av(g,{get icon(){return i()},get title(){return n()},get label(){return r()},get checked(){return b(s)},set checked(y){X(s,y,!0)}})};oe(f,g=>{e.button?g(h):g(d,!1)})}var p=V(f,2);Ve(p,"",{},{width:"max-content"});var m=M(p);Eo(m,()=>e.children??Cn),F(p),lr(p,g=>u=g,()=>u),F(c),lr(c,g=>a=g,()=>a),cl("toggle",p,g=>{g.newState=="closed"&&X(s,!1)}),I(t,c),Pe()}dn(["keydown"]);var uLe=G('
    '),cLe=G('
    ');function fLe(t,e){De(e,!0);let n=L(()=>{let l=new Set(e.state.selection??[]);return new Set(e.spec.items.filter(u=>l.has(u.label)))});class r extends sL{reset(){e.onStateChange({selection:void 0})}}const i=new r,nv3IncludedDatasets=pe(null);let nv3DatasetMemberships=Ph({coordinator:e.context.coordinator,selection:e.context.filter,query:l=>{let u=e.spec.field==="dataset"&&e.context.filter.clauses.find(c=>c?.source?.filterField==="Collections"&&c.predicate!=null&&c.value!=null);if(!u){X(nv3IncludedDatasets,null);return null}return Be.from(e.context.table).select({value:Hn(ae("dataset"),"TEXT")}).where(u.predicate).groupby(Hn(ae("dataset"),"TEXT"))},queryResult:l=>{X(nv3IncludedDatasets,new Set(l.toArray().map(u=>u.value).filter(u=>u!=null)))}});UC(()=>{nv3DatasetMemberships.destroy()}),An(()=>{e.spec.field,nv3DatasetMemberships.requestUpdate()});function s(l,u){let c=new Set(e.state.selection??[]);u.shiftKey||u.metaKey?(c.has(l.label)?c.delete(l.label):c.add(l.label),e.onStateChange({selection:Array.from(c)})):c.has(l.label)&&c.size==1?e.onStateChange({selection:void 0}):e.onStateChange({selection:[l.label]})}An(()=>(An(()=>{let l=new Set(e.state.selection??[]),u=e.spec.items.filter(h=>l.has(h.label)),c=u.length!=0?_o(u.map(h=>h.predicate)):null,f={source:i,clients:new Set([i]),value:u.length==0?null:u,predicate:c};e.context.filter.update(f)}),()=>{e.context.filter.update({source:i,clients:new Set([i]),value:null,predicate:null})}));var o=cLe(),a=M(o);de(()=>ne(o,"data-nv3-field",e.spec.field));Ot(a,21,()=>e.spec.items,Wt,(l,u)=>{const c=L(()=>b(n).has(b(u))||b(n).size==0),nv3Fade=L(()=>{let x=b(nv3IncludedDatasets),S=b(u)?.label;return e.spec.field==="dataset"&&x instanceof Set&&S!=null&&!x.has(S)});var f=uLe();let h,nv3FadeStyle;f.__click=x=>{s(b(u),x)};var d=M(f),p=M(d);let m;F(d);var g=V(d),y=M(g),O=M(y,!0);F(y),F(g);var v=V(g),w=M(v,!0);F(v),F(f),de(x=>{h=Qt(f,1,"hover:bg-slate-200 dark:hover:bg-slate-700 select-none leading-7",null,h,{"opacity-20":!b(c)}),nv3FadeStyle=Ve(f,"",nv3FadeStyle,{"opacity":b(nv3Fade)?".12":"1","filter":b(nv3Fade)?"grayscale(1) saturate(0) contrast(.55)":"none"}),m=Ve(p,"",m,{"background-color":b(u).color}),ne(y,"title",b(u).label),ut(O,b(u).label),ut(w,x)},[()=>b(u).count.toLocaleString()]),I(l,f)}),F(a),F(o),I(t,o),Pe()}dn(["click"]);function UH(t){let e=0;function n(r){e+=1;try{r()}finally{e-=1}}return{set(r){n(()=>{t.set(r)})},update(r){n(()=>{t.update(r)})},subscribe(r){return t.subscribe(i=>{e==0&&r(i)})}}}const Nm={linear:{type:"linear",expr:t=>t,forward:t=>t,reverse:t=>t},log:{type:"log",expr:t=>Zf(xx(t,0),oN(t),Ae("nan")),forward:t=>Math.log10(t),reverse:t=>Math.pow(10,t)},symlog:{type:"symlog",expr:(t,e)=>Or(Eh(t),cp(E6(1,Zp(Kr(t,e))))),forward:(t,e)=>Math.sign(t)*Math.log1p(Math.abs(t)/e),reverse:(t,e)=>Math.sign(t)*Math.expm1(Math.abs(t))*e}};function hLe(t,e){let n=t,r=1/0;for(let i of e){let s=Math.abs(t-i);s=100&&n>=0&&i0?"log":"symlog")),n<=0&&o=="log"&&(r<=0?(n=1,r=10):n=Math.min(t.minPositive,r/10));let a=e.desiredCount??5;switch(o){case"linear":{let l=I_().domain([n,r]).nice(a),u=l.ticks(a);return{scale:{...Nm.linear,domain:l.domain()},binStart:l.domain()[0],binSize:u[1]-u[0]}}case"log":{let l=Y1().domain([n,r]).nice(),u=Math.log10(l.domain()[0]),c=(Math.log10(l.domain()[1])-u)/a;return c=hLe(c,[.05,.1,.2,.5,1,1.5,2]),{scale:{...Nm.log,domain:l.domain()},binStart:u,binSize:c}}case"symlog":{let l=Math.max(Math.abs(n),Math.abs(r)),u=l>=100?1:l>0?l/1e5:1,c=Nm.symlog.forward(n,u),f=Nm.symlog.forward(r,u);return{scale:{...Nm.symlog,domain:[n,r],constant:u},binStart:c,binSize:(f-c)/a}}default:throw new Error("invalid scale type")}}async function dLe(t,e,n,r){if(n==null)return null;let[i]=Array.from(await t.query(Be.describe(Be.from(e).select(n))));if(i==null)return null;let s=G1(i.column_type);return s=="string"?await P$(t,e,n,n==="dataset"?100:10,r):s=="number"?await OH(t,e,n)<=10?await P$(t,e,n,10,r):await pLe(t,e,n,r):null}async function P$(t,e,n,r,i){let s=`__ev_${n}_id`,o=Array.from(await t.query(Be.from(e).select({value:Hn(ae(n),"TEXT"),count:Cr()}).where(Xp(Eu(Hn(ae(n),"TEXT")))).groupby(Hn(ae(n),"TEXT")).orderby(fp(Cr())).limit(r))),a=o.length,l=o.length+1;await t.exec(` ALTER TABLE ${e} ADD COLUMN IF NOT EXISTS ${ae(s)} INTEGER DEFAULT 0; UPDATE ${e} SET ${ae(s)} = CASE ${ae(n)}::TEXT ${o.map(({value:m},g)=>Ze`WHEN ${Ae(m)} THEN ${Ae(g)}`).join(" ")} ELSE (CASE WHEN ${ae(n)} IS NULL THEN ${Ae(l)} ELSE ${Ae(a)} END) END `);let u=Array.from(await t.query(Be.from(e).select({index:ae(s),count:Hn(Cr(),"INT")}).groupby(ae(s)))),c=new Map;for(let m of u)c.set(m.index,m.count);let f=c.get(a)??0,h=c.get(l)??0,d=mLe(i,o.length),p=o.map(({value:m},g)=>({label:m,color:n==="benchmark_accuracy"?m==="0"?"#b91c1c":m==="1"?"#15803d":d[g]:d[g],predicate:qs(Hn(ae(n),"TEXT"),Ae(m)),count:c.get(g)??0}));if(f>0){let{otherCategoryCount:m}=(await t.query(` SELECT COUNT(DISTINCT(${ae(n)}::TEXT)) AS otherCategoryCount FROM ${e} WHERE ${ae(s)} = ${Ae(a)} AND ${ae(n)} IS NOT NULL `)).get(0);p.push({label:`(other ${m.toLocaleString()})`,color:i.otherColor,predicate:o.length>0?Ze`${ae(n)} IS NOT NULL AND ${ae(n)}::TEXT NOT IN (${o.map(g=>Ae(g.value)).join(",")})`:Ze`${ae(n)} IS NOT NULL`,count:f})}return h>0&&(f<=0&&(await t.exec(` UPDATE ${e} SET ${ae(s)} = ${ae(s)} - 1 WHERE ${ae(s)} = ${Ae(l)} `),l-=1),p.push({label:"(null)",color:i.nullColor,predicate:Eu(ae(n)),count:h})),{indexColumn:s,legend:p}}async function pLe(t,e,n,r){let i=(await t.query(Be.from(e).select({count:Cr(),min:Vg(ae(n)),max:wx(ae(n)),mean:Cv(ae(n)),median:C6(ae(n))}).where(Fc(ae(n))))).get(0),s=(n==="num_turns"||n==="num_tool_calls")?jH(i,{scale:"linear"}):jH(i),o=`__ev_${n}_id`,a=Hn(ae(n),"DOUBLE");a=s.scale.expr(a,s.scale.constant??0);let l=Zf(Fc(Hn(ae(n),"DOUBLE")),Ev(Or(Er(a,s.binStart),1/s.binSize)),Ae(null));await t.exec(` ALTER TABLE ${e} ADD COLUMN IF NOT EXISTS ${ae(o)} INTEGER DEFAULT 0; UPDATE ${e} SET ${ae(o)} = ${l} `);let u=Array.from(await t.query(` SELECT ${ae(o)} AS index, COUNT(*)::INT AS count FROM ${e} GROUP BY ${ae(o)} ORDER BY ${ae(o)} ASC `)),c=null,f=null,h=new Map,d=g=>s.scale.reverse(g,s.scale.constant??0);for(let{index:g,count:y}of u)g!=null&&((c==null||gf)&&(f=g)),h.set(g,y);let p=[],m=Ny(".6");if(c!=null&&f!=null){let g=gLe(r,f-c+1);for(let y=c;y<=f;y++){let O=d(y*s.binSize+s.binStart),v=d((y+1)*s.binSize+s.binStart);p.push({label:`[${m(O)}, ${m(v)})`,color:g[y-c],predicate:qs(l,Ae(y)),count:h.get(y)??0})}}if(h.has(null)){let g=p.length;await t.exec(` UPDATE ${e} SET ${ae(o)} = ${Ae(g)} WHERE ${ae(o)} IS NULL `),p.push({label:"(null / nan / inf)",color:r.nullColor,predicate:Eu(l),count:h.get(null)??0})}return{indexColumn:o,legend:p}}function mLe(t,e){if(typeof t.categoryColors=="function")return t.categoryColors(e);{let n=[];for(let r=0;rn(i/(e-1)))}}function sO(t,e,n){return t+(e-t)*n}function yLe(t,e,n){let r=Math.log(t.scale),i=Math.log(e.scale);if(Math.abs(i-r)<1e-5)return{x:sO(t.x,e.x,n),y:sO(t.y,e.y,n),scale:sO(t.scale,e.scale,n)};let s=Math.exp(sO(r,i,n));return{x:(e.x*e.scale-t.x*t.scale+(t.x-e.x)*(t.scale*e.scale/s))/(e.scale-t.scale),y:(e.y*e.scale-t.y*t.scale+(t.y-e.y)*(t.scale*e.scale/s))/(e.scale-t.scale),scale:s}}async function bLe(t,e,n,r){let{stdX:i,stdY:s}=(await t.query(Be.from(e).select({stdX:Ze`STDDEV(${ae(n)})::FLOAT`,stdY:Ze`STDDEV(${ae(r)})::FLOAT`}))).get(0);return 1/(Math.max(i,s,.001)*3)}const OLe=DH(yMe),vLe=DH(fMe);var wLe=G('
    '),xLe=G(' '),_Le=G('
    ',1),SLe=G('
    Display Mode
    Point Size
    '),kLe=G('
    ');function CLe(t,e){De(e,!0);const n=()=>hr(f,"$colorScheme",s),r=()=>hr(p,"$themeConfig",s),i=()=>hr(h,"$columnStyles",s),[s,o]=Lo(),a=Math.min(20,CDe()),l=1/16,u=4e6,c=5e4;let{colorScheme:f,columnStyles:h,searchResult:d,theme:p}=e.context,m=L(()=>lT(n(),r())),g=UH(e.context.highlight),nV3SemanticHighlight=UH(e.context.semanticHighlights),nV3BenchmarkOverlay=UH(e.context.benchmarkOverlay),y=L(()=>e.spec.data.category),O=pe(null),v=pe(null);An(()=>{e.context.coordinator.query(Be.from(e.context.table).select({count:Ze`COUNT(*)::INT`})).then(z=>{X(v,z.get(0).count)})});let w=pe(null),x=pe(null),S=pe(null),nV3SemanticPoints=pe([]),nV3BenchmarkPoints=pe([]);An(()=>{e.context.cache.value(`embedding/category/${b(y)}`,()=>dLe(e.context.coordinator,e.context.table,b(y),b(m))).then(ee=>{X(O,ee),(b(O)?.legend.length??0)>a&&e.onSpecChange({mode:"points"})})}),An(()=>{let z=!0,ee=null;return g.subscribe(W=>{if(X(x,W),z){z=!1,ee=W;return}let K=W??[],H=ee??[],J=K.filter(Y=>H.indexOf(Y)<0);J.length==1&&_(J[0]),b(w)!=null&&K.indexOf(b(w))<0&&X(w,null),ee=W})}),An(()=>{let z=0;return nV3SemanticHighlight.subscribe(async ee=>{let W=++z;if(ee==null||ee.length==0){X(nV3SemanticPoints,[]);return}let K=Array.from(await e.context.coordinator.query(Be.from(e.context.table).select({identifier:ae(e.context.id),x:ae(e.spec.data.x),y:ae(e.spec.data.y)}).where(Dh(e.context.id,ee.map(H=>Ae(H))))));W===z&&X(nV3SemanticPoints,K)})}),An(()=>nV3BenchmarkOverlay.subscribe(z=>{X(nV3BenchmarkPoints,z??[])})),An(()=>d.subscribe(async z=>{if(z==null||z.ids.length==0){X(S,null);return}let ee=null;z.mode=="neighbors"&&(ee=z.query);let W=Array.from(await e.context.coordinator.query(Be.from(e.context.table).select({identifier:ae(e.context.id),x:ae(e.spec.data.x),y:ae(e.spec.data.y)}).where(Dh(e.context.id,z.ids.concat(ee!=null?[ee]:[]).map(K=>Ae(K))))));X(S,{center:W.filter(K=>K.identifier===ee)[0]??null,points:W.filter(K=>K.identifier!==ee)})}));async function _(z){let W=await e.context.cache.value(`embedding/default-viewport-scale/${e.spec.data.x},${e.spec.data.y}`,()=>bLe(e.context.coordinator,e.context.table,e.spec.data.x,e.spec.data.y))*2,K=await e.context.coordinator.query(Be.from(e.context.table).select({x:ae(e.spec.data.x),y:ae(e.spec.data.y)}).where(qs(ae(e.context.id),Ae(z)))),{x:H,y:J}=K.get(0);D({x:H,y:J,scale:W}),X(w,z)}let k,C=pe(null);function D(z){X(w,null);let ee=b(C)??e.state.viewport;if(ee==null){e.onStateChange({viewport:z});return}X(C,ee);let W=800,K=new Date().getTime(),H=()=>{let J=(new Date().getTime()-K)/W;J>1&&(J=1),X(C,yLe(ee,z,PH(J))),J<1?k=requestAnimationFrame(H):e.onStateChange({viewport:b(C)})};k&&cancelAnimationFrame(k),k=requestAnimationFrame(H)}var A=kLe(),E=M(A);{let z=L(()=>b(O)?.indexColumn),ee=L(()=>b(O)?.legend.map(Z=>Z.color)??[b(m).embeddingColor]),W=L(()=>({colorScheme:n(),...e.context.embeddingViewConfig,mode:e.spec.mode??"points",...e.spec.minimumDensity!=null?{minimumDensity:e.spec.minimumDensity}:{},...e.spec.pointSize!=null?{pointSize:e.spec.pointSize}:{},downsampleMaxPoints:e.spec.downsampleMaxPoints??u})),K=L(()=>Object.fromEntries(e.context.columns.filter(Z=>Z.name!=="emb"&&Z.name!=="true_rows"&&Z.name!=="True_rows").map(Z=>[Z.name,Z.name]))),H=L(()=>({class:OLe,props:{darkMode:n(),columnStyles:i(),onNearestNeighborSearch:(e.context.searchModes??[]).indexOf("neighbors")>=0?Z=>e.context.search?.(Z,"neighbors"):null}})),J=L(()=>({class:vLe,props:{...b(S)??{points:[],center:null},semanticPoints:b(nV3SemanticPoints),benchmarkPoints:b(nV3BenchmarkPoints)}})),Y=L(()=>b(C)??e.state.viewport);OMe(E,{get width(){return e.width},get height(){return e.height},get coordinator(){return e.context.coordinator},get table(){return e.context.table},get filter(){return e.context.filter},get rangeSelection(){return e.context.filter},get identifier(){return e.context.id},get x(){return e.spec.data.x},get y(){return e.spec.data.y},get text(){return e.spec.data.text},get category(){return b(z)},get categoryColors(){return b(ee)},get config(){return b(W)},get labels(){return e.context.embeddingViewLabels},get cache(){return e.context.persistentCache},get additionalFields(){return b(K)},get customTooltip(){return b(H)},get customOverlay(){return b(J)},get viewportState(){return b(Y)},onViewportState:Z=>e.onStateChange({viewport:Z}),get rangeSelectionValue(){return e.state.brush},onRangeSelection:Z=>e.onStateChange({brush:Z??void 0}),get tooltip(){return b(w)},onTooltip:Z=>{X(w,Z)},get selection(){return b(x)},onSelection:Z=>{X(x,Z),g.set(Z?.map(he=>he.identifier)??null)}})}var T=V(E,2),R=M(T);{var $=z=>{var ee=wLe(),W=M(ee);{let K=L(()=>({items:b(O).legend,field:b(y)})),H=L(()=>e.state.legend??{});fLe(W,{get context(){return e.context},get spec(){return b(K)},get state(){return b(H)},mode:"view",onSpecChange:()=>{},onStateChange:(J,Y)=>{e.onStateChange({legend:J})}})}F(ee),I(z,ee)};oe(R,z=>{b(O)!=null&&z($)})}var Q=V(R,2),B=M(Q);{let z=L(()=>[{value:void 0,label:"--"},...e.context.columns.filter(ee=>(ee.jsType=="string"||ee.jsType=="number")&&ee.name!==e.spec.data.x&&ee.name!==e.spec.data.y&&ee.name!=="row_x"&&ee.name!=="row_y"&&["row_id","text","source_file","source_line","source_group","projection_x","projection_y","__collection_source","license","benchmark_task_id","benchmark_query_id","benchmark_row_id","benchmark_accuracy","row_kind","sub_file"].indexOf(ee.name)<0).map(ee=>({value:ee.name,label:`${ee.name} (${ee.type})`}))]);Zs(B,{class:"max-w-64",label:"Color",get value(){return b(y)},onChange:ee=>e.onSpecChange({data:{...e.spec.data,category:ee}}),get options(){return b(z)}})}var q=V(B,2);Uw(q,{get icon(){return t8},title:"Options",children:(z,ee)=>{var W=SLe(),K=V(M(W),2),H=M(K);{let ue=L(()=>e.spec.mode??"points"),Ee=L(()=>b(O)!=null&&b(O).legend.length>a);Zs(H,{get value(){return b(ue)},onChange:Le=>e.onSpecChange({mode:Le}),get disabled(){return b(Ee)},options:[{value:"points",label:"Points"},{value:"density",label:"Density"}]})}var J=V(H,2);{var Y=ue=>{var Ee=()=>Math.log((e.spec.minimumDensity??l)/l),Le=qe=>e.onSpecChange({minimumDensity:l*Math.exp(qe)});KO(ue,{get value(){return Ee()},set value(qe){Le(qe)},min:-4,max:4,step:.05})};oe(J,ue=>{(e.spec.mode??"points")=="density"&&ue(Y)})}F(K);var Z=V(K,4),he=M(Z),me=()=>e.spec.pointSize??1,te=ue=>e.onSpecChange({pointSize:ue});KO(he,{get value(){return me()},set value(ue){te(ue)},min:1,max:10,step:.05});var le=V(he,2);Nu(le,{label:"Auto",onClick:()=>e.onSpecChange({pointSize:void 0})}),F(Z);var ve=V(Z,2);{var xe=ue=>{const Ee=L(()=>e.spec.downsampleMaxPoints??Math.min(u,b(v))),Le=L(()=>b(Ee)>=b(v));var qe=_Le(),Fe=ke(qe),it=M(Fe),St=V(it);{var Se=Bn=>{var er=xLe(),jt=M(er);F(er),de(jr=>ut(jt,`/ ${jr??""}`),[()=>b(v)>=1e6?(b(v)/1e6).toFixed(1)+"M":(b(v)/1e3).toFixed(0)+"K"]),I(Bn,er)};oe(St,Bn=>{b(Le)||Bn(Se)})}F(Fe);var gt=V(Fe,2),Kt=M(gt),Rn=()=>e.spec.downsampleMaxPoints??Math.min(u,b(v)??u),Ri=Bn=>e.onSpecChange({downsampleMaxPoints:Bn});{let Bn=L(()=>Math.max(1e4,Math.floor(b(v)/100/1e4)*1e4));KO(Kt,{get value(){return Rn()},set value(er){Ri(er)},min:c,get max(){return b(v)},get step(){return b(Bn)}})}F(gt),de(Bn=>ut(it,`Max Points: ${Bn??""} `),[()=>b(Le)?"All":b(Ee)>=1e6?(b(Ee)/1e6).toFixed(1)+"M":(b(Ee)/1e3).toFixed(0)+"K"]),I(ue,qe)};oe(ve,ue=>{b(v)!=null&&b(v)>c&&ue(xe)})}F(W),I(z,W)},$$slots:{default:!0}}),F(Q),F(T),F(A),I(t,A),Pe(),o()}var ALe=G('
    Page
    ');function vC(t,e){De(e,!0);let n;function r(m){if(!isFinite(m))return e.currentPage;m=Math.max(0,Math.min(e.pageCount-1,m)),e.onChange(m),n.value=(m+1).toString()}var i=ALe(),s=M(i);let o;s.__click=()=>{r(e.currentPage-1)};var a=M(s);ike(a,{class:"w-5 h-5"}),F(s);var l=V(s,2),u=V(M(l),2);ox(u),u.__keydown=m=>{if(m.key=="Enter"){let g=+n.value;r(Math.round(g)-1)}},lr(u,m=>n=m,()=>n);var c=V(u,2),f=M(c);F(c),F(l);var h=V(l,2);let d;h.__click=()=>{r(e.currentPage+1)};var p=M(h);F4(p,{class:"w-5 h-5"}),F(h),F(i),de(()=>{o=Qt(s,1,"border border-slate-300 bg-white/50 dark:border-slate-700 dark:bg-black/50 px-3 py-1 rounded-md",null,o,{"text-slate-300":e.currentPage<=0,"dark:text-slate-700":e.currentPage<=0}),s.disabled=e.currentPage<=0,KM(u,e.currentPage+1),ut(f,`of ${e.pageCount??""}`),d=Qt(h,1,"border border-slate-300 bg-white/50 dark:border-slate-700 dark:bg-black/50 px-3 py-1 rounded-md",null,d,{"text-slate-300":e.currentPage>=e.pageCount-1,"dark:text-slate-700":e.currentPage>=e.pageCount-1}),h.disabled=e.currentPage>=e.pageCount-1}),cl("blur",u,()=>{let m=+n.value;r(Math.round(m)-1)}),I(t,i),Pe()}dn(["click","keydown"]);var ELe=G(' '),TLe=G(""),DLe=G('
    ');function gT(t,e){De(e,!0);var n=DLe();Ot(n,21,()=>e.options,Wt,(r,i)=>{const s=L(()=>e.value==b(i).value);var o=TLe();o.__click=()=>{e.onChange?.(b(i).value)};var a=M(o);{var l=f=>{const h=L(()=>b(i).icon);var d=ot(),p=ke(d);Bu(p,()=>b(h),(m,g)=>{g(m,{class:"w-5 h-5"})}),I(f,d)};oe(a,f=>{b(i).icon!=null&&f(l)})}var u=V(a,2);{var c=f=>{var h=ELe(),d=M(h,!0);F(h),de(()=>ut(d,b(i).label)),I(f,h)};oe(u,f=>{b(i).label!=null&&b(i).label!=""&&f(c)})}F(o),de(()=>{Qt(o,1,`flex items-center px-1.5 py-1.5 h-[26px] rounded-[3.875px] focus-visible:outline-2 outline-blue-600 -outline-offset-1 ${b(s)?"bg-white dark:bg-black shadow-md":"text-slate-400 dark:text-slate-600"}`),ne(o,"title",b(i).title??b(i).label)}),I(r,o)}),F(n),I(t,n),Pe()}dn(["click"]);var PLe=G('
    '),RLe=G("
    "),ILe=G('
    ');function FLe(t,e){De(e,!0);let n=L(()=>new Set(e.highlight)),r=new Map,i=L(()=>e.cardTemplate!=null?WW(e.cardTemplate):void 0);function s(u){return r.get(u)}var o={getElementForId:s},a=ILe(),l=M(a);return Ve(l,"",{},{"grid-template-columns":"repeat(auto-fill, minmax(300px, 1fr))"}),Ot(l,21,()=>e.data,Wt,(u,c)=>{const f=L(()=>b(c).__id__),h=L(()=>Object.fromEntries(e.columns.map(w=>[w,b(c)[w]]))),d=L(()=>b(n).has(b(f)));var p=RLe(),m=M(p);let g;m.__mousedown=w=>{(w.shiftKey||w.ctrlKey||w.metaKey)&&w.preventDefault()},m.__click=w=>e.onRowClick(b(f),w);var y=M(m);{var O=w=>{var x=ot(),S=ke(x);ix(S,()=>b(i)(b(h))),I(w,x)},v=w=>{var x=PLe(),S=M(x);fT(S,{get values(){return b(h)},get columns(){return e.columns},get columnStyles(){return e.columnStyles}}),F(x),I(w,x)};oe(y,w=>{b(i)!=null?w(O):w(v,!1)})}F(m),lr(m,(w,x)=>r.set(x,w),w=>r.get(w),()=>[b(f)]),F(p),de(()=>g=Qt(m,1,"flex items-stretch flex-col border rounded-lg transition-all hover:shadow-md bg-white dark:bg-slate-800 overflow-hidden text-left w-full select-text appearance-none",null,g,{"border-slate-200":!b(d),"dark:border-slate-700":!b(d),"border-blue-500":b(d),"ring-1":b(d),"ring-blue-500":b(d)})),I(u,p)}),F(l),F(a),I(t,a),Pe(o)}dn(["mousedown","click"]);var $Le=G('
    '),MLe=G('
    ');function LLe(t,e){De(e,!0);function n(a){e.onChange?.(e.value?.map(l=>l.column==a?{column:l.column,direction:l.direction=="ascending"?"descending":"ascending"}:l))}function r(a){let l=e.value?.filter(u=>u.column!=a);l?.length==0&&(l=void 0),e.onChange?.(l)}var i=ot(),s=ke(i);{var o=a=>{var l=MLe();Ot(l,21,()=>e.value??[],Wt,(u,c)=>{var f=$Le(),h=M(f),d=V(h);d.__click=()=>n(b(c).column);var p=M(d);{var m=v=>{KX(v,{})},g=v=>{var w=ot(),x=ke(w);{var S=_=>{HX(_,{})};oe(x,_=>{b(c).direction=="descending"&&_(S)},!0)}I(v,w)};oe(p,v=>{b(c).direction=="ascending"?v(m):v(g,!1)})}F(d);var y=V(d,2);y.__click=()=>r(b(c).column);var O=M(y);sd(O,{}),F(y),F(f),de(()=>ut(h,`${b(c).column??""} `)),I(u,f)}),F(l),I(a,l)};oe(s,a=>{(e.value?.length??!1)&&a(o)})}I(t,i),Pe()}dn(["click"]);var NLe=G('
    '),QLe=G(''),BLe=G("
    "),zLe=G(""),ULe=G('
    ');function jLe(t,e){De(e,!0);let n=L(()=>new Set(e.highlight)),r=new Map,i=pe({}),s=pe(new Set),o=pe(null);function a(w){return e.columnDescs.find(S=>S.name===w)?.jsType==="number"?"text-right":"text-left"}function l(w){return String(w).length>100}function u(w){X(s,new Set(b(s).has(w)?[...b(s)].filter(x=>x!==w):[...b(s),w]))}function c(w){return x=>{let S=b(i)[w]??e.defaultColumnWidths[w]??150;return{move:_=>{let k=S+_.clientX-x.clientX;k=Math.max(60,k),X(i,{...b(i),[w]:k})}}}}function f(w,x){let S=x?.findIndex(_=>_.column==w)??-1;if(!(S<0))return{order:x?.[S].direction,isPrimary:S==0}}function h(w,x){let S=[];x!=null?S=[{column:w,direction:x},...e.sort?.filter(_=>_.column!=w)??[]]:S=e.sort?.filter(_=>_.column!=w)??[],e.onSortChange(S.length==0?void 0:S)}function d(w){return r.get(w)}var p={getElementForId:d},m=ULe(),g=M(m),y=M(g),O=M(y);Ot(O,17,()=>e.columns,Wt,(w,x)=>{const S=L(()=>f(b(x),e.sort)),_=L(()=>b(S)?.isPrimary??!1),k=L(()=>b(i)[b(x)]??e.defaultColumnWidths[b(x)]??150);var C=NLe();let D;var A=M(C),E=M(A),T=M(E,!0);F(E);var R=V(E,2);R.__click=()=>h(b(x),b(S)==null?"ascending":b(S).order=="ascending"?"descending":void 0);var $=M(R);let Q;var B=M($);{var q=W=>{KX(W,{})},z=W=>{var K=ot(),H=ke(K);{var J=Z=>{HX(Z,{})},Y=Z=>{G3e(Z,{})};oe(H,Z=>{b(S)?.order=="descending"?Z(J):Z(Y,!1)},!0)}I(W,K)};oe(B,W=>{b(S)?.order=="ascending"?W(q):W(z,!1)})}F($),F(R),F(A);var ee=V(A,2);Zn(ee,(W,K)=>sn?.(W,K),()=>({drag:c(b(x))})),F(C),de(W=>{Qt(C,1,`px-4 py-1.5 font-normal text-slate-400 dark:text-slate-500 border-b border-slate-200 dark:border-slate-800 whitespace-nowrap relative group ${W??""}`),D=Ve(C,"",D,{width:`${b(k)??""}px`}),ut(T,b(x)),Q=Qt($,1,"",null,Q,{"text-slate-300":!b(_),"dark:text-slate-600":!b(_),"text-slate-600":b(_),"dark:text-slate-200":b(_)})},[()=>a(b(x))]),I(w,C)}),ws(),F(y),F(g);var v=V(g);return Ot(v,21,()=>e.data,Wt,(w,x,S)=>{const _=L(()=>b(x).__id__);var k=zLe();k.__click=D=>e.onRowClick(b(_),D),k.__mousedown=D=>{(D.shiftKey||D.ctrlKey||D.metaKey)&&D.preventDefault()};var C=M(k);Ot(C,17,()=>e.columns,Wt,(D,A)=>{var E=BLe(),T=M(E);let R;var $=M(T);yw($,{get value(){return b(x)[b(A)]},get style(){return e.columnStyles[b(A)]}}),F(T);var Q=V(T,2);{var B=q=>{var z=QLe();z.__click=ee=>{ee.stopPropagation(),u(S)},I(q,z)};oe(Q,q=>{!b(s).has(S)&&l(b(x)[b(A)])&&b(o)?.row===S&&b(o)?.col===b(A)&&q(B)})}F(E),de((q,z)=>{Qt(E,1,`px-4 py-1.5 text-slate-500 dark:text-slate-400 align-top overflow-hidden relative ${q??""}`),R=Qt(T,1,"overflow-wrap-anywhere",null,R,z)},[()=>a(b(A)),()=>({"line-clamp-3":!b(s).has(S)&&l(b(x)[b(A)])})]),cl("mouseenter",E,()=>X(o,{row:S,col:b(A)})),cl("mouseleave",E,()=>X(o,null)),I(D,E)}),ws(),F(k),lr(k,(D,A)=>r.set(A,D),D=>r.get(D),()=>[b(_)]),de(D=>Qt(k,1,`transition-colors ${D??""}`),[()=>b(n).has(b(_))?"bg-blue-100 dark:bg-blue-950":S%2===0?"bg-white dark:bg-black hover:bg-blue-50 dark:hover:bg-blue-950":"bg-slate-50 dark:bg-slate-900 hover:bg-blue-50 dark:hover:bg-blue-950"]),I(w,k)}),F(v),F(m),I(t,m),Pe(p)}dn(["click","mousedown"]);function qLe(t){if(t.query){const e=t.predicate?L_(t.predicate):null,n=gC(t.query,{table:t.table,filter:e??"(true)"});return Ze`(${n})`}else{let e=Be.from(t.table).select("*");return t.predicate&&(e=e.where(t.predicate)),e}}var VLe=G('
    '),ZLe=G(" ",1),XLe=G('
    '),WLe=G(" ",1),YLe=G('
    Loading...
    '),GLe=G('
    ');function HLe(t,e){De(e,!0);const n=()=>hr(o,"$contextColumnStyles",i),r=()=>hr(u,"$highlight",i),[i,s]=Lo();let{columnStyles:o}=e.context,a=L(()=>({...n(),...e.spec.columnStyles})),l=UH(e.context.highlight),u=e.context.highlight,c=L(()=>e.spec.viewMode??"table"),f=L(()=>e.state.offset??0),h=L(()=>e.spec.pageSize??100),d=pe(void 0),p=pe(void 0),m=pe({});An(()=>{let J=!0,Y=null;return l.subscribe(Z=>{if(J){J=!1,Y=Z;return}let he=Z??[],me=Y??[],te=he.filter(le=>me.indexOf(le)<0);te.length==1&&k(te[0]),Y=Z})});let g=pe(0),y=pe(void 0),O=L(()=>Math.floor(b(f)/b(h))),v=L(()=>Math.ceil(b(g)/b(h)));function w(){Br(()=>{b(f)!=0&&e.onStateChange({offset:0}),b(p)&&(b(p).scrollTop=0)})}function x(J){let Y=J.query==null,Z=ue=>qLe({query:J.query,table:e.context.table,predicate:ue}),he=(J.sort??[]).map(ue=>{let Ee=ae(ue.column);return ue.direction==="descending"?fp(Ee):Pd(Ee)}),me=[],te=0,le,ve=Ph({coordinator:e.context.coordinator,selection:e.context.filter,query:ue=>Be.from(Z(ue)).select({count:Cr()}),queryResult:ue=>{X(g,ue.get(0).count)}}),xe=Ph({coordinator:e.context.coordinator,selection:e.context.filter,prepare:async()=>{if(me=(await e.context.coordinator.query(Be.describe(Z()))).toArray().map(Fe=>Fe.column_name),me=me.filter(Fe=>["row_id","source_file","source_line","source_group","projection_x","projection_y","__collection_source","license","benchmark_task_id","benchmark_query_id","benchmark_row_id","benchmark_accuracy","row_kind","sub_file"].indexOf(Fe)<0),J.columns){let Fe=new Set(J.columns);me=me.filter(it=>Fe.has(it))}me=me.filter(Fe=>J.columnStyles[Fe]?.display!=="hidden");let Ee=Be.from(Z()).select(Object.fromEntries([...Y?[["__id__",ae(e.context.id)]]:[],...me.map(Fe=>[Fe,ae(Fe)])])).limit(10).offset(0),qe=(await e.context.coordinator.query(Ee)).toArray();X(m,Object.fromEntries(me.map(Fe=>[Fe,qe.reduce((it,St)=>Math.max(it,_(St[Fe])),_(Fe))])))},query:ue=>(te=b(f),le=ue,Be.from(Z(ue)).select(Object.fromEntries([...Y?[["__id__",ae(e.context.id)]]:[],...me.map(Ee=>[Ee,ae(Ee)])])).orderby(he).limit(J.pageSize).offset(b(f))),queryResult:ue=>{X(y,{data:ue.toArray(),columns:me,offset:te,offsetForId:Y?async Ee=>{let Le=Be.from(Z(le)).select({id:ae(e.context.id),offset:he.length>0?eD().orderby(...he):eD()}),qe=Be.from(Le).select({offset:ae("offset")}).where(qs(ae("id"),Ae(Ee)));return(await e.context.coordinator.query(qe)).get(0)?.offset}:void 0})}});return An(()=>{b(f)!=te&&xe.requestQuery()}),()=>{ve.destroy(),xe.destroy()}}let S=L(wv(()=>({query:e.spec.query,columns:e.spec.columns,columnStyles:b(a),sort:e.spec.sort,pageSize:b(h)})));An(()=>(w(),x(b(S)))),An(()=>{let J=()=>{w()};return e.context.filter.addEventListener("value",J),()=>{e.context.filter.removeEventListener("value",J)}});function _(J){let Y=String(J).length;return Math.min(600,Math.max(80,Y*8+40))}async function k(J){if(e.spec.query!=null||b(y)==null)return;if(b(y).data.some(Z=>Z.__id__===J))b(d)?.getElementForId(J)?.scrollIntoView({behavior:"smooth",block:"center"});else{let Z=await b(y)?.offsetForId?.(J);Z!=null&&(Z=Math.floor(Z/b(h))*b(h),X(C,{offset:Z,id:J}),e.onStateChange({offset:Z}))}}let C=pe(void 0);ki(()=>{if(!b(C))return;let J=b(C);b(y)?.offset==J.offset&&(X(C,void 0),Br(()=>{b(d)?.getElementForId(J.id)?.scrollIntoView({behavior:"smooth",block:"center"})}))});function D(J){e.onStateChange({offset:J*b(h)})}function A(){e.onStateChange({offset:Math.min(b(g)-1,b(f)+b(h))})}function E(J,Y){J!=null&&l.update(Z=>Y.shiftKey||Y.ctrlKey||Y.metaKey?Z==null?[J]:Z.indexOf(J)>=0?Z.filter(he=>he!=J):[...Z,J]:Z!=null&&Z.length==1&&Z.indexOf(J)>=0?null:[J])}var T=GLe();let R;var $=M(T),Q=M($),B=M(Q);{let J=L(()=>[{value:"table",icon:vke,title:"Table view"},{value:"cards",icon:pke,title:"Card view"}]);gT(B,{get value(){return b(c)},onChange:Y=>e.onSpecChange({viewMode:Y}),get options(){return b(J)}})}var q=V(B,2);vC(q,{get currentPage(){return b(O)},get pageCount(){return b(v)},onChange:D});var z=V(q,2);LLe(z,{get value(){return e.spec.sort},onChange:J=>e.onSpecChange({sort:J})}),F(Q),F($);var ee=V($,2),W=M(ee);{var K=J=>{var Y=ot(),Z=ke(Y);{var he=te=>{var le=ZLe(),ve=ke(le);lr(jLe(ve,{get data(){return b(y).data},get columns(){return b(y).columns},get columnDescs(){return e.context.columns},get columnStyles(){return b(a)},get defaultColumnWidths(){return b(m)},get highlight(){return r()},get sort(){return e.spec.sort},onRowClick:E,onSortChange:Ee=>e.onSpecChange({sort:Ee})}),Ee=>X(d,Ee),()=>b(d));var xe=V(ve,2);{var ue=Ee=>{var Le=VLe(),qe=M(Le);qe.__click=A;var Fe=V(M(qe));F4(Fe,{}),F(qe),F(Le),I(Ee,Le)};oe(xe,Ee=>{b(f)+b(h){var le=WLe(),ve=ke(le);lr(FLe(ve,{get data(){return b(y).data},get columns(){return b(y).columns},get columnStyles(){return b(a)},get highlight(){return r()},get cardTemplate(){return e.spec.cardTemplate},onRowClick:E}),Ee=>X(d,Ee),()=>b(d));var xe=V(ve,2);{var ue=Ee=>{var Le=XLe(),qe=M(Le);qe.__click=A;var Fe=V(M(qe));F4(Fe,{}),F(qe),F(Le),I(Ee,Le)};oe(xe,Ee=>{b(f)+b(h){b(c)==="table"?te(he):te(me,!1)})}I(J,Y)},H=J=>{var Y=YLe();I(J,Y)};oe(W,J=>{b(y)!=null?J(K):J(H,!1)})}F(ee),lr(ee,J=>X(p,J),()=>b(p)),F(T),de(()=>R=Ve(T,"",R,{height:`${e.height??e.spec.defaultHeight??500}px`})),I(t,T),Pe(),s()}dn(["click"]);var KLe=G("
    "),JLe=G("
    ");function qH(t,e){let n=pe(300),r=pe(200),i=Xe(e,"flexHeight",3,!1);var s=JLe();let o;var a=M(s);{var l=c=>{var f=KLe();let h;var d=M(f);Eo(d,()=>e.children??Cn,()=>b(n),()=>b(r)),F(f),de(()=>h=Ve(f,"",h,{position:"absolute",height:`${b(r)??""}px`})),I(c,f)},u=c=>{var f=ot(),h=ke(f);Eo(h,()=>e.children??Cn,()=>b(n),()=>b(r)),I(c,f)};oe(a,c=>{i()?c(l):c(u,!1)})}F(s),de(()=>{Qt(s,1,sx(i()?"flex-1 min-h-0":void 0)),o=Ve(s,"",o,{"user-select":"none",position:"relative",height:i()?void 0:"fit-content"})}),fl(s,"clientWidth",c=>X(n,c)),fl(s,"clientHeight",c=>X(r,c)),I(t,s)}var eNe=ft("
    ");function R$(t,e){De(e,!0);let n=L(()=>e.dimension=="x"?{px:e.proxy.scale.x?.apply(e.label.value)??0,py:e.proxy.plotHeight+e.label.padding,anchorX:.5,anchorY:0}:{px:-e.label.padding,py:e.proxy.scale.y?.apply(e.label.value)??0,anchorX:1,anchorY:.5}),r=L(()=>b(n).px),i=L(()=>b(n).py),s=L(()=>b(n).anchorX),o=L(()=>b(n).anchorY),a=L(()=>e.label.orientation=="vertical"?{rotation:90,shiftX:b(s)*e.label.size.width,shiftY:-b(o)*e.label.size.height,width:e.label.size.height,height:e.label.size.width}:{rotation:0,shiftX:-b(s)*e.label.size.width,shiftY:-b(o)*e.label.size.height,width:e.label.size.width,height:e.label.size.height}),l=L(()=>b(a).rotation),u=L(()=>b(a).shiftX),c=L(()=>b(a).shiftY),f=L(()=>b(a).width),h=L(()=>b(a).height),d=4,p=4;var m=eNe(),g=M(m);ne(g,"x",-d),ne(g,"y",-p);var y=M(g);let O;var v=M(y,!0);F(y),F(g),F(m),de(()=>{ne(m,"transform",`translate(${b(r)+b(u)}, ${b(i)+b(c)}) rotate(${b(l)??""})`),ne(g,"width",b(f)+d*2),ne(g,"height",b(h)+p*2),ne(y,"title",e.label.text),O=Ve(y,"",O,{width:`${b(f)+2}px`,height:`${b(h)+p*2}px`,"line-height":`${b(h)+p*2}px`,"font-family":e.label.fontFamily,"font-size":`${e.label.fontSize??""}px`,"margin-left":"4px",color:e.color,overflow:"hidden","white-space":"nowrap","text-overflow":"ellipsis"}),ut(v,e.label.text)}),I(t,m),Pe()}let Qm;function tNe(){return Qm==null&&(Qm=document.createElement("canvas"),Qm.width=1,Qm.height=1),Qm.getContext("2d")}function jw(t,e){let n=tNe();n.font=`${e.fontSize}px ${e.fontFamily}`;let r=n.measureText(t);return{size:{width:Math.min(e.maxWidth,r.width),height:e.fontSize},fontFamily:e.fontFamily,fontSize:e.fontSize}}function qw(t,e,n,r){switch(t.type){case"band":return nNe(t,e,n,r);default:return rNe(t,e,n,r)}}function nNe(t,e,n,r){let i=[...t.domain,...t.specialValues??[]];i=Array.from(new Set(i)),n=="y"&&(i=i.reverse());let s=[],o=[];if(e){let f=e.values??i,h=e.labelPadding??6,d=WH(e,r);s=f.map(p=>{if(n=="y")return{text:p,value:p,padding:h,level:0,orientation:"horizontal",...jw(p,d)};{let m=jw(p,d);return m.size={width:m.size.height,height:m.size.width},{text:p,value:p,padding:h,level:0,orientation:"vertical",...m}}}),o=f.map(p=>({value:p,level:0}))}let a=rH().domain(i).padding(.1);n=="y"&&a.range([1,0]);let l=a.bandwidth(),u=a.step(),c={rangeBands:[[[0,0],[1,0]]],apply:f=>[(a(f)??0)+l/2,0],applyBand:f=>{let h=a(f)??0;return[[h,0],[h+l,0]]},invert(f,[h,d]){let p=(f-h)/(d-h);n=="y"&&(p=1-p);let m=Math.floor(p/u);return i[m]}};return{labels:s,gridLines:[],ticks:o,base:c,concrete:f=>XH(c,"band",t.domain,t.specialValues??[],f)}}function VH(t,e){let[n,r]=t,[i,s]=e;return o=>[n+(i-n)*o,r+(s-r)*o]}function ZH(t){let[e,n]=t;return([r,i])=>r*(n-e)+e+i}function XH(t,e,n,r,i){let s=ZH(i);return{type:e,domain:n,specialValues:r,range:i,rangeBands:t.rangeBands.map(([o,a])=>[s(o),s(a)]),apply:o=>s(t.apply(o)),applyBand:o=>{let[a,l]=t.applyBand(o),u=s(a),c=s(l);return ut.invert(o,i,a)}}function WH(t,e){return{fontFamily:t?.labelFontFamily??e.labelFontFamily,fontSize:t?.labelFontSize??e.labelFontSize,maxWidth:t?.labelMaxWidth??e.labelMaxWidth}}function rNe(t,e,n,r){let i;switch(t.type){case"linear":{i=I_().domain(t.domain);break}case"log":{i=Y1().domain(t.domain);break}case"symlog":{let d=t.constant??1;i=sH().constant(d).domain(t.domain),i.nice=()=>i,i.ticks=p=>sNe(i.domain(),d,p),i.tickFormat=()=>Ny("~s");break}default:throw new Error("invalid scale type")}let s=[],o=[];if(e){let d=[];if(e.extendScaleToTicks??!0)if(e.values){d=e.values;let O=i.domain().concat(d);i=i.domain([O.reduce((v,w)=>Math.min(v,w),O[0]),O.reduce((v,w)=>Math.max(v,w),O[0])])}else{let O=e.desiredTickCount??5;i.nice&&(i=i.nice(O)),d=i.ticks(O)}else{if(e.values)d=e.values;else{let w=e.desiredTickCount??5;d=i.ticks(w)}let[O,v]=i.domain();d=d.filter(w=>w>=O&&w<=v)}let p=e.labelPadding??6,m=i.tickFormat(e.values?e.values.length:e.desiredTickCount??5),g=O=>t.type=="log"||t.type=="symlog"?Math.round(Math.log10(Math.abs(O)))==Math.log10(Math.abs(O))?0:1:0,y=WH(e,r);s=d.map(O=>{let v=m(O);return{text:v,value:O,padding:p,level:g(O),orientation:"horizontal",...jw(v,y)}});for(let O of t.specialValues??[])s.push({text:O,value:O,padding:p,level:0,orientation:"horizontal",...jw(O,y)});o=d.map(O=>({value:O,level:g(O)}))}n=="y"&&i.range([1,0]);let{rangeBands:a,map:l}=iNe(Array.from(new Set(t.specialValues??[])),n=="x"?"start":"end"),[u,c]=a[0],f=VH(u,c),h={rangeBands:a,apply:d=>{let p=l.get(d);if(p!=null)return[(p[0][0]+p[1][0])/2,(p[0][1]+p[1][1])/2];if(d==null)return[NaN,NaN];let m=d instanceof Array&&d.length>=2?(i(d[0])+i(d[1]))/2:i(d);return f(m)},applyBand:d=>{let p=l.get(d);if(p!=null)return p;if(d==null)return[[NaN,NaN],[NaN,NaN]];if(d instanceof Array&&d.length>=2)return[f(i(d[0])),f(i(d[1]))];{let m=f(i(d));return[m,m]}},invert(d,p,m){let g=ZH(p);if(m!="number")for(let[y,[O,v]]of l.entries()){let w=g(O),x=g(v);if(d>=Math.min(w,x)&&d<=Math.max(w,x))return y}if(m!="string"){let y=g(u),O=g(c);return i.invert((d-y)/(O-y))}}};return{labels:s,gridLines:o,ticks:o,base:h,concrete:d=>XH(h,t.type,i.domain(),t.specialValues??[],d)}}function iNe(t,e){let n=[[0,0],[1,0]],r,i=new Map;if(t.length>0){let s=8,a=t.length*20;e=="start"?(n=[[0,a+s],[1,0]],r=[[0,0],[0,a]]):(n=[[0,0],[1,-a-s]],r=[[1,-a],[1,0]]);let l=VH(r[0],r[1]);for(let u=0;u({...e(a),index:l})).sort((a,l)=>a.priority-l.priority),s=t.map(a=>!1),o=(a,l)=>Math.abs(a.center-l.center)s[l])}function sNe(t,e,n){n=n??5;let r=t[0],i=t[1];if(r>0&&i>0&&r/i>.5||r<0&&i<0&&i/r>.5)return I_().domain([r,i]).ticks(n);let s=e*2,o=e*5;return r<-o&&i>o&&(n=Math.ceil(n/2)),[...r<-o?Y1().domain([s,-r]).ticks(n).map(a=>-a):[],0,...i>o?Y1().domain([s,i]).ticks(n):[]].filter(a=>a>=r&&a<=i)}function oNe(t,e){switch(t.type){case"band":{let o=t.range??e.categoryColors,a=new Map;if(typeof o=="function"){let l=o(t.domain.length);for(let u=0;ua.get(l)??e.markColorGray}}default:let r=qw({...t,specialValues:[]},null,"x",e).concrete([0,1]),i=dFe(t.range??e.interpolate),s=new Set(t.specialValues??[]);return{type:t.type,domain:t.domain,specialValues:t.specialValues??[],apply:o=>s.has(o)?e.markColorGray:i(r.apply(o))}}}function aNe(t,e){let n=[0,1e3];if(t.range instanceof Array&&t.range.length==2){let[r,i]=t.range;typeof r=="number"&&typeof i=="number"&&(n=[r,i])}switch(t.type){case"band":{let s=new Map;for(let o=0;os.get(o)??1}}default:let i=qw({...t,specialValues:[]},null,"x",e).concrete(n);return{type:t.type,domain:t.domain,specialValues:t.specialValues??[],apply:s=>i.apply(s)}}}function os(t,e,n){if(t.length==0)return[0,0];if(n=="inner"){let r=0,i=0;for(let[s,o]of t){let a=s*e+o;a<0&&(r=Math.max(r,-a)),a>e&&(i=Math.max(i,a-e))}return[r,i]}else{let r=0,i=0;for(let[s,o]of t){let a=(e-r-i)*s+r+o;a<0&&s!=1&&(r=((e-i)*s+o)/(s-1)),a>e&&s!=0&&(i=((e-r)*s+r+o-e)/s)}return[r,i]}}function Bm(t){if(typeof t=="number"&&isFinite(t)&&t>0)return t}const lNe=300,uNe=200;function cNe(t,e){let n=[],r=[];if(e?.x&&e?.x.labels.length>0)for(let d of e.x.labels){let p=e.x.base.apply(d.value);n.push([p[0],p[1]-d.size.width/2]),n.push([p[0],p[1]+d.size.width/2]),r.push([1,d.size.height+d.padding])}if(e?.y&&e?.y.labels.length>0)for(let d of e.y.labels){let p=e.y.base.apply(d.value);n.push([0,-d.size.width-d.padding]),r.push([p[0],p[1]-d.size.height/2]),r.push([p[0],p[1]+d.size.height/2])}let{width:i,height:s,plotWidth:o,plotHeight:a,plotAspectRatio:l}=t;i=Bm(i),s=Bm(s),o=Bm(o),a=Bm(a),l=Bm(l);let u=0,c=0,f=0,h=0;if(l==null)i==null&&o!=null?([u,c]=os(n,o,"inner"),i=o+u+c):(i=i??lNe,[u,c]=os(n,i,"outer"),o=i-u-c),s==null&&a!=null?([f,h]=os(r,a,"inner"),s=a+f+h):(s=s??uNe,[f,h]=os(r,s,"outer"),a=s-f-h);else if(o!=null||a!=null){if(o!=null)a=o/l;else if(a!=null)o=a*l;else throw new Error("unreachable");let[d,p]=os(n,o,"inner"),[m,g]=os(r,a,"inner");return i=i??o+d+p,s=s??a+m+g,{width:i,height:s,plotRect:{x:d,y:m,width:o,height:a}}}else if(s==null){i=i??400,[u,c]=os(n,i,"outer");let d=i-u-c,p=d/l;return[f,h]=os(r,p,"inner"),s=p+f+h,{width:i,height:s,plotRect:{x:u,y:f,width:d,height:p}}}else{if(i==null)return s=s??400,[f,h]=os(r,s,"outer"),a=s-f-h,o=a*l,[u,c]=os(r,o,"inner"),i=o+u+c,{width:i,height:s,plotRect:{x:u,y:f,width:o,height:a}};[u,c]=os(n,i,"outer"),o=i-u-c,a=o/l,[f,h]=os(r,a,"inner"),f+h+a>s&&([f,h]=os(r,s,"outer"),a=s-f-h,o=a*l,[u,c]=os(n,o,"inner"))}return{width:i,height:s,plotRect:{x:u,y:f,width:o,height:a}}}var fNe=ft(''),hNe=ft(''),dNe=ft(""),pNe=ft(''),mNe=ft(''),gNe=ft(""),yNe=G("
    ");function YH(t,e){De(e,!0);const n=4;let r=Xe(e,"xAxis",19,()=>({})),i=Xe(e,"yAxis",19,()=>({})),s=L(()=>e.xScale?qw(e.xScale,r(),"x",e.theme):void 0),o=L(()=>e.yScale?qw(e.yScale,i(),"y",e.theme):void 0),a=L(()=>cNe({width:e.width,height:e.height,plotWidth:e.plotWidth,plotHeight:e.plotHeight,plotAspectRatio:e.plotAspectRatio},{x:b(s),y:b(o)})),l=L(()=>b(a).width),u=L(()=>b(a).height),c=L(()=>b(a).plotRect.x),f=L(()=>b(a).plotRect.y),h=L(()=>b(a).plotRect.width),d=L(()=>b(a).plotRect.height),p=L(()=>b(s)?.concrete([0,b(h)])),m=L(()=>b(o)?.concrete([0,b(d)])),g=L(()=>b(s)&&b(p)?I$(b(s).labels,T=>({center:b(p).apply(T.value),length:T.size.width,priority:T.level}),{gap:4}):[]),y=L(()=>b(o)&&b(m)?I$(b(o).labels,T=>({center:b(m).apply(T.value),length:T.size.height,priority:T.level}),{gap:2}):[]),O=L(()=>({plotWidth:b(h),plotHeight:b(d),scale:{x:b(p),y:b(m),...e.otherScales??{}}}));var v=yNe();let w;var x=M(v);Ve(x,"",{},{position:"absolute",left:"-4px",top:"-4px"});var S=M(x),_=M(S);Eo(_,()=>e.childrenBelow??Cn,()=>b(O));var k=V(_);{var C=T=>{var R=dNe(),$=M(R);Ot($,17,()=>b(s).ticks,Wt,(q,z)=>{const ee=L(()=>b(p).apply(b(z).value));var W=fNe();de(()=>{ne(W,"x1",b(ee)),ne(W,"y1",b(d)),ne(W,"x2",b(ee)),ne(W,"y2",b(d)+(b(z).level==0?3:0)),ne(W,"stroke",e.theme.gridColor),ne(W,"stroke-opacity",b(z).level==0?1:.4)}),I(q,W)});var Q=V($);Ot(Q,17,()=>b(s).gridLines,Wt,(q,z)=>{const ee=L(()=>b(p).apply(b(z).value));var W=ot(),K=ke(W);Ot(K,17,()=>b(m)?.rangeBands??[],Wt,(H,J)=>{var Y=L(()=>OT(b(J),2));let Z=()=>b(Y)[0],he=()=>b(Y)[1];var me=hNe();de((te,le)=>{ne(me,"x1",b(ee)),ne(me,"y1",te),ne(me,"x2",b(ee)),ne(me,"y2",le),ne(me,"stroke",e.theme.gridColor),ne(me,"stroke-opacity",b(z).level==0?1:.4)},[()=>Math.min(Z(),he()),()=>Math.max(Z(),he())]),I(H,me)}),I(q,W)});var B=V(Q);Ot(B,17,()=>b(g),Wt,(q,z)=>{R$(q,{get label(){return b(z)},dimension:"x",get proxy(){return b(O)},get color(){return e.theme.labelColor}})}),F(R),I(T,R)};oe(k,T=>{b(s)&&b(p)&&r()&&T(C)})}var D=V(k);{var A=T=>{var R=gNe(),$=M(R);Ot($,17,()=>b(o).ticks,Wt,(q,z)=>{const ee=L(()=>b(m).apply(b(z).value));var W=pNe();ne(W,"x2",0),de(()=>{ne(W,"x1",-(b(z).level==0?3:0)),ne(W,"y1",b(ee)),ne(W,"y2",b(ee)),ne(W,"stroke",e.theme.gridColor),ne(W,"stroke-opacity",b(z).level==0?1:.4)}),I(q,W)});var Q=V($);Ot(Q,17,()=>b(o).gridLines,Wt,(q,z)=>{const ee=L(()=>b(m).apply(b(z).value));var W=ot(),K=ke(W);Ot(K,17,()=>b(p)?.rangeBands??[],Wt,(H,J)=>{var Y=L(()=>OT(b(J),2));let Z=()=>b(Y)[0],he=()=>b(Y)[1];var me=mNe();de(()=>{ne(me,"x1",Z()),ne(me,"y1",b(ee)),ne(me,"x2",he()),ne(me,"y2",b(ee)),ne(me,"stroke",e.theme.gridColor),ne(me,"stroke-opacity",b(z).level==0?1:.4)}),I(H,me)}),I(q,W)});var B=V(Q);Ot(B,17,()=>b(y),Wt,(q,z)=>{R$(q,{get label(){return b(z)},dimension:"y",get proxy(){return b(O)},get color(){return e.theme.labelColor}})}),F(R),I(T,R)};oe(D,T=>{b(o)&&b(m)&&i()&&T(A)})}var E=V(D);Eo(E,()=>e.children??Cn,()=>b(O)),F(S),F(x),F(v),de(()=>{w=Ve(v,"",w,{width:`${b(l)??""}py`,height:`${b(u)??""}px`,position:"relative","user-select":"none","-webkit-user-select":"none",cursor:"default"}),ne(x,"width",b(l)+n*2),ne(x,"height",b(u)+n*2),ne(S,"transform",`translate(${n+b(c)},${n+b(f)})`)}),I(t,v),Pe()}var bNe=ft('',1),ONe=ft('',1),vNe=ft('',1),wNe=ft('',1),xNe=ft('');function _Ne(t,e){De(e,!0);const n=8;let r,i=L(()=>e.proxy.scale.x!=null&&e.value?.x!=null?e.proxy.scale.x.applyBand(e.value.x):[0,e.proxy.plotWidth]),s=L(()=>e.proxy.scale.y!=null&&e.value?.y!=null?e.proxy.scale.y.applyBand(e.value.y):[0,e.proxy.plotHeight]);function o(m){return m instanceof Array&&m.length==2&&typeof m[0]=="number"&&typeof m[1]=="number"}function a(m,g,y){let O=m.invert(g,y);if(m.domain.length==2&&typeof m.domain[0]=="number"&&typeof O=="number"){let[v,w]=m.domain;return Math.max(Math.min(v,w),Math.min(Math.max(v,w),O))}return O}function l(m,g){return(g=="x"||g=="xy")&&m.x==null?!1:!((g=="y"||g=="xy")&&m.y==null)}function u(){return m=>{let g=r.getBoundingClientRect().left,y=r.getBoundingClientRect().top,O=m.clientX-g,v=m.clientY-y,w=e.proxy.scale.x?a(e.proxy.scale.x,O):null,x=e.proxy.scale.y?a(e.proxy.scale.y,v):null;if(w==null&&(e.mode=="x"||e.mode=="xy")||x==null&&(e.mode=="y"||e.mode=="xy"))return;let S=(C,D)=>typeof C=="number"&&typeof D=="number"?C!=D?[Math.min(C,D),Math.max(C,D)]:null:D,_=C=>C==null?void 0:typeof C=="number"?"number":"string",k=C=>{let D=C.clientX-g,A=C.clientY-y,E=e.proxy.scale.x?a(e.proxy.scale.x,D,_(w))??w:null,T=e.proxy.scale.y?a(e.proxy.scale.y,A,_(x))??x:null,R={};return(e.mode=="x"||e.mode=="xy")&&(R.x=S(w,E)),(e.mode=="y"||e.mode=="xy")&&(R.y=S(x,T)),l(R,e.mode)?R:null};return{move:C=>{e.onChange(k(C))},up:C=>{e.onChange(k(C))}}}}function c(m){return g=>{if(e.value==null)return;let y={...e.value},{x:O,y:v}=e.proxy.scale,w=o(y.x),x=o(y.y),S=[...O&&y.x?O.applyBand(y.x):[0,0],...v&&y.y?v.applyBand(y.y):[0,0]];if(!w){let k=Math.max(m[0],m[1]);m=[k,k,m[2],m[3]]}if(!x){let k=Math.max(m[2],m[3]);m=[m[0],m[1],k,k]}let _=k=>{let C=k.pageX-g.pageX,D=k.pageY-g.pageY,A=[C,C,D,D].map((T,R)=>S[R]+T*m[R]),E={...y};if(O&&(e.mode=="x"||e.mode=="xy"))if(w){let T=a(O,A[0],"number"),R=a(O,A[1],"number");E.x=T==R?null:T{e.onChange(_(k))},up:k=>{let C=_(k);C&&!w&&!x&&C.x==y.x&&C.y==y.y&&(C=null),e.onChange(C)}}}}var f=xNe(),h=M(f);ne(h,"x",0),ne(h,"y",0),Ve(h,"",{},{"pointer-events":"fill","user-select":"none",cursor:"crosshair"}),lr(h,m=>r=m,()=>r),Zn(h,(m,g)=>sn?.(m,g),()=>({click:m=>{if(e.value!=null)e.onChange(null);else{let g=u()(m);g&&(g.move(m),g.up(m))}},drag:u()}));var d=V(h);{var p=m=>{var g=wNe(),y=ke(g);let O;var v=V(y);let w;Zn(v,(A,E)=>sn?.(A,E),()=>({drag:c([1,1,1,1])}));var x=V(v);{var S=A=>{var E=bNe(),T=ke(E);ne(T,"width",n),Ve(T,"",{},{cursor:"ew-resize",stroke:"none",fill:"none","pointer-events":"all"}),Zn(T,($,Q)=>sn?.($,Q),()=>({drag:c([1,0,0,0])}));var R=V(T);ne(R,"width",n),Ve(R,"",{},{cursor:"ew-resize",stroke:"none",fill:"none","pointer-events":"all"}),Zn(R,($,Q)=>sn?.($,Q),()=>({drag:c([0,1,0,0])})),de(($,Q,B,q)=>{ne(T,"x",b(i)[0]-n/2),ne(T,"y",$),ne(T,"height",Q),ne(R,"x",b(i)[1]-n/2),ne(R,"y",B),ne(R,"height",q)},[()=>Math.min(b(s)[0],b(s)[1]),()=>Math.abs(b(s)[0]-b(s)[1]),()=>Math.min(b(s)[0],b(s)[1]),()=>Math.abs(b(s)[0]-b(s)[1])]),I(A,E)};oe(x,A=>{(e.mode=="x"||e.mode=="xy")&&o(e.value.x)&&A(S)})}var _=V(x);{var k=A=>{var E=ONe(),T=ke(E);ne(T,"height",n),Ve(T,"",{},{cursor:"ns-resize",stroke:"none",fill:"none","pointer-events":"all"}),Zn(T,($,Q)=>sn?.($,Q),()=>({drag:c([0,0,1,0])}));var R=V(T);ne(R,"height",n),Ve(R,"",{},{cursor:"ns-resize",stroke:"none",fill:"none","pointer-events":"all"}),Zn(R,($,Q)=>sn?.($,Q),()=>({drag:c([0,0,0,1])})),de(($,Q,B,q)=>{ne(T,"x",$),ne(T,"width",Q),ne(T,"y",b(s)[0]-n/2),ne(R,"x",B),ne(R,"width",q),ne(R,"y",b(s)[1]-n/2)},[()=>Math.min(b(i)[0],b(i)[1]),()=>Math.abs(b(i)[0]-b(i)[1]),()=>Math.min(b(i)[0],b(i)[1]),()=>Math.abs(b(i)[0]-b(i)[1])]),I(A,E)};oe(_,A=>{(e.mode=="y"||e.mode=="xy")&&o(e.value.y)&&A(k)})}var C=V(_);{var D=A=>{var E=vNe(),T=ke(E);ne(T,"width",n),ne(T,"height",n),Ve(T,"",{},{cursor:"nesw-resize",stroke:"none",fill:"none","pointer-events":"all"}),Zn(T,(B,q)=>sn?.(B,q),()=>({drag:c([1,0,1,0])}));var R=V(T);ne(R,"width",n),ne(R,"height",n),Ve(R,"",{},{cursor:"nwse-resize",stroke:"none",fill:"none","pointer-events":"all"}),Zn(R,(B,q)=>sn?.(B,q),()=>({drag:c([1,0,0,1])}));var $=V(R);ne($,"width",n),ne($,"height",n),Ve($,"",{},{cursor:"nwse-resize",stroke:"none",fill:"none","pointer-events":"all"}),Zn($,(B,q)=>sn?.(B,q),()=>({drag:c([0,1,1,0])}));var Q=V($);ne(Q,"width",n),ne(Q,"height",n),Ve(Q,"",{},{cursor:"nesw-resize",stroke:"none",fill:"none","pointer-events":"all"}),Zn(Q,(B,q)=>sn?.(B,q),()=>({drag:c([0,1,0,1])})),de(()=>{ne(T,"x",b(i)[0]-n/2),ne(T,"y",b(s)[0]-n/2),ne(R,"x",b(i)[0]-n/2),ne(R,"y",b(s)[1]-n/2),ne($,"x",b(i)[1]-n/2),ne($,"y",b(s)[0]-n/2),ne(Q,"x",b(i)[1]-n/2),ne(Q,"y",b(s)[1]-n/2)}),I(A,E)};oe(C,A=>{e.mode=="xy"&&o(e.value.x)&&o(e.value.y)&&A(D)})}de((A,E,T,R,$,Q,B,q)=>{ne(y,"x",A),ne(y,"width",E),ne(y,"y",T),ne(y,"height",R),O=Ve(y,"",O,{stroke:e.theme.brushBorderBack,fill:"none","stroke-width":2}),ne(v,"x",$),ne(v,"width",Q),ne(v,"y",B),ne(v,"height",q),w=Ve(v,"",w,{stroke:e.theme.brushBorder,fill:e.theme.brushFill,cursor:"move"})},[()=>Math.min(b(i)[0],b(i)[1]),()=>Math.abs(b(i)[0]-b(i)[1]),()=>Math.min(b(s)[0],b(s)[1]),()=>Math.abs(b(s)[0]-b(s)[1]),()=>Math.min(b(i)[0],b(i)[1]),()=>Math.abs(b(i)[0]-b(i)[1]),()=>Math.min(b(s)[0],b(s)[1]),()=>Math.abs(b(s)[0]-b(s)[1])]),I(m,g)};oe(d,m=>{b(i)&&b(s)&&e.value&&m(p)})}F(f),de(()=>{ne(h,"width",e.proxy.plotWidth),ne(h,"height",e.proxy.plotHeight)}),I(t,f),Pe()}var SNe=ft('');function kNe(t,e){De(e,!0);let n=L(()=>e.proxy.scale.x&&e.xDomain?e.proxy.scale.x.apply(e.xDomain[0]):0),r=L(()=>e.proxy.scale.x&&e.xDomain?e.proxy.scale.x.apply(e.xDomain[1]):e.proxy.plotWidth),i=L(()=>e.proxy.scale.y&&e.yDomain?e.proxy.scale.y.apply(e.yDomain[0]):0),s=L(()=>e.proxy.scale.y&&e.yDomain?e.proxy.scale.y.apply(e.yDomain[1]):e.proxy.plotHeight),o=pe(null),a=document.createElement("canvas");An(()=>{a.width=e.rasterWidth,a.height=e.rasterHeight;let u=a.getContext("2d",{colorSpace:"srgb",willReadFrequently:!0});u.clearRect(0,0,a.width,a.height);let c=u.getImageData(0,0,a.width,a.height),f=0;for(let h=0;h{ne(l,"x",u),ne(l,"y",c),ne(l,"width",f),ne(l,"height",h),ne(l,"href",b(o))},[()=>Math.min(b(n),b(r)),()=>Math.min(b(i),b(s)),()=>Math.abs(b(n)-b(r)),()=>Math.abs(b(i)-b(s))]),I(t,l),Pe()}var CNe=G('
    '),ANe=G('
    '),ENe=ft(""),TNe=ft("",1),DNe=G('
    '),PNe=G('
    ');function RNe(t,e){De(e,!0);var n=PNe(),r=M(n);{var i=o=>{var a=ANe();Ot(a,21,()=>e.scale.domain.concat(e.scale.specialValues??[]),Wt,(l,u)=>{const c=L(()=>e.scale.apply(b(u)));var f=CNe(),h=M(f);let d;var p=V(h,2),m=M(p,!0);F(p),F(f),de(()=>{ne(f,"title",b(u)),d=Ve(h,"",d,{background:b(c)}),ut(m,b(u))}),I(l,f)}),F(a),I(o,a)},s=o=>{var a=DNe(),l=M(a);qH(l,{children:(c,f=Cn,h=Cn)=>{{const d=(m,g=Cn)=>{var y=TNe(),O=ke(y);{let w=L(()=>g().scale.x?.domain);kNe(O,{color:x=>e.scale.apply(x),rasterWidth:100,rasterHeight:1,get proxy(){return g()},get xDomain(){return b(w)}})}var v=V(O);Ot(v,17,()=>e.scale.specialValues??[],Wt,(w,x)=>{const S=L(()=>{const[k,C]=g().scale.x?.applyBand(b(x))??[NaN,NaN];return{x0:k,x1:C}});var _=ENe();ne(_,"y",0),de((k,C,D)=>{ne(_,"x",k),ne(_,"width",C),ne(_,"height",g().plotHeight),ne(_,"fill",D)},[()=>Math.min(b(S).x0,b(S).x1),()=>Math.abs(b(S).x1-b(S).x0),()=>e.scale.apply(b(x))]),I(w,_)}),I(m,y)};let p=L(()=>({type:e.outputs.scale.color.type??"linear",domain:e.scale.domain,specialValues:e.scale.specialValues}));YH(c,{get xScale(){return b(p)},xAxis:{extendScaleToTicks:!1},get width(){return f()},plotHeight:8,get theme(){return e.theme},children:d,$$slots:{default:!0}})}},$$slots:{default:!0}}),F(a),I(o,a)};oe(r,o=>{e.scale.type=="band"?o(i):o(s,!1)})}F(n),I(t,n),Pe()}function uh(t,e,n){return{length:t.length,at:r=>e(t[r])}}function V_(t,e){return{length:t,at:()=>e}}function ff({proxy:t,data:e},n){let r=e.columns[n],i=t.scale[n];return r!=null&&i!=null?uh(r,i.apply):V_(e.length,n=="x"?t.plotWidth/2:t.plotHeight/2)}function INe(t){if(typeof t=="number"){let e=t/2;return([n,r])=>[(n+r)/2-e,(n+r)/2+e]}else if(t!=null){if("gap"in t){let{gap:e,clampToRatio:n}=t;return([r,i])=>{let s=Math.min(e/2,(n??0)*Math.abs(r-i)/2);return r[n+(r-n)*e,r+(n-r)*e]}}}function ll({proxy:t,data:e},n,r){let i=INe(r),s=e.columns[n],o=t.scale[n];if(s!=null&&o!=null)return i?uh(s,u=>i(o.applyBand(u))):uh(s,o.applyBand);let a=e.columns[n+"1"],l=e.columns[n+"2"];if(a!=null&&l!=null&&o!=null){let u=a.map((c,f)=>[c,l[f]]);return i?uh(u,([c,f])=>i([o.apply(c),o.apply(f)])):uh(u,([c,f])=>[o.apply(c),o.apply(f)])}return V_(e.length,n=="x"?[0,t.plotWidth]:[0,t.plotHeight])}function GH({proxy:t,data:e,theme:n}){return e.columns.color!=null&&t.scale.color!=null?uh(e.columns.color,t.scale.color.apply):V_(e.length,n.markColor)}function HH({proxy:t,data:e},n){return e.columns.size!=null&&t.scale.size!=null?uh(e.columns.size,t.scale.size.apply):V_(e.length,n??100)}function Vw(t){let e=Object.keys(t.columns).filter(r=>r!="x"&&r!="y"),n=new Map;for(let r=0;rt.columns[o][r])),s=n.get(i);s==null?n.set(i,[r]):s.push(r)}return Array.from(n.values())}function wC(t,e){switch(t){case"monotone":return e=="horizontal"?oFe:sFe;case"basis":return tFe;case"natural":return aFe;case"step":return lFe;case"step-before":return uFe;case"step-after":return cFe;case"catmull-rom":return iFe;case"cardinal":return nFe;case"linear":return Mw;default:return console.warn(`Unknown interpolate: ${t}`),Mw}}function KH(t,e,n,r){let i=n.orientation??"vertical",s=ff(t,"x"),o=ff(t,"y"),a=e.filter(u=>isFinite(s.at(u))&&isFinite(o.at(u))).sort((u,c)=>s.at(u)-s.at(c)),l=fH().x(u=>s.at(u)).y(u=>o.at(u)).curve(wC(n.interpolate,i));return r&&l.context(r),l(a)}function JH(t,e,n,r){let i=n.orientation??"vertical";if(i=="vertical"){let s=ff(t,"x"),o=ll(t,"y",void 0),a=e.filter(u=>isFinite(s.at(u))&&isFinite(o.at(u)[0])&&isFinite(o.at(u)[1])).sort((u,c)=>s.at(u)-s.at(c)),l=u$().x(u=>s.at(u)).y0(u=>o.at(u)[0]).y1(u=>o.at(u)[1]).curve(wC(n.interpolate,i));return r&&l.context(r),l(a)}else{let s=ll(t,"x",void 0),o=ff(t,"y"),a=e.filter(u=>isFinite(o.at(u))&&isFinite(s.at(u)[0])&&isFinite(s.at(u)[1])).sort((u,c)=>o.at(u)-o.at(c)),l=u$().y(u=>o.at(u)).x0(u=>s.at(u)[0]).x1(u=>s.at(u)[1]).curve(wC(n.interpolate,i));return r&&l.context(r),l(a)}}function zm(t,e){let n=GH(t);function r(s){if(s==null)return"none";if(s!="$encoding")return s.startsWith("$")?t.theme[s.substring(1)]??s:s}let i={"stroke-width":e.strokeWidth,"stroke-linecap":e.strokeCap,"stroke-linejoin":e.strokeJoin,"stroke-opacity":e.strokeOpacity,"fill-opacity":e.fillOpacity,"paint-order":e.paintOrder,opacity:e.opacity,fill:r(e.fillColor),stroke:r(e.strokeColor)};return{length:t.data.length,at:s=>{let o={...i};return e.fillColor=="$encoding"&&(o.fill=n.at(s)),e.strokeColor=="$encoding"&&(o.stroke=n.at(s)),o}}}function Um(t,e){let n=GH(t);function r(s){if(s==null)return"none";if(s!="$encoding")return s.startsWith("$")?t.theme[s.substring(1)]??s:s}let i=e.paintOrder!="stroke fill";return{prepare:s=>{s.lineWidth=e.strokeWidth??1,s.lineCap=e.strokeCap??"butt",s.lineJoin=e.strokeJoin??"bevel",s.globalAlpha=e.opacity??1;let o=r(e.fillColor),a=r(e.strokeColor);o!=null&&(s.fillStyle=o),a!=null&&(s.strokeStyle=a)},draw:(s,o)=>{e.fillColor=="$encoding"&&(s.fillStyle=n.at(o)),e.strokeColor=="$encoding"&&(s.strokeStyle=n.at(o));let a=(e.opacity??1)*(e.fillOpacity??1),l=(e.opacity??1)*(e.strokeOpacity??1);i?(e.fillColor!=null&&a>0&&(s.globalAlpha=a,s.fill()),e.strokeColor!=null&&l>0&&(s.globalAlpha=l,s.stroke())):(e.strokeColor!=null&&l>0&&(s.globalAlpha=l,s.stroke()),e.fillColor!=null&&a>0&&(s.globalAlpha=a,s.fill()))}}}var FNe=ft("");function F$(t,e){De(e,!0);let n;function r(o,a,l){let u=document.createElementNS("http://www.w3.org/2000/svg",o);for(const[c,f]of Object.entries(a))u.setAttribute(c,f);for(const[c,f]of Object.entries(l))u.setAttribute(c,f);return u}function*i(o,a){let l=[];switch(a.primitive){case"rect":{const u=ll(o,"x",a.xDimension),c=ll(o,"y",a.yDimension),f=zm(o,a.style);for(let h=0;h{let o=i({proxy:e.proxy,data:e.layer.data,theme:e.theme},e.layer),a=document.createDocumentFragment();for(let l of o)a.appendChild(l);n.replaceChildren(a)});var s=FNe();lr(s,o=>n=o,()=>n),I(t,s),Pe()}function $Ne(t,e,n){switch(n.primitive){case"rect":{const r=ll(e,"x",n.xDimension),i=ll(e,"y",n.yDimension);let s=Um(e,n.style);s.prepare(t);for(let o=0;o");function $$(t,e){De(e,!0);let n=L(()=>e.proxy.plotWidth),r=L(()=>e.proxy.plotHeight),i=24,s=2,o;ki(()=>{MNe(o,i,s,{proxy:e.proxy,data:e.layer.data,theme:e.theme},e.layer)});var a=LNe();ne(a,"x",-i),ne(a,"y",-i);var l=M(a);let u;lr(l,c=>o=c,()=>o),F(a),de(()=>{ne(a,"width",b(n)+i*2),ne(a,"height",b(r)+i*2),ne(l,"width",(b(n)+i*2)*s),ne(l,"height",(b(r)+i*2)*s),u=Ve(l,"",u,{width:`${b(n)+i*2}px`,height:`${b(r)+i*2}px`})}),I(t,a),Pe()}var NNe=G(' ');function QNe(t,e){De(e,!0);let n=Xe(e,"value",15);const r=["linear","log","symlog"];var i=ot(),s=ke(i);{var o=a=>{var l=NNe(),u=M(l),c=M(u);F(u);var f=V(u,2);{let h=L(()=>r.map(d=>({value:d,label:d})));bw(f,{get options(){return b(h)},get value(){return n()},onChange:d=>n(d)})}F(l),de(()=>ut(c,`${e.label??""}:`)),I(a,l)};oe(s,a=>{n()!=null&&n()!="band"&&a(o)})}I(t,i),Pe()}var BNe=G('Normalize: '),zNe=G('
    ');function UNe(t,e){De(e,!0);var n=zNe();Ot(n,21,()=>e.spec.widgets??[],Wt,(r,i)=>{var s=ot(),o=ke(s);{var a=u=>{var c=()=>e.outputs.scale[b(i).channel].type??"linear",f=h=>{e.onSpecChange({scale:{[b(i).channel]:{type:h}}})};{let h=L(()=>b(i).channel.toUpperCase());QNe(u,{get label(){return b(h)},get value(){return c()},set value(d){f(d)}})}},l=u=>{var c=ot(),f=ke(c);{var h=d=>{const p=L(()=>typeof b(i).layer=="number"?[b(i).layer]:b(i).layer);var m=BNe(),g=V(M(m),2);{let y=L(()=>[{value:null,label:"off"},...(b(i).options??["x","y"]).map(v=>({value:v,label:v.toUpperCase()}))]),O=L(()=>e.spec.layers?.[b(p)[0]]?.encoding?.[b(i).attribute]?.normalize??null);bw(g,{get options(){return b(y)},get value(){return b(O)},onChange:v=>{let w=JSON.parse(JSON.stringify(e.spec));for(let x of b(p))if(w.layers?.[x]?.encoding?.[b(i).attribute]!=null){let S=w.layers?.[x]?.encoding?.[b(i).attribute];S.normalize=v??void 0}e.onSpecChange(w,"replace")}})}F(m),I(d,m)};oe(f,d=>{b(i).type=="encoding.normalize"&&d(h)},!0)}I(u,c)};oe(o,u=>{b(i).type=="scale.type"?u(a):u(l,!1)})}I(r,s)}),F(n),I(t,n),Pe()}async function jNe(t,e,n){let r=a=>t.query(a),s=(await r(Be.describe(Be.from(e).select({field:n})))).get(0)?.column_type;if(s==null)return;let o=G1(s);if(o=="number"){let a=Hn(n,"DOUBLE"),l=await r(Be.from(e).select({count:Cr(),min:Vg(a),minPositive:Vg(Zf(xx(a,0),a,Ae(null))),max:wx(a),mean:Cv(a),median:C6(a)}).where(Fc(a))),u=await r(Be.from(e).select({countNonFinite:Cr()}).where(_o(Xp(Fc(a)),Eu(a))));return{field:n,quantitative:{...l.get(0),...u.get(0)}}}else if(o=="string"){let a=Hn(n,"TEXT"),l=Array.from(await r(Be.from(e).select({value:a,count:Cr()}).where(Th(a)).groupby(a).orderby(fp(Cr())).limit(1e3))),u=(await r(Be.from(e).select({count:Cr()}).where(Eu(a)))).get(0).count,{otherCount:c,numOtherLevels:f}=(await r(Be.from(e).select({otherCount:Cr(),numOtherLevels:Ze`COUNT(DISTINCT(${a}))`}).where(Th(a),Xp(Dh(a,l.map(h=>Ae(h.value))))))).get(0);return{field:n,nominal:{levels:l,numOtherLevels:f,otherCount:c,nullCount:u}}}}function qNe({stats:t,scaleType:e,binCount:n}){if(t.quantitative){let r=jH(t.quantitative,{scale:e,desiredCount:n??20}),i=Hn(t.field,"DOUBLE"),s=r.scale.expr(i,r.scale.constant??0),o=r.scale.type=="log"?Zf(xs(Fc(i),xx(i,Ae(0))),Ev(Or(Er(s,r.binStart),1/r.binSize)),Ae(null)):Zf(Fc(i),Ev(Or(Er(s,r.binStart),1/r.binSize)),Ae(null)),a=p=>Math.floor((r.scale.forward(p,r.scale.constant??0)-r.binStart)/r.binSize),l=p=>r.scale.reverse(p*r.binSize+r.binStart,r.scale.constant??0),u=a(r.scale.type=="log"?t.quantitative.minPositive:t.quantitative.min),c=a(t.quantitative.max),f=[l(u),l(c+1)],h=t.quantitative.countNonFinite>0;r.scale.type=="log"&&t.quantitative.min<0&&(h=!0);let d=p=>{if(typeof p=="string"){if(p=="n/a")return _o(Xp(Fc(i)),Eu(i))}else if(p instanceof Array)if(p.length==2&&typeof p[0]=="number"){let[m,g]=p;if(typeof m=="number"&&typeof g=="number")return vu(i,[Math.min(m,g),Math.max(m,g)])}else return _o(...p.map(d));return Ae(!1)};return{select:o,scale:{type:r.scale.type,constant:r.scale.constant,domain:f,specialValues:h?["n/a"]:[]},predicate:d,order:(p,m)=>{let g=typeof p=="string"?[1,0]:[0,p[0]],y=typeof m=="string"?[1,0]:[0,m[0]];return g[0]!=y[0]?g[0]-y[0]:g[1]-y[1]},field:p=>p==null?"n/a":[l(p),l(p+1)]}}if(t.nominal){n=n??15;let{levels:r,nullCount:i,otherCount:s,numOtherLevels:o}=t.nominal;r.length>n&&(o+=r.length-n,s=r.slice(n).reduce((p,m)=>p+m.count,0),r=r.slice(0,n));let a=`(${o.toLocaleString()} others)`,l="(null)",u=Hn(t.field,"TEXT"),c=Zf(Dh(u,r.map(p=>Ae(p.value))),u,Zf(Eu(u),Ae(l),Ae(a))),f=[...s>0?[a]:[],...i>0?[l]:[]],h=p=>p==l?Eu(u):p==a?xs(Xp(Dh(u,r.map(m=>Ae(m.value)))),Th(u)):T6(u,Ae(p)),d=r.map(p=>p.value);return{select:c,scale:{type:"band",domain:r.map(p=>p.value),specialValues:f},field:p=>p,predicate:p=>p instanceof Array?_o(...p.map(m=>h(m))):h(p.toString()),order:(p,m)=>{if(typeof p=="string"&&typeof m=="string"){let g=d.indexOf(p);g<0&&(g=d.length+f.indexOf(p));let y=d.indexOf(m);return y<0&&(y=d.length+f.indexOf(m)),g-y}return 0}}}}class VNe{context;spec;source;cleanupFn;outputs;selections;state;constructor(e,n){this.context=e,this.spec=void 0,this.outputs=Xi(void 0),this.state=Xi(void 0),this.selections=Xi(void 0),this.source={reset:()=>{n?.()}}}async setSpec(e){if(Bg(e,this.spec))return;this.cleanup(),this.spec=e;let n=new ZNe(this.context,this.spec);if(n.stats=await XNe(n),this.spec!==e)return;let r=WNe(n,this.outputs,this.selections),i,s=ty([this.selections,this.state],o=>o).subscribe(([o,a])=>{for(let l of o??[]){let u=a?.[l.key],c=l.clause(u);i&&i.selection===l&&Bg(i.value,u)||(i={selection:l,value:u},c?this.context.filter.update({source:this.source,clients:new Set(r),...c}):this.context.filter.update({source:this.source,clients:new Set(r),value:null,predicate:null}))}});this.cleanupFn=()=>{this.source.reset(),this.state.set(void 0),s();for(let o of r)try{o.destroy()}catch{}}}cleanup(){this.cleanupFn?.(),this.cleanupFn=void 0,this.spec=void 0}destroy(){this.cleanup(),this.outputs.set(void 0),this.state.set(void 0),this.selections.set(void 0)}}class ZNe{constructor(e,n,r={}){this.context=e,this.spec=n,this.stats=r}fieldExpr(e){let n={table:this.context.table,filter:"(true)"};return typeof e=="string"?ae(e):Ze`${gC(e.sql,n)}`}fromExpr(e,n){let r={table:this.context.table,filter:n??"(true)"};return typeof e=="string"?new S6(e):Ze`(${gC(e.sql,r)})`}}function eK(t,e){return JSON.stringify([t.toString(),e])}async function XNe(t){let e={};(t.spec.layers??[]).forEach(i=>{let s=t.fromExpr(i.from??t.context.table);Object.entries(i.encoding??{}).forEach(([o,a])=>{if("field"in a&&!("aggregate"in a)){let l=eK(s,a.field);e[l]=t.context.cache.value("field-stats/"+l,()=>jNe(t.context.coordinator,s,t.fieldExpr(a.field)))}})});let n=Object.entries(e),r=await Promise.all(n.map(i=>i[1]));return Object.fromEntries(n.map(([i,s],o)=>[i,r[o]]))}function WNe(t,e,n){let r=[],i={},s=[];return(t.spec.layers??[]).forEach((a,l)=>{let{client:u,outputs:c,scaleHints:f}=YNe(t,a,l);for(let h in f)i[h]?i[h]=rK(i[h],f[h]):i[h]=f[h];u!=null&&r.push(u),s.push(c)}),ty(s,a=>a).subscribe(a=>{e.set(KNe(t.spec,i,a))}),n.set(JNe(t.spec,i)),r}function YNe(t,e,n){let r={},i={},s={},o={},a=[],l={},u=t.fromExpr(e.from??t.context.table),c=!1;Object.entries(e.encoding??{}).forEach(([h,d])=>{("aggregate"in d||"field"in d&&d.bin!=null)&&(c=!0)}),Object.entries(e.encoding??{}).forEach(([h,d])=>{let p=nK(h),m=GNe(t,u,p,d,c);m!=null&&(m.select!=null&&(s[h]=m.select),m.normalize!=null&&(o[h]=m.normalize),m.grouping!=null&&(a=a.concat(m.grouping)),m.mapper!=null&&(i[h]=m.mapper),m.order!=null&&(l[h]=m.order),p!=null&&m.scale!=null&&(r[p]==null?r[p]=m.scale:r[p]=rK(r[p],m.scale)))});let f=Xi(void 0);if(Object.keys(s).length==0){let h={length:1,columns:{}};for(let p in i)h.columns[p]=[i[p](void 0)];return{outputs:Xi(U$(e,n,h,l)),scaleHints:r}}else{let h=e.filter=="$filter";typeof e.from=="object"&&e.from.sql.indexOf("$filter")>=0&&(h=!0);let d=Ph({coordinator:t.context.coordinator,selection:h?t.context.filter:void 0,query:p=>{let m=Be.from(t.fromExpr(e.from??t.context.table,L_(p))).select(s).where(e.filter=="$filter"?p:[]).groupby(...a);return Object.keys(o).length==0?m:Be.from(m).select(Object.fromEntries(Object.entries(s).map(([g,y])=>[g,o[g]!=null?Ze`${ae(g)} / (SUM(${ae(g)}) OVER (PARTITION BY ${ae(o[g])}))`:g])))},queryResult:p=>{let m={length:p.numRows,columns:{}};for(let g of p.names)m.columns[g]=Array.from(p.getChild(g));for(let g in i)m.columns[g]?m.columns[g]=m.columns[g].map(i[g]):m.columns[g]=Array.from({length:m.length},()=>i[g](void 0));f.set(U$(e,n,m,l))}});return{outputs:f,client:d,scaleHints:r}}}const M$={min:t=>Vg(t),max:t=>wx(t),mean:t=>Cv(t),average:t=>Cv(t),median:t=>C6(t),stdev:t=>Bne(t),stdevp:t=>zne(t),variance:t=>Une(t),variancep:t=>jne(t),sum:t=>dr(t),product:t=>$ne(t),quantile:(t,{quantile:e})=>Mne(t,e??.5)};function tK(t,e){if(typeof e=="string")return T6(t,Ae(e));if(e instanceof Array)if(e.length==2&&typeof e[0]=="number"&&typeof e[1]=="number"){let[n,r]=e;return vu(t,[Math.min(n,r),Math.max(n,r)])}else return _o(...e.map(n=>tK(t,n)));return Ae(!1)}function GNe(t,e,n,r,i){if("aggregate"in r)switch(r.aggregate){case"count":return{select:Cr(),scale:{title:"Count",kind:"quantitative",includeZero:!0},normalize:r.normalize};case"ecdf-value":if(r.field!=null){let s=L$(),o=Hn(t.fieldExpr(r.field),"DOUBLE");return{select:Ze`unnest(quantile_disc(${o}, ${s}))`,scale:{kind:"quantitative",predicate:a=>N$(o,a),title:oO(r.field)},normalize:r.normalize}}else{console.warn(`Invalid spec: aggregate '${r.aggregate}' require a field`);return}case"ecdf-rank":{let s=L$();return{select:Ze`unnest(${s})`,scale:{kind:"quantitative",domain:[0,1],title:"Quantile"},normalize:r.normalize}}default:{if(typeof r.aggregate=="string"&&M$[r.aggregate]){let s=M$[r.aggregate];if(r.field!=null){let o=t.fieldExpr(r.field);return{select:s(o,{quantile:r.quantile}).where(Fc(o)),scale:{kind:"quantitative",predicate:a=>N$(o,a),title:`${r.aggregate.toUpperCase()}(${oO(r.field)})`},normalize:r.normalize}}else{console.warn(`Invalid spec: aggregate '${r.aggregate}' require a field`);return}}if(typeof r.aggregate=="object"&&"sql"in r.aggregate)return{select:Ze`${r.aggregate.sql}`,scale:{kind:"quantitative"},normalize:r.normalize};console.warn(`Invalid spec: unknown aggregate '${r.aggregate}'`);return}}else if("field"in r){let s=r.bin;s==null&&i&&n!=null&&(s={});let o=t.stats[eK(e,r.field)];if(!o)return;if(s){let a=qNe({stats:o,scaleType:n?t.spec.scale?.[n]?.type:void 0,binCount:s.desiredCount??(n=="x"||n=="y"?20:5)});if(a==null){console.warn("Invalid spec: unsupported data type");return}return{select:a.select,grouping:[a.select],scale:n?{...a.scale,kind:a.scale.type=="band"?"nominal":"quantitative",predicate:a.predicate,title:oO(r.field)}:void 0,mapper:a.field,order:a.order}}else{let a=t.fieldExpr(r.field);return{select:a,grouping:i?[a]:[],scale:{kind:o.quantitative?"quantitative":"nominal",title:oO(r.field),predicate:l=>tK(a,l)}}}}else if("value"in r)return{mapper:()=>r.value,scale:typeof r.value=="string"?{kind:"nominal",domain:[r.value]}:typeof r.value=="number"?{kind:"quantitative",domain:[r.value]}:void 0}}function oO(t){return typeof t=="string"?t:t.sql}function L$(){let t=[],e=200;for(let n=0;n<=e;n++)t.push(n/e);return Ze`[${t.map(n=>Ae(n)).join(",")}]::DOUBLE[]`}function N$(t,e){if(e instanceof Array&&e.length==2&&typeof e[0]=="number"){let[n,r]=e;if(typeof n=="number"&&typeof r=="number")return vu(t,[Math.min(n,r),Math.max(n,r)])}}function nK(t){switch(t){case"x":case"x1":case"x2":return"x";case"y":case"y1":case"y2":return"y";case"color":return"color";case"size":return"size"}}function rK(t,e){let n=Array.from(new Set([t.title,e.title].filter(i=>i!=null&&i.trim()!=""))),r=n.length>0?n.join(", "):void 0;return{kind:e.kind,type:t.type??e.type,domain:(t.domain??[]).concat(e.domain??[]),specialValues:(t.specialValues??[]).concat(e.specialValues??[]),title:r,includeZero:t.includeZero===!0||e.includeZero===!0?!0:void 0,predicate:t.predicate??e.predicate}}function Q$(t){return RDe(t,e=>typeof e=="number"&&isFinite(e)?e:void 0)}function HNe(t,e,n,r){switch(e.kind){case"quantitative":{let i=[e.domain??[],...n].map(l=>Q$(l.flat())).flat(),[s,o]=Q$(i);return(s==null||o==null||!isFinite(s)||!isFinite(o))&&(s=0,o=1),s==o&&(s>0?s=0:s<0?o=0:o=1),(r=="size"||e.includeZero===!0)&&(s>0?s=0:o<0&&(o=0)),{type:t.type??e.type??"linear",domain:t.domain??[s,o],specialValues:e.specialValues,constant:t.constant,range:t.range}}case"nominal":{let i=[e.domain??[],...n].map(a=>new Set(a.flat().filter(l=>typeof l=="string"))).flatMap(a=>Array.from(a)),s=new Set(e.specialValues??[]),o=Array.from(new Set(i)).filter(a=>!s.has(a));return{type:t.type??e.type??"band",domain:t.domain??o,specialValues:e.specialValues,range:t.range}}default:return{type:"linear",domain:[0,1]}}}function B$(t,e,n,r){let i=h=>JSON.stringify(h),s=h=>JSON.parse(h),o=t.columns[e].slice(),a=t.columns[n].slice(),l=Object.entries(t.columns).filter(([h,d])=>h!=e&&h!=n).map(([h,d])=>[h,d.slice()]),u=new Set,c=new Set,f=new Set;for(let h=0;hg[h]));u.add(d),c.add(p),f.add(d+","+p)}for(let h of u)for(let d of c)if(!f.has(h+","+d)){o.push(s(h)),a.push(r);let p=s(d);for(let m=0;m{for(let c in n){let f=t.columns[c];if(f==null)continue;let h=n[c](f[l],f[u]);if(h!=0)return h}return l-u});let a=0;for(let l of o){let u=s[l];if(typeof u!="number"||!isFinite(u)){s[l]=null;continue}let c=a+u;s[l]=[a,c],a=c}}return{length:t.length,columns:{...t.columns,[r]:s}}}function z$(t){return t.encoding?.x!=null&&"aggregate"in t.encoding.x?"horizontal":"vertical"}function U$(t,e,n,r){let i={key:e.toString(),zIndex:t.zIndex??0,interpolate:t.interpolate??"linear",orientation:t.orientation,xDimension:t.width,yDimension:t.height,data:n};switch(t.mark){case"bar":switch(t.orientation??z$(t)){case"horizontal":i.data=aO(n,"y",r),i.yDimension=t.height??{gap:1,clampToRatio:.1},i.orientation="horizontal";break;case"vertical":i.data=aO(n,"x",r),i.xDimension=t.width??{gap:1,clampToRatio:.1},i.orientation="vertical";break;default:console.warn(`Invalid orientation: '${t.orientation}'`);return}return{...i,primitive:"rect",style:{fillColor:"$encoding",...t.style}};case"point":return{...i,pointSize:t.size,primitive:t.mark,style:{fillColor:"$encoding",...t.style}};case"rect":return{...i,primitive:t.mark,style:{fillColor:"$encoding",...t.style}};case"line":return{...i,primitive:t.mark,style:{strokeColor:"$encoding",strokeWidth:2,strokeJoin:"round",strokeCap:"round",...t.style}};case"area":switch(t.orientation??z$(t)){case"horizontal":i.data=aO(B$(n,"y","x",0),"y",r),i.orientation="horizontal";break;case"vertical":i.data=aO(B$(n,"x","y",0),"x",r),i.orientation="vertical";break;default:console.warn(`Invalid orientation: '${t.orientation}'`);return}return{...i,primitive:"area",style:{fillColor:"$encoding",...t.style}};case"rule":return t.orientation=="vertical"?i.xDimension=0:t.orientation=="horizontal"&&(i.yDimension=0),{...i,primitive:t.mark,style:{strokeColor:"$encoding",strokeWidth:2,...t.style}};default:console.warn(`Invalid mark: '${t.mark}'`);return}}function KNe(t,e,n){let r={},i={};(t.layers??[]).forEach((s,o)=>{Object.entries(s.encoding??{}).forEach(([a,l])=>{if(n[o]==null)return;let u=nK(a);if(u!=null){let c=n[o].data.columns[a];c!=null&&(i[u]==null?i[u]=[c]:i[u].push(c))}})});for(let s of Object.keys(e))r[s]=HNe(t.scale?.[s]??{},e[s],i[s]??[],s);return{scale:r,axis:{x:{title:e.x?.title,...t.axis?.x??{}},y:{title:e.y?.title,...t.axis?.y??{}}},layers:n.filter(s=>s!=null)}}function JNe(t,e){let n=[];return Object.entries(t.selection??{}).forEach(([r,i])=>{if("encoding"in i){let s,o;(i.encoding=="x"||i.encoding=="xy")&&e.x?.predicate!=null&&(s=e.x.predicate),(i.encoding=="y"||i.encoding=="xy")&&e.y?.predicate!=null&&(o=e.y.predicate),n.push({key:r,type:i.encoding,clause:a=>{if(a==null)return;let l=xs(...[a?.x!=null&&s!=null?s(a.x):void 0,a?.y!=null&&o!=null?o(a.y):void 0].filter(u=>u!=null));return{value:a,predicate:l}}})}}),n}var eQe=G('
    '),tQe=G(" ",1),nQe=G('
    '),rQe=G('
    '),iQe=G('
    '),sQe=G('
    ',1);function oQe(t,e){De(e,!0);const n=()=>hr(u,"$colorScheme",o),r=()=>hr(c,"$themeConfig",o),i=()=>hr(d,"$outputs",o),s=()=>hr(p,"$selections",o),[o,a]=Lo(),l=2e3;let{colorScheme:u,theme:c}=e.context,f=L(()=>lT(n(),r())),h=new VNe(e.context,()=>{e.onStateChange({},"replace")}),{outputs:d,selections:p}=h;UC(()=>{h.destroy()}),An(()=>{h.setSpec(e.spec)}),An(()=>{h.state.set(e.state)});let m=L(()=>i()?.scale.color?oNe(i().scale.color,b(f)):void 0),g=L(()=>i()?.scale.size?aNe(i().scale.size,b(f)):void 0),y=L(()=>i()?.layers.sort((w,x)=>w.zIndex-x.zIndex)??[]),O=L(()=>e.height!=null),v=160;jh(t,{get width(){return e.width},get height(){return e.height},class:"flex flex-col gap-2",children:(w,x)=>{const S=L(()=>b(m)!=null),_=L(()=>(e.spec.widgets?.length??0)>0);var k=sQe(),C=ke(k),D=M(C);{var A=B=>{var q=eQe(),z=M(q);F(q),de(()=>ut(z,`↑ ${i()?.axis.y.title??""}`)),I(B,q)};oe(D,B=>{i()?.axis.y.title!=null&&B(A)})}var E=V(D,2);qH(E,{get flexHeight(){return b(O)},children:(q,z=Cn,ee=Cn)=>{var W=ot(),K=ke(W);{var H=J=>{{const Y=(xe,ue=Cn)=>{var Ee=ot(),Le=ke(Ee);Ot(Le,17,()=>b(y).filter(qe=>qe.zIndex<0),qe=>qe.key,(qe,Fe)=>{var it=ot(),St=ke(it);{var Se=Kt=>{F$(Kt,{get proxy(){return ue()},get theme(){return b(f)},get layer(){return b(Fe)}})},gt=Kt=>{$$(Kt,{get proxy(){return ue()},get theme(){return b(f)},get layer(){return b(Fe)}})};oe(St,Kt=>{b(Fe).data.length<=l?Kt(Se):Kt(gt,!1)})}I(qe,it)}),I(xe,Ee)},Z=(xe,ue=Cn)=>{var Ee=tQe(),Le=ke(Ee);Ot(Le,17,()=>b(y).filter(Fe=>!(Fe.zIndex<0)),Fe=>Fe.key,(Fe,it)=>{var St=ot(),Se=ke(St);{var gt=Rn=>{F$(Rn,{get proxy(){return ue()},get theme(){return b(f)},get layer(){return b(it)}})},Kt=Rn=>{$$(Rn,{get proxy(){return ue()},get theme(){return b(f)},get layer(){return b(it)}})};oe(Se,Rn=>{b(it).data.length<=l?Rn(gt):Rn(Kt,!1)})}I(Fe,St)});var qe=V(Le,2);Ot(qe,1,()=>s()??[],Wt,(Fe,it)=>{_Ne(Fe,{get proxy(){return ue()},get mode(){return b(it).type},get value(){return e.state[b(it).key]},get theme(){return b(f)},onChange:St=>{switch(b(it).type){case"x":e.onStateChange({[b(it).key]:St?.x!=null?{x:St.x}:void 0});break;case"y":e.onStateChange({[b(it).key]:St?.y!=null?{y:St.y}:void 0});break;case"xy":e.onStateChange({[b(it).key]:St!=null&&St.x!=null&&St.y!=null?{x:St.x,y:St.y}:void 0});break}}})}),I(xe,Ee)};let he=L(()=>b(O)?ee():void 0),me=L(()=>e.spec.plotSize?.width??void 0),te=L(()=>e.spec.plotSize?.height??(e.spec.plotSize?.aspectRatio==null&&!b(O)?v:void 0)),le=L(()=>e.spec.plotSize?.aspectRatio),ve=L(()=>({color:b(m),size:b(g)}));YH(J,{get width(){return z()},get height(){return b(he)},get plotWidth(){return b(me)},get plotHeight(){return b(te)},get plotAspectRatio(){return b(le)},get xScale(){return i().scale.x},get yScale(){return i().scale.y},get xAxis(){return i().axis.x},get yAxis(){return i().axis.y},get otherScales(){return b(ve)},get theme(){return b(f)},childrenBelow:Y,children:Z,$$slots:{childrenBelow:!0,default:!0}})}};oe(K,J=>{i()!=null&&J(H)})}I(q,W)},$$slots:{default:!0}});var T=V(E,2);{var R=B=>{var q=nQe(),z=M(q);F(q),de(()=>ut(z,`${i()?.axis.x.title??""} →`)),I(B,q)};oe(T,B=>{i()?.axis.x.title!=null&&B(R)})}F(C);var $=V(C,2);{var Q=B=>{var q=iQe(),z=M(q);{var ee=H=>{var J=rQe(),Y=M(J),Z=M(Y);RNe(Z,{get scale(){return b(m)},get outputs(){return i()},get theme(){return b(f)}}),F(Y),F(J),I(H,J)};oe(z,H=>{b(S)&&H(ee)})}var W=V(z,2);{var K=H=>{UNe(H,{get spec(){return e.spec},get outputs(){return i()},get onSpecChange(){return e.onSpecChange}})};oe(W,H=>{b(_)&&H(K)})}F(q),I(B,q)};oe($,B=>{i()&&(b(S)||b(_))&&B(Q)})}I(w,k)},$$slots:{default:!0}}),Pe(),a()}async function aQe(t){let{coordinator:e,table:n,projection:r}=t,i=t.config??{},s=i.exclude??[],o=(await bH(e,n)).filter(l=>!l.name.startsWith("__")),a=[];if(r!=null&&i.embedding!==!1){let l={type:"embedding",title:"Embedding",data:{x:r.x,y:r.y,text:r.text,category:i.embedding?.data?.category??i.embedding?.category??"dataset"}};typeof i.embedding=="object"&&(l={...l,...i.embedding,data:{...l.data,...(i.embedding.data??{})}}),a.push(l),s.push(r.x),s.push(r.y),r.text&&s.push(r.text)}{let l="Collections",u=i.override?.[l];u!==void 0&&(u!==null&&a.push(u),s.push(l))}if(a.push({type:"predicates",title:"SQL Predicates",...(typeof i.predicates=="object"?i.predicates:{})}),i.table!==!1){let l={type:"instances",title:"Instances"};typeof i.table=="object"&&(l={...l,...i.table}),a.push(l)}for(let l of o){if(l.jsType==null||i.include!=null&&i.include.indexOf(l.name)<0||s.indexOf(l.name)>=0)continue;let u=i.override?.[l.name];if(u!==void 0){u!==null&&a.push(u);continue}let c=await OH(e,n,l.name);if(!(c<=1))switch(l.jsType){case"string":{c<=1e3&&a.push({type:"count-plot",title:l.name,data:{field:l.name}});break}case"string[]":{a.push({type:"count-plot",title:l.name,data:{field:l.name,isList:!0}});break}case"number":{c<=10?a.push({type:"count-plot",title:l.name,data:{field:l.name}}):a.push(iK(l.name));break}}}return a}function iK(t,e){return{title:t,layers:[{mark:"bar",style:{fillColor:"$markColorFade"},encoding:{x:{field:t},y:{aggregate:"count"}}},{mark:"bar",filter:"$filter",encoding:{x:{field:t},y:{aggregate:"count"},...e?{color:{field:e}}:{}}}],selection:{brush:{encoding:"x"}},widgets:[{type:"scale.type",channel:"x"},{type:"encoding.normalize",attribute:"y",layer:[0,1],options:["x"]}]}}const sK={},oK={},aK=[];function gd(t,e,n={}){sK[t]=e,oK[t]=n}function Is(t){aK.push(t)}function lQe(t){if(typeof t!="object")return y$;if(typeof t.type=="string"){let e=sK[t.type];return e??y$}return oQe}function lK(t){if(typeof t!="object")return{};if(typeof t.type=="string"){let e=oK[t.type];return e??{}}return{}}function uQe(){return aK}gd("builder",aMe);gd("count-plot",vFe);gd("embedding",CLe);gd("instances",HLe);gd("predicates",NFe);gd("markdown",_Fe,{supportsEditMode:!0});gd("content-viewer",QAe);Is({icon:"chart-h-bar",description:"Create a count plot of a field",ui:[{label:"Field",field:{key:"x",types:["number","string","string[]"],required:!0}}],create:({x:t})=>t.type=="discrete[]"?{title:t.name,type:"count-plot",data:{field:t.name,isList:!0}}:{title:t.name,type:"count-plot",data:{field:t.name}}});Is({icon:"chart-stacked",description:"Create a histogram of a field",ui:[{label:"Field",field:{key:"x",types:["number","string"],required:!0}},{label:"Group Field",field:{key:"color",types:["number","string"]}}],create:({x:t,color:e})=>iK(t.name,e?.name)});Is({icon:"chart-line",description:"Create a line chart of two fields",ui:[{label:"X Field",field:{key:"x",types:["number","string"],required:!0}},{label:"Y Field",field:{key:"y",types:["number"],required:!0}},{label:"Group Field",field:{key:"color",types:["number","string"]}}],create:({x:t,y:e,color:n})=>({title:e.name,layers:[{mark:"line",filter:"$filter",encoding:{x:{field:t.name},y:{aggregate:"mean",field:e.name},...n?{color:{field:n.name}}:{}}}],selection:{brush:{encoding:"x"}},widgets:[{type:"scale.type",channel:"x"},{type:"encoding.normalize",attribute:"y",layer:0,options:["x"]}]})});Is({icon:"chart-ecdf",description:"Create a chart showing the empirical cumulative distribution (eCDF) of a field",ui:[{label:"Field",field:{key:"x",types:["number"],required:!0}},{label:"Group Field",field:{key:"color",types:["number","string"]}}],create:({x:t,color:e})=>({title:t.name,layers:[{mark:"line",filter:"$filter",encoding:{x:{aggregate:"ecdf-value",field:t.name},y:{aggregate:"ecdf-rank"},...e?{color:{field:e.name}}:{}}}],selection:{brush:{encoding:"x"}},widgets:[{type:"scale.type",channel:"x"}]})});Is({icon:"chart-heatmap",description:"Create a 2D heatmap of two fields",ui:[{label:"X Field",field:{key:"x",types:["number","string"],required:!0}},{label:"Y Field",field:{key:"y",types:["number","string"],required:!0}}],create:({x:t,y:e})=>({title:`${t.name}, ${e.name}`,layers:[{mark:"rect",filter:"$filter",zIndex:-1,encoding:{x:{field:t.name},y:{field:e.name},color:{aggregate:"count"}}},{mark:"rect",zIndex:-2,encoding:{color:{value:0}}}],selection:{brush:{encoding:"xy"}},widgets:[{type:"scale.type",channel:"x"},{type:"scale.type",channel:"y"},{type:"encoding.normalize",attribute:"color",layer:0,options:["x","y"]}]})});Is({icon:"chart-boxplot",description:"Create a box plot",ui:[{label:"X Field",field:{key:"x",required:!0}},{label:"Y Field",field:{key:"y",types:["number"],required:!0}}],create:({x:t,y:e})=>({title:t.name,layers:[{mark:"rect",filter:"$filter",width:1,style:{fillColor:"$ruleColor"},encoding:{x:{field:t.name},y1:{aggregate:"min",field:e.name},y2:{aggregate:"max",field:e.name}}},{mark:"rect",filter:"$filter",width:{gap:1,clampToRatio:.1},encoding:{x:{field:t.name},y1:{aggregate:"quantile",quantile:.25,field:e.name},y2:{aggregate:"quantile",quantile:.75,field:e.name}}},{mark:"rect",filter:"$filter",height:1,width:{gap:1,clampToRatio:.1},style:{fillColor:"$ruleColor"},encoding:{x:{field:t.name},y:{aggregate:"median",field:e.name}}}],selection:{brush:{encoding:"x"}},axis:{y:{title:e.name}},widgets:[{type:"scale.type",channel:"x"},{type:"scale.type",channel:"y"}]})});Is({icon:"chart-bubble",description:"Create a bubble chart",ui:[{label:"X Field",field:{key:"x",types:["number"],required:!0}},{label:"Y Field",field:{key:"y",types:["number"],required:!0}},{label:"Color Field",field:{key:"color",types:["number","string"]}},{label:"Group Field",field:{key:"group",types:["number","string"]}}],create:({x:t,y:e,color:n,group:r})=>({title:t.name,layers:[{mark:"point",filter:"$filter",style:{fillColor:"$encoding",fillOpacity:.1,strokeColor:"$encoding"},encoding:{x:{aggregate:"mean",field:t.name},y:{aggregate:"mean",field:e.name},size:{aggregate:"count"},...n?{color:{field:n?.name}}:{},...r?{group:{field:r.name}}:{}}}],selection:{brush:{encoding:"xy"}},widgets:[{type:"scale.type",channel:"x"},{type:"scale.type",channel:"y"}]})});Is({icon:"chart-embedding",description:"Create an embedding view",ui:[{label:"X Field",field:{key:"x",types:["number"],required:!0}},{label:"Y Field",field:{key:"y",types:["number"],required:!0}},{label:"Text Field",field:{key:"text",types:["string"]}},{label:"Category Field",field:{key:"category",types:["string","number"]}}],preview:!1,create:({x:t,y:e,text:n,category:r},i)=>({type:"embedding",title:"Embedding",data:{x:t.name,y:e.name,text:n?.name,category:r?.name}})});Is({icon:"chart-predicates",description:"Create a filter with custom SQL predicates",ui:[],create:()=>({type:"predicates",title:"SQL Predicates"})});Is({icon:"chart-markdown",description:"Create a view with markdown content",preview:!1,ui:[{code:{key:"content",language:"markdown"}}],create:({content:t})=>({type:"markdown",title:"Markdown",content:t})});Is({icon:"chart-content-viewer",description:"Create a view that displays a given field's content for the last selected point",preview:!1,ui:[{label:"Field",field:{key:"field",required:!0}}],create:({field:t})=>({type:"content-viewer",title:t.name,field:t.name})});Is({icon:"chart-spec",description:"Create a chart with custom spec",preview:!1,ui:[{spec:{key:"spec"}}],create:({spec:t})=>t});Is({icon:"chart-table",description:"Create a table view with pagination",preview:!1,ui:[{label:"SQL query for the table (optional)",details:"Leave empty to show the (filtered) dataset, use $table and $filter to refer to the data table and filter predicate respectively.",code:{key:"query",language:"sql"}}],create:({query:t})=>({type:"instances",title:"Table",viewMode:"table",query:t!=null&&t.trim()!=""?t:void 0})});Is({icon:"chart-cards",description:"Create a card view with pagination",preview:!1,ui:[{label:"SQL query for the card view (optional)",details:"Leave empty to show the (filtered) dataset, use $table and $filter to refer to the data table and filter predicate respectively.",code:{key:"query",language:"sql"}},{label:"HTML template for the cards (optional)",code:{key:"template",language:""}}],create:({query:t,template:e})=>({type:"instances",title:"Cards",viewMode:"cards",query:t!=null&&t.trim()!=""?t:void 0,cardTemplate:e!=null&&e.trim()!=""?e:void 0})});var cQe=G('
    '),fQe=G('
    ');function hQe(t,e){De(e,!0);const n=()=>hr(s,"$colorScheme",r),[r,i]=Lo();let{colorScheme:s}=e.context,o=L(()=>e.grid.resolvePlacement(e.placement)),a=L(()=>b(o).x),l=L(()=>b(o).y),u=L(()=>b(o).width),c=L(()=>b(o).height),f=pe(!1),h=L(()=>lK(e.spec).supportsEditMode??!1),d=L(()=>b(h)&&b(f)?"edit":"view"),p=pe(void 0),m;function g(Y){return Z=>{let he=e.grid.numColumns,me=e.grid.xScaler,te=e.grid.yScaler,le=e.placement.x,ve=e.placement.y,xe=e.placement.x+e.placement.width,ue=e.placement.y+e.placement.height;return e.onBringToFront?.(),e.onIsPlacementChanging?.(!0),{move:Ee=>{let Le=Math.round(le+(Ee.clientX-Z.clientX)*Y[0]/me),qe=Math.round(ve+(Ee.clientY-Z.clientY)*Y[1]/te),Fe=Math.round(xe+(Ee.clientX-Z.clientX)*Y[2]/me),it=Math.round(ue+(Ee.clientY-Z.clientY)*Y[3]/te);const St=2,Se=2;Y[0]&&Y[2]?(Le=Math.min(Math.max(0,Le),he-(xe-le)),Fe=Le+(xe-le)):(Le=Math.min(Math.max(0,Le),xe-St),Fe=Math.min(Math.max(le+St,Fe),he)),Y[1]&&Y[3]?(qe=Math.max(0,qe),it=qe+(ue-ve)):(qe=Math.min(Math.max(0,qe),ue-Se),it=Math.max(ve+Se,it)),e.onPlacementChange?.({x:Le,y:qe,width:Fe-Le,height:it-qe})},up:()=>{e.onIsPlacementChanging?.(!1)},cancel:()=>{e.onIsPlacementChanging?.(!1)}}}}function y(){m?.scrollIntoView({block:"nearest"})}var O={scrollIntoView:y},v=fQe();v.__click=()=>{e.onBringToFront?.()};let w;var x=M(v),S=M(x),_=M(S),k=M(_,!0);F(_),Zn(_,(Y,Z)=>sn?.(Y,Z),()=>({click:()=>{e.onBringToFront?.()},drag:g([1,1,1,1])}));var C=V(_,2),D=M(C);{let Y=L(()=>b(d)=="edit"?JE:e8);Cc(D,{get icon(){return b(Y)},onClick:()=>{X(f,!b(f)),b(f)&&X(p,e.spec)}})}var A=V(D,2);Cc(A,{get icon(){return sd},get onClick(){return e.onRemove}}),F(C),F(S);var E=V(S,2),T=M(E);{var R=Y=>{var Z=ot(),he=ke(Z);Eo(he,()=>e.chartView,()=>({id:e.id,width:"container",height:"container",mode:b(d)})),I(Y,Z)},$=Y=>{var Z=cQe(),he=M(Z);KE(he,{class:"w-full flex-1 min-h-0",get initialValue(){return b(p)},get colorScheme(){return n()},onChange:te=>{X(p,te)}});var me=V(he,2);{let te=L(()=>b(p)==null);lA(me,{label:"Confirm",get disabled(){return b(te)},onClick:()=>{b(p)!=null&&(e.onSpecChange(b(p)),X(f,!1))}})}F(Z),I(Y,Z)};oe(T,Y=>{b(d)=="view"&&b(f)&&e.onSpecChange?Y($,!1):Y(R)})}F(E),F(x);var Q=V(x,2);Ve(Q,"",{},{left:"-2px",top:"10px",bottom:"10px",width:"10px"}),Zn(Q,(Y,Z)=>sn?.(Y,Z),()=>({drag:g([1,0,0,0])}));var B=V(Q,2);Ve(B,"",{},{right:"-2px",top:"10px",bottom:"10px",width:"10px"}),Zn(B,(Y,Z)=>sn?.(Y,Z),()=>({drag:g([0,0,1,0])}));var q=V(B,2);Ve(q,"",{},{left:"10px",right:"10px",top:"-2px",height:"10px"}),Zn(q,(Y,Z)=>sn?.(Y,Z),()=>({drag:g([0,1,0,0])}));var z=V(q,2);Ve(z,"",{},{left:"10px",right:"10px",bottom:"-2px",height:"10px"}),Zn(z,(Y,Z)=>sn?.(Y,Z),()=>({drag:g([0,0,0,1])}));var ee=V(z,2);Ve(ee,"",{},{left:"-2px",top:"-2px",width:"10px",height:"10px"}),Zn(ee,(Y,Z)=>sn?.(Y,Z),()=>({drag:g([1,1,0,0])}));var W=V(ee,2);Ve(W,"",{},{right:"-2px",top:"-2px",width:"10px",height:"10px"}),Zn(W,(Y,Z)=>sn?.(Y,Z),()=>({drag:g([0,1,1,0])}));var K=V(W,2);Ve(K,"",{},{left:"-2px",bottom:"-2px",width:"10px",height:"10px"}),Zn(K,(Y,Z)=>sn?.(Y,Z),()=>({drag:g([1,0,0,1])}));var H=V(K,2);Ve(H,"",{},{right:"-2px",bottom:"-2px",width:"10px",height:"10px"}),Zn(H,(Y,Z)=>sn?.(Y,Z),()=>({drag:g([0,0,1,1])})),F(v),lr(v,Y=>m=Y,()=>m),de(()=>{w=Ve(v,"",w,{left:`${b(a)??""}px`,top:`${b(l)??""}px`,width:`${b(u)??""}px`,height:`${b(c)??""}px`,"z-index":e.order}),ut(k,e.spec.title)}),xc(3,v,()=>TB,()=>({duration:100})),I(t,v);var J=Pe(O);return i(),J}dn(["click"]);function Z_(t,e=""){let n=1,r;do r=e+n,n++;while(r in t);return r}function uK(t,e){if(!e||e.length===0)return t;let n=new Set(t),r=new Set(e);return[...e.filter(i=>n.has(i)),...t.filter(i=>!r.has(i))]}class X_{numColumns;rows;constructor(e){if(e>32)throw new Error("numColumns must be <= 32");this.numColumns=e,this.rows=new Uint32Array(128)}ensureSize(e){if(this.rows.length=this.numColumns||n<0||n>=this.rows.length?!1:(this.rows[n]&1<=this.numColumns||n<0||(this.ensureSize(n+1),r==0?this.rows[n]&=~(1<this.numColumns&&(r=this.numColumns-e),r<=0||i<=0)return!0;let s=(1<this.numColumns&&(r=this.numColumns-e),r<=0||i<=0)return;const s=(1<this.numColumns)throw new Error("invalid dimensions");let r=this.rows.length;for(let s=0;s=0;e--)if(this.rows[e]!=0)return e;return-1}unusedRects(e,n,r,i){let s=this.clone(),o=[],a=this.maxOccupiedY();for(let l=0;l<=a;l++)for(let u=0;u=e;h--){f=0;for(let d=1;d<=Math.min(i,s.rows.length-l);d++){let p=!0;for(let m=0;ma+1&&(f=a+1-l),f>=n){o.push({x:u,y:l,width:h,height:f}),s.fill(u,l,h,f);break}}}return o}}class dQe{containerWidth;containerHeight;numColumns;numRows;gap;constructor(e,n,r,i,s){this.containerWidth=e,this.containerHeight=n,this.numColumns=r,this.numRows=i,this.gap=s}resolvePlacement(e){let n=(this.containerWidth-this.gap*(this.numColumns-1))/this.numColumns,r=(this.containerHeight-this.gap*(this.numRows-1))/this.numRows;return{x:e.x*(n+this.gap),y:e.y*(r+this.gap),width:e.width*n+(e.width-1)*this.gap,height:e.height*r+(e.height-1)*this.gap}}get xScaler(){return(this.containerWidth+this.gap)/this.numColumns}get yScaler(){return(this.containerHeight+this.gap)/this.numRows}}function pQe(t,e,n){let r={},i=new X_(n);for(let s in t){let o=e[s];o!=null&&(i.fill(o.x,o.y,o.width,o.height),r[s]=o)}for(let s in t){if(r[s]!=null)continue;let o=8,a=5;t[s].type=="embedding"&&(o=16,a=12),(t[s].type=="table"||t[s].type=="instances")&&(o=n,a=6),o>n&&(o=n);let{x:l,y:u}=i.find(o,a);i.fill(l,u,o,a),r[s]={x:l,y:u,width:o,height:a}}return r}var mQe=G(''),gQe=G("
    ");function yQe(t,e){De(e,!0);let n=pe(100),r=pe(100),i,s=pe(0),o=L(()=>e.state.numColumns??(b(n)<500?8:24)),a=L(()=>e.state.numRows??16),l=L(()=>new dQe(b(n),b(r),b(o),b(a),6)),u=L(()=>`${b(o)}x${b(a)}`),c=L(()=>pQe(e.charts,e.state.grids?.[b(u)]?.placements??{},b(l).numColumns)),f=L(wv(()=>uK(Object.keys(e.charts),e.state.grids?.[b(u)]?.order).reverse())),h=L(()=>{let D=new X_(b(l).numColumns);for(let A in b(c))D.fill(b(c)[A].x,b(c)[A].y,b(c)[A].width,b(c)[A].height);return D.unusedRects(4,4,12,8)}),d=L(()=>{let D=b(l).numRows;for(let A in b(c))D=Math.max(D,b(c)[A].y+b(c)[A].height);return D}),p=pe(void 0),m=L(()=>Math.max(b(p)??b(d),b(d))),g=L(()=>b(m)<=b(l).numRows?b(r):b(l).yScaler*b(m));An(()=>{let D=b(s)>=1;Br(()=>{D?X(p,Math.max(b(p)??b(d),b(d)),!0):X(p,0)})});function y(D){e.onStateChange({grids:{[b(u)]:{placements:{...b(c),[D]:void 0}}}}),e.onChartsChange({[D]:void 0}),e.onChartStatesChange({[D]:void 0})}function O(D){let A=e.state.grids?.[b(u)]?.order??[],E=[D,...A.filter(T=>T!=D)];e.onStateChange({grids:{[b(u)]:{order:E}}})}function v(D){let A=Z_(e.charts);e.onChartsChange({[A]:{type:"builder",title:"New"}}),e.onStateChange({grids:{[b(u)]:{placements:{[A]:D}}}})}let w=vc({});Ah(()=>{let D=new Set(Object.keys(e.charts));ki(()=>{let A=D;if(D=new Set(Object.keys(e.charts)),D.size!=A.size+1)return;let E=[];for(let T of D)A.has(T)||E.push(T);E.length==1&&w[E[0]]?.scrollIntoView()})});var x=gQe(),S=M(x);let _;var k=M(S);Ot(k,17,()=>b(h),Wt,(D,A)=>{const E=L(()=>b(l).resolvePlacement(b(A)));var T=mQe(),R=L(()=>v.bind(null,b(A)));T.__click=function(...B){b(R)?.apply(this,B)};let $;var Q=M(T);GX(Q,{}),F(T),de(()=>$=Ve(T,"",$,{left:`${b(E).x??""}px`,top:`${b(E).y??""}px`,width:`${b(E).width??""}px`,height:`${b(E).height??""}px`})),xc(3,T,()=>TB,()=>({duration:100})),I(D,T)});var C=V(k,2);Ot(C,16,()=>Object.keys(e.charts),D=>D,(D,A)=>{{let E=L(()=>b(c)[A]??{x:0,y:0,width:4,height:3}),T=L(()=>b(f).indexOf(A)),R=L(()=>y.bind(null,A)),$=L(()=>O.bind(null,A));lr(hQe(D,{get context(){return e.context},get id(){return A},get spec(){return e.charts[A]},get placement(){return b(E)},get grid(){return b(l)},get order(){return b(T)},get onRemove(){return b(R)},onPlacementChange:Q=>{e.onStateChange({grids:{[b(u)]:{placements:{...b(c),[A]:Q}}}})},onIsPlacementChanging:Q=>X(s,b(s)+(Q?1:-1)),get onBringToFront(){return b($)},onSpecChange:Q=>{e.onChartsChange({[A]:void 0}),e.onChartStatesChange({[A]:void 0}),e.onChartsChange({[A]:Q})},get chartView(){return e.chartView}}),(Q,B)=>w[B]=Q,Q=>w?.[Q],()=>[A])}}),F(S),lr(S,D=>i=D,()=>i),F(x),de(()=>{Qt(x,1,`w-full h-full overflow-x-hidden relative ${b(g)>b(r)?"overflow-y-scroll overscroll-none":"overflow-y-hidden"}`),_=Ve(S,"",_,{"z-index":0,width:`${b(n)??""}px`,height:`${b(g)??""}px`,position:"relative",overflow:"hidden"})}),fl(x,"clientWidth",D=>X(n,D)),fl(x,"clientHeight",D=>X(r,D)),I(t,x),Pe()}dn(["click"]);function bQe(t,e){De(e,!0);function n(){let r=Z_(e.charts);e.onChartsChange({[r]:{type:"builder",title:"New"}})}Nu(t,{get icon(){return GX},onClick:n,title:"Add"}),Pe()}function j$(t,{from:e,to:n},r={}){var{delay:i=0,duration:s=S=>Math.sqrt(S)*120,easing:o=PH}=r,a=getComputedStyle(t),l=a.transform==="none"?"":a.transform,[u,c]=a.transformOrigin.split(" ").map(parseFloat);u/=t.clientWidth,c/=t.clientHeight;var f=OQe(t),h=t.clientWidth/n.width/f,d=t.clientHeight/n.height/f,p=e.left+e.width*u,m=e.top+e.height*c,g=n.left+n.width*u,y=n.top+n.height*c,O=(p-g)*h,v=(m-y)*d,w=e.width/n.width,x=e.height/n.height;return{delay:i,duration:typeof s=="function"?s(Math.sqrt(O*O+v*v)):s,easing:o,css:(S,_)=>{var k=_*O,C=_*v,D=S+_*w,A=S+_*x;return`transform: ${l} translate(${k}px, ${C}px) scale(${D}, ${A});`}}}function OQe(t){if("currentCSSZoom"in t)return t.currentCSSZoom;for(var e=t,n=1;e!==null;)n*=+getComputedStyle(e).zoom,e=e.parentElement;return n}var vQe=G('
    '),wQe=G('
    '),xQe=G('
    '),_Qe=G('
    ',1);function q$(t,e){De(e,!0);let n=pe(!1),r=L(()=>lK(e.spec).supportsEditMode??!1),i=L(()=>b(r)&&b(n)?"edit":"view"),s=pe(void 0);var o=_Qe(),a=ke(o),l=M(a);l.__click=()=>e.onIsVisibleChange?.(!e.isVisible);var u=M(l);{var c=T=>{var R=vQe(),$=M(R);oI($,{}),F(R),I(T,R)},f=T=>{var R=wQe(),$=M(R);sI($,{}),F(R),I(T,R)};oe(u,T=>{e.isVisible?T(c):T(f,!1)})}var h=V(u,2),d=M(h,!0);F(h),F(l);var p=V(l,2),m=M(p);{var g=T=>{{let R=L(()=>b(i)=="edit"?JE:e8);Cc(T,{get icon(){return b(R)},title:"Edit",onClick:()=>{X(n,!b(n)),b(n)&&(X(s,e.spec),e.onIsVisibleChange?.(!0))}})}};oe(m,T=>{e.onSpecChange&&T(g)})}var y=V(m,2);{var O=T=>{Cc(T,{get icon(){return oI},title:"Move up",get onClick(){return e.onUp}})};oe(y,T=>{e.onUp&&T(O)})}var v=V(y,2);{var w=T=>{Cc(T,{get icon(){return sI},title:"Move down",get onClick(){return e.onDown}})};oe(v,T=>{e.onDown&&T(w)})}var x=V(v,2);{var S=T=>{Cc(T,{get icon(){return sd},title:"Close",onClick:()=>e.onRemove()})};oe(x,T=>{e.onRemove&&T(S)})}F(p),F(a);var _=V(a,2);let k;var C=M(_),D=M(C);Eo(D,()=>e.chartView,()=>({id:e.id,width:"container",mode:b(i)}));var A=V(D,2);{var E=T=>{var R=xQe(),$=M(R),Q=M($);KE(Q,{class:"w-full flex-1 min-h-0",get initialValue(){return b(s)},get colorScheme(){return e.colorScheme},onChange:q=>{X(s,q)}});var B=V(Q,2);{let q=L(()=>b(s)==null);lA(B,{label:"Confirm",get disabled(){return b(q)},onClick:()=>{b(s)!=null&&(e.onSpecChange(b(s)),X(n,!1))}})}F($),F(R),xc(3,R,()=>eg),I(T,R)};oe(A,T=>{b(i)=="view"&&b(n)&&e.onSpecChange&&T(E)})}F(C),F(_),de(()=>{ut(d,e.spec.title),k=Ve(_,"",k,{display:"grid","grid-template-rows":e.isVisible?"1fr":"0fr",transition:"grid-template-rows 300ms ease-in-out"})}),I(t,o),Pe()}dn(["click"]);var SQe=G("
    ");function V$(t,e){De(e,!0);let n=Ht(e,["$$slots","$$events","$$legacy"]);function r(s){let o=s.pageX,a=s.pageY,l=e.value;return{move:u=>{let c=u.pageX-o,f=u.pageY-a,h=l+(e.axis=="x"?c:f)*e.scaler;he.max&&(h=n.max),e.onChange(h)}}}var i=SQe();Zn(i,(s,o)=>sn?.(s,o),()=>({drag:r})),de(()=>Qt(i,1,`${e.class??""} ${e.axis=="x"?"cursor-col-resize":"cursor-row-resize"}`)),I(t,i),Pe()}function kQe(t,e,n){if(n?.[e]!=null)return n[e];switch(t.type){case"embedding":return"embedding";case"instances":return"table";default:return"chart"}}function cK(t,e){let n={embedding:[],table:[],chart:[]};for(let r in t){let i=kQe(t[r],r,e.placements);i!=null&&n[i].push(r)}return n}var CQe=G('
    '),AQe=G('
    '),EQe=G('
    '),TQe=G("
    "),DQe=G('
    '),PQe=G('
    '),RQe=G('
    '),IQe=G(" ",1),FQe=G('
    '),$Qe=G('
    '),MQe=G('
    ');function LQe(t,e){De(e,!0);const n=()=>hr(s,"$colorScheme",r),[r,i]=Lo();let{colorScheme:s}=e.context,o=pe(100),a=pe(100),l=pe(300),u=pe(400),c=pe(400),f=L(wv(()=>cK(e.charts,e.state))),h=L(()=>b(o)<500),d=L(()=>b(f).embedding.length>0&&(e.state.showEmbedding??!0)),p=L(()=>b(f).table.length>0&&(e.state.showTable??!0)),m=L(()=>e.state.showCharts??!0);function g(k,C){let A=Math.round((k+7)/(C+7)),E,T;for(let R=Math.max(1,A-1);R<=Math.max(1,A+1);R++){let $=(k-7*(R-1))/R,Q=Math.abs($-C);(E==null||QuK(b(f).chart,e.state.chartsOrder)));function O(k,C){let D=[...b(y)],A=D.indexOf(k);if(A==-1)return;let E=A+C;E<0||E>=D.length||([D[A],D[E]]=[D[E],D[A]],e.onStateChange({chartsOrder:D}))}function v(k){e.onChartsChange({[k]:void 0}),e.onChartStatesChange({[k]:void 0})}var w=MQe(),x=M(w);{var S=k=>{var C=IQe(),D=ke(C);{var A=Q=>{var B=DQe(),q=M(B);{var z=J=>{var Y=AQe();Ot(Y,20,()=>b(f).embedding,Z=>Z,(Z,he)=>{var me=CQe(),te=M(me);Eo(te,()=>e.chartView,()=>({id:he,width:"container",height:"container"})),F(me),I(Z,me)}),F(Y),I(J,Y)};oe(q,J=>{b(d)&&J(z)})}var ee=V(q,2);{var W=J=>{{let Y=L(()=>b(a)-100);V$(J,{class:"h-2 flex-none",axis:"y",min:100,get max(){return b(Y)},scaler:-1,get value(){return b(l)},onChange:Z=>X(l,Z,!0)})}};oe(ee,J=>{b(d)&&b(p)&&J(W)})}var K=V(ee,2);{var H=J=>{var Y=TQe();let Z;Ot(Y,20,()=>b(f).table,he=>he,(he,me)=>{var te=EQe(),le=M(te);Eo(le,()=>e.chartView,()=>({id:me,width:"container",height:"container"})),F(te),I(he,te)}),F(Y),de(()=>{Qt(Y,1,`flex flex-row gap-2 overflow-hidden ${b(d)?"flex-none":"flex-1"}`),Z=Ve(Y,"",Z,{height:b(d)?`${b(l)}px`:null})}),xc(3,Y,()=>eg),I(J,Y)};oe(K,J=>{b(p)&&J(H)})}F(B),I(Q,B)};oe(D,Q=>{(b(d)||b(p))&&Q(A)})}var E=V(D,2);{var T=Q=>{{let B=L(()=>b(o)-100);V$(Q,{class:"w-2 flex-none",axis:"x",min:100,get max(){return b(B)},scaler:-1,get value(){return b(u)},onChange:q=>X(u,q,!0)})}};oe(E,Q=>{(b(d)||b(p))&&b(m)&&Q(T)})}var R=V(E,2);{var $=Q=>{var B=RQe();let q;var z=M(B),ee=M(z);ee.__click=()=>{let K=Z_(e.charts);e.onChartsChange({[K]:{type:"builder",title:"New"}}),e.onStateChange({chartsOrder:[K,...b(y).filter(H=>H!=K)]})};var W=V(ee,2);Ot(W,26,()=>b(y),K=>K,(K,H,J)=>{const Y=L(()=>e.charts[H]),Z=L(()=>e.state.chartVisibility?.[H]??!0);var he=PQe();let me;var te=M(he);{let le=L(()=>v.bind(null,H)),ve=L(()=>b(J)>0?O.bind(null,H,-1):void 0),xe=L(()=>b(J)+1{e.onStateChange({chartVisibility:{[H]:ue}})},get isVisible(){return b(Z)},get colorScheme(){return n()},get chartView(){return e.chartView},get onRemove(){return b(le)},get onUp(){return b(ve)},get onDown(){return b(xe)},onSpecChange:ue=>{e.onChartsChange({[H]:void 0}),e.onChartStatesChange({[H]:void 0}),e.onChartsChange({[H]:ue})}})}F(he),de(le=>me=Ve(he,"",me,le),[()=>({width:`${g(b(c),500)??""}px`})]),IT(he,()=>j$,()=>({duration:300})),xc(2,he,()=>eg),I(K,he)}),F(z),F(B),de(()=>q=Ve(B,"",q,{width:`${(b(d)||b(p)?b(u):b(o))??""}px`})),fl(z,"clientWidth",K=>X(c,K)),xc(3,B,()=>eg,()=>({axis:"x"})),I(Q,B)};oe(R,Q=>{b(m)&&Q($)})}I(k,C)},_=k=>{var C=$Qe();Ot(C,30,()=>b(f).embedding.concat(b(y),b(f).table),D=>D,(D,A)=>{const E=L(()=>e.state.chartVisibility?.[A]??!0),T=L(()=>b(y).indexOf(A));var R=FQe(),$=M(R);{let Q=L(()=>v.bind(null,A)),B=L(()=>b(T)>0?O.bind(null,A,-1):void 0),q=L(()=>b(T)!=-1&&b(T)+1{e.onStateChange({chartVisibility:{[A]:z}})},get isVisible(){return b(E)},get colorScheme(){return n()},get chartView(){return e.chartView},get onRemove(){return b(Q)},get onUp(){return b(B)},get onDown(){return b(q)}})}F(R),IT(R,()=>j$,()=>({duration:300})),xc(2,R,()=>eg),I(D,R)}),F(C),I(k,C)};oe(x,k=>{b(h)?k(_,!1):k(S)})}F(w),fl(w,"clientWidth",k=>X(o,k)),fl(w,"clientHeight",k=>X(a,k)),I(t,w),Pe(),i()}dn(["click"]);var NQe=G('
    ');function QQe(t,e){De(e,!0);let n=L(()=>cK(e.charts,e.state));var r=NQe(),i=M(r);{var s=f=>{var h=()=>e.state.showEmbedding??!0,d=p=>{e.onStateChange({showEmbedding:p})};av(f,{get icon(){return lke},title:"Show / hide embedding",get checked(){return h()},set checked(p){d(p)}})};oe(i,f=>{b(n).embedding.length>0&&f(s)})}var o=V(i,2);{var a=f=>{var h=()=>e.state.showTable??!0,d=p=>{e.onStateChange({showTable:p})};av(f,{get icon(){return xke},title:"Show / hide table",get checked(){return h()},set checked(p){d(p)}})};oe(o,f=>{b(n).table.length>0&&f(a)})}var l=V(o,2),u=()=>e.state.showCharts??!0,c=f=>{e.onStateChange({showCharts:f})};av(l,{get icon(){return Ske},title:"Show / hide charts",get checked(){return u()},set checked(f){c(f)}}),F(r),I(t,r),Pe()}const Qp={list:[LQe,QQe],dashboard:[yQe,bQe]};function BQe(t){return Qp[t]==null?Qp.list[0]:Qp[t][0]}function zQe(t){return Qp[t]==null?Qp.list[1]:Qp[t][1]}function UQe(t,e){De(e,!0);let n=L(()=>zQe(e.layout)),r=L(()=>e.layoutStates[e.layout]??{});function i(u,c="merge"){qp(e.charts,u,c,f=>e.onChartsChange?.(f))}function s(u,c="merge"){qp(e.chartStates,u,c,f=>e.onChartStatesChange?.(f))}function o(u,c,f="merge"){cO(e.layoutStates,u,c,f,h=>e.onLayoutStatesChange?.(h))}var a=ot(),l=ke(a);{let u=L(()=>o.bind(null,e.layout));Bu(l,()=>b(n),(c,f)=>{f(c,{get context(){return e.context},get charts(){return e.charts},get state(){return b(r)},get onStateChange(){return b(u)},onChartsChange:i,onChartStatesChange:s})})}I(t,a),Pe()}function jQe(t,e){De(e,!0);let n=L(()=>BQe(e.layout)),r=L(()=>e.layoutStates[e.layout]??{});function i(f,h,d="merge"){cO(e.charts,f,h,d,p=>e.onChartsChange?.(p))}function s(f,h,d="merge"){cO(e.chartStates,f,h,d,p=>e.onChartStatesChange?.(p))}function o(f,h="merge"){qp(e.charts,f,h,d=>e.onChartsChange?.(d))}function a(f,h="merge"){qp(e.chartStates,f,h,d=>e.onChartStatesChange?.(d))}function l(f,h,d="merge"){cO(e.layoutStates,f,h,d,p=>e.onLayoutStatesChange?.(p))}var u=ot(),c=ke(u);{const f=(d,p)=>{let m=()=>p?.().id,g=()=>p?.().width,y=()=>p?.().height,O=()=>p?.().mode;const v=L(()=>e.charts[m()]),w=L(()=>e.chartStates[m()]??{});{let x=L(()=>O()??"view"),S=L(()=>i.bind(null,m())),_=L(()=>s.bind(null,m())),k=L(()=>e.registerChartDelegate?C=>e.registerChartDelegate?.(m(),C):void 0);TH(d,{get context(){return e.context},get width(){return g()},get height(){return y()},get spec(){return b(v)},get state(){return b(w)},get mode(){return b(x)},get onSpecChange(){return b(S)},get onStateChange(){return b(_)},get registerDelegate(){return b(k)}})}};let h=L(()=>l.bind(null,e.layout));Bu(c,()=>b(n),(d,p)=>{p(d,{get context(){return e.context},get charts(){return e.charts},get state(){return b(r)},get onStateChange(){return b(h)},onChartsChange:o,onChartStatesChange:a,chartView:f,$$slots:{chartView:!0}})})}I(t,u),Pe()}var qQe=G("
    "),VQe=G('
    ');function ZQe(t,e){De(e,!0);function n(g){e.onChange({...e.style,...g})}let r=L(()=>e.style.renderer!=null?HW[e.style.renderer]:void 0);var i=VQe(),s=M(i),o=M(s),a=M(o,!0);F(o),F(s);var l=V(s),u=M(l),c=M(u);{let g=L(()=>e.style.renderer??null),y=L(()=>[{value:null,label:"(default)"},...A8.map(O=>({value:O.renderer,label:O.label}))]);Zs(c,{get value(){return b(g)},onChange:O=>n({renderer:O}),get options(){return b(y)}})}var f=V(c,2);{var h=g=>{Uw(g,{get icon(){return t8},children:(y,O)=>{var v=qQe();Zn(v,(w,x)=>b(r)?.(w,x),()=>({options:e.style.options,onChange:w=>{n({options:w})}})),I(y,v)},$$slots:{default:!0}})};oe(f,g=>{b(r)&&g(h)})}F(u),F(l);var d=V(l),p=M(d),m=M(p);{let g=L(()=>e.style.display??"badge");Zs(m,{get value(){return b(g)},onChange:y=>{n({display:y})},options:[{value:"full",label:"Full"},{value:"badge",label:"Badge"},{value:"hidden",label:"Hidden"}]})}F(p),F(d),F(i),de(()=>ut(a,e.column.name)),I(t,i),Pe()}var XQe=G('
    ColumnFormatStyle
    ');function WQe(t,e){De(e,!0);var n=XQe(),r=M(n),i=V(M(r));Ot(i,21,()=>e.columns,Wt,(s,o)=>{{let a=L(()=>e.styles[b(o).name]??{});ZQe(s,{get column(){return b(o)},get style(){return b(a)},onChange:l=>{let u={...e.styles};u[b(o).name]=l,e.onStylesChange(u)}})}}),F(i),F(r),F(n),I(t,n),Pe()}var YQe=G('
    ');function GQe(t,e){De(e,!0);let n=pe(null),r=pe(null);ki(()=>{X(n,null),X(r,null);let l=Ph({coordinator:e.coordinator,selection:e.filter,prepare:async()=>{let u=await e.coordinator.query(Be.from(e.table).select({count:Ze`COUNT(*)::INT`}));X(n,u.get(0).count,!0)},query:u=>Be.from(e.table).select({count:Ze`COUNT(*)::INT`}).where(u),queryResult:u=>{X(r,u.getChild("count").get(0),!0)}});return()=>{l.destroy()}});var i=YQe(),s=M(i),o=V(s),a=M(o);F(o),F(i),de((l,u)=>{ut(s,`${l??""} `),ut(a,`/ ${u??""} points`)},[()=>b(r)?.toLocaleString()??"",()=>b(n)?.toLocaleString()??""]),I(t,i),Pe()}var lv={exports:{}};var HQe=lv.exports,Z$;function KQe(){return Z$||(Z$=1,(function(t,e){(function(n,r){t.exports=r()})(HQe,(function(){var n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(u){return typeof u}:function(u){return u&&typeof Symbol=="function"&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u},r=function(u,c){if(!(u instanceof c))throw new TypeError("Cannot call a class as a function")},i=(function(){function u(c,f){for(var h=0;h1&&arguments[1]!==void 0?arguments[1]:!0,h=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:5e3;r(this,u),this.ctx=c,this.iframes=f,this.exclude=h,this.iframesTimeout=d}return i(u,[{key:"getContexts",value:function(){var f=void 0,h=[];return typeof this.ctx>"u"||!this.ctx?f=[]:NodeList.prototype.isPrototypeOf(this.ctx)?f=Array.prototype.slice.call(this.ctx):Array.isArray(this.ctx)?f=this.ctx:typeof this.ctx=="string"?f=Array.prototype.slice.call(document.querySelectorAll(this.ctx)):f=[this.ctx],f.forEach(function(d){var p=h.filter(function(m){return m.contains(d)}).length>0;h.indexOf(d)===-1&&!p&&h.push(d)}),h}},{key:"getIframeContents",value:function(f,h){var d=arguments.length>2&&arguments[2]!==void 0?arguments[2]:function(){},p=void 0;try{var m=f.contentWindow;if(p=m.document,!m||!p)throw new Error("iframe inaccessible")}catch{d()}p&&h(p)}},{key:"isIframeBlank",value:function(f){var h="about:blank",d=f.getAttribute("src").trim(),p=f.contentWindow.location.href;return p===h&&d!==h&&d}},{key:"observeIframeLoad",value:function(f,h,d){var p=this,m=!1,g=null,y=function O(){if(!m){m=!0,clearTimeout(g);try{p.isIframeBlank(f)||(f.removeEventListener("load",O),p.getIframeContents(f,h,d))}catch{d()}}};f.addEventListener("load",y),g=setTimeout(y,this.iframesTimeout)}},{key:"onIframeReady",value:function(f,h,d){try{f.contentWindow.document.readyState==="complete"?this.isIframeBlank(f)?this.observeIframeLoad(f,h,d):this.getIframeContents(f,h,d):this.observeIframeLoad(f,h,d)}catch{d()}}},{key:"waitForIframes",value:function(f,h){var d=this,p=0;this.forEachIframe(f,function(){return!0},function(m){p++,d.waitForIframes(m.querySelector("html"),function(){--p||h()})},function(m){m||h()})}},{key:"forEachIframe",value:function(f,h,d){var p=this,m=arguments.length>3&&arguments[3]!==void 0?arguments[3]:function(){},g=f.querySelectorAll("iframe"),y=g.length,O=0;g=Array.prototype.slice.call(g);var v=function(){--y<=0&&m(O)};y||v(),g.forEach(function(w){u.matches(w,p.exclude)?v():p.onIframeReady(w,function(x){h(w)&&(O++,d(x)),v()},v)})}},{key:"createIterator",value:function(f,h,d){return document.createNodeIterator(f,h,d,!1)}},{key:"createInstanceOnIframe",value:function(f){return new u(f.querySelector("html"),this.iframes)}},{key:"compareNodeIframe",value:function(f,h,d){var p=f.compareDocumentPosition(d),m=Node.DOCUMENT_POSITION_PRECEDING;if(p&m)if(h!==null){var g=h.compareDocumentPosition(d),y=Node.DOCUMENT_POSITION_FOLLOWING;if(g&y)return!0}else return!0;return!1}},{key:"getIteratorNode",value:function(f){var h=f.previousNode(),d=void 0;return h===null?d=f.nextNode():d=f.nextNode()&&f.nextNode(),{prevNode:h,node:d}}},{key:"checkIframeFilter",value:function(f,h,d,p){var m=!1,g=!1;return p.forEach(function(y,O){y.val===d&&(m=O,g=y.handled)}),this.compareNodeIframe(f,h,d)?(m===!1&&!g?p.push({val:d,handled:!0}):m!==!1&&!g&&(p[m].handled=!0),!0):(m===!1&&p.push({val:d,handled:!1}),!1)}},{key:"handleOpenIframes",value:function(f,h,d,p){var m=this;f.forEach(function(g){g.handled||m.getIframeContents(g.val,function(y){m.createInstanceOnIframe(y).forEachNode(h,d,p)})})}},{key:"iterateThroughNodes",value:function(f,h,d,p,m){for(var g=this,y=this.createIterator(h,f,p),O=[],v=[],w=void 0,x=void 0,S=function(){var k=g.getIteratorNode(y);return x=k.prevNode,w=k.node,w};S();)this.iframes&&this.forEachIframe(h,function(_){return g.checkIframeFilter(w,x,_,O)},function(_){g.createInstanceOnIframe(_).forEachNode(f,function(k){return v.push(k)},p)}),v.push(w);v.forEach(function(_){d(_)}),this.iframes&&this.handleOpenIframes(O,f,d,p),m()}},{key:"forEachNode",value:function(f,h,d){var p=this,m=arguments.length>3&&arguments[3]!==void 0?arguments[3]:function(){},g=this.getContexts(),y=g.length;y||m(),g.forEach(function(O){var v=function(){p.iterateThroughNodes(f,O,h,d,function(){--y<=0&&m()})};p.iframes?p.waitForIframes(O,v):v()})}}],[{key:"matches",value:function(f,h){var d=typeof h=="string"?[h]:h,p=f.matches||f.matchesSelector||f.msMatchesSelector||f.mozMatchesSelector||f.oMatchesSelector||f.webkitMatchesSelector;if(p){var m=!1;return d.every(function(g){return p.call(f,g)?(m=!0,!1):!0}),m}else return!1}}]),u})(),a=(function(){function u(c){r(this,u),this.ctx=c,this.ie=!1;var f=window.navigator.userAgent;(f.indexOf("MSIE")>-1||f.indexOf("Trident")>-1)&&(this.ie=!0)}return i(u,[{key:"log",value:function(f){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"debug",d=this.opt.log;this.opt.debug&&(typeof d>"u"?"undefined":n(d))==="object"&&typeof d[h]=="function"&&d[h]("mark.js: "+f)}},{key:"escapeStr",value:function(f){return f.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}},{key:"createRegExp",value:function(f){return this.opt.wildcards!=="disabled"&&(f=this.setupWildcardsRegExp(f)),f=this.escapeStr(f),Object.keys(this.opt.synonyms).length&&(f=this.createSynonymsRegExp(f)),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(f=this.setupIgnoreJoinersRegExp(f)),this.opt.diacritics&&(f=this.createDiacriticsRegExp(f)),f=this.createMergedBlanksRegExp(f),(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(f=this.createJoinersRegExp(f)),this.opt.wildcards!=="disabled"&&(f=this.createWildcardsRegExp(f)),f=this.createAccuracyRegExp(f),f}},{key:"createSynonymsRegExp",value:function(f){var h=this.opt.synonyms,d=this.opt.caseSensitive?"":"i",p=this.opt.ignoreJoiners||this.opt.ignorePunctuation.length?"\0":"";for(var m in h)if(h.hasOwnProperty(m)){var g=h[m],y=this.opt.wildcards!=="disabled"?this.setupWildcardsRegExp(m):this.escapeStr(m),O=this.opt.wildcards!=="disabled"?this.setupWildcardsRegExp(g):this.escapeStr(g);y!==""&&O!==""&&(f=f.replace(new RegExp("("+this.escapeStr(y)+"|"+this.escapeStr(O)+")","gm"+d),p+("("+this.processSynomyms(y)+"|")+(this.processSynomyms(O)+")")+p))}return f}},{key:"processSynomyms",value:function(f){return(this.opt.ignoreJoiners||this.opt.ignorePunctuation.length)&&(f=this.setupIgnoreJoinersRegExp(f)),f}},{key:"setupWildcardsRegExp",value:function(f){return f=f.replace(/(?:\\)*\?/g,function(h){return h.charAt(0)==="\\"?"?":""}),f.replace(/(?:\\)*\*/g,function(h){return h.charAt(0)==="\\"?"*":""})}},{key:"createWildcardsRegExp",value:function(f){var h=this.opt.wildcards==="withSpaces";return f.replace(/\u0001/g,h?"[\\S\\s]?":"\\S?").replace(/\u0002/g,h?"[\\S\\s]*?":"\\S*")}},{key:"setupIgnoreJoinersRegExp",value:function(f){return f.replace(/[^(|)\\]/g,function(h,d,p){var m=p.charAt(d+1);return/[(|)\\]/.test(m)||m===""?h:h+"\0"})}},{key:"createJoinersRegExp",value:function(f){var h=[],d=this.opt.ignorePunctuation;return Array.isArray(d)&&d.length&&h.push(this.escapeStr(d.join(""))),this.opt.ignoreJoiners&&h.push("\\u00ad\\u200b\\u200c\\u200d"),h.length?f.split(/\u0000+/).join("["+h.join("")+"]*"):f}},{key:"createDiacriticsRegExp",value:function(f){var h=this.opt.caseSensitive?"":"i",d=this.opt.caseSensitive?["aàáảãạăằắẳẵặâầấẩẫậäåāą","AÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ","cçćč","CÇĆČ","dđď","DĐĎ","eèéẻẽẹêềếểễệëěēę","EÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ","iìíỉĩịîïī","IÌÍỈĨỊÎÏĪ","lł","LŁ","nñňń","NÑŇŃ","oòóỏõọôồốổỗộơởỡớờợöøō","OÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ","rř","RŘ","sšśșş","SŠŚȘŞ","tťțţ","TŤȚŢ","uùúủũụưừứửữựûüůū","UÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ","yýỳỷỹỵÿ","YÝỲỶỸỴŸ","zžżź","ZŽŻŹ"]:["aàáảãạăằắẳẵặâầấẩẫậäåāąAÀÁẢÃẠĂẰẮẲẴẶÂẦẤẨẪẬÄÅĀĄ","cçćčCÇĆČ","dđďDĐĎ","eèéẻẽẹêềếểễệëěēęEÈÉẺẼẸÊỀẾỂỄỆËĚĒĘ","iìíỉĩịîïīIÌÍỈĨỊÎÏĪ","lłLŁ","nñňńNÑŇŃ","oòóỏõọôồốổỗộơởỡớờợöøōOÒÓỎÕỌÔỒỐỔỖỘƠỞỠỚỜỢÖØŌ","rřRŘ","sšśșşSŠŚȘŞ","tťțţTŤȚŢ","uùúủũụưừứửữựûüůūUÙÚỦŨỤƯỪỨỬỮỰÛÜŮŪ","yýỳỷỹỵÿYÝỲỶỸỴŸ","zžżźZŽŻŹ"],p=[];return f.split("").forEach(function(m){d.every(function(g){if(g.indexOf(m)!==-1){if(p.indexOf(g)>-1)return!1;f=f.replace(new RegExp("["+g+"]","gm"+h),"["+g+"]"),p.push(g)}return!0})}),f}},{key:"createMergedBlanksRegExp",value:function(f){return f.replace(/[\s]+/gmi,"[\\s]+")}},{key:"createAccuracyRegExp",value:function(f){var h=this,d="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~¡¿",p=this.opt.accuracy,m=typeof p=="string"?p:p.value,g=typeof p=="string"?[]:p.limiters,y="";switch(g.forEach(function(O){y+="|"+h.escapeStr(O)}),m){case"partially":default:return"()("+f+")";case"complementary":return y="\\s"+(y||this.escapeStr(d)),"()([^"+y+"]*"+f+"[^"+y+"]*)";case"exactly":return"(^|\\s"+y+")("+f+")(?=$|\\s"+y+")"}}},{key:"getSeparatedKeywords",value:function(f){var h=this,d=[];return f.forEach(function(p){h.opt.separateWordSearch?p.split(" ").forEach(function(m){m.trim()&&d.indexOf(m)===-1&&d.push(m)}):p.trim()&&d.indexOf(p)===-1&&d.push(p)}),{keywords:d.sort(function(p,m){return m.length-p.length}),length:d.length}}},{key:"isNumeric",value:function(f){return Number(parseFloat(f))==f}},{key:"checkRanges",value:function(f){var h=this;if(!Array.isArray(f)||Object.prototype.toString.call(f[0])!=="[object Object]")return this.log("markRanges() will only accept an array of objects"),this.opt.noMatch(f),[];var d=[],p=0;return f.sort(function(m,g){return m.start-g.start}).forEach(function(m){var g=h.callNoMatchOnInvalidRanges(m,p),y=g.start,O=g.end,v=g.valid;v&&(m.start=y,m.length=O-y,d.push(m),p=O)}),d}},{key:"callNoMatchOnInvalidRanges",value:function(f,h){var d=void 0,p=void 0,m=!1;return f&&typeof f.start<"u"?(d=parseInt(f.start,10),p=d+parseInt(f.length,10),this.isNumeric(f.start)&&this.isNumeric(f.length)&&p-h>0&&p-d>0?m=!0:(this.log("Ignoring invalid or overlapping range: "+(""+JSON.stringify(f))),this.opt.noMatch(f))):(this.log("Ignoring invalid range: "+JSON.stringify(f)),this.opt.noMatch(f)),{start:d,end:p,valid:m}}},{key:"checkWhitespaceRanges",value:function(f,h,d){var p=void 0,m=!0,g=d.length,y=h-g,O=parseInt(f.start,10)-y;return O=O>g?g:O,p=O+parseInt(f.length,10),p>g&&(p=g,this.log("End range automatically set to the max value of "+g)),O<0||p-O<0||O>g||p>g?(m=!1,this.log("Invalid range: "+JSON.stringify(f)),this.opt.noMatch(f)):d.substring(O,p).replace(/\s+/g,"")===""&&(m=!1,this.log("Skipping whitespace only range: "+JSON.stringify(f)),this.opt.noMatch(f)),{start:O,end:p,valid:m}}},{key:"getTextNodes",value:function(f){var h=this,d="",p=[];this.iterator.forEachNode(NodeFilter.SHOW_TEXT,function(m){p.push({start:d.length,end:(d+=m.textContent).length,node:m})},function(m){return h.matchesExclude(m.parentNode)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},function(){f({value:d,nodes:p})})}},{key:"matchesExclude",value:function(f){return o.matches(f,this.opt.exclude.concat(["script","style","title","head","html"]))}},{key:"wrapRangeInTextNode",value:function(f,h,d){var p=this.opt.element?this.opt.element:"mark",m=f.splitText(h),g=m.splitText(d-h),y=document.createElement(p);return y.setAttribute("data-markjs","true"),this.opt.className&&y.setAttribute("class",this.opt.className),y.textContent=m.textContent,m.parentNode.replaceChild(y,m),g}},{key:"wrapRangeInMappedTextNode",value:function(f,h,d,p,m){var g=this;f.nodes.every(function(y,O){var v=f.nodes[O+1];if(typeof v>"u"||v.start>h){if(!p(y.node))return!1;var w=h-y.start,x=(d>y.end?y.end:d)-y.start,S=f.value.substr(0,y.start),_=f.value.substr(x+y.start);if(y.node=g.wrapRangeInTextNode(y.node,w,x),f.value=S+_,f.nodes.forEach(function(k,C){C>=O&&(f.nodes[C].start>0&&C!==O&&(f.nodes[C].start-=x),f.nodes[C].end-=x)}),d-=x,m(y.node.previousSibling,y.start),d>y.end)h=y.end;else return!1}return!0})}},{key:"wrapMatches",value:function(f,h,d,p,m){var g=this,y=h===0?0:h+1;this.getTextNodes(function(O){O.nodes.forEach(function(v){v=v.node;for(var w=void 0;(w=f.exec(v.textContent))!==null&&w[y]!=="";)if(d(w[y],v)){var x=w.index;if(y!==0)for(var S=1;S ",1);function nBe(t,e){let n=Xe(e,"pageSize",3,50),r=pe(0),i=L(()=>Math.ceil(e.count/n()));var s=tBe(),o=ke(s);{var a=f=>{vC(f,{get currentPage(){return b(r)},get pageCount(){return b(i)},onChange:h=>{X(r,h)}})};oe(o,f=>{b(i)>1&&f(a)})}var l=V(o,2);{let f=L(()=>({start:b(r)*n(),end:Math.min(e.count,b(r)*n()+n())}));Eo(l,()=>e.children,()=>b(f))}var u=V(l,2);{var c=f=>{vC(f,{get currentPage(){return b(r)},get pageCount(){return b(i)},onChange:h=>{X(r,h)}})};oe(u,f=>{b(i)>1&&f(c)})}I(t,s)}var rBe=G('
    Distance
    '),iBe=G('
    ',1),sBe=G('

    ');function oBe(t,e){De(e,!0);let n=Xe(e,"limit",3,100);function r(y,O){new eBe(y).mark(O)}let i=L(()=>e.items.length==0?"No result found.":e.items.length==1?`${e.items.length.toLocaleString()} result.`:e.items.length>=n()?`More than ${e.items.length.toLocaleString()} results, showing top ${n().toLocaleString()}.`:`${e.items.length.toLocaleString()} results.`);var s=sBe(),o=M(s),a=M(o),l=M(a),u=M(l,!0);F(l);var c=V(l,2),f=M(c,!0);F(c),F(a);var h=V(a,2),d=M(h);d.__click=()=>{e.onClose?.()};var p=M(d);sd(p,{}),F(d),F(h),F(o);var m=V(o,4),g=M(m);nBe(g,{get count(){return e.items.length},children:(O,v)=>{let w=()=>v?.().start,x=()=>v?.().end;var S=ot(),_=ke(S);Ot(_,16,()=>e.items.slice(w(),x()),k=>k,(k,C)=>{var D=iBe(),A=ke(D);A.__click=()=>{e.onClick?.(C)};var E=M(A);{var T=Q=>{var B=rBe(),q=M(B),z=V(M(q),2),ee=M(z,!0);F(z),F(q),F(B),de(W=>ut(ee,W),[()=>C.distance.toFixed(5)]),I(Q,B)};oe(E,Q=>{C.distance!=null&&Q(T)})}var R=V(E,2),$=M(R);{let Q=L(()=>e.columnStyles??{});fT($,{get values(){return C.fields},get columnStyles(){return b(Q)}})}F(R),Zn(R,(Q,B)=>r?.(Q,B),()=>e.highlight),F(A),ws(2),I(k,D)}),I(O,S)},$$slots:{default:!0}}),F(m),F(s),de(()=>{ut(u,e.label),ut(f,b(i))}),I(t,s),Pe()}dn(["click"]);function dk(t,e){De(e,!0);let n=Xe(e,"label",3,null),r=Xe(e,"icon",3,null),i=Xe(e,"title",3,""),s=Xe(e,"order",3,null),o=pe("ready"),a=null;async function l(){if(e.onClick&&b(o)!="running"){X(o,"running");try{await e.onClick(),X(o,"success"),a!=null&&clearTimeout(a),a=setTimeout(()=>{b(o)=="success"&&X(o,"ready")},2e3)}catch(u){X(o,"error"),console.error(u)}}}{let u=L(()=>b(o)=="ready"?r():b(o)=="running"?n8:b(o)=="success"?JE:JX);Nu(t,{get label(){return n()},get icon(){return b(u)},get title(){return i()},get order(){return s()},get class(){return e.class},onClick:l})}Pe()}var aBe=G(' '),lBe=G('
    ');function uBe(t,e){let n=Xe(e,"status",3,"Loading...");var r=lBe(),i=M(r);n8(i,{class:"text-blue-500"});var s=V(i,2);{var o=a=>{var l=aBe(),u=M(l,!0);F(l),de(()=>ut(u,n())),I(a,l)};oe(s,a=>{n()!=null&&a(o)})}F(r),I(t,r)}class cBe{contents;constructor(){this.contents=new Map}get(e){return this.contents.get(e)??null}set(e,n){this.contents.set(e,n)}value(e,n){if(this.contents.has(e))return this.contents.get(e);const r=n();return this.contents.set(e,r),r}}const xC="0.18.1";var uv={exports:{}},fBe=uv.exports,X$;function hBe(){return X$||(X$=1,(function(t){(function(e,n){t.exports?t.exports=n():e.jsonSchema=n()})(fBe,function(){var e=r;e.Integer={type:"integer"};var n={String,Boolean,Number,Object,Array,Date};e.validate=r;function r(i,s){return r(i,s,{changing:!1})}e.checkPropertyChange=function(i,s,o){return r(i,s,{changing:o||"property"})};var r=e._validate=function(i,s,o){o||(o={});var a=o.changing;function l(h){return h.type||n[h.name]==h&&h.name.toLowerCase()}var u=[];function c(h,d,p,m){var g;p+=p?typeof m=="number"?"["+m+"]":typeof m>"u"?"":"."+m:m;function y(k){u.push({property:p,message:k})}if((typeof d!="object"||d instanceof Array)&&(p||typeof d!="function")&&!(d&&l(d)))return typeof d=="function"?h instanceof d||y("is not an instance of the class/constructor "+d.name):d&&y("Invalid schema/property definition "+d),null;a&&d.readonly&&y("is a readonly field, it can not be changed"),d.extends&&c(h,d.extends,p,m);function O(k,C){if(k){if(typeof k=="string"&&k!="any"&&(k=="null"?C!==null:typeof C!=k)&&!(C instanceof Array&&k=="array")&&!(C instanceof Date&&k=="date")&&!(k=="integer"&&C%1===0))return[{property:p,message:C+" - "+typeof C+" value found, but a "+k+" is required"}];if(k instanceof Array){for(var D=[],A=0;Ad.maxItems&&y("There must be a maximum of "+d.maxItems+" in the array")}else(d.properties||d.additionalProperties)&&u.concat(f(h,d.properties,p,d.additionalProperties));if(d.pattern&&typeof h=="string"&&!h.match(d.pattern)&&y("does not match the regex pattern "+d.pattern),d.maxLength&&typeof h=="string"&&h.length>d.maxLength&&y("may only be "+d.maxLength+" characters long"),d.minLength&&typeof h=="string"&&h.lengthh&&y("must have a minimum value of "+d.minimum),typeof d.maximum<"u"&&typeof h==typeof d.maximum&&d.maximumqo({table:e.context.table,columns:e.context.columns})},{name:"run_sql_query",description:"Run a readonly SQL query in DuckDB.",inputSchema:{type:"object",properties:{query:{type:"string",description:"The SQL query to run, must be readonly."}},additionalProperties:!1},execute:async i=>{let s=await e.context.coordinator.query(i.query);return qo(s.toArray())}},{name:"list_renderers",description:"Get a list of value renderers to display values in the table, cards, or tooltip. Renderers can be set in ColumnStyle",inputSchema:{type:"object",additionalProperties:!1},execute:async()=>qo(A8)},{name:"get_column_styles",description:"Get column styles for all columns.",inputSchema:{type:"object",additionalProperties:!1},execute:async()=>qo(e.columnStyles)},{name:"set_column_style",description:"Set column style for a given column",inputSchema:{type:"object",properties:{column:{type:"string"},style:{type:"object",description:`The column style. Schema: ${JSON.stringify(j3e)}. Use the list_renderers tool to get the list of renderers.`}},additionalProperties:!1},execute:async i=>(e.columnStyles={...e.columnStyles,[i.column]:i.style},Xo("success"))},{name:"list_charts",description:"List all charts in Embedding Atlas.",inputSchema:{type:"object",additionalProperties:!1},execute:async()=>qo(e.charts)},{name:"add_chart",description:"Create a new chart with the specification, returns the id of the new chart.",inputSchema:{type:"object",properties:{spec:{type:"object",description:` The chart specification. Schema: ${JSON.stringify(HO)}. Notes: - The data might be very large (>100k) points. Try not to create a chart that has no aggregation. - Add "filter": "$filter" to appropriate layers to make the chart respond to filters from other charts. The filter is a cross-filter. - When creating a chart, consider adding interactivity to it. - The plot size is determined by the chart container by default. Refrain from setting it directly. - Before adding a new chart, please list existing charts with list_charts at least once to ensure no duplication. `}},additionalProperties:!1},execute:async i=>{let s=W$.validate(i.spec,HO);if(s.valid){let o=Z_(e.charts);return e.charts={...e.charts,[o]:i.spec},qo({id:o})}else return qo({error:"Spec is invalid",details:s.errors})}},{name:"get_chart_spec",description:"Get the specification of a chart",inputSchema:{type:"object",properties:{id:{type:"string"}},additionalProperties:!1},execute:async i=>qo(e.charts[i.id])},{name:"set_chart_spec",description:"Update the specification of a chart",inputSchema:{type:"object",properties:{id:{type:"string"},spec:{type:"object",description:"The new chart specification, replacing the existing one."}},additionalProperties:!1},execute:async i=>{let s=W$.validate(i.spec,HO);return s.valid?(e.charts={...e.charts,[i.id]:i.spec},Xo("success")):qo({error:"Spec is invalid",details:s.errors})}},{name:"get_chart_state",description:"Get the state of a chart",inputSchema:{type:"object",properties:{id:{type:"string"}},additionalProperties:!1},execute:async i=>qo(e.chartStates[i.id]??{})},{name:"set_chart_state",description:` Update the state of a chart. Schema: ${JSON.stringify(B3e)}. `,inputSchema:{type:"object",properties:{id:{type:"string"},state:{type:"object",description:"The new chart state, replacing the existing one."}},additionalProperties:!1},execute:async i=>(e.chartStates={...e.chartStates,[i.id]:i.state},Xo("success"))},{name:"clear_chart_state",description:"Clear the state of a chart",inputSchema:{type:"object",properties:{id:{type:"string"}},additionalProperties:!1},execute:async i=>(e.chartStates={...e.chartStates,[i.id]:{}},Xo("success"))},{name:"delete_chart",description:"Delete a chart",inputSchema:{type:"object",properties:{id:{type:"string"}},additionalProperties:!1},execute:async i=>(e.charts=Object.fromEntries(Object.entries(e.charts).filter(s=>s[0]!=i.id)),e.chartStates=Object.fromEntries(Object.entries(e.chartStates).filter(s=>s[0]!=i.id)),Xo("success"))},{name:"get_chart_screenshot",description:"Get a screenshot of a chart",inputSchema:{type:"object",properties:{id:{type:"string"}},additionalProperties:!1},execute:async i=>{let s=e.chartDelegates.get(i.id);if(s!=null){for(let o of s)if(o.screenshot){let a=await o.screenshot(n);return Y$(a)}}return Xo("chart does not support taking screenshot")}},{name:"get_layout_type",description:"Get the type of the current layout ('list' or 'dashboard')",inputSchema:{type:"object",additionalProperties:!1},execute:async()=>Xo(e.layout)},{name:"set_layout_type",description:"Set the type of the current layout ('list' or 'dashboard')",inputSchema:{type:"object",properties:{type:{type:"string"}},additionalProperties:!1},execute:async i=>(e.layout=i.type,Xo("success"))},{name:"get_layout_state",description:"Get the state of the current layout",inputSchema:{type:"object",additionalProperties:!1},execute:async()=>qo(e.layoutStates[e.layout]??{})},{name:"set_layout_state",description:"Set the state of the current layout",inputSchema:{type:"object",properties:{state:{type:"object",description:` The new chart state, replacing the existing one. Schema: - dashboard layout state: ${JSON.stringify(z3e)} - list layout state: ${JSON.stringify(U3e)} `}},additionalProperties:!1},execute:async i=>(e.layoutStates={...e.layoutStates,[e.layout]:i.state},Xo("success"))},{name:"get_full_screenshot",description:"Get a full screenshot of the application",inputSchema:{type:"object",additionalProperties:!1},execute:async()=>{let i=await EH(e.container,n);return Y$(i)}}];t.provideContext({tools:r})}function Xo(t){return{content:[{type:"text",text:t.toString()}]}}function qo(t){return Xo(JSON.stringify(t))}function Y$(t){let e=pBe(t);return e?{content:[{type:"image",data:e.data,mimeType:e.mimeType}]}:Xo("failed to take screenshot")}function pBe(t){if(!t.startsWith("data:"))return null;const e=t.indexOf(",");if(e===-1)return null;const n=t.substring(5,e),r=t.substring(e+1);let i;return n.includes(";base64")?i=n.replace(";base64",""):n.includes(";")?i=n.split(";")[0]:i=n,!i.startsWith("image/")||i!=="image/png"&&i!=="image/jpeg"?null:{mimeType:i,data:r}}class mBe{worker;callbacks;constructor(){this.worker=new Worker(new URL(""+new URL("search.worker-t1sBWce_.js",import.meta.url).href,import.meta.url),{type:"module"}),this.callbacks=new Map,this.worker.onmessage=e=>{let n=this.callbacks.get(e.data.identifier);n!=null&&(this.callbacks.delete(e.data.identifier),n(e.data))}}rpc(e){return new Promise((n,r)=>{let i=new Date().getTime()+"-"+Math.random();this.callbacks.set(i,n),this.worker.postMessage({...e,identifier:i})})}async clear(){await this.rpc({type:"clear"})}async addPoints(e){await this.rpc({type:"points",points:e})}async query(e,n){return(await this.rpc({type:"query",query:e,limit:n})).result}}class gBe{coordinator;table;columns;backend;currentIndex=null;constructor(e,n,r){this.coordinator=e,this.table=n,this.columns=r,this.currentIndex=null,this.backend=new mBe}predicateString(e){return e!=null&&e.toString()!=""?e.toString():null}buildIndexIfNeeded(e){let n=async()=>{let i;r!=null?i=await this.coordinator.query(` SELECT ${ae(this.columns.id)} AS id, ${ae(this.columns.text)} AS text FROM ${this.table} WHERE ${r} `):i=await this.coordinator.query(` SELECT ${ae(this.columns.id)} AS id, ${ae(this.columns.text)} AS text FROM ${this.table} `),await this.backend.clear(),await this.backend.addPoints(Array.from(i))},r=this.predicateString(e);if(this.currentIndex!=null){if(this.currentIndex.predicate!=r){let i=this.currentIndex.promise.then(()=>n());this.currentIndex={predicate:r,promise:i}}}else{let i=n();this.currentIndex={predicate:r,promise:i}}return this.currentIndex.promise}async fullTextSearch(e,n={}){let r=n.limit??100,i=n.predicate;return n?.onStatus?.("Indexing..."),await this.buildIndexIfNeeded(i),n?.onStatus?.("Searching..."),(await this.backend.query(e,r)).map(o=>({id:o}))}}async function yBe(t,e,n,r,i,s){let o=[`${ae(n.id,e)} AS id`];n.x&&o.push(`${ae(n.x,e)} AS x`),n.y&&o.push(`${ae(n.y,e)} AS y`),n.text&&o.push(`${ae(n.text,e)} AS text`);let a=r??{};for(let d in a){let p=a[d];typeof p=="string"?o.push(`${ae(p,e)} AS "field_${d}"`):o.push(`${Ze(p.sql)} AS "field_${d}"`)}let l=s.map(d=>d.id),u=new Map,c=new Map;for(let d=0;dAe(d)).join(", ")}] ${i?`AND (${i})`:""} ) LEFT JOIN ${e} ON ${ae(n.id,e)} = __search_result_id__ `),h=Array.from(f).map(d=>{let p={id:d.id,distance:c.get(d.id)?.distance,fields:{}};for(let m in d)m.startsWith("field_")?p.fields[m.substring(6)]=d[m]:p[m]=d[m];return p});return h=h.sort((d,p)=>(u.get(d.id)??0)-(u.get(p.id)??0)),h}function bBe(t){let{coordinator:e,table:n,idColumn:r,searcher:i,textColumn:s,neighborsColumn:o}=t;if(i===null)return{};let a={};if(i?.fullTextSearch!=null)a.fullTextSearch=i.fullTextSearch.bind(i);else if(s!=null){let l=new gBe(e,n,{id:r,text:s});a.fullTextSearch=l.fullTextSearch.bind(l)}return i?.vectorSearch!=null&&(a.vectorSearch=i.vectorSearch.bind(i)),i?.nearestNeighbors!=null?a.nearestNeighbors=i.nearestNeighbors.bind(i):o!=null&&(a.nearestNeighbors=async l=>{let u=Be.from(n).select({knn:ae(o)}).where(qs(ae(r),Ae(l))),c=await e.query(u),f=Array.from(c);if(f.length!=1)return[];let{distances:h,ids:d}=f[0].knn;return Array.from(d).map((m,g)=>({id:m,distance:h[g]})).filter(m=>m.id!=l)}),a}async function OBe({searcher:t,predicate:e,query:n,mode:r,limit:i,onStatus:s}){s("Searching...");let o=[];if(n.toString(),r=="full-text"&&t.fullTextSearch!=null)n=n.trim(),o=await t.fullTextSearch(n,{limit:i,predicate:e,onStatus:s});else if(r=="vector"&&t.vectorSearch!=null)n=n.trim(),o=await t.vectorSearch(n,{limit:i,predicate:e,onStatus:s});else if(r=="neighbors"&&t.nearestNeighbors!=null)""+n.toString(),o=await t.nearestNeighbors(n,{limit:i,predicate:e,onStatus:s});else return[];return o}let fK=typeof window<"u"?window.matchMedia?.("(prefers-color-scheme: dark)"):null,W_=Xi(fK?.matches?"dark":"light");fK?.addEventListener("change",t=>{W_.set(t.matches?"dark":"light")});function vBe(){let t=Xi(null);return{colorScheme:ty([W_,t],([n,r])=>r??n),userColorScheme:t}}function wBe(t,e){let n=0;return(...r)=>{const i=++n;t(...r).then(s=>{i===n&&e(s)}).catch(s=>{console.error(s)})}}var xBe=G('
    '),_Be=G('
    '),SBe=G('
    '),kBe=G('
    Embedding Atlas
    '),CBe=G(''),ABe=G('
    '),EBe=G('
    '),TBe=G('

    Column Styles

    ',1),DBe=G('
    '),PBe=G('
    Connecting...',1),RBe=G('
    Connected',1),IBe=G('
    Error or server closed connection',1),FBe=G('

    MCP (Model Context Protocol)

    ',1),$Be=G('

    Export

    About

    '),MBe=G('
    ',1),LBe=G('
    ');function hK(t,e){De(e,!0);const n=()=>hr(c,"$colorScheme",s),r=()=>hr(E,"$searchResultStore",s),i=()=>hr(v,"$resolvedColumnStyles",s),[s,o]=Lo(),a=500;let l=Xe(e,"embeddingViewConfig",3,null),u=Xe(e,"embeddingViewLabels",3,null);const{colorScheme:c,userColorScheme:f}=vBe();An(()=>{LT(f,e.colorScheme)});let h,d=pe(!1),p=pe("parquet");const m=I6.crossfilter();function g(){return L_(m.predicate(null))}let y=pe([]),O=pe({}),v=Xi({});An(()=>{let Se=w(b(y),b(O));v.set(Se)});function w(Se,gt){let Kt={};for(let Rn of Se)Kt[Rn.name]={display:e.data.text==Rn.name?"full":"badge",...gt[Rn.name]??{}};return Kt}let x=bBe({coordinator:e.coordinator,table:e.data.table,idColumn:e.data.id,textColumn:e.data.text,neighborsColumn:e.data.neighbors,searcher:e.searcher}),S=[...x.fullTextSearch!=null?["full-text"]:[],...x.vectorSearch!=null?["vector"]:[],...x.nearestNeighbors!=null?["neighbors"]:[]];const _={"full-text":{value:"full-text",label:"Full Text"},vector:{value:"vector",label:"Vector"},neighbors:{value:"neighbors",label:"Neighbors"}};let k=pe("full-text"),C=pe(""),D=pe(""),A=pe(!1),E=Xi(null);const T=wBe(async(Se,gt)=>{X(A,!0);let Kt=g(),Rn=await OBe({searcher:x,predicate:Kt,query:Se,mode:gt,limit:a,onStatus:jt=>{X(D,jt,!0)}}),Ri=await yBe(e.coordinator,e.data.table,{id:e.data.id,x:e.data.projection?.x,y:e.data.projection?.y,text:e.data.text},Object.fromEntries(b(y).map(jt=>[jt.name,jt.name])),Kt,Rn),Bn=Se.toString().trim(),er=Se.toString().trim();return gt=="neighbors"&&(Bn="Neighbors of #"+Se.toString(),er=""),X(D,""),{query:Se,mode:gt,ids:Ri.map(jt=>jt.id),label:Bn,highlight:er,items:Ri}},Se=>{E.set(Se)}),R=qC(T,500);function $(){E.set(null),X(A,!1)}An(()=>{b(C)==""?$():R(b(C),b(k))});function Q(){for(let Se of m.clauses)Se.source?.reset?.(),m.update({...Se,value:null,predicate:null});globalThis.dispatchEvent?.(new CustomEvent("nemotron-atlas-filters-cleared"))}function nV3HiddenFields(){return(e.defaultChartsConfig?.exclude??[]).concat(["emb","true_rows","True_rows","row_id","text","dataset_full_name","source_file","source_line","source_group","projection_x","projection_y","num_tool_calls","pass_rate","__collection_source","license","benchmark_task_id","benchmark_query_id","benchmark_row_id","benchmark_accuracy","row_kind","available_rows","sample_rows","samples_rows","smaples_rows","sample_policy","sub_file","row_x","row_y","Collection","collection","Collection_memberships"])}function nV3CleanChart(Se){if(Se==null||typeof Se!="object")return Se;let gt=Se.data?.field,Kt=Se.data?.category;if(Se.type==="embedding"&&(Kt==null||Kt===""))Se={...Se,data:{...Se.data,category:"dataset"}},Kt="dataset";let Rn=typeof Se.title=="string"?Se.title:"",nV3Hidden=nV3HiddenFields(),nV3SidebarChartFields=["num_tool_calls","pass_rate"],nV3HiddenForChart=nV3Hidden.filter(nV3Field=>nV3SidebarChartFields.indexOf(nV3Field)<0),nV3ChartJson=JSON.stringify(Se);if(nV3Hidden.indexOf(gt)>=0&&nV3SidebarChartFields.indexOf(gt)<0||nV3Hidden.indexOf(Kt)>=0)return null;if(Se.type!=="predicates"&&nV3HiddenForChart.some(nV3Field=>Rn===nV3Field||nV3ChartJson.indexOf(`"field":"${nV3Field}"`)>=0||nV3ChartJson.indexOf(`"category":"${nV3Field}"`)>=0))return null;if(Se.type==="embedding"&&(Kt==="Collection"||Kt==="collection"))return{...Se,data:{...Se.data,category:"pipeline_stage"}};if((gt==="Collection"||gt==="collection")&&Rn==="Collection")return null;if(Rn==="Collection")return null;if(JSON.stringify(Se).indexOf('"field":"Collection"')>=0||JSON.stringify(Se).indexOf('"field":"collection"')>=0)return null;if(Se.type==="predicates"){let nV3PredicateHidden=nV3Hidden.filter(nV3Field=>["num_turns","num_tool_calls","has_tools","pass_rate"].indexOf(nV3Field)<0),nV3HiddenPredicate=Kt=>{let Ri=String(Kt?.predicate??""),Bn=String(Kt?.name??""),er=Ri.split(/[^A-Za-z0-9_]+/);return nV3PredicateHidden.some(jt=>er.indexOf(jt)>=0||Bn.indexOf(jt)>=0)||Ri.indexOf("Benchmark")>=0||Bn.indexOf("Benchmark")>=0},gt=(Array.isArray(Se.items)?Se.items:[]).filter(Kt=>!nV3HiddenPredicate(Kt)).filter(Kt=>!(typeof Kt?.predicate=="string"&&/\bCollection\b/.test(Kt.predicate)&&Kt.predicate.indexOf("Collections")<0));return{...Se,items:gt}}return Se}function nV3CleanCharts(Se){let gt=[],Kt=null,nV3DatasetChart=null,nV3UsedInChart=null,nV3HasToolsChart=null,nV3NumTurnsChart=null,nV3NumToolCallsChart=null,nV3PassRateChart=null,nV3PredicatesChart=null,nV3RowKindChart=null,nV3BenchAccuracyChart=null;for(let[Rn,Ri]of Object.entries(Se??{})){let Bn=nV3CleanChart(Ri);Bn!=null&&(Bn.data?.field==="Collections"?Kt=Bn:Bn.data?.field==="dataset"?nV3DatasetChart=Bn:Bn.data?.field==="Used_in"?nV3UsedInChart=Bn:Bn.data?.field==="has_tools"?nV3HasToolsChart=Bn:Bn.data?.field==="num_turns"?nV3NumTurnsChart=Bn:Bn.data?.field==="num_tool_calls"?nV3NumToolCallsChart=Bn:Bn.data?.field==="pass_rate"?nV3PassRateChart=Bn:Bn.type==="predicates"?nV3PredicatesChart=Bn:Bn.data?.field==="row_kind"?nV3RowKindChart=Bn:Bn.data?.field==="benchmark_accuracy"?nV3BenchAccuracyChart=Bn:gt.push(Bn))}let Rn=e.defaultChartsConfig?.override?.Collections,nV3DatasetDefault=e.defaultChartsConfig?.override?.dataset,nV3UsedInDefault=e.defaultChartsConfig?.override?.Used_in,nV3HasToolsDefault=e.defaultChartsConfig?.override?.has_tools,nV3NumTurnsDefault=e.defaultChartsConfig?.override?.num_turns,nV3NumToolCallsDefault=e.defaultChartsConfig?.override?.num_tool_calls,nV3PassRateDefault=e.defaultChartsConfig?.override?.pass_rate,nV3PredicatesDefault=e.defaultChartsConfig?.predicates,nV3RowKindDefault=e.defaultChartsConfig?.override?.row_kind,nV3BenchAccuracyDefault=e.defaultChartsConfig?.override?.benchmark_accuracy,Ri=[];for(let Bn of gt)Bn.type==="embedding"&&Ri.push(Bn);(nV3PredicatesChart!=null||nV3PredicatesDefault!=null)&&Ri.push({type:"predicates",...(nV3PredicatesDefault??{}),...(nV3PredicatesChart??{}),items:[...(nV3PredicatesDefault?.items??[]),...(nV3PredicatesChart?.items??[])].filter((Bn,er,jt)=>jt.findIndex(jr=>jr.predicate===Bn.predicate&&jr.name===Bn.name)===er),title:"SQL Predicates"}),(Kt!=null||Rn!=null)&&Ri.push({...(Kt??Rn),title:"Collections"}),(nV3DatasetChart!=null||nV3DatasetDefault!=null)&&Ri.push({...(nV3DatasetChart??nV3DatasetDefault),title:"Dataset"}),(nV3UsedInChart!=null||nV3UsedInDefault!=null)&&Ri.push({...(nV3UsedInChart??nV3UsedInDefault),title:"Used in"}),(nV3HasToolsChart!=null||nV3HasToolsDefault!=null)&&Ri.push({...(nV3HasToolsChart??nV3HasToolsDefault),title:"has_tools"}),(nV3NumTurnsChart!=null||nV3NumTurnsDefault!=null)&&Ri.push({...(nV3NumTurnsChart??nV3NumTurnsDefault),title:"num_turns"}),(nV3NumToolCallsChart!=null||nV3NumToolCallsDefault!=null)&&Ri.push({...(nV3NumToolCallsChart??nV3NumToolCallsDefault),title:"num_tool_calls"}),(nV3PassRateChart!=null||nV3PassRateDefault!=null)&&Ri.push({...(nV3PassRateChart??nV3PassRateDefault),title:"pass_rate"}),(nV3RowKindChart!=null||nV3RowKindDefault!=null)&&Ri.push({...(nV3RowKindChart??nV3RowKindDefault),title:"row_kind"}),(nV3BenchAccuracyChart!=null||nV3BenchAccuracyDefault!=null)&&Ri.push({...(nV3BenchAccuracyChart??nV3BenchAccuracyDefault),title:"benchmark_accuracy"});for(let Bn of gt)Bn.type!=="embedding"&&Ri.push(Bn);return Object.fromEntries(Ri.map((Bn,er)=>[`${er+1}`,Bn]))}function B(Se){let gt=nV3CleanCharts(Se.charts??{}),nV3HasPredicateDefaults=Object.values(gt).some(Kt=>Kt?.type==="predicates"&&(Kt.items??[]).some(Rn=>["num_turns","num_tool_calls","has_tools","pass_rate"].some(Ri=>String(Rn?.predicate??"").indexOf(Ri)>=0)));X(K,gt),X(H,{}),X(J,nV3HasPredicateDefaults?"list":Se.layout??"list"),X(Y,Object.fromEntries(Object.entries(Se.layoutStates??{}).filter(([Kt])=>gt[Kt]!=null))),X(O,Object.fromEntries(Object.entries(Se.columnStyles??{}).filter(([Kt])=>nV3HiddenFields().indexOf(Kt)<0)))}function q(){let Se=nV3CleanCharts(b(K)),gt=Object.fromEntries(Object.entries(b(H)).filter(([Kt])=>Se[Kt]!=null)),Kt=Object.fromEntries(Object.entries(b(Y)).filter(([Rn])=>Se[Rn]!=null)),Rn=Object.fromEntries(Object.entries(b(O)).filter(([Ri])=>nV3HiddenFields().indexOf(Ri)<0));return{version:xC,timestamp:new Date().getTime()/1e3,charts:Se,chartStates:gt,layout:b(J),layoutStates:Kt,columnStyles:Rn,predicate:g()}}ki(()=>{b(d)&&e.onStateChange?.(q())}),Ah(async()=>{let nV3AllColumns=await bH(e.coordinator,e.data.table);if(X(y,nV3AllColumns.filter(Se=>{let gt=nV3HiddenFields();return!Se.name.startsWith("__")&>.indexOf(Se.name)<0})),W.columns=b(y),W.predicateColumns=nV3AllColumns.filter(Se=>!Se.name.startsWith("__")),e.initialState&&B(e.initialState),Object.keys(b(K)).length==0){let Se=await aQe({coordinator:e.coordinator,table:e.data.table,id:e.data.id,projection:e.data.projection?{...e.data.projection,text:e.data.text??void 0}:void 0,config:e.defaultChartsConfig??void 0});X(K,nV3CleanCharts(Object.fromEntries(Se.map((gt,Kt)=>[`${Kt+1}`,gt]))))}X(d,!0)});function z(Se){if(Se.key=="Escape"){Q(),Se.preventDefault();try{document.activeElement?.blur?.()}catch{}}}let ee=Xi(e.chartTheme??void 0);An(()=>{ee.set(e.chartTheme??void 0)});let W={coordinator:e.coordinator,filter:m,table:e.data.table,id:e.data.id,columns:[],colorScheme:c,theme:ee,columnStyles:v,cache:new cBe,persistentCache:e.cache??{get:async()=>null,set:async(Se,gt)=>{}},searchModes:S,search:T,searchResult:E,highlight:Xi(null),semanticHighlights:Xi(null),benchmarkOverlay:Xi(null),embeddingViewConfig:l(),embeddingViewLabels:u(),hiddenFields:nV3HiddenFields()};const nV3VolumePredicatePrefix="Volume bar:",nV3VolumePredicateRetryDelay=100;let nV3PendingDatasetPredicate=null,nV3DatasetPredicateRetry=null;function nV3SqlString(Se){return`'${String(Se).replace(/'/g,"''")}'`}function nV3DatasetPredicate(Se){let gt=[...new Set((Array.isArray(Se)?Se:[Se]).map(Kt=>String(Kt??"").trim()).filter(Boolean))];return gt.length===0?null:gt.length===1?`dataset = ${nV3SqlString(gt[0])}`:`dataset IN (${gt.map(nV3SqlString).join(", ")})`}function nV3ScheduleDatasetPredicateRetry(){nV3DatasetPredicateRetry==null&&(nV3DatasetPredicateRetry=setTimeout(()=>{nV3DatasetPredicateRetry=null;if(nV3PendingDatasetPredicate!=null){let Se=nV3PendingDatasetPredicate;nV3PendingDatasetPredicate=null,nV3SetDatasetPredicate(Se)}},nV3VolumePredicateRetryDelay))}function nV3SetDatasetPredicate(Se){let gt=Object.entries(b(K)).find(([jt,jr])=>jr?.type==="predicates");if(!gt)return nV3PendingDatasetPredicate=Se,nV3ScheduleDatasetPredicateRetry(),!1;let[Kt,Rn]=gt,Ri=nV3DatasetPredicate(Se),Bn=(Rn.items??[]).filter(jt=>!String(jt?.name??"").startsWith(nV3VolumePredicatePrefix)),er=new Set((Rn.items??[]).filter(jt=>String(jt?.name??"").startsWith(nV3VolumePredicatePrefix)).map(jt=>jt.predicate)),jt=(b(H)[Kt]?.selection??[]).filter(jr=>!er.has(jr));if(Ri){let jr=[...new Set((Array.isArray(Se)?Se:[Se]).map(Zl=>String(Zl??"").trim()).filter(Boolean))],Zl=jr.length===1?`Dataset: ${jr[0]}`:`Datasets: ${jr.length} selected`;Bn=[...Bn,{name:`${nV3VolumePredicatePrefix} ${Zl}`,predicate:Ri}],jt=[...jt,Ri]}return X(K,{...b(K),[Kt]:{...Rn,items:Bn}}),X(H,{...b(H),[Kt]:{...(b(H)[Kt]??{}),selection:jt}}),!0};(()=>{const Se=globalThis.__nemotronAtlas=globalThis.__nemotronAtlas??{};Se.setHighlight=gt=>{W.highlight.set(gt==null?null:Array.isArray(gt)?gt:[gt])};Se.clearHighlight=()=>{W.highlight.set(null)};Se.setSemanticHighlights=gt=>{W.semanticHighlights.set(gt==null?null:Array.isArray(gt)?gt:[gt])};Se.clearSemanticHighlights=()=>{W.semanticHighlights.set(null)};Se.setBenchmarkOverlay=gt=>{W.benchmarkOverlay.set(gt==null?null:Array.isArray(gt)?gt:[gt])};Se.clearBenchmarkOverlay=()=>{W.benchmarkOverlay.set(null)};Se.focusSemanticResult=gt=>{W.highlight.set(gt==null?null:[gt])};Se.clearSemanticFocus=()=>{W.highlight.set(null)};Se.setDatasetPredicate=gt=>nV3SetDatasetPredicate(gt);Se.clearDatasetPredicate=()=>nV3SetDatasetPredicate([]);globalThis.dispatchEvent?.(new CustomEvent("nemotron-atlas-ready"))})();let K=pe({}),H=pe({}),J=pe("list"),Y=pe({}),Z=new Map;function he(Se,gt){return Z.has(Se)||Z.set(Se,new Set),Z.get(Se).add(gt),()=>{Z.get(Se)?.delete(gt)}}let me=pe(void 0);Ah(()=>{e.modelContext&&(dBe(e.modelContext,{context:W,set charts(Se){X(K,Se)},get charts(){return b(K)},set chartStates(Se){X(H,Se)},get chartStates(){return b(H)},set layout(Se){X(J,Se)},get layout(){return b(J)},set layoutStates(Se){X(Y,Se)},get layoutStates(){return b(Y)},get chartDelegates(){return Z},get container(){return h},get columnStyles(){return b(O)},set columnStyles(Se){X(O,Se)}}),ki(()=>{let Se=e.modelContext.connectionStatus?.subscribe(gt=>{X(me,gt)});return()=>{Se?.()}}))});async function te(){let Se=JSON.stringify(q());await navigator.clipboard.writeText(Se)}var le=LBe();cl("keydown",vk,z),Ve(le,"",{},{width:"100%",height:"100%"});var ve=M(le);let xe,ue;var Ee=M(ve),Le=M(Ee);{var qe=Se=>{var gt=MBe(),Kt=ke(gt),Rn=M(Kt);{var Ri=un=>{var Yn=SBe(),qr=M(Yn);M_(qr,{type:"search",placeholder:"Search...",className:"w-full max-w-[400px] ",get value(){return b(C)},set value(Vt){X(C,Vt,!0)}});var In=V(qr,2);{var Ii=Vt=>{{let Rr=L(()=>S.filter(ti=>ti!="neighbors").map(ti=>_[ti]));Zs(Vt,{get options(){return b(Rr)},get value(){return b(k)},onChange:ti=>X(k,ti,!0)})}};oe(In,Vt=>{S.filter(Rr=>Rr!="neighbors").length>1&&Vt(Ii)})}var rs=V(In,2);{var qt=Vt=>{var Rr=_Be();Ve(Rr,"",{},{height:"48em"});var ti=M(Rr);{var Aa=is=>{const tr=L(r);var xn=ot(),xr=ke(xn);bv(xr,()=>b(tr),Fi=>{oBe(Fi,{get items(){return b(tr).items},get label(){return b(tr).label},get highlight(){return b(tr).highlight},limit:a,onClick:async ao=>{W.highlight.set([ao.id])},onClose:$,get columnStyles(){return i()}})}),I(is,xn)},Xl=is=>{var tr=ot(),xn=ke(tr);{var xr=Fi=>{var ao=xBe(),Wl=M(ao);uBe(Wl,{get status(){return b(D)}}),F(ao),I(Fi,ao)};oe(xn,Fi=>{b(D)!=null&&Fi(xr)},!0)}I(is,tr)};oe(ti,is=>{r()!=null?is(Aa):is(Xl,!1)})}F(Rr),I(Vt,Rr)};oe(rs,Vt=>{b(A)&&Vt(qt)})}F(Yn),I(un,Yn)},Bn=un=>{var Yn=kBe();I(un,Yn)};oe(Rn,un=>{b(k).length>0?un(Ri):un(Bn,!1)})}F(Kt);var er=V(Kt,2),jt=M(er);GQe(jt,{get coordinator(){return e.coordinator},get filter(){return m},get table(){return e.data.table}});var jr=V(jt,2),Zl=M(jr);Zl.__click=Q;var yd=M(Zl);sd(yd,{class:"w-5 h-5"}),F(Zl);var vf=V(Zl,2);{var bd=un=>{Uw(un,{title:"Export Selection",button:(qr,In)=>{let Ii=()=>In?.().visible,rs=()=>In?.().toggle;var qt=CBe();qt.__click=function(...ti){rs()?.apply(this,ti)};let Vt;var Rr=M(qt);L3(Rr,{class:"w-5 h-5"}),F(qt),de(()=>Vt=Qt(qt,1,"rounded-md px-1.5 py-1.5 flex select-none items-center focus-visible:outline-2 outline-blue-600 -outline-offset-1",null,Vt,{"text-slate-400":!Ii(),"dark:text-slate-500":!Ii()})),I(qr,qt)},children:(qr,In)=>{var Ii=ABe(),rs=M(Ii),qt=M(rs);dk(qt,{get icon(){return L3},label:"Export Selection",title:"Export the selected points",class:"w-48",onClick:()=>e.onExportSelection(g(),b(p))});var Vt=V(qt,2);Zs(Vt,{label:"Format",get value(){return b(p)},onChange:Rr=>X(p,Rr,!0),options:[{value:"parquet",label:"Parquet"},{value:"jsonl",label:"JSONL"},{value:"json",label:"JSON"},{value:"csv",label:"CSV"}]}),F(rs),F(Ii),I(qr,Ii)},$$slots:{button:!0,default:!0}})};oe(vf,un=>{e.onExportSelection&&un(bd)})}F(jr),F(er);var zo=V(er,2),Ca=M(zo),ns=M(Ca);bv(ns,()=>b(J),un=>{var Yn=EBe(),qr=M(Yn);UQe(qr,{get context(){return W},get charts(){return b(K)},get chartStates(){return b(H)},get layout(){return b(J)},get layoutStates(){return b(Y)},onChartsChange:In=>X(K,In),onChartStatesChange:In=>X(H,In),onLayoutStatesChange:In=>X(Y,In)}),F(Yn),xc(3,Yn,()=>hae),I(un,Yn)}),F(Ca);var oo=V(Ca,2);{let un=L(()=>[{value:"list",icon:bke,title:"List layout"},{value:"dashboard",icon:gke,title:"Dashboard layout"}]);gT(oo,{get value(){return b(J)},onChange:Yn=>X(J,Yn),get options(){return b(un)}})}var oc=V(oo,2);{var wf=un=>{{let Yn=L(()=>n()=="dark"?Pke:Tke);Nu(un,{get icon(){return b(Yn)},title:"Toggle light / dark mode",onClick:()=>{LT(f,n()=="light"?"dark":"light")}})}};oe(oc,un=>{e.colorScheme==null&&un(wf)})}var cm=V(oc,2);Uw(cm,{get icon(){return t8},title:"Options",children:(un,Yn)=>{var qr=$Be(),In=M(qr);{var Ii=tr=>{var xn=TBe(),xr=V(ke(xn),2);WQe(xr,{get columns(){return b(y)},get styles(){return i()},onStylesChange:Fi=>{X(O,Fi)}}),I(tr,xn)};oe(In,tr=>{b(y).length>0&&tr(Ii)})}var rs=V(In,4),qt=M(rs);dk(qt,{get icon(){return eke},label:"Copy State",title:"Copy the current Embedding Atlas state as JSON to clipboard.",class:"w-48",onClick:te}),F(rs);var Vt=V(rs,2);{var Rr=tr=>{var xn=DBe(),xr=M(xn);dk(xr,{get icon(){return L3},label:"Export Application",title:"Download a self-contained static web application",class:"w-48",get onClick(){return e.onExportApplication}}),F(xn),I(tr,xn)};oe(Vt,tr=>{e.onExportApplication&&tr(Rr)})}var ti=V(Vt,2);{var Aa=tr=>{var xn=FBe(),xr=V(ke(xn),2),Fi=M(xr);{var ao=Uo=>{var ie=PBe();ws(),I(Uo,ie)},Wl=Uo=>{var ie=ot(),ye=ke(ie);{var Re=Ne=>{var Je=RBe();ws(),I(Ne,Je)},Qe=Ne=>{var Je=ot(),be=ke(Je);{var j=se=>{var we=IBe();ws(),I(se,we)};oe(be,se=>{(b(me)=="closed"||b(me)=="error")&&se(j)},!0)}I(Ne,Je)};oe(ye,Ne=>{b(me)=="connected"?Ne(Re):Ne(Qe,!1)},!0)}I(Uo,ie)};oe(Fi,Uo=>{b(me)=="connecting"?Uo(ao):Uo(Wl,!1)})}F(xr),I(tr,xn)};oe(ti,tr=>{b(me)&&tr(Aa)})}var Xl=V(ti,4),is=M(Xl);F(Xl),F(qr),de(()=>ut(is,`Embedding Atlas, ${xC}`)),I(un,qr)},$$slots:{default:!0}}),F(zo),I(Se,gt)};oe(Le,Se=>{b(d)&&Se(qe)})}F(Ee);var Fe=V(Ee,2),it=M(Fe);{var St=Se=>{jQe(Se,{get context(){return W},get layout(){return b(J)},get layoutStates(){return b(Y)},get charts(){return b(K)},get chartStates(){return b(H)},onChartsChange:gt=>X(K,gt),onChartStatesChange:gt=>X(H,gt),onLayoutStatesChange:gt=>X(Y,gt),registerChartDelegate:he})};oe(it,Se=>{b(d)&&Se(St)})}F(Fe),F(ve),F(le),lr(le,Se=>h=Se,()=>h),de(()=>{xe=Qt(ve,1,"w-full h-full flex flex-col text-slate-800 bg-slate-200 dark:text-slate-200 dark:bg-slate-800",null,xe,{dark:n()=="dark"}),ue=Ve(ve,"",ue,{"color-scheme":n()})}),I(t,le),Pe(),o()}dn(["click"]);var NBe=G('
    '),QBe=G('
    '),BBe=G('
    ');function dK(t,e){De(e,!0);let n=Xe(e,"messages",19,()=>[]);var r=BBe();Ot(r,21,n,Wt,(i,s,o)=>{const a=L(()=>o==n().length-1);var l=QBe(),u=M(l),c=M(u);{var f=S=>{var _=ot(),k=ke(_);{var C=A=>{JX(A,{class:"text-red-400 w-5 h-5"})},D=A=>{n8(A,{class:"text-blue-500 w-5 h-5"})};oe(k,A=>{b(s).error?A(C):A(D,!1)})}I(S,_)};oe(c,S=>{(b(a)||b(s).error)&&S(f)})}F(u);var h=V(u,2);let d;var p=M(h);{var m=S=>{var _=NBe(),k=M(_);ix(k,()=>O_(b(s).text)),F(_),I(S,_)},g=S=>{var _=hh();de(()=>ut(_,b(s).text)),I(S,_)};oe(p,S=>{b(s).markdown?S(m):S(g,!1)})}F(h);var y=V(h,2),O=M(y);{var v=S=>{var _=hh();de(k=>ut(_,`${k??""}%`),[()=>b(s).progress.toFixed(0)]),I(S,_)};oe(O,S=>{b(s).progress!=null&&S(v)})}var w=V(O,2);{var x=S=>{var _=hh();de(()=>ut(_,b(s).progressText)),I(S,_)};oe(w,S=>{b(s).progressText!=null&&S(x)})}F(y),F(l),de(()=>d=Qt(h,1,"flex-1",null,d,{"text-red-400":b(s).error})),I(i,l)}),F(r),I(t,r),Pe()}const pK="deflate-raw";async function zBe(t){let n=new TextEncoder().encode(JSON.stringify(t)),r=await ree(n,pK);return aee(r)}async function UBe(t){let e=lee(t),n=await iee(e,pK),r=new TextDecoder;return JSON.parse(r.decode(n))}function mK(t){let e=t.lastIndexOf("?");if(e<0)return{};let n=new URLSearchParams(t.slice(e+1));return Object.fromEntries(n.entries())}function jBe(t,e){let n=t.lastIndexOf("?"),r=new URLSearchParams(e);r.sort();let i=r.toString();return i==""?n<0?t:t.slice(0,n):n<0?t+"?"+i:t.slice(0,n)+"?"+r.toString()}async function cv(t,e="object"){try{let n=mK(window.location.hash);return n[t]==null?void 0:e=="text"?n[t]:e=="object"?await UBe(n[t]):void 0}catch{return}}async function Lf(t,e,n="object"){let r;if(e!==void 0)if(n=="text"){if(typeof e!="string")return;r=e}else if(n=="object")r=await zBe(e);else return;let i=mK(window.location.hash);r===void 0?delete i[t]:i[t]=r,window.location.hash=jBe(window.location.hash,i)}var qBe=G("
    "),VBe=G('
    ');function ZBe(t,e){De(e,!0);const n=()=>hr(W_,"$systemColorScheme",r),[r,i]=Lo(),s=_x();let o=pe(!1),a=pe(!1),l=pe("Loading..."),u=pe(null),c=pe(null);Ah(async()=>{try{X(u,await cv("state")),X(l,"Initializing database..."),X(c,await e.dataSource.initializeCoordinator(s,"dataset",O=>{X(l,O,!0)})),X(o,!0)}catch(O){X(a,!0),X(l,O.message,!0);return}});async function f(O,v){e.dataSource.downloadSelection&&await e.dataSource.downloadSelection(O,v)}async function h(){e.dataSource.downloadArchive&&await e.dataSource.downloadArchive()}function d(O){mK(window.location.hash).state!=null&&Lf("state",{...O,predicate:void 0})}var p=VBe(),m=M(p);{var g=O=>{{let v=L(()=>({...b(c).data??{id:"id"},table:"dataset"})),w=L(()=>b(u)??b(c).initialState),x=L(()=>e.dataSource.downloadArchive?h:null),S=L(()=>e.dataSource.downloadSelection?f:null),_=L(()=>qC(d,200));hK(O,{get coordinator(){return s},get data(){return b(v)},get embeddingViewConfig(){return b(c).embeddingViewConfig},get embeddingViewLabels(){return b(c).embeddingViewLabels},get defaultChartsConfig(){return b(c).defaultChartsConfig},get chartTheme(){return b(c).chartTheme},get stylesheet(){return b(c).stylesheet},get initialState(){return b(w)},get modelContext(){return b(c).modelContext},get onExportApplication(){return b(x)},get onExportSelection(){return b(S)},get onStateChange(){return b(_)},get cache(){return e.dataSource.cache}})}},y=O=>{var v=qBe();let w;var x=M(v);{let S=L(()=>[{text:b(l),error:b(a)}]);dK(x,{get messages(){return b(S)}})}F(v),de(()=>w=Qt(v,1,"w-full h-full grid place-content-center select-none text-slate-800 bg-slate-200 dark:text-slate-200 dark:bg-slate-800",null,w,{dark:n()=="dark"})),I(O,v)};oe(m,O=>{b(o)&&b(c)!=null?O(g):O(y,!1)})}F(p),I(t,p),Pe(),i()}function fv(t,e){let n=document.createElement("a");n.href=URL.createObjectURL(new Blob([t],{type:"application/octet-stream"})),n.download=e,n.click()}const _C={json:{query:"(FORMAT JSON, ARRAY true)",extension:"json"},jsonl:{query:"(FORMAT JSON)",extension:"jsonl"},csv:{query:"(FORMAT CSV)",extension:"csv"},parquet:{query:"(FORMAT parquet)",extension:"parquet"}};function XBe(t,e,n,r){return e==null||e.length==0?Ze`COPY ${t} TO ${Ae(n)} ${_C[r].query}`:Ze`COPY (SELECT * FROM ${t} WHERE ${e}) TO ${Ae(n)} ${_C[r].query}`}function gK(t){return`selection-${Date.now()}.${_C[t].extension}`}async function yK(t,e,n,r){let i=await t.databaseConnector()?.getDuckDB(),s=gK(r);await i.registerEmptyFileBuffer(s);let o=XBe(e,n,s,r);await t.query(o.toString());let a=await i.copyFileToBuffer(s);return i.dropFile(s),[a,s]}class WBe{ws=null;endpoint;shouldReconnect=!0;reconnectAttempts=0;maxReconnectAttempts;reconnectDelay;maxReconnectDelay;reconnectTimeoutId=null;onMessage;onStatus;constructor(e,n){this.endpoint=e,this.maxReconnectAttempts=n.maxReconnectAttempts??10,this.reconnectDelay=n.initialReconnectDelay??1e3,this.maxReconnectDelay=n.maxReconnectDelay??3e4,this.onMessage=n.onMessage,this.onStatus=n.onStatus,this.connect()}connect(){if(this.shouldReconnect){this.onStatus?.("connecting");try{this.ws=new WebSocket(this.endpoint),this.ws.onopen=()=>{console.debug("WebSocket connected"),this.reconnectAttempts=0,this.onStatus?.("connected")},this.ws.onmessage=e=>{this.onMessage(e)},this.ws.onclose=e=>{console.debug("WebSocket closed:",e.code,e.reason),this.ws=null,this.shouldReconnect&&this.reconnectAttempts=this.maxReconnectAttempts&&(console.error("Max reconnection attempts reached, giving up"),this.onStatus?.("error"))},this.ws.onerror=e=>{console.error("WebSocket error:",e)}}catch(e){console.error("Failed to create WebSocket:",e),this.shouldReconnect&&this.reconnectAttempts{this.reconnectTimeoutId=null,this.connect()},e)}send(e){return this.ws?.readyState===WebSocket.OPEN?(this.ws.send(e),!0):!1}close(){this.shouldReconnect=!1,this.reconnectTimeoutId&&(clearTimeout(this.reconnectTimeoutId),this.reconnectTimeoutId=null),this.ws?.close(),this.onStatus?.("closed")}}class YBe{tools;toolsMap;ws;connectionStatus;constructor(e){this.tools=[],this.toolsMap=new Map,this.connectionStatus=Xi("connecting"),this.ws=new WBe(e,{onMessage:async n=>{try{const r=JSON.parse(n.data);if(r.control==="close"){this.ws.close();return}const i=r,s=await this.processRequest(i);this.ws.send(JSON.stringify(s))}catch(r){console.error("Error processing MCP request:",r)}},onStatus:n=>{this.connectionStatus.set(n)}})}close(){this.ws.close()}provideContext(e){this.tools=e.tools??[],this.toolsMap=new Map(this.tools.map(n=>[n.name,n]))}async processRequest(e){if(e.request instanceof Array){let n=[];for(let r of e.request)n.push(await this.processRPC(r));return{id:e.id,response:n}}else return{id:e.id,response:await this.processRPC(e.request)}}async processRPC(e){let n,r;try{n=await this.rpc(e.method,e.params??{})}catch(i){r={code:-32603,message:i.toString()}}return{jsonrpc:"2.0",id:e.id,result:n,error:r}}async rpc(e,n){switch(e){case"initialize":return await this.initialize(n);case"tools/list":return await this.toolsList(n);case"tools/call":return await this.toolsCall(n);default:throw new Error(`method ${e} is not implemented`)}}async initialize(e){return console.info("MCP Initialize",e.clientInfo),{protocolVersion:"2024-11-05",capabilities:{logging:{},prompts:{},resources:{},tools:{},tasks:{}},serverInfo:{name:"Embedding Atlas",title:"Embedding Atlas MCP Server",version:"1.0.0",description:"MCP server for the Embedding Atlas frontend",icons:[{src:"https://apple.github.io/embedding-atlas/favicon.svg",mimeType:"image/svg+xml",sizes:["any"]}],websiteUrl:"https://apple.github.io/embedding-atlas"},instructions:"Optional instructions for the client"}}async toolsList(e){return{tools:this.tools.map(r=>({name:r.name,title:r.title,description:r.description,inputSchema:r.inputSchema,outputSchema:r.outputSchema}))}}async toolsCall(e){let n=this.toolsMap.get(e.name);if(n==null)throw new Error("tool not found");try{return await n.execute(e.arguments,void 0)}catch(r){return{content:[{type:"text",text:"Exception: "+r.toString()}],isError:!0}}}}function jm(t,e){return e.startsWith(".")&&(e=e.slice(1)),t.endsWith("/")&&e.startsWith("/")?t+e.slice(1):!t.endsWith("/")&&!e.startsWith("/")?t+"/"+e:t+e}class GBe{serverUrl;downloadArchive=void 0;downloadSelection=void 0;constructor(e){if(e.startsWith("http"))this.serverUrl=e;else{let n=window.location.origin+window.location.pathname;n=n.replace(/\/[^/]*$/,"/"),this.serverUrl=jm(n,e)}}async initializeCoordinator(e,n,r){let i=await this.metadata();r("Initializing database...");let s=i.database?.type??"wasm";if(await yH(e,s,i.database?.uri??jm(this.serverUrl,"query")),i.database?.load){r("Loading data...");let o=i.database?.datasetUrl??jm(this.serverUrl,"dataset.parquet");await e.exec(` CREATE OR REPLACE TABLE ${n} AS ( SELECT *, Collection_memberships AS Collections FROM read_parquet(${Ae(o)}) ); `)}return i.isStatic||(this.downloadArchive=async()=>{let a=await(await this.fetchEndpoint("archive.zip")).arrayBuffer();fv(a,"embedding-atlas.zip")}),s=="wasm"?this.downloadSelection=async(o,a)=>{let[l,u]=await yK(e,n,o,a);fv(l,u)}:i.isStatic||(this.downloadSelection=async(o,a)=>{let l=gK(a),c=await(await this.fetchEndpoint("selection",{method:"POST",body:JSON.stringify({predicate:o,format:a})})).arrayBuffer();fv(c,l)}),i.mcp&&i.mcp.type=="websocket"&&(i.props.modelContext=new YBe(jm(this.serverUrl,"mcp_websocket"))),i.props}async fetchEndpoint(e,n){let r=await fetch(jm(this.serverUrl,e),n);if(r.status!=200)throw new Error("ERROR FETCH");return r}async metadata(){try{return await this.fetchEndpoint("metadata.json?v=dataset-color-field-1").then(e=>e.json())}catch{throw new Error("Network Error: Failed to fetch dataset metadata")}}async cacheGet(e){try{return await this.fetchEndpoint("cache/"+e).then(n=>n.json())}catch{return null}}async cacheSet(e,n){try{await this.fetchEndpoint("cache/"+e,{method:"POST",body:JSON.stringify(n)})}catch{}}cache={get:e=>this.cacheGet(e),set:(e,n)=>this.cacheSet(e,n)}}function HBe(t,e){De(e,!1);let n="./data/",r=new GBe(n);BC(),ZBe(t,{get dataSource(){return r}}),Pe()}var KBe=G('');function JBe(t,e){De(e,!0);let n=Xe(e,"multiple",3,!1),r=pe(!1),i;function s(m){m.preventDefault(),X(r,!0)}function o(){X(r,!1)}function a(m){if(m.preventDefault(),X(r,!1),m.dataTransfer.files){let g=Array.from(m.dataTransfer.files);(n()||g.length==1)&&g.length>0&&g.every(u)&&e.onUpload(g)}}function l(m){let g=Array.from(m.target.files);(n()||g.length==1)&&g.length>0&&g.every(u)&&e.onUpload(g)}function u(m){if(e.extensions==null)return!0;for(let g of e.extensions)if(m.name.toLowerCase().endsWith(g.toLowerCase()))return!0;return!1}var c=KBe();c.__click=()=>{i.click()};var f=M(c),h=M(f),d=M(h,!0);F(h),ws(2),F(f);var p=V(f,2);p.__change=l,lr(p,m=>i=m,()=>i),F(c),de(m=>{Qt(c,1,`flex flex-col items-center w-full justify-center py-20 border-2 border-dashed rounded-md transition-all ${b(r)?"bg-slate-50 border-slate-500 dark:bg-slate-900 dark:border-slate-500":"bg-slate-50 border-slate-300 dark:bg-slate-900 dark:border-slate-700"}`),ut(d,b(r)?"Drop your files here":"Drag & drop files here or click to select"),ne(p,"accept",m),p.multiple=n()},[()=>e.extensions?.join(",")]),cl("dragover",c,s),cl("dragleave",c,o),cl("drop",c,a),I(t,c),Pe()}dn(["click","change"]);var eze=G(''),tze=G('
      '),nze=G('
      ');function G$(t,e){De(e,!0);let n=Xe(e,"value",3,""),r=Xe(e,"options",19,()=>[]),i,s,o=pe(!1),a=L(()=>n()!=null&&r()!=null?r().filter(p=>p.toLowerCase().includes(n().toLowerCase())):r()??[]);function l(p){e.onChange?.(p)}function u(p){l(p),X(o,!1)}var c=nze(),f=M(c);ox(f),f.__change=()=>l(i.value??""),f.__input=()=>l(i.value??""),lr(f,p=>i=p,()=>i);var h=V(f,2);{var d=p=>{var m=tze();Ot(m,20,()=>b(a),g=>g,(g,y)=>{var O=eze();O.__click=()=>u(y);var v=M(O,!0);F(O),de(()=>ut(v,y)),I(g,O)}),F(m),I(p,m)};oe(h,p=>{b(o)&&b(a).length>0&&p(d)})}F(c),lr(c,p=>s=p,()=>s),de(()=>{Qt(c,1,`relative ${e.className??""??""}`),ne(f,"placeholder",e.placeholder),KM(f,n())}),cl("focus",f,()=>X(o,!0)),cl("blur",f,p=>{p.relatedTarget&&p.relatedTarget instanceof Node&&s.contains(p.relatedTarget)||X(o,!1)}),I(t,c),Pe()}dn(["change","input","click"]);var rze=G('
      X
      Y
      Neighbors

      Neighbors column should contain pre-computed nearest neighbors in format: . IDs should be zero-based row indices.

      ',1),ize=G(`
      Text
      Model

      Computing the embedding and 2D projection in browser may take a while. The model will be loaded with Transformers.js.

      `,1),sze=G(`
      Image
      Model

      Computing the embedding and 2D projection in browser may take a while. The model will be loaded with Transformers.js.

      `,1),oze=G(`

      Search and Tooltip (optional)

      The selected column, if any, will be used for full-text search and tooltips. Choose a column with freeform text, such as a description, chat messages, or a summary.

      Text

      Embedding View (optional)

      To enable the embedding view, you can either (a) pick a pair of pre-computed X and Y columns; or (b) pick a text column and compute the embedding projection in browser. For large data, it's recommended to pre-compute the embedding and its 2D projection.

      `);function aze(t,e){De(e,!0);const n=["Xenova/all-MiniLM-L6-v2","Xenova/paraphrase-multilingual-mpnet-base-v2","Xenova/multilingual-e5-small","Xenova/multilingual-e5-base","Xenova/multilingual-e5-large"],r=["Xenova/dinov2-small","Xenova/dinov2-base","Xenova/dinov2-large","Xenova/dino-vitb8","Xenova/dino-vits8","Xenova/dino-vitb16","Xenova/dino-vits16"];let i=pe("precomputed"),s=pe(void 0),o=pe(void 0),a=pe(void 0),l=pe(void 0),u=pe(void 0),c=pe(void 0),f=pe(void 0),h=pe(void 0),d=L(()=>e.columns.filter(A=>G1(A.column_type)=="number")),p=L(()=>e.columns.filter(A=>G1(A.column_type)=="string"));An(()=>{let A=b(s);Br(()=>b(u)==null)&&X(u,A,!0)});function m(){let A={version:xC,text:b(s)};if(b(i)=="precomputed"&&b(o)!=null&&b(a)!=null&&(A.embedding={precomputed:{x:b(o),y:b(a),neighbors:b(l)!=null?b(l):void 0}}),b(i)=="from-text"&&b(u)!=null){let E=b(c)?.trim()??"";(E==null||E=="")&&(E=n[0]),A.embedding={compute:{column:b(u),type:"text",model:E}}}if(b(i)=="from-image"&&b(f)!=null){let E=b(h)?.trim()??"";(E==null||E=="")&&(E=r[0]),A.embedding={compute:{column:b(f),type:"image",model:E}}}e.onConfirm?.(A)}var g=oze(),y=M(g),O=V(M(y),4),v=V(M(O),2);{let A=L(()=>[{value:void 0,label:"(none)"},...b(p).map(E=>({value:E.column_name,label:`${E.column_name} (${E.column_type})`}))]);Zs(v,{class:"flex-1 min-w-0",get value(){return b(s)},onChange:E=>X(s,E,!0),get options(){return b(A)}})}F(O);var w=V(O,8),x=M(w);gT(x,{get value(){return b(i)},onChange:A=>X(i,A,!0),options:[{value:"precomputed",label:"Pre-computed"},{value:"from-text",label:"From Text"},{value:"from-image",label:"From Image"},{value:"none",label:"None"}]}),F(w);var S=V(w,2);{var _=A=>{var E=rze(),T=ke(E),R=V(M(T),2);{let W=L(()=>[{value:void 0,label:"(none)"},...b(d).map(K=>({value:K.column_name,label:`${K.column_name} (${K.column_type})`}))]);Zs(R,{class:"flex-1 min-w-0",get value(){return b(o)},onChange:K=>X(o,K,!0),get options(){return b(W)}})}F(T);var $=V(T,2),Q=V(M($),2);{let W=L(()=>[{value:void 0,label:"(none)"},...b(d).map(K=>({value:K.column_name,label:`${K.column_name} (${K.column_type})`}))]);Zs(Q,{class:"flex-1 min-w-0",get value(){return b(a)},onChange:K=>X(a,K,!0),get options(){return b(W)}})}F($);var B=V($,2),q=V(M(B),2);{let W=L(()=>[{value:void 0,label:"(none)"},...e.columns.map(K=>({value:K.column_name,label:`${K.column_name} (${K.column_type})`}))]);Zs(q,{class:"flex-1 min-w-0",get value(){return b(l)},onChange:K=>X(l,K,!0),get options(){return b(W)}})}F(B);var z=V(B,2),ee=V(M(z));ee.textContent='{ "ids": [n1, n2, ...], "distances": [d1, d2, ...] }',ws(),F(z),I(A,E)},k=A=>{var E=ot(),T=ke(E);{var R=Q=>{var B=ize(),q=ke(B),z=V(M(q),2);{let K=L(()=>[{value:void 0,label:"(none)"},...b(p).map(H=>({value:H.column_name,label:`${H.column_name} (${H.column_type})`}))]);Zs(z,{class:"flex-1 min-w-0",get value(){return b(u)},onChange:H=>X(u,H,!0),get options(){return b(K)}})}F(q);var ee=V(q,2),W=V(M(ee),2);G$(W,{className:"flex-1",get value(){return b(c)},get placeholder(){return`(default ${n[0]??""})`},onChange:K=>X(c,K,!0),get options(){return n}}),F(ee),ws(2),I(Q,B)},$=Q=>{var B=ot(),q=ke(B);{var z=ee=>{var W=sze(),K=ke(W),H=V(M(K),2);{let Z=L(()=>[{value:void 0,label:"(none)"},...e.columns.map(he=>({value:he.column_name,label:`${he.column_name} (${he.column_type})`}))]);Zs(H,{class:"flex-1 min-w-0",get value(){return b(f)},onChange:he=>X(f,he,!0),get options(){return b(Z)}})}F(K);var J=V(K,2),Y=V(M(J),2);G$(Y,{className:"flex-1",get value(){return b(h)},get placeholder(){return`(default ${r[0]??""})`},onChange:Z=>X(h,Z,!0),get options(){return r}}),F(J),ws(2),I(ee,W)};oe(q,ee=>{b(i)=="from-image"&&ee(z)},!0)}I(Q,B)};oe(T,Q=>{b(i)=="from-text"?Q(R):Q($,!1)},!0)}I(A,E)};oe(S,A=>{b(i)=="precomputed"?A(_):A(k,!1)})}F(y);var C=V(y,2),D=V(M(C),2);Nu(D,{label:"Confirm",class:"w-40 justify-center",onClick:()=>{m()}}),F(C),F(g),I(t,g),Pe()}var lze=G('
      ');function uze(t,e){De(e,!0);let n=pe("");function r(){let a=b(n).trim();a!=""&&e.onConfirm(a)}var i=lze(),s=M(i);M_(s,{className:"flex-1",placeholder:"Enter data URL",onEnter:r,get value(){return b(n)},set value(a){X(n,a,!0)}});var o=V(s,2);Nu(o,{onClick:r,get icon(){return W3e}}),F(i),I(t,i),Pe()}class cze{static connect(e){return new Promise(n=>{let r=new Map,i=(s,...o)=>new Promise((a,l)=>{let u=new Date().getTime()+"-"+Math.random();r.set(u,[a,l]),e.postMessage({rpc:s,id:u,args:o})});e.postMessage({ready:!0}),e.onmessage=s=>{if(s.data.ready){n(i);return}let o=r.get(s.data.id);o!=null&&(r.delete(s.data.id),s.data.error?o[1](new Error(s.data.error)):o[0](s.data.result))}})}static runtime(){let e=new Map,n=async r=>{if(r.data.ready&&postMessage({ready:!0}),r.data.rpc){let s={id:r.data.id,result:null,error:null};try{s.result=await e.get(r.data.rpc)?.(...r.data.args)}catch(o){s.error=o.toString()}postMessage(s)}};return postMessage({ready:!0}),{handler:n,register:(r,i)=>{e.set(r,i)}}}}let pk=null;function fze(){if(pk==null){let t=new Worker(new URL(""+new URL("embedding.worker-cwWKVx1c.js",import.meta.url).href,import.meta.url),{type:"module"});pk=cze.connect(t)}return pk}async function*hze(t,e,n,r,i){let o=(await t.query(Be.from(e).select({count:Cr()}))).get(0).count,a=0;for(;ao&&(u=o);let c=await t.query(Be.from(e).select({id:ae(n),value:ae(r)}).offset(a).limit(u-l));yield{total:o,data:c},a=u}}async function dze(t,e,n,r,i,s,o){let a=0;await t.exec(` ALTER TABLE ${e} ADD COLUMN IF NOT EXISTS ${ae(r)} DOUBLE DEFAULT 0; ALTER TABLE ${e} ADD COLUMN IF NOT EXISTS ${ae(i)} DOUBLE DEFAULT 0; `);for(let l of s){let u=o.subarray(a,a+l.length*2);await t.exec(` WITH t1 AS ( SELECT UNNEST([${l.map(c=>Ae(c)).join(",")}]) AS id, UNNEST([${l.map((c,f)=>u[f*2]).join(",")}]) AS x, UNNEST([${l.map((c,f)=>u[f*2+1]).join(",")}]) AS y ) UPDATE ${e} SET ${ae(r)} = t1.x, ${ae(i)} = t1.y FROM t1 WHERE ${ae(n,e)} = t1.id `),a+=l.length*2}}async function pze(t){function e(a,l){t.callback?.(a,l)}e(`Loading ${t.model}...`);let n=await fze(),r=await n("embedding.new",{type:t.type,model:t.model}),i=[],s=0;for await(const{total:a,data:l}of hze(t.coordinator,t.table,t.idColumn,t.dataColumn,t.type=="text"?64:16)){e("Processing Batches...",s/a*100);let u=Array.from(l.getChild("id")),c=Array.from(l.getChild("value"));await n("embedding.batch",r,c),i.push(u),s+=u.length}e("UMAP Projection...");let o=await n("embedding.finalize",r);await dze(t.coordinator,t.table,t.idColumn,t.xColumn,t.yColumn,i,o)}function bK(){let t={};return typeof window!=null&&window.EMBEDDING_ATLAS_CONFIG!=null&&(t=window.EMBEDDING_ATLAS_CONFIG),{home:"backend-viewer",...t}}const mze="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let gze=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=mze[n[t]&63];return e};class yze{messages;constructor(){this.messages=Xi([])}append(e){let n=gze();return this.messages.update(r=>[...r,{...e,_id:n}]),{update:r=>{this.messages.update(i=>i.map(s=>s._id==n?{...s,...r}:s))}}}info(e,n={}){return this.append({text:e,...n})}error(e,n={}){return this.append({text:e,...n,error:!0})}exception(e){return e instanceof OK?this.append({text:e.message,...e.loggerOptions,error:!0}):e instanceof Error?this.append({text:e.message,error:!0}):this.append({text:String(e),error:!0})}}class OK extends Error{loggerOptions;constructor(e,n={}){super(e),this.loggerOptions=n}}async function bze(t,e,n,r,i){let s=bK();for(let[o,a]of t.entries())if(a instanceof File){i?.info("Loading data from file...");let l=a.name,u=new Uint8Array(await a.arrayBuffer());await H$(o,t.length,u,l,r,e,n)}else if("url"in a){let l=await s.loadDataFromUrl?.(a.url,{db:e,connection:n,table:r,fetch:async f=>{let h=await mk(f,{referrerPolicy:"no-referrer"},i);return new Uint8Array(await h.arrayBuffer())},logger:i});if(l===!0)continue;let u,c;if(l!=null)if("data"in l)u=l.data,c=l.filename??a.url;else if("url"in l){let f=await mk(l.url,{referrerPolicy:"no-referrer"},i);u=new Uint8Array(await f.arrayBuffer()),c=l.filename??a.url}else throw new Error("invalid result from loadDataFromUrl");else{let f=await mk(a.url,{referrerPolicy:"no-referrer"},i);u=new Uint8Array(await f.arrayBuffer()),c=a.url}await H$(o,t.length,u,c,r,e,n)}else throw new Error("invalid input type")}async function H$(t,e,n,r,i,s,o){let a=`data-${t}`+vze(r);await s.registerFileBuffer(a,n),e==1?await o.query(`CREATE TABLE ${i} AS SELECT * FROM ${Ae(a)}`):t==0?await o.query(`CREATE TABLE ${i} AS SELECT *, ${Ae(r)} AS filename FROM ${Ae(a)}`):await o.query(`INSERT INTO ${i} SELECT *, ${Ae(r)} AS filename FROM ${Ae(a)}`),await s.dropFile(a)}async function mk(t,e,n){let r,i=n?.info("Loading data from URL...");try{r=await fetch(t,e)}catch{throw new OK("Failed to fetch data from URL: This may be due to a network issue or the server blocking [cross-origin requests (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS). Check that the URL is valid and configured to allow access from this site.",{markdown:!0})}if(!r.ok)throw new Error(`Failed to fetch data from URL: ${wze(r.status)}. Please check if the URL is accessible and the server is responding correctly.`);if(!r.body)throw new Error("Failed to fetch data from URL: Server response has no body content. This may indicate a server configuration issue or the resource may be empty.");const s=200;try{let o=r.body.getReader(),a=[],l=0,u=0;for(;;){let{done:c,value:f}=await o.read();if(c)break;f!=null&&(a.push(f),l+=f.length);let h=new Date().getTime();h-u>=s&&(i?.update({progressText:K$(l)}),u=h)}return i?.update({progressText:K$(l)}),new Blob(a)}catch{throw new Error("Failed to fetch data from URL: Error while reading data.")}}function Oze(t){let e=t.toLowerCase();return{"application/json":".json","text/json":".json","application/x-ndjson":".jsonl","application/ndjson":".jsonl","application/jsonlines":".jsonl","application/json-seq":".jsonl","application/vnd.apache.parquet":".parquet","application/x-parquet":".parquet"}[e]||".bin"}function vze(t){if(t.startsWith("data:")){let s=t.match(/^data:([^;,]+)/);return s?Oze(s[1]):".bin"}let e=t.split("#",1)[0].split("?",1)[0],n=e.lastIndexOf("/"),r=n>=0?e.slice(n+1):e;if(!r||r[0]==="."&&r.indexOf(".",1)===-1)return null;let i=r.lastIndexOf(".");return i>0?r.slice(i):null}function K$(t,e=1){let n=[["B",0],["KB",0],["MB",1],["GB",2]],r=1e3,i=t,s=0;for(;i>=r&&s
      A saved view is available in the URL. It will be restored after the data loads.
      '),_ze=G('
      — or —
      All data remains confined to the browser and is not transmitted elsewhere.
      '),Sze=G("
      "),kze=G('
      ');function Cze(t,e){De(e,!0);const n=()=>hr(W_,"$systemColorScheme",i),r=()=>hr(c,"$messages",i),[i,s]=Lo(),o=_x(),a=yH(o,"wasm",null);let l=pe("load-data"),u=new yze,c=u.messages,f=pe(void 0),h=pe([]),d=pe({});async function p(){X(d,{data:await cv("data","text"),settings:await cv("settings"),state:await cv("state")})}function m(){Lf("data",void 0,"text"),Lf("state",void 0),Lf("settings",void 0),X(d,{})}Ah(async()=>{await p(),b(d).data!=null&&typeof b(d).data=="string"&&await g([{url:b(d).data}])});async function g(k){X(l,"messages");try{u.info("Initializing database..."),await a;let C=await o.databaseConnector().getDuckDB(),D=await o.databaseConnector().getConnection();await bze(k,C,D,"dataset",u);let A=await o.query("DESCRIBE TABLE dataset");X(h,Array.from(A)),await o.exec(` CREATE OR REPLACE SEQUENCE __row_index_sequence__ MINVALUE 0 START 0; ALTER TABLE dataset ADD COLUMN IF NOT EXISTS __row_index__ INTEGER DEFAULT nextval('__row_index_sequence__'); `)}catch(C){X(l,"messages"),u.exception(C);return}k.length==1&&"url"in k[0]&&Lf("data",k[0].url,"text"),X(l,"columns"),b(d).settings!=null&&await y(b(d).settings)}async function y(k){X(l,"messages");try{let C,D;if(k.embedding!=null&&"precomputed"in k.embedding&&(C={x:k.embedding.precomputed.x,y:k.embedding.precomputed.y},k.embedding.precomputed.neighbors!=null&&(D=k.embedding.precomputed.neighbors)),k.embedding!=null&&"compute"in k.embedding){let A=k.embedding.compute.column,E=k.embedding.compute.type,T=k.embedding.compute.model,R=A+"_proj_x",$=A+"_proj_y",Q=u.info("Embedding: Initialize");await pze({coordinator:o,table:"dataset",idColumn:"__row_index__",dataColumn:A,type:E,xColumn:R,yColumn:$,model:T,callback:(B,q)=>{Q.update({text:`Embedding: ${B}`,progress:q})}}),C={x:R,y:$}}X(f,{data:{table:"dataset",id:"__row_index__",text:k.text,projection:C,neighbors:D},initialState:b(d).state},!0)}catch(C){u.exception(C);return}await Lf("settings",k),X(l,"ready")}function O(k){Lf("state",{...k,predicate:void 0})}async function v(k,C){let[D,A]=await yK(o,"dataset",k,C);fv(D,A)}var w=kze(),x=M(w);{var S=k=>{{let C=L(()=>qC(O,200));hK(k,Ch({get coordinator(){return o},get onStateChange(){return b(C)},onExportSelection:v},()=>b(f)))}},_=k=>{var C=Sze();let D;var A=M(C);{var E=R=>{var $=_ze(),Q=M($);JBe(Q,{extensions:[".csv",".parquet",".json",".jsonl"],multiple:!0,onUpload:g});var B=V(Q,4);uze(B,{onConfirm:ee=>g([{url:ee}])});var q=V(B,2);{var z=ee=>{var W=xze(),K=V(M(W),2);K.__click=m;var H=M(K);sd(H,{class:"w-4 h-4"}),ws(),F(K),F(W),I(ee,W)};oe(q,ee=>{(b(d).settings!=null||b(d).state!=null)&&ee(z)})}ws(2),F($),I(R,$)},T=R=>{var $=ot(),Q=ke($);{var B=z=>{aze(z,{get columns(){return b(h)},onConfirm:ee=>y(ee)})},q=z=>{var ee=ot(),W=ke(ee);{var K=H=>{dK(H,{get messages(){return r()}})};oe(W,H=>{b(l)=="messages"&&H(K)},!0)}I(z,ee)};oe(Q,z=>{b(l)=="columns"?z(B):z(q,!1)},!0)}I(R,$)};oe(A,R=>{b(l)=="load-data"?R(E):R(T,!1)})}F(C),de(()=>D=Qt(C,1,"w-full h-full grid place-content-center select-none text-slate-800 bg-slate-200 dark:text-slate-200 dark:bg-slate-800",null,D,{dark:n()=="dark"})),I(k,C)};oe(x,k=>{b(l)=="ready"&&b(f)!==void 0?k(S):k(_,!1)})}F(w),I(t,w),Pe(),s()}dn(["click"]);function Aze(t,e){De(e,!1);const n=bK(),r=ch({"/":n.home=="file-viewer"?Cze:HBe});BC(),nee(t,{get routes(){return b(r)}}),Pe()}LC(Aze,{target:document.getElementById("app")});