Current File : /home/inlingua/www/crm/ninexb/wp-content/plugins/fluentform-block/build/index.js |
(()=>{var e,t={501:(e,t,n)=>{"use strict";var i=n(196);const o=window.wp.hooks,r=window.wp.compose,s=window.wp.element,l=(0,r.createHigherOrderComponent)((e=>t=>{const{isSelected:n}=t;return(0,s.useEffect)((()=>{const e=document.querySelector(".interface-interface-skeleton__sidebar");e&&(e.classList.add("ffblock-block-sidebar"),e.addEventListener("scroll",(function(e){e.target.scrollTop>86?this.classList.add("ffblock-sidebar-collapse"):this.classList.remove("ffblock-sidebar-collapse")})))}),[n]),[(0,i.createElement)(e,{...t})]}),"withInspectorControl");(0,o.addFilter)("editor.BlockEdit","ffblock/fluentform",l);const a=window.wp.blocks,c=window.wp.components,h=window.wp.i18n,u=[{label:"Normal",value:"normal"},{label:"Hover",value:"hover"}],f=[{label:(0,h.__)("Classic","fluentform-block"),value:"classic"},{label:(0,h.__)("Gradient","fluentform-block"),value:"gradient"}],d=[{label:(0,h.__)("Default","fluentform-block"),value:""},{label:(0,h.__)("Left Top","fluentform-block"),value:"left top"},{label:(0,h.__)("Left Center","fluentform-block"),value:"left center"},{label:(0,h.__)("Left Bottom","fluentform-block"),value:"left bottom"},{label:(0,h.__)("Right Top","fluentform-block"),value:"right top"},{label:(0,h.__)("Right Center","fluentform-block"),value:"right center"},{label:(0,h.__)("Right Bottom","fluentform-block"),value:"right bottom"},{label:(0,h.__)("Center Top","fluentform-block"),value:"center top"},{label:(0,h.__)("Center Center","fluentform-block"),value:"center center"},{label:(0,h.__)("Center Bottom","fluentform-block"),value:"center bottom"}],p=[{label:(0,h.__)("Default","fluentform-block"),value:""},{label:(0,h.__)("Auto","fluentform-block"),value:"auto"},{label:(0,h.__)("Cover","fluentform-block"),value:"cover"},{label:(0,h.__)("Contain","fluentform-block"),value:"contain"}],m=[{label:(0,h.__)("Default","fluentform-block"),value:""},{label:(0,h.__)("No Repeat","fluentform-block"),value:"no-repeat"},{label:(0,h.__)("Repeat","fluentform-block"),value:"repeat"},{label:(0,h.__)("Repeat X","fluentform-block"),value:"repeat-x"},{label:(0,h.__)("Repeat Y","fluentform-block"),value:"repeat-y"}],g=[{label:(0,h.__)("Default","fluentform-block"),value:""},{label:(0,h.__)("Scroll","fluentform-block"),value:"scroll"},{label:(0,h.__)("Fixed","fluentform-block"),value:"fixed"}],b=[{label:(0,h.__)("None","fluentform-block"),value:"none"},{label:(0,h.__)("Lowercase","fluentform-block"),value:"lowercase"},{label:(0,h.__)("Capitalize","fluentform-block"),value:"capitalize"},{label:(0,h.__)("Uppercase","fluentform-block"),value:"uppercase"}],v=[{label:(0,h.__)("Default","fluentform-block"),value:""},{label:(0,h.__)("Light","fluentform-block"),value:"300"},{label:(0,h.__)("Normal","fluentform-block"),value:"400"},{label:(0,h.__)("Medium","fluentform-block"),value:"500"},{label:(0,h.__)("Semi Bold","fluentform-block"),value:"600"},{label:(0,h.__)("Bold","fluentform-block"),value:"700"},{label:(0,h.__)("Extra Bold","fluentform-block"),value:"800"},{label:(0,h.__)("Heavy Bold","fluentform-block"),value:"900"}],y=[{label:(0,h.__)("Default","fluentform-block"),value:""},{label:(0,h.__)("Normal","fluentform-block"),value:"normal"},{label:(0,h.__)("Italic","fluentform-block"),value:"italic"},{label:(0,h.__)("Oblique","fluentform-block"),value:"oblique"}],w=((0,h.__)("H1","fluentform-block"),(0,h.__)("H2","fluentform-block"),(0,h.__)("H3","fluentform-block"),(0,h.__)("H4","fluentform-block"),(0,h.__)("H5","fluentform-block"),(0,h.__)("H6","fluentform-block"),[{label:(0,h.__)("Default"),value:""},{label:(0,h.__)("None"),value:"none"},{label:(0,h.__)("Solid"),value:"solid"},{label:(0,h.__)("Dashed"),value:"dashed"},{label:(0,h.__)("Dotted"),value:"dotted"},{label:(0,h.__)("Double"),value:"double"},{label:(0,h.__)("Groove"),value:"groove"},{label:(0,h.__)("Inset"),value:"inset"},{label:(0,h.__)("Outset"),value:"outset"},{label:(0,h.__)("Ridge"),value:"ridge"}]),k=((0,h.__)("Select Direction"),(0,h.__)("None"),(0,h.__)("Bottom to top"),(0,h.__)("Top to bottom"),(0,h.__)("Right to left"),(0,h.__)("Left to right"),(0,h.__)("Normal"),(0,h.__)("Top to bottom"),(0,h.__)("Bottom to top"),(0,h.__)("Right to left"),(0,h.__)("Left to right"),(0,h.__)("Zoom in"),(0,h.__)("None"),(0,h.__)("Scale In"),(0,h.__)("Scale Out"),(0,h.__)("Slide Up"),(0,h.__)("Slide Down"),(0,h.__)("Slide Right"),(0,h.__)("Slide Left"),(0,h.__)("1 Col","fluentform-block"),(0,h.__)("2 Col","fluentform-block"),(0,h.__)("3 Col","fluentform-block"),(0,h.__)("4 Col","fluentform-block"),(0,h.__)("5 Col","fluentform-block"),(0,h.__)("6 Col","fluentform-block"),(0,h.__)("7 Col","fluentform-block"),(0,h.__)("8 Col","fluentform-block"),(0,h.__)("1 Col","fluentform-block"),(0,h.__)("2 Col","fluentform-block"),(0,h.__)("3 Col","fluentform-block"),(0,h.__)("4 Col","fluentform-block"),(0,h.__)("5 Col","fluentform-block"),(0,h.__)("6 Col","fluentform-block"),{Arial:{weight:["100","200","300","400","500","600","700","800","900"]},Tahoma:{weight:["100","200","300","400","500","600","700","800","900"]},Helvetica:{weight:["100","200","300","400","500","600","700","800","900"]},"Times New Roman":{weight:["100","200","300","400","500","600","700","800","900"]},Georgia:{weight:["100","200","300","400","500","600","700","800","900"]},"Abhaya Libre":{weight:["400","500","600","700","800"]},ABeeZee:{weight:["400","400i"]},"Abril Fatface":{weight:["400"]},Aclonica:{weight:["400"]},Acme:{weight:["400"]},Actor:{weight:["400"]},Anton:{weight:["400"]},Arvo:{weight:["400","700"]},Asap:{weight:["400","500","600","700"]},"Barlow Condensed":{weight:["100","200","300","400","500","600","700","800","900"]},Barlow:{weight:["100","200","300","400","500","600","700","800","900"]},"Cormorant Garamond":{weight:["300","400","500","600","700"]},Faustina:{weight:["400","500","600","700"]},"Fira Sans":{weight:["100","200","300","400","500","600","700","800","900"]},"IBM Plex Sans":{weight:["100","200","300","400","500","600","700"]},Inconsolata:{weight:["400","700"]},Heebo:{weight:["100","300","400","500","700","800","900"]},Karla:{weight:["400","700"]},Lato:{weight:["100","200","300","400","500","600","700","800","900"]},Lora:{weight:["400","700"]},Merriweather:{weight:["300","400","500","600","700","800","900"]},Montserrat:{weight:["100","200","300","400","500","600","700","800","900"]},"Noto Sans":{weight:["400","700"]},"Noto Serif":{weight:["400","700"]},"Open Sans":{weight:["300","400","500","600","700","800"]},Oswald:{weight:["200","300","400","500","600","700"]},"Playfair Display":{weight:["400","700","900"]},"PT Serif":{weight:["400","700"]},Roboto:{weight:["100","300","400","500","700","900"]},Rubik:{weight:["300","400","500","700","900"]},Tajawal:{weight:["200","300","400","500","700","800","900"]},Ubuntu:{weight:["300","400","500","700"]},Yrsa:{weight:["300","400","500","600","700"]},"Yanone Kaffeesatz":{weight:["200","300","400","500","600","700"]},Yantramanav:{weight:["100","300","400","500","700","900"]}}),{GradientPicker:x}=((0,h.__)("H1","fluentform-block"),(0,h.__)("H2","fluentform-block"),(0,h.__)("H3","fluentform-block"),(0,h.__)("H4","fluentform-block"),(0,h.__)("H5","fluentform-block"),(0,h.__)("H6","fluentform-block"),(0,h.__)("Span","fluentform-block"),(0,h.__)("P","fluentform-block"),wp.components),O=function(e){const{label:t,value:n,onChange:o}=e;return(0,i.createElement)("div",{className:"ffblock-control-field ffblock-control-gradient-wrap"},t&&(0,i.createElement)("div",{className:"ffblock-control-head"},(0,i.createElement)("span",{className:"ffblock-label"},t)),(0,i.createElement)("div",{className:"ffblock-control-body"},(0,i.createElement)(x,{label:"helloooooo",value:n,onChange:e=>(e=>{o(e)})(e),gradients:[{name:"Green",gradient:"linear-gradient(135deg, #80F1A6 0%, #EFD000 100%)",slug:"green"},{name:"Blue",gradient:"linear-gradient(45deg, #0150ec 0%, #0A51BB 100%)",slug:"blue"},{name:"Dark Blue",gradient:"linear-gradient(50deg, #15D2E3 10%, #11D6E2 40%, #10D7E2 80%)",slug:"darkBlue"},{name:"Yellow",gradient:"linear-gradient(135deg, #FBDA61 2.88%, #F76B1C 98.13%)",slug:"yellow"},{name:"Merun",gradient:"linear-gradient(135deg, #E25544 2.88%, #620C90 98.14%)",slug:"merun"}]})))},S=window.wp.blockEditor,{useState:C,useEffect:E}=wp.element,{Dropdown:A,Tooltip:M,ColorPicker:T,Button:D}=wp.components,P=function({label:e,color:t,onChange:n}){const[o,r]=C(t);return E((()=>{r(t)}),[t]),(0,i.createElement)("div",{className:"ffblock-control-field ffblock-control-color-wrap"},e&&(0,i.createElement)("span",{className:"ffblock-label"},e),(0,i.createElement)("div",{className:"ffblock-color"},(0,i.createElement)(A,{contentClassName:"ffblock-components-popover ffblock-cp-color-content",renderToggle:({isOpen:e,onToggle:n})=>(0,i.createElement)(M,{text:t||"default"},(0,i.createElement)("div",{className:"ffblock-color-ball"},(0,i.createElement)("div",{style:{height:25,width:25,borderRadius:"50%",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.1)",backgroundColor:o},"aria-expanded":e,onClick:n,"aria-label":t||"default"}))),renderContent:()=>(0,i.createElement)(T,{color:t,onChangeComplete:e=>(({rgb:e,hex:t})=>{let i=e?`rgba(${e.r},${e.g},${e.b},${e.a})`:t;n(i)})(e)})}),o&&(0,i.createElement)(D,{isSmall:!0,className:"ffblock-reset-btn",icon:"image-rotate",onClick:()=>n(void 0)})))};var R=n(697),$=n.n(R);function _({imageUrl:e,onDeleteImage:t,onEditImage:n=null}){return(0,i.createElement)("div",{className:"ffblock-image-avatar",style:{backgroundImage:`url(${e})`}},(0,i.createElement)("div",{className:"ffblock-img-avt-action-group"},null!==n&&(0,i.createElement)(c.Button,{className:"button ffblock-btn-edit",onClick:n},(0,i.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",width:"1em",height:"1em",fill:"currentColor"},(0,i.createElement)("path",{d:"M497.9 142.1l-46.1 46.1c-4.7 4.7-12.3 4.7-17 0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1 60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8L21.6 362.4.4 483.9c-2.9 16.4 11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3 0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM124.1 339.9c-5.5-5.5-5.5-14.3 0-19.8l154-154c5.5-5.5 14.3-5.5 19.8 0s5.5 14.3 0 19.8l-154 154c-5.5 5.5-14.3 5.5-19.8 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z"}))),(0,i.createElement)(c.Button,{className:"button ffblock-btn-delete",onClick:()=>t()},(0,i.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",width:"1em",height:"1em",fill:"currentColor"},(0,i.createElement)("path",{d:"M160 400C160 408.8 152.8 416 144 416C135.2 416 128 408.8 128 400V192C128 183.2 135.2 176 144 176C152.8 176 160 183.2 160 192V400zM240 400C240 408.8 232.8 416 224 416C215.2 416 208 408.8 208 400V192C208 183.2 215.2 176 224 176C232.8 176 240 183.2 240 192V400zM320 400C320 408.8 312.8 416 304 416C295.2 416 288 408.8 288 400V192C288 183.2 295.2 176 304 176C312.8 176 320 183.2 320 192V400zM317.5 24.94L354.2 80H424C437.3 80 448 90.75 448 104C448 117.3 437.3 128 424 128H416V432C416 476.2 380.2 512 336 512H112C67.82 512 32 476.2 32 432V128H24C10.75 128 0 117.3 0 104C0 90.75 10.75 80 24 80H93.82L130.5 24.94C140.9 9.357 158.4 0 177.1 0H270.9C289.6 0 307.1 9.358 317.5 24.94H317.5zM151.5 80H296.5L277.5 51.56C276 49.34 273.5 48 270.9 48H177.1C174.5 48 171.1 49.34 170.5 51.56L151.5 80zM80 432C80 449.7 94.33 464 112 464H336C353.7 464 368 449.7 368 432V128H80V432z"})))))}_.propTypes={imageUrl:$().string.isRequired,onDeleteImage:$().func.isRequired};const B=_,I=window.wp.data,L=({resRequiredProps:e})=>{const{resDevice:t,setAttributes:n}=e,[o,r]=(0,s.useState)(!1),l=(0,s.useRef)(),a=(0,s.useCallback)((()=>r(!1)),[]),c=e=>{n({resDevice:e});let t="lg"==e?"Desktop":"md"==e?"Tablet":"sm"==e?"Mobile":"Desktop";(0,I.dispatch)("core/edit-post").__experimentalSetPreviewDeviceType(t),r((()=>!o))};return u=l,f=a,(0,i.useEffect)((()=>{let e=!1,t=!1;const n=n=>{!e&&t&&u.current&&!u.current.contains(n.target)&&f(n)},i=n=>{t=u.current,e=u.current&&u.current.contains(n.target)};return document.addEventListener("mousedown",i),document.addEventListener("touchstart",i),document.addEventListener("click",n),()=>{document.removeEventListener("mousedown",i),document.removeEventListener("touchstart",i),document.removeEventListener("click",n)}}),[u,f]),(0,i.createElement)("div",{ref:l,className:`ffblock-device-switchers active-${t}${o?" ffblock-device-switchers-open":""} `,onClick:()=>r((()=>!o))},(0,i.createElement)("div",{className:"ffblock-device-switchers-wrap"},(0,i.createElement)("a",{className:"ffblock-device-switcher ffblock-device-switcher-desktop"+("lg"===t?" active":""),onClick:()=>c("lg"),"data-tooltip":(0,h.__)("Desktop","fluentform-block")},(0,i.createElement)("i",{className:"dashicons dashicons-desktop"})),(0,i.createElement)("a",{className:"ffblock-device-switcher ffblock-device-switcher-laptop"+("md"===t?" active":""),onClick:()=>c("md"),"data-tooltip":(0,h.__)("Tablet","fluentform-block")},(0,i.createElement)("i",{className:"dashicons dashicons-tablet"})),(0,i.createElement)("a",{className:"ffblock-device-switcher ffblock-device-switcher-tablet"+("sm"===t?" active":""),onClick:()=>c("sm"),"data-tooltip":(0,h.__)("Mobile","fluentform-block")},(0,i.createElement)("i",{className:"dashicons dashicons-smartphone"}))));var u,f},N=function(e){const{label:t,value:n,onChange:o,responsive:r,name:s,options:l,resRequiredProps:a}=e,{resDevice:h}=a;return(0,i.createElement)("div",{className:"ffblock-control-field ffblock-control-bg-property"},(0,i.createElement)("div",{className:"ffblock-control-head"},(0,i.createElement)("span",{className:"ffblock-label"},t),r&&(0,i.createElement)(L,{resRequiredProps:a})),(0,i.createElement)("div",{className:"ffblock-control-body"},(0,i.createElement)(c.SelectControl,{value:r?n[s][h]:n[s],options:l,onChange:e=>(e=>{const t=JSON.parse(JSON.stringify(n));r?t[s][h]=e:t[s]=e,o(t)})(e)})))},V=function({label:e,value:t,onChange:n,resRequiredProps:o}){const r=["imgPosition","imgAttachment","imgRepeat","imgSize"],s=(e,i)=>{const o=JSON.parse(JSON.stringify(t));r.includes(i)?o.imgProperty=e:o[i]=e,n(o)},l=void 0!==t.img?t.img.imgURL:"",a=void 0!==t.img?t.img.imgID:"";return(0,i.createElement)("div",{className:"ffblock-control-field ffblock-control-bg-img-wrap"},e&&(0,i.createElement)("span",{className:"ffblock-label"},e),(0,i.createElement)("div",{className:"ffblock-bg-img"},(0,i.createElement)(P,{label:(0,h.__)("Background Color","fluentform-block"),color:t.color||"",onChange:e=>s(e,"color")}),(0,i.createElement)(c.BaseControl,{label:(0,h.__)("Background Image","fluentform-block")},(0,i.createElement)(S.MediaUpload,{onSelect:e=>{const t={imgURL:e.url,imgID:e.id};s(t,"img")},allowedTypes:["image"],value:a,render:({open:e})=>l?(0,i.createElement)(B,{imageUrl:l,onEditImage:e,onDeleteImage:()=>{s("","img")}}):(0,i.createElement)(c.Button,{className:"ffblock-img-remove-btn",label:(0,h.__)("Upload Image","fluentform-block"),icon:"format-image",onClick:e})}),l&&(0,i.createElement)(N,{label:(0,h.__)("Background Position","fluentform-block"),responsive:!0,value:t.imgProperty,name:"imgPosition",options:d,onChange:e=>{s(e,"imgPosition")},resRequiredProps:o}),l&&(0,i.createElement)(N,{label:(0,h.__)("Background Attachment","fluentform-block"),responsive:!0,value:t.imgProperty,name:"imgAttachment",options:g,onChange:e=>s(e,"imgAttachment"),resRequiredProps:o}),l&&(0,i.createElement)(N,{label:(0,h.__)("Background Repeat","fluentform-block"),responsive:!0,value:t.imgProperty,name:"imgRepeat",options:m,onChange:e=>s(e,"imgRepeat"),resRequiredProps:o}),l&&(0,i.createElement)(N,{label:(0,h.__)("Background Size","fluentform-block"),responsive:!0,value:t.imgProperty,name:"imgSize",options:p,onChange:e=>s(e,"imgSize"),resRequiredProps:o}))))},H=function({label:e,value:t,onChange:n,resRequiredProps:o}){const r={type:"classic",classic:{color:"",img:{imgURL:"",imgID:""},imgProperty:{imgPosition:{lg:""},imgAttachment:{lg:""},imgRepeat:{lg:""},imgSize:{lg:""}}},gradient:null},s=(e,i)=>{n(Object.assign({},r,t||{},{[i]:e}))};return(0,i.createElement)("div",{className:"ffblock-control-field ffblock-control-background-wrap"},e&&(0,i.createElement)("div",{className:"ffblock-control-head"},(0,i.createElement)("span",{className:"ffblock-label"},e)),(0,i.createElement)("div",{className:"ffblock-control-body"},(0,i.createElement)("div",{className:"ffblock-control-body-btn-wrap"},(0,i.createElement)(c.ButtonGroup,{className:"ffblock-btn-group"},f.map((e=>(0,i.createElement)(c.Button,{isLarge:!0,variant:t.type===e.value?"primary":"secondary",onClick:()=>s(e.value,"type")},e.label)))),(0!=Object.keys(t.classic).length||t.gradient)&&(0,i.createElement)(c.Button,{isSmall:!0,className:"ffblock-reset-btn",icon:"image-rotate",onClick:()=>n(r)})),(0,i.createElement)("div",{className:"ffblock-control-body-content-wrap"},"classic"===t.type&&(0,i.createElement)(V,{value:t.classic,onChange:e=>s(e,"classic"),resRequiredProps:o}),"gradient"===t.type&&(0,i.createElement)(O,{value:t.gradient,onChange:e=>s(e,"gradient")}))))},W=function({value:e,responsive:t,onChange:n,label:o,content:r,options:s,resRequiredProps:l,help:a}){const{resDevice:u}=l,f=()=>e?t?e[u]:e:"",d=i=>{if(""==i)return;const o=t?Object.assign({},e,{[u]:i}):i;n(o)},p=s&&Array.isArray(s)?s:["left","center","right","justify"];return(0,i.createElement)("div",{className:"ffblock-control-field ffblock-control-alignment-wrap"},(o||t)&&(0,i.createElement)("div",{className:"ffblock-control-head"},o&&(0,i.createElement)("span",{className:"ffblock-label"},o),t&&(0,i.createElement)(L,{resRequiredProps:l})),(0,i.createElement)("div",{className:"ffblock-control-body ffblock-btn-group"},p.map(((e,t)=>r?(0,i.createElement)(i.Fragment,null,(0,i.createElement)("button",{className:(f()==e.value?"active":"")+" ffblock-button",key:t,onClick:()=>d(f()==e.value?"":e.value)},(0,i.createElement)(c.Tooltip,{text:(0,h.__)(e.label,"fluentform-block")},(0,i.createElement)("span",null,(0,h.__)(e.label,"fluentform-block"))))):(0,i.createElement)(i.Fragment,null,(0,i.createElement)("button",{className:(f()==e?"active":"")+" ffblock-button",key:t,onClick:()=>d(f()==e?"":e)},("left"==e||"flex-start"===e)&&(0,i.createElement)(c.Tooltip,{text:(0,h.__)("Left","fluentform-block")},(0,i.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",width:"1em",height:"1em",fill:"currentColor"},(0,i.createElement)("path",{d:"M256 96H32C14.33 96 0 81.67 0 64C0 46.33 14.33 32 32 32H256C273.7 32 288 46.33 288 64C288 81.67 273.7 96 256 96zM256 352H32C14.33 352 0 337.7 0 320C0 302.3 14.33 288 32 288H256C273.7 288 288 302.3 288 320C288 337.7 273.7 352 256 352zM0 192C0 174.3 14.33 160 32 160H416C433.7 160 448 174.3 448 192C448 209.7 433.7 224 416 224H32C14.33 224 0 209.7 0 192zM416 480H32C14.33 480 0 465.7 0 448C0 430.3 14.33 416 32 416H416C433.7 416 448 430.3 448 448C448 465.7 433.7 480 416 480z"}))),"center"==e&&(0,i.createElement)(c.Tooltip,{text:(0,h.__)("Middle","fluentform-block")},(0,i.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",width:"1em",height:"1em",fill:"currentColor"},(0,i.createElement)("path",{d:"M320 96H128C110.3 96 96 81.67 96 64C96 46.33 110.3 32 128 32H320C337.7 32 352 46.33 352 64C352 81.67 337.7 96 320 96zM416 224H32C14.33 224 0 209.7 0 192C0 174.3 14.33 160 32 160H416C433.7 160 448 174.3 448 192C448 209.7 433.7 224 416 224zM0 448C0 430.3 14.33 416 32 416H416C433.7 416 448 430.3 448 448C448 465.7 433.7 480 416 480H32C14.33 480 0 465.7 0 448zM320 352H128C110.3 352 96 337.7 96 320C96 302.3 110.3 288 128 288H320C337.7 288 352 302.3 352 320C352 337.7 337.7 352 320 352z"}))),("right"==e||"flex-end"===e)&&(0,i.createElement)(c.Tooltip,{text:(0,h.__)("Right","fluentform-block")},(0,i.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",width:"1em",height:"1em",fill:"currentColor"},(0,i.createElement)("path",{d:"M416 96H192C174.3 96 160 81.67 160 64C160 46.33 174.3 32 192 32H416C433.7 32 448 46.33 448 64C448 81.67 433.7 96 416 96zM416 352H192C174.3 352 160 337.7 160 320C160 302.3 174.3 288 192 288H416C433.7 288 448 302.3 448 320C448 337.7 433.7 352 416 352zM0 192C0 174.3 14.33 160 32 160H416C433.7 160 448 174.3 448 192C448 209.7 433.7 224 416 224H32C14.33 224 0 209.7 0 192zM416 480H32C14.33 480 0 465.7 0 448C0 430.3 14.33 416 32 416H416C433.7 416 448 430.3 448 448C448 465.7 433.7 480 416 480z"}))),"justify"==e&&(0,i.createElement)(c.Tooltip,{text:(0,h.__)("Right","fluentform-block")},(0,i.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 448 512",width:"1em",height:"1em",fill:"currentColor"},(0,i.createElement)("path",{d:"M416 96H32C14.33 96 0 81.67 0 64C0 46.33 14.33 32 32 32H416C433.7 32 448 46.33 448 64C448 81.67 433.7 96 416 96zM416 352H32C14.33 352 0 337.7 0 320C0 302.3 14.33 288 32 288H416C433.7 288 448 302.3 448 320C448 337.7 433.7 352 416 352zM0 192C0 174.3 14.33 160 32 160H416C433.7 160 448 174.3 448 192C448 209.7 433.7 224 416 224H32C14.33 224 0 209.7 0 192zM416 480H32C14.33 480 0 465.7 0 448C0 430.3 14.33 416 32 416H416C433.7 416 448 430.3 448 448C448 465.7 433.7 480 416 480z"})))))))),a&&(0,i.createElement)("p",{className:"components-base-control__help"},a))},z=function(e){const{label:t,value:n,onChange:o,min:r,max:s,step:l,reset:a,help:h,defultValue:u=""}=e,f={min:r,max:s,step:l};return(0,i.createElement)("div",{className:"ffblock-control-field ffblock-control-range-wrap"},t&&(0,i.createElement)("div",{className:"ffblock-control-head"},(0,i.createElement)("span",{className:"ffblock-label"},t)),(0,i.createElement)("div",{className:"ffblock-control-body"},(0,i.createElement)(c.RangeControl,{value:n,onChange:e=>{(e=>{o(e)})(e)},...f,help:h}),a&&n?(0,i.createElement)(c.Button,{isSmall:!0,className:"ffblock-reset-btn",icon:"image-rotate",onClick:()=>o(u)}):""))},{__:F}=wp.i18n,{ToggleControl:Q}=wp.components,j=function(e){const{label:t,value:n,onChange:o,transition:r}=e,s=(e,t,i=null)=>{const r=JSON.parse(JSON.stringify(n));"width"===t?r[t][i]=e:r[t]=e,o(r)};return(0,i.createElement)("div",{className:"ffblock-control-field ffblock-control-boxshadow-wrap"},t&&(0,i.createElement)("span",{className:"ffblock-label"},t),(0,i.createElement)("div",{className:"ffblock-boxshadow"},(0,i.createElement)(Q,{label:"Inset",checked:n.inset,onChange:e=>s(e,"inset")}),(0,i.createElement)(P,{label:F("Shadow Color","fluentform-block"),color:n.color,onChange:e=>s(e,"color")}),(0,i.createElement)(z,{label:F("Horizontal Offset","fluentform-block"),reset:!0,value:n.width.top,onChange:e=>s(e,"width","top"),min:0,max:100}),(0,i.createElement)(z,{label:F("Vertical Offset","fluentform-block"),reset:!0,value:n.width.right,onChange:e=>s(e,"width","right"),min:0,max:100}),(0,i.createElement)(z,{label:F("Shadow Blur","fluentform-block"),reset:!0,value:n.width.bottom,onChange:e=>s(e,"width","bottom"),min:0,max:100}),(0,i.createElement)(z,{label:F("Shadow Spread","fluentform-block"),reset:!0,value:n.width.left,onChange:e=>s(e,"width","left"),min:0,max:100}),r&&(0,i.createElement)(z,{label:F("Shadow Transition","fluentform-block"),reset:!0,value:n.transition,onChange:e=>s(e,"transition"),min:0,max:5,step:.1})))},q={};q.fluentformLogo=(0,i.createElement)("svg",{fill:"#0150ec","aria-hidden":"true",height:"24",width:"24"},(0,i.createElement)("path",{d:"M15.57,0H4.43A4.43,4.43,0,0,0,0,4.43V15.57A4.43,4.43,0,0,0,4.43,20H15.57A4.43,4.43,0,0,0,20,15.57V4.43A4.43,4.43,0,0,0,15.57,0ZM12.82,14a2.36,2.36,0,0,1-1.66.68H6.5A2.31,2.31,0,0,1,7.18,13a2.36,2.36,0,0,1,1.66-.68l4.66,0A2.34,2.34,0,0,1,12.82,14Zm3.3-3.46a2.36,2.36,0,0,1-1.66.68H3.21a2.25,2.25,0,0,1,.68-1.64,2.36,2.36,0,0,1,1.66-.68H16.79A2.25,2.25,0,0,1,16.12,10.53Zm0-3.73a2.36,2.36,0,0,1-1.66.68H3.21a2.25,2.25,0,0,1,.68-1.64,2.36,2.36,0,0,1,1.66-.68H16.79A2.25,2.25,0,0,1,16.12,6.81Z"})),q.title_preview="Preview";const U=q,G=function(e){const{label:t,value:n,onChange:o,responsive:r,min:l,max:a,units:h,step:u,defultValue:f={},help:d,resRequiredProps:p}=e,{resDevice:m}=p,[g,b]=(0,s.useState)("px"),v={min:l,max:a,step:u},y=f;return(0,i.createElement)("div",{className:"ffblock-control-field ffblock-control-range-wrap"},(0,i.createElement)("div",{className:"ffblock-control-head"},(0,i.createElement)("div",{className:"rt-left-part"},t&&(0,i.createElement)("span",{className:"ffblock-label"},t),r&&(0,i.createElement)(L,{resRequiredProps:p})),h&&(0,i.createElement)("div",{className:"rt-right-part"},(0,i.createElement)("div",{className:"ffblock-units-choices"},(h&&Array.isArray(h)?h:["px","em","%"]).map((e=>(0,i.createElement)("label",{className:n?.unit===e||!n?.unit&&e===g?"active":"",onClick:()=>(e=>{const t=JSON.parse(JSON.stringify(n));t.unit=e,o(t),b(e)})(e)},e)))))),(0,i.createElement)("div",{className:"ffblock-control-body"},(0,i.createElement)(c.RangeControl,{className:"ffblock-control-field",value:n[m],onChange:e=>{(e=>{const t=JSON.parse(JSON.stringify(n));t[m]=e,t.unit=t.unit||g,o(t)})(e)},...v,help:d}),(n[m]||0!==n[m])&&(0,i.createElement)(c.Button,{isSmall:!0,className:"ffblock-reset-btn",icon:"image-rotate",onClick:()=>o(y)})))},X=e=>{const{responsive:t,onChange:n,units:o,value:r,type:s,resRequiredProps:l}=e,{resDevice:a}=l,c={isLinked:!0,unit:"px",value:""},h=t?r[a]?r[a]:c:r||c,u=e=>{e.type=s,n(e)};let f;if(h.isLinked){const e=h?.value?h.value.split(" ")[0]:"";f=new Array(5).fill(e)}else f=h?.value?h.value.split(" "):["0","0","0","0"];return(0,i.createElement)("div",{className:"ffblock-control-field ffblock-control-dimension"},(0,i.createElement)("div",{className:"ffblock-control-head"},(0,i.createElement)("div",{className:"rt-left-part"},(0,i.createElement)("div",{className:"ffblock-label"},e.label),t&&(0,i.createElement)(L,{resRequiredProps:l})),(0,i.createElement)("div",{className:"rt-right-part"},(0,i.createElement)("div",{className:"ffblock-units-choices"},(o&&Array.isArray(o)?o:["px","em","%"]).map((e=>(0,i.createElement)("label",{className:h?.unit===e||!h?.unit&&e===c.unit?"active":"",onClick:()=>(e=>{const n=JSON.parse(JSON.stringify(r));t?n[a].unit=e:n.unit=e,u(n)})(e)},e)))))),(0,i.createElement)("div",{className:"ffblock-control-body"},(0,i.createElement)("div",{className:"ffblock-control-dimensions"},["top","right","bottom","left"].map(((e,n)=>(0,i.createElement)("div",{className:"ffblock-control-dimension"},(0,i.createElement)("input",{type:"number",value:f[n],"data-setting":e,onChange:n=>((e,n)=>{let i=h.value?h.value.split(" "):["0","0","0","0"];(h.isLinked||i.length<4)&&(i=new Array(5).fill(i[0]||"0"));const[o,s,l,f]=i,d=JSON.parse(JSON.stringify(r)),p=h.isLinked?`${n} ${n} ${n} ${n}`:`${"top"===e?`${n}`:`${o}`} ${"right"===e?`${n}`:`${s}`} ${"bottom"===e?`${n}`:`${l}`} ${"left"===e?`${n}`:`${f}`}`;t?(d[a]=d[a]?d[a]:c,d[a].value=p):d.value=p,u(d)})(e,n.target.value)}),(0,i.createElement)("label",{className:"ffblock-control-dimension-label"},e)))),(0,i.createElement)("div",{className:"ffblock-control-dimension linking"},(0,i.createElement)("button",{className:"ffblock-link-dimensions "+(h?.isLinked?"admin-links linked":"editor-unlink"),onClick:()=>{const e=JSON.parse(JSON.stringify(r));if(t){if(e[a].isLinked=!e[a].isLinked,e[a].isLinked)e[a].value=e[a].value?e[a].value.split(" ")[0]:"0 0 0 0";else if(e[a].value.length<4){const[t,n,i,o]=new Array(4).fill(e[a].value||"0");e[a].value=`${t} ${n} ${i} ${o}`}}else e.isLinked=!e.isLinked;u(e)}},(0,i.createElement)("span",{className:"rt-dm-link-icon dashicons dashicons-"+(h?.isLinked?"admin-links linked":"editor-unlink")}))))))};X.propTypes={label:$().string,value:$().object,onChange:$().func.isRequired,type:$().oneOf(["padding","margin","borderRadius","borderWidth"])};const Y=X,K=function({label:e,value:t,onChange:n,resRequiredProps:o}){const r=(e,i)=>{n(Object.assign({},t,{[i]:"lg"==i?e.lg:e}))};return(0,i.createElement)("div",{className:"ffblock-control-field ffblock-control-border-wrap"},(0,i.createElement)(c.BaseControl,{label:e||""},(0,i.createElement)(c.SelectControl,{label:(0,h.__)("Border Style","fluentform-block"),value:t.borderStyle,options:w,onChange:e=>r(e,"borderStyle")}),"none"!==t.borderStyle&&t.borderStyle&&(0,i.createElement)(i.Fragment,null,(0,i.createElement)(P,{label:(0,h.__)("Border Color","fluentform-block"),color:t.borderColor,onChange:e=>r(e,"borderColor")}),(0,i.createElement)(Y,{label:"Border Width",type:"borderWidth",responsive:!0,value:t,onChange:e=>r(e,"lg"),resRequiredProps:o}))))};function Z(e){return Z="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Z(e)}function J(e){var t=function(e,t){if("object"!=Z(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,"string");if("object"!=Z(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==Z(t)?t:String(t)}function ee(e,t,n){return(t=J(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function te(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function ne(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?te(Object(n),!0).forEach((function(t){ee(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):te(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function oe(e,t){if(e){if("string"==typeof e)return ie(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ie(e,t):void 0}}function re(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var i,o,r,s,l=[],a=!0,c=!1;try{if(r=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;a=!1}else for(;!(a=(i=r.call(n)).done)&&(l.push(i.value),l.length!==t);a=!0);}catch(e){c=!0,o=e}finally{try{if(!a&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return l}}(e,t)||oe(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function se(e,t){if(null==e)return{};var n,i,o={},r=Object.keys(e);for(i=0;i<r.length;i++)n=r[i],t.indexOf(n)>=0||(o[n]=e[n]);return o}function le(e,t){if(null==e)return{};var n,i,o=se(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i<r.length;i++)n=r[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var ae=["defaultInputValue","defaultMenuIsOpen","defaultValue","inputValue","menuIsOpen","onChange","onInputChange","onMenuClose","onMenuOpen","value"];function ce(){return ce=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},ce.apply(this,arguments)}function he(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,J(i.key),i)}}function ue(e,t){return ue=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ue(e,t)}function fe(e){return fe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},fe(e)}function de(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,i=fe(e);if(t){var o=fe(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return function(e,t){if(t&&("object"===Z(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function pe(e){return function(e){if(Array.isArray(e))return ie(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||oe(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var me=function(){function e(e){var t=this;this._insertTag=function(e){var n;n=0===t.tags.length?t.insertionPoint?t.insertionPoint.nextSibling:t.prepend?t.container.firstChild:t.before:t.tags[t.tags.length-1].nextSibling,t.container.insertBefore(e,n),t.tags.push(e)},this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(e){e.forEach(this._insertTag)},t.insert=function(e){this.ctr%(this.isSpeedy?65e3:1)==0&&this._insertTag(function(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),void 0!==e.nonce&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}(this));var t=this.tags[this.tags.length-1];if(this.isSpeedy){var n=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(t);try{n.insertRule(e,n.cssRules.length)}catch(e){}}else t.appendChild(document.createTextNode(e));this.ctr++},t.flush=function(){this.tags.forEach((function(e){return e.parentNode&&e.parentNode.removeChild(e)})),this.tags=[],this.ctr=0},e}(),ge=Math.abs,be=String.fromCharCode,ve=Object.assign;function ye(e){return e.trim()}function we(e,t,n){return e.replace(t,n)}function ke(e,t){return e.indexOf(t)}function xe(e,t){return 0|e.charCodeAt(t)}function Oe(e,t,n){return e.slice(t,n)}function Se(e){return e.length}function Ce(e){return e.length}function Ee(e,t){return t.push(e),e}var Ae=1,Me=1,Te=0,De=0,Pe=0,Re="";function $e(e,t,n,i,o,r,s){return{value:e,root:t,parent:n,type:i,props:o,children:r,line:Ae,column:Me,length:s,return:""}}function _e(e,t){return ve($e("",null,null,"",null,null,0),e,{length:-e.length},t)}function Be(){return Pe=De>0?xe(Re,--De):0,Me--,10===Pe&&(Me=1,Ae--),Pe}function Ie(){return Pe=De<Te?xe(Re,De++):0,Me++,10===Pe&&(Me=1,Ae++),Pe}function Le(){return xe(Re,De)}function Ne(){return De}function Ve(e,t){return Oe(Re,e,t)}function He(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function We(e){return Ae=Me=1,Te=Se(Re=e),De=0,[]}function ze(e){return Re="",e}function Fe(e){return ye(Ve(De-1,qe(91===e?e+2:40===e?e+1:e)))}function Qe(e){for(;(Pe=Le())&&Pe<33;)Ie();return He(e)>2||He(Pe)>3?"":" "}function je(e,t){for(;--t&&Ie()&&!(Pe<48||Pe>102||Pe>57&&Pe<65||Pe>70&&Pe<97););return Ve(e,Ne()+(t<6&&32==Le()&&32==Ie()))}function qe(e){for(;Ie();)switch(Pe){case e:return De;case 34:case 39:34!==e&&39!==e&&qe(Pe);break;case 40:41===e&&qe(e);break;case 92:Ie()}return De}function Ue(e,t){for(;Ie()&&e+Pe!==57&&(e+Pe!==84||47!==Le()););return"/*"+Ve(t,De-1)+"*"+be(47===e?e:Ie())}function Ge(e){for(;!He(Le());)Ie();return Ve(e,De)}var Xe="-ms-",Ye="-moz-",Ke="-webkit-",Ze="comm",Je="rule",et="decl",tt="@keyframes";function nt(e,t){for(var n="",i=Ce(e),o=0;o<i;o++)n+=t(e[o],o,e,t)||"";return n}function it(e,t,n,i){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case et:return e.return=e.return||e.value;case Ze:return"";case tt:return e.return=e.value+"{"+nt(e.children,i)+"}";case Je:e.value=e.props.join(",")}return Se(n=nt(e.children,i))?e.return=e.value+"{"+n+"}":""}function ot(e){return ze(rt("",null,null,null,[""],e=We(e),0,[0],e))}function rt(e,t,n,i,o,r,s,l,a){for(var c=0,h=0,u=s,f=0,d=0,p=0,m=1,g=1,b=1,v=0,y="",w=o,k=r,x=i,O=y;g;)switch(p=v,v=Ie()){case 40:if(108!=p&&58==xe(O,u-1)){-1!=ke(O+=we(Fe(v),"&","&\f"),"&\f")&&(b=-1);break}case 34:case 39:case 91:O+=Fe(v);break;case 9:case 10:case 13:case 32:O+=Qe(p);break;case 92:O+=je(Ne()-1,7);continue;case 47:switch(Le()){case 42:case 47:Ee(lt(Ue(Ie(),Ne()),t,n),a);break;default:O+="/"}break;case 123*m:l[c++]=Se(O)*b;case 125*m:case 59:case 0:switch(v){case 0:case 125:g=0;case 59+h:-1==b&&(O=we(O,/\f/g,"")),d>0&&Se(O)-u&&Ee(d>32?at(O+";",i,n,u-1):at(we(O," ","")+";",i,n,u-2),a);break;case 59:O+=";";default:if(Ee(x=st(O,t,n,c,h,o,l,y,w=[],k=[],u),r),123===v)if(0===h)rt(O,t,x,x,w,r,u,l,k);else switch(99===f&&110===xe(O,3)?100:f){case 100:case 108:case 109:case 115:rt(e,x,x,i&&Ee(st(e,x,x,0,0,o,l,y,o,w=[],u),k),o,k,u,l,i?w:k);break;default:rt(O,x,x,x,[""],k,0,l,k)}}c=h=d=0,m=b=1,y=O="",u=s;break;case 58:u=1+Se(O),d=p;default:if(m<1)if(123==v)--m;else if(125==v&&0==m++&&125==Be())continue;switch(O+=be(v),v*m){case 38:b=h>0?1:(O+="\f",-1);break;case 44:l[c++]=(Se(O)-1)*b,b=1;break;case 64:45===Le()&&(O+=Fe(Ie())),f=Le(),h=u=Se(y=O+=Ge(Ne())),v++;break;case 45:45===p&&2==Se(O)&&(m=0)}}return r}function st(e,t,n,i,o,r,s,l,a,c,h){for(var u=o-1,f=0===o?r:[""],d=Ce(f),p=0,m=0,g=0;p<i;++p)for(var b=0,v=Oe(e,u+1,u=ge(m=s[p])),y=e;b<d;++b)(y=ye(m>0?f[b]+" "+v:we(v,/&\f/g,f[b])))&&(a[g++]=y);return $e(e,t,n,0===o?Je:l,a,c,h)}function lt(e,t,n){return $e(e,t,n,Ze,be(Pe),Oe(e,2,-2),0)}function at(e,t,n,i){return $e(e,t,n,et,Oe(e,0,i),Oe(e,i+1,-1),i)}var ct=function(e,t,n){for(var i=0,o=0;i=o,o=Le(),38===i&&12===o&&(t[n]=1),!He(o);)Ie();return Ve(e,De)},ht=new WeakMap,ut=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var t=e.value,n=e.parent,i=e.column===n.column&&e.line===n.line;"rule"!==n.type;)if(!(n=n.parent))return;if((1!==e.props.length||58===t.charCodeAt(0)||ht.get(n))&&!i){ht.set(e,!0);for(var o=[],r=function(e,t){return ze(function(e,t){var n=-1,i=44;do{switch(He(i)){case 0:38===i&&12===Le()&&(t[n]=1),e[n]+=ct(De-1,t,n);break;case 2:e[n]+=Fe(i);break;case 4:if(44===i){e[++n]=58===Le()?"&\f":"",t[n]=e[n].length;break}default:e[n]+=be(i)}}while(i=Ie());return e}(We(e),t))}(t,o),s=n.props,l=0,a=0;l<r.length;l++)for(var c=0;c<s.length;c++,a++)e.props[a]=o[l]?r[l].replace(/&\f/g,s[c]):s[c]+" "+r[l]}}},ft=function(e){if("decl"===e.type){var t=e.value;108===t.charCodeAt(0)&&98===t.charCodeAt(2)&&(e.return="",e.value="")}};function dt(e,t){switch(function(e,t){return 45^xe(e,0)?(((t<<2^xe(e,0))<<2^xe(e,1))<<2^xe(e,2))<<2^xe(e,3):0}(e,t)){case 5103:return Ke+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Ke+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Ke+e+Ye+e+Xe+e+e;case 6828:case 4268:return Ke+e+Xe+e+e;case 6165:return Ke+e+Xe+"flex-"+e+e;case 5187:return Ke+e+we(e,/(\w+).+(:[^]+)/,Ke+"box-$1$2"+Xe+"flex-$1$2")+e;case 5443:return Ke+e+Xe+"flex-item-"+we(e,/flex-|-self/,"")+e;case 4675:return Ke+e+Xe+"flex-line-pack"+we(e,/align-content|flex-|-self/,"")+e;case 5548:return Ke+e+Xe+we(e,"shrink","negative")+e;case 5292:return Ke+e+Xe+we(e,"basis","preferred-size")+e;case 6060:return Ke+"box-"+we(e,"-grow","")+Ke+e+Xe+we(e,"grow","positive")+e;case 4554:return Ke+we(e,/([^-])(transform)/g,"$1"+Ke+"$2")+e;case 6187:return we(we(we(e,/(zoom-|grab)/,Ke+"$1"),/(image-set)/,Ke+"$1"),e,"")+e;case 5495:case 3959:return we(e,/(image-set\([^]*)/,Ke+"$1$`$1");case 4968:return we(we(e,/(.+:)(flex-)?(.*)/,Ke+"box-pack:$3"+Xe+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Ke+e+e;case 4095:case 3583:case 4068:case 2532:return we(e,/(.+)-inline(.+)/,Ke+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(Se(e)-1-t>6)switch(xe(e,t+1)){case 109:if(45!==xe(e,t+4))break;case 102:return we(e,/(.+:)(.+)-([^]+)/,"$1"+Ke+"$2-$3$1"+Ye+(108==xe(e,t+3)?"$3":"$2-$3"))+e;case 115:return~ke(e,"stretch")?dt(we(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(115!==xe(e,t+1))break;case 6444:switch(xe(e,Se(e)-3-(~ke(e,"!important")&&10))){case 107:return we(e,":",":"+Ke)+e;case 101:return we(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Ke+(45===xe(e,14)?"inline-":"")+"box$3$1"+Ke+"$2$3$1"+Xe+"$2box$3")+e}break;case 5936:switch(xe(e,t+11)){case 114:return Ke+e+Xe+we(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Ke+e+Xe+we(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Ke+e+Xe+we(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Ke+e+Xe+e+e}return e}var pt=[function(e,t,n,i){if(e.length>-1&&!e.return)switch(e.type){case et:e.return=dt(e.value,e.length);break;case tt:return nt([_e(e,{value:we(e.value,"@","@"+Ke)})],i);case Je:if(e.length)return function(e,t){return e.map(t).join("")}(e.props,(function(t){switch(function(e,t){return(e=/(::plac\w+|:read-\w+)/.exec(e))?e[0]:e}(t)){case":read-only":case":read-write":return nt([_e(e,{props:[we(t,/:(read-\w+)/,":-moz-$1")]})],i);case"::placeholder":return nt([_e(e,{props:[we(t,/:(plac\w+)/,":"+Ke+"input-$1")]}),_e(e,{props:[we(t,/:(plac\w+)/,":-moz-$1")]}),_e(e,{props:[we(t,/:(plac\w+)/,Xe+"input-$1")]})],i)}return""}))}}],mt=function(e){var t=e.key;if("css"===t){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var i,o,r=e.stylisPlugins||pt,s={},l=[];i=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),(function(e){for(var t=e.getAttribute("data-emotion").split(" "),n=1;n<t.length;n++)s[t[n]]=!0;l.push(e)}));var a,c,h,u,f=[it,(u=function(e){a.insert(e)},function(e){e.root||(e=e.return)&&u(e)})],d=(c=[ut,ft].concat(r,f),h=Ce(c),function(e,t,n,i){for(var o="",r=0;r<h;r++)o+=c[r](e,t,n,i)||"";return o});o=function(e,t,n,i){a=n,nt(ot(e?e+"{"+t.styles+"}":t.styles),d),i&&(p.inserted[t.name]=!0)};var p={key:t,sheet:new me({key:t,container:i,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:s,registered:{},insert:o};return p.sheet.hydrate(l),p},gt=function(e,t,n){var i=e.key+"-"+t.name;!1===n&&void 0===e.registered[i]&&(e.registered[i]=t.styles)},bt={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function vt(e){var t=Object.create(null);return function(n){return void 0===t[n]&&(t[n]=e(n)),t[n]}}var yt=/[A-Z]|^ms/g,wt=/_EMO_([^_]+?)_([^]*?)_EMO_/g,kt=function(e){return 45===e.charCodeAt(1)},xt=function(e){return null!=e&&"boolean"!=typeof e},Ot=vt((function(e){return kt(e)?e:e.replace(yt,"-$&").toLowerCase()})),St=function(e,t){switch(e){case"animation":case"animationName":if("string"==typeof t)return t.replace(wt,(function(e,t,n){return Et={name:t,styles:n,next:Et},t}))}return 1===bt[e]||kt(e)||"number"!=typeof t||0===t?t:t+"px"};function Ct(e,t,n){if(null==n)return"";if(void 0!==n.__emotion_styles)return n;switch(typeof n){case"boolean":return"";case"object":if(1===n.anim)return Et={name:n.name,styles:n.styles,next:Et},n.name;if(void 0!==n.styles){var i=n.next;if(void 0!==i)for(;void 0!==i;)Et={name:i.name,styles:i.styles,next:Et},i=i.next;return n.styles+";"}return function(e,t,n){var i="";if(Array.isArray(n))for(var o=0;o<n.length;o++)i+=Ct(e,t,n[o])+";";else for(var r in n){var s=n[r];if("object"!=typeof s)null!=t&&void 0!==t[s]?i+=r+"{"+t[s]+"}":xt(s)&&(i+=Ot(r)+":"+St(r,s)+";");else if(!Array.isArray(s)||"string"!=typeof s[0]||null!=t&&void 0!==t[s[0]]){var l=Ct(e,t,s);switch(r){case"animation":case"animationName":i+=Ot(r)+":"+l+";";break;default:i+=r+"{"+l+"}"}}else for(var a=0;a<s.length;a++)xt(s[a])&&(i+=Ot(r)+":"+St(r,s[a])+";")}return i}(e,t,n);case"function":if(void 0!==e){var o=Et,r=n(e);return Et=o,Ct(e,t,r)}}if(null==t)return n;var s=t[n];return void 0!==s?s:n}var Et,At=/label:\s*([^\s;\n{]+)\s*(;|$)/g,Mt=function(e,t,n){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var i=!0,o="";Et=void 0;var r=e[0];null==r||void 0===r.raw?(i=!1,o+=Ct(n,t,r)):o+=r[0];for(var s=1;s<e.length;s++)o+=Ct(n,t,e[s]),i&&(o+=r[s]);At.lastIndex=0;for(var l,a="";null!==(l=At.exec(o));)a+="-"+l[1];var c=function(e){for(var t,n=0,i=0,o=e.length;o>=4;++i,o-=4)t=1540483477*(65535&(t=255&e.charCodeAt(i)|(255&e.charCodeAt(++i))<<8|(255&e.charCodeAt(++i))<<16|(255&e.charCodeAt(++i))<<24))+(59797*(t>>>16)<<16),n=1540483477*(65535&(t^=t>>>24))+(59797*(t>>>16)<<16)^1540483477*(65535&n)+(59797*(n>>>16)<<16);switch(o){case 3:n^=(255&e.charCodeAt(i+2))<<16;case 2:n^=(255&e.charCodeAt(i+1))<<8;case 1:n=1540483477*(65535&(n^=255&e.charCodeAt(i)))+(59797*(n>>>16)<<16)}return(((n=1540483477*(65535&(n^=n>>>13))+(59797*(n>>>16)<<16))^n>>>15)>>>0).toString(36)}(o)+a;return{name:c,styles:o,next:Et}},Tt=!!i.useInsertionEffect&&i.useInsertionEffect,Dt=Tt||function(e){return e()},Pt=(Tt||i.useLayoutEffect,{}.hasOwnProperty),Rt=i.createContext("undefined"!=typeof HTMLElement?mt({key:"css"}):null);Rt.Provider;var $t=function(e){return(0,i.forwardRef)((function(t,n){var o=(0,i.useContext)(Rt);return e(t,o,n)}))},_t=i.createContext({}),Bt="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",It=function(e){var t=e.cache,n=e.serialized,i=e.isStringTag;return gt(t,n,i),Dt((function(){return function(e,t,n){gt(e,t,n);var i=e.key+"-"+t.name;if(void 0===e.inserted[t.name]){var o=t;do{e.insert(t===o?"."+i:"",o,e.sheet,!0),o=o.next}while(void 0!==o)}}(t,n,i)})),null},Lt=$t((function(e,t,n){var o=e.css;"string"==typeof o&&void 0!==t.registered[o]&&(o=t.registered[o]);var r=e[Bt],s=[o],l="";"string"==typeof e.className?l=function(e,t,n){var i="";return n.split(" ").forEach((function(n){void 0!==e[n]?t.push(e[n]+";"):i+=n+" "})),i}(t.registered,s,e.className):null!=e.className&&(l=e.className+" ");var a=Mt(s,void 0,i.useContext(_t));l+=t.key+"-"+a.name;var c={};for(var h in e)Pt.call(e,h)&&"css"!==h&&h!==Bt&&(c[h]=e[h]);return c.ref=n,c.className=l,i.createElement(i.Fragment,null,i.createElement(It,{cache:t,serialized:a,isStringTag:"string"==typeof r}),i.createElement(r,c))})),Nt=Lt,Vt=(n(679),function(e,t){var n=arguments;if(null==t||!Pt.call(t,"css"))return i.createElement.apply(void 0,n);var o=n.length,r=new Array(o);r[0]=Nt,r[1]=function(e,t){var n={};for(var i in t)Pt.call(t,i)&&(n[i]=t[i]);return n[Bt]=e,n}(e,t);for(var s=2;s<o;s++)r[s]=n[s];return i.createElement.apply(null,r)});function Ht(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return Mt(t)}const Wt=window.ReactDOM,zt=Math.min,Ft=Math.max,Qt=Math.round,jt=Math.floor,qt=e=>({x:e,y:e});function Ut(e){return Yt(e)?(e.nodeName||"").toLowerCase():"#document"}function Gt(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function Xt(e){var t;return null==(t=(Yt(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function Yt(e){return e instanceof Node||e instanceof Gt(e).Node}function Kt(e){return e instanceof Element||e instanceof Gt(e).Element}function Zt(e){return e instanceof HTMLElement||e instanceof Gt(e).HTMLElement}function Jt(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ShadowRoot||e instanceof Gt(e).ShadowRoot)}function en(e){const{overflow:t,overflowX:n,overflowY:i,display:o}=tn(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&!["inline","contents"].includes(o)}function tn(e){return Gt(e).getComputedStyle(e)}function nn(e){const t=function(e){if("html"===Ut(e))return e;const t=e.assignedSlot||e.parentNode||Jt(e)&&e.host||Xt(e);return Jt(t)?t.host:t}(e);return function(e){return["html","body","#document"].includes(Ut(e))}(t)?e.ownerDocument?e.ownerDocument.body:e.body:Zt(t)&&en(t)?t:nn(t)}function on(e,t,n){var i;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=nn(e),r=o===(null==(i=e.ownerDocument)?void 0:i.body),s=Gt(o);return r?t.concat(s,s.visualViewport||[],en(o)?o:[],s.frameElement&&n?on(s.frameElement):[]):t.concat(o,on(o,[],n))}function rn(e){return Kt(e)?e:e.contextElement}function sn(e){const t=rn(e);if(!Zt(t))return qt(1);const n=t.getBoundingClientRect(),{width:i,height:o,$:r}=function(e){const t=tn(e);let n=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const o=Zt(e),r=o?e.offsetWidth:n,s=o?e.offsetHeight:i,l=Qt(n)!==r||Qt(i)!==s;return l&&(n=r,i=s),{width:n,height:i,$:l}}(t);let s=(r?Qt(n.width):n.width)/i,l=(r?Qt(n.height):n.height)/o;return s&&Number.isFinite(s)||(s=1),l&&Number.isFinite(l)||(l=1),{x:s,y:l}}const ln=qt(0);function an(e){const t=Gt(e);return"undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:ln}function cn(e,t,n,i){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),r=rn(e);let s=qt(1);t&&(i?Kt(i)&&(s=sn(i)):s=sn(e));const l=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==Gt(e))&&t}(r,n,i)?an(r):qt(0);let a=(o.left+l.x)/s.x,c=(o.top+l.y)/s.y,h=o.width/s.x,u=o.height/s.y;if(r){const e=Gt(r),t=i&&Kt(i)?Gt(i):i;let n=e.frameElement;for(;n&&i&&t!==e;){const e=sn(n),t=n.getBoundingClientRect(),i=tn(n),o=t.left+(n.clientLeft+parseFloat(i.paddingLeft))*e.x,r=t.top+(n.clientTop+parseFloat(i.paddingTop))*e.y;a*=e.x,c*=e.y,h*=e.x,u*=e.y,a+=o,c+=r,n=Gt(n).frameElement}}return f={width:h,height:u,x:a,y:c},{...f,top:f.y,left:f.x,right:f.x+f.width,bottom:f.y+f.height};var f}const hn=i.useLayoutEffect;var un=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],fn=function(){};function dn(e,t){return t?"-"===t[0]?e+t:e+"__"+t:e}function pn(e,t){for(var n=arguments.length,i=new Array(n>2?n-2:0),o=2;o<n;o++)i[o-2]=arguments[o];var r=[].concat(i);if(t&&e)for(var s in t)t.hasOwnProperty(s)&&t[s]&&r.push("".concat(dn(e,s)));return r.filter((function(e){return e})).map((function(e){return String(e).trim()})).join(" ")}var mn=function(e){return t=e,Array.isArray(t)?e.filter(Boolean):"object"===Z(e)&&null!==e?[e]:[];var t},gn=function(e){return e.className,e.clearValue,e.cx,e.getStyles,e.getClassNames,e.getValue,e.hasValue,e.isMulti,e.isRtl,e.options,e.selectOption,e.selectProps,e.setValue,e.theme,ne({},le(e,un))},bn=function(e,t,n){var i=e.cx,o=e.getStyles,r=e.getClassNames,s=e.className;return{css:o(t,e),className:i(null!=n?n:{},r(t,e),s)}};function vn(e){return[document.documentElement,document.body,window].indexOf(e)>-1}function yn(e){return vn(e)?window.pageYOffset:e.scrollTop}function wn(e,t){vn(e)?window.scrollTo(0,t):e.scrollTop=t}function kn(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:200,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:fn,o=yn(e),r=t-o,s=0;!function t(){var l=function(e,t,n,i){return n*((e=e/i-1)*e*e+1)+t}(s+=10,o,r,n);wn(e,l),s<n?window.requestAnimationFrame(t):i(e)}()}function xn(e,t){var n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),o=t.offsetHeight/3;i.bottom+o>n.bottom?wn(e,Math.min(t.offsetTop+t.clientHeight-e.offsetHeight+o,e.scrollHeight)):i.top-o<n.top&&wn(e,Math.max(t.offsetTop-o,0))}function On(){try{return document.createEvent("TouchEvent"),!0}catch(e){return!1}}var Sn=!1,Cn={get passive(){return Sn=!0}},En="undefined"!=typeof window?window:{};En.addEventListener&&En.removeEventListener&&(En.addEventListener("p",fn,Cn),En.removeEventListener("p",fn,!1));var An=Sn;function Mn(e){return null!=e}function Tn(e,t,n){return e?t:n}var Dn=["children","innerProps"],Pn=["children","innerProps"];var Rn,$n,Bn,In=function(e){return"auto"===e?"bottom":e},Ln=(0,i.createContext)(null),Nn=function(e){var t=e.children,n=e.minMenuHeight,o=e.maxMenuHeight,r=e.menuPlacement,s=e.menuPosition,l=e.menuShouldScrollIntoView,a=e.theme,c=((0,i.useContext)(Ln)||{}).setPortalPlacement,h=(0,i.useRef)(null),u=re((0,i.useState)(o),2),f=u[0],d=u[1],p=re((0,i.useState)(null),2),m=p[0],g=p[1],b=a.spacing.controlHeight;return hn((function(){var e=h.current;if(e){var t="fixed"===s,i=function(e){var t=e.maxHeight,n=e.menuEl,i=e.minHeight,o=e.placement,r=e.shouldScroll,s=e.isFixedPosition,l=e.controlHeight,a=function(e){var t=getComputedStyle(e),n="absolute"===t.position,i=/(auto|scroll)/;if("fixed"===t.position)return document.documentElement;for(var o=e;o=o.parentElement;)if(t=getComputedStyle(o),(!n||"static"!==t.position)&&i.test(t.overflow+t.overflowY+t.overflowX))return o;return document.documentElement}(n),c={placement:"bottom",maxHeight:t};if(!n||!n.offsetParent)return c;var h,u=a.getBoundingClientRect().height,f=n.getBoundingClientRect(),d=f.bottom,p=f.height,m=f.top,g=n.offsetParent.getBoundingClientRect().top,b=s||vn(h=a)?window.innerHeight:h.clientHeight,v=yn(a),y=parseInt(getComputedStyle(n).marginBottom,10),w=parseInt(getComputedStyle(n).marginTop,10),k=g-w,x=b-m,O=k+v,S=u-v-m,C=d-b+v+y,E=v+m-w,A=160;switch(o){case"auto":case"bottom":if(x>=p)return{placement:"bottom",maxHeight:t};if(S>=p&&!s)return r&&kn(a,C,A),{placement:"bottom",maxHeight:t};if(!s&&S>=i||s&&x>=i)return r&&kn(a,C,A),{placement:"bottom",maxHeight:s?x-y:S-y};if("auto"===o||s){var M=t,T=s?k:O;return T>=i&&(M=Math.min(T-y-l,t)),{placement:"top",maxHeight:M}}if("bottom"===o)return r&&wn(a,C),{placement:"bottom",maxHeight:t};break;case"top":if(k>=p)return{placement:"top",maxHeight:t};if(O>=p&&!s)return r&&kn(a,E,A),{placement:"top",maxHeight:t};if(!s&&O>=i||s&&k>=i){var D=t;return(!s&&O>=i||s&&k>=i)&&(D=s?k-w:O-w),r&&kn(a,E,A),{placement:"top",maxHeight:D}}return{placement:"bottom",maxHeight:t};default:throw new Error('Invalid placement provided "'.concat(o,'".'))}return c}({maxHeight:o,menuEl:e,minHeight:n,placement:r,shouldScroll:l&&!t,isFixedPosition:t,controlHeight:b});d(i.maxHeight),g(i.placement),null==c||c(i.placement)}}),[o,r,s,l,n,c,b]),t({ref:h,placerProps:ne(ne({},e),{},{placement:m||In(r),maxHeight:f})})},Vn=function(e,t){var n=e.theme,i=n.spacing.baseUnit,o=n.colors;return ne({textAlign:"center"},t?{}:{color:o.neutral40,padding:"".concat(2*i,"px ").concat(3*i,"px")})},Hn=Vn,Wn=Vn,zn=["size"],Fn=["innerProps","isRtl","size"],Qn={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},jn=function(e){var t=e.size,n=le(e,zn);return Vt("svg",ce({height:t,width:t,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:Qn},n))},qn=function(e){return Vt(jn,ce({size:20},e),Vt("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"}))},Un=function(e){return Vt(jn,ce({size:20},e),Vt("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},Gn=function(e,t){var n=e.isFocused,i=e.theme,o=i.spacing.baseUnit,r=i.colors;return ne({label:"indicatorContainer",display:"flex",transition:"color 150ms"},t?{}:{color:n?r.neutral60:r.neutral20,padding:2*o,":hover":{color:n?r.neutral80:r.neutral40}})},Xn=Gn,Yn=Gn,Kn=function(){var e=Ht.apply(void 0,arguments),t="animation-"+e.name;return{name:t,styles:"@keyframes "+t+"{"+e.styles+"}",anim:1,toString:function(){return"_EMO_"+this.name+"_"+this.styles+"_EMO_"}}}(Rn||($n=["\n 0%, 80%, 100% { opacity: 0; }\n 40% { opacity: 1; }\n"],Bn||(Bn=$n.slice(0)),Rn=Object.freeze(Object.defineProperties($n,{raw:{value:Object.freeze(Bn)}})))),Zn=function(e){var t=e.delay,n=e.offset;return Vt("span",{css:Ht({animation:"".concat(Kn," 1s ease-in-out ").concat(t,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:n?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},Jn=["data"],ei=["innerRef","isDisabled","isHidden","inputClassName"],ti={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},ni={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":ne({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},ti)},ii=function(e){return ne({label:"input",color:"inherit",background:0,opacity:e?0:1,width:"100%"},ti)},oi=function(e){var t=e.children,n=e.innerProps;return Vt("div",n,t)},ri={ClearIndicator:function(e){var t=e.children,n=e.innerProps;return Vt("div",ce({},bn(e,"clearIndicator",{indicator:!0,"clear-indicator":!0}),n),t||Vt(qn,null))},Control:function(e){var t=e.children,n=e.isDisabled,i=e.isFocused,o=e.innerRef,r=e.innerProps,s=e.menuIsOpen;return Vt("div",ce({ref:o},bn(e,"control",{control:!0,"control--is-disabled":n,"control--is-focused":i,"control--menu-is-open":s}),r,{"aria-disabled":n||void 0}),t)},DropdownIndicator:function(e){var t=e.children,n=e.innerProps;return Vt("div",ce({},bn(e,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),n),t||Vt(Un,null))},DownChevron:Un,CrossIcon:qn,Group:function(e){var t=e.children,n=e.cx,i=e.getStyles,o=e.getClassNames,r=e.Heading,s=e.headingProps,l=e.innerProps,a=e.label,c=e.theme,h=e.selectProps;return Vt("div",ce({},bn(e,"group",{group:!0}),l),Vt(r,ce({},s,{selectProps:h,theme:c,getStyles:i,getClassNames:o,cx:n}),a),Vt("div",null,t))},GroupHeading:function(e){var t=gn(e);t.data;var n=le(t,Jn);return Vt("div",ce({},bn(e,"groupHeading",{"group-heading":!0}),n))},IndicatorsContainer:function(e){var t=e.children,n=e.innerProps;return Vt("div",ce({},bn(e,"indicatorsContainer",{indicators:!0}),n),t)},IndicatorSeparator:function(e){var t=e.innerProps;return Vt("span",ce({},t,bn(e,"indicatorSeparator",{"indicator-separator":!0})))},Input:function(e){var t=e.cx,n=e.value,i=gn(e),o=i.innerRef,r=i.isDisabled,s=i.isHidden,l=i.inputClassName,a=le(i,ei);return Vt("div",ce({},bn(e,"input",{"input-container":!0}),{"data-value":n||""}),Vt("input",ce({className:t({input:!0},l),ref:o,style:ii(s),disabled:r},a)))},LoadingIndicator:function(e){var t=e.innerProps,n=e.isRtl,i=e.size,o=void 0===i?4:i,r=le(e,Fn);return Vt("div",ce({},bn(ne(ne({},r),{},{innerProps:t,isRtl:n,size:o}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),t),Vt(Zn,{delay:0,offset:n}),Vt(Zn,{delay:160,offset:!0}),Vt(Zn,{delay:320,offset:!n}))},Menu:function(e){var t=e.children,n=e.innerRef,i=e.innerProps;return Vt("div",ce({},bn(e,"menu",{menu:!0}),{ref:n},i),t)},MenuList:function(e){var t=e.children,n=e.innerProps,i=e.innerRef,o=e.isMulti;return Vt("div",ce({},bn(e,"menuList",{"menu-list":!0,"menu-list--is-multi":o}),{ref:i},n),t)},MenuPortal:function(e){var t=e.appendTo,n=e.children,o=e.controlElement,r=e.innerProps,s=e.menuPlacement,l=e.menuPosition,a=(0,i.useRef)(null),c=(0,i.useRef)(null),h=re((0,i.useState)(In(s)),2),u=h[0],f=h[1],d=(0,i.useMemo)((function(){return{setPortalPlacement:f}}),[]),p=re((0,i.useState)(null),2),m=p[0],g=p[1],b=(0,i.useCallback)((function(){if(o){var e=function(e){var t=e.getBoundingClientRect();return{bottom:t.bottom,height:t.height,left:t.left,right:t.right,top:t.top,width:t.width}}(o),t="fixed"===l?0:window.pageYOffset,n=e[u]+t;n===(null==m?void 0:m.offset)&&e.left===(null==m?void 0:m.rect.left)&&e.width===(null==m?void 0:m.rect.width)||g({offset:n,rect:e})}}),[o,l,u,null==m?void 0:m.offset,null==m?void 0:m.rect.left,null==m?void 0:m.rect.width]);hn((function(){b()}),[b]);var v=(0,i.useCallback)((function(){"function"==typeof c.current&&(c.current(),c.current=null),o&&a.current&&(c.current=function(e,t,n,i){void 0===i&&(i={});const{ancestorScroll:o=!0,ancestorResize:r=!0,elementResize:s="function"==typeof ResizeObserver,layoutShift:l="function"==typeof IntersectionObserver,animationFrame:a=!1}=i,c=rn(e),h=o||r?[...c?on(c):[],...on(t)]:[];h.forEach((e=>{o&&e.addEventListener("scroll",n,{passive:!0}),r&&e.addEventListener("resize",n)}));const u=c&&l?function(e,t){let n,i=null;const o=Xt(e);function r(){clearTimeout(n),i&&i.disconnect(),i=null}return function s(l,a){void 0===l&&(l=!1),void 0===a&&(a=1),r();const{left:c,top:h,width:u,height:f}=e.getBoundingClientRect();if(l||t(),!u||!f)return;const d={rootMargin:-jt(h)+"px "+-jt(o.clientWidth-(c+u))+"px "+-jt(o.clientHeight-(h+f))+"px "+-jt(c)+"px",threshold:Ft(0,zt(1,a))||1};let p=!0;function m(e){const t=e[0].intersectionRatio;if(t!==a){if(!p)return s();t?s(!1,t):n=setTimeout((()=>{s(!1,1e-7)}),100)}p=!1}try{i=new IntersectionObserver(m,{...d,root:o.ownerDocument})}catch(e){i=new IntersectionObserver(m,d)}i.observe(e)}(!0),r}(c,n):null;let f,d=-1,p=null;s&&(p=new ResizeObserver((e=>{let[i]=e;i&&i.target===c&&p&&(p.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame((()=>{p&&p.observe(t)}))),n()})),c&&!a&&p.observe(c),p.observe(t));let m=a?cn(e):null;return a&&function t(){const i=cn(e);!m||i.x===m.x&&i.y===m.y&&i.width===m.width&&i.height===m.height||n(),m=i,f=requestAnimationFrame(t)}(),n(),()=>{h.forEach((e=>{o&&e.removeEventListener("scroll",n),r&&e.removeEventListener("resize",n)})),u&&u(),p&&p.disconnect(),p=null,a&&cancelAnimationFrame(f)}}(o,a.current,b,{elementResize:"ResizeObserver"in window}))}),[o,b]);hn((function(){v()}),[v]);var y=(0,i.useCallback)((function(e){a.current=e,v()}),[v]);if(!t&&"fixed"!==l||!m)return null;var w=Vt("div",ce({ref:y},bn(ne(ne({},e),{},{offset:m.offset,position:l,rect:m.rect}),"menuPortal",{"menu-portal":!0}),r),n);return Vt(Ln.Provider,{value:d},t?(0,Wt.createPortal)(w,t):w)},LoadingMessage:function(e){var t=e.children,n=void 0===t?"Loading...":t,i=e.innerProps,o=le(e,Pn);return Vt("div",ce({},bn(ne(ne({},o),{},{children:n,innerProps:i}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),i),n)},NoOptionsMessage:function(e){var t=e.children,n=void 0===t?"No options":t,i=e.innerProps,o=le(e,Dn);return Vt("div",ce({},bn(ne(ne({},o),{},{children:n,innerProps:i}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),i),n)},MultiValue:function(e){var t=e.children,n=e.components,i=e.data,o=e.innerProps,r=e.isDisabled,s=e.removeProps,l=e.selectProps,a=n.Container,c=n.Label,h=n.Remove;return Vt(a,{data:i,innerProps:ne(ne({},bn(e,"multiValue",{"multi-value":!0,"multi-value--is-disabled":r})),o),selectProps:l},Vt(c,{data:i,innerProps:ne({},bn(e,"multiValueLabel",{"multi-value__label":!0})),selectProps:l},t),Vt(h,{data:i,innerProps:ne(ne({},bn(e,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(t||"option")},s),selectProps:l}))},MultiValueContainer:oi,MultiValueLabel:oi,MultiValueRemove:function(e){var t=e.children,n=e.innerProps;return Vt("div",ce({role:"button"},n),t||Vt(qn,{size:14}))},Option:function(e){var t=e.children,n=e.isDisabled,i=e.isFocused,o=e.isSelected,r=e.innerRef,s=e.innerProps;return Vt("div",ce({},bn(e,"option",{option:!0,"option--is-disabled":n,"option--is-focused":i,"option--is-selected":o}),{ref:r,"aria-disabled":n},s),t)},Placeholder:function(e){var t=e.children,n=e.innerProps;return Vt("div",ce({},bn(e,"placeholder",{placeholder:!0}),n),t)},SelectContainer:function(e){var t=e.children,n=e.innerProps,i=e.isDisabled,o=e.isRtl;return Vt("div",ce({},bn(e,"container",{"--is-disabled":i,"--is-rtl":o}),n),t)},SingleValue:function(e){var t=e.children,n=e.isDisabled,i=e.innerProps;return Vt("div",ce({},bn(e,"singleValue",{"single-value":!0,"single-value--is-disabled":n}),i),t)},ValueContainer:function(e){var t=e.children,n=e.innerProps,i=e.isMulti,o=e.hasValue;return Vt("div",ce({},bn(e,"valueContainer",{"value-container":!0,"value-container--is-multi":i,"value-container--has-value":o}),n),t)}},si=Number.isNaN||function(e){return"number"==typeof e&&e!=e};function li(e,t){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n++)if(!((i=e[n])===(o=t[n])||si(i)&&si(o)))return!1;var i,o;return!0}for(var ai={name:"7pg0cj-a11yText",styles:"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap"},ci=function(e){return Vt("span",ce({css:ai},e))},hi={guidance:function(e){var t=e.isSearchable,n=e.isMulti,i=e.tabSelectsValue,o=e.context,r=e.isInitialFocus;switch(o){case"menu":return"Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu".concat(i?", press Tab to select the option and exit the menu":"",".");case"input":return r?"".concat(e["aria-label"]||"Select"," is focused ").concat(t?",type to refine list":"",", press Down to open the menu, ").concat(n?" press left to focus selected values":""):"";case"value":return"Use left and right to toggle between focused values, press Backspace to remove the currently focused value";default:return""}},onChange:function(e){var t=e.action,n=e.label,i=void 0===n?"":n,o=e.labels,r=e.isDisabled;switch(t){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(i,", deselected.");case"clear":return"All selected options have been cleared.";case"initial-input-focus":return"option".concat(o.length>1?"s":""," ").concat(o.join(","),", selected.");case"select-option":return"option ".concat(i,r?" is disabled. Select another option.":", selected.");default:return""}},onFocus:function(e){var t=e.context,n=e.focused,i=e.options,o=e.label,r=void 0===o?"":o,s=e.selectValue,l=e.isDisabled,a=e.isSelected,c=e.isAppleDevice,h=function(e,t){return e&&e.length?"".concat(e.indexOf(t)+1," of ").concat(e.length):""};if("value"===t&&s)return"value ".concat(r," focused, ").concat(h(s,n),".");if("menu"===t&&c){var u=l?" disabled":"",f="".concat(a?" selected":"").concat(u);return"".concat(r).concat(f,", ").concat(h(i,n),".")}return""},onFilter:function(e){var t=e.inputValue,n=e.resultsMessage;return"".concat(n).concat(t?" for search term "+t:"",".")}},ui=function(e){var t=e.ariaSelection,n=e.focusedOption,o=e.focusedValue,r=e.focusableOptions,s=e.isFocused,l=e.selectValue,a=e.selectProps,c=e.id,h=e.isAppleDevice,u=a.ariaLiveMessages,f=a.getOptionLabel,d=a.inputValue,p=a.isMulti,m=a.isOptionDisabled,g=a.isSearchable,b=a.menuIsOpen,v=a.options,y=a.screenReaderStatus,w=a.tabSelectsValue,k=a.isLoading,x=a["aria-label"],O=a["aria-live"],S=(0,i.useMemo)((function(){return ne(ne({},hi),u||{})}),[u]),C=(0,i.useMemo)((function(){var e,n="";if(t&&S.onChange){var i=t.option,o=t.options,r=t.removedValue,s=t.removedValues,a=t.value,c=r||i||(e=a,Array.isArray(e)?null:e),h=c?f(c):"",u=o||s||void 0,d=u?u.map(f):[],p=ne({isDisabled:c&&m(c,l),label:h,labels:d},t);n=S.onChange(p)}return n}),[t,S,m,l,f]),E=(0,i.useMemo)((function(){var e="",t=n||o,i=!!(n&&l&&l.includes(n));if(t&&S.onFocus){var s={focused:t,label:f(t),isDisabled:m(t,l),isSelected:i,options:r,context:t===n?"menu":"value",selectValue:l,isAppleDevice:h};e=S.onFocus(s)}return e}),[n,o,f,m,S,r,l,h]),A=(0,i.useMemo)((function(){var e="";if(b&&v.length&&!k&&S.onFilter){var t=y({count:r.length});e=S.onFilter({inputValue:d,resultsMessage:t})}return e}),[r,d,b,S,v,y,k]),M="initial-input-focus"===(null==t?void 0:t.action),T=(0,i.useMemo)((function(){var e="";if(S.guidance){var t=o?"value":b?"menu":"input";e=S.guidance({"aria-label":x,context:t,isDisabled:n&&m(n,l),isMulti:p,isSearchable:g,tabSelectsValue:w,isInitialFocus:M})}return e}),[x,n,o,p,m,g,b,S,l,w,M]),D=Vt(i.Fragment,null,Vt("span",{id:"aria-selection"},C),Vt("span",{id:"aria-focused"},E),Vt("span",{id:"aria-results"},A),Vt("span",{id:"aria-guidance"},T));return Vt(i.Fragment,null,Vt(ci,{id:c},M&&D),Vt(ci,{"aria-live":O,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},s&&!M&&D))},fi=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],di=new RegExp("["+fi.map((function(e){return e.letters})).join("")+"]","g"),pi={},mi=0;mi<fi.length;mi++)for(var gi=fi[mi],bi=0;bi<gi.letters.length;bi++)pi[gi.letters[bi]]=gi.base;var vi=function(e){return e.replace(di,(function(e){return pi[e]}))},yi=function(e,t){void 0===t&&(t=li);var n=null;function i(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];if(n&&n.lastThis===this&&t(i,n.lastArgs))return n.lastResult;var r=e.apply(this,i);return n={lastResult:r,lastArgs:i,lastThis:this},r}return i.clear=function(){n=null},i}(vi),wi=function(e){return e.replace(/^\s+|\s+$/g,"")},ki=function(e){return"".concat(e.label," ").concat(e.value)},xi=["innerRef"];function Oi(e){var t=e.innerRef,n=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];var o=Object.entries(e).filter((function(e){var t=re(e,1)[0];return!n.includes(t)}));return o.reduce((function(e,t){var n=re(t,2),i=n[0],o=n[1];return e[i]=o,e}),{})}(le(e,xi),"onExited","in","enter","exit","appear");return Vt("input",ce({ref:t},n,{css:Ht({label:"dummyInput",background:0,border:0,caretColor:"transparent",fontSize:"inherit",gridArea:"1 / 1 / 2 / 3",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(.01)"},"","")}))}var Si=["boxSizing","height","overflow","paddingRight","position"],Ci={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function Ei(e){e.preventDefault()}function Ai(e){e.stopPropagation()}function Mi(){var e=this.scrollTop,t=this.scrollHeight,n=e+this.offsetHeight;0===e?this.scrollTop=1:n===t&&(this.scrollTop=e-1)}function Ti(){return"ontouchstart"in window||navigator.maxTouchPoints}var Di=!("undefined"==typeof window||!window.document||!window.document.createElement),Pi=0,Ri={capture:!1,passive:!1},$i=function(e){var t=e.target;return t.ownerDocument.activeElement&&t.ownerDocument.activeElement.blur()},_i={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function Bi(e){var t=e.children,n=e.lockEnabled,o=e.captureEnabled,r=function(e){var t=e.isEnabled,n=e.onBottomArrive,o=e.onBottomLeave,r=e.onTopArrive,s=e.onTopLeave,l=(0,i.useRef)(!1),a=(0,i.useRef)(!1),c=(0,i.useRef)(0),h=(0,i.useRef)(null),u=(0,i.useCallback)((function(e,t){if(null!==h.current){var i=h.current,c=i.scrollTop,u=i.scrollHeight,f=i.clientHeight,d=h.current,p=t>0,m=u-f-c,g=!1;m>t&&l.current&&(o&&o(e),l.current=!1),p&&a.current&&(s&&s(e),a.current=!1),p&&t>m?(n&&!l.current&&n(e),d.scrollTop=u,g=!0,l.current=!0):!p&&-t>c&&(r&&!a.current&&r(e),d.scrollTop=0,g=!0,a.current=!0),g&&function(e){e.cancelable&&e.preventDefault(),e.stopPropagation()}(e)}}),[n,o,r,s]),f=(0,i.useCallback)((function(e){u(e,e.deltaY)}),[u]),d=(0,i.useCallback)((function(e){c.current=e.changedTouches[0].clientY}),[]),p=(0,i.useCallback)((function(e){var t=c.current-e.changedTouches[0].clientY;u(e,t)}),[u]),m=(0,i.useCallback)((function(e){if(e){var t=!!An&&{passive:!1};e.addEventListener("wheel",f,t),e.addEventListener("touchstart",d,t),e.addEventListener("touchmove",p,t)}}),[p,d,f]),g=(0,i.useCallback)((function(e){e&&(e.removeEventListener("wheel",f,!1),e.removeEventListener("touchstart",d,!1),e.removeEventListener("touchmove",p,!1))}),[p,d,f]);return(0,i.useEffect)((function(){if(t){var e=h.current;return m(e),function(){g(e)}}}),[t,m,g]),function(e){h.current=e}}({isEnabled:void 0===o||o,onBottomArrive:e.onBottomArrive,onBottomLeave:e.onBottomLeave,onTopArrive:e.onTopArrive,onTopLeave:e.onTopLeave}),s=function(e){var t=e.isEnabled,n=e.accountForScrollbars,o=void 0===n||n,r=(0,i.useRef)({}),s=(0,i.useRef)(null),l=(0,i.useCallback)((function(e){if(Di){var t=document.body,n=t&&t.style;if(o&&Si.forEach((function(e){var t=n&&n[e];r.current[e]=t})),o&&Pi<1){var i=parseInt(r.current.paddingRight,10)||0,s=document.body?document.body.clientWidth:0,l=window.innerWidth-s+i||0;Object.keys(Ci).forEach((function(e){var t=Ci[e];n&&(n[e]=t)})),n&&(n.paddingRight="".concat(l,"px"))}t&&Ti()&&(t.addEventListener("touchmove",Ei,Ri),e&&(e.addEventListener("touchstart",Mi,Ri),e.addEventListener("touchmove",Ai,Ri))),Pi+=1}}),[o]),a=(0,i.useCallback)((function(e){if(Di){var t=document.body,n=t&&t.style;Pi=Math.max(Pi-1,0),o&&Pi<1&&Si.forEach((function(e){var t=r.current[e];n&&(n[e]=t)})),t&&Ti()&&(t.removeEventListener("touchmove",Ei,Ri),e&&(e.removeEventListener("touchstart",Mi,Ri),e.removeEventListener("touchmove",Ai,Ri)))}}),[o]);return(0,i.useEffect)((function(){if(t){var e=s.current;return l(e),function(){a(e)}}}),[t,l,a]),function(e){s.current=e}}({isEnabled:n});return Vt(i.Fragment,null,n&&Vt("div",{onClick:$i,css:_i}),t((function(e){r(e),s(e)})))}var Ii={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},Li=function(e){var t=e.name,n=e.onFocus;return Vt("input",{required:!0,name:t,tabIndex:-1,"aria-hidden":"true",onFocus:n,css:Ii,value:"",onChange:function(){}})};function Ni(e){var t;return"undefined"!=typeof window&&null!=window.navigator&&e.test((null===(t=window.navigator.userAgentData)||void 0===t?void 0:t.platform)||window.navigator.platform)}function Vi(){return Ni(/^Mac/i)}var Hi={clearIndicator:Yn,container:function(e){var t=e.isDisabled;return{label:"container",direction:e.isRtl?"rtl":void 0,pointerEvents:t?"none":void 0,position:"relative"}},control:function(e,t){var n=e.isDisabled,i=e.isFocused,o=e.theme,r=o.colors,s=o.borderRadius;return ne({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:o.spacing.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},t?{}:{backgroundColor:n?r.neutral5:r.neutral0,borderColor:n?r.neutral10:i?r.primary:r.neutral20,borderRadius:s,borderStyle:"solid",borderWidth:1,boxShadow:i?"0 0 0 1px ".concat(r.primary):void 0,"&:hover":{borderColor:i?r.primary:r.neutral30}})},dropdownIndicator:Xn,group:function(e,t){var n=e.theme.spacing;return t?{}:{paddingBottom:2*n.baseUnit,paddingTop:2*n.baseUnit}},groupHeading:function(e,t){var n=e.theme,i=n.colors,o=n.spacing;return ne({label:"group",cursor:"default",display:"block"},t?{}:{color:i.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:3*o.baseUnit,paddingRight:3*o.baseUnit,textTransform:"uppercase"})},indicatorsContainer:function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},indicatorSeparator:function(e,t){var n=e.isDisabled,i=e.theme,o=i.spacing.baseUnit,r=i.colors;return ne({label:"indicatorSeparator",alignSelf:"stretch",width:1},t?{}:{backgroundColor:n?r.neutral10:r.neutral20,marginBottom:2*o,marginTop:2*o})},input:function(e,t){var n=e.isDisabled,i=e.value,o=e.theme,r=o.spacing,s=o.colors;return ne(ne({visibility:n?"hidden":"visible",transform:i?"translateZ(0)":""},ni),t?{}:{margin:r.baseUnit/2,paddingBottom:r.baseUnit/2,paddingTop:r.baseUnit/2,color:s.neutral80})},loadingIndicator:function(e,t){var n=e.isFocused,i=e.size,o=e.theme,r=o.colors,s=o.spacing.baseUnit;return ne({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:i,lineHeight:1,marginRight:i,textAlign:"center",verticalAlign:"middle"},t?{}:{color:n?r.neutral60:r.neutral20,padding:2*s})},loadingMessage:Wn,menu:function(e,t){var n,i=e.placement,o=e.theme,r=o.borderRadius,s=o.spacing,l=o.colors;return ne((ee(n={label:"menu"},function(e){return e?{bottom:"top",top:"bottom"}[e]:"bottom"}(i),"100%"),ee(n,"position","absolute"),ee(n,"width","100%"),ee(n,"zIndex",1),n),t?{}:{backgroundColor:l.neutral0,borderRadius:r,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:s.menuGutter,marginTop:s.menuGutter})},menuList:function(e,t){var n=e.maxHeight,i=e.theme.spacing.baseUnit;return ne({maxHeight:n,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},t?{}:{paddingBottom:i,paddingTop:i})},menuPortal:function(e){var t=e.rect,n=e.offset,i=e.position;return{left:t.left,position:i,top:n,width:t.width,zIndex:1}},multiValue:function(e,t){var n=e.theme,i=n.spacing,o=n.borderRadius,r=n.colors;return ne({label:"multiValue",display:"flex",minWidth:0},t?{}:{backgroundColor:r.neutral10,borderRadius:o/2,margin:i.baseUnit/2})},multiValueLabel:function(e,t){var n=e.theme,i=n.borderRadius,o=n.colors,r=e.cropWithEllipsis;return ne({overflow:"hidden",textOverflow:r||void 0===r?"ellipsis":void 0,whiteSpace:"nowrap"},t?{}:{borderRadius:i/2,color:o.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},multiValueRemove:function(e,t){var n=e.theme,i=n.spacing,o=n.borderRadius,r=n.colors,s=e.isFocused;return ne({alignItems:"center",display:"flex"},t?{}:{borderRadius:o/2,backgroundColor:s?r.dangerLight:void 0,paddingLeft:i.baseUnit,paddingRight:i.baseUnit,":hover":{backgroundColor:r.dangerLight,color:r.danger}})},noOptionsMessage:Hn,option:function(e,t){var n=e.isDisabled,i=e.isFocused,o=e.isSelected,r=e.theme,s=r.spacing,l=r.colors;return ne({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},t?{}:{backgroundColor:o?l.primary:i?l.primary25:"transparent",color:n?l.neutral20:o?l.neutral0:"inherit",padding:"".concat(2*s.baseUnit,"px ").concat(3*s.baseUnit,"px"),":active":{backgroundColor:n?void 0:o?l.primary:l.primary50}})},placeholder:function(e,t){var n=e.theme,i=n.spacing,o=n.colors;return ne({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},t?{}:{color:o.neutral50,marginLeft:i.baseUnit/2,marginRight:i.baseUnit/2})},singleValue:function(e,t){var n=e.isDisabled,i=e.theme,o=i.spacing,r=i.colors;return ne({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},t?{}:{color:n?r.neutral40:r.neutral80,marginLeft:o.baseUnit/2,marginRight:o.baseUnit/2})},valueContainer:function(e,t){var n=e.theme.spacing,i=e.isMulti,o=e.hasValue,r=e.selectProps.controlShouldRenderValue;return ne({alignItems:"center",display:i&&o&&r?"flex":"grid",flex:1,flexWrap:"wrap",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"},t?{}:{padding:"".concat(n.baseUnit/2,"px ").concat(2*n.baseUnit,"px")})}},Wi={borderRadius:4,colors:{primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},spacing:{baseUnit:4,controlHeight:38,menuGutter:8}},zi={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:On(),captureMenuScroll:!On(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:function(e,t){if(e.data.__isNew__)return!0;var n=ne({ignoreCase:!0,ignoreAccents:!0,stringify:ki,trim:!0,matchFrom:"any"},void 0),i=n.ignoreCase,o=n.ignoreAccents,r=n.stringify,s=n.trim,l=n.matchFrom,a=s?wi(t):t,c=s?wi(r(e)):r(e);return i&&(a=a.toLowerCase(),c=c.toLowerCase()),o&&(a=yi(a),c=vi(c)),"start"===l?c.substr(0,a.length)===a:c.indexOf(a)>-1},formatGroupLabel:function(e){return e.label},getOptionLabel:function(e){return e.label},getOptionValue:function(e){return e.value},isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:function(e){return!!e.isDisabled},loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!function(){try{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch(e){return!1}}(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(e){var t=e.count;return"".concat(t," result").concat(1!==t?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function Fi(e,t,n,i){return{type:"option",data:t,isDisabled:Ki(e,t,n),isSelected:Zi(e,t,n),label:Xi(e,t),value:Yi(e,t),index:i}}function Qi(e,t){return e.options.map((function(n,i){if("options"in n){var o=n.options.map((function(n,i){return Fi(e,n,t,i)})).filter((function(t){return Ui(e,t)}));return o.length>0?{type:"group",data:n,options:o,index:i}:void 0}var r=Fi(e,n,t,i);return Ui(e,r)?r:void 0})).filter(Mn)}function ji(e){return e.reduce((function(e,t){return"group"===t.type?e.push.apply(e,pe(t.options.map((function(e){return e.data})))):e.push(t.data),e}),[])}function qi(e,t){return e.reduce((function(e,n){return"group"===n.type?e.push.apply(e,pe(n.options.map((function(e){return{data:e.data,id:"".concat(t,"-").concat(n.index,"-").concat(e.index)}})))):e.push({data:n.data,id:"".concat(t,"-").concat(n.index)}),e}),[])}function Ui(e,t){var n=e.inputValue,i=void 0===n?"":n,o=t.data,r=t.isSelected,s=t.label,l=t.value;return(!eo(e)||!r)&&Ji(e,{label:s,value:l,data:o},i)}var Gi=function(e,t){var n;return(null===(n=e.find((function(e){return e.data===t})))||void 0===n?void 0:n.id)||null},Xi=function(e,t){return e.getOptionLabel(t)},Yi=function(e,t){return e.getOptionValue(t)};function Ki(e,t,n){return"function"==typeof e.isOptionDisabled&&e.isOptionDisabled(t,n)}function Zi(e,t,n){if(n.indexOf(t)>-1)return!0;if("function"==typeof e.isOptionSelected)return e.isOptionSelected(t,n);var i=Yi(e,t);return n.some((function(t){return Yi(e,t)===i}))}function Ji(e,t,n){return!e.filterOption||e.filterOption(t,n)}var eo=function(e){var t=e.hideSelectedOptions,n=e.isMulti;return void 0===t?n:t},to=1,no=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&ue(e,t)}(s,e);var t,n,o,r=de(s);function s(e){var t;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),(t=r.call(this,e)).state={ariaSelection:null,focusedOption:null,focusedOptionId:null,focusableOptionsWithIds:[],focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,prevWasFocused:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0,instancePrefix:""},t.blockOptionHover=!1,t.isComposing=!1,t.commonProps=void 0,t.initialTouchX=0,t.initialTouchY=0,t.openAfterFocus=!1,t.scrollToFocusedOptionOnUpdate=!1,t.userIsDragging=void 0,t.isAppleDevice=Vi()||Ni(/^iPhone/i)||Ni(/^iPad/i)||Vi()&&navigator.maxTouchPoints>1,t.controlRef=null,t.getControlRef=function(e){t.controlRef=e},t.focusedOptionRef=null,t.getFocusedOptionRef=function(e){t.focusedOptionRef=e},t.menuListRef=null,t.getMenuListRef=function(e){t.menuListRef=e},t.inputRef=null,t.getInputRef=function(e){t.inputRef=e},t.focus=t.focusInput,t.blur=t.blurInput,t.onChange=function(e,n){var i=t.props,o=i.onChange,r=i.name;n.name=r,t.ariaOnChange(e,n),o(e,n)},t.setValue=function(e,n,i){var o=t.props,r=o.closeMenuOnSelect,s=o.isMulti,l=o.inputValue;t.onInputChange("",{action:"set-value",prevInputValue:l}),r&&(t.setState({inputIsHiddenAfterUpdate:!s}),t.onMenuClose()),t.setState({clearFocusValueOnUpdate:!0}),t.onChange(e,{action:n,option:i})},t.selectOption=function(e){var n=t.props,i=n.blurInputOnSelect,o=n.isMulti,r=n.name,s=t.state.selectValue,l=o&&t.isOptionSelected(e,s),a=t.isOptionDisabled(e,s);if(l){var c=t.getOptionValue(e);t.setValue(s.filter((function(e){return t.getOptionValue(e)!==c})),"deselect-option",e)}else{if(a)return void t.ariaOnChange(e,{action:"select-option",option:e,name:r});o?t.setValue([].concat(pe(s),[e]),"select-option",e):t.setValue(e,"select-option")}i&&t.blurInput()},t.removeValue=function(e){var n=t.props.isMulti,i=t.state.selectValue,o=t.getOptionValue(e),r=i.filter((function(e){return t.getOptionValue(e)!==o})),s=Tn(n,r,r[0]||null);t.onChange(s,{action:"remove-value",removedValue:e}),t.focusInput()},t.clearValue=function(){var e=t.state.selectValue;t.onChange(Tn(t.props.isMulti,[],null),{action:"clear",removedValues:e})},t.popValue=function(){var e=t.props.isMulti,n=t.state.selectValue,i=n[n.length-1],o=n.slice(0,n.length-1),r=Tn(e,o,o[0]||null);t.onChange(r,{action:"pop-value",removedValue:i})},t.getFocusedOptionId=function(e){return Gi(t.state.focusableOptionsWithIds,e)},t.getFocusableOptionsWithIds=function(){return qi(Qi(t.props,t.state.selectValue),t.getElementId("option"))},t.getValue=function(){return t.state.selectValue},t.cx=function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return pn.apply(void 0,[t.props.classNamePrefix].concat(n))},t.getOptionLabel=function(e){return Xi(t.props,e)},t.getOptionValue=function(e){return Yi(t.props,e)},t.getStyles=function(e,n){var i=t.props.unstyled,o=Hi[e](n,i);o.boxSizing="border-box";var r=t.props.styles[e];return r?r(o,n):o},t.getClassNames=function(e,n){var i,o;return null===(i=(o=t.props.classNames)[e])||void 0===i?void 0:i.call(o,n)},t.getElementId=function(e){return"".concat(t.state.instancePrefix,"-").concat(e)},t.getComponents=function(){return e=t.props,ne(ne({},ri),e.components);var e},t.buildCategorizedOptions=function(){return Qi(t.props,t.state.selectValue)},t.getCategorizedOptions=function(){return t.props.menuIsOpen?t.buildCategorizedOptions():[]},t.buildFocusableOptions=function(){return ji(t.buildCategorizedOptions())},t.getFocusableOptions=function(){return t.props.menuIsOpen?t.buildFocusableOptions():[]},t.ariaOnChange=function(e,n){t.setState({ariaSelection:ne({value:e},n)})},t.onMenuMouseDown=function(e){0===e.button&&(e.stopPropagation(),e.preventDefault(),t.focusInput())},t.onMenuMouseMove=function(e){t.blockOptionHover=!1},t.onControlMouseDown=function(e){if(!e.defaultPrevented){var n=t.props.openMenuOnClick;t.state.isFocused?t.props.menuIsOpen?"INPUT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&t.onMenuClose():n&&t.openMenu("first"):(n&&(t.openAfterFocus=!0),t.focusInput()),"INPUT"!==e.target.tagName&&"TEXTAREA"!==e.target.tagName&&e.preventDefault()}},t.onDropdownIndicatorMouseDown=function(e){if(!(e&&"mousedown"===e.type&&0!==e.button||t.props.isDisabled)){var n=t.props,i=n.isMulti,o=n.menuIsOpen;t.focusInput(),o?(t.setState({inputIsHiddenAfterUpdate:!i}),t.onMenuClose()):t.openMenu("first"),e.preventDefault()}},t.onClearIndicatorMouseDown=function(e){e&&"mousedown"===e.type&&0!==e.button||(t.clearValue(),e.preventDefault(),t.openAfterFocus=!1,"touchend"===e.type?t.focusInput():setTimeout((function(){return t.focusInput()})))},t.onScroll=function(e){"boolean"==typeof t.props.closeMenuOnScroll?e.target instanceof HTMLElement&&vn(e.target)&&t.props.onMenuClose():"function"==typeof t.props.closeMenuOnScroll&&t.props.closeMenuOnScroll(e)&&t.props.onMenuClose()},t.onCompositionStart=function(){t.isComposing=!0},t.onCompositionEnd=function(){t.isComposing=!1},t.onTouchStart=function(e){var n=e.touches,i=n&&n.item(0);i&&(t.initialTouchX=i.clientX,t.initialTouchY=i.clientY,t.userIsDragging=!1)},t.onTouchMove=function(e){var n=e.touches,i=n&&n.item(0);if(i){var o=Math.abs(i.clientX-t.initialTouchX),r=Math.abs(i.clientY-t.initialTouchY);t.userIsDragging=o>5||r>5}},t.onTouchEnd=function(e){t.userIsDragging||(t.controlRef&&!t.controlRef.contains(e.target)&&t.menuListRef&&!t.menuListRef.contains(e.target)&&t.blurInput(),t.initialTouchX=0,t.initialTouchY=0)},t.onControlTouchEnd=function(e){t.userIsDragging||t.onControlMouseDown(e)},t.onClearIndicatorTouchEnd=function(e){t.userIsDragging||t.onClearIndicatorMouseDown(e)},t.onDropdownIndicatorTouchEnd=function(e){t.userIsDragging||t.onDropdownIndicatorMouseDown(e)},t.handleInputChange=function(e){var n=t.props.inputValue,i=e.currentTarget.value;t.setState({inputIsHiddenAfterUpdate:!1}),t.onInputChange(i,{action:"input-change",prevInputValue:n}),t.props.menuIsOpen||t.onMenuOpen()},t.onInputFocus=function(e){t.props.onFocus&&t.props.onFocus(e),t.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(t.openAfterFocus||t.props.openMenuOnFocus)&&t.openMenu("first"),t.openAfterFocus=!1},t.onInputBlur=function(e){var n=t.props.inputValue;t.menuListRef&&t.menuListRef.contains(document.activeElement)?t.inputRef.focus():(t.props.onBlur&&t.props.onBlur(e),t.onInputChange("",{action:"input-blur",prevInputValue:n}),t.onMenuClose(),t.setState({focusedValue:null,isFocused:!1}))},t.onOptionHover=function(e){if(!t.blockOptionHover&&t.state.focusedOption!==e){var n=t.getFocusableOptions().indexOf(e);t.setState({focusedOption:e,focusedOptionId:n>-1?t.getFocusedOptionId(e):null})}},t.shouldHideSelectedOptions=function(){return eo(t.props)},t.onValueInputFocus=function(e){e.preventDefault(),e.stopPropagation(),t.focus()},t.onKeyDown=function(e){var n=t.props,i=n.isMulti,o=n.backspaceRemovesValue,r=n.escapeClearsValue,s=n.inputValue,l=n.isClearable,a=n.isDisabled,c=n.menuIsOpen,h=n.onKeyDown,u=n.tabSelectsValue,f=n.openMenuOnFocus,d=t.state,p=d.focusedOption,m=d.focusedValue,g=d.selectValue;if(!(a||"function"==typeof h&&(h(e),e.defaultPrevented))){switch(t.blockOptionHover=!0,e.key){case"ArrowLeft":if(!i||s)return;t.focusValue("previous");break;case"ArrowRight":if(!i||s)return;t.focusValue("next");break;case"Delete":case"Backspace":if(s)return;if(m)t.removeValue(m);else{if(!o)return;i?t.popValue():l&&t.clearValue()}break;case"Tab":if(t.isComposing)return;if(e.shiftKey||!c||!u||!p||f&&t.isOptionSelected(p,g))return;t.selectOption(p);break;case"Enter":if(229===e.keyCode)break;if(c){if(!p)return;if(t.isComposing)return;t.selectOption(p);break}return;case"Escape":c?(t.setState({inputIsHiddenAfterUpdate:!1}),t.onInputChange("",{action:"menu-close",prevInputValue:s}),t.onMenuClose()):l&&r&&t.clearValue();break;case" ":if(s)return;if(!c){t.openMenu("first");break}if(!p)return;t.selectOption(p);break;case"ArrowUp":c?t.focusOption("up"):t.openMenu("last");break;case"ArrowDown":c?t.focusOption("down"):t.openMenu("first");break;case"PageUp":if(!c)return;t.focusOption("pageup");break;case"PageDown":if(!c)return;t.focusOption("pagedown");break;case"Home":if(!c)return;t.focusOption("first");break;case"End":if(!c)return;t.focusOption("last");break;default:return}e.preventDefault()}},t.state.instancePrefix="react-select-"+(t.props.instanceId||++to),t.state.selectValue=mn(e.value),e.menuIsOpen&&t.state.selectValue.length){var n=t.getFocusableOptionsWithIds(),i=t.buildFocusableOptions(),o=i.indexOf(t.state.selectValue[0]);t.state.focusableOptionsWithIds=n,t.state.focusedOption=i[o],t.state.focusedOptionId=Gi(n,i[o])}return t}return t=s,n=[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput(),this.props.menuIsOpen&&this.state.focusedOption&&this.menuListRef&&this.focusedOptionRef&&xn(this.menuListRef,this.focusedOptionRef)}},{key:"componentDidUpdate",value:function(e){var t=this.props,n=t.isDisabled,i=t.menuIsOpen,o=this.state.isFocused;(o&&!n&&e.isDisabled||o&&i&&!e.menuIsOpen)&&this.focusInput(),o&&n&&!e.isDisabled?this.setState({isFocused:!1},this.onMenuClose):o||n||!e.isDisabled||this.inputRef!==document.activeElement||this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(xn(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close",prevInputValue:this.props.inputValue}),this.props.onMenuClose()}},{key:"onInputChange",value:function(e,t){this.props.onInputChange(e,t)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(e){var t=this,n=this.state,i=n.selectValue,o=n.isFocused,r=this.buildFocusableOptions(),s="first"===e?0:r.length-1;if(!this.props.isMulti){var l=r.indexOf(i[0]);l>-1&&(s=l)}this.scrollToFocusedOptionOnUpdate=!(o&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:r[s],focusedOptionId:this.getFocusedOptionId(r[s])},(function(){return t.onMenuOpen()}))}},{key:"focusValue",value:function(e){var t=this.state,n=t.selectValue,i=t.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var o=n.indexOf(i);i||(o=-1);var r=n.length-1,s=-1;if(n.length){switch(e){case"previous":s=0===o?0:-1===o?r:o-1;break;case"next":o>-1&&o<r&&(s=o+1)}this.setState({inputIsHidden:-1!==s,focusedValue:n[s]})}}}},{key:"focusOption",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"first",t=this.props.pageSize,n=this.state.focusedOption,i=this.getFocusableOptions();if(i.length){var o=0,r=i.indexOf(n);n||(r=-1),"up"===e?o=r>0?r-1:i.length-1:"down"===e?o=(r+1)%i.length:"pageup"===e?(o=r-t)<0&&(o=0):"pagedown"===e?(o=r+t)>i.length-1&&(o=i.length-1):"last"===e&&(o=i.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:i[o],focusedValue:null,focusedOptionId:this.getFocusedOptionId(i[o])})}}},{key:"getTheme",value:function(){return this.props.theme?"function"==typeof this.props.theme?this.props.theme(Wi):ne(ne({},Wi),this.props.theme):Wi}},{key:"getCommonProps",value:function(){var e=this.clearValue,t=this.cx,n=this.getStyles,i=this.getClassNames,o=this.getValue,r=this.selectOption,s=this.setValue,l=this.props,a=l.isMulti,c=l.isRtl,h=l.options;return{clearValue:e,cx:t,getStyles:n,getClassNames:i,getValue:o,hasValue:this.hasValue(),isMulti:a,isRtl:c,options:h,selectOption:r,selectProps:l,setValue:s,theme:this.getTheme()}}},{key:"hasValue",value:function(){return this.state.selectValue.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var e=this.props,t=e.isClearable,n=e.isMulti;return void 0===t?n:t}},{key:"isOptionDisabled",value:function(e,t){return Ki(this.props,e,t)}},{key:"isOptionSelected",value:function(e,t){return Zi(this.props,e,t)}},{key:"filterOption",value:function(e,t){return Ji(this.props,e,t)}},{key:"formatOptionLabel",value:function(e,t){if("function"==typeof this.props.formatOptionLabel){var n=this.props.inputValue,i=this.state.selectValue;return this.props.formatOptionLabel(e,{context:t,inputValue:n,selectValue:i})}return this.getOptionLabel(e)}},{key:"formatGroupLabel",value:function(e){return this.props.formatGroupLabel(e)}},{key:"startListeningComposition",value:function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))}},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))}},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:function(){var e=this.props,t=e.isDisabled,n=e.isSearchable,o=e.inputId,r=e.inputValue,s=e.tabIndex,l=e.form,a=e.menuIsOpen,c=e.required,h=this.getComponents().Input,u=this.state,f=u.inputIsHidden,d=u.ariaSelection,p=this.commonProps,m=o||this.getElementId("input"),g=ne(ne(ne({"aria-autocomplete":"list","aria-expanded":a,"aria-haspopup":!0,"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props["aria-invalid"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-required":c,role:"combobox","aria-activedescendant":this.isAppleDevice?void 0:this.state.focusedOptionId||""},a&&{"aria-controls":this.getElementId("listbox")}),!n&&{"aria-readonly":!0}),this.hasValue()?"initial-input-focus"===(null==d?void 0:d.action)&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return n?i.createElement(h,ce({},p,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:m,innerRef:this.getInputRef,isDisabled:t,isHidden:f,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:s,form:l,type:"text",value:r},g)):i.createElement(Oi,ce({id:m,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:fn,onFocus:this.onInputFocus,disabled:t,tabIndex:s,inputMode:"none",form:l,value:""},g))}},{key:"renderPlaceholderOrValue",value:function(){var e=this,t=this.getComponents(),n=t.MultiValue,o=t.MultiValueContainer,r=t.MultiValueLabel,s=t.MultiValueRemove,l=t.SingleValue,a=t.Placeholder,c=this.commonProps,h=this.props,u=h.controlShouldRenderValue,f=h.isDisabled,d=h.isMulti,p=h.inputValue,m=h.placeholder,g=this.state,b=g.selectValue,v=g.focusedValue,y=g.isFocused;if(!this.hasValue()||!u)return p?null:i.createElement(a,ce({},c,{key:"placeholder",isDisabled:f,isFocused:y,innerProps:{id:this.getElementId("placeholder")}}),m);if(d)return b.map((function(t,l){var a=t===v,h="".concat(e.getOptionLabel(t),"-").concat(e.getOptionValue(t));return i.createElement(n,ce({},c,{components:{Container:o,Label:r,Remove:s},isFocused:a,isDisabled:f,key:h,index:l,removeProps:{onClick:function(){return e.removeValue(t)},onTouchEnd:function(){return e.removeValue(t)},onMouseDown:function(e){e.preventDefault()}},data:t}),e.formatOptionLabel(t,"value"))}));if(p)return null;var w=b[0];return i.createElement(l,ce({},c,{data:w,isDisabled:f}),this.formatOptionLabel(w,"value"))}},{key:"renderClearIndicator",value:function(){var e=this.getComponents().ClearIndicator,t=this.commonProps,n=this.props,o=n.isDisabled,r=n.isLoading,s=this.state.isFocused;if(!this.isClearable()||!e||o||!this.hasValue()||r)return null;var l={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return i.createElement(e,ce({},t,{innerProps:l,isFocused:s}))}},{key:"renderLoadingIndicator",value:function(){var e=this.getComponents().LoadingIndicator,t=this.commonProps,n=this.props,o=n.isDisabled,r=n.isLoading,s=this.state.isFocused;return e&&r?i.createElement(e,ce({},t,{innerProps:{"aria-hidden":"true"},isDisabled:o,isFocused:s})):null}},{key:"renderIndicatorSeparator",value:function(){var e=this.getComponents(),t=e.DropdownIndicator,n=e.IndicatorSeparator;if(!t||!n)return null;var o=this.commonProps,r=this.props.isDisabled,s=this.state.isFocused;return i.createElement(n,ce({},o,{isDisabled:r,isFocused:s}))}},{key:"renderDropdownIndicator",value:function(){var e=this.getComponents().DropdownIndicator;if(!e)return null;var t=this.commonProps,n=this.props.isDisabled,o=this.state.isFocused,r={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return i.createElement(e,ce({},t,{innerProps:r,isDisabled:n,isFocused:o}))}},{key:"renderMenu",value:function(){var e=this,t=this.getComponents(),n=t.Group,o=t.GroupHeading,r=t.Menu,s=t.MenuList,l=t.MenuPortal,a=t.LoadingMessage,c=t.NoOptionsMessage,h=t.Option,u=this.commonProps,f=this.state.focusedOption,d=this.props,p=d.captureMenuScroll,m=d.inputValue,g=d.isLoading,b=d.loadingMessage,v=d.minMenuHeight,y=d.maxMenuHeight,w=d.menuIsOpen,k=d.menuPlacement,x=d.menuPosition,O=d.menuPortalTarget,S=d.menuShouldBlockScroll,C=d.menuShouldScrollIntoView,E=d.noOptionsMessage,A=d.onMenuScrollToTop,M=d.onMenuScrollToBottom;if(!w)return null;var T,D=function(t,n){var o=t.type,r=t.data,s=t.isDisabled,l=t.isSelected,a=t.label,c=t.value,d=f===r,p=s?void 0:function(){return e.onOptionHover(r)},m=s?void 0:function(){return e.selectOption(r)},g="".concat(e.getElementId("option"),"-").concat(n),b={id:g,onClick:m,onMouseMove:p,onMouseOver:p,tabIndex:-1,role:"option","aria-selected":e.isAppleDevice?void 0:l};return i.createElement(h,ce({},u,{innerProps:b,data:r,isDisabled:s,isSelected:l,key:g,label:a,type:o,value:c,isFocused:d,innerRef:d?e.getFocusedOptionRef:void 0}),e.formatOptionLabel(t.data,"menu"))};if(this.hasOptions())T=this.getCategorizedOptions().map((function(t){if("group"===t.type){var r=t.data,s=t.options,l=t.index,a="".concat(e.getElementId("group"),"-").concat(l),c="".concat(a,"-heading");return i.createElement(n,ce({},u,{key:a,data:r,options:s,Heading:o,headingProps:{id:c,data:t.data},label:e.formatGroupLabel(t.data)}),t.options.map((function(e){return D(e,"".concat(l,"-").concat(e.index))})))}if("option"===t.type)return D(t,"".concat(t.index))}));else if(g){var P=b({inputValue:m});if(null===P)return null;T=i.createElement(a,u,P)}else{var R=E({inputValue:m});if(null===R)return null;T=i.createElement(c,u,R)}var $={minMenuHeight:v,maxMenuHeight:y,menuPlacement:k,menuPosition:x,menuShouldScrollIntoView:C},_=i.createElement(Nn,ce({},u,$),(function(t){var n=t.ref,o=t.placerProps,l=o.placement,a=o.maxHeight;return i.createElement(r,ce({},u,$,{innerRef:n,innerProps:{onMouseDown:e.onMenuMouseDown,onMouseMove:e.onMenuMouseMove},isLoading:g,placement:l}),i.createElement(Bi,{captureEnabled:p,onTopArrive:A,onBottomArrive:M,lockEnabled:S},(function(t){return i.createElement(s,ce({},u,{innerRef:function(n){e.getMenuListRef(n),t(n)},innerProps:{role:"listbox","aria-multiselectable":u.isMulti,id:e.getElementId("listbox")},isLoading:g,maxHeight:a,focusedOption:f}),T)})))}));return O||"fixed"===x?i.createElement(l,ce({},u,{appendTo:O,controlElement:this.controlRef,menuPlacement:k,menuPosition:x}),_):_}},{key:"renderFormField",value:function(){var e=this,t=this.props,n=t.delimiter,o=t.isDisabled,r=t.isMulti,s=t.name,l=t.required,a=this.state.selectValue;if(l&&!this.hasValue()&&!o)return i.createElement(Li,{name:s,onFocus:this.onValueInputFocus});if(s&&!o){if(r){if(n){var c=a.map((function(t){return e.getOptionValue(t)})).join(n);return i.createElement("input",{name:s,type:"hidden",value:c})}var h=a.length>0?a.map((function(t,n){return i.createElement("input",{key:"i-".concat(n),name:s,type:"hidden",value:e.getOptionValue(t)})})):i.createElement("input",{name:s,type:"hidden",value:""});return i.createElement("div",null,h)}var u=a[0]?this.getOptionValue(a[0]):"";return i.createElement("input",{name:s,type:"hidden",value:u})}}},{key:"renderLiveRegion",value:function(){var e=this.commonProps,t=this.state,n=t.ariaSelection,o=t.focusedOption,r=t.focusedValue,s=t.isFocused,l=t.selectValue,a=this.getFocusableOptions();return i.createElement(ui,ce({},e,{id:this.getElementId("live-region"),ariaSelection:n,focusedOption:o,focusedValue:r,isFocused:s,selectValue:l,focusableOptions:a,isAppleDevice:this.isAppleDevice}))}},{key:"render",value:function(){var e=this.getComponents(),t=e.Control,n=e.IndicatorsContainer,o=e.SelectContainer,r=e.ValueContainer,s=this.props,l=s.className,a=s.id,c=s.isDisabled,h=s.menuIsOpen,u=this.state.isFocused,f=this.commonProps=this.getCommonProps();return i.createElement(o,ce({},f,{className:l,innerProps:{id:a,onKeyDown:this.onKeyDown},isDisabled:c,isFocused:u}),this.renderLiveRegion(),i.createElement(t,ce({},f,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:c,isFocused:u,menuIsOpen:h}),i.createElement(r,ce({},f,{isDisabled:c}),this.renderPlaceholderOrValue(),this.renderInput()),i.createElement(n,ce({},f,{isDisabled:c}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],o=[{key:"getDerivedStateFromProps",value:function(e,t){var n=t.prevProps,i=t.clearFocusValueOnUpdate,o=t.inputIsHiddenAfterUpdate,r=t.ariaSelection,s=t.isFocused,l=t.prevWasFocused,a=t.instancePrefix,c=e.options,h=e.value,u=e.menuIsOpen,f=e.inputValue,d=e.isMulti,p=mn(h),m={};if(n&&(h!==n.value||c!==n.options||u!==n.menuIsOpen||f!==n.inputValue)){var g=u?function(e,t){return ji(Qi(e,t))}(e,p):[],b=u?qi(Qi(e,p),"".concat(a,"-option")):[],v=i?function(e,t){var n=e.focusedValue,i=e.selectValue.indexOf(n);if(i>-1){if(t.indexOf(n)>-1)return n;if(i<t.length)return t[i]}return null}(t,p):null,y=function(e,t){var n=e.focusedOption;return n&&t.indexOf(n)>-1?n:t[0]}(t,g);m={selectValue:p,focusedOption:y,focusedOptionId:Gi(b,y),focusableOptionsWithIds:b,focusedValue:v,clearFocusValueOnUpdate:!1}}var w=null!=o&&e!==n?{inputIsHidden:o,inputIsHiddenAfterUpdate:void 0}:{},k=r,x=s&&l;return s&&!x&&(k={value:Tn(d,p,p[0]||null),options:p,action:"initial-input-focus"},x=!l),"initial-input-focus"===(null==r?void 0:r.action)&&(k=null),ne(ne(ne({},m),w),{},{prevProps:e,ariaSelection:k,prevWasFocused:x})}}],n&&he(t.prototype,n),o&&he(t,o),Object.defineProperty(t,"prototype",{writable:!1}),s}(i.Component);no.defaultProps=zi;var io=(0,i.forwardRef)((function(e,t){var n=function(e){var t=e.defaultInputValue,n=void 0===t?"":t,o=e.defaultMenuIsOpen,r=void 0!==o&&o,s=e.defaultValue,l=void 0===s?null:s,a=e.inputValue,c=e.menuIsOpen,h=e.onChange,u=e.onInputChange,f=e.onMenuClose,d=e.onMenuOpen,p=e.value,m=le(e,ae),g=re((0,i.useState)(void 0!==a?a:n),2),b=g[0],v=g[1],y=re((0,i.useState)(void 0!==c?c:r),2),w=y[0],k=y[1],x=re((0,i.useState)(void 0!==p?p:l),2),O=x[0],S=x[1],C=(0,i.useCallback)((function(e,t){"function"==typeof h&&h(e,t),S(e)}),[h]),E=(0,i.useCallback)((function(e,t){var n;"function"==typeof u&&(n=u(e,t)),v(void 0!==n?n:e)}),[u]),A=(0,i.useCallback)((function(){"function"==typeof d&&d(),k(!0)}),[d]),M=(0,i.useCallback)((function(){"function"==typeof f&&f(),k(!1)}),[f]),T=void 0!==a?a:b,D=void 0!==c?c:w,P=void 0!==p?p:O;return ne(ne({},m),{},{inputValue:T,menuIsOpen:D,onChange:C,onInputChange:E,onMenuClose:M,onMenuOpen:A,value:P})}(e);return i.createElement(no,ce({ref:t},n))})),oo=io;const ro=(0,r.withInstanceId)((function({label:e,value:t,help:n,instanceId:o,onChange:r,className:s,...l}){const a=`ffblock-font-family-${o}`,u=[{value:"",label:(0,h.__)("Default","fluentform-block")}];return Object.keys(k).map((e=>{u.push({value:e,label:e})})),(0,i.createElement)(c.BaseControl,{label:e,id:a,help:n,className:s},(0,i.createElement)(oo,{value:t?{value:t,label:t}:{},onChange:e=>(e=>{let t=e.value;const n=document.createElement("link");n.rel="stylesheet",t&&(n.href="https://fonts.googleapis.com/css?family="+e.value.replace(/ /g,"+")+":100,100italic,200,200italic,300,300italic,400,400italic,500,500italic,600,600italic,700,700italic,800,800italic,900,900italic",document.head.appendChild(n)),r(e.value)})(e),options:u,closeMenuOnSelect:!0,...l}))})),so=function(e){const{label:t,value:n,onChange:o,resRequiredProps:r}=e,s=(e,t)=>{const i=JSON.parse(JSON.stringify(n));i[t]=e,o(i)};return(0,i.createElement)("div",{className:"ffblock-control-field ffblock-control-typography-wrap"},t&&(0,i.createElement)("span",{className:"ffblock-label"},t),(0,i.createElement)("div",{className:"ffblock-typography"},(0,i.createElement)(c.Dropdown,{className:"ffblock-typography-dropdown-icon",contentClassName:"ffblock-components-popover ffblock-cp-typography-content",position:"bottom right",renderToggle:({isOpen:e,onToggle:t})=>(0,i.createElement)(c.Button,{isSmall:!0,onClick:t,"aria-expanded":e,icon:"edit"}),renderContent:()=>(0,i.createElement)("div",{className:"ffblock-typography-content"},(0,i.createElement)(ro,{label:(0,h.__)("Font Family","fluentform-block"),value:n.family||null,onChange:e=>s(e,"family"),className:"font-family-base-controll ffblock-control-react-select"}),(0,i.createElement)(G,{label:(0,h.__)("Font Size","fluentform-block"),responsive:!0,value:n.size||{},units:["px","em","%"],min:1,max:"em"===n.size.unit?10:200,step:"em"===n.size.unit?.1:1,onChange:e=>s(e,"size"),resRequiredProps:r}),(0,i.createElement)(c.SelectControl,{label:(0,h.__)("Font Weight","fluentform-block"),value:n.weight||"",options:v,onChange:e=>s(e,"weight")}),(0,i.createElement)(c.SelectControl,{label:(0,h.__)("Font Style","fluentform-block"),value:n.style||null,options:y,onChange:e=>s(e,"style")}),(0,i.createElement)(c.SelectControl,{label:(0,h.__)("Text Transform","fluentform-block"),value:n.transform||"",options:b,onChange:e=>s(e,"transform")}),(0,i.createElement)(G,{label:(0,h.__)("Letter Spacing","fluentform-block"),responsive:!0,value:n.spacing||{},units:["px","em"],min:-5,max:"em"===n.spacing.unit?10:100,step:"em"===n.spacing.unit?.01:1,onChange:e=>s(e,"spacing"),resRequiredProps:r}),(0,i.createElement)(G,{label:(0,h.__)("Line Height","fluentform-block"),responsive:!0,value:n.height||{},units:["px","em"],min:1,max:"em"===n.height.unit?10:100,step:"em"===n.height.unit?.01:1,onChange:e=>s(e,"height"),resRequiredProps:r}))})))};class lo{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=bo(this,e,t);let i=[];return this.decompose(0,e,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(t,this.length,i,1),co.from(i,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=bo(this,e,t);let n=[];return this.decompose(e,t,n,0),co.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),i=new fo(this),o=new fo(e);for(let e=t,r=t;;){if(i.next(e),o.next(e),e=0,i.lineBreak!=o.lineBreak||i.done!=o.done||i.value!=o.value)return!1;if(r+=i.value.length,i.done||r>=n)return!0}}iter(e=1){return new fo(this,e)}iterRange(e,t=this.length){return new po(this,e,t)}iterLines(e,t){let n;if(null==e)n=this.iter();else{null==t&&(t=this.lines+1);let i=this.line(e).from;n=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new mo(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(0==e.length)throw new RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new ao(e):co.from(ao.split(e,[])):lo.empty}}class ao extends lo{constructor(e,t=function(e){let t=-1;for(let n of e)t+=n.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,i){for(let o=0;;o++){let r=this.text[o],s=i+r.length;if((t?n:s)>=e)return new go(i,s,n,r);i=s+1,n++}}decompose(e,t,n,i){let o=e<=0&&t>=this.length?this:new ao(uo(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(1&i){let e=n.pop(),t=ho(o.text,e.text.slice(),0,o.length);if(t.length<=32)n.push(new ao(t,e.length+o.length));else{let e=t.length>>1;n.push(new ao(t.slice(0,e)),new ao(t.slice(e)))}}else n.push(o)}replace(e,t,n){if(!(n instanceof ao))return super.replace(e,t,n);[e,t]=bo(this,e,t);let i=ho(this.text,ho(n.text,uo(this.text,0,e)),t),o=this.length+n.length-(t-e);return i.length<=32?new ao(i,o):co.from(ao.split(i,[]),o)}sliceString(e,t=this.length,n="\n"){[e,t]=bo(this,e,t);let i="";for(let o=0,r=0;o<=t&&r<this.text.length;r++){let s=this.text[r],l=o+s.length;o>e&&r&&(i+=n),e<l&&t>o&&(i+=s.slice(Math.max(0,e-o),t-o)),o=l+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],i=-1;for(let o of e)n.push(o),i+=o.length+1,32==n.length&&(t.push(new ao(n,i)),n=[],i=-1);return i>-1&&t.push(new ao(n,i)),t}}class co extends lo{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,i){for(let o=0;;o++){let r=this.children[o],s=i+r.length,l=n+r.lines-1;if((t?l:s)>=e)return r.lineInner(e,t,n,i);i=s+1,n=l+1}}decompose(e,t,n,i){for(let o=0,r=0;r<=t&&o<this.children.length;o++){let s=this.children[o],l=r+s.length;if(e<=l&&t>=r){let o=i&((r<=e?1:0)|(l>=t?2:0));r>=e&&l<=t&&!o?n.push(s):s.decompose(e-r,t-r,n,o)}r=l+1}}replace(e,t,n){if([e,t]=bo(this,e,t),n.lines<this.lines)for(let i=0,o=0;i<this.children.length;i++){let r=this.children[i],s=o+r.length;if(e>=o&&t<=s){let l=r.replace(e-o,t-o,n),a=this.lines-r.lines+l.lines;if(l.lines<a>>4&&l.lines>a>>6){let o=this.children.slice();return o[i]=l,new co(o,this.length-(t-e)+n.length)}return super.replace(o,s,l)}o=s+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n="\n"){[e,t]=bo(this,e,t);let i="";for(let o=0,r=0;o<this.children.length&&r<=t;o++){let s=this.children[o],l=r+s.length;r>e&&o&&(i+=n),e<l&&t>r&&(i+=s.sliceString(e-r,t-r,n)),r=l+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof co))return 0;let n=0,[i,o,r,s]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,o+=t){if(i==r||o==s)return n;let l=this.children[i],a=e.children[o];if(l!=a)return n+l.scanIdentical(a,t);n+=l.length+1}}static from(e,t=e.reduce(((e,t)=>e+t.length+1),-1)){let n=0;for(let t of e)n+=t.lines;if(n<32){let n=[];for(let t of e)t.flatten(n);return new ao(n,t)}let i=Math.max(32,n>>5),o=i<<1,r=i>>1,s=[],l=0,a=-1,c=[];function h(e){let t;if(e.lines>o&&e instanceof co)for(let t of e.children)h(t);else e.lines>r&&(l>r||!l)?(u(),s.push(e)):e instanceof ao&&l&&(t=c[c.length-1])instanceof ao&&e.lines+t.lines<=32?(l+=e.lines,a+=e.length+1,c[c.length-1]=new ao(t.text.concat(e.text),t.length+1+e.length)):(l+e.lines>i&&u(),l+=e.lines,a+=e.length+1,c.push(e))}function u(){0!=l&&(s.push(1==c.length?c[0]:co.from(c,a)),a=-1,l=c.length=0)}for(let t of e)h(t);return u(),1==s.length?s[0]:new co(s,t)}}function ho(e,t,n=0,i=1e9){for(let o=0,r=0,s=!0;r<e.length&&o<=i;r++){let l=e[r],a=o+l.length;a>=n&&(a>i&&(l=l.slice(0,i-o)),o<n&&(l=l.slice(n-o)),s?(t[t.length-1]+=l,s=!1):t.push(l)),o=a+1}return t}function uo(e,t,n){return ho(e,[""],t,n)}lo.empty=new ao([""],0);class fo{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof ao?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,i=this.nodes[n],o=this.offsets[n],r=o>>1,s=i instanceof ao?i.text.length:i.children.length;if(r==(t>0?s:0)){if(0==n)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&o)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(i instanceof ao){let o=i.text[r+(t<0?-1:0)];if(this.offsets[n]+=t,o.length>Math.max(0,e))return this.value=0==e?o:t>0?o.slice(e):o.slice(0,o.length-e),this;e-=o.length}else{let o=i.children[r+(t<0?-1:0)];e>o.length?(e-=o.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(o),this.offsets.push(t>0?1:(o instanceof ao?o.text.length:o.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class po{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new fo(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=n?i:t<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class mo{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:i}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(lo.prototype[Symbol.iterator]=function(){return this.iter()},fo.prototype[Symbol.iterator]=po.prototype[Symbol.iterator]=mo.prototype[Symbol.iterator]=function(){return this});class go{constructor(e,t,n,i){this.from=e,this.to=t,this.number=n,this.text=i}get length(){return this.to-this.from}}function bo(e,t,n){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,n))]}let vo="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((e=>e?parseInt(e,36):1));for(let e=1;e<vo.length;e++)vo[e]+=vo[e-1];function yo(e){for(let t=1;t<vo.length;t+=2)if(vo[t]>e)return vo[t-1]<=e;return!1}function wo(e){return e>=127462&&e<=127487}const ko=8205;function xo(e,t,n=!0,i=!0){return(n?Oo:So)(e,t,i)}function Oo(e,t,n){if(t==e.length)return t;t&&Co(e.charCodeAt(t))&&Eo(e.charCodeAt(t-1))&&t--;let i=Ao(e,t);for(t+=To(i);t<e.length;){let o=Ao(e,t);if(i==ko||o==ko||n&&yo(o))t+=To(o),i=o;else{if(!wo(o))break;{let n=0,i=t-2;for(;i>=0&&wo(Ao(e,i));)n++,i-=2;if(n%2==0)break;t+=2}}}return t}function So(e,t,n){for(;t>0;){let i=Oo(e,t-2,n);if(i<t)return i;t--}return 0}function Co(e){return e>=56320&&e<57344}function Eo(e){return e>=55296&&e<56320}function Ao(e,t){let n=e.charCodeAt(t);if(!Eo(n)||t+1==e.length)return n;let i=e.charCodeAt(t+1);return Co(i)?i-56320+(n-55296<<10)+65536:n}function Mo(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}function To(e){return e<65536?1:2}const Do=/\r\n?|\n/;var Po=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Po||(Po={}));class Ro{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,i=0;t<this.sections.length;){let o=this.sections[t++],r=this.sections[t++];r<0?(e(n,i,o),i+=o):i+=r,n+=o}}iterChangedRanges(e,t=!1){Io(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];i<0?e.push(n,i):e.push(i,n)}return new Ro(e)}composeDesc(e){return this.empty?e:e.empty?this:No(this,e)}mapDesc(e,t=!1){return e.empty?this:Lo(this,e,t)}mapPos(e,t=-1,n=Po.Simple){let i=0,o=0;for(let r=0;r<this.sections.length;){let s=this.sections[r++],l=this.sections[r++],a=i+s;if(l<0){if(a>e)return o+(e-i);o+=s}else{if(n!=Po.Simple&&a>=e&&(n==Po.TrackDel&&i<e&&a>e||n==Po.TrackBefore&&i<e||n==Po.TrackAfter&&a>e))return null;if(a>e||a==e&&t<0&&!s)return e==i||t<0?o:o+l;o+=l}i=a}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return o}touchesRange(e,t=e){for(let n=0,i=0;n<this.sections.length&&i<=t;){let o=i+this.sections[n++];if(this.sections[n++]>=0&&i<=t&&o>=e)return!(i<e&&o>t)||"cover";i=o}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+n+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some((e=>"number"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ro(e)}static create(e){return new Ro(e)}}class $o extends Ro{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Io(this,((t,n,i,o,r)=>e=e.replace(i,i+(n-t),r)),!1),e}mapDesc(e,t=!1){return Lo(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let i=0,o=0;i<t.length;i+=2){let r=t[i],s=t[i+1];if(s>=0){t[i]=s,t[i+1]=r;let l=i>>1;for(;n.length<l;)n.push(lo.empty);n.push(r?e.slice(o,o+r):lo.empty)}o+=r}return new $o(t,n)}compose(e){return this.empty?e:e.empty?this:No(this,e,!0)}map(e,t=!1){return e.empty?this:Lo(this,e,t,!0)}iterChanges(e,t=!1){Io(this,e,t)}get desc(){return Ro.create(this.sections)}filter(e){let t=[],n=[],i=[],o=new Vo(this);e:for(let r=0,s=0;;){let l=r==e.length?1e9:e[r++];for(;s<l||s==l&&0==o.len;){if(o.done)break e;let e=Math.min(o.len,l-s);_o(i,e,-1);let r=-1==o.ins?-1:0==o.off?o.ins:0;_o(t,e,r),r>0&&Bo(n,t,o.text),o.forward(e),s+=e}let a=e[r++];for(;s<a;){if(o.done)break e;let e=Math.min(o.len,a-s);_o(t,e,-1),_o(i,e,-1==o.ins?-1:0==o.off?o.ins:0),o.forward(e),s+=e}}return{changes:new $o(t,n),filtered:Ro.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],i=this.sections[t+1];i<0?e.push(n):0==i?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let i=[],o=[],r=0,s=null;function l(e=!1){if(!e&&!i.length)return;r<t&&_o(i,t-r,-1);let n=new $o(i,o);s=s?s.compose(n.map(s)):n,i=[],o=[],r=0}return function e(a){if(Array.isArray(a))for(let t of a)e(t);else if(a instanceof $o){if(a.length!=t)throw new RangeError(`Mismatched change set length (got ${a.length}, expected ${t})`);l(),s=s?s.compose(a.map(s)):a}else{let{from:e,to:s=e,insert:c}=a;if(e>s||e<0||s>t)throw new RangeError(`Invalid change range ${e} to ${s} (in doc of length ${t})`);let h=c?"string"==typeof c?lo.of(c.split(n||Do)):c:lo.empty,u=h.length;if(e==s&&0==u)return;e<r&&l(),e>r&&_o(i,e-r,-1),_o(i,s-e,u),Bo(o,i,h),r=s}}(e),l(!s),s}static empty(e){return new $o(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let i=0;i<e.length;i++){let o=e[i];if("number"==typeof o)t.push(o,-1);else{if(!Array.isArray(o)||"number"!=typeof o[0]||o.some(((e,t)=>t&&"string"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==o.length)t.push(o[0],0);else{for(;n.length<i;)n.push(lo.empty);n[i]=lo.of(o.slice(1)),t.push(o[0],n[i].length)}}}return new $o(t,n)}static createSet(e,t){return new $o(e,t)}}function _o(e,t,n,i=!1){if(0==t&&n<=0)return;let o=e.length-2;o>=0&&n<=0&&n==e[o+1]?e[o]+=t:0==t&&0==e[o]?e[o+1]+=n:i?(e[o]+=t,e[o+1]+=n):e.push(t,n)}function Bo(e,t,n){if(0==n.length)return;let i=t.length-2>>1;if(i<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<i;)e.push(lo.empty);e.push(n)}}function Io(e,t,n){let i=e.inserted;for(let o=0,r=0,s=0;s<e.sections.length;){let l=e.sections[s++],a=e.sections[s++];if(a<0)o+=l,r+=l;else{let c=o,h=r,u=lo.empty;for(;c+=l,h+=a,a&&i&&(u=u.append(i[s-2>>1])),!(n||s==e.sections.length||e.sections[s+1]<0);)l=e.sections[s++],a=e.sections[s++];t(o,c,r,h,u),o=c,r=h}}}function Lo(e,t,n,i=!1){let o=[],r=i?[]:null,s=new Vo(e),l=new Vo(t);for(let e=-1;;)if(-1==s.ins&&-1==l.ins){let e=Math.min(s.len,l.len);_o(o,e,-1),s.forward(e),l.forward(e)}else if(l.ins>=0&&(s.ins<0||e==s.i||0==s.off&&(l.len<s.len||l.len==s.len&&!n))){let t=l.len;for(_o(o,l.ins,-1);t;){let n=Math.min(s.len,t);s.ins>=0&&e<s.i&&s.len<=n&&(_o(o,0,s.ins),r&&Bo(r,o,s.text),e=s.i),s.forward(n),t-=n}l.next()}else{if(!(s.ins>=0)){if(s.done&&l.done)return r?$o.createSet(o,r):Ro.create(o);throw new Error("Mismatched change set lengths")}{let t=0,n=s.len;for(;n;)if(-1==l.ins){let e=Math.min(n,l.len);t+=e,n-=e,l.forward(e)}else{if(!(0==l.ins&&l.len<n))break;n-=l.len,l.next()}_o(o,t,e<s.i?s.ins:0),r&&e<s.i&&Bo(r,o,s.text),e=s.i,s.forward(s.len-n)}}}function No(e,t,n=!1){let i=[],o=n?[]:null,r=new Vo(e),s=new Vo(t);for(let e=!1;;){if(r.done&&s.done)return o?$o.createSet(i,o):Ro.create(i);if(0==r.ins)_o(i,r.len,0,e),r.next();else if(0!=s.len||s.done){if(r.done||s.done)throw new Error("Mismatched change set lengths");{let t=Math.min(r.len2,s.len),n=i.length;if(-1==r.ins){let n=-1==s.ins?-1:s.off?0:s.ins;_o(i,t,n,e),o&&n&&Bo(o,i,s.text)}else-1==s.ins?(_o(i,r.off?0:r.len,t,e),o&&Bo(o,i,r.textBit(t))):(_o(i,r.off?0:r.len,s.off?0:s.ins,e),o&&!s.off&&Bo(o,i,s.text));e=(r.ins>t||s.ins>=0&&s.len>t)&&(e||i.length>n),r.forward2(t),s.forward(t)}}else _o(i,0,s.ins,e),o&&Bo(o,i,s.text),s.next()}}class Vo{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return-2==this.ins}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?lo.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?lo.empty:t[n].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Ho{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get bidiLevel(){let e=7&this.flags;return 7==e?null:e}get goalColumn(){let e=this.flags>>6;return 16777215==e?void 0:e}map(e,t=-1){let n,i;return this.empty?n=i=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new Ho(n,i,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return Wo.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return Wo.range(this.anchor,n)}eq(e){return this.anchor==e.anchor&&this.head==e.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid JSON representation for SelectionRange");return Wo.range(e.anchor,e.head)}static create(e,t,n){return new Ho(e,t,n)}}class Wo{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:Wo.create(this.ranges.map((n=>n.map(e,t))),this.mainIndex)}eq(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let t=0;t<this.ranges.length;t++)if(!this.ranges[t].eq(e.ranges[t]))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return 1==this.ranges.length?this:new Wo([this.main],0)}addRange(e,t=!0){return Wo.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,Wo.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map((e=>e.toJSON())),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Wo(e.ranges.map((e=>Ho.fromJSON(e))),e.main)}static single(e,t=e){return new Wo([Wo.range(e,t)],0)}static create(e,t=0){if(0==e.length)throw new RangeError("A selection needs at least one range");for(let n=0,i=0;i<e.length;i++){let o=e[i];if(o.empty?o.from<=n:o.from<n)return Wo.normalized(e.slice(),t);n=o.to}return new Wo(e,t)}static cursor(e,t=0,n,i){return Ho.create(e,e,(0==t?0:t<0?8:16)|(null==n?7:Math.min(6,n))|(null!=i?i:16777215)<<6)}static range(e,t,n,i){let o=(null!=n?n:16777215)<<6|(null==i?7:Math.min(6,i));return t<e?Ho.create(t,e,48|o):Ho.create(e,t,(t>e?8:0)|o)}static normalized(e,t=0){let n=e[t];e.sort(((e,t)=>e.from-t.from)),t=e.indexOf(n);for(let n=1;n<e.length;n++){let i=e[n],o=e[n-1];if(i.empty?i.from<=o.to:i.from<o.to){let r=o.from,s=Math.max(i.to,o.to);n<=t&&t--,e.splice(--n,2,i.anchor>i.head?Wo.range(s,r):Wo.range(r,s))}}return new Wo(e,t)}}function zo(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let Fo=0;class Qo{constructor(e,t,n,i,o){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=i,this.id=Fo++,this.default=e([]),this.extensions="function"==typeof o?o(this):o}get reader(){return this}static define(e={}){return new Qo(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(e.combine?(e,t)=>e===t:jo),!!e.static,e.enables)}of(e){return new qo([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new qo(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new qo(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],(n=>t(n.field(e))))}}function jo(e,t){return e==t||e.length==t.length&&e.every(((e,n)=>e===t[n]))}class qo{constructor(e,t,n,i){this.dependencies=e,this.facet=t,this.type=n,this.value=i,this.id=Fo++}dynamicSlot(e){var t;let n=this.value,i=this.facet.compareInput,o=this.id,r=e[o]>>1,s=2==this.type,l=!1,a=!1,c=[];for(let n of this.dependencies)"doc"==n?l=!0:"selection"==n?a=!0:0==(1&(null!==(t=e[n.id])&&void 0!==t?t:1))&&c.push(e[n.id]);return{create:e=>(e.values[r]=n(e),1),update(e,t){if(l&&t.docChanged||a&&(t.docChanged||t.selection)||Go(e,c)){let t=n(e);if(s?!Uo(t,e.values[r],i):!i(t,e.values[r]))return e.values[r]=t,1}return 0},reconfigure:(e,t)=>{let l,a=t.config.address[o];if(null!=a){let o=rr(t,a);if(this.dependencies.every((n=>n instanceof Qo?t.facet(n)===e.facet(n):!(n instanceof Ko)||t.field(n,!1)==e.field(n,!1)))||(s?Uo(l=n(e),o,i):i(l=n(e),o)))return e.values[r]=o,0}else l=n(e);return e.values[r]=l,1}}}}function Uo(e,t,n){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++)if(!n(e[i],t[i]))return!1;return!0}function Go(e,t){let n=!1;for(let i of t)1&or(e,i)&&(n=!0);return n}function Xo(e,t,n){let i=n.map((t=>e[t.id])),o=n.map((e=>e.type)),r=i.filter((e=>!(1&e))),s=e[t.id]>>1;function l(e){let n=[];for(let t=0;t<i.length;t++){let r=rr(e,i[t]);if(2==o[t])for(let e of r)n.push(e);else n.push(r)}return t.combine(n)}return{create(e){for(let t of i)or(e,t);return e.values[s]=l(e),1},update(e,n){if(!Go(e,r))return 0;let i=l(e);return t.compare(i,e.values[s])?0:(e.values[s]=i,1)},reconfigure(e,o){let r=Go(e,i),a=o.config.facets[t.id],c=o.facet(t);if(a&&!r&&jo(n,a))return e.values[s]=c,0;let h=l(e);return t.compare(h,c)?(e.values[s]=c,0):(e.values[s]=h,1)}}}const Yo=Qo.define({static:!0});class Ko{constructor(e,t,n,i,o){this.id=e,this.createF=t,this.updateF=n,this.compareF=i,this.spec=o,this.provides=void 0}static define(e){let t=new Ko(Fo++,e.create,e.update,e.compare||((e,t)=>e===t),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Yo).find((e=>e.field==this));return((null==t?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let i=e.values[t],o=this.updateF(i,n);return this.compareF(i,o)?0:(e.values[t]=o,1)},reconfigure:(e,n)=>null!=n.config.address[this.id]?(e.values[t]=n.field(this),0):(e.values[t]=this.create(e),1)}}init(e){return[this,Yo.of({field:this,create:e})]}get extension(){return this}}function Zo(e){return t=>new er(t,e)}const Jo={highest:Zo(0),high:Zo(1),default:Zo(2),low:Zo(3),lowest:Zo(4)};class er{constructor(e,t){this.inner=e,this.prec=t}}class tr{of(e){return new nr(this,e)}reconfigure(e){return tr.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class nr{constructor(e,t){this.compartment=e,this.inner=t}}class ir{constructor(e,t,n,i,o,r){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=i,this.staticValues=o,this.facets=r,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return null==t?e.default:this.staticValues[t>>1]}static resolve(e,t,n){let i=[],o=Object.create(null),r=new Map;for(let n of function(e,t,n){let i=[[],[],[],[],[]],o=new Map;return function e(r,s){let l=o.get(r);if(null!=l){if(l<=s)return;let e=i[l].indexOf(r);e>-1&&i[l].splice(e,1),r instanceof nr&&n.delete(r.compartment)}if(o.set(r,s),Array.isArray(r))for(let t of r)e(t,s);else if(r instanceof nr){if(n.has(r.compartment))throw new RangeError("Duplicate use of compartment in extensions");let i=t.get(r.compartment)||r.inner;n.set(r.compartment,i),e(i,s)}else if(r instanceof er)e(r.inner,r.prec);else if(r instanceof Ko)i[s].push(r),r.provides&&e(r.provides,s);else if(r instanceof qo)i[s].push(r),r.facet.extensions&&e(r.facet.extensions,2);else{let t=r.extension;if(!t)throw new Error(`Unrecognized extension value in extension set (${r}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);e(t,s)}}(e,2),i.reduce(((e,t)=>e.concat(t)))}(e,t,r))n instanceof Ko?i.push(n):(o[n.facet.id]||(o[n.facet.id]=[])).push(n);let s=Object.create(null),l=[],a=[];for(let e of i)s[e.id]=a.length<<1,a.push((t=>e.slot(t)));let c=null==n?void 0:n.config.facets;for(let e in o){let t=o[e],i=t[0].facet,r=c&&c[e]||[];if(t.every((e=>0==e.type)))if(s[i.id]=l.length<<1|1,jo(r,t))l.push(n.facet(i));else{let e=i.combine(t.map((e=>e.value)));l.push(n&&i.compare(e,n.facet(i))?n.facet(i):e)}else{for(let e of t)0==e.type?(s[e.id]=l.length<<1|1,l.push(e.value)):(s[e.id]=a.length<<1,a.push((t=>e.dynamicSlot(t))));s[i.id]=a.length<<1,a.push((e=>Xo(e,i,t)))}}let h=a.map((e=>e(s)));return new ir(e,r,h,s,l,o)}}function or(e,t){if(1&t)return 2;let n=t>>1,i=e.status[n];if(4==i)throw new Error("Cyclic dependency between fields and/or facets");if(2&i)return i;e.status[n]=4;let o=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|o}function rr(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}const sr=Qo.define(),lr=Qo.define({combine:e=>e.some((e=>e)),static:!0}),ar=Qo.define({combine:e=>e.length?e[0]:void 0,static:!0}),cr=Qo.define(),hr=Qo.define(),ur=Qo.define(),fr=Qo.define({combine:e=>!!e.length&&e[0]});class dr{constructor(e,t){this.type=e,this.value=t}static define(){return new pr}}class pr{of(e){return new dr(this,e)}}class mr{constructor(e){this.map=e}of(e){return new gr(this,e)}}class gr{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return void 0===t?void 0:t==this.value?this:new gr(this.type,t)}is(e){return this.type==e}static define(e={}){return new mr(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let i of e){let e=i.map(t);e&&n.push(e)}return n}}gr.reconfigure=gr.define(),gr.appendConfig=gr.define();class br{constructor(e,t,n,i,o,r){this.startState=e,this.changes=t,this.selection=n,this.effects=i,this.annotations=o,this.scrollIntoView=r,this._doc=null,this._state=null,n&&zo(n,t.newLength),o.some((e=>e.type==br.time))||(this.annotations=o.concat(br.time.of(Date.now())))}static create(e,t,n,i,o,r){return new br(e,t,n,i,o,r)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(br.userEvent);return!(!t||!(t==e||t.length>e.length&&t.slice(0,e.length)==e&&"."==t[e.length]))}}function vr(e,t){let n=[];for(let i=0,o=0;;){let r,s;if(i<e.length&&(o==t.length||t[o]>=e[i]))r=e[i++],s=e[i++];else{if(!(o<t.length))return n;r=t[o++],s=t[o++]}!n.length||n[n.length-1]<r?n.push(r,s):n[n.length-1]<s&&(n[n.length-1]=s)}}function yr(e,t,n){var i;let o,r,s;return n?(o=t.changes,r=$o.empty(t.changes.length),s=e.changes.compose(t.changes)):(o=t.changes.map(e.changes),r=e.changes.mapDesc(t.changes,!0),s=e.changes.compose(o)),{changes:s,selection:t.selection?t.selection.map(r):null===(i=e.selection)||void 0===i?void 0:i.map(o),effects:gr.mapEffects(e.effects,o).concat(gr.mapEffects(t.effects,r)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function wr(e,t,n){let i=t.selection,o=Or(t.annotations);return t.userEvent&&(o=o.concat(br.userEvent.of(t.userEvent))),{changes:t.changes instanceof $o?t.changes:$o.of(t.changes||[],n,e.facet(ar)),selection:i&&(i instanceof Wo?i:Wo.single(i.anchor,i.head)),effects:Or(t.effects),annotations:o,scrollIntoView:!!t.scrollIntoView}}function kr(e,t,n){let i=wr(e,t.length?t[0]:{},e.doc.length);t.length&&!1===t[0].filter&&(n=!1);for(let o=1;o<t.length;o++){!1===t[o].filter&&(n=!1);let r=!!t[o].sequential;i=yr(i,wr(e,t[o],r?i.changes.newLength:e.doc.length),r)}let o=br.create(e,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return function(e){let t=e.startState,n=t.facet(ur),i=e;for(let o=n.length-1;o>=0;o--){let r=n[o](e);r&&Object.keys(r).length&&(i=yr(i,wr(t,r,e.changes.newLength),!0))}return i==e?e:br.create(t,e.changes,e.selection,i.effects,i.annotations,i.scrollIntoView)}(n?function(e){let t=e.startState,n=!0;for(let i of t.facet(cr)){let t=i(e);if(!1===t){n=!1;break}Array.isArray(t)&&(n=!0===n?t:vr(n,t))}if(!0!==n){let i,o;if(!1===n)o=e.changes.invertedDesc,i=$o.empty(t.doc.length);else{let t=e.changes.filter(n);i=t.changes,o=t.filtered.mapDesc(t.changes).invertedDesc}e=br.create(t,i,e.selection&&e.selection.map(o),gr.mapEffects(e.effects,o),e.annotations,e.scrollIntoView)}let i=t.facet(hr);for(let n=i.length-1;n>=0;n--){let o=i[n](e);e=o instanceof br?o:Array.isArray(o)&&1==o.length&&o[0]instanceof br?o[0]:kr(t,Or(o),!1)}return e}(o):o)}br.time=dr.define(),br.userEvent=dr.define(),br.addToHistory=dr.define(),br.remote=dr.define();const xr=[];function Or(e){return null==e?xr:Array.isArray(e)?e:[e]}var Sr=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(Sr||(Sr={}));const Cr=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Er;try{Er=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}class Ar{constructor(e,t,n,i,o,r){this.config=e,this.doc=t,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=o,r&&(r._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)or(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(null!=n)return or(this,n),rr(this,n);if(t)throw new RangeError("Field is not present in this state")}update(...e){return kr(this,e,!0)}applyTransaction(e){let t,n=this.config,{base:i,compartments:o}=n;for(let t of e.effects)t.is(tr.reconfigure)?(n&&(o=new Map,n.compartments.forEach(((e,t)=>o.set(t,e))),n=null),o.set(t.value.compartment,t.value.extension)):t.is(gr.reconfigure)?(n=null,i=t.value):t.is(gr.appendConfig)&&(n=null,i=Or(i).concat(t.value));n?t=e.startState.values.slice():(n=ir.resolve(i,o,this),t=new Ar(n,this.doc,this.selection,n.dynamicSlots.map((()=>null)),((e,t)=>t.reconfigure(e,this)),null).values);let r=e.startState.facet(lr)?e.newSelection:e.newSelection.asSingle();new Ar(n,e.newDoc,r,t,((t,n)=>n.update(t,e)),e)}replaceSelection(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange((t=>({changes:{from:t.from,to:t.to,insert:e},range:Wo.cursor(t.from+e.length)})))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),i=this.changes(n.changes),o=[n.range],r=Or(n.effects);for(let n=1;n<t.ranges.length;n++){let s=e(t.ranges[n]),l=this.changes(s.changes),a=l.map(i);for(let e=0;e<n;e++)o[e]=o[e].map(a);let c=i.mapDesc(l,!0);o.push(s.range.map(c)),i=i.compose(a),r=gr.mapEffects(r,a).concat(gr.mapEffects(Or(s.effects),c))}return{changes:i,selection:Wo.create(o,t.mainIndex),effects:r}}changes(e=[]){return e instanceof $o?e:$o.of(e,this.doc.length,this.facet(Ar.lineSeparator))}toText(e){return lo.of(e.split(this.facet(Ar.lineSeparator)||Do))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return null==t?e.default:(or(this,t),rr(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let i=e[n];i instanceof Ko&&null!=this.config.address[i.id]&&(t[n]=i.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},n){if(!e||"string"!=typeof e.doc)throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(n)for(let t in n)if(Object.prototype.hasOwnProperty.call(e,t)){let o=n[t],r=e[t];i.push(o.init((e=>o.spec.fromJSON(r,e))))}return Ar.create({doc:e.doc,selection:Wo.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=ir.resolve(e.extensions||[],new Map),n=e.doc instanceof lo?e.doc:lo.of((e.doc||"").split(t.staticFacet(Ar.lineSeparator)||Do)),i=e.selection?e.selection instanceof Wo?e.selection:Wo.single(e.selection.anchor,e.selection.head):Wo.single(0);return zo(i,n.length),t.staticFacet(lr)||(i=i.asSingle()),new Ar(t,n,i,t.dynamicSlots.map((()=>null)),((e,t)=>t.create(e)),null)}get tabSize(){return this.facet(Ar.tabSize)}get lineBreak(){return this.facet(Ar.lineSeparator)||"\n"}get readOnly(){return this.facet(fr)}phrase(e,...t){for(let t of this.facet(Ar.phrases))if(Object.prototype.hasOwnProperty.call(t,e)){e=t[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,((e,n)=>{if("$"==n)return"$";let i=+(n||1);return!i||i>t.length?e:t[i-1]}))),e}languageDataAt(e,t,n=-1){let i=[];for(let o of this.facet(sr))for(let r of o(this,t,n))Object.prototype.hasOwnProperty.call(r,e)&&i.push(r[e]);return i}charCategorizer(e){return t=this.languageDataAt("wordChars",e).join(""),e=>{if(!/\S/.test(e))return Sr.Space;if(function(e){if(Er)return Er.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||Cr.test(n)))return!0}return!1}(e))return Sr.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return Sr.Word;return Sr.Other};var t}wordAt(e){let{text:t,from:n,length:i}=this.doc.lineAt(e),o=this.charCategorizer(e),r=e-n,s=e-n;for(;r>0;){let e=xo(t,r,!1);if(o(t.slice(e,r))!=Sr.Word)break;r=e}for(;s<i;){let e=xo(t,s);if(o(t.slice(s,e))!=Sr.Word)break;s=e}return r==s?null:Wo.range(r+n,s+n)}}function Mr(e,t,n={}){let i={};for(let t of e)for(let e of Object.keys(t)){let o=t[e],r=i[e];if(void 0===r)i[e]=o;else if(r===o||void 0===o);else{if(!Object.hasOwnProperty.call(n,e))throw new Error("Config merge conflict for field "+e);i[e]=n[e](r,o)}}for(let e in t)void 0===i[e]&&(i[e]=t[e]);return i}Ar.allowMultipleSelections=lr,Ar.tabSize=Qo.define({combine:e=>e.length?e[0]:4}),Ar.lineSeparator=ar,Ar.readOnly=fr,Ar.phrases=Qo.define({compare(e,t){let n=Object.keys(e),i=Object.keys(t);return n.length==i.length&&n.every((n=>e[n]==t[n]))}}),Ar.languageData=sr,Ar.changeFilter=cr,Ar.transactionFilter=hr,Ar.transactionExtender=ur,tr.reconfigure=gr.define();class Tr{eq(e){return this==e}range(e,t=e){return Dr.create(e,t,this)}}Tr.prototype.startSide=Tr.prototype.endSide=0,Tr.prototype.point=!1,Tr.prototype.mapMode=Po.TrackDel;class Dr{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new Dr(e,t,n)}}function Pr(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class Rr{constructor(e,t,n,i){this.from=e,this.to=t,this.value=n,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,i=0){let o=n?this.to:this.from;for(let r=i,s=o.length;;){if(r==s)return r;let i=r+s>>1,l=o[i]-e||(n?this.value[i].endSide:this.value[i].startSide)-t;if(i==r)return l>=0?r:s;l>=0?s=i:r=i+1}}between(e,t,n,i){for(let o=this.findIndex(t,-1e9,!0),r=this.findIndex(n,1e9,!1,o);o<r;o++)if(!1===i(this.from[o]+e,this.to[o]+e,this.value[o]))return!1}map(e,t){let n=[],i=[],o=[],r=-1,s=-1;for(let l=0;l<this.value.length;l++){let a,c,h=this.value[l],u=this.from[l]+e,f=this.to[l]+e;if(u==f){let e=t.mapPos(u,h.startSide,h.mapMode);if(null==e)continue;if(a=c=e,h.startSide!=h.endSide&&(c=t.mapPos(u,h.endSide),c<a))continue}else if(a=t.mapPos(u,h.startSide),c=t.mapPos(f,h.endSide),a>c||a==c&&h.startSide>0&&h.endSide<=0)continue;(c-a||h.endSide-h.startSide)<0||(r<0&&(r=a),h.point&&(s=Math.max(s,c-a)),n.push(h),i.push(a-r),o.push(c-r))}return{mapped:n.length?new Rr(i,o,n,s):null,pos:r}}}class $r{constructor(e,t,n,i){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=i}static create(e,t,n,i){return new $r(e,t,n,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:i=0,filterTo:o=this.length}=e,r=e.filter;if(0==t.length&&!r)return this;if(n&&(t=t.slice().sort(Pr)),this.isEmpty)return t.length?$r.of(t):this;let s=new Ir(this,null,-1).goto(0),l=0,a=[],c=new _r;for(;s.value||l<t.length;)if(l<t.length&&(s.from-t[l].from||s.startSide-t[l].value.startSide)>=0){let e=t[l++];c.addInner(e.from,e.to,e.value)||a.push(e)}else 1==s.rangeIndex&&s.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(s.chunkIndex)<t[l].from)&&(!r||i>this.chunkEnd(s.chunkIndex)||o<this.chunkPos[s.chunkIndex])&&c.addChunk(this.chunkPos[s.chunkIndex],this.chunk[s.chunkIndex])?s.nextChunk():((!r||i>s.to||o<s.from||r(s.from,s.to,s.value))&&(c.addInner(s.from,s.to,s.value)||a.push(Dr.create(s.from,s.to,s.value))),s.next());return c.finishInner(this.nextLayer.isEmpty&&!a.length?$r.empty:this.nextLayer.update({add:a,filter:r,filterFrom:i,filterTo:o}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],i=-1;for(let o=0;o<this.chunk.length;o++){let r=this.chunkPos[o],s=this.chunk[o],l=e.touchesRange(r,r+s.length);if(!1===l)i=Math.max(i,s.maxPoint),t.push(s),n.push(e.mapPos(r));else if(!0===l){let{mapped:o,pos:l}=s.map(r,e);o&&(i=Math.max(i,o.maxPoint),t.push(o),n.push(l))}}let o=this.nextLayer.map(e);return 0==t.length?o:new $r(n,t,o||$r.empty,i)}between(e,t,n){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let o=this.chunkPos[i],r=this.chunk[i];if(t>=o&&e<=o+r.length&&!1===r.between(o,e-o,t-o,n))return}this.nextLayer.between(e,t,n)}}iter(e=0){return Lr.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Lr.from(e).goto(t)}static compare(e,t,n,i,o=-1){let r=e.filter((e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=o)),s=t.filter((e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=o)),l=Br(r,s,n),a=new Vr(r,l,o),c=new Vr(s,l,o);n.iterGaps(((e,t,n)=>Hr(a,e,c,t,n,i))),n.empty&&0==n.length&&Hr(a,0,c,0,0,i)}static eq(e,t,n=0,i){null==i&&(i=999999999);let o=e.filter((e=>!e.isEmpty&&t.indexOf(e)<0)),r=t.filter((t=>!t.isEmpty&&e.indexOf(t)<0));if(o.length!=r.length)return!1;if(!o.length)return!0;let s=Br(o,r),l=new Vr(o,s,0).goto(n),a=new Vr(r,s,0).goto(n);for(;;){if(l.to!=a.to||!Wr(l.active,a.active)||l.point&&(!a.point||!l.point.eq(a.point)))return!1;if(l.to>i)return!0;l.next(),a.next()}}static spans(e,t,n,i,o=-1){let r=new Vr(e,null,o).goto(t),s=t,l=r.openStart;for(;;){let e=Math.min(r.to,n);if(r.point){let n=r.activeForPoint(r.to),o=r.pointFrom<t?n.length+1:Math.min(n.length,l);i.point(s,e,r.point,n,o,r.pointRank),l=Math.min(r.openEnd(e),n.length)}else e>s&&(i.span(s,e,r.active,l),l=r.openEnd(e));if(r.to>n)return l+(r.point&&r.to>n?1:0);s=r.to,r.next()}}static of(e,t=!1){let n=new _r;for(let i of e instanceof Dr?[e]:t?function(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let i=e[n];if(Pr(t,i)>0)return e.slice().sort(Pr);t=i}return e}(e):e)n.add(i.from,i.to,i.value);return n.finish()}}$r.empty=new $r([],[],null,-1),$r.empty.nextLayer=$r.empty;class _r{finishChunk(e){this.chunks.push(new Rr(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new _r)).add(e,t,n)}addInner(e,t,n){let i=e-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(i<0||(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),0))}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner($r.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=$r.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Br(e,t,n){let i=new Map;for(let t of e)for(let e=0;e<t.chunk.length;e++)t.chunk[e].maxPoint<=0&&i.set(t.chunk[e],t.chunkPos[e]);let o=new Set;for(let e of t)for(let t=0;t<e.chunk.length;t++){let r=i.get(e.chunk[t]);null==r||(n?n.mapPos(r):r)!=e.chunkPos[t]||(null==n?void 0:n.touchesRange(r,r+e.chunk[t].length))||o.add(e.chunk[t])}return o}class Ir{constructor(e,t,n,i=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let t=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(t)||this.layer.chunkEnd(this.chunkIndex)<e||t.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Lr{constructor(e){this.heap=e}static from(e,t=null,n=-1){let i=[];for(let o=0;o<e.length;o++)for(let r=e[o];!r.isEmpty;r=r.nextLayer)r.maxPoint>=n&&i.push(new Ir(r,t,n,o));return 1==i.length?i[0]:new Lr(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)Nr(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)Nr(this.heap,e);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Nr(this.heap,0)}}}function Nr(e,t){for(let n=e[t];;){let i=1+(t<<1);if(i>=e.length)break;let o=e[i];if(i+1<e.length&&o.compare(e[i+1])>=0&&(o=e[i+1],i++),n.compare(o)<0)break;e[i]=n,e[t]=o,t=i}}class Vr{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Lr.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){zr(this.active,e),zr(this.activeTo,e),zr(this.activeRank,e),this.minActive=Qr(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:i,rank:o}=this.cursor;for(;t<this.activeRank.length&&this.activeRank[t]<=o;)t++;Fr(this.active,t,n),Fr(this.activeTo,t,i),Fr(this.activeRank,t,o),e&&Fr(e,t,this.cursor.from),this.minActive=Qr(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&zr(n,i)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let e=this.cursor.value;if(e.point){if(!(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=e,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=e.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}this.cursor.next()}else this.addActive(n),this.cursor.next()}}}if(n){this.openStart=0;for(let t=n.length-1;t>=0&&n[t]<e;t--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function Hr(e,t,n,i,o,r){e.goto(t),n.goto(i);let s=i+o,l=i,a=i-t;for(;;){let t=e.to+a-n.to||e.endSide-n.endSide,i=t<0?e.to+a:n.to,o=Math.min(i,s);if(e.point||n.point?e.point&&n.point&&(e.point==n.point||e.point.eq(n.point))&&Wr(e.activeForPoint(e.to),n.activeForPoint(n.to))||r.comparePoint(l,o,e.point,n.point):o>l&&!Wr(e.active,n.active)&&r.compareRange(l,o,e.active,n.active),i>s)break;l=i,t<=0&&e.next(),t>=0&&n.next()}}function Wr(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!e[n].eq(t[n]))return!1;return!0}function zr(e,t){for(let n=t,i=e.length-1;n<i;n++)e[n]=e[n+1];e.pop()}function Fr(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function Qr(e,t){let n=-1,i=1e9;for(let o=0;o<t.length;o++)(t[o]-i||e[o].endSide-e[n].endSide)<0&&(n=o,i=t[o]);return n}function jr(e,t,n=e.length){let i=0;for(let o=0;o<n;)9==e.charCodeAt(o)?(i+=t-i%t,o++):(i++,o=xo(e,o));return i}function qr(e,t,n,i){for(let i=0,o=0;;){if(o>=t)return i;if(i==e.length)break;o+=9==e.charCodeAt(i)?n-o%n:1,i=xo(e,i)}return!0===i?-1:e.length}const Ur="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),Gr="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),Xr="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class Yr{constructor(e,t){this.rules=[];let{finish:n}=t||{};function i(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function o(e,t,r,s){let l=[],a=/^@(\w+)\b/.exec(e[0]),c=a&&"keyframes"==a[1];if(a&&null==t)return r.push(e[0]+";");for(let n in t){let s=t[n];if(/&/.test(n))o(n.split(/,\s*/).map((t=>e.map((e=>t.replace(/&/,e))))).reduce(((e,t)=>e.concat(t))),s,r);else if(s&&"object"==typeof s){if(!a)throw new RangeError("The value of a property ("+n+") should be a primitive value.");o(i(n),s,l,c)}else null!=s&&l.push(n.replace(/_.*/,"").replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()))+": "+s+";")}(l.length||c)&&r.push((!n||a||s?e:e.map(n)).join(", ")+" {"+l.join(" ")+"}")}for(let t in e)o(i(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=Xr[Ur]||1;return Xr[Ur]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let i=e[Gr],o=n&&n.nonce;i?o&&i.setNonce(o):i=new Zr(e,o),i.mount(Array.isArray(t)?t:[t])}}let Kr=new Map;class Zr{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let t=Kr.get(n);if(t)return e.adoptedStyleSheets=[t.sheet,...e.adoptedStyleSheets],e[Gr]=t;this.sheet=new i.CSSStyleSheet,e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets],Kr.set(n,this)}else{this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);let i=e.head||e;i.insertBefore(this.styleTag,i.firstChild)}this.modules=[],e[Gr]=this}mount(e){let t=this.sheet,n=0,i=0;for(let o=0;o<e.length;o++){let r=e[o],s=this.modules.indexOf(r);if(s<i&&s>-1&&(this.modules.splice(s,1),i--,s=-1),-1==s){if(this.modules.splice(i++,0,r),t)for(let e=0;e<r.rules.length;e++)t.insertRule(r.rules[e],n++)}else{for(;i<s;)n+=this.modules[i++].rules.length;n+=r.rules.length,i++}}if(!t){let e="";for(let t=0;t<this.modules.length;t++)e+=this.modules[t].getRules()+"\n";this.styleTag.textContent=e}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var Jr={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},es={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ts="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),ns="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),is=0;is<10;is++)Jr[48+is]=Jr[96+is]=String(is);for(is=1;is<=24;is++)Jr[is+111]="F"+is;for(is=65;is<=90;is++)Jr[is]=String.fromCharCode(is+32),es[is]=String.fromCharCode(is);for(var os in Jr)es.hasOwnProperty(os)||(es[os]=Jr[os]);function rs(e){let t;return t=11==e.nodeType?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function ss(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function ls(e,t){if(!t.anchorNode)return!1;try{return ss(e,t.anchorNode)}catch(e){return!1}}function as(e){return 3==e.nodeType?ws(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function cs(e,t,n,i){return!!n&&(us(e,t,n,i,-1)||us(e,t,n,i,1))}function hs(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function us(e,t,n,i,o){for(;;){if(e==n&&t==i)return!0;if(t==(o<0?0:fs(e))){if("DIV"==e.nodeName)return!1;let n=e.parentNode;if(!n||1!=n.nodeType)return!1;t=hs(e)+(o<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if(1==(e=e.childNodes[t+(o<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=o<0?fs(e):0}}}function fs(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function ds(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function ps(e){return{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function ms(e,t){let n=t.width/e.offsetWidth,i=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(t.height-e.offsetHeight)<1)&&(i=1),{scaleX:n,scaleY:i}}class gs{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?fs(t):0),n,Math.min(e.focusOffset,n?fs(n):0))}set(e,t,n,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=i}}let bs,vs=null;function ys(e){if(e.setActive)return e.setActive();if(vs)return e.focus(vs);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==vs?{get preventScroll(){return vs={preventScroll:!0},!0}}:void 0),!vs){vs=!1;for(let e=0;e<t.length;){let n=t[e++],i=t[e++],o=t[e++];n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=o&&(n.scrollLeft=o)}}}function ws(e,t,n=t){let i=bs||(bs=document.createRange());return i.setEnd(e,n),i.setStart(e,t),i}function ks(e,t,n){let i={key:t,code:t,keyCode:n,which:n,cancelable:!0},o=new KeyboardEvent("keydown",i);o.synthetic=!0,e.dispatchEvent(o);let r=new KeyboardEvent("keyup",i);return r.synthetic=!0,e.dispatchEvent(r),o.defaultPrevented||r.defaultPrevented}function xs(e){for(;e.attributes.length;)e.removeAttributeNode(e.attributes[0])}function Os(e){return e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}class Ss{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new Ss(e.parentNode,hs(e),t)}static after(e,t){return new Ss(e.parentNode,hs(e)+1,t)}}const Cs=[];class Es{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let n of this.children){if(n==e)return t;t+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(2&this.flags){let n,i=this.dom,o=null;for(let r of this.children){if(7&r.flags){if(!r.dom&&(n=o?o.nextSibling:i.firstChild)){let e=Es.get(n);(!e||!e.parent&&e.canReuseDOM(r))&&r.reuseDOM(n)}r.sync(e,t),r.flags&=-8}if(n=o?o.nextSibling:i.firstChild,t&&!t.written&&t.node==i&&n!=r.dom&&(t.written=!0),r.dom.parentNode==i)for(;n&&n!=r.dom;)n=As(n);else i.insertBefore(r.dom,n);o=r.dom}for(n=o?o.nextSibling:i.firstChild,n&&t&&t.node==i&&(t.written=!0);n;)n=As(n)}else if(1&this.flags)for(let n of this.children)7&n.flags&&(n.sync(e,t),n.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let n;if(e==this.dom)n=this.dom.childNodes[t];else{let i=0==fs(e)?0:0==t?-1:1;for(;;){let t=e.parentNode;if(t==this.dom)break;0==i&&t.firstChild!=t.lastChild&&(i=e==t.firstChild?-1:1),e=t}n=i<0?e:e.nextSibling}if(n==this.dom.firstChild)return 0;for(;n&&!Es.get(n);)n=n.nextSibling;if(!n)return this.length;for(let e=0,t=0;;e++){let i=this.children[e];if(i.dom==n)return t;t+=i.length+i.breakAfter}}domBoundsAround(e,t,n=0){let i=-1,o=-1,r=-1,s=-1;for(let l=0,a=n,c=n;l<this.children.length;l++){let n=this.children[l],h=a+n.length;if(a<e&&h>t)return n.domBoundsAround(e,t,a);if(h>=e&&-1==i&&(i=l,o=a),a>t&&n.dom.parentNode==this.dom){r=l,s=c;break}c=h,a=h+n.breakAfter}return{from:o,to:s<0?n+this.length:s,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:r<this.children.length&&r>=0?this.children[r].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),1&t.flags)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,7&this.flags&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,n=Cs){this.markDirty();for(let i=e;i<t;i++){let e=this.children[i];e.parent==this&&n.indexOf(e)<0&&e.destroy()}this.children.splice(e,t-e,...n);for(let e=0;e<n.length;e++)n[e].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new Ms(this.children,e,this.children.length)}childPos(e,t=1){return this.childCursor().findPos(e,t)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+("Text"==e?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,t,n,i,o,r){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!(8&(this.flags|e.flags))}getSide(){return 0}destroy(){for(let e of this.children)e.parent==this&&e.destroy();this.parent=null}}function As(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}Es.prototype.breakAfter=0;class Ms{constructor(e,t,n){this.children=e,this.pos=t,this.i=n,this.off=0}findPos(e,t=1){for(;;){if(e>this.pos||e==this.pos&&(t>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function Ts(e,t,n,i,o,r,s,l,a){let{children:c}=e,h=c.length?c[t]:null,u=r.length?r[r.length-1]:null,f=u?u.breakAfter:s;if(!(t==i&&h&&!s&&!f&&r.length<2&&h.merge(n,o,r.length?u:null,0==n,l,a))){if(i<c.length){let e=c[i];e&&(o<e.length||e.breakAfter&&(null==u?void 0:u.breakAfter))?(t==i&&(e=e.split(o),o=0),!f&&u&&e.merge(0,o,u,!0,0,a)?r[r.length-1]=e:((o||e.children.length&&!e.children[0].length)&&e.merge(0,o,null,!1,0,a),r.push(e))):(null==e?void 0:e.breakAfter)&&(u?u.breakAfter=1:s=1),i++}for(h&&(h.breakAfter=s,n>0&&(!s&&r.length&&h.merge(n,h.length,r[0],!1,l,0)?h.breakAfter=r.shift().breakAfter:(n<h.length||h.children.length&&0==h.children[h.children.length-1].length)&&h.merge(n,h.length,null,!1,l,0),t++));t<i&&r.length;)if(c[i-1].become(r[r.length-1]))i--,r.pop(),a=r.length?0:l;else{if(!c[t].become(r[0]))break;t++,r.shift(),l=r.length?0:a}!r.length&&t&&i<c.length&&!c[t-1].breakAfter&&c[i].merge(0,0,c[t-1],!1,l,a)&&t--,(t<i||r.length)&&e.replaceChildren(t,i,r)}}function Ds(e,t,n,i,o,r){let s=e.childCursor(),{i:l,off:a}=s.findPos(n,1),{i:c,off:h}=s.findPos(t,-1),u=t-n;for(let e of i)u+=e.length;e.length+=u,Ts(e,c,h,l,a,i,0,o,r)}let Ps="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},Rs="undefined"!=typeof document?document:{documentElement:{style:{}}};const $s=/Edge\/(\d+)/.exec(Ps.userAgent),_s=/MSIE \d/.test(Ps.userAgent),Bs=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ps.userAgent),Is=!!(_s||Bs||$s),Ls=!Is&&/gecko\/(\d+)/i.test(Ps.userAgent),Ns=!Is&&/Chrome\/(\d+)/.exec(Ps.userAgent),Vs="webkitFontSmoothing"in Rs.documentElement.style,Hs=!Is&&/Apple Computer/.test(Ps.vendor),Ws=Hs&&(/Mobile\/\w+/.test(Ps.userAgent)||Ps.maxTouchPoints>2);var zs={mac:Ws||/Mac/.test(Ps.platform),windows:/Win/.test(Ps.platform),linux:/Linux|X11/.test(Ps.platform),ie:Is,ie_version:_s?Rs.documentMode||6:Bs?+Bs[1]:$s?+$s[1]:0,gecko:Ls,gecko_version:Ls?+(/Firefox\/(\d+)/.exec(Ps.userAgent)||[0,0])[1]:0,chrome:!!Ns,chrome_version:Ns?+Ns[1]:0,ios:Ws,android:/Android\b/.test(Ps.userAgent),webkit:Vs,safari:Hs,webkit_version:Vs?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Rs.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class Fs extends Es{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){3==e.nodeType&&this.createDOM(e)}merge(e,t,n){return!(8&this.flags||n&&(!(n instanceof Fs)||this.length-(t-e)+n.length>256||8&n.flags)||(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(t),this.markDirty(),0))}split(e){let t=new Fs(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=8&this.flags,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new Ss(this.dom,e)}domBoundsAround(e,t,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return function(e,t,n){let i=e.nodeValue.length;t>i&&(t=i);let o=t,r=t,s=0;0==t&&n<0||t==i&&n>=0?zs.chrome||zs.gecko||(t?(o--,s=1):r<i&&(r++,s=-1)):n<0?o--:r<i&&r++;let l=ws(e,o,r).getClientRects();if(!l.length)return null;let a=l[(s?s<0:n>=0)?0:l.length-1];return zs.safari&&!s&&0==a.width&&(a=Array.prototype.find.call(l,(e=>e.width))||a),s?ds(a,s<0):a||null}(this.dom,e,t)}}class Qs extends Es{constructor(e,t=[],n=0){super(),this.mark=e,this.children=t,this.length=n;for(let e of t)e.setParent(this)}setAttrs(e){if(xs(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!(8&(this.flags|e.flags))}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,n,i,o,r){return!(n&&(!(n instanceof Qs&&n.mark.eq(this.mark))||e&&o<=0||t<this.length&&r<=0)||(Ds(this,e,t,n?n.children.slice():[],o-1,r-1),this.markDirty(),0))}split(e){let t=[],n=0,i=-1,o=0;for(let r of this.children){let s=n+r.length;s>e&&t.push(n<e?r.split(e-n):r),i<0&&n>=e&&(i=o),n=s,o++}let r=this.length-e;return this.length=e,i>-1&&(this.children.length=i,this.markDirty()),new Qs(this.mark,t,r)}domAtPos(e){return Us(this,e)}coordsAt(e,t){return Xs(this,e,t)}}class js extends Es{static create(e,t,n){return new js(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=js.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){this.dom&&this.widget.updateDOM(this.dom,e)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.dom.contentEditable="false")}getSide(){return this.side}merge(e,t,n,i,o,r){return!(n&&(!(n instanceof js&&this.widget.compare(n.widget))||e>0&&o<=0||t<this.length&&r<=0)||(this.length=e+(n?n.length:0)+(this.length-t),0))}become(e){return e instanceof js&&e.side==this.side&&this.widget.constructor==e.widget.constructor&&(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0)}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(0==this.length)return lo.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,n=t&&t.state.doc,i=this.posAtStart;return n?n.slice(i,i+this.length):lo.empty}domAtPos(e){return(this.length?0==e:this.side>0)?Ss.before(this.dom):Ss.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);if(n)return n;let i=this.dom.getClientRects(),o=null;if(!i.length)return null;let r=this.side?this.side<0:e>0;for(let t=r?i.length-1:0;o=i[t],!(e>0?0==t:t==i.length-1||o.top<o.bottom);t+=r?-1:1);return ds(o,!r)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}}class qs extends Es{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof qs&&e.side==this.side}split(){return new qs(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?Ss.before(this.dom):Ss.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return lo.empty}get isHidden(){return!0}}function Us(e,t){let n=e.dom,{children:i}=e,o=0;for(let e=0;o<i.length;o++){let r=i[o],s=e+r.length;if(!(s==e&&r.getSide()<=0)){if(t>e&&t<s&&r.dom.parentNode==n)return r.domAtPos(t-e);if(t<=e)break;e=s}}for(let e=o;e>0;e--){let t=i[e-1];if(t.dom.parentNode==n)return t.domAtPos(t.length)}for(let e=o;e<i.length;e++){let t=i[e];if(t.dom.parentNode==n)return t.domAtPos(0)}return new Ss(n,0)}function Gs(e,t,n){let i,{children:o}=e;n>0&&t instanceof Qs&&o.length&&(i=o[o.length-1])instanceof Qs&&i.mark.eq(t.mark)?Gs(i,t.children[0],n-1):(o.push(t),t.setParent(e)),e.length+=t.length}function Xs(e,t,n){let i=null,o=-1,r=null,s=-1;!function e(t,l){for(let a=0,c=0;a<t.children.length&&c<=l;a++){let h=t.children[a],u=c+h.length;u>=l&&(h.children.length?e(h,l-c):(!r||r.isHidden&&n>0)&&(u>l||c==u&&h.getSide()>0)?(r=h,s=l-c):(c<l||c==u&&h.getSide()<0&&!h.isHidden)&&(i=h,o=l-c)),c=u}}(e,t);let l=(n<0?i:r)||i||r;return l?l.coordsAt(Math.max(0,l==i?o:s),n):function(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=as(t);return n[n.length-1]||null}(e)}function Ys(e,t){for(let n in e)"class"==n&&t.class?t.class+=" "+e.class:"style"==n&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}Fs.prototype.children=js.prototype.children=qs.prototype.children=Cs;const Ks=Object.create(null);function Zs(e,t,n){if(e==t)return!0;e||(e=Ks),t||(t=Ks);let i=Object.keys(e),o=Object.keys(t);if(i.length-(n&&i.indexOf(n)>-1?1:0)!=o.length-(n&&o.indexOf(n)>-1?1:0))return!1;for(let r of i)if(r!=n&&(-1==o.indexOf(r)||e[r]!==t[r]))return!1;return!0}function Js(e,t,n){let i=!1;if(t)for(let o in t)n&&o in n||(i=!0,"style"==o?e.style.cssText="":e.removeAttribute(o));if(n)for(let o in n)t&&t[o]==n[o]||(i=!0,"style"==o?e.style.cssText=n[o]:e.setAttribute(o,n[o]));return i}function el(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let i=e.attributes[n];t[i.name]=i.value}return t}class tl extends Es{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,n,i,o,r){if(n){if(!(n instanceof tl))return!1;this.dom||n.transferDOM(this)}return i&&this.setDeco(n?n.attrs:null),Ds(this,e,t,n?n.children.slice():[],o,r),!0}split(e){let t=new tl;if(t.breakAfter=this.breakAfter,0==this.length)return t;let{i:n,off:i}=this.childPos(e);i&&(t.append(this.children[n].split(i),0),this.children[n].merge(i,this.children[n].length,null,!1,0,0),n++);for(let e=n;e<this.children.length;e++)t.append(this.children[e],0);for(;n>0&&0==this.children[n-1].length;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){Zs(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Gs(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=Ys(t,this.attrs||{})),n&&(this.attrs=Ys({class:n},this.attrs||{}))}domAtPos(e){return Us(this,e)}reuseDOM(e){"DIV"==e.nodeName&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?4&this.flags&&(xs(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(Js(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let i=this.dom.lastChild;for(;i&&Es.get(i)instanceof Qs;)i=i.lastChild;if(!(i&&this.length&&("BR"==i.nodeName||0!=(null===(n=Es.get(i))||void 0===n?void 0:n.isEditable)||zs.ios&&this.children.some((e=>e instanceof Fs))))){let e=document.createElement("BR");e.cmIgnore=!0,this.dom.appendChild(e)}}measureTextSize(){if(0==this.children.length||this.length>20)return null;let e,t=0;for(let n of this.children){if(!(n instanceof Fs)||/[^ -~]/.test(n.text))return null;let i=as(n.dom);if(1!=i.length)return null;t+=i[0].width,e=i[0].height}return t?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length,textHeight:e}:null}coordsAt(e,t){let n=Xs(this,e,t);if(!this.children.length&&n&&this.parent){let{heightOracle:e}=this.parent.view.viewState,t=n.bottom-n.top;if(Math.abs(t-e.lineHeight)<2&&e.textHeight<t){let i=(t-e.textHeight)/2;return{top:n.top+i,bottom:n.bottom-i,left:n.left,right:n.left}}}return n}become(e){return!1}covers(){return!0}static find(e,t){for(let n=0,i=0;n<e.children.length;n++){let o=e.children[n],r=i+o.length;if(r>=t){if(o instanceof tl)return o;if(r>t)break}i=r+o.breakAfter}return null}}class nl extends Es{constructor(e,t,n){super(),this.widget=e,this.length=t,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(e,t,n,i,o,r){return!(n&&(!(n instanceof nl&&this.widget.compare(n.widget))||e>0&&o<=0||t<this.length&&r<=0)||(this.length=e+(n?n.length:0)+(this.length-t),0))}domAtPos(e){return 0==e?Ss.before(this.dom):Ss.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let n=new nl(this.widget,t,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return Cs}sync(e){this.dom&&this.widget.updateDOM(this.dom,e)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.dom.contentEditable="false")}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):lo.empty}domBoundsAround(){return null}become(e){return e instanceof nl&&e.widget.constructor==this.widget.constructor&&(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0)}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,t){return this.widget.coordsAt(this.dom,e,t)}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:t,endSide:n}=this.deco;return t!=n&&(e<0?t<0:n>0)}}class il{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}destroy(e){}}var ol=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(ol||(ol={}));class rl extends Tr{constructor(e,t,n,i){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=i}get heightRelevant(){return!1}static mark(e){return new sl(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new al(e,t,t,n,e.widget||null,!1)}static replace(e){let t,n,i=!!e.block;if(e.isBlockGap)t=-5e8,n=4e8;else{let{start:o,end:r}=cl(e,i);t=(o?i?-3e8:-1:5e8)-1,n=1+(r?i?2e8:1:-6e8)}return new al(e,t,n,i,e.widget||null,!0)}static line(e){return new ll(e)}static set(e,t=!1){return $r.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}rl.none=$r.empty;class sl extends rl{constructor(e){let{start:t,end:n}=cl(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,n;return this==e||e instanceof sl&&this.tagName==e.tagName&&(this.class||(null===(t=this.attrs)||void 0===t?void 0:t.class))==(e.class||(null===(n=e.attrs)||void 0===n?void 0:n.class))&&Zs(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}sl.prototype.point=!1;class ll extends rl{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof ll&&this.spec.class==e.spec.class&&Zs(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}ll.prototype.mapMode=Po.TrackBefore,ll.prototype.point=!0;class al extends rl{constructor(e,t,n,i,o,r){super(t,n,o,e),this.block=i,this.isReplace=r,this.mapMode=i?t<=0?Po.TrackBefore:Po.TrackAfter:Po.TrackDel}get type(){return this.startSide!=this.endSide?ol.WidgetRange:this.startSide<=0?ol.WidgetBefore:ol.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof al&&((t=this.widget)==(n=e.widget)||!!(t&&n&&t.compare(n)))&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide;var t,n}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}function cl(e,t=!1){let{inclusiveStart:n,inclusiveEnd:i}=e;return null==n&&(n=e.inclusive),null==i&&(i=e.inclusive),{start:null!=n?n:t,end:null!=i?i:t}}function hl(e,t,n,i=0){let o=n.length-1;o>=0&&n[o]+i>=e?n[o]=Math.max(n[o],t):n.push(e,t)}al.prototype.point=!0;class ul{constructor(e,t,n,i){this.doc=e,this.pos=t,this.end=n,this.disallowBlockEffectsFor=i,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof nl&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new tl),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(fl(new qs(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||e&&this.content.length&&this.content[this.content.length-1]instanceof nl||this.getLine()}buildText(e,t,n){for(;e>0;){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:i}=this.cursor.next(this.skip);if(this.skip=0,i)throw new Error("Ran out of text content when drawing inline views");if(n){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}this.text=t,this.textOff=0}let i=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-n)),this.getLine().append(fl(new Fs(this.text.slice(this.textOff,this.textOff+i)),t),n),this.atCursorPos=!0,this.textOff+=i,e-=i,n=0}}span(e,t,n,i){this.buildText(t-e,n,i),this.pos=t,this.openStart<0&&(this.openStart=i)}point(e,t,n,i,o,r){if(this.disallowBlockEffectsFor[r]&&n instanceof al){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let s=t-e;if(n instanceof al)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new nl(n.widget||new dl("div"),s,n));else{let r=js.create(n.widget||new dl("span"),s,s?0:n.startSide),l=this.atCursorPos&&!r.isEditable&&o<=i.length&&(e<t||n.startSide>0),a=!r.isEditable&&(e<t||o>i.length||n.startSide<=0),c=this.getLine();2!=this.pendingBuffer||l||r.isEditable||(this.pendingBuffer=0),this.flushBuffer(i),l&&(c.append(fl(new qs(1),i),o),o=i.length+Math.max(0,o-i.length)),c.append(fl(r,i),o),this.atCursorPos=a,this.pendingBuffer=a?e<t||o>i.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);s&&(this.textOff+s<=this.text.length?this.textOff+=s:(this.skip+=s-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=o)}static build(e,t,n,i,o){let r=new ul(e,t,n,o);return r.openEnd=$r.spans(i,t,n,r),r.openStart<0&&(r.openStart=r.openEnd),r.finish(r.openEnd),r}}function fl(e,t){for(let n of t)e=new Qs(n,[e],e.length);return e}class dl extends il{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}const pl=Qo.define(),ml=Qo.define(),gl=Qo.define(),bl=Qo.define(),vl=Qo.define(),yl=Qo.define(),wl=Qo.define(),kl=Qo.define({combine:e=>e.some((e=>e))}),xl=Qo.define({combine:e=>e.some((e=>e))});class Ol{constructor(e,t="nearest",n="nearest",i=5,o=5,r=!1){this.range=e,this.y=t,this.x=n,this.yMargin=i,this.xMargin=o,this.isSnapshot=r}map(e){return e.empty?this:new Ol(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Ol(Wo.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Sl=gr.define({map:(e,t)=>e.map(t)});function Cl(e,t,n){let i=e.facet(bl);i.length?i[0](t):window.onerror?window.onerror(String(t),n,void 0,void 0,t):n?console.error(n+":",t):console.error(t)}const El=Qo.define({combine:e=>!e.length||e[0]});let Al=0;const Ml=Qo.define();class Tl{constructor(e,t,n,i,o){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=i,this.extension=o(this)}static define(e,t){const{eventHandlers:n,eventObservers:i,provide:o,decorations:r}=t||{};return new Tl(Al++,e,n,i,(e=>{let t=[Ml.of(e)];return r&&t.push($l.of((t=>{let n=t.plugin(e);return n?r(n):rl.none}))),o&&t.push(o(e)),t}))}static fromClass(e,t){return Tl.define((t=>new e(t)),t)}}class Dl{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(Cl(e.state,t,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(e){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){Cl(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(null===(t=this.value)||void 0===t?void 0:t.destroy)try{this.value.destroy()}catch(t){Cl(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Pl=Qo.define(),Rl=Qo.define(),$l=Qo.define(),_l=Qo.define(),Bl=Qo.define();function Il(e,t,n){let i=e.state.facet(Bl);if(!i.length)return i;let o=i.map((t=>t instanceof Function?t(e):t)),r=[];return $r.spans(o,t,n,{point(){},span(e,t,n,i){let o=r;for(let r=n.length-1;r>=0;r--,i--){let s,l=n[r].spec.bidiIsolate;if(null!=l)if(i>0&&o.length&&(s=o[o.length-1]).to==e&&s.direction==l)s.to=t,o=s.inner;else{let n={from:e,to:t,direction:l,inner:[]};o.push(n),o=n.inner}}}}),r}const Ll=Qo.define();function Nl(e){let t=0,n=0,i=0,o=0;for(let r of e.state.facet(Ll)){let s=r(e);s&&(null!=s.left&&(t=Math.max(t,s.left)),null!=s.right&&(n=Math.max(n,s.right)),null!=s.top&&(i=Math.max(i,s.top)),null!=s.bottom&&(o=Math.max(o,s.bottom)))}return{left:t,right:n,top:i,bottom:o}}const Vl=Qo.define();class Hl{constructor(e,t,n,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=i}join(e){return new Hl(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let i=e[t-1];if(!(i.fromA>n.toA)){if(i.toA<n.fromA)break;n=n.join(i),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(0==t.length)return e;let n=[];for(let i=0,o=0,r=0,s=0;;i++){let l=i==e.length?null:e[i],a=r-s,c=l?l.fromB:1e9;for(;o<t.length&&t[o]<c;){let e=t[o],i=t[o+1],r=Math.max(s,e),l=Math.min(c,i);if(r<=l&&new Hl(r+a,l+a,r,l).addToSet(n),i>c)break;o+=2}if(!l)return n;new Hl(l.fromA,l.toA,l.fromB,l.toB).addToSet(n),r=l.toA,s=l.toB}}}class Wl{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=$o.empty(this.startState.doc.length);for(let e of n)this.changes=this.changes.compose(e.changes);let i=[];this.changes.iterChangedRanges(((e,t,n,o)=>i.push(new Hl(e,t,n,o)))),this.changedRanges=i}static create(e,t,n){return new Wl(e,t,n)}get viewportChanged(){return(4&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(10&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some((e=>e.selection))}get empty(){return 0==this.flags&&0==this.transactions.length}}var zl=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(zl||(zl={}));const Fl=zl.LTR,Ql=zl.RTL;function jl(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const ql=jl("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Ul=jl("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Gl=Object.create(null),Xl=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);Gl[t]=n,Gl[n]=-t}const Yl=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Kl{get dir(){return this.level%2?Ql:Fl}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}static find(e,t,n,i){let o=-1;for(let r=0;r<e.length;r++){let s=e[r];if(s.from<=t&&s.to>=t){if(s.level==n)return r;(o<0||(0!=i?i<0?s.from<t:s.to>t:e[o].level>s.level))&&(o=r)}}if(o<0)throw new RangeError("Index out of range");return o}}function Zl(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],o=t[n];if(i.from!=o.from||i.to!=o.to||i.direction!=o.direction||!Zl(i.inner,o.inner))return!1}return!0}const Jl=[];function ea(e,t,n,i,o,r,s){let l=i%2?2:1;if(i%2==o%2)for(let a=t,c=0;a<n;){let t=!0,h=!1;if(c==r.length||a<r[c].from){let e=Jl[a];e!=l&&(t=!1,h=16==e)}let u=t||1!=l?null:[],f=t?i:i+1,d=a;e:for(;;)if(c<r.length&&d==r[c].from){if(h)break e;let p=r[c];if(!t)for(let e=p.to,t=c+1;;){if(e==n)break e;if(!(t<r.length&&r[t].from==e)){if(Jl[e]==l)break e;break}e=r[t++].to}c++,u?u.push(p):(p.from>a&&s.push(new Kl(a,p.from,f)),ta(e,p.direction==Fl!=!(f%2)?i+1:i,o,p.inner,p.from,p.to,s),a=p.to),d=p.to}else{if(d==n||(t?Jl[d]!=l:Jl[d]==l))break;d++}u?ea(e,a,d,i+1,o,u,s):a<d&&s.push(new Kl(a,d,f)),a=d}else for(let a=n,c=r.length;a>t;){let n=!0,h=!1;if(!c||a>r[c-1].to){let e=Jl[a-1];e!=l&&(n=!1,h=16==e)}let u=n||1!=l?null:[],f=n?i:i+1,d=a;e:for(;;)if(c&&d==r[c-1].to){if(h)break e;let p=r[--c];if(!n)for(let e=p.from,n=c;;){if(e==t)break e;if(!n||r[n-1].to!=e){if(Jl[e-1]==l)break e;break}e=r[--n].from}u?u.push(p):(p.to<a&&s.push(new Kl(p.to,a,f)),ta(e,p.direction==Fl!=!(f%2)?i+1:i,o,p.inner,p.from,p.to,s),a=p.from),d=p.from}else{if(d==t||(n?Jl[d-1]!=l:Jl[d-1]==l))break;d--}u?ea(e,d,a,i+1,o,u,s):d<a&&s.push(new Kl(d,a,f)),a=d}}function ta(e,t,n,i,o,r,s){let l=t%2?2:1;!function(e,t,n,i,o){for(let s=0;s<=i.length;s++){let l=s?i[s-1].to:t,a=s<i.length?i[s].from:n,c=s?256:o;for(let t=l,n=c,i=c;t<a;t++){let o=(r=e.charCodeAt(t))<=247?ql[r]:1424<=r&&r<=1524?2:1536<=r&&r<=1785?Ul[r-1536]:1774<=r&&r<=2220?4:8192<=r&&r<=8204?256:64336<=r&&r<=65023?4:1;512==o?o=n:8==o&&4==i&&(o=16),Jl[t]=4==o?2:o,7&o&&(i=o),n=o}for(let e=l,t=c,i=c;e<a;e++){let o=Jl[e];if(128==o)e<a-1&&t==Jl[e+1]&&24&t?o=Jl[e]=t:Jl[e]=256;else if(64==o){let o=e+1;for(;o<a&&64==Jl[o];)o++;let r=e&&8==t||o<n&&8==Jl[o]?1==i?1:8:256;for(let t=e;t<o;t++)Jl[t]=r;e=o-1}else 8==o&&1==i&&(Jl[e]=1);t=o,7&o&&(i=o)}}var r}(e,o,r,i,l),function(e,t,n,i,o){let r=1==o?2:1;for(let s=0,l=0,a=0;s<=i.length;s++){let c=s?i[s-1].to:t,h=s<i.length?i[s].from:n;for(let t,n,i,s=c;s<h;s++)if(n=Gl[t=e.charCodeAt(s)])if(n<0){for(let e=l-3;e>=0;e-=3)if(Xl[e+1]==-n){let t=Xl[e+2],n=2&t?o:4&t?1&t?r:o:0;n&&(Jl[s]=Jl[Xl[e]]=n),l=e;break}}else{if(189==Xl.length)break;Xl[l++]=s,Xl[l++]=t,Xl[l++]=a}else if(2==(i=Jl[s])||1==i){let e=i==o;a=e?0:1;for(let t=l-3;t>=0;t-=3){let n=Xl[t+2];if(2&n)break;if(e)Xl[t+2]|=2;else{if(4&n)break;Xl[t+2]|=4}}}}}(e,o,r,i,l),function(e,t,n,i){for(let o=0,r=i;o<=n.length;o++){let s=o?n[o-1].to:e,l=o<n.length?n[o].from:t;for(let a=s;a<l;){let s=Jl[a];if(256==s){let s=a+1;for(;;)if(s==l){if(o==n.length)break;s=n[o++].to,l=o<n.length?n[o].from:t}else{if(256!=Jl[s])break;s++}let c=1==r,h=c==(1==(s<t?Jl[s]:i))?c?1:2:i;for(let t=s,i=o,r=i?n[i-1].to:e;t>a;)t==r&&(t=n[--i].from,r=i?n[i-1].to:e),Jl[--t]=h;a=s}else r=s,a++}}}(o,r,i,l),ea(e,o,r,t,n,i,s)}function na(e){return[new Kl(0,e,0)]}let ia="";function oa(e,t,n,i,o){var r;let s=i.head-e.from,l=-1;if(0==s){if(!o||!e.length)return null;t[0].level!=n&&(s=t[0].side(!1,n),l=0)}else if(s==e.length){if(o)return null;let e=t[t.length-1];e.level!=n&&(s=e.side(!0,n),l=t.length-1)}l<0&&(l=Kl.find(t,s,null!==(r=i.bidiLevel)&&void 0!==r?r:-1,i.assoc));let a=t[l];s==a.side(o,n)&&(a=t[l+=o?1:-1],s=a.side(!o,n));let c=o==(a.dir==n),h=xo(e.text,s,c);if(ia=e.text.slice(Math.min(s,h),Math.max(s,h)),h>a.from&&h<a.to)return Wo.cursor(h+e.from,c?-1:1,a.level);let u=l==(o?t.length-1:0)?null:t[l+(o?1:-1)];return u||a.level==n?u&&u.level<a.level?Wo.cursor(u.side(!o,n)+e.from,o?1:-1,u.level):Wo.cursor(h+e.from,o?-1:1,a.level):Wo.cursor(o?e.to:e.from,o?-1:1,n)}class ra extends Es{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new tl],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Hl(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every((({fromA:e,toA:t})=>t<this.minWidthFrom||e>this.minWidthTo))?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let i=-1;this.view.inputState.composing>=0&&((null===(t=this.domChanged)||void 0===t?void 0:t.newSel)?i=this.domChanged.newSel.head:function(e,t){let n=!1;return t&&e.iterChangedRanges(((e,i)=>{e<t.to&&i>t.from&&(n=!0)})),n}(e.changes,this.hasComposition)||e.selectionSet||(i=e.state.selection.main.head));let o=i>-1?function(e,t,n){let i=la(e,n);if(!i)return null;let{node:o,from:r,to:s}=i,l=o.nodeValue;if(/[\n\r]/.test(l))return null;if(e.state.doc.sliceString(i.from,i.to)!=l)return null;let a=t.invertedDesc,c=new Hl(a.mapPos(r),a.mapPos(s),r,s),h=[];for(let t=o.parentNode;;t=t.parentNode){let n=Es.get(t);if(n instanceof Qs)h.push({node:t,deco:n.mark});else{if(n instanceof tl||"DIV"==t.nodeName&&t.parentNode==e.contentDOM)return{range:c,text:o,marks:h,line:t};if(t==e.contentDOM)return null;h.push({node:t,deco:new sl({inclusive:!0,attributes:el(t),tagName:t.tagName.toLowerCase()})})}}}(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:t,to:i}=this.hasComposition;n=new Hl(t,i,e.changes.mapPos(t,-1),e.changes.mapPos(i,1)).addToSet(n.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(zs.ie||zs.chrome)&&!o&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let r=function(e,t,n){let i=new ca;return $r.compare(e,t,n,i),i.changes}(this.decorations,this.updateDeco(),e.changes);return n=Hl.extendWithRanges(n,r),!!(7&this.flags||0!=n.length)&&(this.updateInner(n,e.startState.doc.length,o),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,n);let{observer:i}=this.view;i.ignore((()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let e=zs.chrome||zs.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,e),this.flags&=-8,e&&(e.written||i.selectionRange.focusNode!=e.node)&&(this.forceSelection=!0),this.dom.style.height=""})),this.markedForComposition.forEach((e=>e.flags&=-9));let o=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let e of this.children)e instanceof nl&&e.widget instanceof sa&&o.push(e.dom);i.updateGaps(o)}updateChildren(e,t,n){let i=n?n.range.addToSet(e.slice()):e,o=this.childCursor(t);for(let e=i.length-1;;e--){let t=e>=0?i[e]:null;if(!t)break;let r,s,l,a,{fromA:c,toA:h,fromB:u,toB:f}=t;if(n&&n.range.fromB<f&&n.range.toB>u){let e=ul.build(this.view.state.doc,u,n.range.fromB,this.decorations,this.dynamicDecorationMap),t=ul.build(this.view.state.doc,n.range.toB,f,this.decorations,this.dynamicDecorationMap);s=e.breakAtStart,l=e.openStart,a=t.openEnd;let i=this.compositionView(n);t.breakAtStart?i.breakAfter=1:t.content.length&&i.merge(i.length,i.length,t.content[0],!1,t.openStart,0)&&(i.breakAfter=t.content[0].breakAfter,t.content.shift()),e.content.length&&i.merge(0,0,e.content[e.content.length-1],!0,0,e.openEnd)&&e.content.pop(),r=e.content.concat(i).concat(t.content)}else({content:r,breakAtStart:s,openStart:l,openEnd:a}=ul.build(this.view.state.doc,u,f,this.decorations,this.dynamicDecorationMap));let{i:d,off:p}=o.findPos(h,1),{i:m,off:g}=o.findPos(c,-1);Ts(this,m,g,d,p,r,s,l,a)}n&&this.fixCompositionDOM(n)}compositionView(e){let t=new Fs(e.text.nodeValue);t.flags|=8;for(let{deco:n}of e.marks)t=new Qs(n,[t],t.length);let n=new tl;return n.append(t,0),n}fixCompositionDOM(e){let t=(e,t)=>{t.flags|=8|(t.children.some((e=>7&e.flags))?1:0),this.markedForComposition.add(t);let n=Es.get(e);n&&n!=t&&(n.dom=null),t.setDOM(e)},n=this.childPos(e.range.fromB,1),i=this.children[n.i];t(e.line,i);for(let o=e.marks.length-1;o>=-1;o--)n=i.childPos(n.off,1),i=i.children[n.i],t(o>=0?e.marks[o].node:e.text,i)}updateSelection(e=!1,t=!1){!e&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let n=this.view.root.activeElement,i=n==this.dom,o=!i&&ls(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(i||t||o))return;let r=this.forceSelection;this.forceSelection=!1;let s=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(s.anchor)),a=s.empty?l:this.moveToLine(this.domAtPos(s.head));if(zs.gecko&&s.empty&&!this.hasComposition&&1==(c=l).node.nodeType&&c.node.firstChild&&(0==c.offset||"false"==c.node.childNodes[c.offset-1].contentEditable)&&(c.offset==c.node.childNodes.length||"false"==c.node.childNodes[c.offset].contentEditable)){let e=document.createTextNode("");this.view.observer.ignore((()=>l.node.insertBefore(e,l.node.childNodes[l.offset]||null))),l=a=new Ss(e,0),r=!0}var c;let h=this.view.observer.selectionRange;!r&&h.focusNode&&cs(l.node,l.offset,h.anchorNode,h.anchorOffset)&&cs(a.node,a.offset,h.focusNode,h.focusOffset)||(this.view.observer.ignore((()=>{zs.android&&zs.chrome&&this.dom.contains(h.focusNode)&&function(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let e=rs(this.view.root);if(e)if(s.empty){if(zs.gecko){let e=function(e,t){return 1!=e.nodeType?0:(t&&"false"==e.childNodes[t-1].contentEditable?1:0)|(t<e.childNodes.length&&"false"==e.childNodes[t].contentEditable?2:0)}(l.node,l.offset);if(e&&3!=e){let t=aa(l.node,l.offset,1==e?1:-1);t&&(l=new Ss(t.node,t.offset))}}e.collapse(l.node,l.offset),null!=s.bidiLevel&&void 0!==e.caretBidiLevel&&(e.caretBidiLevel=s.bidiLevel)}else if(e.extend){e.collapse(l.node,l.offset);try{e.extend(a.node,a.offset)}catch(e){}}else{let t=document.createRange();s.anchor>s.head&&([l,a]=[a,l]),t.setEnd(a.node,a.offset),t.setStart(l.node,l.offset),e.removeAllRanges(),e.addRange(t)}o&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())})),this.view.observer.setSelectionRange(l,a)),this.impreciseAnchor=l.precise?null:new Ss(h.anchorNode,h.anchorOffset),this.impreciseHead=a.precise?null:new Ss(h.focusNode,h.focusOffset)}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=rs(e.root),{anchorNode:i,anchorOffset:o}=e.observer.selectionRange;if(!(n&&t.empty&&t.assoc&&n.modify))return;let r=tl.find(this,t.head);if(!r)return;let s=r.posAtStart;if(t.head==s||t.head==s+r.length)return;let l=this.coordsAt(t.head,-1),a=this.coordsAt(t.head,1);if(!l||!a||l.bottom>a.top)return;let c=this.domAtPos(t.head+t.assoc);n.collapse(c.node,c.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=t.from&&n.collapse(i,o)}moveToLine(e){let t,n=this.dom;if(e.node!=n)return e;for(let i=e.offset;!t&&i<n.childNodes.length;i++){let e=Es.get(n.childNodes[i]);e instanceof tl&&(t=e.domAtPos(0))}for(let i=e.offset-1;!t&&i>=0;i--){let e=Es.get(n.childNodes[i]);e instanceof tl&&(t=e.domAtPos(e.length))}return t?new Ss(t.node,t.offset,!0):e}nearest(e){for(let t=e;t;){let e=Es.get(t);if(e&&e.rootView==this)return e;t=t.parentNode}return null}posFromDOM(e,t){let n=this.nearest(e);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(e,t)+n.posAtStart}domAtPos(e){let{i:t,off:n}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let e=this.children[t];if(n<e.length||e instanceof tl)break;t++,n=0}return this.children[t].domAtPos(n)}coordsAt(e,t){let n=null,i=0;for(let o=this.length,r=this.children.length-1;r>=0;r--){let s=this.children[r],l=o-s.breakAfter,a=l-s.length;if(l<e)break;a<=e&&(a<e||s.covers(-1))&&(l>e||s.covers(1))&&(!n||s instanceof tl&&!(n instanceof tl&&t>=0))&&(n=s,i=a),o=a}return n?n.coordsAt(e-i,t):null}coordsForChar(e){let{i:t,off:n}=this.childPos(e,1),i=this.children[t];if(!(i instanceof tl))return null;for(;i.children.length;){let{i:e,off:t}=i.childPos(n,1);for(;;e++){if(e==i.children.length)return null;if((i=i.children[e]).length)break}n=t}if(!(i instanceof Fs))return null;let o=xo(i.text,n);if(o==n)return null;let r=ws(i.dom,n,o).getClientRects();for(let e=0;e<r.length;e++){let t=r[e];if(e==r.length-1||t.top<t.bottom&&t.left<t.right)return t}return null}measureVisibleLineHeights(e){let t=[],{from:n,to:i}=e,o=this.view.contentDOM.clientWidth,r=o>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,s=-1,l=this.view.textDirection==zl.LTR;for(let e=0,a=0;a<this.children.length;a++){let c=this.children[a],h=e+c.length;if(h>i)break;if(e>=n){let n=c.dom.getBoundingClientRect();if(t.push(n.height),r){let t=c.dom.lastChild,i=t?as(t):[];if(i.length){let t=i[i.length-1],r=l?t.right-n.left:n.right-t.left;r>s&&(s=r,this.minWidth=o,this.minWidthFrom=e,this.minWidthTo=h)}}}e=h+c.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return"rtl"==getComputedStyle(this.children[t].dom).direction?zl.RTL:zl.LTR}measureTextSize(){for(let e of this.children)if(e instanceof tl){let t=e.measureTextSize();if(t)return t}let e,t,n,i=document.createElement("div");return i.className="cm-line",i.style.width="99999px",i.style.position="absolute",i.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(i);let o=as(i.firstChild)[0];e=i.getBoundingClientRect().height,t=o?o.width/27:7,n=o?o.height:e,i.remove()})),{lineHeight:e,charWidth:t,textHeight:n}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Ms(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,i=0;;i++){let o=i==t.viewports.length?null:t.viewports[i],r=o?o.from-1:this.length;if(r>n){let i=(t.lineBlockAt(r).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(rl.replace({widget:new sa(i),block:!0,inclusive:!0,isBlockGap:!0}).range(n,r))}if(!o)break;n=o.to+1}return rl.set(e)}updateDeco(){let e=this.view.state.facet($l).map(((e,t)=>(this.dynamicDecorationMap[t]="function"==typeof e)?e(this.view):e));for(let t=e.length;t<e.length+3;t++)this.dynamicDecorationMap[t]=!1;return this.decorations=[...e,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco]}scrollIntoView(e){if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);return this.view.scrollDOM.scrollTop=t.top-e.yMargin,void(this.view.scrollDOM.scrollLeft=e.xMargin)}let t,{range:n}=e,i=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1);if(!i)return;!n.empty&&(t=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(i={left:Math.min(i.left,t.left),top:Math.min(i.top,t.top),right:Math.max(i.right,t.right),bottom:Math.max(i.bottom,t.bottom)});let o=Nl(this.view),r={left:i.left-o.left,top:i.top-o.top,right:i.right+o.right,bottom:i.bottom+o.bottom},{offsetWidth:s,offsetHeight:l}=this.view.scrollDOM;!function(e,t,n,i,o,r,s,l){let a=e.ownerDocument,c=a.defaultView||window;for(let h=e,u=!1;h&&!u;)if(1==h.nodeType){let e,f=h==a.body,d=1,p=1;if(f)e=ps(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(u=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let t=h.getBoundingClientRect();({scaleX:d,scaleY:p}=ms(h,t)),e={left:t.left,right:t.left+h.clientWidth*d,top:t.top,bottom:t.top+h.clientHeight*p}}let m=0,g=0;if("nearest"==o)t.top<e.top?(g=-(e.top-t.top+s),n>0&&t.bottom>e.bottom+g&&(g=t.bottom-e.bottom+g+s)):t.bottom>e.bottom&&(g=t.bottom-e.bottom+s,n<0&&t.top-g<e.top&&(g=-(e.top+g-t.top+s)));else{let i=t.bottom-t.top,r=e.bottom-e.top;g=("center"==o&&i<=r?t.top+i/2-r/2:"start"==o||"center"==o&&n<0?t.top-s:t.bottom-r+s)-e.top}if("nearest"==i?t.left<e.left?(m=-(e.left-t.left+r),n>0&&t.right>e.right+m&&(m=t.right-e.right+m+r)):t.right>e.right&&(m=t.right-e.right+r,n<0&&t.left<e.left+m&&(m=-(e.left+m-t.left+r))):m=("center"==i?t.left+(t.right-t.left)/2-(e.right-e.left)/2:"start"==i==l?t.left-r:t.right-(e.right-e.left)+r)-e.left,m||g)if(f)c.scrollBy(m,g);else{let e=0,n=0;if(g){let e=h.scrollTop;h.scrollTop+=g/p,n=(h.scrollTop-e)*p}if(m){let t=h.scrollLeft;h.scrollLeft+=m/d,e=(h.scrollLeft-t)*d}t={left:t.left-e,top:t.top-n,right:t.right-e,bottom:t.bottom-n},e&&Math.abs(e-m)<1&&(i="nearest"),n&&Math.abs(n-g)<1&&(o="nearest")}if(f)break;h=h.assignedSlot||h.parentNode}else{if(11!=h.nodeType)break;h=h.host}}(this.view.scrollDOM,r,n.head<n.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,s),-s),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==zl.LTR)}}class sa extends il{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}}function la(e,t){let n=e.observer.selectionRange,i=n.focusNode&&aa(n.focusNode,n.focusOffset,0);if(!i)return null;let o=t-i.offset;return{from:o,to:o+i.node.nodeValue.length,node:i.node}}function aa(e,t,n){if(n<=0)for(let n=e,i=t;;){if(3==n.nodeType)return{node:n,offset:i};if(!(1==n.nodeType&&i>0))break;n=n.childNodes[i-1],i=fs(n)}if(n>=0)for(let i=e,o=t;;){if(3==i.nodeType)return{node:i,offset:o};if(!(1==i.nodeType&&o<i.childNodes.length&&n>=0))break;i=i.childNodes[o],o=0}return null}let ca=class{constructor(){this.changes=[]}compareRange(e,t){hl(e,t,this.changes)}comparePoint(e,t){hl(e,t,this.changes)}};function ha(e,t){return t.left>e?t.left-e:Math.max(0,e-t.right)}function ua(e,t){return t.top>e?t.top-e:Math.max(0,e-t.bottom)}function fa(e,t){return e.top<t.bottom-1&&e.bottom>t.top+1}function da(e,t){return t<e.top?{top:t,left:e.left,right:e.right,bottom:e.bottom}:e}function pa(e,t){return t>e.bottom?{top:e.top,left:e.left,right:e.right,bottom:t}:e}function ma(e,t,n){let i,o,r,s,l,a,c,h,u=!1;for(let f=e.firstChild;f;f=f.nextSibling){let e=as(f);for(let d=0;d<e.length;d++){let p=e[d];o&&fa(o,p)&&(p=da(pa(p,o.bottom),o.top));let m=ha(t,p),g=ua(n,p);if(0==m&&0==g)return 3==f.nodeType?ga(f,t,n):ma(f,t,n);if(!i||s>g||s==g&&r>m){i=f,o=p,r=m,s=g;let l=g?n<p.top?-1:1:m?t<p.left?-1:1:0;u=!l||(l>0?d<e.length-1:d>0)}0==m?n>p.bottom&&(!c||c.bottom<p.bottom)?(l=f,c=p):n<p.top&&(!h||h.top>p.top)&&(a=f,h=p):c&&fa(c,p)?c=pa(c,p.bottom):h&&fa(h,p)&&(h=da(h,p.top))}}if(c&&c.bottom>=n?(i=l,o=c):h&&h.top<=n&&(i=a,o=h),!i)return{node:e,offset:0};let f=Math.max(o.left,Math.min(o.right,t));return 3==i.nodeType?ga(i,f,n):u&&"false"!=i.contentEditable?ma(i,f,n):{node:e,offset:Array.prototype.indexOf.call(e.childNodes,i)+(t>=(o.left+o.right)/2?1:0)}}function ga(e,t,n){let i=e.nodeValue.length,o=-1,r=1e9,s=0;for(let l=0;l<i;l++){let i=ws(e,l,l+1).getClientRects();for(let a=0;a<i.length;a++){let c=i[a];if(c.top==c.bottom)continue;s||(s=t-c.left);let h=(c.top>n?c.top-n:n-c.bottom)-1;if(c.left-1<=t&&c.right+1>=t&&h<r){let n=t>=(c.left+c.right)/2,i=n;if((zs.chrome||zs.gecko)&&ws(e,l).getBoundingClientRect().left==c.right&&(i=!n),h<=0)return{node:e,offset:l+(i?1:0)};o=l+(i?1:0),r=h}}}return{node:e,offset:o>-1?o:s>0?e.nodeValue.length:0}}function ba(e,t,n,i=-1){var o,r;let s,l=e.contentDOM.getBoundingClientRect(),a=l.top+e.viewState.paddingTop,{docHeight:c}=e.viewState,{x:h,y:u}=t,f=u-a;if(f<0)return 0;if(f>c)return e.state.doc.length;for(let t=e.viewState.heightOracle.textHeight/2,o=!1;s=e.elementAtHeight(f),s.type!=ol.Text;)for(;f=i>0?s.bottom+t:s.top-t,!(f>=0&&f<=c);){if(o)return n?null:0;o=!0,i=-i}u=a+f;let d=s.from;if(d<e.viewport.from)return 0==e.viewport.from?0:n?null:va(e,l,s,h,u);if(d>e.viewport.to)return e.viewport.to==e.state.doc.length?e.state.doc.length:n?null:va(e,l,s,h,u);let p=e.dom.ownerDocument,m=e.root.elementFromPoint?e.root:p,g=m.elementFromPoint(h,u);g&&!e.contentDOM.contains(g)&&(g=null),g||(h=Math.max(l.left+1,Math.min(l.right-1,h)),g=m.elementFromPoint(h,u),g&&!e.contentDOM.contains(g)&&(g=null));let b,v=-1;if(g&&0!=(null===(o=e.docView.nearest(g))||void 0===o?void 0:o.isEditable))if(p.caretPositionFromPoint){let e=p.caretPositionFromPoint(h,u);e&&({offsetNode:b,offset:v}=e)}else if(p.caretRangeFromPoint){let t=p.caretRangeFromPoint(h,u);t&&(({startContainer:b,startOffset:v}=t),(!e.contentDOM.contains(b)||zs.safari&&function(e,t,n){let i;if(3!=e.nodeType||t!=(i=e.nodeValue.length))return!1;for(let t=e.nextSibling;t;t=t.nextSibling)if(1!=t.nodeType||"BR"!=t.nodeName)return!1;return ws(e,i-1,i).getBoundingClientRect().left>n}(b,v,h)||zs.chrome&&function(e,t,n){if(0!=t)return!1;for(let t=e;;){let e=t.parentNode;if(!e||1!=e.nodeType||e.firstChild!=t)return!1;if(e.classList.contains("cm-line"))break;t=e}return n-(1==e.nodeType?e.getBoundingClientRect():ws(e,0,Math.max(e.nodeValue.length,1)).getBoundingClientRect()).left>5}(b,v,h))&&(b=void 0))}if(!b||!e.docView.dom.contains(b)){let t=tl.find(e.docView,d);if(!t)return f>s.top+s.height/2?s.to:s.from;({node:b,offset:v}=ma(t.dom,h,u))}let y=e.docView.nearest(b);if(!y)return null;if(y.isWidget&&1==(null===(r=y.dom)||void 0===r?void 0:r.nodeType)){let e=y.dom.getBoundingClientRect();return t.y<e.top||t.y<=e.bottom&&t.x<=(e.left+e.right)/2?y.posAtStart:y.posAtEnd}return y.localPosFromDOM(b,v)+y.posAtStart}function va(e,t,n,i,o){let r=Math.round((i-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>1.5*e.defaultLineHeight){let t=e.viewState.heightOracle.textHeight;r+=Math.floor((o-n.top-.5*(e.defaultLineHeight-t))/t)*e.viewState.heightOracle.lineLength}let s=e.state.sliceDoc(n.from,n.to);return n.from+qr(s,r,e.state.tabSize)}function ya(e,t){let n=e.lineBlockAt(t);if(Array.isArray(n.type))for(let e of n.type)if(e.to>t||e.to==t&&(e.to==n.to||e.type==ol.Text))return e;return n}function wa(e,t,n,i){let o=e.state.doc.lineAt(t.head),r=e.bidiSpans(o),s=e.textDirectionAt(o.from);for(let l=t,a=null;;){let t=oa(o,r,s,l,n),c=ia;if(!t){if(o.number==(n?e.state.doc.lines:1))return l;c="\n",o=e.state.doc.line(o.number+(n?1:-1)),r=e.bidiSpans(o),t=Wo.cursor(n?o.from:o.to)}if(a){if(!a(c))return l}else{if(!i)return t;a=i(c)}l=t}}function ka(e,t,n){for(;;){let i=0;for(let o of e)o.between(t-1,t+1,((e,o,r)=>{if(t>e&&t<o){let r=i||n||(t-e<o-t?-1:1);t=r<0?e:o,i=r}}));if(!i)return t}}function xa(e,t,n){let i=ka(e.state.facet(_l).map((t=>t(e))),n.from,t.head>n.from?-1:1);return i==n.from?n:Wo.cursor(i,i<n.from?1:-1)}class Oa{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.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=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.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,zs.safari&&e.contentDOM.addEventListener("input",(()=>null)),zs.gecko&&function(e){Ya.has(e)||(Ya.add(e),e.addEventListener("copy",(()=>{})),e.addEventListener("cut",(()=>{})))}(e.contentDOM.ownerDocument)}handleEvent(e){(function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n,i=t.target;i!=e.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(n=Es.get(i))&&n.ignoreEvent(t))return!1;return!0})(this.view,e)&&!this.ignoreDuringComposition(e)&&("keydown"==e.type&&this.keydown(e)||this.runHandlers(e.type,e))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Ca(e),n=this.handlers,i=this.view.contentDOM;for(let e in t)if("scroll"!=e){let o=!t[e].handlers.length,r=n[e];r&&o!=!r.handlers.length&&(i.removeEventListener(e,this.handleEvent),r=null),r||i.addEventListener(e,this.handleEvent,{passive:o})}for(let e in n)"scroll"==e||t[e]||i.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&Date.now()<this.lastEscPress+2e3)return!0;if(27!=e.keyCode&&Ma.indexOf(e.keyCode)<0&&(this.view.inputState.lastEscPress=0),zs.android&&zs.chrome&&!e.synthetic&&(13==e.keyCode||8==e.keyCode))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return!zs.ios||e.synthetic||e.altKey||e.metaKey||!((t=Ea.find((t=>t.keyCode==e.keyCode)))&&!e.ctrlKey||Aa.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(229!=e.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=t||e,setTimeout((()=>this.flushIOSKey()),250),!0)}flushIOSKey(){let e=this.pendingIOSKey;return!!e&&(this.pendingIOSKey=void 0,ks(this.view.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(e){return!!/^key/.test(e.type)&&(this.composing>0||!!(zs.safari&&!zs.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}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 Sa(e,t){return(n,i)=>{try{return t.call(e,i,n)}catch(e){Cl(n.state,e)}}}function Ca(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec;if(e&&e.domEventHandlers)for(let i in e.domEventHandlers){let o=e.domEventHandlers[i];o&&n(i).handlers.push(Sa(t.value,o))}if(e&&e.domEventObservers)for(let i in e.domEventObservers){let o=e.domEventObservers[i];o&&n(i).observers.push(Sa(t.value,o))}}for(let e in Pa)n(e).handlers.push(Pa[e]);for(let e in Ra)n(e).observers.push(Ra[e]);return t}const Ea=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Aa="dthko",Ma=[16,17,18,20,91,92,224,225];function Ta(e){return.7*Math.max(0,e)+8}class Da{constructor(e,t,n,i){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParent=function(e){let t=e.ownerDocument;for(let n=e.parentNode;n&&n!=t.body;)if(1==n.nodeType){if(n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)return n;n=n.assignedSlot||n.parentNode}else{if(11!=n.nodeType)break;n=n.host}return null}(e.contentDOM),this.atoms=e.state.facet(_l).map((t=>t(e)));let o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(Ar.allowMultipleSelections)&&function(e,t){let n=e.state.facet(pl);return n.length?n[0](t):zs.mac?t.metaKey:t.ctrlKey}(e,t),this.dragging=!(!function(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let i=rs(e.root);if(!i||0==i.rangeCount)return!0;let o=i.getRangeAt(0).getClientRects();for(let e=0;e<o.length;e++){let n=o[e];if(n.left<=t.clientX&&n.right>=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}(e,t)||1!=Qa(t))&&null}start(e){!1===this.dragging&&this.select(e)}move(e){var t,n,i;if(0==e.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(n=this.startEvent,i=e,Math.max(Math.abs(n.clientX-i.clientX),Math.abs(n.clientY-i.clientY))<10))return;this.select(this.lastEvent=e);let o=0,r=0,s=(null===(t=this.scrollParent)||void 0===t?void 0:t.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},l=Nl(this.view);e.clientX-l.left<=s.left+6?o=-Ta(s.left-e.clientX):e.clientX+l.right>=s.right-6&&(o=Ta(e.clientX-s.right)),e.clientY-l.top<=s.top+6?r=-Ta(s.top-e.clientY):e.clientY+l.bottom>=s.bottom-6&&(r=Ta(e.clientY-s.bottom)),this.setScrollSpeed(o,r)}up(e){null==this.dragging&&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,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval((()=>this.scroll()),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),!1===this.dragging&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let n=0;n<e.ranges.length;n++){let i=e.ranges[n],o=null;if(i.empty){let e=ka(this.atoms,i.from,0);e!=i.from&&(o=Wo.cursor(e,-1))}else{let e=ka(this.atoms,i.from,-1),t=ka(this.atoms,i.to,1);e==i.from&&t==i.to||(o=Wo.range(i.from==i.anchor?e:t,i.from==i.head?e:t))}o&&(t||(t=e.ranges.slice()),t[n]=o)}return t?Wo.create(t,e.mainIndex):e}select(e){let{view:t}=this,n=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection)||n.main.assoc!=t.state.selection.main.assoc&&!1===this.dragging)&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){this.style.update(e)&&setTimeout((()=>this.select(this.lastEvent)),20)}}const Pa=Object.create(null),Ra=Object.create(null),$a=zs.ie&&zs.ie_version<15||zs.ios&&zs.webkit_version<604;function _a(e,t){let n,{state:i}=e,o=1,r=i.toText(t),s=r.lines==i.selection.ranges.length;if(null!=qa&&i.selection.ranges.every((e=>e.empty))&&qa==r.toString()){let e=-1;n=i.changeByRange((n=>{let l=i.doc.lineAt(n.from);if(l.from==e)return{range:n};e=l.from;let a=i.toText((s?r.line(o++).text:t)+i.lineBreak);return{changes:{from:l.from,insert:a},range:Wo.cursor(n.from+a.length)}}))}else n=s?i.changeByRange((e=>{let t=r.line(o++);return{changes:{from:e.from,to:e.to,insert:t.text},range:Wo.cursor(e.from+t.length)}})):i.replaceSelection(r);e.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function Ba(e,t,n,i){if(1==i)return Wo.cursor(t,n);if(2==i)return function(e,t,n=1){let i=e.charCategorizer(t),o=e.doc.lineAt(t),r=t-o.from;if(0==o.length)return Wo.cursor(t);0==r?n=1:r==o.length&&(n=-1);let s=r,l=r;n<0?s=xo(o.text,r,!1):l=xo(o.text,r);let a=i(o.text.slice(s,l));for(;s>0;){let e=xo(o.text,s,!1);if(i(o.text.slice(e,s))!=a)break;s=e}for(;l<o.length;){let e=xo(o.text,l);if(i(o.text.slice(l,e))!=a)break;l=e}return Wo.range(s+o.from,l+o.from)}(e.state,t,n);{let n=tl.find(e.docView,t),i=e.state.doc.lineAt(n?n.posAtEnd:t),o=n?n.posAtStart:i.from,r=n?n.posAtEnd:i.to;return r<e.state.doc.length&&r==i.to&&r++,Wo.range(o,r)}}Ra.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},Pa.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&(e.inputState.lastEscPress=Date.now()),!1),Ra.touchstart=(e,t)=>{e.inputState.lastTouchTime=Date.now(),e.inputState.setSelectionOrigin("select.pointer")},Ra.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},Pa.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let i of e.state.facet(gl))if(n=i(e,t),n)break;if(n||0!=t.button||(n=function(e,t){let n=Va(e,t),i=Qa(t),o=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),o=o.map(e.changes))},get(t,r,s){let l,a=Va(e,t),c=Ba(e,a.pos,a.bias,i);if(n.pos!=a.pos&&!r){let t=Ba(e,n.pos,n.bias,i),o=Math.min(t.from,c.from),r=Math.max(t.to,c.to);c=o<c.from?Wo.range(o,r):Wo.range(r,o)}return r?o.replaceRange(o.main.extend(c.from,c.to)):s&&1==i&&o.ranges.length>1&&(l=function(e,t){for(let n=0;n<e.ranges.length;n++){let{from:i,to:o}=e.ranges[n];if(i<=t&&o>=t)return Wo.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}(o,a.pos))?l:s?o.addRange(c):Wo.create([c])}}}(e,t)),n){let i=!e.hasFocus;e.inputState.startMouseSelection(new Da(e,t,n,i)),i&&e.observer.ignore((()=>ys(e.contentDOM)));let o=e.inputState.mouseSelection;if(o)return o.start(t),!1===o.dragging}return!1};let Ia=(e,t)=>e>=t.top&&e<=t.bottom,La=(e,t,n)=>Ia(t,n)&&e>=n.left&&e<=n.right;function Na(e,t,n,i){let o=tl.find(e.docView,t);if(!o)return 1;let r=t-o.posAtStart;if(0==r)return 1;if(r==o.length)return-1;let s=o.coordsAt(r,-1);if(s&&La(n,i,s))return-1;let l=o.coordsAt(r,1);return l&&La(n,i,l)?1:s&&Ia(i,s)?-1:1}function Va(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:n,bias:Na(e,n,t.clientX,t.clientY)}}const Ha=zs.ie&&zs.ie_version<=11;let Wa=null,za=0,Fa=0;function Qa(e){if(!Ha)return e.detail;let t=Wa,n=Fa;return Wa=e,Fa=Date.now(),za=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(za+1)%3:1}function ja(e,t,n,i){if(!n)return;let o=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:r}=e.inputState,s=i&&r&&function(e,t){let n=e.state.facet(ml);return n.length?n[0](t):zs.mac?!t.altKey:!t.ctrlKey}(e,t)?{from:r.from,to:r.to}:null,l={from:o,insert:n},a=e.state.changes(s?[s,l]:l);e.focus(),e.dispatch({changes:a,selection:{anchor:a.mapPos(o,-1),head:a.mapPos(o,1)},userEvent:s?"move.drop":"input.drop"}),e.inputState.draggedContent=null}Pa.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let i=e.docView.nearest(t.target);if(i&&i.isWidget){let e=i.posAtStart,t=e+i.length;(e>=n.to||t<=n.from)&&(n=Wo.range(e,t))}}let{inputState:i}=e;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",e.state.sliceDoc(n.from,n.to)),t.dataTransfer.effectAllowed="copyMove"),!1},Pa.dragend=e=>(e.inputState.draggedContent=null,!1),Pa.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let i=Array(n.length),o=0,r=()=>{++o==n.length&&ja(e,t,i.filter((e=>null!=e)).join(e.state.lineBreak),!1)};for(let e=0;e<n.length;e++){let t=new FileReader;t.onerror=r,t.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(i[e]=t.result),r()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData("Text");if(n)return ja(e,t,n,!0),!0}return!1},Pa.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=$a?null:t.clipboardData;return n?(_a(e,n.getData("text/plain")||n.getData("text/uri-text")),!0):(function(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout((()=>{e.focus(),n.remove(),_a(e,n.value)}),50)}(e),!1)};let qa=null;Pa.copy=Pa.cut=(e,t)=>{let{text:n,ranges:i,linewise:o}=function(e){let t=[],n=[],i=!1;for(let i of e.selection.ranges)i.empty||(t.push(e.sliceDoc(i.from,i.to)),n.push(i));if(!t.length){let o=-1;for(let{from:i}of e.selection.ranges){let r=e.doc.lineAt(i);r.number>o&&(t.push(r.text),n.push({from:r.from,to:Math.min(e.doc.length,r.to+1)})),o=r.number}i=!0}return{text:t.join(e.lineBreak),ranges:n,linewise:i}}(e.state);if(!n&&!o)return!1;qa=o?n:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let r=$a?null:t.clipboardData;return r?(r.clearData(),r.setData("text/plain",n),!0):(function(e,t){let n=e.dom.parentNode;if(!n)return;let i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=t,i.focus(),i.selectionEnd=t.length,i.selectionStart=0,setTimeout((()=>{i.remove(),e.focus()}),50)}(e,n),!1)};const Ua=dr.define();function Ga(e,t){let n=[];for(let i of e.facet(wl)){let o=i(e,t);o&&n.push(o)}return n?e.update({effects:n,annotations:Ua.of(!0)}):null}function Xa(e){setTimeout((()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=Ga(e.state,t);n?e.dispatch(n):e.update([])}}),10)}Ra.focus=e=>{e.inputState.lastFocusTime=Date.now(),e.scrollDOM.scrollTop||!e.inputState.lastScrollTop&&!e.inputState.lastScrollLeft||(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),Xa(e)},Ra.blur=e=>{e.observer.clearSelectionRange(),Xa(e)},Ra.compositionstart=Ra.compositionupdate=e=>{null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0)},Ra.compositionend=e=>{e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,zs.chrome&&zs.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then((()=>e.observer.flush())):setTimeout((()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])}),50)},Ra.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},Pa.beforeinput=(e,t)=>{var n;let i;if(zs.chrome&&zs.android&&(i=Ea.find((e=>e.inputType==t.inputType)))&&(e.observer.delayAndroidKey(i.key,i.keyCode),"Backspace"==i.key||"Delete"==i.key)){let t=(null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0;setTimeout((()=>{var n;((null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())}),100)}return!1};const Ya=new Set,Ka=["pre-wrap","normal","pre-line","break-spaces"];class Za{constructor(e){this.lineWrapping=e,this.doc=lo.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Ka.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let i=e[n];i<0?n++:this.heightSamples[Math.floor(10*i)]||(t=!0,this.heightSamples[Math.floor(10*i)]=!0)}return t}refresh(e,t,n,i,o,r){let s=Ka.indexOf(e)>-1,l=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=s;if(this.lineWrapping=s,this.lineHeight=t,this.charWidth=n,this.textHeight=i,this.lineLength=o,l){this.heightSamples={};for(let e=0;e<r.length;e++){let t=r[e];t<0?e++:this.heightSamples[Math.floor(10*t)]=!0}}return l}}class Ja{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class ec{constructor(e,t,n,i,o){this.from=e,this.length=t,this.top=n,this.height=i,this._content=o}get type(){return"number"==typeof this._content?ol.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 al?this._content.widget:null}get widgetLineBreaks(){return"number"==typeof this._content?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new ec(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var tc=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(tc||(tc={}));const nc=.001;class ic{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(2&this.flags)>0}set outdated(e){this.flags=(e?2:0)|-3&this.flags}setHeight(e,t){this.height!=t&&(Math.abs(this.height-t)>nc&&(e.heightChanged=!0),this.height=t)}replace(e,t,n){return ic.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,i){let o=this,r=n.doc;for(let s=i.length-1;s>=0;s--){let{fromA:l,toA:a,fromB:c,toB:h}=i[s],u=o.lineAt(l,tc.ByPosNoHeight,n.setDoc(t),0,0),f=u.to>=a?u:o.lineAt(a,tc.ByPosNoHeight,n,0,0);for(h+=f.to-a,a=f.to;s>0&&u.from<=i[s-1].toA;)l=i[s-1].fromA,c=i[s-1].fromB,s--,l<u.from&&(u=o.lineAt(l,tc.ByPosNoHeight,n,0,0));c+=u.from-l,l=u.from;let d=cc.build(n.setDoc(r),e,c,h);o=o.replace(l,a,d)}return o.updateHeight(n,0)}static empty(){return new rc(0,0)}static of(e){if(1==e.length)return e[0];let t=0,n=e.length,i=0,o=0;for(;;)if(t==n)if(i>2*o){let o=e[t-1];o.break?e.splice(--t,1,o.left,null,o.right):e.splice(--t,1,o.left,o.right),n+=1+o.break,i-=o.size}else{if(!(o>2*i))break;{let t=e[n];t.break?e.splice(n,1,t.left,null,t.right):e.splice(n,1,t.left,t.right),n+=2+t.break,o-=t.size}}else if(i<o){let n=e[t++];n&&(i+=n.size)}else{let t=e[--n];t&&(o+=t.size)}let r=0;return null==e[t-1]?(r=1,t--):null==e[t]&&(r=1,n++),new lc(ic.of(e.slice(0,t)),r,ic.of(e.slice(n)))}}ic.prototype.size=1;class oc extends ic{constructor(e,t,n){super(e,t),this.deco=n}blockAt(e,t,n,i){return new ec(i,this.length,n,this.height,this.deco||0)}lineAt(e,t,n,i,o){return this.blockAt(0,n,i,o)}forEachLine(e,t,n,i,o,r){e<=o+this.length&&t>=o&&r(this.blockAt(0,n,i,o))}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more&&this.setHeight(e,i.heights[i.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class rc extends oc{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,i){return new ec(i,this.length,n,this.height,this.breaks)}replace(e,t,n){let i=n[0];return 1==n.length&&(i instanceof rc||i instanceof sc&&4&i.flags)&&Math.abs(this.length-i.length)<10?(i instanceof sc?i=new rc(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):ic.of(n)}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more?this.setHeight(e,i.heights[i.index++]):(n||this.outdated)&&this.setHeight(e,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 sc extends ic{constructor(e){super(e,0)}heightMetrics(e,t){let n,i=e.doc.lineAt(t).number,o=e.doc.lineAt(t+this.length).number,r=o-i+1,s=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*r);n=t/r,this.length>r+1&&(s=(this.height-t)/(this.length-r-1))}else n=this.height/r;return{firstLine:i,lastLine:o,perLine:n,perChar:s}}blockAt(e,t,n,i){let{firstLine:o,lastLine:r,perLine:s,perChar:l}=this.heightMetrics(t,i);if(t.lineWrapping){let o=i+Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length),r=t.doc.lineAt(o),a=s+r.length*l,c=Math.max(n,e-a/2);return new ec(r.from,r.length,c,a,0)}{let i=Math.max(0,Math.min(r-o,Math.floor((e-n)/s))),{from:l,length:a}=t.doc.line(o+i);return new ec(l,a,n+s*i,s,0)}}lineAt(e,t,n,i,o){if(t==tc.ByHeight)return this.blockAt(e,n,i,o);if(t==tc.ByPosNoHeight){let{from:t,to:i}=n.doc.lineAt(e);return new ec(t,i-t,0,0,0)}let{firstLine:r,perLine:s,perChar:l}=this.heightMetrics(n,o),a=n.doc.lineAt(e),c=s+a.length*l,h=a.number-r,u=i+s*h+l*(a.from-o-h);return new ec(a.from,a.length,Math.max(i,Math.min(u,i+this.height-c)),c,0)}forEachLine(e,t,n,i,o,r){e=Math.max(e,o),t=Math.min(t,o+this.length);let{firstLine:s,perLine:l,perChar:a}=this.heightMetrics(n,o);for(let c=e,h=i;c<=t;){let t=n.doc.lineAt(c);if(c==e){let n=t.number-s;h+=l*n+a*(e-o-n)}let i=l+a*t.length;r(new ec(t.from,t.length,h,i,0)),h+=i,c=t.to+1}}replace(e,t,n){let i=this.length-t;if(i>0){let e=n[n.length-1];e instanceof sc?n[n.length-1]=new sc(e.length+i):n.push(null,new sc(i-1))}if(e>0){let t=n[0];t instanceof sc?n[0]=new sc(e+t.length):n.unshift(new sc(e-1),null)}return ic.of(n)}decomposeLeft(e,t){t.push(new sc(e-1),null)}decomposeRight(e,t){t.push(null,new sc(this.length-e-1))}updateHeight(e,t=0,n=!1,i){let o=t+this.length;if(i&&i.from<=t+this.length&&i.more){let n=[],r=Math.max(t,i.from),s=-1;for(i.from>t&&n.push(new sc(i.from-t-1).updateHeight(e,t));r<=o&&i.more;){let t=e.doc.lineAt(r).length;n.length&&n.push(null);let o=i.heights[i.index++];-1==s?s=o:Math.abs(o-s)>=nc&&(s=-2);let l=new rc(t,o);l.outdated=!1,n.push(l),r+=t+1}r<=o&&n.push(null,new sc(o-r).updateHeight(e,r));let l=ic.of(n);return(s<0||Math.abs(l.height-this.height)>=nc||Math.abs(s-this.heightMetrics(e,t).perLine)>=nc)&&(e.heightChanged=!0),l}return(n||this.outdated)&&(this.setHeight(e,e.heightForGap(t,t+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class lc extends ic{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return 1&this.flags}blockAt(e,t,n,i){let o=n+this.left.height;return e<o?this.left.blockAt(e,t,n,i):this.right.blockAt(e,t,o,i+this.left.length+this.break)}lineAt(e,t,n,i,o){let r=i+this.left.height,s=o+this.left.length+this.break,l=t==tc.ByHeight?e<r:e<s,a=l?this.left.lineAt(e,t,n,i,o):this.right.lineAt(e,t,n,r,s);if(this.break||(l?a.to<s:a.from>s))return a;let c=t==tc.ByPosNoHeight?tc.ByPosNoHeight:tc.ByPos;return l?a.join(this.right.lineAt(s,c,n,r,s)):this.left.lineAt(s,c,n,i,o).join(a)}forEachLine(e,t,n,i,o,r){let s=i+this.left.height,l=o+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,t,n,i,o,r),t>=l&&this.right.forEachLine(e,t,n,s,l,r);else{let a=this.lineAt(l,tc.ByPos,n,i,o);e<a.from&&this.left.forEachLine(e,a.from-1,n,i,o,r),a.to>=e&&a.from<=t&&r(a),t>a.to&&this.right.forEachLine(a.to+1,t,n,s,l,r)}}replace(e,t,n){let i=this.left.length+this.break;if(t<i)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,n));let o=[];e>0&&this.decomposeLeft(e,o);let r=o.length;for(let e of n)o.push(e);if(e>0&&ac(o,r-1),t<this.length){let e=o.length;this.decomposeRight(t,o),ac(o,e)}return ic.of(o)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,i=n+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<i&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?ic.of(this.break?[e,null,t]:[e,t]):(this.left=e,this.right=t,this.height=e.height+t.height,this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,i){let{left:o,right:r}=this,s=t+o.length+this.break,l=null;return i&&i.from<=t+o.length&&i.more?l=o=o.updateHeight(e,t,n,i):o.updateHeight(e,t,n),i&&i.from<=s+r.length&&i.more?l=r=r.updateHeight(e,s,n,i):r.updateHeight(e,s,n),l?this.balanced(o,r):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function ac(e,t){let n,i;null==e[t]&&(n=e[t-1])instanceof sc&&(i=e[t+1])instanceof sc&&e.splice(t-1,3,new sc(n.length+1+i.length))}class cc{constructor(e,t){this.pos=e,this.oracle=t,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,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof rc?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new rc(e-this.pos,-1)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let i=n.widget?n.widget.estimatedHeight:0,o=n.widget?n.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let r=t-e;n.block?this.addBlock(new oc(r,i,n)):(r||o||i>=5)&&this.addLineDeco(i,o,r)}else t>e&&this.span(e,t);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:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new rc(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new sc(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof rc)return e;let t=new rc(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||t instanceof rc||this.isCovered?(this.writtenTo<this.pos||null==t)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new rc(0,-1));let n=e;for(let e of this.nodes)e instanceof rc&&e.updateHeight(this.oracle,n),n+=e?e.length:1;return this.nodes}static build(e,t,n,i){let o=new cc(n,e);return $r.spans(t,n,i,o,0),o.finish(n)}}class hc{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,i){(e<t||n&&n.heightRelevant||i&&i.heightRelevant)&&hl(e,t,this.changes,5)}}function uc(e,t){let n=e.getBoundingClientRect(),i=e.ownerDocument,o=i.defaultView||window,r=Math.max(0,n.left),s=Math.min(o.innerWidth,n.right),l=Math.max(0,n.top),a=Math.min(o.innerHeight,n.bottom);for(let t=e.parentNode;t&&t!=i.body;)if(1==t.nodeType){let n=t,i=window.getComputedStyle(n);if((n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)&&"visible"!=i.overflow){let i=n.getBoundingClientRect();r=Math.max(r,i.left),s=Math.min(s,i.right),l=Math.max(l,i.top),a=t==e.parentNode?i.bottom:Math.min(a,i.bottom)}t="absolute"==i.position||"fixed"==i.position?n.offsetParent:n.parentNode}else{if(11!=t.nodeType)break;t=t.host}return{left:r-n.left,right:Math.max(r,s)-n.left,top:l-(n.top+t),bottom:Math.max(l,a)-(n.top+t)}}function fc(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class dc{constructor(e,t,n){this.from=e,this.to=t,this.size=n}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],o=t[n];if(i.from!=o.from||i.to!=o.to||i.size!=o.size)return!1}return!0}draw(e,t){return rl.replace({widget:new pc(this.size*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class pc extends il{constructor(e,t){super(),this.size=e,this.vertical=t}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 mc{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=!0,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=wc,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=zl.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(Rl).some((e=>"function"!=typeof e&&"cm-lineWrapping"==e.class));this.heightOracle=new Za(t),this.stateDeco=e.facet($l).filter((e=>"function"!=typeof e)),this.heightMap=ic.empty().applyChanges(this.stateDeco,lo.empty,this.heightOracle.setDoc(e.doc),[new Hl(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=rl.set(this.lineGaps.map((e=>e.draw(this,!1)))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let i=n?t.head:t.anchor;if(!e.some((({from:e,to:t})=>i>=e&&i<=t))){let{from:t,to:n}=this.lineBlockAt(i);e.push(new gc(t,n))}}this.viewports=e.sort(((e,t)=>e.from-t.from)),this.scaler=this.heightMap.height<=7e6?wc:new kc(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(e=>{this.viewportLines.push(1==this.scaler.scale?e:xc(e,this.scaler))}))}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet($l).filter((e=>"function"!=typeof e));let i=e.changedRanges,o=Hl.extendWithRanges(i,function(e,t,n){let i=new hc;return $r.compare(e,t,n,i,0),i.changes}(n,this.stateDeco,e?e.changes:$o.empty(this.state.doc.length))),r=this.heightMap.height,s=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),this.heightMap.height!=r&&(e.flags|=2),s?(this.scrollAnchorPos=e.changes.mapPos(s.from,-1),this.scrollAnchorHeight=s.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let l=o.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<l.from||t.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,t));let a=!e.changes.empty||2&e.flags||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),a&&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(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(xl)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),i=this.heightOracle,o=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?zl.RTL:zl.LTR;let r=this.heightOracle.mustRefreshForWrapping(o),s=t.getBoundingClientRect(),l=r||this.mustMeasureContent||this.contentDOMHeight!=s.height;this.contentDOMHeight=s.height,this.mustMeasureContent=!1;let a=0,c=0;if(s.width&&s.height){let{scaleX:e,scaleY:n}=ms(t,s);this.scaleX==e&&this.scaleY==n||(this.scaleX=e,this.scaleY=n,a|=8,r=l=!0)}let h=(parseInt(n.paddingTop)||0)*this.scaleY,u=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==h&&this.paddingBottom==u||(this.paddingTop=h,this.paddingBottom=u,a|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,a|=8);let f=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=f&&(this.scrollAnchorHeight=-1,this.scrollTop=f),this.scrolledToBottom=Os(e.scrollDOM);let d=(this.printing?fc:uc)(t,this.paddingTop),p=d.top-this.pixelViewport.top,m=d.bottom-this.pixelViewport.bottom;this.pixelViewport=d;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let b=s.width;if(this.contentDOMWidth==b&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=s.width,this.editorHeight=e.scrollDOM.clientHeight,a|=8),l){let t=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(t)&&(r=!0),r||i.lineWrapping&&Math.abs(b-this.contentDOMWidth)>i.charWidth){let{lineHeight:n,charWidth:s,textHeight:l}=e.docView.measureTextSize();r=n>0&&i.refresh(o,n,s,l,b/s,t),r&&(e.docView.minWidth=0,a|=8)}p>0&&m>0?c=Math.max(p,m):p<0&&m<0&&(c=Math.min(p,m)),i.heightChanged=!1;for(let n of this.viewports){let o=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(r?ic.empty().applyChanges(this.stateDeco,lo.empty,this.heightOracle,[new Hl(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,r,new Ja(n.from,o))}i.heightChanged&&(a|=2)}let v=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return v&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&a||v)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(r?[]:this.lineGaps,e)),a|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),a}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,o=this.heightOracle,{visibleTop:r,visibleBottom:s}=this,l=new gc(i.lineAt(r-1e3*n,tc.ByHeight,o,0,0).from,i.lineAt(s+1e3*(1-n),tc.ByHeight,o,0,0).to);if(t){let{head:e}=t.range;if(e<l.from||e>l.to){let n,r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),s=i.lineAt(e,tc.ByPos,o,0,0);n="center"==t.y?(s.top+s.bottom)/2-r/2:"start"==t.y||"nearest"==t.y&&e<l.from?s.top:s.bottom-r,l=new gc(i.lineAt(n-500,tc.ByHeight,o,0,0).from,i.lineAt(n+r+500,tc.ByHeight,o,0,0).to)}}return l}mapViewport(e,t){let n=t.mapPos(e.from,-1),i=t.mapPos(e.to,1);return new gc(this.heightMap.lineAt(n,tc.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,tc.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,tc.ByPos,this.heightOracle,0,0),{bottom:o}=this.heightMap.lineAt(t,tc.ByPos,this.heightOracle,0,0),{visibleTop:r,visibleBottom:s}=this;return(0==e||i<=r-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||o>=s+Math.max(10,Math.min(n,250)))&&i>r-2e3&&o<s+2e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let i of e)t.touchesRange(i.from,i.to)||n.push(new dc(t.mapPos(i.from),t.mapPos(i.to),i.size));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,i=n?1e4:2e3,o=i>>1,r=i<<1;if(this.defaultTextDirection!=zl.LTR&&!n)return[];let s=[],l=(i,r,a,c)=>{if(r-i<o)return;let h=this.state.selection.main,u=[h.from];h.empty||u.push(h.to);for(let e of u)if(e>i&&e<r)return l(i,e-10,a,c),void l(e+10,r,a,c);let f=function(e,t){for(let n of e)if(t(n))return n}(e,(e=>e.from>=a.from&&e.to<=a.to&&Math.abs(e.from-i)<o&&Math.abs(e.to-r)<o&&!u.some((t=>e.from<t&&e.to>t))));if(!f){if(r<a.to&&t&&n&&t.visibleRanges.some((e=>e.from<=r&&e.to>=r))){let e=t.moveToLineBoundary(Wo.cursor(r),!1,!0).head;e>i&&(r=e)}f=new dc(i,r,this.gapSize(a,i,r,c))}s.push(f)};for(let e of this.viewportLines){if(e.length<r)continue;let t=bc(e.from,e.to,this.stateDeco);if(t.total<r)continue;let o,s,a=this.scrollTarget?this.scrollTarget.range.head:null;if(n){let n,r,l=i/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=a){let i=yc(t,a),o=((this.visibleBottom-this.visibleTop)/2+l)/e.height;n=i-o,r=i+o}else n=(this.visibleTop-e.top-l)/e.height,r=(this.visibleBottom-e.top+l)/e.height;o=vc(t,n),s=vc(t,r)}else{let e,n,r=t.total*this.heightOracle.charWidth,l=i*this.heightOracle.charWidth;if(null!=a){let i=yc(t,a),o=((this.pixelViewport.right-this.pixelViewport.left)/2+l)/r;e=i-o,n=i+o}else e=(this.pixelViewport.left-l)/r,n=(this.pixelViewport.right+l)/r;o=vc(t,e),s=vc(t,n)}o>e.from&&l(e.from,o,e,t),s<e.to&&l(s,e.to,e,t)}return s}gapSize(e,t,n,i){let o=yc(i,n)-yc(i,t);return this.heightOracle.lineWrapping?e.height*o:i.total*this.heightOracle.charWidth*o}updateLineGaps(e){dc.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=rl.set(e.map((e=>e.draw(this,this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];$r.spans(e,this.viewport.from,this.viewport.to,{span(e,n){t.push({from:e,to:n})},point(){}},20);let n=t.length!=this.visibleRanges.length||this.visibleRanges.some(((e,n)=>e.from!=t[n].from||e.to!=t[n].to));return this.visibleRanges=t,n?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find((t=>t.from<=e&&t.to>=e))||xc(this.heightMap.lineAt(e,tc.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return xc(this.heightMap.lineAt(this.scaler.fromDOM(e),tc.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return xc(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 gc{constructor(e,t){this.from=e,this.to=t}}function bc(e,t,n){let i=[],o=e,r=0;return $r.spans(n,e,t,{span(){},point(e,t){e>o&&(i.push({from:o,to:e}),r+=e-o),o=t}},20),o<t&&(i.push({from:o,to:t}),r+=t-o),{total:r,ranges:i}}function vc({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let i=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:o}=t[e],r=o-n;if(i<=r)return n+i;i-=r}}function yc(e,t){let n=0;for(let{from:i,to:o}of e.ranges){if(t<=o){n+=t-i;break}n+=o-i}return n/e.total}const wc={toDOM:e=>e,fromDOM:e=>e,scale:1};class kc{constructor(e,t,n){let i=0,o=0,r=0;this.viewports=n.map((({from:n,to:o})=>{let r=t.lineAt(n,tc.ByPos,e,0,0).top,s=t.lineAt(o,tc.ByPos,e,0,0).bottom;return i+=s-r,{from:n,to:o,top:r,bottom:s,domTop:0,domBottom:0}})),this.scale=(7e6-i)/(t.height-i);for(let e of this.viewports)e.domTop=r+(e.top-o)*this.scale,r=e.domBottom=e.domTop+(e.bottom-e.top),o=e.bottom}toDOM(e){for(let t=0,n=0,i=0;;t++){let o=t<this.viewports.length?this.viewports[t]:null;if(!o||e<o.top)return i+(e-n)*this.scale;if(e<=o.bottom)return o.domTop+(e-o.top);n=o.bottom,i=o.domBottom}}fromDOM(e){for(let t=0,n=0,i=0;;t++){let o=t<this.viewports.length?this.viewports[t]:null;if(!o||e<o.domTop)return n+(e-i)/this.scale;if(e<=o.domBottom)return o.top+(e-o.domTop);n=o.bottom,i=o.domBottom}}}function xc(e,t){if(1==t.scale)return e;let n=t.toDOM(e.top),i=t.toDOM(e.bottom);return new ec(e.from,e.length,n,i-n,Array.isArray(e._content)?e._content.map((e=>xc(e,t))):e._content)}const Oc=Qo.define({combine:e=>e.join(" ")}),Sc=Qo.define({combine:e=>e.indexOf(!0)>-1}),Cc=Yr.newName(),Ec=Yr.newName(),Ac=Yr.newName(),Mc={"&light":"."+Ec,"&dark":"."+Ac};function Tc(e,t,n){return new Yr(t,{finish:t=>/&/.test(t)?t.replace(/&\w*/,(t=>{if("&"==t)return e;if(!n||!n[t])throw new RangeError(`Unsupported selector: ${t}`);return n[t]})):e+" "+t})}const Dc=Tc("."+Cc,{"&":{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},".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:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".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",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&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},"&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-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"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".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"}},Mc),Pc="";class Rc{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(Ar.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Pc}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let i=e;;){this.findPointBefore(n,i);let e=this.text.length;this.readNode(i);let o=i.nextSibling;if(o==t)break;let r=Es.get(i),s=Es.get(o);(r&&s?r.breakAfter:(r?r.breakAfter:_c(i))||_c(o)&&("BR"!=i.nodeName||i.cmIgnore)&&this.text.length>e)&&this.lineBreak(),i=o}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let o,r=-1,s=1;if(this.lineSeparator?(r=t.indexOf(this.lineSeparator,n),s=this.lineSeparator.length):(o=i.exec(t))&&(r=o.index,s=o[0].length),this.append(t.slice(n,r<0?t.length:r)),r<0)break;if(this.lineBreak(),s>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=s-1);n=r+s}}readNode(e){if(e.cmIgnore)return;let t=Es.get(e),n=t&&t.overrideDOMText;if(null!=n){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else 3==e.nodeType?this.readTextNode(e):"BR"==e.nodeName?e.nextSibling&&this.lineBreak():1==e.nodeType&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(3==e.nodeType?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+($c(e,n.node,n.offset)?t:0))}}function $c(e,t,n){for(;;){if(!t||n<fs(t))return!1;if(t==e)return!0;n=hs(t)+1,t=t.parentNode}}function _c(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}class Bc{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class Ic{constructor(e,t,n,i){this.typeOver=i,this.bounds=null,this.text="";let{impreciseHead:o,impreciseAnchor:r}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,n,0))){let t=o||r?[]:function(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:i,focusNode:o,focusOffset:r}=e.observer.selectionRange;return n&&(t.push(new Bc(n,i)),o==n&&r==i||t.push(new Bc(o,r))),t}(e),n=new Rc(t,e.state);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=function(e,t){if(0==e.length)return null;let n=e[0].pos,i=2==e.length?e[1].pos:n;return n>-1&&i>-1?Wo.single(n+t,i+t):null}(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=o&&o.node==t.focusNode&&o.offset==t.focusOffset||!ss(e.contentDOM,t.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),i=r&&r.node==t.anchorNode&&r.offset==t.anchorOffset||!ss(e.contentDOM,t.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset);this.newSel=Wo.single(i,n)}}}function Lc(e,t){let n,{newSel:i}=t,o=e.state.selection.main,r=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:i,to:s}=t.bounds,l=o.from,a=null;(8===r||zs.android&&t.text.length<s-i)&&(l=o.to,a="end");let c=function(e,t,n,i){let o=Math.min(e.length,t.length),r=0;for(;r<o&&e.charCodeAt(r)==t.charCodeAt(r);)r++;if(r==o&&e.length==t.length)return null;let s=e.length,l=t.length;for(;s>0&&l>0&&e.charCodeAt(s-1)==t.charCodeAt(l-1);)s--,l--;return"end"==i&&(n-=s+Math.max(0,r-Math.min(s,l))-r),s<r&&e.length<t.length?(r-=n<=r&&n>=s?r-n:0,l=r+(l-s),s=r):l<r&&(r-=n<=r&&n>=l?r-n:0,s=r+(s-l),l=r),{from:r,toA:s,toB:l}}(e.state.doc.sliceString(i,s,Pc),t.text,l-i,a);c&&(zs.chrome&&13==r&&c.toB==c.from+2&&t.text.slice(c.from,c.toB)==Pc+Pc&&c.toB--,n={from:i+c.from,to:i+c.toA,insert:lo.of(t.text.slice(c.from,c.toB).split(Pc))})}else i&&(!e.hasFocus&&e.state.facet(El)||i.main.eq(o))&&(i=null);if(!n&&!i)return!1;if(!n&&t.typeOver&&!o.empty&&i&&i.main.empty?n={from:o.from,to:o.to,insert:e.state.doc.slice(o.from,o.to)}:n&&n.from>=o.from&&n.to<=o.to&&(n.from!=o.from||n.to!=o.to)&&o.to-o.from-(n.to-n.from)<=4?n={from:o.from,to:o.to,insert:e.state.doc.slice(o.from,n.from).append(n.insert).append(e.state.doc.slice(n.to,o.to))}:(zs.mac||zs.android)&&n&&n.from==n.to&&n.from==o.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(i&&2==n.insert.length&&(i=Wo.single(i.main.anchor-1,i.main.head-1)),n={from:o.from,to:o.to,insert:lo.of([" "])}):zs.chrome&&n&&n.from==n.to&&n.from==o.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(i&&(i=Wo.single(i.main.anchor-1,i.main.head-1)),n={from:o.from,to:o.to,insert:lo.of([" "])}),n){if(zs.ios&&e.inputState.flushIOSKey())return!0;if(zs.android&&(n.from==o.from&&n.to==o.to&&1==n.insert.length&&2==n.insert.lines&&ks(e.contentDOM,"Enter",13)||(n.from==o.from-1&&n.to==o.to&&0==n.insert.length||8==r&&n.insert.length<n.to-n.from&&n.to>o.head)&&ks(e.contentDOM,"Backspace",8)||n.from==o.from&&n.to==o.to+1&&0==n.insert.length&&ks(e.contentDOM,"Delete",46)))return!0;let t,s=n.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let l=()=>t||(t=function(e,t,n){let i,o=e.state,r=o.selection.main;if(t.from>=r.from&&t.to<=r.to&&t.to-t.from>=(r.to-r.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=r.from<t.from?o.sliceDoc(r.from,t.from):"",s=r.to>t.to?o.sliceDoc(t.to,r.to):"";i=o.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+s))}else{let s=o.changes(t),l=n&&n.main.to<=s.newLength?n.main:void 0;if(o.selection.ranges.length>1&&e.inputState.composing>=0&&t.to<=r.to&&t.to>=r.to-10){let a,c=e.state.sliceDoc(t.from,t.to),h=n&&la(e,n.main.head);if(h){let e=t.insert.length-(t.to-t.from);a={from:h.from,to:h.to-e}}else a=e.state.doc.lineAt(r.head);let u=r.to-t.to,f=r.to-r.from;i=o.changeByRange((n=>{if(n.from==r.from&&n.to==r.to)return{changes:s,range:l||n.map(s)};let i=n.to-u,h=i-c.length;if(n.to-n.from!=f||e.state.sliceDoc(h,i)!=c||n.to>=a.from&&n.from<=a.to)return{range:n};let d=o.changes({from:h,to:i,insert:t.insert}),p=n.to-r.to;return{changes:d,range:l?Wo.range(Math.max(0,l.anchor+p),Math.max(0,l.head+p)):n.map(d)}}))}else i={changes:s,selection:l&&o.selection.replaceRange(l)}}let s="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,s+=".compose",e.inputState.compositionFirstChange&&(s+=".start",e.inputState.compositionFirstChange=!1)),o.update(i,{userEvent:s,scrollIntoView:!0})}(e,n,i));return e.state.facet(yl).some((t=>t(e,n.from,n.to,s,l)))||e.dispatch(l()),!0}if(i&&!i.main.eq(o)){let t=!1,n="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),n=e.inputState.lastSelectionOrigin),e.dispatch({selection:i,scrollIntoView:t,userEvent:n}),!0}return!1}const Nc={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Vc=zs.ie&&zs.ie_version<=11;class Hc{constructor(e){this.view=e,this.active=!1,this.selectionRange=new gs,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.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver((t=>{for(let e of t)this.queue.push(e);(zs.ie&&zs.ie_version<=11||zs.ios&&e.composing)&&t.some((e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length))?this.flushSoon():this.flush()})),Vc&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.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),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((()=>{var e;(null===(e=this.view.docView)||void 0===e?void 0:e.lastUpdate)<Date.now()-75&&this.onResize()})),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver((e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.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((e=>{e.length>0&&e[e.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.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout((()=>{this.resizeTimeout=-1,this.view.requestMeasure()}),50))}onPrint(){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(((t,n)=>t!=e[n])))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,i=this.selectionRange;if(n.state.facet(El)?n.root.activeElement!=this.dom:!ls(n.dom,i))return;let o=i.anchorNode&&n.docView.nearest(i.anchorNode);o&&o.ignoreEvent(e)?t||(this.selectionChanged=!1):(zs.ie&&zs.ie_version<=11||zs.android&&zs.chrome)&&!n.state.selection.main.empty&&i.focusNode&&cs(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=zs.safari&&11==e.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e){let t=null;function n(e){e.preventDefault(),e.stopImmediatePropagation(),t=e.getTargetRanges()[0]}if(e.contentDOM.addEventListener("beforeinput",n,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",n,!0),!t)return null;let i=t.startContainer,o=t.startOffset,r=t.endContainer,s=t.endOffset,l=e.docView.domAtPos(e.state.selection.main.anchor);return cs(l.node,l.offset,r,s)&&([i,o,r,s]=[r,s,i,o]),{anchorNode:i,anchorOffset:o,focusNode:r,focusOffset:s}}(this.view)||rs(e.root);if(!t||this.selectionRange.eq(t))return!1;let n=ls(this.dom,t);return n&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&function(e,t){let n=t.focusNode,i=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=i)return!1;for(i=Math.min(i,fs(n));;)if(i){if(1!=n.nodeType)return!1;let e=n.childNodes[i-1];"false"==e.contentEditable?i--:(n=e,i=fs(n))}else{if(n==e)return!0;i=hs(n),n=n.parentNode}}(this.dom,t)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(t),n&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(1==n.nodeType)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else{if(11!=n.nodeType)break;n=n.host}if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);for(let e of this.scrollTargets=t)e.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,Nc),Vc&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Vc&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let e=()=>{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&ks(this.dom,e.key,e.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&"Enter"!=e||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(null===(n=this.delayedAndroidKey)||void 0===n?void 0:n.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 t=-1,n=-1,i=!1;for(let o of e){let e=this.readMutation(o);e&&(e.typeOver&&(i=!0),-1==t?({from:t,to:n}=e):(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:i}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),i=this.selectionChanged&&ls(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let o=new Ic(this.view,e,t,n);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,i=Lc(this.view,t);return this.view.state==n&&this.view.update([]),i}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty("attributes"==e.type),"attributes"==e.type&&(t.flags|=4),"childList"==e.type){let n=Wc(t,e.previousSibling||e.target.previousSibling,-1),i=Wc(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:i?t.posBefore(i):t.posAtEnd,typeOver:!1}}return"characterData"==e.type?{from:t.posAtStart,to:t.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),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),e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var e,t,n;this.stop(),null===(e=this.intersection)||void 0===e||e.disconnect(),null===(t=this.gapIntersection)||void 0===t||t.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect();for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}function Wc(e,t,n){for(;t;){let i=Es.get(t);if(i&&i.parent==e)return i;let o=t.parentNode;t=o!=e.dom?o:n>0?t.nextSibling:t.previousSibling}return null}class zc{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.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){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:t}=e;this.dispatchTransactions=e.dispatchTransactions||t&&(e=>e.forEach((e=>t(e,this))))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||function(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}(e.parent)||document,this.viewState=new mc(e.state||Ar.create(e)),e.scrollTo&&e.scrollTo.is(Sl)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Ml).map((e=>new Dl(e)));for(let e of this.plugins)e.update(this);this.observer=new Hc(this),this.inputState=new Oa(this),this.inputState.ensureHandlers(this.plugins),this.docView=new ra(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}dispatch(...e){let t=1==e.length&&e[0]instanceof br?e:1==e.length&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t,n=!1,i=!1,o=this.state;for(let t of e){if(t.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=t.state}if(this.destroyed)return void(this.viewState.state=o);let r=this.hasFocus,s=0,l=null;e.some((e=>e.annotation(Ua)))?(this.inputState.notifiedFocused=r,s=1):r!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=r,l=Ga(o,r),l||(s=1));let a=this.observer.delayedAndroidKey,c=null;if(a?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(c=null)):this.observer.clear(),o.facet(Ar.phrases)!=this.state.facet(Ar.phrases))return this.setState(o);t=Wl.create(this,o,e),t.flags|=s;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let t of e){if(h&&(h=h.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection;h=new Ol(e.empty?e:Wo.cursor(e.head,e.head>e.anchor?-1:1))}for(let e of t.effects)e.is(Sl)&&(h=e.value.clip(this.state))}this.viewState.update(t,h),this.bidiCache=jc.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),n=this.docView.update(t),this.state.facet(Vl)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some((e=>e.isUserEvent("select.pointer"))))}finally{this.updateState=0}if(t.startState.facet(Oc)!=t.state.facet(Oc)&&(this.viewState.mustMeasureContent=!0),(n||i||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!t.empty)for(let e of this.state.facet(vl))try{e(t)}catch(e){Cl(this.state,e,"update listener")}(l||c)&&Promise.resolve().then((()=>{l&&this.state==l.startState&&this.dispatch(l),c&&!Lc(this,c)&&a.force&&ks(this.contentDOM,a.key,a.keyCode)}))}setState(e){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=e);this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);this.viewState=new mc(e),this.plugins=e.facet(Ml).map((e=>new Dl(e))),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new ra(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Ml),n=e.state.facet(Ml);if(t!=n){let i=[];for(let o of n){let n=t.indexOf(o);if(n<0)i.push(new Dl(o));else{let t=this.plugins[n];t.mustUpdate=e,i.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e<this.plugins.length;e++)this.plugins[e].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.scrollDOM,i=n.scrollTop*this.scaleY,{scrollAnchorPos:o,scrollAnchorHeight:r}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(r=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(r<0)if(Os(n))o=-1,r=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(i);o=e.from,r=e.top}this.updateState=1;let s=this.viewState.measure(this);if(!s&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(e>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let l=[];4&s||([this.measureRequests,l]=[l,this.measureRequests]);let a=l.map((e=>{try{return e.read(this)}catch(e){return Cl(this.state,e),Qc}})),c=Wl.create(this,this.state,[]),h=!1;c.flags|=s,t?t.flags|=s:t=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),h=this.docView.update(c));for(let e=0;e<l.length;e++)if(a[e]!=Qc)try{let t=l[e];t.write&&t.write(a[e],this)}catch(e){Cl(this.state,e)}if(h&&this.docView.updateSelection(!0),!c.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,r=-1;continue}{let e=(o<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(o).top)-r;if(e>1||e<-1){i+=e,n.scrollTop=i/this.scaleY,r=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(vl))e(t)}get themeClasses(){return Cc+" "+(this.state.facet(Sc)?Ac:Ec)+" "+this.state.facet(Oc)}updateAttrs(){let e=qc(this,Pl,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(El)?"true":"false",class:"cm-content",style:`${zs.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),qc(this,Rl,t);let n=this.observer.ignore((()=>{let n=Js(this.contentDOM,this.contentAttrs,t),i=Js(this.dom,this.editorAttrs,e);return n||i}));return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let e of n.effects)e.is(zc.announce)&&(t&&(this.announceDOM.textContent=""),t=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=e.value)}mountStyles(){this.styleModules=this.state.facet(Vl);let e=this.state.facet(zc.cspNonce);Yr.mount(this.root,this.styleModules.concat(Dc).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&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(null!=e.key)for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key)return void(this.measureRequests[t]=e);this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(void 0===t||t&&t.spec!=e)&&this.pluginMap.set(e,t=this.plugins.find((t=>t.spec==e))||null),t&&t.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,t,n){return xa(this,e,wa(this,e,t,n))}moveByGroup(e,t){return xa(this,e,wa(this,e,t,(t=>function(e,t,n){let i=e.state.charCategorizer(t),o=i(n);return e=>{let t=i(e);return o==Sr.Space&&(o=t),o==t}}(this,e.head,t))))}moveToLineBoundary(e,t,n=!0){return function(e,t,n,i){let o=ya(e,t.head),r=i&&o.type==ol.Text&&(e.lineWrapping||o.widgetLineBreaks)?e.coordsAtPos(t.assoc<0&&t.head>o.from?t.head-1:t.head):null;if(r){let t=e.dom.getBoundingClientRect(),i=e.textDirectionAt(o.from),s=e.posAtCoords({x:n==(i==zl.LTR)?t.right-1:t.left+1,y:(r.top+r.bottom)/2});if(null!=s)return Wo.cursor(s,n?-1:1)}return Wo.cursor(n?o.to:o.from,n?-1:1)}(this,e,t,n)}moveVertically(e,t,n){return xa(this,e,function(e,t,n,i){let o=t.head,r=n?1:-1;if(o==(n?e.state.doc.length:0))return Wo.cursor(o,t.assoc);let s,l=t.goalColumn,a=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(o,t.assoc||-1),h=e.documentTop;if(c)null==l&&(l=c.left-a.left),s=r<0?c.top:c.bottom;else{let t=e.viewState.lineBlockAt(o);null==l&&(l=Math.min(a.right-a.left,e.defaultCharacterWidth*(o-t.from))),s=(r<0?t.top:t.bottom)+h}let u=a.left+l,f=null!=i?i:e.viewState.heightOracle.textHeight>>1;for(let t=0;;t+=10){let n=s+(f+t)*r,i=ba(e,{x:u,y:n},!1,r);if(n<a.top||n>a.bottom||(r<0?i<o:i>o)){let t=e.docView.coordsForChar(i),o=!t||n<t.top?-1:1;return Wo.cursor(i,o,void 0,l)}}}(this,e,t,n))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),ba(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let i=this.state.doc.lineAt(e),o=this.bidiSpans(i);return ds(n,o[Kl.find(o,e-i.from,-1,t)].dir==zl.LTR==t>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(kl)||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>Fc)return na(e.length);let t,n=this.textDirectionAt(e.from);for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||Zl(i.isolates,t=Il(this,e.from,e.to))))return i.order;t||(t=Il(this,e.from,e.to));let i=function(e,t,n){if(!e)return[new Kl(0,0,t==Ql?1:0)];if(t==Fl&&!n.length&&!Yl.test(e))return na(e.length);if(n.length)for(;e.length>Jl.length;)Jl[Jl.length]=256;let i=[],o=t==Fl?0:1;return ta(e,o,o,n,0,e.length,i),i}(e.text,n,t);return this.bidiCache.push(new jc(e.from,e.to,n,t,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||zs.safari&&(null===(e=this.inputState)||void 0===e?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{ys(this.contentDOM),this.docView.updateSelection()}))}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((9==e.nodeType?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){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,t={}){return Sl.of(new Ol("number"==typeof e?Wo.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Sl.of(new Ol(Wo.cursor(n.from),"start","start",n.top-e,t,!0))}static domEventHandlers(e){return Tl.define((()=>({})),{eventHandlers:e})}static domEventObservers(e){return Tl.define((()=>({})),{eventObservers:e})}static theme(e,t){let n=Yr.newName(),i=[Oc.of(n),Vl.of(Tc(`.${n}`,e))];return t&&t.dark&&i.push(Sc.of(!0)),i}static baseTheme(e){return Jo.lowest(Vl.of(Tc("."+Cc,e,Mc)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),i=n&&Es.get(n)||Es.get(e);return(null===(t=null==i?void 0:i.rootView)||void 0===t?void 0:t.view)||null}}zc.styleModule=Vl,zc.inputHandler=yl,zc.focusChangeEffect=wl,zc.perLineTextDirection=kl,zc.exceptionSink=bl,zc.updateListener=vl,zc.editable=El,zc.mouseSelectionStyle=gl,zc.dragMovesSelection=ml,zc.clickAddsSelectionRange=pl,zc.decorations=$l,zc.atomicRanges=_l,zc.bidiIsolatedRanges=Bl,zc.scrollMargins=Ll,zc.darkTheme=Sc,zc.cspNonce=Qo.define({combine:e=>e.length?e[0]:""}),zc.contentAttributes=Rl,zc.editorAttributes=Pl,zc.lineWrapping=zc.contentAttributes.of({class:"cm-lineWrapping"}),zc.announce=gr.define();const Fc=4096,Qc={};class jc{constructor(e,t,n,i,o,r){this.from=e,this.to=t,this.dir=n,this.isolates=i,this.fresh=o,this.order=r}static update(e,t){if(t.empty&&!e.some((e=>e.fresh)))return e;let n=[],i=e.length?e[e.length-1].dir:zl.LTR;for(let o=Math.max(0,e.length-10);o<e.length;o++){let r=e[o];r.dir!=i||t.touchesRange(r.from,r.to)||n.push(new jc(t.mapPos(r.from,1),t.mapPos(r.to,-1),r.dir,r.isolates,!1,r.order))}return n}}function qc(e,t,n){for(let i=e.state.facet(t),o=i.length-1;o>=0;o--){let t=i[o],r="function"==typeof t?t(e):t;r&&Ys(r,n)}return n}const Uc=zs.mac?"mac":zs.windows?"win":zs.linux?"linux":"key";function Gc(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}const Xc=Jo.default(zc.domEventHandlers({keydown:(e,t)=>th(Zc(t.state),e,t,"editor")})),Yc=Qo.define({enables:Xc}),Kc=new WeakMap;function Zc(e){let t=e.facet(Yc),n=Kc.get(t);return n||Kc.set(t,n=function(e,t=Uc){let n=Object.create(null),i=Object.create(null),o=(e,t)=>{let n=i[e];if(null==n)i[e]=t;else if(n!=t)throw new Error("Key binding "+e+" is used both as a regular binding and as a multi-stroke prefix")},r=(e,i,r,s,l)=>{var a,c;let h=n[e]||(n[e]=Object.create(null)),u=i.split(/ (?!$)/).map((e=>function(e,t){const n=e.split(/-(?!$)/);let i,o,r,s,l=n[n.length-1];"Space"==l&&(l=" ");for(let e=0;e<n.length-1;++e){const l=n[e];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))i=!0;else if(/^(c|ctrl|control)$/i.test(l))o=!0;else if(/^s(hift)?$/i.test(l))r=!0;else{if(!/^mod$/i.test(l))throw new Error("Unrecognized modifier name: "+l);"mac"==t?s=!0:o=!0}}return i&&(l="Alt-"+l),o&&(l="Ctrl-"+l),s&&(l="Meta-"+l),r&&(l="Shift-"+l),l}(e,t)));for(let t=1;t<u.length;t++){let n=u.slice(0,t).join(" ");o(n,!0),h[n]||(h[n]={preventDefault:!0,stopPropagation:!1,run:[t=>{let i=Jc={view:t,prefix:n,scope:e};return setTimeout((()=>{Jc==i&&(Jc=null)}),eh),!0}]})}let f=u.join(" ");o(f,!1);let d=h[f]||(h[f]={preventDefault:!1,stopPropagation:!1,run:(null===(c=null===(a=h._any)||void 0===a?void 0:a.run)||void 0===c?void 0:c.slice())||[]});r&&d.run.push(r),s&&(d.preventDefault=!0),l&&(d.stopPropagation=!0)};for(let i of e){let e=i.scope?i.scope.split(" "):["editor"];if(i.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||(e._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let t in e)e[t].run.push(i.any)}let o=i[t]||i.key;if(o)for(let t of e)r(t,o,i.run,i.preventDefault,i.stopPropagation),i.shift&&r(t,"Shift-"+o,i.shift,i.preventDefault,i.stopPropagation)}return n}(t.reduce(((e,t)=>e.concat(t)),[]))),n}let Jc=null;const eh=4e3;function th(e,t,n,i){let o=function(e){var t=!(ts&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||ns&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?es:Jr)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(t),r=To(Ao(o,0))==o.length&&" "!=o,s="",l=!1,a=!1,c=!1;Jc&&Jc.view==n&&Jc.scope==i&&(s=Jc.prefix+" ",Ma.indexOf(t.keyCode)<0&&(a=!0,Jc=null));let h,u,f=new Set,d=e=>{if(e){for(let i of e.run)if(!f.has(i)&&(f.add(i),i(n,t)))return e.stopPropagation&&(c=!0),!0;e.preventDefault&&(e.stopPropagation&&(c=!0),a=!0)}return!1},p=e[i];return p&&(d(p[s+Gc(o,t,!r)])?l=!0:r&&(t.altKey||t.metaKey||t.ctrlKey)&&!(zs.windows&&t.ctrlKey&&t.altKey)&&(h=Jr[t.keyCode])&&h!=o?(d(p[s+Gc(h,t,!0)])||t.shiftKey&&(u=es[t.keyCode])!=o&&u!=h&&d(p[s+Gc(u,t,!1)]))&&(l=!0):r&&t.shiftKey&&d(p[s+Gc(o,t,!0)])&&(l=!0),!l&&d(p._any)&&(l=!0)),a&&(l=!0),l&&c&&t.stopPropagation(),l}class nh{constructor(e,t,n,i,o){this.className=e,this.left=t,this.top=n,this.width=i,this.height=o}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className&&(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",null!=this.width&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,n){if(n.empty){let i=e.coordsAtPos(n.head,n.assoc||1);if(!i)return[];let o=ih(e);return[new nh(t,i.left-o.left,i.top-o.top,null,i.bottom-i.top)]}return function(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let i=Math.max(n.from,e.viewport.from),o=Math.min(n.to,e.viewport.to),r=e.textDirection==zl.LTR,s=e.contentDOM,l=s.getBoundingClientRect(),a=ih(e),c=s.querySelector(".cm-line"),h=c&&window.getComputedStyle(c),u=l.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),f=l.right-(h?parseInt(h.paddingRight):0),d=ya(e,i),p=ya(e,o),m=d.type==ol.Text?d:null,g=p.type==ol.Text?p:null;if(m&&(e.lineWrapping||d.widgetLineBreaks)&&(m=oh(e,i,m)),g&&(e.lineWrapping||p.widgetLineBreaks)&&(g=oh(e,o,g)),m&&g&&m.from==g.from)return v(y(n.from,n.to,m));{let t=m?y(n.from,null,m):w(d,!1),i=g?y(null,n.to,g):w(p,!0),o=[];return(m||d).to<(g||p).from-(m&&g?1:0)||d.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2<i.top?o.push(b(u,t.bottom,f,i.top)):t.bottom<i.top&&e.elementAtHeight((t.bottom+i.top)/2).type==ol.Text&&(t.bottom=i.top=(t.bottom+i.top)/2),v(t).concat(o).concat(v(i))}function b(e,n,i,o){return new nh(t,e-a.left,n-a.top-.01,i-e,o-n+.01)}function v({top:e,bottom:t,horizontal:n}){let i=[];for(let o=0;o<n.length;o+=2)i.push(b(n[o],e,n[o+1],t));return i}function y(t,n,i){let o=1e9,s=-1e9,l=[];function a(t,n,a,c,h){let d=e.coordsAtPos(t,t==i.to?-2:2),p=e.coordsAtPos(a,a==i.from?2:-2);d&&p&&(o=Math.min(d.top,p.top,o),s=Math.max(d.bottom,p.bottom,s),h==zl.LTR?l.push(r&&n?u:d.left,r&&c?f:p.right):l.push(!r&&c?u:p.left,!r&&n?f:d.right))}let c=null!=t?t:i.from,h=null!=n?n:i.to;for(let i of e.visibleRanges)if(i.to>c&&i.from<h)for(let o=Math.max(i.from,c),r=Math.min(i.to,h);;){let i=e.state.doc.lineAt(o);for(let s of e.bidiSpans(i)){let e=s.from+i.from,l=s.to+i.from;if(e>=r)break;l>o&&a(Math.max(e,o),null==t&&e<=c,Math.min(l,r),null==n&&l>=h,s.dir)}if(o=i.to+1,o>=r)break}return 0==l.length&&a(c,null==t,h,null==n,e.textDirection),{top:o,bottom:s,horizontal:l}}function w(e,t){let n=l.top+(t?e.top:e.bottom);return{top:n,bottom:n,horizontal:[]}}}(e,t,n)}}function ih(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==zl.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function oh(e,t,n){let i=Wo.cursor(t);return{from:Math.max(n.from,e.moveToLineBoundary(i,!1,!0).from),to:Math.min(n.to,e.moveToLineBoundary(i,!0,!0).from),type:ol.Text}}class rh{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(sh)!=e.state.facet(sh)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}setOrder(e){let t=0,n=e.facet(sh);for(;t<n.length&&n[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;e==this.scaleX&&t==this.scaleY||(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some(((e,t)=>{return n=e,i=this.drawn[t],!(n.constructor==i.constructor&&n.eq(i));var n,i}))){let t=this.dom.firstChild,n=0;for(let i of e)i.update&&t&&i.constructor&&this.drawn[n].constructor&&i.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(i.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const sh=Qo.define();function lh(e){return[Tl.define((t=>new rh(t,e))),sh.of(e)]}const ah=!zs.ios,ch=Qo.define({combine:e=>Mr(e,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})});function hh(e){return e.startState.facet(ch)!=e.state.facet(ch)}const uh=lh({above:!0,markers(e){let{state:t}=e,n=t.facet(ch),i=[];for(let o of t.selection.ranges){let r=o==t.selection.main;if(o.empty?!r||ah:n.drawRangeCursor){let t=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",n=o.empty?o:Wo.cursor(o.head,o.head>o.anchor?-1:1);for(let o of nh.forRange(e,t,n))i.push(o)}}return i},update(e,t){e.transactions.some((e=>e.selection))&&(t.style.animationName="cm-blink"==t.style.animationName?"cm-blink2":"cm-blink");let n=hh(e);return n&&fh(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){fh(t.state,e)},class:"cm-cursorLayer"});function fh(e,t){t.style.animationDuration=e.facet(ch).cursorBlinkRate+"ms"}const dh=lh({above:!1,markers:e=>e.state.selection.ranges.map((t=>t.empty?[]:nh.forRange(e,"cm-selectionBackground",t))).reduce(((e,t)=>e.concat(t))),update:(e,t)=>e.docChanged||e.selectionSet||e.viewportChanged||hh(e),class:"cm-selectionLayer"}),ph={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};ah&&(ph[".cm-line"].caretColor="transparent !important",ph[".cm-content"]={caretColor:"transparent !important"});const mh=Jo.highest(zc.theme(ph)),gh=gr.define({map:(e,t)=>null==e?null:t.mapPos(e)}),bh=Ko.define({create:()=>null,update:(e,t)=>(null!=e&&(e=t.changes.mapPos(e)),t.effects.reduce(((e,t)=>t.is(gh)?t.value:e),e))}),vh=Tl.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let n=e.state.field(bh);null==n?null!=this.cursor&&(null===(t=this.cursor)||void 0===t||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(bh)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(bh),n=null!=t&&e.coordsAtPos(t);if(!n)return null;let i=e.scrollDOM.getBoundingClientRect();return{left:n.left-i.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-i.top+e.scrollDOM.scrollTop*e.scaleY,height:n.bottom-n.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:n}=this.view;e?(this.cursor.style.left=e.left/t+"px",this.cursor.style.top=e.top/n+"px",this.cursor.style.height=e.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(bh)!=e&&this.view.dispatch({effects:gh.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){e.target!=this.view.contentDOM&&this.view.contentDOM.contains(e.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function yh(e,t,n,i,o){t.lastIndex=0;for(let r,s=e.iterRange(n,i),l=n;!s.next().done;l+=s.value.length)if(!s.lineBreak)for(;r=t.exec(s.value);)o(l+r.index,r)}class wh{constructor(e){const{regexp:t,decoration:n,decorate:i,boundary:o,maxLength:r=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,i)this.addMatch=(e,t,n,o)=>i(o,n,n+e[0].length,e,t);else if("function"==typeof n)this.addMatch=(e,t,i,o)=>{let r=n(e,t,i);r&&o(i,i+e[0].length,r)};else{if(!n)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(e,t,i,o)=>o(i,i+e[0].length,n)}this.boundary=o,this.maxLength=r}createDeco(e){let t=new _r,n=t.add.bind(t);for(let{from:t,to:i}of function(e,t){let n=e.visibleRanges;if(1==n.length&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let i=[];for(let{from:o,to:r}of n)o=Math.max(e.state.doc.lineAt(o).from,o-t),r=Math.min(e.state.doc.lineAt(r).to,r+t),i.length&&i[i.length-1].to>=o?i[i.length-1].to=r:i.push({from:o,to:r});return i}(e,this.maxLength))yh(e.state.doc,this.regexp,t,i,((t,i)=>this.addMatch(i,e,t,n)));return t.finish()}updateDeco(e,t){let n=1e9,i=-1;return e.docChanged&&e.changes.iterChanges(((t,o,r,s)=>{s>e.view.viewport.from&&r<e.view.viewport.to&&(n=Math.min(r,n),i=Math.max(s,i))})),e.viewportChanged||i-n>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,t.map(e.changes),n,i):t}updateRange(e,t,n,i){for(let o of e.visibleRanges){let r=Math.max(o.from,n),s=Math.min(o.to,i);if(s>r){let n=e.state.doc.lineAt(r),i=n.to<s?e.state.doc.lineAt(s):n,l=Math.max(o.from,n.from),a=Math.min(o.to,i.to);if(this.boundary){for(;r>n.from;r--)if(this.boundary.test(n.text[r-1-n.from])){l=r;break}for(;s<i.to;s++)if(this.boundary.test(i.text[s-i.from])){a=s;break}}let c,h=[],u=(e,t,n)=>h.push(n.range(e,t));if(n==i)for(this.regexp.lastIndex=l-n.from;(c=this.regexp.exec(n.text))&&c.index<a-n.from;)this.addMatch(c,e,c.index+n.from,u);else yh(e.state.doc,this.regexp,l,a,((t,n)=>this.addMatch(n,e,t,u)));t=t.update({filterFrom:l,filterTo:a,filter:(e,t)=>e<l||t>a,add:h})}}return t}}const kh=null!=/x/.unicode?"gu":"g",xh=new RegExp("[\0-\b\n--\u2028\u2029\ufeff-]",kh),Oh={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Sh=null;const Ch=Qo.define({combine(e){let t=Mr(e,{render:null,specialChars:xh,addSpecialChars:null});return(t.replaceTabs=!function(){var e;if(null==Sh&&"undefined"!=typeof document&&document.body){let t=document.body.style;Sh=null!=(null!==(e=t.tabSize)&&void 0!==e?e:t.MozTabSize)}return Sh||!1}())&&(t.specialChars=new RegExp("\t|"+t.specialChars.source,kh)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,kh)),t}});let Eh=null;class Ah extends il{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=function(e){return e>=32?"•":10==e?"":String.fromCharCode(9216+e)}(this.code),n=e.state.phrase("Control character")+" "+(Oh[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,n,t);if(i)return i;let o=document.createElement("span");return o.textContent=t,o.title=n,o.setAttribute("aria-label",n),o.className="cm-specialChar",o}ignoreEvent(){return!1}}class Mh extends il{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent="\t",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}const Th=rl.line({class:"cm-activeLine"}),Dh=Tl.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let i of e.state.selection.ranges){let o=e.lineBlockAt(i.head);o.from>t&&(n.push(Th.range(o.from)),t=o.from)}return rl.set(n)}},{decorations:e=>e.decorations});class Ph extends il{constructor(e){super(),this.content=e}toDOM(){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?e.setAttribute("aria-label","placeholder "+this.content):e.setAttribute("aria-hidden","true"),e}coordsAt(e){let t=e.firstChild?as(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),i=ds(t[0],"rtl"!=n.direction),o=parseInt(n.lineHeight);return i.bottom-i.top>1.5*o?{left:i.left,right:i.right,top:i.top,bottom:i.top+o}:i}ignoreEvent(){return!1}}const Rh=2e3;function $h(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),i=e.state.doc.lineAt(n),o=n-i.from,r=o>Rh?-1:o==i.length?function(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}(e,t.clientX):jr(i.text,e.state.tabSize,n-i.from);return{line:i.number,col:r,off:o}}const _h={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},Bh={style:"cursor: crosshair"},Ih="-10000px";class Lh{constructor(e,t,n){this.facet=t,this.createTooltipView=n,this.input=e.state.facet(t),this.tooltips=this.input.filter((e=>e)),this.tooltipViews=this.tooltips.map(n)}update(e,t){var n;let i=e.state.facet(this.facet),o=i.filter((e=>e));if(i===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let r=[],s=t?[]:null;for(let n=0;n<o.length;n++){let i=o[n],l=-1;if(i){for(let e=0;e<this.tooltips.length;e++){let t=this.tooltips[e];t&&t.create==i.create&&(l=e)}if(l<0)r[n]=this.createTooltipView(i),s&&(s[n]=!!i.above);else{let i=r[n]=this.tooltipViews[l];s&&(s[n]=t[l]),i.update&&i.update(e)}}}for(let e of this.tooltipViews)r.indexOf(e)<0&&(e.dom.remove(),null===(n=e.destroy)||void 0===n||n.call(e));return t&&(s.forEach(((e,n)=>t[n]=e)),t.length=s.length),this.input=i,this.tooltips=o,this.tooltipViews=r,!0}}function Nh(e){let{win:t}=e;return{top:0,left:0,bottom:t.innerHeight,right:t.innerWidth}}const Vh=Qo.define({combine:e=>{var t,n,i;return{position:zs.ios?"absolute":(null===(t=e.find((e=>e.position)))||void 0===t?void 0:t.position)||"fixed",parent:(null===(n=e.find((e=>e.parent)))||void 0===n?void 0:n.parent)||null,tooltipSpace:(null===(i=e.find((e=>e.tooltipSpace)))||void 0===i?void 0:i.tooltipSpace)||Nh}}}),Hh=new WeakMap,Wh=Tl.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(Vh);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new Lh(e,Qh,(e=>this.createTooltip(e))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,i=e.state.facet(Vh);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e){let t=e.create(this.view);if(t.dom.classList.add("cm-tooltip"),e.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let e=document.createElement("div");e.className="cm-tooltip-arrow",t.dom.appendChild(e)}return t.dom.style.position=this.position,t.dom.style.top=Ih,t.dom.style.left="0px",this.container.appendChild(t.dom),t.mount&&t.mount(this.view),t}destroy(){var e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),null===(e=t.destroy)||void 0===e||e.call(t);this.parent&&this.container.remove(),null===(t=this.intersectionObserver)||void 0===t||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=this.view.dom.getBoundingClientRect(),t=1,n=1,i=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(zs.gecko)i=e.offsetParent!=this.container.ownerDocument.body;else if(e.style.top==Ih&&"0px"==e.style.left){let t=e.getBoundingClientRect();i=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}}if(i||"absolute"==this.position)if(this.parent){let e=this.parent.getBoundingClientRect();e.width&&e.height&&(t=e.width/this.parent.offsetWidth,n=e.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:n}=this.view.viewState);return{editor:e,parent:this.parent?this.container.getBoundingClientRect():e,pos:this.manager.tooltips.map(((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)})),size:this.manager.tooltipViews.map((({dom:e})=>e.getBoundingClientRect())),space:this.view.state.facet(Vh).tooltipSpace(this.view),scaleX:t,scaleY:n,makeAbsolute:i}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let e of this.manager.tooltipViews)e.dom.style.position="absolute"}let{editor:n,space:i,scaleX:o,scaleY:r}=e,s=[];for(let l=0;l<this.manager.tooltips.length;l++){let a=this.manager.tooltips[l],c=this.manager.tooltipViews[l],{dom:h}=c,u=e.pos[l],f=e.size[l];if(!u||u.bottom<=Math.max(n.top,i.top)||u.top>=Math.min(n.bottom,i.bottom)||u.right<Math.max(n.left,i.left)-.1||u.left>Math.min(n.right,i.right)+.1){h.style.top=Ih;continue}let d=a.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,m=f.right-f.left,g=null!==(t=Hh.get(c))&&void 0!==t?t:f.bottom-f.top,b=c.offset||Fh,v=this.view.textDirection==zl.LTR,y=f.width>i.right-i.left?v?i.left:i.right-f.width:v?Math.min(u.left-(d?14:0)+b.x,i.right-m):Math.max(i.left,u.left-m+(d?14:0)-b.x),w=this.above[l];!a.strictSide&&(w?u.top-(f.bottom-f.top)-b.y<i.top:u.bottom+(f.bottom-f.top)+b.y>i.bottom)&&w==i.bottom-u.bottom>u.top-i.top&&(w=this.above[l]=!w);let k=(w?u.top-i.top:i.bottom-u.bottom)-p;if(k<g&&!1!==c.resize){if(k<this.view.defaultLineHeight){h.style.top=Ih;continue}Hh.set(c,g),h.style.height=(g=k)/r+"px"}else h.style.height&&(h.style.height="");let x=w?u.top-g-p-b.y:u.bottom+p+b.y,O=y+m;if(!0!==c.overlap)for(let e of s)e.left<O&&e.right>y&&e.top<x+g&&e.bottom>x&&(x=w?e.top-g-2-p:e.bottom+p+2);if("absolute"==this.position?(h.style.top=(x-e.parent.top)/r+"px",h.style.left=(y-e.parent.left)/o+"px"):(h.style.top=x/r+"px",h.style.left=y/o+"px"),d){let e=u.left+(v?b.x:-b.x)-(y+14-7);d.style.left=e/o+"px"}!0!==c.overlap&&s.push({left:y,top:x,right:O,bottom:x+g}),h.classList.toggle("cm-tooltip-above",w),h.classList.toggle("cm-tooltip-below",!w),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=Ih}},{eventObservers:{scroll(){this.maybeMeasure()}}}),zh=zc.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Fh={x:0,y:0},Qh=Qo.define({enables:[Wh,zh]}),jh=Qo.define();class qh{static create(e){return new qh(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Lh(e,jh,(e=>this.createHostedView(e)))}createHostedView(e){let t=e.create(this.view);return t.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(t.dom),this.mounted&&t.mount&&t.mount(this.view),t}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)null===(e=t.destroy)||void 0===e||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let i=n[e];if(void 0!==i)if(void 0===t)t=i;else if(t!==i)return}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const Uh=Qh.compute([jh],(e=>{let t=e.facet(jh).filter((e=>e));return 0===t.length?null:{pos:Math.min(...t.map((e=>e.pos))),end:Math.max(...t.map((e=>{var t;return null!==(t=e.end)&&void 0!==t?t:e.pos}))),create:qh.create,above:t[0].above,arrow:t.some((e=>e.arrow))}}));class Gh{constructor(e,t,n,i,o){this.view=e,this.source=t,this.field=n,this.setHover=i,this.hoverTime=o,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout((()=>this.startHover()),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,n=e.docView.nearest(t.target);if(!n)return;let i,o=1;if(n instanceof js)i=n.posAtStart;else{if(i=e.posAtCoords(t),null==i)return;let n=e.coordsAtPos(i);if(!n||t.y<n.top||t.y>n.bottom||t.x<n.left-e.defaultCharacterWidth||t.x>n.right+e.defaultCharacterWidth)return;let r=e.bidiSpans(e.state.doc.lineAt(i)).find((e=>e.from<=i&&e.to>=i)),s=r&&r.dir==zl.RTL?-1:1;o=t.x<n.left?-s:s}let r=this.source(e,i,o);if(null==r?void 0:r.then){let t=this.pending={pos:i};r.then((n=>{this.pending==t&&(this.pending=null,n&&e.dispatch({effects:this.setHover.of(n)}))}),(t=>Cl(e.state,t,"hover tooltip")))}else r&&e.dispatch({effects:this.setHover.of(r)})}get tooltip(){let e=this.view.plugin(Wh),t=e?e.manager.tooltips.findIndex((e=>e.create==qh.create)):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:n,tooltip:i}=this;if(n&&i&&!function(e,t){let n=e.getBoundingClientRect();return t.clientX>=n.left-Xh&&t.clientX<=n.right+Xh&&t.clientY>=n.top-Xh&&t.clientY<=n.bottom+Xh}(i.dom,e)||this.pending){let{pos:i}=n||this.pending,o=null!==(t=null==n?void 0:n.end)&&void 0!==t?t:i;(i==o?this.view.posAtCoords(this.lastMove)==i:function(e,t,n,i,o,r){let s=e.scrollDOM.getBoundingClientRect(),l=e.documentTop+e.documentPadding.top+e.contentHeight;if(s.left>i||s.right<i||s.top>o||Math.min(s.bottom,l)<o)return!1;let a=e.posAtCoords({x:i,y:o},!1);return a>=t&&a<=n}(this.view,i,o,e.clientX,e.clientY))||(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t){let{tooltip:t}=this;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of(null)})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener("mouseleave",t),this.active&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Xh=4;function Yh(e,t={}){let n=gr.define(),i=Ko.define({create:()=>null,update(e,i){if(e&&(t.hideOnChange&&(i.docChanged||i.selection)||t.hideOn&&t.hideOn(i,e)))return null;if(e&&i.docChanged){let t=i.changes.mapPos(e.pos,-1,Po.TrackDel);if(null==t)return null;let n=Object.assign(Object.create(null),e);n.pos=t,null!=e.end&&(n.end=i.changes.mapPos(e.end)),e=n}for(let t of i.effects)t.is(n)&&(e=t.value),t.is(Zh)&&(e=null);return e},provide:e=>jh.from(e)});return[i,Tl.define((o=>new Gh(o,e,i,n,t.hoverTime||300))),Uh]}function Kh(e,t){let n=e.plugin(Wh);if(!n)return null;let i=n.manager.tooltips.indexOf(t);return i<0?null:n.manager.tooltipViews[i]}const Zh=gr.define(),Jh=Qo.define({combine(e){let t,n;for(let i of e)t=t||i.topContainer,n=n||i.bottomContainer;return{topContainer:t,bottomContainer:n}}});function eu(e,t){let n=e.plugin(tu),i=n?n.specs.indexOf(t):-1;return i>-1?n.panels[i]:null}const tu=Tl.fromClass(class{constructor(e){this.input=e.state.facet(ou),this.specs=this.input.filter((e=>e)),this.panels=this.specs.map((t=>t(e)));let t=e.state.facet(Jh);this.top=new nu(e,!0,t.topContainer),this.bottom=new nu(e,!1,t.bottomContainer),this.top.sync(this.panels.filter((e=>e.top))),this.bottom.sync(this.panels.filter((e=>!e.top)));for(let e of this.panels)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}update(e){let t=e.state.facet(Jh);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new nu(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new nu(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(ou);if(n!=this.input){let t=n.filter((e=>e)),i=[],o=[],r=[],s=[];for(let n of t){let t,l=this.specs.indexOf(n);l<0?(t=n(e.view),s.push(t)):(t=this.panels[l],t.update&&t.update(e)),i.push(t),(t.top?o:r).push(t)}this.specs=t,this.panels=i,this.top.sync(o),this.bottom.sync(r);for(let e of s)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>zc.scrollMargins.of((t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}}))});class nu{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=iu(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=iu(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function iu(e){let t=e.nextSibling;return e.remove(),t}const ou=Qo.define({enables:tu});class ru extends Tr{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}ru.prototype.elementClass="",ru.prototype.toDOM=void 0,ru.prototype.mapMode=Po.TrackBefore,ru.prototype.startSide=ru.prototype.endSide=-1,ru.prototype.point=!0;const su=Qo.define(),lu={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>$r.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},au=Qo.define();function cu(e){return[uu(),au.of(Object.assign(Object.assign({},lu),e))]}const hu=Qo.define({combine:e=>e.some((e=>e))});function uu(e){let t=[fu];return e&&!1===e.fixed&&t.push(hu.of(!0)),t}const fu=Tl.fromClass(class{constructor(e){this.view=e,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(au).map((t=>new gu(e,t)));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!e.state.facet(hu),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,i=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(i<.8*(n.to-n.from))}e.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(hu)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&this.dom.remove();let n=$r.iter(this.view.state.facet(su),this.view.viewport.from),i=[],o=this.gutters.map((e=>new mu(e,this.view.viewport,-this.view.documentPadding.top)));for(let e of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(e.type)){let t=!0;for(let r of e.type)if(r.type==ol.Text&&t){pu(n,i,r.from);for(let e of o)e.line(this.view,r,i);t=!1}else if(r.widget)for(let e of o)e.widget(this.view,r)}else if(e.type==ol.Text){pu(n,i,e.from);for(let t of o)t.line(this.view,e,i)}else if(e.widget)for(let t of o)t.widget(this.view,e);for(let e of o)e.finish();e&&this.view.scrollDOM.insertBefore(this.dom,t)}updateGutters(e){let t=e.startState.facet(au),n=e.state.facet(au),i=e.docChanged||e.heightChanged||e.viewportChanged||!$r.eq(e.startState.facet(su),e.state.facet(su),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(i=!0);else{i=!0;let o=[];for(let i of n){let n=t.indexOf(i);n<0?o.push(new gu(this.view,i)):(this.gutters[n].update(e),o.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),o.indexOf(e)<0&&e.destroy();for(let e of o)this.dom.appendChild(e.dom);this.gutters=o}return i}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove()}},{provide:e=>zc.scrollMargins.of((t=>{let n=t.plugin(e);return n&&0!=n.gutters.length&&n.fixed?t.textDirection==zl.LTR?{left:n.dom.offsetWidth*t.scaleX}:{right:n.dom.offsetWidth*t.scaleX}:null}))});function du(e){return Array.isArray(e)?e:[e]}function pu(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class mu{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=$r.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:i}=this,o=(t.top-this.height)/e.scaleY,r=t.height/e.scaleY;if(this.i==i.elements.length){let t=new bu(e,r,o,n);i.elements.push(t),i.dom.appendChild(t.dom)}else i.elements[this.i].update(e,r,o,n);this.height=t.bottom,this.i++}line(e,t,n){let i=[];pu(this.cursor,i,t.from),n.length&&(i=i.concat(n));let o=this.gutter.config.lineMarker(e,t,i);o&&i.unshift(o);let r=this.gutter;(0!=i.length||r.config.renderEmptyElements)&&this.addElement(e,t,i)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t);n&&this.addElement(e,t,[n])}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class gu{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,(i=>{let o,r=i.target;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let e=r.getBoundingClientRect();o=(e.top+e.bottom)/2}else o=i.clientY;let s=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[n](e,s,i)&&i.preventDefault()}));this.markers=du(t.markers(e)),t.initialSpacer&&(this.spacer=new bu(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=du(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!$r.eq(this.markers,t,n.from,n.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}destroy(){for(let e of this.elements)e.destroy()}}class bu{constructor(e,t,n,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,i)}update(e,t,n,i){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),function(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].compare(t[n]))return!1;return!0}(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,t){let n="cm-gutterElement",i=this.dom.firstChild;for(let o=0,r=0;;){let s=r,l=o<t.length?t[o++]:null,a=!1;if(l){let e=l.elementClass;e&&(n+=" "+e);for(let e=r;e<this.markers.length;e++)if(this.markers[e].compare(l)){s=e,a=!0;break}}else s=this.markers.length;for(;r<s;){let e=this.markers[r++];if(e.toDOM){e.destroy(i);let t=i.nextSibling;i.remove(),i=t}}if(!l)break;l.toDOM&&(a?i=i.nextSibling:this.dom.insertBefore(l.toDOM(e),i)),a&&r++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}const vu=Qo.define(),yu=Qo.define({combine:e=>Mr(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let e in t){let i=n[e],o=t[e];n[e]=i?(e,t,n)=>i(e,t,n)||o(e,t,n):o}return n}})});class wu extends ru{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function ku(e,t){return e.state.facet(yu).formatNumber(t,e.state)}const xu=au.compute([yu],(e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:e=>e.state.facet(vu),lineMarker:(e,t,n)=>n.some((e=>e.toDOM))?null:new wu(ku(e,e.state.doc.lineAt(t.from).number)),widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet(yu)!=e.state.facet(yu),initialSpacer:e=>new wu(ku(e,Ou(e.state.doc.lines))),updateSpacer(e,t){let n=ku(t.view,Ou(t.view.state.doc.lines));return n==e.number?e:new wu(n)},domEventHandlers:e.facet(yu).domEventHandlers})));function Ou(e){let t=9;for(;t<e;)t=10*t+9;return t}const Su=new class extends ru{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},Cu=su.compute(["selection"],(e=>{let t=[],n=-1;for(let i of e.selection.ranges){let o=e.doc.lineAt(i.head).from;o>n&&(n=o,t.push(Su.range(o)))}return $r.of(t)})),Eu=1024;let Au=0;class Mu{constructor(e,t){this.from=e,this.to=t}}class Tu{constructor(e={}){this.id=Au++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=Ru.match(e)),t=>{let n=e(t);return void 0===n?null:[this,n]}}}Tu.closedBy=new Tu({deserialize:e=>e.split(" ")}),Tu.openedBy=new Tu({deserialize:e=>e.split(" ")}),Tu.group=new Tu({deserialize:e=>e.split(" ")}),Tu.contextHash=new Tu({perNode:!0}),Tu.lookAhead=new Tu({perNode:!0}),Tu.mounted=new Tu({perNode:!0});class Du{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[Tu.mounted.id]}}const Pu=Object.create(null);class Ru{constructor(e,t,n,i=0){this.name=e,this.props=t,this.id=n,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):Pu,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),i=new Ru(e.name||"",t,e.id,n);if(e.props)for(let n of e.props)if(Array.isArray(n)||(n=n(i)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}return i}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(Tu.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let i of n.split(" "))t[i]=e[n];return e=>{for(let n=e.prop(Tu.group),i=-1;i<(n?n.length:0);i++){let o=t[i<0?e.name:n[i]];if(o)return o}}}}Ru.none=new Ru("",Object.create(null),0,8);class $u{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let i=null;for(let t of e){let e=t(n);e&&(i||(i=Object.assign({},n.props)),i[e[0].id]=e[1])}t.push(i?new Ru(n.name,i,n.id,n.flags):n)}return new $u(t)}}const _u=new WeakMap,Bu=new WeakMap;var Iu;!function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays"}(Iu||(Iu={}));class Lu{constructor(e,t,n,i,o){if(this.type=e,this.children=t,this.positions=n,this.length=i,this.props=null,o&&o.length){this.props=Object.create(null);for(let[e,t]of o)this.props["number"==typeof e?e:e.id]=t}}toString(){let e=Du.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let e of this.children){let n=e.toString();n&&(t&&(t+=","),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new Yu(this.topNode,e)}cursorAt(e,t=0,n=0){let i=_u.get(this)||this.topNode,o=new Yu(i);return o.moveTo(e,t),_u.set(this,o._tree),o}get topNode(){return new Fu(this,0,0,null)}resolve(e,t=0){let n=Wu(_u.get(this)||this.topNode,e,t,!1);return _u.set(this,n),n}resolveInner(e,t=0){let n=Wu(Bu.get(this)||this.topNode,e,t,!0);return Bu.set(this,n),n}resolveStack(e,t=0){return function(e,t,n){let i=e.resolveInner(t,n),o=null;for(let e=i instanceof Fu?i:i.context.parent;e;e=e.parent)if(e.index<0){let r=e.parent;(o||(o=[i])).push(r.resolve(t,n)),e=r}else{let r=Du.get(e.tree);if(r&&r.overlay&&r.overlay[0].from<=t&&r.overlay[r.overlay.length-1].to>=t){let s=new Fu(r.tree,r.overlay[0].from+e.from,-1,e);(o||(o=[i])).push(Wu(s,t,n,!1))}}return o?Gu(o):i}(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:o=this.length}=e,r=e.mode||0,s=(r&Iu.IncludeAnonymous)>0;for(let e=this.cursor(r|Iu.IncludeAnonymous);;){let r=!1;if(e.from<=o&&e.to>=i&&(!s&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;r=!0}for(;r&&n&&(s||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;r=!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 t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:ef(Ru.none,this.children,this.positions,0,this.children.length,0,this.length,((e,t,n)=>new Lu(this.type,e,t,n,this.propValues)),e.makeTree||((e,t,n)=>new Lu(Ru.none,e,t,n)))}static build(e){return function(e){var t;let{buffer:n,nodeSet:i,maxBufferLength:o=Eu,reused:r=[],minRepeatType:s=i.types.length}=e,l=Array.isArray(n)?new Nu(n,n.length):n,a=i.types,c=0,h=0;function u(e,t,n,g,b,v){let{id:y,start:w,end:k,size:x}=l,O=h;for(;x<0;){if(l.next(),-1==x){let t=r[y];return n.push(t),void g.push(w-e)}if(-3==x)return void(c=y);if(-4==x)return void(h=y);throw new RangeError(`Unrecognized record size: ${x}`)}let S,C,E=a[y],A=w-e;if(k-w<=o&&(C=function(e,t){let n=l.fork(),i=0,r=0,a=0,c=n.end-o,h={size:0,start:0,skip:0};e:for(let o=n.pos-e;n.pos>o;){let e=n.size;if(n.id==t&&e>=0){h.size=i,h.start=r,h.skip=a,a+=4,i+=4,n.next();continue}let l=n.pos-e;if(e<0||l<o||n.start<c)break;let u=n.id>=s?4:0,f=n.start;for(n.next();n.pos>l;){if(n.size<0){if(-3!=n.size)break e;u+=4}else n.id>=s&&(u+=4);n.next()}r=f,i+=e,a+=u}return(t<0||i==e)&&(h.size=i,h.start=r,h.skip=a),h.size>4?h:void 0}(l.pos-t,b))){let t=new Uint16Array(C.size-C.skip),n=l.pos-C.size,o=t.length;for(;l.pos>n;)o=m(C.start,t,o);S=new Vu(t,k-C.start,i),A=C.start-e}else{let e=l.pos-x;l.next();let t=[],n=[],i=y>=s?y:-1,r=0,a=k;for(;l.pos>e;)i>=0&&l.id==i&&l.size>=0?(l.end<=a-o&&(d(t,n,w,r,l.end,a,i,O),r=t.length,a=l.end),l.next()):v>2500?f(w,e,t,n):u(w,e,t,n,i,v+1);if(i>=0&&r>0&&r<t.length&&d(t,n,w,r,w,a,i,O),t.reverse(),n.reverse(),i>-1&&r>0){let e=function(e){return(t,n,i)=>{let o,r,s=0,l=t.length-1;if(l>=0&&(o=t[l])instanceof Lu){if(!l&&o.type==e&&o.length==i)return o;(r=o.prop(Tu.lookAhead))&&(s=n[l]+o.length+r)}return p(e,t,n,i,s)}}(E);S=ef(E,t,n,0,t.length,0,k-w,e,e)}else S=p(E,t,n,k-w,O-k)}n.push(S),g.push(A)}function f(e,t,n,r){let s=[],a=0,c=-1;for(;l.pos>t;){let{id:e,start:t,end:n,size:i}=l;if(i>4)l.next();else{if(c>-1&&t<c)break;c<0&&(c=n-o),s.push(e,t,n),a++,l.next()}}if(a){let t=new Uint16Array(4*a),o=s[s.length-2];for(let e=s.length-3,n=0;e>=0;e-=3)t[n++]=s[e],t[n++]=s[e+1]-o,t[n++]=s[e+2]-o,t[n++]=n;n.push(new Vu(t,s[2]-o,i)),r.push(o-e)}}function d(e,t,n,o,r,s,l,a){let c=[],h=[];for(;e.length>o;)c.push(e.pop()),h.push(t.pop()+n-r);e.push(p(i.types[l],c,h,s-r,a-s)),t.push(r-n)}function p(e,t,n,i,o=0,r){if(c){let e=[Tu.contextHash,c];r=r?[e].concat(r):[e]}if(o>25){let e=[Tu.lookAhead,o];r=r?[e].concat(r):[e]}return new Lu(e,t,n,i,r)}function m(e,t,n){let{id:i,start:o,end:r,size:a}=l;if(l.next(),a>=0&&i<s){let s=n;if(a>4){let i=l.pos-(a-4);for(;l.pos>i;)n=m(e,t,n)}t[--n]=s,t[--n]=r-e,t[--n]=o-e,t[--n]=i}else-3==a?c=i:-4==a&&(h=i);return n}let g=[],b=[];for(;l.pos>0;)u(e.start||0,e.bufferStart||0,g,b,-1,0);let v=null!==(t=e.length)&&void 0!==t?t:g.length?b[0]+g[0].length:0;return new Lu(a[e.topID],g.reverse(),b.reverse(),v)}(e)}}Lu.empty=new Lu(Ru.none,[],[],0);class Nu{constructor(e,t){this.buffer=e,this.index=t}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 Nu(this.buffer,this.index)}}class Vu{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Ru.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],i=this.set.types[t],o=i.name;if(/\W/.test(o)&&!i.isError&&(o=JSON.stringify(o)),n==(e+=4))return o;let r=[];for(;e<n;)r.push(this.childString(e)),e=this.buffer[e+3];return o+"("+r.join(",")+")"}findChild(e,t,n,i,o){let{buffer:r}=this,s=-1;for(let l=e;l!=t&&!(Hu(o,i,r[l+1],r[l+2])&&(s=l,n>0));l=r[l+3]);return s}slice(e,t,n){let i=this.buffer,o=new Uint16Array(t-e),r=0;for(let s=e,l=0;s<t;){o[l++]=i[s++],o[l++]=i[s++]-n;let t=o[l++]=i[s++]-n;o[l++]=i[s++]-e,r=Math.max(r,t)}return new Vu(o,r,this.set)}}function Hu(e,t,n,i){switch(e){case-2:return n<t;case-1:return i>=t&&n<t;case 0:return n<t&&i>t;case 1:return n<=t&&i>t;case 2:return i>t;case 4:return!0}}function Wu(e,t,n,i){for(var o;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!i&&e instanceof Fu&&e.index<0?null:e.parent;if(!t)return e;e=t}let r=i?0:Iu.IgnoreOverlays;if(i)for(let i=e,s=i.parent;s;i=s,s=i.parent)i instanceof Fu&&i.index<0&&(null===(o=s.enter(t,n,r))||void 0===o?void 0:o.from)!=i.from&&(e=s);for(;;){let i=e.enter(t,n,r);if(!i)return e;e=i}}class zu{cursor(e=0){return new Yu(this,e)}getChild(e,t=null,n=null){let i=Qu(this,e,t,n);return i.length?i[0]:null}getChildren(e,t=null,n=null){return Qu(this,e,t,n)}resolve(e,t=0){return Wu(this,e,t,!1)}resolveInner(e,t=0){return Wu(this,e,t,!0)}matchContext(e){return ju(this,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}}class Fu extends zu{constructor(e,t,n,i){super(),this._tree=e,this.from=t,this.index=n,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,i,o=0){for(let r=this;;){for(let{children:s,positions:l}=r._tree,a=t>0?s.length:-1;e!=a;e+=t){let a=s[e],c=l[e]+r.from;if(Hu(i,n,c,c+a.length))if(a instanceof Vu){if(o&Iu.ExcludeBuffers)continue;let s=a.findChild(0,a.buffer.length,t,n-c,i);if(s>-1)return new Uu(new qu(r,a,e,c),null,s)}else if(o&Iu.IncludeAnonymous||!a.type.isAnonymous||Ku(a)){let s;if(!(o&Iu.IgnoreMounts)&&(s=Du.get(a))&&!s.overlay)return new Fu(s.tree,c,e,r);let l=new Fu(a,c,e,r);return o&Iu.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(t<0?a.children.length-1:0,t,n,i)}}if(o&Iu.IncludeAnonymous||!r.type.isAnonymous)return null;if(e=r.index>=0?r.index+t:t<0?-1:r._parent._tree.children.length,r=r._parent,!r)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,n=0){let i;if(!(n&Iu.IgnoreOverlays)&&(i=Du.get(this._tree))&&i.overlay){let n=e-this.from;for(let{from:e,to:o}of i.overlay)if((t>0?e<=n:e<n)&&(t<0?o>=n:o>n))return new Fu(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}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 Qu(e,t,n,i){let o=e.cursor(),r=[];if(!o.firstChild())return r;if(null!=n)for(;!o.type.is(n);)if(!o.nextSibling())return r;for(;;){if(null!=i&&o.type.is(i))return r;if(o.type.is(t)&&r.push(o.node),!o.nextSibling())return null==i?r:[]}}function ju(e,t,n=t.length-1){for(let i=e.parent;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(t[n]&&t[n]!=i.name)return!1;n--}}return!0}class qu{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}}class Uu extends zu{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,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:i}=this.context,o=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,n);return o<0?null:new Uu(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,n=0){if(n&Iu.ExcludeBuffers)return null;let{buffer:i}=this.context,o=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return o<0?null:new Uu(this.context,this,o)}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,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Uu(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Uu(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,i=this.index+4,o=n.buffer[this.index+3];if(o>i){let r=n.buffer[this.index+1];e.push(n.slice(i,o,r)),t.push(0)}return new Lu(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Gu(e){if(!e.length)return null;let t=0,n=e[0];for(let i=1;i<e.length;i++){let o=e[i];(o.from>n.from||o.to<n.to)&&(n=o,t=i)}let i=n instanceof Fu&&n.index<0?null:n.parent,o=e.slice();return i?o[t]=i:o.splice(t,1),new Xu(o,n)}class Xu{constructor(e,t){this.heads=e,this.node=t}get next(){return Gu(this.heads)}}class Yu{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Fu)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.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)}yieldBuf(e,t){this.index=e;let{start:n,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=n+i.buffer[e+1],this.to=n+i.buffer[e+2],!0}yield(e){return!!e&&(e instanceof Fu?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:i}=this.buffer,o=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,n);return!(o<0)&&(this.stack.push(this.index),this.yieldBuf(o))}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,t,n=this.mode){return this.buffer?!(n&Iu.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Iu.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Iu.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));let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(i.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=i)}else({index:t,_parent:n}=this._tree);for(;n;({index:t,_parent:n}=n))if(t>-1)for(let i=t+e,o=e<0?-1:n._tree.children.length;i!=o;i+=e){let e=n._tree.children[i];if(this.mode&Iu.IncludeAnonymous||e instanceof Vu||!e.type.isAnonymous||Ku(e))return!1}return!0}move(e,t){if(t&&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,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let i=this.index,o=this.stack.length;o>=0;){for(let r=e;r;r=r._parent)if(r.index==i){if(i==this.index)return r;t=r,n=o+1;break e}i=this.stack[--o]}for(let e=n;e<this.stack.length;e++)t=new Uu(this.buffer,t,this.stack[e]);return this.bufferNode=new Uu(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let i=!1;if(this.type.isAnonymous||!1!==e(this)){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;i&&t&&t(this),i=this.type.isAnonymous,!this.nextSibling();){if(!n)return;this.parent(),n--,i=!0}}}matchContext(e){if(!this.buffer)return ju(this.node,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let i=e.length-1,o=this.stack.length-1;i>=0;o--){if(o<0)return ju(this.node,e,i);let r=n[t.buffer[this.stack[o]]];if(!r.isAnonymous){if(e[i]&&e[i]!=r.name)return!1;i--}}return!0}}function Ku(e){return e.children.some((e=>e instanceof Vu||!e.type.isAnonymous||Ku(e)))}const Zu=new WeakMap;function Ju(e,t){if(!e.isAnonymous||t instanceof Vu||t.type!=e)return 1;let n=Zu.get(t);if(null==n){n=1;for(let i of t.children){if(i.type!=e||!(i instanceof Lu)){n=1;break}n+=Ju(e,i)}Zu.set(t,n)}return n}function ef(e,t,n,i,o,r,s,l,a){let c=0;for(let n=i;n<o;n++)c+=Ju(e,t[n]);let h=Math.ceil(1.5*c/8),u=[],f=[];return function t(n,i,o,s,l){for(let c=o;c<s;){let o=c,d=i[c],p=Ju(e,n[c]);for(c++;c<s;c++){let t=Ju(e,n[c]);if(p+t>=h)break;p+=t}if(c==o+1){if(p>h){let e=n[o];t(e.children,e.positions,0,e.children.length,i[o]+l);continue}u.push(n[o])}else{let t=i[c-1]+n[c-1].length-d;u.push(ef(e,n,i,o,c,d,t,null,a))}f.push(d+l-r)}}(t,n,i,o,0),(l||a)(u,f,s)}class tf{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof Uu?this.setBuffer(e.context.buffer,e.index,t):e instanceof Fu&&this.map.set(e.tree,t)}get(e){return e instanceof Uu?this.getBuffer(e.context.buffer,e.index):e instanceof Fu?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class nf{constructor(e,t,n,i,o=!1,r=!1){this.from=e,this.to=t,this.tree=n,this.offset=i,this.open=(o?1:0)|(r?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],n=!1){let i=[new nf(0,e.length,e,0,!1,n)];for(let n of t)n.to>e.length&&i.push(n);return i}static applyChanges(e,t,n=128){if(!t.length)return e;let i=[],o=1,r=e.length?e[0]:null;for(let s=0,l=0,a=0;;s++){let c=s<t.length?t[s]:null,h=c?c.fromA:1e9;if(h-l>=n)for(;r&&r.from<h;){let t=r;if(l>=t.from||h<=t.to||a){let e=Math.max(t.from,l)-a,n=Math.min(t.to,h)-a;t=e>=n?null:new nf(e,n,t.tree,t.offset+a,s>0,!!c)}if(t&&i.push(t),r.to>h)break;r=o<e.length?e[o++]:null}if(!c)break;l=c.toA,a=c.toA-c.toB}return i}}class of{startParse(e,t,n){return"string"==typeof e&&(e=new rf(e)),n=n?n.length?n.map((e=>new Mu(e.from,e.to))):[new Mu(0,0)]:[new Mu(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let i=this.startParse(e,t,n);for(;;){let e=i.advance();if(e)return e}}}class rf{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new Tu({perNode:!0});let sf=0;class lf{constructor(e,t,n){this.set=e,this.base=t,this.modified=n,this.id=sf++}static define(e){if(null==e?void 0:e.base)throw new Error("Can not derive from a modified tag");let t=new lf([],null,[]);if(t.set.push(t),e)for(let n of e.set)t.set.push(n);return t}static defineModifier(){let e=new cf;return t=>t.modified.indexOf(e)>-1?t:cf.get(t.base||t,t.modified.concat(e).sort(((e,t)=>e.id-t.id)))}}let af=0;class cf{constructor(){this.instances=[],this.id=af++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find((n=>{return n.base==e&&(i=t,o=n.modified,i.length==o.length&&i.every(((e,t)=>e==o[t])));var i,o}));if(n)return n;let i=[],o=new lf(i,e,t);for(let e of t)e.instances.push(o);let r=function(e){let t=[[]];for(let n=0;n<e.length;n++)for(let i=0,o=t.length;i<o;i++)t.push(t[i].concat(e[n]));return t.sort(((e,t)=>t.length-e.length))}(t);for(let t of e.set)if(!t.modified.length)for(let e of r)i.push(cf.get(t,e));return o}}function hf(e){let t=Object.create(null);for(let n in e){let i=e[n];Array.isArray(i)||(i=[i]);for(let e of n.split(" "))if(e){let n=[],o=2,r=e;for(let t=0;;){if("..."==r&&t>0&&t+3==e.length){o=1;break}let i=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(r);if(!i)throw new RangeError("Invalid path: "+e);if(n.push("*"==i[0]?"":'"'==i[0][0]?JSON.parse(i[0]):i[0]),t+=i[0].length,t==e.length)break;let s=e[t++];if(t==e.length&&"!"==s){o=0;break}if("/"!=s)throw new RangeError("Invalid path: "+e);r=e.slice(t)}let s=n.length-1,l=n[s];if(!l)throw new RangeError("Invalid path: "+e);let a=new ff(i,o,s>0?n.slice(0,s):null);t[l]=a.sort(t[l])}}return uf.add(t)}const uf=new Tu;class ff{constructor(e,t,n,i){this.tags=e,this.mode=t,this.context=n,this.next=i}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}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}}function df(e,t){let n=Object.create(null);for(let t of e)if(Array.isArray(t.tag))for(let e of t.tag)n[e.id]=t.class;else n[t.tag.id]=t.class;let{scope:i,all:o=null}=t||{};return{style:e=>{let t=o;for(let i of e)for(let e of i.set){let i=n[e.id];if(i){t=t?t+" "+i:i;break}}return t},scope:i}}function pf(e,t,n,i=0,o=e.length){let r=new mf(i,Array.isArray(t)?t:[t],n);r.highlightRange(e.cursor(),i,o,"",r.highlighters),r.flush(o)}ff.empty=new ff([],2,null);class mf{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,i,o){let{type:r,from:s,to:l}=e;if(s>=n||l<=t)return;r.isTop&&(o=this.highlighters.filter((e=>!e.scope||e.scope(r))));let a=i,c=function(e){let t=e.type.prop(uf);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||ff.empty,h=function(e,t){let n=null;for(let i of e){let e=i.style(t);e&&(n=n?n+" "+e:e)}return n}(o,c.tags);if(h&&(a&&(a+=" "),a+=h,1==c.mode&&(i+=(i?" ":"")+h)),this.startSpan(Math.max(t,s),a),c.opaque)return;let u=e.tree&&e.tree.prop(Tu.mounted);if(u&&u.overlay){let r=e.node.enter(u.overlay[0].from+s,1),c=this.highlighters.filter((e=>!e.scope||e.scope(u.tree.type))),h=e.firstChild();for(let f=0,d=s;;f++){let p=f<u.overlay.length?u.overlay[f]:null,m=p?p.from+s:l,g=Math.max(t,d),b=Math.min(n,m);if(g<b&&h)for(;e.from<b&&(this.highlightRange(e,g,b,i,o),this.startSpan(Math.min(b,e.to),a),!(e.to>=m)&&e.nextSibling()););if(!p||m>n)break;d=p.to+s,d>t&&(this.highlightRange(r.cursor(),Math.max(t,p.from+s),Math.min(n,d),"",c),this.startSpan(Math.min(n,d),a))}h&&e.parent()}else if(e.firstChild()){u&&(i="");do{if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,i,o),this.startSpan(Math.min(n,e.to),a)}}while(e.nextSibling());e.parent()}}}const gf=lf.define,bf=gf(),vf=gf(),yf=gf(vf),wf=gf(vf),kf=gf(),xf=gf(kf),Of=gf(kf),Sf=gf(),Cf=gf(Sf),Ef=gf(),Af=gf(),Mf=gf(),Tf=gf(Mf),Df=gf(),Pf={comment:bf,lineComment:gf(bf),blockComment:gf(bf),docComment:gf(bf),name:vf,variableName:gf(vf),typeName:yf,tagName:gf(yf),propertyName:wf,attributeName:gf(wf),className:gf(vf),labelName:gf(vf),namespace:gf(vf),macroName:gf(vf),literal:kf,string:xf,docString:gf(xf),character:gf(xf),attributeValue:gf(xf),number:Of,integer:gf(Of),float:gf(Of),bool:gf(kf),regexp:gf(kf),escape:gf(kf),color:gf(kf),url:gf(kf),keyword:Ef,self:gf(Ef),null:gf(Ef),atom:gf(Ef),unit:gf(Ef),modifier:gf(Ef),operatorKeyword:gf(Ef),controlKeyword:gf(Ef),definitionKeyword:gf(Ef),moduleKeyword:gf(Ef),operator:Af,derefOperator:gf(Af),arithmeticOperator:gf(Af),logicOperator:gf(Af),bitwiseOperator:gf(Af),compareOperator:gf(Af),updateOperator:gf(Af),definitionOperator:gf(Af),typeOperator:gf(Af),controlOperator:gf(Af),punctuation:Mf,separator:gf(Mf),bracket:Tf,angleBracket:gf(Tf),squareBracket:gf(Tf),paren:gf(Tf),brace:gf(Tf),content:Sf,heading:Cf,heading1:gf(Cf),heading2:gf(Cf),heading3:gf(Cf),heading4:gf(Cf),heading5:gf(Cf),heading6:gf(Cf),contentSeparator:gf(Sf),list:gf(Sf),quote:gf(Sf),emphasis:gf(Sf),strong:gf(Sf),link:gf(Sf),monospace:gf(Sf),strikethrough:gf(Sf),inserted:gf(),deleted:gf(),changed:gf(),invalid:gf(),meta:Df,documentMeta:gf(Df),annotation:gf(Df),processingInstruction:gf(Df),definition:lf.defineModifier(),constant:lf.defineModifier(),function:lf.defineModifier(),standard:lf.defineModifier(),local:lf.defineModifier(),special:lf.defineModifier()};var Rf;df([{tag:Pf.link,class:"tok-link"},{tag:Pf.heading,class:"tok-heading"},{tag:Pf.emphasis,class:"tok-emphasis"},{tag:Pf.strong,class:"tok-strong"},{tag:Pf.keyword,class:"tok-keyword"},{tag:Pf.atom,class:"tok-atom"},{tag:Pf.bool,class:"tok-bool"},{tag:Pf.url,class:"tok-url"},{tag:Pf.labelName,class:"tok-labelName"},{tag:Pf.inserted,class:"tok-inserted"},{tag:Pf.deleted,class:"tok-deleted"},{tag:Pf.literal,class:"tok-literal"},{tag:Pf.string,class:"tok-string"},{tag:Pf.number,class:"tok-number"},{tag:[Pf.regexp,Pf.escape,Pf.special(Pf.string)],class:"tok-string2"},{tag:Pf.variableName,class:"tok-variableName"},{tag:Pf.local(Pf.variableName),class:"tok-variableName tok-local"},{tag:Pf.definition(Pf.variableName),class:"tok-variableName tok-definition"},{tag:Pf.special(Pf.variableName),class:"tok-variableName2"},{tag:Pf.definition(Pf.propertyName),class:"tok-propertyName tok-definition"},{tag:Pf.typeName,class:"tok-typeName"},{tag:Pf.namespace,class:"tok-namespace"},{tag:Pf.className,class:"tok-className"},{tag:Pf.macroName,class:"tok-macroName"},{tag:Pf.propertyName,class:"tok-propertyName"},{tag:Pf.operator,class:"tok-operator"},{tag:Pf.comment,class:"tok-comment"},{tag:Pf.meta,class:"tok-meta"},{tag:Pf.invalid,class:"tok-invalid"},{tag:Pf.punctuation,class:"tok-punctuation"}]);const $f=new Tu;const _f=new Tu;class Bf{constructor(e,t,n=[],i=""){this.data=e,this.name=i,Ar.prototype.hasOwnProperty("tree")||Object.defineProperty(Ar.prototype,"tree",{get(){return Nf(this)}}),this.parser=t,this.extension=[Uf.of(this),Ar.languageData.of(((e,t,n)=>{let i=If(e,t,n),o=i.type.prop($f);if(!o)return[];let r=e.facet(o),s=i.type.prop(_f);if(s){let o=i.resolve(t-i.from,n);for(let t of s)if(t.test(o,e)){let n=e.facet(t.facet);return"replace"==t.type?n:n.concat(r)}}return r}))].concat(n)}isActiveAt(e,t,n=-1){return If(e,t,n).type.prop($f)==this.data}findRegions(e){let t=e.facet(Uf);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],i=(e,t)=>{if(e.prop($f)==this.data)return void n.push({from:t,to:t+e.length});let o=e.prop(Tu.mounted);if(o){if(o.tree.prop($f)==this.data){if(o.overlay)for(let e of o.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(o.overlay){let e=n.length;if(i(o.tree,o.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let o=e.children[n];o instanceof Lu&&i(o,e.positions[n]+t)}};return i(Nf(e),0),n}get allowsNesting(){return!0}}function If(e,t,n){let i=e.facet(Uf),o=Nf(e).topNode;if(!i||i.allowsNesting)for(let e=o;e;e=e.enter(t,n,Iu.ExcludeBuffers))e.type.isTop&&(o=e);return o}Bf.setState=gr.define();class Lf extends Bf{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=(n=e.languageData,Qo.define({combine:n?e=>e.concat(n):void 0}));var n;return new Lf(t,e.parser.configure({props:[$f.add((e=>e.isTop?t:void 0))]}),e.name)}configure(e,t){return new Lf(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Nf(e){let t=e.field(Bf.state,!1);return t?t.tree:Lu.empty}class Vf{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,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let Hf=null;class Wf{constructor(e,t,n=[],i,o,r,s,l){this.parser=e,this.state=t,this.fragments=n,this.tree=i,this.treeLen=o,this.viewport=r,this.skipped=s,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new Wf(e,t,[],Lu.empty,0,n,[],null)}startParse(){return this.parser.startParse(new Vf(this.state.doc),this.fragments)}work(e,t){return null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=Lu.empty&&this.isDone(null!=t?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext((()=>{var n;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let i=this.parse.advance();if(i){if(this.fragments=this.withoutTempSkipped(nf.addTree(i,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=null!==(n=this.parse.stoppedAt)&&void 0!==n?n:this.state.doc.length,this.tree=i,this.parse=null,!(this.treeLen<(null!=t?t:this.state.doc.length)))return!0;this.parse=this.startParse()}if(e())return!1}}))}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext((()=>{for(;!(t=this.parse.advance()););})),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(nf.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Hf;Hf=this;try{return e()}finally{Hf=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=zf(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:i,treeLen:o,viewport:r,skipped:s}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges(((e,n,i,o)=>t.push({fromA:e,toA:n,fromB:i,toB:o}))),n=nf.applyChanges(n,t),i=Lu.empty,o=0,r={from:e.mapPos(r.from,-1),to:e.mapPos(r.to,1)},this.skipped.length){s=[];for(let t of this.skipped){let n=e.mapPos(t.from,1),i=e.mapPos(t.to,-1);n<i&&s.push({from:n,to:i})}}}return new Wf(this.parser,t,n,i,o,r,s,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:i}=this.skipped[t];n<e.to&&i>e.from&&(this.fragments=zf(this.fragments,n,i),this.skipped.splice(t--,1))}return!(this.skipped.length>=t||(this.reset(),0))}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends of{createParse(t,n,i){let o=i[0].from,r=i[i.length-1].to;return{parsedPos:o,advance(){let t=Hf;if(t){for(let e of i)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=r,new Lu(Ru.none,[],[],r-o)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return Hf}}function zf(e,t,n){return nf.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class Ff{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new Ff(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=Wf.create(e.facet(Uf).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new Ff(n)}}Bf.state=Ko.define({create:Ff.init,update(e,t){for(let e of t.effects)if(e.is(Bf.setState))return e.value;return t.startState.facet(Uf)!=t.state.facet(Uf)?Ff.init(t.state):e.apply(t)}});let Qf=e=>{let t=setTimeout((()=>e()),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(Qf=e=>{let t=-1,n=setTimeout((()=>{t=requestIdleCallback(e,{timeout:400})}),100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const jf="undefined"!=typeof navigator&&(null===(Rf=navigator.scheduling)||void 0===Rf?void 0:Rf.isInputPending)?()=>navigator.scheduling.isInputPending():null,qf=Tl.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 t=this.view.state.field(Bf.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Bf.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=Qf(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:i}}=this.view,o=n.field(Bf.state);if(o.tree==o.context.tree&&o.context.isDone(i+1e5))return;let r=Date.now()+Math.min(this.chunkBudget,100,e&&!jf?Math.max(25,e.timeRemaining()-5):1e9),s=o.context.treeLen<i&&n.doc.length>i+1e3,l=o.context.work((()=>jf&&jf()||Date.now()>r),i+(s?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:Bf.setState.of(new Ff(o.context))})),this.chunkBudget>0&&(!l||s)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then((()=>this.scheduleWork())).catch((e=>Cl(this.view.state,e))).then((()=>this.workScheduled--)),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Uf=Qo.define({combine:e=>e.length?e[0]:null,enables:e=>[Bf.state,qf,zc.contentAttributes.compute([e],(t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}}))]});class Gf{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const Xf=Qo.define(),Yf=Qo.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some((e=>e!=t[0])))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function Kf(e){let t=e.facet(Yf);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function Zf(e,t){let n="",i=e.tabSize,o=e.facet(Yf)[0];if("\t"==o){for(;t>=i;)n+="\t",t-=i;o=" "}for(let e=0;e<t;e++)n+=o;return n}function Jf(e,t){e instanceof Ar&&(e=new ed(e));for(let n of e.state.facet(Xf)){let i=n(e,t);if(void 0!==i)return i}let n=Nf(e.state);return n.length>=t?function(e,t,n){let i=t.resolveStack(n),o=i.node.enterUnfinishedNodesBefore(n);if(o!=i.node){let e=[];for(let t=o;t!=i.node;t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)i={node:e[t],next:i}}return nd(i,e,n)}(e,n,t):null}class ed{constructor(e,t={}){this.state=e,this.options=t,this.unit=Kf(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:o}=this.options;return null!=i&&i>=n.from&&i<=n.to?o&&i==e?{text:"",from:e}:(t<0?i<e:i<=e)?{text:n.text.slice(i-n.from),from:i}:{text:n.text.slice(0,i-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:i}=this.lineAt(e,t);return n.slice(e-i,Math.min(n.length,e+100-i))}column(e,t=1){let{text:n,from:i}=this.lineAt(e,t),o=this.countColumn(n,e-i),r=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return r>-1&&(o+=r-this.countColumn(n,n.search(/\S|$/))),o}countColumn(e,t=e.length){return jr(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:i}=this.lineAt(e,t),o=this.options.overrideIndentation;if(o){let e=o(i);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const td=new Tu;function nd(e,t,n){for(let i=e;i;i=i.next){let e=id(i.node);if(e)return e(rd.create(t,n,i))}return 0}function id(e){let t=e.type.prop(td);if(t)return t;let n,i=e.firstChild;if(i&&(n=i.type.prop(Tu.closedBy))){let t=e.lastChild,i=t&&n.indexOf(t.name)>-1;return e=>function(e,t,n,i,o){let r=e.textAfter,s=r.match(/^\s*/)[0].length,l=i&&r.slice(s,s+i.length)==i||o==e.pos+s,a=t?function(e){let t=e.node,n=t.childAfter(t.from),i=t.lastChild;if(!n)return null;let o=e.options.simulateBreak,r=e.state.doc.lineAt(n.from),s=null==o||o<=r.from?r.to:Math.min(r.to,o);for(let e=n.to;;){let o=t.childAfter(e);if(!o||o==i)return null;if(!o.type.isSkipped)return o.from<s?n:null;e=o.to}}(e):null;return a?l?e.column(a.from):e.column(a.to):e.baseIndent+(l?0:e.unit*n)}(e,!0,1,void 0,i&&!function(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}(e)?t.from:void 0)}return null==e.parent?od:null}function od(){return 0}class rd extends ed{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new rd(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(sd(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return nd(this.context.next,this.base,this.pos)}}function sd(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function ld({except:e,units:t=1}={}){return n=>{let i=e&&e.test(n.textAfter);return n.baseIndent+(i?0:t*n.unit)}}const ad=Qo.define(),cd=new Tu;function hd(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function ud(e,t,n){for(let i of e.facet(ad)){let o=i(e,t,n);if(o)return o}return function(e,t,n){let i=Nf(e);if(i.length<n)return null;let o=null;for(let r=i.resolveStack(n,1);r;r=r.next){let s=r.node;if(s.to<=n||s.from>n)continue;if(o&&s.from<t)break;let l=s.type.prop(cd);if(l&&(s.to<i.length-50||i.length==e.doc.length||!hd(s))){let i=l(s,e);i&&i.from<=n&&i.from>=t&&i.to>n&&(o=i)}}return o}(e,t,n)}function fd(e,t){let n=t.mapPos(e.from,1),i=t.mapPos(e.to,-1);return n>=i?void 0:{from:n,to:i}}const dd=gr.define({map:fd}),pd=gr.define({map:fd});function md(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some((e=>e.from<=n&&e.to>=n))||t.push(e.lineBlockAt(n));return t}const gd=Ko.define({create:()=>rl.none,update(e,t){e=e.map(t.changes);for(let n of t.effects)if(n.is(dd)&&!vd(e,n.value.from,n.value.to)){let{preparePlaceholder:i}=t.state.facet(Od),o=i?rl.replace({widget:new Ad(i(t.state,n.value))}):Ed;e=e.update({add:[o.range(n.value.from,n.value.to)]})}else n.is(pd)&&(e=e.update({filter:(e,t)=>n.value.from!=e||n.value.to!=t,filterFrom:n.value.from,filterTo:n.value.to}));if(t.selection){let n=!1,{head:i}=t.selection.main;e.between(i,i,((e,t)=>{e<i&&t>i&&(n=!0)})),n&&(e=e.update({filterFrom:i,filterTo:i,filter:(e,t)=>t<=i||e>=i}))}return e},provide:e=>zc.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,((e,t)=>{n.push(e,t)})),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n<e.length;){let i=e[n++],o=e[n++];if("number"!=typeof i||"number"!=typeof o)throw new RangeError("Invalid JSON for fold state");t.push(Ed.range(i,o))}return rl.set(t,!0)}});function bd(e,t,n){var i;let o=null;return null===(i=e.field(gd,!1))||void 0===i||i.between(t,n,((e,t)=>{(!o||o.from>e)&&(o={from:e,to:t})})),o}function vd(e,t,n){let i=!1;return e.between(t,t,((e,o)=>{e==t&&o==n&&(i=!0)})),i}function yd(e,t){return e.field(gd,!1)?t:t.concat(gr.appendConfig.of(Sd()))}function wd(e,t,n=!0){let i=e.state.doc.lineAt(t.from).number,o=e.state.doc.lineAt(t.to).number;return zc.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${i} ${e.state.phrase("to")} ${o}.`)}const kd=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:e=>{for(let t of md(e)){let n=ud(e.state,t.from,t.to);if(n)return e.dispatch({effects:yd(e.state,[dd.of(n),wd(e,n)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:e=>{if(!e.state.field(gd,!1))return!1;let t=[];for(let n of md(e)){let i=bd(e.state,n.from,n.to);i&&t.push(pd.of(i),wd(e,i,!1))}return t.length&&e.dispatch({effects:t}),t.length>0}},{key:"Ctrl-Alt-[",run:e=>{let{state:t}=e,n=[];for(let i=0;i<t.doc.length;){let o=e.lineBlockAt(i),r=ud(t,o.from,o.to);r&&n.push(dd.of(r)),i=(r?e.lineBlockAt(r.to):o).to+1}return n.length&&e.dispatch({effects:yd(e.state,n)}),!!n.length}},{key:"Ctrl-Alt-]",run:e=>{let t=e.state.field(gd,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,((e,t)=>{n.push(pd.of({from:e,to:t}))})),e.dispatch({effects:n}),!0}}],xd={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},Od=Qo.define({combine:e=>Mr(e,xd)});function Sd(e){let t=[gd,Dd];return e&&t.push(Od.of(e)),t}function Cd(e,t){let{state:n}=e,i=n.facet(Od),o=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),i=bd(e.state,n.from,n.to);i&&e.dispatch({effects:pd.of(i)}),t.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(e,o,t);let r=document.createElement("span");return r.textContent=i.placeholderText,r.setAttribute("aria-label",n.phrase("folded code")),r.title=n.phrase("unfold"),r.className="cm-foldPlaceholder",r.onclick=o,r}const Ed=rl.replace({widget:new class extends il{toDOM(e){return Cd(e,null)}}});class Ad extends il{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return Cd(e,this.value)}}const Md={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Td extends ru{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}const Dd=zc.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Pd{constructor(e,t){let n;function i(e){let t=Yr.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;const o="string"==typeof t.all?t.all:t.all?i(t.all):void 0,r=t.scope;this.scope=r instanceof Bf?e=>e.prop($f)==r.data:r?e=>e==r:void 0,this.style=df(e.map((e=>({tag:e.tag,class:e.class||i(Object.assign({},e,{tag:null}))}))),{all:o}).style,this.module=n?new Yr(n):null,this.themeType=t.themeType}static define(e,t){return new Pd(e,t||{})}}const Rd=Qo.define(),$d=Qo.define({combine:e=>e.length?[e[0]]:null});function _d(e){let t=e.facet(Rd);return t.length?t:e.facet($d)}function Bd(e,t){let n,i=[Ld];return e instanceof Pd&&(e.module&&i.push(zc.styleModule.of(e.module)),n=e.themeType),(null==t?void 0:t.fallback)?i.push($d.of(e)):n?i.push(Rd.computeN([zc.darkTheme],(t=>t.facet(zc.darkTheme)==("dark"==n)?[e]:[]))):i.push(Rd.of(e)),i}class Id{constructor(e){this.markCache=Object.create(null),this.tree=Nf(e.state),this.decorations=this.buildDeco(e,_d(e.state))}update(e){let t=Nf(e.state),n=_d(e.state),i=n!=_d(e.startState);t.length<e.view.viewport.to&&!i&&t.type==this.tree.type?this.decorations=this.decorations.map(e.changes):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n))}buildDeco(e,t){if(!t||!this.tree.length)return rl.none;let n=new _r;for(let{from:i,to:o}of e.visibleRanges)pf(this.tree,t,((e,t,i)=>{n.add(e,t,this.markCache[i]||(this.markCache[i]=rl.mark({class:i})))}),i,o);return n.finish()}}const Ld=Jo.high(Tl.fromClass(Id,{decorations:e=>e.decorations})),Nd=Pd.define([{tag:Pf.meta,color:"#404740"},{tag:Pf.link,textDecoration:"underline"},{tag:Pf.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Pf.emphasis,fontStyle:"italic"},{tag:Pf.strong,fontWeight:"bold"},{tag:Pf.strikethrough,textDecoration:"line-through"},{tag:Pf.keyword,color:"#708"},{tag:[Pf.atom,Pf.bool,Pf.url,Pf.contentSeparator,Pf.labelName],color:"#219"},{tag:[Pf.literal,Pf.inserted],color:"#164"},{tag:[Pf.string,Pf.deleted],color:"#a11"},{tag:[Pf.regexp,Pf.escape,Pf.special(Pf.string)],color:"#e40"},{tag:Pf.definition(Pf.variableName),color:"#00f"},{tag:Pf.local(Pf.variableName),color:"#30a"},{tag:[Pf.typeName,Pf.namespace],color:"#085"},{tag:Pf.className,color:"#167"},{tag:[Pf.special(Pf.variableName),Pf.macroName],color:"#256"},{tag:Pf.definition(Pf.propertyName),color:"#00c"},{tag:Pf.comment,color:"#940"},{tag:Pf.invalid,color:"#f00"}]),Vd=zc.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Hd=1e4,Wd="()[]{}",zd=Qo.define({combine:e=>Mr(e,{afterCursor:!0,brackets:Wd,maxScanDistance:Hd,renderMatch:jd})}),Fd=rl.mark({class:"cm-matchingBracket"}),Qd=rl.mark({class:"cm-nonmatchingBracket"});function jd(e){let t=[],n=e.matched?Fd:Qd;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}const qd=Ko.define({create:()=>rl.none,update(e,t){if(!t.docChanged&&!t.selection)return e;let n=[],i=t.state.facet(zd);for(let e of t.state.selection.ranges){if(!e.empty)continue;let o=Kd(t.state,e.head,-1,i)||e.head>0&&Kd(t.state,e.head-1,1,i)||i.afterCursor&&(Kd(t.state,e.head,1,i)||e.head<t.state.doc.length&&Kd(t.state,e.head+1,-1,i));o&&(n=n.concat(i.renderMatch(o,t.state)))}return rl.set(n,!0)},provide:e=>zc.decorations.from(e)}),Ud=[qd,Vd],Gd=new Tu;function Xd(e,t,n){let i=e.prop(t<0?Tu.openedBy:Tu.closedBy);if(i)return i;if(1==e.name.length){let i=n.indexOf(e.name);if(i>-1&&i%2==(t<0?1:0))return[n[i+t]]}return null}function Yd(e){let t=e.type.prop(Gd);return t?t(e.node):e}function Kd(e,t,n,i={}){let o=i.maxScanDistance||Hd,r=i.brackets||Wd,s=Nf(e),l=s.resolveInner(t,n);for(let e=l;e;e=e.parent){let i=Xd(e.type,n,r);if(i&&e.from<e.to){let o=Yd(e);if(o&&(n>0?t>=o.from&&t<o.to:t>o.from&&t<=o.to))return Zd(0,0,n,e,o,i,r)}}return function(e,t,n,i,o,r,s){let l=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),a=s.indexOf(l);if(a<0||a%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},h=e.doc.iterRange(t,n>0?e.doc.length:0),u=0;for(let e=0;!h.next().done&&e<=r;){let r=h.value;n<0&&(e+=r.length);let l=t+e*n;for(let e=n>0?0:r.length-1,t=n>0?r.length:-1;e!=t;e+=n){let t=s.indexOf(r[e]);if(!(t<0||i.resolveInner(l+e,1).type!=o))if(t%2==0==n>0)u++;else{if(1==u)return{start:c,end:{from:l+e,to:l+e+1},matched:t>>1==a>>1};u--}}n>0&&(e+=r.length)}return h.done?{start:c,matched:!1}:null}(e,t,n,s,l.type,o,r)}function Zd(e,t,n,i,o,r,s){let l=i.parent,a={from:o.from,to:o.to},c=0,h=null==l?void 0:l.cursor();if(h&&(n<0?h.childBefore(i.from):h.childAfter(i.to)))do{if(n<0?h.to<=i.from:h.from>=i.to){if(0==c&&r.indexOf(h.type.name)>-1&&h.from<h.to){let e=Yd(h);return{start:a,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(Xd(h.type,n,s))c++;else if(Xd(h.type,-n,s)){if(0==c){let e=Yd(h);return{start:a,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}c--}}}while(n<0?h.prevSibling():h.nextSibling());return{start:a,matched:!1}}const Jd=Object.create(null),ep=[Ru.none],tp=[],np=Object.create(null),ip=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])ip[e]=rp(Jd,t);function op(e,t){tp.indexOf(e)>-1||(tp.push(e),console.warn(t))}function rp(e,t){let n=[];for(let i of t.split(" ")){let t=[];for(let n of i.split(".")){let i=e[n]||Pf[n];i?"function"==typeof i?t.length?t=t.map(i):op(n,`Modifier ${n} used at start of tag`):t.length?op(n,`Tag ${n} used as modifier`):t=Array.isArray(i)?i:[i]:op(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let i=t.replace(/ /g,"_"),o=i+" "+n.map((e=>e.id)),r=np[o];if(r)return r.id;let s=np[o]=Ru.define({id:ep.length,name:i,props:[hf({[i]:n})]});return ep.push(s),s.id}function sp(e,t){return({state:n,dispatch:i})=>{if(n.readOnly)return!1;let o=e(t,n);return!!o&&(i(n.update(o)),!0)}}const lp=sp(dp,0),ap=sp(fp,0),cp=sp(((e,t)=>fp(e,t,function(e){let t=[];for(let n of e.selection.ranges){let i=e.doc.lineAt(n.from),o=n.to<=i.to?i:e.doc.lineAt(n.to),r=t.length-1;r>=0&&t[r].to>i.from?t[r].to=o.to:t.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:o.to})}return t}(t))),0);function hp(e,t){let n=e.languageDataAt("commentTokens",t);return n.length?n[0]:{}}const up=50;function fp(e,t,n=t.selection.ranges){let i=n.map((e=>hp(t,e.from).block));if(!i.every((e=>e)))return null;let o=n.map(((e,n)=>function(e,{open:t,close:n},i,o){let r,s,l=e.sliceDoc(i-up,i),a=e.sliceDoc(o,o+up),c=/\s*$/.exec(l)[0].length,h=/^\s*/.exec(a)[0].length,u=l.length-c;if(l.slice(u-t.length,u)==t&&a.slice(h,h+n.length)==n)return{open:{pos:i-c,margin:c&&1},close:{pos:o+h,margin:h&&1}};o-i<=2*up?r=s=e.sliceDoc(i,o):(r=e.sliceDoc(i,i+up),s=e.sliceDoc(o-up,o));let f=/^\s*/.exec(r)[0].length,d=/\s*$/.exec(s)[0].length,p=s.length-d-n.length;return r.slice(f,f+t.length)==t&&s.slice(p,p+n.length)==n?{open:{pos:i+f+t.length,margin:/\s/.test(r.charAt(f+t.length))?1:0},close:{pos:o-d-n.length,margin:/\s/.test(s.charAt(p-1))?1:0}}:null}(t,i[n],e.from,e.to)));if(2!=e&&!o.every((e=>e)))return{changes:t.changes(n.map(((e,t)=>o[t]?[]:[{from:e.from,insert:i[t].open+" "},{from:e.to,insert:" "+i[t].close}])))};if(1!=e&&o.some((e=>e))){let e=[];for(let t,n=0;n<o.length;n++)if(t=o[n]){let o=i[n],{open:r,close:s}=t;e.push({from:r.pos-o.open.length,to:r.pos+r.margin},{from:s.pos-s.margin,to:s.pos+o.close.length})}return{changes:e}}return null}function dp(e,t,n=t.selection.ranges){let i=[],o=-1;for(let{from:e,to:r}of n){let n=i.length,s=1e9,l=hp(t,e).line;if(l){for(let n=e;n<=r;){let a=t.doc.lineAt(n);if(a.from>o&&(e==r||r>a.from)){o=a.from;let e=/^\s*/.exec(a.text)[0].length,t=e==a.length,n=a.text.slice(e,e+l.length)==l?e:-1;e<a.text.length&&e<s&&(s=e),i.push({line:a,comment:n,token:l,indent:e,empty:t,single:!1})}n=a.to+1}if(s<1e9)for(let e=n;e<i.length;e++)i[e].indent<i[e].line.text.length&&(i[e].indent=s);i.length==n+1&&(i[n].single=!0)}}if(2!=e&&i.some((e=>e.comment<0&&(!e.empty||e.single)))){let e=[];for(let{line:t,token:n,indent:o,empty:r,single:s}of i)!s&&r||e.push({from:t.from+o,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&i.some((e=>e.comment>=0))){let e=[];for(let{line:t,comment:n,token:o}of i)if(n>=0){let i=t.from+n,r=i+o.length;" "==t.text[r-t.from]&&r++,e.push({from:i,to:r})}return{changes:e}}return null}const pp=dr.define(),mp=dr.define(),gp=Qo.define(),bp=Qo.define({combine:e=>Mr(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,i)=>e(n,i)||t(n,i)})}),vp=Ko.define({create:()=>Bp.empty,update(e,t){let n=t.state.facet(bp),i=t.annotation(pp);if(i){let o=Cp.fromTransaction(t,i.selection),r=i.side,s=0==r?e.undone:e.done;return s=o?Ep(s,s.length,n.minDepth,o):Dp(s,t.startState.selection),new Bp(0==r?i.rest:s,0==r?s:i.rest)}let o=t.annotation(mp);if("full"!=o&&"before"!=o||(e=e.isolate()),!1===t.annotation(br.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let r=Cp.fromTransaction(t),s=t.annotation(br.time),l=t.annotation(br.userEvent);return r?e=e.addChanges(r,s,l,n,t):t.selection&&(e=e.addSelection(t.startState.selection,s,l,n.newGroupDelay)),"full"!=o&&"after"!=o||(e=e.isolate()),e},toJSON:e=>({done:e.done.map((e=>e.toJSON())),undone:e.undone.map((e=>e.toJSON()))}),fromJSON:e=>new Bp(e.done.map(Cp.fromJSON),e.undone.map(Cp.fromJSON))});function yp(e,t){return function({state:n,dispatch:i}){if(!t&&n.readOnly)return!1;let o=n.field(vp,!1);if(!o)return!1;let r=o.pop(e,n,t);return!!r&&(i(r),!0)}}const kp=yp(0,!1),xp=yp(1,!1),Op=yp(0,!0),Sp=yp(1,!0);class Cp{constructor(e,t,n,i,o){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=i,this.selectionsAfter=o}setSelAfter(e){return new Cp(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((e=>e.toJSON()))}}static fromJSON(e){return new Cp(e.changes&&$o.fromJSON(e.changes),[],e.mapped&&Ro.fromJSON(e.mapped),e.startSelection&&Wo.fromJSON(e.startSelection),e.selectionsAfter.map(Wo.fromJSON))}static fromTransaction(e,t){let n=Mp;for(let t of e.startState.facet(gp)){let i=t(e);i.length&&(n=n.concat(i))}return!n.length&&e.changes.empty?null:new Cp(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,Mp)}static selection(e){return new Cp(void 0,Mp,void 0,void 0,e)}}function Ep(e,t,n,i){let o=t+1>n+20?t-n-1:0,r=e.slice(o,t);return r.push(i),r}function Ap(e,t){return e.length?t.length?e.concat(t):e:t}const Mp=[],Tp=200;function Dp(e,t){if(e.length){let n=e[e.length-1],i=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Tp));return i.length&&i[i.length-1].eq(t)?e:(i.push(t),Ep(e,e.length-1,1e9,n.setSelAfter(i)))}return[Cp.selection([t])]}function Pp(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function Rp(e,t){if(!e.length)return e;let n=e.length,i=Mp;for(;n;){let o=$p(e[n-1],t,i);if(o.changes&&!o.changes.empty||o.effects.length){let t=e.slice(0,n);return t[n-1]=o,t}t=o.mapped,n--,i=o.selectionsAfter}return i.length?[Cp.selection(i)]:Mp}function $p(e,t,n){let i=Ap(e.selectionsAfter.length?e.selectionsAfter.map((e=>e.map(t))):Mp,n);if(!e.changes)return Cp.selection(i);let o=e.changes.map(t),r=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(r):r;return new Cp(o,gr.mapEffects(e.effects,t),s,e.startSelection.map(r),i)}const _p=/^(input\.type|delete)($|\.)/;class Bp{constructor(e,t,n=0,i=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=i}isolate(){return this.prevTime?new Bp(this.done,this.undone):this}addChanges(e,t,n,i,o){let r=this.done,s=r[r.length-1];return r=s&&s.changes&&!s.changes.empty&&e.changes&&(!n||_p.test(n))&&(!s.selectionsAfter.length&&t-this.prevTime<i.newGroupDelay&&i.joinToEvent(o,function(e,t){let n=[],i=!1;return e.iterChangedRanges(((e,t)=>n.push(e,t))),t.iterChangedRanges(((e,t,o,r)=>{for(let e=0;e<n.length;){let t=n[e++],s=n[e++];r>=t&&o<=s&&(i=!0)}})),i}(s.changes,e.changes))||"input.type.compose"==n)?Ep(r,r.length-1,i.minDepth,new Cp(e.changes.compose(s.changes),Ap(e.effects,s.effects),s.mapped,s.startSelection,Mp)):Ep(r,r.length,i.minDepth,e),new Bp(r,Mp,t,n)}addSelection(e,t,n,i){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:Mp;return o.length>0&&t-this.prevTime<i&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&(r=o[o.length-1],s=e,r.ranges.length==s.ranges.length&&0===r.ranges.filter(((e,t)=>e.empty!=s.ranges[t].empty)).length)?this:new Bp(Dp(this.done,e),this.undone,t,n);var r,s}addMapping(e){return new Bp(Rp(this.done,e),Rp(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let i=0==e?this.done:this.undone;if(0==i.length)return null;let o=i[i.length-1],r=o.selectionsAfter[0]||t.selection;if(n&&o.selectionsAfter.length)return t.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:pp.of({side:e,rest:Pp(i),selection:r}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(o.changes){let n=1==i.length?Mp:i.slice(0,i.length-1);return o.mapped&&(n=Rp(n,o.mapped)),t.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:pp.of({side:e,rest:n,selection:r}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}}Bp.empty=new Bp(Mp,Mp);const Ip=[{key:"Mod-z",run:kp,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:xp,preventDefault:!0},{linux:"Ctrl-Shift-z",run:xp,preventDefault:!0},{key:"Mod-u",run:Op,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Sp,preventDefault:!0}];function Lp(e,t){return Wo.create(e.ranges.map(t),e.mainIndex)}function Np(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Vp({state:e,dispatch:t},n){let i=Lp(e.selection,n);return!i.eq(e.selection)&&(t(Np(e,i)),!0)}function Hp(e,t){return Wo.cursor(t?e.to:e.from)}function Wp(e,t){return Vp(e,(n=>n.empty?e.moveByChar(n,t):Hp(n,t)))}function zp(e){return e.textDirectionAt(e.state.selection.main.head)==zl.LTR}const Fp=e=>Wp(e,!zp(e)),Qp=e=>Wp(e,zp(e));function jp(e,t){return Vp(e,(n=>n.empty?e.moveByGroup(n,t):Hp(n,t)))}function qp(e,t,n){if(t.type.prop(n))return!0;let i=t.to-t.from;return i&&(i>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function Up(e,t,n){let i,o,r=Nf(e).resolveInner(t.head),s=n?Tu.closedBy:Tu.openedBy;for(let i=t.head;;){let t=n?r.childAfter(i):r.childBefore(i);if(!t)break;qp(e,t,s)?r=t:i=n?t.to:t.from}return o=r.type.prop(s)&&(i=n?Kd(e,r.from,1):Kd(e,r.to,-1))&&i.matched?n?i.end.to:i.end.from:n?r.to:r.from,Wo.cursor(o,n?-1:1)}function Gp(e,t){return Vp(e,(n=>{if(!n.empty)return Hp(n,t);let i=e.moveVertically(n,t);return i.head!=n.head?i:e.moveToLineBoundary(n,t)}))}"undefined"!=typeof Intl&&Intl.Segmenter;const Xp=e=>Gp(e,!1),Yp=e=>Gp(e,!0);function Kp(e){let t,n=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,i=0,o=0;if(n){for(let t of e.state.facet(zc.scrollMargins)){let n=t(e);(null==n?void 0:n.top)&&(i=Math.max(null==n?void 0:n.top,i)),(null==n?void 0:n.bottom)&&(o=Math.max(null==n?void 0:n.bottom,o))}t=e.scrollDOM.clientHeight-i-o}else t=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:i,marginBottom:o,selfScroll:n,height:Math.max(e.defaultLineHeight,t-5)}}function Zp(e,t){let n,i=Kp(e),{state:o}=e,r=Lp(o.selection,(n=>n.empty?e.moveVertically(n,t,i.height):Hp(n,t)));if(r.eq(o.selection))return!1;if(i.selfScroll){let t=e.coordsAtPos(o.selection.main.head),s=e.scrollDOM.getBoundingClientRect(),l=s.top+i.marginTop,a=s.bottom-i.marginBottom;t&&t.top>l&&t.bottom<a&&(n=zc.scrollIntoView(r.main.head,{y:"start",yMargin:t.top-l}))}return e.dispatch(Np(o,r),{effects:n}),!0}const Jp=e=>Zp(e,!1),em=e=>Zp(e,!0);function tm(e,t,n){let i=e.lineBlockAt(t.head),o=e.moveToLineBoundary(t,n);if(o.head==t.head&&o.head!=(n?i.to:i.from)&&(o=e.moveToLineBoundary(t,n,!1)),!n&&o.head==i.from&&i.length){let n=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;n&&t.head!=i.from+n&&(o=Wo.cursor(i.from+n))}return o}function nm(e,t){let n=Lp(e.state.selection,(e=>{let n=t(e);return Wo.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)}));return!n.eq(e.state.selection)&&(e.dispatch(Np(e.state,n)),!0)}function im(e,t){return nm(e,(n=>e.moveByChar(n,t)))}const om=e=>im(e,!zp(e)),rm=e=>im(e,zp(e));function sm(e,t){return nm(e,(n=>e.moveByGroup(n,t)))}function lm(e,t){return nm(e,(n=>e.moveVertically(n,t)))}const am=e=>lm(e,!1),cm=e=>lm(e,!0);function hm(e,t){return nm(e,(n=>e.moveVertically(n,t,Kp(e).height)))}const um=e=>hm(e,!1),fm=e=>hm(e,!0),dm=({state:e,dispatch:t})=>(t(Np(e,{anchor:0})),!0),pm=({state:e,dispatch:t})=>(t(Np(e,{anchor:e.doc.length})),!0),mm=({state:e,dispatch:t})=>(t(Np(e,{anchor:e.selection.main.anchor,head:0})),!0),gm=({state:e,dispatch:t})=>(t(Np(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function bm(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:i}=e,o=i.changeByRange((i=>{let{from:o,to:r}=i;if(o==r){let s=t(i);s<o?(n="delete.backward",s=vm(e,s,!1)):s>o&&(n="delete.forward",s=vm(e,s,!0)),o=Math.min(o,s),r=Math.max(r,s)}else o=vm(e,o,!1),r=vm(e,r,!0);return o==r?{range:i}:{changes:{from:o,to:r},range:Wo.cursor(o,o<i.head?-1:1)}}));return!o.changes.empty&&(e.dispatch(i.update(o,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?zc.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function vm(e,t,n){if(e instanceof zc)for(let i of e.state.facet(zc.atomicRanges).map((t=>t(e))))i.between(t,t,((e,i)=>{e<t&&i>t&&(t=n?i:e)}));return t}const ym=(e,t)=>bm(e,(n=>{let i,o,r=n.from,{state:s}=e,l=s.doc.lineAt(r);if(!t&&r>l.from&&r<l.from+200&&!/[^ \t]/.test(i=l.text.slice(0,r-l.from))){if("\t"==i[i.length-1])return r-1;let e=jr(i,s.tabSize)%Kf(s)||Kf(s);for(let t=0;t<e&&" "==i[i.length-1-t];t++)r--;o=r}else o=xo(l.text,r-l.from,t,t)+l.from,o==r&&l.number!=(t?s.doc.lines:1)?o+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(l.text.slice(o-l.from,r-l.from))&&(o=xo(l.text,o-l.from,!1,!1)+l.from);return o})),wm=e=>ym(e,!1),km=e=>ym(e,!0),xm=(e,t)=>bm(e,(n=>{let i=n.head,{state:o}=e,r=o.doc.lineAt(i),s=o.charCategorizer(i);for(let e=null;;){if(i==(t?r.to:r.from)){i==n.head&&r.number!=(t?o.doc.lines:1)&&(i+=t?1:-1);break}let l=xo(r.text,i-r.from,t)+r.from,a=r.text.slice(Math.min(i,l)-r.from,Math.max(i,l)-r.from),c=s(a);if(null!=e&&c!=e)break;" "==a&&i==n.head||(e=c),i=l}return i})),Om=e=>xm(e,!1);function Sm(e){let t=[],n=-1;for(let i of e.selection.ranges){let o=e.doc.lineAt(i.from),r=e.doc.lineAt(i.to);if(i.empty||i.to!=r.from||(r=e.doc.lineAt(i.to-1)),n>=o.number){let e=t[t.length-1];e.to=r.to,e.ranges.push(i)}else t.push({from:o.from,to:r.to,ranges:[i]});n=r.number+1}return t}function Cm(e,t,n){if(e.readOnly)return!1;let i=[],o=[];for(let t of Sm(e)){if(n?t.to==e.doc.length:0==t.from)continue;let r=e.doc.lineAt(n?t.to+1:t.from-1),s=r.length+1;if(n){i.push({from:t.to,to:r.to},{from:t.from,insert:r.text+e.lineBreak});for(let n of t.ranges)o.push(Wo.range(Math.min(e.doc.length,n.anchor+s),Math.min(e.doc.length,n.head+s)))}else{i.push({from:r.from,to:t.from},{from:t.to,insert:e.lineBreak+r.text});for(let e of t.ranges)o.push(Wo.range(e.anchor-s,e.head-s))}}return!!i.length&&(t(e.update({changes:i,scrollIntoView:!0,selection:Wo.create(o,e.selection.mainIndex),userEvent:"move.line"})),!0)}function Em(e,t,n){if(e.readOnly)return!1;let i=[];for(let t of Sm(e))n?i.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):i.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});return t(e.update({changes:i,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Am=Mm(!1);function Mm(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let i=t.changeByRange((n=>{let{from:i,to:o}=n,r=t.doc.lineAt(i),s=!e&&i==o&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n,i=Nf(e).resolveInner(t),o=i.childBefore(t),r=i.childAfter(t);return o&&r&&o.to<=t&&r.from>=t&&(n=o.type.prop(Tu.closedBy))&&n.indexOf(r.name)>-1&&e.doc.lineAt(o.to).from==e.doc.lineAt(r.from).from&&!/\S/.test(e.sliceDoc(o.to,r.from))?{from:o.to,to:r.from}:null}(t,i);e&&(i=o=(o<=r.to?r:t.doc.lineAt(o)).to);let l=new ed(t,{simulateBreak:i,simulateDoubleBreak:!!s}),a=Jf(l,i);for(null==a&&(a=jr(/^\s*/.exec(t.doc.lineAt(i).text)[0],t.tabSize));o<r.to&&/\s/.test(r.text[o-r.from]);)o++;s?({from:i,to:o}=s):i>r.from&&i<r.from+100&&!/\S/.test(r.text.slice(0,i))&&(i=r.from);let c=["",Zf(t,a)];return s&&c.push(Zf(t,l.lineIndent(r.from,-1))),{changes:{from:i,to:o,insert:lo.of(c)},range:Wo.cursor(i+1+c[1].length)}}));return n(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function Tm(e,t){let n=-1;return e.changeByRange((i=>{let o=[];for(let r=i.from;r<=i.to;){let s=e.doc.lineAt(r);s.number>n&&(i.empty||i.to>s.from)&&(t(s,o,i),n=s.number),r=s.to+1}let r=e.changes(o);return{changes:o,range:Wo.range(r.mapPos(i.anchor,1),r.mapPos(i.head,1))}}))}const Dm=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Tm(e,((t,n)=>{n.push({from:t.from,insert:e.facet(Yf)})})),{userEvent:"input.indent"})),!0),Pm=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Tm(e,((t,n)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let o=jr(i,e.tabSize),r=0,s=Zf(e,Math.max(0,o-Kf(e)));for(;r<i.length&&r<s.length&&i.charCodeAt(r)==s.charCodeAt(r);)r++;n.push({from:t.from+r,to:t.from+i.length,insert:s.slice(r)})})),{userEvent:"delete.dedent"})),!0),Rm=[{key:"Ctrl-b",run:Fp,shift:om,preventDefault:!0},{key:"Ctrl-f",run:Qp,shift:rm},{key:"Ctrl-p",run:Xp,shift:am},{key:"Ctrl-n",run:Yp,shift:cm},{key:"Ctrl-a",run:e=>Vp(e,(t=>Wo.cursor(e.lineBlockAt(t.head).from,1))),shift:e=>nm(e,(t=>Wo.cursor(e.lineBlockAt(t.head).from)))},{key:"Ctrl-e",run:e=>Vp(e,(t=>Wo.cursor(e.lineBlockAt(t.head).to,-1))),shift:e=>nm(e,(t=>Wo.cursor(e.lineBlockAt(t.head).to)))},{key:"Ctrl-d",run:km},{key:"Ctrl-h",run:wm},{key:"Ctrl-k",run:e=>bm(e,(t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}))},{key:"Ctrl-Alt-h",run:Om},{key:"Ctrl-o",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:lo.of(["",""])},range:Wo.cursor(e.from)})));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,i=e.doc.lineAt(n),o=n==i.from?n-1:xo(i.text,n-i.from,!1)+i.from,r=n==i.to?n+1:xo(i.text,n-i.from,!0)+i.from;return{changes:{from:o,to:r,insert:e.doc.slice(n,r).append(e.doc.slice(o,n))},range:Wo.cursor(r)}}));return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:em}],$m=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>Vp(e,(t=>Up(e.state,t,!zp(e)))),shift:e=>nm(e,(t=>Up(e.state,t,!zp(e))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>Vp(e,(t=>Up(e.state,t,zp(e)))),shift:e=>nm(e,(t=>Up(e.state,t,zp(e))))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>Cm(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>Em(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>Cm(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>Em(e,t,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,i=null;return n.ranges.length>1?i=Wo.create([n.main]):n.main.empty||(i=Wo.create([Wo.cursor(n.main.head)])),!!i&&(t(Np(e,i)),!0)}},{key:"Mod-Enter",run:Mm(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=Sm(e).map((({from:t,to:n})=>Wo.range(t,Math.min(n+1,e.doc.length))));return t(e.update({selection:Wo.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=Lp(e.selection,(t=>{var n;for(let i=Nf(e).resolveStack(t.from,1);i;i=i.next){let{node:e}=i;if((e.from<t.from&&e.to>=t.to||e.to>t.to&&e.from<=t.from)&&(null===(n=e.parent)||void 0===n?void 0:n.parent))return Wo.range(e.to,e.from)}return t}));return t(Np(e,n)),!0},preventDefault:!0},{key:"Mod-[",run:Pm},{key:"Mod-]",run:Dm},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),i=new ed(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),o=Tm(e,((t,o,r)=>{let s=Jf(i,t.from);if(null==s)return;/\S/.test(t.text)||(s=0);let l=/^\s*/.exec(t.text)[0],a=Zf(e,s);(l!=a||r.from<t.from+l.length)&&(n[t.from]=s,o.push({from:t.from,to:t.from+l.length,insert:a}))}));return o.changes.empty||t(e.update(o,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Sm(t).map((({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n})))),i=Lp(t.selection,(t=>e.moveVertically(t,!0))).map(n);return e.dispatch({changes:n,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>function(e,t,n){let i=!1,o=Lp(e.selection,(t=>{let o=Kd(e,t.head,-1)||Kd(e,t.head,1)||t.head>0&&Kd(e,t.head-1,1)||t.head<e.doc.length&&Kd(e,t.head+1,-1);if(!o||!o.end)return t;i=!0;let r=o.start.from==t.head?o.end.to:o.end.from;return n?Wo.range(t.anchor,r):Wo.cursor(r)}));return!!i&&(t(Np(e,o)),!0)}(e,t,!1)},{key:"Mod-/",run:e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),i=hp(e.state,n.from);return i.line?lp(e):!!i.block&&cp(e)}},{key:"Alt-A",run:ap}].concat([{key:"ArrowLeft",run:Fp,shift:om,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>jp(e,!zp(e)),shift:e=>sm(e,!zp(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>Vp(e,(t=>tm(e,t,!zp(e)))),shift:e=>nm(e,(t=>tm(e,t,!zp(e)))),preventDefault:!0},{key:"ArrowRight",run:Qp,shift:rm,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>jp(e,zp(e)),shift:e=>sm(e,zp(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>Vp(e,(t=>tm(e,t,zp(e)))),shift:e=>nm(e,(t=>tm(e,t,zp(e)))),preventDefault:!0},{key:"ArrowUp",run:Xp,shift:am,preventDefault:!0},{mac:"Cmd-ArrowUp",run:dm,shift:mm},{mac:"Ctrl-ArrowUp",run:Jp,shift:um},{key:"ArrowDown",run:Yp,shift:cm,preventDefault:!0},{mac:"Cmd-ArrowDown",run:pm,shift:gm},{mac:"Ctrl-ArrowDown",run:em,shift:fm},{key:"PageUp",run:Jp,shift:um},{key:"PageDown",run:em,shift:fm},{key:"Home",run:e=>Vp(e,(t=>tm(e,t,!1))),shift:e=>nm(e,(t=>tm(e,t,!1))),preventDefault:!0},{key:"Mod-Home",run:dm,shift:mm},{key:"End",run:e=>Vp(e,(t=>tm(e,t,!0))),shift:e=>nm(e,(t=>tm(e,t,!0))),preventDefault:!0},{key:"Mod-End",run:pm,shift:gm},{key:"Enter",run:Am},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:wm,shift:wm},{key:"Delete",run:km},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Om},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>xm(e,!0)},{mac:"Mod-Backspace",run:e=>bm(e,(t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}))},{mac:"Mod-Delete",run:e=>bm(e,(t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}))}].concat(Rm.map((e=>({mac:e.key,run:e.run,shift:e.shift}))))),_m={key:"Tab",run:Dm,shift:Pm};function Bm(){var e=arguments[0];"string"==typeof e&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&"object"==typeof n&&null==n.nodeType&&!Array.isArray(n)){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var o=n[i];"string"==typeof o?e.setAttribute(i,o):null!=o&&(e[i]=o)}t++}for(;t<arguments.length;t++)Im(e,arguments[t]);return e}function Im(e,t){if("string"==typeof t)e.appendChild(document.createTextNode(t));else if(null==t);else if(null!=t.nodeType)e.appendChild(t);else{if(!Array.isArray(t))throw new RangeError("Unsupported child node: "+t);for(var n=0;n<t.length;n++)Im(e,t[n])}}const Lm="function"==typeof String.prototype.normalize?e=>e.normalize("NFKD"):e=>e;class Nm{constructor(e,t,n=0,i=e.length,o,r){this.test=r,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,i),this.bufferStart=n,this.normalize=o?e=>o(Lm(e)):Lm,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Ao(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Mo(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=To(e);let i=this.normalize(t);for(let e=0,o=n;;e++){let r=i.charCodeAt(e),s=this.match(r,o);if(e==i.length-1){if(s)return this.value=s,this;break}o==n&&e<t.length&&t.charCodeAt(e)==r&&o++}}}match(e,t){let n=null;for(let i=0;i<this.matches.length;i+=2){let o=this.matches[i],r=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?n={from:this.matches[i+1],to:t+1}:(this.matches[i]++,r=!0)),r||(this.matches.splice(i,2),i-=2)}return this.query.charCodeAt(0)==e&&(1==this.query.length?n={from:t,to:t+1}:this.matches.push(1,t)),n&&this.test&&!this.test(n.from,n.to,this.buffer,this.bufferStart)&&(n=null),n}}"undefined"!=typeof Symbol&&(Nm.prototype[Symbol.iterator]=function(){return this});const Vm={from:-1,to:-1,match:/.*/.exec("")},Hm="gm"+(null==/x/.unicode?"":"u");class Wm{constructor(e,t,n,i=0,o=e.length){if(this.text=e,this.to=o,this.curLine="",this.done=!1,this.value=Vm,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Qm(e,t,n,i,o);this.re=new RegExp(t,Hm+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.iter=e.iter();let r=e.lineAt(i);this.curLineStart=r.from,this.matchPos=jm(e,i),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,i=n+t[0].length;if(this.matchPos=jm(this.text,i+(n==i?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<i||n>this.value.to)&&(!this.test||this.test(n,i,t)))return this.value={from:n,to:i,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),e=0}}}}const zm=new WeakMap;class Fm{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let i=zm.get(e);if(!i||i.from>=n||i.to<=t){let i=new Fm(t,e.sliceString(t,n));return zm.set(e,i),i}if(i.from==t&&i.to==n)return i;let{text:o,from:r}=i;return r>t&&(o=e.sliceString(t,r)+o,r=t),i.to<n&&(o+=e.sliceString(i.to,n)),zm.set(e,new Fm(r,o)),new Fm(t,o.slice(t-r,n-r))}}class Qm{constructor(e,t,n,i,o){this.text=e,this.to=o,this.done=!1,this.value=Vm,this.matchPos=jm(e,i),this.re=new RegExp(t,Hm+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.flat=Fm.get(e,i,this.chunkEnd(i+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=jm(this.text,n+(e==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Fm.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function jm(e,t){if(t>=e.length)return t;let n,i=e.lineAt(t);for(;t<i.to&&(n=i.text.charCodeAt(t-i.from))>=56320&&n<57344;)t++;return t}function qm(e){let t=Bm("input",{class:"cm-textfield",name:"line",value:String(e.state.doc.lineAt(e.state.selection.main.head).number)});function n(){let n=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!n)return;let{state:i}=e,o=i.doc.lineAt(i.selection.main.head),[,r,s,l,a]=n,c=l?+l.slice(1):0,h=s?+s:o.number;if(s&&a){let e=h/100;r&&(e=e*("-"==r?-1:1)+o.number/i.doc.lines),h=Math.round(i.doc.lines*e)}else s&&r&&(h=h*("-"==r?-1:1)+o.number);let u=i.doc.line(Math.max(1,Math.min(i.doc.lines,h))),f=Wo.cursor(u.from+Math.max(0,Math.min(c,u.length)));e.dispatch({effects:[Um.of(!1),zc.scrollIntoView(f.from,{y:"center"})],selection:f}),e.focus()}return{dom:Bm("form",{class:"cm-gotoLine",onkeydown:t=>{27==t.keyCode?(t.preventDefault(),e.dispatch({effects:Um.of(!1)}),e.focus()):13==t.keyCode&&(t.preventDefault(),n())},onsubmit:e=>{e.preventDefault(),n()}},Bm("label",e.state.phrase("Go to line"),": ",t)," ",Bm("button",{class:"cm-button",type:"submit"},e.state.phrase("go")))}}"undefined"!=typeof Symbol&&(Wm.prototype[Symbol.iterator]=Qm.prototype[Symbol.iterator]=function(){return this});const Um=gr.define(),Gm=Ko.define({create:()=>!0,update(e,t){for(let n of t.effects)n.is(Um)&&(e=n.value);return e},provide:e=>ou.from(e,(e=>e?qm:null))}),Xm=zc.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Ym={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Km=Qo.define({combine:e=>Mr(e,Ym,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}),Zm=rl.mark({class:"cm-selectionMatch"}),Jm=rl.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function eg(e,t,n,i){return!(0!=n&&e(t.sliceDoc(n-1,n))==Sr.Word||i!=t.doc.length&&e(t.sliceDoc(i,i+1))==Sr.Word)}const tg=Tl.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(Km),{state:n}=e,i=n.selection;if(i.ranges.length>1)return rl.none;let o,r=i.main,s=null;if(r.empty){if(!t.highlightWordAroundCursor)return rl.none;let e=n.wordAt(r.head);if(!e)return rl.none;s=n.charCategorizer(r.head),o=n.sliceDoc(e.from,e.to)}else{let e=r.to-r.from;if(e<t.minSelectionLength||e>200)return rl.none;if(t.wholeWords){if(o=n.sliceDoc(r.from,r.to),s=n.charCategorizer(r.head),!eg(s,n,r.from,r.to)||!function(e,t,n,i){return e(t.sliceDoc(n,n+1))==Sr.Word&&e(t.sliceDoc(i-1,i))==Sr.Word}(s,n,r.from,r.to))return rl.none}else if(o=n.sliceDoc(r.from,r.to).trim(),!o)return rl.none}let l=[];for(let i of e.visibleRanges){let e=new Nm(n.doc,o,i.from,i.to);for(;!e.next().done;){let{from:i,to:o}=e.value;if((!s||eg(s,n,i,o))&&(r.empty&&i<=r.from&&o>=r.to?l.push(Jm.range(i,o)):(i>=r.to||o<=r.from)&&l.push(Zm.range(i,o)),l.length>t.maxMatches))return rl.none}}return rl.set(l)}},{decorations:e=>e.decorations}),ng=zc.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),ig=Qo.define({combine:e=>Mr(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Rg(e),scrollToMatch:e=>zc.scrollIntoView(e)})});class og{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||function(e){try{return new RegExp(e,Hm),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,((e,t)=>"n"==t?"\n":"r"==t?"\r":"t"==t?"\t":"\\"))}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new ug(this):new lg(this)}getCursor(e,t=0,n){let i=e.doc?e:Ar.create({doc:e});return null==n&&(n=i.doc.length),this.regexp?ag(this,i,t,n):sg(this,i,t,n)}}class rg{constructor(e){this.spec=e}}function sg(e,t,n,i){return new Nm(t.doc,e.unquoted,n,i,e.caseSensitive?void 0:e=>e.toLowerCase(),e.wholeWord?function(e,t){return(n,i,o,r)=>((r>n||r+o.length<i)&&(r=Math.max(0,n-2),o=e.sliceString(r,Math.min(e.length,i+2))),!(t(cg(o,n-r))==Sr.Word&&t(hg(o,n-r))==Sr.Word||t(hg(o,i-r))==Sr.Word&&t(cg(o,i-r))==Sr.Word))}(t.doc,t.charCategorizer(t.selection.main.head)):void 0)}class lg extends rg{constructor(e){super(e)}nextMatch(e,t,n){let i=sg(this.spec,e,n,e.doc.length).nextOverlapping();return i.done&&(i=sg(this.spec,e,0,t).nextOverlapping()),i.done?null:i.value}prevMatchInRange(e,t,n){for(let i=n;;){let n=Math.max(t,i-1e4-this.spec.unquoted.length),o=sg(this.spec,e,n,i),r=null;for(;!o.nextOverlapping().done;)r=o.value;if(r)return r;if(n==t)return null;i-=1e4}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=sg(this.spec,e,0,e.doc.length),i=[];for(;!n.next().done;){if(i.length>=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let o=sg(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!o.next().done;)i(o.value.from,o.value.to)}}function ag(e,t,n,i){return new Wm(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?(o=t.charCategorizer(t.selection.main.head),(e,t,n)=>!n[0].length||(o(cg(n.input,n.index))!=Sr.Word||o(hg(n.input,n.index))!=Sr.Word)&&(o(hg(n.input,n.index+n[0].length))!=Sr.Word||o(cg(n.input,n.index+n[0].length))!=Sr.Word)):void 0},n,i);var o}function cg(e,t){return e.slice(xo(e,t,!1),t)}function hg(e,t){return e.slice(t,xo(e,t))}class ug extends rg{nextMatch(e,t,n){let i=ag(this.spec,e,n,e.doc.length).next();return i.done&&(i=ag(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,n){for(let i=1;;i++){let o=Math.max(t,n-1e4*i),r=ag(this.spec,e,o,n),s=null;for(;!r.next().done;)s=r.value;if(s&&(o==t||s.from>o+10))return s;if(o==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,((t,n)=>"$"==n?"$":"&"==n?e.match[0]:"0"!=n&&+n<e.match.length?e.match[n]:t))}matchAll(e,t){let n=ag(this.spec,e,0,e.doc.length),i=[];for(;!n.next().done;){if(i.length>=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let o=ag(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!o.next().done;)i(o.value.from,o.value.to)}}const fg=gr.define(),dg=gr.define(),pg=Ko.define({create:e=>new mg(Eg(e).create(),null),update(e,t){for(let n of t.effects)n.is(fg)?e=new mg(n.value.create(),e.panel):n.is(dg)&&(e=new mg(e.query,n.value?Cg:null));return e},provide:e=>ou.from(e,(e=>e.panel))});class mg{constructor(e,t){this.query=e,this.panel=t}}const gg=rl.mark({class:"cm-searchMatch"}),bg=rl.mark({class:"cm-searchMatch cm-searchMatch-selected"}),vg=Tl.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(pg))}update(e){let t=e.state.field(pg);(t!=e.startState.field(pg)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return rl.none;let{view:n}=this,i=new _r;for(let t=0,o=n.visibleRanges,r=o.length;t<r;t++){let{from:s,to:l}=o[t];for(;t<r-1&&l>o[t+1].from-500;)l=o[++t].to;e.highlight(n.state,s,l,((e,t)=>{let o=n.state.selection.ranges.some((n=>n.from==e&&n.to==t));i.add(e,t,o?bg:gg)}))}return i.finish()}},{decorations:e=>e.decorations});function yg(e){return t=>{let n=t.state.field(pg,!1);return n&&n.query.spec.valid?e(t,n):Tg(t)}}const wg=yg(((e,{query:t})=>{let{to:n}=e.state.selection.main,i=t.nextMatch(e.state,n,n);if(!i)return!1;let o=Wo.single(i.from,i.to),r=e.state.facet(ig);return e.dispatch({selection:o,effects:[Ig(e,i),r.scrollToMatch(o.main,e)],userEvent:"select.search"}),Mg(e),!0})),kg=yg(((e,{query:t})=>{let{state:n}=e,{from:i}=n.selection.main,o=t.prevMatch(n,i,i);if(!o)return!1;let r=Wo.single(o.from,o.to),s=e.state.facet(ig);return e.dispatch({selection:r,effects:[Ig(e,o),s.scrollToMatch(r.main,e)],userEvent:"select.search"}),Mg(e),!0})),xg=yg(((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!(!n||!n.length||(e.dispatch({selection:Wo.create(n.map((e=>Wo.range(e.from,e.to)))),userEvent:"select.search.matches"}),0))})),Og=yg(((e,{query:t})=>{let{state:n}=e,{from:i,to:o}=n.selection.main;if(n.readOnly)return!1;let r=t.nextMatch(n,i,i);if(!r)return!1;let s,l,a=[],c=[];if(r.from==i&&r.to==o&&(l=n.toText(t.getReplacement(r)),a.push({from:r.from,to:r.to,insert:l}),r=t.nextMatch(n,r.from,r.to),c.push(zc.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(i).number)+"."))),r){let t=0==a.length||a[0].from>=r.to?0:r.to-r.from-l.length;s=Wo.single(r.from-t,r.to-t),c.push(Ig(e,r)),c.push(n.facet(ig).scrollToMatch(s.main,e))}return e.dispatch({changes:a,selection:s,effects:c,userEvent:"input.replace"}),!0})),Sg=yg(((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map((e=>{let{from:n,to:i}=e;return{from:n,to:i,insert:t.getReplacement(e)}}));if(!n.length)return!1;let i=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:zc.announce.of(i),userEvent:"input.replace.all"}),!0}));function Cg(e){return e.state.facet(ig).createPanel(e)}function Eg(e,t){var n,i,o,r,s;let l=e.selection.main,a=l.empty||l.to>l.from+100?"":e.sliceDoc(l.from,l.to);if(t&&!a)return t;let c=e.facet(ig);return new og({search:(null!==(n=null==t?void 0:t.literal)&&void 0!==n?n:c.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(i=null==t?void 0:t.caseSensitive)&&void 0!==i?i:c.caseSensitive,literal:null!==(o=null==t?void 0:t.literal)&&void 0!==o?o:c.literal,regexp:null!==(r=null==t?void 0:t.regexp)&&void 0!==r?r:c.regexp,wholeWord:null!==(s=null==t?void 0:t.wholeWord)&&void 0!==s?s:c.wholeWord})}function Ag(e){let t=eu(e,Cg);return t&&t.dom.querySelector("[main-field]")}function Mg(e){let t=Ag(e);t&&t==e.root.activeElement&&t.select()}const Tg=e=>{let t=e.state.field(pg,!1);if(t&&t.panel){let n=Ag(e);if(n&&n!=e.root.activeElement){let i=Eg(e.state,t.query.spec);i.valid&&e.dispatch({effects:fg.of(i)}),n.focus(),n.select()}}else e.dispatch({effects:[dg.of(!0),t?fg.of(Eg(e.state,t.query.spec)):gr.appendConfig.of(Ng)]});return!0},Dg=e=>{let t=e.state.field(pg,!1);if(!t||!t.panel)return!1;let n=eu(e,Cg);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:dg.of(!1)}),!0},Pg=[{key:"Mod-f",run:Tg,scope:"editor search-panel"},{key:"F3",run:wg,shift:kg,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:wg,shift:kg,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Dg,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:i,to:o}=n.main,r=[],s=0;for(let t=new Nm(e.doc,e.sliceDoc(i,o));!t.next().done;){if(r.length>1e3)return!1;t.value.from==i&&(s=r.length),r.push(Wo.range(t.value.from,t.value.to))}return t(e.update({selection:Wo.create(r,s),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:e=>{let t=eu(e,qm);if(!t){let n=[Um.of(!0)];null==e.state.field(Gm,!1)&&n.push(gr.appendConfig.of([Gm,Xm])),e.dispatch({effects:n}),t=eu(e,qm)}return t&&t.dom.querySelector("input").select(),!0}},{key:"Mod-d",run:({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some((e=>e.from===e.to)))return(({state:e,dispatch:t})=>{let{selection:n}=e,i=Wo.create(n.ranges.map((t=>e.wordAt(t.head)||Wo.cursor(t.head))),n.mainIndex);return!i.eq(n)&&(t(e.update({selection:i})),!0)})({state:e,dispatch:t});let i=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some((t=>e.sliceDoc(t.from,t.to)!=i)))return!1;let o=function(e,t){let{main:n,ranges:i}=e.selection,o=e.wordAt(n.head),r=o&&o.from==n.from&&o.to==n.to;for(let n=!1,o=new Nm(e.doc,t,i[i.length-1].to);;){if(o.next(),!o.done){if(n&&i.some((e=>e.from==o.value.from)))continue;if(r){let t=e.wordAt(o.value.from);if(!t||t.from!=o.value.from||t.to!=o.value.to)continue}return o.value}if(n)return null;o=new Nm(e.doc,t,0,Math.max(0,i[i.length-1].from-1)),n=!0}}(e,i);return!!o&&(t(e.update({selection:e.selection.addRange(Wo.range(o.from,o.to),!1),effects:zc.scrollIntoView(o.to)})),!0)},preventDefault:!0}];class Rg{constructor(e){this.view=e;let t=this.query=e.state.field(pg).query.spec;function n(e,t,n){return Bm("button",{class:"cm-button",name:e,onclick:t,type:"button"},n)}this.commit=this.commit.bind(this),this.searchField=Bm("input",{value:t.search,placeholder:$g(e,"Find"),"aria-label":$g(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Bm("input",{value:t.replace,placeholder:$g(e,"Replace"),"aria-label":$g(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Bm("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=Bm("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=Bm("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=Bm("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,n("next",(()=>wg(e)),[$g(e,"next")]),n("prev",(()=>kg(e)),[$g(e,"previous")]),n("select",(()=>xg(e)),[$g(e,"all")]),Bm("label",null,[this.caseField,$g(e,"match case")]),Bm("label",null,[this.reField,$g(e,"regexp")]),Bm("label",null,[this.wordField,$g(e,"by word")]),...e.state.readOnly?[]:[Bm("br"),this.replaceField,n("replace",(()=>Og(e)),[$g(e,"replace")]),n("replaceAll",(()=>Sg(e)),[$g(e,"replace all")])],Bm("button",{name:"close",onclick:()=>Dg(e),"aria-label":$g(e,"close"),type:"button"},["×"])])}commit(){let e=new og({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:fg.of(e)}))}keydown(e){var t,n;n=e,th(Zc((t=this.view).state),n,t,"search-panel")?e.preventDefault():13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?kg:wg)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),Og(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(fg)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(ig).top}}function $g(e,t){return e.state.phrase(t)}const _g=30,Bg=/[\s\.,:;?!]/;function Ig(e,{from:t,to:n}){let i=e.state.doc.lineAt(t),o=e.state.doc.lineAt(n).to,r=Math.max(i.from,t-_g),s=Math.min(o,n+_g),l=e.state.sliceDoc(r,s);if(r!=i.from)for(let e=0;e<_g;e++)if(!Bg.test(l[e+1])&&Bg.test(l[e])){l=l.slice(e);break}if(s!=o)for(let e=l.length-1;e>l.length-_g;e--)if(!Bg.test(l[e-1])&&Bg.test(l[e])){l=l.slice(0,e);break}return zc.announce.of(`${e.state.phrase("current match")}. ${l} ${e.state.phrase("on line")} ${i.number}.`)}const Lg=zc.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Ng=[pg,Jo.low(vg),Lg];class Vg{constructor(e,t,n){this.state=e,this.pos=t,this.explicit=n,this.abortListeners=[]}tokenBefore(e){let t=Nf(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),i=t.text.slice(n-t.from,this.pos-t.from),o=i.search(Fg(e,!1));return o<0?null:{from:n+o,to:this.pos,text:i.slice(o)}}get aborted(){return null==this.abortListeners}addEventListener(e,t){"abort"==e&&this.abortListeners&&this.abortListeners.push(t)}}function Hg(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}class Wg{constructor(e,t,n,i){this.completion=e,this.source=t,this.match=n,this.score=i}}function zg(e){return e.selection.main.from}function Fg(e,t){var n;let{source:i}=e,o=t&&"^"!=i[0],r="$"!=i[i.length-1];return o||r?new RegExp(`${o?"^":""}(?:${i})${r?"$":""}`,null!==(n=e.flags)&&void 0!==n?n:e.ignoreCase?"i":""):e}const Qg=dr.define(),jg=new WeakMap;function qg(e){if(!Array.isArray(e))return e;let t=jg.get(e);return t||jg.set(e,t=function(e){let t=e.map((e=>"string"==typeof e?{label:e}:e)),[n,i]=t.every((e=>/^\w+$/.test(e.label)))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),n=Object.create(null);for(let{label:i}of e){t[i[0]]=!0;for(let e=1;e<i.length;e++)n[i[e]]=!0}let i=Hg(t)+Hg(n)+"*$";return[new RegExp("^"+i),new RegExp(i)]}(t);return e=>{let o=e.matchBefore(i);return o||e.explicit?{from:o?o.from:e.pos,options:t,validFor:n}:null}}(e)),t}const Ug=gr.define(),Gg=gr.define();class Xg{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=Ao(e,t),i=To(n);this.chars.push(n);let o=e.slice(t,t+i),r=o.toUpperCase();this.folded.push(Ao(r==o?o.toLowerCase():r,0)),t+=i}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,!0}match(e){if(0==this.pattern.length)return this.ret(-100,[]);if(e.length<this.pattern.length)return!1;let{chars:t,folded:n,any:i,precise:o,byWord:r}=this;if(1==t.length){let i=Ao(e,0),o=To(i),r=o==e.length?0:-100;if(i==t[0]);else{if(i!=n[0])return!1;r+=-200}return this.ret(r,[0,o])}let s=e.indexOf(this.pattern);if(0==s)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=t.length,a=0;if(s<0){for(let o=0,r=Math.min(e.length,200);o<r&&a<l;){let r=Ao(e,o);r!=t[a]&&r!=n[a]||(i[a++]=o),o+=To(r)}if(a<l)return!1}let c=0,h=0,u=!1,f=0,d=-1,p=-1,m=/[a-z]/.test(e),g=!0;for(let i=0,a=Math.min(e.length,200),b=0;i<a&&h<l;){let a=Ao(e,i);s<0&&(c<l&&a==t[c]&&(o[c++]=i),f<l&&(a==t[f]||a==n[f]?(0==f&&(d=i),p=i+1,f++):f=0));let v,y=a<255?a>=48&&a<=57||a>=97&&a<=122?2:a>=65&&a<=90?1:0:(v=Mo(a))!=v.toLowerCase()?1:v!=v.toUpperCase()?2:0;(!i||1==y&&m||0==b&&0!=y)&&(t[h]==a||n[h]==a&&(u=!0)?r[h++]=i:r.length&&(g=!1)),b=y,i+=To(a)}return h==l&&0==r[0]&&g?this.result((u?-200:0)-100,r,e):f==l&&0==d?this.ret(-200-e.length+(p==e.length?0:-100),[0,p]):s>-1?this.ret(-700-e.length,[s,s+this.pattern.length]):f==l?this.ret(-900-e.length,[d,p]):h==l?this.result((u?-200:0)-100-700+(g?0:-1100),r,e):2!=t.length&&this.result((i[0]?-700:0)-200-1100,i,e)}result(e,t,n){let i=[],o=0;for(let e of t){let t=e+(this.astral?To(Ao(n,e)):1);o&&i[o-1]==e?i[o-1]=t:(i[o++]=e,i[o++]=t)}return this.ret(e-n.length,i)}}const Yg=Qo.define({combine:e=>Mr(e,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Zg,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>Kg(e(n),t(n)),optionClass:(e,t)=>n=>Kg(e(n),t(n)),addToOptions:(e,t)=>e.concat(t)})});function Kg(e,t){return e?t?e+" "+t:e:t}function Zg(e,t,n,i,o,r){let s,l,a=e.textDirection==zl.RTL,c=a,h=!1,u="top",f=t.left-o.left,d=o.right-t.right,p=i.right-i.left,m=i.bottom-i.top;if(c&&f<Math.min(p,d)?c=!1:!c&&d<Math.min(p,f)&&(c=!0),p<=(c?f:d))s=Math.max(o.top,Math.min(n.top,o.bottom-m))-t.top,l=Math.min(400,c?f:d);else{h=!0,l=Math.min(400,(a?t.right:o.right-t.left)-30);let e=o.bottom-t.bottom;e>=m||e>t.top?s=n.bottom-t.top:(u="bottom",s=t.bottom-n.top)}return{style:`${u}: ${s/((t.bottom-t.top)/r.offsetHeight)}px; max-width: ${l/((t.right-t.left)/r.offsetWidth)}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":c?"left":"right")}}function Jg(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let i=Math.floor((e-t)/n);return{from:e-(i+1)*n,to:e-i*n}}class eb{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass="";let i=e.state.field(t),{options:o,selected:r}=i.open,s=e.state.facet(Yg);this.optionContent=function(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map((e=>"cm-completionIcon-"+e))),t.setAttribute("aria-hidden","true"),t},position:20}),t.push({render(e,t,n,i){let o=document.createElement("span");o.className="cm-completionLabel";let r=e.displayLabel||e.label,s=0;for(let e=0;e<i.length;){let t=i[e++],n=i[e++];t>s&&o.appendChild(document.createTextNode(r.slice(s,t)));let l=o.appendChild(document.createElement("span"));l.appendChild(document.createTextNode(r.slice(t,n))),l.className="cm-completionMatchedText",s=n}return s<r.length&&o.appendChild(document.createTextNode(r.slice(s))),o},position:50},{render(e){if(!e.detail)return null;let t=document.createElement("span");return t.className="cm-completionDetail",t.textContent=e.detail,t},position:80}),t.sort(((e,t)=>e.position-t.position)).map((e=>e.render))}(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=Jg(o.length,r,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",(n=>{let{options:i}=e.state.field(t).open;for(let t,o=n.target;o&&o!=this.dom;o=o.parentNode)if("LI"==o.nodeName&&(t=/-(\d+)$/.exec(o.id))&&+t[1]<i.length)return this.applyCompletion(e,i[+t[1]]),void n.preventDefault()})),this.dom.addEventListener("focusout",(t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(Yg).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:Gg.of(null)})})),this.showOptions(o,i.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}update(e){var t;let n=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=i){let{options:o,selected:r,disabled:s}=n.open;i.open&&i.open.options==o||(this.range=Jg(o.length,r,e.state.facet(Yg).maxRenderedOptions),this.showOptions(o,n.id)),this.updateSel(),s!=(null===(t=i.open)||void 0===t?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!s)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=Jg(t.options.length,t.selected,this.view.state.facet(Yg).maxRenderedOptions),this.showOptions(t.options,e.id)),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:n}=t.options[t.selected],{info:i}=n;if(!i)return;let o="string"==typeof i?document.createTextNode(i):i(n);if(!o)return;"then"in o?o.then((t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,n)})).catch((e=>Cl(this.view.state,e,"completion info"))):this.addInfoPane(o,n)}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",null!=e.nodeType)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:i}=e;n.appendChild(t),this.infoDestroy=i||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)"LI"==n.nodeName&&n.id?i==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected"):i--;return t&&function(e,t){let n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),o=n.height/e.offsetHeight;i.top<n.top?e.scrollTop-=(n.top-i.top)/o:i.bottom>n.bottom&&(e.scrollTop+=(i.bottom-n.bottom)/o)}(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),o=this.space;if(!o){let e=this.dom.ownerDocument.defaultView||window;o={left:0,top:0,right:e.innerWidth,bottom:e.innerHeight}}return i.top>Math.min(o.bottom,t.bottom)-10||i.bottom<Math.max(o.top,t.top)+10?null:this.view.state.facet(Yg).positionInfo(this.view,t,i,n,o,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,n){const i=document.createElement("ul");i.id=t,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions"));let o=null;for(let r=n.from;r<n.to;r++){let{completion:s,match:l}=e[r],{section:a}=s;if(a){let e="string"==typeof a?a:a.name;e!=o&&(r>n.from||0==n.from)&&(o=e,"string"!=typeof a&&a.header?i.appendChild(a.header(a)):i.appendChild(document.createElement("completion-section")).textContent=e)}const c=i.appendChild(document.createElement("li"));c.id=t+"-"+r,c.setAttribute("role","option");let h=this.optionClass(s);h&&(c.className=h);for(let e of this.optionContent){let t=e(s,this.view.state,this.view,l);t&&c.appendChild(t)}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function tb(e,t){return n=>new eb(n,e,t)}function nb(e){return 100*(e.boost||0)+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}class ib{constructor(e,t,n,i,o,r){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=i,this.selected=o,this.disabled=r}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new ib(this.options,sb(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,i,o){let r=function(e,t){let n=[],i=null,o=e=>{n.push(e);let{section:t}=e.completion;if(t){i||(i=[]);let e="string"==typeof t?t:t.name;i.some((t=>t.name==e))||i.push("string"==typeof t?{name:e}:t)}};for(let i of e)if(i.hasResult()){let e=i.result.getMatch;if(!1===i.result.filter)for(let t of i.result.options)o(new Wg(t,i.source,e?e(t):[],1e9-n.length));else{let n=new Xg(t.sliceDoc(i.from,i.to));for(let t of i.result.options)if(n.match(t.label)){let r=t.displayLabel?e?e(t,n.matched):[]:n.matched;o(new Wg(t,i.source,r,n.score+(t.boost||0)))}}}if(i){let e=Object.create(null),t=0,o=(e,t)=>{var n,i;return(null!==(n=e.rank)&&void 0!==n?n:1e9)-(null!==(i=t.rank)&&void 0!==i?i:1e9)||(e.name<t.name?-1:1)};for(let n of i.sort(o))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e["string"==typeof n?n:n.name])}}let r=[],s=null,l=t.facet(Yg).compareCompletions;for(let e of n.sort(((e,t)=>t.score-e.score||l(e.completion,t.completion)))){let t=e.completion;!s||s.label!=t.label||s.detail!=t.detail||null!=s.type&&null!=t.type&&s.type!=t.type||s.apply!=t.apply||s.boost!=t.boost?r.push(e):nb(e.completion)>nb(s)&&(r[r.length-1]=e),s=e.completion}return r}(e,t);if(!r.length)return i&&e.some((e=>1==e.state))?new ib(i.options,i.attrs,i.tooltip,i.timestamp,i.selected,!0):null;let s=t.facet(Yg).selectOnOpen?0:-1;if(i&&i.selected!=s&&-1!=i.selected){let e=i.options[i.selected].completion;for(let t=0;t<r.length;t++)if(r[t].completion==e){s=t;break}}return new ib(r,sb(n,s),{pos:e.reduce(((e,t)=>t.hasResult()?Math.min(e,t.from):e),1e8),create:mb,above:o.aboveCursor},i?i.timestamp:Date.now(),s,!1)}map(e){return new ib(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class ob{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new ob(lb,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,n=t.facet(Yg),i=(n.override||t.languageDataAt("autocomplete",zg(t)).map(qg)).map((t=>(this.active.find((e=>e.source==t))||new cb(t,this.active.some((e=>0!=e.state))?1:0)).update(e,n)));i.length==this.active.length&&i.every(((e,t)=>e==this.active[t]))&&(i=this.active);let o=this.open;o&&e.docChanged&&(o=o.map(e.changes)),e.selection||i.some((t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to)))||!function(e,t){if(e==t)return!0;for(let n=0,i=0;;){for(;n<e.length&&!e[n].hasResult;)n++;for(;i<t.length&&!t[i].hasResult;)i++;let o=n==e.length,r=i==t.length;if(o||r)return o==r;if(e[n++].result!=t[i++].result)return!1}}(i,this.active)?o=ib.build(i,t,this.id,o,n):o&&o.disabled&&!i.some((e=>1==e.state))&&(o=null),!o&&i.every((e=>1!=e.state))&&i.some((e=>e.hasResult()))&&(i=i.map((e=>e.hasResult()?new cb(e.source,0):e)));for(let t of e.effects)t.is(fb)&&(o=o&&o.setSelected(t.value,this.id));return i==this.active&&o==this.open?this:new ob(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:rb}}const rb={"aria-autocomplete":"list"};function sb(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const lb=[];function ab(e){return e.isUserEvent("input.type")?"input":e.isUserEvent("delete.backward")?"delete":null}class cb{constructor(e,t,n=-1){this.source=e,this.state=t,this.explicitPos=n}hasResult(){return!1}update(e,t){let n=ab(e),i=this;n?i=i.handleUserEvent(e,n,t):e.docChanged?i=i.handleChange(e):e.selection&&0!=i.state&&(i=new cb(i.source,0));for(let t of e.effects)if(t.is(Ug))i=new cb(i.source,1,t.value?zg(e.state):-1);else if(t.is(Gg))i=new cb(i.source,0);else if(t.is(ub))for(let e of t.value)e.source==i.source&&(i=e);return i}handleUserEvent(e,t,n){return"delete"!=t&&n.activateOnTyping?new cb(this.source,1):this.map(e.changes)}handleChange(e){return e.changes.touchesRange(zg(e.startState))?new cb(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new cb(this.source,this.state,e.mapPos(this.explicitPos))}}class hb extends cb{constructor(e,t,n,i,o){super(e,2,t),this.result=n,this.from=i,this.to=o}hasResult(){return!0}handleUserEvent(e,t,n){var i;let o=e.changes.mapPos(this.from),r=e.changes.mapPos(this.to,1),s=zg(e.state);if((this.explicitPos<0?s<=o:s<this.from)||s>r||"delete"==t&&zg(e.startState)==this.from)return new cb(this.source,"input"==t&&n.activateOnTyping?1:0);let l,a=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos);return function(e,t,n,i){if(!e)return!1;let o=t.sliceDoc(n,i);return"function"==typeof e?e(o,n,i,t):Fg(e,!0).test(o)}(this.result.validFor,e.state,o,r)?new hb(this.source,a,this.result,o,r):this.result.update&&(l=this.result.update(this.result,o,r,new Vg(e.state,s,a>=0)))?new hb(this.source,a,l,l.from,null!==(i=l.to)&&void 0!==i?i:zg(e.state)):new cb(this.source,1,a)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new cb(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new hb(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}const ub=gr.define({map:(e,t)=>e.map((e=>e.map(t)))}),fb=gr.define(),db=Ko.define({create:()=>ob.start(),update:(e,t)=>e.update(t),provide:e=>[Qh.from(e,(e=>e.tooltip)),zc.contentAttributes.from(e,(e=>e.attrs))]});function pb(e,t){const n=t.completion.apply||t.completion.label;let i=e.state.field(db).active.find((e=>e.source==t.source));return i instanceof hb&&("string"==typeof n?e.dispatch(Object.assign(Object.assign({},function(e,t,n,i){let{main:o}=e.selection,r=n-o.from,s=i-o.from;return Object.assign(Object.assign({},e.changeByRange((l=>l!=o&&n!=i&&e.sliceDoc(l.from+r,l.from+s)!=e.sliceDoc(n,i)?{range:l}:{changes:{from:l.from+r,to:i==o.from?l.to:l.from+s,insert:t},range:Wo.cursor(l.from+r+t.length)}))),{scrollIntoView:!0,userEvent:"input.complete"})}(e.state,n,i.from,i.to)),{annotations:Qg.of(t.completion)})):n(e,t.completion,i.from,i.to),!0)}const mb=tb(db,pb);function gb(e,t="option"){return n=>{let i=n.state.field(db,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<n.state.facet(Yg).interactionDelay)return!1;let o,r=1;"page"==t&&(o=Kh(n,i.open.tooltip))&&(r=Math.max(2,Math.floor(o.dom.offsetHeight/o.dom.querySelector("li").offsetHeight)-1));let{length:s}=i.open.options,l=i.open.selected>-1?i.open.selected+r*(e?1:-1):e?0:s-1;return l<0?l="page"==t?0:s-1:l>=s&&(l="page"==t?s-1:0),n.dispatch({effects:fb.of(l)}),!0}}class bb{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const vb=Tl.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0;for(let t of e.state.field(db).active)1==t.state&&this.startQuery(t)}update(e){let t=e.state.field(db);if(!e.selectionSet&&!e.docChanged&&e.startState.field(db)==t)return;let n=e.transactions.some((e=>(e.selection||e.docChanged)&&!ab(e)));for(let t=0;t<this.running.length;t++){let i=this.running[t];if(n||i.updates.length+e.transactions.length>50&&Date.now()-i.time>1e3){for(let e of i.context.abortListeners)try{e()}catch(e){Cl(this.view.state,e)}i.context.abortListeners=null,this.running.splice(t--,1)}else i.updates.push(...e.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=t.active.some((e=>1==e.state&&!this.running.some((t=>t.active.source==e.source))))?setTimeout((()=>this.startUpdate()),50):-1,0!=this.composing)for(let t of e.transactions)"input"==ab(t)?this.composing=2:2==this.composing&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:e}=this.view,t=e.field(db);for(let e of t.active)1!=e.state||this.running.some((t=>t.active.source==e.source))||this.startQuery(e)}startQuery(e){let{state:t}=this.view,n=zg(t),i=new Vg(t,n,e.explicitPos==n),o=new bb(e,i);this.running.push(o),Promise.resolve(e.source(i)).then((e=>{o.context.aborted||(o.done=e||null,this.scheduleAccept())}),(e=>{this.view.dispatch({effects:Gg.of(null)}),Cl(this.view.state,e)}))}scheduleAccept(){this.running.every((e=>void 0!==e.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),this.view.state.facet(Yg).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(Yg);for(let i=0;i<this.running.length;i++){let o=this.running[i];if(void 0===o.done)continue;if(this.running.splice(i--,1),o.done){let i=new hb(o.active.source,o.active.explicitPos,o.done,o.done.from,null!==(e=o.done.to)&&void 0!==e?e:zg(o.updates.length?o.updates[0].startState:this.view.state));for(let e of o.updates)i=i.update(e,n);if(i.hasResult()){t.push(i);continue}}let r=this.view.state.field(db).active.find((e=>e.source==o.active.source));if(r&&1==r.state)if(null==o.done){let e=new cb(o.active.source,0);for(let t of o.updates)e=e.update(t,n);1!=e.state&&t.push(e)}else this.startQuery(r)}t.length&&this.view.dispatch({effects:ub.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(db,!1);if(t&&t.tooltip&&this.view.state.facet(Yg).closeOnBlur){let n=t.open&&Kh(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||this.view.dispatch({effects:Gg.of(null)})}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:Ug.of(!1)})),20),this.composing=0}}}),yb=zc.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),wb={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},kb=gr.define({map(e,t){let n=t.mapPos(e,-1,Po.TrackAfter);return null==n?void 0:n}}),xb=new class extends Tr{};xb.startSide=1,xb.endSide=-1;const Ob=Ko.define({create:()=>$r.empty,update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(kb)&&(e=e.update({add:[xb.range(n.value,n.value+1)]}));return e}}),Sb="()[]{}<>";function Cb(e){for(let t=0;t<8;t+=2)if(Sb.charCodeAt(t)==e)return Sb.charAt(t+1);return Mo(e<128?e:e+1)}function Eb(e,t){return e.languageDataAt("closeBrackets",t)[0]||wb}const Ab="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Mb=zc.inputHandler.of(((e,t,n,i)=>{if((Ab?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let o=e.state.selection.main;if(i.length>2||2==i.length&&1==To(Ao(i,0))||t!=o.from||n!=o.to)return!1;let r=function(e,t){let n=Eb(e,e.selection.main.head),i=n.brackets||wb.brackets;for(let o of i){let r=Cb(Ao(o,0));if(t==o)return r==o?_b(e,o,i.indexOf(o+o+o)>-1,n):Rb(e,o,r,n.before||wb.before);if(t==r&&Db(e,e.selection.main.from))return $b(e,0,r)}return null}(e.state,i);return!!r&&(e.dispatch(r),!0)})),Tb=[{key:"Backspace",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Eb(e,e.selection.main.head).brackets||wb.brackets,i=null,o=e.changeByRange((t=>{if(t.empty){let i=function(e,t){let n=e.sliceString(t-2,t);return To(Ao(n,0))==n.length?n:n.slice(1)}(e.doc,t.head);for(let o of n)if(o==i&&Pb(e.doc,t.head)==Cb(Ao(o,0)))return{changes:{from:t.head-o.length,to:t.head+o.length},range:Wo.cursor(t.head-o.length)}}return{range:i=t}}));return i||t(e.update(o,{scrollIntoView:!0,userEvent:"delete.backward"})),!i}}];function Db(e,t){let n=!1;return e.field(Ob).between(0,e.doc.length,(e=>{e==t&&(n=!0)})),n}function Pb(e,t){let n=e.sliceString(t,t+2);return n.slice(0,To(Ao(n,0)))}function Rb(e,t,n,i){let o=null,r=e.changeByRange((r=>{if(!r.empty)return{changes:[{insert:t,from:r.from},{insert:n,from:r.to}],effects:kb.of(r.to+t.length),range:Wo.range(r.anchor+t.length,r.head+t.length)};let s=Pb(e.doc,r.head);return!s||/\s/.test(s)||i.indexOf(s)>-1?{changes:{insert:t+n,from:r.head},effects:kb.of(r.head+t.length),range:Wo.cursor(r.head+t.length)}:{range:o=r}}));return o?null:e.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function $b(e,t,n){let i=null,o=e.changeByRange((t=>t.empty&&Pb(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:Wo.cursor(t.head+n.length)}:i={range:t}));return i?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function _b(e,t,n,i){let o=i.stringPrefixes||wb.stringPrefixes,r=null,s=e.changeByRange((i=>{if(!i.empty)return{changes:[{insert:t,from:i.from},{insert:t,from:i.to}],effects:kb.of(i.to+t.length),range:Wo.range(i.anchor+t.length,i.head+t.length)};let s,l=i.head,a=Pb(e.doc,l);if(a==t){if(Bb(e,l))return{changes:{insert:t+t,from:l},effects:kb.of(l+t.length),range:Wo.cursor(l+t.length)};if(Db(e,l)){let i=n&&e.sliceDoc(l,l+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:l,to:l+i.length,insert:i},range:Wo.cursor(l+i.length)}}}else{if(n&&e.sliceDoc(l-2*t.length,l)==t+t&&(s=Ib(e,l-2*t.length,o))>-1&&Bb(e,s))return{changes:{insert:t+t+t+t,from:l},effects:kb.of(l+t.length),range:Wo.cursor(l+t.length)};if(e.charCategorizer(l)(a)!=Sr.Word&&Ib(e,l,o)>-1&&!function(e,t,n,i){let o=Nf(e).resolveInner(t,-1),r=i.reduce(((e,t)=>Math.max(e,t.length)),0);for(let s=0;s<5;s++){let s=e.sliceDoc(o.from,Math.min(o.to,o.from+n.length+r)),l=s.indexOf(n);if(!l||l>-1&&i.indexOf(s.slice(0,l))>-1){let t=o.firstChild;for(;t&&t.from==o.from&&t.to-t.from>n.length+l;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let a=o.to==t&&o.parent;if(!a)break;o=a}return!1}(e,l,t,o))return{changes:{insert:t+t,from:l},effects:kb.of(l+t.length),range:Wo.cursor(l+t.length)}}return{range:r=i}}));return r?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Bb(e,t){let n=Nf(e).resolveInner(t+1);return n.parent&&n.from==t}function Ib(e,t,n){let i=e.charCategorizer(t);if(i(e.sliceDoc(t-1,t))!=Sr.Word)return t;for(let o of n){let n=t-o.length;if(e.sliceDoc(n,t)==o&&i(e.sliceDoc(n-1,n))!=Sr.Word)return n}return-1}const Lb=[{key:"Ctrl-Space",run:e=>!!e.state.field(db,!1)&&(e.dispatch({effects:Ug.of(!0)}),!0)},{key:"Escape",run:e=>{let t=e.state.field(db,!1);return!(!t||!t.active.some((e=>0!=e.state))||(e.dispatch({effects:Gg.of(null)}),0))}},{key:"ArrowDown",run:gb(!0)},{key:"ArrowUp",run:gb(!1)},{key:"PageDown",run:gb(!0,"page")},{key:"PageUp",run:gb(!1,"page")},{key:"Enter",run:e=>{let t=e.state.field(db,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(Yg).interactionDelay)&&pb(e,t.open.options[t.open.selected])}}],Nb=Jo.highest(Yc.computeN([Yg],(e=>e.facet(Yg).defaultKeymap?[Lb]:[])));class Vb{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class Hb{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let i=e,o=n.facet(Kb).markerFilter;o&&(i=o(i));let r=rl.set(i.map((e=>e.from==e.to||e.from==e.to-1&&n.doc.lineAt(e.from).to==e.from?rl.widget({widget:new ev(e),diagnostic:e}).range(e.from):rl.mark({attributes:{class:"cm-lintRange cm-lintRange-"+e.severity+(e.markClass?" "+e.markClass:"")},diagnostic:e}).range(e.from,e.to))),!0);return new Hb(r,t,Wb(r))}}function Wb(e,t=null,n=0){let i=null;return e.between(n,1e9,((e,n,{spec:o})=>{if(!t||o.diagnostic==t)return i=new Vb(e,n,o.diagnostic),!1})),i}const zb=gr.define(),Fb=gr.define(),Qb=gr.define(),jb=Ko.define({create:()=>new Hb(rl.none,null,null),update(e,t){if(t.docChanged){let n=e.diagnostics.map(t.changes),i=null;if(e.selected){let o=t.changes.mapPos(e.selected.from,1);i=Wb(n,e.selected.diagnostic,o)||Wb(n,null,o)}e=new Hb(n,e.panel,i)}for(let n of t.effects)n.is(zb)?e=Hb.init(n.value,e.panel,t.state):n.is(Fb)?e=new Hb(e.diagnostics,n.value?nv.open:null,e.selected):n.is(Qb)&&(e=new Hb(e.diagnostics,e.panel,n.value));return e},provide:e=>[ou.from(e,(e=>e.panel)),zc.decorations.from(e,(e=>e.diagnostics))]}),qb=rl.mark({class:"cm-lintRange cm-lintRange-active"});function Ub(e,t,n){let{diagnostics:i}=e.state.field(jb),o=[],r=2e8,s=0;i.between(t-(n<0?1:0),t+(n>0?1:0),((e,i,{spec:l})=>{t>=e&&t<=i&&(e==i||(t>e||n>0)&&(t<i||n<0))&&(o.push(l.diagnostic),r=Math.min(e,r),s=Math.max(i,s))}));let l=e.state.facet(Kb).tooltipFilter;return l&&(o=l(o)),o.length?{pos:r,end:s,above:e.state.doc.lineAt(r).to<s,create:()=>({dom:Gb(e,o)})}:null}function Gb(e,t){return Bm("ul",{class:"cm-tooltip-lint"},t.map((t=>Jb(e,t,!1))))}const Xb=e=>{let t=e.state.field(jb,!1);return!(!t||!t.panel||(e.dispatch({effects:Fb.of(!1)}),0))},Yb=[{key:"Mod-Shift-m",run:e=>{let t=e.state.field(jb,!1);var n,i;t&&t.panel||e.dispatch({effects:(n=e.state,i=[Fb.of(!0)],n.field(jb,!1)?i:i.concat(gr.appendConfig.of(rv)))});let o=eu(e,nv.open);return o&&o.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:e=>{let t=e.state.field(jb,!1);if(!t)return!1;let n=e.state.selection.main,i=t.diagnostics.iter(n.to+1);return!(!i.value&&(i=t.diagnostics.iter(0),!i.value||i.from==n.from&&i.to==n.to)||(e.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),0))}}],Kb=Qo.define({combine:e=>Object.assign({sources:e.map((e=>e.source))},Mr(e.map((e=>e.config)),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t}))});function Zb(e){let t=[];if(e)e:for(let{name:n}of e){for(let e=0;e<n.length;e++){let i=n[e];if(/[a-zA-Z]/.test(i)&&!t.some((e=>e.toLowerCase()==i.toLowerCase()))){t.push(i);continue e}}t.push("")}return t}function Jb(e,t,n){var i;let o=n?Zb(t.actions):[];return Bm("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},Bm("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage():t.message),null===(i=t.actions)||void 0===i?void 0:i.map(((n,i)=>{let r=!1,s=i=>{if(i.preventDefault(),r)return;r=!0;let o=Wb(e.state.field(jb).diagnostics,t);o&&n.apply(e,o.from,o.to)},{name:l}=n,a=o[i]?l.indexOf(o[i]):-1,c=a<0?l:[l.slice(0,a),Bm("u",l.slice(a,a+1)),l.slice(a+1)];return Bm("button",{type:"button",class:"cm-diagnosticAction",onclick:s,onmousedown:s,"aria-label":` Action: ${l}${a<0?"":` (access key "${o[i]})"`}.`},c)})),t.source&&Bm("div",{class:"cm-diagnosticSource"},t.source))}class ev extends il{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return Bm("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class tv{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=Jb(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class nv{constructor(e){this.view=e,this.items=[],this.list=Bm("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(27==t.keyCode)Xb(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:n}=this.items[this.selectedIndex],i=Zb(n.actions);for(let o=0;o<i.length;o++)if(i[o].toUpperCase().charCodeAt(0)==t.keyCode){let t=Wb(this.view.state.field(jb).diagnostics,n);t&&n.actions[o].apply(e,t.from,t.to)}}}t.preventDefault()},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=Bm("div",{class:"cm-panel-lint"},this.list,Bm("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Xb(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(jb).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(jb),n=0,i=!1,o=null;for(e.between(0,this.view.state.doc.length,((e,r,{spec:s})=>{let l,a=-1;for(let e=n;e<this.items.length;e++)if(this.items[e].diagnostic==s.diagnostic){a=e;break}a<0?(l=new tv(this.view,s.diagnostic),this.items.splice(n,0,l),i=!0):(l=this.items[a],a>n&&(this.items.splice(n,a-n),i=!0)),t&&l.diagnostic==t.diagnostic?l.dom.hasAttribute("aria-selected")||(l.dom.setAttribute("aria-selected","true"),o=l):l.dom.hasAttribute("aria-selected")&&l.dom.removeAttribute("aria-selected"),n++}));n<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();0==this.items.length&&(this.items.push(new tv(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),o?(this.list.setAttribute("aria-activedescendant",o.id),this.view.requestMeasure({key:this,read:()=>({sel:o.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=Wb(this.view.state.field(jb).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:Qb.of(t)})}static open(e){return new nv(e)}}function iv(e){return function(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const ov=zc.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:iv("#d11")},".cm-lintRange-warning":{backgroundImage:iv("orange")},".cm-lintRange-info":{backgroundImage:iv("#999")},".cm-lintRange-hint":{backgroundImage:iv("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}}),rv=[jb,zc.decorations.compute([jb],(e=>{let{selected:t,panel:n}=e.field(jb);return t&&n&&t.from!=t.to?rl.set([qb.range(t.from,t.to)]):rl.none})),Yh(Ub,{hideOn:function(e,t){let n=e.startState.doc.lineAt(t.pos);return!(!e.effects.some((e=>e.is(zb)))&&!e.changes.touchesRange(n.from,n.to))}}),ov];var sv=function(e){void 0===e&&(e={});var{crosshairCursor:t=!1}=e,n=[];!1!==e.closeBracketsKeymap&&(n=n.concat(Tb)),!1!==e.defaultKeymap&&(n=n.concat($m)),!1!==e.searchKeymap&&(n=n.concat(Pg)),!1!==e.historyKeymap&&(n=n.concat(Ip)),!1!==e.foldKeymap&&(n=n.concat(kd)),!1!==e.completionKeymap&&(n=n.concat(Lb)),!1!==e.lintKeymap&&(n=n.concat(Yb));var i=[];return!1!==e.lineNumbers&&i.push(function(e={}){return[yu.of(e),uu(),xu]}()),!1!==e.highlightActiveLineGutter&&i.push(Cu),!1!==e.highlightSpecialChars&&i.push(function(e={}){return[Ch.of(e),Eh||(Eh=Tl.fromClass(class{constructor(e){this.view=e,this.decorations=rl.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(Ch)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new wh({regexp:e.specialChars,decoration:(t,n,i)=>{let{doc:o}=n.state,r=Ao(t[0],0);if(9==r){let e=o.lineAt(i),t=n.state.tabSize,r=jr(e.text,t,i-e.from);return rl.replace({widget:new Mh((t-r%t)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=rl.replace({widget:new Ah(e,r)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(Ch);e.startState.facet(Ch)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))]}()),!1!==e.history&&i.push(function(e={}){return[vp,bp.of(e),zc.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?kp:"historyRedo"==e.inputType?xp:null;return!!n&&(e.preventDefault(),n(t))}})]}()),!1!==e.foldGutter&&i.push(function(e={}){let t=Object.assign(Object.assign({},Md),e),n=new Td(t,!0),i=new Td(t,!1),o=Tl.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(Uf)!=e.state.facet(Uf)||e.startState.field(gd,!1)!=e.state.field(gd,!1)||Nf(e.startState)!=Nf(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new _r;for(let o of e.viewportLineBlocks){let r=bd(e.state,o.from,o.to)?i:ud(e.state,o.from,o.to)?n:null;r&&t.add(o.from,o.from,r)}return t.finish()}}),{domEventHandlers:r}=t;return[o,cu({class:"cm-foldGutter",markers(e){var t;return(null===(t=e.plugin(o))||void 0===t?void 0:t.markers)||$r.empty},initialSpacer:()=>new Td(t,!1),domEventHandlers:Object.assign(Object.assign({},r),{click:(e,t,n)=>{if(r.click&&r.click(e,t,n))return!0;let i=bd(e.state,t.from,t.to);if(i)return e.dispatch({effects:pd.of(i)}),!0;let o=ud(e.state,t.from,t.to);return!!o&&(e.dispatch({effects:dd.of(o)}),!0)}})}),Sd()]}()),!1!==e.drawSelection&&i.push(function(e={}){return[ch.of(e),uh,dh,mh,xl.of(!0)]}()),!1!==e.dropCursor&&i.push([bh,vh]),!1!==e.allowMultipleSelections&&i.push(Ar.allowMultipleSelections.of(!0)),!1!==e.indentOnInput&&i.push(Ar.transactionFilter.of((e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:i}=e.newSelection.main,o=n.lineAt(i);if(i>o.from+200)return e;let r=n.sliceString(o.from,i);if(!t.some((e=>e.test(r))))return e;let{state:s}=e,l=-1,a=[];for(let{head:e}of s.selection.ranges){let t=s.doc.lineAt(e);if(t.from==l)continue;l=t.from;let n=Jf(s,t.from);if(null==n)continue;let i=/^\s*/.exec(t.text)[0],o=Zf(s,n);i!=o&&a.push({from:t.from,to:t.from+i.length,insert:o})}return a.length?[e,{changes:a,sequential:!0}]:e}))),!1!==e.syntaxHighlighting&&i.push(Bd(Nd,{fallback:!0})),!1!==e.bracketMatching&&i.push(function(e={}){return[zd.of(e),Ud]}()),!1!==e.closeBrackets&&i.push([Mb,Ob]),!1!==e.autocompletion&&i.push(function(e={}){return[db,Yg.of(e),vb,Nb,yb]}()),!1!==e.rectangularSelection&&i.push(function(e){let t=e=>e.altKey&&0==e.button;return zc.mouseSelectionStyle.of(((e,n)=>t(n)?function(e,t){let n=$h(e,t),i=e.state.selection;return n?{update(e){if(e.docChanged){let t=e.changes.mapPos(e.startState.doc.line(n.line).from),o=e.state.doc.lineAt(t);n={line:o.number,col:n.col,off:Math.min(n.off,o.length)},i=i.map(e.changes)}},get(t,o,r){let s=$h(e,t);if(!s)return i;let l=function(e,t,n){let i=Math.min(t.line,n.line),o=Math.max(t.line,n.line),r=[];if(t.off>Rh||n.off>Rh||t.col<0||n.col<0){let s=Math.min(t.off,n.off),l=Math.max(t.off,n.off);for(let t=i;t<=o;t++){let n=e.doc.line(t);n.length<=l&&r.push(Wo.range(n.from+s,n.to+l))}}else{let s=Math.min(t.col,n.col),l=Math.max(t.col,n.col);for(let t=i;t<=o;t++){let n=e.doc.line(t),i=qr(n.text,s,e.tabSize,!0);if(i<0)r.push(Wo.cursor(n.to));else{let t=qr(n.text,l,e.tabSize);r.push(Wo.range(n.from+i,n.from+t))}}}return r}(e.state,n,s);return l.length?r?Wo.create(l.concat(i.ranges)):Wo.create(l):i}}:null}(e,n):null))}()),!1!==t&&i.push(function(e={}){let[t,n]=_h[e.key||"Alt"],i=Tl.fromClass(class{constructor(e){this.view=e,this.isDown=!1}set(e){this.isDown!=e&&(this.isDown=e,this.view.update([]))}},{eventObservers:{keydown(e){this.set(e.keyCode==t||n(e))},keyup(e){e.keyCode!=t&&n(e)||this.set(!1)},mousemove(e){this.set(n(e))}}});return[i,zc.contentAttributes.of((e=>{var t;return(null===(t=e.plugin(i))||void 0===t?void 0:t.isDown)?Bh:null}))]}()),!1!==e.highlightActiveLine&&i.push(Dh),!1!==e.highlightSelectionMatches&&i.push(function(e){let t=[ng,tg];return t}()),e.tabSize&&"number"==typeof e.tabSize&&i.push(Yf.of(" ".repeat(e.tabSize))),i.concat([Yc.of(n.flat())]).filter(Boolean)};const lv="#e06c75",av="#abb2bf",cv="#7d8799",hv="#d19a66",uv="#2c313a",fv="#282c34",dv="#353a42",pv="#528bff",mv=[zc.theme({"&":{color:av,backgroundColor:fv},".cm-content":{caretColor:pv},".cm-cursor, .cm-dropCursor":{borderLeftColor:pv},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"#3E4451"},".cm-panels":{backgroundColor:"#21252b",color:av},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:fv,color:cv,border:"none"},".cm-activeLineGutter":{backgroundColor:uv},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:dv},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:dv,borderBottomColor:dv},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:uv,color:av}}},{dark:!0}),Bd(Pd.define([{tag:Pf.keyword,color:"#c678dd"},{tag:[Pf.name,Pf.deleted,Pf.character,Pf.propertyName,Pf.macroName],color:lv},{tag:[Pf.function(Pf.variableName),Pf.labelName],color:"#61afef"},{tag:[Pf.color,Pf.constant(Pf.name),Pf.standard(Pf.name)],color:hv},{tag:[Pf.definition(Pf.name),Pf.separator],color:av},{tag:[Pf.typeName,Pf.className,Pf.number,Pf.changed,Pf.annotation,Pf.modifier,Pf.self,Pf.namespace],color:"#e5c07b"},{tag:[Pf.operator,Pf.operatorKeyword,Pf.url,Pf.escape,Pf.regexp,Pf.link,Pf.special(Pf.string)],color:"#56b6c2"},{tag:[Pf.meta,Pf.comment],color:cv},{tag:Pf.strong,fontWeight:"bold"},{tag:Pf.emphasis,fontStyle:"italic"},{tag:Pf.strikethrough,textDecoration:"line-through"},{tag:Pf.link,color:cv,textDecoration:"underline"},{tag:Pf.heading,fontWeight:"bold",color:lv},{tag:[Pf.atom,Pf.bool,Pf.special(Pf.variableName)],color:hv},{tag:[Pf.processingInstruction,Pf.string,Pf.inserted],color:"#98c379"},{tag:Pf.invalid,color:"#ffffff"}]))];var gv=zc.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),bv=function(e){void 0===e&&(e={});var{indentWithTab:t=!0,editable:n=!0,readOnly:i=!1,theme:o="light",placeholder:r="",basicSetup:s=!0}=e,l=[];switch(t&&l.unshift(Yc.of([_m])),s&&("boolean"==typeof s?l.unshift(sv()):l.unshift(sv(s))),r&&l.unshift(function(e){return Tl.fromClass(class{constructor(t){this.view=t,this.placeholder=e?rl.set([rl.widget({widget:new Ph(e),side:1}).range(0)]):rl.none}get decorations(){return this.view.state.doc.length?rl.none:this.placeholder}},{decorations:e=>e.decorations})}(r)),o){case"light":l.push(gv);break;case"dark":l.push(mv);break;case"none":break;default:l.push(o)}return!1===n&&l.push(zc.editable.of(!1)),i&&l.push(Ar.readOnly.of(!0)),[...l]},vv=dr.define(),yv=[],wv=n(893),kv=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],xv=(0,i.forwardRef)(((e,t)=>{var{className:n,value:o="",selection:r,extensions:s=[],onChange:l,onStatistics:a,onCreateEditor:c,onUpdate:h,autoFocus:u,theme:f="light",height:d,minHeight:p,maxHeight:m,width:g,minWidth:b,maxWidth:v,basicSetup:y,placeholder:w,indentWithTab:k,editable:x,readOnly:O,root:S,initialState:C}=e,E=se(e,kv),A=(0,i.useRef)(null),{state:M,view:T,container:D}=function(e){var{value:t,selection:n,onChange:o,onStatistics:r,onCreateEditor:s,onUpdate:l,extensions:a=yv,autoFocus:c,theme:h="light",height:u=null,minHeight:f=null,maxHeight:d=null,width:p=null,minWidth:m=null,maxWidth:g=null,placeholder:b="",editable:v=!0,readOnly:y=!1,indentWithTab:w=!0,basicSetup:k=!0,root:x,initialState:O}=e,[S,C]=(0,i.useState)(),[E,A]=(0,i.useState)(),[M,T]=(0,i.useState)(),D=zc.theme({"&":{height:u,minHeight:f,maxHeight:d,width:p,minWidth:m,maxWidth:g},"& .cm-scroller":{height:"100% !important"}}),P=zc.updateListener.of((e=>{if(e.docChanged&&"function"==typeof o&&!e.transactions.some((e=>e.annotation(vv)))){var t=e.state.doc.toString();o(t,e)}r&&r((e=>({line:e.state.doc.lineAt(e.state.selection.main.from),lineCount:e.state.doc.lines,lineBreak:e.state.lineBreak,length:e.state.doc.length,readOnly:e.state.readOnly,tabSize:e.state.tabSize,selection:e.state.selection,selectionAsSingle:e.state.selection.asSingle().main,ranges:e.state.selection.ranges,selectionCode:e.state.sliceDoc(e.state.selection.main.from,e.state.selection.main.to),selections:e.state.selection.ranges.map((t=>e.state.sliceDoc(t.from,t.to))),selectedText:e.state.selection.ranges.some((e=>!e.empty))}))(e))})),R=[P,D,...bv({theme:h,editable:v,readOnly:y,placeholder:b,indentWithTab:w,basicSetup:k})];return l&&"function"==typeof l&&R.push(zc.updateListener.of(l)),R=R.concat(a),(0,i.useEffect)((()=>{if(S&&!M){var e={doc:t,selection:n,extensions:R},i=O?Ar.fromJSON(O.json,e,O.fields):Ar.create(e);if(T(i),!E){var o=new zc({state:i,parent:S,root:x});A(o),s&&s(o,i)}}return()=>{E&&(T(void 0),A(void 0))}}),[S,M]),(0,i.useEffect)((()=>C(e.container)),[e.container]),(0,i.useEffect)((()=>()=>{E&&(E.destroy(),A(void 0))}),[E]),(0,i.useEffect)((()=>{c&&E&&E.focus()}),[c,E]),(0,i.useEffect)((()=>{E&&E.dispatch({effects:gr.reconfigure.of(R)})}),[h,a,u,f,d,p,m,g,b,v,y,w,k,o,l]),(0,i.useEffect)((()=>{if(void 0!==t){var e=E?E.state.doc.toString():"";E&&t!==e&&E.dispatch({changes:{from:0,to:e.length,insert:t||""},annotations:[vv.of(!0)]})}}),[t,E]),{state:M,setState:T,view:E,setView:A,container:S,setContainer:C}}({container:A.current,root:S,value:o,autoFocus:u,theme:f,height:d,minHeight:p,maxHeight:m,width:g,minWidth:b,maxWidth:v,basicSetup:y,placeholder:w,indentWithTab:k,editable:x,readOnly:O,selection:r,onChange:l,onStatistics:a,onCreateEditor:c,onUpdate:h,extensions:s,initialState:C});if((0,i.useImperativeHandle)(t,(()=>({editor:A.current,state:M,view:T})),[A,D,M,T]),"string"!=typeof o)throw new Error("value must be typeof string but got "+typeof o);var P="string"==typeof f?"cm-theme-"+f:"cm-theme";return(0,wv.jsx)("div",ce({ref:A,className:P+(n?" "+n:"")},E))}));xv.displayName="CodeMirror";const Ov=xv;class Sv{constructor(e,t,n,i,o,r,s,l,a,c=0,h){this.p=e,this.stack=t,this.state=n,this.reducePos=i,this.pos=o,this.score=r,this.buffer=s,this.bufferBase=l,this.curContext=a,this.lookAhead=c,this.parent=h}toString(){return`[${this.stack.filter(((e,t)=>t%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let i=e.parser.context;return new Sv(e,[],t,n,n,0,[],0,i?new Cv(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,i=65535&e,{parser:o}=this.p,r=o.dynamicPrecedence(i);if(r&&(this.score+=r),0==n)return this.pushState(o.getGoto(this.state,i,!0),this.reducePos),i<o.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,4,!0),void this.reduceContext(i,this.reducePos);let s=this.stack.length-3*(n-1)-(262144&e?6:0),l=s?this.stack[s-2]:this.p.ranges[0].from,a=this.reducePos-l;a>=2e3&&!(null===(t=this.p.parser.nodeSet.types[i])||void 0===t?void 0:t.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=a):this.p.lastBigReductionSize<a&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=a));let c=s?this.stack[s-1]:0,h=this.bufferBase+this.buffer.length-c;if(i<o.minRepeatTerm||131072&e){let e=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,l,e,h+4,!0)}if(262144&e)this.state=this.stack[s];else{let e=this.stack[s-3];this.state=o.getGoto(e,i,!0)}for(;this.stack.length>s;)this.stack.pop();this.reduceContext(i,l)}storeNode(e,t,n,i=4,o=!1){if(0==e&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this,i=this.buffer.length;if(0==i&&e.parent&&(i=e.bufferBase-e.parent.bufferBase,e=e.parent),i>0&&0==e.buffer[i-4]&&e.buffer[i-1]>-1){if(t==n)return;if(e.buffer[i-2]>=t)return void(e.buffer[i-2]=n)}}if(o&&this.pos!=n){let o=this.buffer.length;if(o>0&&0!=this.buffer[o-4])for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,i>4&&(i-=4);this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=n,this.buffer[o+3]=i}else this.buffer.push(e,t,n,i)}shift(e,t,n,i){if(131072&e)this.pushState(65535&e,this.pos);else if(0==(262144&e)){let o=e,{parser:r}=this.p;(i>this.pos||t<=r.maxNode)&&(this.pos=i,r.stateFlag(o,1)||(this.reducePos=i)),this.pushState(o,n),this.shiftContext(t,n),t<=r.maxNode&&this.buffer.push(t,n,i,4)}else this.pos=i,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,i,4)}apply(e,t,n,i){65536&e?this.reduce(e):this.shift(e,t,n,i)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(t,i),this.buffer.push(n,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),i=e.bufferBase+t;for(;e&&i==e.bufferBase;)e=e.parent;return new Sv(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Ev(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==n)return!1;if(0==(65536&n))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let i,o=0;o<t.length;o+=2)(i=t[o+1])!=this.state&&this.p.parser.hasAction(i,e)&&n.push(t[o],i);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let i=t[e+1];n.some(((e,t)=>1&t&&e==i))||n.push(t[e],i)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let i=t[e+1];if(i==this.state)continue;let o=this.split();o.pushState(i,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[e],this.pos),o.reducePos=this.pos,o.score-=200,n.push(o)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(0==(65536&t))return!1;if(!e.validAction(this.state,t)){let n=t>>19,i=65535&t,o=this.stack.length-3*n;if(o<0||e.getGoto(this.stack[o],i,!1)<0){let e=this.findForcedReduction();if(null==e)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(i,o)=>{if(!t.includes(i))return t.push(i),e.allActions(i,(t=>{if(393216&t);else if(65536&t){let n=(t>>19)-o;if(n>1){let i=65535&t,o=this.stack.length-3*n;if(o>=0&&e.getGoto(this.stack[o],i,!1)>=0)return n<<19|65536|i}}else{let e=n(t,o+1);if(null!=e)return e}}))};return n(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(3!=this.stack.length)return!1;let{parser:e}=this.p;return 65535==e.data[e.stateSlot(this.state,1)]&&!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 t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||-3!=this.buffer[e])&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||-4!=this.buffer[e])&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new Cv(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Cv{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class Ev{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=65535&e,n=e>>19;0==n?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(n-1);let i=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=i}}class Av{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,0==this.index&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Av(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;null!=e&&(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,0==this.index&&this.maybeNext()}fork(){return new Av(this.stack,this.pos,this.index)}}function Mv(e,t=Uint16Array){if("string"!=typeof e)return e;let n=null;for(let i=0,o=0;i<e.length;){let r=0;for(;;){let t=e.charCodeAt(i++),n=!1;if(126==t){r=65535;break}t>=92&&t--,t>=34&&t--;let o=t-32;if(o>=46&&(o-=46,n=!0),r+=o,n)break;r*=46}n?n[o++]=r:n=new t(r)}return n}class Tv{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Dv=new Tv;class Pv{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Dv,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,i=this.rangeIndex,o=this.pos+e;for(;o<n.from;){if(!i)return null;let e=this.ranges[--i];o-=n.from-e.to,n=e}for(;t<0?o>n.to:o>=n.to;){if(i==this.ranges.length-1)return null;let e=this.ranges[++i];o+=e.from-n.to,n=e}return o}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t,n,i=this.chunkOff+e;if(i>=0&&i<this.chunk.length)t=this.pos+e,n=this.chunk.charCodeAt(i);else{let i=this.resolveOffset(e,1);if(null==i)return-1;if(t=i,t>=this.chunk2Pos&&t<this.chunk2Pos+this.chunk2.length)n=this.chunk2.charCodeAt(t-this.chunk2Pos);else{let e=this.rangeIndex,i=this.range;for(;i.to<=t;)i=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=t),t+this.chunk2.length>i.to&&(this.chunk2=this.chunk2.slice(0,i.to-t)),n=this.chunk2.charCodeAt(0)}}return t>=this.token.lookAhead&&(this.token.lookAhead=t+1),n}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(null==n||n<this.token.start)throw new RangeError("Token end out of bounds");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:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>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,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=Dv,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,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let i of this.ranges){if(i.from>=t)break;i.to>e&&(n+=this.input.read(Math.max(i.from,e),Math.min(i.to,t)))}return n}}class Rv{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;Bv(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}Rv.prototype.contextual=Rv.prototype.fallback=Rv.prototype.extend=!1;class $v{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data="string"==typeof e?Mv(e):e}token(e,t){let n=e.pos,i=0;for(;;){let n=e.next<0,o=e.resolveOffset(1,1);if(Bv(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(null==this.elseToken)return;if(n||i++,null==o)break;e.reset(o,e.token)}i&&(e.reset(n,e.token),e.acceptToken(this.elseToken,i))}}$v.prototype.contextual=Rv.prototype.fallback=Rv.prototype.extend=!1;class _v{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function Bv(e,t,n,i,o,r){let s=0,l=1<<i,{dialect:a}=n.p.parser;e:for(;0!=(l&e[s]);){let n=e[s+1];for(let i=s+3;i<n;i+=2)if((e[i+1]&l)>0){let n=e[i];if(a.allows(n)&&(-1==t.token.value||t.token.value==n||Lv(n,t.token.value,o,r))){t.acceptToken(n);break}}let i=t.next,c=0,h=e[s+2];if(!(t.next<0&&h>c&&65535==e[n+3*h-3])){for(;c<h;){let o=c+h>>1,r=n+o+(o<<1),l=e[r],a=e[r+1]||65536;if(i<l)h=o;else{if(!(i>=a)){s=e[r+2],t.advance();continue e}c=o+1}}break}s=e[n+3*h-1]}}function Iv(e,t,n){for(let i,o=t;65535!=(i=e[o]);o++)if(i==n)return o-t;return-1}function Lv(e,t,n,i){let o=Iv(n,i,t);return o<0||Iv(n,i,e)<o}const Nv="undefined"!=typeof process&&process.env&&/\bparse\b/.test(process.env.LOG);let Vv=null;function Hv(e,t,n){let i=e.cursor(Iu.IncludeAnonymous);for(i.moveTo(t);;)if(!(n<0?i.childBefore(t):i.childAfter(t)))for(;;){if((n<0?i.to<t:i.from>t)&&!i.type.isError)return n<0?Math.max(0,Math.min(i.to-1,t-25)):Math.min(e.length,Math.max(i.from+1,t+25));if(n<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return n<0?0:e.length}}class Wv{constructor(e,t){this.fragments=e,this.nodeSet=t,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?Hv(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Hv(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 t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],i=this.index[t];if(i==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=n.children[i],r=this.start[t]+n.positions[i];if(r>e)return this.nextStart=r,null;if(o instanceof Lu){if(r==e){if(r<this.safeFrom)return null;let e=r+o.length;if(e<=this.safeTo){let t=o.prop(Tu.lookAhead);if(!t||e+t<this.fragment.to)return o}}this.index[t]++,r+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(r),this.index.push(0))}else this.index[t]++,this.nextStart=r+o.length}}}class zv{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map((e=>new Tv))}getActions(e){let t=0,n=null,{parser:i}=e.p,{tokenizers:o}=i,r=i.stateSlot(e.state,3),s=e.curContext?e.curContext.hash:0,l=0;for(let i=0;i<o.length;i++){if(0==(1<<i&r))continue;let a=o[i],c=this.tokens[i];if((!n||a.fallback)&&((a.contextual||c.start!=e.pos||c.mask!=r||c.context!=s)&&(this.updateCachedToken(c,a,e),c.mask=r,c.context=s),c.lookAhead>c.end+25&&(l=Math.max(c.lookAhead,l)),0!=c.value)){let i=t;if(c.extended>-1&&(t=this.addActions(e,c.extended,c.end,t)),t=this.addActions(e,c.value,c.end,t),!a.extend&&(n=c,t>i))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),n||e.pos!=this.stream.end||(n=new Tv,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Tv,{pos:n,p:i}=e;return t.start=n,t.end=Math.min(n+1,i.stream.end),t.value=n==i.stream.end?i.parser.eofTerm:0,t}updateCachedToken(e,t,n){let i=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(i,e),n),e.value>-1){let{parser:t}=n.p;for(let i=0;i<t.specialized.length;i++)if(t.specialized[i]==e.value){let o=t.specializers[i](this.stream.read(e.start,e.end),n);if(o>=0&&n.p.parser.dialect.allows(o>>1)){0==(1&o)?e.value=o>>1:e.extended=o>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,t,n,i){for(let t=0;t<i;t+=3)if(this.actions[t]==e)return i;return this.actions[i++]=e,this.actions[i++]=t,this.actions[i++]=n,i}addActions(e,t,n,i){let{state:o}=e,{parser:r}=e.p,{data:s}=r;for(let e=0;e<2;e++)for(let l=r.stateSlot(o,e?2:1);;l+=3){if(65535==s[l]){if(1!=s[l+1]){0==i&&2==s[l+1]&&(i=this.putAction(Uv(s,l+2),t,n,i));break}l=Uv(s,l+2)}s[l]==t&&(i=this.putAction(Uv(s,l+1),t,n,i))}return i}}class Fv{constructor(e,t,n,i){this.parser=e,this.input=t,this.ranges=i,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 Pv(t,i),this.tokens=new zv(e,this.stream),this.topTerm=e.top[1];let{from:o}=i[0];this.stacks=[Sv.start(this,e.top[0],o)],this.fragments=n.length&&this.stream.end-o>4*e.bufferLength?new Wv(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e,t,n=this.stacks,i=this.minStackPos,o=this.stacks=[];if(this.bigReductionCount>300&&1==n.length){let[e]=n;for(;e.forceReduce()&&e.stack.length&&e.stack[e.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let r=0;r<n.length;r++){let s=n[r];for(;;){if(this.tokens.mainToken=null,s.pos>i)o.push(s);else{if(this.advanceStack(s,o,n))continue;{e||(e=[],t=[]),e.push(s);let n=this.tokens.getMainToken(s);t.push(n.value,n.end)}}break}}if(!o.length){let t=e&&function(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||null!=e&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}(e);if(t)return Nv&&console.log("Finish with "+this.stackID(t)),this.stackToTree(t);if(this.parser.strict)throw Nv&&e&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+i);this.recovering||(this.recovering=5)}if(this.recovering&&e){let n=null!=this.stoppedAt&&e[0].pos>this.stoppedAt?e[0]:this.runRecovery(e,t,o);if(n)return Nv&&console.log("Force-finish "+this.stackID(n)),this.stackToTree(n.forceAll())}if(this.recovering){let e=1==this.recovering?1:3*this.recovering;if(o.length>e)for(o.sort(((e,t)=>t.score-e.score));o.length>e;)o.pop();o.some((e=>e.reducePos>i))&&this.recovering--}else if(o.length>1){e:for(let e=0;e<o.length-1;e++){let t=o[e];for(let n=e+1;n<o.length;n++){let i=o[n];if(t.sameState(i)||t.buffer.length>500&&i.buffer.length>500){if(!((t.score-i.score||t.buffer.length-i.buffer.length)>0)){o.splice(e--,1);continue e}o.splice(n--,1)}}}o.length>12&&o.splice(12,o.length-12)}this.minStackPos=o[0].pos;for(let e=1;e<o.length;e++)o[e].pos<this.minStackPos&&(this.minStackPos=o[e].pos);return null}stopAt(e){if(null!=this.stoppedAt&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,n){let i=e.pos,{parser:o}=this,r=Nv?this.stackID(e)+" -> ":"";if(null!=this.stoppedAt&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let s=this.fragments.nodeAt(i);s;){let i=this.parser.nodeSet.types[s.type.id]==s.type?o.getGoto(e.state,s.type.id):-1;if(i>-1&&s.length&&(!t||(s.prop(Tu.contextHash)||0)==n))return e.useNode(s,i),Nv&&console.log(r+this.stackID(e)+` (via reuse of ${o.getName(s.type.id)})`),!0;if(!(s instanceof Lu)||0==s.children.length||s.positions[0]>0)break;let l=s.children[0];if(!(l instanceof Lu&&0==s.positions[0]))break;s=l}}let s=o.stateSlot(e.state,4);if(s>0)return e.reduce(s),Nv&&console.log(r+this.stackID(e)+` (via always-reduce ${o.getName(65535&s)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let s=0;s<l.length;){let a=l[s++],c=l[s++],h=l[s++],u=s==l.length||!n,f=u?e:e.split(),d=this.tokens.mainToken;if(f.apply(a,c,d?d.start:f.pos,h),Nv&&console.log(r+this.stackID(f)+` (via ${0==(65536&a)?"shift":`reduce of ${o.getName(65535&a)}`} for ${o.getName(c)} @ ${i}${f==e?"":", split"})`),u)return!0;f.pos>i?t.push(f):n.push(f)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return Qv(e,t),!0}}runRecovery(e,t,n){let i=null,o=!1;for(let r=0;r<e.length;r++){let s=e[r],l=t[r<<1],a=t[1+(r<<1)],c=Nv?this.stackID(s)+" -> ":"";if(s.deadEnd){if(o)continue;if(o=!0,s.restart(),Nv&&console.log(c+this.stackID(s)+" (restarted)"),this.advanceFully(s,n))continue}let h=s.split(),u=c;for(let e=0;h.forceReduce()&&e<10&&(Nv&&console.log(u+this.stackID(h)+" (via force-reduce)"),!this.advanceFully(h,n));e++)Nv&&(u=this.stackID(h)+" -> ");for(let e of s.recoverByInsert(l))Nv&&console.log(c+this.stackID(e)+" (via recover-insert)"),this.advanceFully(e,n);this.stream.end>s.pos?(a==s.pos&&(a++,l=0),s.recoverByDelete(l,a),Nv&&console.log(c+this.stackID(s)+` (via recover-delete ${this.parser.getName(l)})`),Qv(s,n)):(!i||i.score<s.score)&&(i=s)}return i}stackToTree(e){return e.close(),Lu.build({buffer:Av.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 t=(Vv||(Vv=new WeakMap)).get(e);return t||Vv.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function Qv(e,t){for(let n=0;n<t.length;n++){let i=t[n];if(i.pos==e.pos&&i.sameState(e))return void(t[n].score<e.score&&(t[n]=e))}t.push(e)}class jv{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||0==this.disabled[e]}}class qv extends of{constructor(e){if(super(),this.wrappers=[],14!=e.version)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let n=0;n<e.repeatNodeCount;n++)t.push("");let n=Object.keys(e.topRules).map((t=>e.topRules[t][1])),i=[];for(let e=0;e<t.length;e++)i.push([]);function o(e,t,n){i[e].push([t,t.deserialize(String(n))])}if(e.nodeProps)for(let t of e.nodeProps){let e=t[0];"string"==typeof e&&(e=Tu[e]);for(let n=1;n<t.length;){let i=t[n++];if(i>=0)o(i,e,t[n++]);else{let r=t[n+-i];for(let s=-i;s>0;s--)o(t[n++],e,r);n++}}}this.nodeSet=new $u(t.map(((t,o)=>Ru.define({name:o>=this.minRepeatTerm?void 0:t,id:o,props:i[o],top:n.indexOf(o)>-1,error:0==o,skipped:e.skippedNodes&&e.skippedNodes.indexOf(o)>-1})))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Eu;let r=Mv(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(Gv),this.states=Mv(e.states,Uint32Array),this.data=Mv(e.stateData),this.goto=Mv(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map((e=>"number"==typeof e?new Rv(r,e):e)),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,t,n){let i=new Fv(this,e,t,n);for(let o of this.wrappers)i=o(i,e,t,n);return i}getGoto(e,t,n=!1){let i=this.goto;if(t>=i[0])return-1;for(let o=i[t+1];;){let t=i[o++],r=1&t,s=i[o++];if(r&&n)return s;for(let n=o+(t>>1);o<n;o++)if(i[o]==e)return s;if(r)return-1}}hasAction(e,t){let n=this.data;for(let i=0;i<2;i++)for(let o,r=this.stateSlot(e,i?2:1);;r+=3){if(65535==(o=n[r])){if(1!=n[r+1]){if(2==n[r+1])return Uv(n,r+2);break}o=n[r=Uv(n,r+2)]}if(o==t||0==o)return Uv(n,r+1)}return 0}stateSlot(e,t){return this.states[6*e+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,(e=>e==t||null))}allActions(e,t){let n=this.stateSlot(e,4),i=n?t(n):void 0;for(let n=this.stateSlot(e,1);null==i;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=Uv(this.data,n+2)}i=t(Uv(this.data,n+1))}return i}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=Uv(this.data,n+2)}if(0==(1&this.data[n+2])){let e=this.data[n+1];t.some(((t,n)=>1&n&&t==e))||t.push(this.data[n],e)}}return t}configure(e){let t=Object.assign(Object.create(qv.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map((t=>{let n=e.tokenizers.find((e=>e.from==t));return n?n.to:t}))),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map(((n,i)=>{let o=e.specializers.find((e=>e.from==n.external));if(!o)return n;let r=Object.assign(Object.assign({},n),{external:o.to});return t.specializers[i]=Gv(r),r}))),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),null!=e.strict&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),null!=e.bufferLength&&(t.bufferLength=e.bufferLength),t}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 t=this.dynamicPrecedences;return null==t?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map((()=>!1));if(e)for(let i of e.split(" ")){let e=t.indexOf(i);e>=0&&(n[e]=!0)}let i=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n,o=this.dialects[t[e]];65535!=(n=this.data[o++]);)(i||(i=new Uint8Array(this.maxTerm+1)))[n]=1;return new jv(e,n,i)}static deserialize(e){return new qv(e)}}function Uv(e,t){return e[t]|e[t+1]<<16}function Gv(e){if(e.external){let t=e.extend?1:0;return(n,i)=>e.external(n,i)<<1|t}return e.get}const Xv=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288];function Yv(e){return e>=65&&e<=90||e>=97&&e<=122||e>=161}const Kv=new _v(((e,t)=>{for(let i=!1,o=0,r=0;;r++){let{next:s}=e;if(Yv(s)||45==s||95==s||i&&(n=s)>=48&&n<=57)!i&&(45!=s||r>0)&&(i=!0),o===r&&45==s&&o++,e.advance();else{if(92!=s||10==e.peek(1)){i&&e.acceptToken(40==s?97:2==o&&t.canShift(2)?2:98);break}e.advance(),e.next>-1&&e.advance(),i=!0}}var n})),Zv=new _v((e=>{if(Xv.includes(e.peek(-1))){let{next:t}=e;(Yv(t)||95==t||35==t||46==t||91==t||58==t||45==t||38==t)&&e.acceptToken(96)}})),Jv=new _v((e=>{if(!Xv.includes(e.peek(-1))){let{next:t}=e;if(37==t&&(e.advance(),e.acceptToken(1)),Yv(t)){do{e.advance()}while(Yv(e.next));e.acceptToken(1)}}})),ey=hf({"AtKeyword import charset namespace keyframes media supports":Pf.definitionKeyword,"from to selector":Pf.keyword,NamespaceName:Pf.namespace,KeyframeName:Pf.labelName,KeyframeRangeName:Pf.operatorKeyword,TagName:Pf.tagName,ClassName:Pf.className,PseudoClassName:Pf.constant(Pf.className),IdName:Pf.labelName,"FeatureName PropertyName":Pf.propertyName,AttributeName:Pf.attributeName,NumberLiteral:Pf.number,KeywordQuery:Pf.keyword,UnaryQueryOp:Pf.operatorKeyword,"CallTag ValueName":Pf.atom,VariableName:Pf.variableName,Callee:Pf.operatorKeyword,Unit:Pf.unit,"UniversalSelector NestingSelector":Pf.definitionOperator,MatchOp:Pf.compareOperator,"ChildOp SiblingOp, LogicOp":Pf.logicOperator,BinOp:Pf.arithmeticOperator,Important:Pf.modifier,Comment:Pf.blockComment,ColorLiteral:Pf.color,"ParenthesizedContent StringLiteral":Pf.string,":":Pf.punctuation,"PseudoOp #":Pf.derefOperator,"; ,":Pf.separator,"( )":Pf.paren,"[ ]":Pf.squareBracket,"{ }":Pf.brace}),ty={__proto__:null,lang:32,"nth-child":32,"nth-last-child":32,"nth-of-type":32,"nth-last-of-type":32,dir:32,"host-context":32,url:60,"url-prefix":60,domain:60,regexp:60,selector:134},ny={__proto__:null,"@import":114,"@media":138,"@charset":142,"@namespace":146,"@keyframes":152,"@supports":164},iy={__proto__:null,not:128,only:128},oy=qv.deserialize({version:14,states:"9bQYQ[OOO#_Q[OOP#fOWOOOOQP'#Cd'#CdOOQP'#Cc'#CcO#kQ[O'#CfO$_QXO'#CaO$fQ[O'#ChO$qQ[O'#DPO$vQ[O'#DTOOQP'#Ej'#EjO${QdO'#DeO%gQ[O'#DrO${QdO'#DtO%xQ[O'#DvO&TQ[O'#DyO&]Q[O'#EPO&kQ[O'#EROOQS'#Ei'#EiOOQS'#EU'#EUQYQ[OOO&rQXO'#CdO'gQWO'#DaO'lQWO'#EpO'wQ[O'#EpQOQWOOP(RO#tO'#C_POOO)C@X)C@XOOQP'#Cg'#CgOOQP,59Q,59QO#kQ[O,59QO(^Q[O'#EXO(xQWO,58{O)QQ[O,59SO$qQ[O,59kO$vQ[O,59oO(^Q[O,59sO(^Q[O,59uO(^Q[O,59vO)]Q[O'#D`OOQS,58{,58{OOQP'#Ck'#CkOOQO'#C}'#C}OOQP,59S,59SO)dQWO,59SO)iQWO,59SOOQP'#DR'#DROOQP,59k,59kOOQO'#DV'#DVO)nQ`O,59oOOQS'#Cp'#CpO${QdO'#CqO)vQvO'#CsO+TQtO,5:POOQO'#Cx'#CxO)iQWO'#CwO+iQWO'#CyOOQS'#Em'#EmOOQO'#Dh'#DhO+nQ[O'#DoO+|QWO'#EqO&]Q[O'#DmO,[QWO'#DpOOQO'#Er'#ErO({QWO,5:^O,aQpO,5:`OOQS'#Dx'#DxO,iQWO,5:bO,nQ[O,5:bOOQO'#D{'#D{O,vQWO,5:eO,{QWO,5:kO-TQWO,5:mOOQS-E8S-E8SO${QdO,59{O-]Q[O'#EZO-jQWO,5;[O-jQWO,5;[POOO'#ET'#ETP-uO#tO,58yPOOO,58y,58yOOQP1G.l1G.lO.lQXO,5:sOOQO-E8V-E8VOOQS1G.g1G.gOOQP1G.n1G.nO)dQWO1G.nO)iQWO1G.nOOQP1G/V1G/VO.yQ`O1G/ZO/dQXO1G/_O/zQXO1G/aO0bQXO1G/bO0xQWO,59zO0}Q[O'#DOO1UQdO'#CoOOQP1G/Z1G/ZO${QdO1G/ZO1]QpO,59]OOQS,59_,59_O${QdO,59aO1eQWO1G/kOOQS,59c,59cO1jQ!bO,59eO1rQWO'#DhO1}QWO,5:TO2SQWO,5:ZO&]Q[O,5:VO&]Q[O'#E[O2[QWO,5;]O2gQWO,5:XO(^Q[O,5:[OOQS1G/x1G/xOOQS1G/z1G/zOOQS1G/|1G/|O2xQWO1G/|O2}QdO'#D|OOQS1G0P1G0POOQS1G0V1G0VOOQS1G0X1G0XO3YQtO1G/gOOQO,5:u,5:uO3pQ[O,5:uOOQO-E8X-E8XO3}QWO1G0vPOOO-E8R-E8RPOOO1G.e1G.eOOQP7+$Y7+$YOOQP7+$u7+$uO${QdO7+$uOOQS1G/f1G/fO4YQXO'#EoO4aQWO,59jO4fQtO'#EVO5ZQdO'#ElO5eQWO,59ZO5jQpO7+$uOOQS1G.w1G.wOOQS1G.{1G.{OOQS7+%V7+%VO5rQWO1G/PO${QdO1G/oOOQO1G/u1G/uOOQO1G/q1G/qO5wQWO,5:vOOQO-E8Y-E8YO6VQXO1G/vOOQS7+%h7+%hO6^QYO'#CsOOQO'#EO'#EOO6iQ`O'#D}OOQO'#D}'#D}O6tQWO'#E]O6|QdO,5:hOOQS,5:h,5:hO7XQtO'#EYO${QdO'#EYO8VQdO7+%ROOQO7+%R7+%ROOQO1G0a1G0aO8jQpO<<HaO8rQWO,5;ZOOQP1G/U1G/UOOQS-E8T-E8TO${QdO'#EWO8zQWO,5;WOOQT1G.u1G.uOOQP<<Ha<<HaOOQS7+$k7+$kO9SQdO7+%ZOOQO7+%b7+%bOOQO,5:i,5:iO3QQdO'#E^O6tQWO,5:wOOQS,5:w,5:wOOQS-E8Z-E8ZOOQS1G0S1G0SO9ZQtO,5:tOOQS-E8W-E8WOOQO<<Hm<<HmOOQPAN={AN={O:XQdO,5:rOOQO-E8U-E8UOOQO<<Hu<<HuOOQO,5:x,5:xOOQO-E8[-E8[OOQS1G0c1G0c",stateData:":k~O#WOS#XQQ~OUYOXYO]VO^VOtWOxXO!YaO!ZZO!g[O!i]O!k^O!n_O!t`O#URO#_TO~OQfOUYOXYO]VO^VOtWOxXO!YaO!ZZO!g[O!i]O!k^O!n_O!t`O#UeO#_TO~O#R#dP~P!ZO#XjO~O#UlO~O]qO^qOpoOtrOxsO|tO!PvO#SuO#_nO~O!RwO~P#pO`}O#TzO#UyO~O#U!OO~O#U!QO~OQ!ZOb!TOf!ZOh!ZOn!YO#T!WO#U!SO#b!UO~Ob!]O!b!_O!e!`O#U![O!R#eP~Oh!eOn!YO#U!dO~Oh!gO#U!gO~Ob!]O!b!_O!e!`O#U![O~O!W#eP~P%gO]WX]!UX^WXpWXtWXxWX|WX!PWX!RWX#SWX#_WX~O]!lO~O!W!mO#R#dX!Q#dX~O#R#dX!Q#dX~P!ZO#Y!pO#Z!pO#[!rO~OUYOXYO]VO^VOtWOxXO#URO#_TO~OpoO!RwO~O`!yO#TzO#UyO~O!Q#dP~P!ZOb#QO~Ob#RO~Ov#SOz#TO~OP#VObgXjgX!WgX!bgX!egX#UgXagXQgXfgXhgXngXpgX!VgX#RgX#TgX#bgXvgX!QgX~Ob!]Oj#WO!b!_O!e!`O#U![O!W#eP~Ob#ZO~Ob!]O!b!_O!e!`O#U#[O~Op#`O!`#_O!R#eX!W#eX~Ob#cO~Oj#WO!W#eO~O!W#fO~Oh#gOn!YO~O!R#hO~O!RwO!`#_O~O!RwO!W#kO~O!W!}X#R!}X!Q!}X~P!ZO!W!mO#R#da!Q#da~O#Y!pO#Z!pO#[#rO~O]qO^qOtrOxsO|tO!PvO#SuO#_nO~Op!{a!R!{aa!{a~P.QOv#tOz#uO~O]qO^qOtrOxsO#_nO~Op{i|{i!P{i!R{i#S{ia{i~P/ROp}i|}i!P}i!R}i#S}ia}i~P/ROp!Oi|!Oi!P!Oi!R!Oi#S!Oia!Oi~P/RO!Q#vO~Oa#cP~P(^Oa#`P~P${Oa#}Oj#WO~O!W$PO~Oh$QOo$QO~O]!^Xa![X!`![X~O]$RO~Oa$SO!`#_O~Op#`O!R#ea!W#ea~O!`#_Op!aa!R!aa!W!aaa!aa~O!W$XO~O!Q$`O#U$ZO#b$YO~Oj#WOp$bO!V$dO!W!Ti#R!Ti!Q!Ti~P${O!W!}a#R!}a!Q!}a~P!ZO!W!mO#R#di!Q#di~Oa#cX~P#pOa$hO~Oj#WOQ!yXa!yXb!yXf!yXh!yXn!yXp!yX#T!yX#U!yX#b!yX~Op$jOa#`X~P${Oa$lO~Oj#WOv$mO~Oa$nO~O!`#_Op#Oa!R#Oa!W#Oa~Oa$pO~P.QOP#VOpgX!RgX~O#b$YOp!qX!R!qX~Op$rO!RwO~O!Q$vO#U$ZO#b$YO~Oj#WOQ!|Xb!|Xf!|Xh!|Xn!|Xp!|X!V!|X!W!|X#R!|X#T!|X#U!|X#b!|X!Q!|X~Op$bO!V$yO!W!Tq#R!Tq!Q!Tq~P${Oj#WOv$zO~OpoOa#ca~Op$jOa#`a~Oa$}O~P${Oj#WOQ!|ab!|af!|ah!|an!|ap!|a!V!|a!W!|a#R!|a#T!|a#U!|a#b!|a!Q!|a~Oa!zap!za~P${O#Wo#X#bj!P#b~",goto:"-Y#gPPP#hP#kP#t$TP#t$d#tPP$jPPP$p$y$yP%]P$yP$y%w&ZPPP&s&y#tP'PP#tP'VP#tP#t#tPPP']'r(PPP#kPP(W(W(b(WP(WP(W(WP#kP#kP#kP(e#kP(h(k(n(u#kP#kP(z)Q)a)o)u*P*V*a*g*mPPPPPPPPPP*s*|P+i+lP,b,e,k,tRkQ_bOPdhw!m#nkYOPdhotuvw!m#Q#c#nkSOPdhotuvw!m#Q#c#nQmTR!snQ{VR!wqQ!w}Q#Y!XR#s!yq!ZZ]!T!l#R#T#W#l#u#z$R$b$c$j$o${p!ZZ]!T!l#R#T#W#l#u#z$R$b$c$j$o${U$]#h$_$rR$q$[q!XZ]!T!l#R#T#W#l#u#z$R$b$c$j$o${p!ZZ]!T!l#R#T#W#l#u#z$R$b$c$j$o${Q!e^R#g!fQ|VR!xqQ!w|R#s!xQ!PWR!zrQ!RXR!{sQxUQ!vpQ#d!bQ#j!iQ#k!jQ$t$^R%Q$sSgPwQ!ohQ#m!mR$e#nZfPhw!m#na!a[`a!V!]!_#_#`R#]!]R!f^R!h_R#i!hS$^#h$_R%O$rV$[#h$_$rQ!qjR#q!qQdOShPwU!kdh#nR#n!mQ#z#RU$i#z$o${Q$o$RR${$jQ$k#zR$|$kQpUS!up$gR$g#wQ$c#lR$x$cQ!ngS#o!n#pR#p!oQ#a!^R$V#aQ$_#hR$u$_Q$s$^R%P$s_cOPdhw!m#n^UOPdhw!m#nQ!toQ!|tQ!}uQ#OvQ#w#QR$W#cR#{#RQ!VZQ!c]Q#U!TQ#l!l[#y#R#z$R$j$o${Q#|#TQ$O#WS$a#l$cQ$f#uR$w$bR#x#QQiPR#PwQ!b[Q!jaR#X!VU!^[a!VQ!i`Q#^!]Q#b!_Q$T#_R$U#`",nodeNames:"⚠ Unit VariableName Comment StyleSheet RuleSet UniversalSelector TagSelector TagName NestingSelector ClassSelector ClassName PseudoClassSelector : :: PseudoClassName PseudoClassName ) ( ArgList ValueName ParenthesizedValue ColorLiteral NumberLiteral StringLiteral BinaryExpression BinOp CallExpression Callee CallLiteral CallTag ParenthesizedContent , PseudoClassName ArgList IdSelector # IdName ] AttributeSelector [ AttributeName MatchOp ChildSelector ChildOp DescendantSelector SiblingSelector SiblingOp } { Block Declaration PropertyName Important ; ImportStatement AtKeyword import KeywordQuery FeatureQuery FeatureName BinaryQuery LogicOp UnaryQuery UnaryQueryOp ParenthesizedQuery SelectorQuery selector MediaStatement media CharsetStatement charset NamespaceStatement namespace NamespaceName KeyframesStatement keyframes KeyframeName KeyframeList KeyframeSelector KeyframeRangeName SupportsStatement supports AtRule Styles",maxTerm:114,nodeProps:[["openedBy",17,"(",48,"{"],["closedBy",18,")",49,"}"]],propSources:[ey],skippedNodes:[0,3,85],repeatNodeCount:10,tokenData:"J^~R!^OX$}X^%u^p$}pq%uqr)Xrs.Rst/utu6duv$}vw7^wx7oxy9^yz9oz{9t{|:_|}?Q}!O?c!O!P@Q!P!Q@i!Q![Ab![!]B]!]!^CX!^!_$}!_!`Cj!`!aC{!a!b$}!b!cDw!c!}$}!}#OFa#O#P$}#P#QFr#Q#R6d#R#T$}#T#UGT#U#c$}#c#dHf#d#o$}#o#pH{#p#q6d#q#rI^#r#sIo#s#y$}#y#z%u#z$f$}$f$g%u$g#BY$}#BY#BZ%u#BZ$IS$}$IS$I_%u$I_$I|$}$I|$JO%u$JO$JT$}$JT$JU%u$JU$KV$}$KV$KW%u$KW&FU$}&FU&FV%u&FV;'S$};'S;=`JW<%lO$}`%QSOy%^z;'S%^;'S;=`%o<%lO%^`%cSo`Oy%^z;'S%^;'S;=`%o<%lO%^`%rP;=`<%l%^~%zh#W~OX%^X^'f^p%^pq'fqy%^z#y%^#y#z'f#z$f%^$f$g'f$g#BY%^#BY#BZ'f#BZ$IS%^$IS$I_'f$I_$I|%^$I|$JO'f$JO$JT%^$JT$JU'f$JU$KV%^$KV$KW'f$KW&FU%^&FU&FV'f&FV;'S%^;'S;=`%o<%lO%^~'mh#W~o`OX%^X^'f^p%^pq'fqy%^z#y%^#y#z'f#z$f%^$f$g'f$g#BY%^#BY#BZ'f#BZ$IS%^$IS$I_'f$I_$I|%^$I|$JO'f$JO$JT%^$JT$JU'f$JU$KV%^$KV$KW'f$KW&FU%^&FU&FV'f&FV;'S%^;'S;=`%o<%lO%^l)[UOy%^z#]%^#]#^)n#^;'S%^;'S;=`%o<%lO%^l)sUo`Oy%^z#a%^#a#b*V#b;'S%^;'S;=`%o<%lO%^l*[Uo`Oy%^z#d%^#d#e*n#e;'S%^;'S;=`%o<%lO%^l*sUo`Oy%^z#c%^#c#d+V#d;'S%^;'S;=`%o<%lO%^l+[Uo`Oy%^z#f%^#f#g+n#g;'S%^;'S;=`%o<%lO%^l+sUo`Oy%^z#h%^#h#i,V#i;'S%^;'S;=`%o<%lO%^l,[Uo`Oy%^z#T%^#T#U,n#U;'S%^;'S;=`%o<%lO%^l,sUo`Oy%^z#b%^#b#c-V#c;'S%^;'S;=`%o<%lO%^l-[Uo`Oy%^z#h%^#h#i-n#i;'S%^;'S;=`%o<%lO%^l-uS!V[o`Oy%^z;'S%^;'S;=`%o<%lO%^~.UWOY.RZr.Rrs.ns#O.R#O#P.s#P;'S.R;'S;=`/o<%lO.R~.sOh~~.vRO;'S.R;'S;=`/P;=`O.R~/SXOY.RZr.Rrs.ns#O.R#O#P.s#P;'S.R;'S;=`/o;=`<%l.R<%lO.R~/rP;=`<%l.Rn/zYtQOy%^z!Q%^!Q![0j![!c%^!c!i0j!i#T%^#T#Z0j#Z;'S%^;'S;=`%o<%lO%^l0oYo`Oy%^z!Q%^!Q![1_![!c%^!c!i1_!i#T%^#T#Z1_#Z;'S%^;'S;=`%o<%lO%^l1dYo`Oy%^z!Q%^!Q![2S![!c%^!c!i2S!i#T%^#T#Z2S#Z;'S%^;'S;=`%o<%lO%^l2ZYf[o`Oy%^z!Q%^!Q![2y![!c%^!c!i2y!i#T%^#T#Z2y#Z;'S%^;'S;=`%o<%lO%^l3QYf[o`Oy%^z!Q%^!Q![3p![!c%^!c!i3p!i#T%^#T#Z3p#Z;'S%^;'S;=`%o<%lO%^l3uYo`Oy%^z!Q%^!Q![4e![!c%^!c!i4e!i#T%^#T#Z4e#Z;'S%^;'S;=`%o<%lO%^l4lYf[o`Oy%^z!Q%^!Q![5[![!c%^!c!i5[!i#T%^#T#Z5[#Z;'S%^;'S;=`%o<%lO%^l5aYo`Oy%^z!Q%^!Q![6P![!c%^!c!i6P!i#T%^#T#Z6P#Z;'S%^;'S;=`%o<%lO%^l6WSf[o`Oy%^z;'S%^;'S;=`%o<%lO%^d6gUOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^d7QSzSo`Oy%^z;'S%^;'S;=`%o<%lO%^b7cSXQOy%^z;'S%^;'S;=`%o<%lO%^~7rWOY7oZw7owx.nx#O7o#O#P8[#P;'S7o;'S;=`9W<%lO7o~8_RO;'S7o;'S;=`8h;=`O7o~8kXOY7oZw7owx.nx#O7o#O#P8[#P;'S7o;'S;=`9W;=`<%l7o<%lO7o~9ZP;=`<%l7on9cSb^Oy%^z;'S%^;'S;=`%o<%lO%^~9tOa~n9{UUQjWOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^n:fWjW!PQOy%^z!O%^!O!P;O!P!Q%^!Q![>T![;'S%^;'S;=`%o<%lO%^l;TUo`Oy%^z!Q%^!Q![;g![;'S%^;'S;=`%o<%lO%^l;nYo`#b[Oy%^z!Q%^!Q![;g![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^l<cYo`Oy%^z{%^{|=R|}%^}!O=R!O!Q%^!Q![=j![;'S%^;'S;=`%o<%lO%^l=WUo`Oy%^z!Q%^!Q![=j![;'S%^;'S;=`%o<%lO%^l=qUo`#b[Oy%^z!Q%^!Q![=j![;'S%^;'S;=`%o<%lO%^l>[[o`#b[Oy%^z!O%^!O!P;g!P!Q%^!Q![>T![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^n?VSp^Oy%^z;'S%^;'S;=`%o<%lO%^l?hWjWOy%^z!O%^!O!P;O!P!Q%^!Q![>T![;'S%^;'S;=`%o<%lO%^n@VU#_QOy%^z!Q%^!Q![;g![;'S%^;'S;=`%o<%lO%^~@nTjWOy%^z{@}{;'S%^;'S;=`%o<%lO%^~AUSo`#X~Oy%^z;'S%^;'S;=`%o<%lO%^lAg[#b[Oy%^z!O%^!O!P;g!P!Q%^!Q![>T![!g%^!g!h<^!h#X%^#X#Y<^#Y;'S%^;'S;=`%o<%lO%^bBbU]QOy%^z![%^![!]Bt!];'S%^;'S;=`%o<%lO%^bB{S^Qo`Oy%^z;'S%^;'S;=`%o<%lO%^nC^S!W^Oy%^z;'S%^;'S;=`%o<%lO%^dCoSzSOy%^z;'S%^;'S;=`%o<%lO%^bDQU|QOy%^z!`%^!`!aDd!a;'S%^;'S;=`%o<%lO%^bDkS|Qo`Oy%^z;'S%^;'S;=`%o<%lO%^bDzWOy%^z!c%^!c!}Ed!}#T%^#T#oEd#o;'S%^;'S;=`%o<%lO%^bEk[!YQo`Oy%^z}%^}!OEd!O!Q%^!Q![Ed![!c%^!c!}Ed!}#T%^#T#oEd#o;'S%^;'S;=`%o<%lO%^bFfSxQOy%^z;'S%^;'S;=`%o<%lO%^lFwSv[Oy%^z;'S%^;'S;=`%o<%lO%^bGWUOy%^z#b%^#b#cGj#c;'S%^;'S;=`%o<%lO%^bGoUo`Oy%^z#W%^#W#XHR#X;'S%^;'S;=`%o<%lO%^bHYS!`Qo`Oy%^z;'S%^;'S;=`%o<%lO%^bHiUOy%^z#f%^#f#gHR#g;'S%^;'S;=`%o<%lO%^fIQS!RUOy%^z;'S%^;'S;=`%o<%lO%^nIcS!Q^Oy%^z;'S%^;'S;=`%o<%lO%^fItU!PQOy%^z!_%^!_!`6y!`;'S%^;'S;=`%o<%lO%^`JZP;=`<%l$}",tokenizers:[Zv,Jv,Kv,1,2,3,4,new $v("m~RRYZ[z{a~~g~aO#Z~~dP!P!Qg~lO#[~~",28,102)],topRules:{StyleSheet:[0,4],Styles:[1,84]},specialized:[{term:97,get:e=>ty[e]||-1},{term:56,get:e=>ny[e]||-1},{term:98,get:e=>iy[e]||-1}],tokenPrec:1169});let ry=null;function sy(){if(!ry&&"object"==typeof document&&document.body){let{style:e}=document.body,t=[],n=new Set;for(let i in e)"cssText"!=i&&"cssFloat"!=i&&"string"==typeof e[i]&&(/[A-Z]/.test(i)&&(i=i.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()))),n.has(i)||(t.push(i),n.add(i)));ry=t.sort().map((e=>({type:"property",label:e})))}return ry||[]}const ly=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map((e=>({type:"class",label:e}))),ay=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map((e=>({type:"keyword",label:e}))).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map((e=>({type:"constant",label:e})))),cy=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map((e=>({type:"type",label:e}))),hy=/^(\w[\w-]*|-\w[\w-]*|)$/,uy=/^-(-[\w-]*)?$/,fy=new tf,dy=["Declaration"];function py(e){for(let t=e;;){if(t.type.isTop)return t;if(!(t=t.parent))return e}}function my(e,t,n){if(t.to-t.from>4096){let i=fy.get(t);if(i)return i;let o=[],r=new Set,s=t.cursor(Iu.IncludeAnonymous);if(s.firstChild())do{for(let t of my(e,s.node,n))r.has(t.label)||(r.add(t.label),o.push(t))}while(s.nextSibling());return fy.set(t,o),o}{let i=[],o=new Set;return t.cursor().iterate((t=>{var r;if(n(t)&&t.matchContext(dy)&&":"==(null===(r=t.node.nextSibling)||void 0===r?void 0:r.name)){let n=e.sliceString(t.from,t.to);o.has(n)||(o.add(n),i.push({label:n,type:"variable"}))}})),i}}const gy=e=>t=>{let{state:n,pos:i}=t,o=Nf(n).resolveInner(i,-1),r=o.type.isError&&o.from==o.to-1&&"-"==n.doc.sliceString(o.from,o.to);if("PropertyName"==o.name||(r||"TagName"==o.name)&&/^(Block|Styles)$/.test(o.resolve(o.to).name))return{from:o.from,options:sy(),validFor:hy};if("ValueName"==o.name)return{from:o.from,options:ay,validFor:hy};if("PseudoClassName"==o.name)return{from:o.from,options:ly,validFor:hy};if(e(o)||(t.explicit||r)&&function(e,t){var n;if(("("==e.name||e.type.isError)&&(e=e.parent||e),"ArgList"!=e.name)return!1;let i=null===(n=e.parent)||void 0===n?void 0:n.firstChild;return"Callee"==(null==i?void 0:i.name)&&"var"==t.sliceString(i.from,i.to)}(o,n.doc))return{from:e(o)||r?o.from:i,options:my(n.doc,py(o),e),validFor:uy};if("TagName"==o.name){for(let{parent:e}=o;e;e=e.parent)if("Block"==e.name)return{from:o.from,options:sy(),validFor:hy};return{from:o.from,options:cy,validFor:hy}}if(!t.explicit)return null;let s=o.resolve(i),l=s.childBefore(i);return l&&":"==l.name&&"PseudoClassSelector"==s.name?{from:i,options:ly,validFor:hy}:l&&":"==l.name&&"Declaration"==s.name||"ArgList"==s.name?{from:i,options:ay,validFor:hy}:"Block"==s.name||"Styles"==s.name?{from:i,options:sy(),validFor:hy}:null},by=gy((e=>"VariableName"==e.name)),vy=Lf.define({name:"css",parser:oy.configure({props:[td.add({Declaration:ld()}),cd.add({"Block KeyframeList":function(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null}})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}}),yy=({attributes:e,setAttributes:t})=>{const{blockCustomCss:n}=e;return(0,i.createElement)("div",{className:"ffblock-codemirror-wrapper"},(0,i.createElement)(Ov,{value:n||"\n {{FFBID}} { \n /*background-color: red;*/ \n } \n",height:"200px",extensions:[new Gf(vy,vy.data.of({autocomplete:by}))],onChange:e=>t({blockCustomCss:e})}),(0,i.createElement)("span",{className:"help-text"},(0,i.createElement)(c.TextHighlight,{text:"Use {{ FFBID }} prefix before the selector to wrap elements to prevent working globally.",highlight:"{{ FFBID }}"})))},wy=function({attributes:e,setAttributes:t,type:n=""}){const{resDevice:o,mainWrapMarginTop:r,mainWrapMarginBottom:s,mainWrapMargin:l,mainWrapPadding:a,mainWrapBGType:u,mainWrapBG:f,mainWrapHoverBG:d,mainWrapHoverBGTransition:p,mainWrapBGOverlayEnable:m,mainWrapBGOverlay:g,mainWrapBorderType:b,mainWrapBorder:v,mainWrapHoverBorder:y,mainWrapRadius:w,mainWrapHoverRadius:k,mainWrapShadowType:x,mainWrapShadow:O,mainWrapHoverShadow:S,mainWrapZindex:C,mainWrapShowHide:E}=e,A={setAttributes:t,resDevice:o,attributes:e};return(0,i.createElement)(i.Fragment,null,(0,i.createElement)(c.PanelBody,{title:(0,h.__)("Margin & Padding","fluentform-block"),initialOpen:!0},"row"===n&&(0,i.createElement)(i.Fragment,null,(0,i.createElement)(G,{label:(0,h.__)("Margin Top","fluentform-block"),responsive:!0,value:r,min:-500,max:500,step:1,onChange:e=>t({mainWrapMarginTop:e}),resRequiredProps:A}),(0,i.createElement)(G,{label:(0,h.__)("Margin Bottom","fluentform-block"),responsive:!0,value:s,min:-500,max:500,step:1,onChange:e=>t({mainWrapMarginBottom:e}),resRequiredProps:A})),"row"!==n&&(0,i.createElement)(Y,{onChange:e=>{t({mainWrapMargin:e})},label:"Margin",type:"margin",responsive:!0,value:l,resRequiredProps:A}),(0,i.createElement)(Y,{label:(0,h.__)("Padding","fluentform-block"),type:"padding",responsive:!0,value:a,onChange:e=>{t({mainWrapPadding:e})},resRequiredProps:A})),(0,i.createElement)(c.PanelBody,{title:(0,h.__)("Background","fluentform-block"),initialOpen:!1},(0,i.createElement)(xy,{normalContent:(0,i.createElement)(H,{label:"Background",value:f,onChange:e=>t({mainWrapBG:e}),resRequiredProps:A}),hoverContent:(0,i.createElement)(i.Fragment,null,(0,i.createElement)(H,{label:"Background",value:d,onChange:e=>t({mainWrapHoverBG:e}),resRequiredProps:A}),(0,i.createElement)(z,{label:(0,h.__)("Background Transition","fluentform-block"),reset:!0,value:p,onChange:e=>t({mainWrapHoverBGTransition:e}),min:0,max:5,step:.1}))}),(0,i.createElement)(c.ToggleControl,{label:(0,h.__)("Enable Overlay","fluentform-block"),checked:m,onChange:e=>t({mainWrapBGOverlayEnable:e})}),m&&(0,i.createElement)(i.Fragment,null,(0,i.createElement)(H,{label:"Background",value:g,onChange:e=>t({mainWrapBGOverlay:e}),resRequiredProps:A}))),(0,i.createElement)(c.PanelBody,{title:(0,h.__)("Border","fluentform-block"),initialOpen:!1},(0,i.createElement)(xy,{normalContent:(0,i.createElement)(i.Fragment,null,(0,i.createElement)(K,{value:v,onChange:e=>{t({mainWrapBorder:e})},resRequiredProps:A}),(0,i.createElement)(Y,{label:(0,h.__)("Border Radius","fluentform-block"),type:"borderRadius",responsive:!0,value:w,onChange:e=>{t({mainWrapRadius:e})},resRequiredProps:A})),hoverContent:(0,i.createElement)(i.Fragment,null,(0,i.createElement)(K,{value:y,onChange:e=>{t({mainWrapHoverBorder:e})},resRequiredProps:A}),(0,i.createElement)(Y,{label:(0,h.__)("Border Radius","fluentform-block"),type:"borderRadius",responsive:!0,value:k,onChange:e=>{t({mainWrapHoverRadius:e})},resRequiredProps:A}))})),(0,i.createElement)(c.PanelBody,{title:(0,h.__)("Shadow","fluentform-block"),initialOpen:!1},(0,i.createElement)(xy,{normalContent:(0,i.createElement)(j,{value:O,onChange:e=>t({mainWrapShadow:e})}),hoverContent:(0,i.createElement)(j,{value:S,onChange:e=>t({mainWrapHoverShadow:e})})})),(0,i.createElement)(c.PanelBody,{title:(0,h.__)("Show/Hide Condition","fluentform-block"),initialOpen:!1},(0,i.createElement)(c.ToggleControl,{label:(0,h.__)("Hide on desktop","fluentform-block"),className:"ffblock-control-field",checked:E.lg,onChange:e=>t({mainWrapShowHide:{...E,lg:e}})}),(0,i.createElement)(c.ToggleControl,{label:(0,h.__)("Hide on Tablet","fluentform-block"),className:"ffblock-control-field",checked:E.md,onChange:e=>t({mainWrapShowHide:{...E,md:e}})}),(0,i.createElement)(c.ToggleControl,{label:(0,h.__)("Hide on Mobile","fluentform-block"),className:"ffblock-control-field",checked:E.sm,onChange:e=>t({mainWrapShowHide:{...E,sm:e}})})),(0,i.createElement)(c.PanelBody,{title:(0,h.__)("Z-Index","fluentform-block"),initialOpen:!1},(0,i.createElement)(z,{label:(0,h.__)("Z-Index","fluentform-block"),reset:!0,value:C,onChange:e=>t({mainWrapZindex:e}),min:-1e4,max:999999,step:1})),(0,i.createElement)(c.PanelBody,{title:(0,h.__)("Coustom CSS","fluentform-block"),initialOpen:!1},(0,i.createElement)(yy,{attributes:e,setAttributes:t})))},ky=({generalTab:e,styleTab:t,advancedTab:n})=>{const[o,r]=(0,s.useState)("general");return(0,i.createElement)("div",{className:"ffblock-panel-control-wrapper"},(0,i.createElement)(c.ButtonGroup,{className:"ffblock-tab-group"},(0,i.createElement)(c.Button,{className:"ffblock-tab"+("general"===o?" active":""),onClick:()=>r("general")},(0,i.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,i.createElement)("g",{id:"_01_align_center","data-name":"01 align center"},(0,i.createElement)("path",{d:"M5,19H9.414L23.057,5.357a3.125,3.125,0,0,0,0-4.414,3.194,3.194,0,0,0-4.414,0L5,14.586Zm2-3.586L20.057,2.357a1.148,1.148,0,0,1,1.586,0,1.123,1.123,0,0,1,0,1.586L8.586,17H7Z"}),(0,i.createElement)("path",{d:"M23.621,7.622,22,9.243V16H16v6H2V3A1,1,0,0,1,3,2H14.758L16.379.379A5.013,5.013,0,0,1,16.84,0H3A3,3,0,0,0,0,3V24H18.414L24,18.414V7.161A5.15,5.15,0,0,1,23.621,7.622ZM18,21.586V18h3.586Z"}))),(0,i.createElement)("h4",{className:"ffblock-tab-label"},(0,h.__)("General","ffblock-blocks"))),(0,i.createElement)(c.Button,{className:"ffblock-tab"+("style"===o?" active":""),onClick:()=>r("style")},(0,i.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",id:"Layer_1","data-name":"Layer 1",viewBox:"0 0 24 24"},(0,i.createElement)("path",{d:"M8.207,21.293L.732,13.818c-.473-.473-.732-1.101-.732-1.768s.26-1.296,.732-1.768L8.257,2.757l1.414,1.414L2.146,11.697c-.127,.127-.146,.276-.146,.354s.019,.227,.147,.354l7.474,7.475-1.414,1.414Zm15.061-7.475c.472-.473,.732-1.101,.732-1.768s-.26-1.296-.732-1.768L15.743,2.757l-1.414,1.414,7.525,7.526c.127,.127,.146,.276,.146,.353s-.019,.227-.146,.354l-7.475,7.475,1.414,1.414,7.475-7.475Z"})),(0,i.createElement)("h5",{className:"ffblock-tab-label"},(0,h.__)("Style","ffblock-blocks"))),(0,i.createElement)(c.Button,{className:"ffblock-tab"+("advanced"===o?" active":""),onClick:()=>r("advanced")},(0,i.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",id:"Outline",viewBox:"0 0 24 24"},(0,i.createElement)("path",{d:"M12,8a4,4,0,1,0,4,4A4,4,0,0,0,12,8Zm0,6a2,2,0,1,1,2-2A2,2,0,0,1,12,14Z"}),(0,i.createElement)("path",{d:"M21.294,13.9l-.444-.256a9.1,9.1,0,0,0,0-3.29l.444-.256a3,3,0,1,0-3-5.2l-.445.257A8.977,8.977,0,0,0,15,3.513V3A3,3,0,0,0,9,3v.513A8.977,8.977,0,0,0,6.152,5.159L5.705,4.9a3,3,0,0,0-3,5.2l.444.256a9.1,9.1,0,0,0,0,3.29l-.444.256a3,3,0,1,0,3,5.2l.445-.257A8.977,8.977,0,0,0,9,20.487V21a3,3,0,0,0,6,0v-.513a8.977,8.977,0,0,0,2.848-1.646l.447.258a3,3,0,0,0,3-5.2Zm-2.548-3.776a7.048,7.048,0,0,1,0,3.75,1,1,0,0,0,.464,1.133l1.084.626a1,1,0,0,1-1,1.733l-1.086-.628a1,1,0,0,0-1.215.165,6.984,6.984,0,0,1-3.243,1.875,1,1,0,0,0-.751.969V21a1,1,0,0,1-2,0V19.748a1,1,0,0,0-.751-.969A6.984,6.984,0,0,1,7.006,16.9a1,1,0,0,0-1.215-.165l-1.084.627a1,1,0,1,1-1-1.732l1.084-.626a1,1,0,0,0,.464-1.133,7.048,7.048,0,0,1,0-3.75A1,1,0,0,0,4.79,8.992L3.706,8.366a1,1,0,0,1,1-1.733l1.086.628A1,1,0,0,0,7.006,7.1a6.984,6.984,0,0,1,3.243-1.875A1,1,0,0,0,11,4.252V3a1,1,0,0,1,2,0V4.252a1,1,0,0,0,.751.969A6.984,6.984,0,0,1,16.994,7.1a1,1,0,0,0,1.215.165l1.084-.627a1,1,0,1,1,1,1.732l-1.084.626A1,1,0,0,0,18.746,10.125Z"})),(0,i.createElement)("h5",{className:"ffblock-tab-label"},(0,h.__)("Advanced","ffblock-blocks")))),(0,i.createElement)("div",{className:"ffblock-tab-controls"},"general"===o&&(0,i.createElement)(s.Fragment,null,e),"style"===o&&(0,i.createElement)(s.Fragment,null,t),"advanced"===o&&(0,i.createElement)(s.Fragment,null,n)))},xy=({normalContent:e,hoverContent:t})=>(0,i.createElement)(c.BaseControl,null,(0,i.createElement)(c.TabPanel,{className:"ffblock-nh-tab-panel",activeClass:"active-tab",tabs:u.map((({label:e,value:t})=>({name:t,title:e,className:`ffblock-tab ${t}`})))},(n=>"normal"===n?.name?e:t))),Oy=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":2,"name":"ffblock/fluentform","title":"Fluent Form Block","category":"fluentform-block","description":"Fluent forms block is the extension of Fluent forms plugin.You can build advanced Contact form by Fluent form block.","keywords":["gutenberg form","contact form","forms","custom form","form builder"],"textdomain":"fluentform-block","supports":{"anchor":true,"align":["wide","full"]},"attributes":{"layout":{"type":"string","default":"1"},"formId":{"type":"string","default":"1"},"isHtml":{"type":"boolean","default":false},"formJson":{"type":"object","default":null},"formName":{"type":"string","default":"basic_contact_form"},"labelEnable":{"type":"boolean","default":true},"placeholderEnable":{"type":"boolean","default":true},"errorMessageEnable":{"type":"boolean","default":true},"formAlignment":{"type":"object","default":[]},"formMaxWidth":{"type":"object","default":{"lg":"","unit":"px"}},"labelTypo":{"type":"object","default":{"openTypography":1,"size":{"lg":"","unit":"px"},"spacing":{"lg":"","unit":"px"},"height":{"lg":"","unit":"px"},"transform":"","weight":""}},"labelColor":{"type":"string","default":""},"labelSpace":{"type":"object","default":{"lg":{"isLinked":true,"unit":"px","value":""}}},"inputTATypo":{"type":"object","default":{"openTypography":1,"size":{"lg":"","unit":"px"},"spacing":{"lg":"","unit":"px"},"height":{"lg":"","unit":"px"},"transform":"","weight":""}},"inputTAColor":{"type":"string","default":""},"inputTABGColor":{"type":"string","default":""},"inputWidth":{"type":"object","default":{"lg":"","unit":"px"}},"inputHeight":{"type":"object","default":{"lg":"","unit":"px"}},"textareaWidth":{"type":"object","default":{"lg":"","unit":"px"}},"textareaHeight":{"type":"object","default":{"lg":"","unit":"px"}},"inputTAPadding":{"type":"object","default":{"lg":{"isLinked":true,"unit":"px","value":""}}},"inputTAMargin":{"type":"object","default":{"lg":{"isLinked":true,"unit":"px","value":""}}},"inputTABorder":{"type":"object","default":{"borderStyle":"","borderColor":"","lg":{"isLinked":true,"unit":"px","value":""}}},"inputTAHoverBorder":{"type":"object","default":{"borderStyle":"","borderColor":"","lg":{"isLinked":true,"unit":"px","value":""}}},"inputTARadius":{"type":"object","default":{"lg":{"isLinked":true,"unit":"px","value":""}}},"inputTAHoverRadius":{"type":"object","default":{"lg":{"isLinked":true,"unit":"px","value":""}}},"checkboxRSize":{"type":"object","default":{"lg":"","unit":"px"}},"checkboxRItemLabelSpace":{"type":"object","default":{"lg":"","unit":"px"}},"checkboxRItemSpace":{"type":"object","default":{"lg":"","unit":"px"}},"optionLabelColor":{"type":"string","default":""},"checkboxRBgColor":{"type":"string","default":""},"checkboxRCheckedColor":{"type":"string","default":""},"checkboxRBorderWidth":{"type":"object","default":{"lg":"","unit":"px"}},"checkboxRBorderColor":{"type":"string","default":""},"checkboxRounded":{"type":"object","default":{"lg":"","unit":"px"}},"placeholderTypo":{"type":"object","default":{"openTypography":1,"size":{"lg":"","unit":"px"},"spacing":{"lg":"","unit":"px"},"height":{"lg":"","unit":"px"},"transform":"","weight":""}},"placeholderColor":{"type":"string","default":""},"sectionBGColor":{"type":"string","default":""},"sectionMargin":{"type":"object","default":{"lg":{"isLinked":true,"unit":"px","value":""}}},"sectionPadding":{"type":"object","default":{"lg":{"isLinked":true,"unit":"px","value":""}}},"sectionHTypo":{"type":"object","default":{"openTypography":1,"size":{"lg":"","unit":"px"},"spacing":{"lg":"","unit":"px"},"height":{"lg":"","unit":"px"},"transform":"","weight":""}},"sectionHTextColor":{"type":"string","default":""},"sectionHBGColor":{"type":"string","default":""},"sectionDTypo":{"type":"object","default":{"openTypography":1,"size":{"lg":"","unit":"px"},"spacing":{"lg":"","unit":"px"},"height":{"lg":"","unit":"px"},"transform":"","weight":""}},"sectionDTextColor":{"type":"string","default":""},"sectionDBGColor":{"type":"string","default":""},"sectionHLineColor":{"type":"string","default":""},"customHtmlTypo":{"type":"object","default":{"openTypography":1,"size":{"lg":"","unit":"px"},"spacing":{"lg":"","unit":"px"},"height":{"lg":"","unit":"px"},"transform":"","weight":""}},"customHtmlColor":{"type":"string","default":""},"customHtmlBGColor":{"type":"string","default":""},"buttonWidth":{"type":"object","default":{"lg":"","unit":"px"}},"buttonHeight":{"type":"object","default":{"lg":"","unit":"px"}},"buttonTypo":{"type":"object","default":{"openTypography":1,"size":{"lg":"","unit":"px"},"spacing":{"lg":"","unit":"px"},"height":{"lg":"","unit":"px"},"transform":"","weight":""}},"buttonTextColor":{"type":"string","default":""},"buttonHoverTextColor":{"type":"string","default":""},"buttonBGColor":{"type":"string","default":""},"buttonHoverBGColor":{"type":"string","default":""},"buttonPadding":{"type":"object","default":{"lg":{"isLinked":true,"unit":"px","value":""}}},"buttonMargin":{"type":"object","default":{"lg":{"isLinked":true,"unit":"px","value":""}}},"buttonBorder":{"type":"object","default":{"borderStyle":"","borderColor":"","lg":{"isLinked":true,"unit":"px","value":""}}},"buttonHoverBorder":{"type":"object","default":{"borderStyle":"","borderColor":"","lg":{"isLinked":true,"unit":"px","value":""}}},"buttonRadius":{"type":"object","default":{"lg":{"isLinked":true,"unit":"px","value":""}}},"buttonHoverRadius":{"type":"object","default":{"lg":{"isLinked":true,"unit":"px","value":""}}},"buttonShadow":{"type":"object","default":{"openShadow":1,"width":{"top":1,"right":1,"bottom":1,"left":1},"color":"","inset":false}},"buttonHoverShadow":{"type":"object","default":{"openShadow":1,"width":{"top":1,"right":1,"bottom":1,"left":1},"color":"","inset":false}},"successTypo":{"type":"object","default":{"openTypography":1,"size":{"lg":"","unit":"px"},"spacing":{"lg":"","unit":"px"},"height":{"lg":"","unit":"px"},"transform":"","weight":""}},"successColor":{"type":"string","default":""},"successBGColor":{"type":"string","default":""},"successBorderColor":{"type":"string","default":""},"errorTypo":{"type":"object","default":{"openTypography":1,"size":{"lg":"","unit":"px"},"spacing":{"lg":"","unit":"px"},"height":{"lg":"","unit":"px"},"transform":"","weight":""}},"errorColor":{"type":"string","default":""},"errorBGColor":{"type":"string","default":""},"errorBorderColor":{"type":"string","default":""},"blockId":{"type":"string","default":""},"resDevice":{"type":"string","default":"lg"},"blockCSS":{"type":"object"},"preview":{"type":"boolean","default":false},"mainWrapMargin":{"type":"object","default":{"lg":{"isLinked":true,"unit":"px","value":""}}},"mainWrapPadding":{"type":"object","default":{"lg":{"isLinked":true,"unit":"px","value":""}}},"mainWrapBGType":{"type":"string","default":"normal"},"mainWrapBG":{"type":"object","default":{"type":"classic","classic":{"color":"","img":{"imgURL":"","imgID":""},"imgProperty":{"imgPosition":{"lg":""},"imgAttachment":{"lg":""},"imgRepeat":{"lg":""},"imgSize":{"lg":""}}},"gradient":null}},"mainWrapHoverBG":{"type":"object","default":{"type":"classic","classic":{"color":"","img":{"imgURL":"","imgID":""},"imgProperty":{"imgPosition":{"lg":""},"imgAttachment":{"lg":""},"imgRepeat":{"lg":""},"imgSize":{"lg":""}}},"gradient":null}},"mainWrapHoverBGTransition":{"type":"number","default":0.5},"mainWrapBGOverlayEnable":{"type":"boolean","default":false},"mainWrapBGOverlay":{"type":"object","default":{"openBGColor":0,"type":"classic","classic":{"color":"","img":{"imgURL":"","imgID":""},"imgProperty":{"imgPosition":{"lg":""},"imgAttachment":{"lg":""},"imgRepeat":{"lg":""},"imgSize":{"lg":""}}},"gradient":null}},"mainWrapBorderType":{"type":"string","default":"normal"},"mainWrapBorder":{"type":"object","default":{"borderStyle":"","borderColor":"","lg":{"isLinked":true,"unit":"px","value":""}}},"mainWrapHoverBorder":{"type":"object","default":{"borderStyle":"","borderColor":"","lg":{"isLinked":true,"unit":"px","value":""}}},"mainWrapRadius":{"type":"object","default":{"lg":{"isLinked":true,"unit":"px","value":""}}},"mainWrapHoverRadius":{"type":"object","default":{"lg":{"isLinked":true,"unit":"px","value":""}}},"mainWrapShadowType":{"type":"string","default":"normal"},"mainWrapShadow":{"type":"object","default":{"width":{"top":1,"right":1,"bottom":1,"left":1},"color":""}},"mainWrapHoverShadow":{"type":"object","default":{"width":{"top":1,"right":1,"bottom":1,"left":1},"color":""}},"mainWrapZindex":{"type":"number","default":1},"mainWrapShowHide":{"type":"object","default":{"lg":false,"md":false,"sm":false}},"blockCustomCss":{"type":"string","default":""}},"editorScript":"file:./index.js","editorStyle":["file:./index.css","fluentform-public-default-ffb"],"style":"file:./style-index.css"}'),Sy=function({attributes:e,setAttributes:t}){const{resDevice:n,formId:o,labelEnable:r,placeholderEnable:s,errorMessageEnable:l,formMaxWidth:a,formAlignment:u,labelTypo:f,labelColor:d,labelSpace:p,inputTABGColor:m,inputWidth:g,inputHeight:b,textareaWidth:v,textareaHeight:y,inputTAPadding:w,inputTAMargin:k,inputTABorder:x,inputTARadius:O,inputTAHoverBorder:C,inputTAHoverRadius:E,checkboxRSize:A,checkboxRItemLabelSpace:M,checkboxRItemSpace:T,optionLabelColor:D,checkboxRBgColor:R,checkboxRCheckedColor:$,checkboxRBorderWidth:_,checkboxRBorderColor:B,checkboxRounded:I,placeholderColor:L,placeholderTypo:N,sectionBGColor:V,sectionMargin:H,sectionPadding:z,sectionHTypo:F,sectionHTextColor:Q,sectionHBGColor:q,sectionDTypo:U,sectionDTextColor:X,sectionDBGColor:Z,sectionHLineColor:J,customHtmlTypo:ee,customHtmlColor:te,customHtmlBGColor:ne,buttonTypo:ie,buttonTextColor:oe,buttonBGColor:re,buttonHoverTextColor:se,buttonHoverBGColor:le,buttonWidth:ae,buttonHeight:ce,buttonPadding:he,buttonMargin:ue,buttonBorder:fe,buttonRadius:de,buttonHoverBorder:pe,buttonHoverRadius:me,buttonShadow:ge,buttonHoverShadow:be,successTypo:ve,successColor:ye,successBGColor:we,successBorderColor:ke,errorTypo:xe,errorColor:Oe,errorBGColor:Se,errorBorderColor:Ce}=e,Ee={setAttributes:t,resDevice:n,attributes:e},Ae=JSON.parse(ffbBlockParams.fluent_form_lists);return(0,i.createElement)(S.InspectorControls,{key:"controls"},(0,i.createElement)(ky,{generalTab:(0,i.createElement)(i.Fragment,null,(0,i.createElement)(c.PanelBody,{title:(0,h.__)("General","fluentform-block"),initialOpen:!0},(0,i.createElement)(c.SelectControl,{label:(0,h.__)("Fluent Form","fluentform-block"),value:o,options:Ae,onChange:e=>{t({formId:e});let n=Ae.filter((t=>t.value==e))[0];t({formName:n.template_name})},help:(0,h.__)("Form list from plugin fluent form list","fluentform-block")}),(0,i.createElement)(c.ToggleControl,{label:(0,h.__)("Display Labels","fluentform-block"),checked:r,onChange:e=>t({labelEnable:e})}),(0,i.createElement)(c.ToggleControl,{label:(0,h.__)("Display Placeholder","fluentform-block"),checked:s,onChange:e=>t({placeholderEnable:e})}),(0,i.createElement)(c.ToggleControl,{label:(0,h.__)("Display Error Message","fluentform-block"),checked:l,onChange:e=>t({errorMessageEnable:e})}),(0,i.createElement)(G,{label:(0,h.__)("Form Max Width"),responsive:!0,value:a,units:["px","%"],min:1,max:"%"==a.unit?100:2e3,step:1,resRequiredProps:Ee,onChange:e=>t({formMaxWidth:e})}),(0,i.createElement)(W,{label:(0,h.__)("Alignment","fluentform-block"),value:u,responsive:!0,options:["left","center","right"],resRequiredProps:Ee,onChange:e=>{t({formAlignment:e}),t({formAlignmentHelper:e[n]})},help:(0,h.__)("Alignment field working when form max width field value set","fluentform-block")}))),styleTab:(0,i.createElement)(i.Fragment,null,r&&(0,i.createElement)(c.PanelBody,{title:(0,h.__)("Label","fluentform-block"),initialOpen:!0},(0,i.createElement)(so,{label:(0,h.__)("Typography","fluentform-block"),value:f,onChange:e=>t({labelTypo:e}),resRequiredProps:Ee}),(0,i.createElement)(P,{label:(0,h.__)("Color","fluentform-block"),color:d,onChange:e=>t({labelColor:e})}),(0,i.createElement)(Y,{label:(0,h.__)("Space","fluentform-block"),onChange:e=>{t({labelSpace:e})},type:"margin",responsive:!0,value:p,resRequiredProps:Ee})),(0,i.createElement)(c.PanelBody,{title:(0,h.__)("Input/Textarea/Select","fluentform-block"),initialOpen:!1},(0,i.createElement)(G,{label:(0,h.__)("Input Width","fluentform-block"),responsive:!0,value:g,units:["px","%"],min:1,max:"%"===g.unit?100:1e3,step:1,onChange:e=>t({inputWidth:e}),resRequiredProps:Ee}),(0,i.createElement)(G,{label:(0,h.__)("Input Height","fluentform-block"),responsive:!0,value:b,units:["px","%"],min:1,max:"%"===b.unit?100:200,step:1,onChange:e=>t({inputHeight:e}),resRequiredProps:Ee}),(0,i.createElement)(Y,{onChange:e=>{t({inputTAPadding:e})},label:(0,h.__)("Padding","fluentform-block"),type:"padding",responsive:!0,value:w,resRequiredProps:Ee}),(0,i.createElement)(Y,{onChange:e=>{t({inputTAMargin:e})},label:(0,h.__)("Margin","fluentform-block"),type:"margin",responsive:!0,value:k,resRequiredProps:Ee}),(0,i.createElement)(c.PanelBody,{title:(0,h.__)("Border","fluentform-block"),initialOpen:!1},(0,i.createElement)(xy,{normalContent:(0,i.createElement)(i.Fragment,null,(0,i.createElement)(K,{value:x,onChange:e=>{t({inputTABorder:e})},resRequiredProps:Ee}),(0,i.createElement)(Y,{onChange:e=>{t({inputTARadius:e})},label:(0,h.__)("Border Radius","fluentform-block"),type:"borderRadius",responsive:!0,value:O,resRequiredProps:Ee})),hoverContent:(0,i.createElement)(i.Fragment,null,(0,i.createElement)(K,{value:C,onChange:e=>{t({inputTAHoverBorder:e})},resRequiredProps:Ee}),(0,i.createElement)(Y,{onChange:e=>{t({inputTAHoverRadius:e})},label:(0,h.__)("Border Radius","fluentform-block"),type:"borderRadius",responsive:!0,value:E,resRequiredProps:Ee}))})),(0,i.createElement)(P,{label:(0,h.__)("Background Color","fluentform-block"),color:m,onChange:e=>t({inputTABGColor:e})}),(0,i.createElement)("hr",null),(0,i.createElement)("h3",{className:"ffblock-section-label-text"},(0,h.__)("Textarea","fluentform-block")),(0,i.createElement)(G,{label:(0,h.__)("Textarea Width","fluentform-block"),responsive:!0,value:v,units:["px","%"],min:1,max:"%"===v.unit?100:1e3,step:1,onChange:e=>t({textareaWidth:e}),resRequiredProps:Ee}),(0,i.createElement)(G,{label:(0,h.__)("Textarea Height","fluentform-block"),responsive:!0,value:y,units:["px","%"],min:1,max:"%"===y.unit?100:400,step:1,onChange:e=>t({textareaHeight:e}),resRequiredProps:Ee})),s&&(0,i.createElement)(c.PanelBody,{title:(0,h.__)("Placeholder","fluentform-block"),initialOpen:!1},(0,i.createElement)(so,{label:(0,h.__)("Typography","fluentform-block"),value:N,onChange:e=>t({placeholderTypo:e}),resRequiredProps:Ee}),(0,i.createElement)(P,{label:(0,h.__)("Color","fluentform-block"),color:L,onChange:e=>t({placeholderColor:e})})),(0,i.createElement)(c.PanelBody,{title:(0,h.__)("Checkbox & Radio","fluentform-block"),initialOpen:!1},(0,i.createElement)(P,{label:(0,h.__)("Label Color","fluentform-block"),color:D,onChange:e=>t({optionLabelColor:e})}),(0,i.createElement)(P,{label:(0,h.__)("Background Color","fluentform-block"),color:R,onChange:e=>t({checkboxRBgColor:e})}),(0,i.createElement)(P,{label:(0,h.__)("Checked Color","fluentform-block"),color:$,onChange:e=>t({checkboxRCheckedColor:e})}),(0,i.createElement)(G,{label:(0,h.__)("Size","fluentform-block"),responsive:!0,value:A,units:["px","%"],min:1,max:100,step:1,onChange:e=>t({checkboxRSize:e}),resRequiredProps:Ee}),(0,i.createElement)(G,{label:(0,h.__)("Item To Label Space","fluentform-block"),responsive:!0,value:M,units:["px","%"],min:1,max:200,step:1,onChange:e=>t({checkboxRItemLabelSpace:e}),resRequiredProps:Ee}),(0,i.createElement)(G,{label:(0,h.__)("Item Bottom Space","fluentform-block"),responsive:!0,value:T,units:["px","%"],min:1,max:200,step:1,onChange:e=>t({checkboxRItemSpace:e}),resRequiredProps:Ee}),(0,i.createElement)(G,{label:(0,h.__)("Border Width","fluentform-block"),responsive:!0,value:_,units:["px","%"],min:1,max:20,step:1,onChange:e=>t({checkboxRBorderWidth:e}),resRequiredProps:Ee}),(0,i.createElement)(P,{label:(0,h.__)("Border Color","fluentform-block"),color:B,onChange:e=>t({checkboxRBorderColor:e})}),(0,i.createElement)(G,{label:(0,h.__)("Checkbox Rounded Corners","fluentform-block"),responsive:!0,value:I,units:["px","%"],min:1,max:20,step:1,onChange:e=>t({checkboxRounded:e}),resRequiredProps:Ee})),(0,i.createElement)(c.PanelBody,{title:(0,h.__)("Section Break","fluentform-block"),initialOpen:!1},(0,i.createElement)(P,{label:(0,h.__)("Background Color","fluentform-block"),color:V,onChange:e=>t({sectionBGColor:e})}),(0,i.createElement)(Y,{onChange:e=>{t({sectionMargin:e})},label:(0,h.__)("Margin","fluentform-block"),type:"margin",responsive:!0,value:H,resRequiredProps:Ee}),(0,i.createElement)(Y,{onChange:e=>{t({sectionPadding:e})},label:(0,h.__)("Padding","fluentform-block"),type:"padding",responsive:!0,value:z,resRequiredProps:Ee}),(0,i.createElement)("hr",null),(0,i.createElement)("h3",{className:"ffblock-section-label-text"},(0,h.__)("Heading","fluentform-block")),(0,i.createElement)(so,{label:(0,h.__)("Typography","fluentform-block"),value:F,onChange:e=>t({sectionHTypo:e}),resRequiredProps:Ee}),(0,i.createElement)(P,{label:(0,h.__)("Text Color","fluentform-block"),color:Q,onChange:e=>t({sectionHTextColor:e})}),(0,i.createElement)(P,{label:(0,h.__)("Background Color","fluentform-block"),color:q,onChange:e=>t({sectionHBGColor:e})}),(0,i.createElement)("hr",null),(0,i.createElement)("h3",{className:"ffblock-section-label-text"},(0,h.__)("Description","fluentform-block")),(0,i.createElement)(so,{label:(0,h.__)("Typography","fluentform-block"),value:U,onChange:e=>t({sectionDTypo:e}),resRequiredProps:Ee}),(0,i.createElement)(P,{label:(0,h.__)("Text Color","fluentform-block"),color:X,onChange:e=>t({sectionDTextColor:e})}),(0,i.createElement)(P,{label:(0,h.__)("Background Color","fluentform-block"),color:Z,onChange:e=>t({sectionDBGColor:e})}),(0,i.createElement)(P,{label:(0,h.__)("Border Color","fluentform-block"),color:J,onChange:e=>t({sectionHLineColor:e})})),(0,i.createElement)(c.PanelBody,{title:(0,h.__)("Custom HTML","fluentform-block"),initialOpen:!1},(0,i.createElement)(so,{label:(0,h.__)("Typography","fluentform-block"),value:ee,onChange:e=>t({customHtmlTypo:e}),resRequiredProps:Ee}),(0,i.createElement)(P,{label:(0,h.__)("Text Color","fluentform-block"),color:te,onChange:e=>t({customHtmlColor:e})}),(0,i.createElement)(P,{label:(0,h.__)("Background Color","fluentform-block"),color:ne,onChange:e=>t({customHtmlBGColor:e})})),(0,i.createElement)(c.PanelBody,{title:(0,h.__)("Submit Button","fluentform-block"),initialOpen:!1},(0,i.createElement)(so,{label:(0,h.__)("Typography","fluentform-block"),value:ie,onChange:e=>t({buttonTypo:e}),resRequiredProps:Ee}),(0,i.createElement)(xy,{normalContent:(0,i.createElement)(i.Fragment,null,(0,i.createElement)(P,{label:(0,h.__)("Text Color","fluentform-block"),color:oe,onChange:e=>t({buttonTextColor:e})}),(0,i.createElement)(P,{label:(0,h.__)("Background Color","fluentform-block"),color:re,onChange:e=>t({buttonBGColor:e})})),hoverContent:(0,i.createElement)(i.Fragment,null,(0,i.createElement)(P,{label:(0,h.__)("Hover Text Color","fluentform-block"),color:se,onChange:e=>t({buttonHoverTextColor:e})}),(0,i.createElement)(P,{label:(0,h.__)("Hover Background Color","fluentform-block"),color:le,onChange:e=>t({buttonHoverBGColor:e})}))}),(0,i.createElement)(G,{label:(0,h.__)("Width","fluentform-block"),responsive:!0,value:ae,units:["px","%"],min:1,max:"%"==ae.unit?100:1e3,step:1,onChange:e=>t({buttonWidth:e}),resRequiredProps:Ee}),(0,i.createElement)(G,{label:(0,h.__)("Height","fluentform-block"),responsive:!0,value:ce,units:["px","%"],min:1,max:"%"==ce.unit?100:200,step:1,onChange:e=>t({buttonHeight:e}),resRequiredProps:Ee}),(0,i.createElement)(Y,{onChange:e=>{t({buttonPadding:e})},label:(0,h.__)("Padding","fluentform-block"),type:"padding",responsive:!0,value:he,resRequiredProps:Ee}),(0,i.createElement)(Y,{onChange:e=>{t({buttonMargin:e})},label:(0,h.__)("Margin","fluentform-block"),type:"margin",responsive:!0,value:ue,resRequiredProps:Ee}),(0,i.createElement)(c.PanelBody,{title:(0,h.__)("Border","fluentform-block"),initialOpen:!1},(0,i.createElement)(xy,{normalContent:(0,i.createElement)(i.Fragment,null,(0,i.createElement)(K,{value:fe,onChange:e=>{t({buttonBorder:e})},resRequiredProps:Ee}),(0,i.createElement)(Y,{onChange:e=>{t({buttonRadius:e})},label:(0,h.__)("Border Radius","fluentform-block"),type:"borderRadius",responsive:!0,value:de,resRequiredProps:Ee})),hoverContent:(0,i.createElement)(i.Fragment,null,(0,i.createElement)(K,{value:pe,onChange:e=>{t({buttonHoverBorder:e})},resRequiredProps:Ee}),(0,i.createElement)(Y,{onChange:e=>{t({buttonHoverRadius:e})},label:(0,h.__)("Border Radius","fluentform-block"),type:"borderRadius",responsive:!0,value:me,resRequiredProps:Ee}))})),(0,i.createElement)(c.PanelBody,{title:(0,h.__)("Box Shadow","fluentform-block"),initialOpen:!1},(0,i.createElement)(xy,{normalContent:(0,i.createElement)(j,{value:ge,onChange:e=>t({buttonShadow:e})}),hoverContent:(0,i.createElement)(j,{value:be,onChange:e=>t({buttonHoverShadow:e})})}))),(0,i.createElement)(c.PanelBody,{title:(0,h.__)("Success Message","fluentform-block"),initialOpen:!1},(0,i.createElement)(so,{label:(0,h.__)("Typography","fluentform-block"),value:ve,onChange:e=>t({successTypo:e}),resRequiredProps:Ee}),(0,i.createElement)(P,{label:(0,h.__)("Color","fluentform-block"),color:ye,onChange:e=>t({successColor:e})}),(0,i.createElement)(P,{label:(0,h.__)("Background Color","fluentform-block"),color:we,onChange:e=>t({successBGColor:e})}),(0,i.createElement)(P,{label:(0,h.__)("Border Color","fluentform-block"),color:ke,onChange:e=>t({successBorderColor:e})})),(0,i.createElement)(c.PanelBody,{title:(0,h.__)("Error Message","fluentform-block"),initialOpen:!1},(0,i.createElement)(so,{label:(0,h.__)("Typography","fluentform-block"),value:xe,onChange:e=>t({errorTypo:e}),resRequiredProps:Ee}),(0,i.createElement)(P,{label:(0,h.__)("Color","fluentform-block"),color:Oe,onChange:e=>t({errorColor:e})}),(0,i.createElement)(P,{label:(0,h.__)("Background Color","fluentform-block"),color:Se,onChange:e=>t({errorBGColor:e})}),(0,i.createElement)(P,{label:(0,h.__)("Border Color","fluentform-block"),color:Ce,onChange:e=>t({errorBorderColor:e})}))),advancedTab:(0,i.createElement)(i.Fragment,null,(0,i.createElement)(wy,{attributes:e,setAttributes:t}))}))},Cy=window.wp.apiFetch;var Ey=n.n(Cy),Ay=n(184),My=n.n(Ay);const Ty=(e,t)=>{let n={};return e&&e.lg&&(n.lg=t.replace(new RegExp("{{key}}","g"),e.lg+(e.unit||""))),e&&e.md&&(n.md=t.replace(new RegExp("{{key}}","g"),e.md+(e.unit||""))),e&&e.sm&&(n.sm=t.replace(new RegExp("{{key}}","g"),e.sm+(e.unit||""))),n},Dy=(e,t)=>(e.lg&&t.lg.push(e.lg),e.md&&t.md.push(e.md),e.sm&&t.sm.push(e.sm),t),Py=function({controlValue:e}){let t="",n="",i="";if(void 0!==e){let o={lg:[],md:[],sm:[]},r="";if("classic"===e.type){e.classic.imgProperty.imgPosition&&(o=Dy(Ty(e.classic.imgProperty.imgPosition,"background-position:{{key}}"),o)),e.classic.imgProperty.imgAttachment&&(o=Dy(Ty(e.classic.imgProperty.imgAttachment,"background-attachment:{{key}}"),o)),e.classic.imgProperty.imgRepeat&&(o=Dy(Ty(e.classic.imgProperty.imgRepeat,"background-repeat:{{key}}"),o)),e.classic.imgProperty.imgSize&&(o=Dy(Ty(e.classic.imgProperty.imgSize,"background-size:{{key}}"),o));let t=void 0!==e.classic.img?e.classic.img.imgURL:"";r+=e.classic.color?"background:"+e.classic.color+";":"",r+=t?"background-image:url("+t+");":""}else"gradient"===e.type&&e.gradient&&(r+=e.gradient?"background-image :"+e.gradient+";":"");t=`${r} ${o.lg.length>0?o.lg.join(";")+";":""}`,n=`${r} ${o.md.length>0?o.md.join(";")+";":""}`,i=`${r} ${o.sm.length>0?o.sm.join(";")+";":""}`}return{deskBackground:t,tabBackground:n,mobBackground:i}},Ry=function({controlValue:e}){let t="";return void 0!==e&&(t=e.color?"box-shadow:"+(e.inset?"inset":"")+" "+e.width.top+"px "+e.width.right+"px "+e.width.bottom+"px "+e.width.left+"px "+e.color+";":""),{boxshadowStyles:t}},$y=function({controlValue:e,property:t,important:n=""}){let i="",o="",r="";if(void 0!==e){const s=e.unit||"",l=e.lg||"",a=e.md||"",c=e.sm||"";n=n?" !important":"",i=l||0===l?t+":"+("px"!==s&&l>100?100:l)+s+n+";":"",o=a||0===a?t+":"+("px"!==s&&a>100?100:a)+s+n+";":"",r=c||0===c?t+":"+("px"!==s&&c>100?100:c)+s+n+";":""}return{rangeDeviceDesk:i,rangeDeviceTab:o,rangeDeviceMob:r}},_y=(e,t,n)=>{let i="";const o=e.unit||"px";if(e?.isLinked)" "!=e.value&&(i=`${t}:${e.value.split(" ")[0]||"0"}${o}${n}; `);else{let r=e.value?e.value.split(" "):["0","0","0","0"];""===r[0]||""===r[1]||""===r[2]||""===r[3]?("margin"!=t&&"padding"!=t||(r[0]&&(i+=`${t}-top:${r[0]}${"0"!==r[0]?o:""}${n};`),r[1]&&(i+=`${t}-right:${r[1]}${"0"!==r[1]?o:""}${n};`),r[2]&&(i+=`${t}-bottom:${r[2]}${"0"!==r[2]?o:""}${n};`),r[3]&&(i+=`${t}-left:${r[3]}${"0"!==r[3]?o:""}${n};`)),"border-radius"==t&&(r[0]&&(i+=`border-top-left-radius:${r[0]}${"0"!==r[0]?o:""}${n};`),r[1]&&(i+=`border-top-right-radius:${r[1]}${"0"!==r[1]?o:""}${n};`),r[2]&&(i+=`border-bottom-right-radius:${r[2]}${"0"!==r[2]?o:""}${n};`),r[3]&&(i+=`border-bottom-left-radius:${r[3]}${"0"!==r[3]?o:""}${n};`)),"border-width"==t&&(r[0]&&(i+=`border-top-width:${r[0]}${"0"!==r[0]?o:""}${n};`),r[1]&&(i+=`border-right-width:${r[1]}${"0"!==r[1]?o:""}${n};`),r[2]&&(i+=`border-bottom-width:${r[2]}${"0"!==r[2]?o:""}${n};`),r[3]&&(i+=`border-left-width:${r[3]}${"0"!==r[3]?o:""}${n};`))):i=`${t}:${r[0]?r[0]:"0"}${o} ${r[1]?r[1]:"0"}${o} ${r[2]?r[2]:"0"}${o} ${r[3]?r[3]:"0"}${o}${n};`}return i},By=function({controlValue:e,property:t,important:n=""}){let i="",o="",r="";if(void 0!==e){const s=e.lg||"",l=e.md||"",a=e.sm||"";n=n?" !important":"",s&&s?.value&&(i=_y(s,t,n),"border-width"==t&&(e?.borderStyle||e?.borderColor)&&(i+=`\n\t\t\t\tborder-color:${e.borderColor}${n};\n\t\t\t\tborder-style:${e.borderStyle}${n};\n\t\t\t`)),l&&l?.value&&(o=_y(l,t,n)),a&&a?.value&&(r=_y(a,t,n))}return{deskDimension:i,tabDimension:o,mobDimension:r}},Iy=function({controlValue:e}){let t="",n="",i="";if(void 0!==e){let o={lg:[],md:[],sm:[]};e.size&&(o=Dy(Ty(e.size,"font-size:{{key}}"),o)),e.height&&(o=Dy(Ty(e.height,"line-height:{{key}}"),o)),e.spacing&&(o=Dy(Ty(e.spacing,"letter-spacing:{{key}}"),o)),t=`${(e.family&&"none"!==e.family?"font-family:"+e.family+","+(e.type||"sans-serif")+";":"")+(e.weight?"font-weight:"+e.weight+";":"")+(e.style?"font-style:"+e.style+";":"")+(e.transform?"text-transform:"+e.transform+";":"")+(e.decoration?"text-decoration:"+e.decoration+";":"")}${o.lg.length>0?o.lg.join(";")+";":""}`,n=o.lg.length>0?o.lg.join(";")+";":"",i=o.lg.length>0?o.lg.join(";")+";":""}return{deskTypography:t,tabTypography:n,mobTypography:i}},Ly=(e=" ")=>e.replace(/\s+/g," ").replace(/\.ffff\-[\w\-\s\.\,\:\>\(\)\d\+\[\]\#\>]+\{[\s]+\}/g,""),Ny=(e="")=>({__html:e}),Vy=function({attributes:e,setAttributes:t}){const{blockId:n,blockCSS:i,formMaxWidth:o,formAlignment:r,labelTypo:l,labelColor:a,labelSpace:c,inputTATypo:h,inputTAColor:u,inputTABGColor:f,inputTAPadding:d,inputTAMargin:p,inputTABorder:m,inputTARadius:g,inputTAHoverBorder:b,inputTAHoverRadius:v,inputWidth:y,inputHeight:w,textareaWidth:k,textareaHeight:x,checkboxRSize:O,checkboxRItemLabelSpace:S,checkboxRItemSpace:C,optionLabelColor:E,checkboxRBgColor:A,checkboxRCheckedColor:M,checkboxRBorderWidth:T,checkboxRBorderColor:D,checkboxRounded:P,placeholderTypo:R,placeholderColor:$,sectionBGColor:_,sectionMargin:B,sectionPadding:I,sectionHTypo:L,sectionHTextColor:N,sectionHBGColor:V,sectionDTypo:H,sectionDTextColor:W,sectionDBGColor:z,sectionHLineColor:F,customHtmlTypo:Q,customHtmlColor:j,customHtmlBGColor:q,buttonTypo:U,buttonTextColor:G,buttonBGColor:X,buttonHoverTextColor:Y,buttonHoverBGColor:K,buttonWidth:Z,buttonHeight:J,buttonPadding:ee,buttonMargin:te,buttonBorder:ne,buttonRadius:ie,buttonHoverBorder:oe,buttonHoverRadius:re,buttonShadow:se,buttonHoverShadow:le,successTypo:ae,successColor:ce,successBGColor:he,successBorderColor:ue,errorTypo:fe,errorColor:de,errorBGColor:pe,errorBorderColor:me}=e,{wrapperStylesDesk:ge,wrapperStylesTab:be,wrapperStylesMob:ve,blockWriteCss:ye}=function({attributes:e,setAttributes:t}){const{blockId:n,mainWrapMarginTop:i,mainWrapMarginBottom:o,mainWrapMargin:r,mainWrapPadding:s,mainWrapBG:l,mainWrapHoverBG:a,mainWrapHoverBGTransition:c,mainWrapBGOverlayEnable:h,mainWrapBGOverlay:u,mainWrapBorder:f,mainWrapHoverBorder:d,mainWrapRadius:p,mainWrapHoverRadius:m,mainWrapShadow:g,mainWrapHoverShadow:b,mainWrapZindex:v,mainWrapShowHide:y,blockCustomCss:w}=e,{deskDimension:k,tabDimension:x,mobDimension:O}=By({controlValue:r,property:"margin",important:!0}),{rangeDeviceDesk:S,rangeDeviceTab:C,rangeDeviceMob:E}=$y({controlValue:i,property:"margin-top",important:!0}),{rangeDeviceDesk:A,rangeDeviceTab:M,rangeDeviceMob:T}=$y({controlValue:o,property:"margin-bottom",important:!0}),{deskDimension:D,tabDimension:P,mobDimension:R}=By({controlValue:s,property:"padding",important:!0}),{deskBackground:$,tabBackground:_,mobBackground:B}=Py({controlValue:l}),{deskBackground:I,tabBackground:L,mobBackground:N}=Py({controlValue:a}),{deskBackground:V,tabBackground:H,mobBackground:W}=Py({controlValue:u}),{deskDimension:z,tabDimension:F,mobDimension:Q}=By({controlValue:f,property:"border-width",important:!0}),{deskDimension:j,tabDimension:q,mobDimension:U}=By({controlValue:d,property:"border-width",important:!0}),{deskDimension:G,tabDimension:X,mobDimension:Y}=By({controlValue:p,property:"border-radius",important:!0}),{deskDimension:K,tabDimension:Z,mobDimension:J}=By({controlValue:m,property:"border-radius",important:!0}),{boxshadowStyles:ee}=Ry({controlValue:g}),{boxshadowStyles:te}=Ry({controlValue:b}),ne=`\n\t\t.${n}{\n\t\t\t${S}\n\t\t\t${A}\n\t\t\t${k}\n\t\t\t${D}\n\t\t\t${$}\n\t\t\t${c?`transition: background ${c}s;`:""}\n\t\t\t${z}\n\t\t\t${G}\n\t\t\t${ee}\n\t\t\t${v?`z-index:${v};`:""}\n\t\t\ttransition: all 0.25s;\n\t\t\tposition:relative;\n\t\t}\n\t\t.${n}:hover{\n\t\t\t${I}\n\t\t\t${j}\n\t\t\t${K}\n\t\t\t${te}\n\t\t}\n\t\t.${n}::before{\n\t\t\tcontent: "";\n\t\t\tposition:absolute;\n\t\t\ttop: 0;\n\t\t\tleft: 0;\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tz-index:-1;\n\t\t\t${h?`\n\t\t\t${V}\n\t\t\t`:""}\n\t\t}\n\t`,ie=`\n\t\t.${n}{\n\t\t\t${C}\n\t\t\t${M}\n\t\t\t${x}\n\t\t\t${P}\n\t\t\t${_}\n\t\t\t${F}\n\t\t\t${X}\n\t\t}\n\t\t.${n}:hover{\n\t\t\t${L}\n\t\t\t${q}\n\t\t\t${Z}\n\t\t }\n\t\t .${n}::before{\n\t\t\t${h?`\n\t\t\t${H}\t\t\t\n\t\t\t`:""}\n\t\t}\n\t`,oe=`\n\t\t.${n}{\n\t\t\t${E}\n\t\t\t${T}\n\t\t\t${O}\n\t\t\t${R}\n\t\t\t${B}\n\t\t\t${Q}\n\t\t\t${Y}\n\t\t}\n\t\t.${n}:hover{\n\t\t\t${N}\n\t\t\t${U}\n\t\t\t${J}\n\t\t }\n\t\t .${n}::before{\n\t\t\t${h?`\t\t\t\n\t\t\t${W}\n\t\t\t`:""}\n\t\t}\n\t`,re=Ly(((e="",t)=>e.replace(new RegExp("{{FFBID}}","g"),"."+t))(w,n));return{wrapperStylesDesk:ne,wrapperStylesTab:ie,wrapperStylesMob:oe,blockWriteCss:re}}({attributes:e,setAttributes:t}),{rangeDeviceDesk:we,rangeDeviceTab:ke,rangeDeviceMob:xe}=$y({controlValue:o,property:"width"}),{deskTypography:Oe,tabTypography:Se,mobTypography:Ce}=Iy({controlValue:l}),{deskDimension:Ee,tabDimension:Ae,mobDimension:Me}=By({controlValue:c,property:"margin",important:!0}),{deskTypography:Te,tabTypography:De,mobTypography:Pe}=Iy({controlValue:h}),{deskDimension:Re,tabDimension:$e,mobDimension:_e}=By({controlValue:d,property:"padding",important:!0}),{deskDimension:Be,tabDimension:Ie,mobDimension:Le}=By({controlValue:p,property:"margin",important:!0}),{deskDimension:Ne,tabDimension:Ve,mobDimension:He}=By({controlValue:m,property:"border-width",important:!0}),{deskDimension:We,tabDimension:ze,mobDimension:Fe}=By({controlValue:g,property:"border-radius",important:!0}),{deskDimension:Qe,tabDimension:je,mobDimension:qe}=By({controlValue:b,property:"border-width",important:!0}),{deskDimension:Ue,tabDimension:Ge,mobDimension:Xe}=By({controlValue:v,property:"border-radius",important:!0}),{rangeDeviceDesk:Ye,rangeDeviceTab:Ke,rangeDeviceMob:Ze}=$y({controlValue:y,property:"width"}),{rangeDeviceDesk:Je,rangeDeviceTab:et,rangeDeviceMob:tt}=$y({controlValue:w,property:"height"}),{rangeDeviceDesk:nt,rangeDeviceTab:it,rangeDeviceMob:ot}=$y({controlValue:k,property:"width"}),{rangeDeviceDesk:rt,rangeDeviceTab:st,rangeDeviceMob:lt}=$y({controlValue:x,property:"height"}),{deskTypography:at,tabTypography:ct,mobTypography:ht}=Iy({controlValue:R}),{rangeDeviceDesk:ut,rangeDeviceTab:ft,rangeDeviceMob:dt}=$y({controlValue:O,property:"width"}),{rangeDeviceDesk:pt,rangeDeviceTab:mt,rangeDeviceMob:gt}=$y({controlValue:O,property:"height"}),{rangeDeviceDesk:bt,rangeDeviceTab:vt,rangeDeviceMob:yt}=$y({controlValue:S,property:"gap"}),{rangeDeviceDesk:wt,rangeDeviceTab:kt,rangeDeviceMob:xt}=$y({controlValue:C,property:"margin-bottom"}),{rangeDeviceDesk:Ot,rangeDeviceTab:St,rangeDeviceMob:Ct}=$y({controlValue:T,property:"border-width"}),{rangeDeviceDesk:Et,rangeDeviceTab:At,rangeDeviceMob:Mt}=$y({controlValue:P,property:"border-radius"}),{deskDimension:Tt,tabDimension:Dt,mobDimension:Pt}=By({controlValue:B,property:"margin",important:!0}),{deskDimension:Rt,tabDimension:$t,mobDimension:_t}=By({controlValue:I,property:"padding",important:!0}),{deskTypography:Bt,tabTypography:It,mobTypography:Lt}=Iy({controlValue:L}),{deskTypography:Nt,tabTypography:Vt,mobTypography:Ht}=Iy({controlValue:H}),{deskTypography:Wt,tabTypography:zt,mobTypography:Ft}=Iy({controlValue:Q}),{deskTypography:Qt,tabTypography:jt,mobTypography:qt}=Iy({controlValue:U}),{deskDimension:Ut,tabDimension:Gt,mobDimension:Xt}=By({controlValue:te,property:"margin",important:!0}),{deskDimension:Yt,tabDimension:Kt,mobDimension:Zt}=By({controlValue:ee,property:"padding",important:!0}),{rangeDeviceDesk:Jt,rangeDeviceTab:en,rangeDeviceMob:tn}=$y({controlValue:Z,property:"width"}),{rangeDeviceDesk:nn,rangeDeviceTab:on,rangeDeviceMob:rn}=$y({controlValue:J,property:"height"}),{deskDimension:sn,tabDimension:ln,mobDimension:an}=By({controlValue:ne,property:"border-width",important:!0}),{deskDimension:cn,tabDimension:hn,mobDimension:un}=By({controlValue:oe,property:"border-width",important:!0}),{deskDimension:fn,tabDimension:dn,mobDimension:pn}=By({controlValue:ie,property:"border-radius",important:!0}),{deskDimension:mn,tabDimension:gn,mobDimension:bn}=By({controlValue:re,property:"border-radius",important:!0}),{boxshadowStyles:vn}=Ry({controlValue:se}),{boxshadowStyles:yn}=Ry({controlValue:le}),{deskTypography:wn,tabTypography:kn,mobTypography:xn}=Iy({controlValue:ae}),{deskTypography:On,tabTypography:Sn,mobTypography:Cn}=Iy({controlValue:fe}),En=Ly(`\n\t.${n} .ffblock-fluent-form-wrapper{\n\t\t${we}\n\t\tmax-width:100%;\n\t}\n\t${"center"===r.lg?`\n\t.${n} .ffblock-fluent-form-wrapper{margin:0 auto;}`:""}\n\t${"right"===r.lg?`\n\t.${n} .ffblock-fluent-form-wrapper{margin:0 0 0 auto;}`:""}\n\t\n\t${Oe||a||Ee?`\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-group label{\n\t\t\t\t${Oe}\n\t\t\t\t${a?`color:${a};`:""}\n\t\t\t\t${Ee}\n\t\t\t}\n\t`:""}\n\t\n ${Ne||Re||We?`\n\t\t.${n} .ffblock-fluent-form-wrapper input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), \n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-form-control,\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-group textarea,\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-group select{\n\t\t\t${Ne}\n\t\t\t${Re}\n\t\t\t${We}\n\t\t}\n\t`:""}\n\t\n\t${Qe||Ue?`\n\t\t.${n} .ffblock-fluent-form-wrapper input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]):hover, \n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-group textarea:hover,\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-group select:hover{\n\t\t\t${Qe}\n\t\t\t${Ue}\n\t\t}\n\t`:""}\n\t\n\t${f?`\n\t\t.${n} .ffblock-fluent-form-wrapper input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), \n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-group textarea,\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-group select,\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-group .ff-el-input--content .choices[data-type*=select-multiple] .choices__inner{\n\t\t\t${f?`background-color: ${f} !important;`:""}\n\t\t}\n\t`:""}\n\t\n\t${nt||rt?`\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-group textarea{\n\t\t\t${nt}\n\t\t\t${rt}\n\t\t}\n\t`:""}\n\t\n\t${Be?`\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-group{\n\t\t\t${Be}\n\t\t}\n\t`:""}\n\t\n\t${Ye?`\n\t\t.${n} .ffblock-fluent-form-wrapper input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]),\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-group select.ff-el-form-control,\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-group .ff-el-input--content .choices{\n\t\t\t${Ye}\n\t\t}\n\t`:""}\n\t\n\t${Je?`\n\t\t.${n} .ffblock-fluent-form-wrapper input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]),\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-group select.ff-el-form-control{\n\t\t\t${Je}\n\t\t}\n\t`:""}\n\t\n\t${ut||pt||Ot||A||D?`\n\t.${n} .ffblock-fluent-form-wrapper .ff-el-input--content input[type=checkbox],\n\t.${n} .ffblock-fluent-form-wrapper .ff-el-input--content input[type=radio]{\n\t\t${ut}\n\t\t${pt}\n\t\t${Ot}\n\t\t${A?`background-color:${A};`:""}\n\t\t${D?`border-color:${D};`:""}\n\t}\n\t`:""}\n\t\n\t${E?`\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-input--content .ff-el-form-check-label span{\n\t\t\t${E?`color:${E};`:""}\n\t\t}\n\t`:""}\n\n\t${wt?`\t\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-form-check:not(:last-child){\n\t\t\t\t${wt}\n\t\t\t}\n\t`:""}\n\t\n\t${bt?`\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-input--content .ff-el-form-check-label{\n\t\t\t${bt}\n\t\t}\n\t`:""}\n\t\n\t${M?`\n\t\t .${n} .ffblock-fluent-form-wrapper .ff-el-input--content input[type=checkbox]:checked::before{\n\t\t\t${M?`color:${M};`:""}\n\t\t}\n\t`:""}\n\t\n\t${M?`\n\t .${n} .ffblock-fluent-form-wrapper .ff-el-input--content input[type=radio]:checked::before{\n\t\t ${M?`background-color:${M};`:""}\n\t }\n\t`:""}\n\t\n\t${Et?`\n\t .${n} .ffblock-fluent-form-wrapper .ff-el-input--content input[type=checkbox]{\n\t\t ${Et}\n\t }\n\t`:""}\n\t\n ${at||$?`\n\t.${n} .ffblock-fluent-form-wrapper input::-webkit-input-placeholder,\n\t.${n} .ffblock-fluent-form-wrapper textarea::-webkit-input-placeholder,\n\t.${n} .ffblock-fluent-form-wrapper .ff-el-group textarea,\n\t.${n} .ffblock-fluent-form-wrapper .ff-el-group select{\n\t\t${at}\n\t\t${$?`color:${$} !important;`:""}\n\t }\n `:""}\n\t \n ${Tt||Rt||_?`\n\t.${n} .ffblock-fluent-form-wrapper .ff-el-section-break{\n\t ${Tt}\n\t ${Rt}\n\t ${_?`background-color:${_} !important;`:""}\n\t}\n `:""}\n\t \n\t${Bt||N||V?`\n\t .${n} .ffblock-fluent-form-wrapper .ff-el-section-break .ff-el-section-title{\n\t\t${Bt}\n\t\t${N?`color:${N} !important;`:""}\n\t\t${V?`background-color:${V} !important;`:""}\n\t }\n\t `:""}\n\t \n\t${Nt||W||z?`\n\t\t .${n} .ffblock-fluent-form-wrapper .ff-el-section-break .ff-section_break_desk{\n\t\t\t${Nt}\n\t\t\t${W?`color:${W} !important;`:""}\n\t\t\t${z?`background-color:${z} !important;`:""}\n\t\t }\n\t `:""}\n\t \n\t ${F?`\n\t .${n} .ffblock-fluent-form-wrapper .ff-el-section-break hr{\n\t\t${F?`border-color:${F} !important;`:""}\n\t }\n\t `:""}\n\t \n\t${Wt||j||q?`\n\t\t .${n} .ffblock-fluent-form-wrapper .ff-custom_html > *{\n\t\t\t${Wt}\n\t\t\t${j?`color:${j} !important;`:""}\n\t\t\t${q?`background-color:${q} !important;`:""}\n\t\t }\n\t `:""}\n\t \n\t ${Qt||Ut||Yt||Jt||nn||sn||fn||vn||G||X?`\n\t\t .${n} .ff_submit_btn_wrapper button.ff-btn-submit{\n\t\t\t${Qt}\n\t\t\t${Ut}\n\t\t\t${Yt}\n\t\t\t${Jt}\n\t\t\t${nn}\n\t\t\t${sn}\n\t\t\t${fn}\n\t\t\t${vn}\n\t\t\t${G?`color:${G} !important;`:""}\n\t\t\t${X?`background-color:${X} !important;`:""}\n\t\t }\n\t `:""}\n\t \n\t ${cn||mn||yn||Y||K?`\n\t .${n} .ff_submit_btn_wrapper button.ff-btn-submit:hover{\n\t\t${cn}\n\t\t${mn}\n\t\t${yn}\n\t\t${Y?`color:${Y} !important;`:""}\n\t\t${K?`background-color:${K} !important;`:""}\n\t }\n\t `:""}\n\t \n\t ${wn||ce||he||ue?`\n\t\t .${n} .ffblock-fluent-form-wrapper .ff-message-success{\n\t\t\t${wn}\n\t\t\t${ce?`color:${ce} !important;`:""}\n\t\t\t${he?`background-color:${he} !important;`:""}\n\t\t\t${ue?`border-color:${ue} !important;`:""}\n\t\t }\n\t `:""}\n\t \n\t ${On||de||pe||me?`\n\t\t .${n} .ffblock-fluent-form-wrapper .error.text-danger{\n\t\t\t${On}\n\t\t\t${de?`color:${de} !important;`:""}\n\t\t\t${pe?`background-color:${pe} !important;`:""}\n\t\t\t${me?`border-color:${me} !important;`:""}\n\t\t }\n\t `:""}\n\t \n\t\t${ge}\n\t`),An=Ly(`\n\n\t${"center"===r.md?`\n\t.${n} .ffblock-fluent-form-wrapper{margin:0 auto;}`:""}\n\n\t${"right"===r.md?`\n\t.${n} .ffblock-fluent-form-wrapper{margin:0 0 0 auto;}`:""}\n\t\n\t${ke?`\n\t\t.${n} .ffblock-fluent-form-wrapper{\n\t\t\t${ke}\n\t\t}\n\t`:""}\n\t\n\t${Se||Ae?`\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-group label{\n\t\t\t${Se}\n\t\t\t${Ae}\n\t\t}\n\t`:""}\n\t${Ve||$e||ze?`\n\t.${n} .ffblock-fluent-form-wrapper input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), \n\t.${n} .ffblock-fluent-form-wrapper .ff-el-form-control,\n .${n} .ffblock-fluent-form-wrapper .ff-el-group textarea,\n .${n} .ffblock-fluent-form-wrapper .ff-el-group select{\n\t\t${Ve}\n\t\t${$e}\n\t\t${ze}\n\t}\n\t`:""}\n\t\n\t${je||Ge?`\n\t.${n} .ffblock-fluent-form-wrapper input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]):hover, \n .${n} .ffblock-fluent-form-wrapper .ff-el-group textarea:hover,\n .${n} .ffblock-fluent-form-wrapper .ff-el-group select:hover{\n\t\t${je}\n\t\t${Ge}\n\t}\n\t`:""}\n\t${it||st?`\n\t.${n} .ffblock-fluent-form-wrapper .ff-el-group textarea{\n\t\t${it}\n\t\t${st}\n\t}\n\t`:""}\n\t\n\t${Ie?`\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-group{\n\t\t\t${Ie}\n\t\t}\n\t`:""}\n\t\n\t${Ke?`\n\t\t.${n} .ffblock-fluent-form-wrapper input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]),\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-group select.ff-el-form-control,\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-group .ff-el-input--content .choices{\n\t\t\t${Ke}\n\t\t}\n\t`:""}\n\t\n\t${et?`\t\n\t\t.${n} .ffblock-fluent-form-wrapper input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]),\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-group select.ff-el-form-control{\n\t\t\t${et}\n\t\t}\n\t`:""}\n\t\n\t${ft||mt||St?`\n\t.${n} .ffblock-fluent-form-wrapper .ff-el-input--content input[type=checkbox],\n\t.${n} .ffblock-fluent-form-wrapper .ff-el-input--content input[type=radio]{\n\t\t${ft}\n\t\t${mt}\n\t\t${St}\n\t}\n\t`:""}\n\t\n\t${kt?`\n\t.${n} .ffblock-fluent-form-wrapper .ff-el-form-check:not(:last-child){\n\t\t${kt}\n\t}\n\t`:""}\n\t\n\t${vt?`\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-input--content .ff-el-form-check-label{\n\t\t\t${vt}\n\t\t}\n\t`:""}\n\t\n\t${At?`\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-input--content input[type=checkbox]{\n\t\t\t${At}\n\t\t}\n\t`:""}\n\t\n\t${ct?`\n\t\t.${n} .ffblock-fluent-form-wrapper input::-webkit-input-placeholder,\n\t\t.${n} .ffblock-fluent-form-wrapper textarea::-webkit-input-placeholder,\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-group textarea,\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-group select{\n\t\t\t${ct}\n\t\t }\n\t `:""}\n\t \n\t${Dt||$t?`\n\t .${n} .ffblock-fluent-form-wrapper .ff-el-section-break{\n\t\t${Dt}\n\t\t${$t}\n\t }\n\t `:""}\n\t${It?`\n\t\t .${n} .ffblock-fluent-form-wrapper .ff-el-section-break .ff-el-section-title{\n\t\t\t${It}\n\t\t }\n\t `:""}\n\t \n\t${Vt?`\n\t\t .${n} .ffblock-fluent-form-wrapper .ff-el-section-break .ff-section_break_desk{\n\t\t\t${Vt}\n\t\t }\n `:""}\n\t \n\t${zt?`\n\t\t .${n} .ffblock-fluent-form-wrapper .ff-custom_html > *{\n\t\t\t${zt}\n\t\t }\n\t `:""}\n\t \n\t ${jt||Gt||Kt||en||on||ln||dn?`\n\t .${n} .ff_submit_btn_wrapper button.ff-btn-submit{\n\t\t${jt}\n\t\t${Gt}\n\t\t${Kt}\n\t\t${en}\n\t\t${on}\n\t\t${ln}\n\t\t${dn}\n\t\t${vn}\n\t }\n\t `:""}\n\t \n\t ${hn||gn||yn?`\n\t .${n} .ff_submit_btn_wrapper button.ff-btn-submit:hover{\n\t\t${hn}\n\t\t${gn}\n\t\t${yn}\n\t }\n\t `:""}\n\t \n\t .${n} .ffblock-fluent-form-wrapper .ff-message-success{\n\t\t${kn}\n\t }\n\t .${n} .ffblock-fluent-form-wrapper .error.text-danger{\n\t\t${Sn}\n\t }\n\t\t${be}\n\t`),Mn=Ly(`\n\t${"center"===r.sm?`\n\t.${n} .ffblock-fluent-form-wrapper{margin:0 auto;}`:""}\n\n\t${"right"===r.sm?`\n\t.${n} .ffblock-fluent-form-wrapper{margin:0 0 0 auto;}`:""}\n\n\t.${n} .ffblock-fluent-form-wrapper{\n\t\t${xe}\n\t}\n\t\n\t${Ce||Me?`\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-group label{\n\t\t\t${Ce}\n\t\t\t${Me}\n\t\t}\n\t`:""}\n\t\n${He||_e||Fe?`\n\t.${n} .ffblock-fluent-form-wrapper input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]), \n\t.${n} .ffblock-fluent-form-wrapper .ff-el-form-control,\n .${n} .ffblock-fluent-form-wrapper .ff-el-group textarea,\n .${n} .ffblock-fluent-form-wrapper .ff-el-group select{\n\t\t${He}\n\t\t${_e}\n\t\t${Fe}\n\t}\n\t`:""}\n\t${qe||Xe?`\n\t.${n} .ffblock-fluent-form-wrapper input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]):hover, \n .${n} .ffblock-fluent-form-wrapper .ff-el-group textarea:hover,\n .${n} .ffblock-fluent-form-wrapper .ff-el-group select:hover{\n\t\t${qe}\n\t\t${Xe}\n\t}\n\t`:""}\n\t${ot||lt?`\n\t.${n} .ffblock-fluent-form-wrapper .ff-el-group textarea{\n\t\t${ot}\n\t\t${lt}\n\t}\n`:""}\n\n${Le?`\n\t.${n} .ffblock-fluent-form-wrapper .ff-el-group{\n\t\t${Le}\n\t}\n\t`:""}\n\t\n\t${Ze?`\n\t.${n} .ffblock-fluent-form-wrapper input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]),\n\t.${n} .ffblock-fluent-form-wrapper .ff-el-group select.ff-el-form-control,\n\t.${n} .ffblock-fluent-form-wrapper .ff-el-group .ff-el-input--content .choices{\n\t\t${Ze}\n\t}\n\t`:""}\n\t${tt?`\t\n\t.${n} .ffblock-fluent-form-wrapper input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]),\n\t.${n} .ffblock-fluent-form-wrapper .ff-el-group select.ff-el-form-control{\n\t\t${tt}\n\t}\n\t`:""}\n\t\n\t${dt||gt||Ct?`\n\t.${n} .ffblock-fluent-form-wrapper .ff-el-input--content input[type=checkbox],\n\t.${n} .ffblock-fluent-form-wrapper .ff-el-input--content input[type=radio]{\n\t\t${dt}\n\t\t${gt}\n\t\t${Ct}\n\t}\n\t`:""}\n\t\n\t${xt?`\n\t\t.${n} .ffblock-fluent-form-wrapper .ff-el-form-check:not(:last-child){\n\t\t\t${xt}\n\t\t}\n\t`:""}\n\t\n\t${yt?`\n\t.${n} .ffblock-fluent-form-wrapper .ff-el-input--content .ff-el-form-check-label{\n\t\t${yt}\n\t}\n `:""}\n ${Mt?`\n\t.${n} .ffblock-fluent-form-wrapper .ff-el-input--content input[type=checkbox]{\n\t\t${Mt}\n\t}\n\t`:""}\n\t${ht?`\n\t.${n} .ffblock-fluent-form-wrapper input::-webkit-input-placeholder,\n\t.${n} .ffblock-fluent-form-wrapper textarea::-webkit-input-placeholder,\n\t.${n} .ffblock-fluent-form-wrapper .ff-el-group textarea,\n\t.${n} .ffblock-fluent-form-wrapper .ff-el-group select{\n\t\t${ht}\n\t }\n\t `:""}\n\t \n\t${Pt||_t?`\n\t\t .${n} .ffblock-fluent-form-wrapper .ff-el-section-break{\n\t\t\t${Pt}\n\t\t\t${_t}\n\t\t }\n\t `:""}\n\t \n\t${Lt?`\n\t\t .${n} .ffblock-fluent-form-wrapper .ff-el-section-break .ff-el-section-title{\n\t\t\t${Lt}\n\t\t }\n\t`:""}\n\t\n${Ht?`\n\t .${n} .ffblock-fluent-form-wrapper .ff-el-section-break .ff-section_break_desk{\n\t\t${Ht}\n\t }\n\t`:""}\n\t\n${Ft?`\n\t .${n} .ffblock-fluent-form-wrapper .ff-custom_html > *{\n\t\t${Ft}\n\t }\n\t `:""}\n\t ${qt||Xt||Zt||tn||rn||an||pn?`\n\t .${n} .ff_submit_btn_wrapper button.ff-btn-submit{\n\t\t${qt}\n\t\t${Xt}\n\t\t${Zt}\n\t\t${tn}\n\t\t${rn}\n\t\t${an}\n\t\t${pn}\n\t\t${vn}\n\t }\n\t `:""}\n\t \n\t ${un||bn||yn?`\n\t .${n} .ff_submit_btn_wrapper button.ff-btn-submit:hover{\n\t\t${un}\n\t\t${bn}\n\t\t${yn}\n\t }\n\t `:""}\n\t \n\t ${xn?`\n\t .${n} .ffblock-fluent-form-wrapper .ff-message-success{\n\t\t${xn}\n\t }\n\t `:""}\n\t \n\t ${Cn?`\n\t .${n} .ffblock-fluent-form-wrapper .error.text-danger{\n\t\t${Cn}\n\t }\n\t `:""}\n\t \n\t\t${ve}\n\t`);return(0,s.useEffect)((()=>{const e={desktop:En,tablet:An,mobile:Mn,customCss:ye};JSON.stringify(i)!=JSON.stringify(e)&&t({blockCSS:e})}),[e]),`\n\t\t${En}\n\t\t${ye}\n\t\t@media all and (max-width: 1024px) {\n\t\t\t${An}\n\t\t}\n\t\t@media all and (max-width: 767px) {\n\t\t\t${Mn}\n\t\t}\n\t`};(0,a.registerBlockType)(Oy,{icon:{src:U.fluentformLogo,foreground:"#0150ec",background:"#ecf4ff"},edit:function({isSelected:e,attributes:t,setAttributes:n,clientId:o}){const{formId:r,layout:l,labelEnable:a,placeholderEnable:u,errorMessageEnable:f,formName:d}=t;(0,s.useEffect)((()=>{((e,t,n,i)=>{const{blockId:o}=n,r="fluentform-block-"+t.substr(0,13);o?o&&o!==r&&i({blockId:r}):i({blockId:r})})(0,o,t,n)}),[]);const p=((e,t,n="")=>{const{blockId:i,mainWrapShowHide:o}=t;return e({className:`${i} ffblock-block-editor${o?.lg?" ffblock-hide-desktop":""}${o?.md?" ffblock-hide-tablet":""}${o?.sm?" ffblock-hide-mobile":""} ${n?" "+n:""}`})})(S.useBlockProps,t),m=Vy({attributes:t,setAttributes:n}),g=My()(["ffblock-fluent-form-wrapper","ffblock-fluent-form-style-"+l,!a&&"ffblock-fm-hide-label",!u&&"ffblock-fm-hide-placeholder",!f&&"ffblock-fm-hide-error-message","inline_subscription"==d?"ffblock-fluentform-subscription":""]),[b,v]=(0,s.useState)(!1),[y,w]=(0,s.useState)({});return(0,s.useEffect)((()=>{r&&(async()=>{const e=new window.FormData;e.append("action","ffblock_fluentform"),e.append("ffblock_nonce_key",ffbBlockParams.ffblock_nonce_key),e.append("formId",r),e.append("formName",d);try{const t=await Ey()({url:ffbBlockParams.ajaxurl,method:"POST",body:e});t?.success?(v(!0),w({...t?.data})):(v(!1),w({}))}catch(e){console.error(e)}})()}),[r]),"object"==typeof y&&Object.keys(y).length?[e&&(0,i.createElement)(Sy,{attributes:t,setAttributes:n}),(0,i.createElement)("style",null,`${m}`),(0,i.createElement)("div",{...p},(0,i.createElement)("div",{className:g},!ffbBlockParams.is_fluent_form_active&&(0,i.createElement)("p",null,(0,h.__)("To use the features of this block, please install and activate the ","fluentform-block"),(0,i.createElement)("a",{className:"ffb-plugin-link",href:ffbBlockParams.admin_url+"plugin-install.php?s=fluent form&tab=search&type=term",target:"_blank"},(0,h.__)("Fluent Forms","fluentform-block"))),ffbBlockParams.is_fluent_form_active&&r&&(0,i.createElement)("div",{dangerouslySetInnerHTML:Ny(y?.html)}),!r&&(0,i.createElement)("p",null,(0,h.__)("Please Select A Form","fluentform-block"))))]:[e&&(0,i.createElement)(Sy,{attributes:t,setAttributes:n}),b?(0,i.createElement)("p",null,(0,h.__)("No Fluentform found.","fluentform-block")):(0,i.createElement)("div",{className:"ffblock-spinner"},(0,i.createElement)(c.Spinner,null))]},save:()=>null,example:{attributes:{preview:!0}}})},184:(e,t)=>{var n;!function(){"use strict";var i={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var r=typeof n;if("string"===r||"number"===r)e.push(n);else if(Array.isArray(n)){if(n.length){var s=o.apply(null,n);s&&e.push(s)}}else if("object"===r){if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]")){e.push(n.toString());continue}for(var l in n)i.call(n,l)&&n[l]&&e.push(l)}}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},679:(e,t,n)=>{"use strict";var i=n(296),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},r={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},s={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},l={};function a(e){return i.isMemo(e)?s:l[e.$$typeof]||o}l[i.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},l[i.Memo]=s;var c=Object.defineProperty,h=Object.getOwnPropertyNames,u=Object.getOwnPropertySymbols,f=Object.getOwnPropertyDescriptor,d=Object.getPrototypeOf,p=Object.prototype;e.exports=function e(t,n,i){if("string"!=typeof n){if(p){var o=d(n);o&&o!==p&&e(t,o,i)}var s=h(n);u&&(s=s.concat(u(n)));for(var l=a(t),m=a(n),g=0;g<s.length;++g){var b=s[g];if(!(r[b]||i&&i[b]||m&&m[b]||l&&l[b])){var v=f(n,b);try{c(t,b,v)}catch(e){}}}}return t}},103:(e,t)=>{"use strict";var n="function"==typeof Symbol&&Symbol.for,i=n?Symbol.for("react.element"):60103,o=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,s=n?Symbol.for("react.strict_mode"):60108,l=n?Symbol.for("react.profiler"):60114,a=n?Symbol.for("react.provider"):60109,c=n?Symbol.for("react.context"):60110,h=n?Symbol.for("react.async_mode"):60111,u=n?Symbol.for("react.concurrent_mode"):60111,f=n?Symbol.for("react.forward_ref"):60112,d=n?Symbol.for("react.suspense"):60113,p=n?Symbol.for("react.suspense_list"):60120,m=n?Symbol.for("react.memo"):60115,g=n?Symbol.for("react.lazy"):60116,b=n?Symbol.for("react.block"):60121,v=n?Symbol.for("react.fundamental"):60117,y=n?Symbol.for("react.responder"):60118,w=n?Symbol.for("react.scope"):60119;function k(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case i:switch(e=e.type){case h:case u:case r:case l:case s:case d:return e;default:switch(e=e&&e.$$typeof){case c:case f:case g:case m:case a:return e;default:return t}}case o:return t}}}function x(e){return k(e)===u}t.AsyncMode=h,t.ConcurrentMode=u,t.ContextConsumer=c,t.ContextProvider=a,t.Element=i,t.ForwardRef=f,t.Fragment=r,t.Lazy=g,t.Memo=m,t.Portal=o,t.Profiler=l,t.StrictMode=s,t.Suspense=d,t.isAsyncMode=function(e){return x(e)||k(e)===h},t.isConcurrentMode=x,t.isContextConsumer=function(e){return k(e)===c},t.isContextProvider=function(e){return k(e)===a},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===i},t.isForwardRef=function(e){return k(e)===f},t.isFragment=function(e){return k(e)===r},t.isLazy=function(e){return k(e)===g},t.isMemo=function(e){return k(e)===m},t.isPortal=function(e){return k(e)===o},t.isProfiler=function(e){return k(e)===l},t.isStrictMode=function(e){return k(e)===s},t.isSuspense=function(e){return k(e)===d},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===u||e===l||e===s||e===d||e===p||"object"==typeof e&&null!==e&&(e.$$typeof===g||e.$$typeof===m||e.$$typeof===a||e.$$typeof===c||e.$$typeof===f||e.$$typeof===v||e.$$typeof===y||e.$$typeof===w||e.$$typeof===b)},t.typeOf=k},296:(e,t,n)=>{"use strict";e.exports=n(103)},703:(e,t,n)=>{"use strict";var i=n(414);function o(){}function r(){}r.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,r,s){if(s!==i){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:r,resetWarningCache:o};return n.PropTypes=n,n}},697:(e,t,n)=>{e.exports=n(703)()},414:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},251:(e,t,n)=>{"use strict";var i=n(196),o=Symbol.for("react.element"),r=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),s=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,n){var i,a={},c=null,h=null;for(i in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(h=t.ref),t)r.call(t,i)&&!l.hasOwnProperty(i)&&(a[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps)void 0===a[i]&&(a[i]=t[i]);return{$$typeof:o,type:e,key:c,ref:h,props:a,_owner:s.current}}},893:(e,t,n)=>{"use strict";e.exports=n(251)},196:e=>{"use strict";e.exports=window.React}},n={};function i(e){var o=n[e];if(void 0!==o)return o.exports;var r=n[e]={exports:{}};return t[e](r,r.exports,i),r.exports}i.m=t,e=[],i.O=(t,n,o,r)=>{if(!n){var s=1/0;for(h=0;h<e.length;h++){for(var[n,o,r]=e[h],l=!0,a=0;a<n.length;a++)(!1&r||s>=r)&&Object.keys(i.O).every((e=>i.O[e](n[a])))?n.splice(a--,1):(l=!1,r<s&&(s=r));if(l){e.splice(h--,1);var c=o();void 0!==c&&(t=c)}}return t}r=r||0;for(var h=e.length;h>0&&e[h-1][2]>r;h--)e[h]=e[h-1];e[h]=[n,o,r]},i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={826:0,431:0};i.O.j=t=>0===e[t];var t=(t,n)=>{var o,r,[s,l,a]=n,c=0;if(s.some((t=>0!==e[t]))){for(o in l)i.o(l,o)&&(i.m[o]=l[o]);if(a)var h=a(i)}for(t&&t(n);c<s.length;c++)r=s[c],i.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return i.O(h)},n=globalThis.webpackChunkfluentform_block=globalThis.webpackChunkfluentform_block||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var o=i.O(void 0,[431],(()=>i(501)));o=i.O(o)})();