From e493ac3c8ed746dc48eda9ffa45cc293baad52c7 Mon Sep 17 00:00:00 2001 From: Lorenz Buehmann Date: Tue, 29 Nov 2022 08:48:39 +0100 Subject: [PATCH] GH-3026: spatial index per graph and kryo serialization --- .../apache/jena/rdfs/engine/MatchRDFS.java | 106 +++-- .../jena/sparql/expr/ExprUndefFunction.java | 6 +- .../function/scripting/ScriptFunction.java | 3 +- .../org/apache/jena/rdfs/TestInfSPARQL.java | 22 + jena-fuseki2/jena-fuseki-ui/package.json | 4 + jena-fuseki2/jena-fuseki-ui/pom.xml | 2 +- .../jena-fuseki-ui/src/assets/logo.svg | 99 +---- .../src/services/fuseki.service.js | 55 +++ .../src/views/dataset/Query.vue | 14 +- .../jena-fuseki-ui/yasqe.lateral.patch | 336 +++++++++++++++ jena-fuseki2/jena-fuseki-webapp/pom.xml | 6 + jena-geosparql/pom.xml | 81 +++- .../apache/jena/geosparql/InitGeoSPARQL.java | 2 +- .../geosparql/assembler/GeoAssembler.java | 28 +- .../geosparql/assembler/VocabGeoSPARQL.java | 4 + .../configuration/GeoSPARQLConfig.java | 4 + .../configuration/GeoSPARQLOperations.java | 6 + .../topological/GenericPropertyFunction.java | 6 +- .../geosparql/spatial/SearchEnvelope.java | 19 +- .../jena/geosparql/spatial/SpatialIndex.java | 386 ++++++++++++++---- .../spatial/SpatialIndexStorage.java | 101 ----- .../GenericSpatialPropertyFunction.java | 23 +- .../spatial/serde/CustomGeometrySerde.java | 206 ++++++++++ .../serde/CustomSpatialIndexSerde.java | 70 ++++ .../spatial/serde/JtsKryoRegistrator.java | 89 ++++ .../geosparql/spatial/SearchEnvelopeTest.java | 10 +- .../geosparql/spatial/SpatialIndexTest.java | 69 ++++ .../spatial/SpatialIndexTestData.java | 9 + .../cardinal/EastGeomPFTest.java | 22 +- .../cardinal/EastPFTest.java | 15 +- .../cardinal/WestGeomPFTest.java | 15 +- .../cardinal/WestPFTest.java | 15 +- 32 files changed, 1455 insertions(+), 378 deletions(-) create mode 100644 jena-fuseki2/jena-fuseki-ui/yasqe.lateral.patch delete mode 100644 jena-geosparql/src/main/java/org/apache/jena/geosparql/spatial/SpatialIndexStorage.java create mode 100644 jena-geosparql/src/main/java/org/apache/jena/geosparql/spatial/serde/CustomGeometrySerde.java create mode 100644 jena-geosparql/src/main/java/org/apache/jena/geosparql/spatial/serde/CustomSpatialIndexSerde.java create mode 100644 jena-geosparql/src/main/java/org/apache/jena/geosparql/spatial/serde/JtsKryoRegistrator.java create mode 100644 jena-geosparql/src/test/java/org/apache/jena/geosparql/spatial/SpatialIndexTest.java diff --git a/jena-arq/src/main/java/org/apache/jena/rdfs/engine/MatchRDFS.java b/jena-arq/src/main/java/org/apache/jena/rdfs/engine/MatchRDFS.java index cef8c1af9f8..a05c94ac68c 100644 --- a/jena-arq/src/main/java/org/apache/jena/rdfs/engine/MatchRDFS.java +++ b/jena-arq/src/main/java/org/apache/jena/rdfs/engine/MatchRDFS.java @@ -21,6 +21,7 @@ import java.util.*; import java.util.function.Function; import java.util.function.Predicate; +import java.util.stream.Collectors; import java.util.stream.Stream; import org.apache.jena.atlas.lib.InternalErrorException; @@ -206,10 +207,12 @@ private Stream find_ANY_type_T(X type) { Set types = subTypes(type); // [RDFS] Make these streams? - accInstances(tuples, types, type); - accInstancesRange(tuples, types, type); - accInstancesDomain(tuples, types, type); - return tuples.stream(); + return Stream.concat( + Stream.concat( + accInstances(tuples, types, type), + accInstancesRange(tuples, types, type)), + accInstancesDomain(tuples, types, type)) + .distinct(); } private Stream find_ANY_type_ANY() { @@ -360,35 +363,56 @@ private Stream infFilter(Stream input, X subject, X predicate, X object) { return stream; } - private void accInstances(Set tuples, Set types, X requestedType) { - for ( X type : types ) { - Stream stream = sourceFind(ANY, rdfType, type); - stream.forEach(triple -> tuples.add(dstCreate(subject(triple), rdfType, requestedType)) ); - } + private Stream accInstances(Set tuples, Set types, X requestedType) { + return types.stream() + .flatMap(type -> sourceFind(ANY, rdfType, type)) + .map(triple -> dstCreate(subject(triple), rdfType, requestedType)); +// return types.stream() +// .map(type -> sourceFind(ANY, rdfType, type)) +// .reduce(Stream::concat) +// .orElse(Stream.empty()); } - private void accInstancesDomain(Set tuples, Set types, X requestedType) { - for ( X type : types ) { - Set predicates = setup.getPropertiesByDomain(type); - if ( isEmpty(predicates) ) - continue; - predicates.forEach(p -> { - Stream stream = sourceFind(ANY, p, ANY); - stream.forEach(triple -> tuples.add(dstCreate(subject(triple), rdfType, requestedType)) ); - }); - } + private Stream accInstancesDomain(Set tuples, Set types, X requestedType) { + // collect properties for all types once, then get all subjects of triples with those properties + return types.stream() + .map(setup::getPropertiesByDomain) + .flatMap(Set::stream) + .distinct() + .flatMap(p -> sourceFind(ANY, p, ANY)) + .map(triple -> dstCreate(subject(triple), rdfType, requestedType)); +// Stream fullStream = Stream.empty(); +// for (X type : types) { +// Set predicates = setup.getPropertiesByDomain(type); +// if (isEmpty(predicates)) +// continue; +// for (X p : predicates) { +// Stream stream = sourceFind(ANY, p, ANY).map(triple -> dstCreate(subject(triple), rdfType, requestedType)); +// fullStream = Stream.concat(fullStream, stream); +// } +// } +// return fullStream; } - private void accInstancesRange(Set tuples, Set types, X requestedType) { - for ( X type : types ) { - Set predicates = setup.getPropertiesByRange(type); - if ( isEmpty(predicates) ) - continue; - predicates.forEach(p -> { - Stream stream = sourceFind(ANY, p, ANY); - stream.forEach(triple -> tuples.add(dstCreate(object(triple), rdfType, requestedType)) ); - }); - } + private Stream accInstancesRange(Set tuples, Set types, X requestedType) { + // collect properties for all types once, then get all objects of triples with those properties + return types.stream() + .map(setup::getPropertiesByRange) + .flatMap(Set::stream) + .distinct() + .flatMap(p -> sourceFind(ANY, p, ANY)) + .map(triple -> dstCreate(object(triple), rdfType, requestedType)); +// Stream fullStream = Stream.empty(); +// for (X type : types) { +// Set predicates = setup.getPropertiesByRange(type); +// if (isEmpty(predicates)) +// continue; +// for (X p : predicates) { +// Stream stream = sourceFind(ANY, p, ANY).map(triple -> dstCreate(object(triple), rdfType, requestedType)); +// fullStream = Stream.concat(fullStream, stream); +// } +// } +// return fullStream; } private void accTypes(Set types, X subject) { @@ -398,20 +422,24 @@ private void accTypes(Set types, X subject) { private void accTypesDomain(Set types, X X) { Stream stream = sourceFind(X, ANY, ANY); - stream.forEach(triple -> { - X p = predicate(triple); - Set x = setup.getDomain(p); - types.addAll(x); - }); + + stream.map(this::predicate) + .distinct() + .forEach(p -> { + Set x = setup.getDomain(p); + types.addAll(x); + }); } private void accTypesRange(Set types, X X) { Stream stream = sourceFind(ANY, ANY, X); - stream.forEach(triple -> { - X p = predicate(triple); - Set x = setup.getRange(p); - types.addAll(x); - }); + + stream.map(this::predicate) + .distinct() + .forEach(p -> { + Set x = setup.getRange(p); + types.addAll(x); + }); } private Set subTypes(Set types) { diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprUndefFunction.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprUndefFunction.java index 64467d17578..14a6e950496 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprUndefFunction.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/ExprUndefFunction.java @@ -18,13 +18,15 @@ package org.apache.jena.sparql.expr; +import org.apache.jena.query.QueryParseException; + /** Exception for an undefined function. */ -public class ExprUndefFunction extends ExprEvalException +public class ExprUndefFunction extends QueryParseException { private final String fnName; - public ExprUndefFunction(String msg, String fnName) { super(msg) ; this.fnName = fnName;} + public ExprUndefFunction(String msg, String fnName) { super(msg, -1, -1) ; this.fnName = fnName;} public String getFunctionName() { return fnName; diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/function/scripting/ScriptFunction.java b/jena-arq/src/main/java/org/apache/jena/sparql/function/scripting/ScriptFunction.java index f0a82d8fbca..9c624284f37 100644 --- a/jena-arq/src/main/java/org/apache/jena/sparql/function/scripting/ScriptFunction.java +++ b/jena-arq/src/main/java/org/apache/jena/sparql/function/scripting/ScriptFunction.java @@ -37,6 +37,7 @@ import org.apache.jena.atlas.lib.PoolBase; import org.apache.jena.atlas.lib.PoolSync; import org.apache.jena.query.ARQ; +import org.apache.jena.query.QueryParseException; import org.apache.jena.riot.RiotNotFoundException; import org.apache.jena.sparql.expr.*; import org.apache.jena.sparql.function.FunctionBase; @@ -163,7 +164,7 @@ public NodeValue exec(List args) { try { r = engine.invokeFunction(name, params); } catch (ScriptException e) { - throw new ExprEvalException("Failed to evaluate " + lang + "function '" + name + "'", e); + throw new QueryParseException("Failed to evaluate " + lang + "function '" + name + "'", e, -1, -1); } catch (NoSuchMethodException e) { throw new ExprUndefFunction("No such " + lang + " function '" + name + "'", name); } diff --git a/jena-arq/src/test/java/org/apache/jena/rdfs/TestInfSPARQL.java b/jena-arq/src/test/java/org/apache/jena/rdfs/TestInfSPARQL.java index 09a32254d01..4f6c3dd929f 100644 --- a/jena-arq/src/test/java/org/apache/jena/rdfs/TestInfSPARQL.java +++ b/jena-arq/src/test/java/org/apache/jena/rdfs/TestInfSPARQL.java @@ -114,5 +114,27 @@ public class TestInfSPARQL { } } + @Test + public void sparql4() { + Graph vocab = SSE.parseGraph("(graph (:p rdfs:range :R) (:p rdfs:domain :D) )"); + DatasetGraph dsg0 = DatasetGraphFactory.createTxnMem(); + + DatasetGraph dsg = RDFSFactory.datasetRDFS(dsg0, vocab); + dsg.executeWrite(() -> { + dsg.add(quad("(:g1 :x :p :y)")); + }); + + // Named graphs, duplicates. + { + String qs2 = PREFIXES + "SELECT * { GRAPH <" + Quad.unionGraph.getURI() + "> { ?s ?p ?o } }"; + Query query2 = QueryFactory.create(qs2); + + try (QueryExecution qExec = QueryExecutionFactory.create(query2, dsg)) { + ResultSet rs = qExec.execSelect(); + ResultSetFormatter.out(rs); + } + } + } + } diff --git a/jena-fuseki2/jena-fuseki-ui/package.json b/jena-fuseki2/jena-fuseki-ui/package.json index 6fa23c40e15..35a2ccd2bfd 100644 --- a/jena-fuseki2/jena-fuseki-ui/package.json +++ b/jena-fuseki2/jena-fuseki-ui/package.json @@ -9,6 +9,10 @@ "scripts": { "dev": "vite", "serve": "vite preview", + "//": [ + {"prebuild": "pwd"}, + {"prebuild": "patch -R -F0 -ff -p1 < yasqe.lateral.patch >/dev/null || : ; patch -F0 -ff -p1 < yasqe.lateral.patch" } + ], "build": "vite build", "test:unit": "vitest run --pool=threads --environment jsdom", "test:e2e": "run-script-os", diff --git a/jena-fuseki2/jena-fuseki-ui/pom.xml b/jena-fuseki2/jena-fuseki-ui/pom.xml index 3121c1ee43b..9f2acf63a0b 100644 --- a/jena-fuseki2/jena-fuseki-ui/pom.xml +++ b/jena-fuseki2/jena-fuseki-ui/pom.xml @@ -107,7 +107,7 @@ yarn - run build + run build --mode development diff --git a/jena-fuseki2/jena-fuseki-ui/src/assets/logo.svg b/jena-fuseki2/jena-fuseki-ui/src/assets/logo.svg index a08d38f3ee2..275c12f5ef7 100644 --- a/jena-fuseki2/jena-fuseki-ui/src/assets/logo.svg +++ b/jena-fuseki2/jena-fuseki-ui/src/assets/logo.svg @@ -1,90 +1,17 @@ - + + + + + + + + + + + - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - diff --git a/jena-fuseki2/jena-fuseki-ui/src/services/fuseki.service.js b/jena-fuseki2/jena-fuseki-ui/src/services/fuseki.service.js index d98b90ee5b0..ad5aa305b5e 100644 --- a/jena-fuseki2/jena-fuseki-ui/src/services/fuseki.service.js +++ b/jena-fuseki2/jena-fuseki-ui/src/services/fuseki.service.js @@ -22,6 +22,39 @@ import { BUS } from '@/events' const DATASET_SIZE_QUERY_1 = 'select (count(*) as ?count) {?s ?p ?o}' const DATASET_SIZE_QUERY_2 = 'select ?g (count(*) as ?count) {graph ?g {?s ?p ?o}} group by ?g' +const CONF_DATASET_NAME = 'yasgui-config' +const CONF_EXAMPLE_QUERIES_QUERY = `PREFIX conf: +PREFIX rdfs: +PREFIX rdf: +PREFIX sd: +PREFIX list: +JSON { + "text": ?text, + "value": ?value +} WHERE { + ?root sd:endpoint "/@DATASET_NAME@/" . + ?root conf:exampleQueries ?list . + ?list list:index (?idx ?ex) . + ?ex rdfs:label ?text . + ?ex conf:query ?value . +} +ORDER BY ?idx` +const CONF_PREFIXES_QUERY = `PREFIX conf: +PREFIX rdfs: +PREFIX rdf: +PREFIX sd: +PREFIX list: +JSON { + "text": ?text, + "uri": ?uri +} WHERE { + ?root sd:endpoint "/@DATASET_NAME@/" . + ?root conf:prefixes ?list . + ?list list:index (?idx ?ex) . + ?ex rdfs:label ?text . + ?ex conf:uri ?uri . +} +ORDER BY ?idx` class FusekiService { /** @@ -240,6 +273,28 @@ class FusekiService { throw new Error(error.response.data) }) } + + async getYasguiExampleQueries (datasetName) { + return await axios + .get(this.getFusekiUrl(`/${CONF_DATASET_NAME}`), { + params: { + query: CONF_EXAMPLE_QUERIES_QUERY.replaceAll("@DATASET_NAME@", datasetName) + } + }) + } + + async getYasguiPrefixes (datasetName) { + return await axios + .get(this.getFusekiUrl(`/${CONF_DATASET_NAME}`), { + params: { + query: CONF_PREFIXES_QUERY.replaceAll("@DATASET_NAME@", datasetName) + } + }) + } + + getYasguiConfigDsName () { + return CONF_DATASET_NAME + } } export default FusekiService diff --git a/jena-fuseki2/jena-fuseki-ui/src/views/dataset/Query.vue b/jena-fuseki2/jena-fuseki-ui/src/views/dataset/Query.vue index 2d424f54078..bf9863f269d 100644 --- a/jena-fuseki2/jena-fuseki-ui/src/views/dataset/Query.vue +++ b/jena-fuseki2/jena-fuseki-ui/src/views/dataset/Query.vue @@ -332,10 +332,22 @@ export default { datasetUrl: function (val, oldVal) { this.currentDatasetUrl = val }, - currentDatasetUrl: function (val, oldVal) { + currentDatasetUrl: async function (val, oldVal) { if (this.yasqe) { this.yasqe.options.requestConfig.endpoint = this.$fusekiService.getFusekiUrl(val) } + if (this.serverData.datasets.find((ds) => ds['ds.name'] === `/${this.$fusekiService.getYasguiConfigDsName()}`)) { + const [queries_res, prefixes_res] = await Promise.all([ + this.$fusekiService.getYasguiExampleQueries(this.datasetName), + this.$fusekiService.getYasguiPrefixes(this.datasetName) + ]) + if (queries_res.data.length !== 0) { + this.queries.splice(0, Infinity, ...queries_res.data) + } + if (prefixes_res.data.length !== 0) { + this.prefixes.splice(0, Infinity, ...prefixes_res.data) + } + } }, contentTypeSelect: function (val, oldVal) { if (this.yasqe) { diff --git a/jena-fuseki2/jena-fuseki-ui/yasqe.lateral.patch b/jena-fuseki2/jena-fuseki-ui/yasqe.lateral.patch new file mode 100644 index 00000000000..c0f837a7b62 --- /dev/null +++ b/jena-fuseki2/jena-fuseki-ui/yasqe.lateral.patch @@ -0,0 +1,336 @@ +# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0 + +diff --git a/node_modules/@triply/yasqe/grammar/_tokenizer-table.js b/node_modules/@triply/yasqe/grammar/_tokenizer-table.js +index 36c9090db2..26966f2f05 100644 +--- a/node_modules/@triply/yasqe/grammar/_tokenizer-table.js ++++ b/node_modules/@triply/yasqe/grammar/_tokenizer-table.js +@@ -19,6 +19,7 @@ module.exports = { + "]": [], + "{": [], + OPTIONAL: [], ++ LATERAL: [], + MINUS: [], + GRAPH: [], + SERVICE: [], +@@ -36,6 +37,7 @@ module.exports = { + GRAPH: [], + "{": [], + OPTIONAL: [], ++ LATERAL: [], + MINUS: [], + SERVICE: [], + FILTER: [], +@@ -78,6 +80,7 @@ module.exports = { + "]": [], + "{": [], + OPTIONAL: [], ++ LATERAL: [], + MINUS: [], + GRAPH: [], + SERVICE: [], +@@ -94,6 +97,7 @@ module.exports = { + GRAPH: [], + "{": [], + OPTIONAL: [], ++ LATERAL: [], + MINUS: [], + SERVICE: [], + FILTER: [], +@@ -130,6 +134,7 @@ module.exports = { + ".": [], + "{": [], + OPTIONAL: [], ++ LATERAL: [], + MINUS: [], + GRAPH: [], + SERVICE: [], +@@ -141,6 +146,7 @@ module.exports = { + "*[graphPatternNotTriples,?.,?triplesBlock]": { + "{": ["[graphPatternNotTriples,?.,?triplesBlock]", "*[graphPatternNotTriples,?.,?triplesBlock]"], + OPTIONAL: ["[graphPatternNotTriples,?.,?triplesBlock]", "*[graphPatternNotTriples,?.,?triplesBlock]"], ++ LATERAL: ["[graphPatternNotTriples,?.,?triplesBlock]", "*[graphPatternNotTriples,?.,?triplesBlock]"], + MINUS: ["[graphPatternNotTriples,?.,?triplesBlock]", "*[graphPatternNotTriples,?.,?triplesBlock]"], + GRAPH: ["[graphPatternNotTriples,?.,?triplesBlock]", "*[graphPatternNotTriples,?.,?triplesBlock]"], + SERVICE: ["[graphPatternNotTriples,?.,?triplesBlock]", "*[graphPatternNotTriples,?.,?triplesBlock]"], +@@ -907,6 +913,7 @@ module.exports = { + GRAPH: [], + "{": [], + OPTIONAL: [], ++ LATERAL: [], + MINUS: [], + SERVICE: [], + FILTER: [], +@@ -1058,6 +1065,7 @@ module.exports = { + ".": ["[.,?triplesBlock]"], + "{": [], + OPTIONAL: [], ++ LATERAL: [], + MINUS: [], + GRAPH: [], + SERVICE: [], +@@ -1103,6 +1111,7 @@ module.exports = { + "]": [], + "{": [], + OPTIONAL: [], ++ LATERAL: [], + MINUS: [], + GRAPH: [], + SERVICE: [], +@@ -1146,6 +1155,7 @@ module.exports = { + GRAPH: [], + "{": [], + OPTIONAL: [], ++ LATERAL: [], + MINUS: [], + SERVICE: [], + FILTER: [], +@@ -1315,6 +1325,7 @@ module.exports = { + GRAPH: [], + "{": [], + OPTIONAL: [], ++ LATERAL: [], + MINUS: [], + SERVICE: [], + FILTER: [], +@@ -1449,6 +1460,7 @@ module.exports = { + DOUBLE_NEGATIVE: ["triplesBlock"], + "{": [], + OPTIONAL: [], ++ LATERAL: [], + MINUS: [], + GRAPH: [], + SERVICE: [], +@@ -1615,6 +1627,7 @@ module.exports = { + "[graphPatternNotTriples,?.,?triplesBlock]": { + "{": ["graphPatternNotTriples", "?.", "?triplesBlock"], + OPTIONAL: ["graphPatternNotTriples", "?.", "?triplesBlock"], ++ LATERAL: ["graphPatternNotTriples", "?.", "?triplesBlock"], + MINUS: ["graphPatternNotTriples", "?.", "?triplesBlock"], + GRAPH: ["graphPatternNotTriples", "?.", "?triplesBlock"], + SERVICE: ["graphPatternNotTriples", "?.", "?triplesBlock"], +@@ -2714,6 +2727,7 @@ module.exports = { + graphPatternNotTriples: { + "{": ["groupOrUnionGraphPattern"], + OPTIONAL: ["optionalGraphPattern"], ++ LATERAL: ["lateralGraphPattern"], + MINUS: ["minusGraphPattern"], + GRAPH: ["graphGraphPattern"], + SERVICE: ["serviceGraphPattern"], +@@ -2824,6 +2838,7 @@ module.exports = { + groupGraphPatternSub: { + "{": ["?triplesBlock", "*[graphPatternNotTriples,?.,?triplesBlock]"], + OPTIONAL: ["?triplesBlock", "*[graphPatternNotTriples,?.,?triplesBlock]"], ++ LATERAL: ["?triplesBlock", "*[graphPatternNotTriples,?.,?triplesBlock]"], + MINUS: ["?triplesBlock", "*[graphPatternNotTriples,?.,?triplesBlock]"], + GRAPH: ["?triplesBlock", "*[graphPatternNotTriples,?.,?triplesBlock]"], + SERVICE: ["?triplesBlock", "*[graphPatternNotTriples,?.,?triplesBlock]"], +@@ -3300,6 +3315,9 @@ module.exports = { + optionalGraphPattern: { + OPTIONAL: ["OPTIONAL", "groupGraphPattern"] + }, ++ lateralGraphPattern: { ++ LATERAL: ["LATERAL", "groupGraphPattern"] ++ }, + "or([*,expression])": { + "*": ["*"], + "!": ["expression"], +@@ -3542,6 +3560,7 @@ module.exports = { + SELECT: ["subSelect"], + "{": ["groupGraphPatternSub"], + OPTIONAL: ["groupGraphPatternSub"], ++ LATERAL: ["groupGraphPatternSub"], + MINUS: ["groupGraphPatternSub"], + GRAPH: ["groupGraphPatternSub"], + SERVICE: ["groupGraphPatternSub"], +@@ -3874,6 +3893,7 @@ module.exports = { + ".": [], + "{": [], + OPTIONAL: [], ++ LATERAL: [], + MINUS: [], + GRAPH: [], + SERVICE: [], +@@ -4761,7 +4781,7 @@ module.exports = { + } + }, + +- keywords: /^(GROUP_CONCAT|DATATYPE|BASE|PREFIX|SELECT|CONSTRUCT|DESCRIBE|ASK|FROM|NAMED|ORDER|BY|LIMIT|ASC|DESC|OFFSET|DISTINCT|REDUCED|WHERE|GRAPH|OPTIONAL|UNION|FILTER|GROUP|HAVING|AS|VALUES|LOAD|CLEAR|DROP|CREATE|MOVE|COPY|SILENT|INSERT|DELETE|DATA|WITH|TO|USING|NAMED|MINUS|BIND|LANGMATCHES|LANG|BOUND|SAMETERM|ISIRI|ISURI|ISBLANK|ISLITERAL|REGEX|TRUE|FALSE|UNDEF|ADD|DEFAULT|ALL|SERVICE|INTO|IN|NOT|IRI|URI|BNODE|RAND|ABS|CEIL|FLOOR|ROUND|CONCAT|STRLEN|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|SUBSTR|REPLACE|EXISTS|COUNT|SUM|MIN|MAX|AVG|SAMPLE|SEPARATOR|STR)/i, ++ keywords: /^(GROUP_CONCAT|DATATYPE|BASE|PREFIX|SELECT|CONSTRUCT|DESCRIBE|ASK|FROM|NAMED|ORDER|BY|LIMIT|ASC|DESC|OFFSET|DISTINCT|REDUCED|WHERE|GRAPH|OPTIONAL|LATERAL|UNION|FILTER|GROUP|HAVING|AS|VALUES|LOAD|CLEAR|DROP|CREATE|MOVE|COPY|SILENT|INSERT|DELETE|DATA|WITH|TO|USING|NAMED|MINUS|BIND|LANGMATCHES|LANG|BOUND|SAMETERM|ISIRI|ISURI|ISBLANK|ISLITERAL|REGEX|TRUE|FALSE|UNDEF|ADD|DEFAULT|ALL|SERVICE|INTO|IN|NOT|IRI|URI|BNODE|RAND|ABS|CEIL|FLOOR|ROUND|CONCAT|STRLEN|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|SUBSTR|REPLACE|EXISTS|COUNT|SUM|MIN|MAX|AVG|SAMPLE|SEPARATOR|STR)/i, + + punct: /^(\*|a|\.|\{|\}|,|\(|\)|;|\[|\]|\|\||&&|=|!=|!|<=|>=|<|>|\+|-|\/|\^\^|\?|\||\^)/, + +diff --git a/node_modules/@triply/yasqe/grammar/sparqljs-browser-min.js b/node_modules/@triply/yasqe/grammar/sparqljs-browser-min.js +index 56d3073a9b..bf6932f5fa 100644 +--- a/node_modules/@triply/yasqe/grammar/sparqljs-browser-min.js ++++ b/node_modules/@triply/yasqe/grammar/sparqljs-browser-min.js +@@ -16,6 +16,7 @@ module.exports = { + "]": [], + "{": [], + OPTIONAL: [], ++ LATERAL: [], + MINUS: [], + GRAPH: [], + SERVICE: [], +@@ -33,6 +34,7 @@ module.exports = { + GRAPH: [], + "{": [], + OPTIONAL: [], ++ LATERAL: [], + MINUS: [], + SERVICE: [], + FILTER: [], +@@ -75,6 +77,7 @@ module.exports = { + "]": [], + "{": [], + OPTIONAL: [], ++ LATERAL: [], + MINUS: [], + GRAPH: [], + SERVICE: [], +@@ -91,6 +94,7 @@ module.exports = { + GRAPH: [], + "{": [], + OPTIONAL: [], ++ LATERAL: [], + MINUS: [], + SERVICE: [], + FILTER: [], +@@ -127,6 +131,7 @@ module.exports = { + ".": [], + "{": [], + OPTIONAL: [], ++ LATERAL: [], + MINUS: [], + GRAPH: [], + SERVICE: [], +@@ -138,6 +143,7 @@ module.exports = { + "*[graphPatternNotTriples,?.,?triplesBlock]": { + "{": ["[graphPatternNotTriples,?.,?triplesBlock]", "*[graphPatternNotTriples,?.,?triplesBlock]"], + OPTIONAL: ["[graphPatternNotTriples,?.,?triplesBlock]", "*[graphPatternNotTriples,?.,?triplesBlock]"], ++ LATERAL: ["[graphPatternNotTriples,?.,?triplesBlock]", "*[graphPatternNotTriples,?.,?triplesBlock]"], + MINUS: ["[graphPatternNotTriples,?.,?triplesBlock]", "*[graphPatternNotTriples,?.,?triplesBlock]"], + GRAPH: ["[graphPatternNotTriples,?.,?triplesBlock]", "*[graphPatternNotTriples,?.,?triplesBlock]"], + SERVICE: ["[graphPatternNotTriples,?.,?triplesBlock]", "*[graphPatternNotTriples,?.,?triplesBlock]"], +@@ -897,6 +903,7 @@ module.exports = { + GRAPH: [], + "{": [], + OPTIONAL: [], ++ LATERAL: [], + MINUS: [], + SERVICE: [], + FILTER: [], +@@ -1031,6 +1038,7 @@ module.exports = { + ".": ["[.,?triplesBlock]"], + "{": [], + OPTIONAL: [], ++ LATERAL: [], + MINUS: [], + GRAPH: [], + SERVICE: [], +@@ -1063,6 +1071,7 @@ module.exports = { + "]": [], + "{": [], + OPTIONAL: [], ++ LATERAL: [], + MINUS: [], + GRAPH: [], + SERVICE: [], +@@ -1106,6 +1115,7 @@ module.exports = { + GRAPH: [], + "{": [], + OPTIONAL: [], ++ LATERAL: [], + MINUS: [], + SERVICE: [], + FILTER: [], +@@ -1261,6 +1271,7 @@ module.exports = { + GRAPH: [], + "{": [], + OPTIONAL: [], ++ LATERAL: [], + MINUS: [], + SERVICE: [], + FILTER: [], +@@ -1395,6 +1406,7 @@ module.exports = { + DOUBLE_NEGATIVE: ["triplesBlock"], + "{": [], + OPTIONAL: [], ++ LATERAL: [], + MINUS: [], + GRAPH: [], + SERVICE: [], +@@ -1493,6 +1505,7 @@ module.exports = { + "[graphPatternNotTriples,?.,?triplesBlock]": { + "{": ["graphPatternNotTriples", "?.", "?triplesBlock"], + OPTIONAL: ["graphPatternNotTriples", "?.", "?triplesBlock"], ++ LATERAL: ["graphPatternNotTriples", "?.", "?triplesBlock"], + MINUS: ["graphPatternNotTriples", "?.", "?triplesBlock"], + GRAPH: ["graphPatternNotTriples", "?.", "?triplesBlock"], + SERVICE: ["graphPatternNotTriples", "?.", "?triplesBlock"], +@@ -2546,6 +2559,7 @@ module.exports = { + graphPatternNotTriples: { + "{": ["groupOrUnionGraphPattern"], + OPTIONAL: ["optionalGraphPattern"], ++ LATERAL: ["optionalGraphPattern"], + MINUS: ["minusGraphPattern"], + GRAPH: ["graphGraphPattern"], + SERVICE: ["serviceGraphPattern"], +@@ -2652,6 +2666,7 @@ module.exports = { + groupGraphPatternSub: { + "{": ["?triplesBlock", "*[graphPatternNotTriples,?.,?triplesBlock]"], + OPTIONAL: ["?triplesBlock", "*[graphPatternNotTriples,?.,?triplesBlock]"], ++ LATERAL: ["?triplesBlock", "*[graphPatternNotTriples,?.,?triplesBlock]"], + MINUS: ["?triplesBlock", "*[graphPatternNotTriples,?.,?triplesBlock]"], + GRAPH: ["?triplesBlock", "*[graphPatternNotTriples,?.,?triplesBlock]"], + SERVICE: ["?triplesBlock", "*[graphPatternNotTriples,?.,?triplesBlock]"], +@@ -3106,6 +3121,7 @@ module.exports = { + }, + offsetClause: { OFFSET: ["OFFSET", "INTEGER"] }, + optionalGraphPattern: { OPTIONAL: ["OPTIONAL", "groupGraphPattern"] }, ++ lateralGraphPattern: { LATERAL: ["LATERAL", "groupGraphPattern"] }, + "or([*,expression])": { + "*": ["*"], + "!": ["expression"], +@@ -3333,6 +3349,7 @@ module.exports = { + SELECT: ["subSelect"], + "{": ["groupGraphPatternSub"], + OPTIONAL: ["groupGraphPatternSub"], ++ LATERAL: ["groupGraphPatternSub"], + MINUS: ["groupGraphPatternSub"], + GRAPH: ["groupGraphPatternSub"], + SERVICE: ["groupGraphPatternSub"], +@@ -3655,6 +3672,7 @@ module.exports = { + ".": [], + "{": [], + OPTIONAL: [], ++ LATERAL: [], + MINUS: [], + GRAPH: [], + SERVICE: [], +@@ -4522,7 +4540,7 @@ module.exports = { + WHERE: ["?WHERE", "groupGraphPattern"] + } + }, +- keywords: /^(GROUP_CONCAT|DATATYPE|BASE|PREFIX|SELECT|CONSTRUCT|DESCRIBE|ASK|FROM|NAMED|ORDER|BY|LIMIT|ASC|DESC|OFFSET|DISTINCT|REDUCED|WHERE|GRAPH|OPTIONAL|UNION|FILTER|GROUP|HAVING|AS|VALUES|LOAD|CLEAR|DROP|CREATE|MOVE|COPY|SILENT|INSERT|DELETE|DATA|WITH|TO|USING|NAMED|MINUS|BIND|LANGMATCHES|LANG|BOUND|SAMETERM|ISIRI|ISURI|ISBLANK|ISLITERAL|REGEX|TRUE|FALSE|UNDEF|ADD|DEFAULT|ALL|SERVICE|INTO|IN|NOT|IRI|URI|BNODE|RAND|ABS|CEIL|FLOOR|ROUND|CONCAT|STRLEN|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|SUBSTR|REPLACE|EXISTS|COUNT|SUM|MIN|MAX|AVG|SAMPLE|SEPARATOR|STR)/i, ++ keywords: /^(GROUP_CONCAT|DATATYPE|BASE|PREFIX|SELECT|CONSTRUCT|DESCRIBE|ASK|FROM|NAMED|ORDER|BY|LIMIT|ASC|DESC|OFFSET|DISTINCT|REDUCED|WHERE|GRAPH|OPTIONAL|LATERAL|UNION|FILTER|GROUP|HAVING|AS|VALUES|LOAD|CLEAR|DROP|CREATE|MOVE|COPY|SILENT|INSERT|DELETE|DATA|WITH|TO|USING|NAMED|MINUS|BIND|LANGMATCHES|LANG|BOUND|SAMETERM|ISIRI|ISURI|ISBLANK|ISLITERAL|REGEX|TRUE|FALSE|UNDEF|ADD|DEFAULT|ALL|SERVICE|INTO|IN|NOT|IRI|URI|BNODE|RAND|ABS|CEIL|FLOOR|ROUND|CONCAT|STRLEN|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|SUBSTR|REPLACE|EXISTS|COUNT|SUM|MIN|MAX|AVG|SAMPLE|SEPARATOR|STR)/i, + punct: /^(\*|a|\.|\{|\}|,|\(|\)|;|\[|\]|\|\||&&|=|!=|!|<=|>=|<|>|\+|-|\/|\^\^|\?|\||\^)/, + startSymbol: "sparql11", + acceptEmpty: !0 +diff --git a/node_modules/@triply/yasqe/build/yasqe.min.js b/node_modules/@triply/yasqe/build/yasqe.min.js +index 684a565ff1..446177b802 100644 +--- a/node_modules/@triply/yasqe/build/yasqe.min.js ++++ b/node_modules/@triply/yasqe/build/yasqe.min.js +@@ -1,2 +1,2 @@ +-!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Yasqe",[],t):"object"==typeof exports?exports.Yasqe=t():e.Yasqe=t()}(window,(function(){return function(e){var t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(i,n,function(t){return e[t]}.bind(null,n));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="/",r(r.s=82)}([function(e,t,r){"use strict";r.d(t,"a",(function(){return l})),r.d(t,"d",(function(){return u})),r.d(t,"c",(function(){return c})),r.d(t,"f",(function(){return p})),r.d(t,"b",(function(){return d})),r.d(t,"g",(function(){return h})),r.d(t,"e",(function(){return f}));var i=r(4),n=r.n(i),o=r(5),s=r.n(o),a=r(106),l=function(){function e(t){n()(this,e),this.namespace=t}return s()(e,[{key:"set",value:function(e,t,r,i){if(a.enabled&&(this.removeExpiredKeys(),e&&void 0!==t)){t.documentElement&&(t=(new XMLSerializer).serializeToString(t.documentElement));try{a.set(e,{namespace:this.namespace,val:t,exp:r,time:(new Date).getTime()/1e3})}catch(e){if(e instanceof Error){var n=e;if(n.quotaExceeded=function(e){var t=!1;if(e)if(e.code)switch(e.code){case 22:t=!0;break;case 1014:"NS_ERROR_DOM_QUOTA_REACHED"===e.name&&(t=!0)}else-2147024882===e.number&&(t=!0);return t}(e),!n.quotaExceeded||!i)throw n;i(e)}throw e}}}},{key:"remove",value:function(e){a.enabled&&e&&a.remove(e)}},{key:"removeExpiredKeys",value:function(){var e=this;a.enabled&&a.each((function(t,r){t&&t.exp&&(new Date).getTime()/1e3-t.time>t.exp&&e.remove(r)}))}},{key:"removeAll",value:function(){a.enabled}},{key:"removeNamespace",value:function(){var e=this;a.each((function(t,r){t.namespace&&t.namespace===e.namespace&&e.remove(r)}))}},{key:"get",value:function(e){if(a.enabled&&e&&(this.removeExpiredKeys(),e)){var t=a.get(e);if(!t)return;return t.val}}}]),e}();function u(e){if(e&&0==e.trim().indexOf("')}function p(e,t){if(e)return e.classList?e.classList.contains(t):!!e.className.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))}function d(e){if(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i=15&&(p=!1,l=!0);var L=v&&(u||p&&(null==N||N<12.11)),T=r||s&&a>=9;function I(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var S,A=function(e,t){var r=e.className,i=I(t).exec(r);if(i){var n=r.slice(i.index+i[0].length);e.className=r.slice(0,i.index)+(n?i[1]+n:"")}};function C(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function b(e,t){return C(e).appendChild(t)}function O(e,t,r,i){var n=document.createElement(e);if(r&&(n.className=r),i&&(n.style.cssText=i),"string"==typeof t)n.appendChild(document.createTextNode(t));else if(t)for(var o=0;o=t)return s+(t-o);s+=a-o,s+=r-s%r,o=a+1}}E?M=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:s&&(M=function(e){try{e.select()}catch(e){}});var U=function(){this.id=null,this.f=null,this.time=0,this.handler=F(this.onTimeout,this)};function B(e,t){for(var r=0;r=t)return i+Math.min(s,t-n);if(n+=o-i,i=o+1,(n+=r-n%r)>=t)return i}}var z=[""];function K(e){for(;z.length<=e;)z.push(X(z)+" ");return z[e]}function X(e){return e[e.length-1]}function Y(e,t){for(var r=[],i=0;i"€"&&(e.toUpperCase()!=e.toLowerCase()||Z.test(e))}function ee(e,t){return t?!!(t.source.indexOf("\\w")>-1&&J(e))||t.test(e):J(e)}function te(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var re=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function ie(e){return e.charCodeAt(0)>=768&&re.test(e)}function ne(e,t,r){for(;(r<0?t>0:tr?-1:1;;){if(t==r)return t;var n=(t+r)/2,o=i<0?Math.ceil(n):Math.floor(n);if(o==t)return e(o)?t:r;e(o)?r=o:t=o+i}}var se=null;function ae(e,t,r){var i;se=null;for(var n=0;nt)return n;o.to==t&&(o.from!=o.to&&"before"==r?i=n:se=n),o.from==t&&(o.from!=o.to&&"before"!=r?i=n:se=n)}return null!=i?i:se}var le=function(){var e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,t=/[stwN]/,r=/[LRr]/,i=/[Lb1n]/,n=/[1n]/;function o(e,t,r){this.level=e,this.from=t,this.to=r}return function(s,a){var l="ltr"==a?"L":"R";if(0==s.length||"ltr"==a&&!e.test(s))return!1;for(var u,c=s.length,p=[],d=0;d-1&&(i[t]=n.slice(0,o).concat(n.slice(o+1)))}}}function fe(e,t){var r=de(e,t);if(r.length)for(var i=Array.prototype.slice.call(arguments,2),n=0;n0}function ve(e){e.prototype.on=function(e,t){pe(this,e,t)},e.prototype.off=function(e,t){he(this,e,t)}}function xe(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ye(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Ne(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Le(e){xe(e),ye(e)}function Te(e){return e.target||e.srcElement}function Ie(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),v&&e.ctrlKey&&1==t&&(t=3),t}var Se,Ae,Ce=function(){if(s&&a<9)return!1;var e=O("div");return"draggable"in e||"dragDrop"in e}();function be(e){if(null==Se){var t=O("span","​");b(e,O("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Se=t.offsetWidth<=1&&t.offsetHeight>2&&!(s&&a<8))}var r=Se?O("span","​"):O("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function Oe(e){if(null!=Ae)return Ae;var t=b(e,document.createTextNode("AخA")),r=S(t,0,1).getBoundingClientRect(),i=S(t,1,2).getBoundingClientRect();return C(e),!(!r||r.left==r.right)&&(Ae=i.right-r.right<3)}var Re,Pe=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],i=e.length;t<=i;){var n=e.indexOf("\n",t);-1==n&&(n=e.length);var o=e.slice(t,"\r"==e.charAt(n-1)?n-1:n),s=o.indexOf("\r");-1!=s?(r.push(o.slice(0,s)),t+=s+1):(r.push(o),t=n+1)}return r}:function(e){return e.split(/\r\n?|\n/)},_e=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},De="oncopy"in(Re=O("div"))||(Re.setAttribute("oncopy","return;"),"function"==typeof Re.oncopy),we=null,Me={},Fe={};function Ge(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Me[e]=t}function ke(e){if("string"==typeof e&&Fe.hasOwnProperty(e))e=Fe[e];else if(e&&"string"==typeof e.name&&Fe.hasOwnProperty(e.name)){var t=Fe[e.name];"string"==typeof t&&(t={name:t}),(e=Q(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return ke("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return ke("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Ue(e,t){t=ke(t);var r=Me[t.name];if(!r)return Ue(e,"text/plain");var i=r(e,t);if(Be.hasOwnProperty(t.name)){var n=Be[t.name];for(var o in n)n.hasOwnProperty(o)&&(i.hasOwnProperty(o)&&(i["_"+o]=i[o]),i[o]=n[o])}if(i.name=t.name,t.helperType&&(i.helperType=t.helperType),t.modeProps)for(var s in t.modeProps)i[s]=t.modeProps[s];return i}var Be={};function je(e,t){G(t,Be.hasOwnProperty(e)?Be[e]:Be[e]={})}function Ve(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var r={};for(var i in t){var n=t[i];n instanceof Array&&(n=n.concat([])),r[i]=n}return r}function He(e,t){for(var r;e.innerMode&&(r=e.innerMode(t))&&r.mode!=e;)t=r.state,e=r.mode;return r||{mode:e,state:t}}function qe(e,t,r){return!e.startState||e.startState(t,r)}var We=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};function ze(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var i=0;;++i){var n=r.children[i],o=n.chunkSize();if(t=e.first&&tr?et(r,ze(e,r).text.length):function(e,t){var r=e.ch;return null==r||r>t?et(e.line,t):r<0?et(e.line,0):e}(t,ze(e,t.line).text.length)}function lt(e,t){for(var r=[],i=0;i=this.string.length},We.prototype.sol=function(){return this.pos==this.lineStart},We.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},We.prototype.next=function(){if(this.post},We.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},We.prototype.skipToEnd=function(){this.pos=this.string.length},We.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},We.prototype.backUp=function(e){this.pos-=e},We.prototype.column=function(){return this.lastColumnPos0?null:(i&&!1!==t&&(this.pos+=i[0].length),i)}var n=function(e){return r?e.toLowerCase():e};if(n(this.string.substr(this.pos,e.length))==n(e))return!1!==t&&(this.pos+=e.length),!0},We.prototype.current=function(){return this.string.slice(this.start,this.pos)},We.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},We.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},We.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var ut=function(e,t){this.state=e,this.lookAhead=t},ct=function(e,t,r,i){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};function pt(e,t,r,i){var n=[e.state.modeGen],o={};yt(e,t.text,e.doc.mode,r,(function(e,t){return n.push(e,t)}),o,i);for(var s=r.state,a=function(i){r.baseTokens=n;var a=e.state.overlays[i],l=1,u=0;r.state=!0,yt(e,t.text,a.mode,r,(function(e,t){for(var r=l;ue&&n.splice(l,1,e,n[l+1],i),l+=2,u=Math.min(e,i)}if(t)if(a.opaque)n.splice(r,l-r,e,"overlay "+t),l=r+2;else for(;re.options.maxHighlightLength&&Ve(e.doc.mode,i.state),o=pt(e,t,i);n&&(i.state=n),t.stateAfter=i.save(!n),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function ht(e,t,r){var i=e.doc,n=e.display;if(!i.mode.startState)return new ct(i,!0,t);var o=function(e,t,r){for(var i,n,o=e.doc,s=r?-1:t-(e.doc.mode.innerMode?1e3:100),a=t;a>s;--a){if(a<=o.first)return o.first;var l=ze(o,a-1),u=l.stateAfter;if(u&&(!r||a+(u instanceof ut?u.lookAhead:0)<=o.modeFrontier))return a;var c=k(l.text,null,e.options.tabSize);(null==n||i>c)&&(n=a-1,i=c)}return n}(e,t,r),s=o>i.first&&ze(i,o-1).stateAfter,a=s?ct.fromSaved(i,s,o):new ct(i,qe(i.mode),o);return i.iter(o,t,(function(r){ft(e,r.text,a);var i=a.line;r.stateAfter=i==t-1||i%5==0||i>=n.viewFrom&&it.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}ct.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ct.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},ct.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ct.fromSaved=function(e,t,r){return t instanceof ut?new ct(e,Ve(e.mode,t.state),r,t.lookAhead):new ct(e,Ve(e.mode,t),r)},ct.prototype.save=function(e){var t=!1!==e?Ve(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ut(t,this.maxLookAhead):t};var mt=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function vt(e,t,r,i){var n,o,s=e.doc,a=s.mode,l=ze(s,(t=at(s,t)).line),u=ht(e,t.line,r),c=new We(l.text,e.options.tabSize,u);for(i&&(o=[]);(i||c.pose.options.maxHighlightLength?(a=!1,s&&ft(e,t,i,p.pos),p.pos=t.length,l=null):l=xt(gt(r,p,i.state,d),o),d){var h=d[0].name;h&&(l="m-"+(l?h+" "+l:h))}if(!a||c!=l){for(;u=t:o.to>t);(i||(i=[])).push(new Tt(s,o.from,a?null:o.to))}}return i}(r,n,s),l=function(e,t,r){var i;if(e)for(var n=0;n=t:o.to>t)||o.from==t&&"bookmark"==s.type&&(!r||o.marker.insertLeft)){var a=null==o.from||(s.inclusiveLeft?o.from<=t:o.from0&&a)for(var x=0;xt)&&(!r||_t(r,o.marker)<0)&&(r=o.marker)}return r}function Gt(e,t,r,i,n){var o=ze(e,t),s=Lt&&o.markedSpans;if(s)for(var a=0;a=0&&p<=0||c<=0&&p>=0)&&(c<=0&&(l.marker.inclusiveRight&&n.inclusiveLeft?tt(u.to,r)>=0:tt(u.to,r)>0)||c>=0&&(l.marker.inclusiveRight&&n.inclusiveLeft?tt(u.from,i)<=0:tt(u.from,i)<0)))return!0}}}function kt(e){for(var t;t=wt(e);)e=t.find(-1,!0).line;return e}function Ut(e,t){var r=ze(e,t),i=kt(r);return r==i?t:$e(i)}function Bt(e,t){if(t>e.lastLine())return t;var r,i=ze(e,t);if(!jt(e,i))return t;for(;r=Mt(i);)i=r.find(1,!0).line;return $e(i)+1}function jt(e,t){var r=Lt&&t.markedSpans;if(r)for(var i=void 0,n=0;nt.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)}))}var zt=function(e,t,r){this.text=e,Ot(this,t),this.height=r?r(this):1};function Kt(e){e.parent=null,bt(e)}zt.prototype.lineNo=function(){return $e(this)},ve(zt);var Xt={},Yt={};function $t(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Yt:Xt;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Qt(e,t){var r=R("span",null,null,l?"padding-right: .1px":null),i={pre:R("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var n=0;n<=(t.rest?t.rest.length:0);n++){var o=n?t.rest[n-1]:t.line,s=void 0;i.pos=0,i.addToken=Jt,Oe(e.display.measure)&&(s=ue(o,e.doc.direction))&&(i.addToken=er(i.addToken,s)),i.map=[],rr(o,i,dt(e,o,t!=e.display.externalMeasured&&$e(o))),o.styleClasses&&(o.styleClasses.bgClass&&(i.bgClass=w(o.styleClasses.bgClass,i.bgClass||"")),o.styleClasses.textClass&&(i.textClass=w(o.styleClasses.textClass,i.textClass||""))),0==i.map.length&&i.map.push(0,0,i.content.appendChild(be(e.display.measure))),0==n?(t.measure.map=i.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(i.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(l){var a=i.content.lastChild;(/\bcm-tab\b/.test(a.className)||a.querySelector&&a.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return fe(e,"renderLine",e,t.line,i.pre),i.pre.className&&(i.textClass=w(i.pre.className,i.textClass||"")),i}function Zt(e){var t=O("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Jt(e,t,r,i,n,o,l){if(t){var u,c=e.splitSpaces?function(e,t){if(e.length>1&&!/ /.test(e))return e;for(var r=t,i="",n=0;nu&&p.from<=u);d++);if(p.to>=c)return e(r,i,n,o,s,a,l);e(r,i.slice(0,p.to-u),n,o,null,a,l),o=null,i=i.slice(p.to-u),u=p.to}}}function tr(e,t,r,i){var n=!i&&r.widgetNode;n&&e.map.push(e.pos,e.pos+t,n),!i&&e.cm.display.input.needsContentAttribute&&(n||(n=e.content.appendChild(document.createElement("span"))),n.setAttribute("cm-marker",r.id)),n&&(e.cm.display.input.setUneditable(n),e.content.appendChild(n)),e.pos+=t,e.trailingSpace=!1}function rr(e,t,r){var i=e.markedSpans,n=e.text,o=0;if(i)for(var s,a,l,u,c,p,d,h=n.length,f=0,E=1,g="",m=0;;){if(m==f){l=u=c=a="",d=null,p=null,m=1/0;for(var v=[],x=void 0,y=0;yf||L.collapsed&&N.to==f&&N.from==f)){if(null!=N.to&&N.to!=f&&m>N.to&&(m=N.to,u=""),L.className&&(l+=" "+L.className),L.css&&(a=(a?a+";":"")+L.css),L.startStyle&&N.from==f&&(c+=" "+L.startStyle),L.endStyle&&N.to==m&&(x||(x=[])).push(L.endStyle,N.to),L.title&&((d||(d={})).title=L.title),L.attributes)for(var T in L.attributes)(d||(d={}))[T]=L.attributes[T];L.collapsed&&(!p||_t(p.marker,L)<0)&&(p=N)}else N.from>f&&m>N.from&&(m=N.from)}if(x)for(var I=0;I=h)break;for(var A=Math.min(h,m);;){if(g){var C=f+g.length;if(!p){var b=C>A?g.slice(0,A-f):g;t.addToken(t,b,s?s+l:l,c,f+b.length==m?u:"",a,d)}if(C>=A){g=g.slice(A-f),f=A;break}f=C,c=""}g=n.slice(o,o=r[E++]),s=$t(r[E++],t.cm.options)}}else for(var O=1;Or)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Or(e,t,r,i){return _r(e,Pr(e,t),r,i)}function Rr(e,t){if(t>=e.display.viewFrom&&t=r.lineN&&t2&&o.push((l.bottom+u.top)/2-r.top)}}o.push(r.bottom-r.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,r,i){var n,o=Mr(t.map,r,i),l=o.node,u=o.start,c=o.end,p=o.collapse;if(3==l.nodeType){for(var d=0;d<4;d++){for(;u&&ie(t.line.text.charAt(o.coverStart+u));)--u;for(;o.coverStart+c1}(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*i,bottom:t.bottom*i}}(e.display.measure,n))}else{var h;u>0&&(p=i="right"),n=e.options.lineWrapping&&(h=l.getClientRects()).length>1?h["right"==i?h.length-1:0]:l.getBoundingClientRect()}if(s&&a<9&&!u&&(!n||!n.left&&!n.right)){var f=l.parentNode.getClientRects()[0];n=f?{left:f.left,right:f.left+ii(e.display),top:f.top,bottom:f.bottom}:wr}for(var E=n.top-t.rect.top,g=n.bottom-t.rect.top,m=(E+g)/2,v=t.view.measure.heights,x=0;xt)&&(n=(o=l-a)-1,t>=l&&(s="right")),null!=n){if(i=e[u+2],a==l&&r==(i.insertLeft?"left":"right")&&(s=r),"left"==r&&0==n)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)i=e[2+(u-=3)],s="left";if("right"==r&&n==l-a)for(;u=0&&(r=e[n]).left==r.right;n--);return r}function Gr(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t=i.text.length?(l=i.text.length,u="before"):l<=0&&(l=0,u="after"),!a)return s("before"==u?l-1:l,"before"==u);function c(e,t,r){return s(r?e-1:e,1==a[t].level!=r)}var p=ae(a,l,u),d=se,h=c(l,p,"before"==u);return null!=d&&(h.other=c(l,d,"before"!=u)),h}function Kr(e,t){var r=0;t=at(e.doc,t),e.options.lineWrapping||(r=ii(e.display)*t.ch);var i=ze(e.doc,t.line),n=Ht(i)+Lr(e.display);return{left:r,right:r,top:n,bottom:n+i.height}}function Xr(e,t,r,i,n){var o=et(e,t,r);return o.xRel=n,i&&(o.outside=i),o}function Yr(e,t,r){var i=e.doc;if((r+=e.display.viewOffset)<0)return Xr(i.first,0,null,-1,-1);var n=Qe(i,r),o=i.first+i.size-1;if(n>o)return Xr(i.first+i.size-1,ze(i,o).text.length,null,1,1);t<0&&(t=0);for(var s=ze(i,n);;){var a=Jr(e,s,n,t,r),l=Ft(s,a.ch+(a.xRel>0||a.outside>0?1:0));if(!l)return a;var u=l.find(1);if(u.line==n)return u;s=ze(i,n=u.line)}}function $r(e,t,r,i){i-=Vr(t);var n=t.text.length,o=oe((function(t){return _r(e,r,t-1).bottom<=i}),n,0);return{begin:o,end:n=oe((function(t){return _r(e,r,t).top>i}),o,n)}}function Qr(e,t,r,i){return r||(r=Pr(e,t)),$r(e,t,r,Hr(e,t,_r(e,r,i),"line").top)}function Zr(e,t,r,i){return!(e.bottom<=r)&&(e.top>r||(i?e.left:e.right)>t)}function Jr(e,t,r,i,n){n-=Ht(t);var o=Pr(e,t),s=Vr(t),a=0,l=t.text.length,u=!0,c=ue(t,e.doc.direction);if(c){var p=(e.options.lineWrapping?ti:ei)(e,t,r,o,c,i,n);a=(u=1!=p.level)?p.from:p.to-1,l=u?p.to:p.from-1}var d,h,f=null,E=null,g=oe((function(t){var r=_r(e,o,t);return r.top+=s,r.bottom+=s,!!Zr(r,i,n,!1)&&(r.top<=n&&r.left<=i&&(f=t,E=r),!0)}),a,l),m=!1;if(E){var v=i-E.left=y.bottom?1:0}return Xr(r,g=ne(t.text,g,1),h,m,i-d)}function ei(e,t,r,i,n,o,s){var a=oe((function(a){var l=n[a],u=1!=l.level;return Zr(zr(e,et(r,u?l.to:l.from,u?"before":"after"),"line",t,i),o,s,!0)}),0,n.length-1),l=n[a];if(a>0){var u=1!=l.level,c=zr(e,et(r,u?l.from:l.to,u?"after":"before"),"line",t,i);Zr(c,o,s,!0)&&c.top>s&&(l=n[a-1])}return l}function ti(e,t,r,i,n,o,s){var a=$r(e,t,i,s),l=a.begin,u=a.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var c=null,p=null,d=0;d=u||h.to<=l)){var f=_r(e,i,1!=h.level?Math.min(u,h.to)-1:Math.max(l,h.from)).right,E=fE)&&(c=h,p=E)}}return c||(c=n[n.length-1]),c.fromu&&(c={from:c.from,to:u,level:c.level}),c}function ri(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Dr){Dr=O("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Dr.appendChild(document.createTextNode("x")),Dr.appendChild(O("br"));Dr.appendChild(document.createTextNode("x"))}b(e.measure,Dr);var r=Dr.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),C(e.measure),r||1}function ii(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=O("span","xxxxxxxxxx"),r=O("pre",[t],"CodeMirror-line-like");b(e.measure,r);var i=t.getBoundingClientRect(),n=(i.right-i.left)/10;return n>2&&(e.cachedCharWidth=n),n||10}function ni(e){for(var t=e.display,r={},i={},n=t.gutters.clientLeft,o=t.gutters.firstChild,s=0;o;o=o.nextSibling,++s){var a=e.display.gutterSpecs[s].className;r[a]=o.offsetLeft+o.clientLeft+n,i[a]=o.clientWidth}return{fixedPos:oi(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:i,wrapperWidth:t.wrapper.clientWidth}}function oi(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function si(e){var t=ri(e.display),r=e.options.lineWrapping,i=r&&Math.max(5,e.display.scroller.clientWidth/ii(e.display)-3);return function(n){if(jt(e.doc,n))return 0;var o=0;if(n.widgets)for(var s=0;s0&&(l=ze(e.doc,u.line).text).length==u.ch){var c=k(l,l.length,e.options.tabSize)-l.length;u=et(u.line,Math.max(0,Math.round((o-Ir(e.display).left)/ii(e.display))-c))}return u}function ui(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var r=e.display.view,i=0;it)&&(n.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=n.viewTo)Lt&&Ut(e.doc,t)n.viewFrom?di(e):(n.viewFrom+=i,n.viewTo+=i);else if(t<=n.viewFrom&&r>=n.viewTo)di(e);else if(t<=n.viewFrom){var o=hi(e,r,r+i,1);o?(n.view=n.view.slice(o.index),n.viewFrom=o.lineN,n.viewTo+=i):di(e)}else if(r>=n.viewTo){var s=hi(e,t,t,-1);s?(n.view=n.view.slice(0,s.index),n.viewTo=s.lineN):di(e)}else{var a=hi(e,t,t,-1),l=hi(e,r,r+i,1);a&&l?(n.view=n.view.slice(0,a.index).concat(nr(e,a.lineN,l.lineN)).concat(n.view.slice(l.index)),n.viewTo+=i):di(e)}var u=n.externalMeasured;u&&(r=n.lineN&&t=i.viewTo)){var o=i.view[ui(e,t)];if(null!=o.node){var s=o.changes||(o.changes=[]);-1==B(s,r)&&s.push(r)}}}function di(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function hi(e,t,r,i){var n,o=ui(e,t),s=e.display.view;if(!Lt||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var a=e.display.viewFrom,l=0;l0){if(o==s.length-1)return null;n=a+s[o].size-t,o++}else n=a-t;t+=n,r+=n}for(;Ut(e.doc,r)!=r;){if(o==(i<0?0:s.length-1))return null;r+=i*s[o-(i<0?1:0)].size,o+=i}return{index:o,lineN:r}}function fi(e){for(var t=e.display.view,r=0,i=0;i=e.display.viewTo||a.to().linet||t==r&&s.to==t)&&(i(Math.max(s.from,t),Math.min(s.to,r),1==s.level?"rtl":"ltr",o),n=!0)}n||i(t,r,"ltr")}(E,r||0,null==i?d:i,(function(e,t,n,p){var g="ltr"==n,m=h(e,g?"left":"right"),v=h(t-1,g?"right":"left"),x=null==r&&0==e,y=null==i&&t==d,N=0==p,L=!E||p==E.length-1;if(v.top-m.top<=3){var T=(u?y:x)&&L,I=(u?x:y)&&N?a:(g?m:v).left,S=T?l:(g?v:m).right;c(I,m.top,S-I,m.bottom)}else{var A,C,b,O;g?(A=u&&x&&N?a:m.left,C=u?l:f(e,n,"before"),b=u?a:f(t,n,"after"),O=u&&y&&L?l:v.right):(A=u?f(e,n,"before"):a,C=!u&&x&&N?l:m.right,b=!u&&y&&L?a:v.left,O=u?f(t,n,"after"):l),c(A,m.top,C-A,m.bottom),m.bottom0?t.blinker=setInterval((function(){return t.cursorDiv.style.visibility=(r=!r)?"":"hidden"}),e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Ni(e){e.state.focused||(e.display.input.focus(),Ti(e))}function Li(e){e.state.delayingBlurEvent=!0,setTimeout((function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Ii(e))}),100)}function Ti(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(fe(e,"focus",e,t),e.state.focused=!0,D(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),l&&setTimeout((function(){return e.display.input.reset(!0)}),20)),e.display.input.receivedFocus()),yi(e))}function Ii(e,t){e.state.delayingBlurEvent||(e.state.focused&&(fe(e,"blur",e,t),e.state.focused=!1,A(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout((function(){e.state.focused||(e.display.shift=!1)}),150))}function Si(e){for(var t=e.display,r=t.lineDiv.offsetTop,i=0;i.005||d<-.005)&&(Ye(n.line,l),Ai(n.line),n.rest))for(var h=0;he.display.sizerWidth){var f=Math.ceil(u/ii(e.display));f>e.display.maxLineLength&&(e.display.maxLineLength=f,e.display.maxLine=n.line,e.display.maxLineChanged=!0)}}}}function Ai(e){if(e.widgets)for(var t=0;t=s&&(o=Qe(t,Ht(ze(t,l))-e.wrapper.clientHeight),s=l)}return{from:o,to:Math.max(s,o+1)}}function bi(e,t){var r=e.display,i=ri(e.display);t.top<0&&(t.top=0);var n=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:r.scroller.scrollTop,o=Cr(e),s={};t.bottom-t.top>o&&(t.bottom=t.top+o);var a=e.doc.height+Tr(r),l=t.topa-i;if(t.topn+o){var c=Math.min(t.top,(u?a:t.bottom)-o);c!=n&&(s.scrollTop=c)}var p=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft,d=Ar(e)-(e.options.fixedGutter?r.gutters.offsetWidth:0),h=t.right-t.left>d;return h&&(t.right=t.left+d),t.left<10?s.scrollLeft=0:t.leftd+p-3&&(s.scrollLeft=t.right+(h?0:10)-d),s}function Oi(e,t){null!=t&&(_i(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Ri(e){_i(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Pi(e,t,r){null==t&&null==r||_i(e),null!=t&&(e.curOp.scrollLeft=t),null!=r&&(e.curOp.scrollTop=r)}function _i(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Di(e,Kr(e,t.from),Kr(e,t.to),t.margin))}function Di(e,t,r,i){var n=bi(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-i,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+i});Pi(e,n.scrollLeft,n.scrollTop)}function wi(e,t){Math.abs(e.doc.scrollTop-t)<2||(r||ln(e,{top:t}),Mi(e,t,!0),r&&ln(e),rn(e,100))}function Mi(e,t,r){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),(e.display.scroller.scrollTop!=t||r)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Fi(e,t,r,i){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!i||(e.doc.scrollLeft=t,pn(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Gi(e){var t=e.display,r=t.gutters.offsetWidth,i=Math.round(e.doc.height+Tr(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:i,scrollHeight:i+Sr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var ki=function(e,t,r){this.cm=r;var i=this.vert=O("div",[O("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),n=this.horiz=O("div",[O("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=n.tabIndex=-1,e(i),e(n),pe(i,"scroll",(function(){i.clientHeight&&t(i.scrollTop,"vertical")})),pe(n,"scroll",(function(){n.clientWidth&&t(n.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,s&&a<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};ki.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,i=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?i+"px":"0";var n=e.viewHeight-(t?i:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+n)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?i+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?i:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==i&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?i:0,bottom:t?i:0}},ki.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},ki.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},ki.prototype.zeroWidthHack=function(){var e=v&&!h?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new U,this.disableVert=new U},ki.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto",t.set(1e3,(function i(){var n=e.getBoundingClientRect();("vert"==r?document.elementFromPoint(n.right-1,(n.top+n.bottom)/2):document.elementFromPoint((n.right+n.left)/2,n.bottom-1))!=e?e.style.pointerEvents="none":t.set(1e3,i)}))},ki.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Ui=function(){};function Bi(e,t){t||(t=Gi(e));var r=e.display.barWidth,i=e.display.barHeight;ji(e,t);for(var n=0;n<4&&r!=e.display.barWidth||i!=e.display.barHeight;n++)r!=e.display.barWidth&&e.options.lineWrapping&&Si(e),ji(e,Gi(e)),r=e.display.barWidth,i=e.display.barHeight}function ji(e,t){var r=e.display,i=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=i.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=i.bottom)+"px",r.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=i.bottom+"px",r.scrollbarFiller.style.width=i.right+"px"):r.scrollbarFiller.style.display="",i.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=i.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}Ui.prototype.update=function(){return{bottom:0,right:0}},Ui.prototype.setScrollLeft=function(){},Ui.prototype.setScrollTop=function(){},Ui.prototype.clear=function(){};var Vi={native:ki,null:Ui};function Hi(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&A(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Vi[e.options.scrollbarStyle]((function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),pe(t,"mousedown",(function(){e.state.focused&&setTimeout((function(){return e.display.input.focus()}),0)})),t.setAttribute("cm-not-content","true")}),(function(t,r){"horizontal"==r?Fi(e,t):wi(e,t)}),e),e.display.scrollbars.addClass&&D(e.display.wrapper,e.display.scrollbars.addClass)}var qi=0;function Wi(e){var t;e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++qi},t=e.curOp,or?or.ops.push(t):t.ownsGroup=or={ops:[t],delayedCallbacks:[]}}function zi(e){var t=e.curOp;t&&function(e,t){var r=e.ownsGroup;if(r)try{!function(e){var t=e.delayedCallbacks,r=0;do{for(;r=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new on(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Xi(e){e.updatedDisplay=e.mustUpdate&&sn(e.cm,e.update)}function Yi(e){var t=e.cm,r=t.display;e.updatedDisplay&&Si(t),e.barMeasure=Gi(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Or(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Sr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Ar(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function $i(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft(window.innerHeight||document.documentElement.clientHeight)&&(n=!1),null!=n&&!f){var o=O("div","​",null,"position: absolute;\n top: "+(t.top-r.viewOffset-Lr(e.display))+"px;\n height: "+(t.bottom-t.top+Sr(e)+r.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(n),e.display.lineSpace.removeChild(o)}}}(t,function(e,t,r,i){var n;null==i&&(i=0),e.options.lineWrapping||t!=r||(r="before"==(t=t.ch?et(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?et(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var s=!1,a=zr(e,t),l=r&&r!=t?zr(e,r):a,u=bi(e,n={left:Math.min(a.left,l.left),top:Math.min(a.top,l.top)-i,right:Math.max(a.left,l.left),bottom:Math.max(a.bottom,l.bottom)+i}),c=e.doc.scrollTop,p=e.doc.scrollLeft;if(null!=u.scrollTop&&(wi(e,u.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(s=!0)),null!=u.scrollLeft&&(Fi(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-p)>1&&(s=!0)),!s)break}return n}(t,at(i,e.scrollToPos.from),at(i,e.scrollToPos.to),e.scrollToPos.margin));var n=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(n)for(var s=0;s=e.display.viewTo)){var r=+new Date+e.options.workTime,i=ht(e,t.highlightFrontier),n=[];t.iter(i.line,Math.min(t.first+t.size,e.display.viewTo+500),(function(o){if(i.line>=e.display.viewFrom){var s=o.styles,a=o.text.length>e.options.maxHighlightLength?Ve(t.mode,i.state):null,l=pt(e,o,i,!0);a&&(i.state=a),o.styles=l.styles;var u=o.styleClasses,c=l.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var p=!s||s.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),d=0;!p&&dr)return rn(e,e.options.workDelay),!0})),t.highlightFrontier=i.line,t.modeFrontier=Math.max(t.modeFrontier,i.line),n.length&&Zi(e,(function(){for(var t=0;t=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==fi(e))return!1;dn(e)&&(di(e),t.dims=ni(e));var n=i.first+i.size,o=Math.max(t.visible.from-e.options.viewportMargin,i.first),s=Math.min(n,t.visible.to+e.options.viewportMargin);r.viewFroms&&r.viewTo-s<20&&(s=Math.min(n,r.viewTo)),Lt&&(o=Ut(e.doc,o),s=Bt(e.doc,s));var a=o!=r.viewFrom||s!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;!function(e,t,r){var i=e.display;0==i.view.length||t>=i.viewTo||r<=i.viewFrom?(i.view=nr(e,t,r),i.viewFrom=t):(i.viewFrom>t?i.view=nr(e,t,i.viewFrom).concat(i.view):i.viewFromr&&(i.view=i.view.slice(0,ui(e,r)))),i.viewTo=r}(e,o,s),r.viewOffset=Ht(ze(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var u=fi(e);if(!a&&0==u&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var c=function(e){if(e.hasFocus())return null;var t=_();if(!t||!P(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var i=window.getSelection();i.anchorNode&&i.extend&&P(e.display.lineDiv,i.anchorNode)&&(r.anchorNode=i.anchorNode,r.anchorOffset=i.anchorOffset,r.focusNode=i.focusNode,r.focusOffset=i.focusOffset)}return r}(e);return u>4&&(r.lineDiv.style.display="none"),function(e,t,r){var i=e.display,n=e.options.lineNumbers,o=i.lineDiv,s=o.firstChild;function a(t){var r=t.nextSibling;return l&&v&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var u=i.view,c=i.viewFrom,p=0;p-1&&(h=!1),ur(e,d,c,r)),h&&(C(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(Je(e.options,c)))),s=d.node.nextSibling}else{var f=gr(e,d,c,r);o.insertBefore(f,s)}c+=d.size}for(;s;)s=a(s)}(e,r.updateLineNumbers,t.dims),u>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,function(e){if(e&&e.activeElt&&e.activeElt!=_()&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&P(document.body,e.anchorNode)&&P(document.body,e.focusNode))){var t=window.getSelection(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}(c),C(r.cursorDiv),C(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,a&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,rn(e,400)),r.updateLineNumbers=null,!0}function an(e,t){for(var r=t.viewport,i=!0;;i=!1){if(i&&e.options.lineWrapping&&t.oldDisplayWidth!=Ar(e))i&&(t.visible=Ci(e.display,e.doc,r));else if(r&&null!=r.top&&(r={top:Math.min(e.doc.height+Tr(e.display)-Cr(e),r.top)}),t.visible=Ci(e.display,e.doc,r),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!sn(e,t))break;Si(e);var n=Gi(e);Ei(e),Bi(e,n),cn(e,n),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function ln(e,t){var r=new on(e,t);if(sn(e,r)){Si(e),an(e,r);var i=Gi(e);Ei(e),Bi(e,i),cn(e,i),r.finish()}}function un(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function cn(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Sr(e)+"px"}function pn(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var i=oi(t)-t.scroller.scrollLeft+e.doc.scrollLeft,n=t.gutters.offsetWidth,o=i+"px",s=0;sa.clientWidth,c=a.scrollHeight>a.clientHeight;if(n&&u||o&&c){if(o&&v&&l)e:for(var d=t.target,h=s.view;d!=a;d=d.parentNode)for(var f=0;f=0&&tt(e,i.to())<=0)return r}return-1};var Tn=function(e,t){this.anchor=e,this.head=t};function In(e,t,r){var i=e&&e.options.selectionsMayTouch,n=t[r];t.sort((function(e,t){return tt(e.from(),t.from())})),r=B(t,n);for(var o=1;o0:l>=0){var u=ot(a.from(),s.from()),c=nt(a.to(),s.to()),p=a.empty()?s.from()==s.head:a.from()==a.head;o<=r&&--r,t.splice(--o,2,new Tn(p?c:u,p?u:c))}}return new Ln(t,r)}function Sn(e,t){return new Ln([new Tn(e,t||e)],0)}function An(e){return e.text?et(e.from.line+e.text.length-1,X(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Cn(e,t){if(tt(e,t.from)<0)return e;if(tt(e,t.to)<=0)return An(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,i=e.ch;return e.line==t.to.line&&(i+=An(t).ch-t.to.ch),et(r,i)}function bn(e,t){for(var r=[],i=0;i1&&e.remove(a.line+1,f-1),e.insert(a.line+1,m)}ar(e,"change",e,t)}function wn(e,t,r){!function e(i,n,o){if(i.linked)for(var s=0;sa-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=function(e,t){return t?(Un(e.done),X(e.done)):e.done.length&&!X(e.done).ranges?X(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),X(e.done)):void 0}(n,n.lastOp==i)))s=X(o.changes),0==tt(t.from,t.to)&&0==tt(t.from,s.to)?s.to=An(t):o.changes.push(kn(e,t));else{var l=X(n.done);for(l&&l.ranges||Vn(e.sel,n.done),o={changes:[kn(e,t)],generation:n.generation},n.done.push(o);n.done.length>n.undoDepth;)n.done.shift(),n.done[0].ranges||n.done.shift()}n.done.push(r),n.generation=++n.maxGeneration,n.lastModTime=n.lastSelTime=a,n.lastOp=n.lastSelOp=i,n.lastOrigin=n.lastSelOrigin=t.origin,s||fe(e,"historyAdded")}function jn(e,t,r,i){var n=e.history,o=i&&i.origin;r==n.lastSelOp||o&&n.lastSelOrigin==o&&(n.lastModTime==n.lastSelTime&&n.lastOrigin==o||function(e,t,r,i){var n=t.charAt(0);return"*"==n||"+"==n&&r.ranges.length==i.ranges.length&&r.somethingSelected()==i.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,o,X(n.done),t))?n.done[n.done.length-1]=t:Vn(t,n.done),n.lastSelTime=+new Date,n.lastSelOrigin=o,n.lastSelOp=r,i&&!1!==i.clearRedo&&Un(n.undone)}function Vn(e,t){var r=X(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Hn(e,t,r,i){var n=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,i),(function(r){r.markedSpans&&((n||(n=t["spans_"+e.id]={}))[o]=r.markedSpans),++o}))}function qn(e){if(!e)return null;for(var t,r=0;r-1&&(X(a)[p]=u[p],delete u[p])}}}return i}function Kn(e,t,r,i){if(i){var n=e.anchor;if(r){var o=tt(t,n)<0;o!=tt(r,n)<0?(n=t,t=r):o!=tt(t,r)<0&&(t=r)}return new Tn(n,t)}return new Tn(r||t,t)}function Xn(e,t,r,i,n){null==n&&(n=e.cm&&(e.cm.display.shift||e.extend)),Jn(e,new Ln([Kn(e.sel.primary(),t,r,n)],0),i)}function Yn(e,t,r){for(var i=[],n=e.cm&&(e.cm.display.shift||e.extend),o=0;o=t.ch:a.to>t.ch))){if(n&&(fe(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--s;continue}break}if(!l.atomic)continue;if(r){var p=l.find(i<0?1:-1),d=void 0;if((i<0?c:u)&&(p=so(e,p,-i,p&&p.line==t.line?o:null)),p&&p.line==t.line&&(d=tt(p,r))&&(i<0?d<0:d>0))return no(e,p,t,i,n)}var h=l.find(i<0?-1:1);return(i<0?u:c)&&(h=so(e,h,i,h.line==t.line?o:null)),h?no(e,h,t,i,n):null}}return t}function oo(e,t,r,i,n){var o=i||1,s=no(e,t,r,o,n)||!n&&no(e,t,r,o,!0)||no(e,t,r,-o,n)||!n&&no(e,t,r,-o,!0);return s||(e.cantEdit=!0,et(e.first,0))}function so(e,t,r,i){return r<0&&0==t.ch?t.line>e.first?at(e,et(t.line-1)):null:r>0&&t.ch==(i||ze(e,t.line)).text.length?t.line0)){var c=[l,1],p=tt(u.from,a.from),d=tt(u.to,a.to);(p<0||!s.inclusiveLeft&&!p)&&c.push({from:u.from,to:a.from}),(d>0||!s.inclusiveRight&&!d)&&c.push({from:a.to,to:u.to}),n.splice.apply(n,c),l+=c.length-3}}return n}(e,t.from,t.to);if(i)for(var n=i.length-1;n>=0;--n)co(e,{from:i[n].from,to:i[n].to,text:n?[""]:t.text,origin:t.origin});else co(e,t)}}function co(e,t){if(1!=t.text.length||""!=t.text[0]||0!=tt(t.from,t.to)){var r=bn(e,t);Bn(e,t,r,e.cm?e.cm.curOp.id:NaN),fo(e,t,r,At(e,t));var i=[];wn(e,(function(e,r){r||-1!=B(i,e.history)||(vo(e.history,t),i.push(e.history)),fo(e,t,null,At(e,t))}))}}function po(e,t,r){var i=e.cm&&e.cm.state.suppressEdits;if(!i||r){for(var n,o=e.history,s=e.sel,a="undo"==t?o.done:o.undone,l="undo"==t?o.undone:o.done,u=0;u=0;--h){var f=d(h);if(f)return f.v}}}}function ho(e,t){if(0!=t&&(e.first+=t,e.sel=new Ln(Y(e.sel.ranges,(function(e){return new Tn(et(e.anchor.line+t,e.anchor.ch),et(e.head.line+t,e.head.ch))})),e.sel.primIndex),e.cm)){ci(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,i=r.viewFrom;ie.lastLine())){if(t.from.lineo&&(t={from:t.from,to:et(o,ze(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ke(e,t.from,t.to),r||(r=bn(e,t)),e.cm?function(e,t,r){var i=e.doc,n=e.display,o=t.from,s=t.to,a=!1,l=o.line;e.options.lineWrapping||(l=$e(kt(ze(i,o.line))),i.iter(l,s.line+1,(function(e){if(e==n.maxLine)return a=!0,!0}))),i.sel.contains(t.from,t.to)>-1&&ge(e),Dn(i,t,r,si(e)),e.options.lineWrapping||(i.iter(l,o.line+t.text.length,(function(e){var t=qt(e);t>n.maxLineLength&&(n.maxLine=e,n.maxLineLength=t,n.maxLineChanged=!0,a=!1)})),a&&(e.curOp.updateMaxLine=!0)),function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontierr;i--){var n=ze(e,i).stateAfter;if(n&&(!(n instanceof ut)||i+n.lookAhead1||!(this.children[0]instanceof yo))){var a=[];this.collapse(a),this.children=[new yo(a)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var s=n.lines.length%25+25,a=s;a10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var i=0;i0||0==s&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=R("span",[o.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Gt(e,t.line,t,r,o)||t.line!=r.line&&Gt(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Lt=!0}o.addToHistory&&Bn(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var a,l=t.line,u=e.cm;if(e.iter(l,r.line+1,(function(e){u&&o.collapsed&&!u.options.lineWrapping&&kt(e)==u.display.maxLine&&(a=!0),o.collapsed&&l!=t.line&&Ye(e,0),function(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}(e,new Tt(o,l==t.line?t.ch:null,l==r.line?r.ch:null)),++l})),o.collapsed&&e.iter(t.line,r.line+1,(function(t){jt(e,t)&&Ye(t,0)})),o.clearOnEnter&&pe(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(Nt=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++Io,o.atomic=!0),u){if(a&&(u.curOp.updateMaxLine=!0),o.collapsed)ci(u,t.line,r.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var c=t.line;c<=r.line;c++)pi(u,c,"text");o.atomic&&ro(u.doc),ar(u,"markerAdded",u,o)}return o}So.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Wi(e),me(this,"clear")){var r=this.find();r&&ar(this,"clear",r.from,r.to)}for(var i=null,n=null,o=0;oe.display.maxLineLength&&(e.display.maxLine=u,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=i&&e&&this.collapsed&&ci(e,i,n+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&ro(e.doc)),e&&ar(e,"markerCleared",e,this,i,n),t&&zi(e),this.parent&&this.parent.clear()}},So.prototype.find=function(e,t){var r,i;null==e&&"bookmark"==this.type&&(e=1);for(var n=0;n=0;l--)uo(this,i[l]);a?Zn(this,a):this.cm&&Ri(this.cm)})),undo:tn((function(){po(this,"undo")})),redo:tn((function(){po(this,"redo")})),undoSelection:tn((function(){po(this,"undo",!0)})),redoSelection:tn((function(){po(this,"redo",!0)})),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,i=0;i=e.ch)&&t.push(n.marker.parent||n.marker)}return t},findMarks:function(e,t,r){e=at(this,e),t=at(this,t);var i=[],n=e.line;return this.iter(e.line,t.line+1,(function(o){var s=o.markedSpans;if(s)for(var a=0;a=l.to||null==l.from&&n!=e.line||null!=l.from&&n==t.line&&l.from>=t.ch||r&&!r(l.marker)||i.push(l.marker.parent||l.marker)}++n})),i},getAllMarks:function(){var e=[];return this.iter((function(t){var r=t.markedSpans;if(r)for(var i=0;ie)return t=e,!0;e-=o,++r})),at(this,et(r,t))},indexFromPos:function(e){var t=(e=at(this,e)).ch;if(e.linet&&(t=e.from),null!=e.to&&e.to-1)return t.state.draggingText(e),void setTimeout((function(){return t.display.input.focus()}),20);try{var p=e.dataTransfer.getData("Text");if(p){var d;if(t.state.draggingText&&!t.state.draggingText.copy&&(d=t.listSelections()),eo(t.doc,Sn(r,r)),d)for(var h=0;h=0;t--)Eo(e.doc,"",i[t].from,i[t].to,"+delete");Ri(e)}))}function Zo(e,t,r){var i=ne(e.text,t+r,r);return i<0||i>e.text.length?null:i}function Jo(e,t,r){var i=Zo(e,t.ch,r);return null==i?null:new et(t.line,i,r<0?"after":"before")}function es(e,t,r,i,n){if(e){"rtl"==t.doc.direction&&(n=-n);var o=ue(r,t.doc.direction);if(o){var s,a=n<0?X(o):o[0],l=n<0==(1==a.level)?"after":"before";if(a.level>0||"rtl"==t.doc.direction){var u=Pr(t,r);s=n<0?r.text.length-1:0;var c=_r(t,u,s).top;s=oe((function(e){return _r(t,u,e).top==c}),n<0==(1==a.level)?a.from:a.to-1,s),"before"==l&&(s=Zo(r,s,1))}else s=n<0?a.to:a.from;return new et(i,s,l)}}return new et(i,n<0?r.text.length:0,n<0?"before":"after")}Ho.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Ho.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Ho.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Ho.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Ho.default=v?Ho.macDefault:Ho.pcDefault;var ts={selectAll:ao,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),V)},killLine:function(e){return Qo(e,(function(t){if(t.empty()){var r=ze(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line0)n=new et(n.line,n.ch+1),e.replaceRange(o.charAt(n.ch-1)+o.charAt(n.ch-2),et(n.line,n.ch-2),n,"+transpose");else if(n.line>e.doc.first){var s=ze(e.doc,n.line-1).text;s&&(n=new et(n.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+s.charAt(s.length-1),et(n.line-1,s.length-1),n,"+transpose"))}r.push(new Tn(n,n))}e.setSelections(r)}))},newlineAndIndent:function(e){return Zi(e,(function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var i=0;i-1&&(tt((n=u.ranges[n]).from(),t)<0||t.xRel>0)&&(tt(n.to(),t)>0||t.xRel<0)?function(e,t,r,i){var n=e.display,o=!1,u=Ji(e,(function(t){l&&(n.scroller.draggable=!1),e.state.draggingText=!1,he(n.wrapper.ownerDocument,"mouseup",u),he(n.wrapper.ownerDocument,"mousemove",c),he(n.scroller,"dragstart",p),he(n.scroller,"drop",u),o||(xe(t),i.addNew||Xn(e.doc,r,null,null,i.extend),l&&!d||s&&9==a?setTimeout((function(){n.wrapper.ownerDocument.body.focus({preventScroll:!0}),n.input.focus()}),20):n.input.focus())})),c=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},p=function(){return o=!0};l&&(n.scroller.draggable=!0),e.state.draggingText=u,u.copy=!i.moveOnDrag,n.scroller.dragDrop&&n.scroller.dragDrop(),pe(n.wrapper.ownerDocument,"mouseup",u),pe(n.wrapper.ownerDocument,"mousemove",c),pe(n.scroller,"dragstart",p),pe(n.scroller,"drop",u),Li(e),setTimeout((function(){return n.input.focus()}),20)}(e,i,t,o):function(e,t,r,i){var n=e.display,o=e.doc;xe(t);var s,a,l=o.sel,u=l.ranges;if(i.addNew&&!i.extend?(a=o.sel.contains(r),s=a>-1?u[a]:new Tn(r,r)):(s=o.sel.primary(),a=o.sel.primIndex),"rectangle"==i.unit)i.addNew||(s=new Tn(r,r)),r=li(e,t,!0,!0),a=-1;else{var c=ms(e,r,i.unit);s=i.extend?Kn(s,c.anchor,c.head,i.extend):c}i.addNew?-1==a?(a=u.length,Jn(o,In(e,u.concat([s]),a),{scroll:!1,origin:"*mouse"})):u.length>1&&u[a].empty()&&"char"==i.unit&&!i.extend?(Jn(o,In(e,u.slice(0,a).concat(u.slice(a+1)),0),{scroll:!1,origin:"*mouse"}),l=o.sel):$n(o,a,s,H):(a=0,Jn(o,new Ln([s],0),H),l=o.sel);var p=r;function d(t){if(0!=tt(p,t))if(p=t,"rectangle"==i.unit){for(var n=[],u=e.options.tabSize,c=k(ze(o,r.line).text,r.ch,u),d=k(ze(o,t.line).text,t.ch,u),h=Math.min(c,d),f=Math.max(c,d),E=Math.min(r.line,t.line),g=Math.min(e.lastLine(),Math.max(r.line,t.line));E<=g;E++){var m=ze(o,E).text,v=W(m,h,u);h==f?n.push(new Tn(et(E,v),et(E,v))):m.length>v&&n.push(new Tn(et(E,v),et(E,W(m,f,u))))}n.length||n.push(new Tn(r,r)),Jn(o,In(e,l.ranges.slice(0,a).concat(n),a),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var x,y=s,N=ms(e,t,i.unit),L=y.anchor;tt(N.anchor,L)>0?(x=N.head,L=ot(y.from(),N.anchor)):(x=N.anchor,L=nt(y.to(),N.head));var T=l.ranges.slice(0);T[a]=function(e,t){var r=t.anchor,i=t.head,n=ze(e.doc,r.line);if(0==tt(r,i)&&r.sticky==i.sticky)return t;var o=ue(n);if(!o)return t;var s=ae(o,r.ch,r.sticky),a=o[s];if(a.from!=r.ch&&a.to!=r.ch)return t;var l,u=s+(a.from==r.ch==(1!=a.level)?0:1);if(0==u||u==o.length)return t;if(i.line!=r.line)l=(i.line-r.line)*("ltr"==e.doc.direction?1:-1)>0;else{var c=ae(o,i.ch,i.sticky),p=c-s||(i.ch-r.ch)*(1==a.level?-1:1);l=c==u-1||c==u?p<0:p>0}var d=o[u+(l?-1:0)],h=l==(1==d.level),f=h?d.from:d.to,E=h?"after":"before";return r.ch==f&&r.sticky==E?t:new Tn(new et(r.line,f,E),i)}(e,new Tn(at(o,L),x)),Jn(o,In(e,T,a),H)}}var h=n.wrapper.getBoundingClientRect(),f=0;function E(t){e.state.selectingText=!1,f=1/0,t&&(xe(t),n.input.focus()),he(n.wrapper.ownerDocument,"mousemove",g),he(n.wrapper.ownerDocument,"mouseup",m),o.history.lastSelOrigin=null}var g=Ji(e,(function(t){0!==t.buttons&&Ie(t)?function t(r){var s=++f,a=li(e,r,!0,"rectangle"==i.unit);if(a)if(0!=tt(a,p)){e.curOp.focus=_(),d(a);var l=Ci(n,o);(a.line>=l.to||a.lineh.bottom?20:0;u&&setTimeout(Ji(e,(function(){f==s&&(n.scroller.scrollTop+=u,t(r))})),50)}}(t):E(t)})),m=Ji(e,E);e.state.selectingText=m,pe(n.wrapper.ownerDocument,"mousemove",g),pe(n.wrapper.ownerDocument,"mouseup",m)}(e,i,t,o)}(t,i,o,e):Te(e)==r.scroller&&xe(e):2==n?(i&&Xn(t.doc,i),setTimeout((function(){return r.input.focus()}),20)):3==n&&(T?t.display.input.onContextMenu(e):Li(t)))}}function ms(e,t,r){if("char"==r)return new Tn(t,t);if("word"==r)return e.findWordAt(t);if("line"==r)return new Tn(et(t.line,0),at(e.doc,et(t.line+1,0)));var i=r(e,t);return new Tn(i.from,i.to)}function vs(e,t,r,i){var n,o;if(t.touches)n=t.touches[0].clientX,o=t.touches[0].clientY;else try{n=t.clientX,o=t.clientY}catch(e){return!1}if(n>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;i&&xe(t);var s=e.display,a=s.lineDiv.getBoundingClientRect();if(o>a.bottom||!me(e,r))return Ne(t);o-=a.top-s.viewOffset;for(var l=0;l=n)return fe(e,r,e,Qe(e.doc,o),e.display.gutterSpecs[l].className,t),Ne(t)}}function xs(e,t){return vs(e,t,"gutterClick",!0)}function ys(e,t){Nr(e.display,t)||function(e,t){return!!me(e,"gutterContextMenu")&&vs(e,t,"gutterContextMenu",!1)}(e,t)||Ee(e,t,"contextmenu")||T||e.display.input.onContextMenu(t)}function Ns(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Ur(e)}Es.prototype.compare=function(e,t,r){return this.time+400>e&&0==tt(t,this.pos)&&r==this.button};var Ls={toString:function(){return"CodeMirror.Init"}},Ts={},Is={};function Ss(e,t,r){if(!t!=!(r&&r!=Ls)){var i=e.display.dragFunctions,n=t?pe:he;n(e.display.scroller,"dragstart",i.start),n(e.display.scroller,"dragenter",i.enter),n(e.display.scroller,"dragover",i.over),n(e.display.scroller,"dragleave",i.leave),n(e.display.scroller,"drop",i.drop)}}function As(e){e.options.lineWrapping?(D(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(A(e.display.wrapper,"CodeMirror-wrap"),Wt(e)),ai(e),ci(e),Ur(e),setTimeout((function(){return Bi(e)}),100)}function Cs(e,t){var r=this;if(!(this instanceof Cs))return new Cs(e,t);this.options=t=t?G(t):{},G(Ts,t,!1);var i=t.value;"string"==typeof i?i=new Po(i,t.mode,null,t.lineSeparator,t.direction):t.mode&&(i.modeOption=t.mode),this.doc=i;var n=new Cs.inputStyles[t.inputStyle](this),o=this.display=new gn(e,i,n,t);for(var u in o.wrapper.CodeMirror=this,Ns(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Hi(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new U,keySeq:null,specialChars:null},t.autofocus&&!m&&o.input.focus(),s&&a<11&&setTimeout((function(){return r.display.input.reset(!0)}),20),function(e){var t=e.display;pe(t.scroller,"mousedown",Ji(e,gs)),pe(t.scroller,"dblclick",s&&a<11?Ji(e,(function(t){if(!Ee(e,t)){var r=li(e,t);if(r&&!xs(e,t)&&!Nr(e.display,t)){xe(t);var i=e.findWordAt(r);Xn(e.doc,i.anchor,i.head)}}})):function(t){return Ee(e,t)||xe(t)}),pe(t.scroller,"contextmenu",(function(t){return ys(e,t)})),pe(t.input.getField(),"contextmenu",(function(r){t.scroller.contains(r.target)||ys(e,r)}));var r,i={end:0};function n(){t.activeTouch&&(r=setTimeout((function(){return t.activeTouch=null}),1e3),(i=t.activeTouch).end=+new Date)}function o(e,t){if(null==t.left)return!0;var r=t.left-e.left,i=t.top-e.top;return r*r+i*i>400}pe(t.scroller,"touchstart",(function(n){if(!Ee(e,n)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(n)&&!xs(e,n)){t.input.ensurePolled(),clearTimeout(r);var o=+new Date;t.activeTouch={start:o,moved:!1,prev:o-i.end<=300?i:null},1==n.touches.length&&(t.activeTouch.left=n.touches[0].pageX,t.activeTouch.top=n.touches[0].pageY)}})),pe(t.scroller,"touchmove",(function(){t.activeTouch&&(t.activeTouch.moved=!0)})),pe(t.scroller,"touchend",(function(r){var i=t.activeTouch;if(i&&!Nr(t,r)&&null!=i.left&&!i.moved&&new Date-i.start<300){var s,a=e.coordsChar(t.activeTouch,"page");s=!i.prev||o(i,i.prev)?new Tn(a,a):!i.prev.prev||o(i,i.prev.prev)?e.findWordAt(a):new Tn(et(a.line,0),at(e.doc,et(a.line+1,0))),e.setSelection(s.anchor,s.head),e.focus(),xe(r)}n()})),pe(t.scroller,"touchcancel",n),pe(t.scroller,"scroll",(function(){t.scroller.clientHeight&&(wi(e,t.scroller.scrollTop),Fi(e,t.scroller.scrollLeft,!0),fe(e,"scroll",e))})),pe(t.scroller,"mousewheel",(function(t){return Nn(e,t)})),pe(t.scroller,"DOMMouseScroll",(function(t){return Nn(e,t)})),pe(t.wrapper,"scroll",(function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0})),t.dragFunctions={enter:function(t){Ee(e,t)||Le(t)},over:function(t){Ee(e,t)||(function(e,t){var r=li(e,t);if(r){var i=document.createDocumentFragment();mi(e,r,i),e.display.dragCursor||(e.display.dragCursor=O("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),b(e.display.dragCursor,i)}}(e,t),Le(t))},start:function(t){return function(e,t){if(s&&(!e.state.draggingText||+new Date-_o<100))Le(t);else if(!Ee(e,t)&&!Nr(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!d)){var r=O("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",p&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),p&&r.parentNode.removeChild(r)}}(e,t)},drop:Ji(e,Do),leave:function(t){Ee(e,t)||wo(e)}};var l=t.input.getField();pe(l,"keyup",(function(t){return ps.call(e,t)})),pe(l,"keydown",Ji(e,cs)),pe(l,"keypress",Ji(e,ds)),pe(l,"focus",(function(t){return Ti(e,t)})),pe(l,"blur",(function(t){return Ii(e,t)}))}(this),Go(),Wi(this),this.curOp.forceUpdate=!0,Mn(this,i),t.autofocus&&!m||this.hasFocus()?setTimeout(F(Ti,this),20):Ii(this),Is)Is.hasOwnProperty(u)&&Is[u](this,t[u],Ls);dn(this),t.finishInit&&t.finishInit(this);for(var c=0;c150)){if(!i)return;r="prev"}}else u=0,r="not";"prev"==r?u=t>o.first?k(ze(o,t-1).text,null,s):0:"add"==r?u=l+e.options.indentUnit:"subtract"==r?u=l-e.options.indentUnit:"number"==typeof r&&(u=l+r),u=Math.max(0,u);var p="",d=0;if(e.options.indentWithTabs)for(var h=Math.floor(u/s);h;--h)d+=s,p+="\t";if(ds,l=Pe(t),u=null;if(a&&i.ranges.length>1)if(Rs&&Rs.text.join("\n")==t){if(i.ranges.length%Rs.text.length==0){u=[];for(var c=0;c=0;d--){var h=i.ranges[d],f=h.from(),E=h.to();h.empty()&&(r&&r>0?f=et(f.line,f.ch-r):e.state.overwrite&&!a?E=et(E.line,Math.min(ze(o,E.line).text.length,E.ch+X(l).length)):a&&Rs&&Rs.lineWise&&Rs.text.join("\n")==t&&(f=E=et(f.line,0)));var g={from:f,to:E,text:u?u[d%u.length]:l,origin:n||(a?"paste":e.state.cutIncoming>s?"cut":"+input")};uo(e.doc,g),ar(e,"inputRead",e,g)}t&&!a&&ws(e,t),Ri(e),e.curOp.updateInput<2&&(e.curOp.updateInput=p),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ds(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Zi(t,(function(){return _s(t,r,0,null,"paste")})),!0}function ws(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,i=r.ranges.length-1;i>=0;i--){var n=r.ranges[i];if(!(n.head.ch>100||i&&r.ranges[i-1].head.line==n.head.line)){var o=e.getModeAt(n.head),s=!1;if(o.electricChars){for(var a=0;a-1){s=Os(e,n.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(ze(e.doc,n.head.line).text.slice(0,n.head.ch))&&(s=Os(e,n.head.line,"smart"));s&&ar(e,"electricInput",e,n.head.line)}}}function Ms(e){for(var t=[],r=[],i=0;i=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var o=ae(n,r.ch,r.sticky),s=n[o];if("ltr"==e.doc.direction&&s.level%2==0&&(i>0?s.to>r.ch:s.from=s.from&&d>=c.begin)){var h=p?"before":"after";return new et(r.line,d,h)}}var f=function(e,t,i){for(var o=function(e,t){return t?new et(r.line,l(e,1),"before"):new et(r.line,e,"after")};e>=0&&e0==(1!=s.level),u=a?i.begin:l(i.end,-1);if(s.from<=u&&u0?c.end:l(c.begin,-1);return null==g||i>0&&g==t.text.length||!(E=f(i>0?0:n.length-1,i,u(g)))?null:E}(e.cm,a,t,r):Jo(a,t,r))){if(i||(s=t.line+l)=e.first+e.size||(t=new et(s,t.ch,t.sticky),!(a=ze(e,s))))return!1;t=es(n,e.cm,a,t.line,l)}else t=o;return!0}if("char"==i)u();else if("column"==i)u(!0);else if("word"==i||"group"==i)for(var c=null,p="group"==i,d=e.cm&&e.cm.getHelper(t,"wordChars"),h=!0;!(r<0)||u(!h);h=!1){var f=a.text.charAt(t.ch)||"\n",E=ee(f,d)?"w":p&&"\n"==f?"n":!p||/\s/.test(f)?null:"p";if(!p||h||E||(E="s"),c&&c!=E){r<0&&(r=1,u(),t.sticky="after");break}if(E&&(c=E),r>0&&!u(!h))break}var g=oo(e,t,o,s,!0);return rt(o,g)&&(g.hitSide=!0),g}function Us(e,t,r,i){var n,o,s=e.doc,a=t.left;if("page"==i){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=Math.max(l-.5*ri(e.display),3);n=(r>0?t.bottom:t.top)+r*u}else"line"==i&&(n=r>0?t.bottom+3:t.top-3);for(;(o=Yr(e,a,n)).outside;){if(r<0?n<=0:n>=s.height){o.hitSide=!0;break}n+=5*r}return o}var Bs=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new U,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function js(e,t){var r=Rr(e,t.line);if(!r||r.hidden)return null;var i=ze(e.doc,t.line),n=br(r,i,t.line),o=ue(i,e.doc.direction),s="left";o&&(s=ae(o,t.ch)%2?"right":"left");var a=Mr(n.map,t.ch,s);return a.offset="right"==a.collapse?a.end:a.start,a}function Vs(e,t){return t&&(e.bad=!0),e}function Hs(e,t,r){var i;if(t==e.display.lineDiv){if(!(i=e.display.lineDiv.childNodes[r]))return Vs(e.clipPos(et(e.display.viewTo-1)),!0);t=null,r=0}else for(i=t;;i=i.parentNode){if(!i||i==e.display.lineDiv)return null;if(i.parentNode&&i.parentNode==e.display.lineDiv)break}for(var n=0;n=t.display.viewTo||o.line=t.display.viewFrom&&js(t,n)||{node:l[0].measure.map[2],offset:0},c=o.linei.firstLine()&&(s=et(s.line-1,ze(i.doc,s.line-1).length)),a.ch==ze(i.doc,a.line).text.length&&a.linen.viewTo-1)return!1;s.line==n.viewFrom||0==(e=ui(i,s.line))?(t=$e(n.view[0].line),r=n.view[0].node):(t=$e(n.view[e].line),r=n.view[e-1].node.nextSibling);var l,u,c=ui(i,a.line);if(c==n.view.length-1?(l=n.viewTo-1,u=n.lineDiv.lastChild):(l=$e(n.view[c+1].line)-1,u=n.view[c+1].node.previousSibling),!r)return!1;for(var p=i.doc.splitLines(function(e,t,r,i,n){var o="",s=!1,a=e.doc.lineSeparator(),l=!1;function u(){s&&(o+=a,l&&(o+=a),s=l=!1)}function c(e){e&&(u(),o+=e)}function p(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(r)return void c(r);var o,d=t.getAttribute("cm-marker");if(d){var h=e.findMarks(et(i,0),et(n+1,0),(g=+d,function(e){return e.id==g}));return void(h.length&&(o=h[0].find(0))&&c(Ke(e.doc,o.from,o.to).join(a)))}if("false"==t.getAttribute("contenteditable"))return;var f=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;f&&u();for(var E=0;E1&&d.length>1;)if(X(p)==X(d))p.pop(),d.pop(),l--;else{if(p[0]!=d[0])break;p.shift(),d.shift(),t++}for(var h=0,f=0,E=p[0],g=d[0],m=Math.min(E.length,g.length);hs.ch&&v.charCodeAt(v.length-f-1)==x.charCodeAt(x.length-f-1);)h--,f++;p[p.length-1]=v.slice(0,v.length-f).replace(/^\u200b+/,""),p[0]=p[0].slice(h).replace(/\u200b+$/,"");var N=et(t,h),L=et(l,d.length?X(d).length-f:0);return p.length>1||p[0]||tt(N,L)?(Eo(i.doc,p,N,L,"+input"),!0):void 0},Bs.prototype.ensurePolled=function(){this.forceCompositionEnd()},Bs.prototype.reset=function(){this.forceCompositionEnd()},Bs.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Bs.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()}),80))},Bs.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Zi(this.cm,(function(){return ci(e.cm)}))},Bs.prototype.setUneditable=function(e){e.contentEditable="false"},Bs.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Ji(this.cm,_s)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Bs.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Bs.prototype.onContextMenu=function(){},Bs.prototype.resetPosition=function(){},Bs.prototype.needsContentAttribute=!0;var Ws=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new U,this.hasSelection=!1,this.composing=null};Ws.prototype.init=function(e){var t=this,r=this,i=this.cm;this.createField(e);var n=this.textarea;function o(e){if(!Ee(i,e)){if(i.somethingSelected())Ps({lineWise:!1,text:i.getSelections()});else{if(!i.options.lineWiseCopyCut)return;var t=Ms(i);Ps({lineWise:!0,text:t.text}),"cut"==e.type?i.setSelections(t.ranges,null,V):(r.prevInput="",n.value=t.text.join("\n"),M(n))}"cut"==e.type&&(i.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),E&&(n.style.width="0px"),pe(n,"input",(function(){s&&a>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()})),pe(n,"paste",(function(e){Ee(i,e)||Ds(e,i)||(i.state.pasteIncoming=+new Date,r.fastPoll())})),pe(n,"cut",o),pe(n,"copy",o),pe(e.scroller,"paste",(function(t){if(!Nr(e,t)&&!Ee(i,t)){if(!n.dispatchEvent)return i.state.pasteIncoming=+new Date,void r.focus();var o=new Event("paste");o.clipboardData=t.clipboardData,n.dispatchEvent(o)}})),pe(e.lineSpace,"selectstart",(function(t){Nr(e,t)||xe(t)})),pe(n,"compositionstart",(function(){var e=i.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:i.markText(e,i.getCursor("to"),{className:"CodeMirror-composing"})}})),pe(n,"compositionend",(function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)}))},Ws.prototype.createField=function(e){this.wrapper=Gs(),this.textarea=this.wrapper.firstChild},Ws.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Ws.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,i=gi(e);if(e.options.moveInputWithCursor){var n=zr(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),s=t.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,n.top+s.top-o.top)),i.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,n.left+s.left-o.left))}return i},Ws.prototype.showSelection=function(e){var t=this.cm.display;b(t.cursorDiv,e.cursors),b(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ws.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&M(this.textarea),s&&a>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",s&&a>=9&&(this.hasSelection=null))}},Ws.prototype.getField=function(){return this.textarea},Ws.prototype.supportsTouch=function(){return!1},Ws.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!m||_()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ws.prototype.blur=function(){this.textarea.blur()},Ws.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ws.prototype.receivedFocus=function(){this.slowPoll()},Ws.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){e.poll(),e.cm.state.focused&&e.slowPoll()}))},Ws.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0,t.polling.set(20,(function r(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,r))}))},Ws.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,i=this.prevInput;if(this.contextMenuPending||!t.state.focused||_e(r)&&!i&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var n=r.value;if(n==i&&!t.somethingSelected())return!1;if(s&&a>=9&&this.hasSelection===n||v&&/[\uf700-\uf7ff]/.test(n))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=n.charCodeAt(0);if(8203!=o||i||(i="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var l=0,u=Math.min(i.length,n.length);l1e3||n.indexOf("\n")>-1?r.value=e.prevInput="":e.prevInput=n,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},Ws.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ws.prototype.onKeyPress=function(){s&&a>=9&&(this.hasSelection=null),this.fastPoll()},Ws.prototype.onContextMenu=function(e){var t=this,r=t.cm,i=r.display,n=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=li(r,e),u=i.scroller.scrollTop;if(o&&!p){r.options.resetSelectionOnContextMenu&&-1==r.doc.sel.contains(o)&&Ji(r,Jn)(r.doc,Sn(o),V);var c,d=n.style.cssText,h=t.wrapper.style.cssText,f=t.wrapper.offsetParent.getBoundingClientRect();if(t.wrapper.style.cssText="position: static",n.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-f.top-5)+"px; left: "+(e.clientX-f.left-5)+"px;\n z-index: 1000; background: "+(s?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",l&&(c=window.scrollY),i.input.focus(),l&&window.scrollTo(null,c),i.input.reset(),r.somethingSelected()||(n.value=t.prevInput=" "),t.contextMenuPending=m,i.selForContextMenu=r.doc.sel,clearTimeout(i.detectingSelectAll),s&&a>=9&&g(),T){Le(e);var E=function(){he(window,"mouseup",E),setTimeout(m,20)};pe(window,"mouseup",E)}else setTimeout(m,50)}function g(){if(null!=n.selectionStart){var e=r.somethingSelected(),o="​"+(e?n.value:"");n.value="⇚",n.value=o,t.prevInput=e?"":"​",n.selectionStart=1,n.selectionEnd=o.length,i.selForContextMenu=r.doc.sel}}function m(){if(t.contextMenuPending==m&&(t.contextMenuPending=!1,t.wrapper.style.cssText=h,n.style.cssText=d,s&&a<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=u),null!=n.selectionStart)){(!s||s&&a<9)&&g();var e=0,o=function(){i.selForContextMenu==r.doc.sel&&0==n.selectionStart&&n.selectionEnd>0&&"​"==t.prevInput?Ji(r,ao)(r):e++<10?i.detectingSelectAll=setTimeout(o,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(o,200)}}},Ws.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},Ws.prototype.setUneditable=function(){},Ws.prototype.needsContentAttribute=!1,function(e){var t=e.optionHandlers;function r(r,i,n,o){e.defaults[r]=i,n&&(t[r]=o?function(e,t,r){r!=Ls&&n(e,t,r)}:n)}e.defineOption=r,e.Init=Ls,r("value","",(function(e,t){return e.setValue(t)}),!0),r("mode",null,(function(e,t){e.doc.modeOption=t,Rn(e)}),!0),r("indentUnit",2,Rn,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,(function(e){Pn(e),Ur(e),ci(e)}),!0),r("lineSeparator",null,(function(e,t){if(e.doc.lineSep=t,t){var r=[],i=e.doc.first;e.doc.iter((function(e){for(var n=0;;){var o=e.text.indexOf(t,n);if(-1==o)break;n=o+t.length,r.push(et(i,o))}i++}));for(var n=r.length-1;n>=0;n--)Eo(e.doc,t,r[n],et(r[n].line,r[n].ch+t.length))}})),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(e,t,r){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),r!=Ls&&e.refresh()})),r("specialCharPlaceholder",Zt,(function(e){return e.refresh()}),!0),r("electricChars",!0),r("inputStyle",m?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),r("spellcheck",!1,(function(e,t){return e.getInputField().spellcheck=t}),!0),r("autocorrect",!1,(function(e,t){return e.getInputField().autocorrect=t}),!0),r("autocapitalize",!1,(function(e,t){return e.getInputField().autocapitalize=t}),!0),r("rtlMoveVisually",!y),r("wholeLineUpdateBefore",!0),r("theme","default",(function(e){Ns(e),En(e)}),!0),r("keyMap","default",(function(e,t,r){var i=$o(t),n=r!=Ls&&$o(r);n&&n.detach&&n.detach(e,i),i.attach&&i.attach(e,n||null)})),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,As,!0),r("gutters",[],(function(e,t){e.display.gutterSpecs=hn(t,e.options.lineNumbers),En(e)}),!0),r("fixedGutter",!0,(function(e,t){e.display.gutters.style.left=t?oi(e.display)+"px":"0",e.refresh()}),!0),r("coverGutterNextToScrollbar",!1,(function(e){return Bi(e)}),!0),r("scrollbarStyle","native",(function(e){Hi(e),Bi(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)}),!0),r("lineNumbers",!1,(function(e,t){e.display.gutterSpecs=hn(e.options.gutters,t),En(e)}),!0),r("firstLineNumber",1,En,!0),r("lineNumberFormatter",(function(e){return e}),En,!0),r("showCursorWhenSelecting",!1,Ei,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,(function(e,t){"nocursor"==t&&(Ii(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)})),r("screenReaderLabel",null,(function(e,t){t=""===t?null:t,e.display.input.screenReaderLabelChanged(t)})),r("disableInput",!1,(function(e,t){t||e.display.input.reset()}),!0),r("dragDrop",!0,Ss),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,Ei,!0),r("singleCursorHeightPerLine",!0,Ei,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,Pn,!0),r("addModeClass",!1,Pn,!0),r("pollInterval",100),r("undoDepth",200,(function(e,t){return e.doc.history.undoDepth=t})),r("historyEventDelay",1250),r("viewportMargin",10,(function(e){return e.refresh()}),!0),r("maxHighlightLength",1e4,Pn,!0),r("moveInputWithCursor",!0,(function(e,t){t||e.display.input.resetPosition()})),r("tabindex",null,(function(e,t){return e.display.input.getField().tabIndex=t||""})),r("autofocus",null),r("direction","ltr",(function(e,t){return e.doc.setDirection(t)}),!0),r("phrases",null)}(Cs),function(e){var t=e.optionHandlers,r=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,r){var i=this.options,n=i[e];i[e]==r&&"mode"!=e||(i[e]=r,t.hasOwnProperty(e)&&Ji(this,t[e])(this,r,n),fe(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"]($o(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;rr&&(Os(this,n.head.line,e,!0),r=n.head.line,i==this.doc.sel.primIndex&&Ri(this));else{var o=n.from(),s=n.to(),a=Math.max(r,o.line);r=Math.min(this.lastLine(),s.line-(s.ch?0:1))+1;for(var l=a;l0&&$n(this.doc,i,new Tn(o,u[i].to()),V)}}})),getTokenAt:function(e,t){return vt(this,e,t)},getLineTokens:function(e,t){return vt(this,et(e),t,!0)},getTokenTypeAt:function(e){e=at(this.doc,e);var t,r=dt(this,ze(this.doc,e.line)),i=0,n=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var s=i+n>>1;if((s?r[2*s-1]:0)>=o)n=s;else{if(!(r[2*s+1]o&&(e=o,n=!0),i=ze(this.doc,e)}else i=e;return Hr(this,i,{top:0,left:0},t||"page",r||n).top+(n?this.doc.height-Ht(i):0)},defaultTextHeight:function(){return ri(this.display)},defaultCharWidth:function(){return ii(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,i,n){var o,s,a,l=this.display,u=(e=zr(this,at(this.doc,e))).bottom,c=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),l.sizer.appendChild(t),"over"==i)u=e.top;else if("above"==i||"near"==i){var p=Math.max(l.wrapper.clientHeight,this.doc.height),d=Math.max(l.sizer.clientWidth,l.lineSpace.clientWidth);("above"==i||e.bottom+t.offsetHeight>p)&&e.top>t.offsetHeight?u=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=p&&(u=e.bottom),c+t.offsetWidth>d&&(c=d-t.offsetWidth)}t.style.top=u+"px",t.style.left=t.style.right="","right"==n?(c=l.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==n?c=0:"middle"==n&&(c=(l.sizer.clientWidth-t.offsetWidth)/2),t.style.left=c+"px"),r&&(o=this,s={left:c,top:u,right:c+t.offsetWidth,bottom:u+t.offsetHeight},null!=(a=bi(o,s)).scrollTop&&wi(o,a.scrollTop),null!=a.scrollLeft&&Fi(o,a.scrollLeft))},triggerOnKeyDown:en(cs),triggerOnKeyPress:en(ds),triggerOnKeyUp:ps,triggerOnMouseDown:en(gs),execCommand:function(e){if(ts.hasOwnProperty(e))return ts[e].call(null,this)},triggerElectric:en((function(e){ws(this,e)})),findPosH:function(e,t,r,i){var n=1;t<0&&(n=-1,t=-t);for(var o=at(this.doc,e),s=0;s0&&s(t.charAt(r-1));)--r;for(;i.5||this.options.lineWrapping)&&ai(this),fe(this,"refresh",this)})),swapDoc:en((function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),Mn(this,e),Ur(this),this.display.input.reset(),Pi(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,ar(this,"swapDoc",this,t),t})),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ve(e),e.registerHelper=function(t,i,n){r.hasOwnProperty(t)||(r[t]=e[t]={_global:[]}),r[t][i]=n},e.registerGlobalHelper=function(t,i,n,o){e.registerHelper(t,i,o),r[t]._global.push({pred:n,val:o})}}(Cs);var zs="iter insert remove copy getEditor constructor".split(" ");for(var Ks in Po.prototype)Po.prototype.hasOwnProperty(Ks)&&B(zs,Ks)<0&&(Cs.prototype[Ks]=function(e){return function(){return e.apply(this.doc,arguments)}}(Po.prototype[Ks]));return ve(Po),Cs.inputStyles={textarea:Ws,contenteditable:Bs},Cs.defineMode=function(e){Cs.defaults.mode||"null"==e||(Cs.defaults.mode=e),Ge.apply(this,arguments)},Cs.defineMIME=function(e,t){Fe[e]=t},Cs.defineMode("null",(function(){return{token:function(e){return e.skipToEnd()}}})),Cs.defineMIME("text/plain","null"),Cs.defineExtension=function(e,t){Cs.prototype[e]=t},Cs.defineDocExtension=function(e,t){Po.prototype[e]=t},Cs.fromTextArea=function(e,t){if((t=t?G(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var r=_();t.autofocus=r==e||null!=e.getAttribute("autofocus")&&r==document.body}function i(){e.value=a.getValue()}var n;if(e.form&&(pe(e.form,"submit",i),!t.leaveSubmitMethodAlone)){var o=e.form;n=o.submit;try{var s=o.submit=function(){i(),o.submit=n,o.submit(),o.submit=s}}catch(e){}}t.finishInit=function(r){r.save=i,r.getTextArea=function(){return e},r.toTextArea=function(){r.toTextArea=isNaN,i(),e.parentNode.removeChild(r.getWrapperElement()),e.style.display="",e.form&&(he(e.form,"submit",i),t.leaveSubmitMethodAlone||"function"!=typeof e.form.submit||(e.form.submit=n))}},e.style.display="none";var a=Cs((function(t){return e.parentNode.insertBefore(t,e.nextSibling)}),t);return a},function(e){e.off=he,e.on=pe,e.wheelEventPixels=yn,e.Doc=Po,e.splitLines=Pe,e.countColumn=k,e.findColumn=W,e.isWordChar=J,e.Pass=j,e.signal=fe,e.Line=zt,e.changeEnd=An,e.scrollbarModel=Vi,e.Pos=et,e.cmpPos=tt,e.modes=Me,e.mimeModes=Fe,e.resolveMode=ke,e.getMode=Ue,e.modeExtensions=Be,e.extendMode=je,e.copyState=Ve,e.startState=qe,e.innerMode=He,e.commands=ts,e.keyMap=Ho,e.keyName=Yo,e.isModifierKey=Ko,e.lookupKey=zo,e.normalizeKeyMap=Wo,e.StringStream=We,e.SharedTextMarker=Co,e.TextMarker=So,e.LineWidget=Lo,e.e_preventDefault=xe,e.e_stopPropagation=ye,e.e_stop=Le,e.addClass=D,e.contains=P,e.rmClass=A,e.keyNames=Uo}(Cs),Cs.version="5.55.0",Cs}()},function(e,t,r){"use strict";var i=r(3).a.Symbol;t.a=i},function(e,t,r){"use strict";var i,n=r(44),o=r(3).a["__core-js_shared__"],s=(i=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+i:"";var a=function(e){return!!s&&s in e},l=r(2),u=r(22),c=/^\[object .+?Constructor\]$/,p=Function.prototype,d=Object.prototype,h=p.toString,f=d.hasOwnProperty,E=RegExp("^"+h.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var g=function(e){return!(!Object(l.a)(e)||a(e))&&(Object(n.a)(e)?E:c).test(Object(u.a)(e))};var m=function(e,t){return null==e?void 0:e[t]};t.a=function(e,t){var r=m(e,t);return g(r)?r:void 0}},function(e,t,r){"use strict";var i=r(44),n=r(43);t.a=function(e){return null!=e&&Object(n.a)(e.length)&&!Object(i.a)(e)}},function(e,t,r){"use strict";var i=r(8),n=Object.prototype,o=n.hasOwnProperty,s=n.toString,a=i.a?i.a.toStringTag:void 0;var l=function(e){var t=o.call(e,a),r=e[a];try{e[a]=void 0;var i=!0}catch(e){}var n=s.call(e);return i&&(t?e[a]=r:delete e[a]),n},u=Object.prototype.toString;var c=function(e){return u.call(e)},p=i.a?i.a.toStringTag:void 0;t.a=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":p&&p in Object(e)?l(e):c(e)}},function(e,t,r){"use strict";t.a=function(e,t){return e===t||e!=e&&t!=t}},function(e,t,r){"use strict";var i=r(68),n=r(80),o=r(10);t.a=function(e){return Object(o.a)(e)?Object(i.a)(e):Object(n.a)(e)}},function(e,t,r){"use strict";(function(e){var i=r(3),n=r(93),o="object"==typeof exports&&exports&&!exports.nodeType&&exports,s=o&&"object"==typeof e&&e&&!e.nodeType&&e,a=s&&s.exports===o?i.a.Buffer:void 0,l=(a?a.isBuffer:void 0)||n.a;t.a=l}).call(this,r(83)(e))},function(e,t,r){"use strict";var i=r(11),n=r(6);var o=function(e){return Object(n.a)(e)&&"[object Arguments]"==Object(i.a)(e)},s=Object.prototype,a=s.hasOwnProperty,l=s.propertyIsEnumerable,u=o(function(){return arguments}())?o:function(e){return Object(n.a)(e)&&a.call(e,"callee")&&!l.call(e,"callee")};t.a=u},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t,r){"use strict";var i=r(11),n=r(6);t.a=function(e){return"symbol"==typeof e||Object(n.a)(e)&&"[object Symbol]"==Object(i.a)(e)}},function(e,t,r){"use strict";var i=r(26);var n=function(){this.__data__=new i.a,this.size=0};var o=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r};var s=function(e){return this.__data__.get(e)};var a=function(e){return this.__data__.has(e)},l=r(28),u=r(34);var c=function(e,t){var r=this.__data__;if(r instanceof i.a){var n=r.__data__;if(!l.a||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new u.a(n)}return r.set(e,t),this.size=r.size,this};function p(e){var t=this.__data__=new i.a(e);this.size=t.size}p.prototype.clear=n,p.prototype.delete=o,p.prototype.get=s,p.prototype.has=a,p.prototype.set=c;t.a=p},function(e,t,r){e.exports=r(105)},function(e,t,r){"use strict";var i=r(9),n=r(3),o=Object(i.a)(n.a,"DataView"),s=r(28),a=Object(i.a)(n.a,"Promise"),l=Object(i.a)(n.a,"Set"),u=Object(i.a)(n.a,"WeakMap"),c=r(11),p=r(22),d=Object(p.a)(o),h=Object(p.a)(s.a),f=Object(p.a)(a),E=Object(p.a)(l),g=Object(p.a)(u),m=c.a;(o&&"[object DataView]"!=m(new o(new ArrayBuffer(1)))||s.a&&"[object Map]"!=m(new s.a)||a&&"[object Promise]"!=m(a.resolve())||l&&"[object Set]"!=m(new l)||u&&"[object WeakMap]"!=m(new u))&&(m=function(e){var t=Object(c.a)(e),r="[object Object]"==t?e.constructor:void 0,i=r?Object(p.a)(r):"";if(i)switch(i){case d:return"[object DataView]";case h:return"[object Map]";case f:return"[object Promise]";case E:return"[object Set]";case g:return"[object WeakMap]"}return t});t.a=m},function(e,t){function r(t){return e.exports=r=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},r(t)}e.exports=r},function(e,t,r){"use strict";var i=Function.prototype.toString;t.a=function(e){if(null!=e){try{return i.call(e)}catch(e){}try{return e+""}catch(e){}}return""}},,function(e,t,r){"use strict";var i=r(17);t.a=function(e){if("string"==typeof e||Object(i.a)(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}},function(e,t,r){"use strict";t.a=function(e){return e}},function(e,t,r){"use strict";var i=function(){this.__data__=[],this.size=0},n=r(12);var o=function(e,t){for(var r=e.length;r--;)if(Object(n.a)(e[r][0],t))return r;return-1},s=Array.prototype.splice;var a=function(e){var t=this.__data__,r=o(t,e);return!(r<0)&&(r==t.length-1?t.pop():s.call(t,r,1),--this.size,!0)};var l=function(e){var t=this.__data__,r=o(t,e);return r<0?void 0:t[r][1]};var u=function(e){return o(this.__data__,e)>-1};var c=function(e,t){var r=this.__data__,i=o(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this};function p(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e0||e instanceof Object)?t(e):null)},v.prototype.toError=function(){var e=this.req,t=e.method,r=e.url,i="cannot ".concat(t," ").concat(r," (").concat(this.status,")"),n=new Error(i);return n.status=this.status,n.method=t,n.url=r,n},d.Response=v,o(x.prototype),a(x.prototype),x.prototype.type=function(e){return this.set("Content-Type",d.types[e]||e),this},x.prototype.accept=function(e){return this.set("Accept",d.types[e]||e),this},x.prototype.auth=function(e,t,r){1===arguments.length&&(t=""),"object"===i(t)&&null!==t&&(r=t,t=""),r||(r={type:"function"==typeof btoa?"basic":"auto"});var n=function(e){if("function"==typeof btoa)return btoa(e);throw new Error("Cannot use basic auth, btoa is not a function")};return this._auth(e,t,r,n)},x.prototype.query=function(e){return"string"!=typeof e&&(e=f(e)),e&&this._query.push(e),this},x.prototype.attach=function(e,t,r){if(t){if(this._data)throw new Error("superagent can't mix .send() and .attach()");this._getFormData().append(e,t,r||t.name)}return this},x.prototype._getFormData=function(){return this._formData||(this._formData=new n.FormData),this._formData},x.prototype.callback=function(e,t){if(this._shouldRetry(e,t))return this._retry();var r=this._callback;this.clearTimeout(),e&&(this._maxRetries&&(e.retries=this._retries-1),this.emit("error",e)),r(e,t)},x.prototype.crossDomainError=function(){var e=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");e.crossDomain=!0,e.status=this.status,e.method=this.method,e.url=this.url,this.callback(e)},x.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},x.prototype.ca=x.prototype.agent,x.prototype.buffer=x.prototype.ca,x.prototype.write=function(){throw new Error("Streaming is not supported in browser version of superagent")},x.prototype.pipe=x.prototype.write,x.prototype._isHost=function(e){return e&&"object"===i(e)&&!Array.isArray(e)&&"[object Object]"!==Object.prototype.toString.call(e)},x.prototype.end=function(e){this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=e||p,this._finalizeQueryString(),this._end()},x.prototype._setUploadTimeout=function(){var e=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout((function(){e._timeoutError("Upload timeout of ",e._uploadTimeout,"ETIMEDOUT")}),this._uploadTimeout))},x.prototype._end=function(){if(this._aborted)return this.callback(new Error("The request has been aborted even before .end() was called"));var e=this;this.xhr=d.getXHR();var t=this.xhr,r=this._formData||this._data;this._setTimeouts(),t.onreadystatechange=function(){var r=t.readyState;if(r>=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4===r){var i;try{i=t.status}catch(e){i=0}if(!i){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}};var i=function(t,r){r.total>0&&(r.percent=r.loaded/r.total*100,100===r.percent&&clearTimeout(e._uploadTimeoutTimer)),r.direction=t,e.emit("progress",r)};if(this.hasListeners("progress"))try{t.addEventListener("progress",i.bind(null,"download")),t.upload&&t.upload.addEventListener("progress",i.bind(null,"upload"))}catch(e){}t.upload&&this._setUploadTimeout();try{this.username&&this.password?t.open(this.method,this.url,!0,this.username,this.password):t.open(this.method,this.url,!0)}catch(e){return this.callback(e)}if(this._withCredentials&&(t.withCredentials=!0),!this._formData&&"GET"!==this.method&&"HEAD"!==this.method&&"string"!=typeof r&&!this._isHost(r)){var n=this._header["content-type"],o=this._serializer||d.serialize[n?n.split(";")[0]:""];!o&&m(n)&&(o=d.serialize["application/json"]),o&&(r=o(r))}for(var s in this.header)null!==this.header[s]&&Object.prototype.hasOwnProperty.call(this.header,s)&&t.setRequestHeader(s,this.header[s]);this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send(void 0===r?null:r)},d.agent=function(){return new c},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach((function(e){c.prototype[e.toLowerCase()]=function(t,r){var i=new d.Request(e,t);return this._setDefaults(i),r&&i.end(r),i}})),c.prototype.del=c.prototype.delete,d.get=function(e,t,r){var i=d("GET",e);return"function"==typeof t&&(r=t,t=null),t&&i.query(t),r&&i.end(r),i},d.head=function(e,t,r){var i=d("HEAD",e);return"function"==typeof t&&(r=t,t=null),t&&i.query(t),r&&i.end(r),i},d.options=function(e,t,r){var i=d("OPTIONS",e);return"function"==typeof t&&(r=t,t=null),t&&i.send(t),r&&i.end(r),i},d.del=y,d.delete=y,d.patch=function(e,t,r){var i=d("PATCH",e);return"function"==typeof t&&(r=t,t=null),t&&i.send(t),r&&i.end(r),i},d.post=function(e,t,r){var i=d("POST",e);return"function"==typeof t&&(r=t,t=null),t&&i.send(t),r&&i.end(r),i},d.put=function(e,t,r){var i=d("PUT",e);return"function"==typeof t&&(r=t,t=null),t&&i.send(t),r&&i.end(r),i}},function(e,t,r){(function(t){var r=Object.assign?Object.assign:function(e,t,r,i){for(var n=1;n-1&&e%1==0&&e<=9007199254740991}},function(e,t,r){"use strict";var i=r(11),n=r(2);t.a=function(e){if(!Object(n.a)(e))return!1;var t=Object(i.a)(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},function(e,t,r){"use strict";t.a=function(e){return function(t){return e(t)}}},function(e,t,r){"use strict";var i=r(1),n=r(17),o=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;t.a=function(e,t){if(Object(i.a)(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!Object(n.a)(e))||(s.test(e)||!o.test(e)||null!=t&&e in Object(t))}},function(e,t,r){"use strict";var i=r(3).a.Uint8Array;t.a=i},function(e,t,r){"use strict";var i=r(9),n=function(){try{var e=Object(i.a)(Object,"defineProperty");return e({},"",{}),e}catch(e){}}();t.a=n},function(e,t){function r(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=r=function(e){return typeof e}:e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(t)}e.exports=r},function(e,t,r){"use strict";function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],i=!0,n=!1,o=void 0;try{for(var s,a=e[Symbol.iterator]();!(i=(s=a.next()).done)&&(r.push(s.value),!t||r.length!==t);i=!0);}catch(e){n=!0,o=e}finally{try{i||null==a.return||a.return()}finally{if(n)throw o}}return r}(e,t)||s(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 n(e){return(n="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})(e)}function o(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||s(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.")}()}function s(e,t){if(e){if("string"==typeof e)return a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,t):void 0}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r-1?r.split(e.arrayFormatSeparator).map((function(t){return h(t,e)})):null===r?r:h(r,e);i[t]=n};default:return function(e,t,r){void 0!==r[e]?r[e]=[].concat(r[e],t):r[e]=t}}}(t),o=Object.create(null);if("string"!=typeof e)return o;if(!(e=e.trim().replace(/^[?#&]/,"")))return o;var a,l=function(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=s(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw o}}}}(e.split("&"));try{for(l.s();!(a=l.n()).done;){var u=a.value,d=i(c(t.decode?u.replace(/\+/g," "):u,"="),2),f=d[0],E=d[1];E=void 0===E?null:["comma","separator"].includes(t.arrayFormat)?E:h(E,t),r(h(f,t),E,o)}}catch(e){l.e(e)}finally{l.f()}for(var m=0,v=Object.keys(o);m0})).join("&")},t.parseUrl=function(e,t){t=Object.assign({decode:!0},t);var r=i(c(e,"#"),2),n=r[0],o=r[1];return Object.assign({url:n.split("?")[0]||"",query:m(E(e),t)},t&&t.parseFragmentIdentifier&&o?{fragmentIdentifier:h(o,t)}:{})},t.stringifyUrl=function(e,r){r=Object.assign({encode:!0,strict:!0},r);var i=f(e.url).split("?")[0]||"",n=t.extract(e.url),o=t.parse(n,{sort:!1}),s=Object.assign(o,e.query),a=t.stringify(s,r);a&&(a="?".concat(a));var l=function(e){var t="",r=e.indexOf("#");return-1!==r&&(t=e.slice(r)),t}(e.url);return e.fragmentIdentifier&&(l="#".concat(d(e.fragmentIdentifier,r))),"".concat(i).concat(a).concat(l)}},function(e,t,r){"use strict";var i=r(65),n=Object(i.a)(Object.getPrototypeOf,Object);t.a=n},function(e,t,r){"use strict";var i=r(18),n=r(59);var o=function(e,t,r,o){var s=r.length,a=s,l=!o;if(null==e)return!a;for(e=Object(e);s--;){var u=r[s];if(l&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++s0&&s.length>n&&!s.warned){s.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=s.length,a=l,console&&console.warn&&console.warn(a)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function h(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=d.bind(i);return n.listener=r,i.wrapFn=n,n}function f(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var l=n[e];if(void 0===l)return!1;if("function"==typeof l)o(l,this,t);else{var u=l.length,c=g(l,u);for(r=0;r=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,n=o;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1=0;i--)this.removeListener(e,t[i]);return this},a.prototype.listeners=function(e){return f(this,e,!0)},a.prototype.rawListeners=function(e){return f(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):E.call(e,t)},a.prototype.listenerCount=E,a.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(e,t,r){"use strict";var i=r(53),n=r(24);t.a=function(e,t){for(var r=0,o=(t=Object(i.a)(t,e)).length;null!=e&&ra))return!1;var d=o.get(e);if(d&&o.get(t))return d==t;var h=-1,f=!0,E=2&r?new l:void 0;for(o.set(e,t),o.set(t,e);++h=0){var n=r.string.indexOf(" ");return r.string=r.string.substr(0,n),r.end=r.start+r.string.length,r}if(!r.type)return r;var o=t.getTokenAt({line:i.line,ch:r.end+1});return"ws"!==o.type&&r.state.possibleFullIri&&null!==r.type&&"ws"!==r.type&&o.end!==r.end?(r.end=o.end,r.string=r.string+o.string,e(t,r,{line:i.line,ch:o.end})):"ws"===r.type?(r.end=r.end+1,r.string=r.string.substring(r.string.length-1),r):r}(e,function e(t,r,i){var n=t.getTokenAt({line:i.line,ch:r.start});if(!("punc"!==r.type&&"error"!==r.type||r.state.possibleFullIri||r.state.inPrefixDecl))return r.state.possibleCurrent=r.state.possibleNext,r;if("punc"===n.type&&!n.state.possibleFullIri&&!n.state.inPrefixDecl)return r;return null!=n.type&&"ws"!=n.type&&null!=r.type&&"ws"!=r.type?(r.start=n.start,r.string=n.string+r.string,e(t,r,{line:i.line,ch:n.start})):null!=r.type&&"ws"==r.type?(r.start=r.start+1,r.string=r.string.substring(1),r):r}(e,t,r),r)}function y(e,t,r){null==r&&(r=1);var i=e.getTokenAt({line:t,ch:r});if(!(null==i||null==i||i.end=0)return r}}function L(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3?arguments[3]:void 0;i||(i=e.getDoc().getLine(t));var n=(i=i.toUpperCase()).indexOf("PREFIX ",r);if(n>=0){var o=e.getTokenTypeAt(v.a.Pos(t,n+1));if("keyword"===o)return n}}function T(e,t){e.getDoc().replaceRange("PREFIX "+t+"\n",{line:0,ch:0}),e.collapsePrefixes(!1)}var I=r(0),S=r(50);function A(e,t,r){var i;t.onmouseover=function(){i||((i=document.createElement("div")).className="yasqe_tooltip"),i.style.display="block",i.innerHTML=r,t.appendChild(i)},t.onmouseout=function(){i&&(i.style.display="none"),i.innerHTML=r}}var C=r(19),b=r.n(C),O=r(44),R=r(170),P=function(e,t,r,i){return new(r||(r=Promise))((function(n,o){function s(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,a)}l((i=i.apply(e,t||[])).next())}))};function _(e,t){return Object(O.a)(t)?t(e):t}function D(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Object(R.a)({},_(e,e.config.requestConfig),_(e,t));if(r.endpoint&&0!=r.endpoint.length){var i=e.getQueryMode(),n=Object(O.a)(r.endpoint)?r.endpoint(e):r.endpoint,o="update"==i?"POST":Object(O.a)(r.method)?r.method(e):r.method,s=Object(O.a)(r.headers)?r.headers(e):r.headers,a=Object(O.a)(r.withCredentials)?r.withCredentials(e):r.withCredentials;return{reqMethod:o,url:n,args:M(e,r),headers:s,accept:F(e,r),withCredentials:a}}}function w(e,t){return P(this,void 0,void 0,b.a.mark((function r(){var i,n,o;return b.a.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(r.prev=0,D(e,t),n=D(e,t)){r.next=5;break}return r.abrupt("return");case 5:return o=Date.now(),(i="POST"===n.reqMethod?g.post(n.url).type("form").send(n.args):g.get(n.url).query(n.args)).accept(n.accept).set(n.headers||{}),n.withCredentials&&i.withCredentials(),e.emit("query",i,n),r.next=12,i.then((function(t){return e.emit("queryResponse",t,Date.now()-o),e.emit("queryResults",t.body,Date.now()-o),t.body}),(function(t){throw t instanceof Error&&"Aborted"===t.message||e.emit("queryResponse",t,Date.now()-o),e.emit("error",t),t}));case 12:return r.abrupt("return",r.sent);case 15:r.prev=15,r.t0=r.catch(0),console.error(r.t0);case 18:case"end":return r.stop()}}),r,null,[[0,15]])})))}function M(e,t){var r=e.getQueryMode(),i={},n=_(e,t),o=Object(O.a)(n.queryArgument)?n.queryArgument(e):n.queryArgument;o||(o=e.getQueryMode()),i[o]=n.adjustQueryBeforeRequest?n.adjustQueryBeforeRequest(e):e.getValue();var s=Object(O.a)(n.namedGraphs)?n.namedGraphs(e):n.namedGraphs;s&&s.length>0&&(i["query"===r?"named-graph-uri":"using-named-graph-uri "]=s);var a=Object(O.a)(n.defaultGraphs)?n.defaultGraphs(e):n.defaultGraphs;a&&a.length>0&&(i["query"==r?"default-graph-uri":"using-graph-uri "]=s);var l=Object(O.a)(n.args)?n.args(e):n.args;return l&&l.length>0&&Object(R.a)(i,l.reduce((function(e,t){return e[t.name]?e[t.name].push(t.value):e[t.name]=[t.value],e}),{})),i}function F(e,t){var r=_(e,t),i=null;if("update"==e.getQueryMode())i=Object(O.a)(r.acceptHeaderUpdate)?r.acceptHeaderUpdate(e):r.acceptHeaderUpdate;else{var n=e.getQueryType();i="DESCRIBE"==n||"CONSTRUCT"==n?Object(O.a)(r.acceptHeaderGraph)?r.acceptHeaderGraph(e):r.acceptHeaderGraph:Object(O.a)(r.acceptHeaderSelect)?r.acceptHeaderSelect(e):r.acceptHeaderSelect}return i}function G(e,t){var r=D(e,_(e,t));if(!r)return"";var i=r.url;0!==r.url.indexOf("http")&&(i="".concat(window.location.protocol,"//").concat(window.location.host),0===r.url.indexOf("/")?i+=r.url:i+=window.location.pathname+r.url);var n=["curl"];for(var o in"GET"===r.reqMethod?(i+="?".concat(S.stringify(r.args)),n.push(i)):"POST"===r.reqMethod?(n.push(i),n.push("--data",S.stringify(r.args))):(console.warn("Unexpected request-method",r.reqMethod),n.push(i)),n.push("-X",r.reqMethod),r.headers)n.push("-H '".concat(o,": ").concat(r.headers[o],"'"));return n.join(" ")}var k='',U=function(){function e(){o()(this,e),this.words=0,this.prefixes=0,this.children={}}return a()(e,[{key:"insert",value:function(t,r){if(0!=t.length){var i,n=this;void 0===r&&(r=0),r!==t.length?(n.prefixes++,i=t[r],void 0===n.children[i]&&(n.children[i]=new e),n.children[i].insert(t,r+1)):n.words++}}},{key:"remove",value:function(e,t){if(0!=e.length){var r,i=this;void 0===t&&(t=0),void 0!==i&&(t!==e.length?(i.prefixes--,r=e[t],i.children[r].remove(e,t+1)):i.words--)}}},{key:"update",value:function(e,t){0!=e.length&&0!=t.length&&(this.remove(e),this.insert(t))}},{key:"countWord",value:function(e,t){if(0==e.length)return 0;var r,i,n=0;return void 0===t&&(t=0),t===e.length?this.words:(r=e[t],void 0!==(i=this.children[r])&&(n=i.countWord(e,t+1)),n)}},{key:"countPrefix",value:function(e,t){if(0==e.length)return 0;var r,i=0;if(void 0===t&&(t=0),t===e.length)return this.prefixes;var n=e[t];return void 0!==(r=this.children[n])&&(i=r.countPrefix(e,t+1)),i}},{key:"find",value:function(e){return 0!=e.length&&this.countWord(e)>0}},{key:"getAllWords",value:function(e){var t,r,i=this,n=[];if(void 0===e&&(e=""),void 0===i)return[];for(t in i.words>0&&n.push(e),i.children)i.children.hasOwnProperty(t)&&(r=i.children[t],n=n.concat(r.getAllWords(e+t)));return n}},{key:"autoComplete",value:function(e,t){var r,i;return 0==e.length?void 0===t?this.getAllWords(e):[]:(void 0===t&&(t=0),r=e[t],void 0===(i=this.children[r])?[]:t===e.length-1?i.getAllWords(e):i.autoComplete(e,t+1))}}]),e}(),B=r(54);var j=function(e,t,r){var i=-1,n=e.length;t<0&&(t=-t>n?0:n+t),(r=r>n?n:r)<0&&(r+=n),n=t>r?0:r-t>>>0,t>>>=0;for(var o=Array(n);++i=0&&(a+=l.innerText),r[a])continue;if(a.length<=1)continue;if(0!==a.indexOf(t.string))continue;if(a===t.string)continue;r[a]=!0,i.push(a)}}return i.sort()},bulk:!1,autoShow:!0},W=r(97),z=r(60),K=r(52),X=r(90),Y=r(10);var $=function(e,t){var r=-1,i=Object(Y.a)(e)?Array(e.length):[];return Object(X.a)(e,(function(e,n,o){i[++r]=t(e,n,o)})),i};var Q=function(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e},Z=r(45),J=r(17);var ee=function(e,t){if(e!==t){var r=void 0!==e,i=null===e,n=e==e,o=Object(J.a)(e),s=void 0!==t,a=null===t,l=t==t,u=Object(J.a)(t);if(!a&&!u&&!o&&e>t||o&&s&&l&&!a&&!u||i&&s&&l||!r&&l||!n)return 1;if(!i&&!o&&!u&&e=a?l:l*("desc"==r[i]?-1:1)}return e.index-t.index},re=r(25);var ie=function(e,t,r){var i=-1;t=Object(z.a)(t.length?t:[re.a],Object(Z.a)(K.a));var n=$(e,(function(e,r,n){return{criteria:Object(z.a)(t,(function(t){return t(e)})),index:++i,value:e}}));return Q(n,(function(e,t){return te(e,t,r)}))},ne=r(79),oe=r(70),se=Object(ne.a)((function(e,t){if(null==e)return[];var r=t.length;return r>1&&Object(oe.a)(e,t[0],t[1])?t=[]:r>2&&Object(oe.a)(t[0],t[1],t[2])&&(t=[t[0]]),ie(e,Object(W.a)(t,1),[])})),ae={"string-2":"prefixed",atom:"var"},le={postprocessHints:function(e,t){return se(t,(function(e){return e.text.split(":")[0]}))},onInitialize:function(e){var t=this;e.on("change",(function(){var r;if(e.config.autocompleters&&-1!=e.config.autocompleters.indexOf(t.name)){var i=e.getDoc().getCursor(),n=e.getTokenAt(i);if(n.type&&"prefixed"==ae[n.type]){var o=n.string.indexOf(":");if(-1!==o){var s=e.getPreviousNonWsToken(i.line,n).string.toUpperCase(),a=e.getTokenAt({line:i.line,ch:n.start});if("PREFIX"!==s&&("ws"==a.type||null==a.type||"punc"===a.type&&("|"===a.string||"/"===a.string||"^^"==a.string||"{"==a.string||"("===a.string))){var l=n.string.substring(0,o+1);null==e.getPrefixesFromQuery()[l.slice(0,-1)]&&(n.autocompletionString=l,null===(r=e.autocompleters[t.name])||void 0===r||r.getCompletions(n).then((function(t){t.length&&(e.addPrefixes(t[0]),e.autocomplete())}),console.warn))}}}}}))},isValidCompletionPosition:function(e){var t=e.getDoc().getCursor(),r=e.getTokenAt(t);if(e.getDoc().getLine(t.line).length>t.ch)return!1;if("ws"!=r.type&&(r=e.getCompleteToken()),0!==r.string.indexOf("a")&&r.state.possibleCurrent.indexOf("PNAME_NS")<0)return!1;var i=e.getPreviousNonWsToken(t.line,r);return!(!i||"PREFIX"!=i.string.toUpperCase())},get:function(e){return g.get(e.config.prefixCcApi).then((function(e){var t=[];for(var r in e.body){var i=r+": <"+e.body[r]+">";t.push(i)}return t.sort()}))},preProcessToken:function(e,t){var r=e.getPreviousNonWsToken(e.getDoc().getCursor().line,t);return r&&r.string&&":"==r.string.slice(-1)&&(t={start:r.start,end:t.end,string:r.string+" "+t.string,state:t.state,type:t.type}),t},bulk:!0,autoShow:!0,persistenceId:"prefixes",name:"prefixes"},ue={onInitialize:function(e){},get:function(e,t){return ve(e,"property",t)},isValidCompletionPosition:function(e){var t=e.getCompleteToken();return 0!=t.string.length&&("?"!==t.string[0]&&"$"!==t.string[0]&&t.state.possibleCurrent.indexOf("a")>=0)},preProcessToken:function(e,t){return ge(e,t)},postProcessSuggestion:function(e,t,r){return me(e,t,r)},bulk:!1,name:"property"},ce={onInitialize:function(e){},get:function(e,t){return ve(e,"class",t)},isValidCompletionPosition:function(e){var t=e.getCompleteToken();if("?"===t.string[0]||"$"===t.string[0])return!1;var r=e.getDoc().getCursor(),i=e.getPreviousNonWsToken(r.line,t);return"a"===i.state.lastProperty||("rdf:type"===i.state.lastProperty||("rdfs:domain"===i.state.lastProperty||"rdfs:range"===i.state.lastProperty))},preProcessToken:function(e,t){return ge(e,t)},postProcessSuggestion:function(e,t,r){return me(e,t,r)},bulk:!1,name:"class"};function pe(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return de(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return de(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}function de(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r0?(this.storeBulkCompletions(t),Promise.resolve()):this.getCompletions().then((function(t){return e.storeBulkCompletions(t)}))}return Promise.resolve()}},{key:"isValidPosition",value:function(){return!!this.config.isValidCompletionPosition&&(this.config.isValidCompletionPosition(this.yasqe)?(this.config.autoShow||this.yasqe.showNotification(this.config.name,"Press CTRL - to autocomplete"),this.emit("validPosition",this),!0):(this.emit("invalidPosition",this),this.yasqe.hideNotification(this.config.name),!1))}},{key:"getHint",value:function(e,t){var r,i;this.config.postProcessSuggestion&&(t=this.config.postProcessSuggestion(this.yasqe,e,t));var n=this.yasqe.getDoc().getCursor();e.from&&(i=Object.assign(Object.assign({},n),e.from));var o=this.yasqe.getDoc().getCursor().line;return{text:t,displayText:t,from:i,to:e.to?{ch:(null===(r=null==e?void 0:e.to)||void 0===r?void 0:r.ch)||this.yasqe.getCompleteToken().end,line:o}:e.string.length>0?{ch:this.yasqe.getCompleteToken().end,line:o}:e.from}}},{key:"getHints",value:function(e){var t=this;return this.config.preProcessToken&&(e=this.config.preProcessToken(this.yasqe,e)),e?this.getCompletions(e).then((function(r){return r.map((function(r){return t.getHint(e,r)}))})).then((function(e){return t.config.postprocessHints?t.config.postprocessHints(t.yasqe,e):e})):Promise.resolve([])}},{key:"autocomplete",value:function(e){var t=this;if(!this.isValidPosition())return!1;var r=this.yasqe.state.completionActive,i=this.yasqe.getDoc().getCursor();if(r&&i.sticky&&i.ch!==r.startPos.ch?this.yasqe.state.completionActive.startPos=i:r&&!i.sticky&&i.ch"]/,completeSingle:!1,hint:n,container:this.yasqe.rootEl,extraKeys:{Home:function(e,t){e.getDoc().setCursor({ch:0,line:t.data.from.line})},End:function(e,t){e.getDoc().setCursor({ch:e.getLine(t.data.to.line).length,line:t.data.to.line})}}},this.yasqe.config.hintConfig);return this.yasqe.showHint(o),!0}}]),r}(B.EventEmitter);function ge(e,t){var r=e.getPrefixesFromQuery(),i=t.string;if(i.indexOf("<")<0&&(t.tokenPrefix=i.substring(0,i.indexOf(":")+1),null!=r[t.tokenPrefix.slice(0,-1)]&&(t.tokenPrefixUri=r[t.tokenPrefix.slice(0,-1)])),t.autocompletionString=i.trim(),i.indexOf("<")<0&&i.indexOf(":")>-1)for(var n in r)if(t.tokenPrefix===n+":"){t.autocompletionString=r[n],t.autocompletionString+=i.substring(n.length+1);break}return 0==t.autocompletionString.indexOf("<")&&(t.autocompletionString=t.autocompletionString.substring(1)),t.autocompletionString.indexOf(">",t.autocompletionString.length-1)>0&&(t.autocompletionString=t.autocompletionString.substring(0,t.autocompletionString.length-1)),t}function me(e,t,r){return r=t.tokenPrefix&&t.autocompletionString&&t.tokenPrefixUri?t.tokenPrefix+r.substring(t.tokenPrefixUri.length):"<"+r+">"}var ve=function(e,t,r){var i=0===window.location.protocol.indexOf("http")?"https://":"http://",n="autocomplete_"+t;return r&&r.string&&0!=r.string.trim().length?g.get(i+"lov.linkeddata.es/dataset/lov/api/v2/autocomplete/terms").query({q:r.autocompletionString,page_size:50,type:t}).then((function(e){return e.body.results?e.body.results.map((function(e){return e.uri[0]})):[]}),(function(t){e.showNotification(n,"Failed fetching suggestions")})):(e.showNotification(n,"Nothing to autocomplete yet!"),Promise.resolve([]))},xe=[q,le,ue,ce],ye=r(171);var Ne=r(7);r(92),r(99),r(100),r(101),r(162),r(122),r(163),r(102),r(166),r(103),r(167),r(168),Ne.registerHelper("fold","prefix",(function(e,t){var r=t.line,i=e.getDoc().getLine(r);var n=function(t,r){var i=e.getTokenAt(v.a.Pos(t,r+1));if(!i||"keyword"!=i.type)return-1;var n=y(e,t,i.end+1);if(!n||"string-2"!=n.type)return-1;var o=y(e,t,n.end+1);return o&&"variable-3"==o.type?o.end:-1};if(!function(){for(var t=!1,i=r-1;i>=0;i--)if(e.getDoc().getLine(i).toUpperCase().indexOf("PREFIX ")>=0){t=!0;break}return t}()){var o=L(e,r,t.ch,i);if(null!=o){for(var s,a=!1,l=e.getDoc().lastLine(),u=n(r,o),c=r,p=r;p<=l&&!a;++p)for(var d=e.getDoc().getLine(p),h=p==r?o+1:0;;){!a&&d.indexOf("{")>=0&&(a=!0);var f=d.toUpperCase().indexOf("PREFIX ",h);if(!(f>=0))break;(s=n(p,f))>0&&(c=p,h=u=s),h++}return{from:v.a.Pos(r,o+"PREFIX ".length),to:v.a.Pos(c,u)}}}})),Ne.defineMode("sparql11",(function(e){var t=r(161),i=t.table,n="[0-9A-Fa-f]",o="(([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD])(((([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|-|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]))|\\.)*(([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|-|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040])))?)?:",s="[eE][\\+-]?[0-9]+",a="[0-9]*\\.[0-9]+",l="(([0-9]+\\.[0-9]*"+s+")|(\\.[0-9]+"+s+")|([0-9]+"+s+"))",u="\\\\[tbnrf\\\\\"']",c=n+"{4}",p="(\\\\u"+c+"|\\\\U00(10|0"+n+")"+c+")",d={SINGLE:{CAT:"STRING_LITERAL_LONG1",QUOTES:"'''",CONTENTS:"(('|'')?([^'\\\\]|"+u+"|"+p+"))*"},DOUBLE:{CAT:"STRING_LITERAL_LONG2",QUOTES:'"""',CONTENTS:'(("|"")?([^"\\\\]|'+u+"|"+p+"))*"}};for(var h in d)d[h].COMPLETE=d[h].QUOTES+d[h].CONTENTS+d[h].QUOTES;var f={};for(var E in d)f[E]={complete:{name:"STRING_LITERAL_LONG_"+E,regex:new RegExp("^"+d[E].COMPLETE),style:"string"},contents:{name:"STRING_LITERAL_LONG_"+E,regex:new RegExp("^"+d[E].CONTENTS),style:"string"},closing:{name:"STRING_LITERAL_LONG_"+E,regex:new RegExp("^"+d[E].CONTENTS+d[E].QUOTES),style:"string"},quotes:{name:"STRING_LITERAL_LONG_QUOTES_"+E,regex:new RegExp("^"+d[E].QUOTES),style:"string"}};var g="[\\x20\\x09\\x0D\\x0A]",m="#([^\\n\\r]*[\\n\\r]|[^\\n\\r]*$)",v=[{name:"WS",regex:new RegExp("^"+g+"+"),style:"ws"},{name:"COMMENT",regex:new RegExp("^"+m),style:"comment"},{name:"IRI_REF",regex:new RegExp('^<[^<>"`|{}^\\\0- ]*>'),style:"variable-3"},{name:"VAR1",regex:new RegExp("^\\?([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|[0-9])([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040])*"),style:"atom"},{name:"VAR2",regex:new RegExp("^\\$([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|[0-9])([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040])*"),style:"atom"},{name:"LANGTAG",regex:new RegExp("^@[a-zA-Z]+(-[a-zA-Z0-9]+)*"),style:"meta"},{name:"DOUBLE",regex:new RegExp("^"+l),style:"number"},{name:"DECIMAL",regex:new RegExp("^"+a),style:"number"},{name:"INTEGER",regex:new RegExp("^[0-9]+"),style:"number"},{name:"DOUBLE_POSITIVE",regex:new RegExp("^\\+(([0-9]+\\.[0-9]*[eE][\\+-]?[0-9]+)|(\\.[0-9]+[eE][\\+-]?[0-9]+)|([0-9]+[eE][\\+-]?[0-9]+))"),style:"number"},{name:"DECIMAL_POSITIVE",regex:new RegExp("^\\+[0-9]*\\.[0-9]+"),style:"number"},{name:"INTEGER_POSITIVE",regex:new RegExp("^\\+[0-9]+"),style:"number"},{name:"DOUBLE_NEGATIVE",regex:new RegExp("^-(([0-9]+\\.[0-9]*[eE][\\+-]?[0-9]+)|(\\.[0-9]+[eE][\\+-]?[0-9]+)|([0-9]+[eE][\\+-]?[0-9]+))"),style:"number"},{name:"DECIMAL_NEGATIVE",regex:new RegExp("^-[0-9]*\\.[0-9]+"),style:"number"},{name:"INTEGER_NEGATIVE",regex:new RegExp("^-[0-9]+"),style:"number"},{name:"STRING_LITERAL1",regex:new RegExp("^'(([^\\x27\\x5C\\x0A\\x0D])|\\\\[tbnrf\\\\\"']|(\\\\u[0-9A-Fa-f]{4}|\\\\U00(10|0[0-9A-Fa-f])[0-9A-Fa-f]{4}))*'"),style:"string"},{name:"STRING_LITERAL2",regex:new RegExp('^"(([^\\x22\\x5C\\x0A\\x0D])|\\\\[tbnrf\\\\"\']|(\\\\u[0-9A-Fa-f]{4}|\\\\U00(10|0[0-9A-Fa-f])[0-9A-Fa-f]{4}))*"'),style:"string"},{name:"NIL",regex:new RegExp("^\\(([\\x20\\x09\\x0D\\x0A]|(#([^\\n\\r]*[\\n\\r]|[^\\n\\r]*$)))*\\)"),style:"punc"},{name:"ANON",regex:new RegExp("^\\[([\\x20\\x09\\x0D\\x0A]|(#([^\\n\\r]*[\\n\\r]|[^\\n\\r]*$)))*\\]"),style:"punc"},{name:"PNAME_LN",regex:new RegExp("^(([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD])(((([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|-|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]))|\\.)*(([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|-|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040])))?)?:([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|:|[0-9]|((%[0-9A-Fa-f][0-9A-Fa-f])|(\\\\[_~\\.\\-!\\$&'\\(\\)\\*\\+,;=/\\?#@%])))((([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|-|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040])|\\.|:|((%[0-9A-Fa-f][0-9A-Fa-f])|(\\\\[_~\\.\\-!\\$&'\\(\\)\\*\\+,;=/\\?#@%])))*(([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|-|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040])|:|((%[0-9A-Fa-f][0-9A-Fa-f])|(\\\\[_~\\.\\-!\\$&'\\(\\)\\*\\+,;=/\\?#@%]))))?"),style:"string-2"},{name:"PNAME_NS",regex:new RegExp("^"+o),style:"string-2"},{name:"BLANK_NODE_LABEL",regex:new RegExp("^_:([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|[0-9])((([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|-|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040])|\\.)*([A-Za-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]|_|-|[0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]))?"),style:"string-2"}];function x(e){var t=[],r=i[e];if(null!=r)for(var n in r)t.push(n.toString());else t.push(e);return t}function y(e,r){function n(){var t=e.column();r.errorStartPos=t,r.errorEndPos=t+l.string.length}function o(e){if(null==r.queryType)switch(e){case"SELECT":case"CONSTRUCT":case"ASK":case"DESCRIBE":case"INSERT":case"DELETE":case"LOAD":case"CLEAR":case"CREATE":case"DROP":case"COPY":case"MOVE":case"ADD":r.queryType=e}}function s(e){switch(r.inPrefixDecl="prefixDecl"===e,e){case"disallowVars":r.allowVars=!1;break;case"allowVars":r.allowVars=!0;break;case"disallowBnodes":r.allowBnodes=!1;break;case"allowBnodes":r.allowBnodes=!0;break;case"storeProperty":r.storeProperty=!0}}function a(e){return(r.allowVars||"var"!=e)&&(r.allowBnodes||"blankNode"!=e&&"blankNodePropertyList"!=e&&"blankNodePropertyListPath"!=e)}0==e.pos&&(r.possibleCurrent=r.possibleNext);var l=function(){var i;if(r.inLiteral){var n=!1;if((i=e.match(f[r.inLiteral].contents.regex,!0,!1))&&0==i[0].length&&(i=e.match(f[r.inLiteral].closing.regex,!0,!1),n=!0),i&&i[0].length>0){var o={quotePos:n?"end":"content",cat:d[r.inLiteral].CAT,style:f[r.inLiteral].complete.style,string:i[0],start:e.start};return n&&(r.inLiteral=void 0),o}}for(var s in f){var a;if(i=e.match(f[s].quotes.regex,!0,!1))return r.inLiteral?(r.inLiteral=void 0,a="end"):(r.inLiteral=s,a="start"),{cat:d[s].CAT,style:f[s].quotes.style,string:i[0],quotePos:a,start:e.start}}for(var l=0;l",style:"error",string:(i=e.match(/^.[A-Za-z0-9]*/,!0,!1))[0],start:e.start,quotePos:void 0}}();if(""==l.cat)return 1==r.OK&&(r.OK=!1,n()),r.complete=!1,l.style;if("WS"===l.cat||"COMMENT"===l.cat||l.quotePos&&"end"!=l.quotePos)return r.possibleCurrent=r.possibleNext,r.possibleFullIri=!1,l.style;var u,c=!1,p=l.cat;if(r.possibleFullIri&&">"===l.string&&(r.possibleFullIri=!1),r.possibleFullIri||"<"!==l.string||(r.possibleFullIri=!0),!l.quotePos||"end"==l.quotePos)for(;r.stack.length>0&&p&&r.OK&&!c;)if("var"===(u=r.stack.pop())&&l.string&&(r.variables[l.string]=l.string),i[u]){var h=i[u][p];if(null!=h&&a(u)){for(var E=h.length-1;E>=0;--E)r.stack.push(h[E]);s(u)}else r.OK=!1,r.complete=!1,n(),r.stack.push(u)}else if(u==p){r.inPrefixDecl&&("PNAME_NS"===u&&l.string.length>0?r.currentPnameNs=l.string.slice(0,-1):"string"==typeof r.currentPnameNs&&l.string.length>1&&(r.prefixes[r.currentPnameNs]=l.string.slice(1,-1),r.currentPnameNs=void 0)),c=!0,o(u);for(var g=!0,m=r.stack.length;m>0;--m){var y=i[r.stack[m-1]];y&&y.$||(g=!1)}if(r.complete=g,r.storeProperty&&"punc"!=p?(r.lastProperty=l.string,r.lastPropertyIndex=l.start,r.storeProperty=!1):"."!==p&&";"!==p||(r.lastProperty="",r.lastPropertyIndex=0),!r.inPrefixDecl&&("PNAME_NS"===p||"PNAME_LN"===p)){var N=l.string.indexOf(":");if(N>=0){var L=l.string.slice(0,N);void 0===r.prefixes[L]&&(r.OK=!1,n(),r.errorMsg="Prefix '"+L+"' is not defined")}}}else r.OK=!1,r.complete=!1,n();if(!c&&r.OK&&(r.OK=!1,r.complete=!1,n()),r.possibleNext.indexOf("a")>=0)for(var T=e.string,I=l.start;I>=0;I--)if(" "!==T[I-1]){"|"===T[I-1]||"/"===T[I-1]||"punc"===l.style||(r.lastPredicateOffset=l.start);break}return r.possibleCurrent=r.possibleNext,r.possibleNext=x(r.stack[r.stack.length-1]),l.style}var N={"*[,, object]":3,"*[(,),object]":3,"*[(,),objectPath]":3,"*[/,pathEltOrInverse]":2,object:2,objectPath:2,objectList:2,objectListPath:2,storeProperty:2,pathMod:2,"?pathMod":2,propertyListNotEmpty:1,propertyList:1,propertyListPath:1,propertyListPathNotEmpty:1,"?[verb,objectList]":1},L={"}":1,"]":1,")":1,"{":-1,"(":-1,"[":-1};return{token:y,startState:function(){return{tokenize:y,OK:!0,complete:t.acceptEmpty,errorStartPos:void 0,errorEndPos:void 0,queryType:void 0,possibleCurrent:x(t.startSymbol),possibleNext:x(t.startSymbol),allowVars:!0,allowBnodes:!0,storeProperty:!1,lastProperty:"",lastPropertyIndex:0,inLiteral:void 0,stack:[t.startSymbol],lastPredicateOffset:e.indentUnit||2,prefixes:{},variables:{},currentPnameNs:void 0,errorMsg:void 0,inPrefixDecl:!1,possibleFullIri:!1}},indent:function(t,r){var i;if(t.inLiteral)return 0;if(void 0!==t.lastPredicateOffset&&t.stack.length&&"?[or([verbPath,verbSimple]),objectListPath]"==t.stack[t.stack.length-1])return t.lastPredicateOffset;var n=0,o=t.stack.length-1;if(/^[\}\]\)]/.test(r)){for(var s=r.substr(0,1);o>=0;--o)if(t.stack[o]==s){--o;break}}else{var a=N[t.stack[o]];a&&(n+=a,--o)}for(;o>=0;--o){var l=L[t.stack[o]];l&&(n+=l)}return n*(null!==(i=e.indentUnit)&&void 0!==i?i:2)},electricChars:"}])"}}));var Le=Ne;function Te(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return Ie(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ie(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var i=0,n=function(){};return{s:n,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:n}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}function Ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r1&&void 0!==arguments[1]?arguments[1]:{};if(o()(this,r),(i=t.call(this)).autocompleters={},i.prevQueryValid=!1,i.queryValid=!0,i.superagent=g,i.handleHashChange=function(){var e,t;null===(t=(e=i.config).consumeShareLink)||void 0===t||t.call(e,u()(i))},i.notificationEls={},!e)throw new Error("No parent passed as argument. Dont know where to draw YASQE");i.rootEl=document.createElement("div"),i.rootEl.className="yasqe",e.appendChild(i.rootEl),i.config=Object(R.a)({},r.defaults,n);var s,a=Le(i.rootEl,i.config),l=Te(Object.getOwnPropertyNames(r.prototype));try{for(l.s();!(s=l.n()).done;){var c=s.value;a[c]=r.prototype[c].bind(u()(i))}}catch(e){l.e(e)}finally{l.f()}Object.assign(u()(i),Le.prototype,a),i.storage=new I.a(r.storageNamespace),i.drawButtons();var p=i.getStorageId();if(p){var d=i.storage.get(p);i.persistentConfig=d&&"string"==typeof d?{query:d,editorHeight:i.config.editorHeight}:d,i.persistentConfig||(i.persistentConfig={query:i.getValue(),editorHeight:i.config.editorHeight}),i.persistentConfig&&i.persistentConfig.query&&i.setValue(i.persistentConfig.query)}return i.config.autocompleters.forEach((function(e){return i.enableCompleter(e).then((function(){}),console.warn)})),i.config.consumeShareLink&&(i.config.consumeShareLink(u()(i)),window.addEventListener("hashchange",i.handleHashChange)),i.checkSyntax(),i.persistentConfig&&i.persistentConfig.editorHeight?i.getWrapperElement().style.height=i.persistentConfig.editorHeight:i.config.editorHeight&&(i.getWrapperElement().style.height=i.config.editorHeight),i.config.resizeable&&i.drawResizer(),i.config.collapsePrefixesOnLoad&&i.collapsePrefixes(!0),i.registerEventListeners(),i}return a()(r,[{key:"handleChange",value:function(){this.checkSyntax(),this.updateQueryButton()}},{key:"handleBlur",value:function(){this.saveQuery()}},{key:"handleChanges",value:function(){this.checkSyntax(),this.updateQueryButton()}},{key:"handleCursorActivity",value:function(){this.autocomplete(!0)}},{key:"handleQuery",value:function(e,t){this.req=t,this.updateQueryButton()}},{key:"handleQueryResponse",value:function(e,t,r){this.lastQueryDuration=r,this.req=void 0,this.updateQueryButton()}},{key:"handleQueryAbort",value:function(e,t){this.req=void 0,this.updateQueryButton()}},{key:"registerEventListeners",value:function(){this.on("change",this.handleChange),this.on("blur",this.handleBlur),this.on("changes",this.handleChanges),this.on("cursorActivity",this.handleCursorActivity),this.on("query",this.handleQuery),this.on("queryResponse",this.handleQueryResponse),this.on("queryAbort",this.handleQueryAbort)}},{key:"unregisterEventListeners",value:function(){this.off("change",this.handleChange),this.off("blur",this.handleBlur),this.off("changes",this.handleChanges),this.off("cursorActivity",this.handleCursorActivity),this.off("query",this.handleQuery),this.off("queryResponse",this.handleQueryResponse),this.off("queryAbort",this.handleQueryAbort)}},{key:"emit",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i'),a=document.createElement("button");a.className="yasqe_share",a.title="Share query",a.setAttribute("aria-label","Share query"),a.appendChild(s),t.appendChild(a),a.addEventListener("click",(function(e){return l(e)})),a.addEventListener("keydown",(function(e){"Enter"===e.code&&l(e)}));var l=function(r){r.stopPropagation();var i=document.createElement("div");i.className="yasqe_sharePopup",t.appendChild(i),document.body.addEventListener("click",(function(e){i&&e.target!==i&&!i.contains(e.target)&&(i.remove(),i=void 0)}),!0);var n=document.createElement("input");n.type="text",n.value=e.config.createShareableLink(e),n.onfocus=function(){n.select()},n.onmouseup=function(){return!1},i.innerHTML="";var o=document.createElement("div");o.className="inputWrapper",o.appendChild(n),i.appendChild(o);var a=[],l=e.config.createShortLink;if(l){i.className=i.className+=" enableShort";var u=document.createElement("button");a.push(u),u.innerHTML="Shorten",u.className="yasqe_btn yasqe_btn-sm shorten",i.appendChild(u),u.onclick=function(){a.forEach((function(e){return e.disabled=!0})),l(e,n.value).then((function(e){n.value=e,n.focus()}),(function(e){var t=document.createElement("span");t.className="shortlinkErr";var r="An error has occurred";"string"==typeof e&&0!==e.length?r=e:e.message&&0!==e.message.length&&(r=e.message),t.textContent=r,n.replaceWith(t)}))}}var c=document.createElement("button");a.push(c),c.innerText="cURL",c.className="yasqe_btn yasqe_btn-sm curl",i.appendChild(c),c.onclick=function(){a.forEach((function(e){return e.disabled=!0})),n.value=e.getAsCurlString(),n.focus(),null==i||i.appendChild(c)};var p=s.getBoundingClientRect();i.style.top=s.offsetTop+p.height+"px",i.style.left=s.offsetLeft+s.clientWidth-i.clientWidth+"px",n.focus()}}if(this.config.showQueryButton){this.queryBtn=document.createElement("button"),Object(I.b)(this.queryBtn,"yasqe_queryButton");var u=Object(I.d)('');Object(I.b)(u,"queryIcon"),this.queryBtn.appendChild(u);var c=Object(I.d)(k);Object(I.b)(c,"warningIcon"),this.queryBtn.appendChild(c),this.queryBtn.onclick=function(){e.config.queryingDisabled||(e.req?e.abortQuery():e.query().catch((function(){})))},this.queryBtn.title="Run query",this.queryBtn.setAttribute("aria-label","Run query"),t.appendChild(this.queryBtn),this.updateQueryButton()}}},{key:"drawResizer",value:function(){if(!this.resizeWrapper){this.resizeWrapper=document.createElement("div"),Object(I.b)(this.resizeWrapper,"resizeWrapper");var e=document.createElement("div");Object(I.b)(e,"resizeChip"),this.resizeWrapper.appendChild(e),this.resizeWrapper.addEventListener("mousedown",this.initDrag,!1),this.resizeWrapper.addEventListener("dblclick",this.expandEditor),this.rootEl.appendChild(this.resizeWrapper)}}},{key:"initDrag",value:function(){document.documentElement.addEventListener("mousemove",this.doDrag,!1),document.documentElement.addEventListener("mouseup",this.stopDrag,!1)}},{key:"calculateDragOffset",value:function(e,t){var r=0;t.offsetParent&&(r=t.offsetParent.offsetTop);for(var i=0,n=t.parentElement;n;)i+=n.scrollTop,n=n.parentElement;return e.clientY-r-this.rootEl.offsetTop+i}},{key:"doDrag",value:function(e){this.getWrapperElement().style.height=this.calculateDragOffset(e,this.rootEl)+"px"}},{key:"stopDrag",value:function(){document.documentElement.removeEventListener("mousemove",this.doDrag,!1),document.documentElement.removeEventListener("mouseup",this.stopDrag,!1),this.emit("resize",this.getWrapperElement().style.height),this.getStorageId()&&this.persistentConfig&&(this.persistentConfig.editorHeight=this.getWrapperElement().style.height,this.saveQuery()),this.refresh()}},{key:"duplicateLine",value:function(){var e=this.getDoc().getCursor();if(e){var t=this.getDoc().getLine(e.line);this.getDoc().replaceRange(t+"\n"+t,{ch:0,line:e.line},{ch:t.length,line:e.line})}}},{key:"updateQueryButton",value:function(e){this.queryBtn&&(this.config.queryingDisabled?(Object(I.b)(this.queryBtn,"query_disabled"),this.queryBtn.title=this.config.queryingDisabled):(Object(I.g)(this.queryBtn,"query_disabled"),this.queryBtn.title="Run query",this.queryBtn.setAttribute("aria-label","Run query")),e||(e=this.queryValid?"valid":"error"),e!=this.queryStatus&&(Object(I.g)(this.queryBtn,"query_"+this.queryStatus),Object(I.b)(this.queryBtn,"query_"+e),this.queryStatus=e),this.req&&this.queryBtn.className.indexOf("busy")<0&&(this.queryBtn.className=this.queryBtn.className+=" busy"),!this.req&&this.queryBtn.className.indexOf("busy")>=0&&(this.queryBtn.className=this.queryBtn.className.replace("busy","")))}},{key:"handleLocalStorageQuotaFull",value:function(e){console.warn("Localstorage quota exceeded. Clearing all queries"),r.clearStorage()}},{key:"saveQuery",value:function(){var e=this.getStorageId();e&&this.persistentConfig&&(this.persistentConfig.query=this.getValue(),this.storage.set(e,this.persistentConfig,this.config.persistencyExpire,this.handleLocalStorageQuotaFull))}},{key:"getQueryType",value:function(){return this.getOption("queryType")}},{key:"getQueryMode",value:function(){switch(this.getQueryType()){case"INSERT":case"DELETE":case"LOAD":case"CLEAR":case"CREATE":case"DROP":case"COPY":case"MOVE":case"ADD":return"update";default:return"query"}}},{key:"getVariablesFromQuery",value:function(){var e=this.getTokenAt({line:this.getDoc().lastLine(),ch:this.getDoc().getLine(this.getDoc().lastLine()).length},!0),t=[];for(var r in e.state.variables)t.push(r);return t.sort()}},{key:"autoformatSelection",value:function(e,t){var i=this.getValue();return i=i.substring(e,t),r.autoformatString(i)}},{key:"commentLines",value:function(){for(var e=this.getDoc().getCursor("start").line,t=this.getDoc().getCursor("end").line,r=Math.min(e,t),i=Math.max(e,t),n=!0,o=r;o<=i;o++){var s=this.getDoc().getLine(o);if(0==s.length||"#"!=s.substring(0,1)){n=!1;break}}for(o=r;o<=i;o++)n?this.getDoc().replaceRange("",{line:o,ch:0},{line:o,ch:1}):this.getDoc().replaceRange("#",{line:o,ch:0})}},{key:"autoformat",value:function(){var e=this;this.getDoc().somethingSelected()||this.execCommand("selectAll");var t=this.getDoc().getCursor("start"),r={line:this.getDoc().getCursor("end").line,ch:this.getDoc().getSelection().length},i=this.getDoc().indexFromPos(t),n=this.getDoc().indexFromPos(r),o=this.autoformatSelection(i,n);this.operation((function(){e.getDoc().replaceRange(o,t,r);for(var n=e.getDoc().posFromIndex(i).line,s=e.getDoc().posFromIndex(i+o.length).line,a=n;a<=s;a++)e.indentLine(a,"smart")}))}},{key:"getQueryWithValues",value:function(e){if(!e)return this.getValue();var t;if("string"==typeof e)t=e;else{e instanceof Array||(e=[e]);var i=e.reduce((function(e,t){for(var r in t)e[r]=r;return e}),{}),n=[];for(var o in i)n.push(o);if(!n.length)return this.getValue();t="VALUES ("+n.join(" ")+") {\n",e.forEach((function(e){t+="( ",n.forEach((function(r){t+=e[r]||"UNDEF"})),t+=" )\n"})),t+="}\n"}if(!t)return this.getValue();var s="",a=!1,l=!1;return r.runMode(this.getValue(),"sparql11",(function(e,r,i,n,o){"keyword"===r&&"select"===e.toLowerCase()&&(l=!0),s+=e,l&&!a&&"punc"===r&&"{"===e&&(a=!0,s+="\n"+t)})),s}},{key:"getValueWithoutComments",value:function(){var e="";return r.runMode(this.getValue(),"sparql11",(function(t,r){"comment"!=r&&(e+=t)})),e}},{key:"setCheckSyntaxErrors",value:function(e){this.config.syntaxErrorCheck=e,this.checkSyntax()}},{key:"checkSyntax",value:function(){this.queryValid=!0,this.clearGutter("gutterErrorBar");for(var e=0;e0){var l=[];i.possibleCurrent.forEach((function(e){l.push(""+Object(ye.a)(e)+"")})),A(0,a,"This line is invalid. Expected: "+l.join(", "))}a.className="parseErrorIcon",this.setGutterMarker(e,"gutterErrorBar",a),this.queryValid=!1;break}}}},{key:"getCompleteToken",value:function(e,t){return x(this,e,t)}},{key:"getPreviousNonWsToken",value:function(e,t){return function e(t,r,i){var n=t.getTokenAt({line:r,ch:i.start});return null!=n&&"ws"==n.type&&(n=e(t,r,n)),n}(this,e,t)}},{key:"getNextNonWsToken",value:function(e,t){return y(this,e,t)}},{key:"showNotification",value:function(e,t){if(!this.notificationEls[e]){var r=document.createElement("div");Object(I.b)(r,"notificationContainer"),this.getWrapperElement().appendChild(r),this.notificationEls[e]=document.createElement("div"),Object(I.b)(this.notificationEls[e],"notification","notif_"+e),r.appendChild(this.notificationEls[e])}for(var i in this.notificationEls)i!==e&&this.hideNotification(i);var n=this.notificationEls[e];Object(I.b)(n,"active"),n.innerText=t}},{key:"hideNotification",value:function(e){this.notificationEls[e]&&Object(I.g)(this.notificationEls[e],"active")}},{key:"enableCompleter",value:function(e){return r.Autocompleters[e]?(this.config.autocompleters.indexOf(e)<0&&this.config.autocompleters.push(e),(this.autocompleters[e]=new Ee(this,r.Autocompleters[e])).initialize()):Promise.reject(new Error("Autocompleter "+e+" is not a registered autocompleter"))}},{key:"disableCompleter",value:function(e){this.config.autocompleters=this.config.autocompleters.filter((function(t){return t!==e})),this.autocompleters[e]=void 0}},{key:"autocomplete",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.getDoc().somethingSelected())for(var t in this.config.autocompleters){var r=this.autocompleters[this.config.autocompleters[t]];r&&r.autocomplete(e)}}},{key:"collapsePrefixes",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=N(this);void 0!==t&&this.foldCode(t,Le.fold.prefix,e?"fold":"unfold")}},{key:"getPrefixesFromQuery",value:function(){return(e=this).getTokenAt({line:e.getDoc().lastLine(),ch:e.getDoc().getLine(e.getDoc().lastLine()).length},!0).state.prefixes;var e}},{key:"addPrefixes",value:function(e){return function(e,t){var r=e.getPrefixesFromQuery();if("string"==typeof t)T(e,t);else for(var i in t)i in r||T(e,i+": <"+t[i]+">");e.collapsePrefixes(!1)}(this,e)}},{key:"removePrefixes",value:function(e){return function(e,t){for(var r in t)e.setValue(e.getValue().replace(new RegExp("PREFIX\\s*"+r+":\\s*"+(("<"+t[r]+">").replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+"\\s*"),"ig"),""));e.collapsePrefixes(!1)}(this,e)}},{key:"updateWidget",value:function(){if(this.cursorCoords&&this.state.completionActive&&this.state.completionActive.widget){var e=this.cursorCoords(null).bottom;this.state.completionActive.widget.hints.style.top=e+"px"}}},{key:"query",value:function(e){return this.config.queryingDisabled?Promise.reject("Querying is disabled."):(this.abortQuery(),w(this,e))}},{key:"getUrlParams",value:function(){var e={};return window.location.hash.length>1&&(e=S.parse(location.hash)),e&&"query"in e||!(window.location.search.length>1)||(e=S.parse(window.location.search)),e}},{key:"configToQueryParams",value:function(){var e={};return window.location.hash.length>1&&(e=S.parse(window.location.hash)),e.query=this.getValue(),e}},{key:"queryParamsToConfig",value:function(e){e&&e.query&&"string"==typeof e.query&&this.setValue(e.query)}},{key:"getAsCurlString",value:function(e){return G(this,e)}},{key:"abortQuery",value:function(){this.req&&(this.req.abort(),this.emit("queryAbort",this,this.req))}},{key:"expandEditor",value:function(){this.setSize(null,"100%")}},{key:"destroy",value:function(){var e,t;for(var r in this.abortQuery(),this.unregisterEventListeners(),null===(e=this.resizeWrapper)||void 0===e||e.removeEventListener("mousedown",this.initDrag,!1),null===(t=this.resizeWrapper)||void 0===t||t.removeEventListener("dblclick",this.expandEditor),this.autocompleters)this.disableCompleter(r);window.removeEventListener("hashchange",this.handleHashChange),this.rootEl.remove()}}],[{key:"autoformatString",value:function(e){var t=[["keyword","ws","string-2","ws","variable-3"],["keyword","ws","variable-3"]],i=["}"],n="",o="",s=[];return r.runMode(e,"sparql11",(function(e,r){s.push(r);var a=function(e){if("{"===e)return 1;if("."===e)return 1;if(";"===e)return s.length>2&&"punc"===s[s.length-2]?0:1;for(var r=0;r1&&void 0!==arguments[1])||arguments[1],i=e.name;r.Autocompleters[i]=e,t&&r.defaults.autocompleters.indexOf(i)<0&&r.defaults.autocompleters.push(i)}},{key:"forkAutocompleter",value:function(e,t){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!r.Autocompleters[e])throw new Error("Autocompleter "+e+" does not exist");if(!(null==t?void 0:t.name))throw new Error("Expected a name for newly registered autocompleter");var n=t.name;r.Autocompleters[n]=Object.assign(Object.assign({},r.Autocompleters[e]),t),i&&r.defaults.autocompleters.indexOf(n)<0&&r.defaults.autocompleters.push(n)}}]),r}(Le);Re.storageNamespace="triply",Re.Sparql=i,Re.runMode=Le.runMode,Re.Autocompleters={},Re.defaults=(Ae=(0===window.location.protocol.indexOf("http")?"//":"http://")+"prefix.cc/popular/all.file.json",Ce=r(7),be={mode:"sparql11",value:"PREFIX rdf: \nPREFIX rdfs: \nSELECT * WHERE {\n ?sub ?pred ?obj .\n} LIMIT 10",highlightSelectionMatches:{showToken:/\w/},tabMode:"indent",lineNumbers:!0,lineWrapping:!0,foldGutter:{rangeFinder:new Ce.fold.combine(Ce.fold.brace,Ce.fold.prefix)},collapsePrefixesOnLoad:!1,gutters:["gutterErrorBar","CodeMirror-linenumbers","CodeMirror-foldgutter"],matchBrackets:!0,fixedGutter:!0,syntaxErrorCheck:!0,autocompleters:[],extraKeys:{"Ctrl-Space":function(e){e.autocomplete()},"Shift-Ctrl-K":function(e){var t=e,r=t.getDoc().getCursor().line;return r===t.getDoc().lastLine()&&r>1?t.getDoc().replaceRange("",{ch:t.getDoc().getLine(r-1).length,line:r-1},{ch:t.getDoc().getLine(r).length,line:r}):t.getDoc().replaceRange("",{ch:0,line:r},{ch:0,line:r+1})},"Ctrl-/":function(e){e.commentLines()},"Shift-Ctrl-D":function(e){e.duplicateLine()},"Shift-Ctrl-F":function(e){e.autoformat()},"Ctrl-S":function(e){e.saveQuery()},"Cmd-Enter":function(e){e.query().catch((function(){}))},"Ctrl-Enter":function(e){e.query().catch((function(){}))},Esc:function(e){e.getInputField().blur()}},createShareableLink:function(e){return document.location.protocol+"//"+document.location.host+document.location.pathname+document.location.search+"#"+S.stringify(e.configToQueryParams())},pluginButtons:void 0,createShortLink:void 0,consumeShareLink:function(e){e.queryParamsToConfig(e.getUrlParams())},persistenceId:function(e){var t="",r=e.rootEl;for(r.id&&(t=r.id);r&&r!==document;r=r.parentNode)if(r){r.id&&(t=r.id);break}return"yasqe_"+t+"_query"},persistencyExpire:2592e3,showQueryButton:!0,hintConfig:{},resizeable:!0,editorHeight:"300px",queryingDisabled:void 0,prefixCcApi:Ae},Oe={queryArgument:void 0,endpoint:"https://dbpedia.org/sparql",method:"POST",acceptHeaderGraph:"application/n-triples,*/*;q=0.9",acceptHeaderSelect:"application/sparql-results+json,*/*;q=0.9",acceptHeaderUpdate:"text/plain,*/*;q=0.9",namedGraphs:[],defaultGraphs:[],args:[],headers:{},withCredentials:!1,adjustQueryBeforeRequest:!1},Object.assign(Object.assign({},be),{requestConfig:Oe})),Object.assign(Le.prototype,Re.prototype),xe.forEach((function(e){Re.registerAutocompleter(e)}));t.default=Re},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t,r){"use strict";t.a=function(e){var t=-1,r=Array(e.size);return e.forEach((function(e,i){r[++t]=[i,e]})),r}},function(e,t,r){"use strict";var i=r(79),n=r(70);t.a=function(e){return Object(i.a)((function(t,r){var i=-1,o=r.length,s=o>1?r[o-1]:void 0,a=o>2?r[2]:void 0;for(s=e.length>3&&"function"==typeof s?(o--,s):void 0,a&&Object(n.a)(r[0],r[1],a)&&(s=o<3?void 0:s,o=1),t=Object(t);++i0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(s);t.a=l},function(e,t,r){"use strict";var i=r(66),n=r(10);var o=function(e,t){return function(r,i){if(null==r)return r;if(!Object(n.a)(r))return e(r,i);for(var o=r.length,s=t?o:-1,a=Object(r);(t?s--:++st.firstLine();)r=e.Pos(r.line-1,0),u=l(!1);if(u&&!u.cleared&&"unfold"!==o){var c=function(e,t,r){var n=i(e,t,"widget");if("function"==typeof n&&(n=n(r.from,r.to)),"string"==typeof n){var o=document.createTextNode(n);(n=document.createElement("span")).appendChild(o),n.className="CodeMirror-foldmarker"}else n&&(n=n.cloneNode(!0));return n}(t,n,u);e.on(c,"mousedown",(function(t){p.clear(),e.e_preventDefault(t)}));var p=t.markText(u.from,u.to,{replacedWith:c,clearOnEnter:i(t,n,"clearOnEnter"),__isFold:!0});p.on("clear",(function(r,i){e.signal(t,"unfold",t,r,i)})),e.signal(t,"fold",t,u.from,u.to)}}e.newFoldFunction=function(e,r){return function(i,n){t(i,n,{rangeFinder:e,widget:r})}},e.defineExtension("foldCode",(function(e,r,i){t(this,e,r,i)})),e.defineExtension("isFolded",(function(e){for(var t=this.findMarksAt(e),r=0;r0&&n(c)?r>1?e(c,r-1,n,o,s):Object(i.a)(s,c):o||(s[s.length]=c)}return s}},,function(e,t,r){!function(e){"use strict";e.defineOption("foldGutter",!1,(function(t,i,n){var o;n&&n!=e.Init&&(t.clearGutter(t.state.foldGutter.options.gutter),t.state.foldGutter=null,t.off("gutterClick",l),t.off("changes",u),t.off("viewportChange",c),t.off("fold",p),t.off("unfold",p),t.off("swapDoc",u)),i&&(t.state.foldGutter=new r((!0===(o=i)&&(o={}),null==o.gutter&&(o.gutter="CodeMirror-foldgutter"),null==o.indicatorOpen&&(o.indicatorOpen="CodeMirror-foldgutter-open"),null==o.indicatorFolded&&(o.indicatorFolded="CodeMirror-foldgutter-folded"),o)),a(t),t.on("gutterClick",l),t.on("changes",u),t.on("viewportChange",c),t.on("fold",p),t.on("unfold",p),t.on("swapDoc",u))}));var t=e.Pos;function r(e){this.options=e,this.from=this.to=0}function i(e,r){for(var i=e.findMarks(t(r,0),t(r+1,0)),n=0;n=u){if(d&&s&&d.test(s.className))return;o=n(a.indicatorOpen)}}(o||s)&&e.setGutterMarker(r,a.gutter,o)}))}function s(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function a(e){var t=e.getViewport(),r=e.state.foldGutter;r&&(e.operation((function(){o(e,t.from,t.to)})),r.from=t.from,r.to=t.to)}function l(e,r,n){var o=e.state.foldGutter;if(o){var s=o.options;if(n==s.gutter){var a=i(e,r);a?a.clear():e.foldCode(t(r,0),s)}}}function u(e){var t=e.state.foldGutter;if(t){var r=t.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout((function(){a(e)}),r.foldOnChangeTimeSpan||600)}}function c(e){var t=e.state.foldGutter;if(t){var r=t.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout((function(){var r=e.getViewport();t.from==t.to||r.from-t.to>20||t.from-r.to>20?a(e):e.operation((function(){r.fromt.to&&(o(e,t.to,r.to),t.to=r.to)}))}),r.updateViewportTimeSpan||400)}}function p(e,t){var r=e.state.foldGutter;if(r){var i=t.line;i>=r.from&&i=e.max))return e.ch=0,e.text=e.cm.getLine(++e.line),!0}function l(e){if(!(e.line<=e.min))return e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0}function u(e){for(;;){var t=e.text.indexOf(">",e.ch);if(-1==t){if(a(e))continue;return}if(s(e,t+1)){var r=e.text.lastIndexOf("/",t),i=r>-1&&!/\S/.test(e.text.slice(r+1,t));return e.ch=t+1,i?"selfClose":"regular"}e.ch=t+1}}function c(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==t){if(l(e))continue;return}if(s(e,t+1)){n.lastIndex=t,e.ch=t;var r=n.exec(e.text);if(r&&r.index==t)return r}else e.ch=t}}function p(e){for(;;){n.lastIndex=e.ch;var t=n.exec(e.text);if(!t){if(a(e))continue;return}if(s(e,t.index+1))return e.ch=t.index+t[0].length,t;e.ch=t.index+1}}function d(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==t){if(l(e))continue;return}if(s(e,t+1)){var r=e.text.lastIndexOf("/",t),i=r>-1&&!/\S/.test(e.text.slice(r+1,t));return e.ch=t+1,i?"selfClose":"regular"}e.ch=t}}function h(e,r){for(var i=[];;){var n,o=p(e),s=e.line,a=e.ch-(o?o[0].length:0);if(!o||!(n=u(e)))return;if("selfClose"!=n)if(o[1]){for(var l=i.length-1;l>=0;--l)if(i[l]==o[2]){i.length=l;break}if(l<0&&(!r||r==o[2]))return{tag:o[2],from:t(s,a),to:t(e.line,e.ch)}}else i.push(o[2])}}function f(e,r){for(var i=[];;){var n=d(e);if(!n)return;if("selfClose"!=n){var o=e.line,s=e.ch,a=c(e);if(!a)return;if(a[1])i.push(a[2]);else{for(var l=i.length-1;l>=0;--l)if(i[l]==a[2]){i.length=l;break}if(l<0&&(!r||r==a[2]))return{tag:a[2],from:t(e.line,e.ch),to:t(o,s)}}}else c(e)}}e.registerHelper("fold","xml",(function(e,i){for(var n=new o(e,i.line,0);;){var s=p(n);if(!s||n.line!=i.line)return;var a=u(n);if(!a)return;if(!s[1]&&"selfClose"!=a){var l=t(n.line,n.ch),c=h(n,s[2]);return c&&r(c.from,l)>0?{from:l,to:c.from}:null}}})),e.findMatchingTag=function(e,i,n){var s=new o(e,i.line,i.ch,n);if(-1!=s.text.indexOf(">")||-1!=s.text.indexOf("<")){var a=u(s),l=a&&t(s.line,s.ch),p=a&&c(s);if(a&&p&&!(r(s,i)>0)){var d={from:t(s.line,s.ch),to:l,tag:p[2]};return"selfClose"==a?{open:d,close:null,at:"open"}:p[1]?{open:f(s,p[2]),close:d,at:"close"}:{open:d,close:h(s=new o(e,l.line,l.ch,n),p[2]),at:"open"}}}},e.findEnclosingTag=function(e,t,r,i){for(var n=new o(e,t.line,t.ch,r);;){var s=f(n,i);if(!s)break;var a=h(new o(e,t.line,t.ch,r),s.tag);if(a)return{open:s,close:a}}},e.scanForClosingTag=function(e,t,r,i){return h(new o(e,t.line,t.ch,i?{from:0,to:i}:null),r)}}(r(7))},function(e,t,r){!function(e){"use strict";e.registerHelper("fold","brace",(function(t,r){var i,n=r.line,o=t.getLine(n);function s(s){for(var a=r.ch,l=0;;){var u=a<=0?-1:o.lastIndexOf(s,a-1);if(-1!=u){if(1==l&&ut.lastLine())return null;var i=t.getTokenAt(e.Pos(r,1));if(/\S/.test(i.string)||(i=t.getTokenAt(e.Pos(r,i.end+1))),"keyword"!=i.type||"import"!=i.string)return null;for(var n=r,o=Math.min(t.lastLine(),r+10);n<=o;++n){var s=t.getLine(n).indexOf(";");if(-1!=s)return{startCh:i.end,end:e.Pos(n,s)}}}var n,o=r.line,s=i(o);if(!s||i(o-1)||(n=i(o-2))&&n.end.line==o-1)return null;for(var a=s.end;;){var l=i(a.line+1);if(null==l)break;a=l.end}return{from:t.clipPos(e.Pos(o,s.startCh+1)),to:a}})),e.registerHelper("fold","include",(function(t,r){function i(r){if(rt.lastLine())return null;var i=t.getTokenAt(e.Pos(r,1));return/\S/.test(i.string)||(i=t.getTokenAt(e.Pos(r,i.end+1))),"meta"==i.type&&"#include"==i.string.slice(0,8)?i.start+8:void 0}var n=r.line,o=i(n);if(null==o||null!=i(n-1))return null;for(var s=n;null!=i(s+1);)++s;return{from:e.Pos(n,o+1),to:t.clipPos(e.Pos(s))}}))}(r(7))},function(e,t,r){!function(e){var t=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),r=e.Pos,i={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function n(e){return e&&e.bracketRegex||/[(){}[\]]/}function o(e,t,o){var a=e.getLineHandle(t.line),l=t.ch-1,u=o&&o.afterCursor;null==u&&(u=/(^| )cm-fat-cursor($| )/.test(e.getWrapperElement().className));var c=n(o),p=!u&&l>=0&&c.test(a.text.charAt(l))&&i[a.text.charAt(l)]||c.test(a.text.charAt(l+1))&&i[a.text.charAt(++l)];if(!p)return null;var d=">"==p.charAt(1)?1:-1;if(o&&o.strict&&d>0!=(l==t.ch))return null;var h=e.getTokenTypeAt(r(t.line,l+1)),f=s(e,r(t.line,l+(d>0?1:0)),d,h||null,o);return null==f?null:{from:r(t.line,l),to:f&&f.pos,match:f&&f.ch==p.charAt(0),forward:d>0}}function s(e,t,o,s,a){for(var l=a&&a.maxScanLineLength||1e4,u=a&&a.maxScanLines||1e3,c=[],p=n(a),d=o>0?Math.min(t.line+u,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-u),h=t.line;h!=d;h+=o){var f=e.getLine(h);if(f){var E=o>0?0:f.length-1,g=o>0?f.length:-1;if(!(f.length>l))for(h==t.line&&(E=t.ch-(o<0?1:0));E!=g;E+=o){var m=f.charAt(E);if(p.test(m)&&(void 0===s||e.getTokenTypeAt(r(h,E+1))==s)){var v=i[m];if(v&&">"==v.charAt(1)==o>0)c.push(m);else{if(!c.length)return{pos:r(h,E),ch:m};c.pop()}}}}}return h-o!=(o>0?e.lastLine():e.firstLine())&&null}function a(e,i,n){for(var s=e.state.matchBrackets.maxHighlightLineLength||1e3,a=[],l=e.listSelections(),u=0;u=0;--n){var o=this.tryEntries[n],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var a=r.call(o,"catchLoc"),l=r.call(o,"finallyLoc");if(a&&l){if(this.prev=0;--i){var n=this.tryEntries[i];if(n.tryLoc<=this.prev&&r.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),N(r),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var i=r.completion;if("throw"===i.type){var n=i.arg;N(r)}return n}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:T(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}},e}(e.exports);try{regeneratorRuntime=i}catch(e){Function("r","regeneratorRuntime = r")(i)}},function(e,t,r){var i=r(107),n=r(108),o=[r(115)];e.exports=i.createStore(n,o)},function(e,t,r){var i=r(40),n=i.slice,o=i.pluck,s=i.each,a=i.bind,l=i.create,u=i.isList,c=i.isFunction,p=i.isObject;e.exports={createStore:h};var d={version:"2.0.12",enabled:!1,get:function(e,t){var r=this.storage.read(this._namespacePrefix+e);return this._deserialize(r,t)},set:function(e,t){return void 0===t?this.remove(e):(this.storage.write(this._namespacePrefix+e,this._serialize(t)),t)},remove:function(e){this.storage.remove(this._namespacePrefix+e)},each:function(e){var t=this;this.storage.each((function(r,i){e.call(t,t._deserialize(r),(i||"").replace(t._namespaceRegexp,""))}))},clearAll:function(){this.storage.clearAll()},hasNamespace:function(e){return this._namespacePrefix=="__storejs_"+e+"_"},createStore:function(){return h.apply(this,arguments)},addPlugin:function(e){this._addPlugin(e)},namespace:function(e){return h(this.storage,this.plugins,e)}};function h(e,t,r){r||(r=""),e&&!u(e)&&(e=[e]),t&&!u(t)&&(t=[t]);var i=r?"__storejs_"+r+"_":"",h=r?new RegExp("^"+i):null;if(!/^[a-zA-Z0-9_\-]*$/.test(r))throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes");var f=l({_namespacePrefix:i,_namespaceRegexp:h,_testStorage:function(e){try{var t="__storejs__test__";e.write(t,t);var r=e.read(t)===t;return e.remove(t),r}catch(e){return!1}},_assignPluginFnProp:function(e,t){var r=this[t];this[t]=function(){var t=n(arguments,0),i=this;function o(){if(r)return s(arguments,(function(e,r){t[r]=e})),r.apply(i,t)}var a=[o].concat(t);return e.apply(i,a)}},_serialize:function(e){return JSON.stringify(e)},_deserialize:function(e,t){if(!e)return t;var r="";try{r=JSON.parse(e)}catch(t){r=e}return void 0!==r?r:t},_addStorage:function(e){this.enabled||this._testStorage(e)&&(this.storage=e,this.enabled=!0)},_addPlugin:function(e){var t=this;if(u(e))s(e,(function(e){t._addPlugin(e)}));else if(!o(this.plugins,(function(t){return e===t}))){if(this.plugins.push(e),!c(e))throw new Error("Plugins must be function values that return objects");var r=e.call(this);if(!p(r))throw new Error("Plugins must return an object of function properties");s(r,(function(r,i){if(!c(r))throw new Error("Bad plugin property: "+i+" from plugin "+e.name+". Plugins should only return functions.");t._assignPluginFnProp(r,i)}))}},addStorage:function(e){!function(){var e="undefined"==typeof console?null:console;if(e){var t=e.warn?e.warn:e.log;t.apply(e,arguments)}}("store.addStorage(storage) is deprecated. Use createStore([storages])"),this._addStorage(e)}},d,{plugins:[]});return f.raw={},s(f,(function(e,t){c(e)&&(f.raw[t]=a(f,e))})),s(e,(function(e){f._addStorage(e)})),s(t,(function(e){f._addPlugin(e)})),f}},function(e,t,r){e.exports=[r(109),r(110),r(111),r(112),r(113),r(114)]},function(e,t,r){var i=r(40).Global;function n(){return i.localStorage}function o(e){return n().getItem(e)}e.exports={name:"localStorage",read:o,write:function(e,t){return n().setItem(e,t)},each:function(e){for(var t=n().length-1;t>=0;t--){var r=n().key(t);e(o(r),r)}},remove:function(e){return n().removeItem(e)},clearAll:function(){return n().clear()}}},function(e,t,r){var i=r(40).Global;e.exports={name:"oldFF-globalStorage",read:function(e){return n[e]},write:function(e,t){n[e]=t},each:o,remove:function(e){return n.removeItem(e)},clearAll:function(){o((function(e,t){delete n[e]}))}};var n=i.globalStorage;function o(e){for(var t=n.length-1;t>=0;t--){var r=n.key(t);e(n[r],r)}}},function(e,t,r){var i=r(40).Global;e.exports={name:"oldIE-userDataStorage",write:function(e,t){if(s)return;var r=l(e);o((function(e){e.setAttribute(r,t),e.save("storejs")}))},read:function(e){if(s)return;var t=l(e),r=null;return o((function(e){r=e.getAttribute(t)})),r},each:function(e){o((function(t){for(var r=t.XMLDocument.documentElement.attributes,i=r.length-1;i>=0;i--){var n=r[i];e(t.getAttribute(n.name),n.name)}}))},remove:function(e){var t=l(e);o((function(e){e.removeAttribute(t),e.save("storejs")}))},clearAll:function(){o((function(e){var t=e.XMLDocument.documentElement.attributes;e.load("storejs");for(var r=t.length-1;r>=0;r--)e.removeAttribute(t[r].name);e.save("storejs")}))}};var n=i.document,o=function(){if(!n||!n.documentElement||!n.documentElement.addBehavior)return null;var e,t,r;try{(t=new ActiveXObject("htmlfile")).open(),t.write('