@ax-llm/ax 9.0.19 → 9.0.20
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 +33 -85
- package/CHANGELOG.md +0 -184
- package/LICENSE +0 -201
- package/README.md +0 -569
- package/build/module/docs/assets/icons.d.ts +0 -1
- package/build/module/docs/assets/icons.js +0 -19
- package/build/module/docs/assets/icons.js.map +0 -1
- package/build/module/docs/assets/main.d.ts +0 -1
- package/build/module/docs/assets/main.js +0 -629
- package/build/module/docs/assets/main.js.map +0 -1
- package/build/module/docs/assets/navigation.d.ts +0 -1
- package/build/module/docs/assets/navigation.js +0 -3
- package/build/module/docs/assets/navigation.js.map +0 -1
- package/build/module/docs/assets/search.d.ts +0 -1
- package/build/module/docs/assets/search.js +0 -3
- package/build/module/docs/assets/search.js.map +0 -1
- package/build/module/src/ai/anthropic/api.d.ts +0 -19
- package/build/module/src/ai/anthropic/api.js +0 -326
- package/build/module/src/ai/anthropic/api.js.map +0 -1
- package/build/module/src/ai/anthropic/index.d.ts +0 -2
- package/build/module/src/ai/anthropic/index.js +0 -3
- package/build/module/src/ai/anthropic/index.js.map +0 -1
- package/build/module/src/ai/anthropic/info.d.ts +0 -2
- package/build/module/src/ai/anthropic/info.js +0 -40
- package/build/module/src/ai/anthropic/info.js.map +0 -1
- package/build/module/src/ai/anthropic/types.d.ts +0 -171
- package/build/module/src/ai/anthropic/types.js +0 -10
- package/build/module/src/ai/anthropic/types.js.map +0 -1
- package/build/module/src/ai/azure-openai/api.d.ts +0 -19
- package/build/module/src/ai/azure-openai/api.js +0 -30
- package/build/module/src/ai/azure-openai/api.js.map +0 -1
- package/build/module/src/ai/azure-openai/index.d.ts +0 -1
- package/build/module/src/ai/azure-openai/index.js +0 -2
- package/build/module/src/ai/azure-openai/index.js.map +0 -1
- package/build/module/src/ai/balance.d.ts +0 -23
- package/build/module/src/ai/balance.js +0 -87
- package/build/module/src/ai/balance.js.map +0 -1
- package/build/module/src/ai/base.d.ts +0 -55
- package/build/module/src/ai/base.js +0 -343
- package/build/module/src/ai/base.js.map +0 -1
- package/build/module/src/ai/cohere/api.d.ts +0 -22
- package/build/module/src/ai/cohere/api.js +0 -264
- package/build/module/src/ai/cohere/api.js.map +0 -1
- package/build/module/src/ai/cohere/index.d.ts +0 -2
- package/build/module/src/ai/cohere/index.js +0 -3
- package/build/module/src/ai/cohere/index.js.map +0 -1
- package/build/module/src/ai/cohere/info.d.ts +0 -2
- package/build/module/src/ai/cohere/info.js +0 -52
- package/build/module/src/ai/cohere/info.js.map +0 -1
- package/build/module/src/ai/cohere/types.d.ts +0 -102
- package/build/module/src/ai/cohere/types.js +0 -23
- package/build/module/src/ai/cohere/types.js.map +0 -1
- package/build/module/src/ai/deepseek/api.d.ts +0 -16
- package/build/module/src/ai/deepseek/api.js +0 -32
- package/build/module/src/ai/deepseek/api.js.map +0 -1
- package/build/module/src/ai/deepseek/index.d.ts +0 -2
- package/build/module/src/ai/deepseek/index.js +0 -3
- package/build/module/src/ai/deepseek/index.js.map +0 -1
- package/build/module/src/ai/deepseek/info.d.ts +0 -2
- package/build/module/src/ai/deepseek/info.js +0 -16
- package/build/module/src/ai/deepseek/info.js.map +0 -1
- package/build/module/src/ai/deepseek/types.d.ts +0 -8
- package/build/module/src/ai/deepseek/types.js +0 -10
- package/build/module/src/ai/deepseek/types.js.map +0 -1
- package/build/module/src/ai/google-gemini/api.d.ts +0 -36
- package/build/module/src/ai/google-gemini/api.js +0 -299
- package/build/module/src/ai/google-gemini/api.js.map +0 -1
- package/build/module/src/ai/google-gemini/index.d.ts +0 -2
- package/build/module/src/ai/google-gemini/index.js +0 -3
- package/build/module/src/ai/google-gemini/index.js.map +0 -1
- package/build/module/src/ai/google-gemini/info.d.ts +0 -6
- package/build/module/src/ai/google-gemini/info.js +0 -29
- package/build/module/src/ai/google-gemini/info.js.map +0 -1
- package/build/module/src/ai/google-gemini/types.d.ts +0 -146
- package/build/module/src/ai/google-gemini/types.js +0 -27
- package/build/module/src/ai/google-gemini/types.js.map +0 -1
- package/build/module/src/ai/groq/api.d.ts +0 -18
- package/build/module/src/ai/groq/api.js +0 -52
- package/build/module/src/ai/groq/api.js.map +0 -1
- package/build/module/src/ai/groq/index.d.ts +0 -1
- package/build/module/src/ai/groq/index.js +0 -2
- package/build/module/src/ai/groq/index.js.map +0 -1
- package/build/module/src/ai/groq/types.d.ts +0 -6
- package/build/module/src/ai/groq/types.js +0 -8
- package/build/module/src/ai/groq/types.js.map +0 -1
- package/build/module/src/ai/huggingface/api.d.ts +0 -19
- package/build/module/src/ai/huggingface/api.js +0 -115
- package/build/module/src/ai/huggingface/api.js.map +0 -1
- package/build/module/src/ai/huggingface/index.d.ts +0 -2
- package/build/module/src/ai/huggingface/index.js +0 -3
- package/build/module/src/ai/huggingface/index.js.map +0 -1
- package/build/module/src/ai/huggingface/info.d.ts +0 -6
- package/build/module/src/ai/huggingface/info.js +0 -6
- package/build/module/src/ai/huggingface/info.js.map +0 -1
- package/build/module/src/ai/huggingface/types.d.ts +0 -34
- package/build/module/src/ai/huggingface/types.js +0 -5
- package/build/module/src/ai/huggingface/types.js.map +0 -1
- package/build/module/src/ai/index.d.ts +0 -16
- package/build/module/src/ai/index.js +0 -16
- package/build/module/src/ai/index.js.map +0 -1
- package/build/module/src/ai/mistral/api.d.ts +0 -16
- package/build/module/src/ai/mistral/api.js +0 -32
- package/build/module/src/ai/mistral/api.js.map +0 -1
- package/build/module/src/ai/mistral/index.d.ts +0 -2
- package/build/module/src/ai/mistral/index.js +0 -3
- package/build/module/src/ai/mistral/index.js.map +0 -1
- package/build/module/src/ai/mistral/info.d.ts +0 -2
- package/build/module/src/ai/mistral/info.js +0 -34
- package/build/module/src/ai/mistral/info.js.map +0 -1
- package/build/module/src/ai/mistral/types.d.ts +0 -10
- package/build/module/src/ai/mistral/types.js +0 -13
- package/build/module/src/ai/mistral/types.js.map +0 -1
- package/build/module/src/ai/ollama/api.d.ts +0 -22
- package/build/module/src/ai/ollama/api.js +0 -32
- package/build/module/src/ai/ollama/api.js.map +0 -1
- package/build/module/src/ai/ollama/index.d.ts +0 -1
- package/build/module/src/ai/ollama/index.js +0 -2
- package/build/module/src/ai/ollama/index.js.map +0 -1
- package/build/module/src/ai/openai/api.d.ts +0 -29
- package/build/module/src/ai/openai/api.js +0 -283
- package/build/module/src/ai/openai/api.js.map +0 -1
- package/build/module/src/ai/openai/index.d.ts +0 -2
- package/build/module/src/ai/openai/index.js +0 -3
- package/build/module/src/ai/openai/index.js.map +0 -1
- package/build/module/src/ai/openai/info.d.ts +0 -6
- package/build/module/src/ai/openai/info.js +0 -50
- package/build/module/src/ai/openai/info.js.map +0 -1
- package/build/module/src/ai/openai/types.d.ts +0 -165
- package/build/module/src/ai/openai/types.js +0 -18
- package/build/module/src/ai/openai/types.js.map +0 -1
- package/build/module/src/ai/together/api.d.ts +0 -15
- package/build/module/src/ai/together/api.js +0 -28
- package/build/module/src/ai/together/api.js.map +0 -1
- package/build/module/src/ai/together/index.d.ts +0 -1
- package/build/module/src/ai/together/index.js +0 -2
- package/build/module/src/ai/together/index.js.map +0 -1
- package/build/module/src/ai/together/info.d.ts +0 -2
- package/build/module/src/ai/together/info.js +0 -2
- package/build/module/src/ai/together/info.js.map +0 -1
- package/build/module/src/ai/types.d.ts +0 -159
- package/build/module/src/ai/types.js +0 -2
- package/build/module/src/ai/types.js.map +0 -1
- package/build/module/src/ai/util.d.ts +0 -12
- package/build/module/src/ai/util.js +0 -63
- package/build/module/src/ai/util.js.map +0 -1
- package/build/module/src/ai/wrap.d.ts +0 -47
- package/build/module/src/ai/wrap.js +0 -95
- package/build/module/src/ai/wrap.js.map +0 -1
- package/build/module/src/db/base.d.ts +0 -23
- package/build/module/src/db/base.js +0 -87
- package/build/module/src/db/base.js.map +0 -1
- package/build/module/src/db/cloudflare.d.ts +0 -21
- package/build/module/src/db/cloudflare.js +0 -98
- package/build/module/src/db/cloudflare.js.map +0 -1
- package/build/module/src/db/index.d.ts +0 -6
- package/build/module/src/db/index.js +0 -7
- package/build/module/src/db/index.js.map +0 -1
- package/build/module/src/db/memory.d.ts +0 -21
- package/build/module/src/db/memory.js +0 -99
- package/build/module/src/db/memory.js.map +0 -1
- package/build/module/src/db/pinecone.d.ts +0 -21
- package/build/module/src/db/pinecone.js +0 -71
- package/build/module/src/db/pinecone.js.map +0 -1
- package/build/module/src/db/types.d.ts +0 -35
- package/build/module/src/db/types.js +0 -3
- package/build/module/src/db/types.js.map +0 -1
- package/build/module/src/db/weaviate.d.ts +0 -21
- package/build/module/src/db/weaviate.js +0 -127
- package/build/module/src/db/weaviate.js.map +0 -1
- package/build/module/src/db/wrap.d.ts +0 -13
- package/build/module/src/db/wrap.js +0 -35
- package/build/module/src/db/wrap.js.map +0 -1
- package/build/module/src/docs/index.d.ts +0 -4
- package/build/module/src/docs/index.js +0 -5
- package/build/module/src/docs/index.js.map +0 -1
- package/build/module/src/docs/manager.d.ts +0 -45
- package/build/module/src/docs/manager.js +0 -159
- package/build/module/src/docs/manager.js.map +0 -1
- package/build/module/src/docs/reranker.d.ts +0 -7
- package/build/module/src/docs/reranker.js +0 -26
- package/build/module/src/docs/reranker.js.map +0 -1
- package/build/module/src/docs/rewriter.d.ts +0 -4
- package/build/module/src/docs/rewriter.js +0 -9
- package/build/module/src/docs/rewriter.js.map +0 -1
- package/build/module/src/docs/tika.d.ts +0 -18
- package/build/module/src/docs/tika.js +0 -46
- package/build/module/src/docs/tika.js.map +0 -1
- package/build/module/src/dsp/asserts.d.ts +0 -32
- package/build/module/src/dsp/asserts.js +0 -91
- package/build/module/src/dsp/asserts.js.map +0 -1
- package/build/module/src/dsp/eval.d.ts +0 -43
- package/build/module/src/dsp/eval.js +0 -125
- package/build/module/src/dsp/eval.js.map +0 -1
- package/build/module/src/dsp/evaluate.d.ts +0 -12
- package/build/module/src/dsp/evaluate.js +0 -32
- package/build/module/src/dsp/evaluate.js.map +0 -1
- package/build/module/src/dsp/extract.d.ts +0 -25
- package/build/module/src/dsp/extract.js +0 -153
- package/build/module/src/dsp/extract.js.map +0 -1
- package/build/module/src/dsp/generate.d.ts +0 -55
- package/build/module/src/dsp/generate.js +0 -314
- package/build/module/src/dsp/generate.js.map +0 -1
- package/build/module/src/dsp/generate.test.d.ts +0 -1
- package/build/module/src/dsp/generate.test.js +0 -41
- package/build/module/src/dsp/generate.test.js.map +0 -1
- package/build/module/src/dsp/index.d.ts +0 -15
- package/build/module/src/dsp/index.js +0 -11
- package/build/module/src/dsp/index.js.map +0 -1
- package/build/module/src/dsp/loader.d.ts +0 -30
- package/build/module/src/dsp/loader.js +0 -81
- package/build/module/src/dsp/loader.js.map +0 -1
- package/build/module/src/dsp/optimize.d.ts +0 -27
- package/build/module/src/dsp/optimize.js +0 -95
- package/build/module/src/dsp/optimize.js.map +0 -1
- package/build/module/src/dsp/parser.d.ts +0 -87
- package/build/module/src/dsp/parser.js +0 -1542
- package/build/module/src/dsp/parser.js.map +0 -1
- package/build/module/src/dsp/program.d.ts +0 -73
- package/build/module/src/dsp/program.js +0 -116
- package/build/module/src/dsp/program.js.map +0 -1
- package/build/module/src/dsp/prompt.d.ts +0 -48
- package/build/module/src/dsp/prompt.js +0 -260
- package/build/module/src/dsp/prompt.js.map +0 -1
- package/build/module/src/dsp/registry.d.ts +0 -6
- package/build/module/src/dsp/registry.js +0 -15
- package/build/module/src/dsp/registry.js.map +0 -1
- package/build/module/src/dsp/router.d.ts +0 -26
- package/build/module/src/dsp/router.js +0 -71
- package/build/module/src/dsp/router.js.map +0 -1
- package/build/module/src/dsp/sig.d.ts +0 -37
- package/build/module/src/dsp/sig.js +0 -194
- package/build/module/src/dsp/sig.js.map +0 -1
- package/build/module/src/dsp/sig.test.d.ts +0 -1
- package/build/module/src/dsp/sig.test.js +0 -28
- package/build/module/src/dsp/sig.test.js.map +0 -1
- package/build/module/src/dsp/stopwords.d.ts +0 -1
- package/build/module/src/dsp/stopwords.js +0 -1164
- package/build/module/src/dsp/stopwords.js.map +0 -1
- package/build/module/src/dsp/strutil.d.ts +0 -11
- package/build/module/src/dsp/strutil.js +0 -60
- package/build/module/src/dsp/strutil.js.map +0 -1
- package/build/module/src/dsp/util.d.ts +0 -5
- package/build/module/src/dsp/util.js +0 -76
- package/build/module/src/dsp/util.js.map +0 -1
- package/build/module/src/funcs/code.d.ts +0 -9
- package/build/module/src/funcs/code.js +0 -63
- package/build/module/src/funcs/code.js.map +0 -1
- package/build/module/src/funcs/embed.d.ts +0 -6
- package/build/module/src/funcs/embed.js +0 -29
- package/build/module/src/funcs/embed.js.map +0 -1
- package/build/module/src/funcs/functions.d.ts +0 -16
- package/build/module/src/funcs/functions.js +0 -55
- package/build/module/src/funcs/functions.js.map +0 -1
- package/build/module/src/funcs/index.d.ts +0 -3
- package/build/module/src/funcs/index.js +0 -4
- package/build/module/src/funcs/index.js.map +0 -1
- package/build/module/src/funcs/jsonschema.d.ts +0 -2
- package/build/module/src/funcs/jsonschema.js +0 -97
- package/build/module/src/funcs/jsonschema.js.map +0 -1
- package/build/module/src/index.d.ts +0 -9
- package/build/module/src/index.js.map +0 -1
- package/build/module/src/mem/index.d.ts +0 -2
- package/build/module/src/mem/index.js +0 -3
- package/build/module/src/mem/index.js.map +0 -1
- package/build/module/src/mem/memory.d.ts +0 -16
- package/build/module/src/mem/memory.js +0 -77
- package/build/module/src/mem/memory.js.map +0 -1
- package/build/module/src/mem/types.d.ts +0 -10
- package/build/module/src/mem/types.js +0 -2
- package/build/module/src/mem/types.js.map +0 -1
- package/build/module/src/prompts/agent.d.ts +0 -34
- package/build/module/src/prompts/agent.js +0 -108
- package/build/module/src/prompts/agent.js.map +0 -1
- package/build/module/src/prompts/cot.d.ts +0 -9
- package/build/module/src/prompts/cot.js +0 -17
- package/build/module/src/prompts/cot.js.map +0 -1
- package/build/module/src/prompts/index.d.ts +0 -4
- package/build/module/src/prompts/index.js +0 -5
- package/build/module/src/prompts/index.js.map +0 -1
- package/build/module/src/prompts/prompts.test.d.ts +0 -1
- package/build/module/src/prompts/prompts.test.js +0 -54
- package/build/module/src/prompts/prompts.test.js.map +0 -1
- package/build/module/src/prompts/rag.d.ts +0 -23
- package/build/module/src/prompts/rag.js +0 -30
- package/build/module/src/prompts/rag.js.map +0 -1
- package/build/module/src/prompts/react.d.ts +0 -8
- package/build/module/src/prompts/react.js +0 -22
- package/build/module/src/prompts/react.js.map +0 -1
- package/build/module/src/trace/index.d.ts +0 -171
- package/build/module/src/trace/index.js +0 -67
- package/build/module/src/trace/index.js.map +0 -1
- package/build/module/src/util/apicall.d.ts +0 -18
- package/build/module/src/util/apicall.js +0 -50
- package/build/module/src/util/apicall.js.map +0 -1
- package/build/module/src/util/log.d.ts +0 -14
- package/build/module/src/util/log.js +0 -31
- package/build/module/src/util/log.js.map +0 -1
- package/build/module/src/util/other.d.ts +0 -1
- package/build/module/src/util/other.js +0 -5
- package/build/module/src/util/other.js.map +0 -1
- package/build/module/src/util/rate-limit.d.ts +0 -24
- package/build/module/src/util/rate-limit.js +0 -49
- package/build/module/src/util/rate-limit.js.map +0 -1
- package/build/module/src/util/stream.d.ts +0 -9
- package/build/module/src/util/stream.js +0 -29
- package/build/module/src/util/stream.js.map +0 -1
- package/build/module/src/util/transform.d.ts +0 -7
- package/build/module/src/util/transform.js +0 -59
- package/build/module/src/util/transform.js.map +0 -1
- /package/{build/module/src/index.js → index.js} +0 -0
|
@@ -1,629 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use strict";
|
|
3
|
-
(() => {
|
|
4
|
-
var Ce = Object.create;
|
|
5
|
-
var ne = Object.defineProperty;
|
|
6
|
-
var Pe = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var Oe = Object.getOwnPropertyNames;
|
|
8
|
-
var _e = Object.getPrototypeOf, Re = Object.prototype.hasOwnProperty;
|
|
9
|
-
var Me = (t, e) => () => (e || t((e = { exports: {} }).exports, e), e.exports);
|
|
10
|
-
var Fe = (t, e, n, r) => { if (e && typeof e == "object" || typeof e == "function")
|
|
11
|
-
for (let i of Oe(e))
|
|
12
|
-
!Re.call(t, i) && i !== n && ne(t, i, { get: () => e[i], enumerable: !(r = Pe(e, i)) || r.enumerable }); return t; };
|
|
13
|
-
var De = (t, e, n) => (n = t != null ? Ce(_e(t)) : {}, Fe(e || !t || !t.__esModule ? ne(n, "default", { value: t, enumerable: !0 }) : n, t));
|
|
14
|
-
var ae = Me((se, oe) => {
|
|
15
|
-
(function () {
|
|
16
|
-
var t = function (e) { var n = new t.Builder; return n.pipeline.add(t.trimmer, t.stopWordFilter, t.stemmer), n.searchPipeline.add(t.stemmer), e.call(n, n), n.build(); };
|
|
17
|
-
t.version = "2.3.9";
|
|
18
|
-
t.utils = {}, t.utils.warn = function (e) { return function (n) { e.console && console.warn && console.warn(n); }; }(this), t.utils.asString = function (e) { return e == null ? "" : e.toString(); }, t.utils.clone = function (e) { if (e == null)
|
|
19
|
-
return e; for (var n = Object.create(null), r = Object.keys(e), i = 0; i < r.length; i++) {
|
|
20
|
-
var s = r[i], o = e[s];
|
|
21
|
-
if (Array.isArray(o)) {
|
|
22
|
-
n[s] = o.slice();
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
if (typeof o == "string" || typeof o == "number" || typeof o == "boolean") {
|
|
26
|
-
n[s] = o;
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
throw new TypeError("clone is not deep and does not support nested objects");
|
|
30
|
-
} return n; }, t.FieldRef = function (e, n, r) { this.docRef = e, this.fieldName = n, this._stringValue = r; }, t.FieldRef.joiner = "/", t.FieldRef.fromString = function (e) { var n = e.indexOf(t.FieldRef.joiner); if (n === -1)
|
|
31
|
-
throw "malformed field ref string"; var r = e.slice(0, n), i = e.slice(n + 1); return new t.FieldRef(i, r, e); }, t.FieldRef.prototype.toString = function () { return this._stringValue == null && (this._stringValue = this.fieldName + t.FieldRef.joiner + this.docRef), this._stringValue; };
|
|
32
|
-
t.Set = function (e) { if (this.elements = Object.create(null), e) {
|
|
33
|
-
this.length = e.length;
|
|
34
|
-
for (var n = 0; n < this.length; n++)
|
|
35
|
-
this.elements[e[n]] = !0;
|
|
36
|
-
}
|
|
37
|
-
else
|
|
38
|
-
this.length = 0; }, t.Set.complete = { intersect: function (e) { return e; }, union: function () { return this; }, contains: function () { return !0; } }, t.Set.empty = { intersect: function () { return this; }, union: function (e) { return e; }, contains: function () { return !1; } }, t.Set.prototype.contains = function (e) { return !!this.elements[e]; }, t.Set.prototype.intersect = function (e) { var n, r, i, s = []; if (e === t.Set.complete)
|
|
39
|
-
return this; if (e === t.Set.empty)
|
|
40
|
-
return e; this.length < e.length ? (n = this, r = e) : (n = e, r = this), i = Object.keys(n.elements); for (var o = 0; o < i.length; o++) {
|
|
41
|
-
var a = i[o];
|
|
42
|
-
a in r.elements && s.push(a);
|
|
43
|
-
} return new t.Set(s); }, t.Set.prototype.union = function (e) { return e === t.Set.complete ? t.Set.complete : e === t.Set.empty ? this : new t.Set(Object.keys(this.elements).concat(Object.keys(e.elements))); }, t.idf = function (e, n) { var r = 0; for (var i in e)
|
|
44
|
-
i != "_index" && (r += Object.keys(e[i]).length); var s = (n - r + .5) / (r + .5); return Math.log(1 + Math.abs(s)); }, t.Token = function (e, n) { this.str = e || "", this.metadata = n || {}; }, t.Token.prototype.toString = function () { return this.str; }, t.Token.prototype.update = function (e) { return this.str = e(this.str, this.metadata), this; }, t.Token.prototype.clone = function (e) { return e = e || function (n) { return n; }, new t.Token(e(this.str, this.metadata), this.metadata); };
|
|
45
|
-
t.tokenizer = function (e, n) { if (e == null || e == null)
|
|
46
|
-
return []; if (Array.isArray(e))
|
|
47
|
-
return e.map(function (y) { return new t.Token(t.utils.asString(y).toLowerCase(), t.utils.clone(n)); }); for (var r = e.toString().toLowerCase(), i = r.length, s = [], o = 0, a = 0; o <= i; o++) {
|
|
48
|
-
var l = r.charAt(o), u = o - a;
|
|
49
|
-
if (l.match(t.tokenizer.separator) || o == i) {
|
|
50
|
-
if (u > 0) {
|
|
51
|
-
var d = t.utils.clone(n) || {};
|
|
52
|
-
d.position = [a, u], d.index = s.length, s.push(new t.Token(r.slice(a, o), d));
|
|
53
|
-
}
|
|
54
|
-
a = o + 1;
|
|
55
|
-
}
|
|
56
|
-
} return s; }, t.tokenizer.separator = /[\s\-]+/;
|
|
57
|
-
t.Pipeline = function () { this._stack = []; }, t.Pipeline.registeredFunctions = Object.create(null), t.Pipeline.registerFunction = function (e, n) { n in this.registeredFunctions && t.utils.warn("Overwriting existing registered function: " + n), e.label = n, t.Pipeline.registeredFunctions[e.label] = e; }, t.Pipeline.warnIfFunctionNotRegistered = function (e) {
|
|
58
|
-
var n = e.label && e.label in this.registeredFunctions;
|
|
59
|
-
n || t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index.
|
|
60
|
-
`, e);
|
|
61
|
-
}, t.Pipeline.load = function (e) { var n = new t.Pipeline; return e.forEach(function (r) { var i = t.Pipeline.registeredFunctions[r]; if (i)
|
|
62
|
-
n.add(i);
|
|
63
|
-
else
|
|
64
|
-
throw new Error("Cannot load unregistered function: " + r); }), n; }, t.Pipeline.prototype.add = function () { var e = Array.prototype.slice.call(arguments); e.forEach(function (n) { t.Pipeline.warnIfFunctionNotRegistered(n), this._stack.push(n); }, this); }, t.Pipeline.prototype.after = function (e, n) { t.Pipeline.warnIfFunctionNotRegistered(n); var r = this._stack.indexOf(e); if (r == -1)
|
|
65
|
-
throw new Error("Cannot find existingFn"); r = r + 1, this._stack.splice(r, 0, n); }, t.Pipeline.prototype.before = function (e, n) { t.Pipeline.warnIfFunctionNotRegistered(n); var r = this._stack.indexOf(e); if (r == -1)
|
|
66
|
-
throw new Error("Cannot find existingFn"); this._stack.splice(r, 0, n); }, t.Pipeline.prototype.remove = function (e) { var n = this._stack.indexOf(e); n != -1 && this._stack.splice(n, 1); }, t.Pipeline.prototype.run = function (e) { for (var n = this._stack.length, r = 0; r < n; r++) {
|
|
67
|
-
for (var i = this._stack[r], s = [], o = 0; o < e.length; o++) {
|
|
68
|
-
var a = i(e[o], o, e);
|
|
69
|
-
if (!(a == null || a === ""))
|
|
70
|
-
if (Array.isArray(a))
|
|
71
|
-
for (var l = 0; l < a.length; l++)
|
|
72
|
-
s.push(a[l]);
|
|
73
|
-
else
|
|
74
|
-
s.push(a);
|
|
75
|
-
}
|
|
76
|
-
e = s;
|
|
77
|
-
} return e; }, t.Pipeline.prototype.runString = function (e, n) { var r = new t.Token(e, n); return this.run([r]).map(function (i) { return i.toString(); }); }, t.Pipeline.prototype.reset = function () { this._stack = []; }, t.Pipeline.prototype.toJSON = function () { return this._stack.map(function (e) { return t.Pipeline.warnIfFunctionNotRegistered(e), e.label; }); };
|
|
78
|
-
t.Vector = function (e) { this._magnitude = 0, this.elements = e || []; }, t.Vector.prototype.positionForIndex = function (e) { if (this.elements.length == 0)
|
|
79
|
-
return 0; for (var n = 0, r = this.elements.length / 2, i = r - n, s = Math.floor(i / 2), o = this.elements[s * 2]; i > 1 && (o < e && (n = s), o > e && (r = s), o != e);)
|
|
80
|
-
i = r - n, s = n + Math.floor(i / 2), o = this.elements[s * 2]; if (o == e || o > e)
|
|
81
|
-
return s * 2; if (o < e)
|
|
82
|
-
return (s + 1) * 2; }, t.Vector.prototype.insert = function (e, n) { this.upsert(e, n, function () { throw "duplicate index"; }); }, t.Vector.prototype.upsert = function (e, n, r) { this._magnitude = 0; var i = this.positionForIndex(e); this.elements[i] == e ? this.elements[i + 1] = r(this.elements[i + 1], n) : this.elements.splice(i, 0, e, n); }, t.Vector.prototype.magnitude = function () { if (this._magnitude)
|
|
83
|
-
return this._magnitude; for (var e = 0, n = this.elements.length, r = 1; r < n; r += 2) {
|
|
84
|
-
var i = this.elements[r];
|
|
85
|
-
e += i * i;
|
|
86
|
-
} return this._magnitude = Math.sqrt(e); }, t.Vector.prototype.dot = function (e) { for (var n = 0, r = this.elements, i = e.elements, s = r.length, o = i.length, a = 0, l = 0, u = 0, d = 0; u < s && d < o;)
|
|
87
|
-
a = r[u], l = i[d], a < l ? u += 2 : a > l ? d += 2 : a == l && (n += r[u + 1] * i[d + 1], u += 2, d += 2); return n; }, t.Vector.prototype.similarity = function (e) { return this.dot(e) / this.magnitude() || 0; }, t.Vector.prototype.toArray = function () { for (var e = new Array(this.elements.length / 2), n = 1, r = 0; n < this.elements.length; n += 2, r++)
|
|
88
|
-
e[r] = this.elements[n]; return e; }, t.Vector.prototype.toJSON = function () { return this.elements; };
|
|
89
|
-
t.stemmer = function () { var e = { ational: "ate", tional: "tion", enci: "ence", anci: "ance", izer: "ize", bli: "ble", alli: "al", entli: "ent", eli: "e", ousli: "ous", ization: "ize", ation: "ate", ator: "ate", alism: "al", iveness: "ive", fulness: "ful", ousness: "ous", aliti: "al", iviti: "ive", biliti: "ble", logi: "log" }, n = { icate: "ic", ative: "", alize: "al", iciti: "ic", ical: "ic", ful: "", ness: "" }, r = "[^aeiou]", i = "[aeiouy]", s = r + "[^aeiouy]*", o = i + "[aeiou]*", a = "^(" + s + ")?" + o + s, l = "^(" + s + ")?" + o + s + "(" + o + ")?$", u = "^(" + s + ")?" + o + s + o + s, d = "^(" + s + ")?" + i, y = new RegExp(a), p = new RegExp(u), b = new RegExp(l), g = new RegExp(d), L = /^(.+?)(ss|i)es$/, f = /^(.+?)([^s])s$/, m = /^(.+?)eed$/, S = /^(.+?)(ed|ing)$/, w = /.$/, k = /(at|bl|iz)$/, _ = new RegExp("([^aeiouylsz])\\1$"), B = new RegExp("^" + s + i + "[^aeiouwxy]$"), A = /^(.+?[^aeiou])y$/, j = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/, $ = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/, V = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/, q = /^(.+?)(s|t)(ion)$/, C = /^(.+?)e$/, z = /ll$/, W = new RegExp("^" + s + i + "[^aeiouwxy]$"), N = function (c) { var v, P, T, h, x, O, M; if (c.length < 3)
|
|
90
|
-
return c; if (T = c.substr(0, 1), T == "y" && (c = T.toUpperCase() + c.substr(1)), h = L, x = f, h.test(c) ? c = c.replace(h, "$1$2") : x.test(c) && (c = c.replace(x, "$1$2")), h = m, x = S, h.test(c)) {
|
|
91
|
-
var E = h.exec(c);
|
|
92
|
-
h = y, h.test(E[1]) && (h = w, c = c.replace(h, ""));
|
|
93
|
-
}
|
|
94
|
-
else if (x.test(c)) {
|
|
95
|
-
var E = x.exec(c);
|
|
96
|
-
v = E[1], x = g, x.test(v) && (c = v, x = k, O = _, M = B, x.test(c) ? c = c + "e" : O.test(c) ? (h = w, c = c.replace(h, "")) : M.test(c) && (c = c + "e"));
|
|
97
|
-
} if (h = A, h.test(c)) {
|
|
98
|
-
var E = h.exec(c);
|
|
99
|
-
v = E[1], c = v + "i";
|
|
100
|
-
} if (h = j, h.test(c)) {
|
|
101
|
-
var E = h.exec(c);
|
|
102
|
-
v = E[1], P = E[2], h = y, h.test(v) && (c = v + e[P]);
|
|
103
|
-
} if (h = $, h.test(c)) {
|
|
104
|
-
var E = h.exec(c);
|
|
105
|
-
v = E[1], P = E[2], h = y, h.test(v) && (c = v + n[P]);
|
|
106
|
-
} if (h = V, x = q, h.test(c)) {
|
|
107
|
-
var E = h.exec(c);
|
|
108
|
-
v = E[1], h = p, h.test(v) && (c = v);
|
|
109
|
-
}
|
|
110
|
-
else if (x.test(c)) {
|
|
111
|
-
var E = x.exec(c);
|
|
112
|
-
v = E[1] + E[2], x = p, x.test(v) && (c = v);
|
|
113
|
-
} if (h = C, h.test(c)) {
|
|
114
|
-
var E = h.exec(c);
|
|
115
|
-
v = E[1], h = p, x = b, O = W, (h.test(v) || x.test(v) && !O.test(v)) && (c = v);
|
|
116
|
-
} return h = z, x = p, h.test(c) && x.test(c) && (h = w, c = c.replace(h, "")), T == "y" && (c = T.toLowerCase() + c.substr(1)), c; }; return function (R) { return R.update(N); }; }(), t.Pipeline.registerFunction(t.stemmer, "stemmer");
|
|
117
|
-
t.generateStopWordFilter = function (e) { var n = e.reduce(function (r, i) { return r[i] = i, r; }, {}); return function (r) { if (r && n[r.toString()] !== r.toString())
|
|
118
|
-
return r; }; }, t.stopWordFilter = t.generateStopWordFilter(["a", "able", "about", "across", "after", "all", "almost", "also", "am", "among", "an", "and", "any", "are", "as", "at", "be", "because", "been", "but", "by", "can", "cannot", "could", "dear", "did", "do", "does", "either", "else", "ever", "every", "for", "from", "get", "got", "had", "has", "have", "he", "her", "hers", "him", "his", "how", "however", "i", "if", "in", "into", "is", "it", "its", "just", "least", "let", "like", "likely", "may", "me", "might", "most", "must", "my", "neither", "no", "nor", "not", "of", "off", "often", "on", "only", "or", "other", "our", "own", "rather", "said", "say", "says", "she", "should", "since", "so", "some", "than", "that", "the", "their", "them", "then", "there", "these", "they", "this", "tis", "to", "too", "twas", "us", "wants", "was", "we", "were", "what", "when", "where", "which", "while", "who", "whom", "why", "will", "with", "would", "yet", "you", "your"]), t.Pipeline.registerFunction(t.stopWordFilter, "stopWordFilter");
|
|
119
|
-
t.trimmer = function (e) { return e.update(function (n) { return n.replace(/^\W+/, "").replace(/\W+$/, ""); }); }, t.Pipeline.registerFunction(t.trimmer, "trimmer");
|
|
120
|
-
t.TokenSet = function () { this.final = !1, this.edges = {}, this.id = t.TokenSet._nextId, t.TokenSet._nextId += 1; }, t.TokenSet._nextId = 1, t.TokenSet.fromArray = function (e) { for (var n = new t.TokenSet.Builder, r = 0, i = e.length; r < i; r++)
|
|
121
|
-
n.insert(e[r]); return n.finish(), n.root; }, t.TokenSet.fromClause = function (e) { return "editDistance" in e ? t.TokenSet.fromFuzzyString(e.term, e.editDistance) : t.TokenSet.fromString(e.term); }, t.TokenSet.fromFuzzyString = function (e, n) { for (var r = new t.TokenSet, i = [{ node: r, editsRemaining: n, str: e }]; i.length;) {
|
|
122
|
-
var s = i.pop();
|
|
123
|
-
if (s.str.length > 0) {
|
|
124
|
-
var o = s.str.charAt(0), a;
|
|
125
|
-
o in s.node.edges ? a = s.node.edges[o] : (a = new t.TokenSet, s.node.edges[o] = a), s.str.length == 1 && (a.final = !0), i.push({ node: a, editsRemaining: s.editsRemaining, str: s.str.slice(1) });
|
|
126
|
-
}
|
|
127
|
-
if (s.editsRemaining != 0) {
|
|
128
|
-
if ("*" in s.node.edges)
|
|
129
|
-
var l = s.node.edges["*"];
|
|
130
|
-
else {
|
|
131
|
-
var l = new t.TokenSet;
|
|
132
|
-
s.node.edges["*"] = l;
|
|
133
|
-
}
|
|
134
|
-
if (s.str.length == 0 && (l.final = !0), i.push({ node: l, editsRemaining: s.editsRemaining - 1, str: s.str }), s.str.length > 1 && i.push({ node: s.node, editsRemaining: s.editsRemaining - 1, str: s.str.slice(1) }), s.str.length == 1 && (s.node.final = !0), s.str.length >= 1) {
|
|
135
|
-
if ("*" in s.node.edges)
|
|
136
|
-
var u = s.node.edges["*"];
|
|
137
|
-
else {
|
|
138
|
-
var u = new t.TokenSet;
|
|
139
|
-
s.node.edges["*"] = u;
|
|
140
|
-
}
|
|
141
|
-
s.str.length == 1 && (u.final = !0), i.push({ node: u, editsRemaining: s.editsRemaining - 1, str: s.str.slice(1) });
|
|
142
|
-
}
|
|
143
|
-
if (s.str.length > 1) {
|
|
144
|
-
var d = s.str.charAt(0), y = s.str.charAt(1), p;
|
|
145
|
-
y in s.node.edges ? p = s.node.edges[y] : (p = new t.TokenSet, s.node.edges[y] = p), s.str.length == 1 && (p.final = !0), i.push({ node: p, editsRemaining: s.editsRemaining - 1, str: d + s.str.slice(2) });
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
} return r; }, t.TokenSet.fromString = function (e) { for (var n = new t.TokenSet, r = n, i = 0, s = e.length; i < s; i++) {
|
|
149
|
-
var o = e[i], a = i == s - 1;
|
|
150
|
-
if (o == "*")
|
|
151
|
-
n.edges[o] = n, n.final = a;
|
|
152
|
-
else {
|
|
153
|
-
var l = new t.TokenSet;
|
|
154
|
-
l.final = a, n.edges[o] = l, n = l;
|
|
155
|
-
}
|
|
156
|
-
} return r; }, t.TokenSet.prototype.toArray = function () { for (var e = [], n = [{ prefix: "", node: this }]; n.length;) {
|
|
157
|
-
var r = n.pop(), i = Object.keys(r.node.edges), s = i.length;
|
|
158
|
-
r.node.final && (r.prefix.charAt(0), e.push(r.prefix));
|
|
159
|
-
for (var o = 0; o < s; o++) {
|
|
160
|
-
var a = i[o];
|
|
161
|
-
n.push({ prefix: r.prefix.concat(a), node: r.node.edges[a] });
|
|
162
|
-
}
|
|
163
|
-
} return e; }, t.TokenSet.prototype.toString = function () { if (this._str)
|
|
164
|
-
return this._str; for (var e = this.final ? "1" : "0", n = Object.keys(this.edges).sort(), r = n.length, i = 0; i < r; i++) {
|
|
165
|
-
var s = n[i], o = this.edges[s];
|
|
166
|
-
e = e + s + o.id;
|
|
167
|
-
} return e; }, t.TokenSet.prototype.intersect = function (e) { for (var n = new t.TokenSet, r = void 0, i = [{ qNode: e, output: n, node: this }]; i.length;) {
|
|
168
|
-
r = i.pop();
|
|
169
|
-
for (var s = Object.keys(r.qNode.edges), o = s.length, a = Object.keys(r.node.edges), l = a.length, u = 0; u < o; u++)
|
|
170
|
-
for (var d = s[u], y = 0; y < l; y++) {
|
|
171
|
-
var p = a[y];
|
|
172
|
-
if (p == d || d == "*") {
|
|
173
|
-
var b = r.node.edges[p], g = r.qNode.edges[d], L = b.final && g.final, f = void 0;
|
|
174
|
-
p in r.output.edges ? (f = r.output.edges[p], f.final = f.final || L) : (f = new t.TokenSet, f.final = L, r.output.edges[p] = f), i.push({ qNode: g, output: f, node: b });
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
} return n; }, t.TokenSet.Builder = function () { this.previousWord = "", this.root = new t.TokenSet, this.uncheckedNodes = [], this.minimizedNodes = {}; }, t.TokenSet.Builder.prototype.insert = function (e) { var n, r = 0; if (e < this.previousWord)
|
|
178
|
-
throw new Error("Out of order word insertion"); for (var i = 0; i < e.length && i < this.previousWord.length && e[i] == this.previousWord[i]; i++)
|
|
179
|
-
r++; this.minimize(r), this.uncheckedNodes.length == 0 ? n = this.root : n = this.uncheckedNodes[this.uncheckedNodes.length - 1].child; for (var i = r; i < e.length; i++) {
|
|
180
|
-
var s = new t.TokenSet, o = e[i];
|
|
181
|
-
n.edges[o] = s, this.uncheckedNodes.push({ parent: n, char: o, child: s }), n = s;
|
|
182
|
-
} n.final = !0, this.previousWord = e; }, t.TokenSet.Builder.prototype.finish = function () { this.minimize(0); }, t.TokenSet.Builder.prototype.minimize = function (e) { for (var n = this.uncheckedNodes.length - 1; n >= e; n--) {
|
|
183
|
-
var r = this.uncheckedNodes[n], i = r.child.toString();
|
|
184
|
-
i in this.minimizedNodes ? r.parent.edges[r.char] = this.minimizedNodes[i] : (r.child._str = i, this.minimizedNodes[i] = r.child), this.uncheckedNodes.pop();
|
|
185
|
-
} };
|
|
186
|
-
t.Index = function (e) { this.invertedIndex = e.invertedIndex, this.fieldVectors = e.fieldVectors, this.tokenSet = e.tokenSet, this.fields = e.fields, this.pipeline = e.pipeline; }, t.Index.prototype.search = function (e) { return this.query(function (n) { var r = new t.QueryParser(e, n); r.parse(); }); }, t.Index.prototype.query = function (e) { for (var n = new t.Query(this.fields), r = Object.create(null), i = Object.create(null), s = Object.create(null), o = Object.create(null), a = Object.create(null), l = 0; l < this.fields.length; l++)
|
|
187
|
-
i[this.fields[l]] = new t.Vector; e.call(n, n); for (var l = 0; l < n.clauses.length; l++) {
|
|
188
|
-
var u = n.clauses[l], d = null, y = t.Set.empty;
|
|
189
|
-
u.usePipeline ? d = this.pipeline.runString(u.term, { fields: u.fields }) : d = [u.term];
|
|
190
|
-
for (var p = 0; p < d.length; p++) {
|
|
191
|
-
var b = d[p];
|
|
192
|
-
u.term = b;
|
|
193
|
-
var g = t.TokenSet.fromClause(u), L = this.tokenSet.intersect(g).toArray();
|
|
194
|
-
if (L.length === 0 && u.presence === t.Query.presence.REQUIRED) {
|
|
195
|
-
for (var f = 0; f < u.fields.length; f++) {
|
|
196
|
-
var m = u.fields[f];
|
|
197
|
-
o[m] = t.Set.empty;
|
|
198
|
-
}
|
|
199
|
-
break;
|
|
200
|
-
}
|
|
201
|
-
for (var S = 0; S < L.length; S++)
|
|
202
|
-
for (var w = L[S], k = this.invertedIndex[w], _ = k._index, f = 0; f < u.fields.length; f++) {
|
|
203
|
-
var m = u.fields[f], B = k[m], A = Object.keys(B), j = w + "/" + m, $ = new t.Set(A);
|
|
204
|
-
if (u.presence == t.Query.presence.REQUIRED && (y = y.union($), o[m] === void 0 && (o[m] = t.Set.complete)), u.presence == t.Query.presence.PROHIBITED) {
|
|
205
|
-
a[m] === void 0 && (a[m] = t.Set.empty), a[m] = a[m].union($);
|
|
206
|
-
continue;
|
|
207
|
-
}
|
|
208
|
-
if (i[m].upsert(_, u.boost, function (Qe, Ie) { return Qe + Ie; }), !s[j]) {
|
|
209
|
-
for (var V = 0; V < A.length; V++) {
|
|
210
|
-
var q = A[V], C = new t.FieldRef(q, m), z = B[q], W;
|
|
211
|
-
(W = r[C]) === void 0 ? r[C] = new t.MatchData(w, m, z) : W.add(w, m, z);
|
|
212
|
-
}
|
|
213
|
-
s[j] = !0;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
if (u.presence === t.Query.presence.REQUIRED)
|
|
218
|
-
for (var f = 0; f < u.fields.length; f++) {
|
|
219
|
-
var m = u.fields[f];
|
|
220
|
-
o[m] = o[m].intersect(y);
|
|
221
|
-
}
|
|
222
|
-
} for (var N = t.Set.complete, R = t.Set.empty, l = 0; l < this.fields.length; l++) {
|
|
223
|
-
var m = this.fields[l];
|
|
224
|
-
o[m] && (N = N.intersect(o[m])), a[m] && (R = R.union(a[m]));
|
|
225
|
-
} var c = Object.keys(r), v = [], P = Object.create(null); if (n.isNegated()) {
|
|
226
|
-
c = Object.keys(this.fieldVectors);
|
|
227
|
-
for (var l = 0; l < c.length; l++) {
|
|
228
|
-
var C = c[l], T = t.FieldRef.fromString(C);
|
|
229
|
-
r[C] = new t.MatchData;
|
|
230
|
-
}
|
|
231
|
-
} for (var l = 0; l < c.length; l++) {
|
|
232
|
-
var T = t.FieldRef.fromString(c[l]), h = T.docRef;
|
|
233
|
-
if (N.contains(h) && !R.contains(h)) {
|
|
234
|
-
var x = this.fieldVectors[T], O = i[T.fieldName].similarity(x), M;
|
|
235
|
-
if ((M = P[h]) !== void 0)
|
|
236
|
-
M.score += O, M.matchData.combine(r[T]);
|
|
237
|
-
else {
|
|
238
|
-
var E = { ref: h, score: O, matchData: r[T] };
|
|
239
|
-
P[h] = E, v.push(E);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
} return v.sort(function (Te, ke) { return ke.score - Te.score; }); }, t.Index.prototype.toJSON = function () { var e = Object.keys(this.invertedIndex).sort().map(function (r) { return [r, this.invertedIndex[r]]; }, this), n = Object.keys(this.fieldVectors).map(function (r) { return [r, this.fieldVectors[r].toJSON()]; }, this); return { version: t.version, fields: this.fields, fieldVectors: n, invertedIndex: e, pipeline: this.pipeline.toJSON() }; }, t.Index.load = function (e) { var n = {}, r = {}, i = e.fieldVectors, s = Object.create(null), o = e.invertedIndex, a = new t.TokenSet.Builder, l = t.Pipeline.load(e.pipeline); e.version != t.version && t.utils.warn("Version mismatch when loading serialised index. Current version of lunr '" + t.version + "' does not match serialized index '" + e.version + "'"); for (var u = 0; u < i.length; u++) {
|
|
243
|
-
var d = i[u], y = d[0], p = d[1];
|
|
244
|
-
r[y] = new t.Vector(p);
|
|
245
|
-
} for (var u = 0; u < o.length; u++) {
|
|
246
|
-
var d = o[u], b = d[0], g = d[1];
|
|
247
|
-
a.insert(b), s[b] = g;
|
|
248
|
-
} return a.finish(), n.fields = e.fields, n.fieldVectors = r, n.invertedIndex = s, n.tokenSet = a.root, n.pipeline = l, new t.Index(n); };
|
|
249
|
-
t.Builder = function () { this._ref = "id", this._fields = Object.create(null), this._documents = Object.create(null), this.invertedIndex = Object.create(null), this.fieldTermFrequencies = {}, this.fieldLengths = {}, this.tokenizer = t.tokenizer, this.pipeline = new t.Pipeline, this.searchPipeline = new t.Pipeline, this.documentCount = 0, this._b = .75, this._k1 = 1.2, this.termIndex = 0, this.metadataWhitelist = []; }, t.Builder.prototype.ref = function (e) { this._ref = e; }, t.Builder.prototype.field = function (e, n) { if (/\//.test(e))
|
|
250
|
-
throw new RangeError("Field '" + e + "' contains illegal character '/'"); this._fields[e] = n || {}; }, t.Builder.prototype.b = function (e) { e < 0 ? this._b = 0 : e > 1 ? this._b = 1 : this._b = e; }, t.Builder.prototype.k1 = function (e) { this._k1 = e; }, t.Builder.prototype.add = function (e, n) { var r = e[this._ref], i = Object.keys(this._fields); this._documents[r] = n || {}, this.documentCount += 1; for (var s = 0; s < i.length; s++) {
|
|
251
|
-
var o = i[s], a = this._fields[o].extractor, l = a ? a(e) : e[o], u = this.tokenizer(l, { fields: [o] }), d = this.pipeline.run(u), y = new t.FieldRef(r, o), p = Object.create(null);
|
|
252
|
-
this.fieldTermFrequencies[y] = p, this.fieldLengths[y] = 0, this.fieldLengths[y] += d.length;
|
|
253
|
-
for (var b = 0; b < d.length; b++) {
|
|
254
|
-
var g = d[b];
|
|
255
|
-
if (p[g] == null && (p[g] = 0), p[g] += 1, this.invertedIndex[g] == null) {
|
|
256
|
-
var L = Object.create(null);
|
|
257
|
-
L._index = this.termIndex, this.termIndex += 1;
|
|
258
|
-
for (var f = 0; f < i.length; f++)
|
|
259
|
-
L[i[f]] = Object.create(null);
|
|
260
|
-
this.invertedIndex[g] = L;
|
|
261
|
-
}
|
|
262
|
-
this.invertedIndex[g][o][r] == null && (this.invertedIndex[g][o][r] = Object.create(null));
|
|
263
|
-
for (var m = 0; m < this.metadataWhitelist.length; m++) {
|
|
264
|
-
var S = this.metadataWhitelist[m], w = g.metadata[S];
|
|
265
|
-
this.invertedIndex[g][o][r][S] == null && (this.invertedIndex[g][o][r][S] = []), this.invertedIndex[g][o][r][S].push(w);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
} }, t.Builder.prototype.calculateAverageFieldLengths = function () { for (var e = Object.keys(this.fieldLengths), n = e.length, r = {}, i = {}, s = 0; s < n; s++) {
|
|
269
|
-
var o = t.FieldRef.fromString(e[s]), a = o.fieldName;
|
|
270
|
-
i[a] || (i[a] = 0), i[a] += 1, r[a] || (r[a] = 0), r[a] += this.fieldLengths[o];
|
|
271
|
-
} for (var l = Object.keys(this._fields), s = 0; s < l.length; s++) {
|
|
272
|
-
var u = l[s];
|
|
273
|
-
r[u] = r[u] / i[u];
|
|
274
|
-
} this.averageFieldLength = r; }, t.Builder.prototype.createFieldVectors = function () { for (var e = {}, n = Object.keys(this.fieldTermFrequencies), r = n.length, i = Object.create(null), s = 0; s < r; s++) {
|
|
275
|
-
for (var o = t.FieldRef.fromString(n[s]), a = o.fieldName, l = this.fieldLengths[o], u = new t.Vector, d = this.fieldTermFrequencies[o], y = Object.keys(d), p = y.length, b = this._fields[a].boost || 1, g = this._documents[o.docRef].boost || 1, L = 0; L < p; L++) {
|
|
276
|
-
var f = y[L], m = d[f], S = this.invertedIndex[f]._index, w, k, _;
|
|
277
|
-
i[f] === void 0 ? (w = t.idf(this.invertedIndex[f], this.documentCount), i[f] = w) : w = i[f], k = w * ((this._k1 + 1) * m) / (this._k1 * (1 - this._b + this._b * (l / this.averageFieldLength[a])) + m), k *= b, k *= g, _ = Math.round(k * 1e3) / 1e3, u.insert(S, _);
|
|
278
|
-
}
|
|
279
|
-
e[o] = u;
|
|
280
|
-
} this.fieldVectors = e; }, t.Builder.prototype.createTokenSet = function () { this.tokenSet = t.TokenSet.fromArray(Object.keys(this.invertedIndex).sort()); }, t.Builder.prototype.build = function () { return this.calculateAverageFieldLengths(), this.createFieldVectors(), this.createTokenSet(), new t.Index({ invertedIndex: this.invertedIndex, fieldVectors: this.fieldVectors, tokenSet: this.tokenSet, fields: Object.keys(this._fields), pipeline: this.searchPipeline }); }, t.Builder.prototype.use = function (e) { var n = Array.prototype.slice.call(arguments, 1); n.unshift(this), e.apply(this, n); }, t.MatchData = function (e, n, r) { for (var i = Object.create(null), s = Object.keys(r || {}), o = 0; o < s.length; o++) {
|
|
281
|
-
var a = s[o];
|
|
282
|
-
i[a] = r[a].slice();
|
|
283
|
-
} this.metadata = Object.create(null), e !== void 0 && (this.metadata[e] = Object.create(null), this.metadata[e][n] = i); }, t.MatchData.prototype.combine = function (e) { for (var n = Object.keys(e.metadata), r = 0; r < n.length; r++) {
|
|
284
|
-
var i = n[r], s = Object.keys(e.metadata[i]);
|
|
285
|
-
this.metadata[i] == null && (this.metadata[i] = Object.create(null));
|
|
286
|
-
for (var o = 0; o < s.length; o++) {
|
|
287
|
-
var a = s[o], l = Object.keys(e.metadata[i][a]);
|
|
288
|
-
this.metadata[i][a] == null && (this.metadata[i][a] = Object.create(null));
|
|
289
|
-
for (var u = 0; u < l.length; u++) {
|
|
290
|
-
var d = l[u];
|
|
291
|
-
this.metadata[i][a][d] == null ? this.metadata[i][a][d] = e.metadata[i][a][d] : this.metadata[i][a][d] = this.metadata[i][a][d].concat(e.metadata[i][a][d]);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
} }, t.MatchData.prototype.add = function (e, n, r) { if (!(e in this.metadata)) {
|
|
295
|
-
this.metadata[e] = Object.create(null), this.metadata[e][n] = r;
|
|
296
|
-
return;
|
|
297
|
-
} if (!(n in this.metadata[e])) {
|
|
298
|
-
this.metadata[e][n] = r;
|
|
299
|
-
return;
|
|
300
|
-
} for (var i = Object.keys(r), s = 0; s < i.length; s++) {
|
|
301
|
-
var o = i[s];
|
|
302
|
-
o in this.metadata[e][n] ? this.metadata[e][n][o] = this.metadata[e][n][o].concat(r[o]) : this.metadata[e][n][o] = r[o];
|
|
303
|
-
} }, t.Query = function (e) { this.clauses = [], this.allFields = e; }, t.Query.wildcard = new String("*"), t.Query.wildcard.NONE = 0, t.Query.wildcard.LEADING = 1, t.Query.wildcard.TRAILING = 2, t.Query.presence = { OPTIONAL: 1, REQUIRED: 2, PROHIBITED: 3 }, t.Query.prototype.clause = function (e) { return "fields" in e || (e.fields = this.allFields), "boost" in e || (e.boost = 1), "usePipeline" in e || (e.usePipeline = !0), "wildcard" in e || (e.wildcard = t.Query.wildcard.NONE), e.wildcard & t.Query.wildcard.LEADING && e.term.charAt(0) != t.Query.wildcard && (e.term = "*" + e.term), e.wildcard & t.Query.wildcard.TRAILING && e.term.slice(-1) != t.Query.wildcard && (e.term = "" + e.term + "*"), "presence" in e || (e.presence = t.Query.presence.OPTIONAL), this.clauses.push(e), this; }, t.Query.prototype.isNegated = function () { for (var e = 0; e < this.clauses.length; e++)
|
|
304
|
-
if (this.clauses[e].presence != t.Query.presence.PROHIBITED)
|
|
305
|
-
return !1; return !0; }, t.Query.prototype.term = function (e, n) { if (Array.isArray(e))
|
|
306
|
-
return e.forEach(function (i) { this.term(i, t.utils.clone(n)); }, this), this; var r = n || {}; return r.term = e.toString(), this.clause(r), this; }, t.QueryParseError = function (e, n, r) { this.name = "QueryParseError", this.message = e, this.start = n, this.end = r; }, t.QueryParseError.prototype = new Error, t.QueryLexer = function (e) { this.lexemes = [], this.str = e, this.length = e.length, this.pos = 0, this.start = 0, this.escapeCharPositions = []; }, t.QueryLexer.prototype.run = function () { for (var e = t.QueryLexer.lexText; e;)
|
|
307
|
-
e = e(this); }, t.QueryLexer.prototype.sliceString = function () { for (var e = [], n = this.start, r = this.pos, i = 0; i < this.escapeCharPositions.length; i++)
|
|
308
|
-
r = this.escapeCharPositions[i], e.push(this.str.slice(n, r)), n = r + 1; return e.push(this.str.slice(n, this.pos)), this.escapeCharPositions.length = 0, e.join(""); }, t.QueryLexer.prototype.emit = function (e) { this.lexemes.push({ type: e, str: this.sliceString(), start: this.start, end: this.pos }), this.start = this.pos; }, t.QueryLexer.prototype.escapeCharacter = function () { this.escapeCharPositions.push(this.pos - 1), this.pos += 1; }, t.QueryLexer.prototype.next = function () { if (this.pos >= this.length)
|
|
309
|
-
return t.QueryLexer.EOS; var e = this.str.charAt(this.pos); return this.pos += 1, e; }, t.QueryLexer.prototype.width = function () { return this.pos - this.start; }, t.QueryLexer.prototype.ignore = function () { this.start == this.pos && (this.pos += 1), this.start = this.pos; }, t.QueryLexer.prototype.backup = function () { this.pos -= 1; }, t.QueryLexer.prototype.acceptDigitRun = function () { var e, n; do
|
|
310
|
-
e = this.next(), n = e.charCodeAt(0);
|
|
311
|
-
while (n > 47 && n < 58); e != t.QueryLexer.EOS && this.backup(); }, t.QueryLexer.prototype.more = function () { return this.pos < this.length; }, t.QueryLexer.EOS = "EOS", t.QueryLexer.FIELD = "FIELD", t.QueryLexer.TERM = "TERM", t.QueryLexer.EDIT_DISTANCE = "EDIT_DISTANCE", t.QueryLexer.BOOST = "BOOST", t.QueryLexer.PRESENCE = "PRESENCE", t.QueryLexer.lexField = function (e) { return e.backup(), e.emit(t.QueryLexer.FIELD), e.ignore(), t.QueryLexer.lexText; }, t.QueryLexer.lexTerm = function (e) { if (e.width() > 1 && (e.backup(), e.emit(t.QueryLexer.TERM)), e.ignore(), e.more())
|
|
312
|
-
return t.QueryLexer.lexText; }, t.QueryLexer.lexEditDistance = function (e) { return e.ignore(), e.acceptDigitRun(), e.emit(t.QueryLexer.EDIT_DISTANCE), t.QueryLexer.lexText; }, t.QueryLexer.lexBoost = function (e) { return e.ignore(), e.acceptDigitRun(), e.emit(t.QueryLexer.BOOST), t.QueryLexer.lexText; }, t.QueryLexer.lexEOS = function (e) { e.width() > 0 && e.emit(t.QueryLexer.TERM); }, t.QueryLexer.termSeparator = t.tokenizer.separator, t.QueryLexer.lexText = function (e) { for (;;) {
|
|
313
|
-
var n = e.next();
|
|
314
|
-
if (n == t.QueryLexer.EOS)
|
|
315
|
-
return t.QueryLexer.lexEOS;
|
|
316
|
-
if (n.charCodeAt(0) == 92) {
|
|
317
|
-
e.escapeCharacter();
|
|
318
|
-
continue;
|
|
319
|
-
}
|
|
320
|
-
if (n == ":")
|
|
321
|
-
return t.QueryLexer.lexField;
|
|
322
|
-
if (n == "~")
|
|
323
|
-
return e.backup(), e.width() > 0 && e.emit(t.QueryLexer.TERM), t.QueryLexer.lexEditDistance;
|
|
324
|
-
if (n == "^")
|
|
325
|
-
return e.backup(), e.width() > 0 && e.emit(t.QueryLexer.TERM), t.QueryLexer.lexBoost;
|
|
326
|
-
if (n == "+" && e.width() === 1 || n == "-" && e.width() === 1)
|
|
327
|
-
return e.emit(t.QueryLexer.PRESENCE), t.QueryLexer.lexText;
|
|
328
|
-
if (n.match(t.QueryLexer.termSeparator))
|
|
329
|
-
return t.QueryLexer.lexTerm;
|
|
330
|
-
} }, t.QueryParser = function (e, n) { this.lexer = new t.QueryLexer(e), this.query = n, this.currentClause = {}, this.lexemeIdx = 0; }, t.QueryParser.prototype.parse = function () { this.lexer.run(), this.lexemes = this.lexer.lexemes; for (var e = t.QueryParser.parseClause; e;)
|
|
331
|
-
e = e(this); return this.query; }, t.QueryParser.prototype.peekLexeme = function () { return this.lexemes[this.lexemeIdx]; }, t.QueryParser.prototype.consumeLexeme = function () { var e = this.peekLexeme(); return this.lexemeIdx += 1, e; }, t.QueryParser.prototype.nextClause = function () { var e = this.currentClause; this.query.clause(e), this.currentClause = {}; }, t.QueryParser.parseClause = function (e) { var n = e.peekLexeme(); if (n != null)
|
|
332
|
-
switch (n.type) {
|
|
333
|
-
case t.QueryLexer.PRESENCE: return t.QueryParser.parsePresence;
|
|
334
|
-
case t.QueryLexer.FIELD: return t.QueryParser.parseField;
|
|
335
|
-
case t.QueryLexer.TERM: return t.QueryParser.parseTerm;
|
|
336
|
-
default:
|
|
337
|
-
var r = "expected either a field or a term, found " + n.type;
|
|
338
|
-
throw n.str.length >= 1 && (r += " with value '" + n.str + "'"), new t.QueryParseError(r, n.start, n.end);
|
|
339
|
-
} }, t.QueryParser.parsePresence = function (e) { var n = e.consumeLexeme(); if (n != null) {
|
|
340
|
-
switch (n.str) {
|
|
341
|
-
case "-":
|
|
342
|
-
e.currentClause.presence = t.Query.presence.PROHIBITED;
|
|
343
|
-
break;
|
|
344
|
-
case "+":
|
|
345
|
-
e.currentClause.presence = t.Query.presence.REQUIRED;
|
|
346
|
-
break;
|
|
347
|
-
default:
|
|
348
|
-
var r = "unrecognised presence operator'" + n.str + "'";
|
|
349
|
-
throw new t.QueryParseError(r, n.start, n.end);
|
|
350
|
-
}
|
|
351
|
-
var i = e.peekLexeme();
|
|
352
|
-
if (i == null) {
|
|
353
|
-
var r = "expecting term or field, found nothing";
|
|
354
|
-
throw new t.QueryParseError(r, n.start, n.end);
|
|
355
|
-
}
|
|
356
|
-
switch (i.type) {
|
|
357
|
-
case t.QueryLexer.FIELD: return t.QueryParser.parseField;
|
|
358
|
-
case t.QueryLexer.TERM: return t.QueryParser.parseTerm;
|
|
359
|
-
default:
|
|
360
|
-
var r = "expecting term or field, found '" + i.type + "'";
|
|
361
|
-
throw new t.QueryParseError(r, i.start, i.end);
|
|
362
|
-
}
|
|
363
|
-
} }, t.QueryParser.parseField = function (e) { var n = e.consumeLexeme(); if (n != null) {
|
|
364
|
-
if (e.query.allFields.indexOf(n.str) == -1) {
|
|
365
|
-
var r = e.query.allFields.map(function (o) { return "'" + o + "'"; }).join(", "), i = "unrecognised field '" + n.str + "', possible fields: " + r;
|
|
366
|
-
throw new t.QueryParseError(i, n.start, n.end);
|
|
367
|
-
}
|
|
368
|
-
e.currentClause.fields = [n.str];
|
|
369
|
-
var s = e.peekLexeme();
|
|
370
|
-
if (s == null) {
|
|
371
|
-
var i = "expecting term, found nothing";
|
|
372
|
-
throw new t.QueryParseError(i, n.start, n.end);
|
|
373
|
-
}
|
|
374
|
-
switch (s.type) {
|
|
375
|
-
case t.QueryLexer.TERM: return t.QueryParser.parseTerm;
|
|
376
|
-
default:
|
|
377
|
-
var i = "expecting term, found '" + s.type + "'";
|
|
378
|
-
throw new t.QueryParseError(i, s.start, s.end);
|
|
379
|
-
}
|
|
380
|
-
} }, t.QueryParser.parseTerm = function (e) { var n = e.consumeLexeme(); if (n != null) {
|
|
381
|
-
e.currentClause.term = n.str.toLowerCase(), n.str.indexOf("*") != -1 && (e.currentClause.usePipeline = !1);
|
|
382
|
-
var r = e.peekLexeme();
|
|
383
|
-
if (r == null) {
|
|
384
|
-
e.nextClause();
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
switch (r.type) {
|
|
388
|
-
case t.QueryLexer.TERM: return e.nextClause(), t.QueryParser.parseTerm;
|
|
389
|
-
case t.QueryLexer.FIELD: return e.nextClause(), t.QueryParser.parseField;
|
|
390
|
-
case t.QueryLexer.EDIT_DISTANCE: return t.QueryParser.parseEditDistance;
|
|
391
|
-
case t.QueryLexer.BOOST: return t.QueryParser.parseBoost;
|
|
392
|
-
case t.QueryLexer.PRESENCE: return e.nextClause(), t.QueryParser.parsePresence;
|
|
393
|
-
default:
|
|
394
|
-
var i = "Unexpected lexeme type '" + r.type + "'";
|
|
395
|
-
throw new t.QueryParseError(i, r.start, r.end);
|
|
396
|
-
}
|
|
397
|
-
} }, t.QueryParser.parseEditDistance = function (e) { var n = e.consumeLexeme(); if (n != null) {
|
|
398
|
-
var r = parseInt(n.str, 10);
|
|
399
|
-
if (isNaN(r)) {
|
|
400
|
-
var i = "edit distance must be numeric";
|
|
401
|
-
throw new t.QueryParseError(i, n.start, n.end);
|
|
402
|
-
}
|
|
403
|
-
e.currentClause.editDistance = r;
|
|
404
|
-
var s = e.peekLexeme();
|
|
405
|
-
if (s == null) {
|
|
406
|
-
e.nextClause();
|
|
407
|
-
return;
|
|
408
|
-
}
|
|
409
|
-
switch (s.type) {
|
|
410
|
-
case t.QueryLexer.TERM: return e.nextClause(), t.QueryParser.parseTerm;
|
|
411
|
-
case t.QueryLexer.FIELD: return e.nextClause(), t.QueryParser.parseField;
|
|
412
|
-
case t.QueryLexer.EDIT_DISTANCE: return t.QueryParser.parseEditDistance;
|
|
413
|
-
case t.QueryLexer.BOOST: return t.QueryParser.parseBoost;
|
|
414
|
-
case t.QueryLexer.PRESENCE: return e.nextClause(), t.QueryParser.parsePresence;
|
|
415
|
-
default:
|
|
416
|
-
var i = "Unexpected lexeme type '" + s.type + "'";
|
|
417
|
-
throw new t.QueryParseError(i, s.start, s.end);
|
|
418
|
-
}
|
|
419
|
-
} }, t.QueryParser.parseBoost = function (e) { var n = e.consumeLexeme(); if (n != null) {
|
|
420
|
-
var r = parseInt(n.str, 10);
|
|
421
|
-
if (isNaN(r)) {
|
|
422
|
-
var i = "boost must be numeric";
|
|
423
|
-
throw new t.QueryParseError(i, n.start, n.end);
|
|
424
|
-
}
|
|
425
|
-
e.currentClause.boost = r;
|
|
426
|
-
var s = e.peekLexeme();
|
|
427
|
-
if (s == null) {
|
|
428
|
-
e.nextClause();
|
|
429
|
-
return;
|
|
430
|
-
}
|
|
431
|
-
switch (s.type) {
|
|
432
|
-
case t.QueryLexer.TERM: return e.nextClause(), t.QueryParser.parseTerm;
|
|
433
|
-
case t.QueryLexer.FIELD: return e.nextClause(), t.QueryParser.parseField;
|
|
434
|
-
case t.QueryLexer.EDIT_DISTANCE: return t.QueryParser.parseEditDistance;
|
|
435
|
-
case t.QueryLexer.BOOST: return t.QueryParser.parseBoost;
|
|
436
|
-
case t.QueryLexer.PRESENCE: return e.nextClause(), t.QueryParser.parsePresence;
|
|
437
|
-
default:
|
|
438
|
-
var i = "Unexpected lexeme type '" + s.type + "'";
|
|
439
|
-
throw new t.QueryParseError(i, s.start, s.end);
|
|
440
|
-
}
|
|
441
|
-
} }, function (e, n) { typeof define == "function" && define.amd ? define(n) : typeof se == "object" ? oe.exports = n() : e.lunr = n(); }(this, function () { return t; });
|
|
442
|
-
})();
|
|
443
|
-
});
|
|
444
|
-
var re = [];
|
|
445
|
-
function G(t, e) { re.push({ selector: e, constructor: t }); }
|
|
446
|
-
var U = class {
|
|
447
|
-
constructor() { this.alwaysVisibleMember = null; this.createComponents(document.body), this.ensureFocusedElementVisible(), this.listenForCodeCopies(), window.addEventListener("hashchange", () => this.ensureFocusedElementVisible()), document.body.style.display || (this.ensureFocusedElementVisible(), this.updateIndexVisibility(), this.scrollToHash()); }
|
|
448
|
-
createComponents(e) { re.forEach(n => { e.querySelectorAll(n.selector).forEach(r => { r.dataset.hasInstance || (new n.constructor({ el: r, app: this }), r.dataset.hasInstance = String(!0)); }); }); }
|
|
449
|
-
filterChanged() { this.ensureFocusedElementVisible(); }
|
|
450
|
-
showPage() { document.body.style.display && (console.log("Show page"), document.body.style.removeProperty("display"), this.ensureFocusedElementVisible(), this.updateIndexVisibility(), this.scrollToHash()); }
|
|
451
|
-
scrollToHash() { if (location.hash) {
|
|
452
|
-
console.log("Scorlling");
|
|
453
|
-
let e = document.getElementById(location.hash.substring(1));
|
|
454
|
-
if (!e)
|
|
455
|
-
return;
|
|
456
|
-
e.scrollIntoView({ behavior: "instant", block: "start" });
|
|
457
|
-
} }
|
|
458
|
-
ensureActivePageVisible() { let e = document.querySelector(".tsd-navigation .current"), n = e?.parentElement; for (; n && !n.classList.contains(".tsd-navigation");)
|
|
459
|
-
n instanceof HTMLDetailsElement && (n.open = !0), n = n.parentElement; if (e && !e.checkVisibility()) {
|
|
460
|
-
let r = e.getBoundingClientRect().top - document.documentElement.clientHeight / 4;
|
|
461
|
-
document.querySelector(".site-menu").scrollTop = r;
|
|
462
|
-
} }
|
|
463
|
-
updateIndexVisibility() { let e = document.querySelector(".tsd-index-content"), n = e?.open; e && (e.open = !0), document.querySelectorAll(".tsd-index-section").forEach(r => { r.style.display = "block"; let i = Array.from(r.querySelectorAll(".tsd-index-link")).every(s => s.offsetParent == null); r.style.display = i ? "none" : "block"; }), e && (e.open = n); }
|
|
464
|
-
ensureFocusedElementVisible() { if (this.alwaysVisibleMember && (this.alwaysVisibleMember.classList.remove("always-visible"), this.alwaysVisibleMember.firstElementChild.remove(), this.alwaysVisibleMember = null), !location.hash)
|
|
465
|
-
return; let e = document.getElementById(location.hash.substring(1)); if (!e)
|
|
466
|
-
return; let n = e.parentElement; for (; n && n.tagName !== "SECTION";)
|
|
467
|
-
n = n.parentElement; if (n && n.offsetParent == null) {
|
|
468
|
-
this.alwaysVisibleMember = n, n.classList.add("always-visible");
|
|
469
|
-
let r = document.createElement("p");
|
|
470
|
-
r.classList.add("warning"), r.textContent = "This member is normally hidden due to your filter settings.", n.prepend(r);
|
|
471
|
-
} }
|
|
472
|
-
listenForCodeCopies() { document.querySelectorAll("pre > button").forEach(e => { let n; e.addEventListener("click", () => { e.previousElementSibling instanceof HTMLElement && navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()), e.textContent = "Copied!", e.classList.add("visible"), clearTimeout(n), n = setTimeout(() => { e.classList.remove("visible"), n = setTimeout(() => { e.textContent = "Copy"; }, 100); }, 1e3); }); }); }
|
|
473
|
-
};
|
|
474
|
-
var ie = (t, e = 100) => { let n; return () => { clearTimeout(n), n = setTimeout(() => t(), e); }; };
|
|
475
|
-
var de = De(ae());
|
|
476
|
-
async function le(t, e) { if (!window.searchData)
|
|
477
|
-
return; let n = await fetch(window.searchData), r = new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")), i = await new Response(r).json(); t.data = i, t.index = de.Index.load(i.index), e.classList.remove("loading"), e.classList.add("ready"); }
|
|
478
|
-
function he() { let t = document.getElementById("tsd-search"); if (!t)
|
|
479
|
-
return; let e = { base: t.dataset.base + "/" }, n = document.getElementById("tsd-search-script"); t.classList.add("loading"), n && (n.addEventListener("error", () => { t.classList.remove("loading"), t.classList.add("failure"); }), n.addEventListener("load", () => { le(e, t); }), le(e, t)); let r = document.querySelector("#tsd-search input"), i = document.querySelector("#tsd-search .results"); if (!r || !i)
|
|
480
|
-
throw new Error("The input field or the result list wrapper was not found"); let s = !1; i.addEventListener("mousedown", () => s = !0), i.addEventListener("mouseup", () => { s = !1, t.classList.remove("has-focus"); }), r.addEventListener("focus", () => t.classList.add("has-focus")), r.addEventListener("blur", () => { s || (s = !1, t.classList.remove("has-focus")); }), Ae(t, i, r, e); }
|
|
481
|
-
function Ae(t, e, n, r) { n.addEventListener("input", ie(() => { Ve(t, e, n, r); }, 200)); let i = !1; n.addEventListener("keydown", s => { i = !0, s.key == "Enter" ? Ne(e, n) : s.key == "Escape" ? n.blur() : s.key == "ArrowUp" ? ue(e, -1) : s.key === "ArrowDown" ? ue(e, 1) : i = !1; }), n.addEventListener("keypress", s => { i && s.preventDefault(); }), document.body.addEventListener("keydown", s => { s.altKey || s.ctrlKey || s.metaKey || !n.matches(":focus") && s.key === "/" && (n.focus(), s.preventDefault()); }); }
|
|
482
|
-
function Ve(t, e, n, r) {
|
|
483
|
-
if (!r.index || !r.data)
|
|
484
|
-
return;
|
|
485
|
-
e.textContent = "";
|
|
486
|
-
let i = n.value.trim(), s;
|
|
487
|
-
if (i) {
|
|
488
|
-
let o = i.split(" ").map(a => a.length ? `*${a}*` : "").join(" ");
|
|
489
|
-
s = r.index.search(o);
|
|
490
|
-
}
|
|
491
|
-
else
|
|
492
|
-
s = [];
|
|
493
|
-
for (let o = 0; o < s.length; o++) {
|
|
494
|
-
let a = s[o], l = r.data.rows[Number(a.ref)], u = 1;
|
|
495
|
-
l.name.toLowerCase().startsWith(i.toLowerCase()) && (u *= 1 + 1 / (1 + Math.abs(l.name.length - i.length))), a.score *= u;
|
|
496
|
-
}
|
|
497
|
-
if (s.length === 0) {
|
|
498
|
-
let o = document.createElement("li");
|
|
499
|
-
o.classList.add("no-results");
|
|
500
|
-
let a = document.createElement("span");
|
|
501
|
-
a.textContent = "No results found", o.appendChild(a), e.appendChild(o);
|
|
502
|
-
}
|
|
503
|
-
s.sort((o, a) => a.score - o.score);
|
|
504
|
-
for (let o = 0, a = Math.min(10, s.length); o < a; o++) {
|
|
505
|
-
let l = r.data.rows[Number(s[o].ref)], u = `<svg width="20" height="20" viewBox="0 0 24 24" fill="none" class="tsd-kind-icon"><use href="#icon-${l.kind}"></use></svg>`, d = ce(l.name, i);
|
|
506
|
-
globalThis.DEBUG_SEARCH_WEIGHTS && (d += ` (score: ${s[o].score.toFixed(2)})`), l.parent && (d = `<span class="parent">
|
|
507
|
-
${ce(l.parent, i)}.</span>${d}`);
|
|
508
|
-
let y = document.createElement("li");
|
|
509
|
-
y.classList.value = l.classes ?? "";
|
|
510
|
-
let p = document.createElement("a");
|
|
511
|
-
p.href = r.base + l.url, p.innerHTML = u + d, y.append(p), e.appendChild(y);
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
function ue(t, e) { let n = t.querySelector(".current"); if (!n)
|
|
515
|
-
n = t.querySelector(e == 1 ? "li:first-child" : "li:last-child"), n && n.classList.add("current");
|
|
516
|
-
else {
|
|
517
|
-
let r = n;
|
|
518
|
-
if (e === 1)
|
|
519
|
-
do
|
|
520
|
-
r = r.nextElementSibling ?? void 0;
|
|
521
|
-
while (r instanceof HTMLElement && r.offsetParent == null);
|
|
522
|
-
else
|
|
523
|
-
do
|
|
524
|
-
r = r.previousElementSibling ?? void 0;
|
|
525
|
-
while (r instanceof HTMLElement && r.offsetParent == null);
|
|
526
|
-
r && (n.classList.remove("current"), r.classList.add("current"));
|
|
527
|
-
} }
|
|
528
|
-
function Ne(t, e) { let n = t.querySelector(".current"); if (n || (n = t.querySelector("li:first-child")), n) {
|
|
529
|
-
let r = n.querySelector("a");
|
|
530
|
-
r && (window.location.href = r.href), e.blur();
|
|
531
|
-
} }
|
|
532
|
-
function ce(t, e) { if (e === "")
|
|
533
|
-
return t; let n = t.toLocaleLowerCase(), r = e.toLocaleLowerCase(), i = [], s = 0, o = n.indexOf(r); for (; o != -1;)
|
|
534
|
-
i.push(K(t.substring(s, o)), `<b>${K(t.substring(o, o + r.length))}</b>`), s = o + r.length, o = n.indexOf(r, s); return i.push(K(t.substring(s))), i.join(""); }
|
|
535
|
-
var He = { "&": "&", "<": "<", ">": ">", "'": "'", '"': """ };
|
|
536
|
-
function K(t) { return t.replace(/[&<>"'"]/g, e => He[e]); }
|
|
537
|
-
var I = class {
|
|
538
|
-
constructor(e) { this.el = e.el, this.app = e.app; }
|
|
539
|
-
};
|
|
540
|
-
var F = "mousedown", fe = "mousemove", H = "mouseup", J = { x: 0, y: 0 }, pe = !1, ee = !1, Be = !1, D = !1, me = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
541
|
-
document.documentElement.classList.add(me ? "is-mobile" : "not-mobile");
|
|
542
|
-
me && "ontouchstart" in document.documentElement && (Be = !0, F = "touchstart", fe = "touchmove", H = "touchend");
|
|
543
|
-
document.addEventListener(F, t => { ee = !0, D = !1; let e = F == "touchstart" ? t.targetTouches[0] : t; J.y = e.pageY || 0, J.x = e.pageX || 0; });
|
|
544
|
-
document.addEventListener(fe, t => { if (ee && !D) {
|
|
545
|
-
let e = F == "touchstart" ? t.targetTouches[0] : t, n = J.x - (e.pageX || 0), r = J.y - (e.pageY || 0);
|
|
546
|
-
D = Math.sqrt(n * n + r * r) > 10;
|
|
547
|
-
} });
|
|
548
|
-
document.addEventListener(H, () => { ee = !1; });
|
|
549
|
-
document.addEventListener("click", t => { pe && (t.preventDefault(), t.stopImmediatePropagation(), pe = !1); });
|
|
550
|
-
var X = class extends I {
|
|
551
|
-
constructor(e) { super(e), this.className = this.el.dataset.toggle || "", this.el.addEventListener(H, n => this.onPointerUp(n)), this.el.addEventListener("click", n => n.preventDefault()), document.addEventListener(F, n => this.onDocumentPointerDown(n)), document.addEventListener(H, n => this.onDocumentPointerUp(n)); }
|
|
552
|
-
setActive(e) { if (this.active == e)
|
|
553
|
-
return; this.active = e, document.documentElement.classList.toggle("has-" + this.className, e), this.el.classList.toggle("active", e); let n = (this.active ? "to-has-" : "from-has-") + this.className; document.documentElement.classList.add(n), setTimeout(() => document.documentElement.classList.remove(n), 500); }
|
|
554
|
-
onPointerUp(e) { D || (this.setActive(!0), e.preventDefault()); }
|
|
555
|
-
onDocumentPointerDown(e) { if (this.active) {
|
|
556
|
-
if (e.target.closest(".col-sidebar, .tsd-filter-group"))
|
|
557
|
-
return;
|
|
558
|
-
this.setActive(!1);
|
|
559
|
-
} }
|
|
560
|
-
onDocumentPointerUp(e) { if (!D && this.active && e.target.closest(".col-sidebar")) {
|
|
561
|
-
let n = e.target.closest("a");
|
|
562
|
-
if (n) {
|
|
563
|
-
let r = window.location.href;
|
|
564
|
-
r.indexOf("#") != -1 && (r = r.substring(0, r.indexOf("#"))), n.href.substring(0, r.length) == r && setTimeout(() => this.setActive(!1), 250);
|
|
565
|
-
}
|
|
566
|
-
} }
|
|
567
|
-
};
|
|
568
|
-
var te;
|
|
569
|
-
try {
|
|
570
|
-
te = localStorage;
|
|
571
|
-
}
|
|
572
|
-
catch {
|
|
573
|
-
te = { getItem() { return null; }, setItem() { } };
|
|
574
|
-
}
|
|
575
|
-
var Q = te;
|
|
576
|
-
var ye = document.head.appendChild(document.createElement("style"));
|
|
577
|
-
ye.dataset.for = "filters";
|
|
578
|
-
var Y = class extends I {
|
|
579
|
-
constructor(e) {
|
|
580
|
-
super(e), this.key = `filter-${this.el.name}`, this.value = this.el.checked, this.el.addEventListener("change", () => { this.setLocalStorage(this.el.checked); }), this.setLocalStorage(this.fromLocalStorage()), ye.innerHTML += `html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; }
|
|
581
|
-
`, this.app.updateIndexVisibility();
|
|
582
|
-
}
|
|
583
|
-
fromLocalStorage() { let e = Q.getItem(this.key); return e ? e === "true" : this.el.checked; }
|
|
584
|
-
setLocalStorage(e) { Q.setItem(this.key, e.toString()), this.value = e, this.handleValueChange(); }
|
|
585
|
-
handleValueChange() { this.el.checked = this.value, document.documentElement.classList.toggle(this.key, this.value), this.app.filterChanged(), this.app.updateIndexVisibility(); }
|
|
586
|
-
};
|
|
587
|
-
var Z = class extends I {
|
|
588
|
-
constructor(e) { super(e), this.summary = this.el.querySelector(".tsd-accordion-summary"), this.icon = this.summary.querySelector("svg"), this.key = `tsd-accordion-${this.summary.dataset.key ?? this.summary.textContent.trim().replace(/\s+/g, "-").toLowerCase()}`; let n = Q.getItem(this.key); this.el.open = n ? n === "true" : this.el.open, this.el.addEventListener("toggle", () => this.update()); let r = this.summary.querySelector("a"); r && r.addEventListener("click", () => { location.assign(r.href); }), this.update(); }
|
|
589
|
-
update() { this.icon.style.transform = `rotate(${this.el.open ? 0 : -90}deg)`, Q.setItem(this.key, this.el.open.toString()); }
|
|
590
|
-
};
|
|
591
|
-
function ge(t) { let e = Q.getItem("tsd-theme") || "os"; t.value = e, ve(e), t.addEventListener("change", () => { Q.setItem("tsd-theme", t.value), ve(t.value); }); }
|
|
592
|
-
function ve(t) { document.documentElement.dataset.theme = t; }
|
|
593
|
-
var Le;
|
|
594
|
-
function be() { let t = document.getElementById("tsd-nav-script"); t && (t.addEventListener("load", xe), xe()); }
|
|
595
|
-
async function xe() { let t = document.getElementById("tsd-nav-container"); if (!t || !window.navigationData)
|
|
596
|
-
return; let n = await (await fetch(window.navigationData)).arrayBuffer(), r = new Blob([n]).stream().pipeThrough(new DecompressionStream("gzip")), i = await new Response(r).json(); Le = t.dataset.base + "/", t.innerHTML = ""; for (let s of i)
|
|
597
|
-
we(s, t, []); window.app.createComponents(t), window.app.showPage(), window.app.ensureActivePageVisible(); }
|
|
598
|
-
function we(t, e, n) { let r = e.appendChild(document.createElement("li")); if (t.children) {
|
|
599
|
-
let i = [...n, t.text], s = r.appendChild(document.createElement("details"));
|
|
600
|
-
s.className = t.class ? `${t.class} tsd-index-accordion` : "tsd-index-accordion", s.dataset.key = i.join("$");
|
|
601
|
-
let o = s.appendChild(document.createElement("summary"));
|
|
602
|
-
o.className = "tsd-accordion-summary", o.innerHTML = '<svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="#icon-chevronDown"></use></svg>', Ee(t, o);
|
|
603
|
-
let a = s.appendChild(document.createElement("div"));
|
|
604
|
-
a.className = "tsd-accordion-details";
|
|
605
|
-
let l = a.appendChild(document.createElement("ul"));
|
|
606
|
-
l.className = "tsd-nested-navigation";
|
|
607
|
-
for (let u of t.children)
|
|
608
|
-
we(u, l, i);
|
|
609
|
-
}
|
|
610
|
-
else
|
|
611
|
-
Ee(t, r, t.class); }
|
|
612
|
-
function Ee(t, e, n) { if (t.path) {
|
|
613
|
-
let r = e.appendChild(document.createElement("a"));
|
|
614
|
-
r.href = Le + t.path, n && (r.className = n), location.pathname === r.pathname && r.classList.add("current"), t.kind && (r.innerHTML = `<svg width="20" height="20" viewBox="0 0 24 24" fill="none" class="tsd-kind-icon"><use href="#icon-${t.kind}"></use></svg>`), r.appendChild(document.createElement("span")).textContent = t.text;
|
|
615
|
-
}
|
|
616
|
-
else
|
|
617
|
-
e.appendChild(document.createElement("span")).textContent = t.text; }
|
|
618
|
-
G(X, "a[data-toggle]");
|
|
619
|
-
G(Z, ".tsd-index-accordion");
|
|
620
|
-
G(Y, ".tsd-filter-item input[type=checkbox]");
|
|
621
|
-
var Se = document.getElementById("tsd-theme");
|
|
622
|
-
Se && ge(Se);
|
|
623
|
-
var je = new U;
|
|
624
|
-
Object.defineProperty(window, "app", { value: je });
|
|
625
|
-
he();
|
|
626
|
-
be();
|
|
627
|
-
})();
|
|
628
|
-
export {};
|
|
629
|
-
//# sourceMappingURL=main.js.map
|