@jbrowse/plugin-trix 1.4.2 → 1.5.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"plugin-trix.cjs.production.min.js","sources":["../../../node_modules/regenerator-runtime/runtime.js","../src/TrixTextSearchAdapter/TrixTextSearchAdapter.ts","../src/TrixTextSearchAdapter/configSchema.ts","../src/index.ts"],"sourcesContent":["/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n IteratorPrototype[iteratorSymbol] = function () {\n return this;\n };\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\n GeneratorFunctionPrototype.constructor = GeneratorFunction;\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n AsyncIterator.prototype[asyncIteratorSymbol] = function () {\n return this;\n };\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n Gp[iteratorSymbol] = function() {\n return this;\n };\n\n Gp.toString = function() {\n return \"[object Generator]\";\n };\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n}\n","import Trix from '@gmod/trix'\nimport {\n BaseTextSearchAdapter,\n BaseArgs,\n BaseAdapter,\n} from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { openLocation } from '@jbrowse/core/util/io'\nimport { LocStringResult } from '@jbrowse/core/TextSearch/BaseResults'\nimport { readConfObject } from '@jbrowse/core/configuration'\nimport { AnyConfigurationModel } from '@jbrowse/core/configuration/configurationSchema'\n\nfunction shorten(str: string, term: string, w = 15) {\n const tidx = str.indexOf(term)\n\n return str.length < 40\n ? str\n : (Math.max(0, tidx - w) > 0 ? '...' : '') +\n str.slice(Math.max(0, tidx - w), tidx + term.length + w).trim() +\n (tidx + term.length < str.length ? '...' : '')\n}\n\nexport default class TrixTextSearchAdapter\n extends BaseAdapter\n implements BaseTextSearchAdapter {\n indexingAttributes?: string[]\n trixJs: Trix\n tracksNames?: string[]\n\n constructor(config: AnyConfigurationModel) {\n super(config)\n const ixFilePath = readConfObject(config, 'ixFilePath')\n const ixxFilePath = readConfObject(config, 'ixxFilePath')\n\n if (!ixFilePath) {\n throw new Error('must provide out.ix')\n }\n if (!ixxFilePath) {\n throw new Error('must provide out.ixx')\n }\n this.trixJs = new Trix(\n openLocation(ixxFilePath),\n openLocation(ixFilePath),\n 200,\n )\n }\n\n /*\n * Returns list of results\n * @param args - search options/arguments include: search query\n * limit of results to return, searchType...prefix | full | exact\", etc.\n */\n async searchIndex(args: BaseArgs) {\n const results = await this.trixJs.search(args.queryString)\n const formatted = results.map(entry => {\n const [term, data] = entry.split(',')\n const result = JSON.parse(data.replace(/\\|/g, ',')) as string[]\n const [loc, trackId, ...rest] = result.map(record =>\n decodeURIComponent(record),\n )\n\n const labelFieldIdx = rest.findIndex(elt => !!elt)\n const contextIdx = rest\n .map(elt => elt.toLowerCase())\n .findIndex(f => f.indexOf(term.toLowerCase()) !== -1)\n\n const labelField = rest[labelFieldIdx]\n const contextField = rest[contextIdx]\n const context =\n contextIdx !== -1 && contextIdx !== labelFieldIdx\n ? shorten(contextField, term)\n : undefined\n const label = shorten(labelField, term)\n\n const displayString =\n !context || labelField.toLowerCase() === context.toLowerCase()\n ? label\n : `${labelField} (${context})`\n\n return new LocStringResult({\n locString: loc,\n label: labelField,\n displayString,\n matchedObject: result.map(record => decodeURIComponent(record)),\n trackId,\n })\n })\n\n if (args.searchType === 'exact') {\n return formatted.filter(\n res => res.getLabel().toLowerCase() === args.queryString.toLowerCase(),\n )\n }\n return formatted\n }\n\n freeResources() {}\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\nexport default ConfigurationSchema(\n 'TrixTextSearchAdapter',\n {\n ixFilePath: {\n type: 'fileLocation',\n defaultValue: { uri: 'out.ix' },\n description: 'the location of the trix ix file',\n },\n ixxFilePath: {\n type: 'fileLocation',\n defaultValue: { uri: 'out.ixx' },\n description: 'the location of the trix ixx file',\n },\n metaFilePath: {\n type: 'fileLocation',\n defaultValue: { uri: 'meta.json' },\n description: 'the location of the metadata json file for the trix index',\n },\n tracks: {\n type: 'stringArray',\n defaultValue: [],\n description: 'List of tracks covered by text search adapter',\n },\n assemblyNames: {\n type: 'stringArray',\n defaultValue: [],\n description: 'List of assemblies covered by text search adapter',\n },\n },\n { explicitlyTyped: true, explicitIdentifier: 'textSearchAdapterId' },\n)\n","import TextSearchAdapterType from '@jbrowse/core/pluggableElementTypes/TextSearchAdapterType'\nimport Plugin from '@jbrowse/core/Plugin'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport {\n AdapterClass as TrixTextSearchAdapterClass,\n configSchema as trixAdapterConfigSchema,\n} from './TrixTextSearchAdapter'\n\nexport default class extends Plugin {\n name = 'TrixPlugin'\n\n install(pluginManager: PluginManager) {\n pluginManager.addTextSearchAdapterType(\n () =>\n new TextSearchAdapterType({\n name: 'TrixTextSearchAdapter',\n configSchema: trixAdapterConfigSchema,\n AdapterClass: TrixTextSearchAdapterClass,\n description: 'Trix adapter',\n }),\n )\n }\n}\n"],"names":["runtime","exports","Op","Object","prototype","hasOwn","hasOwnProperty","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","obj","key","value","defineProperty","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","generator","create","Generator","context","Context","_invoke","state","method","arg","Error","undefined","done","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","type","makeInvokeMethod","fn","call","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","this","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","AsyncIterator","PromiseImpl","previousPromise","callInvokeWithMethodAndArg","resolve","reject","invoke","result","__await","then","unwrapped","error","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","length","i","doneResult","constructor","displayName","isGeneratorFunction","genFun","ctor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","iter","toString","keys","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","thrown","delegateYield","module","regeneratorRuntime","accidentalStrictMode","Function","shorten","str","term","w","tidx","indexOf","Math","max","trim","TrixTextSearchAdapter","BaseAdapter","config","ixFilePath","readConfObject","ixxFilePath","trixJs","Trix","openLocation","args","search","queryString","formatted","map","split","JSON","parse","replace","decodeURIComponent","trackId","rest","labelFieldIdx","findIndex","elt","contextIdx","toLowerCase","f","labelField","label","displayString","LocStringResult","locString","matchedObject","searchType","filter","res","getLabel","ConfigurationSchema","defaultValue","uri","description","metaFilePath","tracks","assemblyNames","explicitlyTyped","explicitIdentifier","Plugin","pluginManager","addTextSearchAdapterType","TextSearchAdapterType","configSchema","trixAdapterConfigSchema","AdapterClass","TrixTextSearchAdapterClass"],"mappings":"g6FAOIA,EAAW,SAAUC,OAGnBC,EAAKC,OAAOC,UACZC,EAASH,EAAGI,eAEZC,EAA4B,mBAAXC,OAAwBA,OAAS,GAClDC,EAAiBF,EAAQG,UAAY,aACrCC,EAAsBJ,EAAQK,eAAiB,kBAC/CC,EAAoBN,EAAQO,aAAe,yBAEtCC,EAAOC,EAAKC,EAAKC,UACxBf,OAAOgB,eAAeH,EAAKC,EAAK,CAC9BC,MAAOA,EACPE,YAAY,EACZC,cAAc,EACdC,UAAU,IAELN,EAAIC,OAIXF,EAAO,GAAI,IACX,MAAOQ,GACPR,EAAS,SAASC,EAAKC,EAAKC,UACnBF,EAAIC,GAAOC,YAIbM,EAAKC,EAASC,EAASC,EAAMC,OAGhCC,EAAY1B,OAAO2B,QADFJ,GAAWA,EAAQtB,qBAAqB2B,EAAYL,EAAUK,GACtC3B,WACzC4B,EAAU,IAAIC,EAAQL,GAAe,WAIzCC,EAAUK,iBAsMcT,EAASE,EAAMK,OACnCG,EA/KuB,wBAiLpB,SAAgBC,EAAQC,MA/KT,cAgLhBF,QACI,IAAIG,MAAM,mCAhLE,cAmLhBH,EAA6B,IAChB,UAAXC,QACIC,QAyQL,CAAEnB,WAzfPqB,EAyfyBC,MAAM,OAjQ/BR,EAAQI,OAASA,EACjBJ,EAAQK,IAAMA,IAED,KACPI,EAAWT,EAAQS,YACnBA,EAAU,KACRC,EAAiBC,EAAoBF,EAAUT,MAC/CU,EAAgB,IACdA,IAAmBE,EAAkB,gBAClCF,MAIY,SAAnBV,EAAQI,OAGVJ,EAAQa,KAAOb,EAAQc,MAAQd,EAAQK,SAElC,GAAuB,UAAnBL,EAAQI,OAAoB,IAlNhB,mBAmNjBD,QACFA,EAjNc,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O0F,KAAI,SAAAlH,UAAUuH,mBAAmBvH,MACvDwH,QAAAA,OAIoB,UAApBV,EAAKwB,oDACArB,EAAUsB,QACf,SAAAC,UAAOA,EAAIC,WAAWX,gBAAkBhB,EAAKE,YAAYc,kDAGtDb,4HAGT,uBC7FayB,sBACb,wBACA,CACElC,WAAY,CACVtG,KAAM,eACNyI,aAAc,CAAEC,IAAK,UACrBC,YAAa,oCAEfnC,YAAa,CACXxG,KAAM,eACNyI,aAAc,CAAEC,IAAK,WACrBC,YAAa,qCAEfC,aAAc,CACZ5I,KAAM,eACNyI,aAAc,CAAEC,IAAK,aACrBC,YAAa,6DAEfE,OAAQ,CACN7I,KAAM,cACNyI,aAAc,GACdE,YAAa,iDAEfG,cAAe,CACb9I,KAAM,cACNyI,aAAc,GACdE,YAAa,sDAGjB,CAAEI,iBAAiB,EAAMC,mBAAoB,wDCvBlBC,mFACpB,gDAEP,SAAQC,GACNA,EAAcC,0BACZ,kBACE,IAAIC,EAAsB,CACxB7F,KAAM,wBACN8F,aAAcC,EACdC,aAAcC,EACdb,YAAa"}
1
+ {"version":3,"file":"plugin-trix.cjs.production.min.js","sources":["../../../node_modules/regenerator-runtime/runtime.js","../src/TrixTextSearchAdapter/TrixTextSearchAdapter.ts","../src/TrixTextSearchAdapter/configSchema.ts","../src/index.ts"],"sourcesContent":["/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n define(Gp, \"constructor\", GeneratorFunctionPrototype);\n define(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction);\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","import Trix from '@gmod/trix'\nimport {\n BaseTextSearchAdapter,\n BaseArgs,\n BaseAdapter,\n} from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { openLocation } from '@jbrowse/core/util/io'\nimport BaseResult from '@jbrowse/core/TextSearch/BaseResults'\nimport { readConfObject } from '@jbrowse/core/configuration'\nimport { AnyConfigurationModel } from '@jbrowse/core/configuration/configurationSchema'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache'\n\nfunction decodeURIComponentNoThrow(uri: string) {\n try {\n return decodeURIComponent(uri)\n } catch (e) {\n // avoid throwing exception on a failure to decode URI component\n return uri\n }\n}\n\nfunction shorten(str: string, term: string, w = 15) {\n const tidx = str.toLowerCase().indexOf(term)\n\n return str.length < 40\n ? str\n : (Math.max(0, tidx - w) > 0 ? '...' : '') +\n str.slice(Math.max(0, tidx - w), tidx + term.length + w).trim() +\n (tidx + term.length < str.length ? '...' : '')\n}\n\nexport default class TrixTextSearchAdapter\n extends BaseAdapter\n implements BaseTextSearchAdapter\n{\n indexingAttributes?: string[]\n trixJs: Trix\n tracksNames?: string[]\n\n constructor(\n config: AnyConfigurationModel,\n getSubAdapter?: getSubAdapterType,\n pluginManager?: PluginManager,\n ) {\n super(config, getSubAdapter, pluginManager)\n const ixFilePath = readConfObject(config, 'ixFilePath')\n const ixxFilePath = readConfObject(config, 'ixxFilePath')\n\n if (!ixFilePath) {\n throw new Error('must provide out.ix')\n }\n if (!ixxFilePath) {\n throw new Error('must provide out.ixx')\n }\n this.trixJs = new Trix(\n openLocation(ixxFilePath),\n openLocation(ixFilePath),\n 1500,\n )\n }\n\n /*\n * Returns list of results\n * @param args - search options/arguments include: search query\n * limit of results to return, searchType...prefix | full | exact\", etc.\n */\n async searchIndex(args: BaseArgs) {\n const query = args.queryString.toLowerCase()\n const strs = query.split(' ')\n const results = await this.trixJs.search(query)\n const formatted = results\n // if multi-word search try to filter out relevant items\n .filter(([, data]) =>\n strs.every(r =>\n decodeURIComponentNoThrow(data).toLowerCase().includes(r),\n ),\n )\n .map(([term, data]) => {\n const result = JSON.parse(data.replace(/\\|/g, ',')) as string[]\n const [loc, trackId, ...rest] = result.map(record =>\n decodeURIComponentNoThrow(record),\n )\n\n const labelFieldIdx = rest.findIndex(elt => !!elt)\n const contextIdx = rest\n .map(elt => elt.toLowerCase())\n .findIndex(f => f.indexOf(term.toLowerCase()) !== -1)\n\n const labelField = rest[labelFieldIdx]\n const contextField = rest[contextIdx]\n const context =\n contextIdx !== -1 ? shorten(contextField, term) : undefined\n const label = shorten(labelField, term)\n\n const displayString =\n !context || label.toLowerCase() === context.toLowerCase()\n ? label\n : `${label} (${context})`\n\n return new BaseResult({\n locString: loc,\n label: labelField,\n displayString,\n matchedObject: result.map(record => decodeURIComponent(record)),\n trackId,\n })\n })\n\n if (args.searchType === 'exact') {\n return formatted.filter(\n res => res.getLabel().toLowerCase() === args.queryString.toLowerCase(),\n )\n }\n return formatted\n }\n\n freeResources() {}\n}\n","import { ConfigurationSchema } from '@jbrowse/core/configuration'\n\nexport default ConfigurationSchema(\n 'TrixTextSearchAdapter',\n {\n ixFilePath: {\n type: 'fileLocation',\n defaultValue: { uri: 'out.ix', locationType: 'UriLocation' },\n description: 'the location of the trix ix file',\n },\n ixxFilePath: {\n type: 'fileLocation',\n defaultValue: { uri: 'out.ixx', locationType: 'UriLocation' },\n description: 'the location of the trix ixx file',\n },\n metaFilePath: {\n type: 'fileLocation',\n defaultValue: { uri: 'meta.json', locationType: 'UriLocation' },\n description: 'the location of the metadata json file for the trix index',\n },\n tracks: {\n type: 'stringArray',\n defaultValue: [],\n description: 'List of tracks covered by text search adapter',\n },\n assemblyNames: {\n type: 'stringArray',\n defaultValue: [],\n description: 'List of assemblies covered by text search adapter',\n },\n },\n { explicitlyTyped: true, explicitIdentifier: 'textSearchAdapterId' },\n)\n","import TextSearchAdapterType from '@jbrowse/core/pluggableElementTypes/TextSearchAdapterType'\nimport Plugin from '@jbrowse/core/Plugin'\nimport PluginManager from '@jbrowse/core/PluginManager'\nimport {\n AdapterClass as TrixTextSearchAdapterClass,\n configSchema as trixAdapterConfigSchema,\n} from './TrixTextSearchAdapter'\n\nexport default class extends Plugin {\n name = 'TrixPlugin'\n\n install(pluginManager: PluginManager) {\n pluginManager.addTextSearchAdapterType(\n () =>\n new TextSearchAdapterType({\n name: 'TrixTextSearchAdapter',\n configSchema: trixAdapterConfigSchema,\n AdapterClass: TrixTextSearchAdapterClass,\n description: 'Trix adapter',\n }),\n )\n }\n}\n"],"names":["runtime","exports","Op","Object","prototype","hasOwn","hasOwnProperty","$Symbol","Symbol","iteratorSymbol","iterator","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","toStringTag","define","obj","key","value","defineProperty","enumerable","configurable","writable","err","wrap","innerFn","outerFn","self","tryLocsList","generator","create","Generator","context","Context","_invoke","state","method","arg","Error","undefined","done","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","type","makeInvokeMethod","fn","call","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","this","getProto","getPrototypeOf","NativeIteratorPrototype","values","Gp","defineIteratorMethods","forEach","AsyncIterator","PromiseImpl","previousPromise","callInvokeWithMethodAndArg","resolve","reject","invoke","result","__await","then","unwrapped","error","TypeError","info","resultName","next","nextLoc","pushTryEntry","locs","entry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","iterable","iteratorMethod","isNaN","length","i","doneResult","displayName","isGeneratorFunction","genFun","ctor","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","iter","keys","object","reverse","pop","skipTempReset","prev","charAt","slice","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","thrown","delegateYield","module","regeneratorRuntime","accidentalStrictMode","globalThis","Function","decodeURIComponentNoThrow","uri","decodeURIComponent","e","shorten","str","term","w","tidx","toLowerCase","indexOf","Math","max","trim","TrixTextSearchAdapter","BaseAdapter","config","getSubAdapter","pluginManager","ixFilePath","readConfObject","ixxFilePath","trixJs","Trix","openLocation","args","query","queryString","strs","split","search","formatted","filter","data","every","r","includes","map","JSON","parse","replace","trackId","rest","labelFieldIdx","findIndex","elt","contextIdx","f","labelField","label","displayString","BaseResult","locString","matchedObject","searchType","res","getLabel","ConfigurationSchema","defaultValue","locationType","description","metaFilePath","tracks","assemblyNames","explicitlyTyped","explicitIdentifier","Plugin","addTextSearchAdapterType","TextSearchAdapterType","configSchema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4C,EAAY1C,GAE5B4C,EACH/J,GAAW8J,EAAMxC,gBAAkBtH,EAAQsH,wBAErCwC,eAAU9J,OADb8J,SAGC,IAAIE,EAAW,CACpBC,UAAWlE,EACX+D,MAAOD,EACPE,cAAAA,EACAG,cAAezH,EAAOyG,KAAI,SAAAjI,UAAU8F,mBAAmB9F,MACvDqI,QAAAA,OAIkB,UAApBhB,EAAK6B,oDACAvB,EAAUC,QACf,SAAAuB,UAAOA,EAAIC,WAAW/C,gBAAkBgB,EAAKE,YAAYlB,kDAGtDsB,4HAGT,uBCnHa0B,sBACb,wBACA,CACEtC,WAAY,CACV7G,KAAM,eACNoJ,aAAc,CAAEzD,IAAK,SAAU0D,aAAc,eAC7CC,YAAa,oCAEfvC,YAAa,CACX/G,KAAM,eACNoJ,aAAc,CAAEzD,IAAK,UAAW0D,aAAc,eAC9CC,YAAa,qCAEfC,aAAc,CACZvJ,KAAM,eACNoJ,aAAc,CAAEzD,IAAK,YAAa0D,aAAc,eAChDC,YAAa,6DAEfE,OAAQ,CACNxJ,KAAM,cACNoJ,aAAc,GACdE,YAAa,iDAEfG,cAAe,CACbzJ,KAAM,cACNoJ,aAAc,GACdE,YAAa,sDAGjB,CAAEI,iBAAiB,EAAMC,mBAAoB,wDCvBlBC,mFACpB,gDAEP,SAAQhD,GACNA,EAAciD,0BACZ,kBACE,IAAIC,EAAsB,CACxBvG,KAAM,wBACNwG,aAAcC,EACdC,aAAcC,EACdZ,YAAa"}
@@ -3,7 +3,7 @@ import Plugin from '@jbrowse/core/Plugin';
3
3
  import Trix from '@gmod/trix';
4
4
  import { BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
5
5
  import { openLocation } from '@jbrowse/core/util/io';
6
- import { LocStringResult } from '@jbrowse/core/TextSearch/BaseResults';
6
+ import BaseResult from '@jbrowse/core/TextSearch/BaseResults';
7
7
  import { readConfObject, ConfigurationSchema } from '@jbrowse/core/configuration';
8
8
 
9
9
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
@@ -119,6 +119,8 @@ function _assertThisInitialized(self) {
119
119
  function _possibleConstructorReturn(self, call) {
120
120
  if (call && (typeof call === "object" || typeof call === "function")) {
121
121
  return call;
122
+ } else if (call !== void 0) {
123
+ throw new TypeError("Derived constructors may only return object or undefined");
122
124
  }
123
125
 
124
126
  return _assertThisInitialized(self);
@@ -307,11 +309,9 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
307
309
 
308
310
 
309
311
  var IteratorPrototype = {};
310
-
311
- IteratorPrototype[iteratorSymbol] = function () {
312
+ define(IteratorPrototype, iteratorSymbol, function () {
312
313
  return this;
313
- };
314
-
314
+ });
315
315
  var getProto = Object.getPrototypeOf;
316
316
  var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
317
317
 
@@ -322,8 +322,9 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
322
322
  }
323
323
 
324
324
  var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
325
- GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
326
- GeneratorFunctionPrototype.constructor = GeneratorFunction;
325
+ GeneratorFunction.prototype = GeneratorFunctionPrototype;
326
+ define(Gp, "constructor", GeneratorFunctionPrototype);
327
+ define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
327
328
  GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
328
329
  // Iterator interface in terms of a single ._invoke method.
329
330
 
@@ -428,11 +429,9 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
428
429
  }
429
430
 
430
431
  defineIteratorMethods(AsyncIterator.prototype);
431
-
432
- AsyncIterator.prototype[asyncIteratorSymbol] = function () {
432
+ define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
433
433
  return this;
434
- };
435
-
434
+ });
436
435
  exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
437
436
  // AsyncIterator objects; they just return a Promise for the value of
438
437
  // the final result produced by the iterator.
@@ -609,13 +608,12 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
609
608
  // object to not be returned from this call. This ensures that doesn't happen.
610
609
  // See https://github.com/facebook/regenerator/issues/274 for more details.
611
610
 
612
- Gp[iteratorSymbol] = function () {
611
+ define(Gp, iteratorSymbol, function () {
613
612
  return this;
614
- };
615
-
616
- Gp.toString = function () {
613
+ });
614
+ define(Gp, "toString", function () {
617
615
  return "[object Generator]";
618
- };
616
+ });
619
617
 
620
618
  function pushTryEntry(locs) {
621
619
  var entry = {
@@ -927,20 +925,34 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
927
925
  } catch (accidentalStrictMode) {
928
926
  // This module should not be running in strict mode, so the above
929
927
  // assignment should always work unless something is misconfigured. Just
930
- // in case runtime.js accidentally runs in strict mode, we can escape
928
+ // in case runtime.js accidentally runs in strict mode, in modern engines
929
+ // we can explicitly access globalThis. In older engines we can escape
931
930
  // strict mode using a global Function call. This could conceivably fail
932
931
  // if a Content Security Policy forbids using Function, but in that case
933
932
  // the proper solution is to fix the accidental strict mode problem. If
934
933
  // you've misconfigured your bundler to force strict mode and applied a
935
934
  // CSP to forbid Function, and you're not willing to fix either of those
936
935
  // problems, please detail your unique predicament in a GitHub issue.
937
- Function("r", "regeneratorRuntime = r")(runtime);
936
+ if (typeof globalThis === "object") {
937
+ globalThis.regeneratorRuntime = runtime;
938
+ } else {
939
+ Function("r", "regeneratorRuntime = r")(runtime);
940
+ }
938
941
  }
939
942
  });
940
943
 
944
+ function decodeURIComponentNoThrow(uri) {
945
+ try {
946
+ return decodeURIComponent(uri);
947
+ } catch (e) {
948
+ // avoid throwing exception on a failure to decode URI component
949
+ return uri;
950
+ }
951
+ }
952
+
941
953
  function shorten(str, term) {
942
954
  var w = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 15;
943
- var tidx = str.indexOf(term);
955
+ var tidx = str.toLowerCase().indexOf(term);
944
956
  return str.length < 40 ? str : (Math.max(0, tidx - w) > 0 ? '...' : '') + str.slice(Math.max(0, tidx - w), tidx + term.length + w).trim() + (tidx + term.length < str.length ? '...' : '');
945
957
  }
946
958
 
@@ -949,12 +961,12 @@ var TrixTextSearchAdapter = /*#__PURE__*/function (_BaseAdapter) {
949
961
 
950
962
  var _super = /*#__PURE__*/_createSuper(TrixTextSearchAdapter);
951
963
 
952
- function TrixTextSearchAdapter(config) {
964
+ function TrixTextSearchAdapter(config, getSubAdapter, pluginManager) {
953
965
  var _this;
954
966
 
955
967
  _classCallCheck(this, TrixTextSearchAdapter);
956
968
 
957
- _this = _super.call(this, config);
969
+ _this = _super.call(this, config, getSubAdapter, pluginManager);
958
970
  var ixFilePath = readConfObject(config, 'ixFilePath');
959
971
  var ixxFilePath = readConfObject(config, 'ixxFilePath');
960
972
 
@@ -966,7 +978,7 @@ var TrixTextSearchAdapter = /*#__PURE__*/function (_BaseAdapter) {
966
978
  throw new Error('must provide out.ixx');
967
979
  }
968
980
 
969
- _this.trixJs = new Trix(openLocation(ixxFilePath), openLocation(ixFilePath), 200);
981
+ _this.trixJs = new Trix(openLocation(ixxFilePath), openLocation(ixFilePath), 1500);
970
982
  return _this;
971
983
  }
972
984
  /*
@@ -980,26 +992,35 @@ var TrixTextSearchAdapter = /*#__PURE__*/function (_BaseAdapter) {
980
992
  key: "searchIndex",
981
993
  value: function () {
982
994
  var _searchIndex = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(args) {
983
- var results, formatted;
995
+ var query, strs, results, formatted;
984
996
  return runtime_1.wrap(function _callee$(_context) {
985
997
  while (1) {
986
998
  switch (_context.prev = _context.next) {
987
999
  case 0:
988
- _context.next = 2;
989
- return this.trixJs.search(args.queryString);
1000
+ query = args.queryString.toLowerCase();
1001
+ strs = query.split(' ');
1002
+ _context.next = 4;
1003
+ return this.trixJs.search(query);
990
1004
 
991
- case 2:
1005
+ case 4:
992
1006
  results = _context.sent;
993
- formatted = results.map(function (entry) {
994
- var _entry$split = entry.split(','),
995
- _entry$split2 = _slicedToArray(_entry$split, 2),
996
- term = _entry$split2[0],
997
- data = _entry$split2[1];
1007
+ formatted = results // if multi-word search try to filter out relevant items
1008
+ .filter(function (_ref) {
1009
+ var _ref2 = _slicedToArray(_ref, 2),
1010
+ data = _ref2[1];
1011
+
1012
+ return strs.every(function (r) {
1013
+ return decodeURIComponentNoThrow(data).toLowerCase().includes(r);
1014
+ });
1015
+ }).map(function (_ref3) {
1016
+ var _ref4 = _slicedToArray(_ref3, 2),
1017
+ term = _ref4[0],
1018
+ data = _ref4[1];
998
1019
 
999
1020
  var result = JSON.parse(data.replace(/\|/g, ','));
1000
1021
 
1001
1022
  var _result$map = result.map(function (record) {
1002
- return decodeURIComponent(record);
1023
+ return decodeURIComponentNoThrow(record);
1003
1024
  }),
1004
1025
  _result$map2 = _toArray(_result$map),
1005
1026
  loc = _result$map2[0],
@@ -1016,10 +1037,10 @@ var TrixTextSearchAdapter = /*#__PURE__*/function (_BaseAdapter) {
1016
1037
  });
1017
1038
  var labelField = rest[labelFieldIdx];
1018
1039
  var contextField = rest[contextIdx];
1019
- var context = contextIdx !== -1 && contextIdx !== labelFieldIdx ? shorten(contextField, term) : undefined;
1040
+ var context = contextIdx !== -1 ? shorten(contextField, term) : undefined;
1020
1041
  var label = shorten(labelField, term);
1021
- var displayString = !context || labelField.toLowerCase() === context.toLowerCase() ? label : "".concat(labelField, " (").concat(context, ")");
1022
- return new LocStringResult({
1042
+ var displayString = !context || label.toLowerCase() === context.toLowerCase() ? label : "".concat(label, " (").concat(context, ")");
1043
+ return new BaseResult({
1023
1044
  locString: loc,
1024
1045
  label: labelField,
1025
1046
  displayString: displayString,
@@ -1031,7 +1052,7 @@ var TrixTextSearchAdapter = /*#__PURE__*/function (_BaseAdapter) {
1031
1052
  });
1032
1053
 
1033
1054
  if (!(args.searchType === 'exact')) {
1034
- _context.next = 6;
1055
+ _context.next = 8;
1035
1056
  break;
1036
1057
  }
1037
1058
 
@@ -1039,10 +1060,10 @@ var TrixTextSearchAdapter = /*#__PURE__*/function (_BaseAdapter) {
1039
1060
  return res.getLabel().toLowerCase() === args.queryString.toLowerCase();
1040
1061
  }));
1041
1062
 
1042
- case 6:
1063
+ case 8:
1043
1064
  return _context.abrupt("return", formatted);
1044
1065
 
1045
- case 7:
1066
+ case 9:
1046
1067
  case "end":
1047
1068
  return _context.stop();
1048
1069
  }
@@ -1068,21 +1089,24 @@ var trixAdapterConfigSchema = /*#__PURE__*/ConfigurationSchema('TrixTextSearchAd
1068
1089
  ixFilePath: {
1069
1090
  type: 'fileLocation',
1070
1091
  defaultValue: {
1071
- uri: 'out.ix'
1092
+ uri: 'out.ix',
1093
+ locationType: 'UriLocation'
1072
1094
  },
1073
1095
  description: 'the location of the trix ix file'
1074
1096
  },
1075
1097
  ixxFilePath: {
1076
1098
  type: 'fileLocation',
1077
1099
  defaultValue: {
1078
- uri: 'out.ixx'
1100
+ uri: 'out.ixx',
1101
+ locationType: 'UriLocation'
1079
1102
  },
1080
1103
  description: 'the location of the trix ixx file'
1081
1104
  },
1082
1105
  metaFilePath: {
1083
1106
  type: 'fileLocation',
1084
1107
  defaultValue: {
1085
- uri: 'meta.json'
1108
+ uri: 'meta.json',
1109
+ locationType: 'UriLocation'
1086
1110
  },
1087
1111
  description: 'the location of the metadata json file for the trix index'
1088
1112
  },