@modelform/react-native 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -3
- package/dist/{chunk-72OFPTDE.mjs → chunk-GWGDDKJE.mjs} +362 -66
- package/dist/{chunk-XWSPLZNC.js → chunk-P4NMZ77W.js} +450 -154
- package/dist/core/formFill.d.ts +1 -9
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +4 -2
- package/dist/core/index.mjs +3 -1
- package/dist/core/ruleFill.d.ts +12 -0
- package/dist/index.js +164 -162
- package/dist/index.mjs +3 -1
- package/package.json +1 -1
|
@@ -382,8 +382,8 @@ function interpolate(text, ctx) {
|
|
|
382
382
|
const builtins = builtinValues(ctx);
|
|
383
383
|
return text.replace(
|
|
384
384
|
/\$(\w+)|\$\{(\w+)(?::(\w+))?\}|\[\[(\w+)(?::(\w+))?\]\]/g,
|
|
385
|
-
(match,
|
|
386
|
-
const name = _nullishCoalesce(_nullishCoalesce(
|
|
385
|
+
(match, plain2, braced, bracedFmt, old, oldFmt) => {
|
|
386
|
+
const name = _nullishCoalesce(_nullishCoalesce(plain2, () => ( braced)), () => ( old));
|
|
387
387
|
const format3 = _nullishCoalesce(bracedFmt, () => ( oldFmt));
|
|
388
388
|
const scoped = _optionalChain([ctx, 'access', _30 => _30.scoped, 'optionalAccess', _31 => _31[name]]);
|
|
389
389
|
const value = scoped ? scoped.value : ctx.values[name];
|
|
@@ -1694,7 +1694,10 @@ function parseSpokenDuration(text) {
|
|
|
1694
1694
|
return clock[1] != null ? h * 3600 + m * 60 + s + Number(`0.${f}`) : m * 60 + s + Number(`0.${f}`);
|
|
1695
1695
|
}
|
|
1696
1696
|
}
|
|
1697
|
-
const lower = text.toLowerCase().replace(
|
|
1697
|
+
const lower = text.toLowerCase().replace(
|
|
1698
|
+
/\b(?:(?:a|one|three) )?(half|quarters?)(?: of)? an? (hour|minute)\b/g,
|
|
1699
|
+
(m, part, unit) => `${part === "half" ? 0.5 : m.startsWith("three") ? 0.75 : 0.25} ${unit}`
|
|
1700
|
+
).replace(/\ban hour\b/g, "one hour").replace(/\ba minute\b/g, "one minute").replace(/(\S+) (hours?|minutes?) and a half/g, "$1 and a half $2");
|
|
1698
1701
|
const parts = lower.split(/\b(hours?|hrs?|minutes?|mins?|seconds?|secs?)\b/);
|
|
1699
1702
|
const scale = (unit) => unit.startsWith("h") ? 3600 : unit.startsWith("m") ? 60 : 1;
|
|
1700
1703
|
let total = 0;
|
|
@@ -1954,66 +1957,6 @@ function readFill(form, answer) {
|
|
|
1954
1957
|
}
|
|
1955
1958
|
return result;
|
|
1956
1959
|
}
|
|
1957
|
-
var UNIT_WORDS = {
|
|
1958
|
-
kg: ["kg", "kgs", "kilo", "kilos", "kilogram", "kilograms"],
|
|
1959
|
-
lb: ["lb", "lbs", "pound", "pounds"],
|
|
1960
|
-
h: ["h", "hr", "hrs", "hour", "hours"],
|
|
1961
|
-
min: ["min", "mins", "minute", "minutes"],
|
|
1962
|
-
s: ["s", "sec", "secs", "second", "seconds"],
|
|
1963
|
-
km: ["km", "kms", "kilometer", "kilometers", "kilometre", "kilometres", "k"],
|
|
1964
|
-
mi: ["mi", "mile", "miles"],
|
|
1965
|
-
m: ["m", "meter", "meters", "metre", "metres"]
|
|
1966
|
-
};
|
|
1967
|
-
var NUMBER_WORD = "(?:-?\\d+(?:[.,]\\d+)?|zero|oh|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty|thirty|forty|fifty|sixty|seventy|eighty|ninety|hundred|thousand|point|and|a|half|quarter|minus)";
|
|
1968
|
-
var escape = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1969
|
-
function namesOf(f) {
|
|
1970
|
-
const names = /* @__PURE__ */ new Set([f.label.toLowerCase(), f.key.toLowerCase().replace(/[-_]+/g, " ")]);
|
|
1971
|
-
return [...names].filter((n) => n.trim().length > 1);
|
|
1972
|
-
}
|
|
1973
|
-
var LEAD = /^[\s,:;.-]*(?:(?:is|was|were|of|at|about|around|to|=)\b[\s,:;.-]*)*/i;
|
|
1974
|
-
function ruleFill(form, said) {
|
|
1975
|
-
const lower = said.toLowerCase();
|
|
1976
|
-
const hits = [];
|
|
1977
|
-
for (const f of form.fields)
|
|
1978
|
-
for (const name of namesOf(f)) {
|
|
1979
|
-
const re = new RegExp(`(?<![\\p{L}\\p{N}])${escape(name)}(?![\\p{L}\\p{N}])`, "gu");
|
|
1980
|
-
for (const m of lower.matchAll(re)) {
|
|
1981
|
-
const at = m.index;
|
|
1982
|
-
const end = at + m[0].length;
|
|
1983
|
-
if (!hits.some((h) => at < h.end && end > h.at)) hits.push({ key: f.key, at, end });
|
|
1984
|
-
}
|
|
1985
|
-
}
|
|
1986
|
-
hits.sort((a, b) => a.at - b.at);
|
|
1987
|
-
const segments = {};
|
|
1988
|
-
const used = [];
|
|
1989
|
-
hits.forEach((h, i) => {
|
|
1990
|
-
const stop = i + 1 < hits.length ? hits[i + 1].at : said.length;
|
|
1991
|
-
if (h.key in segments) return;
|
|
1992
|
-
segments[h.key] = said.slice(h.end, stop).replace(LEAD, "").replace(/[\s,;.]+$/, "");
|
|
1993
|
-
used.push([h.at, stop]);
|
|
1994
|
-
});
|
|
1995
|
-
const answer = {};
|
|
1996
|
-
for (const f of form.fields) if (segments[f.key]) answer[f.key] = segments[f.key];
|
|
1997
|
-
const rest = used.reduceRight((text, [a, b]) => text.slice(0, a) + " ".repeat(b - a) + text.slice(b), said);
|
|
1998
|
-
for (const f of form.fields) {
|
|
1999
|
-
if (f.key in answer) continue;
|
|
2000
|
-
if (f.type === "number" && f.unit) {
|
|
2001
|
-
const words2 = _nullishCoalesce(UNIT_WORDS[f.unit.toLowerCase()], () => ( [f.unit.toLowerCase()]));
|
|
2002
|
-
const unitRe = new RegExp(`(?<![\\p{L}\\p{N}])((?:${NUMBER_WORD}[\\s-]+)+)(?:${words2.map(escape).join("|")})(?![\\p{L}\\p{N}])`, "iu");
|
|
2003
|
-
const m = unitRe.exec(rest);
|
|
2004
|
-
if (m && m[1].trim()) answer[f.key] = m[1];
|
|
2005
|
-
} else if ((f.type === "choice" || f.type === "choices") && f.choices) {
|
|
2006
|
-
const options = f.choices.map((label) => ({ label, value: label }));
|
|
2007
|
-
const hits2 = matchChoices(rest, options);
|
|
2008
|
-
const shared = form.fields.some(
|
|
2009
|
-
(g) => g !== f && !(g.key in answer) && (g.type === "choice" || g.type === "choices") && matchChoices(rest, (_nullishCoalesce(g.choices, () => ( []))).map((l) => ({ label: l, value: l }))).length
|
|
2010
|
-
);
|
|
2011
|
-
if (hits2.length && !shared) answer[f.key] = f.type === "choices" ? hits2 : hits2[0];
|
|
2012
|
-
}
|
|
2013
|
-
}
|
|
2014
|
-
return readFill(form, answer);
|
|
2015
|
-
}
|
|
2016
|
-
var ruleFiller = async (form, said) => ruleFill(form, said);
|
|
2017
1960
|
function modelFiller(generate, fallback) {
|
|
2018
1961
|
return async (form, said) => {
|
|
2019
1962
|
let result = null;
|
|
@@ -2042,6 +1985,358 @@ function fillHints(form) {
|
|
|
2042
1985
|
return [...out];
|
|
2043
1986
|
}
|
|
2044
1987
|
|
|
1988
|
+
// src/core/ruleFill.ts
|
|
1989
|
+
var IRREGULAR = {
|
|
1990
|
+
slept: "sleep",
|
|
1991
|
+
felt: "feel",
|
|
1992
|
+
ran: "run",
|
|
1993
|
+
swam: "swim",
|
|
1994
|
+
rode: "ride",
|
|
1995
|
+
drank: "drink",
|
|
1996
|
+
drunk: "drink",
|
|
1997
|
+
ate: "eat",
|
|
1998
|
+
weigh: "weight",
|
|
1999
|
+
weighs: "weight",
|
|
2000
|
+
weighed: "weight",
|
|
2001
|
+
weighing: "weight"
|
|
2002
|
+
};
|
|
2003
|
+
var SYNONYMS = [
|
|
2004
|
+
["alcohol", "drink", "drinks", "booze"],
|
|
2005
|
+
["mood", "feel", "feeling"],
|
|
2006
|
+
["run", "jog"],
|
|
2007
|
+
["ride", "bike", "cycle"],
|
|
2008
|
+
["strength", "gym", "lift"]
|
|
2009
|
+
];
|
|
2010
|
+
var STOP = /* @__PURE__ */ new Set(["a", "an", "the", "and", "or", "no", "not", "i", "it", "is", "was", "at", "in", "of", "to", "for", "my", "me", "on", "yes"]);
|
|
2011
|
+
function stem(word) {
|
|
2012
|
+
let w = word.toLowerCase().replace(/['’]/g, "");
|
|
2013
|
+
w = _nullishCoalesce(IRREGULAR[w], () => ( w));
|
|
2014
|
+
const cut = (suffix, add = "") => {
|
|
2015
|
+
if (!w.endsWith(suffix) || w.length - suffix.length < 3) return false;
|
|
2016
|
+
w = w.slice(0, -suffix.length) + add;
|
|
2017
|
+
return true;
|
|
2018
|
+
};
|
|
2019
|
+
const cutDone = cut("ations", "at") || cut("ation", "at") || cut("ing") || cut("ed");
|
|
2020
|
+
if (!cutDone && !w.endsWith("ss")) cut("s");
|
|
2021
|
+
if (cutDone && /([b-df-hj-np-tv-z])\1$/.test(w) && !/(ll|ss|ff|zz)$/.test(w)) w = w.slice(0, -1);
|
|
2022
|
+
if (w.length > 3 && w.endsWith("e")) w = w.slice(0, -1);
|
|
2023
|
+
return w;
|
|
2024
|
+
}
|
|
2025
|
+
var GLUED_UNIT = /^(\d+(?:[.,]\d+)?)(k|km|kms|kg|kgs|lb|lbs|h|hr|hrs|min|mins|s|sec|secs|mi|m)$/;
|
|
2026
|
+
function tokenize(said) {
|
|
2027
|
+
const out = [];
|
|
2028
|
+
const add = (text, at, end) => out.push({ text, stem: stem(text), at, end });
|
|
2029
|
+
for (const m of said.matchAll(/[\p{L}\p{N}]+(?:['’.,][\p{L}\p{N}]+)*/gu)) {
|
|
2030
|
+
const at = m.index;
|
|
2031
|
+
const raw = m[0].toLowerCase();
|
|
2032
|
+
const glued = GLUED_UNIT.exec(raw);
|
|
2033
|
+
if (glued) {
|
|
2034
|
+
add(glued[1], at, at + glued[1].length);
|
|
2035
|
+
add(glued[2], at + glued[1].length, at + raw.length);
|
|
2036
|
+
} else add(raw, at, at + raw.length);
|
|
2037
|
+
}
|
|
2038
|
+
return out;
|
|
2039
|
+
}
|
|
2040
|
+
var plain = (t) => t.text.replace(/['’]/g, "");
|
|
2041
|
+
var phrase = (text, label, synonym = false) => {
|
|
2042
|
+
const words2 = tokenize(text).map((t) => t.text);
|
|
2043
|
+
if (!words2.length || !label && words2.length === 1 && STOP.has(words2[0])) return null;
|
|
2044
|
+
return { words: words2, stems: words2.map(stem), synonym, label };
|
|
2045
|
+
};
|
|
2046
|
+
function phrasesFor(names, label = false) {
|
|
2047
|
+
const out = [];
|
|
2048
|
+
for (const name of names) {
|
|
2049
|
+
const p = phrase(name, label);
|
|
2050
|
+
if (!p) continue;
|
|
2051
|
+
out.push(p);
|
|
2052
|
+
if (p.stems.length === 1) {
|
|
2053
|
+
for (const group of SYNONYMS)
|
|
2054
|
+
if (group.some((g) => stem(g) === p.stems[0])) {
|
|
2055
|
+
for (const g of group) if (stem(g) !== p.stems[0]) out.push(phrase(g, label, true));
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
return out;
|
|
2060
|
+
}
|
|
2061
|
+
function findPhrases(tokens, targets) {
|
|
2062
|
+
const all = targets.flatMap((t) => t.phrases.map((p) => ({ ...t, p }))).sort((a, b) => b.p.stems.length - a.p.stems.length);
|
|
2063
|
+
const hits = [];
|
|
2064
|
+
for (const { key, label, p } of all)
|
|
2065
|
+
for (let i = 0; i + p.stems.length <= tokens.length; i++) {
|
|
2066
|
+
const span = tokens.slice(i, i + p.stems.length);
|
|
2067
|
+
if (span.some((t, n) => !t.stem || t.stem !== p.stems[n] || !p.label && STOP.has(t.text))) continue;
|
|
2068
|
+
const end = i + p.stems.length;
|
|
2069
|
+
if (hits.some((h) => i < h.end && end > h.start)) continue;
|
|
2070
|
+
const exact = span.every((t, n) => t.text === p.words[n]);
|
|
2071
|
+
hits.push({ key, label, start: i, end, kind: p.synonym ? "synonym" : exact ? "exact" : "form" });
|
|
2072
|
+
}
|
|
2073
|
+
return hits.sort((a, b) => a.start - b.start);
|
|
2074
|
+
}
|
|
2075
|
+
var namesOf = (f) => [.../* @__PURE__ */ new Set([f.label, f.key.replace(/[-_]+/g, " ")])];
|
|
2076
|
+
var NUMBER_WORDS = new Set(
|
|
2077
|
+
"zero oh nought one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty thirty forty fifty sixty seventy eighty ninety hundred thousand".split(" ")
|
|
2078
|
+
);
|
|
2079
|
+
var TIME_UNITS = {
|
|
2080
|
+
s: 1,
|
|
2081
|
+
sec: 1,
|
|
2082
|
+
secs: 1,
|
|
2083
|
+
second: 1,
|
|
2084
|
+
seconds: 1,
|
|
2085
|
+
min: 60,
|
|
2086
|
+
mins: 60,
|
|
2087
|
+
minute: 60,
|
|
2088
|
+
minutes: 60,
|
|
2089
|
+
h: 3600,
|
|
2090
|
+
hr: 3600,
|
|
2091
|
+
hrs: 3600,
|
|
2092
|
+
hour: 3600,
|
|
2093
|
+
hours: 3600
|
|
2094
|
+
};
|
|
2095
|
+
var UNIT_WORDS = {
|
|
2096
|
+
kg: ["kg", "kgs", "kilo", "kilos", "kilogram", "kilograms"],
|
|
2097
|
+
lb: ["lb", "lbs", "pound", "pounds"],
|
|
2098
|
+
km: ["km", "kms", "kilometer", "kilometers", "kilometre", "kilometres", "k"],
|
|
2099
|
+
mi: ["mi", "mile", "miles"],
|
|
2100
|
+
m: ["m", "meter", "meters", "metre", "metres"]
|
|
2101
|
+
};
|
|
2102
|
+
var isDigits = (t) => !!t && /^\d/.test(t.text);
|
|
2103
|
+
var isNumberWord2 = (t) => !!t && NUMBER_WORDS.has(t.text);
|
|
2104
|
+
var isTimeUnit = (t) => !!t && t.text in TIME_UNITS;
|
|
2105
|
+
var is = (t, ...words2) => !!t && words2.includes(t.text);
|
|
2106
|
+
var timeScale = (unit) => unit ? TIME_UNITS[unit.toLowerCase()] : void 0;
|
|
2107
|
+
var unitWords = (unit) => _nullishCoalesce(UNIT_WORDS[unit.toLowerCase()], () => ( [unit.toLowerCase()]));
|
|
2108
|
+
function numberStarts(tokens, i) {
|
|
2109
|
+
const t = tokens[i];
|
|
2110
|
+
const next = tokens[i + 1];
|
|
2111
|
+
if (isDigits(t) || isNumberWord2(t)) return true;
|
|
2112
|
+
if (is(t, "a", "an")) return is(next, "half", "quarter", "hundred", "thousand", "hour", "minute");
|
|
2113
|
+
if (is(t, "half", "quarter")) return is(next, "a", "an", "of", "hour", "minute");
|
|
2114
|
+
return false;
|
|
2115
|
+
}
|
|
2116
|
+
function numberAt(said, tokens, i, stop) {
|
|
2117
|
+
let k = i;
|
|
2118
|
+
let time = false;
|
|
2119
|
+
const numberish = (j) => {
|
|
2120
|
+
const t = tokens[j];
|
|
2121
|
+
const next = tokens[j + 1];
|
|
2122
|
+
if (isDigits(t) || isNumberWord2(t) || is(t, "point", "half", "quarter")) return true;
|
|
2123
|
+
if (is(t, "and")) return j + 1 < stop && (isDigits(next) || isNumberWord2(next) || is(next, "a"));
|
|
2124
|
+
if (is(t, "a", "an")) return is(next, "half", "quarter", "hundred", "thousand", "hour", "minute");
|
|
2125
|
+
if (is(t, "of")) return is(tokens[j - 1], "half", "quarter") && is(next, "a", "an");
|
|
2126
|
+
return false;
|
|
2127
|
+
};
|
|
2128
|
+
while (k < stop) {
|
|
2129
|
+
if (numberish(k)) k++;
|
|
2130
|
+
else if (isTimeUnit(tokens[k])) {
|
|
2131
|
+
time = true;
|
|
2132
|
+
k++;
|
|
2133
|
+
if (!(k < stop && (numberStarts(tokens, k) || is(tokens[k], "and") && numberish(k)))) break;
|
|
2134
|
+
} else break;
|
|
2135
|
+
}
|
|
2136
|
+
while (k > i && is(tokens[k - 1], "and", "a", "an", "of")) k--;
|
|
2137
|
+
if (k <= i) return null;
|
|
2138
|
+
const text = said.slice(tokens[i].at, tokens[k - 1].end);
|
|
2139
|
+
if (time) {
|
|
2140
|
+
const seconds = parseSpokenDuration(text);
|
|
2141
|
+
return seconds == null ? null : { end: k, text, seconds };
|
|
2142
|
+
}
|
|
2143
|
+
if (parseSpokenNumber(text) == null) return null;
|
|
2144
|
+
const unit = k < stop && !STOP.has(tokens[k].text) ? tokens[k].text : void 0;
|
|
2145
|
+
return { end: unit ? k + 1 : k, text, unit };
|
|
2146
|
+
}
|
|
2147
|
+
var round = (n) => Math.round(n * 1e3) / 1e3;
|
|
2148
|
+
function spanValue(f, span) {
|
|
2149
|
+
const scale = timeScale(f.unit);
|
|
2150
|
+
if (span.seconds != null) {
|
|
2151
|
+
if (f.type === "duration") return span.seconds;
|
|
2152
|
+
return scale ? round(span.seconds / scale) : null;
|
|
2153
|
+
}
|
|
2154
|
+
if (span.unit && f.unit && !scale && !unitWords(f.unit).includes(span.unit) && Object.values(UNIT_WORDS).some((ws) => ws.includes(span.unit))) return null;
|
|
2155
|
+
return f.type === "duration" ? span.text : parseSpokenNumber(span.text);
|
|
2156
|
+
}
|
|
2157
|
+
var SCALE_WORDS = {
|
|
2158
|
+
terrible: 0,
|
|
2159
|
+
awful: 0,
|
|
2160
|
+
horrible: 0,
|
|
2161
|
+
dreadful: 0,
|
|
2162
|
+
miserable: 0,
|
|
2163
|
+
worst: 0,
|
|
2164
|
+
bad: 0.25,
|
|
2165
|
+
low: 0.25,
|
|
2166
|
+
poor: 0.25,
|
|
2167
|
+
rough: 0.25,
|
|
2168
|
+
down: 0.25,
|
|
2169
|
+
rubbish: 0.25,
|
|
2170
|
+
easy: 0,
|
|
2171
|
+
light: 0.25,
|
|
2172
|
+
ok: 0.5,
|
|
2173
|
+
okay: 0.5,
|
|
2174
|
+
fine: 0.5,
|
|
2175
|
+
alright: 0.5,
|
|
2176
|
+
average: 0.5,
|
|
2177
|
+
meh: 0.5,
|
|
2178
|
+
moderate: 0.5,
|
|
2179
|
+
normal: 0.5,
|
|
2180
|
+
good: 0.75,
|
|
2181
|
+
decent: 0.75,
|
|
2182
|
+
nice: 0.75,
|
|
2183
|
+
happy: 0.75,
|
|
2184
|
+
high: 0.75,
|
|
2185
|
+
hard: 0.75,
|
|
2186
|
+
tough: 0.75,
|
|
2187
|
+
great: 1,
|
|
2188
|
+
amazing: 1,
|
|
2189
|
+
excellent: 1,
|
|
2190
|
+
fantastic: 1,
|
|
2191
|
+
brilliant: 1,
|
|
2192
|
+
awesome: 1,
|
|
2193
|
+
wonderful: 1,
|
|
2194
|
+
perfect: 1,
|
|
2195
|
+
best: 1,
|
|
2196
|
+
brutal: 1
|
|
2197
|
+
};
|
|
2198
|
+
var INTENSIFIERS = /* @__PURE__ */ new Set(["very", "really", "super", "so", "extremely", "totally", "incredibly"]);
|
|
2199
|
+
function scaleValue(f, tokens, from, to) {
|
|
2200
|
+
if (f.min == null || f.max == null || f.unit) return null;
|
|
2201
|
+
for (let j = Math.max(0, from); j < to; j++) {
|
|
2202
|
+
const w = plain(tokens[j]);
|
|
2203
|
+
if (!(w in SCALE_WORDS)) continue;
|
|
2204
|
+
if (is(tokens[j - 1], "not") || is(tokens[j - 2], "not")) return null;
|
|
2205
|
+
let x = SCALE_WORDS[w];
|
|
2206
|
+
if (INTENSIFIERS.has(_nullishCoalesce(_optionalChain([tokens, 'access', _158 => _158[j - 1], 'optionalAccess', _159 => _159.text]), () => ( ""))) && x !== 0.5) x = x < 0.5 ? Math.max(0, x - 0.25) : Math.min(1, x + 0.25);
|
|
2207
|
+
return { value: Math.round(f.min + x * (f.max - f.min)), at: j };
|
|
2208
|
+
}
|
|
2209
|
+
return null;
|
|
2210
|
+
}
|
|
2211
|
+
var NEGATIONS = /* @__PURE__ */ new Set(["no", "not", "didnt", "dont", "never", "skipped", "skip", "without", "zero", "none", "havent", "hasnt", "wasnt", "nope", "cant", "couldnt"]);
|
|
2212
|
+
function negatedBefore(tokens, start, free) {
|
|
2213
|
+
for (let j = start - 1; j >= Math.max(0, start - 3); j--) {
|
|
2214
|
+
if (!free[j]) return null;
|
|
2215
|
+
if (NEGATIONS.has(plain(tokens[j])) && !is(tokens[j + 1], "wait")) return j;
|
|
2216
|
+
}
|
|
2217
|
+
return null;
|
|
2218
|
+
}
|
|
2219
|
+
var CORRECTIONS = [["no", "wait"], ["wait"], ["sorry"], ["actually"], ["i", "mean"], ["make", "that"], ["scratch", "that"], ["or", "rather"], ["correction"]];
|
|
2220
|
+
function lastCorrection(tokens, from, to) {
|
|
2221
|
+
let last = null;
|
|
2222
|
+
for (let j = from; j < to; j++)
|
|
2223
|
+
for (const c of CORRECTIONS) if (c.every((w, n) => _optionalChain([tokens, 'access', _160 => _160[j + n], 'optionalAccess', _161 => _161.text]) === w) && j + c.length <= to) last = j + c.length;
|
|
2224
|
+
return last;
|
|
2225
|
+
}
|
|
2226
|
+
var LEAD = /^[\s,:;.-]*(?:(?:is|was|were|of|at|about|around|to|=)\b[\s,:;.-]*)*/i;
|
|
2227
|
+
var MAX_GAP = 4;
|
|
2228
|
+
function valueAfter(said, f, h, tokens, stop, free, nextIsToggle) {
|
|
2229
|
+
const from = h.end;
|
|
2230
|
+
if (f.type === "text") {
|
|
2231
|
+
if (from >= stop) return null;
|
|
2232
|
+
const text = said.slice(tokens[from].at, tokens[stop - 1].end).replace(LEAD, "").replace(/[\s,;.]+$/, "");
|
|
2233
|
+
return text ? { value: text, end: stop } : null;
|
|
2234
|
+
}
|
|
2235
|
+
if (f.type === "boolean") {
|
|
2236
|
+
const after = tokens.slice(from, Math.min(stop, from + 2));
|
|
2237
|
+
const last = after[after.length - 1];
|
|
2238
|
+
const lastIsNo = !!last && from + after.length === stop && nextIsToggle && NEGATIONS.has(plain(last));
|
|
2239
|
+
const yes = lastIsNo ? null : parseSpokenYesNo(after.map((t) => t.text).join(" "));
|
|
2240
|
+
if (yes != null) return { value: yes, end: from + after.length };
|
|
2241
|
+
const neg = negatedBefore(tokens, h.start, free);
|
|
2242
|
+
if (neg != null) return { value: false, end: h.end, start: neg };
|
|
2243
|
+
return h.kind === "synonym" ? null : { value: true, end: h.end };
|
|
2244
|
+
}
|
|
2245
|
+
if (f.type === "choice" || f.type === "choices") {
|
|
2246
|
+
if (from >= stop) return null;
|
|
2247
|
+
const labels = choiceLabels(f, tokens.slice(from, stop));
|
|
2248
|
+
if (!labels.length || f.type === "choice" && labels.length > 1) return null;
|
|
2249
|
+
return { value: f.type === "choice" ? labels[0] : labels, end: stop };
|
|
2250
|
+
}
|
|
2251
|
+
const fix = lastCorrection(tokens, from, stop);
|
|
2252
|
+
for (const start of fix != null ? [fix, from] : [from])
|
|
2253
|
+
for (let j = start; j < Math.min(stop, start + MAX_GAP + 1); j++) {
|
|
2254
|
+
if (!numberStarts(tokens, j)) continue;
|
|
2255
|
+
const span = numberAt(said, tokens, j, stop);
|
|
2256
|
+
const value = span && spanValue(f, span);
|
|
2257
|
+
if (span && value != null) return { value, end: span.end };
|
|
2258
|
+
break;
|
|
2259
|
+
}
|
|
2260
|
+
const near = Math.min(stop, from + 3);
|
|
2261
|
+
if (f.choices && from < near) {
|
|
2262
|
+
const [hit] = matchChoices(said.slice(tokens[from].at, tokens[near - 1].end), f.choices.map((label) => ({ label, value: label })));
|
|
2263
|
+
if (hit != null) return { value: hit, end: near };
|
|
2264
|
+
}
|
|
2265
|
+
const scale = scaleValue(f, tokens, from, near);
|
|
2266
|
+
if (scale) return { value: scale.value, end: scale.at + 1 };
|
|
2267
|
+
const before = scaleValue(f, tokens, h.start - 2, h.start);
|
|
2268
|
+
if (before && tokens.slice(before.at, h.start).every((_, n) => free[before.at + n]) && !/[,.;]/.test(said.slice(tokens[before.at].end, tokens[h.start].at)))
|
|
2269
|
+
return { value: before.value, end: h.end, start: before.at };
|
|
2270
|
+
return null;
|
|
2271
|
+
}
|
|
2272
|
+
function choiceLabels(f, tokens) {
|
|
2273
|
+
const hits = findPhrases(tokens, (_nullishCoalesce(f.choices, () => ( []))).map((label) => ({ key: f.key, label, phrases: phrasesFor([label], true) })));
|
|
2274
|
+
return [...new Set(hits.map((h) => h.label))];
|
|
2275
|
+
}
|
|
2276
|
+
function ruleFill(form, said) {
|
|
2277
|
+
const tokens = tokenize(said);
|
|
2278
|
+
const free = tokens.map(() => true);
|
|
2279
|
+
const take = (from, to) => {
|
|
2280
|
+
for (let j = from; j < to; j++) free[j] = false;
|
|
2281
|
+
};
|
|
2282
|
+
const fieldOf = (key) => form.fields.find((f) => f.key === key);
|
|
2283
|
+
const named = [];
|
|
2284
|
+
let inText = false;
|
|
2285
|
+
for (const h of findPhrases(tokens, form.fields.map((f) => ({ key: f.key, phrases: phrasesFor(namesOf(f)) })))) {
|
|
2286
|
+
if (inText && h.kind !== "exact") continue;
|
|
2287
|
+
named.push(h);
|
|
2288
|
+
inText = fieldOf(h.key).type === "text";
|
|
2289
|
+
}
|
|
2290
|
+
for (const h of named) take(h.start, h.end);
|
|
2291
|
+
const answer = {};
|
|
2292
|
+
for (const f of form.fields) {
|
|
2293
|
+
const mine = named.map((h, i) => ({ h, i })).filter(({ h }) => h.key === f.key);
|
|
2294
|
+
for (const { h, i } of mine.reverse()) {
|
|
2295
|
+
const stop = _nullishCoalesce(_optionalChain([named, 'access', _162 => _162[i + 1], 'optionalAccess', _163 => _163.start]), () => ( tokens.length));
|
|
2296
|
+
const nextIsToggle = !!named[i + 1] && fieldOf(named[i + 1].key).type === "boolean";
|
|
2297
|
+
const found = valueAfter(said, f, h, tokens, stop, free, nextIsToggle);
|
|
2298
|
+
if (!found) continue;
|
|
2299
|
+
answer[f.key] = found.value;
|
|
2300
|
+
take(_nullishCoalesce(found.start, () => ( h.start)), found.end);
|
|
2301
|
+
break;
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
const open = (f) => !(f.key in answer);
|
|
2305
|
+
const timeFields = () => form.fields.filter((f) => open(f) && (f.type === "duration" || f.type === "number" && timeScale(f.unit)));
|
|
2306
|
+
for (let j = 0; j < tokens.length; j++) {
|
|
2307
|
+
if (!free[j] || !numberStarts(tokens, j)) continue;
|
|
2308
|
+
let stop = j;
|
|
2309
|
+
while (stop < tokens.length && free[stop]) stop++;
|
|
2310
|
+
const span = numberAt(said, tokens, j, stop);
|
|
2311
|
+
if (!span) continue;
|
|
2312
|
+
let field2;
|
|
2313
|
+
if (span.seconds != null) {
|
|
2314
|
+
const unitSaid = tokens.slice(j, span.end).find(isTimeUnit).text;
|
|
2315
|
+
const candidates = timeFields();
|
|
2316
|
+
field2 = _nullishCoalesce(candidates.find((f) => timeScale(f.unit) === TIME_UNITS[unitSaid]), () => ( (candidates.length === 1 ? candidates[0] : void 0)));
|
|
2317
|
+
} else if (span.unit) {
|
|
2318
|
+
const matching = form.fields.filter((f) => open(f) && f.type === "number" && f.unit && !timeScale(f.unit) && unitWords(f.unit).includes(span.unit));
|
|
2319
|
+
if (matching.length === 1) field2 = matching[0];
|
|
2320
|
+
}
|
|
2321
|
+
const value = field2 && spanValue(field2, span);
|
|
2322
|
+
if (field2 && value != null) {
|
|
2323
|
+
answer[field2.key] = value;
|
|
2324
|
+
take(j, span.end);
|
|
2325
|
+
j = span.end - 1;
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
const unclaimed = tokens.map((t, j) => free[j] ? t : { ...t, stem: "", text: "" });
|
|
2329
|
+
const choiceFields = form.fields.filter((f) => open(f) && (f.type === "choice" || f.type === "choices"));
|
|
2330
|
+
const mentioned = choiceFields.map((f) => ({ f, labels: choiceLabels(f, unclaimed) })).filter((c) => c.labels.length);
|
|
2331
|
+
if (mentioned.length === 1) {
|
|
2332
|
+
const [{ f, labels }] = mentioned;
|
|
2333
|
+
if (f.type === "choices") answer[f.key] = labels;
|
|
2334
|
+
else if (labels.length === 1) answer[f.key] = labels[0];
|
|
2335
|
+
}
|
|
2336
|
+
return readFill(form, answer);
|
|
2337
|
+
}
|
|
2338
|
+
var ruleFiller = async (form, said) => ruleFill(form, said);
|
|
2339
|
+
|
|
2045
2340
|
// src/core/local.ts
|
|
2046
2341
|
var LOCAL_DATASOURCE_TYPE = "modelform-local";
|
|
2047
2342
|
var LEGACY_LOCAL_DATASOURCE_TYPE = "dashkit-local";
|
|
@@ -2118,7 +2413,7 @@ function buildFrames(target, entries, request, label, siblings = []) {
|
|
|
2118
2413
|
const fill = _nullishCoalesce(target.fillZero, () => ( (aggregate === "sum" || aggregate === "count")));
|
|
2119
2414
|
({ times, values } = bucketize(rows, aggregate, bucket, request.range, fill));
|
|
2120
2415
|
}
|
|
2121
|
-
const display = group == null ? name : _nullishCoalesce(_optionalChain([label, 'optionalCall',
|
|
2416
|
+
const display = group == null ? name : _nullishCoalesce(_optionalChain([label, 'optionalCall', _164 => _164(labelKey, group)]), () => ( group));
|
|
2122
2417
|
return {
|
|
2123
2418
|
name,
|
|
2124
2419
|
refId: target.refId,
|
|
@@ -2174,7 +2469,7 @@ function bucketize(rows, aggregate, bucket, range, fillZero) {
|
|
|
2174
2469
|
const keys = fillZero ? step.range(range.from, range.to) : [...sums.keys()].sort((a, b) => a - b);
|
|
2175
2470
|
const values = keys.map((k) => {
|
|
2176
2471
|
const vs = sums.get(k);
|
|
2177
|
-
return _optionalChain([vs, 'optionalAccess',
|
|
2472
|
+
return _optionalChain([vs, 'optionalAccess', _165 => _165.length]) ? reduce2(vs, aggregate) : fillZero ? 0 : null;
|
|
2178
2473
|
});
|
|
2179
2474
|
return { times: keys, values };
|
|
2180
2475
|
}
|
|
@@ -2255,17 +2550,17 @@ function parseGazetteer(json) {
|
|
|
2255
2550
|
};
|
|
2256
2551
|
if (Array.isArray(json)) {
|
|
2257
2552
|
for (const item of json) {
|
|
2258
|
-
const lat = Number(_nullishCoalesce(_optionalChain([item, 'optionalAccess',
|
|
2259
|
-
const lon = Number(_nullishCoalesce(_nullishCoalesce(_optionalChain([item, 'optionalAccess',
|
|
2553
|
+
const lat = Number(_nullishCoalesce(_optionalChain([item, 'optionalAccess', _166 => _166.latitude]), () => ( _optionalChain([item, 'optionalAccess', _167 => _167.lat]))));
|
|
2554
|
+
const lon = Number(_nullishCoalesce(_nullishCoalesce(_optionalChain([item, 'optionalAccess', _168 => _168.longitude]), () => ( _optionalChain([item, 'optionalAccess', _169 => _169.lon]))), () => ( _optionalChain([item, 'optionalAccess', _170 => _170.lng]))));
|
|
2260
2555
|
if (!Number.isFinite(lat) || !Number.isFinite(lon)) continue;
|
|
2261
2556
|
const p = { lon, lat };
|
|
2262
2557
|
add(item.key, p);
|
|
2263
2558
|
for (const k of [..._nullishCoalesce(item.keys, () => ( [])), ..._nullishCoalesce(item.keywords, () => ( []))]) add(k, p);
|
|
2264
2559
|
add(item.name, p);
|
|
2265
2560
|
}
|
|
2266
|
-
} else if (_optionalChain([json, 'optionalAccess',
|
|
2561
|
+
} else if (_optionalChain([json, 'optionalAccess', _171 => _171.type]) === "FeatureCollection") {
|
|
2267
2562
|
for (const f of _nullishCoalesce(json.features, () => ( []))) {
|
|
2268
|
-
const p = featurePoint(_optionalChain([f, 'optionalAccess',
|
|
2563
|
+
const p = featurePoint(_optionalChain([f, 'optionalAccess', _172 => _172.geometry]));
|
|
2269
2564
|
if (!p) continue;
|
|
2270
2565
|
add(f.id, p);
|
|
2271
2566
|
for (const v of Object.values(_nullishCoalesce(f.properties, () => ( {})))) if (typeof v === "string") add(v, p);
|
|
@@ -2274,7 +2569,7 @@ function parseGazetteer(json) {
|
|
|
2274
2569
|
return { find: (key) => _nullishCoalesce(exact.get(key), () => ( folded.get(key.toLowerCase()))) };
|
|
2275
2570
|
}
|
|
2276
2571
|
function featurePoint(geometry) {
|
|
2277
|
-
if (!_optionalChain([geometry, 'optionalAccess',
|
|
2572
|
+
if (!_optionalChain([geometry, 'optionalAccess', _173 => _173.coordinates])) return void 0;
|
|
2278
2573
|
if (geometry.type === "Point") {
|
|
2279
2574
|
const [lon, lat] = geometry.coordinates;
|
|
2280
2575
|
return Number.isFinite(lon) && Number.isFinite(lat) ? { lon, lat } : void 0;
|
|
@@ -2303,7 +2598,7 @@ function loadGazetteer(path, ds) {
|
|
|
2303
2598
|
const json = absolute ? fetch(path).then((r) => {
|
|
2304
2599
|
if (!r.ok) throw new Error(`${r.status} ${r.statusText}`);
|
|
2305
2600
|
return r.json();
|
|
2306
|
-
}) : _optionalChain([ds, 'optionalAccess',
|
|
2601
|
+
}) : _optionalChain([ds, 'optionalAccess', _174 => _174.publicFile]) ? ds.publicFile(path) : Promise.reject(new Error(`${path} is served by Grafana, and this dashboard has no Grafana connection`));
|
|
2307
2602
|
const run2 = json.then(parseGazetteer);
|
|
2308
2603
|
run2.catch(() => loaded.get(path) === run2 && loaded.delete(path));
|
|
2309
2604
|
loaded.set(path, run2);
|
|
@@ -2343,7 +2638,7 @@ function macro(path, format3, ctx) {
|
|
|
2343
2638
|
switch (head) {
|
|
2344
2639
|
case "__from":
|
|
2345
2640
|
case "__to": {
|
|
2346
|
-
const ms = head === "__from" ? _optionalChain([ctx, 'access',
|
|
2641
|
+
const ms = head === "__from" ? _optionalChain([ctx, 'access', _175 => _175.range, 'optionalAccess', _176 => _176.from]) : _optionalChain([ctx, 'access', _177 => _177.range, 'optionalAccess', _178 => _178.to]);
|
|
2347
2642
|
if (ms == null) return void 0;
|
|
2348
2643
|
if (format3 === "date" || format3 === "date:iso") return new Date(ms).toISOString();
|
|
2349
2644
|
if (format3 === "date:seconds") return String(Math.floor(ms / 1e3));
|
|
@@ -2380,13 +2675,13 @@ function macro(path, format3, ctx) {
|
|
|
2380
2675
|
}
|
|
2381
2676
|
return void 0;
|
|
2382
2677
|
case "__series":
|
|
2383
|
-
return rest[0] === "name" ? _nullishCoalesce(_nullishCoalesce(d.seriesName, () => ( _optionalChain([d, 'access',
|
|
2678
|
+
return rest[0] === "name" ? _nullishCoalesce(_nullishCoalesce(d.seriesName, () => ( _optionalChain([d, 'access', _179 => _179.frame, 'optionalAccess', _180 => _180.name]))), () => ( d.fieldName)) : void 0;
|
|
2384
2679
|
case "__data": {
|
|
2385
2680
|
const m = /^fields(?:\.([\w-]+)|\["([^"]*)"\]|\[(\d+)\])/.exec(rest.join("."));
|
|
2386
2681
|
if (!m || !d.frame || d.row == null) return void 0;
|
|
2387
2682
|
const key = _nullishCoalesce(m[1], () => ( m[2]));
|
|
2388
|
-
const f = key != null ? d.frame.fields.find((x) => x.name === key || _optionalChain([x, 'access',
|
|
2389
|
-
const v = _optionalChain([f, 'optionalAccess',
|
|
2683
|
+
const f = key != null ? d.frame.fields.find((x) => x.name === key || _optionalChain([x, 'access', _181 => _181.config, 'optionalAccess', _182 => _182.displayName]) === key) : d.frame.fields[Number(m[3])];
|
|
2684
|
+
const v = _optionalChain([f, 'optionalAccess', _183 => _183.values, 'access', _184 => _184[d.row]]);
|
|
2390
2685
|
if (v == null) return void 0;
|
|
2391
2686
|
return f.type === "time" ? String(toMillis(v)) : String(v);
|
|
2392
2687
|
}
|
|
@@ -2397,9 +2692,9 @@ function urlTime(raw, ms) {
|
|
|
2397
2692
|
return raw.trim().startsWith("now") ? encodeURIComponent(raw.trim()) : String(ms);
|
|
2398
2693
|
}
|
|
2399
2694
|
function allVariables(ctx) {
|
|
2400
|
-
const names = (_nullishCoalesce(_optionalChain([ctx, 'access',
|
|
2695
|
+
const names = (_nullishCoalesce(_optionalChain([ctx, 'access', _185 => _185.dashboard, 'optionalAccess', _186 => _186.templating, 'optionalAccess', _187 => _187.list]), () => ( []))).filter((v) => v.type !== "adhoc").map((v) => v.name);
|
|
2401
2696
|
return (names.length ? names : Object.keys(ctx.values)).flatMap((n) => {
|
|
2402
|
-
const v = _nullishCoalesce(_optionalChain([ctx, 'access',
|
|
2697
|
+
const v = _nullishCoalesce(_optionalChain([ctx, 'access', _188 => _188.scoped, 'optionalAccess', _189 => _189[n], 'optionalAccess', _190 => _190.value]), () => ( ctx.values[n]));
|
|
2403
2698
|
return v == null ? [] : [queryParam(n, v)];
|
|
2404
2699
|
}).join("&");
|
|
2405
2700
|
}
|
|
@@ -2410,7 +2705,7 @@ function parseDashboardLink(href, grafanaUrl) {
|
|
|
2410
2705
|
const base = grafanaUrl ? /^(?:[a-z][a-z0-9+.-]*:)?\/\/([^/?#]+)([^?#]*)/i.exec(grafanaUrl.trim()) : null;
|
|
2411
2706
|
if (host && (!base || base[1].toLowerCase() !== host.toLowerCase())) return null;
|
|
2412
2707
|
if (scheme && !/^https?:$/i.test(scheme)) return null;
|
|
2413
|
-
const prefix = (_nullishCoalesce(_optionalChain([base, 'optionalAccess',
|
|
2708
|
+
const prefix = (_nullishCoalesce(_optionalChain([base, 'optionalAccess', _191 => _191[2]]), () => ( ""))).replace(/\/+$/, "");
|
|
2414
2709
|
const path = prefix && rawPath.startsWith(prefix + "/") ? rawPath.slice(prefix.length) : rawPath;
|
|
2415
2710
|
const p = /^\/d\/([^/]+)(?:\/[^/]*)?\/?$/.exec(path);
|
|
2416
2711
|
if (!p) return null;
|
|
@@ -2434,12 +2729,12 @@ function decode(s) {
|
|
|
2434
2729
|
}
|
|
2435
2730
|
}
|
|
2436
2731
|
function applyDashboardLink(dashboard, target) {
|
|
2437
|
-
const time = target.from || target.to ? { from: target.from || _optionalChain([dashboard, 'access',
|
|
2438
|
-
const list = _optionalChain([dashboard, 'access',
|
|
2732
|
+
const time = target.from || target.to ? { from: target.from || _optionalChain([dashboard, 'access', _192 => _192.time, 'optionalAccess', _193 => _193.from]) || "now-6h", to: target.to || _optionalChain([dashboard, 'access', _194 => _194.time, 'optionalAccess', _195 => _195.to]) || "now" } : dashboard.time;
|
|
2733
|
+
const list = _optionalChain([dashboard, 'access', _196 => _196.templating, 'optionalAccess', _197 => _197.list, 'access', _198 => _198.map, 'call', _199 => _199((v) => {
|
|
2439
2734
|
const values = target.vars[v.name];
|
|
2440
|
-
if (!_optionalChain([values, 'optionalAccess',
|
|
2735
|
+
if (!_optionalChain([values, 'optionalAccess', _200 => _200.length])) return v;
|
|
2441
2736
|
const value = v.multi ? values : values[0];
|
|
2442
|
-
const text = (Array.isArray(value) ? value : [value]).map((x) => x === "$__all" ? "All" : _nullishCoalesce(_optionalChain([v, 'access',
|
|
2737
|
+
const text = (Array.isArray(value) ? value : [value]).map((x) => x === "$__all" ? "All" : _nullishCoalesce(_optionalChain([v, 'access', _201 => _201.options, 'optionalAccess', _202 => _202.find, 'call', _203 => _203((o) => o.value === x), 'optionalAccess', _204 => _204.text]), () => ( x)));
|
|
2443
2738
|
return { ...v, current: { text: v.multi ? text : text[0], value } };
|
|
2444
2739
|
})]);
|
|
2445
2740
|
return { ...dashboard, time, templating: list ? { ...dashboard.templating, list } : dashboard.templating };
|
|
@@ -8573,7 +8868,7 @@ function removeAt(root, pointer) {
|
|
|
8573
8868
|
const segs = pointer.split("/").slice(1).map((s) => s.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
8574
8869
|
const last = segs.pop();
|
|
8575
8870
|
let parent = root;
|
|
8576
|
-
for (const s of segs) parent = _optionalChain([parent, 'optionalAccess',
|
|
8871
|
+
for (const s of segs) parent = _optionalChain([parent, 'optionalAccess', _205 => _205[s]]);
|
|
8577
8872
|
if (Array.isArray(parent)) {
|
|
8578
8873
|
parent.splice(Number(last), 1);
|
|
8579
8874
|
return { array: parentOf(pointer), index: Number(last) };
|
|
@@ -8585,7 +8880,7 @@ function cleanDashboard(json) {
|
|
|
8585
8880
|
const value = structuredClone(json);
|
|
8586
8881
|
const removed = [];
|
|
8587
8882
|
const deletedKeys = /* @__PURE__ */ new Set();
|
|
8588
|
-
for (let
|
|
8883
|
+
for (let round2 = 0; round2 < 10 && !validateDashboard(value); round2++) {
|
|
8589
8884
|
const errors = collapseUnions((_nullishCoalesce(validateDashboard.errors, () => ( []))).filter((e) => !noise(e)));
|
|
8590
8885
|
const targets = /* @__PURE__ */ new Map();
|
|
8591
8886
|
for (const e of errors) {
|
|
@@ -8746,7 +9041,7 @@ var STANDARD = [
|
|
|
8746
9041
|
]
|
|
8747
9042
|
}
|
|
8748
9043
|
},
|
|
8749
|
-
{ path: field("color.fixedColor"), label: "Color", category: "Standard options", control: { kind: "color" }, showIf: (p) => _optionalChain([p, 'access',
|
|
9044
|
+
{ path: field("color.fixedColor"), label: "Color", category: "Standard options", control: { kind: "color" }, showIf: (p) => _optionalChain([p, 'access', _206 => _206.fieldConfig, 'optionalAccess', _207 => _207.defaults, 'optionalAccess', _208 => _208.color, 'optionalAccess', _209 => _209.mode]) === "fixed" }
|
|
8750
9045
|
];
|
|
8751
9046
|
var THRESHOLDS = {
|
|
8752
9047
|
path: field("thresholds"),
|
|
@@ -8772,7 +9067,7 @@ var CALC = {
|
|
|
8772
9067
|
default: "lastNotNull",
|
|
8773
9068
|
control: { kind: "select", choices: Object.entries(REDUCER_LABELS).map(([value, label]) => ({ label, value })) },
|
|
8774
9069
|
stored: "string[]",
|
|
8775
|
-
get: (p) => _optionalChain([p, 'access',
|
|
9070
|
+
get: (p) => _optionalChain([p, 'access', _210 => _210.options, 'optionalAccess', _211 => _211.reduceOptions, 'optionalAccess', _212 => _212.calcs, 'optionalAccess', _213 => _213[0]]),
|
|
8776
9071
|
set: (p, v) => setOptionValue(p, "options.reduceOptions.calcs", v === void 0 ? void 0 : [v])
|
|
8777
9072
|
};
|
|
8778
9073
|
var LEGEND = {
|
|
@@ -8782,9 +9077,9 @@ var LEGEND = {
|
|
|
8782
9077
|
help: "When there are two or more series.",
|
|
8783
9078
|
default: true,
|
|
8784
9079
|
control: { kind: "boolean" },
|
|
8785
|
-
get: (p) => _optionalChain([p, 'access',
|
|
9080
|
+
get: (p) => _optionalChain([p, 'access', _214 => _214.options, 'optionalAccess', _215 => _215.legend, 'optionalAccess', _216 => _216.showLegend]) !== false && _optionalChain([p, 'access', _217 => _217.options, 'optionalAccess', _218 => _218.legend, 'optionalAccess', _219 => _219.displayMode]) !== "hidden",
|
|
8786
9081
|
// Grafana's older displayMode "hidden" would otherwise keep it hidden.
|
|
8787
|
-
set: (p, v) => setOptionValue(v ? setOptionValue(p, "options.legend.displayMode", _optionalChain([p, 'access',
|
|
9082
|
+
set: (p, v) => setOptionValue(v ? setOptionValue(p, "options.legend.displayMode", _optionalChain([p, 'access', _220 => _220.options, 'optionalAccess', _221 => _221.legend, 'optionalAccess', _222 => _222.displayMode]) === "hidden" ? void 0 : _optionalChain([p, 'access', _223 => _223.options, 'optionalAccess', _224 => _224.legend, 'optionalAccess', _225 => _225.displayMode])) : p, "options.legend.showLegend", v ? void 0 : false)
|
|
8788
9083
|
};
|
|
8789
9084
|
var AXIS_LABEL = { path: field("custom.axisLabel"), label: "Axis label", category: "Axis", control: { kind: "text" } };
|
|
8790
9085
|
var AXIS_PLACEMENT = {
|
|
@@ -9038,7 +9333,7 @@ function overrideProperties(type) {
|
|
|
9038
9333
|
return out;
|
|
9039
9334
|
}
|
|
9040
9335
|
function panelOverrides(panel) {
|
|
9041
|
-
const o = _optionalChain([panel, 'access',
|
|
9336
|
+
const o = _optionalChain([panel, 'access', _226 => _226.fieldConfig, 'optionalAccess', _227 => _227.overrides]);
|
|
9042
9337
|
return Array.isArray(o) ? o : [];
|
|
9043
9338
|
}
|
|
9044
9339
|
function setOverrides(panel, overrides) {
|
|
@@ -9086,7 +9381,7 @@ function prepareDashboard(json, file) {
|
|
|
9086
9381
|
});
|
|
9087
9382
|
dashboard.panels.forEach((p, i) => {
|
|
9088
9383
|
for (const r of cleanPanelOptions(p)) removed.push({ path: `panels[${i}]${r.path}`, message: r.message });
|
|
9089
|
-
_optionalChain([p, 'access',
|
|
9384
|
+
_optionalChain([p, 'access', _228 => _228.panels, 'optionalAccess', _229 => _229.forEach, 'call', _230 => _230((child, j) => {
|
|
9090
9385
|
for (const r of cleanPanelOptions(child)) removed.push({ path: `panels[${i}].panels[${j}]${r.path}`, message: r.message });
|
|
9091
9386
|
})]);
|
|
9092
9387
|
});
|
|
@@ -9109,7 +9404,7 @@ function groupIssues(dashboard) {
|
|
|
9109
9404
|
for (const { p, at } of located2) if (isInputPanel(p) && !recordedAt.has(p.options.metric)) recordedAt.set(p.options.metric, at);
|
|
9110
9405
|
for (const { p, at } of located2) {
|
|
9111
9406
|
if (p.type !== INPUT_GROUP) continue;
|
|
9112
|
-
const fields = _optionalChain([p, 'access',
|
|
9407
|
+
const fields = _optionalChain([p, 'access', _231 => _231.options, 'optionalAccess', _232 => _232.fields]);
|
|
9113
9408
|
if (!Array.isArray(fields) || !fields.length) {
|
|
9114
9409
|
out.push({ path: `${at}.options.fields`, message: "a group needs at least one field" });
|
|
9115
9410
|
continue;
|
|
@@ -9126,7 +9421,7 @@ function groupIssues(dashboard) {
|
|
|
9126
9421
|
else recordedAt.set(metric, fat);
|
|
9127
9422
|
mine.push(metric);
|
|
9128
9423
|
});
|
|
9129
|
-
const titleFrom = _optionalChain([p, 'access',
|
|
9424
|
+
const titleFrom = _optionalChain([p, 'access', _233 => _233.options, 'optionalAccess', _234 => _234.titleFrom]);
|
|
9130
9425
|
if (titleFrom !== void 0 && !mine.includes(titleFrom)) out.push({ path: `${at}.options.titleFrom`, message: `must be the metric of one of the group\u2019s fields` });
|
|
9131
9426
|
}
|
|
9132
9427
|
return out;
|
|
@@ -9137,7 +9432,7 @@ function panelProblem(p) {
|
|
|
9137
9432
|
const g = p.gridPos;
|
|
9138
9433
|
if (!isObject3(g) || !["x", "y", "w", "h"].every((k) => typeof g[k] === "number"))
|
|
9139
9434
|
return { at: ".gridPos", message: "must have numeric x, y, w and h", summary: "has no usable gridPos" };
|
|
9140
|
-
if (p.type.startsWith("input-") && p.type !== INPUT_GROUP && !nonEmptyString(_optionalChain([p, 'access',
|
|
9435
|
+
if (p.type.startsWith("input-") && p.type !== INPUT_GROUP && !nonEmptyString(_optionalChain([p, 'access', _235 => _235.options, 'optionalAccess', _236 => _236.metric]))) {
|
|
9141
9436
|
const message = `${p.type} needs a metric to record to`;
|
|
9142
9437
|
return { at: ".options.metric", message, summary: message };
|
|
9143
9438
|
}
|
|
@@ -9213,17 +9508,17 @@ function resolveUrl(base, rel) {
|
|
|
9213
9508
|
function httpFetchJson(options = {}) {
|
|
9214
9509
|
const seen = /* @__PURE__ */ new Map();
|
|
9215
9510
|
return async (url, { accept = "application/json", signal } = {}) => {
|
|
9216
|
-
const extra = await _asyncNullishCoalesce(await _optionalChain([options, 'access',
|
|
9511
|
+
const extra = await _asyncNullishCoalesce(await _optionalChain([options, 'access', _237 => _237.headers, 'optionalCall', _238 => _238()]), async () => ( {}));
|
|
9217
9512
|
const key = JSON.stringify([url, accept, extra]);
|
|
9218
9513
|
const last = seen.get(key);
|
|
9219
9514
|
const get = (etag2) => fetch(url, { headers: { Accept: accept, ...extra, ...etag2 && { "If-None-Match": etag2 } }, cache: "no-store", signal });
|
|
9220
|
-
const res = await get(_optionalChain([last, 'optionalAccess',
|
|
9221
|
-
if (!last || _optionalChain([signal, 'optionalAccess',
|
|
9515
|
+
const res = await get(_optionalChain([last, 'optionalAccess', _239 => _239.etag])).catch((e) => {
|
|
9516
|
+
if (!last || _optionalChain([signal, 'optionalAccess', _240 => _240.aborted])) throw e;
|
|
9222
9517
|
seen.delete(key);
|
|
9223
9518
|
return get();
|
|
9224
9519
|
});
|
|
9225
9520
|
if (res.status === 304 && last) return last.json;
|
|
9226
|
-
if (!res.ok) throw new Error(_nullishCoalesce(_optionalChain([options, 'access',
|
|
9521
|
+
if (!res.ok) throw new Error(_nullishCoalesce(_optionalChain([options, 'access', _241 => _241.httpError, 'optionalCall', _242 => _242(res.status)]), () => ( `HTTP ${res.status}`)));
|
|
9227
9522
|
const json = JSON.parse(await res.text());
|
|
9228
9523
|
const etag = res.headers.get("ETag");
|
|
9229
9524
|
if (etag) seen.set(key, { etag, json });
|
|
@@ -9345,8 +9640,8 @@ var ConfigLoader = (_class2 = class {
|
|
|
9345
9640
|
async start() {
|
|
9346
9641
|
const { url, cache: cache2 } = this.options;
|
|
9347
9642
|
if (!url) return;
|
|
9348
|
-
const cached = await _optionalChain([cache2, 'optionalAccess',
|
|
9349
|
-
const bundle = _optionalChain([cached, 'optionalAccess',
|
|
9643
|
+
const cached = await _optionalChain([cache2, 'optionalAccess', _243 => _243.read, 'call', _244 => _244(), 'access', _245 => _245.catch, 'call', _246 => _246(() => null)]);
|
|
9644
|
+
const bundle = _optionalChain([cached, 'optionalAccess', _247 => _247.url]) === url ? revalidateBundle(cached.bundle) : void 0;
|
|
9350
9645
|
if (cached && bundle && !this.snapshot.fetchedAt) {
|
|
9351
9646
|
this.lastJson = JSON.stringify(bundle);
|
|
9352
9647
|
this.set({ bundle, source: "cache", fetchedAt: cached.fetchedAt, revision: cached.revision });
|
|
@@ -9376,7 +9671,7 @@ var ConfigLoader = (_class2 = class {
|
|
|
9376
9671
|
if (!bundle) {
|
|
9377
9672
|
const errors = issues.filter((i) => i.severity === "error").length;
|
|
9378
9673
|
const needsUpdate = issues.some((i) => i.code === "newer-version");
|
|
9379
|
-
const error = unreachable ? _optionalChain([issues, 'access',
|
|
9674
|
+
const error = unreachable ? _optionalChain([issues, 'access', _248 => _248[0], 'optionalAccess', _249 => _249.message]) : needsUpdate ? "a newer format" : errors === 1 ? "1 error" : `${errors} errors`;
|
|
9380
9675
|
return this.set(
|
|
9381
9676
|
{ loading: false, error, unreachable: !!unreachable, needsUpdate, issues },
|
|
9382
9677
|
this.snapshot.loading || error !== this.snapshot.error || !!unreachable !== !!this.snapshot.unreachable || needsUpdate !== !!this.snapshot.needsUpdate || !sameIssues(issues, this.snapshot.issues)
|
|
@@ -9386,7 +9681,7 @@ var ConfigLoader = (_class2 = class {
|
|
|
9386
9681
|
const changed = json !== this.lastJson;
|
|
9387
9682
|
this.lastJson = json;
|
|
9388
9683
|
const fetchedAt = Date.now();
|
|
9389
|
-
if (changed || revision !== this.snapshot.revision) _optionalChain([cache2, 'optionalAccess',
|
|
9684
|
+
if (changed || revision !== this.snapshot.revision) _optionalChain([cache2, 'optionalAccess', _250 => _250.write, 'call', _251 => _251({ url, fetchedAt, bundle, revision }), 'access', _252 => _252.catch, 'call', _253 => _253(() => {
|
|
9390
9685
|
})]);
|
|
9391
9686
|
this.set(
|
|
9392
9687
|
{ ...changed && { bundle }, source: "remote", fetchedAt, revision, loading: false, error: void 0, unreachable: void 0, needsUpdate: void 0, issues },
|
|
@@ -9403,7 +9698,7 @@ var ConfigLoader = (_class2 = class {
|
|
|
9403
9698
|
/** Stops the loader: cancels a fetch in flight, and nothing it does afterwards changes the state or the cache. */
|
|
9404
9699
|
dispose() {
|
|
9405
9700
|
this.disposed = true;
|
|
9406
|
-
_optionalChain([this, 'access',
|
|
9701
|
+
_optionalChain([this, 'access', _254 => _254.controller, 'optionalAccess', _255 => _255.abort, 'call', _256 => _256()]);
|
|
9407
9702
|
this.listeners.clear();
|
|
9408
9703
|
}
|
|
9409
9704
|
/** `notify: false` drops the patch, so the snapshot only changes when listeners hear about it. */
|
|
@@ -9424,7 +9719,7 @@ function tabIdFor(title, taken) {
|
|
|
9424
9719
|
}
|
|
9425
9720
|
function screenOfType(type, from, docs) {
|
|
9426
9721
|
const shown = from ? screenDocuments(from) : [];
|
|
9427
|
-
const firstOf = (ids) => _nullishCoalesce(_nullishCoalesce(_optionalChain([shown, 'access',
|
|
9722
|
+
const firstOf = (ids) => _nullishCoalesce(_nullishCoalesce(_optionalChain([shown, 'access', _257 => _257.find, 'call', _258 => _258((d) => ids.includes(d.id)), 'optionalAccess', _259 => _259.id]), () => ( ids[0])), () => ( ""));
|
|
9428
9723
|
switch (type) {
|
|
9429
9724
|
case "dashboard":
|
|
9430
9725
|
return { type, dashboard: firstOf(docs.dashboards) };
|
|
@@ -9437,7 +9732,7 @@ function screenOfType(type, from, docs) {
|
|
|
9437
9732
|
}
|
|
9438
9733
|
}
|
|
9439
9734
|
function screenDocuments(screen) {
|
|
9440
|
-
switch (_optionalChain([screen, 'optionalAccess',
|
|
9735
|
+
switch (_optionalChain([screen, 'optionalAccess', _260 => _260.type])) {
|
|
9441
9736
|
case "dashboard":
|
|
9442
9737
|
return [{ id: screen.dashboard, kind: "dashboard" }];
|
|
9443
9738
|
case "forms":
|
|
@@ -10852,8 +11147,8 @@ function removeNode(text, path) {
|
|
|
10852
11147
|
const tree = parseTree2(text);
|
|
10853
11148
|
const value = tree && findNodeAtLocation2(tree, path);
|
|
10854
11149
|
if (!value) return text;
|
|
10855
|
-
const node = _optionalChain([value, 'access',
|
|
10856
|
-
const siblings = _nullishCoalesce(_optionalChain([node, 'access',
|
|
11150
|
+
const node = _optionalChain([value, 'access', _261 => _261.parent, 'optionalAccess', _262 => _262.type]) === "property" ? value.parent : value;
|
|
11151
|
+
const siblings = _nullishCoalesce(_optionalChain([node, 'access', _263 => _263.parent, 'optionalAccess', _264 => _264.children]), () => ( []));
|
|
10857
11152
|
const i = siblings.indexOf(node);
|
|
10858
11153
|
const next = siblings[i + 1];
|
|
10859
11154
|
const prev = siblings[i - 1];
|
|
@@ -10936,20 +11231,20 @@ function removeDocumentFromManifest(text, id) {
|
|
|
10936
11231
|
const edits = [];
|
|
10937
11232
|
const removedTabs = [];
|
|
10938
11233
|
for (let i = tabs.length - 1; i >= 0; i--) {
|
|
10939
|
-
const screen = _optionalChain([tabs, 'access',
|
|
11234
|
+
const screen = _optionalChain([tabs, 'access', _265 => _265[i], 'optionalAccess', _266 => _266.screen]);
|
|
10940
11235
|
const at = ["tabs", i, "screen"];
|
|
10941
11236
|
const removeTab = () => {
|
|
10942
11237
|
edits.push({ path: ["tabs", i], remove: true });
|
|
10943
11238
|
removedTabs.unshift(_nullishCoalesce(tabs[i].title, () => ( tabs[i].id)));
|
|
10944
11239
|
};
|
|
10945
|
-
if (_optionalChain([screen, 'optionalAccess',
|
|
10946
|
-
else if (_optionalChain([screen, 'optionalAccess',
|
|
11240
|
+
if (_optionalChain([screen, 'optionalAccess', _267 => _267.type]) === "dashboard" && screen.dashboard === id) removeTab();
|
|
11241
|
+
else if (_optionalChain([screen, 'optionalAccess', _268 => _268.type]) === "forms" && Array.isArray(screen.forms) && screen.forms.includes(id)) {
|
|
10947
11242
|
if (screen.forms.every((f) => f === id)) removeTab();
|
|
10948
11243
|
else for (let j = screen.forms.length - 1; j >= 0; j--) if (screen.forms[j] === id) edits.push({ path: [...at, "forms", j], remove: true });
|
|
10949
|
-
} else if (_optionalChain([screen, 'optionalAccess',
|
|
11244
|
+
} else if (_optionalChain([screen, 'optionalAccess', _269 => _269.type]) === "menu" && Array.isArray(screen.items))
|
|
10950
11245
|
for (let j = screen.items.length - 1; j >= 0; j--) {
|
|
10951
11246
|
const item = screen.items[j];
|
|
10952
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
11247
|
+
if (_optionalChain([item, 'optionalAccess', _270 => _270.dashboard]) === id || _optionalChain([item, 'optionalAccess', _271 => _271.form]) === id) edits.push({ path: [...at, "items", j], remove: true });
|
|
10953
11248
|
}
|
|
10954
11249
|
}
|
|
10955
11250
|
if (tabs.length && removedTabs.length === tabs.length) throw new Error(`Every tab shows only "${id}". Add another tab first`);
|
|
@@ -10962,21 +11257,21 @@ function renameDocumentInManifest(text, from, to, path) {
|
|
|
10962
11257
|
if (to !== from && to in manifest.documents) throw new Error(`There\u2019s already a document "${to}"`);
|
|
10963
11258
|
const edits = [];
|
|
10964
11259
|
(Array.isArray(manifest.tabs) ? manifest.tabs : []).forEach((tab, i) => {
|
|
10965
|
-
const screen = _optionalChain([tab, 'optionalAccess',
|
|
11260
|
+
const screen = _optionalChain([tab, 'optionalAccess', _272 => _272.screen]);
|
|
10966
11261
|
const at = ["tabs", i, "screen"];
|
|
10967
|
-
if (_optionalChain([screen, 'optionalAccess',
|
|
10968
|
-
if (_optionalChain([screen, 'optionalAccess',
|
|
11262
|
+
if (_optionalChain([screen, 'optionalAccess', _273 => _273.type]) === "dashboard" && screen.dashboard === from) edits.push({ path: [...at, "dashboard"], value: to });
|
|
11263
|
+
if (_optionalChain([screen, 'optionalAccess', _274 => _274.type]) === "forms" && Array.isArray(screen.forms))
|
|
10969
11264
|
screen.forms.forEach((f, j) => f === from && edits.push({ path: [...at, "forms", j], value: to }));
|
|
10970
|
-
if (_optionalChain([screen, 'optionalAccess',
|
|
11265
|
+
if (_optionalChain([screen, 'optionalAccess', _275 => _275.type]) === "menu" && Array.isArray(screen.items))
|
|
10971
11266
|
screen.items.forEach((item, j) => {
|
|
10972
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
10973
|
-
if (_optionalChain([item, 'optionalAccess',
|
|
11267
|
+
if (_optionalChain([item, 'optionalAccess', _276 => _276.dashboard]) === from) edits.push({ path: [...at, "items", j, "dashboard"], value: to });
|
|
11268
|
+
if (_optionalChain([item, 'optionalAccess', _277 => _277.form]) === from) edits.push({ path: [...at, "items", j, "form"], value: to });
|
|
10974
11269
|
});
|
|
10975
11270
|
});
|
|
10976
11271
|
if (path !== void 0) edits.push({ path: ["documents", from], value: path });
|
|
10977
11272
|
let out = applyJsonEdits(text, edits);
|
|
10978
11273
|
if (to !== from) {
|
|
10979
|
-
const key = _optionalChain([findNodeAtLocation2, 'call',
|
|
11274
|
+
const key = _optionalChain([findNodeAtLocation2, 'call', _278 => _278(parseTree2(out), ["documents", from]), 'optionalAccess', _279 => _279.parent, 'optionalAccess', _280 => _280.children, 'optionalAccess', _281 => _281[0]]);
|
|
10980
11275
|
if (key) out = out.slice(0, key.offset) + JSON.stringify(to) + out.slice(key.offset + key.length);
|
|
10981
11276
|
}
|
|
10982
11277
|
return out;
|
|
@@ -10997,7 +11292,7 @@ function inputs(text) {
|
|
|
10997
11292
|
if (d)
|
|
10998
11293
|
for (const p of d.panels.flatMap((x) => x.type === "row" ? [x, ..._nullishCoalesce(x.panels, () => ( []))] : [x])) {
|
|
10999
11294
|
if (typeof p.id !== "number") continue;
|
|
11000
|
-
if (isInputGroup(p)) p.options.fields.forEach((f, i) => typeof _optionalChain([f, 'optionalAccess',
|
|
11295
|
+
if (isInputGroup(p)) p.options.fields.forEach((f, i) => typeof _optionalChain([f, 'optionalAccess', _282 => _282.options, 'optionalAccess', _283 => _283.metric]) === "string" && out.set(`${p.id}.${i}`, { metric: f.options.metric, title: f.title }));
|
|
11001
11296
|
else if (isInputPanel(p)) out.set(String(p.id), { metric: p.options.metric, title: p.title });
|
|
11002
11297
|
}
|
|
11003
11298
|
} catch (e17) {
|
|
@@ -11007,7 +11302,7 @@ function inputs(text) {
|
|
|
11007
11302
|
function reads(text, metric) {
|
|
11008
11303
|
const d = parse2(text);
|
|
11009
11304
|
const panels = d ? d.panels.flatMap((p) => p.type === "row" ? [p, ..._nullishCoalesce(p.panels, () => ( []))] : [p]) : [];
|
|
11010
|
-
return panels.some((p) => (_nullishCoalesce(_optionalChain([p, 'optionalAccess',
|
|
11305
|
+
return panels.some((p) => (_nullishCoalesce(_optionalChain([p, 'optionalAccess', _284 => _284.targets]), () => ( []))).some((t) => t.metric === metric));
|
|
11011
11306
|
}
|
|
11012
11307
|
function metricChanges(before, after) {
|
|
11013
11308
|
const merged = { ...before, ...after };
|
|
@@ -11022,7 +11317,7 @@ function metricChanges(before, after) {
|
|
|
11022
11317
|
for (const [file, text] of Object.entries(after)) {
|
|
11023
11318
|
const old = inputs(before[file]);
|
|
11024
11319
|
for (const [id, input] of inputs(text))
|
|
11025
|
-
if (_optionalChain([old, 'access',
|
|
11320
|
+
if (_optionalChain([old, 'access', _285 => _285.get, 'call', _286 => _286(id), 'optionalAccess', _287 => _287.metric]) === metric && input.metric !== metric) rename ??= { metric, renamedTo: input.metric, file, input: input.title, readBy };
|
|
11026
11321
|
}
|
|
11027
11322
|
changes.push(_nullishCoalesce(rename, () => ( { metric, readBy })));
|
|
11028
11323
|
}
|
|
@@ -11062,14 +11357,14 @@ function variableWithType(v, type) {
|
|
|
11062
11357
|
}
|
|
11063
11358
|
function currentFor(v, value) {
|
|
11064
11359
|
const options = variableOptions({ ...v, current: void 0 });
|
|
11065
|
-
const text = (x) => x === ALL ? "All" : _nullishCoalesce(_optionalChain([options, 'access',
|
|
11360
|
+
const text = (x) => x === ALL ? "All" : _nullishCoalesce(_optionalChain([options, 'access', _288 => _288.find, 'call', _289 => _289((o) => o.value === x), 'optionalAccess', _290 => _290.text]), () => ( x));
|
|
11066
11361
|
return Array.isArray(value) ? { text: value.map(text), value } : { text: text(value), value };
|
|
11067
11362
|
}
|
|
11068
11363
|
function variableWithQuery(v, query) {
|
|
11069
11364
|
const { options: _, current, ...rest } = v;
|
|
11070
11365
|
const next = { ...rest, query };
|
|
11071
11366
|
if (v.type === "textbox" || v.type === "constant") return { ...next, current: { text: query, value: query } };
|
|
11072
|
-
const value = selectValue(next, _optionalChain([current, 'optionalAccess',
|
|
11367
|
+
const value = selectValue(next, _optionalChain([current, 'optionalAccess', _291 => _291.value]), variableOptions(next));
|
|
11073
11368
|
return { ...next, current: currentFor(next, value) };
|
|
11074
11369
|
}
|
|
11075
11370
|
function variableWithCurrent(v, value) {
|
|
@@ -11079,13 +11374,13 @@ function variableWithFlags(v, flags) {
|
|
|
11079
11374
|
const next = { ...v, ...flags };
|
|
11080
11375
|
if (!next.multi) delete next.multi;
|
|
11081
11376
|
if (!next.includeAll) delete next.includeAll;
|
|
11082
|
-
const raw = _optionalChain([v, 'access',
|
|
11377
|
+
const raw = _optionalChain([v, 'access', _292 => _292.current, 'optionalAccess', _293 => _293.value]);
|
|
11083
11378
|
const current = next.multi ? raw == null ? [] : Array.isArray(raw) ? raw : [raw] : Array.isArray(raw) ? raw[0] : raw;
|
|
11084
11379
|
return variableWithCurrent(next, selectValue(next, current, variableOptions({ ...next, current: void 0 })));
|
|
11085
11380
|
}
|
|
11086
11381
|
var refers = (name, flags) => new RegExp(`\\$${name}\\b|\\$\\{${name}(:\\w+)?\\}|\\[\\[${name}(:\\w+)?\\]\\]`, flags);
|
|
11087
11382
|
function allPanels2(dashboard) {
|
|
11088
|
-
return (_nullishCoalesce(dashboard.panels, () => ( []))).flatMap((p) => _optionalChain([p, 'optionalAccess',
|
|
11383
|
+
return (_nullishCoalesce(dashboard.panels, () => ( []))).flatMap((p) => _optionalChain([p, 'optionalAccess', _294 => _294.type]) === "row" ? [p, ..._nullishCoalesce(p.panels, () => ( []))] : [p]).filter((p) => p && typeof p === "object");
|
|
11089
11384
|
}
|
|
11090
11385
|
function variableUses(dashboard, name) {
|
|
11091
11386
|
const re = refers(name);
|
|
@@ -11157,7 +11452,7 @@ function locate(text, tree, path) {
|
|
|
11157
11452
|
for (let n = segs.length; n >= 0; n--) {
|
|
11158
11453
|
const node = findNodeAtLocation2(tree, segs.slice(0, n));
|
|
11159
11454
|
if (!node) continue;
|
|
11160
|
-
const key = _optionalChain([node, 'access',
|
|
11455
|
+
const key = _optionalChain([node, 'access', _295 => _295.parent, 'optionalAccess', _296 => _296.type]) === "property" ? _optionalChain([node, 'access', _297 => _297.parent, 'access', _298 => _298.children, 'optionalAccess', _299 => _299[0]]) : void 0;
|
|
11161
11456
|
if ((node.type === "object" || node.type === "array") && key) return located(text, key.offset, key.length);
|
|
11162
11457
|
if (node.type === "object" || node.type === "array") return located(text, node.offset, 1);
|
|
11163
11458
|
return located(text, node.offset, node.length);
|
|
@@ -11291,7 +11586,7 @@ async function errorText(res) {
|
|
|
11291
11586
|
}
|
|
11292
11587
|
}
|
|
11293
11588
|
async function authHeaders(token) {
|
|
11294
|
-
const t = await _optionalChain([token, 'optionalCall',
|
|
11589
|
+
const t = await _optionalChain([token, 'optionalCall', _300 => _300()]);
|
|
11295
11590
|
return t ? { Authorization: `Bearer ${t}` } : {};
|
|
11296
11591
|
}
|
|
11297
11592
|
var HttpConfigFiles = (_class3 = class {
|
|
@@ -11397,14 +11692,14 @@ function fetchJsonWithToken(token) {
|
|
|
11397
11692
|
return httpFetchJson({ headers: () => authHeaders(token), httpError: (status) => status === 401 ? "not signed in" : `HTTP ${status}` });
|
|
11398
11693
|
}
|
|
11399
11694
|
async function readConfigFiles(source) {
|
|
11400
|
-
const all = await _optionalChain([source, 'access',
|
|
11695
|
+
const all = await _optionalChain([source, 'access', _301 => _301.readAll, 'optionalCall', _302 => _302()]);
|
|
11401
11696
|
const read = all ? async (p) => {
|
|
11402
11697
|
if (!(p in all)) throw new Error(NOT_FOUND);
|
|
11403
11698
|
return all[p];
|
|
11404
11699
|
} : (p) => source.read(p);
|
|
11405
11700
|
const files = { [source.manifestPath]: await read(source.manifestPath) };
|
|
11406
11701
|
const { value } = parseJsonText(files[source.manifestPath]);
|
|
11407
|
-
const documents = _nullishCoalesce(_optionalChain([value, 'optionalAccess',
|
|
11702
|
+
const documents = _nullishCoalesce(_optionalChain([value, 'optionalAccess', _303 => _303.documents]), () => ( {}));
|
|
11408
11703
|
const paths = [...new Set(Object.values(documents).filter((d) => typeof d === "string"))];
|
|
11409
11704
|
await Promise.all(
|
|
11410
11705
|
paths.map(async (p) => {
|
|
@@ -11458,7 +11753,7 @@ var CANVAS_ROW_HEADER = 32;
|
|
|
11458
11753
|
function panelSize(panel, mode) {
|
|
11459
11754
|
const p = pos(panel);
|
|
11460
11755
|
if (mode === "grid") return { span: clampW(p.w), h: clampH(p.h) };
|
|
11461
|
-
return { span: panelSpan(panel, "phone"), h: clampH(_nullishCoalesce(_optionalChain([panel, 'access',
|
|
11756
|
+
return { span: panelSpan(panel, "phone"), h: clampH(_nullishCoalesce(_optionalChain([panel, 'access', _304 => _304.mobile, 'optionalAccess', _305 => _305.h]), () => ( p.h))) };
|
|
11462
11757
|
}
|
|
11463
11758
|
function layoutCanvas(panels, order, mode, width, override) {
|
|
11464
11759
|
return mode === "grid" ? layoutGridCanvas(panels, width, override) : layoutPhoneCanvas(panels, order, width, override);
|
|
@@ -11478,7 +11773,7 @@ function layoutGridCanvas(panels, width, override) {
|
|
|
11478
11773
|
boxes = [...boxes];
|
|
11479
11774
|
boxes[override.index] = b;
|
|
11480
11775
|
}
|
|
11481
|
-
const settled = settleBoxes(boxes, _optionalChain([override, 'optionalAccess',
|
|
11776
|
+
const settled = settleBoxes(boxes, _optionalChain([override, 'optionalAccess', _306 => _306.index]));
|
|
11482
11777
|
const items = settled.map((b, index) => {
|
|
11483
11778
|
const row = isRow(panels[index]);
|
|
11484
11779
|
return { index, row, x: b.x * colW, y: gridOffsetPx(b.y), width: b.w * colW - CANVAS_GAP, height: row ? gridUnitsToPx(1) : gridUnitsToPx(b.h), span: b.w, h: b.h };
|
|
@@ -11522,12 +11817,12 @@ function layoutPhoneCanvas(panels, order, width, override) {
|
|
|
11522
11817
|
y += CANVAS_ROW_HEADER + CANVAS_GAP;
|
|
11523
11818
|
continue;
|
|
11524
11819
|
}
|
|
11525
|
-
if (mode === "phone" && _optionalChain([panel, 'access',
|
|
11820
|
+
if (mode === "phone" && _optionalChain([panel, 'access', _307 => _307.mobile, 'optionalAccess', _308 => _308.hidden])) {
|
|
11526
11821
|
hidden.push(index);
|
|
11527
11822
|
continue;
|
|
11528
11823
|
}
|
|
11529
11824
|
const natural = panelSize(panel, mode);
|
|
11530
|
-
const size = _optionalChain([override, 'optionalAccess',
|
|
11825
|
+
const size = _optionalChain([override, 'optionalAccess', _309 => _309.index]) === index ? { span: clampW(_nullishCoalesce(override.span, () => ( natural.span))), h: clampH(_nullishCoalesce(override.h, () => ( natural.h))) } : natural;
|
|
11531
11826
|
if (used + size.span > GRID_COLUMNS) flush();
|
|
11532
11827
|
line.push({ index, row: false, x: 0, y: 0, width: 0, height: 0, ...size });
|
|
11533
11828
|
used += size.span;
|
|
@@ -11545,7 +11840,7 @@ function dropTarget(canvas, x, y, dragging) {
|
|
|
11545
11840
|
for (const c of pool) if (distance(c) < distance(best)) best = c;
|
|
11546
11841
|
const after = best.row ? y > best.y + best.height / 2 : x > best.x + best.width / 2;
|
|
11547
11842
|
if (!after) return best.index;
|
|
11548
|
-
return _nullishCoalesce(_optionalChain([items, 'access',
|
|
11843
|
+
return _nullishCoalesce(_optionalChain([items, 'access', _310 => _310[items.indexOf(best) + 1], 'optionalAccess', _311 => _311.index]), () => ( null));
|
|
11549
11844
|
}
|
|
11550
11845
|
function movePanel(panels, index, before) {
|
|
11551
11846
|
if (before === index) return panels;
|
|
@@ -11757,9 +12052,9 @@ var refers2 = (name) => new RegExp(`\\$${name}\\b|\\$\\{${name}(:\\w+)?\\}|\\[\\
|
|
|
11757
12052
|
var withChildren = (p) => [p, ...isRow(p) ? _nullishCoalesce(p.panels, () => ( [])) : []];
|
|
11758
12053
|
function panelMetrics(p) {
|
|
11759
12054
|
const found = [];
|
|
11760
|
-
if (isInputType(p.type) && typeof _optionalChain([p, 'access',
|
|
11761
|
-
if (p.type === INPUT_GROUP && Array.isArray(_optionalChain([p, 'access',
|
|
11762
|
-
for (const f of p.options.fields) if (typeof _optionalChain([f, 'optionalAccess',
|
|
12055
|
+
if (isInputType(p.type) && typeof _optionalChain([p, 'access', _312 => _312.options, 'optionalAccess', _313 => _313.metric]) === "string") found.push(p.options.metric);
|
|
12056
|
+
if (p.type === INPUT_GROUP && Array.isArray(_optionalChain([p, 'access', _314 => _314.options, 'optionalAccess', _315 => _315.fields]))) {
|
|
12057
|
+
for (const f of p.options.fields) if (typeof _optionalChain([f, 'optionalAccess', _316 => _316.options, 'optionalAccess', _317 => _317.metric]) === "string") found.push(f.options.metric);
|
|
11763
12058
|
}
|
|
11764
12059
|
for (const t of _nullishCoalesce(p.targets, () => ( []))) if (typeof t.metric === "string" && t.metric && !t.metric.startsWith("$")) found.push(t.metric);
|
|
11765
12060
|
return found;
|
|
@@ -11767,15 +12062,15 @@ function panelMetrics(p) {
|
|
|
11767
12062
|
function renameMetrics(panels, map) {
|
|
11768
12063
|
const rename = (p) => {
|
|
11769
12064
|
let out = p;
|
|
11770
|
-
if (isInputType(p.type) && typeof _optionalChain([p, 'access',
|
|
11771
|
-
if (p.type === INPUT_GROUP && Array.isArray(_optionalChain([p, 'access',
|
|
12065
|
+
if (isInputType(p.type) && typeof _optionalChain([p, 'access', _318 => _318.options, 'optionalAccess', _319 => _319.metric]) === "string" && map[p.options.metric]) out = { ...out, options: { ...out.options, metric: map[p.options.metric] } };
|
|
12066
|
+
if (p.type === INPUT_GROUP && Array.isArray(_optionalChain([p, 'access', _320 => _320.options, 'optionalAccess', _321 => _321.fields]))) {
|
|
11772
12067
|
const to = (m) => typeof m === "string" && map[m] || m;
|
|
11773
|
-
const fields = p.options.fields.map((f) => _optionalChain([f, 'optionalAccess',
|
|
12068
|
+
const fields = p.options.fields.map((f) => _optionalChain([f, 'optionalAccess', _322 => _322.options]) && to(f.options.metric) !== f.options.metric ? { ...f, options: { ...f.options, metric: to(f.options.metric) } } : f);
|
|
11774
12069
|
const titleFrom = to(p.options.titleFrom);
|
|
11775
12070
|
out = { ...out, options: { ...out.options, fields, ...titleFrom !== void 0 && { titleFrom } } };
|
|
11776
12071
|
}
|
|
11777
|
-
if (_optionalChain([p, 'access',
|
|
11778
|
-
if (_optionalChain([p, 'access',
|
|
12072
|
+
if (_optionalChain([p, 'access', _323 => _323.targets, 'optionalAccess', _324 => _324.some, 'call', _325 => _325((t) => typeof t.metric === "string" && map[t.metric])])) out = { ...out, targets: p.targets.map((t) => typeof t.metric === "string" && map[t.metric] ? { ...t, metric: map[t.metric] } : t) };
|
|
12073
|
+
if (_optionalChain([p, 'access', _326 => _326.panels, 'optionalAccess', _327 => _327.length])) out = { ...out, panels: p.panels.map(rename) };
|
|
11779
12074
|
return out;
|
|
11780
12075
|
};
|
|
11781
12076
|
return panels.map(rename);
|
|
@@ -11795,7 +12090,7 @@ function copyPanels(dashboard, indices) {
|
|
|
11795
12090
|
}
|
|
11796
12091
|
}
|
|
11797
12092
|
const chosen = order.filter((i) => picked.has(i)).map((i) => panels[i]);
|
|
11798
|
-
return snippetOf(chosen, _nullishCoalesce(_optionalChain([dashboard, 'access',
|
|
12093
|
+
return snippetOf(chosen, _nullishCoalesce(_optionalChain([dashboard, 'access', _328 => _328.templating, 'optionalAccess', _329 => _329.list]), () => ( [])));
|
|
11799
12094
|
}
|
|
11800
12095
|
function snippetOf(panels, available) {
|
|
11801
12096
|
const left = Math.min(...panels.map((p) => pos2(p).x));
|
|
@@ -11863,7 +12158,7 @@ var sameVariable = (a, b) => {
|
|
|
11863
12158
|
return strip(a) === strip(b);
|
|
11864
12159
|
};
|
|
11865
12160
|
function previewPaste(dashboard, snippet) {
|
|
11866
|
-
const { added, renamed } = mergeVariables(_nullishCoalesce(_optionalChain([dashboard, 'access',
|
|
12161
|
+
const { added, renamed } = mergeVariables(_nullishCoalesce(_optionalChain([dashboard, 'access', _330 => _330.templating, 'optionalAccess', _331 => _331.list]), () => ( [])), snippet.variables);
|
|
11867
12162
|
return { added, renamed };
|
|
11868
12163
|
}
|
|
11869
12164
|
function mergeVariables(existing, incoming) {
|
|
@@ -11900,7 +12195,7 @@ function pasteSnippet(dashboard, snippet, options = {}) {
|
|
|
11900
12195
|
return true;
|
|
11901
12196
|
};
|
|
11902
12197
|
let incoming = snippet.panels.filter(keep).map((p) => p.panels ? { ...p, panels: p.panels.filter(keep) } : p);
|
|
11903
|
-
const { variables, added, renamed } = mergeVariables(_nullishCoalesce(_optionalChain([dashboard, 'access',
|
|
12198
|
+
const { variables, added, renamed } = mergeVariables(_nullishCoalesce(_optionalChain([dashboard, 'access', _332 => _332.templating, 'optionalAccess', _333 => _333.list]), () => ( [])), snippet.variables);
|
|
11904
12199
|
for (const [from, to] of Object.entries(renamed)) incoming = renameVariableInPanels(incoming, from, to);
|
|
11905
12200
|
if (options.metrics) incoming = renameMetrics(incoming, options.metrics);
|
|
11906
12201
|
const after = options.after != null ? existing[options.after] : void 0;
|
|
@@ -11965,7 +12260,7 @@ function parseTemplate(text) {
|
|
|
11965
12260
|
if (seen.has(d.id)) return { error: `Two documents are called "${d.id}"` };
|
|
11966
12261
|
seen.add(d.id);
|
|
11967
12262
|
const { dashboard, issues } = prepareDashboard(d.dashboard, d.id);
|
|
11968
|
-
if (!dashboard) return { error: `"${d.id}" can\u2019t be shown: ${_nullishCoalesce(_optionalChain([issues, 'access',
|
|
12263
|
+
if (!dashboard) return { error: `"${d.id}" can\u2019t be shown: ${_nullishCoalesce(_optionalChain([issues, 'access', _334 => _334.find, 'call', _335 => _335((x) => x.severity === "error"), 'optionalAccess', _336 => _336.message]), () => ( "it isn\u2019t a dashboard"))}` };
|
|
11969
12264
|
if (dashboard.kind && dashboard.kind !== d.kind) return { error: `"${d.id}" is listed as a ${d.kind} but says it\u2019s a ${dashboard.kind}` };
|
|
11970
12265
|
documents.push({ kind: d.kind, id: d.id, dashboard });
|
|
11971
12266
|
}
|
|
@@ -12043,9 +12338,9 @@ function applyTemplate(manifestText, paths, template, options = {}) {
|
|
|
12043
12338
|
}
|
|
12044
12339
|
const tabIds = (_nullishCoalesce(manifest.tabs, () => ( []))).map((t) => t.id);
|
|
12045
12340
|
const added = [];
|
|
12046
|
-
let at = _nullishCoalesce(_optionalChain([manifest, 'access',
|
|
12341
|
+
let at = _nullishCoalesce(_optionalChain([manifest, 'access', _337 => _337.tabs, 'optionalAccess', _338 => _338.length]), () => ( 0));
|
|
12047
12342
|
for (const tab of template.tabs) {
|
|
12048
|
-
if (!_optionalChain([options, 'access',
|
|
12343
|
+
if (!_optionalChain([options, 'access', _339 => _339.tabs, 'optionalAccess', _340 => _340.includes, 'call', _341 => _341(tab.id)])) continue;
|
|
12049
12344
|
const screen = retarget(tab.screen, ids);
|
|
12050
12345
|
if (!screen) continue;
|
|
12051
12346
|
const id = tabIdFor(tab.id, tabIds);
|
|
@@ -12267,7 +12562,7 @@ function readTemplateAnswer(text) {
|
|
|
12267
12562
|
);
|
|
12268
12563
|
const kept = new Set(template.tabs.map((t) => t.id));
|
|
12269
12564
|
for (const [i, tab] of (Array.isArray(raw.tabs) ? raw.tabs : []).entries()) {
|
|
12270
|
-
const id = _optionalChain([tab, 'optionalAccess',
|
|
12565
|
+
const id = _optionalChain([tab, 'optionalAccess', _342 => _342.id]);
|
|
12271
12566
|
if (typeof id !== "string" || !kept.has(id)) warnings.push(`tabs[${i}] was left out: it needs an id, a title and a screen showing only this template\u2019s documents`);
|
|
12272
12567
|
}
|
|
12273
12568
|
const kinds = new Map(template.documents.map((d) => [d.id, d.kind]));
|
|
@@ -12315,9 +12610,9 @@ function readDocumentAnswer(text, kind) {
|
|
|
12315
12610
|
return { error: e.message };
|
|
12316
12611
|
}
|
|
12317
12612
|
const wrapper = json;
|
|
12318
|
-
if (_optionalChain([wrapper, 'optionalAccess',
|
|
12613
|
+
if (_optionalChain([wrapper, 'optionalAccess', _343 => _343.$modelform]) === "template") {
|
|
12319
12614
|
if (!Array.isArray(wrapper.documents) || wrapper.documents.length !== 1) return { error: `That\u2019s a template, not one ${kind}` };
|
|
12320
|
-
json = _optionalChain([wrapper, 'access',
|
|
12615
|
+
json = _optionalChain([wrapper, 'access', _344 => _344.documents, 'access', _345 => _345[0], 'optionalAccess', _346 => _346.dashboard]);
|
|
12321
12616
|
}
|
|
12322
12617
|
if (!json || typeof json !== "object" || Array.isArray(json)) return { error: `That isn\u2019t a ${kind}` };
|
|
12323
12618
|
const raw = json;
|
|
@@ -12356,8 +12651,8 @@ function documentChanges(before, after) {
|
|
|
12356
12651
|
const what = [];
|
|
12357
12652
|
if (was.title !== p.title) what.push("title");
|
|
12358
12653
|
if (was.type !== p.type) what.push("type");
|
|
12359
|
-
if (_optionalChain([was, 'access',
|
|
12360
|
-
if (_optionalChain([was, 'access',
|
|
12654
|
+
if (_optionalChain([was, 'access', _347 => _347.gridPos, 'optionalAccess', _348 => _348.x]) !== _optionalChain([p, 'access', _349 => _349.gridPos, 'optionalAccess', _350 => _350.x]) || _optionalChain([was, 'access', _351 => _351.gridPos, 'optionalAccess', _352 => _352.y]) !== _optionalChain([p, 'access', _353 => _353.gridPos, 'optionalAccess', _354 => _354.y])) what.push("position");
|
|
12655
|
+
if (_optionalChain([was, 'access', _355 => _355.gridPos, 'optionalAccess', _356 => _356.w]) !== _optionalChain([p, 'access', _357 => _357.gridPos, 'optionalAccess', _358 => _358.w]) || _optionalChain([was, 'access', _359 => _359.gridPos, 'optionalAccess', _360 => _360.h]) !== _optionalChain([p, 'access', _361 => _361.gridPos, 'optionalAccess', _362 => _362.h])) what.push("size");
|
|
12361
12656
|
if (!same(was.options, p.options)) what.push("options");
|
|
12362
12657
|
if (!same(was.targets, p.targets) || !same(was.datasource, p.datasource) || !same(was.transformations, p.transformations)) what.push("queries");
|
|
12363
12658
|
if (!same(was.fieldConfig, p.fieldConfig)) what.push("field config");
|
|
@@ -12623,4 +12918,5 @@ function documentChanges(before, after) {
|
|
|
12623
12918
|
|
|
12624
12919
|
|
|
12625
12920
|
|
|
12626
|
-
|
|
12921
|
+
|
|
12922
|
+
exports.frameLength = frameLength; exports.timeField = timeField; exports.numberFields = numberFields; exports.fieldDisplayName = fieldDisplayName; exports.toSeries = toSeries; exports.toXYSeries = toXYSeries; exports.uniqueNames = uniqueNames; exports.toMillis = toMillis; exports.parseTime = parseTime; exports.parseRange = parseRange; exports.addTime = addTime; exports.startOf = startOf; exports.parseDuration = parseDuration; exports.calculateInterval = calculateInterval; exports.formatDuration = formatDuration; exports.TIME_PRESETS = TIME_PRESETS; exports.RELATIVE_RANGES = RELATIVE_RANGES; exports.parseLocalDateTime = parseLocalDateTime; exports.formatLocalDateTime = formatLocalDateTime; exports.timeExprError = timeExprError; exports.describeRange = describeRange; exports.zoomRange = zoomRange; exports.ALL = ALL; exports.initialVariableValues = initialVariableValues; exports.variableOptions = variableOptions; exports.variableInfo = variableInfo; exports.visibleVariables = visibleVariables; exports.isSqlDatasource = isSqlDatasource; exports.framesToOptions = framesToOptions; exports.refineOptions = refineOptions; exports.selectValue = selectValue; exports.variableReferences = variableReferences; exports.interpolate = interpolate; exports.queryParam = queryParam; exports.interpolateDeep = interpolateDeep; exports.resolveTimezone = resolveTimezone; exports.valueText = valueText; exports.GRID_COLUMNS = GRID_COLUMNS; exports.gridUnitsToPx = gridUnitsToPx; exports.gridOffsetPx = gridOffsetPx; exports.compactGrid = compactGrid; exports.isRow = isRow; exports.layoutDashboard = layoutDashboard; exports.repeatOptions = repeatOptions; exports.panelKey = panelKey; exports.panelSpan = panelSpan; exports.applyTransformations = applyTransformations; exports.DASHBOARD_DS = DASHBOARD_DS; exports.dashboardSourceIds = dashboardSourceIds; exports.panelHasQueries = panelHasQueries; exports.queryPanel = queryPanel; exports.normalizeRef = normalizeRef; exports.refreshedVariables = refreshedVariables; exports.variableDependents = variableDependents; exports.variableOrder = variableOrder; exports.resolveVariables = resolveVariables; exports.REDUCER_LABELS = REDUCER_LABELS; exports.isReducer = isReducer; exports.reduce = reduce; exports.INPUT_OPTION_KEYS = INPUT_OPTION_KEYS; exports.INPUT_TYPES = INPUT_TYPES; exports.isInputType = isInputType; exports.isInputPanel = isInputPanel; exports.INPUT_GROUP = INPUT_GROUP; exports.isFormPanelType = isFormPanelType; exports.isInputGroup = isInputGroup; exports.GROUP_FIELD_TYPES = GROUP_FIELD_TYPES; exports.groupFields = groupFields; exports.inputPanels = inputPanels; exports.documentKind = documentKind; exports.inputGroups = inputGroups; exports.plainInputPanels = plainInputPanels; exports.parseClockDigits = parseClockDigits; exports.formatClock = formatClock; exports.toEntries = toEntries; exports.newSaveId = newSaveId; exports.isEmptyItem = isEmptyItem; exports.groupToEntries = groupToEntries; exports.entriesToItems = entriesToItems; exports.groupProblems = groupProblems; exports.sameSave = sameSave; exports.inputProblem = inputProblem; exports.entryToInputValue = entryToInputValue; exports.textSuggestions = textSuggestions; exports.entriesSavedWith = entriesSavedWith; exports.formatValue = formatValue; exports.thresholdStep = thresholdStep; exports.NAMED_COLORS = NAMED_COLORS; exports.resolveColor = resolveColor; exports.SERIES_PALETTE = SERIES_PALETTE; exports.seriesColor = seriesColor; exports.mappedResult = mappedResult; exports.formatDisplay = formatDisplay; exports.valueColor = valueColor; exports.resolveFieldConfig = resolveFieldConfig; exports.fieldMatches = fieldMatches; exports.GrafanaError = GrafanaError; exports.GrafanaClient = GrafanaClient; exports.GrafanaDataSource = GrafanaDataSource; exports.fromWire = fromWire; exports.parseSpokenNumber = parseSpokenNumber; exports.parseSpokenDuration = parseSpokenDuration; exports.matchChoices = matchChoices; exports.parseSpokenYesNo = parseSpokenYesNo; exports.spokenValue = spokenValue; exports.DICTATION_TYPES = DICTATION_TYPES; exports.takesDictation = takesDictation; exports.dictationHints = dictationHints; exports.choicesOf = choicesOf; exports.fillForm = fillForm; exports.fillSchema = fillSchema; exports.fillPrompt = fillPrompt; exports.parseFillAnswer = parseFillAnswer; exports.readFill = readFill; exports.modelFiller = modelFiller; exports.fillHints = fillHints; exports.ruleFill = ruleFill; exports.ruleFiller = ruleFiller; exports.LOCAL_DATASOURCE_TYPE = LOCAL_DATASOURCE_TYPE; exports.isLocalDatasource = isLocalDatasource; exports.LocalDataSource = LocalDataSource; exports.groupField = groupField; exports.buildFrames = buildFrames; exports.MemoryEntryStore = MemoryEntryStore; exports.DEFAULT_GAZETTEER = DEFAULT_GAZETTEER; exports.parseGazetteer = parseGazetteer; exports.loadGazetteer = loadGazetteer; exports.resolveLinks = resolveLinks; exports.parseDashboardLink = parseDashboardLink; exports.applyDashboardLink = applyDashboardLink; exports.appSchema = appSchema; exports.dashboardSchema = dashboardSchema; exports.pointerToPath = pointerToPath; exports.manifestSchemaIssues = manifestSchemaIssues; exports.dashboardSchemaIssues = dashboardSchemaIssues; exports.cleanDashboard = cleanDashboard; exports.MAPPING_TYPES = MAPPING_TYPES; exports.SPECIAL_MATCHES = SPECIAL_MATCHES; exports.mappingRows = mappingRows; exports.rowsToMappings = rowsToMappings; exports.mappingRow = mappingRow; exports.mappingProblem = mappingProblem; exports.OPTION_CATEGORIES = OPTION_CATEGORIES; exports.UNIT_CHOICES = UNIT_CHOICES; exports.panelOptions = panelOptions; exports.getPath = getPath; exports.optionValue = optionValue; exports.setOption = setOption; exports.setOptionValue = setOptionValue; exports.cleanPanelOptions = cleanPanelOptions; exports.OVERRIDE_MATCHERS = OVERRIDE_MATCHERS; exports.overrideProperties = overrideProperties; exports.panelOverrides = panelOverrides; exports.setOverrides = setOverrides; exports.MANIFEST_VERSION = MANIFEST_VERSION; exports.requiredManifestVersion = requiredManifestVersion; exports.validateManifest = validateManifest; exports.prepareDashboard = prepareDashboard; exports.validateDashboard = validateDashboard2; exports.validateBundle = validateBundle; exports.resolveUrl = resolveUrl; exports.httpFetchJson = httpFetchJson; exports.defaultFetchJson = defaultFetchJson; exports.BUNDLE_TYPE = BUNDLE_TYPE; exports.BUNDLE_ACCEPT = BUNDLE_ACCEPT; exports.isBundleResponse = isBundleResponse; exports.bundleRoot = bundleRoot; exports.assembleFromResponse = assembleFromResponse; exports.assembleBundle = assembleBundle; exports.fetchBundle = fetchBundle; exports.revalidateBundle = revalidateBundle; exports.ConfigLoader = ConfigLoader; exports.tabIdFor = tabIdFor; exports.screenOfType = screenOfType; exports.screenDocuments = screenDocuments; exports.documentUses = documentUses; exports.stringifyCompact = stringifyCompact; exports.applyJsonEdits = applyJsonEdits; exports.diffJson = diffJson; exports.documentIdFor = documentIdFor; exports.removeDocumentFromManifest = removeDocumentFromManifest; exports.renameDocumentInManifest = renameDocumentInManifest; exports.metricChanges = metricChanges; exports.REFRESH_CHOICES = REFRESH_CHOICES; exports.EDITABLE_VARIABLE_TYPES = EDITABLE_VARIABLE_TYPES; exports.isEditableVariableType = isEditableVariableType; exports.variableNameError = variableNameError; exports.newVariable = newVariable; exports.variableWithType = variableWithType; exports.variableWithQuery = variableWithQuery; exports.variableWithCurrent = variableWithCurrent; exports.variableWithFlags = variableWithFlags; exports.variableUses = variableUses; exports.renameVariableInPanels = renameVariableInPanels; exports.lineColumn = lineColumn; exports.parseJsonText = parseJsonText; exports.splitPath = splitPath; exports.locate = locate; exports.checkFiles = checkFiles; exports.bundleFromFiles = bundleFromFiles; exports.formatJsonText = formatJsonText; exports.setJsonValue = setJsonValue; exports.PANEL_TYPES = PANEL_TYPES; exports.newPanel = newPanel; exports.newDocument = newDocument; exports.SaveConflictError = SaveConflictError; exports.HttpConfigFiles = HttpConfigFiles; exports.fetchJsonWithToken = fetchJsonWithToken; exports.readConfigFiles = readConfigFiles; exports.readingOrder = readingOrder; exports.repack = repack; exports.CANVAS_GAP = CANVAS_GAP; exports.CANVAS_ROW_HEADER = CANVAS_ROW_HEADER; exports.panelSize = panelSize; exports.layoutCanvas = layoutCanvas; exports.dropTarget = dropTarget; exports.movePanel = movePanel; exports.resizePanel = resizePanel; exports.setHiddenOnPhones = setHiddenOnPhones; exports.nextPanelId = nextPanelId; exports.insertPanel = insertPanel; exports.duplicatePanel = duplicatePanel; exports.removePanel = removePanel; exports.expandRow = expandRow; exports.collapseRow = collapseRow; exports.settleLayout = settleLayout; exports.placePanel = placePanel; exports.snapToGrid = snapToGrid; exports.panelEdits = panelEdits; exports.sampleEntries = sampleEntries; exports.SNIPPET_VERSION = SNIPPET_VERSION; exports.panelMetrics = panelMetrics; exports.renameMetrics = renameMetrics; exports.copyPanels = copyPanels; exports.parseSnippet = parseSnippet; exports.previewPaste = previewPaste; exports.pasteSnippet = pasteSnippet; exports.TEMPLATE_VERSION = TEMPLATE_VERSION; exports.makeTemplate = makeTemplate; exports.parseTemplate = parseTemplate; exports.templateNeeds = templateNeeds; exports.applyTemplate = applyTemplate; exports.DOCUMENT_GUIDE = DOCUMENT_GUIDE; exports.AUTHORING_GUIDE = AUTHORING_GUIDE; exports.EXAMPLE_TEMPLATE = EXAMPLE_TEMPLATE; exports.templatePrompt = templatePrompt; exports.jsonFromAnswer = jsonFromAnswer; exports.readTemplateAnswer = readTemplateAnswer; exports.fixTemplatePrompt = fixTemplatePrompt; exports.documentPrompt = documentPrompt; exports.readDocumentAnswer = readDocumentAnswer; exports.fixDocumentPrompt = fixDocumentPrompt; exports.documentChanges = documentChanges;
|