@redocly/reference-docs 2.27.1 → 2.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli/commands/redocly-docs-cli.min.js +290 -271
- package/bin/cli/commands/redocly-docs-cli.min.js.LICENSE.txt +1 -1
- package/dist/console.redocly-reference-docs.min.js +125 -99
- package/dist/oauth2-redirect.js +1 -1
- package/dist/redocly-reference-docs.min.js +734 -743
- package/lib/components/Endpoint/Endpoint.d.ts +1 -6
- package/lib/components/Endpoint/Endpoint.js +1 -1
- package/lib/components/Endpoint/ServerList.d.ts +1 -6
- package/lib/components/Endpoint/ServerList.js +1 -1
- package/lib/components/Endpoint/Summary.d.ts +1 -12
- package/lib/components/Endpoint/Summary.js +1 -1
- package/lib/components/Endpoint/index.d.ts +2 -1
- package/lib/components/Endpoint/index.js +1 -1
- package/lib/components/Endpoint/styled.d.ts +13 -0
- package/lib/components/Endpoint/styled.js +2 -0
- package/lib/components/Endpoint/types.d.ts +22 -0
- package/lib/components/Endpoint/types.js +2 -0
- package/lib/components/OperationParameters/OperationParameters.js +1 -1
- package/lib/components/OperationParameters/utils.d.ts +1 -1
- package/lib/components/OperationParameters/utils.js +1 -1
- package/lib/components/console/ActionPanel.js +1 -1
- package/lib/components/console/ParameterArray.d.ts +10 -0
- package/lib/components/console/ParameterArray.js +2 -0
- package/lib/components/shared/index.d.ts +0 -1
- package/lib/components/shared/index.js +1 -1
- package/lib/redoc-lib/src/common-elements/CopyButtonWrapper.d.ts +3 -2
- package/lib/redoc-lib/src/common-elements/CopyButtonWrapper.js +1 -1
- package/lib/redoc-lib/src/components/CallbackSamples/CallbackReqSamples.js +1 -1
- package/lib/redoc-lib/src/components/CallbackSamples/CallbackSamples.js +1 -1
- package/lib/redoc-lib/src/components/GenericChildrenSwitcher/GenericChildrenSwitcher.js +1 -1
- package/lib/redoc-lib/src/components/MediaTypeSwitch/MediaTypesSwitch.js +1 -1
- package/lib/redoc-lib/src/components/PayloadSamples/Example.d.ts +1 -5
- package/lib/redoc-lib/src/components/PayloadSamples/Example.js +1 -1
- package/lib/redoc-lib/src/components/PayloadSamples/ExampleValue.d.ts +1 -8
- package/lib/redoc-lib/src/components/PayloadSamples/MediaTypeSamples.d.ts +2 -7
- package/lib/redoc-lib/src/components/PayloadSamples/MediaTypeSamples.js +1 -1
- package/lib/redoc-lib/src/components/PayloadSamples/PayloadSamples.d.ts +1 -7
- package/lib/redoc-lib/src/components/PayloadSamples/PayloadSamples.js +1 -1
- package/lib/redoc-lib/src/components/PayloadSamples/index.d.ts +5 -0
- package/lib/redoc-lib/src/components/PayloadSamples/index.js +2 -0
- package/lib/redoc-lib/src/components/PayloadSamples/{styled.elements.d.ts → styled.d.ts} +0 -0
- package/lib/redoc-lib/src/components/PayloadSamples/{styled.elements.js → styled.js} +1 -1
- package/lib/redoc-lib/src/components/PayloadSamples/types.d.ts +23 -0
- package/lib/redoc-lib/src/components/PayloadSamples/types.js +2 -0
- package/lib/redoc-lib/src/components/PayloadSamples/{exernalExampleHook.d.ts → useExternalExample.d.ts} +0 -0
- package/lib/redoc-lib/src/components/PayloadSamples/{exernalExampleHook.js → useExternalExample.js} +1 -1
- package/lib/redoc-lib/src/components/RequestSamples/CodeSample.js +1 -1
- package/lib/redoc-lib/src/components/RequestSamples/RequestSamples.js +1 -1
- package/lib/redoc-lib/src/components/ResponseSamples/ResponseSamples.js +1 -1
- package/lib/redoc-lib/src/components/SourceCode/SourceCode.d.ts +1 -1
- package/lib/redoc-lib/src/components/SourceCode/SourceCode.js +1 -1
- package/lib/redoc-lib/src/components/index.d.ts +1 -3
- package/lib/redoc-lib/src/components/index.js +1 -1
- package/lib/redoc-lib/src/services/OpenAPIParser.js +1 -1
- package/lib/redoc-lib/src/services/SearchStore.js +1 -1
- package/lib/redoc-lib/src/services/models/Schema.js +1 -1
- package/lib/redoc-lib/src/utils/helpers.d.ts +3 -1
- package/lib/redoc-lib/src/utils/helpers.js +1 -1
- package/lib/redoc-lib/src/utils/openapi.js +1 -1
- package/lib/services/code-samples/generator.js +1 -1
- package/lib-esm/components/Endpoint/Endpoint.d.ts +1 -6
- package/lib-esm/components/Endpoint/Endpoint.js +1 -1
- package/lib-esm/components/Endpoint/ServerList.d.ts +1 -6
- package/lib-esm/components/Endpoint/ServerList.js +1 -1
- package/lib-esm/components/Endpoint/Summary.d.ts +1 -12
- package/lib-esm/components/Endpoint/Summary.js +1 -1
- package/lib-esm/components/Endpoint/index.d.ts +2 -1
- package/lib-esm/components/Endpoint/index.js +1 -1
- package/lib-esm/components/Endpoint/styled.d.ts +13 -0
- package/lib-esm/components/Endpoint/styled.js +2 -0
- package/lib-esm/components/Endpoint/types.d.ts +22 -0
- package/lib-esm/components/Endpoint/types.js +2 -0
- package/lib-esm/components/OperationParameters/OperationParameters.js +1 -1
- package/lib-esm/components/OperationParameters/utils.d.ts +1 -1
- package/lib-esm/components/OperationParameters/utils.js +1 -1
- package/lib-esm/components/console/ActionPanel.js +1 -1
- package/lib-esm/components/console/ParameterArray.d.ts +10 -0
- package/lib-esm/components/console/ParameterArray.js +2 -0
- package/lib-esm/components/shared/index.d.ts +0 -1
- package/lib-esm/components/shared/index.js +1 -1
- package/lib-esm/redoc-lib/src/common-elements/CopyButtonWrapper.d.ts +3 -2
- package/lib-esm/redoc-lib/src/common-elements/CopyButtonWrapper.js +1 -1
- package/lib-esm/redoc-lib/src/components/CallbackSamples/CallbackReqSamples.js +1 -1
- package/lib-esm/redoc-lib/src/components/CallbackSamples/CallbackSamples.js +1 -1
- package/lib-esm/redoc-lib/src/components/GenericChildrenSwitcher/GenericChildrenSwitcher.js +1 -1
- package/lib-esm/redoc-lib/src/components/MediaTypeSwitch/MediaTypesSwitch.js +1 -1
- package/lib-esm/redoc-lib/src/components/PayloadSamples/Example.d.ts +1 -5
- package/lib-esm/redoc-lib/src/components/PayloadSamples/Example.js +1 -1
- package/lib-esm/redoc-lib/src/components/PayloadSamples/ExampleValue.d.ts +1 -8
- package/lib-esm/redoc-lib/src/components/PayloadSamples/MediaTypeSamples.d.ts +2 -7
- package/lib-esm/redoc-lib/src/components/PayloadSamples/MediaTypeSamples.js +1 -1
- package/lib-esm/redoc-lib/src/components/PayloadSamples/PayloadSamples.d.ts +1 -7
- package/lib-esm/redoc-lib/src/components/PayloadSamples/PayloadSamples.js +1 -1
- package/lib-esm/redoc-lib/src/components/PayloadSamples/index.d.ts +5 -0
- package/lib-esm/redoc-lib/src/components/PayloadSamples/index.js +2 -0
- package/lib-esm/redoc-lib/src/components/PayloadSamples/{styled.elements.d.ts → styled.d.ts} +0 -0
- package/lib-esm/redoc-lib/src/components/PayloadSamples/{styled.elements.js → styled.js} +1 -1
- package/lib-esm/redoc-lib/src/components/PayloadSamples/types.d.ts +23 -0
- package/lib-esm/redoc-lib/src/components/PayloadSamples/types.js +2 -0
- package/lib-esm/redoc-lib/src/components/PayloadSamples/{exernalExampleHook.d.ts → useExternalExample.d.ts} +0 -0
- package/lib-esm/redoc-lib/src/components/PayloadSamples/{exernalExampleHook.js → useExternalExample.js} +1 -1
- package/lib-esm/redoc-lib/src/components/RequestSamples/CodeSample.js +1 -1
- package/lib-esm/redoc-lib/src/components/RequestSamples/RequestSamples.js +1 -1
- package/lib-esm/redoc-lib/src/components/ResponseSamples/ResponseSamples.js +1 -1
- package/lib-esm/redoc-lib/src/components/SourceCode/SourceCode.d.ts +1 -1
- package/lib-esm/redoc-lib/src/components/SourceCode/SourceCode.js +1 -1
- package/lib-esm/redoc-lib/src/components/index.d.ts +1 -3
- package/lib-esm/redoc-lib/src/components/index.js +1 -1
- package/lib-esm/redoc-lib/src/services/OpenAPIParser.js +1 -1
- package/lib-esm/redoc-lib/src/services/SearchStore.js +1 -1
- package/lib-esm/redoc-lib/src/services/models/Schema.js +1 -1
- package/lib-esm/redoc-lib/src/utils/helpers.d.ts +3 -1
- package/lib-esm/redoc-lib/src/utils/helpers.js +1 -1
- package/lib-esm/redoc-lib/src/utils/openapi.js +1 -1
- package/lib-esm/services/code-samples/generator.js +1 -1
- package/package.json +5 -3
- package/lib/components/Endpoint/CopyLink.d.ts +0 -1
- package/lib/components/Endpoint/CopyLink.js +0 -2
- package/lib/components/Endpoint/Path.d.ts +0 -5
- package/lib/components/Endpoint/Path.js +0 -2
- package/lib/components/Endpoint/ServerItem.d.ts +0 -1
- package/lib/components/Endpoint/ServerItem.js +0 -2
- package/lib/components/Endpoint/ServerUrl.d.ts +0 -1
- package/lib/components/Endpoint/ServerUrl.js +0 -2
- package/lib/components/shared/SelectOnClick.d.ts +0 -6
- package/lib/components/shared/SelectOnClick.js +0 -2
- package/lib-esm/components/Endpoint/CopyLink.d.ts +0 -1
- package/lib-esm/components/Endpoint/CopyLink.js +0 -2
- package/lib-esm/components/Endpoint/Path.d.ts +0 -5
- package/lib-esm/components/Endpoint/Path.js +0 -2
- package/lib-esm/components/Endpoint/ServerItem.d.ts +0 -1
- package/lib-esm/components/Endpoint/ServerItem.js +0 -2
- package/lib-esm/components/Endpoint/ServerUrl.d.ts +0 -1
- package/lib-esm/components/Endpoint/ServerUrl.js +0 -2
- package/lib-esm/components/shared/SelectOnClick.d.ts +0 -6
- package/lib-esm/components/shared/SelectOnClick.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign,__rest,__spreadArray}from"tslib";import{IS_BROWSER,getDefinitionName}from"../utils/";import{JsonPointer}from"../utils/JsonPointer";import{RedocNormalizedOptions}from"./RedocNormalizedOptions";export function pushRef(e,r){return r&&e[e.length-1]!==r?__spreadArray(__spreadArray([],e,!0),[r],!1):e}export function concatRefStacks(e,r){return r?e.concat(r):e}var OpenAPIParser=function(){function e(e,r,i){var t=this;void 0===i&&(i=new RedocNormalizedOptions({})),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"definitionUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"allowMergeRefs",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"byRef",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var r;if(t.definition){"#"!==e.charAt(0)&&(e="#"+e),e=decodeURIComponent(e);try{r=JsonPointer.get(t.definition,e)}catch(e){}return r||{}}}}),this.validate(e),this.preprocess(e),this.definition=e,this.allowMergeRefs=e.openapi.startsWith("3.1");var n=IS_BROWSER?window.location.href:"";"string"==typeof r&&(this.definitionUrl=new URL(r,n).href)}return Object.defineProperty(e.prototype,"validate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(void 0===e.openapi)throw new Error("Document must be valid OpenAPI 3.0.0 definition")}}),Object.defineProperty(e.prototype,"preprocess",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e.info&&this.options.hideInfoDescription&&(e.info.description="")}}),Object.defineProperty(e.prototype,"isRef",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!e&&(void 0!==
|
|
1
|
+
import{__assign,__rest,__spreadArray}from"tslib";import{IS_BROWSER,getDefinitionName}from"../utils/";import{JsonPointer}from"../utils/JsonPointer";import{RedocNormalizedOptions}from"./RedocNormalizedOptions";export function pushRef(e,r){return r&&e[e.length-1]!==r?__spreadArray(__spreadArray([],e,!0),[r],!1):e}export function concatRefStacks(e,r){return r?e.concat(r):e}var OpenAPIParser=function(){function e(e,r,i){var t=this;void 0===i&&(i=new RedocNormalizedOptions({})),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"definitionUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"definition",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"allowMergeRefs",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"byRef",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var r;if(t.definition){"#"!==e.charAt(0)&&(e="#"+e),e=decodeURIComponent(e);try{r=JsonPointer.get(t.definition,e)}catch(e){}return r||{}}}}),this.validate(e),this.preprocess(e),this.definition=e,this.allowMergeRefs=e.openapi.startsWith("3.1");var n=IS_BROWSER?window.location.href:"";"string"==typeof r&&(this.definitionUrl=new URL(r,n).href)}return Object.defineProperty(e.prototype,"validate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(void 0===e.openapi)throw new Error("Document must be valid OpenAPI 3.0.0 definition")}}),Object.defineProperty(e.prototype,"preprocess",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e.info&&this.options.hideInfoDescription&&(e.info.description="")}}),Object.defineProperty(e.prototype,"isRef",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return!!e&&(void 0!==e.$ref&&null!==e.$ref)}}),Object.defineProperty(e.prototype,"deref",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,i){void 0===r&&(r=[]),void 0===i&&(i=!1);var t=null==e?void 0:e["x-refsStack"];if(r=concatRefStacks(r,t),this.isRef(e)){var n=getDefinitionName(e.$ref);if(n&&this.options.ignoreNamedSchemas.has(n))return{resolved:{type:"object",title:n},refsStack:r};var o=this.byRef(e.$ref);if(!o)throw new Error('Failed to resolve $ref "'+e.$ref+'"');var a=r;if(r.includes(e.$ref))o=Object.assign({},o,{"x-circular-ref":!0});else if(this.isRef(o)){var s=this.deref(o,r,i);a=s.refsStack,o=s.resolved}return a=pushRef(r,e.$ref),{resolved:o=this.allowMergeRefs?this.mergeRefs(e,o,i):o,refsStack:a}}return{resolved:e,refsStack:concatRefStacks(r,t)}}}),Object.defineProperty(e.prototype,"mergeRefs",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,i){e.$ref;var t=__rest(e,["$ref"]),n=Object.keys(t);return 0===n.length?r:i&&n.some((function(e){return!["description","title","externalDocs","x-refsStack","x-parentRefs"].includes(e)}))?{allOf:[r,t]}:__assign(__assign({},r),t)}}),Object.defineProperty(e.prototype,"mergeAllOf",{enumerable:!1,configurable:!0,writable:!0,value:function(e,r,i){var t,n=this;if(e["x-circular-ref"])return e;if(void 0===(e=this.hoistOneOfs(e)).allOf)return e;var o=__assign(__assign({},e),{"x-parentRefs":[],allOf:void 0,title:e.title||getDefinitionName(r)});void 0!==o.properties&&"object"==typeof o.properties&&(o.properties=__assign({},o.properties)),void 0!==o.items&&"object"==typeof o.items&&(o.items=__assign({},o.items));for(var a=e.allOf.map((function(e){var r,t=n.deref(e,i,!0),a=t.resolved,s=t.refsStack,f=e.$ref||void 0,l=n.mergeAllOf(a,f,s);if(!l["x-circular-ref"]||!l.allOf)return f&&(null===(r=o["x-parentRefs"])||void 0===r||r.push.apply(r,__spreadArray(__spreadArray([],l["x-parentRefs"]||[],!1),[f],!1))),{$ref:f,refsStack:pushRef(s,f),schema:l}})).filter((function(e){return void 0!==e})),s=0,f=a;s<f.length;s++){var l=f[s],p=l.schema,c=l.refsStack,d=p.type,u=p.enum,v=p.properties,y=p.items,m=p.required,b=p.title,O=p.description,_=p.readOnly,h=p.writeOnly,g=p.oneOf,A=p.anyOf,w=p["x-circular-ref"],R=__rest(p,["type","enum","properties","items","required","title","description","readOnly","writeOnly","oneOf","anyOf","x-circular-ref"]);if(o.type!==d&&void 0!==o.type&&void 0!==d&&console.warn('Incompatible types in allOf at "'+r+'": "'+o.type+'" and "'+d+'"'),void 0!==d&&(Array.isArray(d)&&Array.isArray(o.type)?o.type=__spreadArray(__spreadArray([],d,!0),o.type,!0):o.type=d),void 0!==u&&(Array.isArray(u)&&Array.isArray(o.enum)?o.enum=Array.from(new Set(__spreadArray(__spreadArray([],u,!0),o.enum,!0))):o.enum=u),void 0!==v&&"object"==typeof v)for(var j in o.properties=o.properties||{},v){var x=concatRefStacks(c,null===(t=v[j])||void 0===t?void 0:t["x-refsStack"]);if(o.properties[j]){if(!w){var S=this.mergeAllOf({allOf:[o.properties[j],v[j]],"x-refsStack":x},r+"/properties/"+j,x);o.properties[j]=S}}else o.properties[j]=__assign(__assign({},v[j]),{"x-refsStack":x})}if(void 0!==y&&!w){var P="boolean"==typeof o.items?{}:Object.assign({},o.items),k="boolean"==typeof p.items?{}:Object.assign({},p.items);o.items=this.mergeAllOf({allOf:[P,k]},r+"/items",c)}void 0!==g&&(o.oneOf=g),void 0!==A&&(o.anyOf=A),void 0!==m&&(o.required=__spreadArray(__spreadArray([],o.required||[],!0),m,!0)),o=__assign(__assign(__assign({},o),{title:o.title||b,description:o.description||O,readOnly:void 0!==o.readOnly?o.readOnly:_,writeOnly:void 0!==o.writeOnly?o.writeOnly:h,"x-circular-ref":o["x-circular-ref"]||w}),R)}return o}}),Object.defineProperty(e.prototype,"findDerived",{enumerable:!1,configurable:!0,writable:!0,value:function(e){var r={},i=this.definition.components&&this.definition.components.schemas||{};for(var t in i){var n=this.deref(i[t]).resolved;void 0!==n.allOf&&n.allOf.find((function(r){return void 0!==r.$ref&&e.indexOf(r.$ref)>-1}))&&(r["#/components/schemas/"+t]=[n["x-discriminator-value"]||t])}return r}}),Object.defineProperty(e.prototype,"hoistOneOfs",{enumerable:!1,configurable:!0,writable:!0,value:function(e){if(void 0===e.allOf)return e;for(var r=e.allOf,i=function(e){var i=r[e];if(Array.isArray(i.oneOf)){var t=r.slice(0,e),n=r.slice(e+1);return{value:{oneOf:i.oneOf.map((function(e){return{allOf:__spreadArray(__spreadArray(__spreadArray([],t,!0),[e],!1),n,!0)}}))}}}},t=0;t<r.length;t++){var n=i(t);if("object"==typeof n)return n.value}return e}}),e}();export{OpenAPIParser};
|
|
2
2
|
//# sourceMappingURL=OpenAPIParser.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see SearchStore.js.LICENSE.txt */
|
|
2
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SearchStore=t():e.SearchStore=t()}(this,(function(){return(()=>{var e={27:(e,t,r)=>{"use strict";r.d(t,{ZP:()=>a});var i=r(336),n=Object.defineProperty,s=(e,t,r)=>(((e,t,r)=>{t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),o=(e,t,r)=>new Promise(((i,n)=>{var s=e=>{try{a(r.next(e))}catch(e){n(e)}},o=e=>{try{a(r.throw(e))}catch(e){n(e)}},a=e=>e.done?i(e.value):Promise.resolve(e.value).then(s,o);a((r=r.apply(e,t)).next())}));class a{constructor(){s(this,"add",f),s(this,"done",p),s(this,"search",R),s(this,"toJS",y),s(this,"load",g),s(this,"dispose",x),s(this,"fromExternalJS",m)}}let u,l,c,h=[];function d(){u=new i.Builder,u.field("title"),u.field("description"),u.ref("ref"),u.pipeline.add(i.trimmer,i.stopWordFilter,i.stemmer),c=new Promise((e=>{l=e}))}function f(e,t,r){const i=h.push(r)-1,n={title:e.toLowerCase(),description:t.toLowerCase(),ref:i};u.add(n)}function p(){return o(this,null,(function*(){l(u.build())}))}function y(){return o(this,null,(function*(){return{store:h,index:(yield c).toJSON()}}))}function m(e,t){return o(this,null,(function*(){try{if(importScripts(e),!self[t])throw new Error("Broken index file format");yield g(self[t])}catch(e){console.error("Failed to load search index: "+e.message)}}))}function g(e){return o(this,null,(function*(){h=e.store,l(i.Index.load(e.index))}))}function x(){return o(this,null,(function*(){h=[],d()}))}function R(e,t=0){return o(this,null,(function*(){if(0===e.trim().length)return[];let r=(yield c).query((t=>{e.trim().toLowerCase().split(/\s+/).forEach((e=>{if(1===e.length)return;const r=(e=>"*"+i.stemmer(new i.Token(e,{}))+"*")(e);t.term(r,{})}))}));return t>0&&(r=r.slice(0,t)),r.map((e=>({meta:h[e.ref],score:e.score})))}))}i.tokenizer.separator=/\s+/,d()},336:(e,t,r)=>{var i,n;!function(){var s,o,a,u,l,c,h,d,f,p,y,m,g,x,R,v,w,Q,k,S,E,b,L,P,T,O,I=function(e){var t=new I.Builder;return t.pipeline.add(I.trimmer,I.stopWordFilter,I.stemmer),t.searchPipeline.add(I.stemmer),e.call(t,t),t.build()};I.version="2.3.9",I.utils={},I.utils.warn=(s=this,function(e){s.console&&console.warn&&console.warn(e)}),I.utils.asString=function(e){return null==e?"":e.toString()},I.utils.clone=function(e){if(null==e)return e;for(var t=Object.create(null),r=Object.keys(e),i=0;i<r.length;i++){var n=r[i],s=e[n];if(Array.isArray(s))t[n]=s.slice();else{if("string"!=typeof s&&"number"!=typeof s&&"boolean"!=typeof s)throw new TypeError("clone is not deep and does not support nested objects");t[n]=s}}return t},I.FieldRef=function(e,t,r){this.docRef=e,this.fieldName=t,this._stringValue=r},I.FieldRef.joiner="/",I.FieldRef.fromString=function(e){var t=e.indexOf(I.FieldRef.joiner);if(-1===t)throw"malformed field ref string";var r=e.slice(0,t),i=e.slice(t+1);return new I.FieldRef(i,r,e)},I.FieldRef.prototype.toString=function(){return null==this._stringValue&&(this._stringValue=this.fieldName+I.FieldRef.joiner+this.docRef),this._stringValue},I.Set=function(e){if(this.elements=Object.create(null),e){this.length=e.length;for(var t=0;t<this.length;t++)this.elements[e[t]]=!0}else this.length=0},I.Set.complete={intersect:function(e){return e},union:function(){return this},contains:function(){return!0}},I.Set.empty={intersect:function(){return this},union:function(e){return e},contains:function(){return!1}},I.Set.prototype.contains=function(e){return!!this.elements[e]},I.Set.prototype.intersect=function(e){var t,r,i,n=[];if(e===I.Set.complete)return this;if(e===I.Set.empty)return e;this.length<e.length?(t=this,r=e):(t=e,r=this),i=Object.keys(t.elements);for(var s=0;s<i.length;s++){var o=i[s];o in r.elements&&n.push(o)}return new I.Set(n)},I.Set.prototype.union=function(e){return e===I.Set.complete?I.Set.complete:e===I.Set.empty?this:new I.Set(Object.keys(this.elements).concat(Object.keys(e.elements)))},I.idf=function(e,t){var r=0;for(var i in e)"_index"!=i&&(r+=Object.keys(e[i]).length);var n=(t-r+.5)/(r+.5);return Math.log(1+Math.abs(n))},I.Token=function(e,t){this.str=e||"",this.metadata=t||{}},I.Token.prototype.toString=function(){return this.str},I.Token.prototype.update=function(e){return this.str=e(this.str,this.metadata),this},I.Token.prototype.clone=function(e){return e=e||function(e){return e},new I.Token(e(this.str,this.metadata),this.metadata)},I.tokenizer=function(e,t){if(null==e||null==e)return[];if(Array.isArray(e))return e.map((function(e){return new I.Token(I.utils.asString(e).toLowerCase(),I.utils.clone(t))}));for(var r=e.toString().toLowerCase(),i=r.length,n=[],s=0,o=0;s<=i;s++){var a=s-o;if(r.charAt(s).match(I.tokenizer.separator)||s==i){if(a>0){var u=I.utils.clone(t)||{};u.position=[o,a],u.index=n.length,n.push(new I.Token(r.slice(o,s),u))}o=s+1}}return n},I.tokenizer.separator=/[\s\-]+/,I.Pipeline=function(){this._stack=[]},I.Pipeline.registeredFunctions=Object.create(null),I.Pipeline.registerFunction=function(e,t){t in this.registeredFunctions&&I.utils.warn("Overwriting existing registered function: "+t),e.label=t,I.Pipeline.registeredFunctions[e.label]=e},I.Pipeline.warnIfFunctionNotRegistered=function(e){e.label&&e.label in this.registeredFunctions||I.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},I.Pipeline.load=function(e){var t=new I.Pipeline;return e.forEach((function(e){var r=I.Pipeline.registeredFunctions[e];if(!r)throw new Error("Cannot load unregistered function: "+e);t.add(r)})),t},I.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach((function(e){I.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)}),this)},I.Pipeline.prototype.after=function(e,t){I.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");r+=1,this._stack.splice(r,0,t)},I.Pipeline.prototype.before=function(e,t){I.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");this._stack.splice(r,0,t)},I.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);-1!=t&&this._stack.splice(t,1)},I.Pipeline.prototype.run=function(e){for(var t=this._stack.length,r=0;r<t;r++){for(var i=this._stack[r],n=[],s=0;s<e.length;s++){var o=i(e[s],s,e);if(null!=o&&""!==o)if(Array.isArray(o))for(var a=0;a<o.length;a++)n.push(o[a]);else n.push(o)}e=n}return e},I.Pipeline.prototype.runString=function(e,t){var r=new I.Token(e,t);return this.run([r]).map((function(e){return e.toString()}))},I.Pipeline.prototype.reset=function(){this._stack=[]},I.Pipeline.prototype.toJSON=function(){return this._stack.map((function(e){return I.Pipeline.warnIfFunctionNotRegistered(e),e.label}))},I.Vector=function(e){this._magnitude=0,this.elements=e||[]},I.Vector.prototype.positionForIndex=function(e){if(0==this.elements.length)return 0;for(var t=0,r=this.elements.length/2,i=r-t,n=Math.floor(i/2),s=this.elements[2*n];i>1&&(s<e&&(t=n),s>e&&(r=n),s!=e);)i=r-t,n=t+Math.floor(i/2),s=this.elements[2*n];return s==e||s>e?2*n:s<e?2*(n+1):void 0},I.Vector.prototype.insert=function(e,t){this.upsert(e,t,(function(){throw"duplicate index"}))},I.Vector.prototype.upsert=function(e,t,r){this._magnitude=0;var i=this.positionForIndex(e);this.elements[i]==e?this.elements[i+1]=r(this.elements[i+1],t):this.elements.splice(i,0,e,t)},I.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var e=0,t=this.elements.length,r=1;r<t;r+=2){var i=this.elements[r];e+=i*i}return this._magnitude=Math.sqrt(e)},I.Vector.prototype.dot=function(e){for(var t=0,r=this.elements,i=e.elements,n=r.length,s=i.length,o=0,a=0,u=0,l=0;u<n&&l<s;)(o=r[u])<(a=i[l])?u+=2:o>a?l+=2:o==a&&(t+=r[u+1]*i[l+1],u+=2,l+=2);return t},I.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},I.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),t=1,r=0;t<this.elements.length;t+=2,r++)e[r]=this.elements[t];return e},I.Vector.prototype.toJSON=function(){return this.elements},I.stemmer=(o={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"},a={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},u="[aeiouy]",l="[^aeiou][^aeiouy]*",c=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),h=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),d=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$"),f=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy]"),p=/^(.+?)(ss|i)es$/,y=/^(.+?)([^s])s$/,m=/^(.+?)eed$/,g=/^(.+?)(ed|ing)$/,x=/.$/,R=/(at|bl|iz)$/,v=new RegExp("([^aeiouylsz])\\1$"),w=new RegExp("^"+l+u+"[^aeiouwxy]$"),Q=/^(.+?[^aeiou])y$/,k=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,S=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,E=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,b=/^(.+?)(s|t)(ion)$/,L=/^(.+?)e$/,P=/ll$/,T=new RegExp("^"+l+u+"[^aeiouwxy]$"),O=function(e){var t,r,i,n,s,u,l;if(e.length<3)return e;if("y"==(i=e.substr(0,1))&&(e=i.toUpperCase()+e.substr(1)),s=y,(n=p).test(e)?e=e.replace(n,"$1$2"):s.test(e)&&(e=e.replace(s,"$1$2")),s=g,(n=m).test(e)){var O=n.exec(e);(n=c).test(O[1])&&(n=x,e=e.replace(n,""))}else s.test(e)&&(t=(O=s.exec(e))[1],(s=f).test(t)&&(u=v,l=w,(s=R).test(e=t)?e+="e":u.test(e)?(n=x,e=e.replace(n,"")):l.test(e)&&(e+="e")));return(n=Q).test(e)&&(e=(t=(O=n.exec(e))[1])+"i"),(n=k).test(e)&&(t=(O=n.exec(e))[1],r=O[2],(n=c).test(t)&&(e=t+o[r])),(n=S).test(e)&&(t=(O=n.exec(e))[1],r=O[2],(n=c).test(t)&&(e=t+a[r])),s=b,(n=E).test(e)?(t=(O=n.exec(e))[1],(n=h).test(t)&&(e=t)):s.test(e)&&(t=(O=s.exec(e))[1]+O[2],(s=h).test(t)&&(e=t)),(n=L).test(e)&&(t=(O=n.exec(e))[1],s=d,u=T,((n=h).test(t)||s.test(t)&&!u.test(t))&&(e=t)),s=h,(n=P).test(e)&&s.test(e)&&(n=x,e=e.replace(n,"")),"y"==i&&(e=i.toLowerCase()+e.substr(1)),e},function(e){return e.update(O)}),I.Pipeline.registerFunction(I.stemmer,"stemmer"),I.generateStopWordFilter=function(e){var t=e.reduce((function(e,t){return e[t]=t,e}),{});return function(e){if(e&&t[e.toString()]!==e.toString())return e}},I.stopWordFilter=I.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"]),I.Pipeline.registerFunction(I.stopWordFilter,"stopWordFilter"),I.trimmer=function(e){return e.update((function(e){return e.replace(/^\W+/,"").replace(/\W+$/,"")}))},I.Pipeline.registerFunction(I.trimmer,"trimmer"),I.TokenSet=function(){this.final=!1,this.edges={},this.id=I.TokenSet._nextId,I.TokenSet._nextId+=1},I.TokenSet._nextId=1,I.TokenSet.fromArray=function(e){for(var t=new I.TokenSet.Builder,r=0,i=e.length;r<i;r++)t.insert(e[r]);return t.finish(),t.root},I.TokenSet.fromClause=function(e){return"editDistance"in e?I.TokenSet.fromFuzzyString(e.term,e.editDistance):I.TokenSet.fromString(e.term)},I.TokenSet.fromFuzzyString=function(e,t){for(var r=new I.TokenSet,i=[{node:r,editsRemaining:t,str:e}];i.length;){var n=i.pop();if(n.str.length>0){var s,o=n.str.charAt(0);o in n.node.edges?s=n.node.edges[o]:(s=new I.TokenSet,n.node.edges[o]=s),1==n.str.length&&(s.final=!0),i.push({node:s,editsRemaining:n.editsRemaining,str:n.str.slice(1)})}if(0!=n.editsRemaining){if("*"in n.node.edges)var a=n.node.edges["*"];else a=new I.TokenSet,n.node.edges["*"]=a;if(0==n.str.length&&(a.final=!0),i.push({node:a,editsRemaining:n.editsRemaining-1,str:n.str}),n.str.length>1&&i.push({node:n.node,editsRemaining:n.editsRemaining-1,str:n.str.slice(1)}),1==n.str.length&&(n.node.final=!0),n.str.length>=1){if("*"in n.node.edges)var u=n.node.edges["*"];else u=new I.TokenSet,n.node.edges["*"]=u;1==n.str.length&&(u.final=!0),i.push({node:u,editsRemaining:n.editsRemaining-1,str:n.str.slice(1)})}if(n.str.length>1){var l,c=n.str.charAt(0),h=n.str.charAt(1);h in n.node.edges?l=n.node.edges[h]:(l=new I.TokenSet,n.node.edges[h]=l),1==n.str.length&&(l.final=!0),i.push({node:l,editsRemaining:n.editsRemaining-1,str:c+n.str.slice(2)})}}}return r},I.TokenSet.fromString=function(e){for(var t=new I.TokenSet,r=t,i=0,n=e.length;i<n;i++){var s=e[i],o=i==n-1;if("*"==s)t.edges[s]=t,t.final=o;else{var a=new I.TokenSet;a.final=o,t.edges[s]=a,t=a}}return r},I.TokenSet.prototype.toArray=function(){for(var e=[],t=[{prefix:"",node:this}];t.length;){var r=t.pop(),i=Object.keys(r.node.edges),n=i.length;r.node.final&&(r.prefix.charAt(0),e.push(r.prefix));for(var s=0;s<n;s++){var o=i[s];t.push({prefix:r.prefix.concat(o),node:r.node.edges[o]})}}return e},I.TokenSet.prototype.toString=function(){if(this._str)return this._str;for(var e=this.final?"1":"0",t=Object.keys(this.edges).sort(),r=t.length,i=0;i<r;i++){var n=t[i];e=e+n+this.edges[n].id}return e},I.TokenSet.prototype.intersect=function(e){for(var t=new I.TokenSet,r=void 0,i=[{qNode:e,output:t,node:this}];i.length;){r=i.pop();for(var n=Object.keys(r.qNode.edges),s=n.length,o=Object.keys(r.node.edges),a=o.length,u=0;u<s;u++)for(var l=n[u],c=0;c<a;c++){var h=o[c];if(h==l||"*"==l){var d=r.node.edges[h],f=r.qNode.edges[l],p=d.final&&f.final,y=void 0;h in r.output.edges?(y=r.output.edges[h]).final=y.final||p:((y=new I.TokenSet).final=p,r.output.edges[h]=y),i.push({qNode:f,output:y,node:d})}}}return t},I.TokenSet.Builder=function(){this.previousWord="",this.root=new I.TokenSet,this.uncheckedNodes=[],this.minimizedNodes={}},I.TokenSet.Builder.prototype.insert=function(e){var t,r=0;if(e<this.previousWord)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++)r++;for(this.minimize(r),t=0==this.uncheckedNodes.length?this.root:this.uncheckedNodes[this.uncheckedNodes.length-1].child,i=r;i<e.length;i++){var n=new I.TokenSet,s=e[i];t.edges[s]=n,this.uncheckedNodes.push({parent:t,char:s,child:n}),t=n}t.final=!0,this.previousWord=e},I.TokenSet.Builder.prototype.finish=function(){this.minimize(0)},I.TokenSet.Builder.prototype.minimize=function(e){for(var t=this.uncheckedNodes.length-1;t>=e;t--){var r=this.uncheckedNodes[t],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}},I.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},I.Index.prototype.search=function(e){return this.query((function(t){new I.QueryParser(e,t).parse()}))},I.Index.prototype.query=function(e){for(var t=new I.Query(this.fields),r=Object.create(null),i=Object.create(null),n=Object.create(null),s=Object.create(null),o=Object.create(null),a=0;a<this.fields.length;a++)i[this.fields[a]]=new I.Vector;for(e.call(t,t),a=0;a<t.clauses.length;a++){var u,l=t.clauses[a],c=I.Set.empty;u=l.usePipeline?this.pipeline.runString(l.term,{fields:l.fields}):[l.term];for(var h=0;h<u.length;h++){var d=u[h];l.term=d;var f=I.TokenSet.fromClause(l),p=this.tokenSet.intersect(f).toArray();if(0===p.length&&l.presence===I.Query.presence.REQUIRED){for(var y=0;y<l.fields.length;y++)s[F=l.fields[y]]=I.Set.empty;break}for(var m=0;m<p.length;m++){var g=p[m],x=this.invertedIndex[g],R=x._index;for(y=0;y<l.fields.length;y++){var v=x[F=l.fields[y]],w=Object.keys(v),Q=g+"/"+F,k=new I.Set(w);if(l.presence==I.Query.presence.REQUIRED&&(c=c.union(k),void 0===s[F]&&(s[F]=I.Set.complete)),l.presence!=I.Query.presence.PROHIBITED){if(i[F].upsert(R,l.boost,(function(e,t){return e+t})),!n[Q]){for(var S=0;S<w.length;S++){var E,b=w[S],L=new I.FieldRef(b,F),P=v[b];void 0===(E=r[L])?r[L]=new I.MatchData(g,F,P):E.add(g,F,P)}n[Q]=!0}}else void 0===o[F]&&(o[F]=I.Set.empty),o[F]=o[F].union(k)}}}if(l.presence===I.Query.presence.REQUIRED)for(y=0;y<l.fields.length;y++)s[F=l.fields[y]]=s[F].intersect(c)}var T=I.Set.complete,O=I.Set.empty;for(a=0;a<this.fields.length;a++){var F;s[F=this.fields[a]]&&(T=T.intersect(s[F])),o[F]&&(O=O.union(o[F]))}var C=Object.keys(r),j=[],N=Object.create(null);if(t.isNegated())for(C=Object.keys(this.fieldVectors),a=0;a<C.length;a++){L=C[a];var _=I.FieldRef.fromString(L);r[L]=new I.MatchData}for(a=0;a<C.length;a++){var D=(_=I.FieldRef.fromString(C[a])).docRef;if(T.contains(D)&&!O.contains(D)){var A,B=this.fieldVectors[_],V=i[_.fieldName].similarity(B);if(void 0!==(A=N[D]))A.score+=V,A.matchData.combine(r[_]);else{var z={ref:D,score:V,matchData:r[_]};N[D]=z,j.push(z)}}}return j.sort((function(e,t){return t.score-e.score}))},I.Index.prototype.toJSON=function(){var e=Object.keys(this.invertedIndex).sort().map((function(e){return[e,this.invertedIndex[e]]}),this),t=Object.keys(this.fieldVectors).map((function(e){return[e,this.fieldVectors[e].toJSON()]}),this);return{version:I.version,fields:this.fields,fieldVectors:t,invertedIndex:e,pipeline:this.pipeline.toJSON()}},I.Index.load=function(e){var t={},r={},i=e.fieldVectors,n=Object.create(null),s=e.invertedIndex,o=new I.TokenSet.Builder,a=I.Pipeline.load(e.pipeline);e.version!=I.version&&I.utils.warn("Version mismatch when loading serialised index. Current version of lunr '"+I.version+"' does not match serialized index '"+e.version+"'");for(var u=0;u<i.length;u++){var l=(h=i[u])[0],c=h[1];r[l]=new I.Vector(c)}for(u=0;u<s.length;u++){var h,d=(h=s[u])[0],f=h[1];o.insert(d),n[d]=f}return o.finish(),t.fields=e.fields,t.fieldVectors=r,t.invertedIndex=n,t.tokenSet=o.root,t.pipeline=a,new I.Index(t)},I.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=I.tokenizer,this.pipeline=new I.Pipeline,this.searchPipeline=new I.Pipeline,this.documentCount=0,this._b=.75,this._k1=1.2,this.termIndex=0,this.metadataWhitelist=[]},I.Builder.prototype.ref=function(e){this._ref=e},I.Builder.prototype.field=function(e,t){if(/\//.test(e))throw new RangeError("Field '"+e+"' contains illegal character '/'");this._fields[e]=t||{}},I.Builder.prototype.b=function(e){this._b=e<0?0:e>1?1:e},I.Builder.prototype.k1=function(e){this._k1=e},I.Builder.prototype.add=function(e,t){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=t||{},this.documentCount+=1;for(var n=0;n<i.length;n++){var s=i[n],o=this._fields[s].extractor,a=o?o(e):e[s],u=this.tokenizer(a,{fields:[s]}),l=this.pipeline.run(u),c=new I.FieldRef(r,s),h=Object.create(null);this.fieldTermFrequencies[c]=h,this.fieldLengths[c]=0,this.fieldLengths[c]+=l.length;for(var d=0;d<l.length;d++){var f=l[d];if(null==h[f]&&(h[f]=0),h[f]+=1,null==this.invertedIndex[f]){var p=Object.create(null);p._index=this.termIndex,this.termIndex+=1;for(var y=0;y<i.length;y++)p[i[y]]=Object.create(null);this.invertedIndex[f]=p}null==this.invertedIndex[f][s][r]&&(this.invertedIndex[f][s][r]=Object.create(null));for(var m=0;m<this.metadataWhitelist.length;m++){var g=this.metadataWhitelist[m],x=f.metadata[g];null==this.invertedIndex[f][s][r][g]&&(this.invertedIndex[f][s][r][g]=[]),this.invertedIndex[f][s][r][g].push(x)}}}},I.Builder.prototype.calculateAverageFieldLengths=function(){for(var e=Object.keys(this.fieldLengths),t=e.length,r={},i={},n=0;n<t;n++){var s=I.FieldRef.fromString(e[n]),o=s.fieldName;i[o]||(i[o]=0),i[o]+=1,r[o]||(r[o]=0),r[o]+=this.fieldLengths[s]}var a=Object.keys(this._fields);for(n=0;n<a.length;n++){var u=a[n];r[u]=r[u]/i[u]}this.averageFieldLength=r},I.Builder.prototype.createFieldVectors=function(){for(var e={},t=Object.keys(this.fieldTermFrequencies),r=t.length,i=Object.create(null),n=0;n<r;n++){for(var s=I.FieldRef.fromString(t[n]),o=s.fieldName,a=this.fieldLengths[s],u=new I.Vector,l=this.fieldTermFrequencies[s],c=Object.keys(l),h=c.length,d=this._fields[o].boost||1,f=this._documents[s.docRef].boost||1,p=0;p<h;p++){var y,m,g,x=c[p],R=l[x],v=this.invertedIndex[x]._index;void 0===i[x]?(y=I.idf(this.invertedIndex[x],this.documentCount),i[x]=y):y=i[x],m=y*((this._k1+1)*R)/(this._k1*(1-this._b+this._b*(a/this.averageFieldLength[o]))+R),m*=d,m*=f,g=Math.round(1e3*m)/1e3,u.insert(v,g)}e[s]=u}this.fieldVectors=e},I.Builder.prototype.createTokenSet=function(){this.tokenSet=I.TokenSet.fromArray(Object.keys(this.invertedIndex).sort())},I.Builder.prototype.build=function(){return this.calculateAverageFieldLengths(),this.createFieldVectors(),this.createTokenSet(),new I.Index({invertedIndex:this.invertedIndex,fieldVectors:this.fieldVectors,tokenSet:this.tokenSet,fields:Object.keys(this._fields),pipeline:this.searchPipeline})},I.Builder.prototype.use=function(e){var t=Array.prototype.slice.call(arguments,1);t.unshift(this),e.apply(this,t)},I.MatchData=function(e,t,r){for(var i=Object.create(null),n=Object.keys(r||{}),s=0;s<n.length;s++){var o=n[s];i[o]=r[o].slice()}this.metadata=Object.create(null),void 0!==e&&(this.metadata[e]=Object.create(null),this.metadata[e][t]=i)},I.MatchData.prototype.combine=function(e){for(var t=Object.keys(e.metadata),r=0;r<t.length;r++){var i=t[r],n=Object.keys(e.metadata[i]);null==this.metadata[i]&&(this.metadata[i]=Object.create(null));for(var s=0;s<n.length;s++){var o=n[s],a=Object.keys(e.metadata[i][o]);null==this.metadata[i][o]&&(this.metadata[i][o]=Object.create(null));for(var u=0;u<a.length;u++){var l=a[u];null==this.metadata[i][o][l]?this.metadata[i][o][l]=e.metadata[i][o][l]:this.metadata[i][o][l]=this.metadata[i][o][l].concat(e.metadata[i][o][l])}}}},I.MatchData.prototype.add=function(e,t,r){if(!(e in this.metadata))return this.metadata[e]=Object.create(null),void(this.metadata[e][t]=r);if(t in this.metadata[e])for(var i=Object.keys(r),n=0;n<i.length;n++){var s=i[n];s in this.metadata[e][t]?this.metadata[e][t][s]=this.metadata[e][t][s].concat(r[s]):this.metadata[e][t][s]=r[s]}else this.metadata[e][t]=r},I.Query=function(e){this.clauses=[],this.allFields=e},I.Query.wildcard=new String("*"),I.Query.wildcard.NONE=0,I.Query.wildcard.LEADING=1,I.Query.wildcard.TRAILING=2,I.Query.presence={OPTIONAL:1,REQUIRED:2,PROHIBITED:3},I.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=I.Query.wildcard.NONE),e.wildcard&I.Query.wildcard.LEADING&&e.term.charAt(0)!=I.Query.wildcard&&(e.term="*"+e.term),e.wildcard&I.Query.wildcard.TRAILING&&e.term.slice(-1)!=I.Query.wildcard&&(e.term=e.term+"*"),"presence"in e||(e.presence=I.Query.presence.OPTIONAL),this.clauses.push(e),this},I.Query.prototype.isNegated=function(){for(var e=0;e<this.clauses.length;e++)if(this.clauses[e].presence!=I.Query.presence.PROHIBITED)return!1;return!0},I.Query.prototype.term=function(e,t){if(Array.isArray(e))return e.forEach((function(e){this.term(e,I.utils.clone(t))}),this),this;var r=t||{};return r.term=e.toString(),this.clause(r),this},I.QueryParseError=function(e,t,r){this.name="QueryParseError",this.message=e,this.start=t,this.end=r},I.QueryParseError.prototype=new Error,I.QueryLexer=function(e){this.lexemes=[],this.str=e,this.length=e.length,this.pos=0,this.start=0,this.escapeCharPositions=[]},I.QueryLexer.prototype.run=function(){for(var e=I.QueryLexer.lexText;e;)e=e(this)},I.QueryLexer.prototype.sliceString=function(){for(var e=[],t=this.start,r=this.pos,i=0;i<this.escapeCharPositions.length;i++)r=this.escapeCharPositions[i],e.push(this.str.slice(t,r)),t=r+1;return e.push(this.str.slice(t,this.pos)),this.escapeCharPositions.length=0,e.join("")},I.QueryLexer.prototype.emit=function(e){this.lexemes.push({type:e,str:this.sliceString(),start:this.start,end:this.pos}),this.start=this.pos},I.QueryLexer.prototype.escapeCharacter=function(){this.escapeCharPositions.push(this.pos-1),this.pos+=1},I.QueryLexer.prototype.next=function(){if(this.pos>=this.length)return I.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},I.QueryLexer.prototype.width=function(){return this.pos-this.start},I.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},I.QueryLexer.prototype.backup=function(){this.pos-=1},I.QueryLexer.prototype.acceptDigitRun=function(){var e,t;do{t=(e=this.next()).charCodeAt(0)}while(t>47&&t<58);e!=I.QueryLexer.EOS&&this.backup()},I.QueryLexer.prototype.more=function(){return this.pos<this.length},I.QueryLexer.EOS="EOS",I.QueryLexer.FIELD="FIELD",I.QueryLexer.TERM="TERM",I.QueryLexer.EDIT_DISTANCE="EDIT_DISTANCE",I.QueryLexer.BOOST="BOOST",I.QueryLexer.PRESENCE="PRESENCE",I.QueryLexer.lexField=function(e){return e.backup(),e.emit(I.QueryLexer.FIELD),e.ignore(),I.QueryLexer.lexText},I.QueryLexer.lexTerm=function(e){if(e.width()>1&&(e.backup(),e.emit(I.QueryLexer.TERM)),e.ignore(),e.more())return I.QueryLexer.lexText},I.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(I.QueryLexer.EDIT_DISTANCE),I.QueryLexer.lexText},I.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(I.QueryLexer.BOOST),I.QueryLexer.lexText},I.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(I.QueryLexer.TERM)},I.QueryLexer.termSeparator=I.tokenizer.separator,I.QueryLexer.lexText=function(e){for(;;){var t=e.next();if(t==I.QueryLexer.EOS)return I.QueryLexer.lexEOS;if(92!=t.charCodeAt(0)){if(":"==t)return I.QueryLexer.lexField;if("~"==t)return e.backup(),e.width()>0&&e.emit(I.QueryLexer.TERM),I.QueryLexer.lexEditDistance;if("^"==t)return e.backup(),e.width()>0&&e.emit(I.QueryLexer.TERM),I.QueryLexer.lexBoost;if("+"==t&&1===e.width())return e.emit(I.QueryLexer.PRESENCE),I.QueryLexer.lexText;if("-"==t&&1===e.width())return e.emit(I.QueryLexer.PRESENCE),I.QueryLexer.lexText;if(t.match(I.QueryLexer.termSeparator))return I.QueryLexer.lexTerm}else e.escapeCharacter()}},I.QueryParser=function(e,t){this.lexer=new I.QueryLexer(e),this.query=t,this.currentClause={},this.lexemeIdx=0},I.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=I.QueryParser.parseClause;e;)e=e(this);return this.query},I.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},I.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},I.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},I.QueryParser.parseClause=function(e){var t=e.peekLexeme();if(null!=t)switch(t.type){case I.QueryLexer.PRESENCE:return I.QueryParser.parsePresence;case I.QueryLexer.FIELD:return I.QueryParser.parseField;case I.QueryLexer.TERM:return I.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+t.type;throw t.str.length>=1&&(r+=" with value '"+t.str+"'"),new I.QueryParseError(r,t.start,t.end)}},I.QueryParser.parsePresence=function(e){var t=e.consumeLexeme();if(null!=t){switch(t.str){case"-":e.currentClause.presence=I.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=I.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+t.str+"'";throw new I.QueryParseError(r,t.start,t.end)}var i=e.peekLexeme();if(null==i)throw r="expecting term or field, found nothing",new I.QueryParseError(r,t.start,t.end);switch(i.type){case I.QueryLexer.FIELD:return I.QueryParser.parseField;case I.QueryLexer.TERM:return I.QueryParser.parseTerm;default:throw r="expecting term or field, found '"+i.type+"'",new I.QueryParseError(r,i.start,i.end)}}},I.QueryParser.parseField=function(e){var t=e.consumeLexeme();if(null!=t){if(-1==e.query.allFields.indexOf(t.str)){var r=e.query.allFields.map((function(e){return"'"+e+"'"})).join(", "),i="unrecognised field '"+t.str+"', possible fields: "+r;throw new I.QueryParseError(i,t.start,t.end)}e.currentClause.fields=[t.str];var n=e.peekLexeme();if(null==n)throw i="expecting term, found nothing",new I.QueryParseError(i,t.start,t.end);if(n.type===I.QueryLexer.TERM)return I.QueryParser.parseTerm;throw i="expecting term, found '"+n.type+"'",new I.QueryParseError(i,n.start,n.end)}},I.QueryParser.parseTerm=function(e){var t=e.consumeLexeme();if(null!=t){e.currentClause.term=t.str.toLowerCase(),-1!=t.str.indexOf("*")&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(null!=r)switch(r.type){case I.QueryLexer.TERM:return e.nextClause(),I.QueryParser.parseTerm;case I.QueryLexer.FIELD:return e.nextClause(),I.QueryParser.parseField;case I.QueryLexer.EDIT_DISTANCE:return I.QueryParser.parseEditDistance;case I.QueryLexer.BOOST:return I.QueryParser.parseBoost;case I.QueryLexer.PRESENCE:return e.nextClause(),I.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new I.QueryParseError(i,r.start,r.end)}else e.nextClause()}},I.QueryParser.parseEditDistance=function(e){var t=e.consumeLexeme();if(null!=t){var r=parseInt(t.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new I.QueryParseError(i,t.start,t.end)}e.currentClause.editDistance=r;var n=e.peekLexeme();if(null!=n)switch(n.type){case I.QueryLexer.TERM:return e.nextClause(),I.QueryParser.parseTerm;case I.QueryLexer.FIELD:return e.nextClause(),I.QueryParser.parseField;case I.QueryLexer.EDIT_DISTANCE:return I.QueryParser.parseEditDistance;case I.QueryLexer.BOOST:return I.QueryParser.parseBoost;case I.QueryLexer.PRESENCE:return e.nextClause(),I.QueryParser.parsePresence;default:throw i="Unexpected lexeme type '"+n.type+"'",new I.QueryParseError(i,n.start,n.end)}else e.nextClause()}},I.QueryParser.parseBoost=function(e){var t=e.consumeLexeme();if(null!=t){var r=parseInt(t.str,10);if(isNaN(r)){var i="boost must be numeric";throw new I.QueryParseError(i,t.start,t.end)}e.currentClause.boost=r;var n=e.peekLexeme();if(null!=n)switch(n.type){case I.QueryLexer.TERM:return e.nextClause(),I.QueryParser.parseTerm;case I.QueryLexer.FIELD:return e.nextClause(),I.QueryParser.parseField;case I.QueryLexer.EDIT_DISTANCE:return I.QueryParser.parseEditDistance;case I.QueryLexer.BOOST:return I.QueryParser.parseBoost;case I.QueryLexer.PRESENCE:return e.nextClause(),I.QueryParser.parsePresence;default:throw i="Unexpected lexeme type '"+n.type+"'",new I.QueryParseError(i,n.start,n.end)}else e.nextClause()}},void 0===(n="function"==typeof(i=function(){return I})?i.call(t,r,t,e):i)||(e.exports=n)}()},567:(e,t,r)=>{var i=r(314),n=["add","done","toJS","fromExternalJS","load","dispose","search","Worker"];e.exports=function(){var e=new Worker(URL.createObjectURL(new Blob(['/*! For license information please see c583fb27fbae15fc4e3d.worker.js.LICENSE.txt */\n(()=>{var e={336:(e,t,r)=>{var i,n;!function(){var s,o,a,u,l,c,h,d,f,p,y,m,g,x,v,w,Q,k,S,E,P,L,b,T,O,I,R=function(e){var t=new R.Builder;return t.pipeline.add(R.trimmer,R.stopWordFilter,R.stemmer),t.searchPipeline.add(R.stemmer),e.call(t,t),t.build()};R.version="2.3.9",R.utils={},R.utils.warn=(s=this,function(e){s.console&&console.warn&&console.warn(e)}),R.utils.asString=function(e){return null==e?"":e.toString()},R.utils.clone=function(e){if(null==e)return e;for(var t=Object.create(null),r=Object.keys(e),i=0;i<r.length;i++){var n=r[i],s=e[n];if(Array.isArray(s))t[n]=s.slice();else{if("string"!=typeof s&&"number"!=typeof s&&"boolean"!=typeof s)throw new TypeError("clone is not deep and does not support nested objects");t[n]=s}}return t},R.FieldRef=function(e,t,r){this.docRef=e,this.fieldName=t,this._stringValue=r},R.FieldRef.joiner="/",R.FieldRef.fromString=function(e){var t=e.indexOf(R.FieldRef.joiner);if(-1===t)throw"malformed field ref string";var r=e.slice(0,t),i=e.slice(t+1);return new R.FieldRef(i,r,e)},R.FieldRef.prototype.toString=function(){return null==this._stringValue&&(this._stringValue=this.fieldName+R.FieldRef.joiner+this.docRef),this._stringValue},R.Set=function(e){if(this.elements=Object.create(null),e){this.length=e.length;for(var t=0;t<this.length;t++)this.elements[e[t]]=!0}else this.length=0},R.Set.complete={intersect:function(e){return e},union:function(){return this},contains:function(){return!0}},R.Set.empty={intersect:function(){return this},union:function(e){return e},contains:function(){return!1}},R.Set.prototype.contains=function(e){return!!this.elements[e]},R.Set.prototype.intersect=function(e){var t,r,i,n=[];if(e===R.Set.complete)return this;if(e===R.Set.empty)return e;this.length<e.length?(t=this,r=e):(t=e,r=this),i=Object.keys(t.elements);for(var s=0;s<i.length;s++){var o=i[s];o in r.elements&&n.push(o)}return new R.Set(n)},R.Set.prototype.union=function(e){return e===R.Set.complete?R.Set.complete:e===R.Set.empty?this:new R.Set(Object.keys(this.elements).concat(Object.keys(e.elements)))},R.idf=function(e,t){var r=0;for(var i in e)"_index"!=i&&(r+=Object.keys(e[i]).length);var n=(t-r+.5)/(r+.5);return Math.log(1+Math.abs(n))},R.Token=function(e,t){this.str=e||"",this.metadata=t||{}},R.Token.prototype.toString=function(){return this.str},R.Token.prototype.update=function(e){return this.str=e(this.str,this.metadata),this},R.Token.prototype.clone=function(e){return e=e||function(e){return e},new R.Token(e(this.str,this.metadata),this.metadata)},R.tokenizer=function(e,t){if(null==e||null==e)return[];if(Array.isArray(e))return e.map((function(e){return new R.Token(R.utils.asString(e).toLowerCase(),R.utils.clone(t))}));for(var r=e.toString().toLowerCase(),i=r.length,n=[],s=0,o=0;s<=i;s++){var a=s-o;if(r.charAt(s).match(R.tokenizer.separator)||s==i){if(a>0){var u=R.utils.clone(t)||{};u.position=[o,a],u.index=n.length,n.push(new R.Token(r.slice(o,s),u))}o=s+1}}return n},R.tokenizer.separator=/[\\s\\-]+/,R.Pipeline=function(){this._stack=[]},R.Pipeline.registeredFunctions=Object.create(null),R.Pipeline.registerFunction=function(e,t){t in this.registeredFunctions&&R.utils.warn("Overwriting existing registered function: "+t),e.label=t,R.Pipeline.registeredFunctions[e.label]=e},R.Pipeline.warnIfFunctionNotRegistered=function(e){e.label&&e.label in this.registeredFunctions||R.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\\n",e)},R.Pipeline.load=function(e){var t=new R.Pipeline;return e.forEach((function(e){var r=R.Pipeline.registeredFunctions[e];if(!r)throw new Error("Cannot load unregistered function: "+e);t.add(r)})),t},R.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach((function(e){R.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)}),this)},R.Pipeline.prototype.after=function(e,t){R.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");r+=1,this._stack.splice(r,0,t)},R.Pipeline.prototype.before=function(e,t){R.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");this._stack.splice(r,0,t)},R.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);-1!=t&&this._stack.splice(t,1)},R.Pipeline.prototype.run=function(e){for(var t=this._stack.length,r=0;r<t;r++){for(var i=this._stack[r],n=[],s=0;s<e.length;s++){var o=i(e[s],s,e);if(null!=o&&""!==o)if(Array.isArray(o))for(var a=0;a<o.length;a++)n.push(o[a]);else n.push(o)}e=n}return e},R.Pipeline.prototype.runString=function(e,t){var r=new R.Token(e,t);return this.run([r]).map((function(e){return e.toString()}))},R.Pipeline.prototype.reset=function(){this._stack=[]},R.Pipeline.prototype.toJSON=function(){return this._stack.map((function(e){return R.Pipeline.warnIfFunctionNotRegistered(e),e.label}))},R.Vector=function(e){this._magnitude=0,this.elements=e||[]},R.Vector.prototype.positionForIndex=function(e){if(0==this.elements.length)return 0;for(var t=0,r=this.elements.length/2,i=r-t,n=Math.floor(i/2),s=this.elements[2*n];i>1&&(s<e&&(t=n),s>e&&(r=n),s!=e);)i=r-t,n=t+Math.floor(i/2),s=this.elements[2*n];return s==e||s>e?2*n:s<e?2*(n+1):void 0},R.Vector.prototype.insert=function(e,t){this.upsert(e,t,(function(){throw"duplicate index"}))},R.Vector.prototype.upsert=function(e,t,r){this._magnitude=0;var i=this.positionForIndex(e);this.elements[i]==e?this.elements[i+1]=r(this.elements[i+1],t):this.elements.splice(i,0,e,t)},R.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var e=0,t=this.elements.length,r=1;r<t;r+=2){var i=this.elements[r];e+=i*i}return this._magnitude=Math.sqrt(e)},R.Vector.prototype.dot=function(e){for(var t=0,r=this.elements,i=e.elements,n=r.length,s=i.length,o=0,a=0,u=0,l=0;u<n&&l<s;)(o=r[u])<(a=i[l])?u+=2:o>a?l+=2:o==a&&(t+=r[u+1]*i[l+1],u+=2,l+=2);return t},R.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},R.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),t=1,r=0;t<this.elements.length;t+=2,r++)e[r]=this.elements[t];return e},R.Vector.prototype.toJSON=function(){return this.elements},R.stemmer=(o={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"},a={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},u="[aeiouy]",l="[^aeiou][^aeiouy]*",c=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),h=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),d=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$"),f=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy]"),p=/^(.+?)(ss|i)es$/,y=/^(.+?)([^s])s$/,m=/^(.+?)eed$/,g=/^(.+?)(ed|ing)$/,x=/.$/,v=/(at|bl|iz)$/,w=new RegExp("([^aeiouylsz])\\\\1$"),Q=new RegExp("^"+l+u+"[^aeiouwxy]$"),k=/^(.+?[^aeiou])y$/,S=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,E=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,P=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,L=/^(.+?)(s|t)(ion)$/,b=/^(.+?)e$/,T=/ll$/,O=new RegExp("^"+l+u+"[^aeiouwxy]$"),I=function(e){var t,r,i,n,s,u,l;if(e.length<3)return e;if("y"==(i=e.substr(0,1))&&(e=i.toUpperCase()+e.substr(1)),s=y,(n=p).test(e)?e=e.replace(n,"$1$2"):s.test(e)&&(e=e.replace(s,"$1$2")),s=g,(n=m).test(e)){var I=n.exec(e);(n=c).test(I[1])&&(n=x,e=e.replace(n,""))}else s.test(e)&&(t=(I=s.exec(e))[1],(s=f).test(t)&&(u=w,l=Q,(s=v).test(e=t)?e+="e":u.test(e)?(n=x,e=e.replace(n,"")):l.test(e)&&(e+="e")));return(n=k).test(e)&&(e=(t=(I=n.exec(e))[1])+"i"),(n=S).test(e)&&(t=(I=n.exec(e))[1],r=I[2],(n=c).test(t)&&(e=t+o[r])),(n=E).test(e)&&(t=(I=n.exec(e))[1],r=I[2],(n=c).test(t)&&(e=t+a[r])),s=L,(n=P).test(e)?(t=(I=n.exec(e))[1],(n=h).test(t)&&(e=t)):s.test(e)&&(t=(I=s.exec(e))[1]+I[2],(s=h).test(t)&&(e=t)),(n=b).test(e)&&(t=(I=n.exec(e))[1],s=d,u=O,((n=h).test(t)||s.test(t)&&!u.test(t))&&(e=t)),s=h,(n=T).test(e)&&s.test(e)&&(n=x,e=e.replace(n,"")),"y"==i&&(e=i.toLowerCase()+e.substr(1)),e},function(e){return e.update(I)}),R.Pipeline.registerFunction(R.stemmer,"stemmer"),R.generateStopWordFilter=function(e){var t=e.reduce((function(e,t){return e[t]=t,e}),{});return function(e){if(e&&t[e.toString()]!==e.toString())return e}},R.stopWordFilter=R.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"]),R.Pipeline.registerFunction(R.stopWordFilter,"stopWordFilter"),R.trimmer=function(e){return e.update((function(e){return e.replace(/^\\W+/,"").replace(/\\W+$/,"")}))},R.Pipeline.registerFunction(R.trimmer,"trimmer"),R.TokenSet=function(){this.final=!1,this.edges={},this.id=R.TokenSet._nextId,R.TokenSet._nextId+=1},R.TokenSet._nextId=1,R.TokenSet.fromArray=function(e){for(var t=new R.TokenSet.Builder,r=0,i=e.length;r<i;r++)t.insert(e[r]);return t.finish(),t.root},R.TokenSet.fromClause=function(e){return"editDistance"in e?R.TokenSet.fromFuzzyString(e.term,e.editDistance):R.TokenSet.fromString(e.term)},R.TokenSet.fromFuzzyString=function(e,t){for(var r=new R.TokenSet,i=[{node:r,editsRemaining:t,str:e}];i.length;){var n=i.pop();if(n.str.length>0){var s,o=n.str.charAt(0);o in n.node.edges?s=n.node.edges[o]:(s=new R.TokenSet,n.node.edges[o]=s),1==n.str.length&&(s.final=!0),i.push({node:s,editsRemaining:n.editsRemaining,str:n.str.slice(1)})}if(0!=n.editsRemaining){if("*"in n.node.edges)var a=n.node.edges["*"];else a=new R.TokenSet,n.node.edges["*"]=a;if(0==n.str.length&&(a.final=!0),i.push({node:a,editsRemaining:n.editsRemaining-1,str:n.str}),n.str.length>1&&i.push({node:n.node,editsRemaining:n.editsRemaining-1,str:n.str.slice(1)}),1==n.str.length&&(n.node.final=!0),n.str.length>=1){if("*"in n.node.edges)var u=n.node.edges["*"];else u=new R.TokenSet,n.node.edges["*"]=u;1==n.str.length&&(u.final=!0),i.push({node:u,editsRemaining:n.editsRemaining-1,str:n.str.slice(1)})}if(n.str.length>1){var l,c=n.str.charAt(0),h=n.str.charAt(1);h in n.node.edges?l=n.node.edges[h]:(l=new R.TokenSet,n.node.edges[h]=l),1==n.str.length&&(l.final=!0),i.push({node:l,editsRemaining:n.editsRemaining-1,str:c+n.str.slice(2)})}}}return r},R.TokenSet.fromString=function(e){for(var t=new R.TokenSet,r=t,i=0,n=e.length;i<n;i++){var s=e[i],o=i==n-1;if("*"==s)t.edges[s]=t,t.final=o;else{var a=new R.TokenSet;a.final=o,t.edges[s]=a,t=a}}return r},R.TokenSet.prototype.toArray=function(){for(var e=[],t=[{prefix:"",node:this}];t.length;){var r=t.pop(),i=Object.keys(r.node.edges),n=i.length;r.node.final&&(r.prefix.charAt(0),e.push(r.prefix));for(var s=0;s<n;s++){var o=i[s];t.push({prefix:r.prefix.concat(o),node:r.node.edges[o]})}}return e},R.TokenSet.prototype.toString=function(){if(this._str)return this._str;for(var e=this.final?"1":"0",t=Object.keys(this.edges).sort(),r=t.length,i=0;i<r;i++){var n=t[i];e=e+n+this.edges[n].id}return e},R.TokenSet.prototype.intersect=function(e){for(var t=new R.TokenSet,r=void 0,i=[{qNode:e,output:t,node:this}];i.length;){r=i.pop();for(var n=Object.keys(r.qNode.edges),s=n.length,o=Object.keys(r.node.edges),a=o.length,u=0;u<s;u++)for(var l=n[u],c=0;c<a;c++){var h=o[c];if(h==l||"*"==l){var d=r.node.edges[h],f=r.qNode.edges[l],p=d.final&&f.final,y=void 0;h in r.output.edges?(y=r.output.edges[h]).final=y.final||p:((y=new R.TokenSet).final=p,r.output.edges[h]=y),i.push({qNode:f,output:y,node:d})}}}return t},R.TokenSet.Builder=function(){this.previousWord="",this.root=new R.TokenSet,this.uncheckedNodes=[],this.minimizedNodes={}},R.TokenSet.Builder.prototype.insert=function(e){var t,r=0;if(e<this.previousWord)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++)r++;for(this.minimize(r),t=0==this.uncheckedNodes.length?this.root:this.uncheckedNodes[this.uncheckedNodes.length-1].child,i=r;i<e.length;i++){var n=new R.TokenSet,s=e[i];t.edges[s]=n,this.uncheckedNodes.push({parent:t,char:s,child:n}),t=n}t.final=!0,this.previousWord=e},R.TokenSet.Builder.prototype.finish=function(){this.minimize(0)},R.TokenSet.Builder.prototype.minimize=function(e){for(var t=this.uncheckedNodes.length-1;t>=e;t--){var r=this.uncheckedNodes[t],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}},R.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},R.Index.prototype.search=function(e){return this.query((function(t){new R.QueryParser(e,t).parse()}))},R.Index.prototype.query=function(e){for(var t=new R.Query(this.fields),r=Object.create(null),i=Object.create(null),n=Object.create(null),s=Object.create(null),o=Object.create(null),a=0;a<this.fields.length;a++)i[this.fields[a]]=new R.Vector;for(e.call(t,t),a=0;a<t.clauses.length;a++){var u,l=t.clauses[a],c=R.Set.empty;u=l.usePipeline?this.pipeline.runString(l.term,{fields:l.fields}):[l.term];for(var h=0;h<u.length;h++){var d=u[h];l.term=d;var f=R.TokenSet.fromClause(l),p=this.tokenSet.intersect(f).toArray();if(0===p.length&&l.presence===R.Query.presence.REQUIRED){for(var y=0;y<l.fields.length;y++)s[F=l.fields[y]]=R.Set.empty;break}for(var m=0;m<p.length;m++){var g=p[m],x=this.invertedIndex[g],v=x._index;for(y=0;y<l.fields.length;y++){var w=x[F=l.fields[y]],Q=Object.keys(w),k=g+"/"+F,S=new R.Set(Q);if(l.presence==R.Query.presence.REQUIRED&&(c=c.union(S),void 0===s[F]&&(s[F]=R.Set.complete)),l.presence!=R.Query.presence.PROHIBITED){if(i[F].upsert(v,l.boost,(function(e,t){return e+t})),!n[k]){for(var E=0;E<Q.length;E++){var P,L=Q[E],b=new R.FieldRef(L,F),T=w[L];void 0===(P=r[b])?r[b]=new R.MatchData(g,F,T):P.add(g,F,T)}n[k]=!0}}else void 0===o[F]&&(o[F]=R.Set.empty),o[F]=o[F].union(S)}}}if(l.presence===R.Query.presence.REQUIRED)for(y=0;y<l.fields.length;y++)s[F=l.fields[y]]=s[F].intersect(c)}var O=R.Set.complete,I=R.Set.empty;for(a=0;a<this.fields.length;a++){var F;s[F=this.fields[a]]&&(O=O.intersect(s[F])),o[F]&&(I=I.union(o[F]))}var C=Object.keys(r),N=[],j=Object.create(null);if(t.isNegated())for(C=Object.keys(this.fieldVectors),a=0;a<C.length;a++){b=C[a];var _=R.FieldRef.fromString(b);r[b]=new R.MatchData}for(a=0;a<C.length;a++){var D=(_=R.FieldRef.fromString(C[a])).docRef;if(O.contains(D)&&!I.contains(D)){var A,B=this.fieldVectors[_],z=i[_.fieldName].similarity(B);if(void 0!==(A=j[D]))A.score+=z,A.matchData.combine(r[_]);else{var V={ref:D,score:z,matchData:r[_]};j[D]=V,N.push(V)}}}return N.sort((function(e,t){return t.score-e.score}))},R.Index.prototype.toJSON=function(){var e=Object.keys(this.invertedIndex).sort().map((function(e){return[e,this.invertedIndex[e]]}),this),t=Object.keys(this.fieldVectors).map((function(e){return[e,this.fieldVectors[e].toJSON()]}),this);return{version:R.version,fields:this.fields,fieldVectors:t,invertedIndex:e,pipeline:this.pipeline.toJSON()}},R.Index.load=function(e){var t={},r={},i=e.fieldVectors,n=Object.create(null),s=e.invertedIndex,o=new R.TokenSet.Builder,a=R.Pipeline.load(e.pipeline);e.version!=R.version&&R.utils.warn("Version mismatch when loading serialised index. Current version of lunr \'"+R.version+"\' does not match serialized index \'"+e.version+"\'");for(var u=0;u<i.length;u++){var l=(h=i[u])[0],c=h[1];r[l]=new R.Vector(c)}for(u=0;u<s.length;u++){var h,d=(h=s[u])[0],f=h[1];o.insert(d),n[d]=f}return o.finish(),t.fields=e.fields,t.fieldVectors=r,t.invertedIndex=n,t.tokenSet=o.root,t.pipeline=a,new R.Index(t)},R.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=R.tokenizer,this.pipeline=new R.Pipeline,this.searchPipeline=new R.Pipeline,this.documentCount=0,this._b=.75,this._k1=1.2,this.termIndex=0,this.metadataWhitelist=[]},R.Builder.prototype.ref=function(e){this._ref=e},R.Builder.prototype.field=function(e,t){if(/\\//.test(e))throw new RangeError("Field \'"+e+"\' contains illegal character \'/\'");this._fields[e]=t||{}},R.Builder.prototype.b=function(e){this._b=e<0?0:e>1?1:e},R.Builder.prototype.k1=function(e){this._k1=e},R.Builder.prototype.add=function(e,t){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=t||{},this.documentCount+=1;for(var n=0;n<i.length;n++){var s=i[n],o=this._fields[s].extractor,a=o?o(e):e[s],u=this.tokenizer(a,{fields:[s]}),l=this.pipeline.run(u),c=new R.FieldRef(r,s),h=Object.create(null);this.fieldTermFrequencies[c]=h,this.fieldLengths[c]=0,this.fieldLengths[c]+=l.length;for(var d=0;d<l.length;d++){var f=l[d];if(null==h[f]&&(h[f]=0),h[f]+=1,null==this.invertedIndex[f]){var p=Object.create(null);p._index=this.termIndex,this.termIndex+=1;for(var y=0;y<i.length;y++)p[i[y]]=Object.create(null);this.invertedIndex[f]=p}null==this.invertedIndex[f][s][r]&&(this.invertedIndex[f][s][r]=Object.create(null));for(var m=0;m<this.metadataWhitelist.length;m++){var g=this.metadataWhitelist[m],x=f.metadata[g];null==this.invertedIndex[f][s][r][g]&&(this.invertedIndex[f][s][r][g]=[]),this.invertedIndex[f][s][r][g].push(x)}}}},R.Builder.prototype.calculateAverageFieldLengths=function(){for(var e=Object.keys(this.fieldLengths),t=e.length,r={},i={},n=0;n<t;n++){var s=R.FieldRef.fromString(e[n]),o=s.fieldName;i[o]||(i[o]=0),i[o]+=1,r[o]||(r[o]=0),r[o]+=this.fieldLengths[s]}var a=Object.keys(this._fields);for(n=0;n<a.length;n++){var u=a[n];r[u]=r[u]/i[u]}this.averageFieldLength=r},R.Builder.prototype.createFieldVectors=function(){for(var e={},t=Object.keys(this.fieldTermFrequencies),r=t.length,i=Object.create(null),n=0;n<r;n++){for(var s=R.FieldRef.fromString(t[n]),o=s.fieldName,a=this.fieldLengths[s],u=new R.Vector,l=this.fieldTermFrequencies[s],c=Object.keys(l),h=c.length,d=this._fields[o].boost||1,f=this._documents[s.docRef].boost||1,p=0;p<h;p++){var y,m,g,x=c[p],v=l[x],w=this.invertedIndex[x]._index;void 0===i[x]?(y=R.idf(this.invertedIndex[x],this.documentCount),i[x]=y):y=i[x],m=y*((this._k1+1)*v)/(this._k1*(1-this._b+this._b*(a/this.averageFieldLength[o]))+v),m*=d,m*=f,g=Math.round(1e3*m)/1e3,u.insert(w,g)}e[s]=u}this.fieldVectors=e},R.Builder.prototype.createTokenSet=function(){this.tokenSet=R.TokenSet.fromArray(Object.keys(this.invertedIndex).sort())},R.Builder.prototype.build=function(){return this.calculateAverageFieldLengths(),this.createFieldVectors(),this.createTokenSet(),new R.Index({invertedIndex:this.invertedIndex,fieldVectors:this.fieldVectors,tokenSet:this.tokenSet,fields:Object.keys(this._fields),pipeline:this.searchPipeline})},R.Builder.prototype.use=function(e){var t=Array.prototype.slice.call(arguments,1);t.unshift(this),e.apply(this,t)},R.MatchData=function(e,t,r){for(var i=Object.create(null),n=Object.keys(r||{}),s=0;s<n.length;s++){var o=n[s];i[o]=r[o].slice()}this.metadata=Object.create(null),void 0!==e&&(this.metadata[e]=Object.create(null),this.metadata[e][t]=i)},R.MatchData.prototype.combine=function(e){for(var t=Object.keys(e.metadata),r=0;r<t.length;r++){var i=t[r],n=Object.keys(e.metadata[i]);null==this.metadata[i]&&(this.metadata[i]=Object.create(null));for(var s=0;s<n.length;s++){var o=n[s],a=Object.keys(e.metadata[i][o]);null==this.metadata[i][o]&&(this.metadata[i][o]=Object.create(null));for(var u=0;u<a.length;u++){var l=a[u];null==this.metadata[i][o][l]?this.metadata[i][o][l]=e.metadata[i][o][l]:this.metadata[i][o][l]=this.metadata[i][o][l].concat(e.metadata[i][o][l])}}}},R.MatchData.prototype.add=function(e,t,r){if(!(e in this.metadata))return this.metadata[e]=Object.create(null),void(this.metadata[e][t]=r);if(t in this.metadata[e])for(var i=Object.keys(r),n=0;n<i.length;n++){var s=i[n];s in this.metadata[e][t]?this.metadata[e][t][s]=this.metadata[e][t][s].concat(r[s]):this.metadata[e][t][s]=r[s]}else this.metadata[e][t]=r},R.Query=function(e){this.clauses=[],this.allFields=e},R.Query.wildcard=new String("*"),R.Query.wildcard.NONE=0,R.Query.wildcard.LEADING=1,R.Query.wildcard.TRAILING=2,R.Query.presence={OPTIONAL:1,REQUIRED:2,PROHIBITED:3},R.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=R.Query.wildcard.NONE),e.wildcard&R.Query.wildcard.LEADING&&e.term.charAt(0)!=R.Query.wildcard&&(e.term="*"+e.term),e.wildcard&R.Query.wildcard.TRAILING&&e.term.slice(-1)!=R.Query.wildcard&&(e.term=e.term+"*"),"presence"in e||(e.presence=R.Query.presence.OPTIONAL),this.clauses.push(e),this},R.Query.prototype.isNegated=function(){for(var e=0;e<this.clauses.length;e++)if(this.clauses[e].presence!=R.Query.presence.PROHIBITED)return!1;return!0},R.Query.prototype.term=function(e,t){if(Array.isArray(e))return e.forEach((function(e){this.term(e,R.utils.clone(t))}),this),this;var r=t||{};return r.term=e.toString(),this.clause(r),this},R.QueryParseError=function(e,t,r){this.name="QueryParseError",this.message=e,this.start=t,this.end=r},R.QueryParseError.prototype=new Error,R.QueryLexer=function(e){this.lexemes=[],this.str=e,this.length=e.length,this.pos=0,this.start=0,this.escapeCharPositions=[]},R.QueryLexer.prototype.run=function(){for(var e=R.QueryLexer.lexText;e;)e=e(this)},R.QueryLexer.prototype.sliceString=function(){for(var e=[],t=this.start,r=this.pos,i=0;i<this.escapeCharPositions.length;i++)r=this.escapeCharPositions[i],e.push(this.str.slice(t,r)),t=r+1;return e.push(this.str.slice(t,this.pos)),this.escapeCharPositions.length=0,e.join("")},R.QueryLexer.prototype.emit=function(e){this.lexemes.push({type:e,str:this.sliceString(),start:this.start,end:this.pos}),this.start=this.pos},R.QueryLexer.prototype.escapeCharacter=function(){this.escapeCharPositions.push(this.pos-1),this.pos+=1},R.QueryLexer.prototype.next=function(){if(this.pos>=this.length)return R.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},R.QueryLexer.prototype.width=function(){return this.pos-this.start},R.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},R.QueryLexer.prototype.backup=function(){this.pos-=1},R.QueryLexer.prototype.acceptDigitRun=function(){var e,t;do{t=(e=this.next()).charCodeAt(0)}while(t>47&&t<58);e!=R.QueryLexer.EOS&&this.backup()},R.QueryLexer.prototype.more=function(){return this.pos<this.length},R.QueryLexer.EOS="EOS",R.QueryLexer.FIELD="FIELD",R.QueryLexer.TERM="TERM",R.QueryLexer.EDIT_DISTANCE="EDIT_DISTANCE",R.QueryLexer.BOOST="BOOST",R.QueryLexer.PRESENCE="PRESENCE",R.QueryLexer.lexField=function(e){return e.backup(),e.emit(R.QueryLexer.FIELD),e.ignore(),R.QueryLexer.lexText},R.QueryLexer.lexTerm=function(e){if(e.width()>1&&(e.backup(),e.emit(R.QueryLexer.TERM)),e.ignore(),e.more())return R.QueryLexer.lexText},R.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(R.QueryLexer.EDIT_DISTANCE),R.QueryLexer.lexText},R.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(R.QueryLexer.BOOST),R.QueryLexer.lexText},R.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(R.QueryLexer.TERM)},R.QueryLexer.termSeparator=R.tokenizer.separator,R.QueryLexer.lexText=function(e){for(;;){var t=e.next();if(t==R.QueryLexer.EOS)return R.QueryLexer.lexEOS;if(92!=t.charCodeAt(0)){if(":"==t)return R.QueryLexer.lexField;if("~"==t)return e.backup(),e.width()>0&&e.emit(R.QueryLexer.TERM),R.QueryLexer.lexEditDistance;if("^"==t)return e.backup(),e.width()>0&&e.emit(R.QueryLexer.TERM),R.QueryLexer.lexBoost;if("+"==t&&1===e.width())return e.emit(R.QueryLexer.PRESENCE),R.QueryLexer.lexText;if("-"==t&&1===e.width())return e.emit(R.QueryLexer.PRESENCE),R.QueryLexer.lexText;if(t.match(R.QueryLexer.termSeparator))return R.QueryLexer.lexTerm}else e.escapeCharacter()}},R.QueryParser=function(e,t){this.lexer=new R.QueryLexer(e),this.query=t,this.currentClause={},this.lexemeIdx=0},R.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=R.QueryParser.parseClause;e;)e=e(this);return this.query},R.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},R.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},R.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},R.QueryParser.parseClause=function(e){var t=e.peekLexeme();if(null!=t)switch(t.type){case R.QueryLexer.PRESENCE:return R.QueryParser.parsePresence;case R.QueryLexer.FIELD:return R.QueryParser.parseField;case R.QueryLexer.TERM:return R.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+t.type;throw t.str.length>=1&&(r+=" with value \'"+t.str+"\'"),new R.QueryParseError(r,t.start,t.end)}},R.QueryParser.parsePresence=function(e){var t=e.consumeLexeme();if(null!=t){switch(t.str){case"-":e.currentClause.presence=R.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=R.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator\'"+t.str+"\'";throw new R.QueryParseError(r,t.start,t.end)}var i=e.peekLexeme();if(null==i)throw r="expecting term or field, found nothing",new R.QueryParseError(r,t.start,t.end);switch(i.type){case R.QueryLexer.FIELD:return R.QueryParser.parseField;case R.QueryLexer.TERM:return R.QueryParser.parseTerm;default:throw r="expecting term or field, found \'"+i.type+"\'",new R.QueryParseError(r,i.start,i.end)}}},R.QueryParser.parseField=function(e){var t=e.consumeLexeme();if(null!=t){if(-1==e.query.allFields.indexOf(t.str)){var r=e.query.allFields.map((function(e){return"\'"+e+"\'"})).join(", "),i="unrecognised field \'"+t.str+"\', possible fields: "+r;throw new R.QueryParseError(i,t.start,t.end)}e.currentClause.fields=[t.str];var n=e.peekLexeme();if(null==n)throw i="expecting term, found nothing",new R.QueryParseError(i,t.start,t.end);if(n.type===R.QueryLexer.TERM)return R.QueryParser.parseTerm;throw i="expecting term, found \'"+n.type+"\'",new R.QueryParseError(i,n.start,n.end)}},R.QueryParser.parseTerm=function(e){var t=e.consumeLexeme();if(null!=t){e.currentClause.term=t.str.toLowerCase(),-1!=t.str.indexOf("*")&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(null!=r)switch(r.type){case R.QueryLexer.TERM:return e.nextClause(),R.QueryParser.parseTerm;case R.QueryLexer.FIELD:return e.nextClause(),R.QueryParser.parseField;case R.QueryLexer.EDIT_DISTANCE:return R.QueryParser.parseEditDistance;case R.QueryLexer.BOOST:return R.QueryParser.parseBoost;case R.QueryLexer.PRESENCE:return e.nextClause(),R.QueryParser.parsePresence;default:var i="Unexpected lexeme type \'"+r.type+"\'";throw new R.QueryParseError(i,r.start,r.end)}else e.nextClause()}},R.QueryParser.parseEditDistance=function(e){var t=e.consumeLexeme();if(null!=t){var r=parseInt(t.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new R.QueryParseError(i,t.start,t.end)}e.currentClause.editDistance=r;var n=e.peekLexeme();if(null!=n)switch(n.type){case R.QueryLexer.TERM:return e.nextClause(),R.QueryParser.parseTerm;case R.QueryLexer.FIELD:return e.nextClause(),R.QueryParser.parseField;case R.QueryLexer.EDIT_DISTANCE:return R.QueryParser.parseEditDistance;case R.QueryLexer.BOOST:return R.QueryParser.parseBoost;case R.QueryLexer.PRESENCE:return e.nextClause(),R.QueryParser.parsePresence;default:throw i="Unexpected lexeme type \'"+n.type+"\'",new R.QueryParseError(i,n.start,n.end)}else e.nextClause()}},R.QueryParser.parseBoost=function(e){var t=e.consumeLexeme();if(null!=t){var r=parseInt(t.str,10);if(isNaN(r)){var i="boost must be numeric";throw new R.QueryParseError(i,t.start,t.end)}e.currentClause.boost=r;var n=e.peekLexeme();if(null!=n)switch(n.type){case R.QueryLexer.TERM:return e.nextClause(),R.QueryParser.parseTerm;case R.QueryLexer.FIELD:return e.nextClause(),R.QueryParser.parseField;case R.QueryLexer.EDIT_DISTANCE:return R.QueryParser.parseEditDistance;case R.QueryLexer.BOOST:return R.QueryParser.parseBoost;case R.QueryLexer.PRESENCE:return e.nextClause(),R.QueryParser.parsePresence;default:throw i="Unexpected lexeme type \'"+n.type+"\'",new R.QueryParseError(i,n.start,n.end)}else e.nextClause()}},void 0===(n="function"==typeof(i=function(){return R})?i.call(t,r,t,e):i)||(e.exports=n)}()}},t={};function r(i){var n=t[i];if(void 0!==n)return n.exports;var s=t[i]={exports:{}};return e[i](s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var i={};(()=>{"use strict";r.d(i,{add:()=>l,done:()=>c,toJS:()=>h,fromExternalJS:()=>d,load:()=>f,dispose:()=>p,search:()=>y});var e=r(336),t=(Object.defineProperty,(e,t,r)=>new Promise(((i,n)=>{var s=e=>{try{a(r.next(e))}catch(e){n(e)}},o=e=>{try{a(r.throw(e))}catch(e){n(e)}},a=e=>e.done?i(e.value):Promise.resolve(e.value).then(s,o);a((r=r.apply(e,t)).next())})));let n,s,o,a=[];function u(){n=new e.Builder,n.field("title"),n.field("description"),n.ref("ref"),n.pipeline.add(e.trimmer,e.stopWordFilter,e.stemmer),o=new Promise((e=>{s=e}))}function l(e,t,r){const i=a.push(r)-1,s={title:e.toLowerCase(),description:t.toLowerCase(),ref:i};n.add(s)}function c(){return t(this,null,(function*(){s(n.build())}))}function h(){return t(this,null,(function*(){return{store:a,index:(yield o).toJSON()}}))}function d(e,r){return t(this,null,(function*(){try{if(importScripts(e),!self[r])throw new Error("Broken index file format");yield f(self[r])}catch(e){console.error("Failed to load search index: "+e.message)}}))}function f(r){return t(this,null,(function*(){a=r.store,s(e.Index.load(r.index))}))}function p(){return t(this,null,(function*(){a=[],u()}))}function y(r,i=0){return t(this,null,(function*(){if(0===r.trim().length)return[];let t=(yield o).query((t=>{r.trim().toLowerCase().split(/\\s+/).forEach((r=>{if(1===r.length)return;const i=(t=>"*"+e.stemmer(new e.Token(t,{}))+"*")(r);t.term(i,{})}))}));return i>0&&(t=t.slice(0,i)),t.map((e=>({meta:a[e.ref],score:e.score})))}))}e.tokenizer.separator=/\\s+/,u(),addEventListener("message",(function(e){var t,r=e.data,n=r.type,s=r.method,o=r.id,a=r.params;"RPC"===n&&s&&((t=i[s])?Promise.resolve().then((function(){return t.apply(i,a)})):Promise.reject("No such method")).then((function(e){postMessage({type:"RPC",id:o,result:e})})).catch((function(e){var t={message:e};e.stack&&(t.message=e.message,t.stack=e.stack,t.name=e.name),postMessage({type:"RPC",id:o,error:t})}))})),postMessage({type:"RPC",method:"ready"})})()})();'])),{name:"[fullhash].worker.js"});return i(e,n),e}},314:e=>{e.exports=function(e,t){var r=0,i={};e.addEventListener("message",(function(t){var r=t.data;if("RPC"===r.type)if(r.id){var n=i[r.id];n&&(delete i[r.id],r.error?n[1](Object.assign(Error(r.error.message),r.error)):n[0](r.result))}else{var s=document.createEvent("Event");s.initEvent(r.method,!1,!1),s.data=r.params,e.dispatchEvent(s)}})),t.forEach((function(t){e[t]=function(){var n=arguments;return new Promise((function(s,o){var a=++r;i[a]=[s,o],e.postMessage({type:"RPC",id:a,method:t,params:[].slice.call(n)})}))}}))}}},t={};function r(i){var n=t[i];if(void 0!==n)return n.exports;var s=t[i]={exports:{}};return e[i](s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{"use strict";r.r(i),r.d(i,{SearchStore:()=>n});const e="undefined"!=typeof window&&"HTMLElement"in window;"undefined"==typeof Element||Element.prototype.scrollIntoViewIfNeeded||(Element.prototype.scrollIntoViewIfNeeded=function(e){e=0===arguments.length||!!e;const t=this.parentNode,r=window.getComputedStyle(t,void 0),i=parseInt(r.getPropertyValue("border-top-width"),10),n=parseInt(r.getPropertyValue("border-left-width"),10),s=this.offsetTop-t.offsetTop<t.scrollTop,o=this.offsetTop-t.offsetTop+this.clientHeight-i>t.scrollTop+t.clientHeight,a=this.offsetLeft-t.offsetLeft<t.scrollLeft,u=this.offsetLeft-t.offsetLeft+this.clientWidth-n>t.scrollLeft+t.clientWidth,l=s&&!o;(s||o)&&e&&(t.scrollTop=this.offsetTop-t.offsetTop-t.clientHeight/2-i+this.clientHeight/2),(a||u)&&e&&(t.scrollLeft=this.offsetLeft-t.offsetLeft-t.clientWidth/2-n+this.clientWidth/2),(s||o||a||u)&&!e&&this.scrollIntoView(l)});var t=Object.defineProperty;class n{constructor(){var i,n,s;i=this,n="searchWorker",s=function(){let t;if(e)try{t=r(567)}catch(e){t=r(27).ZP}else t=r(27).ZP;return new t}(),((e,r,i)=>{r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i})(i,"symbol"!=typeof n?n+"":n,s)}indexItems(e){const t=e=>{e.forEach((e=>{"group"!==e.type&&this.add(e.name,e.description||"",e.id),t(e.items)}))};t(e),this.searchWorker.done()}add(e,t,r){this.searchWorker.add(e,t,r)}dispose(){this.searchWorker.terminate(),this.searchWorker.dispose()}search(e){return this.searchWorker.search(e)}toJS(){return e=this,null,t=function*(){return this.searchWorker.toJS()},new Promise(((r,i)=>{var n=e=>{try{o(t.next(e))}catch(e){i(e)}},s=e=>{try{o(t.throw(e))}catch(e){i(e)}},o=e=>e.done?r(e.value):Promise.resolve(e.value).then(n,s);o((t=t.apply(e,null)).next())}));var e,t}load(e){this.searchWorker.load(e)}fromExternalJS(e,t){e&&t&&this.searchWorker.fromExternalJS(e,t)}}})(),i})()}));
|
|
2
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SearchStore=t():e.SearchStore=t()}(this,(function(){return(()=>{var e={27:(e,t,r)=>{"use strict";r.d(t,{ZP:()=>a});var i=r(336),n=Object.defineProperty,s=(e,t,r)=>(((e,t,r)=>{t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),o=(e,t,r)=>new Promise(((i,n)=>{var s=e=>{try{a(r.next(e))}catch(e){n(e)}},o=e=>{try{a(r.throw(e))}catch(e){n(e)}},a=e=>e.done?i(e.value):Promise.resolve(e.value).then(s,o);a((r=r.apply(e,t)).next())}));class a{constructor(){s(this,"add",f),s(this,"done",p),s(this,"search",R),s(this,"toJS",y),s(this,"load",g),s(this,"dispose",x),s(this,"fromExternalJS",m)}}let u,l,c,h=[];function d(){u=new i.Builder,u.field("title"),u.field("description"),u.ref("ref"),u.pipeline.add(i.trimmer,i.stopWordFilter,i.stemmer),c=new Promise((e=>{l=e}))}function f(e,t,r){const i=h.push(r)-1,n={title:e.toLowerCase(),description:t.toLowerCase(),ref:i};u.add(n)}function p(){return o(this,null,(function*(){l(u.build())}))}function y(){return o(this,null,(function*(){return{store:h,index:(yield c).toJSON()}}))}function m(e,t){return o(this,null,(function*(){try{if(importScripts(e),!self[t])throw new Error("Broken index file format");yield g(self[t])}catch(e){console.error("Failed to load search index: "+e.message)}}))}function g(e){return o(this,null,(function*(){h=e.store,l(i.Index.load(e.index))}))}function x(){return o(this,null,(function*(){h=[],d()}))}function R(e,t=0){return o(this,null,(function*(){if(0===e.trim().length)return[];let r=(yield c).query((t=>{e.trim().toLowerCase().split(/\s+/).forEach((e=>{if(1===e.length)return;const r=(e=>"*"+i.stemmer(new i.Token(e,{}))+"*")(e);t.term(r,{})}))}));return t>0&&(r=r.slice(0,t)),r.map((e=>({meta:h[e.ref],score:e.score})))}))}i.tokenizer.separator=/\s+/,d()},336:(e,t,r)=>{var i,n;!function(){var s,o,a,u,l,c,h,d,f,p,y,m,g,x,R,v,w,Q,k,S,E,b,L,P,T,O,I=function(e){var t=new I.Builder;return t.pipeline.add(I.trimmer,I.stopWordFilter,I.stemmer),t.searchPipeline.add(I.stemmer),e.call(t,t),t.build()};I.version="2.3.9",I.utils={},I.utils.warn=(s=this,function(e){s.console&&console.warn&&console.warn(e)}),I.utils.asString=function(e){return null==e?"":e.toString()},I.utils.clone=function(e){if(null==e)return e;for(var t=Object.create(null),r=Object.keys(e),i=0;i<r.length;i++){var n=r[i],s=e[n];if(Array.isArray(s))t[n]=s.slice();else{if("string"!=typeof s&&"number"!=typeof s&&"boolean"!=typeof s)throw new TypeError("clone is not deep and does not support nested objects");t[n]=s}}return t},I.FieldRef=function(e,t,r){this.docRef=e,this.fieldName=t,this._stringValue=r},I.FieldRef.joiner="/",I.FieldRef.fromString=function(e){var t=e.indexOf(I.FieldRef.joiner);if(-1===t)throw"malformed field ref string";var r=e.slice(0,t),i=e.slice(t+1);return new I.FieldRef(i,r,e)},I.FieldRef.prototype.toString=function(){return null==this._stringValue&&(this._stringValue=this.fieldName+I.FieldRef.joiner+this.docRef),this._stringValue},I.Set=function(e){if(this.elements=Object.create(null),e){this.length=e.length;for(var t=0;t<this.length;t++)this.elements[e[t]]=!0}else this.length=0},I.Set.complete={intersect:function(e){return e},union:function(){return this},contains:function(){return!0}},I.Set.empty={intersect:function(){return this},union:function(e){return e},contains:function(){return!1}},I.Set.prototype.contains=function(e){return!!this.elements[e]},I.Set.prototype.intersect=function(e){var t,r,i,n=[];if(e===I.Set.complete)return this;if(e===I.Set.empty)return e;this.length<e.length?(t=this,r=e):(t=e,r=this),i=Object.keys(t.elements);for(var s=0;s<i.length;s++){var o=i[s];o in r.elements&&n.push(o)}return new I.Set(n)},I.Set.prototype.union=function(e){return e===I.Set.complete?I.Set.complete:e===I.Set.empty?this:new I.Set(Object.keys(this.elements).concat(Object.keys(e.elements)))},I.idf=function(e,t){var r=0;for(var i in e)"_index"!=i&&(r+=Object.keys(e[i]).length);var n=(t-r+.5)/(r+.5);return Math.log(1+Math.abs(n))},I.Token=function(e,t){this.str=e||"",this.metadata=t||{}},I.Token.prototype.toString=function(){return this.str},I.Token.prototype.update=function(e){return this.str=e(this.str,this.metadata),this},I.Token.prototype.clone=function(e){return e=e||function(e){return e},new I.Token(e(this.str,this.metadata),this.metadata)},I.tokenizer=function(e,t){if(null==e||null==e)return[];if(Array.isArray(e))return e.map((function(e){return new I.Token(I.utils.asString(e).toLowerCase(),I.utils.clone(t))}));for(var r=e.toString().toLowerCase(),i=r.length,n=[],s=0,o=0;s<=i;s++){var a=s-o;if(r.charAt(s).match(I.tokenizer.separator)||s==i){if(a>0){var u=I.utils.clone(t)||{};u.position=[o,a],u.index=n.length,n.push(new I.Token(r.slice(o,s),u))}o=s+1}}return n},I.tokenizer.separator=/[\s\-]+/,I.Pipeline=function(){this._stack=[]},I.Pipeline.registeredFunctions=Object.create(null),I.Pipeline.registerFunction=function(e,t){t in this.registeredFunctions&&I.utils.warn("Overwriting existing registered function: "+t),e.label=t,I.Pipeline.registeredFunctions[e.label]=e},I.Pipeline.warnIfFunctionNotRegistered=function(e){e.label&&e.label in this.registeredFunctions||I.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},I.Pipeline.load=function(e){var t=new I.Pipeline;return e.forEach((function(e){var r=I.Pipeline.registeredFunctions[e];if(!r)throw new Error("Cannot load unregistered function: "+e);t.add(r)})),t},I.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach((function(e){I.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)}),this)},I.Pipeline.prototype.after=function(e,t){I.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");r+=1,this._stack.splice(r,0,t)},I.Pipeline.prototype.before=function(e,t){I.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");this._stack.splice(r,0,t)},I.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);-1!=t&&this._stack.splice(t,1)},I.Pipeline.prototype.run=function(e){for(var t=this._stack.length,r=0;r<t;r++){for(var i=this._stack[r],n=[],s=0;s<e.length;s++){var o=i(e[s],s,e);if(null!=o&&""!==o)if(Array.isArray(o))for(var a=0;a<o.length;a++)n.push(o[a]);else n.push(o)}e=n}return e},I.Pipeline.prototype.runString=function(e,t){var r=new I.Token(e,t);return this.run([r]).map((function(e){return e.toString()}))},I.Pipeline.prototype.reset=function(){this._stack=[]},I.Pipeline.prototype.toJSON=function(){return this._stack.map((function(e){return I.Pipeline.warnIfFunctionNotRegistered(e),e.label}))},I.Vector=function(e){this._magnitude=0,this.elements=e||[]},I.Vector.prototype.positionForIndex=function(e){if(0==this.elements.length)return 0;for(var t=0,r=this.elements.length/2,i=r-t,n=Math.floor(i/2),s=this.elements[2*n];i>1&&(s<e&&(t=n),s>e&&(r=n),s!=e);)i=r-t,n=t+Math.floor(i/2),s=this.elements[2*n];return s==e||s>e?2*n:s<e?2*(n+1):void 0},I.Vector.prototype.insert=function(e,t){this.upsert(e,t,(function(){throw"duplicate index"}))},I.Vector.prototype.upsert=function(e,t,r){this._magnitude=0;var i=this.positionForIndex(e);this.elements[i]==e?this.elements[i+1]=r(this.elements[i+1],t):this.elements.splice(i,0,e,t)},I.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var e=0,t=this.elements.length,r=1;r<t;r+=2){var i=this.elements[r];e+=i*i}return this._magnitude=Math.sqrt(e)},I.Vector.prototype.dot=function(e){for(var t=0,r=this.elements,i=e.elements,n=r.length,s=i.length,o=0,a=0,u=0,l=0;u<n&&l<s;)(o=r[u])<(a=i[l])?u+=2:o>a?l+=2:o==a&&(t+=r[u+1]*i[l+1],u+=2,l+=2);return t},I.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},I.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),t=1,r=0;t<this.elements.length;t+=2,r++)e[r]=this.elements[t];return e},I.Vector.prototype.toJSON=function(){return this.elements},I.stemmer=(o={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"},a={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},u="[aeiouy]",l="[^aeiou][^aeiouy]*",c=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),h=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),d=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$"),f=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy]"),p=/^(.+?)(ss|i)es$/,y=/^(.+?)([^s])s$/,m=/^(.+?)eed$/,g=/^(.+?)(ed|ing)$/,x=/.$/,R=/(at|bl|iz)$/,v=new RegExp("([^aeiouylsz])\\1$"),w=new RegExp("^"+l+u+"[^aeiouwxy]$"),Q=/^(.+?[^aeiou])y$/,k=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,S=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,E=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,b=/^(.+?)(s|t)(ion)$/,L=/^(.+?)e$/,P=/ll$/,T=new RegExp("^"+l+u+"[^aeiouwxy]$"),O=function(e){var t,r,i,n,s,u,l;if(e.length<3)return e;if("y"==(i=e.substr(0,1))&&(e=i.toUpperCase()+e.substr(1)),s=y,(n=p).test(e)?e=e.replace(n,"$1$2"):s.test(e)&&(e=e.replace(s,"$1$2")),s=g,(n=m).test(e)){var O=n.exec(e);(n=c).test(O[1])&&(n=x,e=e.replace(n,""))}else s.test(e)&&(t=(O=s.exec(e))[1],(s=f).test(t)&&(u=v,l=w,(s=R).test(e=t)?e+="e":u.test(e)?(n=x,e=e.replace(n,"")):l.test(e)&&(e+="e")));return(n=Q).test(e)&&(e=(t=(O=n.exec(e))[1])+"i"),(n=k).test(e)&&(t=(O=n.exec(e))[1],r=O[2],(n=c).test(t)&&(e=t+o[r])),(n=S).test(e)&&(t=(O=n.exec(e))[1],r=O[2],(n=c).test(t)&&(e=t+a[r])),s=b,(n=E).test(e)?(t=(O=n.exec(e))[1],(n=h).test(t)&&(e=t)):s.test(e)&&(t=(O=s.exec(e))[1]+O[2],(s=h).test(t)&&(e=t)),(n=L).test(e)&&(t=(O=n.exec(e))[1],s=d,u=T,((n=h).test(t)||s.test(t)&&!u.test(t))&&(e=t)),s=h,(n=P).test(e)&&s.test(e)&&(n=x,e=e.replace(n,"")),"y"==i&&(e=i.toLowerCase()+e.substr(1)),e},function(e){return e.update(O)}),I.Pipeline.registerFunction(I.stemmer,"stemmer"),I.generateStopWordFilter=function(e){var t=e.reduce((function(e,t){return e[t]=t,e}),{});return function(e){if(e&&t[e.toString()]!==e.toString())return e}},I.stopWordFilter=I.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"]),I.Pipeline.registerFunction(I.stopWordFilter,"stopWordFilter"),I.trimmer=function(e){return e.update((function(e){return e.replace(/^\W+/,"").replace(/\W+$/,"")}))},I.Pipeline.registerFunction(I.trimmer,"trimmer"),I.TokenSet=function(){this.final=!1,this.edges={},this.id=I.TokenSet._nextId,I.TokenSet._nextId+=1},I.TokenSet._nextId=1,I.TokenSet.fromArray=function(e){for(var t=new I.TokenSet.Builder,r=0,i=e.length;r<i;r++)t.insert(e[r]);return t.finish(),t.root},I.TokenSet.fromClause=function(e){return"editDistance"in e?I.TokenSet.fromFuzzyString(e.term,e.editDistance):I.TokenSet.fromString(e.term)},I.TokenSet.fromFuzzyString=function(e,t){for(var r=new I.TokenSet,i=[{node:r,editsRemaining:t,str:e}];i.length;){var n=i.pop();if(n.str.length>0){var s,o=n.str.charAt(0);o in n.node.edges?s=n.node.edges[o]:(s=new I.TokenSet,n.node.edges[o]=s),1==n.str.length&&(s.final=!0),i.push({node:s,editsRemaining:n.editsRemaining,str:n.str.slice(1)})}if(0!=n.editsRemaining){if("*"in n.node.edges)var a=n.node.edges["*"];else a=new I.TokenSet,n.node.edges["*"]=a;if(0==n.str.length&&(a.final=!0),i.push({node:a,editsRemaining:n.editsRemaining-1,str:n.str}),n.str.length>1&&i.push({node:n.node,editsRemaining:n.editsRemaining-1,str:n.str.slice(1)}),1==n.str.length&&(n.node.final=!0),n.str.length>=1){if("*"in n.node.edges)var u=n.node.edges["*"];else u=new I.TokenSet,n.node.edges["*"]=u;1==n.str.length&&(u.final=!0),i.push({node:u,editsRemaining:n.editsRemaining-1,str:n.str.slice(1)})}if(n.str.length>1){var l,c=n.str.charAt(0),h=n.str.charAt(1);h in n.node.edges?l=n.node.edges[h]:(l=new I.TokenSet,n.node.edges[h]=l),1==n.str.length&&(l.final=!0),i.push({node:l,editsRemaining:n.editsRemaining-1,str:c+n.str.slice(2)})}}}return r},I.TokenSet.fromString=function(e){for(var t=new I.TokenSet,r=t,i=0,n=e.length;i<n;i++){var s=e[i],o=i==n-1;if("*"==s)t.edges[s]=t,t.final=o;else{var a=new I.TokenSet;a.final=o,t.edges[s]=a,t=a}}return r},I.TokenSet.prototype.toArray=function(){for(var e=[],t=[{prefix:"",node:this}];t.length;){var r=t.pop(),i=Object.keys(r.node.edges),n=i.length;r.node.final&&(r.prefix.charAt(0),e.push(r.prefix));for(var s=0;s<n;s++){var o=i[s];t.push({prefix:r.prefix.concat(o),node:r.node.edges[o]})}}return e},I.TokenSet.prototype.toString=function(){if(this._str)return this._str;for(var e=this.final?"1":"0",t=Object.keys(this.edges).sort(),r=t.length,i=0;i<r;i++){var n=t[i];e=e+n+this.edges[n].id}return e},I.TokenSet.prototype.intersect=function(e){for(var t=new I.TokenSet,r=void 0,i=[{qNode:e,output:t,node:this}];i.length;){r=i.pop();for(var n=Object.keys(r.qNode.edges),s=n.length,o=Object.keys(r.node.edges),a=o.length,u=0;u<s;u++)for(var l=n[u],c=0;c<a;c++){var h=o[c];if(h==l||"*"==l){var d=r.node.edges[h],f=r.qNode.edges[l],p=d.final&&f.final,y=void 0;h in r.output.edges?(y=r.output.edges[h]).final=y.final||p:((y=new I.TokenSet).final=p,r.output.edges[h]=y),i.push({qNode:f,output:y,node:d})}}}return t},I.TokenSet.Builder=function(){this.previousWord="",this.root=new I.TokenSet,this.uncheckedNodes=[],this.minimizedNodes={}},I.TokenSet.Builder.prototype.insert=function(e){var t,r=0;if(e<this.previousWord)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++)r++;for(this.minimize(r),t=0==this.uncheckedNodes.length?this.root:this.uncheckedNodes[this.uncheckedNodes.length-1].child,i=r;i<e.length;i++){var n=new I.TokenSet,s=e[i];t.edges[s]=n,this.uncheckedNodes.push({parent:t,char:s,child:n}),t=n}t.final=!0,this.previousWord=e},I.TokenSet.Builder.prototype.finish=function(){this.minimize(0)},I.TokenSet.Builder.prototype.minimize=function(e){for(var t=this.uncheckedNodes.length-1;t>=e;t--){var r=this.uncheckedNodes[t],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}},I.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},I.Index.prototype.search=function(e){return this.query((function(t){new I.QueryParser(e,t).parse()}))},I.Index.prototype.query=function(e){for(var t=new I.Query(this.fields),r=Object.create(null),i=Object.create(null),n=Object.create(null),s=Object.create(null),o=Object.create(null),a=0;a<this.fields.length;a++)i[this.fields[a]]=new I.Vector;for(e.call(t,t),a=0;a<t.clauses.length;a++){var u,l=t.clauses[a],c=I.Set.empty;u=l.usePipeline?this.pipeline.runString(l.term,{fields:l.fields}):[l.term];for(var h=0;h<u.length;h++){var d=u[h];l.term=d;var f=I.TokenSet.fromClause(l),p=this.tokenSet.intersect(f).toArray();if(0===p.length&&l.presence===I.Query.presence.REQUIRED){for(var y=0;y<l.fields.length;y++)s[F=l.fields[y]]=I.Set.empty;break}for(var m=0;m<p.length;m++){var g=p[m],x=this.invertedIndex[g],R=x._index;for(y=0;y<l.fields.length;y++){var v=x[F=l.fields[y]],w=Object.keys(v),Q=g+"/"+F,k=new I.Set(w);if(l.presence==I.Query.presence.REQUIRED&&(c=c.union(k),void 0===s[F]&&(s[F]=I.Set.complete)),l.presence!=I.Query.presence.PROHIBITED){if(i[F].upsert(R,l.boost,(function(e,t){return e+t})),!n[Q]){for(var S=0;S<w.length;S++){var E,b=w[S],L=new I.FieldRef(b,F),P=v[b];void 0===(E=r[L])?r[L]=new I.MatchData(g,F,P):E.add(g,F,P)}n[Q]=!0}}else void 0===o[F]&&(o[F]=I.Set.empty),o[F]=o[F].union(k)}}}if(l.presence===I.Query.presence.REQUIRED)for(y=0;y<l.fields.length;y++)s[F=l.fields[y]]=s[F].intersect(c)}var T=I.Set.complete,O=I.Set.empty;for(a=0;a<this.fields.length;a++){var F;s[F=this.fields[a]]&&(T=T.intersect(s[F])),o[F]&&(O=O.union(o[F]))}var C=Object.keys(r),j=[],N=Object.create(null);if(t.isNegated())for(C=Object.keys(this.fieldVectors),a=0;a<C.length;a++){L=C[a];var _=I.FieldRef.fromString(L);r[L]=new I.MatchData}for(a=0;a<C.length;a++){var D=(_=I.FieldRef.fromString(C[a])).docRef;if(T.contains(D)&&!O.contains(D)){var A,B=this.fieldVectors[_],V=i[_.fieldName].similarity(B);if(void 0!==(A=N[D]))A.score+=V,A.matchData.combine(r[_]);else{var z={ref:D,score:V,matchData:r[_]};N[D]=z,j.push(z)}}}return j.sort((function(e,t){return t.score-e.score}))},I.Index.prototype.toJSON=function(){var e=Object.keys(this.invertedIndex).sort().map((function(e){return[e,this.invertedIndex[e]]}),this),t=Object.keys(this.fieldVectors).map((function(e){return[e,this.fieldVectors[e].toJSON()]}),this);return{version:I.version,fields:this.fields,fieldVectors:t,invertedIndex:e,pipeline:this.pipeline.toJSON()}},I.Index.load=function(e){var t={},r={},i=e.fieldVectors,n=Object.create(null),s=e.invertedIndex,o=new I.TokenSet.Builder,a=I.Pipeline.load(e.pipeline);e.version!=I.version&&I.utils.warn("Version mismatch when loading serialised index. Current version of lunr '"+I.version+"' does not match serialized index '"+e.version+"'");for(var u=0;u<i.length;u++){var l=(h=i[u])[0],c=h[1];r[l]=new I.Vector(c)}for(u=0;u<s.length;u++){var h,d=(h=s[u])[0],f=h[1];o.insert(d),n[d]=f}return o.finish(),t.fields=e.fields,t.fieldVectors=r,t.invertedIndex=n,t.tokenSet=o.root,t.pipeline=a,new I.Index(t)},I.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=I.tokenizer,this.pipeline=new I.Pipeline,this.searchPipeline=new I.Pipeline,this.documentCount=0,this._b=.75,this._k1=1.2,this.termIndex=0,this.metadataWhitelist=[]},I.Builder.prototype.ref=function(e){this._ref=e},I.Builder.prototype.field=function(e,t){if(/\//.test(e))throw new RangeError("Field '"+e+"' contains illegal character '/'");this._fields[e]=t||{}},I.Builder.prototype.b=function(e){this._b=e<0?0:e>1?1:e},I.Builder.prototype.k1=function(e){this._k1=e},I.Builder.prototype.add=function(e,t){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=t||{},this.documentCount+=1;for(var n=0;n<i.length;n++){var s=i[n],o=this._fields[s].extractor,a=o?o(e):e[s],u=this.tokenizer(a,{fields:[s]}),l=this.pipeline.run(u),c=new I.FieldRef(r,s),h=Object.create(null);this.fieldTermFrequencies[c]=h,this.fieldLengths[c]=0,this.fieldLengths[c]+=l.length;for(var d=0;d<l.length;d++){var f=l[d];if(null==h[f]&&(h[f]=0),h[f]+=1,null==this.invertedIndex[f]){var p=Object.create(null);p._index=this.termIndex,this.termIndex+=1;for(var y=0;y<i.length;y++)p[i[y]]=Object.create(null);this.invertedIndex[f]=p}null==this.invertedIndex[f][s][r]&&(this.invertedIndex[f][s][r]=Object.create(null));for(var m=0;m<this.metadataWhitelist.length;m++){var g=this.metadataWhitelist[m],x=f.metadata[g];null==this.invertedIndex[f][s][r][g]&&(this.invertedIndex[f][s][r][g]=[]),this.invertedIndex[f][s][r][g].push(x)}}}},I.Builder.prototype.calculateAverageFieldLengths=function(){for(var e=Object.keys(this.fieldLengths),t=e.length,r={},i={},n=0;n<t;n++){var s=I.FieldRef.fromString(e[n]),o=s.fieldName;i[o]||(i[o]=0),i[o]+=1,r[o]||(r[o]=0),r[o]+=this.fieldLengths[s]}var a=Object.keys(this._fields);for(n=0;n<a.length;n++){var u=a[n];r[u]=r[u]/i[u]}this.averageFieldLength=r},I.Builder.prototype.createFieldVectors=function(){for(var e={},t=Object.keys(this.fieldTermFrequencies),r=t.length,i=Object.create(null),n=0;n<r;n++){for(var s=I.FieldRef.fromString(t[n]),o=s.fieldName,a=this.fieldLengths[s],u=new I.Vector,l=this.fieldTermFrequencies[s],c=Object.keys(l),h=c.length,d=this._fields[o].boost||1,f=this._documents[s.docRef].boost||1,p=0;p<h;p++){var y,m,g,x=c[p],R=l[x],v=this.invertedIndex[x]._index;void 0===i[x]?(y=I.idf(this.invertedIndex[x],this.documentCount),i[x]=y):y=i[x],m=y*((this._k1+1)*R)/(this._k1*(1-this._b+this._b*(a/this.averageFieldLength[o]))+R),m*=d,m*=f,g=Math.round(1e3*m)/1e3,u.insert(v,g)}e[s]=u}this.fieldVectors=e},I.Builder.prototype.createTokenSet=function(){this.tokenSet=I.TokenSet.fromArray(Object.keys(this.invertedIndex).sort())},I.Builder.prototype.build=function(){return this.calculateAverageFieldLengths(),this.createFieldVectors(),this.createTokenSet(),new I.Index({invertedIndex:this.invertedIndex,fieldVectors:this.fieldVectors,tokenSet:this.tokenSet,fields:Object.keys(this._fields),pipeline:this.searchPipeline})},I.Builder.prototype.use=function(e){var t=Array.prototype.slice.call(arguments,1);t.unshift(this),e.apply(this,t)},I.MatchData=function(e,t,r){for(var i=Object.create(null),n=Object.keys(r||{}),s=0;s<n.length;s++){var o=n[s];i[o]=r[o].slice()}this.metadata=Object.create(null),void 0!==e&&(this.metadata[e]=Object.create(null),this.metadata[e][t]=i)},I.MatchData.prototype.combine=function(e){for(var t=Object.keys(e.metadata),r=0;r<t.length;r++){var i=t[r],n=Object.keys(e.metadata[i]);null==this.metadata[i]&&(this.metadata[i]=Object.create(null));for(var s=0;s<n.length;s++){var o=n[s],a=Object.keys(e.metadata[i][o]);null==this.metadata[i][o]&&(this.metadata[i][o]=Object.create(null));for(var u=0;u<a.length;u++){var l=a[u];null==this.metadata[i][o][l]?this.metadata[i][o][l]=e.metadata[i][o][l]:this.metadata[i][o][l]=this.metadata[i][o][l].concat(e.metadata[i][o][l])}}}},I.MatchData.prototype.add=function(e,t,r){if(!(e in this.metadata))return this.metadata[e]=Object.create(null),void(this.metadata[e][t]=r);if(t in this.metadata[e])for(var i=Object.keys(r),n=0;n<i.length;n++){var s=i[n];s in this.metadata[e][t]?this.metadata[e][t][s]=this.metadata[e][t][s].concat(r[s]):this.metadata[e][t][s]=r[s]}else this.metadata[e][t]=r},I.Query=function(e){this.clauses=[],this.allFields=e},I.Query.wildcard=new String("*"),I.Query.wildcard.NONE=0,I.Query.wildcard.LEADING=1,I.Query.wildcard.TRAILING=2,I.Query.presence={OPTIONAL:1,REQUIRED:2,PROHIBITED:3},I.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=I.Query.wildcard.NONE),e.wildcard&I.Query.wildcard.LEADING&&e.term.charAt(0)!=I.Query.wildcard&&(e.term="*"+e.term),e.wildcard&I.Query.wildcard.TRAILING&&e.term.slice(-1)!=I.Query.wildcard&&(e.term=e.term+"*"),"presence"in e||(e.presence=I.Query.presence.OPTIONAL),this.clauses.push(e),this},I.Query.prototype.isNegated=function(){for(var e=0;e<this.clauses.length;e++)if(this.clauses[e].presence!=I.Query.presence.PROHIBITED)return!1;return!0},I.Query.prototype.term=function(e,t){if(Array.isArray(e))return e.forEach((function(e){this.term(e,I.utils.clone(t))}),this),this;var r=t||{};return r.term=e.toString(),this.clause(r),this},I.QueryParseError=function(e,t,r){this.name="QueryParseError",this.message=e,this.start=t,this.end=r},I.QueryParseError.prototype=new Error,I.QueryLexer=function(e){this.lexemes=[],this.str=e,this.length=e.length,this.pos=0,this.start=0,this.escapeCharPositions=[]},I.QueryLexer.prototype.run=function(){for(var e=I.QueryLexer.lexText;e;)e=e(this)},I.QueryLexer.prototype.sliceString=function(){for(var e=[],t=this.start,r=this.pos,i=0;i<this.escapeCharPositions.length;i++)r=this.escapeCharPositions[i],e.push(this.str.slice(t,r)),t=r+1;return e.push(this.str.slice(t,this.pos)),this.escapeCharPositions.length=0,e.join("")},I.QueryLexer.prototype.emit=function(e){this.lexemes.push({type:e,str:this.sliceString(),start:this.start,end:this.pos}),this.start=this.pos},I.QueryLexer.prototype.escapeCharacter=function(){this.escapeCharPositions.push(this.pos-1),this.pos+=1},I.QueryLexer.prototype.next=function(){if(this.pos>=this.length)return I.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},I.QueryLexer.prototype.width=function(){return this.pos-this.start},I.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},I.QueryLexer.prototype.backup=function(){this.pos-=1},I.QueryLexer.prototype.acceptDigitRun=function(){var e,t;do{t=(e=this.next()).charCodeAt(0)}while(t>47&&t<58);e!=I.QueryLexer.EOS&&this.backup()},I.QueryLexer.prototype.more=function(){return this.pos<this.length},I.QueryLexer.EOS="EOS",I.QueryLexer.FIELD="FIELD",I.QueryLexer.TERM="TERM",I.QueryLexer.EDIT_DISTANCE="EDIT_DISTANCE",I.QueryLexer.BOOST="BOOST",I.QueryLexer.PRESENCE="PRESENCE",I.QueryLexer.lexField=function(e){return e.backup(),e.emit(I.QueryLexer.FIELD),e.ignore(),I.QueryLexer.lexText},I.QueryLexer.lexTerm=function(e){if(e.width()>1&&(e.backup(),e.emit(I.QueryLexer.TERM)),e.ignore(),e.more())return I.QueryLexer.lexText},I.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(I.QueryLexer.EDIT_DISTANCE),I.QueryLexer.lexText},I.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(I.QueryLexer.BOOST),I.QueryLexer.lexText},I.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(I.QueryLexer.TERM)},I.QueryLexer.termSeparator=I.tokenizer.separator,I.QueryLexer.lexText=function(e){for(;;){var t=e.next();if(t==I.QueryLexer.EOS)return I.QueryLexer.lexEOS;if(92!=t.charCodeAt(0)){if(":"==t)return I.QueryLexer.lexField;if("~"==t)return e.backup(),e.width()>0&&e.emit(I.QueryLexer.TERM),I.QueryLexer.lexEditDistance;if("^"==t)return e.backup(),e.width()>0&&e.emit(I.QueryLexer.TERM),I.QueryLexer.lexBoost;if("+"==t&&1===e.width())return e.emit(I.QueryLexer.PRESENCE),I.QueryLexer.lexText;if("-"==t&&1===e.width())return e.emit(I.QueryLexer.PRESENCE),I.QueryLexer.lexText;if(t.match(I.QueryLexer.termSeparator))return I.QueryLexer.lexTerm}else e.escapeCharacter()}},I.QueryParser=function(e,t){this.lexer=new I.QueryLexer(e),this.query=t,this.currentClause={},this.lexemeIdx=0},I.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=I.QueryParser.parseClause;e;)e=e(this);return this.query},I.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},I.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},I.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},I.QueryParser.parseClause=function(e){var t=e.peekLexeme();if(null!=t)switch(t.type){case I.QueryLexer.PRESENCE:return I.QueryParser.parsePresence;case I.QueryLexer.FIELD:return I.QueryParser.parseField;case I.QueryLexer.TERM:return I.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+t.type;throw t.str.length>=1&&(r+=" with value '"+t.str+"'"),new I.QueryParseError(r,t.start,t.end)}},I.QueryParser.parsePresence=function(e){var t=e.consumeLexeme();if(null!=t){switch(t.str){case"-":e.currentClause.presence=I.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=I.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+t.str+"'";throw new I.QueryParseError(r,t.start,t.end)}var i=e.peekLexeme();if(null==i)throw r="expecting term or field, found nothing",new I.QueryParseError(r,t.start,t.end);switch(i.type){case I.QueryLexer.FIELD:return I.QueryParser.parseField;case I.QueryLexer.TERM:return I.QueryParser.parseTerm;default:throw r="expecting term or field, found '"+i.type+"'",new I.QueryParseError(r,i.start,i.end)}}},I.QueryParser.parseField=function(e){var t=e.consumeLexeme();if(null!=t){if(-1==e.query.allFields.indexOf(t.str)){var r=e.query.allFields.map((function(e){return"'"+e+"'"})).join(", "),i="unrecognised field '"+t.str+"', possible fields: "+r;throw new I.QueryParseError(i,t.start,t.end)}e.currentClause.fields=[t.str];var n=e.peekLexeme();if(null==n)throw i="expecting term, found nothing",new I.QueryParseError(i,t.start,t.end);if(n.type===I.QueryLexer.TERM)return I.QueryParser.parseTerm;throw i="expecting term, found '"+n.type+"'",new I.QueryParseError(i,n.start,n.end)}},I.QueryParser.parseTerm=function(e){var t=e.consumeLexeme();if(null!=t){e.currentClause.term=t.str.toLowerCase(),-1!=t.str.indexOf("*")&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(null!=r)switch(r.type){case I.QueryLexer.TERM:return e.nextClause(),I.QueryParser.parseTerm;case I.QueryLexer.FIELD:return e.nextClause(),I.QueryParser.parseField;case I.QueryLexer.EDIT_DISTANCE:return I.QueryParser.parseEditDistance;case I.QueryLexer.BOOST:return I.QueryParser.parseBoost;case I.QueryLexer.PRESENCE:return e.nextClause(),I.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new I.QueryParseError(i,r.start,r.end)}else e.nextClause()}},I.QueryParser.parseEditDistance=function(e){var t=e.consumeLexeme();if(null!=t){var r=parseInt(t.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new I.QueryParseError(i,t.start,t.end)}e.currentClause.editDistance=r;var n=e.peekLexeme();if(null!=n)switch(n.type){case I.QueryLexer.TERM:return e.nextClause(),I.QueryParser.parseTerm;case I.QueryLexer.FIELD:return e.nextClause(),I.QueryParser.parseField;case I.QueryLexer.EDIT_DISTANCE:return I.QueryParser.parseEditDistance;case I.QueryLexer.BOOST:return I.QueryParser.parseBoost;case I.QueryLexer.PRESENCE:return e.nextClause(),I.QueryParser.parsePresence;default:throw i="Unexpected lexeme type '"+n.type+"'",new I.QueryParseError(i,n.start,n.end)}else e.nextClause()}},I.QueryParser.parseBoost=function(e){var t=e.consumeLexeme();if(null!=t){var r=parseInt(t.str,10);if(isNaN(r)){var i="boost must be numeric";throw new I.QueryParseError(i,t.start,t.end)}e.currentClause.boost=r;var n=e.peekLexeme();if(null!=n)switch(n.type){case I.QueryLexer.TERM:return e.nextClause(),I.QueryParser.parseTerm;case I.QueryLexer.FIELD:return e.nextClause(),I.QueryParser.parseField;case I.QueryLexer.EDIT_DISTANCE:return I.QueryParser.parseEditDistance;case I.QueryLexer.BOOST:return I.QueryParser.parseBoost;case I.QueryLexer.PRESENCE:return e.nextClause(),I.QueryParser.parsePresence;default:throw i="Unexpected lexeme type '"+n.type+"'",new I.QueryParseError(i,n.start,n.end)}else e.nextClause()}},void 0===(n="function"==typeof(i=function(){return I})?i.call(t,r,t,e):i)||(e.exports=n)}()},567:(e,t,r)=>{var i=r(314),n=["add","done","toJS","fromExternalJS","load","dispose","search","Worker"];e.exports=function(){var e=new Worker(URL.createObjectURL(new Blob(['/*! For license information please see 1a77c0465d2508da59cb.worker.js.LICENSE.txt */\n(()=>{var e={336:(e,t,r)=>{var i,n;!function(){var s,o,a,u,l,c,h,d,f,p,y,m,g,x,v,w,Q,k,S,E,P,L,b,T,O,I,R=function(e){var t=new R.Builder;return t.pipeline.add(R.trimmer,R.stopWordFilter,R.stemmer),t.searchPipeline.add(R.stemmer),e.call(t,t),t.build()};R.version="2.3.9",R.utils={},R.utils.warn=(s=this,function(e){s.console&&console.warn&&console.warn(e)}),R.utils.asString=function(e){return null==e?"":e.toString()},R.utils.clone=function(e){if(null==e)return e;for(var t=Object.create(null),r=Object.keys(e),i=0;i<r.length;i++){var n=r[i],s=e[n];if(Array.isArray(s))t[n]=s.slice();else{if("string"!=typeof s&&"number"!=typeof s&&"boolean"!=typeof s)throw new TypeError("clone is not deep and does not support nested objects");t[n]=s}}return t},R.FieldRef=function(e,t,r){this.docRef=e,this.fieldName=t,this._stringValue=r},R.FieldRef.joiner="/",R.FieldRef.fromString=function(e){var t=e.indexOf(R.FieldRef.joiner);if(-1===t)throw"malformed field ref string";var r=e.slice(0,t),i=e.slice(t+1);return new R.FieldRef(i,r,e)},R.FieldRef.prototype.toString=function(){return null==this._stringValue&&(this._stringValue=this.fieldName+R.FieldRef.joiner+this.docRef),this._stringValue},R.Set=function(e){if(this.elements=Object.create(null),e){this.length=e.length;for(var t=0;t<this.length;t++)this.elements[e[t]]=!0}else this.length=0},R.Set.complete={intersect:function(e){return e},union:function(){return this},contains:function(){return!0}},R.Set.empty={intersect:function(){return this},union:function(e){return e},contains:function(){return!1}},R.Set.prototype.contains=function(e){return!!this.elements[e]},R.Set.prototype.intersect=function(e){var t,r,i,n=[];if(e===R.Set.complete)return this;if(e===R.Set.empty)return e;this.length<e.length?(t=this,r=e):(t=e,r=this),i=Object.keys(t.elements);for(var s=0;s<i.length;s++){var o=i[s];o in r.elements&&n.push(o)}return new R.Set(n)},R.Set.prototype.union=function(e){return e===R.Set.complete?R.Set.complete:e===R.Set.empty?this:new R.Set(Object.keys(this.elements).concat(Object.keys(e.elements)))},R.idf=function(e,t){var r=0;for(var i in e)"_index"!=i&&(r+=Object.keys(e[i]).length);var n=(t-r+.5)/(r+.5);return Math.log(1+Math.abs(n))},R.Token=function(e,t){this.str=e||"",this.metadata=t||{}},R.Token.prototype.toString=function(){return this.str},R.Token.prototype.update=function(e){return this.str=e(this.str,this.metadata),this},R.Token.prototype.clone=function(e){return e=e||function(e){return e},new R.Token(e(this.str,this.metadata),this.metadata)},R.tokenizer=function(e,t){if(null==e||null==e)return[];if(Array.isArray(e))return e.map((function(e){return new R.Token(R.utils.asString(e).toLowerCase(),R.utils.clone(t))}));for(var r=e.toString().toLowerCase(),i=r.length,n=[],s=0,o=0;s<=i;s++){var a=s-o;if(r.charAt(s).match(R.tokenizer.separator)||s==i){if(a>0){var u=R.utils.clone(t)||{};u.position=[o,a],u.index=n.length,n.push(new R.Token(r.slice(o,s),u))}o=s+1}}return n},R.tokenizer.separator=/[\\s\\-]+/,R.Pipeline=function(){this._stack=[]},R.Pipeline.registeredFunctions=Object.create(null),R.Pipeline.registerFunction=function(e,t){t in this.registeredFunctions&&R.utils.warn("Overwriting existing registered function: "+t),e.label=t,R.Pipeline.registeredFunctions[e.label]=e},R.Pipeline.warnIfFunctionNotRegistered=function(e){e.label&&e.label in this.registeredFunctions||R.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\\n",e)},R.Pipeline.load=function(e){var t=new R.Pipeline;return e.forEach((function(e){var r=R.Pipeline.registeredFunctions[e];if(!r)throw new Error("Cannot load unregistered function: "+e);t.add(r)})),t},R.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach((function(e){R.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)}),this)},R.Pipeline.prototype.after=function(e,t){R.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");r+=1,this._stack.splice(r,0,t)},R.Pipeline.prototype.before=function(e,t){R.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");this._stack.splice(r,0,t)},R.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);-1!=t&&this._stack.splice(t,1)},R.Pipeline.prototype.run=function(e){for(var t=this._stack.length,r=0;r<t;r++){for(var i=this._stack[r],n=[],s=0;s<e.length;s++){var o=i(e[s],s,e);if(null!=o&&""!==o)if(Array.isArray(o))for(var a=0;a<o.length;a++)n.push(o[a]);else n.push(o)}e=n}return e},R.Pipeline.prototype.runString=function(e,t){var r=new R.Token(e,t);return this.run([r]).map((function(e){return e.toString()}))},R.Pipeline.prototype.reset=function(){this._stack=[]},R.Pipeline.prototype.toJSON=function(){return this._stack.map((function(e){return R.Pipeline.warnIfFunctionNotRegistered(e),e.label}))},R.Vector=function(e){this._magnitude=0,this.elements=e||[]},R.Vector.prototype.positionForIndex=function(e){if(0==this.elements.length)return 0;for(var t=0,r=this.elements.length/2,i=r-t,n=Math.floor(i/2),s=this.elements[2*n];i>1&&(s<e&&(t=n),s>e&&(r=n),s!=e);)i=r-t,n=t+Math.floor(i/2),s=this.elements[2*n];return s==e||s>e?2*n:s<e?2*(n+1):void 0},R.Vector.prototype.insert=function(e,t){this.upsert(e,t,(function(){throw"duplicate index"}))},R.Vector.prototype.upsert=function(e,t,r){this._magnitude=0;var i=this.positionForIndex(e);this.elements[i]==e?this.elements[i+1]=r(this.elements[i+1],t):this.elements.splice(i,0,e,t)},R.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var e=0,t=this.elements.length,r=1;r<t;r+=2){var i=this.elements[r];e+=i*i}return this._magnitude=Math.sqrt(e)},R.Vector.prototype.dot=function(e){for(var t=0,r=this.elements,i=e.elements,n=r.length,s=i.length,o=0,a=0,u=0,l=0;u<n&&l<s;)(o=r[u])<(a=i[l])?u+=2:o>a?l+=2:o==a&&(t+=r[u+1]*i[l+1],u+=2,l+=2);return t},R.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},R.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),t=1,r=0;t<this.elements.length;t+=2,r++)e[r]=this.elements[t];return e},R.Vector.prototype.toJSON=function(){return this.elements},R.stemmer=(o={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"},a={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},u="[aeiouy]",l="[^aeiou][^aeiouy]*",c=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),h=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),d=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$"),f=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy]"),p=/^(.+?)(ss|i)es$/,y=/^(.+?)([^s])s$/,m=/^(.+?)eed$/,g=/^(.+?)(ed|ing)$/,x=/.$/,v=/(at|bl|iz)$/,w=new RegExp("([^aeiouylsz])\\\\1$"),Q=new RegExp("^"+l+u+"[^aeiouwxy]$"),k=/^(.+?[^aeiou])y$/,S=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,E=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,P=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,L=/^(.+?)(s|t)(ion)$/,b=/^(.+?)e$/,T=/ll$/,O=new RegExp("^"+l+u+"[^aeiouwxy]$"),I=function(e){var t,r,i,n,s,u,l;if(e.length<3)return e;if("y"==(i=e.substr(0,1))&&(e=i.toUpperCase()+e.substr(1)),s=y,(n=p).test(e)?e=e.replace(n,"$1$2"):s.test(e)&&(e=e.replace(s,"$1$2")),s=g,(n=m).test(e)){var I=n.exec(e);(n=c).test(I[1])&&(n=x,e=e.replace(n,""))}else s.test(e)&&(t=(I=s.exec(e))[1],(s=f).test(t)&&(u=w,l=Q,(s=v).test(e=t)?e+="e":u.test(e)?(n=x,e=e.replace(n,"")):l.test(e)&&(e+="e")));return(n=k).test(e)&&(e=(t=(I=n.exec(e))[1])+"i"),(n=S).test(e)&&(t=(I=n.exec(e))[1],r=I[2],(n=c).test(t)&&(e=t+o[r])),(n=E).test(e)&&(t=(I=n.exec(e))[1],r=I[2],(n=c).test(t)&&(e=t+a[r])),s=L,(n=P).test(e)?(t=(I=n.exec(e))[1],(n=h).test(t)&&(e=t)):s.test(e)&&(t=(I=s.exec(e))[1]+I[2],(s=h).test(t)&&(e=t)),(n=b).test(e)&&(t=(I=n.exec(e))[1],s=d,u=O,((n=h).test(t)||s.test(t)&&!u.test(t))&&(e=t)),s=h,(n=T).test(e)&&s.test(e)&&(n=x,e=e.replace(n,"")),"y"==i&&(e=i.toLowerCase()+e.substr(1)),e},function(e){return e.update(I)}),R.Pipeline.registerFunction(R.stemmer,"stemmer"),R.generateStopWordFilter=function(e){var t=e.reduce((function(e,t){return e[t]=t,e}),{});return function(e){if(e&&t[e.toString()]!==e.toString())return e}},R.stopWordFilter=R.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"]),R.Pipeline.registerFunction(R.stopWordFilter,"stopWordFilter"),R.trimmer=function(e){return e.update((function(e){return e.replace(/^\\W+/,"").replace(/\\W+$/,"")}))},R.Pipeline.registerFunction(R.trimmer,"trimmer"),R.TokenSet=function(){this.final=!1,this.edges={},this.id=R.TokenSet._nextId,R.TokenSet._nextId+=1},R.TokenSet._nextId=1,R.TokenSet.fromArray=function(e){for(var t=new R.TokenSet.Builder,r=0,i=e.length;r<i;r++)t.insert(e[r]);return t.finish(),t.root},R.TokenSet.fromClause=function(e){return"editDistance"in e?R.TokenSet.fromFuzzyString(e.term,e.editDistance):R.TokenSet.fromString(e.term)},R.TokenSet.fromFuzzyString=function(e,t){for(var r=new R.TokenSet,i=[{node:r,editsRemaining:t,str:e}];i.length;){var n=i.pop();if(n.str.length>0){var s,o=n.str.charAt(0);o in n.node.edges?s=n.node.edges[o]:(s=new R.TokenSet,n.node.edges[o]=s),1==n.str.length&&(s.final=!0),i.push({node:s,editsRemaining:n.editsRemaining,str:n.str.slice(1)})}if(0!=n.editsRemaining){if("*"in n.node.edges)var a=n.node.edges["*"];else a=new R.TokenSet,n.node.edges["*"]=a;if(0==n.str.length&&(a.final=!0),i.push({node:a,editsRemaining:n.editsRemaining-1,str:n.str}),n.str.length>1&&i.push({node:n.node,editsRemaining:n.editsRemaining-1,str:n.str.slice(1)}),1==n.str.length&&(n.node.final=!0),n.str.length>=1){if("*"in n.node.edges)var u=n.node.edges["*"];else u=new R.TokenSet,n.node.edges["*"]=u;1==n.str.length&&(u.final=!0),i.push({node:u,editsRemaining:n.editsRemaining-1,str:n.str.slice(1)})}if(n.str.length>1){var l,c=n.str.charAt(0),h=n.str.charAt(1);h in n.node.edges?l=n.node.edges[h]:(l=new R.TokenSet,n.node.edges[h]=l),1==n.str.length&&(l.final=!0),i.push({node:l,editsRemaining:n.editsRemaining-1,str:c+n.str.slice(2)})}}}return r},R.TokenSet.fromString=function(e){for(var t=new R.TokenSet,r=t,i=0,n=e.length;i<n;i++){var s=e[i],o=i==n-1;if("*"==s)t.edges[s]=t,t.final=o;else{var a=new R.TokenSet;a.final=o,t.edges[s]=a,t=a}}return r},R.TokenSet.prototype.toArray=function(){for(var e=[],t=[{prefix:"",node:this}];t.length;){var r=t.pop(),i=Object.keys(r.node.edges),n=i.length;r.node.final&&(r.prefix.charAt(0),e.push(r.prefix));for(var s=0;s<n;s++){var o=i[s];t.push({prefix:r.prefix.concat(o),node:r.node.edges[o]})}}return e},R.TokenSet.prototype.toString=function(){if(this._str)return this._str;for(var e=this.final?"1":"0",t=Object.keys(this.edges).sort(),r=t.length,i=0;i<r;i++){var n=t[i];e=e+n+this.edges[n].id}return e},R.TokenSet.prototype.intersect=function(e){for(var t=new R.TokenSet,r=void 0,i=[{qNode:e,output:t,node:this}];i.length;){r=i.pop();for(var n=Object.keys(r.qNode.edges),s=n.length,o=Object.keys(r.node.edges),a=o.length,u=0;u<s;u++)for(var l=n[u],c=0;c<a;c++){var h=o[c];if(h==l||"*"==l){var d=r.node.edges[h],f=r.qNode.edges[l],p=d.final&&f.final,y=void 0;h in r.output.edges?(y=r.output.edges[h]).final=y.final||p:((y=new R.TokenSet).final=p,r.output.edges[h]=y),i.push({qNode:f,output:y,node:d})}}}return t},R.TokenSet.Builder=function(){this.previousWord="",this.root=new R.TokenSet,this.uncheckedNodes=[],this.minimizedNodes={}},R.TokenSet.Builder.prototype.insert=function(e){var t,r=0;if(e<this.previousWord)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++)r++;for(this.minimize(r),t=0==this.uncheckedNodes.length?this.root:this.uncheckedNodes[this.uncheckedNodes.length-1].child,i=r;i<e.length;i++){var n=new R.TokenSet,s=e[i];t.edges[s]=n,this.uncheckedNodes.push({parent:t,char:s,child:n}),t=n}t.final=!0,this.previousWord=e},R.TokenSet.Builder.prototype.finish=function(){this.minimize(0)},R.TokenSet.Builder.prototype.minimize=function(e){for(var t=this.uncheckedNodes.length-1;t>=e;t--){var r=this.uncheckedNodes[t],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}},R.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},R.Index.prototype.search=function(e){return this.query((function(t){new R.QueryParser(e,t).parse()}))},R.Index.prototype.query=function(e){for(var t=new R.Query(this.fields),r=Object.create(null),i=Object.create(null),n=Object.create(null),s=Object.create(null),o=Object.create(null),a=0;a<this.fields.length;a++)i[this.fields[a]]=new R.Vector;for(e.call(t,t),a=0;a<t.clauses.length;a++){var u,l=t.clauses[a],c=R.Set.empty;u=l.usePipeline?this.pipeline.runString(l.term,{fields:l.fields}):[l.term];for(var h=0;h<u.length;h++){var d=u[h];l.term=d;var f=R.TokenSet.fromClause(l),p=this.tokenSet.intersect(f).toArray();if(0===p.length&&l.presence===R.Query.presence.REQUIRED){for(var y=0;y<l.fields.length;y++)s[F=l.fields[y]]=R.Set.empty;break}for(var m=0;m<p.length;m++){var g=p[m],x=this.invertedIndex[g],v=x._index;for(y=0;y<l.fields.length;y++){var w=x[F=l.fields[y]],Q=Object.keys(w),k=g+"/"+F,S=new R.Set(Q);if(l.presence==R.Query.presence.REQUIRED&&(c=c.union(S),void 0===s[F]&&(s[F]=R.Set.complete)),l.presence!=R.Query.presence.PROHIBITED){if(i[F].upsert(v,l.boost,(function(e,t){return e+t})),!n[k]){for(var E=0;E<Q.length;E++){var P,L=Q[E],b=new R.FieldRef(L,F),T=w[L];void 0===(P=r[b])?r[b]=new R.MatchData(g,F,T):P.add(g,F,T)}n[k]=!0}}else void 0===o[F]&&(o[F]=R.Set.empty),o[F]=o[F].union(S)}}}if(l.presence===R.Query.presence.REQUIRED)for(y=0;y<l.fields.length;y++)s[F=l.fields[y]]=s[F].intersect(c)}var O=R.Set.complete,I=R.Set.empty;for(a=0;a<this.fields.length;a++){var F;s[F=this.fields[a]]&&(O=O.intersect(s[F])),o[F]&&(I=I.union(o[F]))}var C=Object.keys(r),N=[],j=Object.create(null);if(t.isNegated())for(C=Object.keys(this.fieldVectors),a=0;a<C.length;a++){b=C[a];var _=R.FieldRef.fromString(b);r[b]=new R.MatchData}for(a=0;a<C.length;a++){var D=(_=R.FieldRef.fromString(C[a])).docRef;if(O.contains(D)&&!I.contains(D)){var A,B=this.fieldVectors[_],z=i[_.fieldName].similarity(B);if(void 0!==(A=j[D]))A.score+=z,A.matchData.combine(r[_]);else{var V={ref:D,score:z,matchData:r[_]};j[D]=V,N.push(V)}}}return N.sort((function(e,t){return t.score-e.score}))},R.Index.prototype.toJSON=function(){var e=Object.keys(this.invertedIndex).sort().map((function(e){return[e,this.invertedIndex[e]]}),this),t=Object.keys(this.fieldVectors).map((function(e){return[e,this.fieldVectors[e].toJSON()]}),this);return{version:R.version,fields:this.fields,fieldVectors:t,invertedIndex:e,pipeline:this.pipeline.toJSON()}},R.Index.load=function(e){var t={},r={},i=e.fieldVectors,n=Object.create(null),s=e.invertedIndex,o=new R.TokenSet.Builder,a=R.Pipeline.load(e.pipeline);e.version!=R.version&&R.utils.warn("Version mismatch when loading serialised index. Current version of lunr \'"+R.version+"\' does not match serialized index \'"+e.version+"\'");for(var u=0;u<i.length;u++){var l=(h=i[u])[0],c=h[1];r[l]=new R.Vector(c)}for(u=0;u<s.length;u++){var h,d=(h=s[u])[0],f=h[1];o.insert(d),n[d]=f}return o.finish(),t.fields=e.fields,t.fieldVectors=r,t.invertedIndex=n,t.tokenSet=o.root,t.pipeline=a,new R.Index(t)},R.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=R.tokenizer,this.pipeline=new R.Pipeline,this.searchPipeline=new R.Pipeline,this.documentCount=0,this._b=.75,this._k1=1.2,this.termIndex=0,this.metadataWhitelist=[]},R.Builder.prototype.ref=function(e){this._ref=e},R.Builder.prototype.field=function(e,t){if(/\\//.test(e))throw new RangeError("Field \'"+e+"\' contains illegal character \'/\'");this._fields[e]=t||{}},R.Builder.prototype.b=function(e){this._b=e<0?0:e>1?1:e},R.Builder.prototype.k1=function(e){this._k1=e},R.Builder.prototype.add=function(e,t){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=t||{},this.documentCount+=1;for(var n=0;n<i.length;n++){var s=i[n],o=this._fields[s].extractor,a=o?o(e):e[s],u=this.tokenizer(a,{fields:[s]}),l=this.pipeline.run(u),c=new R.FieldRef(r,s),h=Object.create(null);this.fieldTermFrequencies[c]=h,this.fieldLengths[c]=0,this.fieldLengths[c]+=l.length;for(var d=0;d<l.length;d++){var f=l[d];if(null==h[f]&&(h[f]=0),h[f]+=1,null==this.invertedIndex[f]){var p=Object.create(null);p._index=this.termIndex,this.termIndex+=1;for(var y=0;y<i.length;y++)p[i[y]]=Object.create(null);this.invertedIndex[f]=p}null==this.invertedIndex[f][s][r]&&(this.invertedIndex[f][s][r]=Object.create(null));for(var m=0;m<this.metadataWhitelist.length;m++){var g=this.metadataWhitelist[m],x=f.metadata[g];null==this.invertedIndex[f][s][r][g]&&(this.invertedIndex[f][s][r][g]=[]),this.invertedIndex[f][s][r][g].push(x)}}}},R.Builder.prototype.calculateAverageFieldLengths=function(){for(var e=Object.keys(this.fieldLengths),t=e.length,r={},i={},n=0;n<t;n++){var s=R.FieldRef.fromString(e[n]),o=s.fieldName;i[o]||(i[o]=0),i[o]+=1,r[o]||(r[o]=0),r[o]+=this.fieldLengths[s]}var a=Object.keys(this._fields);for(n=0;n<a.length;n++){var u=a[n];r[u]=r[u]/i[u]}this.averageFieldLength=r},R.Builder.prototype.createFieldVectors=function(){for(var e={},t=Object.keys(this.fieldTermFrequencies),r=t.length,i=Object.create(null),n=0;n<r;n++){for(var s=R.FieldRef.fromString(t[n]),o=s.fieldName,a=this.fieldLengths[s],u=new R.Vector,l=this.fieldTermFrequencies[s],c=Object.keys(l),h=c.length,d=this._fields[o].boost||1,f=this._documents[s.docRef].boost||1,p=0;p<h;p++){var y,m,g,x=c[p],v=l[x],w=this.invertedIndex[x]._index;void 0===i[x]?(y=R.idf(this.invertedIndex[x],this.documentCount),i[x]=y):y=i[x],m=y*((this._k1+1)*v)/(this._k1*(1-this._b+this._b*(a/this.averageFieldLength[o]))+v),m*=d,m*=f,g=Math.round(1e3*m)/1e3,u.insert(w,g)}e[s]=u}this.fieldVectors=e},R.Builder.prototype.createTokenSet=function(){this.tokenSet=R.TokenSet.fromArray(Object.keys(this.invertedIndex).sort())},R.Builder.prototype.build=function(){return this.calculateAverageFieldLengths(),this.createFieldVectors(),this.createTokenSet(),new R.Index({invertedIndex:this.invertedIndex,fieldVectors:this.fieldVectors,tokenSet:this.tokenSet,fields:Object.keys(this._fields),pipeline:this.searchPipeline})},R.Builder.prototype.use=function(e){var t=Array.prototype.slice.call(arguments,1);t.unshift(this),e.apply(this,t)},R.MatchData=function(e,t,r){for(var i=Object.create(null),n=Object.keys(r||{}),s=0;s<n.length;s++){var o=n[s];i[o]=r[o].slice()}this.metadata=Object.create(null),void 0!==e&&(this.metadata[e]=Object.create(null),this.metadata[e][t]=i)},R.MatchData.prototype.combine=function(e){for(var t=Object.keys(e.metadata),r=0;r<t.length;r++){var i=t[r],n=Object.keys(e.metadata[i]);null==this.metadata[i]&&(this.metadata[i]=Object.create(null));for(var s=0;s<n.length;s++){var o=n[s],a=Object.keys(e.metadata[i][o]);null==this.metadata[i][o]&&(this.metadata[i][o]=Object.create(null));for(var u=0;u<a.length;u++){var l=a[u];null==this.metadata[i][o][l]?this.metadata[i][o][l]=e.metadata[i][o][l]:this.metadata[i][o][l]=this.metadata[i][o][l].concat(e.metadata[i][o][l])}}}},R.MatchData.prototype.add=function(e,t,r){if(!(e in this.metadata))return this.metadata[e]=Object.create(null),void(this.metadata[e][t]=r);if(t in this.metadata[e])for(var i=Object.keys(r),n=0;n<i.length;n++){var s=i[n];s in this.metadata[e][t]?this.metadata[e][t][s]=this.metadata[e][t][s].concat(r[s]):this.metadata[e][t][s]=r[s]}else this.metadata[e][t]=r},R.Query=function(e){this.clauses=[],this.allFields=e},R.Query.wildcard=new String("*"),R.Query.wildcard.NONE=0,R.Query.wildcard.LEADING=1,R.Query.wildcard.TRAILING=2,R.Query.presence={OPTIONAL:1,REQUIRED:2,PROHIBITED:3},R.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=R.Query.wildcard.NONE),e.wildcard&R.Query.wildcard.LEADING&&e.term.charAt(0)!=R.Query.wildcard&&(e.term="*"+e.term),e.wildcard&R.Query.wildcard.TRAILING&&e.term.slice(-1)!=R.Query.wildcard&&(e.term=e.term+"*"),"presence"in e||(e.presence=R.Query.presence.OPTIONAL),this.clauses.push(e),this},R.Query.prototype.isNegated=function(){for(var e=0;e<this.clauses.length;e++)if(this.clauses[e].presence!=R.Query.presence.PROHIBITED)return!1;return!0},R.Query.prototype.term=function(e,t){if(Array.isArray(e))return e.forEach((function(e){this.term(e,R.utils.clone(t))}),this),this;var r=t||{};return r.term=e.toString(),this.clause(r),this},R.QueryParseError=function(e,t,r){this.name="QueryParseError",this.message=e,this.start=t,this.end=r},R.QueryParseError.prototype=new Error,R.QueryLexer=function(e){this.lexemes=[],this.str=e,this.length=e.length,this.pos=0,this.start=0,this.escapeCharPositions=[]},R.QueryLexer.prototype.run=function(){for(var e=R.QueryLexer.lexText;e;)e=e(this)},R.QueryLexer.prototype.sliceString=function(){for(var e=[],t=this.start,r=this.pos,i=0;i<this.escapeCharPositions.length;i++)r=this.escapeCharPositions[i],e.push(this.str.slice(t,r)),t=r+1;return e.push(this.str.slice(t,this.pos)),this.escapeCharPositions.length=0,e.join("")},R.QueryLexer.prototype.emit=function(e){this.lexemes.push({type:e,str:this.sliceString(),start:this.start,end:this.pos}),this.start=this.pos},R.QueryLexer.prototype.escapeCharacter=function(){this.escapeCharPositions.push(this.pos-1),this.pos+=1},R.QueryLexer.prototype.next=function(){if(this.pos>=this.length)return R.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},R.QueryLexer.prototype.width=function(){return this.pos-this.start},R.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},R.QueryLexer.prototype.backup=function(){this.pos-=1},R.QueryLexer.prototype.acceptDigitRun=function(){var e,t;do{t=(e=this.next()).charCodeAt(0)}while(t>47&&t<58);e!=R.QueryLexer.EOS&&this.backup()},R.QueryLexer.prototype.more=function(){return this.pos<this.length},R.QueryLexer.EOS="EOS",R.QueryLexer.FIELD="FIELD",R.QueryLexer.TERM="TERM",R.QueryLexer.EDIT_DISTANCE="EDIT_DISTANCE",R.QueryLexer.BOOST="BOOST",R.QueryLexer.PRESENCE="PRESENCE",R.QueryLexer.lexField=function(e){return e.backup(),e.emit(R.QueryLexer.FIELD),e.ignore(),R.QueryLexer.lexText},R.QueryLexer.lexTerm=function(e){if(e.width()>1&&(e.backup(),e.emit(R.QueryLexer.TERM)),e.ignore(),e.more())return R.QueryLexer.lexText},R.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(R.QueryLexer.EDIT_DISTANCE),R.QueryLexer.lexText},R.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(R.QueryLexer.BOOST),R.QueryLexer.lexText},R.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(R.QueryLexer.TERM)},R.QueryLexer.termSeparator=R.tokenizer.separator,R.QueryLexer.lexText=function(e){for(;;){var t=e.next();if(t==R.QueryLexer.EOS)return R.QueryLexer.lexEOS;if(92!=t.charCodeAt(0)){if(":"==t)return R.QueryLexer.lexField;if("~"==t)return e.backup(),e.width()>0&&e.emit(R.QueryLexer.TERM),R.QueryLexer.lexEditDistance;if("^"==t)return e.backup(),e.width()>0&&e.emit(R.QueryLexer.TERM),R.QueryLexer.lexBoost;if("+"==t&&1===e.width())return e.emit(R.QueryLexer.PRESENCE),R.QueryLexer.lexText;if("-"==t&&1===e.width())return e.emit(R.QueryLexer.PRESENCE),R.QueryLexer.lexText;if(t.match(R.QueryLexer.termSeparator))return R.QueryLexer.lexTerm}else e.escapeCharacter()}},R.QueryParser=function(e,t){this.lexer=new R.QueryLexer(e),this.query=t,this.currentClause={},this.lexemeIdx=0},R.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=R.QueryParser.parseClause;e;)e=e(this);return this.query},R.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},R.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},R.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},R.QueryParser.parseClause=function(e){var t=e.peekLexeme();if(null!=t)switch(t.type){case R.QueryLexer.PRESENCE:return R.QueryParser.parsePresence;case R.QueryLexer.FIELD:return R.QueryParser.parseField;case R.QueryLexer.TERM:return R.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+t.type;throw t.str.length>=1&&(r+=" with value \'"+t.str+"\'"),new R.QueryParseError(r,t.start,t.end)}},R.QueryParser.parsePresence=function(e){var t=e.consumeLexeme();if(null!=t){switch(t.str){case"-":e.currentClause.presence=R.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=R.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator\'"+t.str+"\'";throw new R.QueryParseError(r,t.start,t.end)}var i=e.peekLexeme();if(null==i)throw r="expecting term or field, found nothing",new R.QueryParseError(r,t.start,t.end);switch(i.type){case R.QueryLexer.FIELD:return R.QueryParser.parseField;case R.QueryLexer.TERM:return R.QueryParser.parseTerm;default:throw r="expecting term or field, found \'"+i.type+"\'",new R.QueryParseError(r,i.start,i.end)}}},R.QueryParser.parseField=function(e){var t=e.consumeLexeme();if(null!=t){if(-1==e.query.allFields.indexOf(t.str)){var r=e.query.allFields.map((function(e){return"\'"+e+"\'"})).join(", "),i="unrecognised field \'"+t.str+"\', possible fields: "+r;throw new R.QueryParseError(i,t.start,t.end)}e.currentClause.fields=[t.str];var n=e.peekLexeme();if(null==n)throw i="expecting term, found nothing",new R.QueryParseError(i,t.start,t.end);if(n.type===R.QueryLexer.TERM)return R.QueryParser.parseTerm;throw i="expecting term, found \'"+n.type+"\'",new R.QueryParseError(i,n.start,n.end)}},R.QueryParser.parseTerm=function(e){var t=e.consumeLexeme();if(null!=t){e.currentClause.term=t.str.toLowerCase(),-1!=t.str.indexOf("*")&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(null!=r)switch(r.type){case R.QueryLexer.TERM:return e.nextClause(),R.QueryParser.parseTerm;case R.QueryLexer.FIELD:return e.nextClause(),R.QueryParser.parseField;case R.QueryLexer.EDIT_DISTANCE:return R.QueryParser.parseEditDistance;case R.QueryLexer.BOOST:return R.QueryParser.parseBoost;case R.QueryLexer.PRESENCE:return e.nextClause(),R.QueryParser.parsePresence;default:var i="Unexpected lexeme type \'"+r.type+"\'";throw new R.QueryParseError(i,r.start,r.end)}else e.nextClause()}},R.QueryParser.parseEditDistance=function(e){var t=e.consumeLexeme();if(null!=t){var r=parseInt(t.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new R.QueryParseError(i,t.start,t.end)}e.currentClause.editDistance=r;var n=e.peekLexeme();if(null!=n)switch(n.type){case R.QueryLexer.TERM:return e.nextClause(),R.QueryParser.parseTerm;case R.QueryLexer.FIELD:return e.nextClause(),R.QueryParser.parseField;case R.QueryLexer.EDIT_DISTANCE:return R.QueryParser.parseEditDistance;case R.QueryLexer.BOOST:return R.QueryParser.parseBoost;case R.QueryLexer.PRESENCE:return e.nextClause(),R.QueryParser.parsePresence;default:throw i="Unexpected lexeme type \'"+n.type+"\'",new R.QueryParseError(i,n.start,n.end)}else e.nextClause()}},R.QueryParser.parseBoost=function(e){var t=e.consumeLexeme();if(null!=t){var r=parseInt(t.str,10);if(isNaN(r)){var i="boost must be numeric";throw new R.QueryParseError(i,t.start,t.end)}e.currentClause.boost=r;var n=e.peekLexeme();if(null!=n)switch(n.type){case R.QueryLexer.TERM:return e.nextClause(),R.QueryParser.parseTerm;case R.QueryLexer.FIELD:return e.nextClause(),R.QueryParser.parseField;case R.QueryLexer.EDIT_DISTANCE:return R.QueryParser.parseEditDistance;case R.QueryLexer.BOOST:return R.QueryParser.parseBoost;case R.QueryLexer.PRESENCE:return e.nextClause(),R.QueryParser.parsePresence;default:throw i="Unexpected lexeme type \'"+n.type+"\'",new R.QueryParseError(i,n.start,n.end)}else e.nextClause()}},void 0===(n="function"==typeof(i=function(){return R})?i.call(t,r,t,e):i)||(e.exports=n)}()}},t={};function r(i){var n=t[i];if(void 0!==n)return n.exports;var s=t[i]={exports:{}};return e[i](s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var i={};(()=>{"use strict";r.d(i,{add:()=>l,done:()=>c,toJS:()=>h,fromExternalJS:()=>d,load:()=>f,dispose:()=>p,search:()=>y});var e=r(336),t=(Object.defineProperty,(e,t,r)=>new Promise(((i,n)=>{var s=e=>{try{a(r.next(e))}catch(e){n(e)}},o=e=>{try{a(r.throw(e))}catch(e){n(e)}},a=e=>e.done?i(e.value):Promise.resolve(e.value).then(s,o);a((r=r.apply(e,t)).next())})));let n,s,o,a=[];function u(){n=new e.Builder,n.field("title"),n.field("description"),n.ref("ref"),n.pipeline.add(e.trimmer,e.stopWordFilter,e.stemmer),o=new Promise((e=>{s=e}))}function l(e,t,r){const i=a.push(r)-1,s={title:e.toLowerCase(),description:t.toLowerCase(),ref:i};n.add(s)}function c(){return t(this,null,(function*(){s(n.build())}))}function h(){return t(this,null,(function*(){return{store:a,index:(yield o).toJSON()}}))}function d(e,r){return t(this,null,(function*(){try{if(importScripts(e),!self[r])throw new Error("Broken index file format");yield f(self[r])}catch(e){console.error("Failed to load search index: "+e.message)}}))}function f(r){return t(this,null,(function*(){a=r.store,s(e.Index.load(r.index))}))}function p(){return t(this,null,(function*(){a=[],u()}))}function y(r,i=0){return t(this,null,(function*(){if(0===r.trim().length)return[];let t=(yield o).query((t=>{r.trim().toLowerCase().split(/\\s+/).forEach((r=>{if(1===r.length)return;const i=(t=>"*"+e.stemmer(new e.Token(t,{}))+"*")(r);t.term(i,{})}))}));return i>0&&(t=t.slice(0,i)),t.map((e=>({meta:a[e.ref],score:e.score})))}))}e.tokenizer.separator=/\\s+/,u(),addEventListener("message",(function(e){var t,r=e.data,n=r.type,s=r.method,o=r.id,a=r.params;"RPC"===n&&s&&((t=i[s])?Promise.resolve().then((function(){return t.apply(i,a)})):Promise.reject("No such method")).then((function(e){postMessage({type:"RPC",id:o,result:e})})).catch((function(e){var t={message:e};e.stack&&(t.message=e.message,t.stack=e.stack,t.name=e.name),postMessage({type:"RPC",id:o,error:t})}))})),postMessage({type:"RPC",method:"ready"})})()})();'])),{name:"[fullhash].worker.js"});return i(e,n),e}},314:e=>{e.exports=function(e,t){var r=0,i={};e.addEventListener("message",(function(t){var r=t.data;if("RPC"===r.type)if(r.id){var n=i[r.id];n&&(delete i[r.id],r.error?n[1](Object.assign(Error(r.error.message),r.error)):n[0](r.result))}else{var s=document.createEvent("Event");s.initEvent(r.method,!1,!1),s.data=r.params,e.dispatchEvent(s)}})),t.forEach((function(t){e[t]=function(){var n=arguments;return new Promise((function(s,o){var a=++r;i[a]=[s,o],e.postMessage({type:"RPC",id:a,method:t,params:[].slice.call(n)})}))}}))}}},t={};function r(i){var n=t[i];if(void 0!==n)return n.exports;var s=t[i]={exports:{}};return e[i](s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{"use strict";r.r(i),r.d(i,{SearchStore:()=>n});const e="undefined"!=typeof window&&"HTMLElement"in window;"undefined"==typeof Element||Element.prototype.scrollIntoViewIfNeeded||(Element.prototype.scrollIntoViewIfNeeded=function(e){e=0===arguments.length||!!e;const t=this.parentNode,r=window.getComputedStyle(t,void 0),i=parseInt(r.getPropertyValue("border-top-width"),10),n=parseInt(r.getPropertyValue("border-left-width"),10),s=this.offsetTop-t.offsetTop<t.scrollTop,o=this.offsetTop-t.offsetTop+this.clientHeight-i>t.scrollTop+t.clientHeight,a=this.offsetLeft-t.offsetLeft<t.scrollLeft,u=this.offsetLeft-t.offsetLeft+this.clientWidth-n>t.scrollLeft+t.clientWidth,l=s&&!o;(s||o)&&e&&(t.scrollTop=this.offsetTop-t.offsetTop-t.clientHeight/2-i+this.clientHeight/2),(a||u)&&e&&(t.scrollLeft=this.offsetLeft-t.offsetLeft-t.clientWidth/2-n+this.clientWidth/2),(s||o||a||u)&&!e&&this.scrollIntoView(l)});var t=Object.defineProperty;class n{constructor(){var i,n,s;i=this,n="searchWorker",s=function(){let t;if(e)try{t=r(567)}catch(e){t=r(27).ZP}else t=r(27).ZP;return new t}(),((e,r,i)=>{r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i})(i,"symbol"!=typeof n?n+"":n,s)}indexItems(e){const t=e=>{e.forEach((e=>{"group"!==e.type&&this.add(e.name,e.description||"",e.id),t(e.items)}))};t(e),this.searchWorker.done()}add(e,t,r){this.searchWorker.add(e,t,r)}dispose(){this.searchWorker.terminate(),this.searchWorker.dispose()}search(e){return this.searchWorker.search(e)}toJS(){return e=this,null,t=function*(){return this.searchWorker.toJS()},new Promise(((r,i)=>{var n=e=>{try{o(t.next(e))}catch(e){i(e)}},s=e=>{try{o(t.throw(e))}catch(e){i(e)}},o=e=>e.done?r(e.value):Promise.resolve(e.value).then(n,s);o((t=t.apply(e,null)).next())}));var e,t}load(e){this.searchWorker.load(e)}fromExternalJS(e,t){e&&t&&this.searchWorker.fromExternalJS(e,t)}}})(),i})()}));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign,__decorate,__rest,__spreadArray}from"tslib";import{action,observable,makeObservable}from"mobx";import{pushRef}from"../OpenAPIParser";import{detectType,extractExtensions,humanizeConstraints,isNamedDefinition,isObject,isPrimitiveType,JsonPointer,pluralizeType,sortByField,sortByRequired}from"../../utils/";import{l}from"../Labels";import{FieldModel}from"./Field";var SchemaModel=function(){function e(e,i,t,r,n,a,s){void 0===n&&(n=!1),void 0===a&&(a=[]),void 0===s&&(s={}),Object.defineProperty(this,"parser",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"refsStack",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"deps",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"pointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"displayType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"typePrefix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"title",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"externalDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isPrimitive",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isCircular",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"format",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"displayFormat",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nullable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"deprecated",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pattern",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"example",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"enum",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"default",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"readOnly",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"writeOnly",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"constraints",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_fields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"oneOf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"oneOfType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"discriminatorProp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activeOneOf",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"rawSchema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extensions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"x-enumDescriptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"const",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contentEncoding",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contentMediaType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"minItems",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxItems",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this),this.pointer=i.$ref||t||"";var o=e.deref(i,a,!0),l=o.resolved,p=o.refsStack;this.refsStack=pushRef(p,this.pointer),this.rawSchema=l,this.schema=e.mergeAllOf(this.rawSchema,this.pointer,this.refsStack),this.init(e,n),r.showExtensions&&(this.extensions=extractExtensions(this.schema,r.showExtensions))}return Object.defineProperty(e.prototype,"activateOneOf",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.activeOneOf=e}}),Object.defineProperty(e.prototype,"hasType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type===e||Array.isArray(this.type)&&this.type.includes(e)}}),Object.defineProperty(e.prototype,"fields",{get:function(){if(!this.isCircular)return!this._fields&&this.hasType("object")&&(this._fields=buildFields(this.parser,this.schema,this.pointer,this.options,this.refsStack,this.deps)),this._fields},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"init",{enumerable:!1,configurable:!0,writable:!0,value:function(i,t){var r,n,a,s,o,p,d,u,f=this,c=this.schema;if(this.isCircular=!!c["x-circular-ref"],this.title=c.title||isNamedDefinition(this.pointer)&&JsonPointer.baseName(this.pointer)||"",this.description=c.description||"",this.type=c.type||detectType(c),this.format=c.format,this.enum=c.enum||[],this["x-enumDescriptions"]=c["x-enumDescriptions"],this.example=c.example,this.deprecated=!!c.deprecated,this.pattern=c.pattern,this.externalDocs=c.externalDocs,this.constraints=humanizeConstraints(c),this.displayFormat=this.format,this.isPrimitive=isPrimitiveType(c,this.type),this.default=c.default,this.readOnly=!!c.readOnly,this.writeOnly=!!c.writeOnly,this.const=c.const||"",this.contentEncoding=c.contentEncoding,this.contentMediaType=c.contentMediaType,this.minItems=c.minItems,this.maxItems=c.maxItems,(c.nullable||c["x-nullable"])&&(Array.isArray(this.type)&&!this.type.some((function(e){return null===e||"null"===e}))?this.type=__spreadArray(__spreadArray([],this.type,!0),["null"],!1):Array.isArray(this.type)||null===this.type&&"null"===this.type||(this.type=[this.type,"null"])),this.displayType=Array.isArray(this.type)?this.type.map((function(e){return null===e?"null":e})).join(" or "):this.type,!this.isCircular)if(c.if&&c.then||c.if&&c.else)this.initConditionalOperators(c,i);else if(t||void 0===getDiscriminator(c)){if(t&&Array.isArray(c.oneOf)&&c.oneOf.find((function(e){return e.$ref===f.pointer}))&&delete c.oneOf,void 0!==c.oneOf)return this.initOneOf(c.oneOf,i),this.oneOfType="One of",void(void 0!==c.anyOf&&console.warn("oneOf and anyOf are not supported on the same level. Skipping anyOf at "+this.pointer));if(void 0!==c.anyOf)return this.initOneOf(c.anyOf,i),void(this.oneOfType="Any of");if(this.hasType("array")&&(Array.isArray(c.items)||Array.isArray(c.prefixItems)?this._fields=buildFields(i,c,this.pointer,this.options,this.refsStack,this.deps):isObject(c.items)&&(this.items=new e(i,c.items,this.pointer+"/items",this.options,!1,this.refsStack,this.deps)),this.displayType=c.prefixItems||Array.isArray(c.items)?"items":pluralizeType((null===(r=this.items)||void 0===r?void 0:r.displayType)||this.displayType),this.displayFormat=(null===(n=this.items)||void 0===n?void 0:n.format)||"",this.typePrefix=(null===(a=this.items)||void 0===a?void 0:a.typePrefix)||""+l("arrayOf"),this.title=this.title||(null===(s=this.items)||void 0===s?void 0:s.title)||"",this.isPrimitive=void 0!==(null===(o=this.items)||void 0===o?void 0:o.isPrimitive)?null===(p=this.items)||void 0===p?void 0:p.isPrimitive:this.isPrimitive,void 0===this.example&&void 0!==(null===(d=this.items)||void 0===d?void 0:d.example)&&(this.example=[this.items.example]),(null===(u=this.items)||void 0===u?void 0:u.isPrimitive)&&(this.enum=this.items.enum,this["x-enumDescriptions"]=this.items["x-enumDescriptions"]),Array.isArray(this.type))){var h=this.type.filter((function(e){return"array"!==e}));h.length&&(this.displayType+=" or "+h.join(" or "))}this.enum.length&&this.options.sortEnumValuesAlphabetically&&this.enum.sort()}else this.initDiscriminator(c,i)}}),Object.defineProperty(e.prototype,"initOneOf",{enumerable:!1,configurable:!0,writable:!0,value:function(i,t){var r=this;if(this.oneOf=i.map((function(i,n){var a=t.deref(i,r.refsStack,!0),s=a.resolved,o=a.refsStack,l=t.mergeAllOf(s,r.pointer+"/oneOf/"+n,o),p=isNamedDefinition(i.$ref)&&!l.title?JsonPointer.baseName(i.$ref):""+(l.title||"")+(l.const&&JSON.stringify(l.const)||"");return new e(t,__assign(__assign({},l),{title:p,allOf:[__assign(__assign({},r.schema),{oneOf:void 0,anyOf:void 0})]}),r.pointer+"/oneOf/"+n,r.options,!1,r.refsStack,__assign(__assign({},r.deps),{parentFieldFullPath:r.deps.parentFieldFullPath?r.deps.parentFieldFullPath+r.options.deepLinkSeparator+n:n.toString()}))})),this.options.simpleOneOfTypeLabel){var n=collectUniqueOneOfTypesDeep(this);this.displayType=n.join(" or ")}else this.displayType=this.oneOf.map((function(e){var i=e.typePrefix+(e.title?e.title+" ("+e.displayType+")":e.displayType);return i.indexOf(" or ")>-1&&(i="("+i+")"),i})).join(" or ")}}),Object.defineProperty(e.prototype,"initDiscriminator",{enumerable:!1,configurable:!0,writable:!0,value:function(i,t){var r=this,n=getDiscriminator(i);this.discriminatorProp=null==n?void 0:n.propertyName;var a=t.findDerived(__spreadArray(__spreadArray([],this.schema["x-parentRefs"]||[],!0),[this.pointer],!1));if(i.oneOf)for(var s=0,o=i.oneOf;s<o.length;s++){var l=o[s];if(void 0!==l.$ref){var p=JsonPointer.baseName(l.$ref);a[l.$ref]=p}}var d=(null==n?void 0:n.mapping)||{},u=(null==n?void 0:n["x-explicitMappingOnly"])||!1;0===Object.keys(d).length&&(u=!1);var f={};for(var c in d){var h=d[c];Array.isArray(f[h])?f[h].push(c):f[h]=[c]}for(var b=__assign(u?{}:__assign({},a),f),m=[],y=0,v=Object.keys(b);y<v.length;y++){var O=b[h=v[y]];if(Array.isArray(O))for(var g=0,P=O;g<P.length;g++){var w=P[g];m.push({$ref:h,name:w})}else m.push({$ref:h,name:O})}var j=Object.keys(d);0!==j.length&&(m=m.sort((function(e,i){var t=j.indexOf(e.name),r=j.indexOf(i.name);return t<0&&r<0?e.name.localeCompare(i.name):t<0?1:r<0?-1:t-r}))),this.oneOf=m.map((function(i,n){var a=i.$ref,s=i.name,o=new e(t,{$ref:a},a,r.options,!0,r.refsStack.slice(0,-1),__assign(__assign({},r.deps),{parentFieldFullPath:r.deps.parentFieldFullPath?r.deps.parentFieldFullPath+r.options.deepLinkSeparator+n:n.toString()}));return o.title=s,o}))}}),Object.defineProperty(e.prototype,"initConditionalOperators",{enumerable:!1,configurable:!0,writable:!0,value:function(i,t){var r=this,n=i.if,a=i.else,s=void 0===a?{}:a,o=i.then,l=void 0===o?{}:o,p=__rest(i,["if","else","then"]),d=[{allOf:[p,l,n],title:n&&n["x-displayName"]||(null==n?void 0:n.title)||"case 1"},{allOf:[p,s],title:s&&s["x-displayName"]||(null==s?void 0:s.title)||"case 2"}];this.oneOf=d.map((function(i,n){return new e(t,__assign({},i),r.pointer+"/oneOf/"+n,r.options,!1,r.refsStack,__assign(__assign({},r.deps),{parentFieldFullPath:r.deps.parentFieldFullPath?r.deps.parentFieldFullPath+r.options.deepLinkSeparator+n:n.toString()}))})),this.oneOfType="One of"}}),__decorate([observable],e.prototype,"activeOneOf",void 0),__decorate([action],e.prototype,"activateOneOf",null),e}();export{SchemaModel};function normalizeField(e,i,t){return e||(console.warn('Field "'+i+'" is invalid, skipping.\n Field must be an object but got '+typeof e+' at "'+t+'"'),{})}function buildFields(e,i,t,r,n,a){var s=i.properties||i.prefixItems||i.items||{},o=i.patternProperties||{},l=i.additionalProperties||i.unevaluatedProperties,p=i.prefixItems?i.items:i.additionalItems,d=i.default||{},u=Object.keys(s).map((function(o){var l,p=normalizeField(s[o],o,t),u=void 0!==i.required&&i.required.indexOf(o)>-1;return new FieldModel(e,{name:i.properties?o:"["+o+"]",required:u,schema:__assign(__assign({},p),{example:(null===(l=i.example)||void 0===l?void 0:l[o])||p.example,default:void 0===p.default&&d?d[o]:p.default})},t+"/properties/"+o,r,n,a)}));return r.sortPropsAlphabetically&&(u=sortByField(u,"name")),r.requiredPropsFirst&&(u=sortByRequired(u,r.sortPropsAlphabetically?void 0:i.required)),u.push.apply(u,Object.keys(o).map((function(i){var s=normalizeField(o[i],i,t);return new FieldModel(e,{name:i,required:!1,schema:s,kind:"patternProperties"},t+"/patternProperties/"+i,r,n,a)}))),(isObject(l)||!0===l)&&u.push(new FieldModel(e,{name:(isObject(l)&&l["x-additionalPropertiesName"]||"property name").concat("*"),required:!1,schema:!0===l?{}:l,kind:"additionalProperties"},t+"/additionalProperties",r,n,a)),u.push.apply(u,buildAdditionalItems({parser:e,schema:p,fieldsCount:u.length,$ref:t,options:r,refsStack:n,deps:a})),u}function buildAdditionalItems(e){var i=e.parser,t=e.schema,r=void 0!==t&&t,n=e.fieldsCount,a=e.$ref,s=e.options,o=e.refsStack,l=e.deps;return"boolean"==typeof r?r?[new FieldModel(i,{name:"["+n+"...]",schema:{},kind:"additionalItems"},a+"/additionalItems",s,o,l)]:[]:Array.isArray(r)?__spreadArray([],r.map((function(e,t){return new FieldModel(i,{name:"["+(n+t)+"]",schema:e,kind:"additionalItems"},a+"/additionalItems/"+t,s,o,l)})),!0):isObject(r)?[new FieldModel(i,{name:"["+n+"...]",schema:r,kind:"additionalItems"},a+"/additionalItems",s,o,l)]:[]}function getDiscriminator(e){return e.discriminator||e["x-discriminator"]}function collectUniqueOneOfTypesDeep(e){var i=new Set;return function e(t){for(var r=0,n=t.oneOf||[];r<n.length;r++){var a=n[r];a.oneOf?e(a):a.type&&i.add(a.type)}}(e),Array.from(i.values())}
|
|
1
|
+
import{__assign,__decorate,__rest,__spreadArray}from"tslib";import{action,observable,makeObservable}from"mobx";import{pushRef}from"../OpenAPIParser";import{detectType,extractExtensions,humanizeConstraints,isNamedDefinition,isObject,isPrimitiveType,JsonPointer,pluralizeType,sortByField,sortByRequired}from"../../utils/";import{l}from"../Labels";import{FieldModel}from"./Field";var SchemaModel=function(){function e(e,i,t,r,n,a,s){void 0===n&&(n=!1),void 0===a&&(a=[]),void 0===s&&(s={}),Object.defineProperty(this,"parser",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"refsStack",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"deps",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"pointer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"displayType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"typePrefix",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"title",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"description",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"externalDocs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isPrimitive",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"isCircular",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"format",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"displayFormat",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"nullable",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"deprecated",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pattern",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"example",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"enum",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"default",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"readOnly",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"writeOnly",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"constraints",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_fields",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"oneOf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"oneOfType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"discriminatorProp",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"activeOneOf",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"rawSchema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"schema",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extensions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"x-enumDescriptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"const",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contentEncoding",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contentMediaType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"minItems",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxItems",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),makeObservable(this),this.pointer=i.$ref||t||"";var o=e.deref(i,a,!0),l=o.resolved,p=o.refsStack;this.refsStack=pushRef(p,this.pointer),this.rawSchema=l,this.schema=e.mergeAllOf(this.rawSchema,this.pointer,this.refsStack),this.init(e,n),r.showExtensions&&(this.extensions=extractExtensions(this.schema,r.showExtensions))}return Object.defineProperty(e.prototype,"activateOneOf",{enumerable:!1,configurable:!0,writable:!0,value:function(e){this.activeOneOf=e}}),Object.defineProperty(e.prototype,"hasType",{enumerable:!1,configurable:!0,writable:!0,value:function(e){return this.type===e||Array.isArray(this.type)&&this.type.includes(e)}}),Object.defineProperty(e.prototype,"fields",{get:function(){if(!this.isCircular)return!this._fields&&this.hasType("object")&&(this._fields=buildFields(this.parser,this.schema,this.pointer,this.options,this.refsStack,this.deps)),this._fields},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"init",{enumerable:!1,configurable:!0,writable:!0,value:function(i,t){var r,n,a,s,o,p,d,u,f=this,c=this.schema;if(this.isCircular=!!c["x-circular-ref"],this.title=c.title||isNamedDefinition(this.pointer)&&JsonPointer.baseName(this.pointer)||"",this.description=c.description||"",this.type=c.type||detectType(c),this.format=c.format,this.enum=c.enum||[],this["x-enumDescriptions"]=c["x-enumDescriptions"],this.example=c.example,this.deprecated=!!c.deprecated,this.pattern=c.pattern,this.externalDocs=c.externalDocs,this.constraints=humanizeConstraints(c),this.displayFormat=this.format,this.isPrimitive=isPrimitiveType(c,this.type),this.default=c.default,this.readOnly=!!c.readOnly,this.writeOnly=!!c.writeOnly,this.const=c.const||"",this.contentEncoding=c.contentEncoding,this.contentMediaType=c.contentMediaType,this.minItems=c.minItems,this.maxItems=c.maxItems,(c.nullable||c["x-nullable"])&&(Array.isArray(this.type)&&!this.type.some((function(e){return null===e||"null"===e}))?this.type=__spreadArray(__spreadArray([],this.type,!0),["null"],!1):Array.isArray(this.type)||null===this.type&&"null"===this.type||(this.type=[this.type,"null"])),this.displayType=Array.isArray(this.type)?this.type.map((function(e){return null===e?"null":e})).join(" or "):this.type,!this.isCircular)if(c.if&&c.then||c.if&&c.else)this.initConditionalOperators(c,i);else if(t||void 0===getDiscriminator(c)){if(t&&Array.isArray(c.oneOf)&&c.oneOf.find((function(e){return e.$ref===f.pointer}))&&delete c.oneOf,void 0!==c.oneOf)return this.initOneOf(c.oneOf,i),this.oneOfType="One of",void(void 0!==c.anyOf&&console.warn("oneOf and anyOf are not supported on the same level. Skipping anyOf at "+this.pointer));if(void 0!==c.anyOf)return this.initOneOf(c.anyOf,i),void(this.oneOfType="Any of");if(this.hasType("array")&&(Array.isArray(c.items)||Array.isArray(c.prefixItems)?this._fields=buildFields(i,c,this.pointer,this.options,this.refsStack,this.deps):c.items&&(this.items=new e(i,c.items,this.pointer+"/items",this.options,!1,this.refsStack,this.deps)),this.displayType=c.prefixItems||Array.isArray(c.items)?"items":pluralizeType((null===(r=this.items)||void 0===r?void 0:r.displayType)||this.displayType),this.displayFormat=(null===(n=this.items)||void 0===n?void 0:n.format)||"",this.typePrefix=(null===(a=this.items)||void 0===a?void 0:a.typePrefix)||""+l("arrayOf"),this.title=this.title||(null===(s=this.items)||void 0===s?void 0:s.title)||"",this.isPrimitive=void 0!==(null===(o=this.items)||void 0===o?void 0:o.isPrimitive)?null===(p=this.items)||void 0===p?void 0:p.isPrimitive:this.isPrimitive,void 0===this.example&&void 0!==(null===(d=this.items)||void 0===d?void 0:d.example)&&(this.example=[this.items.example]),(null===(u=this.items)||void 0===u?void 0:u.isPrimitive)&&(this.enum=this.items.enum,this["x-enumDescriptions"]=this.items["x-enumDescriptions"]),Array.isArray(this.type))){var h=this.type.filter((function(e){return"array"!==e}));h.length&&(this.displayType+=" or "+h.join(" or "))}this.enum.length&&this.options.sortEnumValuesAlphabetically&&this.enum.sort()}else this.initDiscriminator(c,i)}}),Object.defineProperty(e.prototype,"initOneOf",{enumerable:!1,configurable:!0,writable:!0,value:function(i,t){var r=this;if(this.oneOf=i.map((function(i,n){var a=t.deref(i,r.refsStack,!0),s=a.resolved,o=a.refsStack,l=t.mergeAllOf(s,r.pointer+"/oneOf/"+n,o),p=isNamedDefinition(i.$ref)&&!l.title?JsonPointer.baseName(i.$ref):""+(l.title||"")+(l.const&&JSON.stringify(l.const)||"");return new e(t,__assign(__assign({},l),{title:p,allOf:[__assign(__assign({},r.schema),{oneOf:void 0,anyOf:void 0})]}),r.pointer+"/oneOf/"+n,r.options,!1,r.refsStack,__assign(__assign({},r.deps),{parentFieldFullPath:r.deps.parentFieldFullPath?r.deps.parentFieldFullPath+r.options.deepLinkSeparator+n:n.toString()}))})),this.options.simpleOneOfTypeLabel){var n=collectUniqueOneOfTypesDeep(this);this.displayType=n.join(" or ")}else this.displayType=this.oneOf.map((function(e){var i=e.typePrefix+(e.title?e.title+" ("+e.displayType+")":e.displayType);return i.indexOf(" or ")>-1&&(i="("+i+")"),i})).join(" or ")}}),Object.defineProperty(e.prototype,"initDiscriminator",{enumerable:!1,configurable:!0,writable:!0,value:function(i,t){var r=this,n=getDiscriminator(i);this.discriminatorProp=null==n?void 0:n.propertyName;var a=t.findDerived(__spreadArray(__spreadArray([],this.schema["x-parentRefs"]||[],!0),[this.pointer],!1));if(i.oneOf)for(var s=0,o=i.oneOf;s<o.length;s++){var l=o[s];if(void 0!==l.$ref){var p=JsonPointer.baseName(l.$ref);a[l.$ref]=p}}var d=(null==n?void 0:n.mapping)||{},u=(null==n?void 0:n["x-explicitMappingOnly"])||!1;0===Object.keys(d).length&&(u=!1);var f={};for(var c in d){var h=d[c];Array.isArray(f[h])?f[h].push(c):f[h]=[c]}for(var b=__assign(u?{}:__assign({},a),f),m=[],y=0,v=Object.keys(b);y<v.length;y++){var O=b[h=v[y]];if(Array.isArray(O))for(var g=0,P=O;g<P.length;g++){var w=P[g];m.push({$ref:h,name:w})}else m.push({$ref:h,name:O})}var j=Object.keys(d);0!==j.length&&(m=m.sort((function(e,i){var t=j.indexOf(e.name),r=j.indexOf(i.name);return t<0&&r<0?e.name.localeCompare(i.name):t<0?1:r<0?-1:t-r}))),this.oneOf=m.map((function(i,n){var a=i.$ref,s=i.name,o=new e(t,{$ref:a},a,r.options,!0,r.refsStack.slice(0,-1),__assign(__assign({},r.deps),{parentFieldFullPath:r.deps.parentFieldFullPath?r.deps.parentFieldFullPath+r.options.deepLinkSeparator+n:n.toString()}));return o.title=s,o}))}}),Object.defineProperty(e.prototype,"initConditionalOperators",{enumerable:!1,configurable:!0,writable:!0,value:function(i,t){var r=this,n=i.if,a=i.else,s=void 0===a?{}:a,o=i.then,l=void 0===o?{}:o,p=__rest(i,["if","else","then"]),d=[{allOf:[p,l,n],title:n&&n["x-displayName"]||(null==n?void 0:n.title)||"case 1"},{allOf:[p,s],title:s&&s["x-displayName"]||(null==s?void 0:s.title)||"case 2"}];this.oneOf=d.map((function(i,n){return new e(t,__assign({},i),r.pointer+"/oneOf/"+n,r.options,!1,r.refsStack,__assign(__assign({},r.deps),{parentFieldFullPath:r.deps.parentFieldFullPath?r.deps.parentFieldFullPath+r.options.deepLinkSeparator+n:n.toString()}))})),this.oneOfType="One of"}}),__decorate([observable],e.prototype,"activeOneOf",void 0),__decorate([action],e.prototype,"activateOneOf",null),e}();export{SchemaModel};function normalizeField(e,i,t){return e||(console.warn('Field "'+i+'" is invalid, skipping.\n Field must be an object but got '+typeof e+' at "'+t+'"'),{})}function buildFields(e,i,t,r,n,a){var s=i.properties||i.prefixItems||i.items||{},o=i.patternProperties||{},l=i.additionalProperties||i.unevaluatedProperties,p=i.prefixItems?i.items:i.additionalItems,d=i.default||{},u=Object.keys(s).map((function(o){var l,p=normalizeField(s[o],o,t),u=void 0!==i.required&&i.required.indexOf(o)>-1;return new FieldModel(e,{name:i.properties?o:"["+o+"]",required:u,schema:__assign(__assign({},p),{example:(null===(l=i.example)||void 0===l?void 0:l[o])||p.example,default:void 0===p.default&&d?d[o]:p.default})},t+"/properties/"+o,r,n,a)}));return r.sortPropsAlphabetically&&(u=sortByField(u,"name")),r.requiredPropsFirst&&(u=sortByRequired(u,r.sortPropsAlphabetically?void 0:i.required)),u.push.apply(u,Object.keys(o).map((function(i){var s=normalizeField(o[i],i,t);return new FieldModel(e,{name:i,required:!1,schema:s,kind:"patternProperties"},t+"/patternProperties/"+i,r,n,a)}))),(isObject(l)||!0===l)&&u.push(new FieldModel(e,{name:(isObject(l)&&l["x-additionalPropertiesName"]||"property name").concat("*"),required:!1,schema:!0===l?{}:l,kind:"additionalProperties"},t+"/additionalProperties",r,n,a)),u.push.apply(u,buildAdditionalItems({parser:e,schema:p,fieldsCount:u.length,$ref:t,options:r,refsStack:n,deps:a})),u}function buildAdditionalItems(e){var i=e.parser,t=e.schema,r=void 0!==t&&t,n=e.fieldsCount,a=e.$ref,s=e.options,o=e.refsStack,l=e.deps;return"boolean"==typeof r?r?[new FieldModel(i,{name:"["+n+"...]",schema:{},kind:"additionalItems"},a+"/additionalItems",s,o,l)]:[]:Array.isArray(r)?__spreadArray([],r.map((function(e,t){return new FieldModel(i,{name:"["+(n+t)+"]",schema:e,kind:"additionalItems"},a+"/additionalItems/"+t,s,o,l)})),!0):isObject(r)?[new FieldModel(i,{name:"["+n+"...]",schema:r,kind:"additionalItems"},a+"/additionalItems",s,o,l)]:[]}function getDiscriminator(e){return e.discriminator||e["x-discriminator"]}function collectUniqueOneOfTypesDeep(e){var i=new Set;return function e(t){for(var r=0,n=t.oneOf||[];r<n.length;r++){var a=n[r];a.oneOf?e(a):a.type&&i.add(a.type)}}(e),Array.from(i.values())}
|
|
2
2
|
//# sourceMappingURL=Schema.js.map
|
|
@@ -22,6 +22,8 @@ export declare function isNumeric(value: unknown): value is number;
|
|
|
22
22
|
export declare function appendToMdHeading(md: string, heading: string, content: string): string;
|
|
23
23
|
export declare const mergeObjects: (target: GenericObject, ...sources: GenericObject[]) => GenericObject;
|
|
24
24
|
export declare const isObject: (item: unknown) => item is "object";
|
|
25
|
+
export declare const isArrayOfObjects: (items: unknown) => items is [];
|
|
26
|
+
export declare const deleteEmptyArrayItem: (items: unknown[]) => unknown[];
|
|
25
27
|
export declare const isMergeableObject: (item: unknown) => boolean;
|
|
26
28
|
/**
|
|
27
29
|
* slugify() returns empty string when failed to slugify.
|
|
@@ -37,7 +39,7 @@ export declare function isAbsoluteUrl(url: string): boolean;
|
|
|
37
39
|
export declare function resolveUrl(url: string, to: string): string;
|
|
38
40
|
export declare function getBasePath(serverUrl: string): string;
|
|
39
41
|
export declare function titleize(text: string): string;
|
|
40
|
-
export declare function
|
|
42
|
+
export declare function removeQueryStringAndHash(serverUrl: string): string;
|
|
41
43
|
export declare function escapeHTMLAttrChars(str: string): string;
|
|
42
44
|
export declare function unescapeHTMLChars(str: string): string;
|
|
43
45
|
export declare function sanitizeItemId(id: string): string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign,__spreadArray}from"tslib";import slugify from"slugify";import{format,parse}from"url";import{ZERO_BREAKPOINT}from"./media-css";import{isNamedDefinition}from"./openapi";import JsonPointer from"./JsonPointer";export function mapWithLast(e,r){for(var t=[],n=0;n<e.length-1;n++)t.push(r(e[n],!1));return 0!==e.length&&t.push(r(e[e.length-1],!0)),t}export function mapValues(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=r(e[n],n,e));return t}export function flattenByProp(e,r){var t=[],n=function(e){for(var i=0,a=e;i<a.length;i++){var o=a[i];t.push(o),o[r]&&n(o[r])}};return n(e),t}export function stripTrailingSlash(e){return e.endsWith("/")?e.substring(0,e.length-1):e}export function isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}export function appendToMdHeading(e,r,t){var n=new RegExp("(^|\\n)#\\s?"+r+"\\s*\\n","i"),i=new RegExp("((\\n|^)#\\s*"+r+"\\s*(\\n|$)(?:.|\\n)*?)(\\n#|$)","i");if(n.test(e))return e.replace(i,"$1\n\n"+t+"\n$4");var a=""===e||e.endsWith("\n\n")?"":e.endsWith("\n")?"\n":"\n\n";return""+e+a+"# "+r+"\n\n"+t}export var mergeObjects=function(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];if(!r.length)return e;var n=r.shift();return void 0===n?e:(isMergeableObject(e)&&isMergeableObject(n)&&Object.keys(n).forEach((function(r){var t;isMergeableObject(n[r])?(e[r]||(e[r]={}),["string","number"].includes(typeof e[r])&&(n[r][ZERO_BREAKPOINT]||0===n[r][ZERO_BREAKPOINT]||console.warn('Theme resolver: using default value of "'+e[r]+'" for "'+r+'". This is not recommended. Prefer adding default value by providing "'+ZERO_BREAKPOINT+'" property to '+JSON.stringify(n[r])+"."),e[r]=((t={})[ZERO_BREAKPOINT]=e[r],t)),mergeObjects(e[r],n[r])):e[r]=n[r]})),mergeObjects.apply(void 0,__spreadArray([e],r,!1)))};export var isObject=function(e){return null!==e&&"object"==typeof e};export var isMergeableObject=function(e){return isObject(e)&&!Array.isArray(e)};export function safeSlugify(e){return slugify(e)||e.toString().toLowerCase().replace(/\s+/g,"-").replace(/&/g,"-and-").replace(/--+/g,"-").replace(/^-+/,"").replace(/-+$/,"")}export function isAbsoluteUrl(e){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(e)}export function resolveUrl(e,r){var t;if(r.startsWith("//"))t=""+(parse(e).protocol||"https:")+r;else if(isAbsoluteUrl(r))t=r;else if(r.startsWith("/")){var n=parse(e);t=format(__assign(__assign({},n),{pathname:r}))}else t=stripTrailingSlash(e)+"/"+r;return stripTrailingSlash(t)}export function getBasePath(e){try{return parseURL(e).pathname}catch(r){return e}}export function titleize(e){return e.charAt(0).toUpperCase()+e.slice(1)}export function
|
|
1
|
+
import{__assign,__spreadArray}from"tslib";import slugify from"slugify";import{format,parse}from"url";import{ZERO_BREAKPOINT}from"./media-css";import{isNamedDefinition}from"./openapi";import JsonPointer from"./JsonPointer";export function mapWithLast(e,r){for(var t=[],n=0;n<e.length-1;n++)t.push(r(e[n],!1));return 0!==e.length&&t.push(r(e[e.length-1],!0)),t}export function mapValues(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=r(e[n],n,e));return t}export function flattenByProp(e,r){var t=[],n=function(e){for(var i=0,a=e;i<a.length;i++){var o=a[i];t.push(o),o[r]&&n(o[r])}};return n(e),t}export function stripTrailingSlash(e){return e.endsWith("/")?e.substring(0,e.length-1):e}export function isNumeric(e){return!isNaN(parseFloat(e))&&isFinite(e)}export function appendToMdHeading(e,r,t){var n=new RegExp("(^|\\n)#\\s?"+r+"\\s*\\n","i"),i=new RegExp("((\\n|^)#\\s*"+r+"\\s*(\\n|$)(?:.|\\n)*?)(\\n#|$)","i");if(n.test(e))return e.replace(i,"$1\n\n"+t+"\n$4");var a=""===e||e.endsWith("\n\n")?"":e.endsWith("\n")?"\n":"\n\n";return""+e+a+"# "+r+"\n\n"+t}export var mergeObjects=function(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];if(!r.length)return e;var n=r.shift();return void 0===n?e:(isMergeableObject(e)&&isMergeableObject(n)&&Object.keys(n).forEach((function(r){var t;isMergeableObject(n[r])?(e[r]||(e[r]={}),["string","number"].includes(typeof e[r])&&(n[r][ZERO_BREAKPOINT]||0===n[r][ZERO_BREAKPOINT]||console.warn('Theme resolver: using default value of "'+e[r]+'" for "'+r+'". This is not recommended. Prefer adding default value by providing "'+ZERO_BREAKPOINT+'" property to '+JSON.stringify(n[r])+"."),e[r]=((t={})[ZERO_BREAKPOINT]=e[r],t)),mergeObjects(e[r],n[r])):e[r]=n[r]})),mergeObjects.apply(void 0,__spreadArray([e],r,!1)))};export var isObject=function(e){return null!==e&&"object"==typeof e};export var isArrayOfObjects=function(e){return Array.isArray(e)&&e.some((function(e){return isObject(e)}))};export var deleteEmptyArrayItem=function(e){return e.filter((function(e){return!!e}))};export var isMergeableObject=function(e){return isObject(e)&&!Array.isArray(e)};export function safeSlugify(e){return slugify(e)||e.toString().toLowerCase().replace(/\s+/g,"-").replace(/&/g,"-and-").replace(/--+/g,"-").replace(/^-+/,"").replace(/-+$/,"")}export function isAbsoluteUrl(e){return/(?:^[a-z][a-z0-9+.-]*:|\/\/)/i.test(e)}export function resolveUrl(e,r){var t;if(r.startsWith("//"))t=""+(parse(e).protocol||"https:")+r;else if(isAbsoluteUrl(r))t=r;else if(r.startsWith("/")){var n=parse(e);t=format(__assign(__assign({},n),{pathname:r}))}else t=stripTrailingSlash(e)+"/"+r;return stripTrailingSlash(t)}export function getBasePath(e){try{return parseURL(e).pathname}catch(r){return e}}export function titleize(e){return e.charAt(0).toUpperCase()+e.slice(1)}export function removeQueryStringAndHash(e){try{var r=parseURL(e);return r.search="",r.hash="",r.toString()}catch(r){return e}}function parseURL(e){return"undefined"==typeof URL?new(require("url").URL)(e):new URL(e)}export function escapeHTMLAttrChars(e){return e.replace(/["\\]/g,"\\$&")}export function unescapeHTMLChars(e){return e.replace(/&#(\d+);/g,(function(e,r){return String.fromCharCode(parseInt(r,10))})).replace(/&/g,"&").replace(/"/g,'"')}export function sanitizeItemId(e){return e&&e.replace(/#/g,"_")}export function getSchemaTitle(e,r){return r||isNamedDefinition(e)&&JsonPointer.baseName(e)||""}
|
|
2
2
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign,__spreadArray}from"tslib";import{dirname}from"path";import UrlTemplate from"url-template";import{MediaTypes}from"../../../types";import{IS_BROWSER}from"./dom";import{isNumeric,removeQueryString,resolveUrl}from"./helpers";function isWildcardStatusCode(e){return"string"==typeof e&&/\dxx/i.test(e)}export function isStatusCode(e){return"default"===e||isNumeric(e)||isWildcardStatusCode(e)}export function getStatusCodeType(e,r){if(void 0===r&&(r=!1),"default"===e)return r?"error":"success";var t="string"==typeof e?parseInt(e,10):e;if(isWildcardStatusCode(e)&&(t*=100),t<100||t>599)throw new Error("invalid HTTP code");var i="success";return t>=300&&t<400?i="redirect":t>=400?i="error":t<200&&(i="info"),i}var operationNames={get:!0,post:!0,put:!0,head:!0,patch:!0,delete:!0,options:!0,$ref:!0};export function isOperationName(e){return e in operationNames}export function getOperationSummary(e){return e.summary||e.operationId||e.description&&e.description.substring(0,50)||"<no summary>"}var schemaKeywordTypes={multipleOf:"number",maximum:"number",exclusiveMaximum:"number",minimum:"number",exclusiveMinimum:"number",maxLength:"string",minLength:"string",pattern:"string",contentEncoding:"string",contentMediaType:"string",items:"array",maxItems:"array",minItems:"array",uniqueItems:"array",maxProperties:"object",minProperties:"object",required:"object",additionalProperties:"object",unevaluatedProperties:"object",patternProperties:"object",properties:"object"};export function detectType(e){if(void 0!==e.type&&!Array.isArray(e.type))return e.type;for(var r=0,t=Object.keys(schemaKeywordTypes);r<t.length;r++){var i=t[r],n=schemaKeywordTypes[i];if(void 0!==e[i])return n}return"any"}export function isPrimitiveType(e,r){if(void 0===r&&(r=e.type),e["x-circular-ref"])return!0;if(void 0!==e.oneOf||void 0!==e.anyOf)return!1;if(e.if&&e.then||e.if&&e.else)return!1;var t=!0,i=Array.isArray(r);return("object"===r||i&&(null==r?void 0:r.includes("object")))&&(t=void 0!==e.properties?0===Object.keys(e.properties).length:void 0===e.additionalProperties&&void 0===e.unevaluatedProperties&&void 0===e.patternProperties),!Array.isArray(e.items)&&!Array.isArray(e.prefixItems)&&(void 0!==e.items&&"boolean"!=typeof e.items&&("array"===r||i&&(null==r?void 0:r.includes("array")))&&(t=isPrimitiveType(e.items,e.items.type)),t)}export function isJsonLike(e){return-1!==e.search(/json/i)}export function isFormUrlEncoded(e){return e===MediaTypes.URL_ENCODED}function delimitedEncodeField(e,r,t){return Array.isArray(e)?e.map((function(e){return e.toString()})).join(t):"object"==typeof e?Object.keys(e).map((function(r){return""+r+t+e[r]})).join(t):r+"="+e.toString()}function deepObjectEncodeField(e,r){return Array.isArray(e)?(console.warn("deepObject style cannot be used with array value:"+e.toString()),""):"object"==typeof e?Object.keys(e).map((function(t){return e[t]?r+"["+t+"]="+e[t]:void 0})).filter(Boolean).join("&"):(console.warn("deepObject style cannot be used with non-object value:"+e.toString()),"")}function serializeFormValue(e,r,t){var i,n="__redoc_param_name__",a=r?"*":"";return UrlTemplate.parse("{?"+n+a+"}").expand((i={},i[n]=t,i)).substring(1).replace(/__redoc_param_name__/g,e)}export function urlFormEncodePayload(e,r){if(void 0===r&&(r={}),Array.isArray(e))throw new Error("Payload must have fields: "+e.toString());return Object.keys(e).map((function(t){var i=e[t],n=r[t]||{},a=n.style,o=void 0===a?"form":a,s=n.explode,u=void 0===s||s;switch(o){case"form":return serializeFormValue(t,u,i);case"spaceDelimited":return delimitedEncodeField(i,t,"%20");case"pipeDelimited":return delimitedEncodeField(i,t,"|");case"deepObject":return deepObjectEncodeField(i,t);default:return console.warn("Incorrect or unsupported encoding style: "+o),""}})).join("&")}function serializePathParameter(e,r,t,i){var n,a=t?"*":"",o="";"label"===r?o=".":"matrix"===r&&(o=";");var s="__redoc_param_name__";return UrlTemplate.parse("{"+o+s+a+"}").expand((n={},n[s]=i,n)).replace(/__redoc_param_name__/g,e)}export function serializeQueryParameter(e,r,t,i){switch(r){case"form":return serializeFormValue(e,t,i);case"spaceDelimited":return Array.isArray(i)?t?serializeFormValue(e,t,i):e+"="+i.join("%20"):(console.warn("The style spaceDelimited is only applicable to arrays"),"");case"pipeDelimited":return Array.isArray(i)?t?serializeFormValue(e,t,i):e+"="+i.join("|"):(console.warn("The style pipeDelimited is only applicable to arrays"),"");case"deepObject":return!t||Array.isArray(i)||"object"!=typeof i?(console.warn("The style deepObject is only applicable for objects with explode=true"),""):deepObjectEncodeField(i,e);default:return console.warn("Unexpected style for query: "+r),""}}function serializeHeaderParameter(e,r,t){var i;if("simple"===e){var n=r?"*":"",a="__redoc_param_name__",o=UrlTemplate.parse("{"+a+n+"}");return decodeURIComponent(o.expand(((i={})[a]=t,i)))}return console.warn("Unexpected style for header: "+e),""}function serializeCookieParameter(e,r,t,i){return"form"===r?serializeFormValue(e,t,i):(console.warn("Unexpected style for cookie: "+r),"")}export function serializeParameterValueWithMime(e,r){return isJsonLike(r)?JSON.stringify(e):(console.warn("Parameter serialization as "+r+" is not supported"),"")}export function serializeParameterValue(e,r){var t=e.name,i=e.style,n=e.explode,a=void 0!==n&&n,o=e.serializationMime;if(o)switch(e.in){case"path":case"header":return serializeParameterValueWithMime(r,o);case"cookie":case"query":return t+"="+serializeParameterValueWithMime(r,o);default:return console.warn("Unexpected parameter location: "+e.in),""}if(!i)return console.warn("Missing style attribute or content for parameter "+t),"";switch(e.in){case"path":return serializePathParameter(t,i,a,r);case"query":return serializeQueryParameter(t,i,a,r);case"header":return serializeHeaderParameter(i,a,r);case"cookie":return serializeCookieParameter(t,i,a,r);default:return console.warn("Unexpected parameter location: "+e.in),""}}export function langFromMime(e){return-1!==e.search(/xml/i)?"xml":"clike"}var DEFINITION_NAME_REGEX=/^#\/components\/(schemas|pathItems)\/([^/]+)$/;export function isNamedDefinition(e){return DEFINITION_NAME_REGEX.test(e||"")}export function getDefinitionName(e){var r;return null===(r=null==e?void 0:e.match(DEFINITION_NAME_REGEX))||void 0===r?void 0:r.pop()}function humanizeMultipleOfConstraint(e){if(void 0!==e){var r=e.toString(10);return/^0\.0*1$/.test(r)?"decimal places <= "+r.split(".")[1].length:"multiple of "+r}}function humanizeRangeConstraint(e,r,t){var i;return void 0!==r&&void 0!==t?i=r===t?"= "+r+" "+e:"[ "+r+" .. "+t+" ] "+e:void 0!==t?i="<= "+t+" "+e:void 0!==r&&(i=1===r?"non-empty":">= "+r+" "+e),i}export function humanizeNumberRange(e){var r,t,i="number"==typeof e.exclusiveMinimum?Math.min(e.exclusiveMinimum,null!==(r=e.minimum)&&void 0!==r?r:1/0):e.minimum,n="number"==typeof e.exclusiveMaximum?Math.max(e.exclusiveMaximum,null!==(t=e.maximum)&&void 0!==t?t:-1/0):e.maximum,a="number"==typeof e.exclusiveMinimum||e.exclusiveMinimum,o="number"==typeof e.exclusiveMaximum||e.exclusiveMaximum;return void 0!==i&&void 0!==n?(a?"( ":"[ ")+i+" .. "+n+(o?" )":" ]"):void 0!==n?(o?"< ":"<= ")+n:void 0!==i?(a?"> ":">= ")+i:void 0}export function humanizeConstraints(e){var r=[],t=humanizeRangeConstraint("characters",e.minLength,e.maxLength);void 0!==t&&r.push(t);var i=humanizeRangeConstraint("items",e.minItems,e.maxItems);void 0!==i&&r.push(i);var n=humanizeRangeConstraint("properties",e.minProperties,e.maxProperties);void 0!==n&&r.push(n);var a=humanizeMultipleOfConstraint(e.multipleOf);void 0!==a&&r.push(a);var o=humanizeNumberRange(e);return void 0!==o&&r.push(o),e.uniqueItems&&r.push("unique"),r}export function sortByRequired(e,r){void 0===r&&(r=[]);var t=[],i=[],n=[];return e.forEach((function(e){e.required?r.includes(e.name)?i.push(e):n.push(e):t.push(e)})),i.sort((function(e,t){return r.indexOf(e.name)-r.indexOf(t.name)})),__spreadArray(__spreadArray(__spreadArray([],i,!0),n,!0),t,!0)}export function sortByField(e,r){return __spreadArray([],e,!0).sort((function(e,t){return e[r].localeCompare(t[r])}))}export function mergeParams(e,r,t){void 0===r&&(r=[]),void 0===t&&(t=[]);var i={};return t.forEach((function(r){r=e.deref(r).resolved,i[r.name+"_"+r.in]=!0})),(r=r.filter((function(r){return r=e.deref(r).resolved,!i[r.name+"_"+r.in]}))).concat(t)}export function mergeSimilarMediaTypes(e){var r={};return Object.keys(e).forEach((function(t){var i=e[t],n=t.split(";")[0].trim();r[n]?r[n]=__assign(__assign({},r[n]),i):r[n]=i})),r}export function expandDefaultServerVariables(e,r){return void 0===r&&(r={}),e.replace(/(?:{)([\w-.]+)(?:})/g,(function(e,t){return r[t]&&r[t].default||e}))}export function normalizeServers(e,r){var t=void 0===e?removeQueryString(function(){if(!IS_BROWSER)return"";var e=window.location.href;return e.endsWith(".html")?dirname(e):e}()):dirname(e);return 0===r.length&&(r=[{url:"/"}]),r.map((function(e){return __assign(__assign({},e),{url:(r=e.url,resolveUrl(t,r)),description:e.description||""});var r}))}export var SECURITY_DEFINITIONS_COMPONENT_NAME="security-definitions";export var SECURITY_DEFINITIONS_JSX_NAME="SecurityDefinitions";export var SCHEMA_DEFINITION_JSX_NAME="SchemaDefinition";export var shortenHTTPVerb=function(e){return{delete:"del",options:"opts"}[e]||e};export function isRedocExtension(e){return e in{"x-circular-ref":!0,"x-parentRefs":!0,"x-refsStack":!0,"x-code-samples":!0,"x-codeSamples":!0,"x-displayName":!0,"x-examples":!0,"x-ignoredHeaderParameters":!0,"x-logo":!0,"x-nullable":!0,"x-servers":!0,"x-tagGroups":!0,"x-traitTag":!0,"x-additionalPropertiesName":!0,"x-explicitMappingOnly":!0,"x-enumDescriptions":!0,"x-hideTryItPanel":!0}}export function extractExtensions(e,r){return Object.keys(e).filter((function(e){return!0===r?e.startsWith("x-")&&!isRedocExtension(e):e.startsWith("x-")&&r.indexOf(e)>-1})).reduce((function(r,t){return r[t]=e[t],r}),{})}export function pluralizeType(e){return e.split(" or ").map((function(e){return e.replace(/^(string|object|number|integer|array|boolean)s?( ?.*)/,"$1s$2")})).join(" or ")}export function getContentWithLegacyExamples(e){var r=e.content,t=e["x-examples"],i=e["x-example"];if(t){r=__assign({},r);for(var n=0,a=Object.keys(t);n<a.length;n++){var o=t[c=a[n]];r[c]=__assign(__assign({},r[c]),{examples:o})}}else if(i){r=__assign({},r);for(var s=0,u=Object.keys(i);s<u.length;s++){var c,m=i[c=u[s]];r[c]=__assign(__assign({},r[c]),{example:m})}}return r}
|
|
1
|
+
import{__assign,__spreadArray}from"tslib";import{dirname}from"path";import UrlTemplate from"url-template";import{MediaTypes}from"../../../types";import{IS_BROWSER}from"./dom";import{deleteEmptyArrayItem,isArrayOfObjects,isNumeric,removeQueryStringAndHash,resolveUrl}from"./helpers";function isWildcardStatusCode(e){return"string"==typeof e&&/\dxx/i.test(e)}export function isStatusCode(e){return"default"===e||isNumeric(e)||isWildcardStatusCode(e)}export function getStatusCodeType(e,r){if(void 0===r&&(r=!1),"default"===e)return r?"error":"success";var t="string"==typeof e?parseInt(e,10):e;if(isWildcardStatusCode(e)&&(t*=100),t<100||t>599)throw new Error("invalid HTTP code");var i="success";return t>=300&&t<400?i="redirect":t>=400?i="error":t<200&&(i="info"),i}var operationNames={get:!0,post:!0,put:!0,head:!0,patch:!0,delete:!0,options:!0,$ref:!0};export function isOperationName(e){return e in operationNames}export function getOperationSummary(e){return e.summary||e.operationId||e.description&&e.description.substring(0,50)||"<no summary>"}var schemaKeywordTypes={multipleOf:"number",maximum:"number",exclusiveMaximum:"number",minimum:"number",exclusiveMinimum:"number",maxLength:"string",minLength:"string",pattern:"string",contentEncoding:"string",contentMediaType:"string",items:"array",maxItems:"array",minItems:"array",uniqueItems:"array",maxProperties:"object",minProperties:"object",required:"object",additionalProperties:"object",unevaluatedProperties:"object",patternProperties:"object",properties:"object"};export function detectType(e){if(void 0!==e.type&&!Array.isArray(e.type))return e.type;for(var r=0,t=Object.keys(schemaKeywordTypes);r<t.length;r++){var i=t[r],n=schemaKeywordTypes[i];if(void 0!==e[i])return n}return"any"}export function isPrimitiveType(e,r){if(void 0===r&&(r=e.type),e["x-circular-ref"])return!0;if(void 0!==e.oneOf||void 0!==e.anyOf)return!1;if(e.if&&e.then||e.if&&e.else)return!1;var t=!0,i=Array.isArray(r);return("object"===r||i&&(null==r?void 0:r.includes("object")))&&(t=void 0!==e.properties?0===Object.keys(e.properties).length:void 0===e.additionalProperties&&void 0===e.unevaluatedProperties&&void 0===e.patternProperties),!Array.isArray(e.items)&&!Array.isArray(e.prefixItems)&&(void 0!==e.items&&"boolean"!=typeof e.items&&("array"===r||i&&(null==r?void 0:r.includes("array")))&&(t=isPrimitiveType(e.items,e.items.type)),t)}export function isJsonLike(e){return-1!==e.search(/json/i)}export function isFormUrlEncoded(e){return e===MediaTypes.URL_ENCODED}function delimitedEncodeField(e,r,t){return Array.isArray(e)?e.map((function(e){return e.toString()})).join(t):"object"==typeof e?Object.keys(e).map((function(r){return""+r+t+e[r]})).join(t):r+"="+e.toString()}function deepObjectEncodeField(e,r){return Array.isArray(e)?(console.warn("deepObject style cannot be used with array value:"+e.toString()),""):"object"==typeof e?Object.keys(e).map((function(t){return e[t]?r+"["+t+"]="+e[t]:void 0})).filter(Boolean).join("&"):(console.warn("deepObject style cannot be used with non-object value:"+e.toString()),"")}function serializeFormValue(e,r,t){var i,n="__redoc_param_name__",a=r?"*":"";return UrlTemplate.parse("{?"+n+a+"}").expand((i={},i[n]=t,i)).substring(1).replace(/__redoc_param_name__/g,e)}function serializeSimpleValue(e,r){var t,i=e?"*":"",n="__redoc_param_name__",a=UrlTemplate.parse("{"+n+i+"}");return decodeURIComponent(a.expand(((t={})[n]=r,t)))}export function urlFormEncodePayload(e,r){if(void 0===r&&(r={}),Array.isArray(e))throw new Error("Payload must have fields: "+e.toString());return Object.keys(e).map((function(t){var i=e[t],n=r[t]||{},a=n.style,o=void 0===a?"form":a,s=n.explode,u=void 0===s||s;switch(o){case"form":return serializeFormValue(t,u,i);case"spaceDelimited":return delimitedEncodeField(i,t,"%20");case"pipeDelimited":return delimitedEncodeField(i,t,"|");case"deepObject":return deepObjectEncodeField(i,t);default:return console.warn("Incorrect or unsupported encoding style: "+o),""}})).join("&")}function serializePathParameter(e,r,t,i){var n,a=t?"*":"",o="";"label"===r?o=".":"matrix"===r&&(o=";");var s="__redoc_param_name__";return UrlTemplate.parse("{"+o+s+a+"}").expand((n={},n[s]=i,n)).replace(/__redoc_param_name__/g,e)}export function serializeQueryParameter(e,r,t,i){var n=function(n){switch(r){case"form":return serializeFormValue(e,t,n);case"spaceDelimited":return Array.isArray(n)?t?serializeFormValue(e,t,n):e+"="+n.join("%20"):(console.warn("The style spaceDelimited is only applicable to arrays"),"");case"pipeDelimited":return Array.isArray(n)?t?serializeFormValue(e,t,n):e+"="+n.join("|"):(console.warn("The style pipeDelimited is only applicable to arrays"),"");case"deepObject":return!t||Array.isArray(n)||"object"!=typeof n?(console.warn("The style deepObject is only applicable for objects with explode=true"),""):deepObjectEncodeField(n,e);case"simple":return serializeSimpleValue(t,i);default:return console.warn("Unexpected style for query: "+r),""}};return isArrayOfObjects(i)&&(i=deleteEmptyArrayItem(i).map((function(e){return n(e)}))),n(i)}function serializeHeaderParameter(e,r,t){return"simple"===e?serializeSimpleValue(r,t):(console.warn("Unexpected style for header: "+e),"")}function serializeCookieParameter(e,r,t,i){return"form"===r?serializeFormValue(e,t,i):(console.warn("Unexpected style for cookie: "+r),"")}export function serializeParameterValueWithMime(e,r){return isJsonLike(r)?JSON.stringify(e):(console.warn("Parameter serialization as "+r+" is not supported"),"")}export function serializeParameterValue(e,r){var t=e.name,i=e.style,n=e.explode,a=void 0!==n&&n,o=e.serializationMime;if(o)switch(e.in){case"path":case"header":return serializeParameterValueWithMime(r,o);case"cookie":case"query":return t+"="+serializeParameterValueWithMime(r,o);default:return console.warn("Unexpected parameter location: "+e.in),""}if(!i)return console.warn("Missing style attribute or content for parameter "+t),"";switch(e.in){case"path":return serializePathParameter(t,i,a,r);case"query":return serializeQueryParameter(t,i,a,r);case"header":return serializeHeaderParameter(i,a,r);case"cookie":return serializeCookieParameter(t,i,a,r);default:return console.warn("Unexpected parameter location: "+e.in),""}}export function langFromMime(e){return-1!==e.search(/xml/i)?"xml":"clike"}var DEFINITION_NAME_REGEX=/^#\/components\/(schemas|pathItems)\/([^/]+)$/;export function isNamedDefinition(e){return DEFINITION_NAME_REGEX.test(e||"")}export function getDefinitionName(e){var r;return null===(r=null==e?void 0:e.match(DEFINITION_NAME_REGEX))||void 0===r?void 0:r.pop()}function humanizeMultipleOfConstraint(e){if(void 0!==e){var r=e.toString(10);return/^0\.0*1$/.test(r)?"decimal places <= "+r.split(".")[1].length:"multiple of "+r}}function humanizeRangeConstraint(e,r,t){var i;return void 0!==r&&void 0!==t?i=r===t?"= "+r+" "+e:"[ "+r+" .. "+t+" ] "+e:void 0!==t?i="<= "+t+" "+e:void 0!==r&&(i=1===r?"non-empty":">= "+r+" "+e),i}export function humanizeNumberRange(e){var r,t,i="number"==typeof e.exclusiveMinimum?Math.min(e.exclusiveMinimum,null!==(r=e.minimum)&&void 0!==r?r:1/0):e.minimum,n="number"==typeof e.exclusiveMaximum?Math.max(e.exclusiveMaximum,null!==(t=e.maximum)&&void 0!==t?t:-1/0):e.maximum,a="number"==typeof e.exclusiveMinimum||e.exclusiveMinimum,o="number"==typeof e.exclusiveMaximum||e.exclusiveMaximum;return void 0!==i&&void 0!==n?(a?"( ":"[ ")+i+" .. "+n+(o?" )":" ]"):void 0!==n?(o?"< ":"<= ")+n:void 0!==i?(a?"> ":">= ")+i:void 0}export function humanizeConstraints(e){var r=[],t=humanizeRangeConstraint("characters",e.minLength,e.maxLength);void 0!==t&&r.push(t);var i=humanizeRangeConstraint("items",e.minItems,e.maxItems);void 0!==i&&r.push(i);var n=humanizeRangeConstraint("properties",e.minProperties,e.maxProperties);void 0!==n&&r.push(n);var a=humanizeMultipleOfConstraint(e.multipleOf);void 0!==a&&r.push(a);var o=humanizeNumberRange(e);return void 0!==o&&r.push(o),e.uniqueItems&&r.push("unique"),r}export function sortByRequired(e,r){void 0===r&&(r=[]);var t=[],i=[],n=[];return e.forEach((function(e){e.required?r.includes(e.name)?i.push(e):n.push(e):t.push(e)})),i.sort((function(e,t){return r.indexOf(e.name)-r.indexOf(t.name)})),__spreadArray(__spreadArray(__spreadArray([],i,!0),n,!0),t,!0)}export function sortByField(e,r){return __spreadArray([],e,!0).sort((function(e,t){return e[r].localeCompare(t[r])}))}export function mergeParams(e,r,t){void 0===r&&(r=[]),void 0===t&&(t=[]);var i={};return t.forEach((function(r){r=e.deref(r).resolved,i[r.name+"_"+r.in]=!0})),(r=r.filter((function(r){return r=e.deref(r).resolved,!i[r.name+"_"+r.in]}))).concat(t)}export function mergeSimilarMediaTypes(e){var r={};return Object.keys(e).forEach((function(t){var i=e[t],n=t.split(";")[0].trim();r[n]?r[n]=__assign(__assign({},r[n]),i):r[n]=i})),r}export function expandDefaultServerVariables(e,r){return void 0===r&&(r={}),e.replace(/(?:{)([\w-.]+)(?:})/g,(function(e,t){return r[t]&&r[t].default||e}))}export function normalizeServers(e,r){var t=void 0===e?removeQueryStringAndHash(function(){if(!IS_BROWSER)return"";var e=window.location.href;return e.endsWith(".html")?dirname(e):e}()):dirname(e);return 0===r.length&&(r=[{url:"/"}]),r.map((function(e){return __assign(__assign({},e),{url:(r=e.url,resolveUrl(t,r)),description:e.description||""});var r}))}export var SECURITY_DEFINITIONS_COMPONENT_NAME="security-definitions";export var SECURITY_DEFINITIONS_JSX_NAME="SecurityDefinitions";export var SCHEMA_DEFINITION_JSX_NAME="SchemaDefinition";export var shortenHTTPVerb=function(e){return{delete:"del",options:"opts"}[e]||e};export function isRedocExtension(e){return e in{"x-circular-ref":!0,"x-parentRefs":!0,"x-refsStack":!0,"x-code-samples":!0,"x-codeSamples":!0,"x-displayName":!0,"x-examples":!0,"x-ignoredHeaderParameters":!0,"x-logo":!0,"x-nullable":!0,"x-servers":!0,"x-tagGroups":!0,"x-traitTag":!0,"x-additionalPropertiesName":!0,"x-explicitMappingOnly":!0,"x-enumDescriptions":!0,"x-hideTryItPanel":!0}}export function extractExtensions(e,r){return Object.keys(e).filter((function(e){return!0===r?e.startsWith("x-")&&!isRedocExtension(e):e.startsWith("x-")&&r.indexOf(e)>-1})).reduce((function(r,t){return r[t]=e[t],r}),{})}export function pluralizeType(e){return e.split(" or ").map((function(e){return e.replace(/^(string|object|number|integer|array|boolean)s?( ?.*)/,"$1s$2")})).join(" or ")}export function getContentWithLegacyExamples(e){var r=e.content,t=e["x-examples"],i=e["x-example"];if(t){r=__assign({},r);for(var n=0,a=Object.keys(t);n<a.length;n++){var o=t[m=a[n]];r[m]=__assign(__assign({},r[m]),{examples:o})}}else if(i){r=__assign({},r);for(var s=0,u=Object.keys(i);s<u.length;s++){var m,l=i[m=u[s]];r[m]=__assign(__assign({},r[m]),{example:l})}}return r}
|
|
2
2
|
//# sourceMappingURL=openapi.js.map
|