import "./cljs_env.js";
shadow$provide.module$node_modules$$codemirror$highlight$dist$index_cjs=function(global,require,module,exports){function sameArray(a,b){return a.length==b.length&&a.every((x,i)=>x==b[i])}function permute(array){let result=[array];for(let i=0;i<array.length;i++)for(let a of permute(array.slice(0,i).concat(array.slice(i+1))))result.push(a);return result}function getHighlightStyle(state){return state.facet(highlightStyle)||state.facet(fallbackHighlightStyle)}function highlightTreeRange(tree,from,to,
style,span){style=new HighlightBuilder(from,style,span);style.highlightRange(tree.cursor(),from,to,"",0,tree.type);style.flush(to)}Object.defineProperty(exports,"__esModule",{value:!0});var common=require("module$node_modules$$lezer$common$dist$index_cjs"),styleMod=require("module$node_modules$style_mod$dist$style_mod_cjs"),view$jscomp$0=require("module$node_modules$$codemirror$view$dist$index_cjs");global=require("module$node_modules$$codemirror$state$dist$index_cjs");var language=require("module$node_modules$$codemirror$language$dist$index_cjs"),
rangeset=require("module$node_modules$$codemirror$rangeset$dist$index_cjs");let nextTagID=0;class Tag{constructor(set,base,modified){this.set=set;this.base=base;this.modified=modified;this.id=nextTagID++}static define(parent){if(null===parent||void 0===parent?0:parent.base)throw Error("Can not derive from a modified tag");let tag=new Tag([],null,[]);tag.set.push(tag);if(parent)for(let t of parent.set)tag.set.push(t);return tag}static defineModifier(){let mod=new Modifier;return tag=>-1<tag.modified.indexOf(mod)?
tag:Modifier.get(tag.base||tag,tag.modified.concat(mod).sort((a,b)=>a.id-b.id))}}let nextModifierID=0;class Modifier{constructor(){this.instances=[];this.id=nextModifierID++}static get(base,mods){if(!mods.length)return base;var exists=mods[0].instances.find(t=>t.base==base&&sameArray(mods,t.modified));if(exists)return exists;exists=[];let tag=new Tag(exists,base,mods);for(var m of mods)m.instances.push(tag);m=permute(mods);for(let parent of base.set)for(let config of m)exists.push(Modifier.get(parent,
config));return tag}}const ruleNodeProp=new common.NodeProp,highlightStyle=global.Facet.define({combine(stylings){return stylings.length?HighlightStyle.combinedMatch(stylings):null}}),fallbackHighlightStyle=global.Facet.define({combine(values){return values.length?values[0].match:null}});class Rule{constructor(tags,mode,context,next){this.tags=tags;this.mode=mode;this.context=context;this.next=next}sort(other){if(!other||other.depth<this.depth)return this.next=other,this;other.next=this.sort(other.next);
return other}get depth(){return this.context?this.context.length:0}}class HighlightStyle{constructor(spec$jscomp$0,options){function def(spec){let cls=styleMod.StyleModule.newName();(modSpec||(modSpec=Object.create(null)))["."+cls]=spec;return cls}this.map=Object.create(null);let modSpec;this.all="string"==typeof options.all?options.all:options.all?def(options.all):null;for(var style of spec$jscomp$0){spec$jscomp$0=(style.class||def(Object.assign({},style,{tag:null})))+(this.all?" "+this.all:"");
let tags=style.tag;if(Array.isArray(tags))for(let tag of tags)this.map[tag.id]=spec$jscomp$0;else this.map[tags.id]=spec$jscomp$0}this.module=modSpec?new styleMod.StyleModule(modSpec):null;this.scope=options.scope||null;this.match=this.match.bind(this);style=[treeHighlighter];this.module&&style.push(view$jscomp$0.EditorView.styleModule.of(this.module));this.extension=style.concat(null==options.themeType?highlightStyle.of(this):highlightStyle.computeN([view$jscomp$0.EditorView.darkTheme],state=>state.facet(view$jscomp$0.EditorView.darkTheme)==
("dark"==options.themeType)?[this]:[]));this.fallback=style.concat(fallbackHighlightStyle.of(this))}match(tag,scope){if(this.scope&&scope!=this.scope)return null;for(let t of tag.set)if(scope=this.map[t.id],void 0!==scope)return t!=tag&&(this.map[tag.id]=scope),scope;return this.map[tag.id]=this.all}static combinedMatch(styles){if(1==styles.length)return styles[0].match;let cache=styles.some(s=>s.scope)?void 0:Object.create(null);return(tag,scope)=>{var cached=cache&&cache[tag.id];if(void 0!==cached)return cached;
cached=null;for(let style of styles){let value=style.match(tag,scope);value&&(cached=cached?cached+" "+value:value)}cache&&(cache[tag.id]=cached);return cached}}static define(specs,options){return new HighlightStyle(specs,options||{})}static get(state,tag,scope){return(state=getHighlightStyle(state))&&state(tag,scope||common.NodeType.none)}}class TreeHighlighter{constructor(view){this.markCache=Object.create(null);this.tree=language.syntaxTree(view.state);this.decorations=this.buildDeco(view,getHighlightStyle(view.state))}update(update){let tree=
language.syntaxTree(update.state),style=getHighlightStyle(update.state),styleChange=style!=update.startState.facet(highlightStyle);if(tree.length<update.view.viewport.to&&!styleChange&&tree.type==this.tree.type)this.decorations=this.decorations.map(update.changes);else if(tree!=this.tree||update.viewportChanged||styleChange)this.tree=tree,this.decorations=this.buildDeco(update.view,style)}buildDeco(view$1,match){if(!match||!this.tree.length)return view$jscomp$0.Decoration.none;let builder=new rangeset.RangeSetBuilder;
for(let {from:from$jscomp$0,to:to$jscomp$0}of view$1.visibleRanges)highlightTreeRange(this.tree,from$jscomp$0,to$jscomp$0,match,(from,to,style)=>{builder.add(from,to,this.markCache[style]||(this.markCache[style]=view$jscomp$0.Decoration.mark({class:style})))});return builder.finish()}}const treeHighlighter=global.Prec.high(view$jscomp$0.ViewPlugin.fromClass(TreeHighlighter,{decorations:v=>v.decorations})),nodeStack=[""];class HighlightBuilder{constructor(at,style,span){this.at=at;this.style=style;
this.span=span;this.class=""}startSpan(at,cls){cls!=this.class&&(this.flush(at),at>this.at&&(this.at=at),this.class=cls)}flush(to){to>this.at&&this.class&&this.span(this.at,to,this.class)}highlightRange(cursor,from,to,inheritedClass,depth,scope){let {type,from:start,to:end}=cursor;if(!(start>=to||end<=from)){nodeStack[depth]=type.name;type.isTop&&(scope=type);for(var cls=inheritedClass,rule=type.prop(ruleNodeProp),opaque=!1;rule;){var JSCompiler_temp;if(!(JSCompiler_temp=!rule.context))a:if(JSCompiler_temp=
rule.context,JSCompiler_temp.length>depth-1)JSCompiler_temp=!1;else{for(let d=depth-1,i=JSCompiler_temp.length-1;0<=i;i--,d--){var check=JSCompiler_temp[i];if(check&&check!=nodeStack[d]){JSCompiler_temp=!1;break a}}JSCompiler_temp=!0}if(JSCompiler_temp){for(var tag of rule.tags)if(JSCompiler_temp=this.style(tag,scope))cls&&(cls+=" "),cls+=JSCompiler_temp,1==rule.mode?inheritedClass+=(inheritedClass?" ":"")+JSCompiler_temp:0==rule.mode&&(opaque=!0);break}rule=rule.next}this.startSpan(cursor.from,cls);
if(!opaque)if((rule=cursor.tree&&cursor.tree.prop(common.NodeProp.mounted))&&rule.overlay){opaque=cursor.node.enter(rule.overlay[0].from+start,1);tag=cursor.firstChild();for(let i=0,pos=start;;i++){check=(JSCompiler_temp=i<rule.overlay.length?rule.overlay[i]:null)?JSCompiler_temp.from+start:end;let rangeFrom=Math.max(from,pos),rangeTo=Math.min(to,check);if(rangeFrom<rangeTo&&tag)for(;cursor.from<rangeTo&&(this.highlightRange(cursor,rangeFrom,rangeTo,inheritedClass,depth+1,scope),this.startSpan(Math.min(to,
cursor.to),cls),!(cursor.to>=check)&&cursor.nextSibling()););if(!JSCompiler_temp||check>to)break;pos=JSCompiler_temp.to+start;pos>from&&(this.highlightRange(opaque.cursor,Math.max(from,JSCompiler_temp.from+start),Math.min(to,pos),inheritedClass,depth,rule.tree.type),this.startSpan(pos,cls))}tag&&cursor.parent()}else if(cursor.firstChild()){do if(!(cursor.to<=from)){if(cursor.from>=to)break;this.highlightRange(cursor,from,to,inheritedClass,depth+1,scope);this.startSpan(Math.min(to,cursor.to),cls)}while(cursor.nextSibling());
cursor.parent()}}}}require=Tag.define;global=require();module=require();const typeName=require(module),propertyName=require(module),literal=require(),string=require(literal),number=require(literal),content=require(),heading=require(content),keyword=require(),operator=require(),punctuation=require(),bracket=require(punctuation),meta=require();require={comment:global,lineComment:require(global),blockComment:require(global),docComment:require(global),name:module,variableName:require(module),typeName,
tagName:require(typeName),propertyName,attributeName:require(propertyName),className:require(module),labelName:require(module),namespace:require(module),macroName:require(module),literal,string,docString:require(string),character:require(string),attributeValue:require(string),number,integer:require(number),float:require(number),bool:require(literal),regexp:require(literal),escape:require(literal),color:require(literal),url:require(literal),keyword,self:require(keyword),null:require(keyword),atom:require(keyword),
unit:require(keyword),modifier:require(keyword),operatorKeyword:require(keyword),controlKeyword:require(keyword),definitionKeyword:require(keyword),moduleKeyword:require(keyword),operator,derefOperator:require(operator),arithmeticOperator:require(operator),logicOperator:require(operator),bitwiseOperator:require(operator),compareOperator:require(operator),updateOperator:require(operator),definitionOperator:require(operator),typeOperator:require(operator),controlOperator:require(operator),punctuation,
separator:require(punctuation),bracket,angleBracket:require(bracket),squareBracket:require(bracket),paren:require(bracket),brace:require(bracket),content,heading,heading1:require(heading),heading2:require(heading),heading3:require(heading),heading4:require(heading),heading5:require(heading),heading6:require(heading),contentSeparator:require(content),list:require(content),quote:require(content),emphasis:require(content),strong:require(content),link:require(content),monospace:require(content),strikethrough:require(content),
inserted:require(),deleted:require(),changed:require(),invalid:require(),meta,documentMeta:require(meta),annotation:require(meta),processingInstruction:require(meta),definition:Tag.defineModifier(),constant:Tag.defineModifier(),function:Tag.defineModifier(),standard:Tag.defineModifier(),local:Tag.defineModifier(),special:Tag.defineModifier()};global=HighlightStyle.define([{tag:require.link,textDecoration:"underline"},{tag:require.heading,textDecoration:"underline",fontWeight:"bold"},{tag:require.emphasis,
fontStyle:"italic"},{tag:require.strong,fontWeight:"bold"},{tag:require.strikethrough,textDecoration:"line-through"},{tag:require.keyword,color:"#708"},{tag:[require.atom,require.bool,require.url,require.contentSeparator,require.labelName],color:"#219"},{tag:[require.literal,require.inserted],color:"#164"},{tag:[require.string,require.deleted],color:"#a11"},{tag:[require.regexp,require.escape,require.special(require.string)],color:"#e40"},{tag:require.definition(require.variableName),color:"#00f"},
{tag:require.local(require.variableName),color:"#30a"},{tag:[require.typeName,require.namespace],color:"#085"},{tag:require.className,color:"#167"},{tag:[require.special(require.variableName),require.macroName],color:"#256"},{tag:require.definition(require.propertyName),color:"#00c"},{tag:require.comment,color:"#940"},{tag:require.meta,color:"#7a757a"},{tag:require.invalid,color:"#f00"}]);module=HighlightStyle.define([{tag:require.link,class:"cmt-link"},{tag:require.heading,class:"cmt-heading"},{tag:require.emphasis,
class:"cmt-emphasis"},{tag:require.strong,class:"cmt-strong"},{tag:require.keyword,class:"cmt-keyword"},{tag:require.atom,class:"cmt-atom"},{tag:require.bool,class:"cmt-bool"},{tag:require.url,class:"cmt-url"},{tag:require.labelName,class:"cmt-labelName"},{tag:require.inserted,class:"cmt-inserted"},{tag:require.deleted,class:"cmt-deleted"},{tag:require.literal,class:"cmt-literal"},{tag:require.string,class:"cmt-string"},{tag:require.number,class:"cmt-number"},{tag:[require.regexp,require.escape,require.special(require.string)],
class:"cmt-string2"},{tag:require.variableName,class:"cmt-variableName"},{tag:require.local(require.variableName),class:"cmt-variableName cmt-local"},{tag:require.definition(require.variableName),class:"cmt-variableName cmt-definition"},{tag:require.special(require.variableName),class:"cmt-variableName2"},{tag:require.definition(require.propertyName),class:"cmt-propertyName cmt-definition"},{tag:require.typeName,class:"cmt-typeName"},{tag:require.namespace,class:"cmt-namespace"},{tag:require.className,
class:"cmt-className"},{tag:require.macroName,class:"cmt-macroName"},{tag:require.propertyName,class:"cmt-propertyName"},{tag:require.operator,class:"cmt-operator"},{tag:require.comment,class:"cmt-comment"},{tag:require.meta,class:"cmt-meta"},{tag:require.invalid,class:"cmt-invalid"},{tag:require.punctuation,class:"cmt-punctuation"}]);exports.HighlightStyle=HighlightStyle;exports.Tag=Tag;exports.classHighlightStyle=module;exports.defaultHighlightStyle=global;exports.highlightTree=function(tree,getStyle,
putStyle,from=0,to=tree.length){highlightTreeRange(tree,from,to,getStyle,putStyle)};exports.styleTags=function(spec){let byName=Object.create(null);for(let prop in spec){let tags=spec[prop];Array.isArray(tags)||(tags=[tags]);for(let part of prop.split(" "))if(part){var pieces=[];let mode=2;var rest=part;for(var pos=0;;){if("..."==rest&&0<pos&&pos+3==part.length){mode=1;break}rest=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(rest);if(!rest)throw new RangeError("Invalid path: "+part);pieces.push("*"==rest[0]?
null:'"'==rest[0][0]?JSON.parse(rest[0]):rest[0]);pos+=rest[0].length;if(pos==part.length)break;rest=part[pos++];if(pos==part.length&&"!"==rest){mode=0;break}if("/"!=rest)throw new RangeError("Invalid path: "+part);rest=part.slice(pos)}rest=pieces.length-1;pos=pieces[rest];if(!pos)throw new RangeError("Invalid path: "+part);pieces=new Rule(tags,mode,0<rest?pieces.slice(0,rest):null);byName[pos]=pieces.sort(byName[pos])}}return ruleNodeProp.add(byName)};exports.tags=require}
//# sourceMappingURL=module$node_modules$$codemirror$highlight$dist$index_cjs.js.map
