@blueprint-chart/editor 0.1.30 → 0.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as t,o,c as r,a3 as a,a4 as c}from"./index-
|
|
1
|
+
import{d as t,o,c as r,a3 as a,a4 as c}from"./index-dPXN_1BF.js";const s={class:"copy-redirect","aria-hidden":"true"},i=t({__name:"CopyRedirect",setup(n){const e=a();return c().replace(e.meta.copyTarget??"/"),(p,_)=>(o(),r("div",s))}});export{i as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as C,o as a,c as o,a as e,r as x,b as A,_ as y,u as G,e as ce,f as H,w as h,g as r,h as _e,i as d,N as ue,B as V,A as ge,j as p,k as X,l as pe,m as Q,n as O,p as J,I as me,q as he,s as Ie,t as T,v as K,x as fe,y as q,z as be,C as ee,D as ve,E as te,F as Ce,G as z,H as ye,J as we,K as v,L as w,M as m,O as Be,P as $,Q as S,R as L,S as Se,T as ke,U as Ae,V as Me,W as Pe,X as Ze,Y as xe,Z as N,$ as Le,a0 as He,a1 as $e,a2 as Ne}from"./index-
|
|
1
|
+
import{d as C,o as a,c as o,a as e,r as x,b as A,_ as y,u as G,e as ce,f as H,w as h,g as r,h as _e,i as d,N as ue,B as V,A as ge,j as p,k as X,l as pe,m as Q,n as O,p as J,I as me,q as he,s as Ie,t as T,v as K,x as fe,y as q,z as be,C as ee,D as ve,E as te,F as Ce,G as z,H as ye,J as we,K as v,L as w,M as m,O as Be,P as $,Q as S,R as L,S as Se,T as ke,U as Ae,V as Me,W as Pe,X as Ze,Y as xe,Z as N,$ as Le,a0 as He,a1 as $e,a2 as Ne}from"./index-dPXN_1BF.js";const je={class:"navigation-marketing-bar","aria-label":"Marketing navigation"},De={class:"navigation-marketing-bar__inner"},Re={class:"navigation-marketing-bar__brand"},Te={key:0,class:"navigation-marketing-bar__menu","aria-label":"Sections"},Ge={key:1,class:"navigation-marketing-bar__actions"},ze={key:2,class:"navigation-marketing-bar__cta-secondary"},We={key:3,class:"navigation-marketing-bar__cta-primary"},Ve=C({__name:"NavigationMarketingBar",setup(i){return(t,u)=>(a(),o("header",je,[e("div",De,[e("div",Re,[x(t.$slots,"brand")]),t.$slots.menu?(a(),o("nav",Te,[x(t.$slots,"menu")])):A("",!0),u[0]||(u[0]=e("div",{class:"navigation-marketing-bar__spacer"},null,-1)),t.$slots.actions?(a(),o("div",Ge,[x(t.$slots,"actions")])):A("",!0),t.$slots["cta-secondary"]?(a(),o("div",ze,[x(t.$slots,"cta-secondary")])):A("",!0),t.$slots["cta-primary"]?(a(),o("div",We,[x(t.$slots,"cta-primary")])):A("",!0)])]))}}),Xe=y(Ve,[["__scopeId","data-v-55d19f31"]]),Ee=["src"],Ye=C({__name:"LandingTopNav",setup(i){const{theme:t,resolvedTheme:u,cycleTheme:g}=G(),n=_e("k"),s=X(()=>u.value==="dark"?O:J),_=pe(),f=ce("(max-width: 37.5rem)"),c={light:Ie,dark:he,auto:me},l=X(()=>c[t.value]);function I(){n.trigger()}return(k,b)=>{const M=Q("router-link");return a(),H(r(Xe),null,{brand:h(()=>[d(M,{to:"/",class:"landing-topnav__brand","aria-label":"Blueprint Chart home"},{default:h(()=>[e("img",{src:s.value,alt:"",class:"landing-topnav__brand-logo"},null,8,Ee),b[0]||(b[0]=e("span",{class:"landing-topnav__brand-name"},"Blueprint Chart",-1))]),_:1})]),menu:h(()=>[d(M,{to:{hash:"#mcp"}},{default:h(()=>[...b[1]||(b[1]=[p(" AI ",-1)])]),_:1}),d(M,{to:{hash:"#format"}},{default:h(()=>[...b[2]||(b[2]=[p(" Format ",-1)])]),_:1}),d(M,{to:{hash:"#defaults"}},{default:h(()=>[...b[3]||(b[3]=[p(" Defaults ",-1)])]),_:1}),d(M,{to:{hash:"#transforms"}},{default:h(()=>[...b[4]||(b[4]=[p(" Transforms ",-1)])]),_:1}),d(M,{to:{hash:"#scenes"}},{default:h(()=>[...b[5]||(b[5]=[p(" Scenes ",-1)])]),_:1})]),actions:h(()=>[d(r(ue),{placeholder:"Search or jump to…","shortcut-label":r(n).keyLabel,collapsed:r(f),onClick:I},null,8,["shortcut-label","collapsed"]),d(r(V),{"icon-left":l.value,label:"Toggle theme","hide-label":"",square:"",variant:"outline-secondary",size:"sm",onClick:r(g)},null,8,["icon-left","onClick"]),r(_)?(a(),H(ge,{key:0})):A("",!0)]),_:1})}}}),Fe=y(Ye,[["__scopeId","data-v-8959d841"]]),Ue=150;function Qe(i){return i?fe(i).scenes.length:0}function ne(i,t,u){ve(i,t,u)}function Oe(i,t,u){const g=be(t),n=g?t:q(""),s=g?u:t,{theme:_}=G();function f(){!i.value||!n.value||ne(i.value,n.value,s)}const c=ee(f,Ue);T([i,n,_],f,{immediate:!0}),K(i,c);function l(I){n.value=I}return{applyDsl:l}}const Je=C({__name:"LandingChartPreview",props:{bpc:{}},setup(i){const t=i,u=te("containerRef");return Oe(u,Ce(t,"bpc"),{stripColors:!0}),(g,n)=>(a(),o("div",{ref_key:"containerRef",ref:u,class:"landing-chart-preview"},null,512))}}),Y=y(Je,[["__scopeId","data-v-eb03c209"]]),Ke={class:"landing-hero"},qe={class:"landing-hero__inner"},et={class:"landing-hero__inner__text"},tt={class:"landing-hero__inner__text__actions"},nt={class:"landing-hero__inner__chart"},at=C({__name:"LandingHero",setup(i){const t=z.find(g=>g.id==="coffee-production");if(!t)throw new Error("Missing coffee-production sample — see LandingHero.vue");const u=t.dsl.replace(/\{/,`{
|
|
2
2
|
theme = "blueprint-framed"`);return(g,n)=>{const s=Y;return a(),o("section",Ke,[e("div",qe,[e("div",et,[d(r(ye),{variant:"info",pill:"",class:"landing-hero__inner__text__eyebrow"},{default:h(()=>[...n[0]||(n[0]=[e("span",{class:"landing-hero__inner__text__eyebrow__dot","aria-hidden":"true"},null,-1),p(" Open source · MIT ",-1)])]),_:1}),n[1]||(n[1]=e("h1",{class:"landing-hero__inner__text__h1"},[p(" The open chart format"),e("br"),e("em",null,"AI writes.")],-1)),n[2]||(n[2]=e("p",{class:"landing-hero__inner__text__sub"}," An open, plain-text chart format an AI can write and any browser can render. Self-contained, no backend, no account required. Prefer to do it yourself? The editor's right here. ",-1)),e("div",tt,[d(r(V),{to:"/charts",label:"My charts",variant:"outline-secondary"}),d(r(V),{to:"/new",label:"New chart",variant:"primary","icon-left":r(we)},null,8,["icon-left"])])]),e("div",nt,[d(s,{bpc:r(u)},null,8,["bpc"])])])])}}}),st=y(at,[["__scopeId","data-v-79f507ab"]]),ot={class:"landing-value-prop-strip","aria-label":"Why Blueprint Chart"},it={class:"landing-value-prop-strip__cell__label"},rt={class:"landing-value-prop-strip__cell__value"},lt=["href"],dt=C({__name:"LandingValuePropStrip",setup(i){const t=[{label:"01 / Plain text",value:"A format AI can write"},{label:"02 / No backend",value:"Renders in the browser"},{label:"03 / Data sovereignty",value:"Nothing ever uploaded"},{label:"04 / MIT",value:"Open source, forever",href:"https://github.com/blueprint-chart/blueprint-chart"}];return(u,g)=>(a(),o("section",ot,[(a(),o(v,null,w(t,n=>e("dl",{key:n.label,class:"landing-value-prop-strip__cell"},[e("dt",it,m(n.label),1),e("dd",rt,[n.href?(a(),o("a",{key:0,href:n.href,target:"_blank",rel:"noopener noreferrer",class:"landing-value-prop-strip__cell__link"},[d(r($),{name:r(Be),size:"xs"},null,8,["name"]),p(" "+m(n.value),1)],8,lt)):(a(),o(v,{key:1},[p(m(n.value),1)],64))])])),64))]))}}),ct=y(dt,[["__scopeId","data-v-b0808585"]]),_t={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"};function ut(i,t){return a(),o("svg",_t,[...t[0]||(t[0]=[e("path",{fill:"currentColor",d:"M197.58 129.06L146 110l-19-51.62a15.92 15.92 0 0 0-29.88 0L78 110l-51.62 19a15.92 15.92 0 0 0 0 29.88L78 178l19 51.62a15.92 15.92 0 0 0 29.88 0L146 178l51.62-19a15.92 15.92 0 0 0 0-29.88ZM137 164.22a8 8 0 0 0-4.74 4.74L112 223.85L91.78 169a8 8 0 0 0-4.78-4.78L32.15 144L87 123.78a8 8 0 0 0 4.78-4.78L112 64.15L132.22 119a8 8 0 0 0 4.74 4.74L191.85 144ZM144 40a8 8 0 0 1 8-8h16V16a8 8 0 0 1 16 0v16h16a8 8 0 0 1 0 16h-16v16a8 8 0 0 1-16 0V48h-16a8 8 0 0 1-8-8m104 48a8 8 0 0 1-8 8h-8v8a8 8 0 0 1-16 0v-8h-8a8 8 0 0 1 0-16h8v-8a8 8 0 0 1 16 0v8h8a8 8 0 0 1 8 8"},null,-1)])])}const E=S({name:"ph-sparkle",render:ut}),gt={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"};function pt(i,t){return a(),o("svg",gt,[...t[0]||(t[0]=[e("path",{fill:"currentColor",d:"M230.92 212c-15.23-26.33-38.7-45.21-66.09-54.16a72 72 0 1 0-73.66 0c-27.39 8.94-50.86 27.82-66.09 54.16a8 8 0 1 0 13.85 8c18.84-32.56 52.14-52 89.07-52s70.23 19.44 89.07 52a8 8 0 1 0 13.85-8M72 96a56 56 0 1 1 56 56a56.06 56.06 0 0 1-56-56"},null,-1)])])}const mt=S({name:"ph-user",render:pt}),ht=["id","data-bs-theme"],It={class:"landing-section__inner"},ft=C({__name:"LandingSection",props:{id:{default:void 0},dark:{type:Boolean,default:!1},full:{type:Boolean,default:!1},bordered:{type:Boolean,default:!0},surface:{default:"chrome"}},setup(i){return(t,u)=>(a(),o("section",{id:i.id,class:L(["landing-section",{"landing-section--dark":i.dark,"landing-section--full":i.full,"landing-section--bordered":i.bordered,[`landing-section--surface-${i.surface}`]:!0}]),"data-bs-theme":i.dark?"dark":void 0},[e("div",It,[x(t.$slots,"default",{},void 0,!0)])],10,ht))}}),j=y(ft,[["__scopeId","data-v-1f01ad30"]]),bt={class:"landing-section-header__label"},vt={class:"landing-section-header__title"},Ct={key:0,class:"landing-section-header__lead"},yt=C({__name:"LandingSectionHeader",props:{label:{},center:{type:Boolean,default:!1}},setup(i){return(t,u)=>(a(),o("div",{class:L(["landing-section-header",{"landing-section-header--center":i.center}])},[e("div",bt,m(i.label),1),e("h2",vt,[x(t.$slots,"default",{},void 0,!0)]),t.$slots.lead?(a(),o("p",Ct,[x(t.$slots,"lead",{},void 0,!0)])):A("",!0)],2))}}),D=y(yt,[["__scopeId","data-v-893c7bf5"]]),wt="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2MDAgNDkyIiByb2xlPSJpbWciIGFyaWEtbGFiZWw9IkJhciBjaGFydCB0aXRsZWQgRSBpcyB0aGUgbW9zdCBmcmVxdWVudCBsZXR0ZXIgaW4gRW5nbGlzaC4gRSBpcyBoaWdobGlnaHRlZCBhdCAxMi43IHBlcmNlbnQsIHRoZSB0YWxsZXN0IGJhciwgZm9sbG93ZWQgYnkgVCA5LjA2LCBBIDguMTcsIE8gNy41MSwgSSA2Ljk3LCBOIDYuNzUsIFMgNi4zMywgSCA2LjA5LCBSIDUuOTkgYW5kIEQgNC4yNS4iPgogIDx0ZXh0IHg9IjIiIHk9IjQwIiBmb250LWZhbWlseT0iR2VvcmdpYSwgJ1RpbWVzIE5ldyBSb21hbicsIHNlcmlmIiBmb250LXNpemU9IjI1IiBmb250LXdlaWdodD0iNjAwIiBmaWxsPSIjMWEyMTI4Ij5FIGlzIHRoZSBtb3N0IGZyZXF1ZW50IGxldHRlciBpbiBFbmdsaXNoPC90ZXh0PgogIDx0ZXh0IHg9IjIiIHk9IjY2IiBmb250LWZhbWlseT0iLWFwcGxlLXN5c3RlbSwgJ1NlZ29lIFVJJywgUm9ib3RvLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjE1IiBmaWxsPSIjNWI2NDcwIj5Ib3cgb2Z0ZW4gZWFjaCBsZXR0ZXIgYXBwZWFycyBpbiB0eXBpY2FsIEVuZ2xpc2ggdGV4dDwvdGV4dD4KCiAgPGcgZm9udC1mYW1pbHk9Ii1hcHBsZS1zeXN0ZW0sICdTZWdvZSBVSScsIFJvYm90bywgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxNCIgZmlsbD0iIzMzNDA0ZCIgdGV4dC1hbmNob3I9Im1pZGRsZSI+CiAgICA8dGV4dCB4PSI3OCIgeT0iMTAyIiBmaWxsPSIjMjU2M0EwIiBmb250LXdlaWdodD0iNzAwIj4xMi43PC90ZXh0PgogICAgPHRleHQgeD0iMTMwIiB5PSIxODgiPjkuMDY8L3RleHQ+CiAgICA8dGV4dCB4PSIxODIiIHk9IjIwOSI+OC4xNzwvdGV4dD4KICAgIDx0ZXh0IHg9IjIzNCIgeT0iMjI1Ij43LjUxPC90ZXh0PgogICAgPHRleHQgeD0iMjg2IiB5PSIyMzciPjYuOTc8L3RleHQ+CiAgICA8dGV4dCB4PSIzMzgiIHk9IjI0MyI+Ni43NTwvdGV4dD4KICAgIDx0ZXh0IHg9IjM5MCIgeT0iMjUzIj42LjMzPC90ZXh0PgogICAgPHRleHQgeD0iNDQyIiB5PSIyNTgiPjYuMDk8L3RleHQ+CiAgICA8dGV4dCB4PSI0OTQiIHk9IjI2MSI+NS45OTwvdGV4dD4KICAgIDx0ZXh0IHg9IjU0NiIgeT0iMzAyIj40LjI1PC90ZXh0PgogIDwvZz4KCiAgPGc+CiAgICA8cmVjdCB4PSI2MCIgIHk9IjExMCIgd2lkdGg9IjM2IiBoZWlnaHQ9IjMwMCIgZmlsbD0iIzI1NjNBMCIvPgogICAgPHJlY3QgeD0iMTEyIiB5PSIxOTYiIHdpZHRoPSIzNiIgaGVpZ2h0PSIyMTQiIGZpbGw9IiNhOWMzZGQiLz4KICAgIDxyZWN0IHg9IjE2NCIgeT0iMjE3IiB3aWR0aD0iMzYiIGhlaWdodD0iMTkzIiBmaWxsPSIjYTljM2RkIi8+CiAgICA8cmVjdCB4PSIyMTYiIHk9IjIzMyIgd2lkdGg9IjM2IiBoZWlnaHQ9IjE3NyIgZmlsbD0iI2E5YzNkZCIvPgogICAgPHJlY3QgeD0iMjY4IiB5PSIyNDUiIHdpZHRoPSIzNiIgaGVpZ2h0PSIxNjUiIGZpbGw9IiNhOWMzZGQiLz4KICAgIDxyZWN0IHg9IjMyMCIgeT0iMjUxIiB3aWR0aD0iMzYiIGhlaWdodD0iMTU5IiBmaWxsPSIjYTljM2RkIi8+CiAgICA8cmVjdCB4PSIzNzIiIHk9IjI2MSIgd2lkdGg9IjM2IiBoZWlnaHQ9IjE0OSIgZmlsbD0iI2E5YzNkZCIvPgogICAgPHJlY3QgeD0iNDI0IiB5PSIyNjYiIHdpZHRoPSIzNiIgaGVpZ2h0PSIxNDQiIGZpbGw9IiNhOWMzZGQiLz4KICAgIDxyZWN0IHg9IjQ3NiIgeT0iMjY5IiB3aWR0aD0iMzYiIGhlaWdodD0iMTQxIiBmaWxsPSIjYTljM2RkIi8+CiAgICA8cmVjdCB4PSI1MjgiIHk9IjMxMCIgd2lkdGg9IjM2IiBoZWlnaHQ9IjEwMCIgZmlsbD0iI2E5YzNkZCIvPgogIDwvZz4KCiAgPGxpbmUgeDE9IjU2IiB5MT0iNDEwIiB4Mj0iNTg2IiB5Mj0iNDEwIiBzdHJva2U9IiNkNmRiZTEiIHN0cm9rZS13aWR0aD0iMSIvPgoKICA8ZyBmb250LWZhbWlseT0iLWFwcGxlLXN5c3RlbSwgJ1NlZ29lIFVJJywgUm9ib3RvLCBzYW5zLXNlcmlmIiBmb250LXNpemU9IjEzIiBmaWxsPSIjNWI2NDcwIiB0ZXh0LWFuY2hvcj0ibWlkZGxlIj4KICAgIDx0ZXh0IHg9Ijc4IiB5PSI0MzIiPkU8L3RleHQ+CiAgICA8dGV4dCB4PSIxMzAiIHk9IjQzMiI+VDwvdGV4dD4KICAgIDx0ZXh0IHg9IjE4MiIgeT0iNDMyIj5BPC90ZXh0PgogICAgPHRleHQgeD0iMjM0IiB5PSI0MzIiPk88L3RleHQ+CiAgICA8dGV4dCB4PSIyODYiIHk9IjQzMiI+STwvdGV4dD4KICAgIDx0ZXh0IHg9IjMzOCIgeT0iNDMyIj5OPC90ZXh0PgogICAgPHRleHQgeD0iMzkwIiB5PSI0MzIiPlM8L3RleHQ+CiAgICA8dGV4dCB4PSI0NDIiIHk9IjQzMiI+SDwvdGV4dD4KICAgIDx0ZXh0IHg9IjQ5NCIgeT0iNDMyIj5SPC90ZXh0PgogICAgPHRleHQgeD0iNTQ2IiB5PSI0MzIiPkQ8L3RleHQ+CiAgPC9nPgo8L3N2Zz4K",Bt={class:"landing-mcp__grid"},St={class:"landing-mcp__chat"},kt={class:"landing-mcp__chat__body"},At={key:1,class:"landing-mcp__avatar landing-mcp__avatar--ghost","aria-hidden":"true"},Mt={class:"landing-mcp__msg__col"},Pt={key:0,class:"landing-mcp__msg__name"},Zt=["href"],xt={key:1,class:"landing-mcp__chart"},Lt=["src"],Ht={class:"landing-mcp__proof"},$t={class:"landing-mcp__steps"},Nt={class:"landing-mcp__steps__n"},jt={class:"landing-mcp__steps__t"},Dt={class:"landing-mcp__cta",href:"https://docs.blueprintchart.com/guide/mcp",target:"_blank",rel:"noopener noreferrer","aria-label":"Read the Blueprint Chart MCP documentation"},Rt='Make a bar chart of English letter frequencies with an highlight on "E".',Tt="claude mcp add blueprint-chart -- npx -y @blueprint-chart/mcp",Gt="https://blueprintchart.com/#/copy?bpc64=Y2hhcnQgYmFyLXZlcnRpY2FsIHsKICB0aXRsZSA9ICJFIGlzIHRoZSBtb3N0IGZyZXF1ZW50IGxldHRlciBpbiBFbmdsaXNoIgogIGRlc2NyaXB0aW9uID0gIkhvdyBvZnRlbiBlYWNoIGxldHRlciBhcHBlYXJzIGluIHR5cGljYWwgRW5nbGlzaCB0ZXh0IgogIGJ5bGluZSA9ICJQaWVycmUgUm9tZXJhIgogIHNvdXJjZSA9ICJMZXdhbmQsIENyeXB0b2xvZ2ljYWwgTWF0aGVtYXRpY3MiCiAgc291cmNlVXJsID0gImh0dHBzOi8vZW4ud2lraXBlZGlhLm9yZy93aWtpL0xldHRlcl9mcmVxdWVuY3kiCiAgbm90ZSA9ICJCYXNlZCBvbiBhbmFseXNpcyBvZiA0MCwwMDAgd29yZHMgZnJvbSBFbmdsaXNoIHByb3NlIgogIGNvbG9yUGFsZXR0ZSA9ICJMb25kb24iCiAgc29ydCA9IGRlc2NlbmRpbmcKICB2YWx1ZUxhYmVscyA9IHRydWUKICB2ZXJ0aWNhbExhYmVsUG9zaXRpb24gPSBvZmYKICB2ZXJ0aWNhbEdyaWRTdHlsZSA9IG5vbmUKCiAgaGlnaGxpZ2h0ICJFIgoKICBkYXRhIHsKICAgICJFIiA9IDEyLjcwCiAgICAiVCIgPSA5LjA2CiAgICAiQSIgPSA4LjE3CiAgICAiTyIgPSA3LjUxCiAgICAiSSIgPSA2Ljk3CiAgICAiTiIgPSA2Ljc1CiAgICAiUyIgPSA2LjMzCiAgICAiSCIgPSA2LjA5CiAgICAiUiIgPSA1Ljk5CiAgICAiRCIgPSA0LjI1CiAgfQp9Cg",zt=C({__name:"LandingMcp",setup(i){const t=[{role:"user",name:"You",text:Rt},{role:"asst",name:"Blueprint Chart",text:"Reading the dataviz handbook for letter-frequency conventions…"},{role:"asst",name:"Blueprint Chart",text:'Drafting the .bpc, sorting by frequency and accenting "E".'},{role:"asst",name:"Blueprint Chart",text:"Validated, no parse errors. Here's the chart 👇",chart:!0},{role:"user",name:"You",text:"Love it. Can you export it to a shareable link?"},{role:"asst",name:"Blueprint Chart",text:"Exported. Anyone can open this to view and copy the chart.",link:Gt}],u=[{n:"01",title:"Read the handbook",sub:"grounded in real dataviz pedagogy"},{n:"02",title:"Write the .bpc",sub:"compact, declarative chart source"},{n:"03",title:"Validate",sub:"structured parse errors and fixes"},{n:"04",title:"Render",sub:"SVG or PNG, deterministic"},{n:"05",title:"Iterate",sub:"a tight loop instead of guessing"}];return(g,n)=>(a(),H(j,{id:"mcp"},{default:h(()=>[d(D,{label:"01 / Author with AI"},{lead:h(()=>[...n[0]||(n[0]=[p(" Connect the Blueprint Chart MCP to Claude, Claude Code, Cursor, or any MCP client. It reads the dataviz handbook, writes the ",-1),e("code",null,".bpc",-1),p(", validates it, and renders it — so you get a real chart from a sentence. ",-1)])]),default:h(()=>[n[1]||(n[1]=p(" Describe the chart.",-1)),n[2]||(n[2]=e("br",null,null,-1)),n[3]||(n[3]=e("em",null,"Let your assistant build it.",-1))]),_:1}),e("div",Bt,[e("div",St,[n[4]||(n[4]=e("div",{class:"landing-mcp__chat__head"},[e("span",{class:"landing-mcp__chat__head__logo"},"B"),p(" Blueprint Chart · Assistant ")],-1)),e("div",kt,[(a(),o(v,null,w(t,(s,_)=>{var f,c,l;return e("div",{key:_,class:L(["landing-mcp__msg",{"landing-mcp__msg--user":s.role==="user","landing-mcp__msg--grouped":((f=t[_-1])==null?void 0:f.role)===s.role}])},[((c=t[_-1])==null?void 0:c.role)!==s.role?(a(),o("span",{key:0,class:L(["landing-mcp__avatar",`landing-mcp__avatar--${s.role}`])},[d(r($),{name:s.role==="user"?r(mt):r(E),size:"xs","aria-hidden":"true"},null,8,["name"])],2)):(a(),o("span",At)),e("div",Mt,[((l=t[_-1])==null?void 0:l.role)!==s.role?(a(),o("span",Pt,m(s.name),1)):A("",!0),e("div",{class:L(["landing-mcp__bubble",`landing-mcp__bubble--${s.role}`])},[p(m(s.text)+" ",1),s.link?(a(),o("a",{key:0,class:"landing-mcp__link",href:s.link,target:"_blank",rel:"noopener noreferrer"},m(s.link),9,Zt)):A("",!0)],2),s.chart?(a(),o("div",xt,[e("img",{class:"landing-mcp__chart__img",src:r(wt),alt:"Bar chart: E is the most frequent letter in English at 12.7%, followed by T, A, O, I, N, S, H, R and D"},null,8,Lt)])):A("",!0)])],2)}),64))])]),e("div",Ht,[n[7]||(n[7]=e("div",{class:"landing-mcp__proof__label"}," How it works ",-1)),e("ol",$t,[(a(),o(v,null,w(u,s=>e("li",{key:s.n,class:"landing-mcp__steps__item"},[e("span",Nt,m(s.n),1),e("span",jt,[p(m(s.title)+" ",1),e("small",null,m(s.sub),1)])])),64))]),e("div",{class:"landing-mcp__install","data-bs-theme":"dark"},[n[5]||(n[5]=e("div",{class:"landing-mcp__install__head"},[e("span",{class:"landing-mcp__install__head__dots"},[e("span"),e("span"),e("span")]),p(" terminal ")],-1)),e("code",{class:"landing-mcp__install__cmd"},m(Tt))]),e("a",Dt,[d(r($),{name:r(E),size:"xs","aria-hidden":"true"},null,8,["name"]),n[6]||(n[6]=p(" Read the docs ",-1))])])])]),_:1}))}}),Wt=y(zt,[["__scopeId","data-v-14c91008"]]),Vt={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"};function Xt(i,t){return a(),o("svg",Vt,[...t[0]||(t[0]=[e("path",{fill:"currentColor",d:"M208 80h-32V56a48 48 0 0 0-96 0v24H48a16 16 0 0 0-16 16v112a16 16 0 0 0 16 16h160a16 16 0 0 0 16-16V96a16 16 0 0 0-16-16M96 56a32 32 0 0 1 64 0v24H96Zm112 152H48V96h160zm-68-56a12 12 0 1 1-12-12a12 12 0 0 1 12 12"},null,-1)])])}const Et=S({name:"ph-lock",render:Xt}),Yt={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"};function Ft(i,t){return a(),o("svg",Yt,[...t[0]||(t[0]=[e("path",{fill:"currentColor",d:"M215.79 118.17a8 8 0 0 0-5-5.66L153.18 90.9l14.66-73.33a8 8 0 0 0-13.69-7l-112 120a8 8 0 0 0 3 13l57.63 21.61l-14.62 73.25a8 8 0 0 0 13.69 7l112-120a8 8 0 0 0 1.94-7.26M109.37 214l10.47-52.38a8 8 0 0 0-5-9.06L62 132.71l84.62-90.66l-10.46 52.38a8 8 0 0 0 5 9.06l52.8 19.8Z"},null,-1)])])}const Ut=S({name:"ph-lightning",render:Ft}),Qt={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"};function Ot(i,t){return a(),o("svg",Qt,[...t[0]||(t[0]=[e("path",{fill:"currentColor",d:"M53.92 34.62a8 8 0 1 0-11.84 10.76l39.24 43.17l-.06.12A65 65 0 0 0 72 88a64 64 0 0 0 0 128h88a87.3 87.3 0 0 0 31.8-5.93l10.28 11.31a8 8 0 1 0 11.84-10.76ZM160 200H72a48 48 0 0 1 0-96c1.1 0 2.2 0 3.3.12A88.4 88.4 0 0 0 72 128a8 8 0 0 0 16 0a72.3 72.3 0 0 1 5.06-26.54l87 95.7A71.7 71.7 0 0 1 160 200m88-72a87.9 87.9 0 0 1-22.35 58.61A8 8 0 0 1 213.71 176a72 72 0 0 0-96.34-106a8 8 0 0 1-9.48-12.89A88 88 0 0 1 248 128"},null,-1)])])}const Jt=S({name:"ph-cloud-slash",render:Ot}),Kt={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"};function qt(i,t){return a(),o("svg",Kt,[...t[0]||(t[0]=[e("path",{fill:"currentColor",d:"M128 24c-53.83 0-96 24.6-96 56v96c0 31.4 42.17 56 96 56s96-24.6 96-56V80c0-31.4-42.17-56-96-56m80 104c0 9.62-7.88 19.43-21.61 26.92C170.93 163.35 150.19 168 128 168s-42.93-4.65-58.39-13.08C55.88 147.43 48 137.62 48 128v-16.64c17.06 15 46.23 24.64 80 24.64s62.94-9.68 80-24.64ZM69.61 53.08C85.07 44.65 105.81 40 128 40s42.93 4.65 58.39 13.08C200.12 60.57 208 70.38 208 80s-7.88 19.43-21.61 26.92C170.93 115.35 150.19 120 128 120s-42.93-4.65-58.39-13.08C55.88 99.43 48 89.62 48 80s7.88-19.43 21.61-26.92m116.78 149.84C170.93 211.35 150.19 216 128 216s-42.93-4.65-58.39-13.08C55.88 195.43 48 185.62 48 176v-16.64c17.06 15 46.23 24.64 80 24.64s62.94-9.68 80-24.64V176c0 9.62-7.88 19.43-21.61 26.92"},null,-1)])])}const en=S({name:"ph-database",render:qt}),tn={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"};function nn(i,t){return a(),o("svg",tn,[...t[0]||(t[0]=[e("path",{fill:"currentColor",d:"M216 48v48a8 8 0 0 1-16 0V67.31l-42.34 42.35a8 8 0 0 1-11.32-11.32L188.69 56H160a8 8 0 0 1 0-16h48a8 8 0 0 1 8 8M98.34 146.34L56 188.69V160a8 8 0 0 0-16 0v48a8 8 0 0 0 8 8h48a8 8 0 0 0 0-16H67.31l42.35-42.34a8 8 0 0 0-11.32-11.32M208 152a8 8 0 0 0-8 8v28.69l-42.34-42.35a8 8 0 0 0-11.32 11.32L188.69 200H160a8 8 0 0 0 0 16h48a8 8 0 0 0 8-8v-48a8 8 0 0 0-8-8M67.31 56H96a8 8 0 0 0 0-16H48a8 8 0 0 0-8 8v48a8 8 0 0 0 16 0V67.31l42.34 42.35a8 8 0 0 0 11.32-11.32Z"},null,-1)])])}const an=S({name:"ph-arrows-out",render:nn}),sn={class:"landing-default-card"},on={class:"landing-default-card__head"},rn={class:"landing-default-card__head__icon"},ln={class:"landing-default-card__head__tag"},dn={class:"landing-default-card__title"},cn={class:"landing-default-card__desc"},_n=C({__name:"LandingDefaultCard",props:{icon:{},tag:{},title:{},description:{}},setup(i){return(t,u)=>(a(),o("div",sn,[e("div",on,[e("span",rn,[d(r($),{name:i.icon,size:"sm"},null,8,["name"])]),e("span",ln,m(i.tag),1)]),e("h4",dn,m(i.title),1),e("p",cn,m(i.description),1)]))}}),F=y(_n,[["__scopeId","data-v-582e2ff8"]]),un={class:"landing-format__grid"},gn={class:"landing-format__pane","data-bs-theme":"dark"},pn=["innerHTML"],mn={class:"landing-format__browser"},hn={class:"landing-format__browser__url","aria-hidden":"true"},In=["href"],fn={class:"landing-format__browser__chart"},bn={class:"landing-format__cards"},vn={class:"landing-format__footnote"},Cn={class:"landing-format__footnote__lead"},yn="eyJ0eXBlIjoibGluZSIsImRhdGEiOlt7IngiOiIxOTgwIix7InkiOj",wn="eyJ0...",Bn=C({__name:"LandingFormat",setup(i){const t=z.find(c=>c.id==="temperature-anomaly");if(!t)throw new Error("Missing temperature-anomaly sample — see LandingFormat.vue");const u=t.dsl.replace(/\{/,`{
|
|
3
3
|
theme = "blueprint-framed"`),g=Se(u);function n(c){const l=new TextEncoder().encode(c);let I="";for(const k of l)I+=String.fromCharCode(k);return globalThis.btoa(I)}const s=n(u),_=typeof window<"u"?`${window.location.origin}${window.location.pathname}#/render?bpc64=${encodeURIComponent(s)}`:"#",f=[{icon:Jt,tag:"A",title:"No backend",description:"The renderer runs in the browser. Self-host the editor anywhere, including a USB stick."},{icon:en,tag:"B",title:"Data stays local",description:"Your CSV never touches a server. The base64 payload is the data. It travels with the iframe."},{icon:an,tag:"C",title:"One string ships",description:"The entire chart fits in a URL fragment. One copy-paste embeds it on any CMS."}];return(c,l)=>(a(),H(j,{id:"format"},{default:h(()=>[d(D,{label:"02 / One portable file"},{lead:h(()=>[...l[0]||(l[0]=[p(" Blueprint charts are plain-text in, self-contained iframe out. No backend renders them. Your data never leaves the browser. One file is the chart, the data, and the embed, together. ",-1)])]),default:h(()=>[l[1]||(l[1]=p(" BPC: a chart you",-1)),l[2]||(l[2]=e("br",null,null,-1)),l[3]||(l[3]=e("em",null,"can hold in your hand.",-1))]),_:1}),e("div",un,[e("div",gn,[l[4]||(l[4]=e("div",{class:"landing-format__pane__head"},[e("span",{class:"landing-format__pane__head__dots"},[e("span"),e("span"),e("span")]),p(" chart.bpc ")],-1)),e("pre",{class:"landing-format__pane__code",innerHTML:r(g)},null,8,pn)]),e("div",mn,[l[7]||(l[7]=e("span",{class:"visually-hidden"},"Example embed URL",-1)),e("div",hn,[l[6]||(l[6]=e("span",{class:"landing-format__browser__url__dots"},[e("span"),e("span"),e("span")],-1)),e("a",{href:r(_),target:"_blank",rel:"noopener","aria-label":"Open this chart embed in a new tab",class:"landing-format__browser__url__bar"},[d(r($),{name:r(Et),size:"xs",variant:"success"},null,8,["name"]),l[5]||(l[5]=e("span",{class:"landing-format__browser__url__bar__host"},"blueprintchart.com/#/render?bpc64=",-1)),e("span",{class:"landing-format__browser__url__bar__fragment landing-format__browser__url__bar__fragment--long"},m(yn)),e("span",{class:"landing-format__browser__url__bar__fragment landing-format__browser__url__bar__fragment--short"},m(wn))],8,In)]),e("div",fn,[d(Y,{bpc:r(u)},null,8,["bpc"])])])]),e("div",bn,[(a(),o(v,null,w(f,I=>d(F,{key:I.tag,icon:I.icon,tag:I.tag,title:I.title,description:I.description},null,8,["icon","tag","title","description"])),64))]),e("p",vn,[e("span",Cn,[l[8]||(l[8]=e("span",{class:"landing-format__footnote__label"},"FYI",-1)),d(r($),{name:r(Ut),size:"xs",variant:"warning"},null,8,["name"])]),l[9]||(l[9]=e("span",{class:"landing-format__footnote__text"},[p(" Plain-text BPC is also an excellent target for LLMs. The official "),e("a",{class:"landing-format__footnote__link",href:"https://docs.blueprintchart.com/guide/mcp",target:"_blank",rel:"noopener noreferrer"},"MCP"),p(" writes, validates, and renders it for you. ")],-1))])]),_:1}))}}),Sn=y(Bn,[["__scopeId","data-v-d42efcc0"]]),kn={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"};function An(i,t){return a(),o("svg",kn,[...t[0]||(t[0]=[e("path",{fill:"currentColor",d:"M225 80.4L183.6 39a24 24 0 0 0-33.94 0L31 157.66a24 24 0 0 0 0 33.94l30.06 30.06a8 8 0 0 0 5.68 2.34H216a8 8 0 0 0 0-16h-84.7l93.7-93.66a24 24 0 0 0 0-33.94M108.68 208H70.05l-27.72-27.72a8 8 0 0 1 0-11.31L96 115.31L148.69 168Zm105-105L160 156.69L107.31 104L161 50.34a8 8 0 0 1 11.32 0l41.38 41.38a8 8 0 0 1 0 11.31Z"},null,-1)])])}const Mn=S({name:"ph-eraser",render:An}),Pn={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"};function Zn(i,t){return a(),o("svg",Pn,[...t[0]||(t[0]=[e("path",{fill:"currentColor",d:"M224 72h-16v-8a24 24 0 0 0-24-24H40a24 24 0 0 0-24 24v96a24 24 0 0 0 24 24h112v8a24 24 0 0 0 24 24h48a24 24 0 0 0 24-24V96a24 24 0 0 0-24-24M40 168a8 8 0 0 1-8-8V64a8 8 0 0 1 8-8h144a8 8 0 0 1 8 8v8h-16a24 24 0 0 0-24 24v72Zm192 24a8 8 0 0 1-8 8h-48a8 8 0 0 1-8-8V96a8 8 0 0 1 8-8h48a8 8 0 0 1 8 8Zm-96 16a8 8 0 0 1-8 8H88a8 8 0 0 1 0-16h40a8 8 0 0 1 8 8m80-96a8 8 0 0 1-8 8h-16a8 8 0 0 1 0-16h16a8 8 0 0 1 8 8"},null,-1)])])}const xn=S({name:"ph-devices",render:Zn}),Ln={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"};function Hn(i,t){return a(),o("svg",Ln,[...t[0]||(t[0]=[e("path",{fill:"currentColor",d:"M100 56H40a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h60v8a32 32 0 0 1-32 32a8 8 0 0 0 0 16a48.05 48.05 0 0 0 48-48V72a16 16 0 0 0-16-16m0 80H40V72h60Zm116-80h-60a16 16 0 0 0-16 16v64a16 16 0 0 0 16 16h60v8a32 32 0 0 1-32 32a8 8 0 0 0 0 16a48.05 48.05 0 0 0 48-48V72a16 16 0 0 0-16-16m0 80h-60V72h60Z"},null,-1)])])}const $n=S({name:"ph-quotes",render:Hn}),Nn={class:"landing-defaults__grid"},jn={class:"landing-defaults__grid__chart"},Dn={class:"landing-defaults__grid__cards"},Rn=C({__name:"LandingDefaults",setup(i){const t=z.find(n=>n.id==="temperature-anomaly");if(!t)throw new Error("Missing temperature-anomaly sample — see LandingDefaults.vue");const u=t.dsl.replace(/\{/,`{
|
|
4
4
|
theme = "blueprint-framed"`),g=[{icon:ke,tag:"01",title:"Axes start at zero",description:"Bars never lie. Truncated axes require an explicit override."},{icon:Ae,tag:"02",title:"Direct labels",description:"Labels sit next to data. Readers' eyes never travel to a legend box."},{icon:Mn,tag:"03",title:"No chart junk",description:"Gridlines and borders are suppressed unless they carry information."},{icon:Me,tag:"04",title:"CVD-safe palettes",description:"Every palette tested against deuteranopia, protanopia, tritanopia."},{icon:xn,tag:"05",title:"Mobile-first",description:"Labels reflow, ticks reduce, layouts adapt from desktop down to 320 px."},{icon:$n,tag:"06",title:"Source attribution",description:"The BPC format includes a source field displayed on every chart."}];return(n,s)=>(a(),H(j,{id:"defaults"},{default:h(()=>[d(D,{label:"03 / Defaults"},{lead:h(()=>[...s[0]||(s[0]=[p(" Clutter is the enemy of insight. Blueprint Chart's defaults are opinionated by design, guided by decades of dataviz research from Tufte, Cairo and Schwabish — the same rigor newsrooms rely on — so your readers focus on the story, not the noise. ",-1)])]),default:h(()=>[s[1]||(s[1]=p(" A simple chart",-1)),s[2]||(s[2]=e("br",null,null,-1)),s[3]||(s[3]=e("em",null,"sends a big message.",-1))]),_:1}),e("div",Nn,[e("div",jn,[d(Y,{bpc:r(u)},null,8,["bpc"])]),e("div",Dn,[(a(),o(v,null,w(g,_=>d(F,{key:_.tag,icon:_.icon,tag:_.tag,title:_.title,description:_.description},null,8,["icon","tag","title","description"])),64))])])]),_:1}))}}),Tn=y(Rn,[["__scopeId","data-v-2eb1dacc"]]),Gn={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"};function zn(i,t){return a(),o("svg",Gn,[...t[0]||(t[0]=[e("path",{fill:"currentColor",d:"M208 40a8 8 0 0 1-8 8h-29.29a24 24 0 0 0-23.62 19.71l-9.5 52.29H184a8 8 0 0 1 0 16h-49.32l-10 55.16A40 40 0 0 1 85.29 224H56a8 8 0 0 1 0-16h29.29a24 24 0 0 0 23.62-19.71l9.5-52.29H72a8 8 0 0 1 0-16h49.32l10-55.16A40 40 0 0 1 170.71 32H200a8 8 0 0 1 8 8"},null,-1)])])}const Wn=S({name:"ph-function",render:zn}),Vn={class:"transforms-demo"},Xn={class:"transforms-demo__steps"},En=["onClick"],Yn={class:"transforms-demo__step__num"},Fn={class:"transforms-demo__step__label"},Un={class:"transforms-demo__body"},Qn={class:"transforms-demo__body__panel"},On={class:"transforms-demo__body__panel__title"},Jn={class:"transforms-demo__body__panel__table"},Kn={class:"transforms-demo__body__panel"},qn={class:"transforms-demo__body__panel__title"},ea={class:"transforms-demo__body__panel__table"},ta={class:"transforms-demo__body__panel__note"},na={class:"landing-transforms__cards"},aa=C({__name:"LandingTransforms",setup(i){const t=N(0),u=[{icon:Wn,tag:"SORT · FILTER · GROUP",title:"Core operations",description:"Multi-column sort, conditional filter, group-with-aggregate (sum / avg / min / max / count)."},{icon:Pe,tag:"29 OPERATIONS",title:"Parse & reshape",description:"Type conversions, string transforms, date extraction, numeric normalisation."},{icon:Ze,tag:"RENAME · HIDE",title:"Chart-ready labels",description:"Clean column names for axis labels. Hide columns without deleting your data."},{icon:xe,tag:"TRANSPOSE",title:"Pivot",description:"Swap rows and columns. First-column values become headers."}],g=[{label:"Raw CSV",inputTitle:"Uploaded data",outputTitle:"Detected types",input:[["country","year","co2"],["France","2019","4.6"],["France","2020","4.1"],["Germany","2019","8.5"],["Germany","2020","7.7"],["USA","2019","15.2"],["USA","2020","13.9"]],output:[["column","type","values"],["country","string","3 unique"],["year","number","2019 – 2020"],["co2","number","4.1 – 15.2"]],note:"Blueprint auto-detects column types from your CSV, paste or sample data."},{label:"Group by",inputTitle:"Input rows",outputTitle:"After grouping",input:[["country","year","co2"],["France","2019","4.6"],["France","2020","4.1"],["Germany","2019","8.5"],["Germany","2020","7.7"],["USA","2019","15.2"],["USA","2020","13.9"]],output:[["country","co2 (avg)"],["France","4.35"],["Germany","8.10"],["USA","14.55"]],highlightCol:"country",outputHighlightCol:"co2 (avg)",note:"Rows with the same country are grouped. CO₂ values aggregated with AVG."},{label:"Sort",inputTitle:"Grouped data",outputTitle:"Sorted descending",input:[["country","co2 (avg)"],["France","4.35"],["Germany","8.10"],["USA","14.55"]],output:[["country","co2 (avg)"],["USA","14.55"],["Germany","8.10"],["France","4.35"]],outputHighlightCol:"co2 (avg)",note:"Sorted by CO₂ descending, highest emitter first. Ready for the chart."},{label:"Rename",inputTitle:"Before rename",outputTitle:"Chart-ready",input:[["country","co2 (avg)"],["USA","14.55"],["Germany","8.10"],["France","4.35"]],output:[["Country","Avg CO₂ (tonnes)"],["USA","14.55"],["Germany","8.10"],["France","4.35"]],outputHighlightCol:"Avg CO₂ (tonnes)",note:"Clean column names for readable axis labels. Data flows straight to the chart."}];return(n,s)=>{const _=D,f=j;return a(),H(f,{id:"transforms",surface:"content"},{default:h(()=>[d(_,{label:"04 / Data pipeline"},{lead:h(()=>[...s[0]||(s[0]=[p(" Raw data rarely fits a chart out of the box. Blueprint's pipeline lets you sort, filter, group, parse and reshape, all without leaving the editor, all replayable from your BPC source. ",-1)])]),default:h(()=>[s[1]||(s[1]=p(" Reshape your data",-1)),s[2]||(s[2]=e("br",null,null,-1)),s[3]||(s[3]=e("em",null,"before you chart it.",-1))]),_:1}),e("div",Vn,[e("div",Xn,[(a(),o(v,null,w(g,(c,l)=>e("button",{key:l,class:L(["transforms-demo__step",{"transforms-demo__step--active":r(t)===l}]),onClick:I=>t.value=l},[e("span",Yn,m(l+1),1),e("span",Fn,m(c.label),1)],10,En)),64))]),e("div",Un,[e("div",Qn,[e("div",On,m(g[r(t)].inputTitle),1),e("table",Jn,[e("thead",null,[e("tr",null,[(a(!0),o(v,null,w(g[r(t)].input[0],c=>(a(),o("th",{key:c,class:"transforms-demo__body__panel__th"},m(c),1))),128))])]),e("tbody",null,[(a(!0),o(v,null,w(g[r(t)].input.slice(1),(c,l)=>(a(),o("tr",{key:l},[(a(!0),o(v,null,w(c,(I,k)=>(a(),o("td",{key:k,class:L(["transforms-demo__body__panel__td",{"transforms-demo__body__panel__td--highlight":g[r(t)].highlightCol===g[r(t)].input[0][k]}])},m(I),3))),128))]))),128))])])]),s[4]||(s[4]=e("div",{class:"transforms-demo__body__flow"},[e("svg",{viewBox:"0 0 80 10",preserveAspectRatio:"none",class:"transforms-demo__body__flow__svg"},[e("path",{d:"M0,5 C30,5 50,5 80,5",class:"transforms-demo__body__flow__wire","vector-effect":"non-scaling-stroke"})]),e("div",{class:"transforms-demo__body__flow__dot transforms-demo__body__flow__dot--left"}),e("div",{class:"transforms-demo__body__flow__dot transforms-demo__body__flow__dot--right"})],-1)),e("div",Kn,[e("div",qn,m(g[r(t)].outputTitle),1),e("table",ea,[e("thead",null,[e("tr",null,[(a(!0),o(v,null,w(g[r(t)].output[0],c=>(a(),o("th",{key:c,class:"transforms-demo__body__panel__th"},m(c),1))),128))])]),e("tbody",null,[(a(!0),o(v,null,w(g[r(t)].output.slice(1),(c,l)=>(a(),o("tr",{key:l},[(a(!0),o(v,null,w(c,(I,k)=>(a(),o("td",{key:k,class:L(["transforms-demo__body__panel__td",{"transforms-demo__body__panel__td--highlight":g[r(t)].outputHighlightCol===g[r(t)].output[0][k]}])},m(I),3))),128))]))),128))])]),e("p",ta,m(g[r(t)].note),1)])])]),e("div",na,[(a(),o(v,null,w(u,c=>d(F,{key:c.tag,icon:c.icon,tag:c.tag,title:c.title,description:c.description},null,8,["icon","tag","title","description"])),64))])]),_:1})}}}),sa=y(aa,[["__scopeId","data-v-d1c11d25"]]),oa={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"};function ia(i,t){return a(),o("svg",oa,[...t[0]||(t[0]=[e("path",{fill:"currentColor",d:"M216 104H102.09L210 75.51a8 8 0 0 0 5.68-9.84l-8.16-30a15.93 15.93 0 0 0-19.42-11.13L35.81 64.74a15.75 15.75 0 0 0-9.7 7.4a15.5 15.5 0 0 0-1.55 12L32 111.56V200a16 16 0 0 0 16 16h160a16 16 0 0 0 16-16v-88a8 8 0 0 0-8-8m-23.84-64l6 22.07l-22.62 6l-28.12-16.24Zm-66.69 17.6l28.12 16.24l-36.94 9.75l-28.12-16.22Zm-79.4 44.62l-6-22.08l26.5-7L94.69 89.4ZM208 200H48v-80h160z"},null,-1)])])}const ra=S({name:"ph-film-slate",render:ia}),la={class:"scenes__grid"},da={class:"scenes__grid__features"},ca={class:"scenes-feature__icon"},_a={class:"scenes-feature__title"},ua={class:"scenes-feature__desc"},ga={class:"scenes-demo"},pa=C({__name:"LandingScenes",setup(i){const t=z.find(B=>B.id==="farm-compass");if(!t)throw new Error("Missing farm-compass sample — see LandingScenes.vue");const u=t.dsl,g=Qe(u),n=te("containerRef"),s=q(null),_=N(-1),f=N(!1),c=N(!1);let l=null;const I=N(_.value+2);T(_,B=>{I.value=B+2});const{theme:k}=G();function b(){n.value&&(ne(n.value,u,{stripColors:!0,sceneIndex:_.value>=0?_.value:void 0,transition:c.value}),c.value=!1)}const M=ee(b,150);T([n,_,k],b,{immediate:!0}),K(n,M);function U(){var B;return((B=n.value)==null?void 0:B.querySelector(".bc-frame-footer"))??null}let P=null;T(n,B=>{if(P&&(P.disconnect(),P=null),!B){s.value=null;return}s.value=U(),P=new MutationObserver(()=>{s.value=U()}),P.observe(B,{childList:!0,subtree:!0})},{immediate:!0});function ae(B){c.value=!0,_.value=B-2}function se(){_.value>-1&&(c.value=!0,_.value=_.value-1)}function oe(){_.value<g-1&&(c.value=!0,_.value=_.value+1)}function ie(){f.value||(f.value=!0,c.value=!0,_.value=-1,l=globalThis.setInterval(()=>{_.value<g-1?(c.value=!0,_.value++):W()},3e3))}function W(){f.value=!1,l&&(globalThis.clearInterval(l),l=null)}Le(()=>{W(),P&&(P.disconnect(),P=null)});const re=[{icon:ra,title:"Sequential scenes",description:"Each scene mutates the chart: highlight, filter, zoom, reorder, or change type entirely."},{icon:E,title:"Smooth animated transitions",description:"D3-powered morphing between states: bars grow, lines redraw, highlights pulse."},{icon:He,title:"Embed anywhere",description:"One iframe embed. Works in WordPress, Ghost, any CMS."}];return(B,Z)=>{const le=D,de=j;return a(),H(de,{id:"scenes",surface:"content"},{default:h(()=>[d(le,{label:"05 / Scenes & storytelling"},{lead:h(()=>[...Z[0]||(Z[0]=[p(" Create a sequence of scenes, each one a step in your narrative. The same chart morphs from overview to focus, from cause to consequence. Press play, or step through. ",-1)])]),default:h(()=>[Z[1]||(Z[1]=p(" Guide your reader",-1)),Z[2]||(Z[2]=e("br",null,null,-1)),Z[3]||(Z[3]=e("em",null,"through the data.",-1))]),_:1}),e("div",la,[e("div",da,[(a(),o(v,null,w(re,R=>e("div",{key:R.title,class:"scenes-feature"},[e("span",ca,[d(r($),{name:R.icon,size:"sm",variant:"primary"},null,8,["name"])]),e("div",null,[e("strong",_a,m(R.title),1),e("p",ua,m(R.description),1)])])),64))]),e("div",ga,[e("div",{ref_key:"containerRef",ref:n,class:"scenes-demo__chart"},null,512),r(s)&&r(g)>0?(a(),H($e,{key:0,to:r(s)},[d(r(Ne),{total:r(g)+1,current:r(I),playing:r(f),position:"left","onUpdate:current":ae,onPrevious:se,onNext:oe,onPlay:ie,onPause:W},null,8,["total","current","playing"])],8,["to"])):A("",!0)])])]),_:1})}}}),ma=y(pa,[["__scopeId","data-v-6712a09b"]]),ha={class:"landing-footer"},Ia={class:"landing-footer__brand"},fa=["src"],ba=C({__name:"LandingFooter",setup(i){const{theme:t}=G(),u=X(()=>t.value==="dark"?O:J);return(g,n)=>{const s=Q("router-link");return a(),o("footer",ha,[e("div",Ia,[e("img",{src:u.value,alt:"Blueprint Chart",class:"landing-footer__brand__logo"},null,8,fa),n[0]||(n[0]=e("span",{class:"landing-footer__brand__name"},"Blueprint Chart",-1))]),n[2]||(n[2]=e("span",{class:"landing-footer__sep","aria-hidden":"true"},"·",-1)),d(s,{to:"/new",class:"landing-footer__link"},{default:h(()=>[...n[1]||(n[1]=[p(" Editor ",-1)])]),_:1}),n[3]||(n[3]=e("span",{class:"landing-footer__sep","aria-hidden":"true"},"·",-1)),n[4]||(n[4]=e("a",{class:"landing-footer__link",href:"https://github.com/blueprint-chart/blueprint-chart",target:"_blank",rel:"noopener noreferrer"}," GitHub ",-1)),n[5]||(n[5]=e("span",{class:"landing-footer__spacer"},null,-1)),n[6]||(n[6]=e("span",{class:"landing-footer__tagline"}," MIT · Open source charting ",-1))])}}}),va=y(ba,[["__scopeId","data-v-14cc0356"]]),Ca={class:"landing-page"},ya=C({__name:"LandingPage",setup(i){return(t,u)=>(a(),o("div",Ca,[d(Fe),d(st),d(ct),d(Wt),d(Sn),d(Tn),d(sa),d(ma),d(va)]))}}),Ba=y(ya,[["__scopeId","data-v-fe1d79e1"]]);export{Ba as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LandingPage-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LandingPage-mQMQYQqJ.js","assets/LandingPage-DwbySIyi.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
var K9=Object.defineProperty;var X9=(t,e,n)=>e in t?K9(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var xn=(t,e,n)=>X9(t,typeof e!="symbol"?e+"":e,n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&o(s)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function o(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();/**
|
|
3
3
|
* @vue/shared v3.5.29
|
|
4
4
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
@@ -256,7 +256,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
256
256
|
|
|
257
257
|
annotation "2021" {
|
|
258
258
|
text = "All-time high cycle"
|
|
259
|
-
|
|
259
|
+
textOffsetY = -12
|
|
260
260
|
showArrow = true
|
|
261
261
|
}
|
|
262
262
|
|
|
@@ -283,7 +283,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
283
283
|
|
|
284
284
|
annotation "2009" {
|
|
285
285
|
text = "Great Recession peak"
|
|
286
|
-
|
|
286
|
+
textOffsetY = -10
|
|
287
287
|
showArrow = true
|
|
288
288
|
}
|
|
289
289
|
|
|
@@ -924,4 +924,4 @@ ${n}`,t.replaceChildren(o)}function IT(t,e,n){if(!e){n!=null&&n.transition||t.re
|
|
|
924
924
|
`,r=t.state.doc.line(r.number+(n?1:-1)),i=t.bidiSpans(r),c=t.visualLineSide(r,!n)}if(l){if(!l(u))return a}else{if(!o)return c;l=o(u)}a=c}}function P0e(t,e,n){let o=t.state.charCategorizer(e),r=o(n);return i=>{let s=o(i);return r==js.Space&&(r=s),r==s}}function D0e(t,e,n,o){let r=e.head,i=n?1:-1;if(r==(n?t.state.doc.length:0))return Ye.cursor(r,e.assoc);let s=e.goalColumn,a,l=t.contentDOM.getBoundingClientRect(),c=t.coordsAtPos(r,(e.empty?e.assoc:0)||(n?1:-1)),u=t.documentTop;if(c)s==null&&(s=c.left-l.left),a=i<0?c.top:c.bottom;else{let m=t.viewState.lineBlockAt(r);s==null&&(s=Math.min(l.right-l.left,t.defaultCharacterWidth*(r-m.from))),a=(i<0?m.top:m.bottom)+u}let d=l.left+s,f=o??t.viewState.heightOracle.textHeight>>1,h=ry(t,{x:d,y:a+f*i},!1,i);return Ye.cursor(h.pos,h.assoc,void 0,s)}function Jd(t,e,n){for(;;){let o=0;for(let r of t)r.between(e-1,e+1,(i,s,a)=>{if(e>i&&e<s){let l=o||n||(e-i<s-e?-1:1);e=l<0?i:s,o=l}});if(!o)return e}}function LM(t,e){let n=null;for(let o=0;o<e.ranges.length;o++){let r=e.ranges[o],i=null;if(r.empty){let s=Jd(t,r.from,0);s!=r.from&&(i=Ye.cursor(s,-1))}else{let s=Jd(t,r.from,-1),a=Jd(t,r.to,1);(s!=r.from||a!=r.to)&&(i=Ye.range(r.from==r.anchor?s:a,r.from==r.head?s:a))}i&&(n||(n=e.ranges.slice()),n[o]=i)}return n?Ye.create(n,e.mainIndex):e}function u1(t,e,n){let o=Jd(t.state.facet(sh).map(r=>r(t)),n.from,e.head>n.from?-1:1);return o==n.from?n:Ye.cursor(o,o<n.from?1:-1)}class es{constructor(e,n){this.pos=e,this.assoc=n}}function ry(t,e,n,o){let r=t.contentDOM.getBoundingClientRect(),i=r.top+t.viewState.paddingTop,{x:s,y:a}=e,l=a-i,c;for(;;){if(l<0)return new es(0,1);if(l>t.viewState.docHeight)return new es(t.state.doc.length,-1);if(c=t.elementAtHeight(l),o==null)break;if(c.type==Xr.Text){if(o<0?c.to<t.viewport.from:c.from>t.viewport.to)break;let f=t.docView.coordsAt(o<0?c.from:c.to,o>0?-1:1);if(f&&(o<0?f.top<=l+i:f.bottom>=l+i))break}let d=t.viewState.heightOracle.textHeight/2;l=o>0?c.bottom+d:c.top-d}if(t.viewport.from>=c.to||t.viewport.to<=c.from){if(n)return null;if(c.type==Xr.Text){let d=M0e(t,r,c,s,a);return new es(d,d==c.from?1:-1)}}if(c.type!=Xr.Text)return l<(c.top+c.bottom)/2?new es(c.from,1):new es(c.to,-1);let u=t.docView.lineAt(c.from,2);return(!u||u.length!=c.length)&&(u=t.docView.lineAt(c.from,-2)),new E0e(t,s,a,t.textDirectionAt(c.from)).scanTile(u,c.from)}class E0e{constructor(e,n,o,r){this.view=e,this.x=n,this.y=o,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,n){let{line:o,spans:r}=this.bidiSpansAt(e);return r[os.find(r,e-o.from,-1,n)].level==this.baseDir}dirAt(e,n){let{line:o,spans:r}=this.bidiSpansAt(e);return r[os.find(r,e-o.from,-1,n)].dir}bidiIn(e,n){let{spans:o,line:r}=this.bidiSpansAt(e);return o.length>1||o.length&&(o[0].level!=this.baseDir||o[0].to+r.from<n)}scan(e,n){let o=0,r=e.length-1,i=new Set,s=this.bidiIn(e[0],e[r]),a,l,c=-1,u=1e9,d;e:for(;o<r;){let h=r-o,m=o+r>>1;t:if(i.has(m)){let g=o+Math.floor(Math.random()*h);for(let v=0;v<h;v++){if(!i.has(g)){m=g;break t}g++,g==r&&(g=o)}break e}i.add(m);let b=n(m);if(b)for(let g=0;g<b.length;g++){let v=b[g],y=0;if(v.bottom<this.y)(!a||a.bottom<v.bottom)&&(a=v),y=1;else if(v.top>this.y)(!l||l.top>v.top)&&(l=v),y=-1;else{let x=v.left>this.x?this.x-v.left:v.right<this.x?this.x-v.right:0,_=Math.abs(x);_<u&&(c=m,u=_,d=v),x&&(y=x<0==(this.baseDir==Nn.LTR)?-1:1)}y==-1&&(!s||this.baseDirAt(e[m],1))?r=m:y==1&&(!s||this.baseDirAt(e[m+1],-1))&&(o=m+1)}}if(!d){let h=a&&(!l||this.y-a.bottom<l.top-this.y)?a:l;return this.y=(h.top+h.bottom)/2,this.scan(e,n)}let f=(s?this.dirAt(e[c],1):this.baseDir)==Nn.LTR;return{i:c,after:this.x>(d.left+d.right)/2==f}}scanText(e,n){let o=[];for(let i=0;i<e.length;i=Po(e.text,i))o.push(n+i);o.push(n+e.length);let r=this.scan(o,i=>{let s=o[i]-n,a=o[i+1]-n;return Rf(e.dom,s,a).getClientRects()});return r.after?new es(o[r.i+1],-1):new es(o[r.i],1)}scanTile(e,n){if(!e.length)return new es(n,1);if(e.children.length==1){let a=e.children[0];if(a.isText())return this.scanText(a,n);if(a.isComposite())return this.scanTile(a,n)}let o=[n];for(let a=0,l=n;a<e.children.length;a++)o.push(l+=e.children[a].length);let r=this.scan(o,a=>{let l=e.children[a];return l.flags&48?null:(l.dom.nodeType==1?l.dom:Rf(l.dom,0,l.length)).getClientRects()}),i=e.children[r.i],s=o[r.i];return i.isText()?this.scanText(i,s):i.isComposite()?this.scanTile(i,s):r.after?new es(o[r.i+1],-1):new es(s,1)}}const Bd="";class I0e{constructor(e,n){this.points=e,this.view=n,this.text="",this.lineSeparator=n.state.facet(Jt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Bd}readRange(e,n){if(!e)return this;let o=e.parentNode;for(let r=e;;){this.findPointBefore(o,r);let i=this.text.length;this.readNode(r);let s=Fn.get(r),a=r.nextSibling;if(a==n){s!=null&&s.breakAfter&&!a&&o!=this.view.contentDOM&&this.lineBreak();break}let l=Fn.get(a);(s&&l?s.breakAfter:(s?s.breakAfter:V0(r))||V0(a)&&(r.nodeName!="BR"||s!=null&&s.isWidget())&&this.text.length>i)&&!R0e(a,n)&&this.lineBreak(),r=a}return this.findPointBefore(o,n),this}readTextNode(e){let n=e.nodeValue;for(let o of this.points)o.node==e&&(o.pos=this.text.length+Math.min(o.offset,n.length));for(let o=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,s=1,a;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,o),s=this.lineSeparator.length):(a=r.exec(n))&&(i=a.index,s=a[0].length),this.append(n.slice(o,i<0?n.length:i)),i<0)break;if(this.lineBreak(),s>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=s-1);o=i+s}}readNode(e){let n=Fn.get(e),o=n&&n.overrideDOMText;if(o!=null){this.findPointInside(e,o.length);for(let r=o.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let o of this.points)o.node==e&&e.childNodes[o.offset]==n&&(o.pos=this.text.length)}findPointInside(e,n){for(let o of this.points)(e.nodeType==3?o.node==e:e.contains(o.node))&&(o.pos=this.text.length+(N0e(e,o.node,o.offset)?n:0))}}function N0e(t,e,n){for(;;){if(!e||n<sa(e))return!1;if(e==t)return!0;n=Qa(e)+1,e=e.parentNode}}function R0e(t,e){let n;for(;!(t==e||!t);t=t.nextSibling){let o=Fn.get(t);if(!(o!=null&&o.isWidget()))return!1;o&&(n||(n=[])).push(o)}if(n)for(let o of n){let r=o.overrideDOMText;if(r!=null&&r.length)return!1}return!0}class tS{constructor(e,n){this.node=e,this.offset=n,this.pos=-1}}class F0e{constructor(e,n,o,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:i,impreciseAnchor:s}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=PM(e.docView.tile,n,o,0))){let a=i||s?[]:z0e(e),l=new I0e(a,e);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=H0e(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=i&&i.node==a.focusNode&&i.offset==a.focusOffset||!Qb(e.contentDOM,a.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=s&&s.node==a.anchorNode&&s.offset==a.anchorOffset||!Qb(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),u=e.viewport;if((it.ios||it.chrome)&&e.state.selection.main.empty&&l!=c&&(u.from>0||u.to<e.state.doc.length)){let d=Math.min(l,c),f=Math.max(l,c),h=u.from-d,m=u.to-f;(h==0||h==1||d==0)&&(m==0||m==-1||f==e.state.doc.length)&&(l=0,c=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Ye.range(c,l)):this.newSel=Ye.single(c,l)}}}function PM(t,e,n,o){if(t.isComposite()){let r=-1,i=-1,s=-1,a=-1;for(let l=0,c=o,u=o;l<t.children.length;l++){let d=t.children[l],f=c+d.length;if(c<e&&f>n)return PM(d,e,n,c);if(f>=e&&r==-1&&(r=l,i=c),c>n&&d.dom.parentNode==t.dom){s=l,a=u;break}u=f,c=f+d.breakAfter}return{from:i,to:a<0?o+t.length:a,startDOM:(r?t.children[r-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:s<t.children.length&&s>=0?t.children[s].dom:null}}else return t.isText()?{from:o,to:o+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function DM(t,e){let n,{newSel:o}=e,r=t.state.selection.main,i=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:s,to:a}=e.bounds,l=r.from,c=null;(i===8||it.android&&e.text.length<a-s)&&(l=r.to,c="end");let u=EM(t.state.doc.sliceString(s,a,Bd),e.text,l-s,c);u&&(it.chrome&&i==13&&u.toB==u.from+2&&e.text.slice(u.from,u.toB)==Bd+Bd&&u.toB--,n={from:s+u.from,to:s+u.toA,insert:qt.of(e.text.slice(u.from,u.toB).split(Bd))})}else o&&(!t.hasFocus&&t.state.facet(Us)||G0(o,r))&&(o=null);if(!n&&!o)return!1;if(!n&&e.typeOver&&!r.empty&&o&&o.main.empty?n={from:r.from,to:r.to,insert:t.state.doc.slice(r.from,r.to)}:(it.mac||it.android)&&n&&n.from==n.to&&n.from==r.head-1&&/^\. ?$/.test(n.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(o&&n.insert.length==2&&(o=Ye.single(o.main.anchor-1,o.main.head-1)),n={from:n.from,to:n.to,insert:qt.of([n.insert.toString().replace("."," ")])}):n&&n.from>=r.from&&n.to<=r.to&&(n.from!=r.from||n.to!=r.to)&&r.to-r.from-(n.to-n.from)<=4?n={from:r.from,to:r.to,insert:t.state.doc.slice(r.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,r.to))}:t.state.doc.lineAt(r.from).to<r.to&&t.docView.lineHasWidget(r.to)&&t.inputState.insertingTextAt>Date.now()-50?n={from:r.from,to:r.to,insert:t.state.toText(t.inputState.insertingText)}:it.chrome&&n&&n.from==n.to&&n.from==r.head&&n.insert.toString()==`
|
|
925
925
|
`&&t.lineWrapping&&(o&&(o=Ye.single(o.main.anchor-1,o.main.head-1)),n={from:r.from,to:r.to,insert:qt.of([" "])}),n)return Rx(t,n,o,i);if(o&&!G0(o,r)){let s=!1,a="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(s=!0),a=t.inputState.lastSelectionOrigin,a=="select.pointer"&&(o=LM(t.state.facet(sh).map(l=>l(t)),o))),t.dispatch({selection:o,scrollIntoView:s,userEvent:a}),!0}else return!1}function Rx(t,e,n,o=-1){if(it.ios&&t.inputState.flushIOSKey(e))return!0;let r=t.state.selection.main;if(it.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&t.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&ru(t.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||o==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&ru(t.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&ru(t.contentDOM,"Delete",46)))return!0;let i=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let s,a=()=>s||(s=V0e(t,e,n));return t.state.facet(xM).some(l=>l(t,e.from,e.to,i,a))||t.dispatch(a()),!0}function V0e(t,e,n){let o,r=t.state,i=r.selection.main,s=-1;if(e.from==e.to&&e.from<i.from||e.from>i.to){let l=e.from<i.from?-1:1,c=l<0?i.from:i.to,u=Jd(r.facet(sh).map(d=>d(t)),c,l);e.from==u&&(s=u)}if(s>-1)o={changes:e,selection:Ye.cursor(e.from+e.insert.length,-1)};else if(e.from>=i.from&&e.to<=i.to&&e.to-e.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let l=i.from<e.from?r.sliceDoc(i.from,e.from):"",c=i.to>e.to?r.sliceDoc(e.to,i.to):"";o=r.replaceSelection(t.state.toText(l+e.insert.sliceString(0,void 0,t.state.lineBreak)+c))}else{let l=r.changes(e),c=n&&n.main.to<=l.newLength?n.main:void 0;if(r.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=i.to+10&&e.to>=i.to-10){let u=t.state.sliceDoc(e.from,e.to),d,f=n&&BM(t,n.main.head);if(f){let m=e.insert.length-(e.to-e.from);d={from:f.from,to:f.to-m}}else d=t.state.doc.lineAt(i.head);let h=i.to-e.to;o=r.changeByRange(m=>{if(m.from==i.from&&m.to==i.to)return{changes:l,range:c||m.map(l)};let b=m.to-h,g=b-u.length;if(t.state.sliceDoc(g,b)!=u||b>=d.from&&g<=d.to)return{range:m};let v=r.changes({from:g,to:b,insert:e.insert}),y=m.to-i.to;return{changes:v,range:c?Ye.range(Math.max(0,c.anchor+y),Math.max(0,c.head+y)):m.map(v)}})}else o={changes:l,selection:c&&r.selection.replaceRange(c)}}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)),r.update(o,{userEvent:a,scrollIntoView:!0})}function EM(t,e,n,o){let r=Math.min(t.length,e.length),i=0;for(;i<r&&t.charCodeAt(i)==e.charCodeAt(i);)i++;if(i==r&&t.length==e.length)return null;let s=t.length,a=e.length;for(;s>0&&a>0&&t.charCodeAt(s-1)==e.charCodeAt(a-1);)s--,a--;if(o=="end"){let l=Math.max(0,i-Math.min(s,a));n-=s+l-i}if(s<i&&t.length<e.length){let l=n<=i&&n>=s?i-n:0;i-=l,a=i+(a-s),s=i}else if(a<i){let l=n<=i&&n>=a?i-n:0;i-=l,s=i+(s-a),a=i}return{from:i,toA:s,toB:a}}function z0e(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:o,focusNode:r,focusOffset:i}=t.observer.selectionRange;return n&&(e.push(new tS(n,o)),(r!=n||i!=o)&&e.push(new tS(r,i))),e}function H0e(t,e){if(t.length==0)return null;let n=t[0].pos,o=t.length==2?t[1].pos:n;return n>-1&&o>-1?Ye.single(n+e,o+e):null}function G0(t,e){return e.head==t.main.head&&e.anchor==t.main.anchor}class W0e{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,it.safari&&e.contentDOM.addEventListener("input",()=>null),it.gecko&&rme(e.contentDOM.ownerDocument)}handleEvent(e){!Z0e(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 o=this.handlers[e];if(o){for(let r of o.observers)r(this.view,n);for(let r of o.handlers){if(n.defaultPrevented)break;if(r(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=U0e(e),o=this.handlers,r=this.view.contentDOM;for(let i in n)if(i!="scroll"){let s=!n[i].handlers.length,a=o[i];a&&s!=!a.handlers.length&&(r.removeEventListener(i,this.handleEvent),a=null),a||r.addEventListener(i,this.handleEvent,{passive:s})}for(let i in o)i!="scroll"&&!n[i]&&r.removeEventListener(i,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&&NM.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),it.android&&it.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return it.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=IM.find(o=>o.keyCode==e.keyCode))&&!e.ctrlKey||G0e.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.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,ru(this.view.contentDOM,n.key,n.keyCode,n instanceof KeyboardEvent?n:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:it.safari&&!it.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 nS(t,e){return(n,o)=>{try{return e.call(t,o,n)}catch(r){rs(n.state,r)}}}function U0e(t){let e=Object.create(null);function n(o){return e[o]||(e[o]={observers:[],handlers:[]})}for(let o of t){let r=o.spec,i=r&&r.plugin.domEventHandlers,s=r&&r.plugin.domEventObservers;if(i)for(let a in i){let l=i[a];l&&n(a).handlers.push(nS(o.value,l))}if(s)for(let a in s){let l=s[a];l&&n(a).observers.push(nS(o.value,l))}}for(let o in Ii)n(o).handlers.push(Ii[o]);for(let o in ei)n(o).observers.push(ei[o]);return e}const IM=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],G0e="dthko",NM=[16,17,18,20,91,92,224,225],jh=6;function Kh(t){return Math.max(0,t)*.7+8}function q0e(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class Y0e{constructor(e,n,o,r){this.view=e,this.startEvent=n,this.style=o,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=Ype(e.contentDOM),this.atoms=e.state.facet(sh).map(s=>s(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(Jt.allowMultipleSelections)&&j0e(e,n),this.dragging=X0e(e,n)&&VM(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&&q0e(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,o=0,r=0,i=0,s=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:s}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:a}=this.scrollParents.y.getBoundingClientRect());let l=OM(this.view);e.clientX-l.left<=r+jh?n=-Kh(r-e.clientX):e.clientX+l.right>=s-jh&&(n=Kh(e.clientX-s)),e.clientY-l.top<=i+jh?o=-Kh(i-e.clientY):e.clientY+l.bottom>=a-jh&&(o=Kh(e.clientY-a)),this.setScrollSpeed(n,o)}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,o=LM(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!o.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:o,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 j0e(t,e){let n=t.state.facet(gM);return n.length?n[0](e):it.mac?e.metaKey:e.ctrlKey}function K0e(t,e){let n=t.state.facet(vM);return n.length?n[0](e):it.mac?!e.altKey:!e.ctrlKey}function X0e(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let o=Nf(t.root);if(!o||o.rangeCount==0)return!0;let r=o.getRangeAt(0).getClientRects();for(let i=0;i<r.length;i++){let s=r[i];if(s.left<=e.clientX&&s.right>=e.clientX&&s.top<=e.clientY&&s.bottom>=e.clientY)return!0}return!1}function Z0e(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,o;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(o=Fn.get(n))&&o.isWidget()&&!o.isHidden&&o.widget.ignoreEvent(e))return!1;return!0}const Ii=Object.create(null),ei=Object.create(null),RM=it.ie&&it.ie_version<15||it.ios&&it.webkit_version<604;function Q0e(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(),FM(t,n.value)},50)}function Gg(t,e,n){for(let o of t.facet(e))n=o(n,t);return n}function FM(t,e){e=Gg(t.state,Dx,e);let{state:n}=t,o,r=1,i=n.toText(e),s=i.lines==n.selection.ranges.length;if(iy!=null&&n.selection.ranges.every(l=>l.empty)&&iy==i.toString()){let l=-1;o=n.changeByRange(c=>{let u=n.doc.lineAt(c.from);if(u.from==l)return{range:c};l=u.from;let d=n.toText((s?i.line(r++).text:e)+n.lineBreak);return{changes:{from:u.from,insert:d},range:Ye.cursor(c.from+d.length)}})}else s?o=n.changeByRange(l=>{let c=i.line(r++);return{changes:{from:l.from,to:l.to,insert:c.text},range:Ye.cursor(l.from+c.length)}}):o=n.replaceSelection(i);t.dispatch(o,{userEvent:"input.paste",scrollIntoView:!0})}ei.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};Ii.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);ei.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};ei.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};Ii.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let o of t.state.facet(bM))if(n=o(t,e),n)break;if(!n&&e.button==0&&(n=eme(t,e)),n){let o=!t.hasFocus;t.inputState.startMouseSelection(new Y0e(t,e,n,o)),o&&t.observer.ignore(()=>{aM(t.contentDOM);let i=t.root.activeElement;i&&!i.contains(t.contentDOM)&&i.blur()});let r=t.inputState.mouseSelection;if(r)return r.start(e),r.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function oS(t,e,n,o){if(o==1)return Ye.cursor(e,n);if(o==2)return O0e(t.state,e,n);{let r=t.docView.lineAt(e,n),i=t.state.doc.lineAt(r?r.posAtEnd:e),s=r?r.posAtStart:i.from,a=r?r.posAtEnd:i.to;return a<t.state.doc.length&&a==i.to&&a++,Ye.range(s,a)}}const J0e=it.ie&&it.ie_version<=11;let rS=null,iS=0,sS=0;function VM(t){if(!J0e)return t.detail;let e=rS,n=sS;return rS=t,sS=Date.now(),iS=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(iS+1)%3:1}function eme(t,e){let n=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),o=VM(e),r=t.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),r=r.map(i.changes))},get(i,s,a){let l=t.posAndSideAtCoords({x:i.clientX,y:i.clientY},!1),c,u=oS(t,l.pos,l.assoc,o);if(n.pos!=l.pos&&!s){let d=oS(t,n.pos,n.assoc,o),f=Math.min(d.from,u.from),h=Math.max(d.to,u.to);u=f<u.from?Ye.range(f,h):Ye.range(h,f)}return s?r.replaceRange(r.main.extend(u.from,u.to)):a&&o==1&&r.ranges.length>1&&(c=tme(r,l.pos))?c:a?r.addRange(u):Ye.create([u])}}}function tme(t,e){for(let n=0;n<t.ranges.length;n++){let{from:o,to:r}=t.ranges[n];if(o<=e&&r>=e)return Ye.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}Ii.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let r=t.docView.tile.nearest(e.target);if(r&&r.isWidget()){let i=r.posAtStart,s=i+r.length;(i>=n.to||s<=n.from)&&(n=Ye.range(i,s))}}let{inputState:o}=t;return o.mouseSelection&&(o.mouseSelection.dragging=!0),o.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",Gg(t.state,Ex,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Ii.dragend=t=>(t.inputState.draggedContent=null,!1);function aS(t,e,n,o){if(n=Gg(t.state,Dx,n),!n)return;let r=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:i}=t.inputState,s=o&&i&&K0e(t,e)?{from:i.from,to:i.to}:null,a={from:r,insert:n},l=t.state.changes(s?[s,a]:a);t.focus(),t.dispatch({changes:l,selection:{anchor:l.mapPos(r,-1),head:l.mapPos(r,1)},userEvent:s?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Ii.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let o=Array(n.length),r=0,i=()=>{++r==n.length&&aS(t,e,o.filter(s=>s!=null).join(t.state.lineBreak),!1)};for(let s=0;s<n.length;s++){let a=new FileReader;a.onerror=i,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(o[s]=a.result),i()},a.readAsText(n[s])}return!0}else{let o=e.dataTransfer.getData("Text");if(o)return aS(t,e,o,!0),!0}return!1};Ii.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=RM?null:e.clipboardData;return n?(FM(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(Q0e(t),!1)};function nme(t,e){let n=t.dom.parentNode;if(!n)return;let o=n.appendChild(document.createElement("textarea"));o.style.cssText="position: fixed; left: -10000px; top: 10px",o.value=e,o.focus(),o.selectionEnd=e.length,o.selectionStart=0,setTimeout(()=>{o.remove(),t.focus()},50)}function ome(t){let e=[],n=[],o=!1;for(let r of t.selection.ranges)r.empty||(e.push(t.sliceDoc(r.from,r.to)),n.push(r));if(!e.length){let r=-1;for(let{from:i}of t.selection.ranges){let s=t.doc.lineAt(i);s.number>r&&(e.push(s.text),n.push({from:s.from,to:Math.min(t.doc.length,s.to+1)})),r=s.number}o=!0}return{text:Gg(t,Ex,e.join(t.lineBreak)),ranges:n,linewise:o}}let iy=null;Ii.copy=Ii.cut=(t,e)=>{if(!Zd(t.contentDOM,t.observer.selectionRange))return!1;let{text:n,ranges:o,linewise:r}=ome(t.state);if(!n&&!r)return!1;iy=r?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:o,scrollIntoView:!0,userEvent:"delete.cut"});let i=RM?null:e.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(nme(t,n),!1)};const zM=pl.define();function HM(t,e){let n=[];for(let o of t.facet(wM)){let r=o(t,e);r&&n.push(r)}return n.length?t.update({effects:n,annotations:zM.of(!0)}):null}function WM(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=HM(t.state,e);n?t.dispatch(n):t.update([])}},10)}ei.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),WM(t)};ei.blur=t=>{t.observer.clearSelectionRange(),WM(t)};ei.compositionstart=ei.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};ei.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,it.chrome&&it.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};ei.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};Ii.beforeinput=(t,e)=>{var n,o;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let i=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),s=e.getTargetRanges();if(i&&s.length){let a=s[0],l=t.posAtDOM(a.startContainer,a.startOffset),c=t.posAtDOM(a.endContainer,a.endOffset);return Rx(t,{from:l,to:c,insert:t.state.toText(i)},null),!0}}let r;if(it.chrome&&it.android&&(r=IM.find(i=>i.inputType==e.inputType))&&(t.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let i=((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0;setTimeout(()=>{var s;(((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0)>i+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return it.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),it.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>ei.compositionend(t,e),20),!1};const lS=new Set;function rme(t){lS.has(t)||(lS.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const cS=["pre-wrap","normal","pre-line","break-spaces"];let Ou=!1;function uS(){Ou=!1}class ime{constructor(e){this.lineWrapping=e,this.doc=qt.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let o=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(o+=Math.max(0,Math.ceil((n-e-o*this.lineLength*.5)/this.lineLength))),this.lineHeight*o}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 cS.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let o=0;o<e.length;o++){let r=e[o];r<0?o++:this.heightSamples[Math.floor(r*10)]||(n=!0,this.heightSamples[Math.floor(r*10)]=!0)}return n}refresh(e,n,o,r,i,s){let a=cS.indexOf(e)>-1,l=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=a||Math.abs(o-this.charWidth)>.1;if(this.lineWrapping=a,this.lineHeight=n,this.charWidth=o,this.textHeight=r,this.lineLength=i,l){this.heightSamples={};for(let c=0;c<s.length;c++){let u=s[c];u<0?c++:this.heightSamples[Math.floor(u*10)]=!0}}return l}}class sme{constructor(e,n){this.from=e,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class hi{constructor(e,n,o,r,i){this.from=e,this.length=n,this.top=o,this.height=r,this._content=i}get type(){return typeof this._content=="number"?Xr.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof nc?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new hi(this.from,this.length+e.length,this.top,this.height+e.height,n)}}var hn=(function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t})(hn||(hn={}));const Tp=.001;class jo{constructor(e,n,o=2){this.length=e,this.height=n,this.flags=o}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Tp&&(Ou=!0),this.height=e)}replace(e,n,o){return jo.of(o)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,o,r){let i=this,s=o.doc;for(let a=r.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:u,toB:d}=r[a],f=i.lineAt(l,hn.ByPosNoHeight,o.setDoc(n),0,0),h=f.to>=c?f:i.lineAt(c,hn.ByPosNoHeight,o,0,0);for(d+=h.to-c,c=h.to;a>0&&f.from<=r[a-1].toA;)l=r[a-1].fromA,u=r[a-1].fromB,a--,l<f.from&&(f=i.lineAt(l,hn.ByPosNoHeight,o,0,0));u+=f.from-l,l=f.from;let m=Fx.build(o.setDoc(s),e,u,d);i=q0(i,i.replace(l,c,m))}return i.updateHeight(o,0)}static empty(){return new xr(0,0,0)}static of(e){if(e.length==1)return e[0];let n=0,o=e.length,r=0,i=0;for(;;)if(n==o)if(r>i*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),o+=1+a.break,r-=a.size}else if(i>r*2){let a=e[o];a.break?e.splice(o,1,a.left,null,a.right):e.splice(o,1,a.left,a.right),o+=2+a.break,i-=a.size}else break;else if(r<i){let a=e[n++];a&&(r+=a.size)}else{let a=e[--o];a&&(i+=a.size)}let s=0;return e[n-1]==null?(s=1,n--):e[n]==null&&(s=1,o++),new lme(jo.of(e.slice(0,n)),s,jo.of(e.slice(o)))}}function q0(t,e){return t==e?t:(t.constructor!=e.constructor&&(Ou=!0),e)}jo.prototype.size=1;const ame=no.replace({});class UM extends jo{constructor(e,n,o){super(e,n),this.deco=o,this.spaceAbove=0}mainBlock(e,n){return new hi(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,n,o,r){return this.spaceAbove&&e<o+this.spaceAbove?new hi(r,0,o,this.spaceAbove,ame):this.mainBlock(o,r)}lineAt(e,n,o,r,i){let s=this.mainBlock(r,i);return this.spaceAbove?this.blockAt(0,o,r,i).join(s):s}forEachLine(e,n,o,r,i,s){e<=i+this.length&&n>=i&&s(this.lineAt(0,hn.ByPos,o,r,i))}setMeasuredHeight(e){let n=e.heights[e.index++];n<0?(this.spaceAbove=-n,n=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(e,n=0,o=!1,r){return r&&r.from<=n&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}}class xr extends UM{constructor(e,n,o){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=o}mainBlock(e,n){return new hi(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,n,o){let r=o[0];return o.length==1&&(r instanceof xr||r instanceof ao&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof ao?r=new xr(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):jo.of(o)}updateHeight(e,n=0,o=!1,r){return r&&r.from<=n&&r.more?this.setMeasuredHeight(r):(o||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class ao extends jo{constructor(e){super(e,0)}heightMetrics(e,n){let o=e.doc.lineAt(n).number,r=e.doc.lineAt(n+this.length).number,i=r-o+1,s,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*i);s=l/i,this.length>i+1&&(a=(this.height-l)/(this.length-i-1))}else s=this.height/i;return{firstLine:o,lastLine:r,perLine:s,perChar:a}}blockAt(e,n,o,r){let{firstLine:i,lastLine:s,perLine:a,perChar:l}=this.heightMetrics(n,r);if(n.lineWrapping){let c=r+(e<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-o)/this.height))*this.length)),u=n.doc.lineAt(c),d=a+u.length*l,f=Math.max(o,e-d/2);return new hi(u.from,u.length,f,d,0)}else{let c=Math.max(0,Math.min(s-i,Math.floor((e-o)/a))),{from:u,length:d}=n.doc.line(i+c);return new hi(u,d,o+a*c,a,0)}}lineAt(e,n,o,r,i){if(n==hn.ByHeight)return this.blockAt(e,o,r,i);if(n==hn.ByPosNoHeight){let{from:h,to:m}=o.doc.lineAt(e);return new hi(h,m-h,0,0,0)}let{firstLine:s,perLine:a,perChar:l}=this.heightMetrics(o,i),c=o.doc.lineAt(e),u=a+c.length*l,d=c.number-s,f=r+a*d+l*(c.from-i-d);return new hi(c.from,c.length,Math.max(r,Math.min(f,r+this.height-u)),u,0)}forEachLine(e,n,o,r,i,s){e=Math.max(e,i),n=Math.min(n,i+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(o,i);for(let u=e,d=r;u<=n;){let f=o.doc.lineAt(u);if(u==e){let m=f.number-a;d+=l*m+c*(e-i-m)}let h=l+c*f.length;s(new hi(f.from,f.length,d,h,0)),d+=h,u=f.to+1}}replace(e,n,o){let r=this.length-n;if(r>0){let i=o[o.length-1];i instanceof ao?o[o.length-1]=new ao(i.length+r):o.push(null,new ao(r-1))}if(e>0){let i=o[0];i instanceof ao?o[0]=new ao(e+i.length):o.unshift(new ao(e-1),null)}return jo.of(o)}decomposeLeft(e,n){n.push(new ao(e-1),null)}decomposeRight(e,n){n.push(null,new ao(this.length-e-1))}updateHeight(e,n=0,o=!1,r){let i=n+this.length;if(r&&r.from<=n+this.length&&r.more){let s=[],a=Math.max(n,r.from),l=-1;for(r.from>n&&s.push(new ao(r.from-n-1).updateHeight(e,n));a<=i&&r.more;){let u=e.doc.lineAt(a).length;s.length&&s.push(null);let d=r.heights[r.index++],f=0;d<0&&(f=-d,d=r.heights[r.index++]),l==-1?l=d:Math.abs(d-l)>=Tp&&(l=-2);let h=new xr(u,d,f);h.outdated=!1,s.push(h),a+=u+1}a<=i&&s.push(null,new ao(i-a).updateHeight(e,a));let c=jo.of(s);return(l<0||Math.abs(c.height-this.height)>=Tp||Math.abs(l-this.heightMetrics(e,n).perLine)>=Tp)&&(Ou=!0),q0(this,c)}else(o||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class lme extends jo{constructor(e,n,o){super(e.length+n+o.length,e.height+o.height,n|(e.outdated||o.outdated?2:0)),this.left=e,this.right=o,this.size=e.size+o.size}get break(){return this.flags&1}blockAt(e,n,o,r){let i=o+this.left.height;return e<i?this.left.blockAt(e,n,o,r):this.right.blockAt(e,n,i,r+this.left.length+this.break)}lineAt(e,n,o,r,i){let s=r+this.left.height,a=i+this.left.length+this.break,l=n==hn.ByHeight?e<s:e<a,c=l?this.left.lineAt(e,n,o,r,i):this.right.lineAt(e,n,o,s,a);if(this.break||(l?c.to<a:c.from>a))return c;let u=n==hn.ByPosNoHeight?hn.ByPosNoHeight:hn.ByPos;return l?c.join(this.right.lineAt(a,u,o,s,a)):this.left.lineAt(a,u,o,r,i).join(c)}forEachLine(e,n,o,r,i,s){let a=r+this.left.height,l=i+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,n,o,r,i,s),n>=l&&this.right.forEachLine(e,n,o,a,l,s);else{let c=this.lineAt(l,hn.ByPos,o,r,i);e<c.from&&this.left.forEachLine(e,c.from-1,o,r,i,s),c.to>=e&&c.from<=n&&s(c),n>c.to&&this.right.forEachLine(c.to+1,n,o,a,l,s)}}replace(e,n,o){let r=this.left.length+this.break;if(n<r)return this.balanced(this.left.replace(e,n,o),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,n-r,o));let i=[];e>0&&this.decomposeLeft(e,i);let s=i.length;for(let a of o)i.push(a);if(e>0&&dS(i,s-1),n<this.length){let a=i.length;this.decomposeRight(n,i),dS(i,a)}return jo.of(i)}decomposeLeft(e,n){let o=this.left.length;if(e<=o)return this.left.decomposeLeft(e,n);n.push(this.left),this.break&&(o++,e>=o&&n.push(null)),e>o&&this.right.decomposeLeft(e-o,n)}decomposeRight(e,n){let o=this.left.length,r=o+this.break;if(e>=r)return this.right.decomposeRight(e-r,n);e<o&&this.left.decomposeRight(e,n),this.break&&e<r&&n.push(null),n.push(this.right)}balanced(e,n){return e.size>2*n.size||n.size>2*e.size?jo.of(this.break?[e,null,n]:[e,n]):(this.left=q0(this.left,e),this.right=q0(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,o=!1,r){let{left:i,right:s}=this,a=n+i.length+this.break,l=null;return r&&r.from<=n+i.length&&r.more?l=i=i.updateHeight(e,n,o,r):i.updateHeight(e,n,o),r&&r.from<=a+s.length&&r.more?l=s=s.updateHeight(e,a,o,r):s.updateHeight(e,a,o),l?this.balanced(i,s):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function dS(t,e){let n,o;t[e]==null&&(n=t[e-1])instanceof ao&&(o=t[e+1])instanceof ao&&t.splice(e-1,3,new ao(n.length+1+o.length))}const cme=5;class Fx{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 o=Math.min(n,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof xr?r.length+=o-this.pos:(o>this.pos||!this.isCovered)&&this.nodes.push(new xr(o-this.pos,-1,0)),this.writtenTo=o,n>o&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,o){if(e<n||o.heightRelevant){let r=o.widget?o.widget.estimatedHeight:0,i=o.widget?o.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let s=n-e;o.block?this.addBlock(new UM(s,r,o)):(s||i||r>=cme)&&this.addLineDeco(r,i,s)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new xr(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,n){let o=new ao(n-e);return this.oracle.doc.lineAt(e).to==n&&(o.flags|=4),o}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof xr)return e;let n=new xr(0,-1,0);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,o){let r=this.ensureLine();r.length+=o,r.collapsed+=o,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=n,this.writtenTo=this.pos=this.pos+o}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof xr)&&!this.isCovered?this.nodes.push(new xr(0,-1,0)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let o=e;for(let r of this.nodes)r instanceof xr&&r.updateHeight(this.oracle,o),o+=r?r.length:1;return this.nodes}static build(e,n,o,r){let i=new Fx(o,e);return nn.spans(n,o,r,i,0),i.finish(o)}}function ume(t,e,n){let o=new dme;return nn.compare(t,e,n,o,0),o.changes}class dme{constructor(){this.changes=[]}compareRange(){}comparePoint(e,n,o,r){(e<n||o&&o.heightRelevant||r&&r.heightRelevant)&&ou(e,n,this.changes,5)}}function fme(t,e){let n=t.getBoundingClientRect(),o=t.ownerDocument,r=o.defaultView||window,i=Math.max(0,n.left),s=Math.min(r.innerWidth,n.right),a=Math.max(0,n.top),l=Math.min(r.innerHeight,n.bottom);for(let c=t.parentNode;c&&c!=o.body;)if(c.nodeType==1){let u=c,d=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&d.overflow!="visible"){let f=u.getBoundingClientRect();i=Math.max(i,f.left),s=Math.min(s,f.right),a=Math.max(a,f.top),l=Math.min(c==t.parentNode?r.innerHeight:l,f.bottom)}c=d.position=="absolute"||d.position=="fixed"?u.offsetParent:u.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:i-n.left,right:Math.max(i,s)-n.left,top:a-(n.top+e),bottom:Math.max(a,l)-(n.top+e)}}function hme(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left<n.innerWidth&&e.right>0&&e.top<n.innerHeight&&e.bottom>0}function pme(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class d1{constructor(e,n,o,r){this.from=e,this.to=n,this.size=o,this.displaySize=r}static same(e,n){if(e.length!=n.length)return!1;for(let o=0;o<e.length;o++){let r=e[o],i=n[o];if(r.from!=i.from||r.to!=i.to||r.size!=i.size)return!1}return!0}draw(e,n){return no.replace({widget:new mme(this.displaySize*(n?e.scaleY:e.scaleX),n)}).range(this.from,this.to)}}class mme extends zg{constructor(e,n){super(),this.size=e,this.vertical=n}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class fS{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=hS,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Nn.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=e.facet(Ix).some(o=>typeof o!="function"&&o.class=="cm-lineWrapping");this.heightOracle=new ime(n),this.stateDeco=pS(e),this.heightMap=jo.empty().applyChanges(this.stateDeco,qt.empty,this.heightOracle.setDoc(e.doc),[new Ur(0,0,0,e.doc.length)]);for(let o=0;o<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());o++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=no.set(this.lineGaps.map(o=>o.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let o=0;o<=1;o++){let r=o?n.head:n.anchor;if(!e.some(({from:i,to:s})=>r>=i&&r<=s)){let{from:i,to:s}=this.lineBlockAt(r);e.push(new Xh(i,s))}}return this.viewports=e.sort((o,r)=>o.from-r.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?hS:new Vx(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(Ld(e,this.scaler))})}update(e,n=null){this.state=e.state;let o=this.stateDeco;this.stateDeco=pS(this.state);let r=e.changedRanges,i=Ur.extendWithRanges(r,ume(o,this.stateDeco,e?e.changes:Kn.empty(this.state.doc.length))),s=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);uS(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=s||Ou)&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=s);let l=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.head<l.from||n.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,n));let c=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(c||!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.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(s0e)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,o=window.getComputedStyle(n),r=this.heightOracle,i=o.whiteSpace;this.defaultTextDirection=o.direction=="rtl"?Nn.RTL:Nn.LTR;let s=this.heightOracle.mustRefreshForWrapping(i)||this.mustMeasureContent==="refresh",a=n.getBoundingClientRect(),l=s||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let c=0,u=0;if(a.width&&a.height){let{scaleX:_,scaleY:C}=sM(n,a);(_>.005&&Math.abs(this.scaleX-_)>.005||C>.005&&Math.abs(this.scaleY-C)>.005)&&(this.scaleX=_,this.scaleY=C,c|=16,s=l=!0)}let d=(parseInt(o.paddingTop)||0)*this.scaleY,f=(parseInt(o.paddingBottom)||0)*this.scaleY;(this.paddingTop!=d||this.paddingBottom!=f)&&(this.paddingTop=d,this.paddingBottom=f,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let h=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=h&&(this.scrollAnchorHeight=-1,this.scrollTop=h),this.scrolledToBottom=lM(e.scrollDOM);let m=(this.printing?pme:fme)(n,this.paddingTop),b=m.top-this.pixelViewport.top,g=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let v=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(v!=this.inView&&(this.inView=v,v&&(l=!0)),!this.inView&&!this.scrollTarget&&!hme(e.dom))return 0;let y=a.width;if((this.contentDOMWidth!=y||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),l){let _=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(_)&&(s=!0),s||r.lineWrapping&&Math.abs(y-this.contentDOMWidth)>r.charWidth){let{lineHeight:C,charWidth:D,textHeight:M}=e.docView.measureTextSize();s=C>0&&r.refresh(i,C,D,M,Math.max(5,y/D),_),s&&(e.docView.minWidth=0,c|=16)}b>0&&g>0?u=Math.max(b,g):b<0&&g<0&&(u=Math.min(b,g)),uS();for(let C of this.viewports){let D=C.from==this.viewport.from?_:e.docView.measureVisibleLineHeights(C);this.heightMap=(s?jo.empty().applyChanges(this.stateDeco,qt.empty,this.heightOracle,[new Ur(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,s,new sme(C.from,D))}Ou&&(c|=2)}let x=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return x&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(u,this.scrollTarget),c|=this.updateForViewport()),(c&2||x)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let o=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,i=this.heightOracle,{visibleTop:s,visibleBottom:a}=this,l=new Xh(r.lineAt(s-o*1e3,hn.ByHeight,i,0,0).from,r.lineAt(a+(1-o)*1e3,hn.ByHeight,i,0,0).to);if(n){let{head:c}=n.range;if(c<l.from||c>l.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),d=r.lineAt(c,hn.ByPos,i,0,0),f;n.y=="center"?f=(d.top+d.bottom)/2-u/2:n.y=="start"||n.y=="nearest"&&c<l.from?f=d.top:f=d.bottom-u,l=new Xh(r.lineAt(f-1e3/2,hn.ByHeight,i,0,0).from,r.lineAt(f+u+1e3/2,hn.ByHeight,i,0,0).to)}}return l}mapViewport(e,n){let o=n.mapPos(e.from,-1),r=n.mapPos(e.to,1);return new Xh(this.heightMap.lineAt(o,hn.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,hn.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:n},o=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,hn.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(n,hn.ByPos,this.heightOracle,0,0),{visibleTop:s,visibleBottom:a}=this;return(e==0||r<=s-Math.max(10,Math.min(-o,250)))&&(n==this.state.doc.length||i>=a+Math.max(10,Math.min(o,250)))&&r>s-2*1e3&&i<a+2*1e3}mapLineGaps(e,n){if(!e.length||n.empty)return e;let o=[];for(let r of e)n.touchesRange(r.from,r.to)||o.push(new d1(n.mapPos(r.from),n.mapPos(r.to),r.size,r.displaySize));return o}ensureLineGaps(e,n){let o=this.heightOracle.lineWrapping,r=o?1e4:2e3,i=r>>1,s=r<<1;if(this.defaultTextDirection!=Nn.LTR&&!o)return[];let a=[],l=(u,d,f,h)=>{if(d-u<i)return;let m=this.state.selection.main,b=[m.from];m.empty||b.push(m.to);for(let v of b)if(v>u&&v<d){l(u,v-10,f,h),l(v+10,d,f,h);return}let g=vme(e,v=>v.from>=f.from&&v.to<=f.to&&Math.abs(v.from-u)<i&&Math.abs(v.to-d)<i&&!b.some(y=>v.from<y&&v.to>y));if(!g){if(d<f.to&&n&&o&&n.visibleRanges.some(x=>x.from<=d&&x.to>=d)){let x=n.moveToLineBoundary(Ye.cursor(d),!1,!0).head;x>u&&(d=x)}let v=this.gapSize(f,u,d,h),y=o||v<2e6?v:2e6;g=new d1(u,d,v,y)}a.push(g)},c=u=>{if(u.length<s||u.type!=Xr.Text)return;let d=gme(u.from,u.to,this.stateDeco);if(d.total<s)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,h,m;if(o){let b=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,g,v;if(f!=null){let y=Qh(d,f),x=((this.visibleBottom-this.visibleTop)/2+b)/u.height;g=y-x,v=y+x}else g=(this.visibleTop-u.top-b)/u.height,v=(this.visibleBottom-u.top+b)/u.height;h=Zh(d,g),m=Zh(d,v)}else{let b=d.total*this.heightOracle.charWidth,g=r*this.heightOracle.charWidth,v=0;if(b>2e6)for(let D of e)D.from>=u.from&&D.from<u.to&&D.size!=D.displaySize&&D.from*this.heightOracle.charWidth+v<this.pixelViewport.left&&(v=D.size-D.displaySize);let y=this.pixelViewport.left+v,x=this.pixelViewport.right+v,_,C;if(f!=null){let D=Qh(d,f),M=((x-y)/2+g)/b;_=D-M,C=D+M}else _=(y-g)/b,C=(x+g)/b;h=Zh(d,_),m=Zh(d,C)}h>u.from&&l(u.from,h,u,d),m<u.to&&l(m,u.to,u,d)};for(let u of this.viewportLines)Array.isArray(u.type)?u.type.forEach(c):c(u);return a}gapSize(e,n,o,r){let i=Qh(r,o)-Qh(r,n);return this.heightOracle.lineWrapping?e.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(e){d1.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=no.set(e.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let o=[];nn.spans(n,this.viewport.from,this.viewport.to,{span(i,s){o.push({from:i,to:s})},point(){}},20);let r=0;if(o.length!=this.visibleRanges.length)r=12;else for(let i=0;i<o.length&&!(r&8);i++){let s=this.visibleRanges[i],a=o[i];(s.from!=a.from||s.to!=a.to)&&(r|=4,e&&e.mapPos(s.from,-1)==a.from&&e.mapPos(s.to,1)==a.to||(r|=8))}return this.visibleRanges=o,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||Ld(this.heightMap.lineAt(e,hn.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)||Ld(this.heightMap.lineAt(this.scaler.fromDOM(e),hn.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 Ld(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 Xh{constructor(e,n){this.from=e,this.to=n}}function gme(t,e,n){let o=[],r=t,i=0;return nn.spans(n,t,e,{span(){},point(s,a){s>r&&(o.push({from:r,to:s}),i+=s-r),r=a}},20),r<e&&(o.push({from:r,to:e}),i+=e-r),{total:i,ranges:o}}function Zh({total:t,ranges:e},n){if(n<=0)return e[0].from;if(n>=1)return e[e.length-1].to;let o=Math.floor(t*n);for(let r=0;;r++){let{from:i,to:s}=e[r],a=s-i;if(o<=a)return i+o;o-=a}}function Qh(t,e){let n=0;for(let{from:o,to:r}of t.ranges){if(e<=r){n+=e-o;break}n+=r-o}return n/t.total}function vme(t,e){for(let n of t)if(e(n))return n}const hS={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};function pS(t){let e=t.facet(Hg).filter(o=>typeof o!="function"),n=t.facet(Nx).filter(o=>typeof o!="function");return n.length&&e.push(nn.join(n)),e}class Vx{constructor(e,n,o){let r=0,i=0,s=0;this.viewports=o.map(({from:a,to:l})=>{let c=n.lineAt(a,hn.ByPos,e,0,0).top,u=n.lineAt(l,hn.ByPos,e,0,0).bottom;return r+=u-c,{from:a,to:l,top:c,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(n.height-r);for(let a of this.viewports)a.domTop=s+(a.top-i)*this.scale,s=a.domBottom=a.domTop+(a.bottom-a.top),i=a.bottom}toDOM(e){for(let n=0,o=0,r=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||e<i.top)return r+(e-o)*this.scale;if(e<=i.bottom)return i.domTop+(e-i.top);o=i.bottom,r=i.domBottom}}fromDOM(e){for(let n=0,o=0,r=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||e<i.domTop)return o+(e-r)/this.scale;if(e<=i.domBottom)return i.top+(e-i.domTop);o=i.bottom,r=i.domBottom}}eq(e){return e instanceof Vx?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((n,o)=>n.from==e.viewports[o].from&&n.to==e.viewports[o].to):!1}}function Ld(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),o=e.toDOM(t.bottom);return new hi(t.from,t.length,n,o-n,Array.isArray(t._content)?t._content.map(r=>Ld(r,e)):t._content)}const Jh=xt.define({combine:t=>t.join(" ")}),sy=xt.define({combine:t=>t.indexOf(!0)>-1}),ay=Xa.newName(),GM=Xa.newName(),qM=Xa.newName(),YM={"&light":"."+GM,"&dark":"."+qM};function ly(t,e,n){return new Xa(e,{finish(o){return/&/.test(o)?o.replace(/&\w*/,r=>{if(r=="&")return t;if(!n||!n[r])throw new RangeError(`Unsupported selector: ${r}`);return n[r]}):t+" "+o}})}const bme=ly("."+ay,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},YM),yme={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},f1=it.ie&&it.ie_version<=11;class xme{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new jpe,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 o of n)this.queue.push(o);(it.ie&&it.ie_version<=11||it.ios&&e.composing)&&n.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&it.android&&e.constructor.EDIT_CONTEXT!==!1&&!(it.chrome&&it.chrome_version<126)&&(this.editContext=new _me(e),e.state.facet(Us)&&(e.contentDOM.editContext=this.editContext.editContext)),f1&&(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)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(n=>{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,o)=>n!=e[o]))){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:o}=this,r=this.selectionRange;if(o.state.facet(Us)?o.root.activeElement!=this.dom:!Zd(this.dom,r))return;let i=r.anchorNode&&o.docView.tile.nearest(r.anchorNode);if(i&&i.isWidget()&&i.widget.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(it.ie&&it.ie_version<=11||it.android&&it.chrome)&&!o.state.selection.main.empty&&r.focusNode&&Qd(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=Nf(e.root);if(!n)return!1;let o=it.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&wme(this.view,n)||n;if(!o||this.selectionRange.eq(o))return!1;let r=Zd(this.dom,o);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Xpe(this.dom,o)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(o),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,n){this.selectionRange.set(e.node,e.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,n=null;for(let o=this.dom;o;)if(o.nodeType==1)!n&&e<this.scrollTargets.length&&this.scrollTargets[e]==o?e++:n||(n=this.scrollTargets.slice(0,e)),n&&n.push(o),o=o.assignedSlot||o.parentNode;else if(o.nodeType==11)o=o.host;else break;if(e<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,e)),n){for(let o of this.scrollTargets)o.removeEventListener("scroll",this.onScroll);for(let o of this.scrollTargets=n)o.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,yme),f1&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),f1&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,n){var o;if(!this.delayedAndroidKey){let r=()=>{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&ru(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange<Date.now()-50||!!(!((o=this.delayedAndroidKey)===null||o===void 0)&&o.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,o=-1,r=!1;for(let i of e){let s=this.readMutation(i);s&&(s.typeOver&&(r=!0),n==-1?{from:n,to:o}=s:(n=Math.min(s.from,n),o=Math.max(s.to,o)))}return{from:n,to:o,typeOver:r}}readChange(){let{from:e,to:n,typeOver:o}=this.processRecords(),r=this.selectionChanged&&Zd(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new F0e(this.view,e,n,o);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}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 o=this.view.state,r=DM(this.view,n);return this.view.state==o&&(n.domChanged||n.newSel&&!G0(this.view.state.selection,n.newSel.main))&&this.view.update([]),r}readMutation(e){let n=this.view.docView.tile.nearest(e.target);if(!n||n.isWidget())return null;if(n.markDirty(e.type=="attributes"),e.type=="childList"){let o=mS(n,e.previousSibling||e.target.previousSibling,-1),r=mS(n,e.nextSibling||e.target.nextSibling,1);return{from:o?n.posAfter(o):n.posAtStart,to:r?n.posBefore(r):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(Us)!=e.state.facet(Us)&&(e.view.contentDOM.editContext=e.state.facet(Us)?this.editContext.editContext:null))}destroy(){var e,n,o;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(o=this.resizeScroll)===null||o===void 0||o.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function mS(t,e,n){for(;e;){let o=Fn.get(e);if(o&&o.parent==t)return o;let r=e.parentNode;e=r!=t.dom?r:n>0?e.nextSibling:e.previousSibling}return null}function gS(t,e){let n=e.startContainer,o=e.startOffset,r=e.endContainer,i=e.endOffset,s=t.docView.domAtPos(t.state.selection.main.anchor,1);return Qd(s.node,s.offset,r,i)&&([n,o,r,i]=[r,i,n,o]),{anchorNode:n,anchorOffset:o,focusNode:r,focusOffset:i}}function wme(t,e){if(e.getComposedRanges){let r=e.getComposedRanges(t.root)[0];if(r)return gS(t,r)}let n=null;function o(r){r.preventDefault(),r.stopImmediatePropagation(),n=r.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",o,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",o,!0),n?gS(t,n):null}class _me{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=o=>{let r=e.state.selection.main,{anchor:i,head:s}=r,a=this.toEditorPos(o.updateRangeStart),l=this.toEditorPos(o.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:o.updateRangeStart,editorBase:a,drifted:!1});let c=l-a>o.text.length;a==this.from&&i<this.from?a=i:l==this.to&&i>this.to&&(l=i);let u=EM(e.state.sliceDoc(a,l),o.text,(c?r.from:r.to)-a,c?"end":null);if(!u){let f=Ye.single(this.toEditorPos(o.selectionStart),this.toEditorPos(o.selectionEnd));G0(f,r)||e.dispatch({selection:f,userEvent:"select"});return}let d={from:u.from+a,to:u.toA+a,insert:qt.of(o.text.slice(u.from,u.toB).split(`
|
|
926
926
|
`))};if((it.mac||it.android)&&d.from==s-1&&/^\. ?$/.test(o.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(d={from:a,to:l,insert:qt.of([o.text.replace("."," ")])}),this.pendingContextChange=d,!e.state.readOnly){let f=this.to-this.from+(d.to-d.from+d.insert.length);Rx(e,d,Ye.single(this.toEditorPos(o.selectionStart,f),this.toEditorPos(o.selectionEnd,f)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),d.from<d.to&&!d.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,o.updateRangeStart-1),Math.min(n.text.length,o.updateRangeStart+1)))&&this.handlers.compositionend(o)},this.handlers.characterboundsupdate=o=>{let r=[],i=null;for(let s=this.toEditorPos(o.rangeStart),a=this.toEditorPos(o.rangeEnd);s<a;s++){let l=e.coordsForChar(s);i=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||i||new DOMRect,r.push(i)}n.updateCharacterBounds(o.rangeStart,r)},this.handlers.textformatupdate=o=>{let r=[];for(let i of o.getTextFormats()){let s=i.underlineStyle,a=i.underlineThickness;if(!/none/i.test(s)&&!/none/i.test(a)){let l=this.toEditorPos(i.rangeStart),c=this.toEditorPos(i.rangeEnd);if(l<c){let u=`text-decoration: underline ${/^[a-z]/.test(s)?s+" ":s=="Dashed"?"dashed ":s=="Squiggle"?"wavy ":""}${/thin/i.test(a)?1:2}px`;r.push(no.mark({attributes:{style:u}}).range(l,c))}}}e.dispatch({effects:SM.of(no.set(r))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:o}=this.composing;this.composing=null,o&&this.reset(e.state)}};for(let o in this.handlers)n.addEventListener(o,this.handlers[o]);this.measureReq={read:o=>{this.editContext.updateControlBounds(o.contentDOM.getBoundingClientRect());let r=Nf(o.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,o=!1,r=this.pendingContextChange;return e.changes.iterChanges((i,s,a,l,c)=>{if(o)return;let u=c.length-(s-i);if(r&&s>=r.to)if(r.from==i&&r.to==s&&r.insert.eq(c)){r=this.pendingContextChange=null,n+=u,this.to+=u;return}else r=null,this.revertPending(e.state);if(i+=n,s+=n,s<=this.from)this.from+=u,this.to+=u;else if(i<this.to){if(i<this.from||s>this.to||this.to-this.from+c.length>3e4){o=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(s),c.toString()),this.to+=u}n+=u}),r&&!o&&this.revertPending(e.state),!o}update(e){let n=this.pendingContextChange,o=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(o.from,o.to)&&e.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||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,o=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),r=this.toContextPos(n.head);(this.editContext.selectionStart!=o||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(o,r)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to<e.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let o=this.composing;return o&&o.drifted?o.editorBase+(e-o.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 At{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(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:o}=e;this.dispatchTransactions=e.dispatchTransactions||o&&(r=>r.forEach(i=>o(i,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Kpe(e.parent)||document,this.viewState=new fS(e.state||Jt.create(e)),e.scrollTo&&e.scrollTo.is(Yh)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(zc).map(r=>new s1(r));for(let r of this.plugins)r.update(this);this.observer=new xme(this),this.inputState=new W0e(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Jk(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let n=e.length==1&&e[0]instanceof Zn?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,o=!1,r,i=this.state;for(let f of e){if(f.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=f.state}if(this.destroyed){this.viewState.state=i;return}let s=this.hasFocus,a=0,l=null;e.some(f=>f.annotation(zM))?(this.inputState.notifiedFocused=s,a=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,l=HM(i,s),l||(a=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(u=null)):this.observer.clear(),i.facet(Jt.phrases)!=this.state.facet(Jt.phrases))return this.setState(i);r=H0.create(this,i,e),r.flags|=a;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let f of e){if(d&&(d=d.map(f.changes)),f.scrollIntoView){let{main:h}=f.state.selection;d=new iu(h.empty?h:Ye.cursor(h.head,h.head>h.anchor?-1:1))}for(let h of f.effects)h.is(Yh)&&(d=h.value.clip(this.state))}this.viewState.update(r,d),this.bidiCache=Y0.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),n=this.docView.update(r),this.state.facet(Md)!=this.styleModules&&this.mountStyles(),o=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(Jh)!=r.state.facet(Jh)&&(this.viewState.mustMeasureContent=!0),(n||o||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!r.empty)for(let f of this.state.facet(ny))try{f(r)}catch(h){rs(this.state,h,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!DM(this,u)&&c.force&&ru(this.contentDOM,c.key,c.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 o of this.plugins)o.destroy(this);this.viewState=new fS(e),this.plugins=e.facet(zc).map(o=>new s1(o)),this.pluginMap.clear();for(let o of this.plugins)o.update(this);this.docView.destroy(),this.docView=new Jk(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(zc),o=e.state.facet(zc);if(n!=o){let r=[];for(let i of o){let s=n.indexOf(i);if(s<0)r.push(new s1(i));else{let a=this.plugins[s];a.mustUpdate=e,r.push(a)}}for(let i of this.plugins)i.mustUpdate!=e&&i.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let r of this.plugins)r.mustUpdate=e;for(let r=0;r<this.plugins.length;r++)this.plugins[r].update(this);n!=o&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let n=e.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(o){rs(this.state,o,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,o=this.scrollDOM,r=o.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:s}=this.viewState;Math.abs(r-this.viewState.scrollTop)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(s<0)if(lM(o))i=-1,s=this.viewState.heightMap.height;else{let h=this.viewState.scrollAnchorAt(r);i=h.from,s=h.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 c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let u=c.map(h=>{try{return h.read(this)}catch(m){return rs(this.state,m),vS}}),d=H0.create(this,this.state,[]),f=!1;d.flags|=l,n?n.flags|=l:n=d,this.updateState=2,d.empty||(this.updatePlugins(d),this.inputState.update(d),this.updateAttrs(),f=this.docView.update(d),f&&this.docViewUpdate());for(let h=0;h<c.length;h++)if(u[h]!=vS)try{let m=c[h];m.write&&m.write(u[h],this)}catch(m){rs(this.state,m)}if(f&&this.docView.updateSelection(!0),!d.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,s=-1;continue}else{let m=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-s;if(m>1||m<-1){r=r+m,o.scrollTop=r/this.scaleY,s=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let a of this.state.facet(ny))a(n)}get themeClasses(){return ay+" "+(this.state.facet(sy)?qM:GM)+" "+this.state.facet(Jh)}updateAttrs(){let e=bS(this,CM,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Us)?"true":"false",class:"cm-content",style:`${it.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),bS(this,Ix,n);let o=this.observer.ignore(()=>{let r=Yk(this.contentDOM,this.contentAttrs,n),i=Yk(this.dom,this.editorAttrs,e);return r||i});return this.editorAttrs=e,this.contentAttrs=n,o}showAnnouncements(e){let n=!0;for(let o of e)for(let r of o.effects)if(r.is(At.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(Md);let e=this.state.facet(At.cspNonce);Xa.mount(this.root,this.styleModules.concat(bme).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;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===e.key){this.measureRequests[n]=e;return}}this.measureRequests.push(e)}}plugin(e){let n=this.pluginMap.get(e);return(n===void 0||n&&n.plugin!=e)&&this.pluginMap.set(e,n=this.plugins.find(o=>o.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,o){return u1(this,e,eS(this,e,n,o))}moveByGroup(e,n){return u1(this,e,eS(this,e,n,o=>P0e(this,e.head,o)))}visualLineSide(e,n){let o=this.bidiSpans(e),r=this.textDirectionAt(e.from),i=o[n?o.length-1:0];return Ye.cursor(i.side(n,r)+e.from,i.forward(!n,r)?1:-1)}moveToLineBoundary(e,n,o=!0){return L0e(this,e,n,o)}moveVertically(e,n,o){return u1(this,e,D0e(this,e,n,o))}domAtPos(e,n=1){return this.docView.domAtPos(e,n)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){this.readMeasured();let o=ry(this,e,n);return o&&o.pos}posAndSideAtCoords(e,n=!0){return this.readMeasured(),ry(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let o=this.docView.coordsAt(e,n);if(!o||o.left==o.right)return o;let r=this.state.doc.lineAt(e),i=this.bidiSpans(r),s=i[os.find(i,e-r.from,-1,n)];return z0(o,s.dir==Nn.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(_M)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>kme)return pM(e.length);let n=this.textDirectionAt(e.from),o;for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||hM(i.isolates,o=Xk(this,e))))return i.order;o||(o=Xk(this,e));let r=o0e(e.text,n,o);return this.bidiCache.push(new Y0(e.from,e.to,n,o,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||it.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{aM(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 Yh.of(new iu(typeof e=="number"?Ye.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,o=this.viewState.scrollAnchorAt(e);return Yh.of(new iu(Ye.cursor(o.from),"start","start",o.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 rc.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return rc.define(()=>({}),{eventObservers:e})}static theme(e,n){let o=Xa.newName(),r=[Jh.of(o),Md.of(ly(`.${o}`,e))];return n&&n.dark&&r.push(sy.of(!0)),r}static baseTheme(e){return Tx.lowest(Md.of(ly("."+ay,e,YM)))}static findFromDOM(e){var n;let o=e.querySelector(".cm-content"),r=o&&Fn.get(o)||Fn.get(e);return((n=r==null?void 0:r.root)===null||n===void 0?void 0:n.view)||null}}At.styleModule=Md;At.inputHandler=xM;At.clipboardInputFilter=Dx;At.clipboardOutputFilter=Ex;At.scrollHandler=kM;At.focusChangeEffect=wM;At.perLineTextDirection=_M;At.exceptionSink=yM;At.updateListener=ny;At.editable=Us;At.mouseSelectionStyle=bM;At.dragMovesSelection=vM;At.clickAddsSelectionRange=gM;At.decorations=Hg;At.blockWrappers=AM;At.outerDecorations=Nx;At.atomicRanges=sh;At.bidiIsolatedRanges=$M;At.scrollMargins=TM;At.darkTheme=sy;At.cspNonce=xt.define({combine:t=>t.length?t[0]:""});At.contentAttributes=Ix;At.editorAttributes=CM;At.lineWrapping=At.contentAttributes.of({class:"cm-lineWrapping"});At.announce=Tn.define();const kme=4096,vS={};class Y0{constructor(e,n,o,r,i,s){this.from=e,this.to=n,this.dir=o,this.isolates=r,this.fresh=i,this.order=s}static update(e,n){if(n.empty&&!e.some(i=>i.fresh))return e;let o=[],r=e.length?e[e.length-1].dir:Nn.LTR;for(let i=Math.max(0,e.length-10);i<e.length;i++){let s=e[i];s.dir==r&&!n.touchesRange(s.from,s.to)&&o.push(new Y0(n.mapPos(s.from,1),n.mapPos(s.to,-1),s.dir,s.isolates,!1,s.order))}return o}}function bS(t,e,n){for(let o=t.state.facet(e),r=o.length-1;r>=0;r--){let i=o[r],s=typeof i=="function"?i(t):i;s&&Bx(s,n)}return n}const Sme=it.mac?"mac":it.windows?"win":it.linux?"linux":"key";function Cme(t,e){const n=t.split(/-(?!$)/);let o=n[n.length-1];o=="Space"&&(o=" ");let r,i,s,a;for(let l=0;l<n.length-1;++l){const c=n[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))i=!0;else if(/^s(hift)?$/i.test(c))s=!0;else if(/^mod$/i.test(c))e=="mac"?a=!0:i=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(o="Alt-"+o),i&&(o="Ctrl-"+o),a&&(o="Meta-"+o),s&&(o="Shift-"+o),o}function ep(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n!==!1&&e.shiftKey&&(t="Shift-"+t),t}const Ame=Tx.default(At.domEventHandlers({keydown(t,e){return Mme($me(e.state),t,e,"editor")}})),jM=xt.define({enables:Ame}),yS=new WeakMap;function $me(t){let e=t.facet(jM),n=yS.get(e);return n||yS.set(e,n=Ome(e.reduce((o,r)=>o.concat(r),[]))),n}let Oa=null;const Tme=4e3;function Ome(t,e=Sme){let n=Object.create(null),o=Object.create(null),r=(s,a)=>{let l=o[s];if(l==null)o[s]=a;else if(l!=a)throw new Error("Key binding "+s+" is used both as a regular binding and as a multi-stroke prefix")},i=(s,a,l,c,u)=>{var d,f;let h=n[s]||(n[s]=Object.create(null)),m=a.split(/ (?!$)/).map(v=>Cme(v,e));for(let v=1;v<m.length;v++){let y=m.slice(0,v).join(" ");r(y,!0),h[y]||(h[y]={preventDefault:!0,stopPropagation:!1,run:[x=>{let _=Oa={view:x,prefix:y,scope:s};return setTimeout(()=>{Oa==_&&(Oa=null)},Tme),!0}]})}let b=m.join(" ");r(b,!1);let g=h[b]||(h[b]={preventDefault:!1,stopPropagation:!1,run:((f=(d=h._any)===null||d===void 0?void 0:d.run)===null||f===void 0?void 0:f.slice())||[]});l&&g.run.push(l),c&&(g.preventDefault=!0),u&&(g.stopPropagation=!0)};for(let s of t){let a=s.scope?s.scope.split(" "):["editor"];if(s.any)for(let c of a){let u=n[c]||(n[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:d}=s;for(let f in u)u[f].run.push(h=>d(h,cy))}let l=s[e]||s.key;if(l)for(let c of a)i(c,l,s.run,s.preventDefault,s.stopPropagation),s.shift&&i(c,"Shift-"+l,s.shift,s.preventDefault,s.stopPropagation)}return n}let cy=null;function Mme(t,e,n,o){cy=e;let r=Vpe(e),i=wpe(r,0),s=_pe(i)==r.length&&r!=" ",a="",l=!1,c=!1,u=!1;Oa&&Oa.view==n&&Oa.scope==o&&(a=Oa.prefix+" ",NM.indexOf(e.keyCode)<0&&(c=!0,Oa=null));let d=new Set,f=g=>{if(g){for(let v of g.run)if(!d.has(v)&&(d.add(v),v(n)))return g.stopPropagation&&(u=!0),!0;g.preventDefault&&(g.stopPropagation&&(u=!0),c=!0)}return!1},h=t[o],m,b;return h&&(f(h[a+ep(r,e,!s)])?l=!0:s&&(e.altKey||e.metaKey||e.ctrlKey)&&!(it.windows&&e.ctrlKey&&e.altKey)&&!(it.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(m=Za[e.keyCode])&&m!=r?(f(h[a+ep(m,e,!0)])||e.shiftKey&&(b=Ef[e.keyCode])!=r&&b!=m&&f(h[a+ep(b,e,!1)]))&&(l=!0):s&&e.shiftKey&&f(h[a+ep(r,e,!0)])&&(l=!0),!l&&f(h._any)&&(l=!0)),c&&(l=!0),l&&u&&e.stopPropagation(),cy=null,l}class Mu extends tc{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Mu.prototype.elementClass="";Mu.prototype.toDOM=void 0;Mu.prototype.mapMode=kr.TrackBefore;Mu.prototype.startSide=Mu.prototype.endSide=-1;Mu.prototype.point=!0;const KM=1024;let Bme=0;class h1{constructor(e,n){this.from=e,this.to=n}}class Et{constructor(e={}){this.id=Bme++,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=hr.match(e)),n=>{let o=e(n);return o===void 0?null:[this,o]}}}Et.closedBy=new Et({deserialize:t=>t.split(" ")});Et.openedBy=new Et({deserialize:t=>t.split(" ")});Et.group=new Et({deserialize:t=>t.split(" ")});Et.isolate=new Et({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Et.contextHash=new Et({perNode:!0});Et.lookAhead=new Et({perNode:!0});Et.mounted=new Et({perNode:!0});class ef{constructor(e,n,o,r=!1){this.tree=e,this.overlay=n,this.parser=o,this.bracketed=r}static get(e){return e&&e.props&&e.props[Et.mounted.id]}}const Lme=Object.create(null);class hr{constructor(e,n,o,r=0){this.name=e,this.props=n,this.id=o,this.flags=r}static define(e){let n=e.props&&e.props.length?Object.create(null):Lme,o=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new hr(e.name||"",n,e.id,o);if(e.props){for(let i of e.props)if(Array.isArray(i)||(i=i(r)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[i[0].id]=i[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(Et.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let o in e)for(let r of o.split(" "))n[r]=e[o];return o=>{for(let r=o.prop(Et.group),i=-1;i<(r?r.length:0);i++){let s=n[i<0?o.name:r[i]];if(s)return s}}}}hr.none=new hr("",Object.create(null),0,8);class zx{constructor(e){this.types=e;for(let n=0;n<e.length;n++)if(e[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let n=[];for(let o of this.types){let r=null;for(let i of e){let s=i(o);if(s){r||(r=Object.assign({},o.props));let a=s[1],l=s[0];l.combine&&l.id in r&&(a=l.combine(r[l.id],a)),r[l.id]=a}}n.push(r?new hr(o.name,r,o.id,o.flags):o)}return new zx(n)}}const tp=new WeakMap,xS=new WeakMap;var _n;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays",t[t.EnterBracketed=16]="EnterBracketed"})(_n||(_n={}));class On{constructor(e,n,o,r,i){if(this.type=e,this.children=n,this.positions=o,this.length=r,this.props=null,i&&i.length){this.props=Object.create(null);for(let[s,a]of i)this.props[typeof s=="number"?s:s.id]=a}}toString(){let e=ef.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let o of this.children){let r=o.toString();r&&(n&&(n+=","),n+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new dy(this.topNode,e)}cursorAt(e,n=0,o=0){let r=tp.get(this)||this.topNode,i=new dy(r);return i.moveTo(e,n),tp.set(this,i._tree),i}get topNode(){return new Zr(this,0,0,null)}resolve(e,n=0){let o=Ff(tp.get(this)||this.topNode,e,n,!1);return tp.set(this,o),o}resolveInner(e,n=0){let o=Ff(xS.get(this)||this.topNode,e,n,!0);return xS.set(this,o),o}resolveStack(e,n=0){return Eme(this,e,n)}iterate(e){let{enter:n,leave:o,from:r=0,to:i=this.length}=e,s=e.mode||0,a=(s&_n.IncludeAnonymous)>0;for(let l=this.cursor(s|_n.IncludeAnonymous);;){let c=!1;if(l.from<=i&&l.to>=r&&(!a&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&o&&(a||!l.type.isAnonymous)&&o(l),!l.nextSibling();){if(!l.parent())return;c=!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:Ux(hr.none,this.children,this.positions,0,this.children.length,0,this.length,(n,o,r)=>new On(this.type,n,o,r,this.propValues),e.makeTree||((n,o,r)=>new On(hr.none,n,o,r)))}static build(e){return Ime(e)}}On.empty=new On(hr.none,[],[],0);class Hx{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 Hx(this.buffer,this.index)}}class Ja{constructor(e,n,o){this.buffer=e,this.length=n,this.set=o}get type(){return hr.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],o=this.buffer[e+3],r=this.set.types[n],i=r.name;if(/\W/.test(i)&&!r.isError&&(i=JSON.stringify(i)),e+=4,o==e)return i;let s=[];for(;e<o;)s.push(this.childString(e)),e=this.buffer[e+3];return i+"("+s.join(",")+")"}findChild(e,n,o,r,i){let{buffer:s}=this,a=-1;for(let l=e;l!=n&&!(XM(i,r,s[l+1],s[l+2])&&(a=l,o>0));l=s[l+3]);return a}slice(e,n,o){let r=this.buffer,i=new Uint16Array(n-e),s=0;for(let a=e,l=0;a<n;){i[l++]=r[a++],i[l++]=r[a++]-o;let c=i[l++]=r[a++]-o;i[l++]=r[a++]-e,s=Math.max(s,c)}return new Ja(i,s,this.set)}}function XM(t,e,n,o){switch(t){case-2:return n<e;case-1:return o>=e&&n<e;case 0:return n<e&&o>e;case 1:return n<=e&&o>e;case 2:return o>e;case 4:return!0}}function Ff(t,e,n,o){for(var r;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let s=!o&&t instanceof Zr&&t.index<0?null:t.parent;if(!s)return t;t=s}let i=o?0:_n.IgnoreOverlays;if(o)for(let s=t,a=s.parent;a;s=a,a=s.parent)s instanceof Zr&&s.index<0&&((r=a.enter(e,n,i))===null||r===void 0?void 0:r.from)!=s.from&&(t=a);for(;;){let s=t.enter(e,n,i);if(!s)return t;t=s}}class ZM{cursor(e=0){return new dy(this,e)}getChild(e,n=null,o=null){let r=wS(this,e,n,o);return r.length?r[0]:null}getChildren(e,n=null,o=null){return wS(this,e,n,o)}resolve(e,n=0){return Ff(this,e,n,!1)}resolveInner(e,n=0){return Ff(this,e,n,!0)}matchContext(e){return uy(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),o=this;for(;n;){let r=n.lastChild;if(!r||r.to!=n.to)break;r.type.isError&&r.from==r.to?(o=n,n=r.prevSibling):n=r}return o}get node(){return this}get next(){return this.parent}}class Zr extends ZM{constructor(e,n,o,r){super(),this._tree=e,this.from=n,this.index=o,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,o,r,i=0){for(let s=this;;){for(let{children:a,positions:l}=s._tree,c=n>0?a.length:-1;e!=c;e+=n){let u=a[e],d=l[e]+s.from,f;if(!(!(i&_n.EnterBracketed&&u instanceof On&&(f=ef.get(u))&&!f.overlay&&f.bracketed&&o>=d&&o<=d+u.length)&&!XM(r,o,d,d+u.length))){if(u instanceof Ja){if(i&_n.ExcludeBuffers)continue;let h=u.findChild(0,u.buffer.length,n,o-d,r);if(h>-1)return new Ea(new Pme(s,u,e,d),null,h)}else if(i&_n.IncludeAnonymous||!u.type.isAnonymous||Wx(u)){let h;if(!(i&_n.IgnoreMounts)&&(h=ef.get(u))&&!h.overlay)return new Zr(h.tree,d,e,s);let m=new Zr(u,d,e,s);return i&_n.IncludeAnonymous||!m.type.isAnonymous?m:m.nextChild(n<0?u.children.length-1:0,n,o,r,i)}}}if(i&_n.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+n:e=n<0?-1:s._parent._tree.children.length,s=s._parent,!s))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,n,o=0){let r;if(!(o&_n.IgnoreOverlays)&&(r=ef.get(this._tree))&&r.overlay){let i=e-this.from,s=o&_n.EnterBracketed&&r.bracketed;for(let{from:a,to:l}of r.overlay)if((n>0||s?a<=i:a<i)&&(n<0||s?l>=i:l>i))return new Zr(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,o)}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 wS(t,e,n,o){let r=t.cursor(),i=[];if(!r.firstChild())return i;if(n!=null){for(let s=!1;!s;)if(s=r.type.is(n),!r.nextSibling())return i}for(;;){if(o!=null&&r.type.is(o))return i;if(r.type.is(e)&&i.push(r.node),!r.nextSibling())return o==null?i:[]}}function uy(t,e,n=e.length-1){for(let o=t;n>=0;o=o.parent){if(!o)return!1;if(!o.type.isAnonymous){if(e[n]&&e[n]!=o.name)return!1;n--}}return!0}class Pme{constructor(e,n,o,r){this.parent=e,this.buffer=n,this.index=o,this.start=r}}class Ea extends ZM{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,o){super(),this.context=e,this._parent=n,this.index=o,this.type=e.buffer.set.types[e.buffer.buffer[o]]}child(e,n,o){let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],e,n-this.context.start,o);return i<0?null:new Ea(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,n,o=0){if(o&_n.ExcludeBuffers)return null;let{buffer:r}=this.context,i=r.findChild(this.index+4,r.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return i<0?null:new Ea(this.context,this,i)}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 Ea(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 Ea(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:o}=this.context,r=this.index+4,i=o.buffer[this.index+3];if(i>r){let s=o.buffer[this.index+1];e.push(o.slice(r,i,s)),n.push(0)}return new On(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function QM(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;i<t.length;i++){let s=t[i];(s.from>n.from||s.to<n.to)&&(n=s,e=i)}let o=n instanceof Zr&&n.index<0?null:n.parent,r=t.slice();return o?r[e]=o:r.splice(e,1),new Dme(r,n)}class Dme{constructor(e,n){this.heads=e,this.node=n}get next(){return QM(this.heads)}}function Eme(t,e,n){let o=t.resolveInner(e,n),r=null;for(let i=o instanceof Zr?o:o.context.parent;i;i=i.parent)if(i.index<0){let s=i.parent;(r||(r=[o])).push(s.resolve(e,n)),i=s}else{let s=ef.get(i.tree);if(s&&s.overlay&&s.overlay[0].from<=e&&s.overlay[s.overlay.length-1].to>=e){let a=new Zr(s.tree,s.overlay[0].from+i.from,-1,i);(r||(r=[o])).push(Ff(a,e,n,!1))}}return r?QM(r):o}class dy{get name(){return this.type.name}constructor(e,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~_n.EnterBracketed,e instanceof Zr)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let o=e._parent;o;o=o._parent)this.stack.unshift(o.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:o,buffer:r}=this.buffer;return this.type=n||r.set.types[r.buffer[e]],this.from=o+r.buffer[e+1],this.to=o+r.buffer[e+2],!0}yield(e){return e?e instanceof Zr?(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,o){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,o,this.mode));let{buffer:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],e,n-this.buffer.start,o);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}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,o=this.mode){return this.buffer?o&_n.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,o))}parent(){if(!this.buffer)return this.yieldNode(this.mode&_n.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&_n.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,o=this.stack.length-1;if(e<0){let r=o<0?0:this.stack[o]+4;if(this.index!=r)return this.yieldBuf(n.findChild(r,this.index,-1,0,4))}else{let r=n.buffer[this.index+3];if(r<(o<0?n.buffer.length:n.buffer[this.stack[o]+3]))return this.yieldBuf(r)}return o<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,o,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let i=0;i<this.index;i++)if(r.buffer.buffer[i+3]<this.index)return!1;({index:n,parent:o}=r)}else({index:n,_parent:o}=this._tree);for(;o;{index:n,_parent:o}=o)if(n>-1)for(let i=n+e,s=e<0?-1:o._tree.children.length;i!=s;i+=e){let a=o._tree.children[i];if(this.mode&_n.IncludeAnonymous||a instanceof Ja||!a.type.isAnonymous||Wx(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<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,o=0;if(e&&e.context==this.buffer)e:for(let r=this.index,i=this.stack.length;i>=0;){for(let s=e;s;s=s._parent)if(s.index==r){if(r==this.index)return s;n=s,o=i+1;break e}r=this.stack[--i]}for(let r=o;r<this.stack.length;r++)n=new Ea(this.buffer,n,this.stack[r]);return this.bufferNode=new Ea(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let o=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){o++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&n&&n(this),r=this.type.isAnonymous,!o)return;if(this.nextSibling())break;this.parent(),o--,r=!0}}}matchContext(e){if(!this.buffer)return uy(this.node.parent,e);let{buffer:n}=this.buffer,{types:o}=n.set;for(let r=e.length-1,i=this.stack.length-1;r>=0;i--){if(i<0)return uy(this._tree,e,r);let s=o[n.buffer[this.stack[i]]];if(!s.isAnonymous){if(e[r]&&e[r]!=s.name)return!1;r--}}return!0}}function Wx(t){return t.children.some(e=>e instanceof Ja||!e.type.isAnonymous||Wx(e))}function Ime(t){var e;let{buffer:n,nodeSet:o,maxBufferLength:r=KM,reused:i=[],minRepeatType:s=o.types.length}=t,a=Array.isArray(n)?new Hx(n,n.length):n,l=o.types,c=0,u=0;function d(C,D,M,$,L,E){let{id:N,start:T,end:O,size:P}=a,B=u,V=c;if(P<0)if(a.next(),P==-1){let ae=i[N];M.push(ae),$.push(T-C);return}else if(P==-3){c=N;return}else if(P==-4){u=N;return}else throw new RangeError(`Unrecognized record size: ${P}`);let z=l[N],G,K,ne=T-C;if(O-T<=r&&(K=g(a.pos-D,L))){let ae=new Uint16Array(K.size-K.skip),he=a.pos-K.size,ge=ae.length;for(;a.pos>he;)ge=v(K.start,ae,ge);G=new Ja(ae,O-K.start,o),ne=K.start-C}else{let ae=a.pos-P;a.next();let he=[],ge=[],le=N>=s?N:-1,fe=0,we=O;for(;a.pos>ae;)le>=0&&a.id==le&&a.size>=0?(a.end<=we-r&&(m(he,ge,T,fe,a.end,we,le,B,V),fe=he.length,we=a.end),a.next()):E>2500?f(T,ae,he,ge):d(T,ae,he,ge,le,E+1);if(le>=0&&fe>0&&fe<he.length&&m(he,ge,T,fe,T,we,le,B,V),he.reverse(),ge.reverse(),le>-1&&fe>0){let Z=h(z,V);G=Ux(z,he,ge,0,he.length,0,O-T,Z,Z)}else G=b(z,he,ge,O-T,B-O,V)}M.push(G),$.push(ne)}function f(C,D,M,$){let L=[],E=0,N=-1;for(;a.pos>D;){let{id:T,start:O,end:P,size:B}=a;if(B>4)a.next();else{if(N>-1&&O<N)break;N<0&&(N=P-r),L.push(T,O,P),E++,a.next()}}if(E){let T=new Uint16Array(E*4),O=L[L.length-2];for(let P=L.length-3,B=0;P>=0;P-=3)T[B++]=L[P],T[B++]=L[P+1]-O,T[B++]=L[P+2]-O,T[B++]=B;M.push(new Ja(T,L[2]-O,o)),$.push(O-C)}}function h(C,D){return(M,$,L)=>{let E=0,N=M.length-1,T,O;if(N>=0&&(T=M[N])instanceof On){if(!N&&T.type==C&&T.length==L)return T;(O=T.prop(Et.lookAhead))&&(E=$[N]+T.length+O)}return b(C,M,$,L,E,D)}}function m(C,D,M,$,L,E,N,T,O){let P=[],B=[];for(;C.length>$;)P.push(C.pop()),B.push(D.pop()+M-L);C.push(b(o.types[N],P,B,E-L,T-E,O)),D.push(L-M)}function b(C,D,M,$,L,E,N){if(E){let T=[Et.contextHash,E];N=N?[T].concat(N):[T]}if(L>25){let T=[Et.lookAhead,L];N=N?[T].concat(N):[T]}return new On(C,D,M,$,N)}function g(C,D){let M=a.fork(),$=0,L=0,E=0,N=M.end-r,T={size:0,start:0,skip:0};e:for(let O=M.pos-C;M.pos>O;){let P=M.size;if(M.id==D&&P>=0){T.size=$,T.start=L,T.skip=E,E+=4,$+=4,M.next();continue}let B=M.pos-P;if(P<0||B<O||M.start<N)break;let V=M.id>=s?4:0,z=M.start;for(M.next();M.pos>B;){if(M.size<0)if(M.size==-3||M.size==-4)V+=4;else break e;else M.id>=s&&(V+=4);M.next()}L=z,$+=P,E+=V}return(D<0||$==C)&&(T.size=$,T.start=L,T.skip=E),T.size>4?T:void 0}function v(C,D,M){let{id:$,start:L,end:E,size:N}=a;if(a.next(),N>=0&&$<s){let T=M;if(N>4){let O=a.pos-(N-4);for(;a.pos>O;)M=v(C,D,M)}D[--M]=T,D[--M]=E-C,D[--M]=L-C,D[--M]=$}else N==-3?c=$:N==-4&&(u=$);return M}let y=[],x=[];for(;a.pos>0;)d(t.start||0,t.bufferStart||0,y,x,-1,0);let _=(e=t.length)!==null&&e!==void 0?e:y.length?x[0]+y[0].length:0;return new On(l[t.topID],y.reverse(),x.reverse(),_)}const _S=new WeakMap;function Op(t,e){if(!t.isAnonymous||e instanceof Ja||e.type!=t)return 1;let n=_S.get(e);if(n==null){n=1;for(let o of e.children){if(o.type!=t||!(o instanceof On)){n=1;break}n+=Op(t,o)}_S.set(e,n)}return n}function Ux(t,e,n,o,r,i,s,a,l){let c=0;for(let m=o;m<r;m++)c+=Op(t,e[m]);let u=Math.ceil(c*1.5/8),d=[],f=[];function h(m,b,g,v,y){for(let x=g;x<v;){let _=x,C=b[x],D=Op(t,m[x]);for(x++;x<v;x++){let M=Op(t,m[x]);if(D+M>=u)break;D+=M}if(x==_+1){if(D>u){let M=m[_];h(M.children,M.positions,0,M.children.length,b[_]+y);continue}d.push(m[_])}else{let M=b[x-1]+m[x-1].length-C;d.push(Ux(t,m,b,_,x,C,M,null,l))}f.push(C+y-i)}}return h(e,n,o,r,0),(a||l)(d,f,s)}class Wl{constructor(e,n,o,r,i=!1,s=!1){this.from=e,this.to=n,this.tree=o,this.offset=r,this.open=(i?1:0)|(s?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],o=!1){let r=[new Wl(0,e.length,e,0,!1,o)];for(let i of n)i.to>e.length&&r.push(i);return r}static applyChanges(e,n,o=128){if(!n.length)return e;let r=[],i=1,s=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let u=a<n.length?n[a]:null,d=u?u.fromA:1e9;if(d-l>=o)for(;s&&s.from<d;){let f=s;if(l>=f.from||d<=f.to||c){let h=Math.max(f.from,l)-c,m=Math.min(f.to,d)-c;f=h>=m?null:new Wl(h,m,f.tree,f.offset+c,a>0,!!u)}if(f&&r.push(f),s.to>d)break;s=i<e.length?e[i++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return r}}class JM{startParse(e,n,o){return typeof e=="string"&&(e=new Nme(e)),o=o?o.length?o.map(r=>new h1(r.from,r.to)):[new h1(0,0)]:[new h1(0,e.length)],this.createParse(e,n||[],o)}parse(e,n,o){let r=this.startParse(e,n,o);for(;;){let i=r.advance();if(i)return i}}}class Nme{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)}}new Et({perNode:!0});let Rme=0;class Hr{constructor(e,n,o,r){this.name=e,this.set=n,this.base=o,this.modified=r,this.id=Rme++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let o=typeof e=="string"?e:"?";if(e instanceof Hr&&(n=e),n!=null&&n.base)throw new Error("Can not derive from a modified tag");let r=new Hr(o,[],null,[]);if(r.set.push(r),n)for(let i of n.set)r.set.push(i);return r}static defineModifier(e){let n=new j0(e);return o=>o.modified.indexOf(n)>-1?o:j0.get(o.base||o,o.modified.concat(n).sort((r,i)=>r.id-i.id))}}let Fme=0;class j0{constructor(e){this.name=e,this.instances=[],this.id=Fme++}static get(e,n){if(!n.length)return e;let o=n[0].instances.find(a=>a.base==e&&Vme(n,a.modified));if(o)return o;let r=[],i=new Hr(e.name,r,e,n);for(let a of n)a.instances.push(i);let s=zme(n);for(let a of e.set)if(!a.modified.length)for(let l of s)r.push(j0.get(a,l));return i}}function Vme(t,e){return t.length==e.length&&t.every((n,o)=>n==e[o])}function zme(t){let e=[[]];for(let n=0;n<t.length;n++)for(let o=0,r=e.length;o<r;o++)e.push(e[o].concat(t[n]));return e.sort((n,o)=>o.length-n.length)}function eB(t){let e=Object.create(null);for(let n in t){let o=t[n];Array.isArray(o)||(o=[o]);for(let r of n.split(" "))if(r){let i=[],s=2,a=r;for(let d=0;;){if(a=="..."&&d>0&&d+3==r.length){s=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!f)throw new RangeError("Invalid path: "+r);if(i.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),d+=f[0].length,d==r.length)break;let h=r[d++];if(d==r.length&&h=="!"){s=0;break}if(h!="/")throw new RangeError("Invalid path: "+r);a=r.slice(d)}let l=i.length-1,c=i[l];if(!c)throw new RangeError("Invalid path: "+r);let u=new Vf(o,s,l>0?i.slice(0,l):null);e[c]=u.sort(e[c])}}return tB.add(e)}const tB=new Et({combine(t,e){let n,o,r;for(;t||e;){if(!t||e&&t.depth>=e.depth?(r=e,e=e.next):(r=t,t=t.next),n&&n.mode==r.mode&&!r.context&&!n.context)continue;let i=new Vf(r.tags,r.mode,r.context);n?n.next=i:o=i,n=i}return o}});class Vf{constructor(e,n,o,r){this.tags=e,this.mode=n,this.context=o,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}Vf.empty=new Vf([],2,null);function nB(t,e){let n=Object.create(null);for(let i of t)if(!Array.isArray(i.tag))n[i.tag.id]=i.class;else for(let s of i.tag)n[s.id]=i.class;let{scope:o,all:r=null}=e||{};return{style:i=>{let s=r;for(let a of i)for(let l of a.set){let c=n[l.id];if(c){s=s?s+" "+c:c;break}}return s},scope:o}}function Hme(t,e){let n=null;for(let o of t){let r=o.style(e);r&&(n=n?n+" "+r:r)}return n}function oB(t,e,n,o=0,r=t.length){let i=new Wme(o,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),o,r,"",i.highlighters),i.flush(r)}class Wme{constructor(e,n,o){this.at=e,this.highlighters=n,this.span=o,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,o,r,i){let{type:s,from:a,to:l}=e;if(a>=o||l<=n)return;s.isTop&&(i=this.highlighters.filter(h=>!h.scope||h.scope(s)));let c=r,u=Ume(e)||Vf.empty,d=Hme(i,u.tags);if(d&&(c&&(c+=" "),c+=d,u.mode==1&&(r+=(r?" ":"")+d)),this.startSpan(Math.max(n,a),c),u.opaque)return;let f=e.tree&&e.tree.prop(Et.mounted);if(f&&f.overlay){let h=e.node.enter(f.overlay[0].from+a,1),m=this.highlighters.filter(g=>!g.scope||g.scope(f.tree.type)),b=e.firstChild();for(let g=0,v=a;;g++){let y=g<f.overlay.length?f.overlay[g]:null,x=y?y.from+a:l,_=Math.max(n,v),C=Math.min(o,x);if(_<C&&b)for(;e.from<C&&(this.highlightRange(e,_,C,r,i),this.startSpan(Math.min(C,e.to),c),!(e.to>=x||!e.nextSibling())););if(!y||x>o)break;v=y.to+a,v>n&&(this.highlightRange(h.cursor(),Math.max(n,y.from+a),Math.min(o,v),"",m),this.startSpan(Math.min(o,v),c))}b&&e.parent()}else if(e.firstChild()){f&&(r="");do if(!(e.to<=n)){if(e.from>=o)break;this.highlightRange(e,n,o,r,i),this.startSpan(Math.min(o,e.to),c)}while(e.nextSibling());e.parent()}}}function Ume(t){let e=t.type.prop(tB);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Xe=Hr.define,np=Xe(),Aa=Xe(),kS=Xe(Aa),SS=Xe(Aa),$a=Xe(),op=Xe($a),p1=Xe($a),Ki=Xe(),_l=Xe(Ki),Yi=Xe(),ji=Xe(),fy=Xe(),vd=Xe(fy),rp=Xe(),at={comment:np,lineComment:Xe(np),blockComment:Xe(np),docComment:Xe(np),name:Aa,variableName:Xe(Aa),typeName:kS,tagName:Xe(kS),propertyName:SS,attributeName:Xe(SS),className:Xe(Aa),labelName:Xe(Aa),namespace:Xe(Aa),macroName:Xe(Aa),literal:$a,string:op,docString:Xe(op),character:Xe(op),attributeValue:Xe(op),number:p1,integer:Xe(p1),float:Xe(p1),bool:Xe($a),regexp:Xe($a),escape:Xe($a),color:Xe($a),url:Xe($a),keyword:Yi,self:Xe(Yi),null:Xe(Yi),atom:Xe(Yi),unit:Xe(Yi),modifier:Xe(Yi),operatorKeyword:Xe(Yi),controlKeyword:Xe(Yi),definitionKeyword:Xe(Yi),moduleKeyword:Xe(Yi),operator:ji,derefOperator:Xe(ji),arithmeticOperator:Xe(ji),logicOperator:Xe(ji),bitwiseOperator:Xe(ji),compareOperator:Xe(ji),updateOperator:Xe(ji),definitionOperator:Xe(ji),typeOperator:Xe(ji),controlOperator:Xe(ji),punctuation:fy,separator:Xe(fy),bracket:vd,angleBracket:Xe(vd),squareBracket:Xe(vd),paren:Xe(vd),brace:Xe(vd),content:Ki,heading:_l,heading1:Xe(_l),heading2:Xe(_l),heading3:Xe(_l),heading4:Xe(_l),heading5:Xe(_l),heading6:Xe(_l),contentSeparator:Xe(Ki),list:Xe(Ki),quote:Xe(Ki),emphasis:Xe(Ki),strong:Xe(Ki),link:Xe(Ki),monospace:Xe(Ki),strikethrough:Xe(Ki),inserted:Xe(),deleted:Xe(),changed:Xe(),invalid:Xe(),meta:rp,documentMeta:Xe(rp),annotation:Xe(rp),processingInstruction:Xe(rp),definition:Hr.defineModifier("definition"),constant:Hr.defineModifier("constant"),function:Hr.defineModifier("function"),standard:Hr.defineModifier("standard"),local:Hr.defineModifier("local"),special:Hr.defineModifier("special")};for(let t in at){let e=at[t];e instanceof Hr&&(e.name=t)}const rB=nB([{tag:at.link,class:"tok-link"},{tag:at.heading,class:"tok-heading"},{tag:at.emphasis,class:"tok-emphasis"},{tag:at.strong,class:"tok-strong"},{tag:at.keyword,class:"tok-keyword"},{tag:at.atom,class:"tok-atom"},{tag:at.bool,class:"tok-bool"},{tag:at.url,class:"tok-url"},{tag:at.labelName,class:"tok-labelName"},{tag:at.inserted,class:"tok-inserted"},{tag:at.deleted,class:"tok-deleted"},{tag:at.literal,class:"tok-literal"},{tag:at.string,class:"tok-string"},{tag:at.number,class:"tok-number"},{tag:[at.regexp,at.escape,at.special(at.string)],class:"tok-string2"},{tag:at.variableName,class:"tok-variableName"},{tag:at.local(at.variableName),class:"tok-variableName tok-local"},{tag:at.definition(at.variableName),class:"tok-variableName tok-definition"},{tag:at.special(at.variableName),class:"tok-variableName2"},{tag:at.definition(at.propertyName),class:"tok-propertyName tok-definition"},{tag:at.typeName,class:"tok-typeName"},{tag:at.namespace,class:"tok-namespace"},{tag:at.className,class:"tok-className"},{tag:at.macroName,class:"tok-macroName"},{tag:at.propertyName,class:"tok-propertyName"},{tag:at.operator,class:"tok-operator"},{tag:at.comment,class:"tok-comment"},{tag:at.meta,class:"tok-meta"},{tag:at.invalid,class:"tok-invalid"},{tag:at.punctuation,class:"tok-punctuation"}]);var m1;const Hc=new Et;function Gme(t){return xt.define({combine:t?e=>e.concat(t):void 0})}const qme=new Et;class bi{constructor(e,n,o=[],r=""){this.data=e,this.name=r,Jt.prototype.hasOwnProperty("tree")||Object.defineProperty(Jt.prototype,"tree",{get(){return vs(this)}}),this.parser=n,this.extension=[Lu.of(this),Jt.languageData.of((i,s,a)=>{let l=CS(i,s,a),c=l.type.prop(Hc);if(!c)return[];let u=i.facet(c),d=l.type.prop(qme);if(d){let f=l.resolve(s-l.from,a);for(let h of d)if(h.test(f,i)){let m=i.facet(h.facet);return h.type=="replace"?m:m.concat(u)}}return u})].concat(o)}isActiveAt(e,n,o=-1){return CS(e,n,o).type.prop(Hc)==this.data}findRegions(e){let n=e.facet(Lu);if((n==null?void 0:n.data)==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let o=[],r=(i,s)=>{if(i.prop(Hc)==this.data){o.push({from:s,to:s+i.length});return}let a=i.prop(Et.mounted);if(a){if(a.tree.prop(Hc)==this.data){if(a.overlay)for(let l of a.overlay)o.push({from:l.from+s,to:l.to+s});else o.push({from:s,to:s+i.length});return}else if(a.overlay){let l=o.length;if(r(a.tree,a.overlay[0].from+s),o.length>l)return}}for(let l=0;l<i.children.length;l++){let c=i.children[l];c instanceof On&&r(c,i.positions[l]+s)}};return r(vs(e),0),o}get allowsNesting(){return!0}}bi.setState=Tn.define();function CS(t,e,n){let o=t.facet(Lu),r=vs(t).topNode;if(!o||o.allowsNesting)for(let i=r;i;i=i.enter(e,n,_n.ExcludeBuffers|_n.EnterBracketed))i.type.isTop&&(r=i);return r}class K0 extends bi{constructor(e,n,o){super(e,n,[],o),this.parser=n}static define(e){let n=Gme(e.languageData);return new K0(n,e.parser.configure({props:[Hc.add(o=>o.isTop?n:void 0)]}),e.name)}configure(e,n){return new K0(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function vs(t){let e=t.field(bi.state,!1);return e?e.tree:On.empty}class Yme{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 o=this.cursorPos-this.string.length;return e<o||n>=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-o,n-o)}}let bd=null;class X0{constructor(e,n,o=[],r,i,s,a,l){this.parser=e,this.state=n,this.fragments=o,this.tree=r,this.treeLen=i,this.viewport=s,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,n,o){return new X0(e,n,[],On.empty,0,o,[],null)}startParse(){return this.parser.startParse(new Yme(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=On.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var o;if(typeof e=="number"){let r=Date.now()+e;e=()=>Date.now()>r}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let r=this.parse.advance();if(r)if(this.fragments=this.withoutTempSkipped(Wl.addTree(r,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(o=this.parse.stoppedAt)!==null&&o!==void 0?o:this.state.doc.length,this.tree=r,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=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(Wl.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=bd;bd=this;try{return e()}finally{bd=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=AS(e,n.from,n.to);return e}changes(e,n){let{fragments:o,tree:r,treeLen:i,viewport:s,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,u,d,f)=>l.push({fromA:c,toA:u,fromB:d,toB:f})),o=Wl.applyChanges(o,l),r=On.empty,i=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let u=e.mapPos(c.from,1),d=e.mapPos(c.to,-1);u<d&&a.push({from:u,to:d})}}}return new X0(this.parser,n,o,r,i,s,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let n=this.skipped.length;for(let o=0;o<this.skipped.length;o++){let{from:r,to:i}=this.skipped[o];r<e.to&&i>e.from&&(this.fragments=AS(this.fragments,r,i),this.skipped.splice(o--,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 JM{createParse(n,o,r){let i=r[0].from,s=r[r.length-1].to;return{parsedPos:i,advance(){let l=bd;if(l){for(let c of r)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=s,new On(hr.none,[],[],s-i)},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 bd}}function AS(t,e,n){return Wl.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class Bu{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),o=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,o)||n.takeTree(),new Bu(n)}static init(e){let n=Math.min(3e3,e.doc.length),o=X0.create(e.facet(Lu).parser,e,{from:0,to:n});return o.work(20,n)||o.takeTree(),new Bu(o)}}bi.state=hl.define({create:Bu.init,update(t,e){for(let n of e.effects)if(n.is(bi.setState))return n.value;return e.startState.facet(Lu)!=e.state.facet(Lu)?Bu.init(e.state):t.apply(e)}});let iB=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(iB=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const g1=typeof navigator<"u"&&(!((m1=navigator.scheduling)===null||m1===void 0)&&m1.isInputPending)?()=>navigator.scheduling.isInputPending():null,jme=rc.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(bi.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(bi.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=iB(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:o,viewport:{to:r}}=this.view,i=o.field(bi.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let s=Date.now()+Math.min(this.chunkBudget,100,e&&!g1?Math.max(25,e.timeRemaining()-5):1e9),a=i.context.treeLen<r&&o.doc.length>r+1e3,l=i.context.work(()=>g1&&g1()||Date.now()>s,r+(a?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:bi.setState.of(new Bu(i.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>rs(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()}}}),Lu=xt.define({combine(t){return t.length?t[0]:null},enables:t=>[bi.state,jme,At.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class Kme{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const Xme=xt.define(),Gx=xt.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 Z0(t){let e=t.facet(Gx);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Q0(t,e){let n="",o=t.tabSize,r=t.facet(Gx)[0];if(r==" "){for(;e>=o;)n+=" ",e-=o;r=" "}for(let i=0;i<e;i++)n+=r;return n}function sB(t,e){t instanceof Jt&&(t=new qg(t));for(let o of t.state.facet(Xme)){let r=o(t,e);if(r!==void 0)return r}let n=vs(t.state);return n.length>=e?Qme(t,n,e):null}class qg{constructor(e,n={}){this.state=e,this.options=n,this.unit=Z0(e)}lineAt(e,n=1){let o=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return r!=null&&r>=o.from&&r<=o.to?i&&r==e?{text:"",from:e}:(n<0?r<e:r<=e)?{text:o.text.slice(r-o.from),from:r}:{text:o.text.slice(0,r-o.from),from:o.from}:o}textAfterPos(e,n=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:o,from:r}=this.lineAt(e,n);return o.slice(e-r,Math.min(o.length,e+100-r))}column(e,n=1){let{text:o,from:r}=this.lineAt(e,n),i=this.countColumn(o,e-r),s=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return s>-1&&(i+=s-this.countColumn(o,o.search(/\S|$/))),i}countColumn(e,n=e.length){return Fg(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:o,from:r}=this.lineAt(e,n),i=this.options.overrideIndentation;if(i){let s=i(r);if(s>-1)return s}return this.countColumn(o,o.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Zme=new Et;function Qme(t,e,n){let o=e.resolveStack(n),r=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(r!=o.node){let i=[];for(let s=r;s&&!(s.from<o.node.from||s.to>o.node.to||s.from==o.node.from&&s.type==o.node.type);s=s.parent)i.push(s);for(let s=i.length-1;s>=0;s--)o={node:i[s],next:o}}return aB(o,t,n)}function aB(t,e,n){for(let o=t;o;o=o.next){let r=ege(o.node);if(r)return r(qx.create(e,n,o))}return 0}function Jme(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function ege(t){let e=t.type.prop(Zme);if(e)return e;let n=t.firstChild,o;if(n&&(o=n.type.prop(Et.closedBy))){let r=t.lastChild,i=r&&o.indexOf(r.name)>-1;return s=>rge(s,!0,1,void 0,i&&!Jme(s)?r.from:void 0)}return t.parent==null?tge:null}function tge(){return 0}class qx extends qg{constructor(e,n,o){super(e.state,e.options),this.base=e,this.pos=n,this.context=o}get node(){return this.context.node}static create(e,n,o){return new qx(e,n,o)}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 o=e.resolve(n.from);for(;o.parent&&o.parent.from==o.from;)o=o.parent;if(nge(o,e))break;n=this.state.doc.lineAt(o.from)}return this.lineIndent(n.from)}continue(){return aB(this.context.next,this.base,this.pos)}}function nge(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function oge(t){let e=t.node,n=e.childAfter(e.from),o=e.lastChild;if(!n)return null;let r=t.options.simulateBreak,i=t.state.doc.lineAt(n.from),s=r==null||r<=i.from?i.to:Math.min(i.to,r);for(let a=n.to;;){let l=e.childAfter(a);if(!l||l==o)return null;if(!l.type.isSkipped){if(l.from>=s)return null;let c=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+c}}a=l.to}}function rge(t,e,n,o,r){let i=t.textAfter,s=i.match(/^\s*/)[0].length,a=o&&i.slice(s,s+o.length)==o||r==t.pos+s,l=oge(t);return l?a?t.column(l.from):t.column(l.to):t.baseIndent+(a?0:t.unit*n)}class Yx{constructor(e,n){this.specs=e;let o;function r(a){let l=Xa.newName();return(o||(o=Object.create(null)))["."+l]=a,l}const i=typeof n.all=="string"?n.all:n.all?r(n.all):void 0,s=n.scope;this.scope=s instanceof bi?a=>a.prop(Hc)==s.data:s?a=>a==s:void 0,this.style=nB(e.map(a=>({tag:a.tag,class:a.class||r(Object.assign({},a,{tag:null}))})),{all:i}).style,this.module=o?new Xa(o):null,this.themeType=n.themeType}static define(e,n){return new Yx(e,n||{})}}const hy=xt.define(),ige=xt.define({combine(t){return t.length?[t[0]]:null}});function v1(t){let e=t.facet(hy);return e.length?e:t.facet(ige)}function sge(t,e){let n=[lge],o;return t instanceof Yx&&(t.module&&n.push(At.styleModule.of(t.module)),o=t.themeType),o?n.push(hy.computeN([At.darkTheme],r=>r.facet(At.darkTheme)==(o=="dark")?[t]:[])):n.push(hy.of(t)),n}class age{constructor(e){this.markCache=Object.create(null),this.tree=vs(e.state),this.decorations=this.buildDeco(e,v1(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=vs(e.state),o=v1(e.state),r=o!=v1(e.startState),{viewport:i}=e.view,s=e.changes.mapPos(this.decoratedTo,1);n.length<i.to&&!r&&n.type==this.tree.type&&s>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=s):(n!=this.tree||e.viewportChanged||r)&&(this.tree=n,this.decorations=this.buildDeco(e.view,o),this.decoratedTo=i.to)}buildDeco(e,n){if(!n||!this.tree.length)return no.none;let o=new Pf;for(let{from:r,to:i}of e.visibleRanges)oB(this.tree,n,(s,a,l)=>{o.add(s,a,this.markCache[l]||(this.markCache[l]=no.mark({class:l})))},r,i);return o.finish()}}const lge=Tx.high(rc.fromClass(age,{decorations:t=>t.decorations})),cge=1e4,uge="()[]{}",dge=new Et;function py(t,e,n){let o=t.prop(e<0?Et.openedBy:Et.closedBy);if(o)return o;if(t.name.length==1){let r=n.indexOf(t.name);if(r>-1&&r%2==(e<0?1:0))return[n[r+e]]}return null}function my(t){let e=t.type.prop(dge);return e?e(t.node):t}function Wc(t,e,n,o={}){let r=o.maxScanDistance||cge,i=o.brackets||uge,s=vs(t),a=s.resolveInner(e,n);for(let l=a;l;l=l.parent){let c=py(l.type,n,i);if(c&&l.from<l.to){let u=my(l);if(u&&(n>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return fge(t,e,n,l,u,c,i)}}return hge(t,e,n,s,a.type,r,i)}function fge(t,e,n,o,r,i,s){let a=o.parent,l={from:r.from,to:r.to},c=0,u=a==null?void 0:a.cursor();if(u&&(n<0?u.childBefore(o.from):u.childAfter(o.to)))do if(n<0?u.to<=o.from:u.from>=o.to){if(c==0&&i.indexOf(u.type.name)>-1&&u.from<u.to){let d=my(u);return{start:l,end:d?{from:d.from,to:d.to}:void 0,matched:!0}}else if(py(u.type,n,s))c++;else if(py(u.type,-n,s)){if(c==0){let d=my(u);return{start:l,end:d&&d.from<d.to?{from:d.from,to:d.to}:void 0,matched:!1}}c--}}while(n<0?u.prevSibling():u.nextSibling());return{start:l,matched:!1}}function hge(t,e,n,o,r,i,s){let a=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),l=s.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?e-1:e,to:n>0?e+1:e},u=t.doc.iterRange(e,n>0?t.doc.length:0),d=0;for(let f=0;!u.next().done&&f<=i;){let h=u.value;n<0&&(f+=h.length);let m=e+f*n;for(let b=n>0?0:h.length-1,g=n>0?h.length:-1;b!=g;b+=n){let v=s.indexOf(h[b]);if(!(v<0||o.resolveInner(m+b,1).type!=r))if(v%2==0==n>0)d++;else{if(d==1)return{start:c,end:{from:m+b,to:m+b+1},matched:v>>1==l>>1};d--}}n>0&&(f+=h.length)}return u.done?{start:c,matched:!1}:null}const pge=Object.create(null),$S=[hr.none],TS=[],OS=Object.create(null),mge=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"]])mge[t]=gge(pge,e);function b1(t,e){TS.indexOf(t)>-1||(TS.push(t),console.warn(e))}function gge(t,e){let n=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let u=t[c]||at[c];u?typeof u=="function"?l.length?l=l.map(u):b1(c,`Modifier ${c} used at start of tag`):l.length?b1(c,`Tag ${c} used as modifier`):l=Array.isArray(u)?u:[u]:b1(c,`Unknown highlighting tag ${c}`)}for(let c of l)n.push(c)}if(!n.length)return 0;let o=e.replace(/ /g,"_"),r=o+" "+n.map(a=>a.id),i=OS[r];if(i)return i.id;let s=OS[r]=hr.define({id:$S.length,name:o,props:[eB({[o]:n})]});return $S.push(s),s.id}Nn.RTL,Nn.LTR;const vge=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),o=Kx(t.state,n.from);return o.line?bge(t):o.block?xge(t):!1};function jx(t,e){return({state:n,dispatch:o})=>{if(n.readOnly)return!1;let r=t(e,n);return r?(o(n.update(r)),!0):!1}}const bge=jx(kge,0),yge=jx(lB,0),xge=jx((t,e)=>lB(t,e,_ge(e)),0);function Kx(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const yd=50;function wge(t,{open:e,close:n},o,r){let i=t.sliceDoc(o-yd,o),s=t.sliceDoc(r,r+yd),a=/\s*$/.exec(i)[0].length,l=/^\s*/.exec(s)[0].length,c=i.length-a;if(i.slice(c-e.length,c)==e&&s.slice(l,l+n.length)==n)return{open:{pos:o-a,margin:a&&1},close:{pos:r+l,margin:l&&1}};let u,d;r-o<=2*yd?u=d=t.sliceDoc(o,r):(u=t.sliceDoc(o,o+yd),d=t.sliceDoc(r-yd,r));let f=/^\s*/.exec(u)[0].length,h=/\s*$/.exec(d)[0].length,m=d.length-h-n.length;return u.slice(f,f+e.length)==e&&d.slice(m,m+n.length)==n?{open:{pos:o+f+e.length,margin:/\s/.test(u.charAt(f+e.length))?1:0},close:{pos:r-h-n.length,margin:/\s/.test(d.charAt(m-1))?1:0}}:null}function _ge(t){let e=[];for(let n of t.selection.ranges){let o=t.doc.lineAt(n.from),r=n.to<=o.to?o:t.doc.lineAt(n.to);r.from>o.from&&r.from==n.to&&(r=n.to==o.to+1?o:t.doc.lineAt(n.to-1));let i=e.length-1;i>=0&&e[i].to>o.from?e[i].to=r.to:e.push({from:o.from+/^\s*/.exec(o.text)[0].length,to:r.to})}return e}function lB(t,e,n=e.selection.ranges){let o=n.map(i=>Kx(e,i.from).block);if(!o.every(i=>i))return null;let r=n.map((i,s)=>wge(e,o[s],i.from,i.to));if(t!=2&&!r.every(i=>i))return{changes:e.changes(n.map((i,s)=>r[s]?[]:[{from:i.from,insert:o[s].open+" "},{from:i.to,insert:" "+o[s].close}]))};if(t!=1&&r.some(i=>i)){let i=[];for(let s=0,a;s<r.length;s++)if(a=r[s]){let l=o[s],{open:c,close:u}=a;i.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+l.close.length})}return{changes:i}}return null}function kge(t,e,n=e.selection.ranges){let o=[],r=-1;e:for(let{from:i,to:s}of n){let a=o.length,l=1e9,c;for(let u=i;u<=s;){let d=e.doc.lineAt(u);if(c==null&&(c=Kx(e,d.from).line,!c))continue e;if(d.from>r&&(i==s||s>d.from)){r=d.from;let f=/^\s*/.exec(d.text)[0].length,h=f==d.length,m=d.text.slice(f,f+c.length)==c?f:-1;f<d.text.length&&f<l&&(l=f),o.push({line:d,comment:m,token:c,indent:f,empty:h,single:!1})}u=d.to+1}if(l<1e9)for(let u=a;u<o.length;u++)o[u].indent<o[u].line.text.length&&(o[u].indent=l);o.length==a+1&&(o[a].single=!0)}if(t!=2&&o.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:a,token:l,indent:c,empty:u,single:d}of o)(d||!u)&&i.push({from:a.from+c,insert:l+" "});let s=e.changes(i);return{changes:s,selection:e.selection.map(s,1)}}else if(t!=1&&o.some(i=>i.comment>=0)){let i=[];for(let{line:s,comment:a,token:l}of o)if(a>=0){let c=s.from+a,u=c+l.length;s.text[u-s.from]==" "&&u++,i.push({from:c,to:u})}return{changes:i}}return null}const gy=pl.define(),Sge=pl.define(),Cge=xt.define(),cB=xt.define({combine(t){return Dpe(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(o,r)=>e(o,r)||n(o,r)})}}),uB=hl.define({create(){return is.empty},update(t,e){let n=e.state.facet(cB),o=e.annotation(gy);if(o){let l=ur.fromTransaction(e,o.selection),c=o.side,u=c==0?t.undone:t.done;return l?u=J0(u,u.length,n.minDepth,l):u=hB(u,e.startState.selection),new is(c==0?o.rest:u,c==0?u:o.rest)}let r=e.annotation(Sge);if((r=="full"||r=="before")&&(t=t.isolate()),e.annotation(Zn.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=ur.fromTransaction(e),s=e.annotation(Zn.time),a=e.annotation(Zn.userEvent);return i?t=t.addChanges(i,s,a,n,e):e.selection&&(t=t.addSelection(e.startState.selection,s,a,n.newGroupDelay)),(r=="full"||r=="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 is(t.done.map(ur.fromJSON),t.undone.map(ur.fromJSON))}});function Age(t={}){return[uB,cB.of(t),At.domEventHandlers({beforeinput(e,n){let o=e.inputType=="historyUndo"?dB:e.inputType=="historyRedo"?vy:null;return o?(e.preventDefault(),o(n)):!1}})]}function Yg(t,e){return function({state:n,dispatch:o}){if(!e&&n.readOnly)return!1;let r=n.field(uB,!1);if(!r)return!1;let i=r.pop(t,n,e);return i?(o(i),!0):!1}}const dB=Yg(0,!1),vy=Yg(1,!1),$ge=Yg(0,!0),Tge=Yg(1,!0);class ur{constructor(e,n,o,r,i){this.changes=e,this.effects=n,this.mapped=o,this.startSelection=r,this.selectionsAfter=i}setSelAfter(e){return new ur(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,o;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:(o=this.startSelection)===null||o===void 0?void 0:o.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(e){return new ur(e.changes&&Kn.fromJSON(e.changes),[],e.mapped&&fs.fromJSON(e.mapped),e.startSelection&&Ye.fromJSON(e.startSelection),e.selectionsAfter.map(Ye.fromJSON))}static fromTransaction(e,n){let o=Gr;for(let r of e.startState.facet(Cge)){let i=r(e);i.length&&(o=o.concat(i))}return!o.length&&e.changes.empty?null:new ur(e.changes.invert(e.startState.doc),o,void 0,n||e.startState.selection,Gr)}static selection(e){return new ur(void 0,Gr,void 0,void 0,e)}}function J0(t,e,n,o){let r=e+1>n+20?e-n-1:0,i=t.slice(r,e);return i.push(o),i}function Oge(t,e){let n=[],o=!1;return t.iterChangedRanges((r,i)=>n.push(r,i)),e.iterChangedRanges((r,i,s,a)=>{for(let l=0;l<n.length;){let c=n[l++],u=n[l++];a>=c&&s<=u&&(o=!0)}}),o}function Mge(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,o)=>n.empty!=e.ranges[o].empty).length===0}function fB(t,e){return t.length?e.length?t.concat(e):t:e}const Gr=[],Bge=200;function hB(t,e){if(t.length){let n=t[t.length-1],o=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Bge));return o.length&&o[o.length-1].eq(e)?t:(o.push(e),J0(t,t.length-1,1e9,n.setSelAfter(o)))}else return[ur.selection([e])]}function Lge(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 y1(t,e){if(!t.length)return t;let n=t.length,o=Gr;for(;n;){let r=Pge(t[n-1],e,o);if(r.changes&&!r.changes.empty||r.effects.length){let i=t.slice(0,n);return i[n-1]=r,i}else e=r.mapped,n--,o=r.selectionsAfter}return o.length?[ur.selection(o)]:Gr}function Pge(t,e,n){let o=fB(t.selectionsAfter.length?t.selectionsAfter.map(a=>a.map(e)):Gr,n);if(!t.changes)return ur.selection(o);let r=t.changes.map(e),i=e.mapDesc(t.changes,!0),s=t.mapped?t.mapped.composeDesc(i):i;return new ur(r,Tn.mapEffects(t.effects,e),s,t.startSelection.map(i),o)}const Dge=/^(input\.type|delete)($|\.)/;class is{constructor(e,n,o=0,r=void 0){this.done=e,this.undone=n,this.prevTime=o,this.prevUserEvent=r}isolate(){return this.prevTime?new is(this.done,this.undone):this}addChanges(e,n,o,r,i){let s=this.done,a=s[s.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!o||Dge.test(o))&&(!a.selectionsAfter.length&&n-this.prevTime<r.newGroupDelay&&r.joinToEvent(i,Oge(a.changes,e.changes))||o=="input.type.compose")?s=J0(s,s.length-1,r.minDepth,new ur(e.changes.compose(a.changes),fB(Tn.mapEffects(e.effects,a.changes),a.effects),a.mapped,a.startSelection,Gr)):s=J0(s,s.length,r.minDepth,e),new is(s,Gr,n,o)}addSelection(e,n,o,r){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:Gr;return i.length>0&&n-this.prevTime<r&&o==this.prevUserEvent&&o&&/^select($|\.)/.test(o)&&Mge(i[i.length-1],e)?this:new is(hB(this.done,e),this.undone,n,o)}addMapping(e){return new is(y1(this.done,e),y1(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,o){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],s=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):n.selection);if(o&&i.selectionsAfter.length)return n.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:gy.of({side:e,rest:Lge(r),selection:s}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let a=r.length==1?Gr:r.slice(0,r.length-1);return i.mapped&&(a=y1(a,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:gy.of({side:e,rest:a,selection:s}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}is.empty=new is(Gr,Gr);const Ege=[{key:"Mod-z",run:dB,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:vy,preventDefault:!0},{linux:"Ctrl-Shift-z",run:vy,preventDefault:!0},{key:"Mod-u",run:$ge,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Tge,preventDefault:!0}];function Qu(t,e){return Ye.create(t.ranges.map(e),t.mainIndex)}function zi(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Hi({state:t,dispatch:e},n){let o=Qu(t.selection,n);return o.eq(t.selection,!0)?!1:(e(zi(t,o)),!0)}function jg(t,e){return Ye.cursor(e?t.to:t.from)}function pB(t,e){return Hi(t,n=>n.empty?t.moveByChar(n,e):jg(n,e))}function Eo(t){return t.textDirectionAt(t.state.selection.main.head)==Nn.LTR}const mB=t=>pB(t,!Eo(t)),gB=t=>pB(t,Eo(t));function vB(t,e){return Hi(t,n=>n.empty?t.moveByGroup(n,e):jg(n,e))}const Ige=t=>vB(t,!Eo(t)),Nge=t=>vB(t,Eo(t));function Rge(t,e,n){if(e.type.prop(n))return!0;let o=e.to-e.from;return o&&(o>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Kg(t,e,n){let o=vs(t).resolveInner(e.head),r=n?Et.closedBy:Et.openedBy;for(let l=e.head;;){let c=n?o.childAfter(l):o.childBefore(l);if(!c)break;Rge(t,c,r)?o=c:l=n?c.to:c.from}let i=o.type.prop(r),s,a;return i&&(s=n?Wc(t,o.from,1):Wc(t,o.to,-1))&&s.matched?a=n?s.end.to:s.end.from:a=n?o.to:o.from,Ye.cursor(a,n?-1:1)}const Fge=t=>Hi(t,e=>Kg(t.state,e,!Eo(t))),Vge=t=>Hi(t,e=>Kg(t.state,e,Eo(t)));function bB(t,e){return Hi(t,n=>{if(!n.empty)return jg(n,e);let o=t.moveVertically(n,e);return o.head!=n.head?o:t.moveToLineBoundary(n,e)})}const yB=t=>bB(t,!1),xB=t=>bB(t,!0);function wB(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,o=0,r;if(e){for(let i of t.state.facet(At.scrollMargins)){let s=i(t);s!=null&&s.top&&(n=Math.max(s==null?void 0:s.top,n)),s!=null&&s.bottom&&(o=Math.max(s==null?void 0:s.bottom,o))}r=t.scrollDOM.clientHeight-n-o}else r=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:o,selfScroll:e,height:Math.max(t.defaultLineHeight,r-5)}}function _B(t,e){let n=wB(t),{state:o}=t,r=Qu(o.selection,s=>s.empty?t.moveVertically(s,e,n.height):jg(s,e));if(r.eq(o.selection))return!1;let i;if(n.selfScroll){let s=t.coordsAtPos(o.selection.main.head),a=t.scrollDOM.getBoundingClientRect(),l=a.top+n.marginTop,c=a.bottom-n.marginBottom;s&&s.top>l&&s.bottom<c&&(i=At.scrollIntoView(r.main.head,{y:"start",yMargin:s.top-l}))}return t.dispatch(zi(o,r),{effects:i}),!0}const MS=t=>_B(t,!1),by=t=>_B(t,!0);function ml(t,e,n){let o=t.lineBlockAt(e.head),r=t.moveToLineBoundary(e,n);if(r.head==e.head&&r.head!=(n?o.to:o.from)&&(r=t.moveToLineBoundary(e,n,!1)),!n&&r.head==o.from&&o.length){let i=/^\s*/.exec(t.state.sliceDoc(o.from,Math.min(o.from+100,o.to)))[0].length;i&&e.head!=o.from+i&&(r=Ye.cursor(o.from+i))}return r}const zge=t=>Hi(t,e=>ml(t,e,!0)),Hge=t=>Hi(t,e=>ml(t,e,!1)),Wge=t=>Hi(t,e=>ml(t,e,!Eo(t))),Uge=t=>Hi(t,e=>ml(t,e,Eo(t))),Gge=t=>Hi(t,e=>Ye.cursor(t.lineBlockAt(e.head).from,1)),qge=t=>Hi(t,e=>Ye.cursor(t.lineBlockAt(e.head).to,-1));function Yge(t,e,n){let o=!1,r=Qu(t.selection,i=>{let s=Wc(t,i.head,-1)||Wc(t,i.head,1)||i.head>0&&Wc(t,i.head-1,1)||i.head<t.doc.length&&Wc(t,i.head+1,-1);if(!s||!s.end)return i;o=!0;let a=s.start.from==i.head?s.end.to:s.end.from;return Ye.cursor(a)});return o?(e(zi(t,r)),!0):!1}const jge=({state:t,dispatch:e})=>Yge(t,e);function si(t,e){let n=Qu(t.state.selection,o=>{let r=e(o);return Ye.range(o.anchor,r.head,r.goalColumn,r.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(zi(t.state,n)),!0)}function kB(t,e){return si(t,n=>t.moveByChar(n,e))}const SB=t=>kB(t,!Eo(t)),CB=t=>kB(t,Eo(t));function AB(t,e){return si(t,n=>t.moveByGroup(n,e))}const Kge=t=>AB(t,!Eo(t)),Xge=t=>AB(t,Eo(t)),Zge=t=>si(t,e=>Kg(t.state,e,!Eo(t))),Qge=t=>si(t,e=>Kg(t.state,e,Eo(t)));function $B(t,e){return si(t,n=>t.moveVertically(n,e))}const TB=t=>$B(t,!1),OB=t=>$B(t,!0);function MB(t,e){return si(t,n=>t.moveVertically(n,e,wB(t).height))}const BS=t=>MB(t,!1),LS=t=>MB(t,!0),Jge=t=>si(t,e=>ml(t,e,!0)),eve=t=>si(t,e=>ml(t,e,!1)),tve=t=>si(t,e=>ml(t,e,!Eo(t))),nve=t=>si(t,e=>ml(t,e,Eo(t))),ove=t=>si(t,e=>Ye.cursor(t.lineBlockAt(e.head).from)),rve=t=>si(t,e=>Ye.cursor(t.lineBlockAt(e.head).to)),PS=({state:t,dispatch:e})=>(e(zi(t,{anchor:0})),!0),DS=({state:t,dispatch:e})=>(e(zi(t,{anchor:t.doc.length})),!0),ES=({state:t,dispatch:e})=>(e(zi(t,{anchor:t.selection.main.anchor,head:0})),!0),IS=({state:t,dispatch:e})=>(e(zi(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),ive=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),sve=({state:t,dispatch:e})=>{let n=Xg(t).map(({from:o,to:r})=>Ye.range(o,Math.min(r+1,t.doc.length)));return e(t.update({selection:Ye.create(n),userEvent:"select"})),!0},ave=({state:t,dispatch:e})=>{let n=Qu(t.selection,o=>{let r=vs(t),i=r.resolveStack(o.from,1);if(o.empty){let s=r.resolveStack(o.from,-1);s.node.from>=i.node.from&&s.node.to<=i.node.to&&(i=s)}for(let s=i;s;s=s.next){let{node:a}=s;if((a.from<o.from&&a.to>=o.to||a.to>o.to&&a.from<=o.from)&&s.next)return Ye.range(a.to,a.from)}return o});return n.eq(t.selection)?!1:(e(zi(t,n)),!0)};function BB(t,e){let{state:n}=t,o=n.selection,r=n.selection.ranges.slice();for(let i of n.selection.ranges){let s=n.doc.lineAt(i.head);if(e?s.to<t.state.doc.length:s.from>0)for(let a=i;;){let l=t.moveVertically(a,e);if(l.head<s.from||l.head>s.to){r.some(c=>c.head==l.head)||r.push(l);break}else{if(l.head==a.head)break;a=l}}}return r.length==o.ranges.length?!1:(t.dispatch(zi(n,Ye.create(r,r.length-1))),!0)}const lve=t=>BB(t,!1),cve=t=>BB(t,!0),uve=({state:t,dispatch:e})=>{let n=t.selection,o=null;return n.ranges.length>1?o=Ye.create([n.main]):n.main.empty||(o=Ye.create([Ye.cursor(n.main.head)])),o?(e(zi(t,o)),!0):!1};function ah(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:o}=t,r=o.changeByRange(i=>{let{from:s,to:a}=i;if(s==a){let l=e(i);l<s?(n="delete.backward",l=ip(t,l,!1)):l>s&&(n="delete.forward",l=ip(t,l,!0)),s=Math.min(s,l),a=Math.max(a,l)}else s=ip(t,s,!1),a=ip(t,a,!0);return s==a?{range:i}:{changes:{from:s,to:a},range:Ye.cursor(s,s<i.head?-1:1)}});return r.changes.empty?!1:(t.dispatch(o.update(r,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?At.announce.of(o.phrase("Selection deleted")):void 0})),!0)}function ip(t,e,n){if(t instanceof At)for(let o of t.state.facet(At.atomicRanges).map(r=>r(t)))o.between(e,e,(r,i)=>{r<e&&i>e&&(e=n?i:r)});return e}const LB=(t,e,n)=>ah(t,o=>{let r=o.from,{state:i}=t,s=i.doc.lineAt(r),a,l;if(n&&!e&&r>s.from&&r<s.from+200&&!/[^ \t]/.test(a=s.text.slice(0,r-s.from))){if(a[a.length-1]==" ")return r-1;let c=Fg(a,i.tabSize),u=c%Z0(i)||Z0(i);for(let d=0;d<u&&a[a.length-1-d]==" ";d++)r--;l=r}else l=Po(s.text,r-s.from,e,e)+s.from,l==r&&s.number!=(e?i.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(s.text.slice(l-s.from,r-s.from))&&(l=Po(s.text,l-s.from,!1,!1)+s.from);return l}),yy=t=>LB(t,!1,!0),PB=t=>LB(t,!0,!1),DB=(t,e)=>ah(t,n=>{let o=n.head,{state:r}=t,i=r.doc.lineAt(o),s=r.charCategorizer(o);for(let a=null;;){if(o==(e?i.to:i.from)){o==n.head&&i.number!=(e?r.doc.lines:1)&&(o+=e?1:-1);break}let l=Po(i.text,o-i.from,e)+i.from,c=i.text.slice(Math.min(o,l)-i.from,Math.max(o,l)-i.from),u=s(c);if(a!=null&&u!=a)break;(c!=" "||o!=n.head)&&(a=u),o=l}return o}),EB=t=>DB(t,!1),dve=t=>DB(t,!0),fve=t=>ah(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),hve=t=>ah(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),pve=t=>ah(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),mve=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(o=>({changes:{from:o.from,to:o.to,insert:qt.of(["",""])},range:Ye.cursor(o.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},gve=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(o=>{if(!o.empty||o.from==0||o.from==t.doc.length)return{range:o};let r=o.from,i=t.doc.lineAt(r),s=r==i.from?r-1:Po(i.text,r-i.from,!1)+i.from,a=r==i.to?r+1:Po(i.text,r-i.from,!0)+i.from;return{changes:{from:s,to:a,insert:t.doc.slice(r,a).append(t.doc.slice(s,r))},range:Ye.cursor(a)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Xg(t){let e=[],n=-1;for(let o of t.selection.ranges){let r=t.doc.lineAt(o.from),i=t.doc.lineAt(o.to);if(!o.empty&&o.to==i.from&&(i=t.doc.lineAt(o.to-1)),n>=r.number){let s=e[e.length-1];s.to=i.to,s.ranges.push(o)}else e.push({from:r.from,to:i.to,ranges:[o]});n=i.number+1}return e}function IB(t,e,n){if(t.readOnly)return!1;let o=[],r=[];for(let i of Xg(t)){if(n?i.to==t.doc.length:i.from==0)continue;let s=t.doc.lineAt(n?i.to+1:i.from-1),a=s.length+1;if(n){o.push({from:i.to,to:s.to},{from:i.from,insert:s.text+t.lineBreak});for(let l of i.ranges)r.push(Ye.range(Math.min(t.doc.length,l.anchor+a),Math.min(t.doc.length,l.head+a)))}else{o.push({from:s.from,to:i.from},{from:i.to,insert:t.lineBreak+s.text});for(let l of i.ranges)r.push(Ye.range(l.anchor-a,l.head-a))}}return o.length?(e(t.update({changes:o,scrollIntoView:!0,selection:Ye.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const vve=({state:t,dispatch:e})=>IB(t,e,!1),bve=({state:t,dispatch:e})=>IB(t,e,!0);function NB(t,e,n){if(t.readOnly)return!1;let o=[];for(let i of Xg(t))n?o.push({from:i.from,insert:t.doc.slice(i.from,i.to)+t.lineBreak}):o.push({from:i.to,insert:t.lineBreak+t.doc.slice(i.from,i.to)});let r=t.changes(o);return e(t.update({changes:r,selection:t.selection.map(r,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const yve=({state:t,dispatch:e})=>NB(t,e,!1),xve=({state:t,dispatch:e})=>NB(t,e,!0),wve=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(Xg(e).map(({from:r,to:i})=>(r>0?r--:i<e.doc.length&&i++,{from:r,to:i}))),o=Qu(e.selection,r=>{let i;if(t.lineWrapping){let s=t.lineBlockAt(r.head),a=t.coordsAtPos(r.head,r.assoc||1);a&&(i=s.bottom+t.documentTop-a.bottom+t.defaultLineHeight/2)}return t.moveVertically(r,!0,i)}).map(n);return t.dispatch({changes:n,selection:o,scrollIntoView:!0,userEvent:"delete.line"}),!0};function _ve(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=vs(t).resolveInner(e),o=n.childBefore(e),r=n.childAfter(e),i;return o&&r&&o.to<=e&&r.from>=e&&(i=o.type.prop(Et.closedBy))&&i.indexOf(r.name)>-1&&t.doc.lineAt(o.to).from==t.doc.lineAt(r.from).from&&!/\S/.test(t.sliceDoc(o.to,r.from))?{from:o.to,to:r.from}:null}const NS=RB(!1),kve=RB(!0);function RB(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let o=e.changeByRange(r=>{let{from:i,to:s}=r,a=e.doc.lineAt(i),l=!t&&i==s&&_ve(e,i);t&&(i=s=(s<=a.to?a:e.doc.lineAt(s)).to);let c=new qg(e,{simulateBreak:i,simulateDoubleBreak:!!l}),u=sB(c,i);for(u==null&&(u=Fg(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));s<a.to&&/\s/.test(a.text[s-a.from]);)s++;l?{from:i,to:s}=l:i>a.from&&i<a.from+100&&!/\S/.test(a.text.slice(0,i))&&(i=a.from);let d=["",Q0(e,u)];return l&&d.push(Q0(e,c.lineIndent(a.from,-1))),{changes:{from:i,to:s,insert:qt.of(d)},range:Ye.cursor(i+1+d[1].length)}});return n(e.update(o,{scrollIntoView:!0,userEvent:"input"})),!0}}function Xx(t,e){let n=-1;return t.changeByRange(o=>{let r=[];for(let s=o.from;s<=o.to;){let a=t.doc.lineAt(s);a.number>n&&(o.empty||o.to>a.from)&&(e(a,r,o),n=a.number),s=a.to+1}let i=t.changes(r);return{changes:r,range:Ye.range(i.mapPos(o.anchor,1),i.mapPos(o.head,1))}})}const Sve=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),o=new qg(t,{overrideIndentation:i=>{let s=n[i];return s??-1}}),r=Xx(t,(i,s,a)=>{let l=sB(o,i.from);if(l==null)return;/\S/.test(i.text)||(l=0);let c=/^\s*/.exec(i.text)[0],u=Q0(t,l);(c!=u||a.from<i.from+c.length)&&(n[i.from]=l,s.push({from:i.from,to:i.from+c.length,insert:u}))});return r.changes.empty||e(t.update(r,{userEvent:"indent"})),!0},Cve=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Xx(t,(n,o)=>{o.push({from:n.from,insert:t.facet(Gx)})}),{userEvent:"input.indent"})),!0),Ave=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Xx(t,(n,o)=>{let r=/^\s*/.exec(n.text)[0];if(!r)return;let i=Fg(r,t.tabSize),s=0,a=Q0(t,Math.max(0,i-Z0(t)));for(;s<r.length&&s<a.length&&r.charCodeAt(s)==a.charCodeAt(s);)s++;o.push({from:n.from+s,to:n.from+r.length,insert:a.slice(s)})}),{userEvent:"delete.dedent"})),!0),$ve=t=>(t.setTabFocusMode(),!0),Tve=[{key:"Ctrl-b",run:mB,shift:SB,preventDefault:!0},{key:"Ctrl-f",run:gB,shift:CB},{key:"Ctrl-p",run:yB,shift:TB},{key:"Ctrl-n",run:xB,shift:OB},{key:"Ctrl-a",run:Gge,shift:ove},{key:"Ctrl-e",run:qge,shift:rve},{key:"Ctrl-d",run:PB},{key:"Ctrl-h",run:yy},{key:"Ctrl-k",run:fve},{key:"Ctrl-Alt-h",run:EB},{key:"Ctrl-o",run:mve},{key:"Ctrl-t",run:gve},{key:"Ctrl-v",run:by}],Ove=[{key:"ArrowLeft",run:mB,shift:SB,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Ige,shift:Kge,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Wge,shift:tve,preventDefault:!0},{key:"ArrowRight",run:gB,shift:CB,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Nge,shift:Xge,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Uge,shift:nve,preventDefault:!0},{key:"ArrowUp",run:yB,shift:TB,preventDefault:!0},{mac:"Cmd-ArrowUp",run:PS,shift:ES},{mac:"Ctrl-ArrowUp",run:MS,shift:BS},{key:"ArrowDown",run:xB,shift:OB,preventDefault:!0},{mac:"Cmd-ArrowDown",run:DS,shift:IS},{mac:"Ctrl-ArrowDown",run:by,shift:LS},{key:"PageUp",run:MS,shift:BS},{key:"PageDown",run:by,shift:LS},{key:"Home",run:Hge,shift:eve,preventDefault:!0},{key:"Mod-Home",run:PS,shift:ES},{key:"End",run:zge,shift:Jge,preventDefault:!0},{key:"Mod-End",run:DS,shift:IS},{key:"Enter",run:NS,shift:NS},{key:"Mod-a",run:ive},{key:"Backspace",run:yy,shift:yy,preventDefault:!0},{key:"Delete",run:PB,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:EB,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:dve,preventDefault:!0},{mac:"Mod-Backspace",run:hve,preventDefault:!0},{mac:"Mod-Delete",run:pve,preventDefault:!0}].concat(Tve.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),Mve=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Fge,shift:Zge},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Vge,shift:Qge},{key:"Alt-ArrowUp",run:vve},{key:"Shift-Alt-ArrowUp",run:yve},{key:"Alt-ArrowDown",run:bve},{key:"Shift-Alt-ArrowDown",run:xve},{key:"Mod-Alt-ArrowUp",run:lve},{key:"Mod-Alt-ArrowDown",run:cve},{key:"Escape",run:uve},{key:"Mod-Enter",run:kve},{key:"Alt-l",mac:"Ctrl-l",run:sve},{key:"Mod-i",run:ave,preventDefault:!0},{key:"Mod-[",run:Ave},{key:"Mod-]",run:Cve},{key:"Mod-Alt-\\",run:Sve},{key:"Shift-Mod-k",run:wve},{key:"Shift-Mod-\\",run:jge},{key:"Mod-/",run:vge},{key:"Alt-A",run:yge},{key:"Ctrl-m",mac:"Shift-Alt-m",run:$ve}].concat(Ove);var RS={};class em{constructor(e,n,o,r,i,s,a,l,c,u=0,d){this.p=e,this.stack=n,this.state=o,this.reducePos=r,this.pos=i,this.score=s,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=u,this.parent=d}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,o=0){let r=e.parser.context;return new em(e,[],n,o,o,0,[],0,r?new FS(r,r.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 o=e>>19,r=e&65535,{parser:i}=this.p,s=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),a=i.dynamicPrecedence(r);if(a&&(this.score+=a),o==0){this.pushState(i.getGoto(this.state,r,!0),this.reducePos),r<i.minRepeatTerm&&this.storeNode(r,this.reducePos,this.reducePos,s?8:4,!0),this.reduceContext(r,this.reducePos);return}let l=this.stack.length-(o-1)*3-(e&262144?6:0),c=l?this.stack[l-2]:this.p.ranges[0].from,u=this.reducePos-c;u>=2e3&&!(!((n=this.p.parser.nodeSet.types[r])===null||n===void 0)&&n.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=u):this.p.lastBigReductionSize<u&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=c,this.p.lastBigReductionSize=u));let d=l?this.stack[l-1]:0,f=this.bufferBase+this.buffer.length-d;if(r<i.minRepeatTerm||e&131072){let h=i.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,c,h,f+4,!0)}if(e&262144)this.state=this.stack[l];else{let h=this.stack[l-3];this.state=i.getGoto(h,r,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(r,c)}storeNode(e,n,o,r=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let s=this,a=this.buffer.length;if(a==0&&s.parent&&(a=s.bufferBase-s.parent.bufferBase,s=s.parent),a>0&&s.buffer[a-4]==0&&s.buffer[a-1]>-1){if(n==o)return;if(s.buffer[a-2]>=n){s.buffer[a-2]=o;return}}}if(!i||this.pos==o)this.buffer.push(e,n,o,r);else{let s=this.buffer.length;if(s>0&&(this.buffer[s-4]!=0||this.buffer[s-1]<0)){let a=!1;for(let l=s;l>0&&this.buffer[l-2]>o;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;s>0&&this.buffer[s-2]>o;)this.buffer[s]=this.buffer[s-4],this.buffer[s+1]=this.buffer[s-3],this.buffer[s+2]=this.buffer[s-2],this.buffer[s+3]=this.buffer[s-1],s-=4,r>4&&(r-=4)}this.buffer[s]=e,this.buffer[s+1]=n,this.buffer[s+2]=o,this.buffer[s+3]=r}}shift(e,n,o,r){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let i=e,{parser:s}=this.p;this.pos=r;let a=s.stateFlag(i,1);!a&&(r>o||n<=s.maxNode)&&(this.reducePos=r),this.pushState(i,a?o:Math.min(o,this.reducePos)),this.shiftContext(n,o),n<=s.maxNode&&this.buffer.push(n,o,r,4)}else this.pos=r,this.shiftContext(n,o),n<=this.p.parser.maxNode&&this.buffer.push(n,o,r,4)}apply(e,n,o,r){e&65536?this.reduce(e):this.shift(e,n,o,r)}useNode(e,n){let o=this.p.reused.length-1;(o<0||this.p.reused[o]!=e)&&(this.p.reused.push(e),o++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(n,r),this.buffer.push(o,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let o=e.buffer.slice(n),r=e.bufferBase+n;for(;e&&r==e.bufferBase;)e=e.parent;return new em(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,o,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let o=e<=this.p.parser.maxNode;o&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,o?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new Bve(this);;){let o=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(o==0)return!1;if((o&65536)==0)return!0;n.reduce(o)}}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 r=[];for(let i=0,s;i<n.length;i+=2)(s=n[i+1])!=this.state&&this.p.parser.hasAction(s,e)&&r.push(n[i],s);if(this.stack.length<120)for(let i=0;r.length<8&&i<n.length;i+=2){let s=n[i+1];r.some((a,l)=>l&1&&a==s)||r.push(n[i],s)}n=r}let o=[];for(let r=0;r<n.length&&o.length<4;r+=2){let i=n[r+1];if(i==this.state)continue;let s=this.split();s.pushState(i,this.pos),s.storeNode(0,s.pos,s.pos,4,!0),s.shiftContext(n[r],this.pos),s.reducePos=this.pos,s.score-=200,o.push(s)}return o}forceReduce(){let{parser:e}=this.p,n=e.stateSlot(this.state,5);if((n&65536)==0)return!1;if(!e.validAction(this.state,n)){let o=n>>19,r=n&65535,i=this.stack.length-o*3;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let s=this.findForcedReduction();if(s==null)return!1;n=s}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=[],o=(r,i)=>{if(!n.includes(r))return n.push(r),e.allActions(r,s=>{if(!(s&393216))if(s&65536){let a=(s>>19)-i;if(a>1){let l=s&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=o(s,i+1);if(a!=null)return a}})};return o(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;n<this.stack.length;n+=3)if(this.stack[n]!=e.stack[n])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(n)))}reduceContext(e,n){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(n)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let n=new FS(this.curContext.tracker,e);n.hash!=this.curContext.hash&&this.emitContext(),this.curContext=n}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class FS{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class Bve{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,o=e>>19;o==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(o-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=r}}class tm{constructor(e,n,o){this.stack=e,this.pos=n,this.index=o,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new tm(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 tm(this.stack,this.pos,this.index)}}function sp(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let o=0,r=0;o<t.length;){let i=0;for(;;){let s=t.charCodeAt(o++),a=!1;if(s==126){i=65535;break}s>=92&&s--,s>=34&&s--;let l=s-32;if(l>=46&&(l-=46,a=!0),i+=l,a)break;i*=46}n?n[r++]=i:n=new e(i)}return n}class Mp{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const VS=new Mp;class Lve{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=VS,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 o=this.range,r=this.rangeIndex,i=this.pos+e;for(;i<o.from;){if(!r)return null;let s=this.ranges[--r];i-=o.from-s.to,o=s}for(;n<0?i>o.to:i>=o.to;){if(r==this.ranges.length-1)return null;let s=this.ranges[++r];i+=s.from-o.to,o=s}return i}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let n of this.ranges)if(n.to>e)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,o,r;if(n>=0&&n<this.chunk.length)o=this.pos+e,r=this.chunk.charCodeAt(n);else{let i=this.resolveOffset(e,1);if(i==null)return-1;if(o=i,o>=this.chunk2Pos&&o<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(o-this.chunk2Pos);else{let s=this.rangeIndex,a=this.range;for(;a.to<=o;)a=this.ranges[++s];this.chunk2=this.input.chunk(this.chunk2Pos=o),o+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-o)),r=this.chunk2.charCodeAt(0)}}return o>=this.token.lookAhead&&(this.token.lookAhead=o+1),r}acceptToken(e,n=0){let o=n?this.resolveOffset(n,-1):this.pos;if(o==null||o<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=o}acceptTokenTo(e,n){this.token.value=e,this.token.end=n}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:n}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=n,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),n=this.pos+e.length;this.chunk=n>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=VS,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,n){if(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 o="";for(let r of this.ranges){if(r.from>=n)break;r.to>e&&(o+=this.input.read(Math.max(r.from,e),Math.min(r.to,n)))}return o}}class su{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:o}=n.p;Pve(this.data,e,n,this.id,o.data,o.tokenPrecTable)}}su.prototype.contextual=su.prototype.fallback=su.prototype.extend=!1;su.prototype.fallback=su.prototype.extend=!1;function Pve(t,e,n,o,r,i){let s=0,a=1<<o,{dialect:l}=n.p.parser;e:for(;(a&t[s])!=0;){let c=t[s+1];for(let h=s+3;h<c;h+=2)if((t[h+1]&a)>0){let m=t[h];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||Dve(m,e.token.value,r,i))){e.acceptToken(m);break}}let u=e.next,d=0,f=t[s+2];if(e.next<0&&f>d&&t[c+f*3-3]==65535){s=t[c+f*3-1];continue e}for(;d<f;){let h=d+f>>1,m=c+h+(h<<1),b=t[m],g=t[m+1]||65536;if(u<b)f=h;else if(u>=g)d=h+1;else{s=t[m+2],e.advance();continue e}}break}}function zS(t,e,n){for(let o=e,r;(r=t[o])!=65535;o++)if(r==n)return o-e;return-1}function Dve(t,e,n,o){let r=zS(n,o,e);return r<0||zS(n,o,t)<r}const vr=typeof process<"u"&&RS&&/\bparse\b/.test(RS.LOG);let x1=null;function HS(t,e,n){let o=t.cursor(_n.IncludeAnonymous);for(o.moveTo(e);;)if(!(n<0?o.childBefore(e):o.childAfter(e)))for(;;){if((n<0?o.to<e:o.from>e)&&!o.type.isError)return n<0?Math.max(0,Math.min(o.to-1,e-25)):Math.min(t.length,Math.max(o.from+1,e+25));if(n<0?o.prevSibling():o.nextSibling())break;if(!o.parent())return n<0?0:t.length}}class Eve{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?HS(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?HS(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let n=this.trees.length-1;if(n<0)return this.nextFragment(),null;let o=this.trees[n],r=this.index[n];if(r==o.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let i=o.children[r],s=this.start[n]+o.positions[r];if(s>e)return this.nextStart=s,null;if(i instanceof On){if(s==e){if(s<this.safeFrom)return null;let a=s+i.length;if(a<=this.safeTo){let l=i.prop(Et.lookAhead);if(!l||a+l<this.fragment.to)return i}}this.index[n]++,s+i.length>=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(s),this.index.push(0))}else this.index[n]++,this.nextStart=s+i.length}}}class Ive{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(o=>new Mp)}getActions(e){let n=0,o=null,{parser:r}=e.p,{tokenizers:i}=r,s=r.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<i.length;c++){if((1<<c&s)==0)continue;let u=i[c],d=this.tokens[c];if(!(o&&!u.fallback)&&((u.contextual||d.start!=e.pos||d.mask!=s||d.context!=a)&&(this.updateCachedToken(d,u,e),d.mask=s,d.context=a),d.lookAhead>d.end+25&&(l=Math.max(d.lookAhead,l)),d.value!=0)){let f=n;if(d.extended>-1&&(n=this.addActions(e,d.extended,d.end,n)),n=this.addActions(e,d.value,d.end,n),!u.extend&&(o=d,n>f))break}}for(;this.actions.length>n;)this.actions.pop();return l&&e.setLookAhead(l),!o&&e.pos==this.stream.end&&(o=new Mp,o.value=e.p.parser.eofTerm,o.start=o.end=e.pos,n=this.addActions(e,o.value,o.end,n)),this.mainToken=o,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new Mp,{pos:o,p:r}=e;return n.start=o,n.end=Math.min(o+1,r.stream.end),n.value=o==r.stream.end?r.parser.eofTerm:0,n}updateCachedToken(e,n,o){let r=this.stream.clipPos(o.pos);if(n.token(this.stream.reset(r,e),o),e.value>-1){let{parser:i}=o.p;for(let s=0;s<i.specialized.length;s++)if(i.specialized[s]==e.value){let a=i.specializers[s](this.stream.read(e.start,e.end),o);if(a>=0&&o.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(r+1)}putAction(e,n,o,r){for(let i=0;i<r;i+=3)if(this.actions[i]==e)return r;return this.actions[r++]=e,this.actions[r++]=n,this.actions[r++]=o,r}addActions(e,n,o,r){let{state:i}=e,{parser:s}=e.p,{data:a}=s;for(let l=0;l<2;l++)for(let c=s.stateSlot(i,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=Vs(a,c+2);else{r==0&&a[c+1]==2&&(r=this.putAction(Vs(a,c+2),n,o,r));break}a[c]==n&&(r=this.putAction(Vs(a,c+1),n,o,r))}return r}}class Nve{constructor(e,n,o,r){this.parser=e,this.input=n,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Lve(n,r),this.tokens=new Ive(e,this.stream),this.topTerm=e.top[1];let{from:i}=r[0];this.stacks=[em.start(this,e.top[0],i)],this.fragments=o.length&&this.stream.end-i>e.bufferLength*4?new Eve(o,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,o=this.stacks=[],r,i;if(this.bigReductionCount>300&&e.length==1){let[s]=e;for(;s.forceReduce()&&s.stack.length&&s.stack[s.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;s<e.length;s++){let a=e[s];for(;;){if(this.tokens.mainToken=null,a.pos>n)o.push(a);else{if(this.advanceStack(a,o,e))continue;{r||(r=[],i=[]),r.push(a);let l=this.tokens.getMainToken(a);i.push(l.value,l.end)}}break}}if(!o.length){let s=r&&Fve(r);if(s)return vr&&console.log("Finish with "+this.stackID(s)),this.stackToTree(s);if(this.parser.strict)throw vr&&r&&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&&r){let s=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,o);if(s)return vr&&console.log("Force-finish "+this.stackID(s)),this.stackToTree(s.forceAll())}if(this.recovering){let s=this.recovering==1?1:this.recovering*3;if(o.length>s)for(o.sort((a,l)=>l.score-a.score);o.length>s;)o.pop();o.some(a=>a.reducePos>n)&&this.recovering--}else if(o.length>1){e:for(let s=0;s<o.length-1;s++){let a=o[s];for(let l=s+1;l<o.length;l++){let c=o[l];if(a.sameState(c)||a.buffer.length>500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)o.splice(l--,1);else{o.splice(s--,1);continue e}}}o.length>12&&(o.sort((s,a)=>a.score-s.score),o.splice(12,o.length-12))}this.minStackPos=o[0].pos;for(let s=1;s<o.length;s++)o[s].pos<this.minStackPos&&(this.minStackPos=o[s].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,n,o){let r=e.pos,{parser:i}=this,s=vr?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,u=c?e.curContext.hash:0;for(let d=this.fragments.nodeAt(r);d;){let f=this.parser.nodeSet.types[d.type.id]==d.type?i.getGoto(e.state,d.type.id):-1;if(f>-1&&d.length&&(!c||(d.prop(Et.contextHash)||0)==u))return e.useNode(d,f),vr&&console.log(s+this.stackID(e)+` (via reuse of ${i.getName(d.type.id)})`),!0;if(!(d instanceof On)||d.children.length==0||d.positions[0]>0)break;let h=d.children[0];if(h instanceof On&&d.positions[0]==0)d=h;else break}}let a=i.stateSlot(e.state,4);if(a>0)return e.reduce(a),vr&&console.log(s+this.stackID(e)+` (via always-reduce ${i.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let u=l[c++],d=l[c++],f=l[c++],h=c==l.length||!o,m=h?e:e.split(),b=this.tokens.mainToken;if(m.apply(u,d,b?b.start:m.pos,f),vr&&console.log(s+this.stackID(m)+` (via ${(u&65536)==0?"shift":`reduce of ${i.getName(u&65535)}`} for ${i.getName(d)} @ ${r}${m==e?"":", split"})`),h)return!0;m.pos>r?n.push(m):o.push(m)}return!1}advanceFully(e,n){let o=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>o)return WS(e,n),!0}}runRecovery(e,n,o){let r=null,i=!1;for(let s=0;s<e.length;s++){let a=e[s],l=n[s<<1],c=n[(s<<1)+1],u=vr?this.stackID(a)+" -> ":"";if(a.deadEnd&&(i||(i=!0,a.restart(),vr&&console.log(u+this.stackID(a)+" (restarted)"),this.advanceFully(a,o))))continue;let d=a.split(),f=u;for(let h=0;h<10&&d.forceReduce()&&(vr&&console.log(f+this.stackID(d)+" (via force-reduce)"),!this.advanceFully(d,o));h++)vr&&(f=this.stackID(d)+" -> ");for(let h of a.recoverByInsert(l))vr&&console.log(u+this.stackID(h)+" (via recover-insert)"),this.advanceFully(h,o);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),vr&&console.log(u+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),WS(a,o)):(!r||r.score<d.score)&&(r=d)}return r}stackToTree(e){return e.close(),On.build({buffer:tm.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let n=(x1||(x1=new WeakMap)).get(e);return n||x1.set(e,n=String.fromCodePoint(this.nextStackID++)),n+e}}function WS(t,e){for(let n=0;n<e.length;n++){let o=e[n];if(o.pos==t.pos&&o.sameState(t)){e[n].score<t.score&&(e[n]=t);return}}e.push(t)}class Rve{constructor(e,n,o){this.source=e,this.flags=n,this.disabled=o}allows(e){return!this.disabled||this.disabled[e]==0}}class nm extends JM{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;a<e.repeatNodeCount;a++)n.push("");let o=Object.keys(e.topRules).map(a=>e.topRules[a][1]),r=[];for(let a=0;a<n.length;a++)r.push([]);function i(a,l,c){r[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=Et[l]);for(let c=1;c<a.length;){let u=a[c++];if(u>=0)i(u,l,a[c++]);else{let d=a[c+-u];for(let f=-u;f>0;f--)i(a[c++],l,d);c++}}}this.nodeSet=new zx(n.map((a,l)=>hr.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:r[l],top:o.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=KM;let s=sp(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(US),this.states=sp(e.states,Uint32Array),this.data=sp(e.stateData),this.goto=sp(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new su(s,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,o){let r=new Nve(this,e,n,o);for(let i of this.wrappers)r=i(r,e,n,o);return r}getGoto(e,n,o=!1){let r=this.goto;if(n>=r[0])return-1;for(let i=r[n+1];;){let s=r[i++],a=s&1,l=r[i++];if(a&&o)return l;for(let c=i+(s>>1);i<c;i++)if(r[i]==e)return l;if(a)return-1}}hasAction(e,n){let o=this.data;for(let r=0;r<2;r++)for(let i=this.stateSlot(e,r?2:1),s;;i+=3){if((s=o[i])==65535)if(o[i+1]==1)s=o[i=Vs(o,i+2)];else{if(o[i+1]==2)return Vs(o,i+2);break}if(s==n||s==0)return Vs(o,i+1)}return 0}stateSlot(e,n){return this.states[e*6+n]}stateFlag(e,n){return(this.stateSlot(e,0)&n)>0}validAction(e,n){return!!this.allActions(e,o=>o==n?!0:null)}allActions(e,n){let o=this.stateSlot(e,4),r=o?n(o):void 0;for(let i=this.stateSlot(e,1);r==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=Vs(this.data,i+2);else break;r=n(Vs(this.data,i+1))}return r}nextStates(e){let n=[];for(let o=this.stateSlot(e,1);;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=Vs(this.data,o+2);else break;if((this.data[o+2]&1)==0){let r=this.data[o+1];n.some((i,s)=>s&1&&i==r)||n.push(this.data[o],r)}}return n}configure(e){let n=Object.assign(Object.create(nm.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let o=this.topRules[e.top];if(!o)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=o}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(o=>{let r=e.tokenizers.find(i=>i.from==o);return r?r.to:o})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((o,r)=>{let i=e.specializers.find(a=>a.from==o.external);if(!i)return o;let s=Object.assign(Object.assign({},o),{external:i.to});return n.specializers[r]=US(s),s})),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),o=n.map(()=>!1);if(e)for(let i of e.split(" ")){let s=n.indexOf(i);s>=0&&(o[s]=!0)}let r=null;for(let i=0;i<n.length;i++)if(!o[i])for(let s=this.dialects[n[i]],a;(a=this.data[s++])!=65535;)(r||(r=new Uint8Array(this.maxTerm+1)))[a]=1;return new Rve(e,o,r)}static deserialize(e){return new nm(e)}}function Vs(t,e){return t[e]|t[e+1]<<16}function Fve(t){let e=null;for(let n of t){let o=n.p.stoppedAt;(n.pos==n.p.stream.end||o!=null&&n.pos>o)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.score<n.score)&&(e=n)}return e}function US(t){if(t.external){let e=t.extend?1:0;return(n,o)=>t.external(n,o)<<1|e}return t.get}const Vve={__proto__:null,chart:12,data:18,colorize:40,highlight:42,"area-fill":46,range:50,note:55,annotation:58,"hide-annotation":62,"show-annotation":64,"hide-range":66,"show-range":68,"hide-note":70,"show-note":72,series:77,scene:80,transform:86},zve=nm.deserialize({version:14,states:",lO]QPOOQOQPOOObQPO'#C`OgQPO,58zO!vQPO1G.fOOQO'#Cg'#CgO!}QPO'#CnOOQO'#Cc'#CcOOQO'#DY'#DYO#SQPO7+$QO#ZQPO'#CdO#`QPO'#CoO#eQPO'#CrO#jQPO'#CtO#oQPO'#CvO#tQPO'#CxO#yQPO'#CzO$OQPO'#DRO$TQPO'#DWO$YQPO'#DTOOQO7+$Q7+$QO$bQPO,59YOOQO-E7W-E7WOOQO<<Gl<<GlO$pQPO,59OO${QPO,59ZO&]QPO,59^O&bQPO,59`O&mQPO,59bO&xQPO,59dOOQO,59f,59fO&}QPO,59mO'SQPO,59rO(`QPO,59oO(gQPO,59oOOQO'#Ck'#CkOOQO1G.t1G.tO(lQPO'#CnOOQO'#Cf'#CfOOQO'#DZ'#DZO(qQPO1G.jOOQO1G.j1G.jO(|QPO1G.uO)XQPO1G.xOOQO'#D]'#D]O)^QPO1G.zOOQO1G.z1G.zO)iQPO1G.|OOQO1G.|1G.|O)tQPO1G/OO*PQPO1G/XO*[QPO1G/^OOQO'#DV'#DVOOQO'#D^'#D^O*gQPO1G/ZOOQO1G/Z1G/ZO*gQPO1G/ZO$bQPO,59YOOQO-E7X-E7XOOQO7+$U7+$UO*nQPO7+$aOOQO7+$a7+$aO*yQPO7+$dOOQO-E7Z-E7ZOOQO7+$f7+$fOOQO7+$h7+$hO+UQPO7+$jOOQO7+$j7+$jO+aQPO7+$sOOQO7+$s7+$sO+lQPO7+$xOOQO7+$x7+$xOOQO-E7[-E7[OOQO7+$u7+$uO+wQPO7+$uO,OQPO1G.tOOQO1G.l1G.lOOQO<<G{<<G{O,^QPO<<HOOOQO<<HO<<HOOOQO<<HU<<HUOOQO<<H_<<H_OOQO<<Hd<<HdOOQO<<Ha<<HaO$bQPO'#D[O,iQPO,59UOOQOAN=jAN=jOOQO,59v,59vOOQO-E7Y-E7Y",stateData:"-O~O!TOSPOSQOS~OUQO~OTRO~O!USO~OTTOXYO[TOdZOeZOg[Oi]Ok^Om_Oo`Op`Oq`Or`Os`Ot`OvaOxcO{bO~O!WdO~PlO]eO~O!WgO~PlO!UhO~O[iO~O[jO~O!UkO~O!UlO~O[mO~O[nO~O[oO~OTpO~O[rO!UqO~OTsO[sO`sOasO~OTTO[TO!WyO~O!UzOTcaXca[cadcaecagcaicakcamcaocapcaqcarcascatcavcaxca{ca!Wca~O[{O~OTTO[TO!W!OO~OTTO[TO!W!QO~O!U!RO~O!U!SO~O!U!TO~OTTOXYO[TOdZOeZOg[Oi]Ok^Om_Oo`Op`Oq`Or`Os`Ot`OvaO{bO~O!W!XO~P'XO!U!YO~O]!ZO~OTTO[TO!W!]O~OTTO[TO!W!_O~O!U!`O~OTTO[TO!W!bO~OTTO[TO!W!cO~OTTO[TO!W!eO~OTTO[TO!W!gO~OTTO[TO!W!iO~O!W!kO~P'XOTTO[TO!W!oO~OTTO[TO!W!qO~OTTO[TO!W!rO~OTTO[TO!W!sO~OTTO[TO!W!tO~O!W!uO~P'XO!V!vOTbi[bi!Wbi~OTTO[TO!W!xO~O!V!vOT^a[^a!W^a~O`aQPTQ~",goto:"%g!RPPPP!SPP!V!ZP!e!iPP#T#WPP#a!ZPP!ZP!ZP!ZP!ZP!ZPPPPPP!ZP$PP$T!ZP$Z$a$g$m%]RPOTWSXSVSXX!Uq!W!Y!lTwhxxUSXklqz}!P!R!S!T!W!Y!^!`!d!f!h!l!pTuhxR!n!ZQteQ!m!ZR!y!vSVSXSvhxl|klz}!P!R!S!T!^!`!d!f!h!pX!Uq!W!Y!lTVSXX!Vq!W!Y!lQXSRfXQxhR![xQ!w!mR!z!wQ}kQ!PlQ!^z^!a}!P!^!d!f!h!pQ!d!RQ!f!SQ!h!TR!p!`Q!WqS!j!W!lR!l!Y",nodeNames:"⚠ LineComment BlockComment Chart ChartDecl Identifier chart ChartMember DataBlock data DataEntry PropertyKey String Equals ValueList PropertyValue Percentage Number Property Colorize colorize highlight AreaFill area-fill RangeAnnotation range NoteAnnotation note Annotation annotation VisibilityDirective hide-annotation show-annotation hide-range show-range hide-note show-note Series series Scene scene SceneMember Transform transform",maxTerm:54,skippedNodes:[0,1,2],repeatNodeCount:5,tokenData:"*f~RgX^!jpq!jrs#_st$x|}%a}!O%f!O!P%o!P!Q'`!Q![&z!_!`*V!c!}$x#R#S$x#T#o$x#o#p*[#q#r*a#y#z!j$f$g!j#BY#BZ!j$IS$I_!j$I|$JO!j$JT$JU!j$KV$KW!j&FU&FV!j~!oY!T~X^!jpq!j#y#z!j$f$g!j#BY#BZ!j$IS$I_!j$I|$JO!j$JT$JU!j$KV$KW!j&FU&FV!j~#bVOr#_rs#ws#O#_#O#P#|#P;'S#_;'S;=`$r<%lO#_~#|O[~~$PZOr#_rs#_s#O#_#O#P#_#P#b#_#b#c#_#c#h#_#h#i#_#i;'S#_;'S;=`$r<%lO#_~$uP;=`<%l#_~$}UT~st$x}!O$x!Q![$x!c!}$x#R#S$x#T#o$x~%fO!V~~%iQ!O!P%o!Q![&z~%rP!Q![%u~%zSa~uv&W!Q![%u!g!h&]#X#Y&]~&]O`~~&`R{|&i}!O&i!Q![&o~&lP!Q![&o~&tQa~uv&W!Q![&o~'PTa~uv&W!O!P%u!Q![&z!g!h&]#X#Y&]~'cQz{'i!P!Q)n~'lTOz'iz{'{{;'S'i;'S;=`)c<%lO'i~(OVOz'iz{(e{!P'i!P!Q)i!Q;'S'i;'S;=`)c<%lO'i~(hVOz'iz{'{{!P'i!P!Q(}!Q;'S'i;'S;=`)c<%lO'i~)STQ~Oz'iz{'{{;'S'i;'S;=`)c<%lO'i~)fP;=`<%l'i~)nOQ~~)sSP~OY)nZ;'S)n;'S;=`*P<%lO)n~*SP;=`<%l)n~*[O]~~*aO!U~~*fO!W~",tokenizers:[0],topRules:{Chart:[0,3]},specialized:[{term:5,get:t=>Vve[t]||-1}],tokenPrec:545}),FB=zve.configure({props:[eB({chart:at.keyword,data:at.keyword,colorize:at.keyword,highlight:at.keyword,"area-fill":at.keyword,annotation:at.keyword,range:at.keyword,note:at.keyword,"hide-annotation":at.keyword,"show-annotation":at.keyword,"hide-range":at.keyword,"show-range":at.keyword,"hide-note":at.keyword,"show-note":at.keyword,series:at.keyword,scene:at.keyword,transform:at.keyword,Identifier:at.variableName,String:at.string,Number:at.number,Percentage:at.number,Equals:at.operator,LineComment:at.lineComment,BlockComment:at.blockComment,"{ }":at.brace})]}),Hve=K0.define({parser:FB,languageData:{commentTokens:{line:"//"}}}),Wve=sge(rB);function Uve(){return new Kme(Hve)}function w1(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function V2e(t){const e=FB.parse(t);let n=0,o="";return oB(e,rB,(r,i,s)=>{r>n&&(o+=w1(t.slice(n,r))),o+=`<span class="${s}">${w1(t.slice(r,i))}</span>`,n=i}),n<t.length&&(o+=w1(t.slice(n))),o}const Gve={class:"d-flex flex-column h-100"},qve={key:0,class:"text-danger small mt-1"},Yve=se({__name:"ChartEditDsl",setup(t){const{dsl:e}=yc(),{applyDsl:n}=Jc(),o=bt("editorEl"),r=Fe();let i,s=!1;function a(l){if(!l.docChanged||s)return;const c=l.state.doc.toString(),u=n(c);u.success?r.value=void 0:r.value=u.error}return vn(()=>{const l=Jt.create({doc:e.value,extensions:[jM.of([...Mve,...Ege]),Age(),Uve(),Wve,At.updateListener.of(a),At.theme({"&":{height:"100%",backgroundColor:"var(--bc-tile-bg-elevated)"},".cm-scroller":{overflow:"auto"},".cm-content":{fontFamily:"var(--bs-font-monospace)",paddingBottom:"var(--fst-clearance, 9rem)"},".cm-gutters":{backgroundColor:"var(--bc-tile-bg-elevated)",color:"var(--bs-secondary-color)",borderRight:"1px solid var(--bs-border-color)"}})]});i=new At({state:l,parent:o.value})}),Ke(e,l=>{!i||i.state.doc.toString()===l||(s=!0,i.dispatch({changes:{from:0,to:i.state.doc.length,insert:l}}),s=!1)}),ca(()=>{i==null||i.destroy(),i=void 0}),(l,c)=>(w(),R("div",Gve,[A("div",{ref_key:"editorEl",ref:o,class:"flex-grow-1 overflow-auto"},null,512),p(r)?(w(),R("div",qve,pe(p(r)),1)):oe("",!0)]))}}),jve={key:1,class:"position-absolute",width:"0",height:"0","aria-hidden":"true"},Kve=se({__name:"PreviewChart",setup(t){const e=bt("containerRef");Sx(e);const{containerRef:n}=TO();Ke(e,E=>{n.value=E},{immediate:!0});const{selectAnnotation:o}=pr();function r(E){var B;const T=E.target.closest("g[data-annotation-index]");if(!T)return;E.preventDefault(),(B=window.getSelection())==null||B.removeAllRanges();const O=T.getAttribute("data-annotation-id");if(O){o(O);return}const P=parseInt(T.getAttribute("data-annotation-index")||"",10);isNaN(P)||o(P)}vn(()=>{var E;(E=e.value)==null||E.addEventListener("dblclick",r)}),oa(()=>{var E;(E=e.value)==null||E.removeEventListener("dblclick",r)});const{cvdMode:i}=Tt(BO()),s=bt("cvdDefsRef");Ke([i,s],([E,N])=>{if(N){for(;N.firstChild;)N.removeChild(N.firstChild);E&&N.appendChild(yre(E))}},{immediate:!0});const a=S(()=>{if(i.value)return{filter:`url(#${DT(i.value)})`}}),{layout:l}=dn(),{scenes:c,activeIndex:u,playing:d,setActive:f,nextScene:h,previousScene:m,startPlayback:b,stopPlayback:g}=Sn(),v=Fe(null),y={buttons:nb,"progress-bar":PA,"dot-stepper":DA,"minimal-arrows":EA},x=S(()=>y[l.value.playerType]),_=S(()=>c.value.length+1),C=S(()=>u.value+2),D=S(()=>c.value.length>=1&&l.value.playerType!=="none");function M(E){f(E-2)}let $=null;function L(){const E=e.value;return E?E.querySelector(".bc-frame-footer"):null}return Ke(e,E=>{if($&&($.disconnect(),$=null),!E){v.value=null;return}v.value=L(),$=new MutationObserver(()=>{v.value=L()}),$.observe(E,{childList:!0,subtree:!0})},{immediate:!0}),oa(()=>{$&&($.disconnect(),$=null)}),(E,N)=>(w(),R(Re,null,[A("div",{ref_key:"containerRef",ref:e,class:"w-100 h-100",style:Lt(p(a))},null,4),p(v)&&p(D)?(w(),Q(Oy,{key:0,to:p(v)},[(w(),Q(Rt(p(x)),{total:p(_),current:p(C),playing:p(d),position:p(l).playerPosition,"onUpdate:current":M,onPrevious:p(m),onNext:p(h),onPlay:p(b),onPause:p(g)},null,40,["total","current","playing","position","onPrevious","onNext","onPlay","onPause"]))],8,["to"])):oe("",!0),p(i)?(w(),R("svg",jve,[A("defs",{ref_key:"cvdDefsRef",ref:s},null,512)])):oe("",!0)],64))}}),VB=Symbol("sceneTimeline"),Xve={key:0,class:"floating-scene-timeline"},Zve=se({__name:"FloatingSceneTimeline",setup(t){const e=Kt(VB,null),{isNarrow:n}=Yr();return(o,r)=>p(e)&&!p(n)&&p(e).showTimeline.value?(w(),R("div",Xve,[H(p(Aq),{scenes:p(e).scenes.value,"active-index":p(e).activeIndex.value,playing:p(e).playing.value,floating:"","onUpdate:activeIndex":p(e).onSelect,onAdd:p(e).onAdd,onRemove:p(e).onRemove,onPlay:p(e).onPlay,onPause:p(e).onPause},null,8,["scenes","active-index","playing","onUpdate:activeIndex","onAdd","onRemove","onPlay","onPause"])])):oe("",!0)}}),zB=Be(Zve,[["__scopeId","data-v-05a62bbc"]]),Qve={class:"chart-edit-panel__canvas-frame"},Jve=se({__name:"ChartEditPanel",setup(t){const e=pr(),{viewMode:n,activeTab:o,canvasMode:r,showDimensions:i}=Tt(e),{selectTab:s,setLastNarrowEditTab:a}=e,{mode:l}=xc(),{isNarrow:c}=Yr(),{layout:u}=dn(),{cardClass:d,cardStyle:f}=kx(u,"chart-edit-panel__canvas__card"),{sections:h}=kO(),m=S({get:()=>!!o.value,set:N=>{N||s("")}});Ke(l,N=>{N==="drawer"&&o.value&&(a(o.value),s(""))},{immediate:!0});function b(N){a(N),s(N)}const g=S(()=>h.value.map(N=>({key:N.key,label:N.label,icon:N.icon}))),v=S(()=>({"chart-edit-panel--narrow":c.value})),y=S(()=>({[`chart-edit-panel__canvas--${r.value}`]:r.value!=="blueprint","chart-edit-panel__canvas--dsl":n.value!=="preview","chart-edit-panel__canvas--dimensions":n.value==="preview"&&i.value})),x={type:"Chart Type",text:"Text",style:"Style",layout:"Layout",series:"Series",axes:"Axes",annotate:"Annotate",interactions:"Interactions"},_=S(()=>x[o.value]??"Panel"),C=bt("canvasRef"),D=bt("cardRef"),M=Ne(0),$=Ne(0);function L(){const N=D.value;N&&(M.value=N.offsetLeft,$.value=N.offsetTop)}ps(C,L),ps(D,L);const E=S(()=>({"--grid-offset-x":`${M.value}px`,"--grid-offset-y":`${$.value}px`}));return(N,T)=>{const O=Kve,P=Yve,B=xO,V=yO,z=_x,G=hpe,K=ape,ne=epe,ae=Qhe,he=dhe,ge=rhe,le=Zfe,fe=yfe,we=ide,Z=wx,be=Eg,re=Vue;return w(),R("div",{class:Te(["chart-edit-panel",p(v)])},[A("div",Qve,[A("div",{ref_key:"canvasRef",ref:C,class:Te(["chart-edit-panel__canvas",p(y)]),style:Lt(p(E))},[p(n)==="preview"?(w(),R("div",{key:0,ref_key:"cardRef",ref:D,class:Te(["chart-edit-panel__canvas__card",p(d)]),style:Lt(p(f))},[H(O)],6)):(w(),Q(P,{key:1,class:"chart-edit-panel__canvas__dsl"})),p(n)==="preview"&&p(i)?(w(),Q(B,{key:2,"card-ref":p(D),"canvas-ref":p(C),layout:p(u)},null,8,["card-ref","canvas-ref","layout"])):oe("",!0),H(zB)],6),p(n)==="preview"?(w(),Q(V,{key:0})):oe("",!0)]),H(be,{"drawer-open":p(m),"onUpdate:drawerOpen":T[0]||(T[0]=ve=>Ze(m)?m.value=ve:null),title:p(_),"container-ref":p(C),onClose:T[1]||(T[1]=ve=>p(s)(""))},$i({default:J(()=>[p(o)==="type"?(w(),Q(K,{key:0})):p(o)==="text"?(w(),Q(ne,{key:1})):p(o)==="style"?(w(),Q(ae,{key:2})):p(o)==="series"?(w(),Q(he,{key:3})):p(o)==="axes"?(w(),Q(ge,{key:4})):p(o)==="layout"?(w(),Q(le,{key:5})):p(o)==="annotate"?(w(),Q(fe,{key:6})):p(o)==="interactions"?(w(),Q(we,{key:7})):oe("",!0)]),_:2},[p(l)==="drawer"?{name:"tabs",fn:J(()=>[H(z,{tabs:p(g),"model-value":p(o),sticky:"","onUpdate:modelValue":b},null,8,["tabs","model-value"])]),key:"0"}:void 0,p(l)!=="drawer"?{name:"header",fn:J(()=>[H(G)]),key:"1"}:void 0,p(l)!=="drawer"?{name:"footer",fn:J(()=>[H(Z)]),key:"2"}:void 0]),1032,["drawer-open","title","container-ref"]),p(c)?oe("",!0):(w(),Q(re,{key:0}))],2)}}}),e1e=Be(Jve,[["__scopeId","data-v-5e9f4c38"]]),t1e={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"};function n1e(t,e){return w(),R("svg",t1e,[...e[0]||(e[0]=[A("path",{fill:"currentColor",d:"M104 32H64a16 16 0 0 0-16 16v160a16 16 0 0 0 16 16h40a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16m0 176H64V48h40Zm88-176h-40a16 16 0 0 0-16 16v160a16 16 0 0 0 16 16h40a16 16 0 0 0 16-16V48a16 16 0 0 0-16-16m0 176h-40V48h40Z"},null,-1)])])}const o1e=Oe({name:"ph-columns",render:n1e}),r1e={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"};function i1e(t,e){return w(),R("svg",r1e,[...e[0]||(e[0]=[A("path",{fill:"currentColor",d:"m245.66 74.34l-32-32a8 8 0 0 0-11.32 11.32L220.69 72H208c-49.33 0-61.05 28.12-71.38 52.92c-9.38 22.51-16.92 40.59-49.48 42.84a40 40 0 1 0 .1 16c43.26-2.65 54.34-29.15 64.14-52.69C161.41 107 169.33 88 208 88h12.69l-18.35 18.34a8 8 0 0 0 11.32 11.32l32-32a8 8 0 0 0 0-11.32M48 200a24 24 0 1 1 24-24a24 24 0 0 1-24 24"},null,-1)])])}const s1e=Oe({name:"ph-flow-arrow",render:i1e}),a1e={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"};function l1e(t,e){return w(),R("svg",a1e,[...e[0]||(e[0]=[A("path",{fill:"currentColor",d:"M176 232a8 8 0 0 1-8 8H88a8 8 0 0 1 0-16h80a8 8 0 0 1 8 8m40-128a87.55 87.55 0 0 1-33.64 69.21A16.24 16.24 0 0 0 176 186v6a16 16 0 0 1-16 16H96a16 16 0 0 1-16-16v-6a16 16 0 0 0-6.23-12.66A87.59 87.59 0 0 1 40 104.49C39.74 56.83 78.26 17.14 125.88 16A88 88 0 0 1 216 104m-16 0a72 72 0 0 0-73.74-72c-39 .92-70.47 33.39-70.26 72.39a71.65 71.65 0 0 0 27.64 56.3A32 32 0 0 1 96 186v6h64v-6a32.15 32.15 0 0 1 12.47-25.35A71.65 71.65 0 0 0 200 104m-16.11-9.34a57.6 57.6 0 0 0-46.56-46.55a8 8 0 0 0-2.66 15.78c16.57 2.79 30.63 16.85 33.44 33.45A8 8 0 0 0 176 104a9 9 0 0 0 1.35-.11a8 8 0 0 0 6.54-9.23"},null,-1)])])}const c1e=Oe({name:"ph-lightbulb",render:l1e});function HB(){return{sections:[{key:"column",label:"Columns",icon:o1e},{key:"transforms",label:"Transforms",icon:s1e},{key:"parsing",label:"Parsing",icon:vO},{key:"reco",label:"Recommendations",icon:c1e}]}}const u1e=se({__name:"DataSideIconRail",props:{disabledTabs:{default:()=>[]}},setup(t){const e=t,n=pr(),{dataPanelTab:o}=Tt(n),{openDataPanel:r}=n,{mode:i,toggleMode:s}=xc(),{sections:a}=HB(),l=S(()=>a.filter(d=>!e.disabledTabs.includes(d.key)).map(d=>({value:d.key,icon:d.icon,tooltip:d.tooltip??d.label})));function c(d){r(d)}function u(){i.value==="closed"&&r(o.value||"column"),s()}return(d,f)=>{const h=yx;return w(),Q(h,{"active-tab":p(o),items:p(l),onSelect:c,onToggleMode:u},null,8,["active-tab","items"])}}}),d1e={class:"reco-card__preview"},f1e={class:"reco-card__body"},h1e={class:"reco-card__body__title"},p1e={class:"reco-card__body__reason"},m1e=se({__name:"DataRecommendationCard",props:{chartType:{},label:{},fitness:{},reason:{}},emits:["select"],setup(t){const e={[Ve.BarVertical]:Oe(LO),[Ve.BarHorizontal]:Oe(PO),[Ve.BarMulti]:Oe(DO),[Ve.Line]:Oe(EO),[Ve.LineMulti]:Oe(IO),[Ve.Donut]:Oe(NO),[Ve.Pie]:Oe(RO)},n=t,o=S(()=>e[n.chartType]),r=S(()=>n.fitness==="best"?"reco-card__body__title__badge--best":n.fitness==="good"?"reco-card__body__title__badge--good":"reco-card__body__title__badge--alt"),i=S(()=>n.fitness==="best"?"Best match":n.fitness==="good"?"Good fit":"Alternative");return(s,a)=>(w(),R("button",{class:Te(["reco-card",{"reco-card--best":t.fitness==="best"}]),onClick:a[0]||(a[0]=l=>s.$emit("select",t.chartType))},[A("div",d1e,[p(o)?(w(),Q(Rt(p(o)),{key:0,class:"reco-card__preview__thumb-svg"})):oe("",!0)]),A("div",f1e,[A("div",h1e,[He(pe(t.label)+" ",1),A("span",{class:Te(["reco-card__body__title__badge",p(r)])},pe(p(i)),3)]),A("div",p1e,pe(t.reason),1)])],2))}}),g1e=Be(m1e,[["__scopeId","data-v-0e22d5d1"]]);function v1e(){const{displayRows:t,displayColumnTypes:e}=er(),n=S(()=>{const r=e.value,i=r.filter(c=>c==="string").length,s=r.filter(c=>c==="number").length,a=r.filter(c=>c==="date").length,l=[];return i>0&&l.push(`${i} categorical`),a>0&&l.push(`${a} date`),s>0&&l.push(`${s} numeric`),l.length>0?`${l.join(" + ")} column${r.length!==1?"s":""}`:"No data"});return{recommendations:S(()=>vre(e.value,t.value.length)),dataSummary:n}}const b1e={class:"data-recommendations"},y1e={class:"data-recommendations__summary"},x1e={key:0,class:"text-muted text-center py-3"},w1e=se({__name:"DataRecommendations",setup(t){const{recommendations:e,dataSummary:n}=v1e(),o=dn();function r(i){o.chartType.value=i}return(i,s)=>{const a=g1e;return w(),R("div",b1e,[A("p",y1e," Based on your data: "+pe(p(n)),1),p(e).length===0?(w(),R("div",x1e," Load data to see recommendations ")):oe("",!0),(w(!0),R(Re,null,vt(p(e),l=>(w(),Q(a,{key:l.chartType,"chart-type":l.chartType,label:l.label,fitness:l.fitness,reason:l.reason,onSelect:r},null,8,["chart-type","label","fitness","reason"]))),128))])}}}),_1e=Be(w1e,[["__scopeId","data-v-47bbaf64"]]),GS={firstRowIsHeader:!0,delimiter:"auto",decimalSeparator:".",treatEmptyAsNull:!0,trimWhitespace:!0},k1e=Qn("parseOptions",()=>{const t=po({...GS});function e(o,r){t[o]=r}function n(){Object.assign(t,{...GS})}return{...mm(t),setOption:e,reset:n}});function WB(){const t=k1e(),{firstRowIsHeader:e,delimiter:n,decimalSeparator:o,treatEmptyAsNull:r,trimWhitespace:i}=Tt(t);return{firstRowIsHeader:e,delimiter:n,decimalSeparator:o,treatEmptyAsNull:r,trimWhitespace:i,setOption:t.setOption,reset:t.reset}}const S1e={class:"data-parse-settings"},C1e={class:"data-parse-settings__field"},A1e={class:"data-parse-settings__field"},$1e=se({__name:"DataParseSettings",setup(t){const e=WB(),{firstRowIsHeader:n,delimiter:o,decimalSeparator:r,treatEmptyAsNull:i,trimWhitespace:s}=Tt(e),{setOption:a}=e,{sourceFormat:l}=er(),c=S(()=>l.value!=="delimited"),u=S({get:()=>n.value,set:v=>a("firstRowIsHeader",v)}),d=S({get:()=>o.value,set:v=>a("delimiter",v)}),f=S({get:()=>r.value,set:v=>a("decimalSeparator",v)}),h=S({get:()=>i.value,set:v=>a("treatEmptyAsNull",v)}),m=S({get:()=>s.value,set:v=>a("trimWhitespace",v)}),b=[{value:"auto",label:"Auto-detect"},{value:",",label:"Comma (,)"},{value:" ",label:"Tab"},{value:";",label:"Semicolon (;)"},{value:"|",label:"Pipe (|)"}],g=[{value:".",label:"Period (.)"},{value:",",label:"Comma (,)"}];return(v,y)=>(w(),R("div",S1e,[H(p(Xs),{modelValue:p(u),"onUpdate:modelValue":y[0]||(y[0]=x=>Ze(u)?u.value=x:null),switch:""},{default:J(()=>[...y[5]||(y[5]=[He(" First row is header ",-1)])]),_:1},8,["modelValue"]),A("div",C1e,[y[6]||(y[6]=A("div",{class:"data-parse-settings__field__label"}," Delimiter ",-1)),H(p(Rn),{modelValue:p(d),"onUpdate:modelValue":y[1]||(y[1]=x=>Ze(d)?d.value=x:null),label:"",options:b,disabled:p(c),block:""},null,8,["modelValue","disabled"])]),A("div",A1e,[y[7]||(y[7]=A("div",{class:"data-parse-settings__field__label"}," Decimal Separator ",-1)),H(p(Rn),{modelValue:p(f),"onUpdate:modelValue":y[2]||(y[2]=x=>Ze(f)?f.value=x:null),label:"",options:g,block:""},null,8,["modelValue"])]),H(p(Xs),{modelValue:p(h),"onUpdate:modelValue":y[3]||(y[3]=x=>Ze(h)?h.value=x:null),switch:""},{default:J(()=>[...y[8]||(y[8]=[He(" Treat empty as null ",-1)])]),_:1},8,["modelValue"]),H(p(Xs),{modelValue:p(m),"onUpdate:modelValue":y[4]||(y[4]=x=>Ze(m)?m.value=x:null),switch:""},{default:J(()=>[...y[9]||(y[9]=[He(" Trim whitespace ",-1)])]),_:1},8,["modelValue"])]))}}),T1e=Be($1e,[["__scopeId","data-v-872473d2"]]),O1e={class:"output-block"},M1e={class:"output-block__meta"},B1e=se({__name:"DataTransformOutputBlock",props:{columns:{},rows:{}},setup(t){return(e,n)=>(w(),R("div",O1e,[n[0]||(n[0]=A("span",{class:"output-block__icon"},[A("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[A("path",{d:"M20 6L9 17l-5-5"})])],-1)),n[1]||(n[1]=A("span",null,"Output",-1)),A("span",M1e,pe(t.columns)+" cols · "+pe(t.rows)+" rows",1)]))}}),L1e=Be(B1e,[["__scopeId","data-v-b1080d62"]]),P1e={class:"add-wrap"},D1e={key:0,class:"add-wrap__dropdown"},E1e=["disabled","onClick"],I1e={class:"add-wrap__dropdown__item__text"},N1e={class:"add-wrap__dropdown__item__text__name"},R1e={class:"add-wrap__dropdown__item__text__desc"},F1e=se({__name:"DataTransformAddButton",emits:["add"],setup(t,{emit:e}){const n=e,o=Ne(!1),r=[{value:tt.Sort,label:"Sort",desc:"Reorder rows by column values",disabled:!1},{value:tt.Filter,label:"Filter",desc:"Keep or exclude rows by condition",disabled:!1},{value:tt.HideColumns,label:"Hide Columns",desc:"Remove columns from output",disabled:!1},{value:tt.Transpose,label:"Transpose",desc:"Swap rows and columns",disabled:!1},{value:tt.Parse,label:"Parse",desc:"Transform column values",disabled:!1},{value:tt.Rename,label:"Rename Column",desc:"Change a column name",disabled:!1},{value:tt.GroupBy,label:"Group By",desc:"Aggregate rows by column values",disabled:!1},{value:tt.Computed,label:"Computed Column",desc:"Derive new column (coming soon)",disabled:!0}];function i(l){return{[tt.Sort]:"add-wrap__dropdown__item__icon--sort",[tt.Filter]:"add-wrap__dropdown__item__icon--filter",[tt.HideColumns]:"add-wrap__dropdown__item__icon--hide-columns",[tt.Transpose]:"add-wrap__dropdown__item__icon--transpose",[tt.Parse]:"add-wrap__dropdown__item__icon--parse",[tt.Rename]:"add-wrap__dropdown__item__icon--rename",[tt.GroupBy]:"add-wrap__dropdown__item__icon--group",[tt.Computed]:"add-wrap__dropdown__item__icon--computed"}[l]??""}function s(l){return{[tt.Sort]:"S",[tt.Filter]:"F",[tt.HideColumns]:"H",[tt.Transpose]:"T",[tt.Parse]:"P",[tt.Rename]:"R",[tt.GroupBy]:"G",[tt.Computed]:"C"}[l]??"?"}function a(l){n("add",l),o.value=!1}return(l,c)=>(w(),R("div",P1e,[H(p(Rl),{label:"Add",onClick:c[0]||(c[0]=u=>o.value=!p(o))}),p(o)?(w(),R("div",D1e,[(w(),R(Re,null,vt(r,u=>A("button",{key:u.value,class:"add-wrap__dropdown__item",disabled:u.disabled,onClick:d=>a(u.value)},[A("span",{class:Te(["add-wrap__dropdown__item__icon",i(u.value)])},pe(s(u.value)),3),A("div",I1e,[A("div",N1e,pe(u.label),1),A("div",R1e,pe(u.desc),1)])],8,E1e)),64))])):oe("",!0)]))}}),V1e=Be(F1e,[["__scopeId","data-v-ac055819"]]),z1e={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"};function H1e(t,e){return w(),R("svg",z1e,[...e[0]||(e[0]=[A("path",{fill:"currentColor",d:"M128 128a8 8 0 0 1-8 8H48a8 8 0 0 1 0-16h72a8 8 0 0 1 8 8M48 72h136a8 8 0 0 0 0-16H48a8 8 0 0 0 0 16m56 112H48a8 8 0 0 0 0 16h56a8 8 0 0 0 0-16m125.66-21.66a8 8 0 0 0-11.32 0L192 188.69V112a8 8 0 0 0-16 0v76.69l-26.34-26.35a8 8 0 0 0-11.32 11.32l40 40a8 8 0 0 0 11.32 0l40-40a8 8 0 0 0 0-11.32"},null,-1)])])}const W1e=Oe({name:"ph-sort-ascending",render:H1e}),U1e={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"};function G1e(t,e){return w(),R("svg",U1e,[...e[0]||(e[0]=[A("path",{fill:"currentColor",d:"M230.6 49.53A15.81 15.81 0 0 0 216 40H40a16 16 0 0 0-11.81 26.76l.08.09L96 139.17V216a16 16 0 0 0 24.87 13.32l32-21.34a16 16 0 0 0 7.13-13.32v-55.49l67.74-72.32l.08-.09a15.8 15.8 0 0 0 2.78-17.23m-84.42 81.05A8 8 0 0 0 144 136v58.66L112 216v-80a8 8 0 0 0-2.16-5.47L40 56h176Z"},null,-1)])])}const q1e=Oe({name:"ph-funnel",render:G1e}),Y1e={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"};function j1e(t,e){return w(),R("svg",Y1e,[...e[0]||(e[0]=[A("path",{fill:"currentColor",d:"M224 48v48a8 8 0 0 1-8 8h-48a8 8 0 0 1 0-16h28.69l-14.63-14.63a79.56 79.56 0 0 0-56.13-23.43h-.45a79.52 79.52 0 0 0-55.89 22.77a8 8 0 0 1-11.18-11.44a96 96 0 0 1 135 .79L208 76.69V48a8 8 0 0 1 16 0m-37.59 135.29a80 80 0 0 1-112.47-.66L59.31 168H88a8 8 0 0 0 0-16H40a8 8 0 0 0-8 8v48a8 8 0 0 0 16 0v-28.69l14.63 14.63A95.43 95.43 0 0 0 130 222.06h.53a95.36 95.36 0 0 0 67.07-27.33a8 8 0 0 0-11.18-11.44Z"},null,-1)])])}const UB=Oe({name:"ph-arrows-clockwise",render:j1e}),K1e={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"};function X1e(t,e){return w(),R("svg",K1e,[...e[0]||(e[0]=[A("path",{fill:"currentColor",d:"M226.76 69a8 8 0 0 0-12.84-2.88l-40.3 37.19l-17.23-3.7l-3.7-17.23l37.19-40.3A8 8 0 0 0 187 29.24A72 72 0 0 0 88 96a72.3 72.3 0 0 0 6 28.94L33.79 177c-.15.12-.29.26-.43.39a32 32 0 0 0 45.26 45.26c.13-.13.27-.28.39-.42L131.06 162A72 72 0 0 0 232 96a71.6 71.6 0 0 0-5.24-27M160 152a56.14 56.14 0 0 1-27.07-7a8 8 0 0 0-9.92 1.77l-55.9 64.74a16 16 0 0 1-22.62-22.62L109.18 133a8 8 0 0 0 1.77-9.93a56 56 0 0 1 58.36-82.31l-31.2 33.81a8 8 0 0 0-1.94 7.1l5.66 26.33a8 8 0 0 0 6.14 6.14l26.35 5.66a8 8 0 0 0 7.1-1.94l33.81-31.2A56.06 56.06 0 0 1 160 152"},null,-1)])])}const Z1e=Oe({name:"ph-wrench",render:X1e}),Q1e={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"};function J1e(t,e){return w(),R("svg",Q1e,[...e[0]||(e[0]=[A("path",{fill:"currentColor",d:"M230.91 172a8 8 0 0 1-2.91 10.91l-96 56a8 8 0 0 1-8.06 0l-96-56A8 8 0 0 1 36 169.09l92 53.65l92-53.65a8 8 0 0 1 10.91 2.91M220 121.09l-92 53.65l-92-53.65a8 8 0 0 0-8 13.82l96 56a8 8 0 0 0 8.06 0l96-56a8 8 0 1 0-8.06-13.82M24 80a8 8 0 0 1 4-6.91l96-56a8 8 0 0 1 8.06 0l96 56a8 8 0 0 1 0 13.82l-96 56a8 8 0 0 1-8.06 0l-96-56A8 8 0 0 1 24 80m23.88 0L128 126.74L208.12 80L128 33.26Z"},null,-1)])])}const ebe=Oe({name:"ph-stack",render:J1e}),tbe={[tt.Sort]:{iconClass:"step-card__body__icon--sort",iconComponent:W1e,fallback:"S",label:"Sort"},[tt.Filter]:{iconClass:"step-card__body__icon--filter",iconComponent:q1e,fallback:"F",label:"Filter"},[tt.HideColumns]:{iconClass:"step-card__body__icon--hide-columns",iconComponent:Bf,fallback:"H",label:"Hide Columns"},[tt.Transpose]:{iconClass:"step-card__body__icon--transpose",iconComponent:UB,fallback:"T",label:"Transpose"},[tt.Parse]:{iconClass:"step-card__body__icon--parse",iconComponent:Z1e,fallback:"P",label:"Parse"},[tt.Rename]:{iconClass:"step-card__body__icon--rename",iconComponent:bx,fallback:"R",label:"Rename"},[tt.GroupBy]:{iconClass:"step-card__body__icon--group",iconComponent:ebe,fallback:"G",label:"Group By"},[tt.Computed]:{iconClass:"step-card__body__icon--computed",fallback:"C",label:"Computed"}},nbe={class:"step-card__number"},obe={class:"step-card__body"},rbe={key:1},ibe={class:"step-card__body__text"},sbe={class:"step-card__body__text__name"},abe={class:"step-card__actions"},lbe=se({__name:"DataTransformStepCard",props:{step:{},index:{},active:{type:Boolean},error:{}},emits:["select","delete"],setup(t){const e=t,n=S(()=>tbe[e.step.type]),o=S(()=>n.value.iconClass),r=S(()=>n.value.iconComponent??null),i=S(()=>n.value.fallback),s=S(()=>n.value.label),a=S(()=>{const{step:l}=e;if(l.type===tt.Sort&&l.config.column)return`${l.config.column} ${l.config.direction??en.Ascending}`;if(l.type===tt.Filter&&l.config.column)return`${l.config.column} ${l.config.condition??wo.Equals} ${l.config.value??""}`;if(l.type===tt.HideColumns){const c=l.config.columns?l.config.columns.split(",").map(u=>u.trim()).filter(Boolean):[];return c.length>0?`Hiding ${c.join(", ")}`:"Configure..."}if(l.type===tt.Transpose)return"Swap rows ↔ columns";if(l.type===tt.Parse&&l.config.column&&l.config.operation)return`${l.config.column} → ${l.config.operation}`;if(l.type===tt.Rename&&l.config.column&&l.config.newName)return`${l.config.column} → ${l.config.newName}`;if(l.type===tt.GroupBy&&l.config.groupColumns&&l.config.aggregates){const c=l.config.groupColumns.split(",").map(d=>d.trim()).filter(Boolean).join(", "),u=l.config.aggregates.split(",").map(d=>{const f=d.lastIndexOf(":");return f<0?d.trim():`${d.slice(f+1).trim()}(${d.slice(0,f).trim()})`}).join(", ");return`Group by ${c} — ${u}`}return"Configure..."});return(l,c)=>(w(),R("div",{class:Te(["step-card",{"step-card--active":t.active,"step-card--error":t.error}]),onClick:c[2]||(c[2]=u=>l.$emit("select"))},[A("div",nbe,pe(t.index+1),1),A("div",obe,[A("span",{class:Te(["step-card__body__icon",p(o)])},[p(r)?(w(),Q(Rt(p(r)),{key:0})):(w(),R("span",rbe,pe(p(i)),1))],2),A("div",ibe,[A("div",sbe,pe(p(s)),1),A("div",{class:Te(["step-card__body__text__desc",{"step-card__body__text__desc--error":t.error}])},pe(t.error||p(a)),3)])]),A("div",abe,[A("button",{class:"step-card__actions__btn","aria-label":"Remove step",onClick:c[0]||(c[0]=pn(u=>l.$emit("delete"),["stop"]))},[...c[3]||(c[3]=[A("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[A("path",{d:"M3 6h18M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})],-1)])])]),t.active&&l.$slots.default?(w(),R("div",{key:0,class:"step-card__config",onClick:c[1]||(c[1]=pn(()=>{},["stop"]))},[Ce(l.$slots,"default",{},void 0,!0)])):oe("",!0)],2))}}),cbe=Be(lbe,[["__scopeId","data-v-4ba65e45"]]),ube={class:"group-by-step"},dbe={class:"group-by-step__field"},fbe={class:"group-by-step__field__columns"},hbe=["checked","onChange"],pbe={key:0,class:"group-by-step__field"},mbe={class:"group-by-step__field__agg-list"},gbe={class:"group-by-step__field__agg-list__row"},vbe={class:"group-by-step__field__agg-list__row__check"},bbe=["checked"],ybe={class:"group-by-step__field__agg-list__row__check"},xbe=["checked","onChange"],wbe=["value","onChange"],_be=se({__name:"DataTransformStepGroupBy",props:{step:{},columns:{},columnTypes:{}},setup(t){const e=t,{updateStep:n}=Rr(),o=S(()=>e.step.config.groupColumns?e.step.config.groupColumns.split(",").map(b=>b.trim()).filter(Boolean):[]),r=S(()=>e.columns.filter(b=>!o.value.includes(b))),i=S(()=>e.step.config.aggregates?e.step.config.aggregates.split(",").map(b=>b.trim()).filter(Boolean).map(b=>{const g=b.lastIndexOf(":");return g<0?null:{col:b.slice(0,g),fn:b.slice(g+1)}}).filter(b=>b!==null):[]),s=S(()=>i.value.some(b=>b.fn==="count"));function a(b){return i.value.some(g=>g.col===b&&g.fn!=="count")}function l(b){const g=i.value.find(v=>v.col===b&&v.fn!=="count");return(g==null?void 0:g.fn)??"sum"}function c(b){return b.map(g=>`${g.col}:${g.fn}`).join(",")}function u(b,g){const v={...e.step.config};b.length>0?v.groupColumns=b.join(","):delete v.groupColumns,g.length>0?v.aggregates=c(g):delete v.aggregates,n(e.step.id,v)}function d(b){const g=[...o.value],v=g.indexOf(b);v>=0?g.splice(v,1):g.push(b);const y=i.value.filter(x=>x.fn==="count"||!g.includes(x.col));u(g,y)}function f(){const b=[...i.value],g=b.findIndex(v=>v.fn==="count");g>=0?b.splice(g,1):b.push({col:"rows",fn:"count"}),u(o.value,b)}function h(b){const g=[...i.value],v=g.findIndex(y=>y.col===b&&y.fn!=="count");v>=0?g.splice(v,1):g.push({col:b,fn:"sum"}),u(o.value,g)}function m(b,g){const v=i.value.map(y=>y.col===b&&y.fn!=="count"?{...y,fn:g}:y);u(o.value,v)}return(b,g)=>(w(),R("div",ube,[A("div",dbe,[g[0]||(g[0]=A("label",{class:"group-by-step__field__label"},"Group by",-1)),A("div",fbe,[(w(!0),R(Re,null,vt(t.columns,v=>(w(),R("label",{key:v,class:"group-by-step__field__columns__column"},[A("input",{type:"checkbox",checked:p(o).includes(v),onChange:y=>d(v)},null,40,hbe),He(" "+pe(v),1)]))),128))])]),p(r).length>0||p(o).length>0?(w(),R("div",pbe,[g[4]||(g[4]=A("label",{class:"group-by-step__field__label"},"Aggregates",-1)),A("div",mbe,[A("div",gbe,[A("label",vbe,[A("input",{type:"checkbox",checked:p(s),onChange:f},null,40,bbe),g[1]||(g[1]=He(" Row count ",-1))]),g[2]||(g[2]=A("span",{class:"group-by-step__field__agg-list__row__fn-label"},"count",-1))]),(w(!0),R(Re,null,vt(p(r),v=>(w(),R("div",{key:v,class:"group-by-step__field__agg-list__row"},[A("label",ybe,[A("input",{type:"checkbox",checked:a(v),onChange:y=>h(v)},null,40,xbe),He(" "+pe(v),1)]),a(v)?(w(),R("select",{key:0,class:"group-by-step__field__agg-list__row__fn",value:l(v),onChange:y=>m(v,y.target.value)},[...g[3]||(g[3]=[A("option",{value:"sum"}," Sum ",-1),A("option",{value:"avg"}," Average ",-1),A("option",{value:"min"}," Min ",-1),A("option",{value:"max"}," Max ",-1)])],40,wbe)):oe("",!0)]))),128))])])):oe("",!0)]))}}),kbe=Be(_be,[["__scopeId","data-v-c53de076"]]),Sbe={class:"data-transform-step-rename"},Cbe=se({__name:"DataTransformStepRename",props:{step:{},columns:{}},setup(t){const e=t,{updateStep:n}=Rr(),o=S(()=>e.columns.map(i=>({value:i,label:i})));function r(i,s){n(e.step.id,{...e.step.config,[i]:s})}return(i,s)=>(w(),R("div",Sbe,[H(p(Rn),{"model-value":t.step.config.column??"",label:"Column",placeholder:"Select a column",options:p(o),block:"","onUpdate:modelValue":s[0]||(s[0]=a=>r("column",a))},null,8,["model-value","options"]),H(p(zm),{id:"rename-new-name","model-value":t.step.config.newName??"",label:"New Name",placeholder:"Enter new column name","onUpdate:modelValue":s[1]||(s[1]=a=>r("newName",a))},null,8,["model-value"])]))}}),Abe=Be(Cbe,[["__scopeId","data-v-5f4cb34e"]]),$be={class:"data-transform-step-parse"},Tbe=se({__name:"DataTransformStepParse",props:{step:{},columns:{}},setup(t){var b;const e=t,{updateStep:n}=Rr(),o=S(()=>e.columns.map(g=>({value:g,label:g}))),r=[{value:"type",label:"Type Conversions"},{value:"string",label:"String"},{value:"numeric",label:"Numeric"},{value:"date",label:"Date/Time"}],i=S(()=>kp.find(g=>g.id===e.step.config.operation)),s=Ne(((b=i.value)==null?void 0:b.category)??"type");Ke(()=>e.step.config.operation,g=>{if(g){const v=kp.find(y=>y.id===g);v&&(s.value=v.category)}});const a=S(()=>kp.filter(g=>g.category===s.value).map(g=>({value:g.id,label:g.label,description:g.description}))),l=S(()=>{var g;return((g=i.value)==null?void 0:g.params)??[]}),c={decimals:"Decimal places",pattern:"Regex pattern",replacement:"Replacement",start:"Start index",end:"End index",length:"Length",char:"Pad character",separator:"Separator",limit:"Limit",min:"Minimum",max:"Maximum",size:"Bucket size",key:"JSON key",amount:"Amount",unit:"Unit",period:"Period",reference:"Reference date"},u={decimals:"0",pattern:"\\d+",replacement:"",start:"0",end:"",length:"10",char:" ",separator:",",limit:"",min:"0",max:"100",size:"10",key:"",amount:"1",unit:"days",period:"month",reference:"YYYY-MM-DD"};function d(g){return c[g]??g}function f(g){return u[g]??""}function h(g){s.value=g;const v={...e.step.config};delete v.operation,n(e.step.id,v)}function m(g,v){n(e.step.id,{...e.step.config,[g]:v})}return(g,v)=>(w(),R("div",$be,[H(p(Rn),{"model-value":t.step.config.column??"",label:"Column",placeholder:"Select a column",options:p(o),block:"","onUpdate:modelValue":v[0]||(v[0]=y=>m("column",y))},null,8,["model-value","options"]),H(p(Rn),{"model-value":p(s),label:"Category",options:r,block:"","onUpdate:modelValue":h},null,8,["model-value"]),H(p(Rn),{"model-value":t.step.config.operation??"",label:"Operation",placeholder:"Select an operation",options:p(a),block:"","onUpdate:modelValue":v[1]||(v[1]=y=>m("operation",y))},null,8,["model-value","options"]),p(l).length>0?(w(!0),R(Re,{key:0},vt(p(l),y=>(w(),Q(p(zm),{id:`parse-${y}`,key:y,"model-value":t.step.config[y]??"",label:d(y),placeholder:f(y),"onUpdate:modelValue":x=>m(y,x)},null,8,["id","model-value","label","placeholder","onUpdate:modelValue"]))),128)):oe("",!0)]))}}),Obe=Be(Tbe,[["__scopeId","data-v-37e3f025"]]),Mbe={class:"data-transform-step-hide-columns"},Bbe={class:"data-transform-step-hide-columns__field"},Lbe={class:"data-transform-step-hide-columns__field__columns"},Pbe=["checked","onChange"],Dbe=se({__name:"DataTransformStepHideColumns",props:{step:{},columns:{}},setup(t){const e=t,{updateStep:n}=Rr(),o=S(()=>e.step.config.columns?e.step.config.columns.split(",").map(i=>i.trim()).filter(Boolean):e.step.config.column?[e.step.config.column]:[]);function r(i){const s=[...o.value],a=s.indexOf(i);a>=0?s.splice(a,1):s.push(i);const l={...e.step.config};delete l.column,s.length===0?delete l.columns:l.columns=s.join(","),n(e.step.id,l)}return(i,s)=>(w(),R("div",Mbe,[A("div",Bbe,[s[0]||(s[0]=A("label",{class:"data-transform-step-hide-columns__field__label"},"Hide columns",-1)),A("div",Lbe,[(w(!0),R(Re,null,vt(t.columns,a=>(w(),R("label",{key:a,class:"data-transform-step-hide-columns__field__columns__column"},[A("input",{type:"checkbox",checked:p(o).includes(a),onChange:l=>r(a)},null,40,Pbe),He(" "+pe(a),1)]))),128))])])]))}}),Ebe=Be(Dbe,[["__scopeId","data-v-a74ff0f2"]]),Ibe={class:"data-transform-step-filter"},Nbe=se({__name:"DataTransformStepFilter",props:{step:{},columns:{}},setup(t){const e=t,{updateStep:n}=Rr(),o=S(()=>e.columns.map(s=>({value:s,label:s}))),r=[{value:wo.Equals,label:"Equals"},{value:wo.NotEquals,label:"Not equals"},{value:wo.Contains,label:"Contains"},{value:wo.GreaterThan,label:"Greater than"},{value:wo.LessThan,label:"Less than"}];function i(s,a){n(e.step.id,{...e.step.config,[s]:a})}return(s,a)=>(w(),R("div",Ibe,[H(p(Rn),{"model-value":t.step.config.column??"",label:"Column",placeholder:"Select a column",options:p(o),block:"","onUpdate:modelValue":a[0]||(a[0]=l=>i("column",l))},null,8,["model-value","options"]),H(p(Rn),{"model-value":t.step.config.condition??p(wo).Equals,label:"Condition",options:r,block:"","onUpdate:modelValue":a[1]||(a[1]=l=>i("condition",l))},null,8,["model-value"]),H(p(zm),{id:"filter-value","model-value":t.step.config.value??"",label:"Value",placeholder:"Filter value","onUpdate:modelValue":a[2]||(a[2]=l=>i("value",l))},null,8,["model-value"])]))}}),Rbe=Be(Nbe,[["__scopeId","data-v-65704d71"]]),Fbe={class:"data-transform-step-sort"},Vbe={class:"data-transform-step-sort__field"},zbe={class:"data-transform-step-sort__field__columns"},Hbe=["checked","onChange"],Wbe=se({__name:"DataTransformStepSort",props:{step:{},columns:{},columnTypes:{}},setup(t){const e=t,{updateStep:n}=Rr(),o=S(()=>e.step.config.columns?e.step.config.columns.split(",").map(c=>c.trim()).filter(Boolean):e.step.config.column?[e.step.config.column]:[]),r=S(()=>o.value.every(c=>{const u=e.columns.indexOf(c);return u>=0&&e.columnTypes[u]==="number"}));function i(c){const u=[...o.value],d=u.indexOf(c);d>=0?u.splice(d,1):u.push(c);const f={...e.step.config};delete f.column,u.length===0?delete f.columns:f.columns=u.join(",");const h=u.every(m=>{const b=e.columns.indexOf(m);return b>=0&&e.columnTypes[b]==="number"});(u.length<=1||!h)&&delete f.operation,n(e.step.id,f)}const s=[{value:"",text:"None"},{value:"sum",text:"Sum"},{value:"avg",text:"Avg"}],a=[{value:en.Ascending,text:"Ascending"},{value:en.Descending,text:"Descending"}];function l(c,u){n(e.step.id,{...e.step.config,[c]:u})}return(c,u)=>(w(),R("div",Fbe,[A("div",Vbe,[u[2]||(u[2]=A("label",{class:"data-transform-step-sort__field__label"},"Sort by",-1)),A("div",zbe,[(w(!0),R(Re,null,vt(t.columns,d=>(w(),R("label",{key:d,class:"data-transform-step-sort__field__columns__column"},[A("input",{type:"checkbox",checked:p(o).includes(d),onChange:f=>i(d)},null,40,Hbe),He(" "+pe(d),1)]))),128))])]),p(o).length>1&&p(r)?(w(),Q(p($n),{key:0,"model-value":t.step.config.operation??"",label:"Operation",options:s,block:"","onUpdate:modelValue":u[0]||(u[0]=d=>l("operation",d))},null,8,["model-value"])):oe("",!0),H(p($n),{"model-value":t.step.config.direction??p(en).Ascending,label:"Direction",options:a,block:"","onUpdate:modelValue":u[1]||(u[1]=d=>l("direction",d))},null,8,["model-value"])]))}}),Ube=Be(Wbe,[["__scopeId","data-v-73ae8834"]]),Gbe={},qbe={class:"pipeline-connector"};function Ybe(t,e){return w(),R("div",qbe)}const jbe=Be(Gbe,[["render",Ybe],["__scopeId","data-v-a3406500"]]),Kbe={class:"source-block"},Xbe={class:"source-block__meta"},Zbe=se({__name:"DataTransformSourceBlock",props:{columns:{},rows:{},label:{default:"Raw Data"}},setup(t){return(e,n)=>(w(),R("div",Kbe,[n[0]||(n[0]=A("span",{class:"source-block__icon"},[A("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2",width:"14",height:"14"},[A("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),A("path",{d:"M3 9h18M9 21V9"})])],-1)),A("span",null,pe(t.label),1),A("span",Xbe,pe(t.columns)+" cols · "+pe(t.rows)+" rows",1)]))}}),Qbe=Be(Zbe,[["__scopeId","data-v-6b491dca"]]),Jbe={class:"pipeline","data-testid":"transform-pipeline"},eye={key:6,class:"pipeline__config-info"},tye={key:7,class:"text-muted text-center py-3"},nye=se({__name:"DataTransformPipeline",setup(t){const{columns:e,rows:n,columnTypes:o}=er(),{steps:r,addStep:i,removeStep:s,applyTransforms:a,getColumnsAtStep:l,validateStep:c}=Rr(),{activeScene:u,activeIndex:d,scenes:f}=Sn(),h=S(()=>{if(!u.value)return"Raw Data";if(d.value<=0)return"Data from Scene 1";const N=f.value[d.value-1];return`Data from ${(N==null?void 0:N.name)||`Scene ${d.value}`}`}),m=Ne(""),b=Fe(new Set),g=S(()=>r.value.findIndex(N=>N.id===m.value)),v=S(()=>g.value<0?{columns:[],columnTypes:[]}:l(g.value,e.value,n.value,o.value)),y=S(()=>v.value.columns),x=S(()=>v.value.columnTypes),_=S(()=>{const N={};for(let T=0;T<r.value.length;T++){const O=r.value[T];if(b.value.has(O.id)){N[O.id]=null;continue}const P=l(T,e.value,n.value,o.value);N[O.id]=c(O,P.columns,P.columnTypes)}return N}),C=S(()=>a(e.value,n.value,o.value)),D=S(()=>C.value.columns.length),M=S(()=>C.value.rows.length);function $(N){const T=m.value;T&&T!==N&&b.value.delete(T),m.value=N}function L(N){const T=i(N);b.value.add(T),$(T)}function E(N){b.value.delete(N),s(N),m.value===N&&(m.value=r.value.length>0?r.value[r.value.length-1].id:"")}return(N,T)=>{const O=Qbe,P=jbe,B=Ube,V=Rbe,z=Ebe,G=Obe,K=Abe,ne=kbe,ae=cbe,he=V1e,ge=L1e;return w(),R("div",Jbe,[H(O,{columns:p(e).length,rows:p(n).length,label:p(h)},null,8,["columns","rows","label"]),(w(!0),R(Re,null,vt(p(r),(le,fe)=>(w(),R(Re,{key:le.id},[H(P),H(ae,{step:le,index:fe,active:p(m)===le.id,error:p(_)[le.id],onSelect:we=>$(le.id),onDelete:we=>E(le.id)},{default:J(()=>[le.type===p(tt).Sort?(w(),Q(B,{key:0,step:le,columns:p(y),"column-types":p(x)},null,8,["step","columns","column-types"])):le.type===p(tt).Filter?(w(),Q(V,{key:1,step:le,columns:p(y)},null,8,["step","columns"])):le.type===p(tt).HideColumns?(w(),Q(z,{key:2,step:le,columns:p(y)},null,8,["step","columns"])):le.type===p(tt).Parse?(w(),Q(G,{key:3,step:le,columns:p(y)},null,8,["step","columns"])):le.type===p(tt).Rename?(w(),Q(K,{key:4,step:le,columns:p(y)},null,8,["step","columns"])):le.type===p(tt).GroupBy?(w(),Q(ne,{key:5,step:le,columns:p(y),"column-types":p(x)},null,8,["step","columns","column-types"])):le.type===p(tt).Transpose?(w(),R("div",eye," Transpose swaps rows and columns. The first column values become headers and column headers become the first column. ")):(w(),R("div",tye," Coming soon "))]),_:2},1032,["step","index","active","error","onSelect","onDelete"])],64))),128)),H(P),H(he,{onAdd:L}),H(P),H(ge,{columns:p(D),rows:p(M)},null,8,["columns","rows"])])}}}),oye=Be(nye,[["__scopeId","data-v-b653c7ed"]]),rye=[0,.30103,.17609,.12494,.09691,.07918,.06695,.05799,.05115,.04576],GB=10,iye=.1;function sye(t){const e=parseFloat(t);if(!Number.isFinite(e)||e===0)return null;const o=Math.abs(e).toExponential(),r=parseInt(o[0],10);return r>=1&&r<=9?r:null}function aye(t,e,n){if(t==="number")return!0;let o=0;for(const r of e){const i=r[n];if(i!=null&&i!==""){const s=parseFloat(i);Number.isFinite(s)&&o++}}return o>=GB}function qB(t,e,n){const o=[];let r=!1;for(let i=0;i<t.length;i++){if(!aye(n[i],e,i))continue;const s=new Array(10).fill(0);let a=0;for(const c of e){const u=sye(c[i]);u!==null&&(s[u]++,a++)}if(a<GB)continue;r=!0;let l=!1;for(let c=1;c<=9;c++){const u=s[c]/a;if(Math.abs(u-rye[c])>iye){l=!0;break}}l&&o.push(t[i])}return{pass:o.length===0,suspicious:o,eligible:r}}const lye={class:"data-column-settings"},cye={class:"data-column-settings__field"},uye={class:"data-column-settings__section"},dye={class:"data-column-settings__section__detections"},fye={class:"data-column-settings__section__detections__item data-column-settings__section__detections__item--success"},hye={class:"data-column-settings__section__detections__item data-column-settings__section__detections__item--info"},pye={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},mye={key:0,d:"M20 6L9 17l-5-5"},gye={key:1,d:"M12 9v4M12 17h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"},vye={key:1,class:"data-column-settings__picker"},bye=se({__name:"DataColumnSettings",setup(t){const e=pr(),{selectedColumnIndex:n}=Tt(e),{selectColumn:o}=e,{columns:r,rows:i,columnTypes:s,setColumnType:a}=er(),l=Ne("string"),c=[{value:"string",label:"String"},{value:"number",label:"Number"},{value:"date",label:"Date"}];Ke(n,v=>{v>=0&&v<r.value.length&&(l.value=s.value[v]??"string")},{immediate:!0});function u(v){a(n.value,v)}const d=S(()=>r.value.map((v,y)=>({value:String(y),label:v})));function f(v){o(parseInt(v,10))}const h=S(()=>{const v=n.value;if(v<0)return{unique:0,total:0};const y=i.value.map(_=>_[v]??"").filter(_=>_.length>0);return{unique:new Set(y).size,total:y.length}}),m=S(()=>{const{unique:v,total:y}=h.value;return v===y?`${v} unique values — no duplicates`:`${y-v} duplicates found`}),b=S(()=>{const v=s.value[n.value];return v==="number"?"Numeric measure detected":v==="date"?"Date axis detected":"Categorical dimension detected"}),g=S(()=>{const v=n.value;if(v<0)return null;const y=r.value[v],x=qB([y],i.value.map(_=>[_[v]]),[s.value[v]]);return x.eligible?{pass:x.pass,label:x.pass?"Follows Benford's law":"Doesn't follow Benford's law"}:null});return(v,y)=>(w(),R("div",lye,[p(n)>=0&&p(n)<p(r).length?(w(),R(Re,{key:0},[A("div",cye,[y[1]||(y[1]=A("div",{class:"data-column-settings__field__label"}," Type ",-1)),H(p(Rn),{modelValue:p(l),"onUpdate:modelValue":[y[0]||(y[0]=x=>Ze(l)?l.value=x:null),u],label:"",options:c,block:""},null,8,["modelValue"])]),y[5]||(y[5]=A("hr",{class:"data-column-settings__divider"},null,-1)),A("div",uye,[y[4]||(y[4]=A("div",{class:"data-column-settings__section__title"}," Detections ",-1)),A("div",dye,[A("span",fye,[y[2]||(y[2]=A("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[A("path",{d:"M20 6L9 17l-5-5"})],-1)),He(" "+pe(p(m)),1)]),A("span",hye,[y[3]||(y[3]=A("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[A("circle",{cx:"12",cy:"12",r:"10"}),A("path",{d:"M12 16v-4M12 8h.01"})],-1)),He(" "+pe(p(b)),1)]),p(g)?(w(),R("span",{key:0,class:Te(["data-column-settings__section__detections__item",p(g).pass?"data-column-settings__section__detections__item--success":"data-column-settings__section__detections__item--warn"])},[(w(),R("svg",pye,[p(g).pass?(w(),R("path",mye)):(w(),R("path",gye))])),He(" "+pe(p(g).label),1)],2)):oe("",!0)])])],64)):(w(),R("div",vye,[y[6]||(y[6]=A("div",{class:"data-column-settings__picker__label"}," Column ",-1)),H(p(Rn),{"model-value":"",label:"",options:p(d),block:"",placeholder:"Select a column…","onUpdate:modelValue":f},null,8,["options"])]))]))}}),yye=Be(bye,[["__scopeId","data-v-fadb97cc"]]),xye={key:0,class:"data-check-empty"},wye={key:1,class:"data-check-table"},_ye={class:"data-check-table__col-header__name"},kye={class:"data-check-table__col-header__type"},Sye=se({__name:"DataCheckTable",setup(t){const e=pr(),{selectedColumnIndex:n}=Tt(e),{selectColumn:o}=e,{displayColumns:r,displayRows:i,displayColumnTypes:s}=er(),a=S(()=>i.value.length===0);return(l,c)=>p(a)?(w(),R("div",xye,[H(p(h2),{class:"data-check-empty__icon"}),c[0]||(c[0]=A("p",null,"No rows match your filters",-1))])):(w(),R("div",wye,[H(p(VI),{hover:"",bordered:""},{default:J(()=>[H(p(qI),null,{default:J(()=>[H(p(z_),null,{default:J(()=>[H(p(V_),{class:"data-check-table__row-num"},{default:J(()=>[...c[1]||(c[1]=[He(" # ",-1)])]),_:1}),(w(!0),R(Re,null,vt(p(r),(u,d)=>(w(),Q(p(V_),{key:d,class:Te(["data-check-table__col-header",{"data-check-table__col--selected":d===p(n)}]),onClick:f=>p(o)(d)},{default:J(()=>[A("div",_ye,pe(u),1),A("div",kye,pe(p(s)[d]??"string"),1)]),_:2},1032,["class","onClick"]))),128))]),_:1})]),_:1}),H(p(zI),null,{default:J(()=>[(w(!0),R(Re,null,vt(p(i),(u,d)=>(w(),Q(p(z_),{key:d},{default:J(()=>[H(p(F_),{class:"data-check-table__row-num"},{default:J(()=>[He(pe(d+1),1)]),_:2},1024),(w(!0),R(Re,null,vt(u,(f,h)=>(w(),Q(p(F_),{key:h,class:Te({"data-check-table__col--selected":h===p(n),"data-check-table__cell--numeric":p(s)[h]==="number"})},{default:J(()=>[He(pe(f),1)]),_:2},1032,["class"]))),128))]),_:2},1024))),128))]),_:1})]),_:1})]))}}),Cye=Be(Sye,[["__scopeId","data-v-670500db"]]),Aye={class:"data-insight-badges"},$ye={class:"data-insight-badge data-insight-badge--shape"},Tye={class:"data-insight-badge__icon"},Oye={class:"data-insight-badge__icon"},Mye=se({__name:"DataInsightBadges",props:{columns:{},rows:{},columnTypes:{}},setup(t){const e=t,n=bt("benfordBadgeRef"),o=S(()=>{let d=0;for(const f of e.rows)for(let h=0;h<e.columns.length;h++){const m=f[h];(m==null||m==="")&&d++}return d}),r=S(()=>o.value===0?"✓":"⚠"),i=S(()=>o.value===0?"No missing values":`${o.value} missing value${o.value===1?"":"s"}`),s=S(()=>o.value===0?"data-insight-badge--quality-ok":"data-insight-badge--quality-warn"),a=S(()=>{const d=qB(e.columns,e.rows,e.columnTypes);return d.eligible?d:null}),l=S(()=>{var d;return(d=a.value)!=null&&d.pass?"✓":"⚠"}),c=S(()=>{var d;return(d=a.value)!=null&&d.pass?"data-insight-badge--benford-ok":"data-insight-badge--benford-warn"}),u=S(()=>a.value?a.value.pass?"All numeric columns follow Benford's Law — the expected distribution of leading digits in real-world data.":`Column(s) ${a.value.suspicious.join(", ")} don't follow Benford's Law — the expected distribution of leading digits. This may indicate fabricated or anomalous data.`:"");return(d,f)=>(w(),R("div",Aye,[A("span",$ye,pe(t.columns.length)+" cols · "+pe(t.rows.length)+" rows ",1),A("span",{class:Te(["data-insight-badge",p(s)])},[A("span",Tye,pe(p(r)),1),He(" "+pe(p(i)),1)],2),p(a)?(w(),R("span",{key:0,ref_key:"benfordBadgeRef",ref:n,class:Te(["data-insight-badge",p(c)])},[A("span",Oye,pe(p(l)),1),f[0]||(f[0]=He(" Benford's law ",-1)),H(p(ff),{"teleport-to":"body",target:p(n),title:p(u),placement:"top"},null,8,["target","title"])],2)):oe("",!0)]))}}),Bye=Be(Mye,[["__scopeId","data-v-d0fa5a33"]]),Lye={class:"data-structure-panel__main__pills-bar"},Pye={key:0,class:"data-structure-panel__main__scene-banner"},Dye=se({__name:"DataStructurePanel",setup(t){const{columns:e,rows:n,columnTypes:o}=er(),r=pr(),{dataPanelOpen:i,dataPanelTab:s}=Tt(r),{openDataPanel:a,closeDataPanel:l,setDataView:c,setLastNarrowDataTab:u}=r,{mode:d}=xc(),{activeScene:f,activeIndex:h,scenes:m}=Sn(),b=S(()=>f.value!==null);Ke(d,P=>{P==="drawer"&&s.value&&(u(s.value),l())},{immediate:!0});const g=S(()=>HT(m.value,h.value)),v=S(()=>{const P=g.value;if(P===h.value)return"Custom data on this scene.";if(P>=0){const B=m.value[P];return`Data inherited from ${(B==null?void 0:B.name)||`Scene ${P+1}`}.`}return"Scene override active."}),y=S(()=>{const P=g.value;return P===h.value?"This scene uses its own data, independent of the base dataset.":P>=0?"Replace data to set different data for this scene.":"The table below shows the base data. Replace data to set custom data for this scene."});function x(){c("upload")}function _(P){u(P),a(P)}const{isNarrow:C}=Yr(),D=bt("mainRef"),{sections:M}=HB(),$=S(()=>b.value?["parsing"]:[]),L=S(()=>b.value?M.filter(P=>P.key!=="parsing"):M),E=S({get:()=>!!s.value,set:P=>{P||l()}}),N={column:"Column Settings",transforms:"Transforms",parsing:"Parsing",reco:"Recommendations"},T=S(()=>N[s.value]??"Panel"),O=S(()=>({"data-structure-panel--narrow":C.value}));return(P,B)=>{const V=Bye,z=Cye,G=_x,K=yye,ne=oye,ae=T1e,he=_1e,ge=wx,le=Eg,fe=u1e;return w(),R("div",{class:Te(["data-structure-panel",p(O)])},[A("div",{ref_key:"mainRef",ref:D,class:"data-structure-panel__main"},[A("div",Lye,[p(b)?(w(),R("div",Pye,[A("strong",null,pe(p(v)),1),He(" "+pe(p(y)),1)])):(w(),Q(V,{key:1,columns:p(e),rows:p(n),"column-types":p(o)},null,8,["columns","rows","column-types"])),H(p(zn),{"icon-left":p(UB),label:"Replace data",variant:"outline-primary",size:"sm",onClick:x},null,8,["icon-left"])]),H(z),H(zB)],512),p(i)?(w(),Q(le,{key:0,"drawer-open":p(E),"onUpdate:drawerOpen":B[0]||(B[0]=we=>Ze(E)?E.value=we:null),title:p(T),"container-ref":p(D),onClose:p(l)},$i({default:J(()=>[p(s)==="column"?(w(),Q(K,{key:0})):p(s)==="transforms"?(w(),Q(ne,{key:1})):p(s)==="parsing"?(w(),Q(ae,{key:2})):p(s)==="reco"?(w(),Q(he,{key:3})):oe("",!0)]),_:2},[p(d)==="drawer"?{name:"tabs",fn:J(()=>[H(G,{tabs:p(L),"model-value":p(s),sticky:"","onUpdate:modelValue":_},null,8,["tabs","model-value"])]),key:"0"}:void 0,p(d)!=="drawer"?{name:"footer",fn:J(()=>[H(ge)]),key:"1"}:void 0]),1032,["drawer-open","title","container-ref","onClose"])):oe("",!0),p(C)?oe("",!0):(w(),Q(fe,{key:1,"disabled-tabs":p($)},null,8,["disabled-tabs"]))],2)}}}),Eye=Be(Dye,[["__scopeId","data-v-3f93b45b"]]),Iye={class:"samples-grid"},Nye=["onClick","onKeydown"],Rye={class:"sample-card__thumb"},Fye=["src","alt"],Vye={class:"sample-card__info"},zye={class:"sample-card__info__name"},Hye={class:"sample-card__info__meta"},Wye=se({__name:"DataUploadSamples",emits:["select"],setup(t){const e={[Ve.BarVertical]:"Columns",[Ve.BarHorizontal]:"Bars",[Ve.BarMulti]:"Grouped Columns",[Ve.Line]:"Line",[Ve.LineMulti]:"Lines",[Ve.Donut]:"Donut",[Ve.Pie]:"Pie",[Ve.Area]:"Area",[Ve.AreaStacked]:"Stacked Area",[Ve.ColumnStacked]:"Stacked Columns",[Ve.BarStacked]:"Stacked Bars",[Ve.BarSplit]:"Split Bars",[Ve.BarGrouped]:"Grouped Bars"};function n(i){const s=i.split(`
|
|
927
|
-
`).filter(a=>a.trim().length>0);return Math.max(0,s.length-1)}const o=po(new Map),r=S(()=>dk.map(i=>({...i,typeLabel:e[i.chartType]??i.chartType,rowCount:n(i.tsvData),thumbSrc:o.get(i.id)})));return vn(()=>{for(const i of dk)if(i.dsl){const s=hx(i.dsl);s&&o.set(i.id,or(s))}}),(i,s)=>(w(),R("div",Iye,[(w(!0),R(Re,null,vt(p(r),a=>(w(),R("div",{key:a.id,class:"sample-card",role:"button",tabindex:"0",onClick:l=>i.$emit("select",a),onKeydown:ar(l=>i.$emit("select",a),["enter"])},[A("div",Rye,[a.thumbSrc?(w(),R("img",{key:0,class:"sample-card__thumb__img",src:a.thumbSrc,alt:a.title},null,8,Fye)):oe("",!0)]),A("div",Vye,[A("div",zye,pe(a.title),1),A("div",Hye,[He(pe(a.typeLabel)+" ",1),s[0]||(s[0]=A("span",{class:"sample-card__info__meta__sep"},"·",-1)),He(" "+pe(a.rowCount)+" rows ",1)])])],40,Nye))),128))]))}}),Uye=Be(Wye,[["__scopeId","data-v-23920b61"]]),Gye=se({__name:"DataUploadFileDrop",emits:["loaded","bpc","dragState"],setup(t,{emit:e}){const n=e,o=Fe(null),r=Ne(!1);function i(f){r.value=f,n("dragState",f)}function s(){i(!0)}function a(){i(!1)}function l(f){return f.name.toLowerCase().endsWith(".bpc")}function c(f){const h=new globalThis.FileReader;h.onload=()=>{typeof h.result=="string"&&n(l(f)?"bpc":"loaded",h.result,f.name)},h.readAsText(f)}function u(f){var m;i(!1);const h=(m=f.dataTransfer)==null?void 0:m.files[0];h&&c(h)}function d(f){var b;const h=f.target,m=(b=h.files)==null?void 0:b[0];m&&c(m),h.value=""}return(f,h)=>(w(),R("div",{class:Te(["file-drop",{"file-drop--active":p(r)}]),onDragover:pn(s,["prevent"]),onDragleave:pn(a,["prevent"]),onDrop:pn(u,["prevent"]),onClick:h[1]||(h[1]=m=>{var b;return(b=p(o))==null?void 0:b.click()})},[h[2]||(h[2]=T7('<div class="file-drop__icon" data-v-f6ebbbc1><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" data-v-f6ebbbc1><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12" data-v-f6ebbbc1></path></svg></div><div class="file-drop__title" data-v-f6ebbbc1> Drag & drop your file here </div><div class="file-drop__or" data-v-f6ebbbc1> or </div>',3)),A("button",{class:"file-drop__btn",onClick:h[0]||(h[0]=pn(m=>{var b;return(b=p(o))==null?void 0:b.click()},["stop"]))}," Browse files "),h[3]||(h[3]=A("div",{class:"file-drop__formats"},[A("span",{class:"file-drop__formats__tag"},".csv"),A("span",{class:"file-drop__formats__tag"},".tsv"),A("span",{class:"file-drop__formats__tag"},".bpc")],-1)),A("input",{ref_key:"fileInput",ref:o,type:"file",accept:".csv,.tsv,.txt,.bpc",class:"file-drop__input",onChange:d},null,544)],34))}}),qye=Be(Gye,[["__scopeId","data-v-f6ebbbc1"]]),Yye={class:"upload-card"},jye={class:"input-card__tabs"},Kye=["onClick"],Xye={key:0,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Zye={key:1,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Qye={key:2,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Jye={key:1,class:"upload-card__paste"},e2e={class:"upload-card__paste__wrap"},t2e={key:0,class:"upload-card__paste__wrap__placeholder"},n2e={class:"upload-card__paste__footer"},o2e={class:"upload-card__paste__footer__hint"},r2e=["disabled"],i2e=se({__name:"DataUploadCard",emits:["loaded","bpc","sample","cancel"],setup(t){const e=g2("v").keyLabel.split(" "),{rawInput:n,sourceFormat:o,columns:r,rows:i,displayColumns:s,displayRows:a}=er(),{activeIndex:l,scenes:c}=Sn();function u(){if(l.value<0)return!1;const y=Ka(c.value,l.value);return!!(y!=null&&y.data)}function d(){return u()?xk(s.value,a.value):(o==null?void 0:o.value)==="bpc"&&r.value.length>0?xk(r.value,i.value):n.value}const f=Ne("paste"),h=Ne(d()),m=bt("pasteArea"),b=Ne(!1);function g(y){var _;const x=(_=y.clipboardData)==null?void 0:_.getData("text/plain");x&&(y.preventDefault(),h.value=x,kn(()=>{m.value&&m.value.focus()}))}const v=[{value:"file",text:"File"},{value:"paste",text:"Paste"},{value:"samples",text:"Samples"}];return(y,x)=>{const _=qye,C=Uye;return w(),R("div",Yye,[x[12]||(x[12]=A("h1",{class:"upload-card__title"}," Add your data ",-1)),x[13]||(x[13]=A("p",{class:"upload-card__subtitle"}," Drop a file, paste from a spreadsheet, or pick a sample dataset ",-1)),p(r).length>0?(w(),R("button",{key:0,class:"upload-card__back",onClick:x[0]||(x[0]=D=>y.$emit("cancel"))}," ← Back to table ")):oe("",!0),A("div",{class:Te(["input-card",{"input-card--drag-over":p(b)}])},[A("div",jye,[(w(),R(Re,null,vt(v,D=>A("button",{key:D.value,class:Te(["input-card__tabs__tab",{"input-card__tabs__tab--active":p(f)===D.value}]),onClick:M=>f.value=D.value},[D.value==="file"?(w(),R("svg",Xye,[...x[7]||(x[7]=[A("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12"},null,-1)])])):D.value==="paste"?(w(),R("svg",Zye,[...x[8]||(x[8]=[A("rect",{x:"8",y:"2",width:"8",height:"4",rx:"1"},null,-1),A("path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"},null,-1)])])):(w(),R("svg",Qye,[...x[9]||(x[9]=[A("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"},null,-1),A("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"},null,-1)])])),He(" "+pe(D.text),1)],10,Kye)),64))]),p(f)==="file"?(w(),Q(_,{key:0,onLoaded:x[1]||(x[1]=(D,M)=>y.$emit("loaded",D,M)),onBpc:x[2]||(x[2]=(D,M)=>y.$emit("bpc",D,M)),onDragState:x[3]||(x[3]=D=>b.value=D)})):p(f)==="paste"?(w(),R("div",Jye,[A("div",e2e,[p(h)?oe("",!0):(w(),R("div",t2e,[...x[10]||(x[10]=[He(" category Gold Silver Bronze",-1),A("br",null,null,-1),He(" USA 40 44 42",-1),A("br",null,null,-1),He(" China 38 32 19 ",-1)])])),Go(A("textarea",{ref_key:"pasteArea",ref:m,"onUpdate:modelValue":x[4]||(x[4]=D=>Ze(h)?h.value=D:null),class:"upload-card__paste__wrap__area",spellcheck:"false",onPaste:g},null,544),[[uf,p(h)]])]),A("div",n2e,[A("div",o2e,[(w(!0),R(Re,null,vt(p(e),D=>(w(),R("span",{key:D,class:"upload-card__paste__footer__hint__kbd"},pe(D),1))),128)),x[11]||(x[11]=He(" paste from spreadsheet ",-1))]),A("button",{class:"upload-card__paste__footer__btn",disabled:!p(h).trim(),onClick:x[5]||(x[5]=D=>y.$emit("loaded",p(h),"Pasted"))}," Load data ",8,r2e)])])):p(f)==="samples"?(w(),Q(C,{key:2,onSelect:x[6]||(x[6]=D=>y.$emit("sample",D))})):oe("",!0)],2)])}}}),s2e=Be(i2e,[["__scopeId","data-v-8d518e50"]]),a2e=se({__name:"DataPanel",setup(t){const e=pr(),{dataView:n}=Tt(e),{setDataView:o}=e,r=er(),{applyDsl:i}=Jc(),{loadSample:s}=Pr(),{next:a}=xx(),l=Tt(WB()),{activeScene:c,activeIndex:u,update:d}=Sn(),f=S(()=>c.value!==null);vn(()=>{r.columns.value.length>0?o("structure"):o("upload")});function h(){if(!r.rawInput.value||r.sourceFormat.value!=="delimited")return;const v=Tb(r.rawInput.value,{firstRowIsHeader:l.firstRowIsHeader.value,delimiter:l.delimiter.value,decimalSeparator:l.decimalSeparator.value,trimWhitespace:l.trimWhitespace.value});r.loadParsed(v)}function m(v,y){if(f.value&&u.value>=0){const x=Tb(v,{firstRowIsHeader:l.firstRowIsHeader.value,delimiter:l.delimiter.value,decimalSeparator:l.decimalSeparator.value,trimWhitespace:l.trimWhitespace.value}),_=Lg(x.columns,x.rows);d(u.value,{data:_}),o("structure");return}r.rawInput.value=v,r.sourceFormat.value="delimited",r.sourceLabel.value=y||"Pasted",h(),o("structure")}function b(v,y){i(v),r.sourceLabel.value=y||"Blueprint file",a()}function g(v){if(f.value&&u.value>=0){d(u.value,{data:v.serializedData}),o("structure");return}s(v),a()}return Ke([()=>l.firstRowIsHeader.value,()=>l.delimiter.value,()=>l.decimalSeparator.value,()=>l.trimWhitespace.value],()=>{r.rawInput.value&&n.value==="structure"&&h()}),(v,y)=>{const x=s2e,_=Eye;return w(),R("div",{class:Te(["data-panel",{"data-panel--structure":p(n)==="structure"}])},[p(n)==="upload"?(w(),Q(x,{key:0,onLoaded:m,onBpc:b,onSample:g,onCancel:y[0]||(y[0]=C=>p(o)("structure"))})):(w(),Q(_,{key:1}))],2)}}}),l2e=Be(a2e,[["__scopeId","data-v-4fa651c7"]]),c2e=["aria-label","aria-disabled","disabled"],u2e={class:"panel-open-button__label"},d2e=se({__name:"PanelOpenButton",props:{label:{},icon:{default:()=>fO},disabled:{type:Boolean,default:!1}},emits:["open"],setup(t,{emit:e}){const n=e;function o(){n("open")}return(r,i)=>(w(),R("button",{class:"panel-open-button",type:"button","aria-label":t.label,"aria-disabled":t.disabled?"true":void 0,disabled:t.disabled,onClick:o},[(w(),Q(Rt(t.icon),{class:"panel-open-button__icon","aria-hidden":"true"})),A("span",u2e,pe(t.label),1)],8,c2e))}}),f2e=Be(d2e,[["__scopeId","data-v-218f5209"]]),h2e={class:"layout-narrow-dock",role:"toolbar","aria-label":"Wizard controls"},p2e={class:"layout-narrow-dock__timeline"},m2e={class:"layout-narrow-dock__action"},g2e=se({__name:"LayoutNarrowDock",props:{showTimeline:{type:Boolean},scenes:{},activeIndex:{},playing:{type:Boolean},panelLabel:{},panelIcon:{default:void 0},panelDisabled:{type:Boolean,default:!1},scenesSheetOpen:{type:Boolean,default:!1}},emits:["update:activeIndex","play","pause","expand-timeline","open-panel"],setup(t,{emit:e}){const n=e;function o(r){n("update:activeIndex",r)}return(r,i)=>(w(),R("div",h2e,[A("div",p2e,[t.showTimeline?(w(),Q(p(Dq),{key:0,scenes:t.scenes,"active-index":t.activeIndex,playing:t.playing,expanded:t.scenesSheetOpen,"onUpdate:activeIndex":o,onPlay:i[0]||(i[0]=s=>n("play")),onPause:i[1]||(i[1]=s=>n("pause")),onExpand:i[2]||(i[2]=s=>n("expand-timeline"))},null,8,["scenes","active-index","playing","expanded"])):oe("",!0)]),A("div",m2e,[H(f2e,{label:t.panelLabel,icon:t.panelIcon,disabled:t.panelDisabled,onOpen:i[3]||(i[3]=s=>n("open-panel"))},null,8,["label","icon","disabled"])])]))}}),v2e=Be(g2e,[["__scopeId","data-v-cc656101"]]),b2e={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"};function y2e(t,e){return w(),R("svg",b2e,[...e[0]||(e[0]=[A("path",{fill:"currentColor",d:"M224 48H32a8 8 0 0 0-8 8v136a16 16 0 0 0 16 16h176a16 16 0 0 0 16-16V56a8 8 0 0 0-8-8M40 112h40v32H40Zm56 0h120v32H96Zm120-48v32H40V64ZM40 160h40v32H40Zm176 32H96v-32h120z"},null,-1)])])}const qS=Oe({name:"ph-table",render:y2e}),x2e={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"};function w2e(t,e){return w(),R("svg",x2e,[...e[0]||(e[0]=[A("path",{fill:"currentColor",d:"M216 112v96a16 16 0 0 1-16 16H56a16 16 0 0 1-16-16v-96a16 16 0 0 1 16-16h24a8 8 0 0 1 0 16H56v96h144v-96h-24a8 8 0 0 1 0-16h24a16 16 0 0 1 16 16M93.66 69.66L120 43.31V136a8 8 0 0 0 16 0V43.31l26.34 26.35a8 8 0 0 0 11.32-11.32l-40-40a8 8 0 0 0-11.32 0l-40 40a8 8 0 0 0 11.32 11.32"},null,-1)])])}const YS=Oe({name:"ph-export",render:w2e}),_2e=1500;function k2e(t){const e=Ne("idle");let n=null;async function o(){if(!t.isSignedIn()||!t.isCloudChart())return;e.value="saving";const i=await t.pushCloud(t.snapshot());e.value=i?"saved":"offline"}function r(){!t.isSignedIn()||!t.isCloudChart()||(n&&clearTimeout(n),n=setTimeout(()=>{n=null,o()},_2e))}return{status:e,requestSync:r,flush:o}}function S2e(){const{isSignedIn:t}=fl(),{isCloudBacked:e,syncCloud:n}=dl(),{sessionId:o,lastSavedAt:r}=Pr(),{title:i,chartType:s}=dn(),{generateDsl:a}=yc(),l=k2e({isSignedIn:()=>t.value,isCloudChart:()=>!!o.value&&e(o.value),pushCloud:n,snapshot:()=>({id:o.value,dsl:a(),meta:Dg(o.value),title:i.value,chartType:s.value})});return Ke(r,()=>{l.requestSync()}),l}const C2e={class:"wizard-shell"},A2e=["title","aria-label"],$2e={class:"wizard-shell__main"},T2e={class:"wizard-shell__content"},O2e=se({__name:"WizardShell",setup(t){const{currentStep:e,currentIndex:n,steps:o,registerCreateSession:r}=xx(),i=er(),s=dn(),{sessionId:a,createSession:l,lastSavedAt:c}=Pr();ms()&&S2e();const{markCloudBacked:u}=dl(),{isSignedIn:d}=fl(),f=Sn(),{scenes:h,activeIndex:m,activeScene:b,playing:g,startPlayback:v,stopPlayback:y}=f,x=S(()=>b.value!==null),{baseOptions:_}=Cn(),C=Rr(),D=Fe([]),M=S(()=>c.value?new Date(c.value):""),$=NR(M),L=S(()=>M.value?`saved ${$.value}`:null),{isNarrow:E}=Yr("lg"),{isNarrow:N}=Yr("md"),{isNarrow:T}=Yr(),O=pr(),{dataView:P}=Tt(O),B=Ng(),V=Fe(!1),z=S(()=>{switch(e.value.key){case"data":return"Data panel";case"edit":return"Edit panel";case"export":return"Export panel";default:return"Open panel"}}),G=S(()=>{switch(e.value.key){case"data":return qS;case"edit":return Gs;case"export":return YS;default:return Gs}}),K=S(()=>e.value.key==="data"&&i.rows.value.length===0);function ne(){if(!K.value)if(e.value.key==="data"){let q=O.lastNarrowDataTab.value;x.value&&q==="parsing"&&(q="column"),O.openDataPanel(q)}else e.value.key==="edit"?O.selectTab(O.lastNarrowEditTab.value):e.value.key==="export"&&B.setExportTab(B.lastNarrowExportTab.value)}function ae(){V.value=!0}function he(q){ie(q),V.value=!1}const ge={data:qS,edit:Gs,export:YS},le=o.map(q=>({label:q.label,key:q.key,icon:ge[q.key]})),fe=S(()=>i.rows.value.length>0?[]:[1,2]);function we(){f.add(),f.setActive(h.value.length-1)}const Z=Fe({}),be=[Ve.BarVertical,Ve.BarHorizontal,Ve.Line,Ve.VerticalBar,Ve.HorizontalBar];function re(q){var te,ue,ye;const Y=ks(q.dataStr);if((te=Y.series)!=null&&te.length&&be.includes(q.chartType)){const _e=Y.series.find(Ae=>Ae.name===s._base.selectedColumn.value);_e&&(Y.values=_e.values),delete Y.series}return px(q.chartType,Y,q.typeOpts,q.sort,{colorizes:(ue=q.colorizes)!=null&&ue.length?q.colorizes:void 0,seriesOverrides:(ye=q.seriesOverrides)!=null&&ye.length?q.seriesOverrides:void 0})}function ve(q,Y){var te;if((q==null?void 0:q.data)!==void 0)return q.data;if((te=q==null?void 0:q.transforms)!=null&&te.length&&i.columns.value.length>0){const ue=C.applyStepList(q.transforms,i.columns.value,i.rows.value,i.columnTypes.value);return Lg(ue.columns,ue.rows)}return Y}function ce(){const q=s._base,Y={};Y[0]=re({chartType:q.chartType.value,dataStr:q.data.value,typeOpts:_.value,sort:q.sort.value,colorizes:q.colorizes.value,seriesOverrides:q.seriesOverrides.value});for(let te=0;te<h.value.length;te++){const ue=Ka(h.value,te);Y[te+1]=re({chartType:(ue==null?void 0:ue.chartType)??q.chartType.value,dataStr:ve(ue,q.data.value),typeOpts:ue!=null&&ue.chartTypeOptions?{..._.value,...ue.chartTypeOptions}:_.value,sort:WT(ue)??q.sort.value,colorizes:(ue==null?void 0:ue.colorizes)??q.colorizes.value,seriesOverrides:(ue==null?void 0:ue.seriesOverrides)??q.seriesOverrides.value})}Z.value=Y}const I=wR(ce,300);Ke([()=>h.value,s._base.chartType,s._base.data,s._base.sort,s._base.colorizes,s._base.seriesOverrides,s._base.selectedColumn,_,e],()=>{e.value.key==="edit"&&I()},{deep:!0});function U(q){var ye;const Y=s._base.title.value;if(q<0)return Y||" ";const te=Ka(h.value,q),ue=(ye=te==null?void 0:te.properties)==null?void 0:ye.title;return ue!==void 0?ue||" ":Y||" "}const j=S(()=>{const q={name:U(-1),index:0,removable:!1,thumbnail:Z.value[0]??null,hint:"base scene"},Y=h.value.map((te,ue)=>{const ye=ue+1,_e=HT(h.value,ue);let Ae;return _e===ue?Ae="custom data":_e<0?Ae="inherits base":Ae=`inherits ${U(_e)||`Scene ${_e+1}`}`,{name:U(ue),index:ye,removable:!0,thumbnail:Z.value[ye]??null,hint:Ae}});return[q,...Y]}),ee=S(()=>m.value+1);function ie(q){f.setActive(q-1)}function de(q){q<=0||f.remove(q-1)}const ke=S(()=>{const q=e.value.key;return q==="export"||q==="data"&&P.value==="upload"?!1:q==="edit"?!0:h.value.length>=1});wi(VB,{scenes:j,activeIndex:ee,playing:g,showTimeline:ke,onSelect:ie,onAdd:we,onRemove:de,onPlay:v,onPause:y}),Ke(m,(q,Y)=>{var te,ue;e.value.key==="data"&&(Y===-1&&q>=0?(D.value=C.snapshot(),C.hydrate(((te=h.value[q])==null?void 0:te.transforms)??[])):Y>=0&&q===-1?(f.update(Y,{transforms:C.snapshot()}),C.hydrate(D.value)):Y>=0&&q>=0&&(f.update(Y,{transforms:C.snapshot()}),C.hydrate(((ue=h.value[q])==null?void 0:ue.transforms)??[])))}),vn(()=>{e.value.key==="edit"&&s._base.data.value&&ce()});function X(){m.value>=0&&(f.update(m.value,{transforms:C.snapshot()}),C.hydrate(D.value),f.setActive(-1)),s._base.data.value=i.serialize();const q=s._base.chartType.value,Y=q.includes("multi")||q.includes("stacked")||q===Ve.BarSplit||q===Ve.BarGrouped;if(i.columns.value.length>2&&!Y){const te=i.columnTypes.value[0]==="date";s._base.chartType.value=te?Ve.LineMulti:Ve.BarMulti}}return r(()=>{X();const q=l();return ms()&&d.value&&u(q),q}),Ke(()=>e.value.key,(q,Y)=>{Y==="data"&&q==="edit"&&a.value&&X()}),FN(()=>{qie()}),(q,Y)=>{const te=l2e,ue=e1e,ye=_ue;return w(),R("div",C2e,[H(uO,{class:"wizard-shell__header"},{start:J(()=>[H(dO),p(L)&&p(E)?(w(),R("span",{key:0,class:"wizard-shell__saved-dot",role:"status","aria-live":"polite",title:p(L),"aria-label":p(L)},null,8,A2e)):oe("",!0)]),center:J(()=>[H(p(KU),{"current-step":p(n),"onUpdate:currentStep":Y[0]||(Y[0]=_e=>Ze(n)?n.value=_e:null),steps:p(le),"disabled-steps":p(fe),layout:p(N)?"stacked":"inline"},null,8,["current-step","steps","disabled-steps","layout"])]),end:J(()=>[p(L)&&!p(E)?(w(),Q(p(jy),{key:0,variant:"success",pill:"",class:"wizard-shell__saved",role:"status","aria-live":"polite"},{default:J(()=>[Y[2]||(Y[2]=A("span",{class:"wizard-shell__saved__dot"},null,-1)),He(" "+pe(p(L)),1)]),_:1})):oe("",!0)]),_:1}),A("div",$2e,[A("div",T2e,[p(e).key==="data"?(w(),Q(te,{key:0})):p(e).key==="edit"?(w(),Q(ue,{key:1})):p(e).key==="export"?(w(),Q(ye,{key:2})):oe("",!0)]),p(T)?(w(),Q(v2e,{key:0,"show-timeline":p(ke),scenes:p(j),"active-index":p(ee),playing:p(g),"panel-label":p(z),"panel-icon":p(G),"panel-disabled":p(K),"scenes-sheet-open":p(V),"onUpdate:activeIndex":ie,onPlay:p(v),onPause:p(y),onExpandTimeline:ae,onOpenPanel:ne},null,8,["show-timeline","scenes","active-index","playing","panel-label","panel-icon","panel-disabled","scenes-sheet-open","onPlay","onPause"])):oe("",!0),p(T)?(w(),Q(p(CA),{key:1,modelValue:p(V),"onUpdate:modelValue":Y[1]||(Y[1]=_e=>Ze(V)?V.value=_e:null),title:"Scenes"},{default:J(()=>[H(p(Yq),{scenes:p(j),"active-index":p(ee),playing:p(g),"onUpdate:activeIndex":he,onAdd:we,onRemove:de,onPlay:p(v),onPause:p(y)},null,8,["scenes","active-index","playing","onPlay","onPause"])]),_:1},8,["modelValue"])):oe("",!0)])])}}}),ap=Be(O2e,[["__scopeId","data-v-c364e526"]]),M2e={class:"render-page"},B2e=se({__name:"RenderPage",setup(t){const e=uc(),n=bt("containerRef"),{applyDsl:o}=Jc();Sx(n);const{layout:r}=dn(),{cardClass:i,cardStyle:s}=kx(r,"render-page__card"),{scenes:a,activeIndex:l,playing:c,setActive:u,nextScene:d,previousScene:f,startPlayback:h,stopPlayback:m}=Sn(),b={buttons:nb,"progress-bar":PA,"dot-stepper":DA,"minimal-arrows":EA},g=S(()=>b[r.value.playerType]||nb),v=S(()=>a.value.length+1),y=S(()=>l.value+2),x=S(()=>a.value.length>=1);function _(L){u(L-2)}const C=Fe(null);function D(){var L;return((L=n.value)==null?void 0:L.querySelector(".bc-frame-footer"))??null}let M=null;Ke(n,L=>{if(M&&(M.disconnect(),M=null),!L){C.value=null;return}C.value=D(),M=new MutationObserver(()=>{C.value=D()}),M.observe(L,{childList:!0,subtree:!0})},{immediate:!0}),oa(()=>{M&&(M.disconnect(),M=null)});function $(L){try{const E=globalThis.atob(L),N=Uint8Array.from(E,O=>O.charCodeAt(0)),T=new TextDecoder().decode(N);o(T)}catch{}}return vn(async()=>{const L=e.query.id;if(L&&ms()){const{fetchPublished:N}=dl(),T=await N(L);T&&o(T);return}const E=e.query.bpc64;E&&$(E)}),(L,E)=>(w(),R("div",M2e,[A("div",{ref_key:"containerRef",ref:n,class:Te(["render-page__card",p(i)]),style:Lt(p(s))},null,6),p(C)&&p(x)?(w(),Q(Oy,{key:0,to:p(C)},[(w(),Q(Rt(p(g)),{total:p(v),current:p(y),playing:p(c),position:p(r).playerPosition,"onUpdate:current":_,onPrevious:p(f),onNext:p(d),onPlay:p(h),onPause:p(m)},null,40,["total","current","playing","position","onPrevious","onNext","onPlay","onPause"]))],8,["to"])):oe("",!0)]))}}),L2e=Be(B2e,[["__scopeId","data-v-f1797748"]]);async function _1(t){var i;const{sessionId:e,loadChart:n,startAutoSave:o}=Pr(),r=t.params.id;if(e.value!==r){if(n(r)){o();return}if(ms()){const s=fl();await s.init();const a=(i=s.user.value)==null?void 0:i.id;if(a){const l=dl(),c=await l.loadCloud(r);if(c&&c.owner===a&&(localStorage.setItem(ns(r),c.dsl),c.meta&&Object.keys(c.meta).length>0&&localStorage.setItem(Pa(r),JSON.stringify(c.meta)),l.markCloudBacked(r),n(r))){o();return}}return`/render?id=${r}`}return"/charts"}}function P2e(t){if(!t)return null;try{const e=t.replace(/-/g,"+").replace(/_/g,"/"),n=e.length%4===0?"":"=".repeat(4-e.length%4),o=atob(e+n),r=new Uint8Array(o.length);for(let i=0;i<o.length;i++)r[i]=o.charCodeAt(i);return new TextDecoder().decode(r)}catch{return null}}const D2e=hR({history:GN(),scrollBehavior(t,e,n){return n||(t.hash?{el:t.hash,behavior:"smooth"}:{top:0})},routes:[{path:"/",component:()=>ob(()=>import("./LandingPage-C542_Pma.js"),__vite__mapDeps([0,1]))},{path:"/charts",component:kle},{path:"/new",component:ap,beforeEnter:()=>{const{prepareNew:t}=Pr();t()}},{path:"/edit/:id",redirect:t=>`/edit/${t.params.id}/visualize`},{path:"/copy",component:()=>ob(()=>import("./CopyRedirect-DR8CwSti.js"),[]),meta:{bare:!0},beforeEnter:t=>{const e=t.query.bpc64,n=P2e(typeof e=="string"?e:"");if(!n)return"/";const{createFromDsl:o}=Pr(),r=o(n);if(!r)return"/";t.meta.copyTarget=`/edit/${r}/visualize`}},{path:"/edit/:id/data",component:ap,beforeEnter:_1},{path:"/edit/:id/visualize",component:ap,beforeEnter:_1},{path:"/edit/:id/export",component:ap,beforeEnter:_1},{path:"/render",component:L2e,meta:{bare:!0}}]});async function E2e(){const e=new URLSearchParams(window.location.search).get("code");if(!e)return;const n=await zr();if(n)try{await n.auth.exchangeCodeForSession(e)}catch{}const o=`${window.location.origin}${window.location.pathname}${window.location.hash||"#/charts"}`;window.history.replaceState({},"",o)}async function I2e(){await nj(),ms()&&await E2e();const t=vP();t.use($P),pP(Xse).use(t).use(D2e).use(iN()).mount("#app")}I2e();export{oa as $,hse as A,zn as B,_R as C,IT as D,bt as E,Ut as F,dk as G,jy as H,PY as I,s2 as J,Re as K,vt as L,pe as M,oG as N,Ase as O,wr as P,Oe as Q,Te as R,V2e as S,Mfe as T,wO as U,_O as V,Z1e as W,bx as X,UB as Y,Ne as Z,Be as _,A as a,Ole as a0,Oy as a1,nb as a2,uc as a3,Rm as a4,oe as b,R as c,se as d,t2 as e,Q as f,p as g,g2 as h,H as i,He as j,S as k,ms as l,wm as m,RA as n,w as o,NA as p,MY as q,Ce as r,$Y as s,Ke as t,Yf as u,ps as v,J as w,Mg as x,Fe as y,Ze as z};
|
|
927
|
+
`).filter(a=>a.trim().length>0);return Math.max(0,s.length-1)}const o=po(new Map),r=S(()=>dk.map(i=>({...i,typeLabel:e[i.chartType]??i.chartType,rowCount:n(i.tsvData),thumbSrc:o.get(i.id)})));return vn(()=>{for(const i of dk)if(i.dsl){const s=hx(i.dsl);s&&o.set(i.id,or(s))}}),(i,s)=>(w(),R("div",Iye,[(w(!0),R(Re,null,vt(p(r),a=>(w(),R("div",{key:a.id,class:"sample-card",role:"button",tabindex:"0",onClick:l=>i.$emit("select",a),onKeydown:ar(l=>i.$emit("select",a),["enter"])},[A("div",Rye,[a.thumbSrc?(w(),R("img",{key:0,class:"sample-card__thumb__img",src:a.thumbSrc,alt:a.title},null,8,Fye)):oe("",!0)]),A("div",Vye,[A("div",zye,pe(a.title),1),A("div",Hye,[He(pe(a.typeLabel)+" ",1),s[0]||(s[0]=A("span",{class:"sample-card__info__meta__sep"},"·",-1)),He(" "+pe(a.rowCount)+" rows ",1)])])],40,Nye))),128))]))}}),Uye=Be(Wye,[["__scopeId","data-v-23920b61"]]),Gye=se({__name:"DataUploadFileDrop",emits:["loaded","bpc","dragState"],setup(t,{emit:e}){const n=e,o=Fe(null),r=Ne(!1);function i(f){r.value=f,n("dragState",f)}function s(){i(!0)}function a(){i(!1)}function l(f){return f.name.toLowerCase().endsWith(".bpc")}function c(f){const h=new globalThis.FileReader;h.onload=()=>{typeof h.result=="string"&&n(l(f)?"bpc":"loaded",h.result,f.name)},h.readAsText(f)}function u(f){var m;i(!1);const h=(m=f.dataTransfer)==null?void 0:m.files[0];h&&c(h)}function d(f){var b;const h=f.target,m=(b=h.files)==null?void 0:b[0];m&&c(m),h.value=""}return(f,h)=>(w(),R("div",{class:Te(["file-drop",{"file-drop--active":p(r)}]),onDragover:pn(s,["prevent"]),onDragleave:pn(a,["prevent"]),onDrop:pn(u,["prevent"]),onClick:h[1]||(h[1]=m=>{var b;return(b=p(o))==null?void 0:b.click()})},[h[2]||(h[2]=T7('<div class="file-drop__icon" data-v-f6ebbbc1><svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" data-v-f6ebbbc1><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12" data-v-f6ebbbc1></path></svg></div><div class="file-drop__title" data-v-f6ebbbc1> Drag & drop your file here </div><div class="file-drop__or" data-v-f6ebbbc1> or </div>',3)),A("button",{class:"file-drop__btn",onClick:h[0]||(h[0]=pn(m=>{var b;return(b=p(o))==null?void 0:b.click()},["stop"]))}," Browse files "),h[3]||(h[3]=A("div",{class:"file-drop__formats"},[A("span",{class:"file-drop__formats__tag"},".csv"),A("span",{class:"file-drop__formats__tag"},".tsv"),A("span",{class:"file-drop__formats__tag"},".bpc")],-1)),A("input",{ref_key:"fileInput",ref:o,type:"file",accept:".csv,.tsv,.txt,.bpc",class:"file-drop__input",onChange:d},null,544)],34))}}),qye=Be(Gye,[["__scopeId","data-v-f6ebbbc1"]]),Yye={class:"upload-card"},jye={class:"input-card__tabs"},Kye=["onClick"],Xye={key:0,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Zye={key:1,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Qye={key:2,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},Jye={key:1,class:"upload-card__paste"},e2e={class:"upload-card__paste__wrap"},t2e={key:0,class:"upload-card__paste__wrap__placeholder"},n2e={class:"upload-card__paste__footer"},o2e={class:"upload-card__paste__footer__hint"},r2e=["disabled"],i2e=se({__name:"DataUploadCard",emits:["loaded","bpc","sample","cancel"],setup(t){const e=g2("v").keyLabel.split(" "),{rawInput:n,sourceFormat:o,columns:r,rows:i,displayColumns:s,displayRows:a}=er(),{activeIndex:l,scenes:c}=Sn();function u(){if(l.value<0)return!1;const y=Ka(c.value,l.value);return!!(y!=null&&y.data)}function d(){return u()?xk(s.value,a.value):(o==null?void 0:o.value)==="bpc"&&r.value.length>0?xk(r.value,i.value):n.value}const f=Ne("paste"),h=Ne(d()),m=bt("pasteArea"),b=Ne(!1);function g(y){var _;const x=(_=y.clipboardData)==null?void 0:_.getData("text/plain");x&&(y.preventDefault(),h.value=x,kn(()=>{m.value&&m.value.focus()}))}const v=[{value:"file",text:"File"},{value:"paste",text:"Paste"},{value:"samples",text:"Samples"}];return(y,x)=>{const _=qye,C=Uye;return w(),R("div",Yye,[x[12]||(x[12]=A("h1",{class:"upload-card__title"}," Add your data ",-1)),x[13]||(x[13]=A("p",{class:"upload-card__subtitle"}," Drop a file, paste from a spreadsheet, or pick a sample dataset ",-1)),p(r).length>0?(w(),R("button",{key:0,class:"upload-card__back",onClick:x[0]||(x[0]=D=>y.$emit("cancel"))}," ← Back to table ")):oe("",!0),A("div",{class:Te(["input-card",{"input-card--drag-over":p(b)}])},[A("div",jye,[(w(),R(Re,null,vt(v,D=>A("button",{key:D.value,class:Te(["input-card__tabs__tab",{"input-card__tabs__tab--active":p(f)===D.value}]),onClick:M=>f.value=D.value},[D.value==="file"?(w(),R("svg",Xye,[...x[7]||(x[7]=[A("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12"},null,-1)])])):D.value==="paste"?(w(),R("svg",Zye,[...x[8]||(x[8]=[A("rect",{x:"8",y:"2",width:"8",height:"4",rx:"1"},null,-1),A("path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"},null,-1)])])):(w(),R("svg",Qye,[...x[9]||(x[9]=[A("path",{d:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20"},null,-1),A("path",{d:"M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"},null,-1)])])),He(" "+pe(D.text),1)],10,Kye)),64))]),p(f)==="file"?(w(),Q(_,{key:0,onLoaded:x[1]||(x[1]=(D,M)=>y.$emit("loaded",D,M)),onBpc:x[2]||(x[2]=(D,M)=>y.$emit("bpc",D,M)),onDragState:x[3]||(x[3]=D=>b.value=D)})):p(f)==="paste"?(w(),R("div",Jye,[A("div",e2e,[p(h)?oe("",!0):(w(),R("div",t2e,[...x[10]||(x[10]=[He(" category Gold Silver Bronze",-1),A("br",null,null,-1),He(" USA 40 44 42",-1),A("br",null,null,-1),He(" China 38 32 19 ",-1)])])),Go(A("textarea",{ref_key:"pasteArea",ref:m,"onUpdate:modelValue":x[4]||(x[4]=D=>Ze(h)?h.value=D:null),class:"upload-card__paste__wrap__area",spellcheck:"false",onPaste:g},null,544),[[uf,p(h)]])]),A("div",n2e,[A("div",o2e,[(w(!0),R(Re,null,vt(p(e),D=>(w(),R("span",{key:D,class:"upload-card__paste__footer__hint__kbd"},pe(D),1))),128)),x[11]||(x[11]=He(" paste from spreadsheet ",-1))]),A("button",{class:"upload-card__paste__footer__btn",disabled:!p(h).trim(),onClick:x[5]||(x[5]=D=>y.$emit("loaded",p(h),"Pasted"))}," Load data ",8,r2e)])])):p(f)==="samples"?(w(),Q(C,{key:2,onSelect:x[6]||(x[6]=D=>y.$emit("sample",D))})):oe("",!0)],2)])}}}),s2e=Be(i2e,[["__scopeId","data-v-8d518e50"]]),a2e=se({__name:"DataPanel",setup(t){const e=pr(),{dataView:n}=Tt(e),{setDataView:o}=e,r=er(),{applyDsl:i}=Jc(),{loadSample:s}=Pr(),{next:a}=xx(),l=Tt(WB()),{activeScene:c,activeIndex:u,update:d}=Sn(),f=S(()=>c.value!==null);vn(()=>{r.columns.value.length>0?o("structure"):o("upload")});function h(){if(!r.rawInput.value||r.sourceFormat.value!=="delimited")return;const v=Tb(r.rawInput.value,{firstRowIsHeader:l.firstRowIsHeader.value,delimiter:l.delimiter.value,decimalSeparator:l.decimalSeparator.value,trimWhitespace:l.trimWhitespace.value});r.loadParsed(v)}function m(v,y){if(f.value&&u.value>=0){const x=Tb(v,{firstRowIsHeader:l.firstRowIsHeader.value,delimiter:l.delimiter.value,decimalSeparator:l.decimalSeparator.value,trimWhitespace:l.trimWhitespace.value}),_=Lg(x.columns,x.rows);d(u.value,{data:_}),o("structure");return}r.rawInput.value=v,r.sourceFormat.value="delimited",r.sourceLabel.value=y||"Pasted",h(),o("structure")}function b(v,y){i(v),r.sourceLabel.value=y||"Blueprint file",a()}function g(v){if(f.value&&u.value>=0){d(u.value,{data:v.serializedData}),o("structure");return}s(v),a()}return Ke([()=>l.firstRowIsHeader.value,()=>l.delimiter.value,()=>l.decimalSeparator.value,()=>l.trimWhitespace.value],()=>{r.rawInput.value&&n.value==="structure"&&h()}),(v,y)=>{const x=s2e,_=Eye;return w(),R("div",{class:Te(["data-panel",{"data-panel--structure":p(n)==="structure"}])},[p(n)==="upload"?(w(),Q(x,{key:0,onLoaded:m,onBpc:b,onSample:g,onCancel:y[0]||(y[0]=C=>p(o)("structure"))})):(w(),Q(_,{key:1}))],2)}}}),l2e=Be(a2e,[["__scopeId","data-v-4fa651c7"]]),c2e=["aria-label","aria-disabled","disabled"],u2e={class:"panel-open-button__label"},d2e=se({__name:"PanelOpenButton",props:{label:{},icon:{default:()=>fO},disabled:{type:Boolean,default:!1}},emits:["open"],setup(t,{emit:e}){const n=e;function o(){n("open")}return(r,i)=>(w(),R("button",{class:"panel-open-button",type:"button","aria-label":t.label,"aria-disabled":t.disabled?"true":void 0,disabled:t.disabled,onClick:o},[(w(),Q(Rt(t.icon),{class:"panel-open-button__icon","aria-hidden":"true"})),A("span",u2e,pe(t.label),1)],8,c2e))}}),f2e=Be(d2e,[["__scopeId","data-v-218f5209"]]),h2e={class:"layout-narrow-dock",role:"toolbar","aria-label":"Wizard controls"},p2e={class:"layout-narrow-dock__timeline"},m2e={class:"layout-narrow-dock__action"},g2e=se({__name:"LayoutNarrowDock",props:{showTimeline:{type:Boolean},scenes:{},activeIndex:{},playing:{type:Boolean},panelLabel:{},panelIcon:{default:void 0},panelDisabled:{type:Boolean,default:!1},scenesSheetOpen:{type:Boolean,default:!1}},emits:["update:activeIndex","play","pause","expand-timeline","open-panel"],setup(t,{emit:e}){const n=e;function o(r){n("update:activeIndex",r)}return(r,i)=>(w(),R("div",h2e,[A("div",p2e,[t.showTimeline?(w(),Q(p(Dq),{key:0,scenes:t.scenes,"active-index":t.activeIndex,playing:t.playing,expanded:t.scenesSheetOpen,"onUpdate:activeIndex":o,onPlay:i[0]||(i[0]=s=>n("play")),onPause:i[1]||(i[1]=s=>n("pause")),onExpand:i[2]||(i[2]=s=>n("expand-timeline"))},null,8,["scenes","active-index","playing","expanded"])):oe("",!0)]),A("div",m2e,[H(f2e,{label:t.panelLabel,icon:t.panelIcon,disabled:t.panelDisabled,onOpen:i[3]||(i[3]=s=>n("open-panel"))},null,8,["label","icon","disabled"])])]))}}),v2e=Be(g2e,[["__scopeId","data-v-cc656101"]]),b2e={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"};function y2e(t,e){return w(),R("svg",b2e,[...e[0]||(e[0]=[A("path",{fill:"currentColor",d:"M224 48H32a8 8 0 0 0-8 8v136a16 16 0 0 0 16 16h176a16 16 0 0 0 16-16V56a8 8 0 0 0-8-8M40 112h40v32H40Zm56 0h120v32H96Zm120-48v32H40V64ZM40 160h40v32H40Zm176 32H96v-32h120z"},null,-1)])])}const qS=Oe({name:"ph-table",render:y2e}),x2e={viewBox:"0 0 256 256",width:"1.2em",height:"1.2em"};function w2e(t,e){return w(),R("svg",x2e,[...e[0]||(e[0]=[A("path",{fill:"currentColor",d:"M216 112v96a16 16 0 0 1-16 16H56a16 16 0 0 1-16-16v-96a16 16 0 0 1 16-16h24a8 8 0 0 1 0 16H56v96h144v-96h-24a8 8 0 0 1 0-16h24a16 16 0 0 1 16 16M93.66 69.66L120 43.31V136a8 8 0 0 0 16 0V43.31l26.34 26.35a8 8 0 0 0 11.32-11.32l-40-40a8 8 0 0 0-11.32 0l-40 40a8 8 0 0 0 11.32 11.32"},null,-1)])])}const YS=Oe({name:"ph-export",render:w2e}),_2e=1500;function k2e(t){const e=Ne("idle");let n=null;async function o(){if(!t.isSignedIn()||!t.isCloudChart())return;e.value="saving";const i=await t.pushCloud(t.snapshot());e.value=i?"saved":"offline"}function r(){!t.isSignedIn()||!t.isCloudChart()||(n&&clearTimeout(n),n=setTimeout(()=>{n=null,o()},_2e))}return{status:e,requestSync:r,flush:o}}function S2e(){const{isSignedIn:t}=fl(),{isCloudBacked:e,syncCloud:n}=dl(),{sessionId:o,lastSavedAt:r}=Pr(),{title:i,chartType:s}=dn(),{generateDsl:a}=yc(),l=k2e({isSignedIn:()=>t.value,isCloudChart:()=>!!o.value&&e(o.value),pushCloud:n,snapshot:()=>({id:o.value,dsl:a(),meta:Dg(o.value),title:i.value,chartType:s.value})});return Ke(r,()=>{l.requestSync()}),l}const C2e={class:"wizard-shell"},A2e=["title","aria-label"],$2e={class:"wizard-shell__main"},T2e={class:"wizard-shell__content"},O2e=se({__name:"WizardShell",setup(t){const{currentStep:e,currentIndex:n,steps:o,registerCreateSession:r}=xx(),i=er(),s=dn(),{sessionId:a,createSession:l,lastSavedAt:c}=Pr();ms()&&S2e();const{markCloudBacked:u}=dl(),{isSignedIn:d}=fl(),f=Sn(),{scenes:h,activeIndex:m,activeScene:b,playing:g,startPlayback:v,stopPlayback:y}=f,x=S(()=>b.value!==null),{baseOptions:_}=Cn(),C=Rr(),D=Fe([]),M=S(()=>c.value?new Date(c.value):""),$=NR(M),L=S(()=>M.value?`saved ${$.value}`:null),{isNarrow:E}=Yr("lg"),{isNarrow:N}=Yr("md"),{isNarrow:T}=Yr(),O=pr(),{dataView:P}=Tt(O),B=Ng(),V=Fe(!1),z=S(()=>{switch(e.value.key){case"data":return"Data panel";case"edit":return"Edit panel";case"export":return"Export panel";default:return"Open panel"}}),G=S(()=>{switch(e.value.key){case"data":return qS;case"edit":return Gs;case"export":return YS;default:return Gs}}),K=S(()=>e.value.key==="data"&&i.rows.value.length===0);function ne(){if(!K.value)if(e.value.key==="data"){let q=O.lastNarrowDataTab.value;x.value&&q==="parsing"&&(q="column"),O.openDataPanel(q)}else e.value.key==="edit"?O.selectTab(O.lastNarrowEditTab.value):e.value.key==="export"&&B.setExportTab(B.lastNarrowExportTab.value)}function ae(){V.value=!0}function he(q){ie(q),V.value=!1}const ge={data:qS,edit:Gs,export:YS},le=o.map(q=>({label:q.label,key:q.key,icon:ge[q.key]})),fe=S(()=>i.rows.value.length>0?[]:[1,2]);function we(){f.add(),f.setActive(h.value.length-1)}const Z=Fe({}),be=[Ve.BarVertical,Ve.BarHorizontal,Ve.Line,Ve.VerticalBar,Ve.HorizontalBar];function re(q){var te,ue,ye;const Y=ks(q.dataStr);if((te=Y.series)!=null&&te.length&&be.includes(q.chartType)){const _e=Y.series.find(Ae=>Ae.name===s._base.selectedColumn.value);_e&&(Y.values=_e.values),delete Y.series}return px(q.chartType,Y,q.typeOpts,q.sort,{colorizes:(ue=q.colorizes)!=null&&ue.length?q.colorizes:void 0,seriesOverrides:(ye=q.seriesOverrides)!=null&&ye.length?q.seriesOverrides:void 0})}function ve(q,Y){var te;if((q==null?void 0:q.data)!==void 0)return q.data;if((te=q==null?void 0:q.transforms)!=null&&te.length&&i.columns.value.length>0){const ue=C.applyStepList(q.transforms,i.columns.value,i.rows.value,i.columnTypes.value);return Lg(ue.columns,ue.rows)}return Y}function ce(){const q=s._base,Y={};Y[0]=re({chartType:q.chartType.value,dataStr:q.data.value,typeOpts:_.value,sort:q.sort.value,colorizes:q.colorizes.value,seriesOverrides:q.seriesOverrides.value});for(let te=0;te<h.value.length;te++){const ue=Ka(h.value,te);Y[te+1]=re({chartType:(ue==null?void 0:ue.chartType)??q.chartType.value,dataStr:ve(ue,q.data.value),typeOpts:ue!=null&&ue.chartTypeOptions?{..._.value,...ue.chartTypeOptions}:_.value,sort:WT(ue)??q.sort.value,colorizes:(ue==null?void 0:ue.colorizes)??q.colorizes.value,seriesOverrides:(ue==null?void 0:ue.seriesOverrides)??q.seriesOverrides.value})}Z.value=Y}const I=wR(ce,300);Ke([()=>h.value,s._base.chartType,s._base.data,s._base.sort,s._base.colorizes,s._base.seriesOverrides,s._base.selectedColumn,_,e],()=>{e.value.key==="edit"&&I()},{deep:!0});function U(q){var ye;const Y=s._base.title.value;if(q<0)return Y||" ";const te=Ka(h.value,q),ue=(ye=te==null?void 0:te.properties)==null?void 0:ye.title;return ue!==void 0?ue||" ":Y||" "}const j=S(()=>{const q={name:U(-1),index:0,removable:!1,thumbnail:Z.value[0]??null,hint:"base scene"},Y=h.value.map((te,ue)=>{const ye=ue+1,_e=HT(h.value,ue);let Ae;return _e===ue?Ae="custom data":_e<0?Ae="inherits base":Ae=`inherits ${U(_e)||`Scene ${_e+1}`}`,{name:U(ue),index:ye,removable:!0,thumbnail:Z.value[ye]??null,hint:Ae}});return[q,...Y]}),ee=S(()=>m.value+1);function ie(q){f.setActive(q-1)}function de(q){q<=0||f.remove(q-1)}const ke=S(()=>{const q=e.value.key;return q==="export"||q==="data"&&P.value==="upload"?!1:q==="edit"?!0:h.value.length>=1});wi(VB,{scenes:j,activeIndex:ee,playing:g,showTimeline:ke,onSelect:ie,onAdd:we,onRemove:de,onPlay:v,onPause:y}),Ke(m,(q,Y)=>{var te,ue;e.value.key==="data"&&(Y===-1&&q>=0?(D.value=C.snapshot(),C.hydrate(((te=h.value[q])==null?void 0:te.transforms)??[])):Y>=0&&q===-1?(f.update(Y,{transforms:C.snapshot()}),C.hydrate(D.value)):Y>=0&&q>=0&&(f.update(Y,{transforms:C.snapshot()}),C.hydrate(((ue=h.value[q])==null?void 0:ue.transforms)??[])))}),vn(()=>{e.value.key==="edit"&&s._base.data.value&&ce()});function X(){m.value>=0&&(f.update(m.value,{transforms:C.snapshot()}),C.hydrate(D.value),f.setActive(-1)),s._base.data.value=i.serialize();const q=s._base.chartType.value,Y=q.includes("multi")||q.includes("stacked")||q===Ve.BarSplit||q===Ve.BarGrouped;if(i.columns.value.length>2&&!Y){const te=i.columnTypes.value[0]==="date";s._base.chartType.value=te?Ve.LineMulti:Ve.BarMulti}}return r(()=>{X();const q=l();return ms()&&d.value&&u(q),q}),Ke(()=>e.value.key,(q,Y)=>{Y==="data"&&q==="edit"&&a.value&&X()}),FN(()=>{qie()}),(q,Y)=>{const te=l2e,ue=e1e,ye=_ue;return w(),R("div",C2e,[H(uO,{class:"wizard-shell__header"},{start:J(()=>[H(dO),p(L)&&p(E)?(w(),R("span",{key:0,class:"wizard-shell__saved-dot",role:"status","aria-live":"polite",title:p(L),"aria-label":p(L)},null,8,A2e)):oe("",!0)]),center:J(()=>[H(p(KU),{"current-step":p(n),"onUpdate:currentStep":Y[0]||(Y[0]=_e=>Ze(n)?n.value=_e:null),steps:p(le),"disabled-steps":p(fe),layout:p(N)?"stacked":"inline"},null,8,["current-step","steps","disabled-steps","layout"])]),end:J(()=>[p(L)&&!p(E)?(w(),Q(p(jy),{key:0,variant:"success",pill:"",class:"wizard-shell__saved",role:"status","aria-live":"polite"},{default:J(()=>[Y[2]||(Y[2]=A("span",{class:"wizard-shell__saved__dot"},null,-1)),He(" "+pe(p(L)),1)]),_:1})):oe("",!0)]),_:1}),A("div",$2e,[A("div",T2e,[p(e).key==="data"?(w(),Q(te,{key:0})):p(e).key==="edit"?(w(),Q(ue,{key:1})):p(e).key==="export"?(w(),Q(ye,{key:2})):oe("",!0)]),p(T)?(w(),Q(v2e,{key:0,"show-timeline":p(ke),scenes:p(j),"active-index":p(ee),playing:p(g),"panel-label":p(z),"panel-icon":p(G),"panel-disabled":p(K),"scenes-sheet-open":p(V),"onUpdate:activeIndex":ie,onPlay:p(v),onPause:p(y),onExpandTimeline:ae,onOpenPanel:ne},null,8,["show-timeline","scenes","active-index","playing","panel-label","panel-icon","panel-disabled","scenes-sheet-open","onPlay","onPause"])):oe("",!0),p(T)?(w(),Q(p(CA),{key:1,modelValue:p(V),"onUpdate:modelValue":Y[1]||(Y[1]=_e=>Ze(V)?V.value=_e:null),title:"Scenes"},{default:J(()=>[H(p(Yq),{scenes:p(j),"active-index":p(ee),playing:p(g),"onUpdate:activeIndex":he,onAdd:we,onRemove:de,onPlay:p(v),onPause:p(y)},null,8,["scenes","active-index","playing","onPlay","onPause"])]),_:1},8,["modelValue"])):oe("",!0)])])}}}),ap=Be(O2e,[["__scopeId","data-v-c364e526"]]),M2e={class:"render-page"},B2e=se({__name:"RenderPage",setup(t){const e=uc(),n=bt("containerRef"),{applyDsl:o}=Jc();Sx(n);const{layout:r}=dn(),{cardClass:i,cardStyle:s}=kx(r,"render-page__card"),{scenes:a,activeIndex:l,playing:c,setActive:u,nextScene:d,previousScene:f,startPlayback:h,stopPlayback:m}=Sn(),b={buttons:nb,"progress-bar":PA,"dot-stepper":DA,"minimal-arrows":EA},g=S(()=>b[r.value.playerType]||nb),v=S(()=>a.value.length+1),y=S(()=>l.value+2),x=S(()=>a.value.length>=1);function _(L){u(L-2)}const C=Fe(null);function D(){var L;return((L=n.value)==null?void 0:L.querySelector(".bc-frame-footer"))??null}let M=null;Ke(n,L=>{if(M&&(M.disconnect(),M=null),!L){C.value=null;return}C.value=D(),M=new MutationObserver(()=>{C.value=D()}),M.observe(L,{childList:!0,subtree:!0})},{immediate:!0}),oa(()=>{M&&(M.disconnect(),M=null)});function $(L){try{const E=globalThis.atob(L),N=Uint8Array.from(E,O=>O.charCodeAt(0)),T=new TextDecoder().decode(N);o(T)}catch{}}return vn(async()=>{const L=e.query.id;if(L&&ms()){const{fetchPublished:N}=dl(),T=await N(L);T&&o(T);return}const E=e.query.bpc64;E&&$(E)}),(L,E)=>(w(),R("div",M2e,[A("div",{ref_key:"containerRef",ref:n,class:Te(["render-page__card",p(i)]),style:Lt(p(s))},null,6),p(C)&&p(x)?(w(),Q(Oy,{key:0,to:p(C)},[(w(),Q(Rt(p(g)),{total:p(v),current:p(y),playing:p(c),position:p(r).playerPosition,"onUpdate:current":_,onPrevious:p(f),onNext:p(d),onPlay:p(h),onPause:p(m)},null,40,["total","current","playing","position","onPrevious","onNext","onPlay","onPause"]))],8,["to"])):oe("",!0)]))}}),L2e=Be(B2e,[["__scopeId","data-v-f1797748"]]);async function _1(t){var i;const{sessionId:e,loadChart:n,startAutoSave:o}=Pr(),r=t.params.id;if(e.value!==r){if(n(r)){o();return}if(ms()){const s=fl();await s.init();const a=(i=s.user.value)==null?void 0:i.id;if(a){const l=dl(),c=await l.loadCloud(r);if(c&&c.owner===a&&(localStorage.setItem(ns(r),c.dsl),c.meta&&Object.keys(c.meta).length>0&&localStorage.setItem(Pa(r),JSON.stringify(c.meta)),l.markCloudBacked(r),n(r))){o();return}}return`/render?id=${r}`}return"/charts"}}function P2e(t){if(!t)return null;try{const e=t.replace(/-/g,"+").replace(/_/g,"/"),n=e.length%4===0?"":"=".repeat(4-e.length%4),o=atob(e+n),r=new Uint8Array(o.length);for(let i=0;i<o.length;i++)r[i]=o.charCodeAt(i);return new TextDecoder().decode(r)}catch{return null}}const D2e=hR({history:GN(),scrollBehavior(t,e,n){return n||(t.hash?{el:t.hash,behavior:"smooth"}:{top:0})},routes:[{path:"/",component:()=>ob(()=>import("./LandingPage-mQMQYQqJ.js"),__vite__mapDeps([0,1]))},{path:"/charts",component:kle},{path:"/new",component:ap,beforeEnter:()=>{const{prepareNew:t}=Pr();t()}},{path:"/edit/:id",redirect:t=>`/edit/${t.params.id}/visualize`},{path:"/copy",component:()=>ob(()=>import("./CopyRedirect-CZMEmM8M.js"),[]),meta:{bare:!0},beforeEnter:t=>{const e=t.query.bpc64,n=P2e(typeof e=="string"?e:"");if(!n)return"/";const{createFromDsl:o}=Pr(),r=o(n);if(!r)return"/";t.meta.copyTarget=`/edit/${r}/visualize`}},{path:"/edit/:id/data",component:ap,beforeEnter:_1},{path:"/edit/:id/visualize",component:ap,beforeEnter:_1},{path:"/edit/:id/export",component:ap,beforeEnter:_1},{path:"/render",component:L2e,meta:{bare:!0}}]});async function E2e(){const e=new URLSearchParams(window.location.search).get("code");if(!e)return;const n=await zr();if(n)try{await n.auth.exchangeCodeForSession(e)}catch{}const o=`${window.location.origin}${window.location.pathname}${window.location.hash||"#/charts"}`;window.history.replaceState({},"",o)}async function I2e(){await nj(),ms()&&await E2e();const t=vP();t.use($P),pP(Xse).use(t).use(D2e).use(iN()).mount("#app")}I2e();export{oa as $,hse as A,zn as B,_R as C,IT as D,bt as E,Ut as F,dk as G,jy as H,PY as I,s2 as J,Re as K,vt as L,pe as M,oG as N,Ase as O,wr as P,Oe as Q,Te as R,V2e as S,Mfe as T,wO as U,_O as V,Z1e as W,bx as X,UB as Y,Ne as Z,Be as _,A as a,Ole as a0,Oy as a1,nb as a2,uc as a3,Rm as a4,oe as b,R as c,se as d,t2 as e,Q as f,p as g,g2 as h,H as i,He as j,S as k,ms as l,wm as m,RA as n,w as o,NA as p,MY as q,Ce as r,$Y as s,Ke as t,Yf as u,ps as v,J as w,Mg as x,Fe as y,Ze as z};
|
package/dist/index.html
CHANGED
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
<meta name="twitter:image" content="https://blueprintchart.com/og-image.png" />
|
|
41
41
|
|
|
42
42
|
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300..700;1,9..40,300..700&family=DM+Serif+Display:ital@0;1&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
|
43
|
-
<script type="module" crossorigin src="/assets/index-
|
|
43
|
+
<script type="module" crossorigin src="/assets/index-dPXN_1BF.js"></script>
|
|
44
44
|
<link rel="stylesheet" crossorigin href="/assets/index-CusjLjZK.css">
|
|
45
45
|
</head>
|
|
46
46
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blueprint-chart/editor",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.31",
|
|
4
4
|
"description": "Blueprint Chart editor — static site bundle. Self-host or use the live version at https://blueprintchart.com.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"blueprint-chart",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"pinia-plugin-persistedstate": "^4.7.1",
|
|
47
47
|
"vue": "^3.5",
|
|
48
48
|
"vue-router": "^4.6.4",
|
|
49
|
-
"@blueprint-chart/lib": "0.1.
|
|
50
|
-
"@blueprint-chart/ui": "0.1.
|
|
49
|
+
"@blueprint-chart/lib": "0.1.31",
|
|
50
|
+
"@blueprint-chart/ui": "0.1.31"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@iconify-json/ph": "^1",
|