@salesforcedevs/dx-components 1.3.181 → 1.3.183

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.3.181",
3
+ "version": "1.3.183",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -41,5 +41,5 @@
41
41
  "eventsourcemock": "^2.0.0",
42
42
  "luxon": "^3.1.0"
43
43
  },
44
- "gitHead": "72f9a2f22e59954161ccd708d477b739117203f3"
44
+ "gitHead": "cdfd81bf3dd2b43b54f949f5f265716b52ca7f6a"
45
45
  }
@@ -7,8 +7,26 @@ import {
7
7
  } from "@sfdocs-internal/wires";
8
8
  import { track as gtmTrack } from "dxUtils/analytics";
9
9
  import prism from "dxUtils/prismjs";
10
+ import { ampscript } from "./customLanguages";
10
11
 
11
- // Used por remove enclosing <pre> tag's (if occurs)
12
+ /*
13
+ Here we create custom syntax highlighting rules for proprietary languages
14
+ */
15
+ // AMPScript
16
+ prism.languages.ampscript = prism.languages.extend("markup");
17
+ prism.languages.insertBefore("ampscript", "comment", { ampscript });
18
+
19
+ // SSJS (Server-Side JavaScript)
20
+ prism.languages.ssjs = prism.languages.extend("markup");
21
+ prism.languages.insertBefore("ssjs", "comment", { ampscript });
22
+
23
+ // GTL (Guide Template Language)
24
+ prism.languages.gtl = prism.languages.extend(
25
+ "markup",
26
+ prism.languages.handlebars
27
+ );
28
+
29
+ // Used for remove enclosing <pre> tag's (if occurs)
12
30
  const preTagRegexp: RegExp = /^<pre.*?>(.*)<\/pre>$/is;
13
31
 
14
32
  const LIGHT = "light";
@@ -37,11 +55,13 @@ export default class CodeBlock extends LightningElement {
37
55
  { label: "Apex", id: "apex" },
38
56
  { label: "Java", id: "java" },
39
57
  { label: "Javascript", id: "javascript" },
58
+ { label: "Javascript", id: "js" },
40
59
  { label: "CSS", id: "css" },
41
60
  { label: "Visualforce", id: "visualforce" },
42
61
  { label: "Html", id: "html" },
43
62
  { label: "xml", id: "xml" },
44
63
  { label: "TypeScript", id: "typescript" },
64
+ { label: "TypeScript", id: "ts" },
45
65
  { label: "PHP", id: "php" },
46
66
  { label: "JSON", id: "json" },
47
67
  { label: "Swift", id: "swift" },
@@ -52,9 +72,15 @@ export default class CodeBlock extends LightningElement {
52
72
  { label: "Shell", id: "sh" },
53
73
  { label: "SQL", id: "sql" },
54
74
  { label: "YAML", id: "yaml" },
75
+ { label: "YAML", id: "yml" },
55
76
  { label: "Markdown", id: "markdown" },
56
77
  { label: "Markdown", id: "md" },
57
- { label: "JSX", id: "jsx" }
78
+ { label: "JSX", id: "jsx" },
79
+ { label: "GraphQL", id: "graphql" },
80
+ { label: "DataWeave", id: "dataweave" },
81
+ { label: "AMPScript", id: "ampscript" },
82
+ { label: "SSJS", id: "ssjs" },
83
+ { label: "GTL", id: "gtl" }
58
84
  ];
59
85
 
60
86
  connectedCallback() {
@@ -0,0 +1,37 @@
1
+ export const ampscript = {
2
+ pattern: /%%=\s*([\s\S]*?)\s*=%%|%%\[([\s\S]*?)\]%%/,
3
+ greedy: true,
4
+ inside: {
5
+ delimiter: {
6
+ pattern: /%%=|=%%|%%\[|\]%%/,
7
+ alias: "operator"
8
+ },
9
+ comment: {
10
+ pattern: /(\/\/.*|\/\*[\s\S]*?\*\/)/,
11
+ greedy: true
12
+ },
13
+ string: {
14
+ pattern: /(["'])(?:\\.|(?!\1)[^\\\r\n])*\1/,
15
+ greedy: true,
16
+ inside: {
17
+ escape: /\\./
18
+ }
19
+ },
20
+ function: {
21
+ pattern: /\b\w+\b(?=\()/i,
22
+ greedy: true
23
+ },
24
+ boolean: /\b(true|false|null)\b/i,
25
+ number: /\b(0(x|X)[0-9a-fA-F]+|([0-9]+(\.[0-9]+)?))\b/,
26
+ keyword:
27
+ /\b(do|else|elseif|for|if(?:\s+not)?|endif|next|then|to|downto|var|set)\b/i,
28
+ operator: /==|!=|>|<|>=|<=|=/,
29
+ variable: {
30
+ pattern: /@\w+|\[\w+\]/,
31
+ greedy: true
32
+ },
33
+ constant:
34
+ /\b(xtmonth|xtmonthnumeric|xtday|xtdayofweek|xtyear|xtshortdate|xtlongdate)\b/i,
35
+ logical: /\b(and|or|not)\b/i
36
+ }
37
+ };
@@ -37,7 +37,7 @@ function commonjsRequire() {
37
37
  //Start autogenerated code
38
38
  var prism = createCommonjsModule(function (module) {
39
39
  /* PrismJS 1.29.0
40
- https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+apex+aspnet+bash+basic+c+csharp+cpp+css-extras+java+javadoc+javadoclike+jsdoc+js-extras+json+json5+jsonp+jsstacktrace+kotlin+markdown+markup-templating+php+phpdoc+php-extras+plsql+python+jsx+regex+sql+swift+typescript+typoscript+uri+vbnet+yaml&plugins=line-numbers+unescaped-markup+match-braces */
40
+ https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript+apex+aspnet+bash+basic+c+csharp+cpp+css-extras+dataweave+graphql+handlebars+java+javadoc+javadoclike+jsdoc+js-extras+json+json5+jsonp+jsstacktrace+kotlin+markdown+markup-templating+php+phpdoc+php-extras+plsql+python+jsx+regex+sql+swift+typescript+typoscript+uri+vbnet+yaml&plugins=unescaped-markup+match-braces */
41
41
  var _self =
42
42
  "undefined" != typeof window
43
43
  ? window
@@ -1780,6 +1780,287 @@ https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javasc
1780
1780
  number: i
1781
1781
  });
1782
1782
  })(Prism);
1783
+ !(function (e) {
1784
+ e.languages.dataweave = {
1785
+ url: /\b[A-Za-z]+:\/\/[\w/:.?=&-]+|\burn:[\w:.?=&-]+/,
1786
+ property: {
1787
+ pattern:
1788
+ /(?:\b\w+#)?(?:"(?:\\.|[^\\"\r\n])*"|\b\w+)(?=\s*[:@])/,
1789
+ greedy: !0
1790
+ },
1791
+ string: {
1792
+ pattern: /(["'`])(?:\\[\s\S]|(?!\1)[^\\])*\1/,
1793
+ greedy: !0
1794
+ },
1795
+ "mime-type":
1796
+ /\b(?:application|audio|image|multipart|text|video)\/[\w+-]+/,
1797
+ date: { pattern: /\|[\w:+-]+\|/, greedy: !0 },
1798
+ comment: [
1799
+ {
1800
+ pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,
1801
+ lookbehind: !0,
1802
+ greedy: !0
1803
+ },
1804
+ { pattern: /(^|[^\\:])\/\/.*/, lookbehind: !0, greedy: !0 }
1805
+ ],
1806
+ regex: { pattern: /\/(?:[^\\\/\r\n]|\\[^\r\n])+\//, greedy: !0 },
1807
+ keyword:
1808
+ /\b(?:and|as|at|case|do|else|fun|if|input|is|match|not|ns|null|or|output|type|unless|update|using|var)\b/,
1809
+ function: /\b[A-Z_]\w*(?=\s*\()/i,
1810
+ number: /-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
1811
+ punctuation: /[{}[\];(),.:@]/,
1812
+ operator: /<<|>>|->|[<>~=]=?|!=|--?-?|\+\+?|!|\?/,
1813
+ boolean: /\b(?:false|true)\b/
1814
+ };
1815
+ })(Prism);
1816
+ (Prism.languages.graphql = {
1817
+ comment: /#.*/,
1818
+ description: {
1819
+ pattern:
1820
+ /(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,
1821
+ greedy: !0,
1822
+ alias: "string",
1823
+ inside: {
1824
+ "language-markdown": {
1825
+ pattern: /(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,
1826
+ lookbehind: !0,
1827
+ inside: Prism.languages.markdown
1828
+ }
1829
+ }
1830
+ },
1831
+ string: {
1832
+ pattern: /"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,
1833
+ greedy: !0
1834
+ },
1835
+ number: /(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,
1836
+ boolean: /\b(?:false|true)\b/,
1837
+ variable: /\$[a-z_]\w*/i,
1838
+ directive: { pattern: /@[a-z_]\w*/i, alias: "function" },
1839
+ "attr-name": {
1840
+ pattern:
1841
+ /\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,
1842
+ greedy: !0
1843
+ },
1844
+ "atom-input": { pattern: /\b[A-Z]\w*Input\b/, alias: "class-name" },
1845
+ scalar: /\b(?:Boolean|Float|ID|Int|String)\b/,
1846
+ constant: /\b[A-Z][A-Z_\d]*\b/,
1847
+ "class-name": {
1848
+ pattern:
1849
+ /(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,
1850
+ lookbehind: !0
1851
+ },
1852
+ fragment: {
1853
+ pattern: /(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,
1854
+ lookbehind: !0,
1855
+ alias: "function"
1856
+ },
1857
+ "definition-mutation": {
1858
+ pattern: /(\bmutation\s+)[a-zA-Z_]\w*/,
1859
+ lookbehind: !0,
1860
+ alias: "function"
1861
+ },
1862
+ "definition-query": {
1863
+ pattern: /(\bquery\s+)[a-zA-Z_]\w*/,
1864
+ lookbehind: !0,
1865
+ alias: "function"
1866
+ },
1867
+ keyword:
1868
+ /\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,
1869
+ operator: /[!=|&]|\.{3}/,
1870
+ "property-query": /\w+(?=\s*\()/,
1871
+ object: /\w+(?=\s*\{)/,
1872
+ punctuation: /[!(){}\[\]:=,]/,
1873
+ property: /\w+/
1874
+ }),
1875
+ Prism.hooks.add("after-tokenize", function (n) {
1876
+ if ("graphql" === n.language)
1877
+ for (
1878
+ var t = n.tokens.filter(function (n) {
1879
+ return (
1880
+ "string" != typeof n &&
1881
+ "comment" !== n.type &&
1882
+ "scalar" !== n.type
1883
+ );
1884
+ }),
1885
+ e = 0;
1886
+ e < t.length;
1887
+
1888
+ ) {
1889
+ var a = t[e++];
1890
+ if ("keyword" === a.type && "mutation" === a.content) {
1891
+ var r = [];
1892
+ if (
1893
+ c(["definition-mutation", "punctuation"]) &&
1894
+ "(" === l(1).content
1895
+ ) {
1896
+ e += 2;
1897
+ var i = f(/^\($/, /^\)$/);
1898
+ if (-1 === i) continue;
1899
+ for (; e < i; e++) {
1900
+ var o = l(0);
1901
+ "variable" === o.type &&
1902
+ (b(o, "variable-input"), r.push(o.content));
1903
+ }
1904
+ e = i + 1;
1905
+ }
1906
+ if (
1907
+ c(["punctuation", "property-query"]) &&
1908
+ "{" === l(0).content &&
1909
+ (e++, b(l(0), "property-mutation"), r.length > 0)
1910
+ ) {
1911
+ var s = f(/^\{$/, /^\}$/);
1912
+ if (-1 === s) continue;
1913
+ for (var u = e; u < s; u++) {
1914
+ var p = t[u];
1915
+ "variable" === p.type &&
1916
+ r.indexOf(p.content) >= 0 &&
1917
+ b(p, "variable-input");
1918
+ }
1919
+ }
1920
+ }
1921
+ }
1922
+ function l(n) {
1923
+ return t[e + n];
1924
+ }
1925
+ function c(n, t) {
1926
+ t = t || 0;
1927
+ for (var e = 0; e < n.length; e++) {
1928
+ var a = l(e + t);
1929
+ if (!a || a.type !== n[e]) return !1;
1930
+ }
1931
+ return !0;
1932
+ }
1933
+ function f(n, a) {
1934
+ for (var r = 1, i = e; i < t.length; i++) {
1935
+ var o = t[i],
1936
+ s = o.content;
1937
+ if ("punctuation" === o.type && "string" == typeof s)
1938
+ if (n.test(s)) r++;
1939
+ else if (a.test(s) && 0 == --r) return i;
1940
+ }
1941
+ return -1;
1942
+ }
1943
+ function b(n, t) {
1944
+ var e = n.alias;
1945
+ e
1946
+ ? Array.isArray(e) || (n.alias = e = [e])
1947
+ : (n.alias = e = []),
1948
+ e.push(t);
1949
+ }
1950
+ });
1951
+ !(function (e) {
1952
+ function n(e, n) {
1953
+ return "___" + e.toUpperCase() + n + "___";
1954
+ }
1955
+ Object.defineProperties((e.languages["markup-templating"] = {}), {
1956
+ buildPlaceholders: {
1957
+ value: function (t, a, r, o) {
1958
+ if (t.language === a) {
1959
+ var c = (t.tokenStack = []);
1960
+ (t.code = t.code.replace(r, function (e) {
1961
+ if ("function" == typeof o && !o(e)) return e;
1962
+ for (
1963
+ var r, i = c.length;
1964
+ -1 !== t.code.indexOf((r = n(a, i)));
1965
+
1966
+ )
1967
+ ++i;
1968
+ return (c[i] = e), r;
1969
+ })),
1970
+ (t.grammar = e.languages.markup);
1971
+ }
1972
+ }
1973
+ },
1974
+ tokenizePlaceholders: {
1975
+ value: function (t, a) {
1976
+ if (t.language === a && t.tokenStack) {
1977
+ t.grammar = e.languages[a];
1978
+ var r = 0,
1979
+ o = Object.keys(t.tokenStack);
1980
+ !(function c(i) {
1981
+ for (
1982
+ var u = 0;
1983
+ u < i.length && !(r >= o.length);
1984
+ u++
1985
+ ) {
1986
+ var g = i[u];
1987
+ if (
1988
+ "string" == typeof g ||
1989
+ (g.content && "string" == typeof g.content)
1990
+ ) {
1991
+ var l = o[r],
1992
+ s = t.tokenStack[l],
1993
+ f =
1994
+ "string" == typeof g
1995
+ ? g
1996
+ : g.content,
1997
+ p = n(a, l),
1998
+ k = f.indexOf(p);
1999
+ if (k > -1) {
2000
+ ++r;
2001
+ var m = f.substring(0, k),
2002
+ d = new e.Token(
2003
+ a,
2004
+ e.tokenize(s, t.grammar),
2005
+ "language-" + a,
2006
+ s
2007
+ ),
2008
+ h = f.substring(k + p.length),
2009
+ v = [];
2010
+ m && v.push.apply(v, c([m])),
2011
+ v.push(d),
2012
+ h && v.push.apply(v, c([h])),
2013
+ "string" == typeof g
2014
+ ? i.splice.apply(
2015
+ i,
2016
+ [u, 1].concat(v)
2017
+ )
2018
+ : (g.content = v);
2019
+ }
2020
+ } else g.content && c(g.content);
2021
+ }
2022
+ return i;
2023
+ })(t.tokens);
2024
+ }
2025
+ }
2026
+ }
2027
+ });
2028
+ })(Prism);
2029
+ !(function (a) {
2030
+ (a.languages.handlebars = {
2031
+ comment: /\{\{![\s\S]*?\}\}/,
2032
+ delimiter: { pattern: /^\{\{\{?|\}\}\}?$/, alias: "punctuation" },
2033
+ string: /(["'])(?:\\.|(?!\1)[^\\\r\n])*\1/,
2034
+ number: /\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][+-]?\d+)?/,
2035
+ boolean: /\b(?:false|true)\b/,
2036
+ block: {
2037
+ pattern: /^(\s*(?:~\s*)?)[#\/]\S+?(?=\s*(?:~\s*)?$|\s)/,
2038
+ lookbehind: !0,
2039
+ alias: "keyword"
2040
+ },
2041
+ brackets: {
2042
+ pattern: /\[[^\]]+\]/,
2043
+ inside: { punctuation: /\[|\]/, variable: /[\s\S]+/ }
2044
+ },
2045
+ punctuation: /[!"#%&':()*+,.\/;<=>@\[\\\]^`{|}~]/,
2046
+ variable: /[^!"#%&'()*+,\/;<=>@\[\\\]^`{|}~\s]+/
2047
+ }),
2048
+ a.hooks.add("before-tokenize", function (e) {
2049
+ a.languages["markup-templating"].buildPlaceholders(
2050
+ e,
2051
+ "handlebars",
2052
+ /\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/g
2053
+ );
2054
+ }),
2055
+ a.hooks.add("after-tokenize", function (e) {
2056
+ a.languages["markup-templating"].tokenizePlaceholders(
2057
+ e,
2058
+ "handlebars"
2059
+ );
2060
+ }),
2061
+ (a.languages.hbs = a.languages.handlebars),
2062
+ (a.languages.mustache = a.languages.handlebars);
2063
+ })(Prism);
1783
2064
  !(function (e) {
1784
2065
  var n =
1785
2066
  /\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,
@@ -1905,84 +2186,6 @@ https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javasc
1905
2186
  }
1906
2187
  });
1907
2188
  })(Prism);
1908
- !(function (e) {
1909
- function n(e, n) {
1910
- return "___" + e.toUpperCase() + n + "___";
1911
- }
1912
- Object.defineProperties((e.languages["markup-templating"] = {}), {
1913
- buildPlaceholders: {
1914
- value: function (t, a, r, o) {
1915
- if (t.language === a) {
1916
- var c = (t.tokenStack = []);
1917
- (t.code = t.code.replace(r, function (e) {
1918
- if ("function" == typeof o && !o(e)) return e;
1919
- for (
1920
- var r, i = c.length;
1921
- -1 !== t.code.indexOf((r = n(a, i)));
1922
-
1923
- )
1924
- ++i;
1925
- return (c[i] = e), r;
1926
- })),
1927
- (t.grammar = e.languages.markup);
1928
- }
1929
- }
1930
- },
1931
- tokenizePlaceholders: {
1932
- value: function (t, a) {
1933
- if (t.language === a && t.tokenStack) {
1934
- t.grammar = e.languages[a];
1935
- var r = 0,
1936
- o = Object.keys(t.tokenStack);
1937
- !(function c(i) {
1938
- for (
1939
- var u = 0;
1940
- u < i.length && !(r >= o.length);
1941
- u++
1942
- ) {
1943
- var g = i[u];
1944
- if (
1945
- "string" == typeof g ||
1946
- (g.content && "string" == typeof g.content)
1947
- ) {
1948
- var l = o[r],
1949
- s = t.tokenStack[l],
1950
- f =
1951
- "string" == typeof g
1952
- ? g
1953
- : g.content,
1954
- p = n(a, l),
1955
- k = f.indexOf(p);
1956
- if (k > -1) {
1957
- ++r;
1958
- var m = f.substring(0, k),
1959
- d = new e.Token(
1960
- a,
1961
- e.tokenize(s, t.grammar),
1962
- "language-" + a,
1963
- s
1964
- ),
1965
- h = f.substring(k + p.length),
1966
- v = [];
1967
- m && v.push.apply(v, c([m])),
1968
- v.push(d),
1969
- h && v.push.apply(v, c([h])),
1970
- "string" == typeof g
1971
- ? i.splice.apply(
1972
- i,
1973
- [u, 1].concat(v)
1974
- )
1975
- : (g.content = v);
1976
- }
1977
- } else g.content && c(g.content);
1978
- }
1979
- return i;
1980
- })(t.tokens);
1981
- }
1982
- }
1983
- }
1984
- });
1985
- })(Prism);
1986
2189
  !(function (e) {
1987
2190
  var a = /\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,
1988
2191
  t = [
@@ -3718,163 +3921,6 @@ https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javasc
3718
3921
  }),
3719
3922
  (e.languages.yml = e.languages.yaml);
3720
3923
  })(Prism);
3721
- !(function () {
3722
- if ("undefined" != typeof Prism && "undefined" != typeof document) {
3723
- var e = "line-numbers",
3724
- n = /\n(?!$)/g,
3725
- t = (Prism.plugins.lineNumbers = {
3726
- getLine: function (n, t) {
3727
- if ("PRE" === n.tagName && n.classList.contains(e)) {
3728
- var i = n.querySelector(".line-numbers-rows");
3729
- if (i) {
3730
- var r =
3731
- parseInt(
3732
- n.getAttribute("data-start"),
3733
- 10
3734
- ) || 1,
3735
- s = r + (i.children.length - 1);
3736
- t < r && (t = r), t > s && (t = s);
3737
- var l = t - r;
3738
- return i.children[l];
3739
- }
3740
- }
3741
- },
3742
- resize: function (e) {
3743
- r([e]);
3744
- },
3745
- assumeViewportIndependence: !0
3746
- }),
3747
- i = void 0;
3748
- window.addEventListener("resize", function () {
3749
- (t.assumeViewportIndependence && i === window.innerWidth) ||
3750
- ((i = window.innerWidth),
3751
- r(
3752
- Array.prototype.slice.call(
3753
- document.querySelectorAll("pre.line-numbers")
3754
- )
3755
- ));
3756
- }),
3757
- Prism.hooks.add("complete", function (t) {
3758
- if (t.code) {
3759
- var i = t.element,
3760
- s = i.parentNode;
3761
- if (
3762
- s &&
3763
- /pre/i.test(s.nodeName) &&
3764
- !i.querySelector(".line-numbers-rows") &&
3765
- Prism.util.isActive(i, e)
3766
- ) {
3767
- i.classList.remove(e), s.classList.add(e);
3768
- var l,
3769
- o = t.code.match(n),
3770
- a = o ? o.length + 1 : 1,
3771
- u = new Array(a + 1).join("<span></span>");
3772
- (l = document.createElement("span")).setAttribute(
3773
- "aria-hidden",
3774
- "true"
3775
- ),
3776
- (l.className = "line-numbers-rows"),
3777
- (l.innerHTML = u),
3778
- s.hasAttribute("data-start") &&
3779
- (s.style.counterReset =
3780
- "linenumber " +
3781
- (parseInt(
3782
- s.getAttribute("data-start"),
3783
- 10
3784
- ) -
3785
- 1)),
3786
- t.element.appendChild(l),
3787
- r([s]),
3788
- Prism.hooks.run("line-numbers", t);
3789
- }
3790
- }
3791
- }),
3792
- Prism.hooks.add("line-numbers", function (e) {
3793
- (e.plugins = e.plugins || {}), (e.plugins.lineNumbers = !0);
3794
- });
3795
- }
3796
- function r(e) {
3797
- if (
3798
- 0 !=
3799
- (e = e.filter(function (e) {
3800
- var n,
3801
- t = ((n = e),
3802
- n
3803
- ? window.getComputedStyle
3804
- ? getComputedStyle(n)
3805
- : n.currentStyle || null
3806
- : null)["white-space"];
3807
- return "pre-wrap" === t || "pre-line" === t;
3808
- })).length
3809
- ) {
3810
- var t = e
3811
- .map(function (e) {
3812
- var t = e.querySelector("code"),
3813
- i = e.querySelector(".line-numbers-rows");
3814
- if (t && i) {
3815
- var r = e.querySelector(".line-numbers-sizer"),
3816
- s = t.textContent.split(n);
3817
- r ||
3818
- (((r =
3819
- document.createElement("span")).className =
3820
- "line-numbers-sizer"),
3821
- t.appendChild(r)),
3822
- (r.innerHTML = "0"),
3823
- (r.style.display = "block");
3824
- var l = r.getBoundingClientRect().height;
3825
- return (
3826
- (r.innerHTML = ""),
3827
- {
3828
- element: e,
3829
- lines: s,
3830
- lineHeights: [],
3831
- oneLinerHeight: l,
3832
- sizer: r
3833
- }
3834
- );
3835
- }
3836
- })
3837
- .filter(Boolean);
3838
- t.forEach(function (e) {
3839
- var n = e.sizer,
3840
- t = e.lines,
3841
- i = e.lineHeights,
3842
- r = e.oneLinerHeight;
3843
- (i[t.length - 1] = void 0),
3844
- t.forEach(function (e, t) {
3845
- if (e && e.length > 1) {
3846
- var s = n.appendChild(
3847
- document.createElement("span")
3848
- );
3849
- (s.style.display = "block"),
3850
- (s.textContent = e);
3851
- } else i[t] = r;
3852
- });
3853
- }),
3854
- t.forEach(function (e) {
3855
- for (
3856
- var n = e.sizer, t = e.lineHeights, i = 0, r = 0;
3857
- r < t.length;
3858
- r++
3859
- )
3860
- void 0 === t[r] &&
3861
- (t[r] =
3862
- n.children[
3863
- i++
3864
- ].getBoundingClientRect().height);
3865
- }),
3866
- t.forEach(function (e) {
3867
- var n = e.sizer,
3868
- t = e.element.querySelector(".line-numbers-rows");
3869
- (n.style.display = "none"),
3870
- (n.innerHTML = ""),
3871
- e.lineHeights.forEach(function (e, n) {
3872
- t.children[n].style.height = e + "px";
3873
- });
3874
- });
3875
- }
3876
- }
3877
- })();
3878
3924
  "undefined" != typeof Prism &&
3879
3925
  "undefined" != typeof document &&
3880
3926
  (Element.prototype.matches ||