var e;function t(e){return RegExp(`^(?:`+e.join(`|`)+`)$`,`i`)}var n=t(`str.lang.langmatches.datatype.bound.sameterm.isiri.isuri.iri.uri.bnode.count.sum.min.max.avg.sample.group_concat.rand.abs.ceil.floor.round.concat.substr.strlen.replace.ucase.lcase.encode_for_uri.contains.strstarts.strends.strbefore.strafter.year.month.day.hours.minutes.seconds.timezone.tz.now.uuid.struuid.md5.sha1.sha256.sha384.sha512.coalesce.if.strlang.strdt.isnumeric.regex.exists.isblank.isliteral.a.bind`.split(`.`)),r=t(`base.prefix.select.distinct.reduced.construct.describe.ask.from.named.where.order.limit.offset.filter.optional.graph.by.asc.desc.as.having.undef.values.group.minus.in.not.service.silent.using.insert.delete.union.true.false.with.data.copy.to.move.add.create.drop.clear.load.into`.split(`.`)),i=/[*+\-<>=&|\^\/!\?]/,a=`[A-Za-z_\\-0-9]`,o=RegExp(`[A-Za-z]`),s=RegExp(`((`+a+`|\\.)*(`+a+`))?:`);function c(t,a){var c=t.next();if(e=null,c==`$`||c==`?`)return c==`?`&&t.match(/\s/,!1)?`operator`:(t.match(/^[A-Za-z0-9_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][A-Za-z0-9_\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]*/),`variableName.local`);if(c==`<`&&!t.match(/^[\s\u00a0=]/,!1))return t.match(/^[^\s\u00a0>]*>?/),`atom`;if(c==`"`||c==`'`)return a.tokenize=u(c),a.tokenize(t,a);if(/[{}\(\),\.;\[\]]/.test(c))return e=c,`bracket`;if(c==`#`)return t.skipToEnd(),`comment`;if(i.test(c))return`operator`;if(c==`:`)return l(t),`atom`;if(c==`@`)return t.eatWhile(/[a-z\d\-]/i),`meta`;if(o.test(c)&&t.match(s))return l(t),`atom`;t.eatWhile(/[_\w\d]/);var d=t.current();return n.test(d)?`builtin`:r.test(d)?`keyword`:`variable`}function l(e){e.match(/(\.(?=[\w_\-\\%])|[:\w_-]|\\[-\\_~.!$&'()*+,;=/?#@%]|%[a-f\d][a-f\d])+/i)}function u(e){return function(t,n){for(var r=!1,i;(i=t.next())!=null;){if(i==e&&!r){n.tokenize=c;break}r=!r&&i==`\\`}return`string`}}function d(e,t,n){e.context={prev:e.context,indent:e.indent,col:n,type:t}}function f(e){e.indent=e.context.indent,e.context=e.context.prev}var p={name:`sparql`,startState:function(){return{tokenize:c,context:null,indent:0,col:0}},token:function(t,n){if(t.sol()&&(n.context&&n.context.align==null&&(n.context.align=!1),n.indent=t.indentation()),t.eatSpace())return null;var r=n.tokenize(t,n);if(r!=`comment`&&n.context&&n.context.align==null&&n.context.type!=`pattern`&&(n.context.align=!0),e==`(`)d(n,`)`,t.column());else if(e==`[`)d(n,`]`,t.column());else if(e==`{`)d(n,`}`,t.column());else if(/[\]\}\)]/.test(e)){for(;n.context&&n.context.type==`pattern`;)f(n);n.context&&e==n.context.type&&(f(n),e==`}`&&n.context&&n.context.type==`pattern`&&f(n))}else e==`.`&&n.context&&n.context.type==`pattern`?f(n):/atom|string|variable/.test(r)&&n.context&&(/[\}\]]/.test(n.context.type)?d(n,`pattern`,t.column()):n.context.type==`pattern`&&!n.context.align&&(n.context.align=!0,n.context.col=t.column()));return r},indent:function(e,t,n){var r=t&&t.charAt(0),i=e.context;if(/[\]\}]/.test(r))for(;i&&i.type==`pattern`;)i=i.prev;var a=i&&r==i.type;return i?i.type==`pattern`?i.col:i.align?i.col+(a?0:1):i.indent+(a?0:n.unit):0},languageData:{commentTokens:{line:`#`}}};export{p as sparql};