cocoda-sdk 3.6.4 → 3.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * cocoda-sdk v3.6.4
2
+ * cocoda-sdk v3.6.5
3
3
  * Copyright (c) 2021 Verbundzentrale des GBV (VZG)
4
4
  * @license MIT
5
5
  *
@@ -13,7 +13,7 @@ var CDK=(()=>{var La=Object.create;var Xt=Object.defineProperty,Fa=Object.define
13
13
  `+s):n.stack=s}catch(o){}}throw n}})}_request(e,r){typeof e=="string"?(r=r||{},r.url=e):r=e||{},r=ke(this.defaults,r);let{transitional:n,paramsSerializer:i,headers:s}=r;n!==void 0&&fr.assertOptions(n,{silentJSONParsing:Be.transitional(Be.boolean),forcedJSONParsing:Be.transitional(Be.boolean),clarifyTimeoutError:Be.transitional(Be.boolean)},!1),i!=null&&(A.isFunction(i)?r.paramsSerializer={serialize:i}:fr.assertOptions(i,{encode:Be.function,serialize:Be.function},!0)),fr.assertOptions(r,{baseUrl:Be.spelling("baseURL"),withXsrfToken:Be.spelling("withXSRFToken")},!0),r.method=(r.method||this.defaults.method||"get").toLowerCase();let o=s&&A.merge(s.common,s[r.method]);s&&A.forEach(["delete","get","head","post","put","patch","common"],f=>{delete s[f]}),r.headers=de.concat(o,s);let a=[],u=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(r)===!1||(u=u&&d.synchronous,a.unshift(d.fulfilled,d.rejected))});let l=[];this.interceptors.response.forEach(function(d){l.push(d.fulfilled,d.rejected)});let c,p=0,m;if(!u){let f=[jr.bind(this),void 0];for(f.unshift.apply(f,a),f.push.apply(f,l),m=f.length,c=Promise.resolve(r);p<m;)c=c.then(f[p++],f[p++]);return c}m=a.length;let g=r;for(p=0;p<m;){let f=a[p++],d=a[p++];try{g=f(g)}catch(y){d.call(this,y);break}}try{c=jr.call(this,g)}catch(f){return Promise.reject(f)}for(p=0,m=l.length;p<m;)c=c.then(l[p++],l[p++]);return c}getUri(e){e=ke(this.defaults,e);let r=cr(e.baseURL,e.url);return sr(r,e.params,e.paramsSerializer)}};A.forEach(["delete","get","head","options"],function(e){Pt.prototype[e]=function(r,n){return this.request(ke(n||{},{method:e,url:r,data:(n||{}).data}))}});A.forEach(["post","put","patch"],function(e){function r(n){return function(s,o,a){return this.request(ke(a||{},{method:e,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:o}))}}Pt.prototype[e]=r(),Pt.prototype[e+"Form"]=r(!0)});var hr=Pt;var Vn=class t{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let r;this.promise=new Promise(function(s){r=s});let n=this;this.promise.then(i=>{if(!n._listeners)return;let s=n._listeners.length;for(;s-- >0;)n._listeners[s](i);n._listeners=null}),this.promise.then=i=>{let s,o=new Promise(a=>{n.subscribe(a),s=a}).then(i);return o.cancel=function(){n.unsubscribe(s)},o},e(function(s,o,a){n.reason||(n.reason=new Fe(s,o,a),r(n.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;let r=this._listeners.indexOf(e);r!==-1&&this._listeners.splice(r,1)}toAbortSignal(){let e=new AbortController,r=n=>{e.abort(n)};return this.subscribe(r),e.signal.unsubscribe=()=>this.unsubscribe(r),e.signal}static source(){let e;return{token:new t(function(i){e=i}),cancel:e}}},zs=Vn;function Jn(t){return function(r){return t.apply(null,r)}}function Kn(t){return A.isObject(t)&&t.isAxiosError===!0}var Yn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Yn).forEach(([t,e])=>{Yn[e]=t});var $s=Yn;function Ws(t){let e=new hr(t),r=rr(hr.prototype.request,e);return A.extend(r,hr.prototype,e,{allOwnKeys:!0}),A.extend(r,e,null,{allOwnKeys:!0}),r.create=function(i){return Ws(ke(t,i))},r}var he=Ws(Rt);he.Axios=hr;he.CanceledError=Fe;he.CancelToken=zs;he.isCancel=ur;he.VERSION=Ur;he.toFormData=nt;he.AxiosError=Y;he.Cancel=he.CanceledError;he.all=function(e){return Promise.all(e)};he.spread=Jn;he.isAxiosError=Kn;he.mergeConfig=ke;he.AxiosHeaders=de;he.formToJSON=t=>Dr(A.isHTMLForm(t)?new FormData(t):t);he.getAdapter=Br.getAdapter;he.HttpStatusCode=$s;he.default=he;var pe=he;var{Axios:vp,AxiosError:Sp,CanceledError:xp,isCancel:Ep,CancelToken:Ap,VERSION:Cp,all:Op,Cancel:kp,isAxiosError:Rp,spread:Ip,toFormData:Tp,AxiosHeaders:Pp,HttpStatusCode:Dp,formToJSON:Mp,getAdapter:Np,mergeConfig:Lp}=pe;var il=/[\\^$.*+?()[\]{}|]/g,sl=t=>t.replace(il,"\\$&"),ol=/[%ÄÖÜäöü ]/g,Xn=class{constructor(e={}){if(Object.assign(this,e),this.notationPattern||(this.notationPattern=".+"),!this.uriPattern&&this.namespace){this.uriPattern="^"+sl(this.namespace);let r=this.notationPattern.replace(ol,encodeURI);this.uriPattern+="("+r+")$"}this.NOTATION_REGEX=RegExp("^("+this.notationPattern+")$"),this.uriPattern&&(this.URI_REGEX=RegExp(this.uriPattern))}isValidNotation(e){return this.NOTATION_REGEX.exec(e)}notationFromUri(e){if(this.URI_REGEX){let r=this.URI_REGEX.exec(e);if(r)return decodeURI(r[1])}}uriFromNotation(e){if(this.uriPattern)return e=encodeURIComponent(e),this.uriPattern.replace(/^\^|\$$/g,"").replace(/\\/g,"").replace(/\(.*\)/,e)}conceptFromUri(e,r={}){let n=this.notationFromUri(e);if(n===void 0)return;let i={uri:e,notation:[n]};return r.inScheme&&(i.inScheme=[{uri:this.uri}]),r.topConcept&&(i.topConceptOf=[{uri:this.uri}]),i}conceptFromNotation(e,r){if(this.isValidNotation(e))return this.conceptFromUri(this.uriFromNotation(e),r)}},$r=Xn;function Dt(t,e,r){let n=Array.prototype.slice,i=typeof Object.keys=="function"?Object.keys:function(l){let c=[];for(let p in l)c.push(p);return c},s=function(l,c){return l===c?!0:l instanceof Date&&c instanceof Date?l.getTime()===c.getTime():typeof l!="object"&&typeof c!="object"?l==c:u(l,c)};function o(l){return l==null}function a(l){return Object.prototype.toString.call(l)=="[object Arguments]"}function u(l,c){if(o(l)||o(c)||l.prototype!==c.prototype)return!1;if(a(l))return a(c)?(l=n.call(l),c=n.call(c),s(l,c)):!1;let p,m,g,f;try{p=i(l),m=i(c)}catch(d){return!1}if(p.length!=m.length)return!1;for(p.sort(),m.sort(),f=p.length-1;f>=0;f--)if(p[f]!=m[f])return!1;for(f=p.length-1;f>=0;f--)if(g=p[f],r){let d=r(l[g],c[g],g);if(d===void 0&&(d=Dt(l[g],c[g])),!d)return!1}else if(!s(l[g],c[g]))return!1;return!0}return s(t,e)}function te(t,e,r=void 0){let n=s=>String.prototype.split.call(e,s).filter(Boolean).reduce((o,a)=>o!=null?o[a]:o,t),i=n(/[,[\]]+?/)||n(/[,[\].]+?/);return i===void 0||i===t?r:i}function Mt(t,e){return e.reduce((r,n)=>(t&&t.hasOwnProperty(n)&&(r[n]=t[n]),r),{})}function pr(t,e){for(let r in t)t.hasOwnProperty(r)&&e(t[r],r)}function Nt(t){return typeof t=="object"&&t!==null}function dr(t){return!!(t&&typeof t.valueOf()=="string")}function Hs(t,e){return[...new Set([...t,...e])]}function qs(t,e,r){return[...t,...e].reduce((n,i)=>(n.findIndex(s=>r(s,i))!==-1||n.push(i),n),[])}function Vs(t,e){for(let r of e){typeof r=="string"&&(r=r.split("."));for(let n=0;n<r.length-1;n++)t=t[r[n]];delete t[r.pop()]}}var Wr={store:null,path:"",defaults:["en"],getLanguages:Ks,selectLanguage:al};function Ks(){return te(Wr.store,Wr.path)||Wr.defaults}function al(t){if(!t)return null;for(let e of Ks())if(t[e])return e;for(let e of Object.keys(t))if(e!="-")return e;return null}var Hr=Wr;var ei={};pt(ei,{addMappingIdentifiers:()=>Qn,compareMappingContent:()=>ul,compareMappingMembers:()=>ll,compareMappings:()=>ro,mappingContent:()=>Gs,mappingContentIdentifier:()=>Zs,mappingMembers:()=>Qs,mappingMembersIdentifier:()=>eo});function Gn(t){var e=function(F,N){var S=F<<N|F>>>32-N;return S},r=function(F){var N="",S,k;for(S=7;S>=0;S--)k=F>>>S*4&15,N+=k.toString(16);return N},n,i,s,o=new Array(80),a=1732584193,u=4023233417,l=2562383102,c=271733878,p=3285377520,m,g,f,d,y,O;t=unescape(encodeURIComponent(t));var I=t.length,C=[];for(i=0;i<I-3;i+=4)s=t.charCodeAt(i)<<24|t.charCodeAt(i+1)<<16|t.charCodeAt(i+2)<<8|t.charCodeAt(i+3),C.push(s);switch(I%4){case 0:i=2147483648;break;case 1:i=t.charCodeAt(I-1)<<24|8388608;break;case 2:i=t.charCodeAt(I-2)<<24|t.charCodeAt(I-1)<<16|32768;break;case 3:i=t.charCodeAt(I-3)<<24|t.charCodeAt(I-2)<<16|t.charCodeAt(I-1)<<8|128;break}for(C.push(i);C.length%16!==14;)C.push(0);for(C.push(I>>>29),C.push(I<<3&4294967295),n=0;n<C.length;n+=16){for(i=0;i<16;i++)o[i]=C[n+i];for(i=16;i<=79;i++)o[i]=e(o[i-3]^o[i-8]^o[i-14]^o[i-16],1);for(m=a,g=u,f=l,d=c,y=p,i=0;i<=19;i++)O=e(m,5)+(g&f|~g&d)+y+o[i]+1518500249&4294967295,y=d,d=f,f=e(g,30),g=m,m=O;for(i=20;i<=39;i++)O=e(m,5)+(g^f^d)+y+o[i]+1859775393&4294967295,y=d,d=f,f=e(g,30),g=m,m=O;for(i=40;i<=59;i++)O=e(m,5)+(g&f|g&d|f&d)+y+o[i]+2400959708&4294967295,y=d,d=f,f=e(g,30),g=m,m=O;for(i=60;i<=79;i++)O=e(m,5)+(g^f^d)+y+o[i]+3395469782&4294967295,y=d,d=f,f=e(g,30),g=m,m=O;a=a+m&4294967295,u=u+g&4294967295,l=l+f&4294967295,c=c+d&4294967295,p=p+y&4294967295}return O=r(a)+r(u)+r(l)+r(c)+r(p),O.toLowerCase()}function Xs(t){return t.map(e=>e&&e.uri).filter(Boolean)}function Zn(t){return["memberSet","memberList","memberChoice"].find(e=>t[e])}function Ys(t){let e=Zn(t),r=t[e]?Xs(t[e]):[];return{[r.length>1?e:"memberSet"]:r.map(n=>({uri:n}))}}function Gs(t){let{from:e,to:r,type:n}=t,i={from:Ys(e||{}),to:Ys(r||{}),type:[n&&n[0]||"http://www.w3.org/2004/02/skos/core#mappingRelation"]};for(let s of["from","to"])if((i[s][Zn(i[s])]||[]).length==0){let o=t[s+"Scheme"];o&&o.uri&&(i[s+"Scheme"]={uri:o.uri})}return i}function Qs(t){let{from:e,to:r}=t,n=[e,r].filter(Boolean).map(i=>Xs(i[Zn(i)]||[]));return[].concat(...n).sort()}function Zs(t){let e=JSON.stringify(Gs(t),["from","fromScheme","to","toScheme","type","memberSet","memberList","memberChoice","uri"]);return"urn:jskos:mapping:content:"+Gn(e+`
14
14
  `)}function eo(t){let e=JSON.stringify(Qs(t));return"urn:jskos:mapping:members:"+Gn(e+`
15
15
  `)}function Qn(t){let e=(t.identifier||[]).filter(r=>r&&!r.startsWith("urn:jskos:mapping:")).concat([eo(t),Zs(t)]).sort();return Object.assign({},t,{identifier:e})}function to(t,e,r){t=t&&Qn(t),e=e&&Qn(e);let n=t&&t.identifier?t.identifier.find(s=>s.startsWith(r)):null,i=e&&e.identifier?e.identifier.find(s=>s.startsWith(r)):null;return n==i}function ro(t,e){return to(t,e,"urn:jskos:mapping:content:")}var ul=ro;function ll(t,e){return to(t,e,"urn:jskos:mapping:members:")}var si={};pt(si,{addContext:()=>fl,annotationCreatorMatches:()=>Ll,annotationCreatorName:()=>Nl,annotationCreatorUri:()=>Ml,clean:()=>ni,cleanJSKOS:()=>hl,compare:()=>it,compareConcepts:()=>gl,compareFunctions:()=>Rl,compareMappingsDeep:()=>Cl,compareObjects:()=>dl,compareSchemes:()=>ml,conceptsOfMapping:()=>gt,copyDeep:()=>Jr,deepCopy:()=>pl,defaultMappingType:()=>oo,definition:()=>Pl,flattenMapping:()=>xl,getAllUris:()=>ti,guessObjectType:()=>Vr,guessSchemeFromNotation:()=>Fl,isConcept:()=>wl,isContainedIn:()=>so,isScheme:()=>io,isSchemeInList:()=>yl,isValidUri:()=>kl,languageMapContent:()=>ii,mappingCSV:()=>Al,mappingRegistryIsStored:()=>Dl,mappingTypeByType:()=>Sl,mappingTypeByUri:()=>wr,mappingTypes:()=>mr,matchObjectTypes:()=>Ol,merge:()=>lo,mergeUris:()=>uo,minifyMapping:()=>vl,normalize:()=>ri,notation:()=>Tl,objectTypes:()=>gr,prefLabel:()=>Ft,sortConcepts:()=>_l,sortSchemes:()=>bl,usedObjectTypes:()=>no,userOwnsMapping:()=>Il});var mr=[{RELEVANCE:"very high",broader:[{uri:"http://www.w3.org/2004/02/skos/core#closeMatch"}],definition:{de:["gleiche Bedeutung"],en:["same meaning"]},notation:["="],prefLabel:{ar:"\u062A\u0637\u0627\u0628\u0642 \u062A\u0627\u0645",be:"\u0434\u0430\u043A\u043B\u0430\u0434\u043D\u0430\u044F \u0430\u0434\u043F\u0430\u0432\u0435\u0434\u043D\u0430\u0441\u0446\u044C","be-tarask":"\u0434\u0430\u043A\u043B\u0430\u0434\u043D\u0430\u044F \u0430\u0434\u043F\u0430\u0432\u0435\u0434\u043D\u0430\u0441\u044C\u0446\u044C",bn:"\u09B9\u09C1\u09AC\u09C1\u09B9\u09C1 \u09AE\u09BF\u09B2",bs:"ta\u010Dno podudaranje",ca:"equival\xE8ncia exacta",cs:"p\u0159esn\xE1 shoda",da:"exact match",de:"exakte \xDCbereinstimmung",el:"\u03B1\u03BA\u03C1\u03B9\u03B2\u03AE\u03C2 \u03B1\u03BD\u03C4\u03B9\u03C3\u03C4\u03BF\u03B9\u03C7\u03AF\u03B1",en:"exact match",eo:"ekzakta ekvivalento",es:"equivalencia exacta",et:"t\xE4pne vaste",fi:"vastaava k\xE4site",fr:"\xE9quivalence exacte",ga:"meaitse\xE1il chruinn",gl:"correspondencia exacta",he:"\u05D4\u05EA\u05D0\u05DE\u05D4 \u05DE\u05D3\u05D5\u05D9\u05E7\u05EA",hu:"pontos egyez\xE9s",id:"sama persis",it:"corrispondenza esatta",ja:"\u5B8C\u5168\u4E00\u81F4",lv:"tie\u0161a sakrit\u012Bba",mk:"\u0442\u043E\u0447\u043D\u043E \u0441\u043E\u0432\u043F\u0430\u0453\u0430\u045A\u0435",ms:"padanan tepat","ms-arab":"\u06A4\u0627\u062F\u0646\u0646 \u062A\u06A4\u062A",nb:"eksakt samsvar",nl:"exacte match",nn:"eksakt samsvar",pl:"dok\u0142adne dopasowanie",pt:"correspond\xEAncia exata",ro:"echivalentul exact",ru:"\u0442\u043E\u0447\u043D\u043E\u0435 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435",sl:"natan\u010Dno ujemanje",sq:"p\xEBrputhje e p\xEBrpikt\xEB",sr:"\u0442\u0430\u0447\u043D\u043E \u043F\u043E\u0434\u0443\u0434\u0430\u0440\u0430\u045A\u0435",sv:"exakt tr\xE4ff",tr:"tam e\u015Fle\u015Fme",uk:"\u0442\u043E\u0447\u043D\u0430 \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u043D\u0456\u0441\u0442\u044C",ur:"\u0628\u0627\u0644\u06A9\u0644 \u062F\u0631\u0633\u062A \u062C\u0648\u0691",zh:"\u7CBE\u78BA\u5339\u914D","zh-cn":"\u7CBE\u786E\u5339\u914D","zh-hans":"\u7CBE\u786E\u5339\u914D","zh-hant":"\u7CBE\u78BA\u5339\u914D"},SHORT:"exact",uri:"http://www.w3.org/2004/02/skos/core#exactMatch"},{RELEVANCE:"high",broader:[{uri:"http://www.w3.org/2004/02/skos/core#mappingRelation"}],definition:{de:["in etwa gleiche Bedeutung"],en:["same general idea but not fully identical meaning"]},notation:["\u2248"],prefLabel:{ar:"\u062A\u0637\u0627\u0628\u0642 \u0642\u0631\u064A\u0628","be-tarask":"\u0431\u043B\u0456\u0437\u043A\u0430\u044F \u0430\u0434\u043F\u0430\u0432\u0435\u0434\u043D\u0430\u0441\u044C\u0446\u044C",ca:"equival\xE8ncia inexacta",de:"hohe \xDCbereinstimmung",el:"\u03C3\u03C4\u03B5\u03BD\u03AE \u03B1\u03BD\u03C4\u03B9\u03C3\u03C4\u03BF\u03B9\u03C7\u03AF\u03B1",en:"close match",eo:"proksima kongrua\u0135o",es:"equivalencia inexacta",fi:"l\xE4hes vastaava k\xE4site",fr:"quasi-\xE9quivalence",he:"\u05D4\u05EA\u05D0\u05DE\u05D4 \u05E7\u05E8\u05D5\u05D1\u05D4",hu:"kv\xE1zi-egyen\xE9rt\xE9k\u0171s\xE9g",it:"corrispondenza parziale",ja:"\u985E\u4F3C\u4E00\u81F4",mk:"\u0431\u043B\u0438\u0441\u043A\u043E \u0441\u043E\u0432\u043F\u0430\u0453\u0430\u045A\u0435",ms:"padanan dekat","ms-arab":"\u06A4\u0627\u062F\u0646\u0646 \u062F\u06A9\u062A",nb:"n\xE6rt samsvar",nl:"nabije match",nn:"n\xE6rt samsvar",pl:"cz\u0119\u015Bciowe dopasowanie",pt:"correspond\xEAncia pr\xF3xima",ru:"\u0431\u043B\u0438\u0437\u043A\u043E\u0435 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435",sl:"visoko ujemanje",sr:"\u0431\u043B\u0438\u0441\u043A\u043E \u043F\u043E\u043A\u043B\u0430\u043F\u0430\u045A\u0435",sv:"n\xE4ra matchning",tr:"yak\u0131n e\u015Fle\u015Fme","zh-hans":"\u9AD8\u5EA6\u5339\u914D"},SHORT:"close",uri:"http://www.w3.org/2004/02/skos/core#closeMatch"},{RELEVANCE:"medium",broader:[{uri:"http://www.w3.org/2004/02/skos/core#mappingRelation"}],definition:{de:["umfassendere Bedeutung"],en:["broader meaning"]},notation:[">"],prefLabel:{"be-tarask":"\u0448\u044B\u0440\u043E\u043A\u0430\u044F \u0430\u0434\u043F\u0430\u0432\u0435\u0434\u043D\u0430\u0441\u044C\u0446\u044C",ca:"relaci\xF3 llunyana",cs:"\u0161ir\u0161\xED koncept",de:"allgemeinere Bedeutung",en:"broad match",eo:"malstrikta kongruo",et:"laiem vaste",fi:"vastaava laajempi k\xE4site",he:"\u05D4\u05EA\u05D0\u05DE\u05D4 \u05E8\u05D7\u05D1\u05D4",hu:"t\xE1gabb jelent\xE9s",it:"corrispondenza con termine pi\xF9 generico",ja:"\u5E83\u7FA9\u4E00\u81F4",mk:"\u043F\u043E\u0448\u0438\u0440\u043E\u043A\u043E \u0441\u043E\u0432\u043F\u0430\u0453\u0430\u045A\u0435",nb:"bredere samsvar",nl:"brede match",nn:"breitt samsvar",pl:"dopasowanie poj\u0119cia o szerszym znaczeniu","pt-br":"correspond\xEAncia gen\xE9rica",ru:"\u0431\u043E\u043B\u0435\u0435 \u0448\u0438\u0440\u043E\u043A\u043E\u0435 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435",sl:"splo\u0161ni pomen",sr:"\u0443 \u0448\u0438\u0440\u0435\u043C \u0441\u043C\u0438\u0441\u043B\u0443",sv:"bred tr\xE4ff",uk:"\u0448\u0438\u0440\u0448\u0430 \u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u043D\u0456\u0441\u0442\u044C",vi:"\u0111\u1ED1i s\xE1nh r\u1ED9ng","zh-hans":"\u5E7F\u6CDB\u5339\u914D"},related:[{uri:"http://www.w3.org/2004/02/skos/core#narrowMatch"}],SHORT:"broad",uri:"http://www.w3.org/2004/02/skos/core#broadMatch"},{RELEVANCE:"medium",broader:[{uri:"http://www.w3.org/2004/02/skos/core#mappingRelation"}],definition:{en:["more specific meaning"]},notation:["<"],prefLabel:{"be-tarask":"\u0432\u0443\u0437\u043A\u0430\u044F \u0430\u0434\u043F\u0430\u0432\u0435\u0434\u043D\u0430\u0441\u044C\u0446\u044C",ca:"relaci\xF3 estreta",de:"spezifischere Bedeutung",en:"narrow match",eo:"strikta kongruo",et:"kitsam vaste",fi:"vastaava suppeampi k\xE4site",he:"\u05D4\u05EA\u05D0\u05DE\u05D4 \u05E6\u05E8\u05D4",hu:"sz\u0171kebb jelent\xE9s",it:"corrispondenza con termine pi\xF9 specifico",ja:"\u72ED\u7FA9\u4E00\u81F4",mk:"\u043F\u043E\u0442\u0435\u0441\u043D\u043E \u0441\u043E\u0432\u043F\u0430\u0453\u0430\u045A\u0435",nb:"smalere samsvar",nl:"nauwe match",nn:"snevert samsvar",pl:"dopasowanie poj\u0119cia o w\u0119\u017Cszym znaczeniu","pt-br":"correspond\xEAncia aproximada",ru:"\u0431\u043E\u043B\u0435\u0435 \u0443\u0437\u043A\u043E\u0435 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435",sl:"ozki pomen",sr:"\u0443 \u0443\u0436\u0435\u043C \u0441\u043C\u0438\u0441\u043B\u0443",sv:"smal tr\xE4ff",ur:"\u0646\u06CC\u0631\u0648 \u0645\u06CC\u0686",vi:"\u0111\u1ED1i s\xE1nh h\u1EB9p","zh-hans":"\u6709\u9650\u5339\u914D"},related:[{uri:"http://www.w3.org/2004/02/skos/core#broadMatch"}],SHORT:"narrow",uri:"http://www.w3.org/2004/02/skos/core#narrowMatch"},{RELEVANCE:"low",broader:[{uri:"http://www.w3.org/2004/02/skos/core#mappingRelation"}],definition:{de:["assoziative Verkn\xFCpfung unterschiedlicher Bedeutungen"],en:["associative link between meanings"]},notation:["~"],prefLabel:{"be-tarask":"\u0437\u044C\u0432\u044F\u0437\u0430\u043D\u0430\u044F \u0430\u0434\u043F\u0430\u0432\u0435\u0434\u043D\u0430\u0441\u044C\u0446\u044C",ca:"parella relacionada",de:"verwandte Bedeutung",en:"related match",eo:"rilata kongruo",fi:"liittyv\xE4 k\xE4site",fr:"association",he:"\u05D4\u05EA\u05D0\u05DE\u05D4 \u05E7\u05E9\u05D5\u05E8\u05D4",hu:"rokon jelent\xE9s",it:"corrispondenza correlata",ja:"\u95A2\u9023\u4E00\u81F4",lv:"saist\u012Bta sakrit\u012Bba",mk:"\u043F\u043E\u0432\u0440\u0437\u0430\u043D\u043E \u0441\u043E\u0432\u043F\u0430\u0453\u0430\u045A\u0435",ms:"padanan berkaitan","ms-arab":"\u06A4\u0627\u062F\u0646\u0646 \u0628\u0631\u06A9\u0627\u0621\u064A\u062A\u0646",nb:"relatert samsvar",nl:"gerelateerde match",pl:"dopasowanie poj\u0119cia o powi\u0105zanym znaczeniu",ru:"\u0430\u0441\u0441\u043E\u0446\u0438\u0430\u0442\u0438\u0432\u043D\u043E\u0435 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435",sl:"povezano ujemanje",tr:"ili\u015Fkili benze\u015Fme",uk:"\u043F\u043E\u0432\u2019\u044F\u0437\u044C",ur:"\u0645\u062A\u0639\u0644\u0642\u06C1 \u0645\u06CC\u0686",vec:"parente\u0142a re\u0142asionada","zh-hans":"\u5173\u8054\u5339\u914D"},SHORT:"related",uri:"http://www.w3.org/2004/02/skos/core#relatedMatch"},{RELEVANCE:"generic",definition:{de:["unbekannter Bedeutungszusammenhang"],en:["unknown type of link between meanings"]},notation:["\u2192"],prefLabel:{ar:"\u0646\u0648\u0639 \u0639\u0644\u0627\u0642\u0629 \u0627\u0644\u062A\u0637\u0628\u064A\u0642",be:"\u0445\u0430\u0440\u0430\u043A\u0442\u044D\u0440\u043D\u0430\u044F \u0430\u0434\u043D\u043E\u0441\u0456\u043D\u0430 \u0430\u0434\u043B\u044E\u0441\u0442\u0440\u0430\u0432\u0430\u043D\u043D\u044F","be-tarask":"\u0445\u0430\u0440\u0430\u043A\u0442\u044D\u0440\u043D\u0430\u044F \u0430\u0434\u043D\u043E\u0441\u0456\u043D\u0430 \u0430\u0434\u043B\u044E\u0441\u0442\u0440\u0430\u0432\u0430\u043D\u044C\u043D\u044F",ca:"relaci\xF3 de mapatge",de:"allgemeine Mapping-Relation",en:"SKOS generic mapping relation",fi:"SKOS-kartoitussuhde",fr:"lien de correspondance SKOS",he:"\u05D9\u05D7\u05E1 \u05DE\u05D9\u05E4\u05D5\u05D9 \u05DB\u05DC\u05DC\u05D9",id:"relasi pemetaan",ja:"SKOS\u4E00\u822C\u30DE\u30C3\u30D4\u30F3\u30B0\u95A2\u4FC2",mk:"\u043F\u0440\u0435\u0441\u043B\u0438\u043A\u0443\u0432\u0430\u0447\u043A\u0438 \u043E\u0434\u043D\u043E\u0441",nb:"SKOS generisk mappingrelasjon","pt-br":"rela\xE7\xE3o gen\xE9rica de mapeamento",sl:"splo\u0161na relacija kartiranja SKOS",sr:"\u0440\u0435\u043B\u0430\u0446\u0438\u0458\u0430 \u043C\u0430\u043F\u0438\u0440\u0430\u045A\u0430",sv:"mappnings relation",zh:"\u6620\u5C04\u95DC\u4FC2","zh-hant":"\u6620\u5C04\u95DC\u4FC2"},SHORT:"",uri:"http://www.w3.org/2004/02/skos/core#mappingRelation"}];var gr={Concept:{type:["http://www.w3.org/2004/02/skos/core#Concept"]},ConceptScheme:{type:["http://www.w3.org/2004/02/skos/core#ConceptScheme"]},ConceptMapping:{type:mr.map(t=>t.uri)},ConceptOccurrence:{},Registry:{type:["http://www.w3.org/ns/dcat#Catalog","http://purl.org/cld/cdtype/CatalogueOrIndex"]},Distribution:{type:["http://www.w3.org/ns/dcat#Distribution"]},Service:{type:["http://www.w3.org/ns/dcat#DataService"]},Dataset:{type:["http://www.w3.org/ns/dcat#Dataset"]},Concordance:{type:["http://rdf-vocabulary.ddialliance.org/xkos#Correspondence","http://rdfs.org/ns/void#Linkset","http://purl.org/spar/fabio/VocabularyMapping"]},Resource:{},Item:{},ConceptBundle:{},Annotation:{type:["Annotation","http://www.w3.org/ns/oa#Annotation"]}},qr=Object.keys(gr).reduce((t,e)=>{for(let r of gr[e].type||[])t[r]=e;return t},{});function Vr(t,e=!1){let r;if(typeof t=="string"&&t)t in qr?r=qr[t]:(t=t.toLowerCase().replace(/s$/,""),r=Object.keys(gr).find(n=>{let i=n.toLowerCase();if(i===t||i==="concept"+t)return!0}));else if(typeof t=="object"&&t.type){let n=Array.isArray(t.type)?t.type:[t.type];for(let i of n)if(i in qr){r=qr[i];break}}return e&&r?r.toLowerCase().replace(/^concept(.+)/,"$1"):r}function no(t){var n;let e=[],r={concepts:"http://www.w3.org/2004/02/skos/core#Concept",schemes:"http://www.w3.org/2004/02/skos/core#ConceptScheme",mappings:"http://www.w3.org/2004/02/skos/core#mappingRelation",concordances:"http://rdf-vocabulary.ddialliance.org/xkos#Correspondence",registries:"http://www.w3.org/ns/dcat#Catalog",types:"http://www.w3.org/2002/07/owl#Class",properties:"http://www.w3.org/1999/02/22-rdf-syntax-ns#Property",annotations:"http://www.w3.org/ns/oa#Annotation"};for(let i in r)(n=t[i])!=null&&n.find(s=>s!==null)&&e.push(r[i]);return e.sort()}var cl=t=>/^[A-Z]*$/.test(t),Lt=(t,e)=>e.split(".").reduce((r,n)=>r&&r[n]?r[n]:null,t),fl=t=>((t instanceof Array?t:[t]).forEach(r=>{r["@context"]="https://gbv.github.io/jskos/context.json"}),t),ni=t=>(Object.keys(t).forEach(e=>{cl(e)||e.startsWith("_")?delete t[e]:t[e]!=null&&typeof t[e]=="object"&&(t[e]=ni(t[e]))}),t),hl=ni,Jr=(t,e=[],r=!0)=>{e=e.concat(["ancestors","narrower","broader","mappings","memberList","TOPCONCEPTS","MAPPINGS","PROVIDER"]);let n=Array.isArray(t)?[]:{};for(let i in t)if(!(r&&i[0]=="_")){if(e.includes(i))if(t[i]&&Array.isArray(t[i])){t[i].length>0?n[i]=[null]:n[i]=[];continue}else{n[i]=null;continue}if(i=="inScheme"){let s=[];for(let o of t.inScheme){let a={uri:o.uri};o.notation&&(a.notation=o.notation),o.prefLabel&&(a.prefLabel=o.prefLabel),s.push(a)}n.inScheme=s;continue}t[i]!=null&&typeof t[i]=="object"?n[i]=Jr(t[i]):n[i]=t[i]}return n},pl=Jr,ti=t=>t?(t.uri?[t.uri]:[]).concat(t.identifier||[]).filter(Boolean):[],it=(t,e)=>{if(t==null&&e==null)return!0;let r=i=>i.replace("https://","http://"),n=ti(t).map(r);for(let i of ti(e).map(r))if(n.indexOf(i)!==-1)return!0;return!1},dl=it,ml=it,gl=it,wl=t=>{var e;return((e=te(t,"type",[]))==null?void 0:e.includes("http://www.w3.org/2004/02/skos/core#Concept"))||te(t,"inScheme")!=null||te(t,"topConceptOf")!=null},io=t=>{var e;return(e=te(t,"type",[]))==null?void 0:e.includes("http://www.w3.org/2004/02/skos/core#ConceptScheme")},so=(t,e)=>{if(!t||!e)return!1;for(let r of e)if(it(t,r))return!0;return!1},yl=so,_l=(t,e=!1)=>t.sort((r,n)=>{let i=te(r,"notation[0]"),s=te(n,"notation[0]");if(i&&s&&(i=i.toLowerCase(),s=s.toLowerCase()),e&&i&&s){let o,a;if(o=parseFloat(i),a=parseFloat(s),!o&&!a){let u=`${i}`.split(/[^\w\d]/),l=`${s}`.split(/[^\w\d]/);for(let c=0;c<Math.min(u.length,l.length);c+=1)if(u[c]!==l[c]){o=parseFloat(u[c])||u[c],a=parseFloat(l[c])||l[c];break}!o&&!a&&(o=i,a=s)}i=o,s=a}if((!i||!s||i==s)&&(i=r.uri,s=n.uri),i&&s){if(i>s)return 1;if(i<s)return-1}return 0}),bl=t=>{let e=["notation[0]",["prefLabel.de","prefLabel.en"],"uri"];return t.sort((r,n)=>{for(let i of e){let s,o;if(Array.isArray(i))for(let a of i)s=s||te(r,a),o=o||te(n,a);else s=te(r,i),o=te(n,i);if(s!=null&&o!=null){if(s=s.toLowerCase(),o=o.toLowerCase(),s>o)return 1;if(s<o)return-1}}return 0})},vl=t=>{let e=Mt(Jr(t),["from","to","fromScheme","toScheme","creator","contributor","type","created","modified","note","identifier","uri","partOf","mappingRelevance"]);for(let r of[e.from,e.to])pr(r,(n,i)=>{let s=[];for(let o of n)s.push(Mt(o,["uri","notation"]));r[i]=s});return e.fromScheme&&(e.fromScheme=Mt(e.fromScheme,["uri","notation"])),e.toScheme&&(e.toScheme=Mt(e.toScheme,["uri","notation"])),e.partOf&&(e.partOf=e.partOf.map(r=>Mt(r,["uri"]))),e},wr=function(t){for(let e of mr)if(t==e.uri)return e;return null},oo=wr("http://www.w3.org/2004/02/skos/core#mappingRelation"),Sl=function(t,e=oo){let r;return Array.isArray(t)&&t.length>0?r=t[0]:r=t,wr(r)||e},xl=(t,e={})=>{let{language:r}=e,n=Lt(t,"from.memberSet.0.notation.0"),i=Lt(t,"to.memberSet.0.notation.0");n=n!==null?n:"",i=i!==null?i:"";let s=wr(Lt(t,"type.0"));s=s?s.SHORT:"";let o=Ft(Lt(t,"from.memberSet.0"),{language:r,fallbackToUri:!1})||"",a=Ft(Lt(t,"to.memberSet.0"),{language:r,fallbackToUri:!1})||"",u=Ft(Lt(t,"creator.0"),{language:r,fallbackToUri:!1})||"";return{fromNotation:n,toNotation:i,fromLabel:o,toLabel:a,type:s,creator:u}},El=(t={})=>{let e=t.delimiter||",",r=t.quoteChar||'"',n=t.lineTerminator||`
16
- `,i=r+r,s=o=>r+(o==null?"":o.split(r).join(i))+r;return o=>o.map(s).join(e)+n},gt=(t,e)=>{let r=[];for(let n of["from","to"])(e==null||n===e)&&(r=r.concat(te(t,`${n}.memberSet`)||te(t,`${n}.memberChoice`)||te(t,`${n}.memberList`)||[]));return r.filter(n=>n!=null)},Al=(t={})=>{let e=El(t),r=t.language||"en";t.type==null&&(t.type=!0);let n=o=>{o=o||[];let a=[];for(let u of["from","to"]){t.schemes&&a.push(`${u}Scheme`);let l=Math.max(...o.map(c=>gt(c,u).length),1);for(let c=0;c<l;c+=1)a.push(`${u}Notation${c?c+1:""}`),t.labels&&a.push(`${u}Label${c?c+1:""}`)}return t.type&&a.push("type"),t.creator&&a.push("creator"),e(a)},i=(o,a={})=>{let u=[];for(let l of["from","to"]){t.schemes&&u.push(te(o,`${l}Scheme.notation[0]`,""));let c=gt(o,l),p=a[`${l}Count`];p==null&&(p=c.length),p=Math.max(p,1);for(let m=0;m<p;m+=1)u.push(te(c[m],"notation[0]","")),t.labels&&u.push(Ft(c[m],{language:r,fallbackToUri:!1}))}return t.type&&u.push(te(wr(te(o,"type[0]")),"SHORT","")),t.creator&&u.push(Ft(te(o,"creator[0]"),{language:r,fallbackToUri:!1})),e(u)};return{header:n,fromMapping:i,fromMappings:(o,a={header:!0})=>{let u="";a.header&&(u+=n(o));let l={fromCount:Math.max(...o.map(c=>gt(c,"from").length)),toCount:Math.max(...o.map(c=>gt(c,"to").length))};for(let c of o)u+=i(c,l);return u}}};function Cl(t,e){return Dt(t,e,(r,n,i)=>{let s={[i]:r},o={[i]:n};if(i=="from"||i=="to")return Dt(Object.getOwnPropertyNames(te(r,i,{})),Object.getOwnPropertyNames(te(n,i,{})))?Dt(gt(s,i),gt(o,i),(a,u,l)=>{if(l!=null)return it(a,u)}):!1;if(i=="fromScheme"||i=="toScheme")return it(r,n)})}var Ol=(t,e)=>{let r=Vr(t),n=Vr(e);return!(r&&n&&r!=n)},ao=t=>{Array.isArray(t)&&t.sort((e,r)=>e===null?1:r===null?-1:0)},uo=(t,e)=>(!t||!e||((Array.isArray(t.identifier)||Array.isArray(e.identifier))&&(t.identifier=Hs(t.identifier||[],e.identifier||[])),!t.uri&&e.uri&&(t.uri=e.uri),t.uri&&e.uri&&t.uri!=e.uri&&!(t.identifier||[]).includes(e.uri)&&(t.identifier=(t.identifier||[]).concat([e.uri])),Array.isArray(t.identifier)&&t.uri&&(t.identifier=t.identifier.filter(r=>r!==t.uri)),(t.identifier||[]).length==0&&delete t.identifier,ao(t.identifier)),t),lo=(t,e,r)=>{if(!t||!e)return t||e;r=r||{};let n=r._path||"",i=r.detectMismatch||[],s=r.skipPaths||[],o={};return pr(t,(a,u)=>{if(!s.includes(n+u))if(Array.isArray(a)&&Array.isArray(e[u]))o[u]=qs(a,e[u],(l,c)=>Nt(l)&&Nt(c)?it(l,c):l===c),ao(o[u]);else if(Nt(a)&&Nt(e[u]))o[u]=lo(a,e[u],Object.assign({_path:`${n}${u}.`},r));else{if(a&&e[u]&&i.includes(n+u)&&!Dt(a,e[u]))throw new Error("Property mismatch in "+n+u);o[u]=a}}),pr(e,(a,u)=>{t[u]||(o[u]=a)}),n==""&&Vs(o,s),r.mergeUris&&uo(o,e),o},ri=t=>Array.isArray(t)?t.map(e=>ri(e)):Nt(t)?(pr(t,(e,r)=>{t[r]=ri(e)}),t):dr(t)?t.normalize():t,kl=t=>{let e=/^[A-Za-z][A-Za-z0-9+\-.]*:(?:\/\/(?:(?:[A-Za-z0-9\-._~!$&'()*+,;=:]|%[0-9A-Fa-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9A-Fa-f]{1,4}:){6}|::(?:[0-9A-Fa-f]{1,4}:){5}|(?:[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){4}|(?:(?:[0-9A-Fa-f]{1,4}:){0,1}[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){3}|(?:(?:[0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){2}|(?:(?:[0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}:|(?:(?:[0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})?::)(?:[0-9A-Fa-f]{1,4}:[0-9A-Fa-f]{1,4}|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))|(?:(?:[0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}|(?:(?:[0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})?::)|[Vv][0-9A-Fa-f]+\.[A-Za-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|(?:[A-Za-z0-9\-._~!$&'()*+,;=]|%[0-9A-Fa-f]{2})*)(?::[0-9]*)?(?:\/(?:[A-Za-z0-9\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*|\/(?:(?:[A-Za-z0-9\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})+(?:\/(?:[A-Za-z0-9\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*)?|(?:[A-Za-z0-9\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})+(?:\/(?:[A-Za-z0-9\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*|)(?:\?(?:[A-Za-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9A-Fa-f]{2})*)?(?:#(?:[A-Za-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9A-Fa-f]{2})*)?$/;return t.match(e)!==null},Rl={mappingsByConcepts:(t,e,r)=>{let n=["memberSet","memberList","memberChoice"],i,s;for(let o of n)i=i||te(t,r+"."+o+"[0].notation[0]"),s=s||te(e,r+"."+o+"[0].notation[0]");return i==null||i<s?-1:s==null||i>s?1:0}},Il=(t,e)=>!t||!e?!1:[t.uri].concat(Object.values(t.identities||{}).map(r=>r.uri)).filter(r=>r!=null).includes(te(e,"creator[0].uri"));function Tl(t,e){let r;if(t&&t.notation&&t.notation.length)r=t.notation[0],(io(t)||e=="scheme")&&(r=r.toUpperCase());else if(t&&t.inScheme&&t.inScheme[0]&&t.uri)try{r=new $r(t&&t.inScheme&&t.inScheme[0]).notationFromUri(t.uri)}catch(n){}return r||""}function ii(t,e,{language:r}={}){let n=t&&e?t[e]:t;return n&&(n[r]||(r=Hr.selectLanguage(n),r))?n[r]:null}function Ft(t,e={}){e=e||{};let r=e.fallbackToUri==null?!0:e.fallbackToUri;return te(t,`prefLabel.${e.language}`)||ii(t,"prefLabel",e)||(r&&t&&t.uri?t.uri:"")}function Pl(t,e={}){e=e||{};let r=te(t,`definition.${e.language}`)||ii(t,"definition",e)||[];return dr(r)&&(r=[r]),r}function Dl(t){return te(t,"stored",te(t,"constructor.stored",te(t,"provider.constructor.stored",!1)))}function Ml(t){return dr(t.creator)?t.creator:t.creator&&t.creator.id}function Nl(t){return te(t,"creator.name")||""}function Ll(t,e){return!!(t&&dr(t.creator)?e&&e.includes(t.creator):e&&t.creator&&e.includes(t.creator.id))}function Fl(t,e){return e.filter(({notationPattern:r})=>(r||".+")===".+"?!1:RegExp("^("+r+")$").test(t))}var P=L(R(R({},ei),si),{ConceptScheme:$r,languagePreference:Hr});var ui={};pt(ui,{concatUrl:()=>Ue,deepEqual:()=>Re,listOfCapabilities:()=>ai,requestMethods:()=>oi,withCustomProps:()=>wt});var oi=[{method:"getRegistries",fallback:[],type:"Registries"},{method:"getSchemes",fallback:[],type:"Schemes"},{method:"vocSearch",fallback:[],type:"Schemes"},{method:"getTypes",fallback:[],type:"Types"},{method:"suggest",fallback:["",[],[],[]]},{method:"vocSuggest",fallback:["",[],[],[]]},{method:"getConcordances",fallback:[],type:"Concordances"},{method:"getOccurrences",fallback:[],type:"Occurrences"},{method:"getTop",fallback:[],type:"Concepts"},{method:"getConcepts",fallback:[],type:"Concepts"},{method:"getNarrower",fallback:[],type:"Concepts"},{method:"getAncestors",fallback:[],type:"Concepts"},{method:"search",fallback:[],type:"Concepts"},{method:"getMapping",fallback:null,type:"Mapping"},{method:"getMappings",fallback:[],type:"Mappings"},{method:"postMapping",fallback:null,type:"Mapping"},{method:"postMappings",fallback:[],type:"Mapping"},{method:"putMapping",fallback:null,type:"Mapping"},{method:"patchMapping",fallback:null,type:"Mapping"},{method:"deleteMapping",fallback:!1},{method:"deleteMappings",fallback:[]},{method:"getAnnotations",fallback:[],type:"Annotations"},{method:"postAnnotation",fallback:null,type:"Annotation"},{method:"putAnnotation",fallback:null,type:"Annotation"},{method:"patchAnnotation",fallback:null,type:"Annotation"},{method:"deleteAnnotation",fallback:!1}];function Ue(...t){let[e,...r]=t;for(let n of r)e.endsWith("/")||(e+="/"),n.startsWith("/")&&(n=n.slice(1)),e+=n;return e}function wt(t,e){return t._totalCount=e._totalCount,t._url=e._url,t}var ai=["registries","schemes","top","data","concepts","narrower","ancestors","types","suggest","search","auth","mappings","concordances","annotations","occurrences"],Re=(t,e)=>{if(t===e)return!0;if(typeof t!="object"||typeof e!="object"||t===null||e===null)return!1;if(Object.keys(t).length===Object.keys(e).length){for(let r in t)if(!(r in e)||!Re(t[r],e[r]))return!1;return!0}return!1};var Ht={};pt(Ht,{BaseProvider:()=>G,ConceptApiProvider:()=>Te,LabelSearchSuggestionProvider:()=>We,LobidApiProvider:()=>Ye,LocApiProvider:()=>qe,LocalMappingsProvider:()=>st,MappingsApiProvider:()=>Ie,ModApiProvider:()=>Xe,MyCoReProvider:()=>Qe,NoTApiProvider:()=>Ze,OccurrencesApiProvider:()=>$e,OlsApiProvider:()=>Ge,ReconciliationApiProvider:()=>je,SkohubProvider:()=>Je,SkosmosApiProvider:()=>He});var li=(t,e)=>t.filter(r=>e.includes(r)),G=class{constructor(e={}){var n,i;this._jskos=e,this.axios=pe.create({timeout:2e5}),this._path=typeof window!="undefined"&&window.location.pathname,this.has={},(n=this.constructor)!=null&&n.supports&&(this.has=Object.assign({},(i=this.constructor)==null?void 0:i.supports)),ai.filter(s=>!this.has[s]).forEach(s=>{this.has[s]=!1}),this._defaultLanguages="en,de,fr,es,nl,it,fi,pl,ru,cs,jp".split(","),this.languages=[],this._auth={key:null,bearerToken:null},this._repeating=[],this._api={status:e.status,schemes:Array.isArray(e.schemes)?void 0:e.schemes,top:e.top,data:e.data,concepts:e.concepts,narrower:e.narrower,ancestors:e.ancestors,types:e.types,suggest:e.suggest,search:e.search,"voc-suggest":e["voc-suggest"],"voc-search":e["voc-search"],mappings:e.mappings,concordances:e.concordances,annotations:e.annotations,occurrences:e.occurrences,reconcile:e.reconcile,api:e.endpoint||e.api,registries:e.registries},this._config={},this.setRetryConfig(),this.axios.interceptors.request.use((s={})=>{var o,a,u;if(s._skipAdditionalParameters||(s.params||(s.params={}),s.params.language=[...new Set([].concat(((o=s.params.language)!=null?o:"").split(","),this.languages,this._defaultLanguages).filter(Boolean))].join(","),this.has.auth&&this._auth.bearerToken&&!((a=s==null?void 0:s.headers)!=null&&a.Authorization)&&(s.headers||(s.headers={}),s.headers.Authorization=`Bearer ${this._auth.bearerToken}`)),(u=s.url)!=null&&u.startsWith("http:")&&typeof window!="undefined"&&window.location.protocol=="https:")throw new pe.Cancel("Can't call http API from https.");return s}),this.axios.interceptors.response.use(({data:s,headers:o={},config:a={}})=>{s=P.normalize(s);let u=a.url;if(u.endsWith("?")||(u+="?"),u+=new URLSearchParams(a.params||{}).toString(),typeof s=="object"){let l=parseInt(o["x-total-count"]);isNaN(l)||(s._totalCount=l),s._url=u}return s},s=>{var l,c,p;let o=(c=(l=s.config)==null?void 0:l._retryCount)!=null?c:0,a=s.config.method,u=(p=s.response)==null?void 0:p.status;return this._retryConfig.methods.includes(a)&&this._retryConfig.statusCodes.includes(u)&&o<this._retryConfig.count?(s.config._retryCount=o+1,s.config.data&&(s.config.data=JSON.parse(s.config.data)),new Promise((m,g)=>{setTimeout(()=>{this.axios(s.config).then(m).catch(g)},(()=>{let f=this._retryConfig.delay;return typeof f=="function"?f(o):f})())})):Promise.reject(s)});let r=[];for(let{method:s,type:o}of oi){let a=this[s]&&this[s].bind(this);if(!a){this[s]=()=>{throw new Qt({method:s})};continue}this[s]=(u={})=>{if(u._raw)return delete u._raw,a(u);let l=r.find(y=>y.method==s&&Re(y.options,u));if(l)return l.promise;let c;u.cancelToken||(c=this.getCancelTokenSource(),u.cancelToken=c.token);let p=this.init().then(()=>a(u)).then(y=>(typeof y=="object"&&y._totalCount===void 0&&(y._totalCount=Array.isArray(y)?y.length:1),y&&o&&this[`adjust${o}`]&&(y=this[`adjust${o}`](y)),y)).catch(y=>{throw y instanceof me?y:y.response?y.response.status.toString().startsWith(4)?new Le({relatedError:y,code:y.response.status}):new Zt({relatedError:y,code:y.response.status}):y.request?typeof navigator!="undefined"&&(navigator.connection||navigator.mozConnection||navigator.webkitConnection)?new er({relatedError:y}):new tr({relatedError:y}):(console.error(y),new me({relatedError:y}))});c&&(p.cancel=(...y)=>c.cancel(...y));let d=u,{cancelToken:m}=d,g=W(d,["cancelToken"]),f={method:s,options:g,promise:p};return r.push(f),p.catch(()=>{}).then(()=>r.splice(r.indexOf(f),1)),p}}}get uri(){return this._jskos.uri}get notation(){return this._jskos.notation}get prefLabel(){return this._jskos.prefLabel}get definition(){return this._jskos.definition}get schemes(){return this._jskos.schemes}get excludedSchemes(){return this._jskos.excludedSchemes}get stored(){return this._jskos.stored!==void 0?this._jskos.stored:this.constructor.stored}init(){return E(this,null,function*(){return this._init?this._init:(this._init=E(this,null,function*(){var r;this._prepare();let e;if(typeof this._api.status=="string")try{e=yield this.axios({method:"get",url:this._api.status})}catch(n){((r=n==null?void 0:n.response)==null?void 0:r.status)===404&&(this._api.status=null)}else e=this._api.status;if(typeof e=="object"&&Object.keys(e).length){this._config=e.config||{};for(let n of Object.keys(this._api))this._api[n]===void 0&&(this._api[n]=e[n]||null)}this._setup()}),this._init)})}_prepare(){}_setup(){}getCancelTokenSource(){return pe.CancelToken.source()}setAuth({key:e=this._auth.key,bearerToken:r=this._auth.bearerToken}){this._auth.key=e,this._auth.bearerToken=r}setRetryConfig(e={}){this._retryConfig=Object.assign({methods:["get","head","options"],statusCodes:[401,403],count:3,delay:r=>300*r},e)}suggest(e){return E(this,null,function*(){e._raw=!0;let r=yield this.search(e),n=[e.search,[],[],[]];for(let i of r){let s=P.notation(i),o=P.prefLabel(i);n[1].push((s?s+" ":"")+o),n[2].push(""),n[3].push(i.uri)}return r._totalCount!=null?n._totalCount=r._totalCount:n._totalCount=r.length,n})}isAuthorizedFor({type:e,action:r,user:n,crossUser:i}){var a,u,l,c;if(r=="read"&&this.has[e]===!0)return!0;if(!this.has[e])return!1;let s=(u=(a=this._config)==null?void 0:a[e])==null?void 0:u[r];if(!s)return!!this.has[e][r];if(s.auth&&(!n||!this._auth.key)||s.auth&&this._auth.key!=((c=(l=this._config)==null?void 0:l.auth)==null?void 0:c.key))return!1;let o=[n==null?void 0:n.uri].concat(Object.values((n==null?void 0:n.identities)||{}).map(p=>p.uri)).filter(Boolean);if(s.auth&&s.identities&&li(o,s.identities).length==0)return!1;if(s.auth&&s.identityProviders){let p=Object.keys((n==null?void 0:n.identities)||{});if(li(p,s.identityProviders).length==0)return!1}return i?s.crossUser===!0||li(s.crossUser||[],o).length>0:!!this.has[e][r]}supportsScheme(e){if(!e)return!1;let r=Array.isArray(this.schemes)?this.schemes:null;return r==null&&!P.isContainedIn(e,this.excludedSchemes||[])?!0:P.isContainedIn(e,r)}adjustConcept(e){if(!e||e.__SAVED__)return e;e._getNarrower=r=>this.getNarrower(L(R({},r),{concept:e})),e._getAncestors=r=>this.getAncestors(L(R({},r),{concept:e})),e._getDetails=r=>E(this,null,function*(){return(yield this.getConcepts(L(R({},r),{concepts:[e]})))[0]});for(let r of["broader","narrower","ancestors"])Array.isArray(e[r])&&e[r].length&&!e[r].includes(null)&&(e[r]=this.adjustConcepts(e[r]));return e._registry=this,e}adjustConcepts(e){return wt(e.map(r=>this.adjustConcept(r)),e)}adjustRegistries(e){return e}adjustScheme(e){if(!e||e.__SAVED__)return e;let r=e._registry;return e._registry=this.cdk&&this.cdk.registryForScheme(e),!e._registry||r===e._registry||e._registry._api.api===this._api.api?e._registry=r||this:["concepts","topConcepts"].forEach(n=>{Array.isArray(e[n])&&(e[n].length===0||e[n][0]===null)&&delete e[n]}),e._registry&&(e._getTop=n=>e._registry.getTop(L(R({},n),{scheme:e})),e._getTypes=n=>e._registry.getTypes(L(R({},n),{scheme:e})),e._suggest=s=>{var o=s,{search:n}=o,i=W(o,["search"]);return e._registry.suggest(L(R({},i),{search:n,scheme:e}))}),e}adjustSchemes(e){return wt(e.map(r=>this.adjustScheme(r)),e)}adjustConcordances(e){for(let r of e)r._registry=this;return e}adjustMapping(e){var r,n,i,s,o;for(let a of["from","to"]){let u=`${a}Scheme`;e[u]||(e[u]=(s=(i=(n=(r=P.conceptsOfMapping(e,a))==null?void 0:r[0])==null?void 0:n.inScheme)==null?void 0:i[0])!=null?s:null)}if(e._registry=this,!e.identifier){let a=(o=P.addMappingIdentifiers(e))==null?void 0:o.identifier;a&&(e.identifier=a)}return e}adjustMappings(e){return wt(e.map(r=>this.adjustMapping(r)),e)}postMappings(){return E(this,arguments,function*(n={}){var i=n,{mappings:e}=i,r=W(i,["mappings"]);if(!e||!e.length)throw new U({parameter:"mappings"});return this._callHelperForArrayWrappers({method:"postMapping",items:e,itemProperty:"mapping",config:r})})}deleteMappings(){return E(this,arguments,function*(n={}){var i=n,{mappings:e}=i,r=W(i,["mappings"]);if(!e||!e.length)throw new U({parameter:"mappings"});return this._callHelperForArrayWrappers({method:"deleteMapping",items:e,itemProperty:"mapping",config:r})})}_callHelperForArrayWrappers(s){return E(this,arguments,function*({method:e,items:r,itemProperty:n,config:i}){let o=[],a=yield Promise.all(r.map(u=>E(this,null,function*(){try{return yield this[e](L(R({[n]:u},i),{_raw:!0}))}catch(l){return o[r.indexOf(u)]=l,null}})));return a._errors=o,a})}};ee(G,"providerName","Base");var ze=ns(fo(),1);var we=[];for(let t=0;t<256;++t)we.push((t+256).toString(16).slice(1));function ho(t,e=0){return(we[t[e+0]]+we[t[e+1]]+we[t[e+2]]+we[t[e+3]]+"-"+we[t[e+4]]+we[t[e+5]]+"-"+we[t[e+6]]+we[t[e+7]]+"-"+we[t[e+8]]+we[t[e+9]]+"-"+we[t[e+10]]+we[t[e+11]]+we[t[e+12]]+we[t[e+13]]+we[t[e+14]]+we[t[e+15]]).toLowerCase()}var fi,Bl=new Uint8Array(16);function hi(){if(!fi){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");fi=crypto.getRandomValues.bind(crypto)}return fi(Bl)}var jl=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),pi={randomUUID:jl};function Ul(t,e,r){var i,s,o;t=t||{};let n=(o=(s=t.random)!=null?s:(i=t.rng)==null?void 0:i.call(t))!=null?o:hi();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){if(r=r||0,r<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let a=0;a<16;++a)e[r+a]=n[a];return e}return ho(n)}function zl(t,e,r){return pi.randomUUID&&!e&&!t?pi.randomUUID():Ul(t,e,r)}var Kr=zl;var Yr="urn:uuid:",st=class extends G{static get supports(){return{mappings:{read:!0,create:!0,update:!0,delete:!0}}}_setup(){this.queue=[],this.localStorageKey="cocoda-mappings--"+this._path;let e="mappings",r=()=>ze.default.getItem(this.localStorageKey).then(n=>{n=n||[];let i=0;for(let s of n.filter(o=>!o.uri||!o.uri.startsWith(Yr)))s.uri&&(s.identifier||(s.identifier=[]),s.identifier.push(s.uri)),s.uri=`${Yr}${Kr()}`,i+=1;return i&&console.warn(`URIs added to ${i} local mappings.`),ze.default.setItem(this.localStorageKey,n)});ze.default.getItem(e).then(n=>{n&&console.warn(`Warning: There is old data in local storage (or IndexedDB, depending on the ) with the key "${e}". This data will not be used anymore. A manual export is necessary to get this data back.`)}),this.queue.push(r().catch(n=>{console.warn("Error when adding URIs to local mappings:",n)}))}isAuthorizedFor({type:e,action:r}){return e=="mappings"&&r!="anonymous"}_getMappingsQueue(){let e=this.queue.slice(-1)[0]||Promise.resolve();return new Promise(r=>{function n(){let o,a,u=new Promise((l,c)=>{o=l,a=c});return u.resolve=o,u.reject=a,u}let i=n(),s=()=>{i.resolve()};this.queue.push(i),e.then(()=>ze.default.getItem(this.localStorageKey)).then(o=>{r({mappings:o,done:s})})})}getMapping(n){return E(this,null,function*(){var i=n,{mapping:e}=i,r=W(i,["mapping"]);if(r._raw=!0,!e||!e.uri)throw new U({parameter:"mapping"});return(yield this.getMappings(L(R({},r),{uri:e.uri})))[0]})}getMappings(){return E(this,arguments,function*({from:e,fromScheme:r,to:n,toScheme:i,creator:s,type:o,partOf:a,offset:u,limit:l,direction:c,mode:p,identifier:m,uri:g}={}){let f={};return e&&(f.from=typeof e=="string"?e:e.uri),r&&(f.fromScheme=typeof r=="string"?{uri:r}:r),n&&(f.to=typeof n=="string"?n:n.uri),i&&(f.toScheme=typeof i=="string"?{uri:i}:i),s&&(f.creator=typeof s=="string"?s:P.prefLabel(s)),o&&(f.type=typeof o=="string"?o:o.uri),a&&(f.partOf=typeof a=="string"?a:a.uri),u&&(f.offset=u),l&&(f.limit=l),c&&(f.direction=c),p&&(f.mode=p),m&&(f.identifier=m),g&&(f.uri=g),this._getMappingsQueue().catch(d=>{throw new me({message:"Could not get mappings from local storage",relatedError:d})}).then(({mappings:d,done:y})=>{y();let O=(C,F)=>C.uri==F||F&&C.notation&&C.notation[0].toLowerCase()==F.toLowerCase();if((f.from||f.to)&&(d=d.filter(C=>{let F=P.conceptsOfMapping(C,"from").find(D=>O(D,f.from))!=null,N=P.conceptsOfMapping(C,"to").find(D=>O(D,f.from))!=null,S=P.conceptsOfMapping(C,"from").find(D=>O(D,f.to))!=null,k=P.conceptsOfMapping(C,"to").find(D=>O(D,f.to))!=null;return f.direction=="backward"?f.mode=="or"?f.from&&N||f.to&&S:(!f.from||N)&&(!f.to||S):f.direction=="both"?f.mode=="or"?f.from&&(F||N)||f.to&&(S||k):(!f.from||F)&&(!f.to||k)||(!f.from||N)&&(!f.to||S):f.mode=="or"?f.from&&F||f.to&&k:(!f.from||F)&&(!f.to||k)})),(f.fromScheme||f.toScheme)&&(d=d.filter(C=>{let F=P.compare(C.fromScheme,f.fromScheme),N=P.compare(C.toScheme,f.fromScheme),S=P.compare(C.fromScheme,f.toScheme),k=P.compare(C.toScheme,f.toScheme);return f.direction=="backward"?f.mode=="or"?f.fromScheme&&N||f.toScheme&&S:(!f.fromScheme||N)&&(!f.toScheme||S):f.direction=="both"?f.mode=="or"?f.fromScheme&&(F||N)||f.toScheme&&(S||k):(!f.fromScheme||F)&&(!f.toScheme||k)||(!f.fromScheme||N)&&(!f.toScheme||S):f.mode=="or"?f.fromScheme&&F||f.toScheme&&k:(!f.fromScheme||F)&&(!f.toScheme||k)})),f.creator){let C=f.creator.split("|");d=d.filter(F=>(F.creator&&F.creator.find(N=>C.includes(P.prefLabel(N))||C.includes(N.uri)))!=null)}f.type&&(d=d.filter(C=>(C.type||[P.defaultMappingType.uri]).includes(f.type))),f.partOf&&(d=d.filter(C=>C.partOf!=null&&C.partOf.find(F=>P.compare(F,{uri:f.partOf}))!=null)),f.identifier&&(d=d.filter(C=>f.identifier.split("|").map(F=>(C.identifier||[]).includes(F)||C.uri==F).reduce((F,N)=>F||N))),f.uri&&(d=d.filter(C=>C.uri==f.uri));let I=d.length;return d=d.sort((C,F)=>{let N=C.modified||C.created,S=F.modified||F.created;return S==null?-1:N==null?1:N>S?-1:1}),d=d.slice(f.offset||0),d=d.slice(0,f.limit),d._totalCount=I,d})})}postMapping(r){return E(this,arguments,function*({mapping:e}){if(!e)throw new U({parameter:"mapping"});let{mappings:n,done:i}=yield this._getMappingsQueue();if((!e.uri||!e.uri.startsWith(Yr))&&(e.uri&&(e.identifier||(e.identifier=[]),e.identifier.push(e.uri)),e.uri=`${Yr}${Kr()}`),n.find(s=>s.uri==e.uri))throw i(),new U({parameter:"mapping",message:"Duplicate URI"});e.created||(e.created=new Date().toISOString()),e.modified||(e.modified=e.created),delete e.partOf,n.push(e),n=n.map(s=>P.minifyMapping(s));try{return yield ze.default.setItem(this.localStorageKey,n),i(),e}catch(s){throw i(),s}})}putMapping(r){return E(this,arguments,function*({mapping:e}){if(!e)throw new U({parameter:"mapping"});let{mappings:n,done:i}=yield this._getMappingsQueue(),s=n.findIndex(o=>o.uri==e.uri);if(s==-1)throw i(),new U({parameter:"mapping",message:"Mapping not found"});e.created||(e.created=n[s].created),e.modified=new Date().toISOString(),delete e.partOf,n[s]=e,n=n.map(o=>P.minifyMapping(o));try{return yield ze.default.setItem(this.localStorageKey,n),i(),e}catch(o){throw i(),o}})}patchMapping(r){return E(this,arguments,function*({mapping:e}){if(!e)throw new U({parameter:"mapping"});let{mappings:n,done:i}=yield this._getMappingsQueue(),s=n.findIndex(o=>o.uri==e.uri);if(s==-1)throw i(),new U({parameter:"mapping",message:"Mapping not found"});e.created||(e.created=n[s].created),e.modified=new Date().toISOString(),delete e.partOf,n[s]=Object.assign(n[s],e),n=n.map(o=>P.minifyMapping(o));try{return yield ze.default.setItem(this.localStorageKey,n),i(),e}catch(o){throw i(),o}})}deleteMapping(r){return E(this,arguments,function*({mapping:e}){if(!e)throw new U({parameter:"mapping"});let{mappings:n,done:i}=yield this._getMappingsQueue();try{return n=n.filter(s=>s.uri!=e.uri),n=n.map(s=>P.minifyMapping(s)),yield ze.default.setItem(this.localStorageKey,n),i(),!0}catch(s){throw i(),s}})}};st.providerName="LocalMappings";st.stored=!0;var Ie=class extends G{_prepare(){this._api.api&&this._api.status===void 0&&(this._api.status=Ue(this._api.api,"/status"))}_setup(){var e,r,n,i,s,o,a,u,l,c,p,m,g,f,d,y,O,I,C,F,N,S,k,D,$,X,K,V,Z;if(this._api.api){let se={mappings:"/mappings",concordances:"/concordances",annotations:"/annotations"};for(let re of Object.keys(se))this._api[re]===void 0&&(this._api[re]=Ue(this._api.api,se[re]))}this.has.mappings=this._api.mappings?{}:!1,this.has.mappings&&(this.has.mappings.read=!!((n=(r=(e=this._config)==null?void 0:e.mappings)==null?void 0:r.read)==null||n),this.has.mappings.create=!!((s=(i=this._config)==null?void 0:i.mappings)!=null&&s.create),this.has.mappings.update=!!((a=(o=this._config)==null?void 0:o.mappings)!=null&&a.update),this.has.mappings.delete=!!((l=(u=this._config)==null?void 0:u.mappings)!=null&&l.delete),this.has.mappings.anonymous=!!((p=(c=this._config)==null?void 0:c.mappings)!=null&&p.anonymous)),this.has.concordances=this._api.concordances?{}:!1,this.has.concordances&&(this.has.concordances.read=!!((g=(m=this._config)==null?void 0:m.concordances)!=null&&g.read),this.has.concordances.create=!!((d=(f=this._config)==null?void 0:f.concordances)!=null&&d.create),this.has.concordances.update=!!((O=(y=this._config)==null?void 0:y.concordances)!=null&&O.update),this.has.concordances.delete=!!((C=(I=this._config)==null?void 0:I.concordances)!=null&&C.delete)),this.has.annotations=this._api.annotations?{}:!1,this.has.annotations&&(this.has.annotations.read=!!((N=(F=this._config)==null?void 0:F.annotations)!=null&&N.read),this.has.annotations.create=!!((k=(S=this._config)==null?void 0:S.annotations)!=null&&k.create),this.has.annotations.update=!!(($=(D=this._config)==null?void 0:D.annotations)!=null&&$.update),this.has.annotations.delete=!!((K=(X=this._config)==null?void 0:X.annotations)!=null&&K.delete)),this.has.auth=((Z=(V=this._config)==null?void 0:V.auth)==null?void 0:Z.key)!=null,this._defaultParams={properties:"annotations"}}getMapping(n){return E(this,null,function*(){var i=n,{mapping:e}=i,r=W(i,["mapping"]);var s;if(!e)throw new U({parameter:"mapping"});if(!e.uri||!e.uri.startsWith(this._api.mappings))throw new U({parameter:"mapping",message:"URI doesn't seem to be part of this registry."});try{return yield this.axios(L(R({},r),{url:e.uri,params:R(R({},this._defaultParams),r.params||{})}))}catch(o){if(((s=o==null?void 0:o.response)==null?void 0:s.status)==404)return null;throw o}})}getMappings(F){return E(this,null,function*(){var N=F,{from:e,fromScheme:r,to:n,toScheme:i,creator:s,type:o,partOf:a,offset:u,limit:l,direction:c,mode:p,identifier:m,cardinality:g,annotatedBy:f,annotatedFor:d,annotatedWith:y,sort:O,order:I}=N,C=W(N,["from","fromScheme","to","toScheme","creator","type","partOf","offset","limit","direction","mode","identifier","cardinality","annotatedBy","annotatedFor","annotatedWith","sort","order"]);let S={},k=this._api.mappings;return e&&(S.from=typeof e=="string"?e:e.uri),r&&(S.fromScheme=typeof r=="string"?r:r.uri),n&&(S.to=typeof n=="string"?n:n.uri),i&&(S.toScheme=typeof i=="string"?i:i.uri),s&&(S.creator=typeof s=="string"?s:P.prefLabel(s)),o&&(S.type=typeof o=="string"?o:o.uri),a&&(S.partOf=typeof a=="string"?a:a.uri),u&&(S.offset=u),l&&(S.limit=l),c&&(S.direction=c),g&&(S.cardinality=g),f&&(S.annotatedBy=f),d&&(S.annotatedFor=d),y&&(S.annotatedWith=y),p&&(S.mode=p),m&&(S.identifier=m),O&&(S.sort=O),I&&(S.order=I),this.axios(L(R({},C),{method:"get",url:k,params:R(R(R({},this._defaultParams),C.params||{}),S)}))})}postMapping(n){return E(this,null,function*(){var i=n,{mapping:e}=i,r=W(i,["mapping"]);if(!e)throw new U({parameter:"mapping"});return e=P.minifyMapping(e),e=P.addMappingIdentifiers(e),this.axios(L(R({},r),{method:"post",url:this._api.mappings,data:e,params:R(R({},this._defaultParams),r.params||{})}))})}putMapping(n){return E(this,null,function*(){var i=n,{mapping:e}=i,r=W(i,["mapping"]);if(!e)throw new U({parameter:"mapping"});e=P.minifyMapping(e),e=P.addMappingIdentifiers(e);let s=e.uri;if(!s||!s.startsWith(this._api.mappings))throw new U({parameter:"mapping",message:"URI doesn't seem to be part of this registry."});return this.axios(L(R({},r),{method:"put",url:s,data:e,params:R(R({},this._defaultParams),r.params||{})}))})}patchMapping(n){return E(this,null,function*(){var i=n,{mapping:e}=i,r=W(i,["mapping"]);var a;if(!e)throw new U({parameter:"mapping"});if(!((a=e.uri)!=null&&a.startsWith(this._api.mappings)))throw new U({parameter:"mapping",message:"URI doesn't seem to be part of this registry."});let u=e,{uri:s}=u,o=W(u,["uri"]);return this.axios(L(R({},r),{method:"patch",url:s,data:o,params:R(R({},this._defaultParams),r.params||{})}))})}deleteMapping(n){return E(this,null,function*(){var i=n,{mapping:e}=i,r=W(i,["mapping"]);if(!e)throw new U({parameter:"mapping"});let s=e.uri;if(!s||!s.startsWith(this._api.mappings))throw new U({parameter:"mapping",message:"URI doesn't seem to be part of this registry."});return yield this.axios(L(R({},r),{method:"delete",url:s})),!0})}getAnnotations(n){return E(this,null,function*(){var i=n,{target:e}=i,r=W(i,["target"]);return e&&(r.params||(r.params={}),r.params.target=e),this.axios(L(R({},r),{method:"get",url:this._api.annotations}))})}postAnnotation(n){return E(this,null,function*(){var i=n,{annotation:e}=i,r=W(i,["annotation"]);return this.axios(L(R({},r),{method:"post",url:this._api.annotations,data:e}))})}putAnnotation(n){return E(this,null,function*(){var i=n,{annotation:e}=i,r=W(i,["annotation"]);let s=e.id;if(!s||!s.startsWith(this._api.annotations))throw new U({parameter:"annotation",message:"URI doesn't seem to be part of this registry."});return this.axios(L(R({},r),{method:"put",url:s,data:e}))})}patchAnnotation(n){return E(this,null,function*(){var i=n,{annotation:e}=i,r=W(i,["annotation"]);let s=e.id;if(!s||!s.startsWith(this._api.annotations))throw new U({parameter:"annotation",message:"URI doesn't seem to be part of this registry."});return this.axios(L(R({},r),{method:"patch",url:s,data:e}))})}deleteAnnotation(n){return E(this,null,function*(){var i=n,{annotation:e}=i,r=W(i,["annotation"]);let s=e.id;if(!s||!s.startsWith(this._api.annotations))throw new U({parameter:"annotation",message:"URI doesn't seem to be part of this registry."});return yield this.axios(L(R({},r),{method:"delete",url:s})),!0})}getConcordances(e){return E(this,null,function*(){return this.axios(L(R({},e),{method:"get",url:this._api.concordances}))})}postConcordance(n){return E(this,null,function*(){var i=n,{concordance:e}=i,r=W(i,["concordance"]);if(!e)throw new U({parameter:"concordance"});return this.axios(L(R({},r),{method:"post",url:this._api.concordances,data:e,params:R(R({},this._defaultParams),r.params||{})}))})}putConcordance(n){return E(this,null,function*(){var i=n,{concordance:e}=i,r=W(i,["concordance"]);if(!e)throw new U({parameter:"concordance"});let s=e.uri;if(!s||!s.startsWith(this._api.concordances))throw new U({parameter:"concordance",message:"URI doesn't seem to be part of this registry."});return this.axios(L(R({},r),{method:"put",url:s,data:e,params:R(R({},this._defaultParams),r.params||{})}))})}patchConcordance(n){return E(this,null,function*(){var i=n,{concordance:e}=i,r=W(i,["concordance"]);var a;if(!e)throw new U({parameter:"concordance"});if(!((a=e.uri)!=null&&a.startsWith(this._api.concordances)))throw new U({parameter:"concordance",message:"URI doesn't seem to be part of this registry."});let u=e,{uri:s}=u,o=W(u,["uri"]);return this.axios(L(R({},r),{method:"patch",url:s,data:o,params:R(R({},this._defaultParams),r.params||{})}))})}deleteConcordance(n){return E(this,null,function*(){var i=n,{concordance:e}=i,r=W(i,["concordance"]);if(!e)throw new U({parameter:"concordance"});let s=e.uri;if(!s||!s.startsWith(this._api.concordances))throw new U({parameter:"concordance",message:"URI doesn't seem to be part of this registry."});return yield this.axios(L(R({},r),{method:"delete",url:s})),!0})}};ee(Ie,"supports",{mappings:!0,concordances:!0,annotations:!0});Ie.providerName="MappingsApi";Ie.stored=!0;var di={},$e=class extends G{get _cache(){return di[this.uri]}_prepare(){di[this.uri]=[],this._occurrencesSupportedSchemes=[]}_occurrencesIsSupported(e){return E(this,null,function*(){if(!(this._occurrencesSupportedSchemes&&this._occurrencesSupportedSchemes.length))try{let n=Ue(this._api.api,"voc"),i=yield this.axios({method:"get",url:n});this._occurrencesSupportedSchemes=i||[]}catch(n){}let r=!1;for(let n of this._occurrencesSupportedSchemes)P.compare(e,n)&&(r=!0);return r})}getMappings(e){return E(this,null,function*(){var u,l,c,p,m,g,f,d,y,O,I,C,F,N;let r=yield this.getOccurrences(e),n=e.from,i=((u=n==null?void 0:n.inScheme)==null?void 0:u[0])||e.fromScheme,s=e.to,o=((l=s==null?void 0:s.inScheme)==null?void 0:l[0])||e.toScheme,a=[];for(let S of r){if(!S)continue;let k={};k.from=(c=S==null?void 0:S.memberSet)==null?void 0:c[0],k.from?k.from={memberSet:[k.from]}:k.from=null,k.fromScheme=(g=(m=(p=S==null?void 0:S.memberSet)==null?void 0:p[0])==null?void 0:m.inScheme)==null?void 0:g[0],k.to=(f=S==null?void 0:S.memberSet)==null?void 0:f[1],k.to?k.to={memberSet:[k.to]}:k.to={memberSet:[]},k.toScheme=(O=(y=(d=S==null?void 0:S.memberSet)==null?void 0:d[1])==null?void 0:y.inScheme)==null?void 0:O[0],(n&&P.compare(n,(C=(I=k==null?void 0:k.to)==null?void 0:I.memberSet)==null?void 0:C[0])||s&&P.compare(s,(N=(F=k==null?void 0:k.from)==null?void 0:F.memberSet)==null?void 0:N[0]))&&([k.from,k.fromScheme,k.to,k.toScheme]=[k.to,k.toScheme,k.from,k.fromScheme]),!k.fromScheme&&i&&(k.fromScheme=i),!k.toScheme&&o&&(k.toScheme=o),k.type=[P.defaultMappingType.uri],k._occurrence=S,k=P.addMappingIdentifiers(k),a.push(k)}return a._url=r._url,a})}getOccurrences(o){return E(this,null,function*(){var a=o,{from:e,to:r,concepts:n,threshold:i=0}=a,s=W(a,["from","to","concepts","threshold"]);var f;let u=[];n=(n||[]).concat([e,r]).filter(d=>!!d);for(let d of n)u.push(this._occurrencesIsSupported((f=d==null?void 0:d.inScheme)==null?void 0:f[0]).then(y=>y&&d.uri?d.uri:null));let l=yield Promise.all(u);if(l=l.filter(d=>d!=null),l.length==0)throw new U({parameter:"concepts"});u=[];for(let d of l)u.push(this._getOccurrences(L(R({},s),{params:{member:d,scheme:"*",threshold:i}})));let c=yield Promise.all(u),p=c.flat(),m=[],g=[];for(let d=0;d<p.length;d+=1){let y=p[d];if(!y)continue;let O=y.memberSet.reduce((I,C)=>I.concat(C.uri),[]).sort().join(" ");m.includes(O)?g.push(d):m.push(O)}return g.forEach(d=>{delete p[d]}),p=p.filter(d=>d!=null),p=p.sort((d,y)=>parseInt(y.count||0)-parseInt(d.count||0)),p._url=c.map(d=>d._url),p})}_getOccurrences(e){return E(this,null,function*(){let r=this._cache.find(i=>Re(i.config.params,e.params));if(r)return r.data;let n=yield this.axios(L(R({},e),{method:"get",url:this._api.api}));return this._cache.push({config:e,data:n}),this._cache.length>20&&(di[this.uri]=this._cache.slice(this._cache.length-20)),n})}};ee($e,"supports",{occurrences:!0,mappings:!0});$e.providerName="OccurrencesApi";$e.stored=!1;var Te=class extends G{_prepare(){this._api.api&&this._api.status===void 0&&(this._api.status=Ue(this._api.api,"/status"))}_setup(){var e,r;if(this._api.api){let n={schemes:"/voc",top:"/voc/top",concepts:"/voc/concepts",data:"/data",narrower:"/narrower",ancestors:"/ancestors",types:"/types",suggest:"/suggest",search:"/search",registries:"/registries"};for(let i of Object.keys(n))this._api[i]===void 0&&(this._api[i]=Ue(this._api.api,n[i]))}this.has.registries=!!this._api.registries,this.has.schemes=!!this._api.schemes,!this.has.schemes&&Array.isArray(this.schemes)&&(this.has.schemes=!0),this.has.top=!!this._api.top,this.has.data=!!this._api.data,this.has.concepts=!!this._api.concepts||this.has.data,this.has.narrower=!!this._api.narrower,this.has.ancestors=!!this._api.ancestors,this.has.types=!!this._api.types,this.has.suggest=!!this._api.suggest,this.has.search=!!this._api.search,this.has.auth=(r=(e=this._config)==null?void 0:e.auth)==null?void 0:r.key,this._defaultParams={properties:"+created,issued,modified,editorialNote,scopeNote,note,definition,mappings,location"}}static _registryConfigForBartocApiConfig({url:e,scheme:r}={}){return!e||!r?null:{api:e,schemes:[r]}}_getSchemeUri(e){return E(this,null,function*(){this._approvedSchemes=this._approvedSchemes||[],this._rejectedSchemes=this._rejectedSchemes||[];let r=this._approvedSchemes.find(s=>P.compare(e,s));if(r)return r.uri;if(this._rejectedSchemes.find(s=>P.compare(e,s)))return null;let i=(yield this.getSchemes({params:{uri:P.getAllUris(e).join("|")}})).find(s=>P.compare(s,e));return i?(this._approvedSchemes.push({uri:i.uri,identifier:P.getAllUris(e)}),i.uri):(this._rejectedSchemes.push({uri:e.uri,identifier:e.identifier}),null)})}getRegistries(){return E(this,arguments,function*(e={}){if(!this._api.registries){if(Array.isArray(this.registries))return this.registries;throw new Se}return yield this.axios(L(R({},e),{method:"get",url:this._api.registries,params:R(L(R({},this._defaultParams),{limit:500}),e.params||{})}))})}getSchemes(){return E(this,arguments,function*(e={}){if(!this._api.schemes){if(Array.isArray(this.schemes))return this.schemes;throw new Se}let r=yield this.axios(L(R({},e),{method:"get",url:this._api.schemes,params:R(L(R({},this._defaultParams),{limit:500}),e.params||{})}));return Array.isArray(this.schemes)?wt(r.filter(n=>P.isContainedIn(n,this.schemes)),r):r})}getTop(n){return E(this,null,function*(){var i=n,{scheme:e}=i,r=W(i,["scheme"]);if(!this._api.top)throw new Se;if(!e)throw new U({parameter:"scheme"});let s=yield this._getSchemeUri(e);if(!s)throw new U({parameter:"scheme",message:"Requested vocabulary seems to be unsupported by this API."});return Array.isArray(this._api.top)?this._api.top:this.axios(L(R({},r),{method:"get",url:this._api.top,params:L(R(L(R({},this._defaultParams),{limit:1e4}),r.params||{}),{uri:s})}))})}getConcepts(n){return E(this,null,function*(){var i=n,{concepts:e}=i,r=W(i,["concepts"]);let s=this._api.concepts||this._api.data;if(!s)throw new Se;Array.isArray(e)||(e=e?[e]:[]);let o=e.map(a=>a.uri).filter(a=>a!=null);return this.axios(L(R({},r),{method:"get",url:s,params:L(R(L(R({},this._defaultParams),{limit:100}),r.params||{}),{uri:o.join("|")})}))})}getNarrower(n){return E(this,null,function*(){var i=n,{concept:e}=i,r=W(i,["concept"]);var s;if(!e||!e.uri)throw new U({parameter:"concept"});if(this._api.narrower)return this.axios(L(R({},r),{method:"get",url:this._api.narrower,params:L(R(L(R({},this._defaultParams),{limit:1e4}),r.params||{}),{uri:e.uri})}));{let o=R({params:{}},r);o.params.properties="narrower";let u=((s=(yield this.getConcepts(R({concepts:[e]},o)))[0])==null?void 0:s.narrower)||[];return u.length?this.getConcepts(R({concepts:u},r)):[]}})}getAncestors(n){return E(this,null,function*(){var i=n,{concept:e}=i,r=W(i,["concept"]);var s;if(!e||!e.uri)throw new U({parameter:"concept"});if(this._api.ancestors)return this.axios(L(R({},r),{method:"get",url:this._api.ancestors,params:L(R(L(R({},this._defaultParams),{limit:1e4}),r.params||{}),{uri:e.uri})}));{let o=R({params:{}},r);o.params.properties="ancestors";let u=((s=(yield this.getConcepts(R({concepts:[e]},o)))[0])==null?void 0:s.ancestors)||[];return u.length?this.getConcepts(R({concepts:u},r)):[]}})}suggest(o){return E(this,null,function*(){var a=o,{use:e="notation,label",types:r=[],sort:n="score",params:i={}}=a,s=W(a,["use","types","sort","params"]);return this._search(L(R({},s),{endpoint:"suggest",params:L(R({},i),{type:r.join("|"),use:e,sort:n})}))})}search(i){return E(this,null,function*(){var s=i,{types:e=[],params:r={}}=s,n=W(s,["types","params"]);return this._search(L(R({},n),{endpoint:"search",params:L(R({},r),{type:e.join("|")})}))})}vocSuggest(s){return E(this,null,function*(){var o=s,{use:e="notation,label",sort:r="score",params:n={}}=o,i=W(o,["use","sort","params"]);return this._search(L(R({},i),{endpoint:"voc-suggest",params:L(R({},n),{use:e,sort:r})}))})}vocSearch(e){return E(this,null,function*(){return this._search(L(R({},e),{endpoint:"voc-search"}))})}_search(l){return E(this,null,function*(){var c=l,{endpoint:e,scheme:r,search:n,limit:i,offset:s,params:o,url:a}=c,u=W(c,["endpoint","scheme","search","limit","offset","params","url"]);if(a=a!=null?a:this._api[e],!a)throw new Se;if(!n)throw new U({parameter:"search"});i=i||this._jskos.suggestResultLimit||100,s=s||0;let p=r&&(yield this._getSchemeUri(r));return a=a.replace("{searchTerms}",n),this.axios(L(R({},u),{params:L(R(R({},this._defaultParams),o),{limit:i,count:i,offset:s,search:n,query:n,voc:p}),method:"get",url:a}))})}getTypes(n){return E(this,null,function*(){var i=n,{scheme:e}=i,r=W(i,["scheme"]);if(!this._api.types)throw new Se;if(Array.isArray(this._api.types))return this._api.types;let s=e&&(yield this._getSchemeUri(e));s&&(r.params||(r.params={}),r.params.uri=s);let o=yield this.axios(L(R({},r),{method:"get",url:this._api.types}));return s&&(o=o.filter(a=>!a.inScheme||P.isContainedIn(e,a.inScheme))),o})}};ee(Te,"providerName","ConceptApi"),ee(Te,"providerType","http://bartoc.org/api-type/jskos"),ee(Te,"supports",{schemes:!0,top:!0,data:!0,concepts:!0,narrower:!0,ancestors:!0,types:!0,suggest:!0,search:!0,auth:!0,registries:!0});var mi={},je=class extends G{get _cache(){return mi[this.uri]}_prepare(){mi[this.uri]=[]}getMappings(s){return E(this,null,function*(){var o=s,{from:e,to:r,mode:n}=o,i=W(o,["from","to","mode"]);var S,k,D,$,X,K;let a=[];Array.isArray(this.schemes)&&(a=this.schemes);let u,l,c=(S=e==null?void 0:e.inScheme)==null?void 0:S[0],p=(k=r==null?void 0:r.inScheme)==null?void 0:k[0],m,g;if(!e||P.isContainedIn(c,a)?(u=!0,l=r,m=p,g=a.find(V=>P.compare(V,c))||a[0]):(u=!1,l=e,m=c,g=a.find(V=>P.compare(V,p))||a[0]),n!="or")return[];if(!this._api.api)throw new Se;if(!l)throw new U({parameter:u?"to":"from"});let f=P.languagePreference.selectLanguage(l.prefLabel);if(!f)throw new U({parameter:u?"to":"from",message:"Missing language"});let d=($=(D=l==null?void 0:l.altLabel)==null?void 0:D[f])!=null?$:[];typeof d=="string"&&(d=[d]);let y=(X=l==null?void 0:l.prefLabel)==null?void 0:X[f],O=d.concat([y]);O=[y];let{url:I,data:C}=yield this._getReconciliationResults(L(R({},i),{labels:O,language:f}));C=[].concat(...Object.values(C).map(V=>V.result)).filter(V=>V),C=C.sort((V,Z)=>V.score!=Z.score?Z.score-V.score:V.match!=Z.match?V.match?-1:1:V.id.length-Z.id.length);let F=(K=g==null?void 0:g.namespace)!=null?K:"",N=C.map(V=>({fromScheme:m,from:{memberSet:[l]},toScheme:g,to:{memberSet:[{uri:F+V.id}]},type:[V.match?"http://www.w3.org/2004/02/skos/core#exactMatch":V.score>=80?"http://www.w3.org/2004/02/skos/core#closeMatch":"http://www.w3.org/2004/02/skos/core#mappingRelation"]}));return u&&(N=N.map(V=>Object.assign(V,{fromScheme:V.toScheme,from:V.to,toScheme:V.fromScheme,to:V.from}))),N._url=I,N})}_getReconciliationResults(i){return E(this,null,function*(){var s=i,{labels:e,language:r}=s,n=W(s,["labels","language"]);e=e.sort();let o=this._cache.find(g=>Re(g.labels,e)&&g.language==r);if(o)return o;let a={},u=0;for(let g of e)a[`q${u}`]={query:g},u+=1;let l=this._api.api;r&&(l=l.replace("{language}",r));let c=`queries=${encodeURIComponent(JSON.stringify(a))}`;n.headers||(n.headers={}),n.headers["Content-Type"]="application/x-www-form-urlencoded";let p=yield this.axios(L(R({},n),{method:"post",url:l,data:c}));p=p||{};let m={labels:e,language:r,data:p,url:`${l}${l.includes("?")?"&":"?"}${c}`};return this._cache.push(m),this._cache.length>20&&(mi[this.uri]=this._cache.slice(this._cache.length-20)),m})}};ee(je,"supports",{mappings:!0});je.providerName="ReconciliationApi";je.providerType="http://bartoc.org/api-type/reconciliation";je.stored=!1;var We=class extends G{_prepare(){this._cache=[]}supportsScheme(e){var r,n;return super.supportsScheme(e)&&((n=(r=e==null?void 0:e._registry)==null?void 0:r.has)==null?void 0:n.search)}getMappings(a){return E(this,null,function*(){var u=a,{from:e,to:r,mode:n,selected:i,limit:s=10}=u,o=W(u,["from","to","mode","selected","limit"]);if(n!="or")return[];if(!i)throw new U({parameter:"selected"});let l=[];e&&this.supportsScheme(i.scheme[!1])?l.push(this._getMappings(L(R({},o),{concept:e,sourceScheme:i.scheme[!0],targetScheme:i.scheme[!1],limit:s}))):l.push(Promise.resolve([])),r&&this.supportsScheme(i.scheme[!0])?l.push(this._getMappings(L(R({},o),{concept:r,sourceScheme:i.scheme[!1],targetScheme:i.scheme[!0],limit:s,swap:!0}))):l.push(Promise.resolve([]));let[c,p]=yield Promise.all(l);for(p=p.filter(m=>!c.find(g=>P.compareMappingMembers(m,g)));c.length+p.length>s;)p.length>=c.length?p.pop():c.pop();return[...c,...p]})}_getMappings(a){return E(this,null,function*(){var u=a,{concept:e,sourceScheme:r,targetScheme:n,limit:i,swap:s=!1}=u,o=W(u,["concept","sourceScheme","targetScheme","limit","swap"]);var f;if(!e||!r||!n)return[];if(P.compare(r,n))return[];let l=P.languagePreference.selectLanguage(e.prefLabel)||this._defaultLanguages[0],c=P.prefLabel(e,{fallbackToUri:!1,language:l});if(!c)return[];let p=/^[\s\wäüöÄÜÖß]*\w/.exec(c);c=p?p[0]:c;let m=yield this._getResults(L(R({},o),{label:c,targetScheme:n,limit:i}));if(!m.length&&((f=e.broader)!=null&&f.length))for(let d of e.broader){let y=P.prefLabel(d,{fallbackToUri:!1,language:l});if(y&&(m=yield this._getResults(L(R({},o),{label:y,targetScheme:n,limit:i})),m.length))break}let g=m.map(d=>({fromScheme:r,from:{memberSet:[e]},toScheme:n,to:{memberSet:[d]},type:["http://www.w3.org/2004/02/skos/core#mappingRelation"]}));return s&&(g=g.map(d=>Object.assign(d,{fromScheme:d.toScheme,from:d.to,toScheme:d.fromScheme,to:d.from}))),g})}_getResults(s){return E(this,null,function*(){var o=s,{label:e,targetScheme:r,limit:n}=o,i=W(o,["label","targetScheme","limit"]);var p;let a=(this._cache[r.uri]||{})[e];if(a&&a._limit>=n)return a;let u=r==null?void 0:r._registry;if(!u||u.has.search===!1)return[];let l=(p=(this._jskos.overrides||[]).find(m=>P.compare(m,r)))==null?void 0:p.search,c=yield u.search(L(R({},i),{url:l,search:e,scheme:r,limit:n}));return this._cache[r.uri]||(this._cache[r.uri]={}),this._cache[r.uri][e]=c,this._cache[r.uri][e]._limit=n,c})}};ee(We,"supports",{mappings:!0});We.providerName="LabelSearchSuggestion";We.stored=!1;var He=class extends G{static _registryConfigForBartocApiConfig({url:e,scheme:r}={}){if(!e||!r)return null;let n={},i=e.match(/(.+\/)([^/]+)\/$/);return i?(n.api=i[1]+"rest/v1/",r.VOCID=i[2],n.schemes=[r],n):null}get _language(){return this.languages[0]||this._defaultLanguages[0]||"en"}_getApiUrl(e,r,n){var o;let i=(e==null?void 0:e.VOCID)||((o=this.schemes.find(a=>P.compare(a,e)))==null?void 0:o.VOCID);if(!i)throw new U({parameter:"scheme",message:"Missing scheme or VOCID property on scheme"});r=r||"",n=n||{},n.lang||(n.lang=this._language);let s=Object.keys(n).map(a=>`${a}=${encodeURIComponent(n[a])}`).join("&");return`${this._api.api}${i}${r}${s?"?"+s:""}`}_getDataUrl(e,{addFormatParameter:r=!0}={}){var i;let n=(i=e==null?void 0:e.inScheme)==null?void 0:i[0];if(!e||!e.uri)throw new U({parameter:"concept",message:"Missing concept URI"});return this._getApiUrl(n,"/data",r?{format:"application/json"}:{})}_getSchemeUri(e){return E(this,null,function*(){this._approvedSchemes=this._approvedSchemes||[],this._rejectedSchemes=this._rejectedSchemes||[];let r=this._approvedSchemes.find(o=>P.compare(e,o));if(r)return r.uri;if(this._rejectedSchemes.find(o=>P.compare(e,o)))return null;let n=this._getApiUrl(e,"/"),s=(yield this.axios({method:"get",url:n})).conceptschemes.find(o=>P.compare(o,e));return s?(this._approvedSchemes.push({uri:s.uri,identifier:P.getAllUris(e)}),s.uri):(this._rejectedSchemes.push({uri:e.uri,identifier:e.identifier}),null)})}_toJskosConcept(e,{concept:r,scheme:n,result:i,language:s}={}){var c,p;if(!e)return null;r=P.deepCopy(r||{}),s=s||e.lang||"en",r.uri=e.uri,n&&(r.inScheme=[n]);let o=e.matchedPrefLabel||e.prefLabel||e.label;if(typeof o=="string")r.prefLabel||(r.prefLabel={}),r.prefLabel[s]=o;else{o&&!Array.isArray(o)&&(o=[o]);for(let m of o||[])r.prefLabel||(r.prefLabel={}),r.prefLabel[m.lang]=m.value}let a=e.altLabel;if(typeof a=="string")r.altLabel||(r.altLabel={}),r.altLabel[s]=a;else{a&&!Array.isArray(a)&&(a=[a]);for(let m of a||[])(c=r==null?void 0:r.altLabel)!=null&&c[m.lang]?(r.altLabel[m.lang].push(m.value),r.altLabel[m.lang]=[...new Set(r.altLabel[m.lang])]):(r.altLabel||(r.altLabel={}),r.altLabel[m.lang]=[m.value])}let u=e.notation||e["skos:notation"]||P.notation(r);u&&(r.notation=[u.value||u]),e.broader&&(Array.isArray(e.broader)||(e.broader=[e.broader]),r.broader=e.broader.map(m=>typeof m=="string"?{uri:m}:m)),e.hasChildren===!0?r.narrower=[null]:e.hasChildren===!1&&(r.narrower=[]),e.type&&!Array.isArray(e.type)&&(e.type=[e.type]),r.type=r.type||[];for(let m of e.type||[]){if(!P.isValidUri(m))continue;let g=m.slice(0,m.indexOf(":"));i&&i["@context"]&&i["@context"][g]&&(m=m.replace(g+":",i["@context"][g])),r.type.push(m)}r.type=[...new Set(r.type)],r.type.length||(r.type=["http://www.w3.org/2004/02/skos/core#Concept"]);let l={"skos:definition":"definition","skos:note":"note","skos:scopeNote":"scopeNote","skos:example":"example","skos:historyNote":"historyNote","skos:editorialNote":"editorialNote","skos:changeNote":"changeNote"};for(let m in l){let g=e[m]||[];if(Array.isArray(g)||(g=[g]),g.length){r[l[m]]={};for(let{lang:f,value:d}of g)f&&d&&((p=r[l[m]])[f]||(p[f]=[]),r[l[m]][f].push(d))}}return r}getSchemes(){return E(this,arguments,function*(r={}){var e=W(r,[]);let n=[];for(let i of this.schemes||[]){let s=this._getApiUrl(i,"/"),a=(yield this.axios(L(R({},e),{method:"get",url:s}))).conceptschemes.find(l=>P.compare(l,i)),u=a&&(a.prefLabel||a.label||a.title);u&&(i.prefLabel||(i.prefLabel={}),i.prefLabel[this._language]=u),n.push(i),this._approvedSchemes=this._approvedSchemes||[],this._approvedSchemes.find(l=>P.compare(i,l))||this._approvedSchemes.push({uri:a.uri,identifier:P.getAllUris(i)})}return n})}getTop(n){return E(this,null,function*(){var i=n,{scheme:e}=i,r=W(i,["scheme"]);let s=this._getApiUrl(e,"/topConcepts"),o=yield this._getSchemeUri(e);if(!o)throw new U({parameter:"scheme",message:"Missing or unsupported scheme or VOCID property on scheme"});r.params||(r.params={}),r.params.scheme=o;let a=yield this.axios(L(R({},r),{method:"get",url:s})),u=[];for(let l of a.topconcepts||[]){let c=this._toJskosConcept(l,{scheme:e,language:this._language});c.topConceptOf=[e],u.push(c)}return u})}getConcepts(n){return E(this,null,function*(){var i=n,{concepts:e}=i,r=W(i,["concepts"]);var o,a;Array.isArray(e)||(e=[e]),e=e.map(u=>({uri:u.uri,inScheme:u.inScheme}));let s=[];for(let u of e){if(!u||!u.uri)throw new U({parameter:"concept",message:"Missing concept URI"});let l={uri:u.uri,format:"application/json"},c=this._getApiUrl((o=u==null?void 0:u.inScheme)==null?void 0:o[0],"/data",l);if(!c)continue;let p=yield this.axios(L(R({},r),{method:"get",url:c})),m=(a=p==null?void 0:p.graph)==null?void 0:a.find(g=>P.compare(g,u));if(m){let g=this._toJskosConcept(m,{concept:u,result:p});for(let f of["broader","narrower"]){let d=m[f]||g[f];d&&!Array.isArray(d)&&(d=[d]),d||(d=[]),g[f]=d.map(y=>this._toJskosConcept(p.graph.find(O=>P.compare(O,y)),{scheme:u.inScheme[0],result:p}))}g.ancestors=[],s.push(g)}}return s})}getNarrower(n){return E(this,null,function*(){var i=n,{concept:e}=i,r=W(i,["concept"]);if(!e||!e.uri)throw new U({parameter:"concept"});let s=e.inScheme[0],o=this._getApiUrl(s,"/children");return r.params||(r.params={}),r.params.uri=e.uri,((yield this.axios(L(R({},r),{method:"get",url:o}))).narrower||[]).map(l=>this._toJskosConcept(l,{scheme:s}))})}getAncestors(n){return E(this,null,function*(){var i=n,{concept:e}=i,r=W(i,["concept"]);var p,m,g,f;if(!e||!e.uri)throw new U({parameter:"concept"});let s=e.inScheme[0],o=this._getApiUrl(s,"/broaderTransitive");r.params||(r.params={}),r.params.uri=e.uri;let a=yield this.axios(L(R({},r),{method:"get",url:o})),u=[],l=e.uri;for(;l;){if(l!=e.uri){let d=(p=a==null?void 0:a.broaderTransitive)==null?void 0:p[l];u=u.concat([d])}l=(f=(g=(m=a==null?void 0:a.broaderTransitive)==null?void 0:m[l])==null?void 0:g.broader)==null?void 0:f[0]}return u.map(d=>this._toJskosConcept(d,{scheme:s})).filter(d=>d.uri!=e.uri)})}search(o){return E(this,null,function*(){var a=o,{search:e,scheme:r,limit:n,types:i=[]}=a,s=W(a,["search","scheme","limit","types"]);let u=this._getApiUrl(r,"/search");return s.params||(s.params={}),s.params.query=`${e}*`,s.params.unique=1,s.params.maxhits=n||100,s.params.type=i.join(" "),((yield this.axios(L(R({},s),{method:"get",url:u}))).results||[]).map(p=>this._toJskosConcept(p,{scheme:r}))})}getTypes(n){return E(this,null,function*(){var i=n,{scheme:e}=i,r=W(i,["scheme"]);let s=this._getApiUrl(e,"/types"),o=[],a=yield this.axios(L(R({},r),{method:"get",url:s}));for(let u of(a==null?void 0:a.types)||[])u.uri!="http://www.w3.org/2004/02/skos/core#Concept"&&(u.label&&(u.prefLabel={[a["@context"]["@language"]]:u.label},delete u.label),o.push(u));return o._url=s,o})}};ee(He,"supports",{scheme:!0,top:!0,data:!0,concepts:!0,narrower:!0,ancestors:!0,types:!0,suggest:!0,search:!0});He.providerName="SkosmosApi";He.providerType="http://bartoc.org/api-type/skosmos";var Gr="http://id.loc.gov/authorities/",Xr=[{uri:`${Gr}subjects`,identifier:["http://bartoc.org/en/node/454"],notation:["LCSH"],concepts:[null],topConcepts:[]},{uri:`${Gr}names`,identifier:["http://bartoc.org/en/node/18536"],notation:["LCNAF"],concepts:[null],topConcepts:[]}],po=`${Gr}classification`;function mo(t){let e={};e.uri=t["@id"],e.notation=(t["http://www.loc.gov/mads/rdf/v1#code"]||[]).map(i=>i["@value"]);let r=t["http://www.loc.gov/mads/rdf/v1#authoritativeLabel"]||t["http://www.w3.org/2000/01/rdf-schema#label"]||[];r.length&&(e.prefLabel={},e.prefLabel[r[0]["@language"]||"en"]=r[0]["@value"]);let n=t["http://www.w3.org/2004/02/skos/core#altLabel"]||[];n.length&&(e.altLabel={en:n.map(i=>i["@value"])});for(let i of t["http://www.w3.org/2000/01/rdf-schema#comment"]||[])e.definition=e.definition||{},e.definition.en=e.definition.en||[],e.definition.en.push(i["@value"]);return e}function $l(t){let e=mo(t);return e.namespace=e.uri+"/",e.type=["http://www.w3.org/2004/02/skos/core#ConceptScheme"],e}var gi=t=>e=>!e||!t||!t.namespace?!0:e.uri.startsWith(t.namespace);function Wl(t,{scheme:e}){let r=mo(t);r.type=["http://www.w3.org/2004/02/skos/core#Concept"],r.inScheme=e?[e]:(t["http://www.loc.gov/mads/rdf/v1#isMemberOfMADSScheme"]||[]).map(s=>Xr.find(o=>o.uri===s["@id"])),(!r.inScheme.length||!r.inScheme[0])&&delete r.inScheme;let n=t["http://www.loc.gov/mads/rdf/v1#hasNarrowerAuthority"]||P.compare(r.inScheme[0],{uri:po})&&t["http://www.loc.gov/mads/rdf/v1#hasMADSCollectionMember"]||[];r.narrower=n.map(s=>({uri:s["@id"]})).filter(gi(r.inScheme&&r.inScheme[0]));let i=t["http://www.loc.gov/mads/rdf/v1#hasBroaderAuthority"]||P.compare(r.inScheme[0],{uri:po})&&t["http://www.loc.gov/mads/rdf/v1#isMemberOfMADSCollection"]||[];return r.broader=i.map(s=>({uri:s["@id"]})).filter(gi(r.inScheme&&r.inScheme[0])),r}var qe=class extends G{static _registryConfigForBartocApiConfig({scheme:e}={}){return!e||!Xr.find(r=>P.compare(r,e))?null:{schemes:[e]}}getSchemes(){return E(this,null,function*(){let e=[];for(let r of yield Promise.all(Xr.filter(n=>!this.schemes||!this.schemes.length||this.schemes.find(i=>P.compare(n,i))).map(n=>pe({method:"get",url:`${n.uri.replace("http:","https:")}.json`}).then(({status:i,data:s})=>{if(i===200){let o=s.find(a=>n.uri===a["@id"]);if(o)return o=P.merge($l(o),n),o.topConcepts=(o.topConcepts||[]).filter(a=>a),o}return null}))))r&&e.push(r);return e})}getConcepts(r){return E(this,arguments,function*({concepts:e}){Array.isArray(e)||(e=[e]);let n=[];for(let i of yield Promise.all(e.map(s=>pe({method:"get",url:`${s.uri.replace("http:","https:")}.json`}).then(({status:o,data:a})=>{if(o===200){let u=a.find(l=>s.uri===l["@id"]);return u?Wl(u,{scheme:s.inScheme&&s.inScheme[0]}):null}}))))i&&n.push(i);return n})}suggest(e){return E(this,null,function*(){let r=yield this.search(e);return[e.search,r.map(n=>P.prefLabel(n,{fallbackToUri:!0})),[],r.map(n=>n.uri)]})}search(s){return E(this,arguments,function*({search:e,scheme:r,limit:n,offset:i}){let o=P.getAllUris(r).find(u=>u.startsWith(Gr));if(!o||!Xr.find(u=>P.compare(u,{uri:o})))throw new U({parameter:"scheme",message:"provided scheme is not supported (yet)"});if(!e)throw new U({parameter:"search",message:"parameter is empty or missing"});n=n||this._jskos.suggestResultLimit||100,i=i||0;let{data:a}=yield pe({method:"get",url:`${o}/suggest2`.replace("http:","https:"),params:{q:e,count:n||100,offset:i,searchtype:"keyword"}});return(a.hits||[]).map(u=>({uri:u.uri,notation:[u.token],prefLabel:{en:u.aLabel},inScheme:[r]})).filter(gi(r))})}};ee(qe,"supports",{schemes:!0,top:!1,data:!0,concepts:!0,narrower:!1,ancestors:!1,suggest:!0,search:!0});qe.providerName="LocApi";qe.providerType="http://bartoc.org/api-type/loc";var ko={};var H;function ye(t,e,r){let n=typeof r,i=typeof t;if(n!=="undefined"){if(i!=="undefined"){if(r){if(i==="function"&&n===i)return function(a){return t(r(a))};if(e=t.constructor,e===r.constructor){if(e===Array)return r.concat(t);if(e===Map){var s=new Map(r);for(var o of t)s.set(o[0],o[1]);return s}if(e===Set){o=new Set(r);for(s of t.values())o.add(s);return o}}}return t}return r}return i==="undefined"?e:t}function Bt(t,e){return typeof t=="undefined"?e:t}function le(){return Object.create(null)}function Pe(t){return typeof t=="string"}function _r(t){return typeof t=="object"}function br(t,e){if(Pe(e))t=t[e];else for(let r=0;t&&r<e.length;r++)t=t[e[r]];return t}var Hl=/[^\p{L}\p{N}]+/u,ql=/(\d{3})/g,Vl=/(\D)(\d{3})/g,Jl=/(\d{3})(\D)/g,go=/[\u0300-\u036f]/g;function $t(t={}){if(!this||this.constructor!==$t)return new $t(...arguments);if(arguments.length)for(t=0;t<arguments.length;t++)this.assign(arguments[t]);else this.assign(t)}H=$t.prototype;H.assign=function(t){this.normalize=ye(t.normalize,!0,this.normalize);let e=t.include,r=e||t.exclude||t.split,n;if(r||r===""){if(typeof r=="object"&&r.constructor!==RegExp){let i="";n=!e,e||(i+="\\p{Z}"),r.letter&&(i+="\\p{L}"),r.number&&(i+="\\p{N}",n=!!e),r.symbol&&(i+="\\p{S}"),r.punctuation&&(i+="\\p{P}"),r.control&&(i+="\\p{C}"),(r=r.char)&&(i+=typeof r=="object"?r.join(""):r);try{this.split=new RegExp("["+(e?"^":"")+i+"]+","u")}catch(s){this.split=/\s+/}}else this.split=r,n=r===!1||"a1a".split(r).length<2;this.numeric=ye(t.numeric,n)}else{try{this.split=ye(this.split,Hl)}catch(i){this.split=/\s+/}this.numeric=ye(t.numeric,ye(this.numeric,!0))}if(this.prepare=ye(t.prepare,null,this.prepare),this.finalize=ye(t.finalize,null,this.finalize),r=t.filter,this.filter=typeof r=="function"?r:ye(r&&new Set(r),null,this.filter),this.dedupe=ye(t.dedupe,!0,this.dedupe),this.matcher=ye((r=t.matcher)&&new Map(r),null,this.matcher),this.mapper=ye((r=t.mapper)&&new Map(r),null,this.mapper),this.stemmer=ye((r=t.stemmer)&&new Map(r),null,this.stemmer),this.replacer=ye(t.replacer,null,this.replacer),this.minlength=ye(t.minlength,1,this.minlength),this.maxlength=ye(t.maxlength,1024,this.maxlength),this.rtl=ye(t.rtl,!1,this.rtl),(this.cache=r=ye(t.cache,!0,this.cache))&&(this.F=null,this.L=typeof r=="number"?r:2e5,this.B=new Map,this.D=new Map,this.I=this.H=128),this.h="",this.J=null,this.A="",this.K=null,this.matcher)for(let i of this.matcher.keys())this.h+=(this.h?"|":"")+i;if(this.stemmer)for(let i of this.stemmer.keys())this.A+=(this.A?"|":"")+i;return this};H.addStemmer=function(t,e){return this.stemmer||(this.stemmer=new Map),this.stemmer.set(t,e),this.A+=(this.A?"|":"")+t,this.K=null,this.cache&&_t(this),this};H.addFilter=function(t){return typeof t=="function"?this.filter=t:(this.filter||(this.filter=new Set),this.filter.add(t)),this.cache&&_t(this),this};H.addMapper=function(t,e){return typeof t=="object"?this.addReplacer(t,e):t.length>1?this.addMatcher(t,e):(this.mapper||(this.mapper=new Map),this.mapper.set(t,e),this.cache&&_t(this),this)};H.addMatcher=function(t,e){return typeof t=="object"?this.addReplacer(t,e):t.length<2&&(this.dedupe||this.mapper)?this.addMapper(t,e):(this.matcher||(this.matcher=new Map),this.matcher.set(t,e),this.h+=(this.h?"|":"")+t,this.J=null,this.cache&&_t(this),this)};H.addReplacer=function(t,e){return typeof t=="string"?this.addMatcher(t,e):(this.replacer||(this.replacer=[]),this.replacer.push(t,e),this.cache&&_t(this),this)};H.encode=function(t,e){if(this.cache&&t.length<=this.H)if(this.F){if(this.B.has(t))return this.B.get(t)}else this.F=setTimeout(_t,50,this);this.normalize&&(typeof this.normalize=="function"?t=this.normalize(t):t=go?t.normalize("NFKD").replace(go,"").toLowerCase():t.toLowerCase()),this.prepare&&(t=this.prepare(t)),this.numeric&&t.length>3&&(t=t.replace(Vl,"$1 $2").replace(Jl,"$1 $2").replace(ql,"$1 "));let r=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer),n=[],i=le(),s,o,a=this.split||this.split===""?t.split(this.split):[t];for(let l=0,c,p;l<a.length;l++)if((c=p=a[l])&&!(c.length<this.minlength||c.length>this.maxlength)){if(e){if(i[c])continue;i[c]=1}else{if(s===c)continue;s=c}if(r)n.push(c);else if(!this.filter||(typeof this.filter=="function"?this.filter(c):!this.filter.has(c))){if(this.cache&&c.length<=this.I)if(this.F){var u=this.D.get(c);if(u||u===""){u&&n.push(u);continue}}else this.F=setTimeout(_t,50,this);if(this.stemmer){this.K||(this.K=new RegExp("(?!^)("+this.A+")$"));let m;for(;m!==c&&c.length>2;)m=c,c=c.replace(this.K,g=>this.stemmer.get(g))}if(c&&(this.mapper||this.dedupe&&c.length>1)){u="";for(let m=0,g="",f,d;m<c.length;m++)f=c.charAt(m),f===g&&this.dedupe||((d=this.mapper&&this.mapper.get(f))||d===""?d===g&&this.dedupe||!(g=d)||(u+=d):u+=g=f);c=u}if(this.matcher&&c.length>1&&(this.J||(this.J=new RegExp("("+this.h+")","g")),c=c.replace(this.J,m=>this.matcher.get(m))),c&&this.replacer)for(u=0;c&&u<this.replacer.length;u+=2)c=c.replace(this.replacer[u],this.replacer[u+1]);if(this.cache&&p.length<=this.I&&(this.D.set(p,c),this.D.size>this.L&&(this.D.clear(),this.I=this.I/1.1|0)),c){if(c!==p)if(e){if(i[c])continue;i[c]=1}else{if(o===c)continue;o=c}n.push(c)}}}return this.finalize&&(n=this.finalize(n)||n),this.cache&&t.length<=this.H&&(this.B.set(t,n),this.B.size>this.L&&(this.B.clear(),this.H=this.H/1.1|0)),n};function _t(t){t.F=null,t.B.clear(),t.D.clear()}function Ei(t,e,r){r||(e||typeof t!="object"?typeof e=="object"&&(r=e,e=0):r=t),r&&(t=r.query||t,e=r.limit||e);let n=""+(e||0);r&&(n+=(r.offset||0)+!!r.context+!!r.suggest+(r.resolve!==!1)+(r.resolution||this.resolution)+(r.boost||0)),t=(""+t).toLowerCase(),this.cache||(this.cache=new St);let i=this.cache.get(t+n);if(!i){let s=r&&r.cache;s&&(r.cache=!1),i=this.search(t,e,r),s&&(r.cache=s),this.cache.set(t+n,i)}return i}function St(t){this.limit=t&&t!==!0?t:1e3,this.cache=new Map,this.h=""}St.prototype.set=function(t,e){this.cache.set(this.h=t,e),this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};St.prototype.get=function(t){let e=this.cache.get(t);return e&&this.h!==t&&(this.cache.delete(t),this.cache.set(this.h=t,e)),e};St.prototype.remove=function(t){for(let e of this.cache){let r=e[0];e[1].includes(t)&&this.cache.delete(r)}};St.prototype.clear=function(){this.cache.clear(),this.h=""};var wo={normalize:!1,numeric:!1,dedupe:!1},Qr={},yi=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]),yo=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),_o=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"],bo={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,\u00DF:2,d:3,t:3,l:4,m:5,n:5,r:6},Ai={Exact:wo,Default:Qr,Normalize:Qr,LatinBalance:{mapper:yi},LatinAdvanced:{mapper:yi,matcher:yo,replacer:_o},LatinExtra:{mapper:yi,replacer:_o.concat([/(?!^)[aeo]/g,""]),matcher:yo},LatinSoundex:{dedupe:!1,include:{letter:!0},finalize:function(t){for(let r=0;r<t.length;r++){var e=t[r];let n=e.charAt(0),i=bo[n];for(let s=1,o;s<e.length&&(o=e.charAt(s),o==="h"||o==="w"||!(o=bo[o])||o===i||(n+=o,i=o,n.length!==4));s++);t[r]=n}}},CJK:{split:""},LatinExact:wo,LatinDefault:Qr,LatinSimple:Qr};function vo(t,e,r,n){let i=[];for(let s=0,o;s<t.index.length;s++)if(o=t.index[s],e>=o.length)e-=o.length;else{e=o[n?"splice":"slice"](e,r);let a=e.length;if(a&&(i=i.length?i.concat(e):e,r-=a,n&&(t.length-=a),!r))break;e=0}return i}function Wt(t){if(!this||this.constructor!==Wt)return new Wt(t);this.index=t?[t]:[],this.length=t?t.length:0;let e=this;return new Proxy([],{get(r,n){if(n==="length")return e.length;if(n==="push")return function(i){e.index[e.index.length-1].push(i),e.length++};if(n==="pop")return function(){if(e.length)return e.length--,e.index[e.index.length-1].pop()};if(n==="indexOf")return function(i){let s=0;for(let o=0,a,u;o<e.index.length;o++){if(a=e.index[o],u=a.indexOf(i),u>=0)return s+u;s+=a.length}return-1};if(n==="includes")return function(i){for(let s=0;s<e.index.length;s++)if(e.index[s].includes(i))return!0;return!1};if(n==="slice")return function(i,s){return vo(e,i||0,s||e.length,!1)};if(n==="splice")return function(i,s){return vo(e,i||0,s||e.length,!0)};if(n==="constructor")return Array;if(typeof n!="symbol")return(r=e.index[n/rt(2,31)|0])&&r[n]},set(r,n,i){return r=n/rt(2,31)|0,(e.index[r]||(e.index[r]=[]))[n]=i,e.length++,!0}})}Wt.prototype.clear=function(){this.index.length=0};Wt.prototype.push=function(){};function De(t=8){if(!this||this.constructor!==De)return new De(t);this.index=le(),this.h=[],this.size=0,t>32?(this.B=Io,this.A=BigInt(t)):(this.B=Ro,this.A=t)}De.prototype.get=function(t){let e=this.index[this.B(t)];return e&&e.get(t)};De.prototype.set=function(t,e){var r=this.B(t);let n=this.index[r];n?(r=n.size,n.set(t,e),(r-=n.size)&&this.size++):(this.index[r]=n=new Map([[t,e]]),this.h.push(n),this.size++)};function Me(t=8){if(!this||this.constructor!==Me)return new Me(t);this.index=le(),this.h=[],this.size=0,t>32?(this.B=Io,this.A=BigInt(t)):(this.B=Ro,this.A=t)}Me.prototype.add=function(t){var e=this.B(t);let r=this.index[e];r?(e=r.size,r.add(t),(e-=r.size)&&this.size++):(this.index[e]=r=new Set([t]),this.h.push(r),this.size++)};H=De.prototype;H.has=Me.prototype.has=function(t){let e=this.index[this.B(t)];return e&&e.has(t)};H.delete=Me.prototype.delete=function(t){let e=this.index[this.B(t)];e&&e.delete(t)&&this.size--};H.clear=Me.prototype.clear=function(){this.index=le(),this.h=[],this.size=0};H.values=Me.prototype.values=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].values())yield e};H.keys=Me.prototype.keys=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].keys())yield e};H.entries=Me.prototype.entries=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].entries())yield e};function Ro(t){let e=rt(2,this.A)-1;if(typeof t=="number")return t&e;let r=0,n=this.A+1;for(let i=0;i<t.length;i++)r=(r*n^t.charCodeAt(i))&e;return this.A===32?r+rt(2,31):r}function Io(t){let e=rt(BigInt(2),this.A)-BigInt(1);var r=typeof t;if(r==="bigint")return t&e;if(r==="number")return BigInt(t)&e;r=BigInt(0);let n=this.A+BigInt(1);for(let i=0;i<t.length;i++)r=(r*n^BigInt(t.charCodeAt(i)))&e;return r}var jt,yr;function Kl(t){return E(this,null,function*(){t=t.data;var e=t.task;let r=t.id,n=t.args;if(e==="init")yr=t.options||{},(e=t.factory)?(Function("return "+e)()(self),jt=new self.FlexSearch.Index(yr),delete self.FlexSearch):jt=new Ne(yr),postMessage({id:r});else{let i;e==="export"&&(n[1]?(n[0]=yr.export,n[2]=0,n[3]=1):n=null),e==="import"?n[0]&&(t=yield yr.import.call(jt,n[0]),jt.import(n[0],t)):((i=n&&jt[e].apply(jt,n))&&i.then&&(i=yield i),i&&i.await&&(i=yield i.await),e==="search"&&i.result&&(i=i.result)),postMessage(e==="search"?{id:r,msg:i}:{id:r})}})}function Ci(t){Ut.call(t,"add"),Ut.call(t,"append"),Ut.call(t,"search"),Ut.call(t,"update"),Ut.call(t,"remove"),Ut.call(t,"searchCache")}var bi,So,tn;function Yl(){bi=tn=0}function Ut(t){this[t+"Async"]=function(){let e=arguments;var r=e[e.length-1];let n;if(typeof r=="function"&&(n=r,delete e[e.length-1]),bi?tn||(tn=Date.now()-So>=this.priority*this.priority*3):(bi=setTimeout(Yl,0),So=Date.now()),tn){let s=this;return new Promise(o=>{setTimeout(function(){o(s[t+"Async"].apply(s,e))},0)})}let i=this[t].apply(this,e);return r=i.then?i:new Promise(s=>s(i)),n&&r.then(n),r}}var ot=0;function bt(t={},e){function r(a){function u(l){l=l.data||l;let c=l.id,p=c&&s.h[c];p&&(p(l.msg),delete s.h[c])}if(this.worker=a,this.h=le(),this.worker)return i?this.worker.on("message",u):this.worker.onmessage=u,t.config?new Promise(function(l){ot>1e9&&(ot=0),s.h[++ot]=function(){l(s)},s.worker.postMessage({id:ot,task:"init",factory:n,options:t})}):(this.priority=t.priority||4,this.encoder=e||null,this.worker.postMessage({task:"init",factory:n,options:t}),this)}if(!this||this.constructor!==bt)return new bt(t);let n=typeof self!="undefined"?self._factory:typeof window!="undefined"?window._factory:null;n&&(n=n.toString());let i=typeof window=="undefined",s=this,o=Xl(n,i,t.worker);return o.then?o.then(function(a){return r.call(s,a)}):r.call(this,o)}at("add");at("append");at("search");at("update");at("remove");at("clear");at("export");at("import");bt.prototype.searchCache=Ei;Ci(bt.prototype);function at(t){bt.prototype[t]=function(){let e=this,r=[].slice.call(arguments);var n=r[r.length-1];let i;return typeof n=="function"&&(i=n,r.pop()),n=new Promise(function(s){t==="export"&&typeof r[0]=="function"&&(r[0]=null),ot>1e9&&(ot=0),e.h[++ot]=s,e.worker.postMessage({task:t,id:ot,args:r})}),i?(n.then(i),this):n}}function Xl(t,e,r){return e?typeof module!="undefined"?new(wi()).Worker(__dirname+"/worker/node.js"):Promise.resolve().then(()=>ns(wi(),1)).then(function(n){return new n.Worker(ko.dirname+"/node/node.mjs")}):t?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+Kl.toString()],{type:"text/javascript"}))):new window.Worker(typeof r=="string"?r:ko.url.replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js","module/worker/worker.js").replace("flexsearch.bundle.module.min.mjs","module/worker/worker.js"),{type:"module"})}vt.prototype.add=function(t,e,r){if(_r(t)&&(e=t,t=br(e,this.key)),e&&(t||t===0)){if(!r&&this.reg.has(t))return this.update(t,e);for(let a=0,u;a<this.field.length;a++){u=this.B[a];var n=this.index.get(this.field[a]);if(typeof u=="function"){var i=u(e);i&&n.add(t,i,r,!0)}else i=u.G,(!i||i(e))&&(u.constructor===String?u=[""+u]:Pe(u)&&(u=[u]),Si(e,u,this.D,0,n,t,u[0],r))}if(this.tag)for(n=0;n<this.A.length;n++){var s=this.A[n];i=this.tag.get(this.F[n]);let a=le();if(typeof s=="function"){if(s=s(e),!s)continue}else{var o=s.G;if(o&&!o(e))continue;s.constructor===String&&(s=""+s),s=br(e,s)}if(i&&s){Pe(s)&&(s=[s]);for(let u=0,l,c;u<s.length;u++)if(l=s[u],!a[l]&&(a[l]=1,(o=i.get(l))?c=o:i.set(l,c=[]),!r||!c.includes(t))){if(c.length===rt(2,31)-1){if(o=new Wt(c),this.fastupdate)for(let p of this.reg.values())p.includes(c)&&(p[p.indexOf(c)]=o);i.set(l,c=o)}c.push(t),this.fastupdate&&((o=this.reg.get(t))?o.push(c):this.reg.set(t,[c]))}}}if(this.store&&(!r||!this.store.has(t))){let a;if(this.h){a=le();for(let u=0,l;u<this.h.length;u++){if(l=this.h[u],(r=l.G)&&!r(e))continue;let c;if(typeof l=="function"){if(c=l(e),!c)continue;l=[l.O]}else if(Pe(l)||l.constructor===String){a[l]=e[l];continue}vi(e,a,l,0,l[0],c)}}this.store.set(t,a||e)}this.worker&&(this.fastupdate||this.reg.add(t))}return this};function vi(t,e,r,n,i,s){if(t=t[i],n===r.length-1)e[i]=s||t;else if(t)if(t.constructor===Array)for(e=e[i]=Array(t.length),i=0;i<t.length;i++)vi(t,e,r,n,i);else e=e[i]||(e[i]=le()),i=r[++n],vi(t,e,r,n,i)}function Si(t,e,r,n,i,s,o,a){if(t=t[o])if(n===e.length-1){if(t.constructor===Array){if(r[n]){for(e=0;e<t.length;e++)i.add(s,t[e],!0,!0);return}t=t.join(" ")}i.add(s,t,a,!0)}else if(t.constructor===Array)for(o=0;o<t.length;o++)Si(t,e,r,n,i,s,o,a);else o=e[++n],Si(t,e,r,n,i,s,o,a)}function Oi(t,e,r,n){if(!t.length)return t;if(t.length===1)return t=t[0],t=r||t.length>e?t.slice(r,r+e):t,n?zt.call(this,t):t;let i=[];for(let s=0,o,a;s<t.length;s++)if((o=t[s])&&(a=o.length)){if(r){if(r>=a){r-=a;continue}o=o.slice(r,r+e),a=o.length,r=0}if(a>e&&(o=o.slice(0,e),a=e),!i.length&&a>=e)return n?zt.call(this,o):o;if(i.push(o),e-=a,!e)break}return i=i.length>1?[].concat.apply([],i):i[0],n?zt.call(this,i):i}function ln(t,e,r,n){var i=n[0];if(i[0]&&i[0].query)return t[e].apply(t,i);if(!(e!=="and"&&e!=="not"||t.result.length||t.await||i.suggest))return n.length>1&&(i=n[n.length-1]),(n=i.resolve)?t.await||t.result:t;let s=[],o=0,a=0,u,l,c,p,m;for(e=0;e<n.length;e++)if(i=n[e]){var g=void 0;if(i.constructor===oe)g=i.await||i.result;else if(i.then||i.constructor===Array)g=i;else{o=i.limit||0,a=i.offset||0,c=i.suggest,l=i.resolve,u=((p=i.highlight||t.highlight)||i.enrich)&&l,g=i.queue;let f=i.async||g,d=i.index,y=i.query;if(d?t.index||(t.index=d):d=t.index,y||i.tag){let O=i.field||i.pluck;if(O&&(!y||t.query&&!p||(t.query=y,t.field=O,t.highlight=p),d=d.index.get(O)),g&&(m||t.await)){m=1;let I,C=t.C.length,F=new Promise(function(N){I=N});(function(N,S){F.h=function(){S.index=null,S.resolve=!1;let k=f?N.searchAsync(S):N.search(S);return k.then?k.then(function(D){return t.C[C]=D=D.result||D,I(D),D}):(k=k.result||k,I(k),k)}})(d,Object.assign({},i)),t.C.push(F),s[e]=F;continue}else i.resolve=!1,i.index=null,g=f?d.searchAsync(i):d.search(i),i.resolve=l,i.index=d}else if(i.and)g=Zr(i,"and",d);else if(i.or)g=Zr(i,"or",d);else if(i.not)g=Zr(i,"not",d);else if(i.xor)g=Zr(i,"xor",d);else continue}g.await?(m=1,g=g.await):g.then?(m=1,g=g.then(function(f){return f.result||f})):g=g.result||g,s[e]=g}if(m&&!t.await&&(t.await=new Promise(function(f){t.return=f})),m){let f=Promise.all(s).then(function(d){for(let y=0;y<t.C.length;y++)if(t.C[y]===f){t.C[y]=function(){return r.call(t,d,o,a,u,l,c,p)};break}ki(t)});t.C.push(f)}else if(t.await)t.C.push(function(){return r.call(t,s,o,a,u,l,c,p)});else return r.call(t,s,o,a,u,l,c,p);return l?t.await||t.result:t}function Zr(t,e,r){t=t[e];let n=t[0]||t;return n.index||(n.index=r),r=new oe(n),t.length>1&&(r=r[e].apply(r,t.slice(1))),r}oe.prototype.or=function(){return ln(this,"or",Gl,arguments)};function Gl(t,e,r,n,i,s,o){return t.length&&(this.result.length&&t.push(this.result),t.length<2?this.result=t[0]:(this.result=To(t,e,r,!1,this.h),r=0)),i&&(this.await=null),i?this.resolve(e,r,n,o):this}oe.prototype.and=function(){return ln(this,"and",Ql,arguments)};function Ql(t,e,r,n,i,s,o){if(!s&&!this.result.length)return i?this.result:this;let a;if(t.length)if(this.result.length&&t.unshift(this.result),t.length<2)this.result=t[0];else{let u=0;for(let l=0,c,p;l<t.length;l++)if((c=t[l])&&(p=c.length))u<p&&(u=p);else if(!s){u=0;break}u?(this.result=nn(t,u,e,r,s,this.h,i),a=!0):this.result=[]}else s||(this.result=t);return i&&(this.await=null),i?this.resolve(e,r,n,o,a):this}oe.prototype.xor=function(){return ln(this,"xor",Zl,arguments)};function Zl(t,e,r,n,i,s,o){if(t.length)if(this.result.length&&t.unshift(this.result),t.length<2)this.result=t[0];else{e:{s=r;var a=this.h;let u=[],l=le(),c=0;for(let p=0,m;p<t.length;p++)if(m=t[p]){c<m.length&&(c=m.length);for(let g=0,f;g<m.length;g++)if(f=m[g])for(let d=0,y;d<f.length;d++)y=f[d],l[y]=l[y]?2:1}for(let p=0,m,g=0;p<c;p++)for(let f=0,d;f<t.length;f++)if((d=t[f])&&(m=d[p])){for(let y=0,O;y<m.length;y++)if(O=m[y],l[O]===1)if(s)s--;else if(i){if(u.push(O),u.length===e){t=u;break e}}else{let I=p+(f?a:0);if(u[I]||(u[I]=[]),u[I].push(O),++g===e){t=u;break e}}}t=u}this.result=t,a=!0}else s||(this.result=t);return i&&(this.await=null),i?this.resolve(e,r,n,o,a):this}oe.prototype.not=function(){return ln(this,"not",ec,arguments)};function ec(t,e,r,n,i,s,o){if(!s&&!this.result.length)return i?this.result:this;if(t.length&&this.result.length){e:{s=r;var a=[];t=new Set(t.flat().flat());for(let u=0,l,c=0;u<this.result.length;u++)if(l=this.result[u]){for(let p=0,m;p<l.length;p++)if(m=l[p],!t.has(m)){if(s)s--;else if(i){if(a.push(m),a.length===e){t=a;break e}}else if(a[u]||(a[u]=[]),a[u].push(m),++c===e){t=a;break e}}}t=a}this.result=t,a=!0}return i&&(this.await=null),i?this.resolve(e,r,n,o,a):this}function rn(t,e,r,n,i){let s,o,a;typeof i=="string"?(s=i,i=""):s=i.template,o=s.indexOf("$1"),a=s.substring(o+2),o=s.substring(0,o);let u=i&&i.boundary,l=!i||i.clip!==!1,c=i&&i.merge&&a&&o&&new RegExp(a+" "+o,"g");i=i&&i.ellipsis;var p=0;if(typeof i=="object"){var m=i.template;p=m.length-2,i=i.pattern}typeof i!="string"&&(i=i===!1?"":"..."),p&&(i=m.replace("$1",i)),m=i.length-p;let g,f;typeof u=="object"&&(g=u.before,g===0&&(g=-1),f=u.after,f===0&&(f=-1),u=u.total||9e5),p=new Map;for(let lt=0,be,Vt,ct;lt<e.length;lt++){let ft;if(n)ft=e,ct=n;else{var d=e[lt];if(ct=d.field,!ct)continue;ft=d.result}Vt=r.get(ct),be=Vt.encoder,d=p.get(be),typeof d!="string"&&(d=be.encode(t),p.set(be,d));for(let ve=0;ve<ft.length;ve++){var y=ft[ve].doc;if(!y||(y=br(y,ct),!y))continue;var O=y.trim().split(/\s+/);if(!O.length)continue;y="";var I=[];let ht=[];for(var C=-1,F=-1,N=0,S=0;S<O.length;S++){var k=O[S],D=be.encode(k);D=D.length>1?D.join(" "):D[0];let J;if(D&&k){for(var $=k.length,X=(be.split?k.replace(be.split,""):k).length-D.length,K="",V=0,Z=0;Z<d.length;Z++){var se=d[Z];if(se){var re=se.length;re+=X<0?0:X,V&&re<=V||(se=D.indexOf(se),se>-1&&(K=(se?k.substring(0,se):"")+o+k.substring(se,se+re)+a+(se+re<$?k.substring(se+re):""),V=re,J=!0))}}K&&(u&&(C<0&&(C=y.length+(y?1:0)),F=y.length+(y?1:0)+K.length,N+=$,ht.push(I.length),I.push({match:K})),y+=(y?" ":"")+K)}if(!J)k=O[S],y+=(y?" ":"")+k,u&&I.push({text:k});else if(u&&N>=u)break}if(N=ht.length*(s.length-2),g||f||u&&y.length-N>u)if(N=u+N-m*2,S=F-C,g>0&&(S+=g),f>0&&(S+=f),S<=N)O=g?C-(g>0?g:0):C-((N-S)/2|0),I=f?F+(f>0?f:0):O+N,l||(O>0&&y.charAt(O)!==" "&&y.charAt(O-1)!==" "&&(O=y.indexOf(" ",O),O<0&&(O=0)),I<y.length&&y.charAt(I-1)!==" "&&y.charAt(I)!==" "&&(I=y.lastIndexOf(" ",I),I<F?I=F:++I)),y=(O?i:"")+y.substring(O,I)+(I<y.length?i:"");else{for(F=[],C={},N={},S={},k={},D={},K=X=$=0,Z=V=1;;){var _e=void 0;for(let J=0,ae;J<ht.length;J++){if(ae=ht[J],K)if(X!==K){if(S[J+1])continue;if(ae+=K,C[ae]){$-=m,N[J+1]=1,S[J+1]=1;continue}if(ae>=I.length-1){if(ae>=I.length){S[J+1]=1,ae>=O.length&&(N[J+1]=1);continue}$-=m}if(y=I[ae].text,re=f&&D[J])if(re>0){if(y.length>re)if(S[J+1]=1,l)y=y.substring(0,re);else continue;(re-=y.length)||(re=-1),D[J]=re}else{S[J+1]=1;continue}if($+y.length+1<=u)y=" "+y,F[J]+=y;else if(l)_e=u-$-1,_e>0&&(y=" "+y.substring(0,_e),F[J]+=y),S[J+1]=1;else{S[J+1]=1;continue}}else{if(S[J])continue;if(ae-=X,C[ae]){$-=m,S[J]=1,N[J]=1;continue}if(ae<=0){if(ae<0){S[J]=1,N[J]=1;continue}$-=m}if(y=I[ae].text,re=g&&k[J])if(re>0){if(y.length>re)if(S[J]=1,l)y=y.substring(y.length-re);else continue;(re-=y.length)||(re=-1),k[J]=re}else{S[J]=1;continue}if($+y.length+1<=u)y+=" ",F[J]=y+F[J];else if(l)_e=y.length+1-(u-$),_e>=0&&_e<y.length&&(y=y.substring(_e)+" ",F[J]=y+F[J]),S[J]=1;else{S[J]=1;continue}}else{y=I[ae].match,g&&(k[J]=g),f&&(D[J]=f),J&&$++;let Jt;if(ae?!J&&m&&($+=m):(N[J]=1,S[J]=1),ae>=O.length-1||ae<I.length-1&&I[ae+1].match?Jt=1:m&&($+=m),$-=s.length-2,!J||$+y.length<=u)F[J]=y;else{_e=V=Z=N[J]=0;break}Jt&&(N[J+1]=1,S[J+1]=1)}$+=y.length,_e=C[ae]=1}if(_e)X===K?K++:X++;else{if(X===K?V=0:Z=0,!V&&!Z)break;V?(X++,K=X):K++}}y="";for(let J=0,ae;J<F.length;J++)ae=(N[J]?J?" ":"":(J&&!i?" ":"")+i)+F[J],y+=ae;i&&!N[F.length]&&(y+=i)}c&&(y=y.replace(c," ")),ft[ve].highlight=y}if(n)break}return e}function oe(t,e){if(!this||this.constructor!==oe)return new oe(t,e);let r=0,n,i,s,o,a,u;if(t&&t.index){let l=t;if(e=l.index,r=l.boost||0,i=l.query){s=l.field||l.pluck,o=l.highlight;let c=l.resolve;t=l.async||l.queue,l.resolve=!1,l.index=null,t=t?e.searchAsync(l):e.search(l),l.resolve=c,l.index=e,t=t.result||t}else t=[]}if(t&&t.then){let l=this;t=t.then(function(c){l.C[0]=l.result=c.result||c,ki(l)}),n=[t],t=[],a=new Promise(function(c){u=c})}this.index=e||null,this.result=t||[],this.h=r,this.C=n||[],this.await=a||null,this.return=u||null,this.highlight=o||null,this.query=i||"",this.field=s||""}H=oe.prototype;H.limit=function(t){if(this.await){let e=this;this.C.push(function(){return e.limit(t).result})}else if(this.result.length){let e=[];for(let r=0,n;r<this.result.length;r++)if(n=this.result[r])if(n.length<=t){if(e[r]=n,t-=n.length,!t)break}else{e[r]=n.slice(0,t);break}this.result=e}return this};H.offset=function(t){if(this.await){let e=this;this.C.push(function(){return e.offset(t).result})}else if(this.result.length){let e=[];for(let r=0,n;r<this.result.length;r++)(n=this.result[r])&&(n.length<=t?t-=n.length:(e[r]=n.slice(t),t=0));this.result=e}return this};H.boost=function(t){if(this.await){let e=this;this.C.push(function(){return e.boost(t).result})}else this.h+=t;return this};function ki(t,e){let r=t.result;var n=t.await;t.await=null;for(let i=0,s;i<t.C.length;i++)if(s=t.C[i]){if(typeof s=="function")r=s(),t.C[i]=r=r.result||r,i--;else if(s.h)r=s.h(),t.C[i]=r=r.result||r,i--;else if(s.then)return t.await=n}return n=t.return,t.C=[],t.return=null,e||n(r),r}H.resolve=function(t,e,r,n,i){let s=this.await?ki(this,!0):this.result;if(s.then){let o=this;return s.then(function(){return o.resolve(t,e,r,n,i)})}return s.length&&(typeof t=="object"?(n=t.highlight||this.highlight,r=!!n||t.enrich,e=t.offset,t=t.limit):(n=n||this.highlight,r=!!n||r),s=i?r?zt.call(this.index,s):s:Oi.call(this.index,s,t||100,e,r)),this.finalize(s,n)};H.finalize=function(t,e){if(t.then){let n=this;return t.then(function(i){return n.finalize(i,e)})}e&&t.length&&this.query&&(t=rn(this.query,t,this.index.index,this.field,e));let r=this.return;return this.highlight=this.index=this.result=this.C=this.await=this.return=null,this.query=this.field="",r&&r(t),t};function nn(t,e,r,n,i,s,o){let a=t.length,u=[],l,c;l=le();for(let p=0,m,g,f,d;p<e;p++)for(let y=0;y<a;y++)if(f=t[y],p<f.length&&(m=f[p]))for(let O=0;O<m.length;O++){if(g=m[O],(c=l[g])?l[g]++:(c=0,l[g]=1),d=u[c]||(u[c]=[]),!o){let I=p+(y||!i?0:s||0);d=d[I]||(d[I]=[])}if(d.push(g),o&&r&&c===a-1&&d.length-n===r)return n?d.slice(n):d}if(t=u.length)if(i)u=u.length>1?To(u,r,n,o,s):(u=u[0])&&r&&u.length>r||n?u.slice(n,r+n):u;else{if(t<a)return[];if(u=u[t-1],r||n)if(o)(u.length>r||n)&&(u=u.slice(n,r+n));else{i=[];for(let p=0,m;p<u.length;p++)if(m=u[p]){if(n&&m.length>n)n-=m.length;else if((r&&m.length>r||n)&&(m=m.slice(n,r+n),r-=m.length,n&&(n-=m.length)),i.push(m),!r)break}u=i}}return u}function To(t,e,r,n,i){let s=[],o=le(),a;var u=t.length;let l;if(n){for(i=u-1;i>=0;i--)if(l=(n=t[i])&&n.length){for(u=0;u<l;u++)if(a=n[u],!o[a]){if(o[a]=1,r)r--;else if(s.push(a),s.length===e)return s}}}else for(let c=u-1,p,m=0;c>=0;c--){p=t[c];for(let g=0;g<p.length;g++)if(l=(n=p[g])&&n.length){for(let f=0;f<l;f++)if(a=n[f],!o[a])if(o[a]=1,r)r--;else{let d=(g+(c<u-1&&i||0))/(c+1)|0;if((s[d]||(s[d]=[])).push(a),++m===e)return s}}}return s}function tc(t,e,r,n,i){let s=le(),o=[];for(let a=0,u;a<e.length;a++){u=e[a];for(let l=0;l<u.length;l++)s[u[l]]=1}if(i){for(let a=0,u;a<t.length;a++)if(u=t[a],s[u]){if(n)n--;else if(o.push(u),s[u]=0,r&&--r===0)break}}else for(let a=0,u,l;a<t.result.length;a++)for(u=t.result[a],e=0;e<u.length;e++)l=u[e],s[l]&&((o[a]||(o[a]=[])).push(l),s[l]=0);return o}le();vt.prototype.search=function(t,e,r,n){r||(!e&&_r(t)?(r=t,t=""):_r(e)&&(r=e,e=0));let i=[];var s=[];let o,a,u,l,c,p,m=0,g=!0,f;if(r){r.constructor===Array&&(r={index:r}),t=r.query||t,o=r.pluck,a=r.merge,l=r.boost,p=o||r.field||(p=r.index)&&(p.index?null:p);var d=this.tag&&r.tag;u=r.suggest,g=r.resolve!==!1,c=r.cache,f=g&&this.store&&r.highlight;var y=!!f||g&&this.store&&r.enrich;e=r.limit||e;var O=r.offset||0;if(e||(e=g?100:0),d&&(!this.db||!n)){d.constructor!==Array&&(d=[d]);var I=[];for(let k=0,D;k<d.length;k++)if(D=d[k],D.field&&D.tag){var C=D.tag;if(C.constructor===Array)for(var F=0;F<C.length;F++)I.push(D.field,C[F]);else I.push(D.field,C)}else{C=Object.keys(D);for(let $=0,X,K;$<C.length;$++)if(X=C[$],K=D[X],K.constructor===Array)for(F=0;F<K.length;F++)I.push(X,K[F]);else I.push(X,K)}if(d=I,!t){if(s=[],I.length)for(d=0;d<I.length;d+=2){if(this.db){if(n=this.index.get(I[d]),!n)continue;s.push(n=n.db.tag(I[d+1],e,O,y))}else n=rc.call(this,I[d],I[d+1],e,O,y);i.push(g?{field:I[d],tag:I[d+1],result:n}:[n])}if(s.length){let k=this;return Promise.all(s).then(function(D){for(let $=0;$<D.length;$++)g?i[$].result=D[$]:i[$]=D[$];return g?i:new oe(i.length>1?nn(i,1,0,0,u,l):i[0],k)})}return g?i:new oe(i.length>1?nn(i,1,0,0,u,l):i[0],this)}}g||o||!(p=p||this.field)||(Pe(p)?o=p:(p.constructor===Array&&p.length===1&&(p=p[0]),o=p.field||p.index)),p&&p.constructor!==Array&&(p=[p])}p||(p=this.field);let N;I=(this.worker||this.db)&&!n&&[];for(let k=0,D,$,X;k<p.length;k++){if($=p[k],this.db&&this.tag&&!this.B[k])continue;let K;if(Pe($)||(K=$,$=K.field,t=K.query||t,e=Bt(K.limit,e),O=Bt(K.offset,O),u=Bt(K.suggest,u),f=g&&this.store&&Bt(K.highlight,f),y=!!f||g&&this.store&&Bt(K.enrich,y),c=Bt(K.cache,c)),n)D=n[k];else{C=K||r||{},F=C.enrich;var S=this.index.get($);if(d&&(this.db&&(C.tag=d,C.field=p,N=S.db.support_tag_search),!N&&F&&(C.enrich=!1),N||(C.limit=0,C.offset=0)),D=c?S.searchCache(t,d&&!N?0:e,C):S.search(t,d&&!N?0:e,C),d&&!N&&(C.limit=e,C.offset=O),F&&(C.enrich=F),I){I[k]=D;continue}}if(X=(D=D.result||D)&&D.length,d&&X){if(C=[],F=0,this.db&&n){if(!N)for(S=p.length;S<n.length;S++){let V=n[S];if(V&&V.length)F++,C.push(V);else if(!u)return g?i:new oe(i,this)}}else for(let V=0,Z,se;V<d.length;V+=2){if(Z=this.tag.get(d[V]),!Z){if(u)continue;return g?i:new oe(i,this)}if(se=(Z=Z&&Z.get(d[V+1]))&&Z.length)F++,C.push(Z);else if(!u)return g?i:new oe(i,this)}if(F){if(D=tc(D,C,e,O,g),X=D.length,!X&&!u)return g?D:new oe(D,this);F--}}if(X)s[m]=$,i.push(D),m++;else if(p.length===1)return g?i:new oe(i,this)}if(I){if(this.db&&d&&d.length&&!N)for(y=0;y<d.length;y+=2){if(s=this.index.get(d[y]),!s){if(u)continue;return g?i:new oe(i,this)}I.push(s.db.tag(d[y+1],e,O,!1))}let k=this;return Promise.all(I).then(function(D){return r&&(r.resolve=g),D.length&&(D=k.search(t,e,r,D)),D})}if(!m)return g?i:new oe(i,this);if(o&&(!y||!this.store))return i=i[0],g?i:new oe(i,this);for(I=[],O=0;O<s.length;O++){if(d=i[O],y&&d.length&&typeof d[0].doc=="undefined"&&(this.db?I.push(d=this.index.get(this.field[0]).db.enrich(d)):d=zt.call(this,d)),o)return g?f?rn(t,d,this.index,o,f):d:new oe(d,this);i[O]={field:s[O],result:d}}if(y&&this.db&&I.length){let k=this;return Promise.all(I).then(function(D){for(let $=0;$<D.length;$++)i[$].result=D[$];return f&&(i=rn(t,i,k.index,o,f)),a?xo(i):i})}return f&&(i=rn(t,i,this.index,o,f)),a?xo(i):i};function xo(t){let e=[],r=le(),n=le();for(let i=0,s,o,a,u,l,c,p;i<t.length;i++){s=t[i],o=s.field,a=s.result;for(let m=0;m<a.length;m++)l=a[m],typeof l!="object"?l={id:u=l}:u=l.id,(c=r[u])?c.push(o):(l.field=r[u]=[o],e.push(l)),(p=l.highlight)&&(c=n[u],c||(n[u]=c={},l.highlight=c),c[o]=p)}return e}function rc(t,e,r,n,i){return t=this.tag.get(t),t?(t=t.get(e),t?(e=t.length-n,e>0&&((r&&e>r||n)&&(t=t.slice(n,n+r)),i&&(t=zt.call(this,t))),t):[]):[]}function zt(t){if(!this||!this.store)return t;if(this.db)return this.index.get(this.field[0]).db.enrich(t);let e=Array(t.length);for(let r=0,n;r<t.length;r++)n=t[r],e[r]={id:n,doc:this.store.get(n)};return e}function vt(t){if(!this||this.constructor!==vt)return new vt(t);let e=t.document||t.doc||t,r,n;if(this.B=[],this.field=[],this.D=[],this.key=(r=e.key||e.id)&&sn(r,this.D)||"id",(n=t.keystore||0)&&(this.keystore=n),this.fastupdate=!!t.fastupdate,this.reg=!this.fastupdate||t.worker||t.db?n?new Me(n):new Set:n?new De(n):new Map,this.h=(r=e.store||null)&&r&&r!==!0&&[],this.store=r?n?new De(n):new Map:null,this.cache=(r=t.cache||null)&&new St(r),t.cache=!1,this.worker=t.worker||!1,this.priority=t.priority||4,this.index=nc.call(this,t,e),this.tag=null,(r=e.tag)&&(typeof r=="string"&&(r=[r]),r.length)){this.tag=new Map,this.A=[],this.F=[];for(let i=0,s,o;i<r.length;i++){if(s=r[i],o=s.field||s,!o)throw Error("The tag field from the document descriptor is undefined.");s.custom?this.A[i]=s.custom:(this.A[i]=sn(o,this.D),s.filter&&(typeof this.A[i]=="string"&&(this.A[i]=new String(this.A[i])),this.A[i].G=s.filter)),this.F[i]=o,this.tag.set(o,new Map)}}if(this.worker){this.fastupdate=!1,t=[];for(let i of this.index.values())i.then&&t.push(i);if(t.length){let i=this;return Promise.all(t).then(function(s){let o=0;for(let a of i.index.entries()){let u=a[0],l=a[1];l.then&&(l=s[o],i.index.set(u,l),o++)}return i})}}else t.db&&(this.fastupdate=!1,this.mount(t.db))}H=vt.prototype;H.mount=function(t){let e=this.field;if(this.tag)for(let s=0,o;s<this.F.length;s++){o=this.F[s];var r=void 0;this.index.set(o,r=new Ne({},this.reg)),e===this.field&&(e=e.slice(0)),e.push(o),r.tag=this.tag.get(o)}r=[];let n={db:t.db,type:t.type,fastupdate:t.fastupdate};for(let s=0,o,a;s<e.length;s++){n.field=a=e[s],o=this.index.get(a);let u=new t.constructor(t.id,n);u.id=t.id,r[s]=u.mount(o),o.document=!0,s?o.bypass=!0:o.store=this.store}let i=this;return this.db=Promise.all(r).then(function(){i.db=!0})};H.commit=function(){return E(this,null,function*(){let t=[];for(let e of this.index.values())t.push(e.commit());yield Promise.all(t),this.reg.clear()})};H.destroy=function(){let t=[];for(let e of this.index.values())t.push(e.destroy());return Promise.all(t)};function nc(t,e){let r=new Map,n=e.index||e.field||e;Pe(n)&&(n=[n]);for(let s=0,o,a;s<n.length;s++){if(o=n[s],Pe(o)||(a=o,o=o.field),a=_r(a)?Object.assign({},t,a):t,this.worker){var i=void 0;i=(i=a.encoder)&&i.encode?i:new $t(typeof i=="string"?Ai[i]:i||{}),i=new bt(a,i),r.set(o,i)}this.worker||r.set(o,new Ne(a,this.reg)),a.custom?this.B[s]=a.custom:(this.B[s]=sn(o,this.D),a.filter&&(typeof this.B[s]=="string"&&(this.B[s]=new String(this.B[s])),this.B[s].G=a.filter)),this.field[s]=o}if(this.h){t=e.store,Pe(t)&&(t=[t]);for(let s=0,o,a;s<t.length;s++)o=t[s],a=o.field||o,o.custom?(this.h[s]=o.custom,o.custom.O=a):(this.h[s]=sn(a,this.D),o.filter&&(typeof this.h[s]=="string"&&(this.h[s]=new String(this.h[s])),this.h[s].G=o.filter))}return r}function sn(t,e){let r=t.split(":"),n=0;for(let i=0;i<r.length;i++)t=r[i],t[t.length-1]==="]"&&(t=t.substring(0,t.length-2))&&(e[n]=!0),t&&(r[n++]=t);return n<r.length&&(r.length=n),n>1?r:r[0]}H.append=function(t,e){return this.add(t,e,!0)};H.update=function(t,e){return this.remove(t).add(t,e)};H.remove=function(t){_r(t)&&(t=br(t,this.key));for(var e of this.index.values())e.remove(t,!0);if(this.reg.has(t)){if(this.tag&&!this.fastupdate)for(let r of this.tag.values())for(let n of r){e=n[0];let i=n[1],s=i.indexOf(t);s>-1&&(i.length>1?i.splice(s,1):r.delete(e))}this.store&&this.store.delete(t),this.reg.delete(t)}return this.cache&&this.cache.remove(t),this};H.clear=function(){let t=[];for(let e of this.index.values()){let r=e.clear();r.then&&t.push(r)}if(this.tag)for(let e of this.tag.values())e.clear();return this.store&&this.store.clear(),this.cache&&this.cache.clear(),t.length?Promise.all(t):this};H.contain=function(t){return this.db?this.index.get(this.field[0]).db.has(t):this.reg.has(t)};H.cleanup=function(){for(let t of this.index.values())t.cleanup();return this};H.get=function(t){return this.db?this.index.get(this.field[0]).db.enrich(t).then(function(e){return e[0]&&e[0].doc||null}):this.store.get(t)||null};H.set=function(t,e){return typeof t=="object"&&(e=t,t=br(e,this.key)),this.store.set(t,e),this};H.searchCache=Ei;H.export=ic;H.import=sc;Ci(vt.prototype);function Ri(t,e=0){let r=[],n=[];e&&(e=25e4/e*5e3|0);for(let i of t.entries())n.push(i),n.length===e&&(r.push(n),n=[]);return n.length&&r.push(n),r}function Ii(t,e){e||(e=new Map);for(let r=0,n;r<t.length;r++)n=t[r],e.set(n[0],n[1]);return e}function Po(t,e=0){let r=[],n=[];e&&(e=25e4/e*1e3|0);for(let i of t.entries())n.push([i[0],Ri(i[1])[0]||[]]),n.length===e&&(r.push(n),n=[]);return n.length&&r.push(n),r}function Do(t,e){e||(e=new Map);for(let r=0,n,i;r<t.length;r++)n=t[r],i=e.get(n[0]),e.set(n[0],Ii(n[1],i));return e}function Mo(t){let e=[],r=[];for(let n of t.keys())r.push(n),r.length===25e4&&(e.push(r),r=[]);return r.length&&e.push(r),e}function No(t,e){e||(e=new Set);for(let r=0;r<t.length;r++)e.add(t[r]);return e}function on(t,e,r,n,i,s,o=0){let a=n&&n.constructor===Array;var u=a?n.shift():n;if(!u)return this.export(t,e,i,s+1);if((u=t((e?e+".":"")+(o+1)+"."+r,JSON.stringify(u)))&&u.then){let l=this;return u.then(function(){return on.call(l,t,e,r,a?n:null,i,s,o+1)})}return on.call(this,t,e,r,a?n:null,i,s,o+1)}function ic(t,e,r=0,n=0){if(r<this.field.length){let o=this.field[r];if((e=this.index.get(o).export(t,o,r,n=1))&&e.then){let a=this;return e.then(function(){return a.export(t,o,r+1)})}return this.export(t,o,r+1)}let i,s;switch(n){case 0:i="reg",s=Mo(this.reg),e=null;break;case 1:i="tag",s=this.tag&&Po(this.tag,this.reg.size),e=null;break;case 2:i="doc",s=this.store&&Ri(this.store),e=null;break;default:return}return on.call(this,t,e,i,s||null,r,n)}function sc(t,e){var r=t.split(".");r[r.length-1]==="json"&&r.pop();let n=r.length>2?r[0]:"";if(r=r.length>2?r[2]:r[1],this.worker&&n)return this.index.get(n).import(t);if(e){if(typeof e=="string"&&(e=JSON.parse(e)),n)return this.index.get(n).import(r,e);switch(r){case"reg":this.fastupdate=!1,this.reg=No(e,this.reg);for(let i=0,s;i<this.field.length;i++)s=this.index.get(this.field[i]),s.fastupdate=!1,s.reg=this.reg;if(this.worker){e=[];for(let i of this.index.values())e.push(i.import(t));return Promise.all(e)}break;case"tag":this.tag=Do(e,this.tag);break;case"doc":this.store=Ii(e,this.store)}}}function Eo(t,e){let r="";for(let n of t.entries()){t=n[0];let i=n[1],s="";for(let o=0,a;o<i.length;o++){a=i[o]||[""];let u="";for(let l=0;l<a.length;l++)u+=(u?",":"")+(e==="string"?'"'+a[l]+'"':a[l]);u="["+u+"]",s+=(s?",":"")+u}s='["'+t+'",['+s+"]]",r+=(r?",":"")+s}return r}Ne.prototype.remove=function(t,e){let r=this.reg.size&&(this.fastupdate?this.reg.get(t):this.reg.has(t));if(r){if(this.fastupdate){for(let n=0,i,s;n<r.length;n++)if((i=r[n])&&(s=i.length))if(i[s-1]===t)i.pop();else{let o=i.indexOf(t);o>=0&&i.splice(o,1)}}else vr(this.map,t),this.depth&&vr(this.ctx,t);e||this.reg.delete(t)}return this.db&&(this.commit_task.push({del:t}),this.M&&Lo(this)),this.cache&&this.cache.remove(t),this};function vr(t,e){let r=0;var n=typeof e=="undefined";if(t.constructor===Array){for(let i=0,s,o,a;i<t.length;i++)if((s=t[i])&&s.length){if(n)return 1;if(o=s.indexOf(e),o>=0){if(s.length>1)return s.splice(o,1),1;if(delete t[i],r)return 1;a=1}else{if(a)return 1;r++}}}else for(let i of t.entries())n=i[0],vr(i[1],e)?r++:t.delete(n);return r}var oc={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};Ne.prototype.add=function(t,e,r,n){if(e&&(t||t===0)){if(!n&&!r&&this.reg.has(t))return this.update(t,e);n=this.depth,e=this.encoder.encode(e,!n);let l=e.length;if(l){let c=le(),p=le(),m=this.resolution;for(let g=0;g<l;g++){let f=e[this.rtl?l-1-g:g];var i=f.length;if(i&&(n||!p[f])){var s=this.score?this.score(e,f,g,null,0):en(m,l,g),o="";switch(this.tokenize){case"tolerant":if(Ve(this,p,f,s,t,r),i>2){for(let d=1,y,O,I,C;d<i-1;d++)y=f.charAt(d),O=f.charAt(d+1),I=f.substring(0,d)+O,C=f.substring(d+2),o=I+y+C,Ve(this,p,o,s,t,r),o=I+C,Ve(this,p,o,s,t,r);Ve(this,p,f.substring(0,f.length-1),s,t,r)}break;case"full":if(i>2){for(let d=0,y;d<i;d++)for(s=i;s>d;s--){o=f.substring(d,s),y=this.rtl?i-1-d:d;var a=this.score?this.score(e,f,g,o,y):en(m,l,g,i,y);Ve(this,p,o,a,t,r)}break}case"bidirectional":case"reverse":if(i>1){for(a=i-1;a>0;a--){o=f[this.rtl?i-1-a:a]+o;var u=this.score?this.score(e,f,g,o,a):en(m,l,g,i,a);Ve(this,p,o,u,t,r)}o=""}case"forward":if(i>1){for(a=0;a<i;a++)o+=f[this.rtl?i-1-a:a],Ve(this,p,o,s,t,r);break}default:if(Ve(this,p,f,s,t,r),n&&l>1&&g<l-1)for(i=this.N,o=f,s=Math.min(n+1,this.rtl?g+1:l-g),a=1;a<s;a++){f=e[this.rtl?l-1-g-a:g+a],u=this.bidirectional&&f>o;let d=this.score?this.score(e,o,g,f,a-1):en(i+(l/2>i?0:1),l,g,s-1,a-1);Ve(this,c,u?o:f,d,t,r,u?f:o)}}}}this.fastupdate||this.reg.add(t)}}return this.db&&(this.commit_task.push(r?{ins:t}:{del:t}),this.M&&Lo(this)),this};function Ve(t,e,r,n,i,s,o){let a,u;if(!(a=e[r])||o&&!a[o]){if(o?(e=a||(e[r]=le()),e[o]=1,u=t.ctx,(a=u.get(o))?u=a:u.set(o,u=t.keystore?new De(t.keystore):new Map)):(u=t.map,e[r]=1),(a=u.get(r))?u=a:u.set(r,u=a=[]),s){for(let l=0,c;l<a.length;l++)if((c=a[l])&&c.includes(i)){if(l<=n)return;c.splice(c.indexOf(i),1),t.fastupdate&&(e=t.reg.get(i))&&e.splice(e.indexOf(c),1);break}}if(u=u[n]||(u[n]=[]),u.push(i),u.length===rt(2,31)-1){if(e=new Wt(u),t.fastupdate)for(let l of t.reg.values())l.includes(u)&&(l[l.indexOf(u)]=e);a[n]=u=e}t.fastupdate&&((n=t.reg.get(i))?n.push(u):t.reg.set(i,[u]))}}function en(t,e,r,n,i){return r&&t>1?e+(n||0)<=t?r+(i||0):(t-1)/(e+(n||0))*(r+(i||0))+1|0:0}Ne.prototype.search=function(t,e,r){if(r||(e||typeof t!="object"?typeof e=="object"&&(r=e,e=0):(r=t,t="")),r&&r.cache)return r.cache=!1,t=this.searchCache(t,e,r),r.cache=!0,t;let n=[],i,s,o,a=0,u,l,c,p,m;r&&(t=r.query||t,e=r.limit||e,a=r.offset||0,s=r.context,o=r.suggest,m=(u=r.resolve)&&r.enrich,c=r.boost,p=r.resolution,l=this.db&&r.tag),typeof u=="undefined"&&(u=this.resolve),s=this.depth&&s!==!1;let g=this.encoder.encode(t,!s);if(i=g.length,e=e||(u?100:0),i===1)return Co.call(this,g[0],"",e,a,u,m,l);if(i===2&&s&&!o)return Co.call(this,g[1],g[0],e,a,u,m,l);let f=le(),d=0,y;if(s&&(y=g[0],d=1),p||p===0||(p=y?this.N:this.resolution),this.db){if(this.db.search&&(r=this.db.search(this,g,e,a,o,u,m,l),r!==!1))return r;let O=this;return(function(){return E(this,null,function*(){for(let I,C;d<i;d++){if((C=g[d])&&!f[C]){if(f[C]=1,I=yield xi(O,C,y,0,0,!1,!1),I=Oo(I,n,o,p)){n=I;break}y&&(o&&I&&n.length||(y=C))}o&&y&&d===i-1&&!n.length&&(p=O.resolution,y="",d=-1,f=le())}return Ao(n,p,e,a,o,c,u)})})()}for(let O,I;d<i;d++){if((I=g[d])&&!f[I]){if(f[I]=1,O=xi(this,I,y,0,0,!1,!1),O=Oo(O,n,o,p)){n=O;break}y&&(o&&O&&n.length||(y=I))}o&&y&&d===i-1&&!n.length&&(p=this.resolution,y="",d=-1,f=le())}return Ao(n,p,e,a,o,c,u)};function Ao(t,e,r,n,i,s,o){let a=t.length,u=t;if(a>1)u=nn(t,e,r,n,i,s,o);else if(a===1)return o?Oi.call(null,t[0],r,n):new oe(t[0],this);return o?u:new oe(u,this)}function Co(t,e,r,n,i,s,o){return t=xi(this,t,e,r,n,i,s,o),this.db?t.then(function(a){return i?a||[]:new oe(a,this)}):t&&t.length?i?Oi.call(this,t,r,n):new oe(t,this):i?[]:new oe([],this)}function Oo(t,e,r,n){let i=[];if(t&&t.length){if(t.length<=n){e.push(t);return}for(let s=0,o;s<n;s++)(o=t[s])&&(i[s]=o);if(i.length){e.push(i);return}}if(!r)return i}function xi(t,e,r,n,i,s,o,a){let u;return r&&(u=t.bidirectional&&e>r)&&(u=r,r=e,e=u),t.db?t.db.get(e,r,n,i,s,o,a):(t=r?(t=t.ctx.get(r))&&t.get(e):t.map.get(e),t)}function Ne(t,e){if(!this||this.constructor!==Ne)return new Ne(t);if(t){var r=Pe(t)?t:t.preset;r&&(t=Object.assign({},oc[r],t))}else t={};r=t.context;let n=r===!0?{depth:1}:r||{},i=Pe(t.encoder)?Ai[t.encoder]:t.encode||t.encoder||{};this.encoder=i.encode?i:typeof i=="object"?new $t(i):{encode:i},this.resolution=t.resolution||9,this.tokenize=r=(r=t.tokenize)&&r!=="default"&&r!=="exact"&&r||"strict",this.depth=r==="strict"&&n.depth||0,this.bidirectional=n.bidirectional!==!1,this.fastupdate=!!t.fastupdate,this.score=t.score||null,(r=t.keystore||0)&&(this.keystore=r),this.map=r?new De(r):new Map,this.ctx=r?new De(r):new Map,this.reg=e||(this.fastupdate?r?new De(r):new Map:r?new Me(r):new Set),this.N=n.resolution||3,this.rtl=i.rtl||t.rtl||!1,this.cache=(r=t.cache||null)&&new St(r),this.resolve=t.resolve!==!1,(r=t.db)&&(this.db=this.mount(r)),this.M=t.commit!==!1,this.commit_task=[],this.commit_timer=null,this.priority=t.priority||4}H=Ne.prototype;H.mount=function(t){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),t.mount(this)};H.commit=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.commit(this)};H.destroy=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.destroy()};function Lo(t){t.commit_timer||(t.commit_timer=setTimeout(function(){t.commit_timer=null,t.db.commit(t)},1))}H.clear=function(){return this.map.clear(),this.ctx.clear(),this.reg.clear(),this.cache&&this.cache.clear(),this.db?(this.commit_timer&&clearTimeout(this.commit_timer),this.commit_timer=null,this.commit_task=[],this.db.clear()):this};H.append=function(t,e){return this.add(t,e,!0)};H.contain=function(t){return this.db?this.db.has(t):this.reg.has(t)};H.update=function(t,e){let r=this,n=this.remove(t);return n&&n.then?n.then(()=>r.add(t,e)):this.add(t,e)};H.cleanup=function(){return this.fastupdate?(vr(this.map),this.depth&&vr(this.ctx),this):this};H.searchCache=Ei;H.export=function(t,e,r=0,n=0){let i,s;switch(n){case 0:i="reg",s=Mo(this.reg);break;case 1:i="cfg",s=null;break;case 2:i="map",s=Ri(this.map,this.reg.size);break;case 3:i="ctx",s=Po(this.ctx,this.reg.size);break;default:return}return on.call(this,t,e,i,s,r,n)};H.import=function(t,e){if(e)switch(typeof e=="string"&&(e=JSON.parse(e)),t=t.split("."),t[t.length-1]==="json"&&t.pop(),t.length===3&&t.shift(),t=t.length>1?t[1]:t[0],t){case"reg":this.fastupdate=!1,this.reg=No(e,this.reg);break;case"map":this.map=Ii(e,this.map);break;case"ctx":this.ctx=Do(e,this.ctx)}};H.serialize=function(t=!0){let e="",r="",n="";if(this.reg.size){let s;for(var i of this.reg.keys())s||(s=typeof i),e+=(e?",":"")+(s==="string"?'"'+i+'"':i);e="index.reg=new Set(["+e+"]);",r=Eo(this.map,s),r="index.map=new Map(["+r+"]);";for(let o of this.ctx.entries()){i=o[0];let a=Eo(o[1],s);a="new Map(["+a+"])",a='["'+i+'",'+a+"]",n+=(n?",":"")+a}n="index.ctx=new Map(["+n+"]);"}return t?"function inject(index){"+e+r+n+"}":e+r+n};Ci(Ne.prototype);var Fo=typeof window!="undefined"&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),an=["map","ctx","tag","reg","cfg"],yt=le();function un(t,e={}){if(!this||this.constructor!==un)return new un(t,e);typeof t=="object"&&(e=t,t=t.name),t||console.info("Default storage space was used, because a name was not passed."),this.id="flexsearch"+(t?":"+t.toLowerCase().replace(/[^a-z0-9_\-]/g,""):""),this.field=e.field?e.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"",this.type=e.type,this.fastupdate=this.support_tag_search=!1,this.db=null,this.h={}}H=un.prototype;H.mount=function(t){return t.index?t.mount(this):(t.db=this,this.open())};H.open=function(){if(this.db)return this.db;let t=this;navigator.storage&&navigator.storage.persist&&navigator.storage.persist(),yt[t.id]||(yt[t.id]=[]),yt[t.id].push(t.field);let e=Fo.open(t.id,1);return e.onupgradeneeded=function(){let r=t.db=this.result;for(let n=0,i;n<an.length;n++){i=an[n];for(let s=0,o;s<yt[t.id].length;s++)o=yt[t.id][s],r.objectStoreNames.contains(i+(i!=="reg"&&o?":"+o:""))||r.createObjectStore(i+(i!=="reg"&&o?":"+o:""))}},t.db=ut(e,function(r){t.db=r,t.db.onversionchange=function(){t.close()}})};H.close=function(){this.db&&this.db.close(),this.db=null};H.destroy=function(){let t=Fo.deleteDatabase(this.id);return ut(t)};H.clear=function(){let t=[];for(let r=0,n;r<an.length;r++){n=an[r];for(let i=0,s;i<yt[this.id].length;i++)s=yt[this.id][i],t.push(n+(n!=="reg"&&s?":"+s:""))}let e=this.db.transaction(t,"readwrite");for(let r=0;r<t.length;r++)e.objectStore(t[r]).clear();return ut(e)};H.get=function(t,e,r=0,n=0,i=!0,s=!1){t=this.db.transaction((e?"ctx":"map")+(this.field?":"+this.field:""),"readonly").objectStore((e?"ctx":"map")+(this.field?":"+this.field:"")).get(e?e+":"+t:t);let o=this;return ut(t).then(function(a){let u=[];if(!a||!a.length)return u;if(i){if(!r&&!n&&a.length===1)return a[0];for(let l=0,c;l<a.length;l++)if((c=a[l])&&c.length){if(n>=c.length){n-=c.length;continue}let p=r?n+Math.min(c.length-n,r):c.length;for(let m=n;m<p;m++)u.push(c[m]);if(n=0,u.length===r)break}return s?o.enrich(u):u}return a})};H.tag=function(t,e=0,r=0,n=!1){t=this.db.transaction("tag"+(this.field?":"+this.field:""),"readonly").objectStore("tag"+(this.field?":"+this.field:"")).get(t);let i=this;return ut(t).then(function(s){return!s||!s.length||r>=s.length?[]:!e&&!r?s:(s=s.slice(r,r+e),n?i.enrich(s):s)})};H.enrich=function(t){typeof t!="object"&&(t=[t]);let e=this.db.transaction("reg","readonly").objectStore("reg"),r=[];for(let n=0;n<t.length;n++)r[n]=ut(e.get(t[n]));return Promise.all(r).then(function(n){for(let i=0;i<n.length;i++)n[i]={id:t[i],doc:n[i]?JSON.parse(n[i]):null};return n})};H.has=function(t){return t=this.db.transaction("reg","readonly").objectStore("reg").getKey(t),ut(t).then(function(e){return!!e})};H.search=null;H.info=function(){};H.transaction=function(t,e,r){t+=t!=="reg"&&this.field?":"+this.field:"";let n=this.h[t+":"+e];if(n)return r.call(this,n);let i=this.db.transaction(t,e);this.h[t+":"+e]=n=i.objectStore(t);let s=r.call(this,n);return this.h[t+":"+e]=null,ut(i).finally(function(){return s})};H.commit=function(t){return E(this,null,function*(){let e=t.commit_task,r=[];t.commit_task=[];for(let n=0,i;n<e.length;n++)i=e[n],i.del&&r.push(i.del);r.length&&(yield this.remove(r)),t.reg.size&&(yield this.transaction("map","readwrite",function(n){for(let i of t.map){let s=i[0],o=i[1];o.length&&(n.get(s).onsuccess=function(){let a=this.result;var u;if(a&&a.length){let l=Math.max(a.length,o.length);for(let c=0,p,m;c<l;c++)if((m=o[c])&&m.length){if((p=a[c])&&p.length)for(u=0;u<m.length;u++)p.push(m[u]);else a[c]=m;u=1}}else a=o,u=1;u&&n.put(a,s)})}}),yield this.transaction("ctx","readwrite",function(n){for(let i of t.ctx){let s=i[0],o=i[1];for(let a of o){let u=a[0],l=a[1];l.length&&(n.get(s+":"+u).onsuccess=function(){let c=this.result;var p;if(c&&c.length){let m=Math.max(c.length,l.length);for(let g=0,f,d;g<m;g++)if((d=l[g])&&d.length){if((f=c[g])&&f.length)for(p=0;p<d.length;p++)f.push(d[p]);else c[g]=d;p=1}}else c=l,p=1;p&&n.put(c,s+":"+u)})}}}),t.store?yield this.transaction("reg","readwrite",function(n){for(let i of t.store){let s=i[0],o=i[1];n.put(typeof o=="object"?JSON.stringify(o):1,s)}}):t.bypass||(yield this.transaction("reg","readwrite",function(n){for(let i of t.reg.keys())n.put(1,i)})),t.tag&&(yield this.transaction("tag","readwrite",function(n){for(let i of t.tag){let s=i[0],o=i[1];o.length&&(n.get(s).onsuccess=function(){let a=this.result;a=a&&a.length?a.concat(o):o,n.put(a,s)})}})),t.map.clear(),t.ctx.clear(),t.tag&&t.tag.clear(),t.store&&t.store.clear(),t.document||t.reg.clear())})};function _i(t,e,r){let n=t.value,i,s=0;for(let o=0,a;o<n.length;o++){if(a=r?n:n[o]){for(let u=0,l,c;u<e.length;u++)if(c=e[u],l=a.indexOf(c),l>=0)if(i=1,a.length>1)a.splice(l,1);else{n[o]=[];break}s+=a.length}if(r)break}s?i&&t.update(n):t.delete(),t.continue()}H.remove=function(t){return typeof t!="object"&&(t=[t]),Promise.all([this.transaction("map","readwrite",function(e){e.openCursor().onsuccess=function(){let r=this.result;r&&_i(r,t)}}),this.transaction("ctx","readwrite",function(e){e.openCursor().onsuccess=function(){let r=this.result;r&&_i(r,t)}}),this.transaction("tag","readwrite",function(e){e.openCursor().onsuccess=function(){let r=this.result;r&&_i(r,t,!0)}}),this.transaction("reg","readwrite",function(e){for(let r=0;r<t.length;r++)e.delete(t[r])})])};function ut(t,e){return new Promise((r,n)=>{t.onsuccess=t.oncomplete=function(){e&&e(this.result),e=null,r(this.result)},t.onerror=t.onblocked=n,t=null})}var cn={Index:Ne,Charset:Ai,Encoder:$t,Document:vt,Worker:bt,Resolver:oe,IndexedDB:un,Language:{}};function fn(t){return t.replace(/\\u[\dA-F]{4}/gi,function(e){return String.fromCharCode(parseInt(e.replace(/\\u/g,""),16))})}var xt={},Je=class extends G{_prepare(){xt[this.uri]={index:{},conceptCache:{},schemeCache:{}}}get _index(){return xt[this.uri]&&xt[this.uri].index}get _conceptCache(){return xt[this.uri]&&xt[this.uri].conceptCache}get _schemeCache(){return xt[this.uri]&&xt[this.uri].schemeCache}static _registryConfigForBartocApiConfig({url:e,scheme:r}={}){return!e||!r?null:{schemes:[{uri:e,identifier:P.getAllUris(r).filter(i=>i!==e)}]}}_loadScheme(n){return E(this,null,function*(){var i=n,{scheme:e}=i,r=W(i,["scheme"]);let s=P.getAllUris(e);for(let f of s)if(this._schemeCache[f])return this._schemeCache[f];let o=this.schemes.find(f=>P.compare(f,e));if(!o||!o.uri)throw new Le({message:`Tried to load unsupported scheme (${e&&e.uri})`});let a=o.uri;s=[...new Set(s.concat(P.getAllUris(o)))];let u=".json";a.endsWith("/")&&(u="index.json");let l=yield this.axios(L(R({},r),{url:`${a}${u}`,_skipAdditionalParameters:!0}));if(l.id!==a)throw new Le({message:"Skohub URL did not return expected concept scheme"});let{title:c,preferredNamespaceUri:p,hasTopConcept:m,description:g}=l;e={uri:a,identifier:s.filter(f=>f!==a)},e.prefLabel=c,Object.keys(e.prefLabel||{}).forEach(f=>{e.prefLabel[f]=fn(e.prefLabel[f])}),e.namespace=p,e.topConcepts=(m||[]).map(f=>this._toJskosConcept(f)),e.concepts=[null],g&&(e.definition=g,Object.keys(e.definition).forEach(f=>{e.definition[f]=[fn(e.definition[f])]}));for(let f of Object.keys(e).filter(d=>!e[d]))delete e[f];for(let f of s)this._schemeCache[f]=e;return e})}_loadConcept(n){return E(this,null,function*(){var i=n,{uri:e}=i,r=W(i,["uri"]);if(this._conceptCache[e])return this._conceptCache[e];try{let s=yield this.axios(L(R({},r),{url:`${e}.json`,_skipAdditionalParameters:!0}));if(s.id!==e)throw new Le({message:"Skohub URL did not return expected concept URI"});let o=this._toJskosConcept(s);return this._conceptCache[e]=o,o}catch(s){return null}})}_toJskosConcept(e){let r={uri:e.id};return r.prefLabel=e.prefLabel,Object.keys(r.prefLabel||{}).forEach(n=>{r.prefLabel[n]=fn(r.prefLabel[n])}),r.narrower=(e.narrower||[]).map(n=>this._toJskosConcept(n)),r.notation=e.notation||[],e.broader&&e.broader.id&&(r.broader=[{uri:e.broader.id}]),e.inScheme&&e.inScheme.id&&(r.inScheme=[{uri:e.inScheme.id}]),e.scopeNote&&(r.scopeNote=e.scopeNote,Object.keys(r.scopeNote).forEach(n=>{r.scopeNote[n]=[fn(r.scopeNote[n])]})),r}getSchemes(){return E(this,arguments,function*(r={}){var e=W(r,[]);return Promise.all(this.schemes.map(n=>this._loadScheme(L(R({},e),{scheme:n}))))})}getTop(n){return E(this,null,function*(){var i=n,{scheme:e}=i,r=W(i,["scheme"]);if(!e||!e.uri)throw new U({parameter:"scheme",message:"Missing scheme URI"});return e=yield this._loadScheme(R({scheme:e},r)),e.topConcepts||[]})}getConcepts(n){return E(this,null,function*(){var i=n,{concepts:e}=i,r=W(i,["concepts"]);return Array.isArray(e)||(e=[e]),(yield Promise.all(e.map(({uri:s})=>this._loadConcept(L(R({},r),{uri:s}))))).filter(Boolean)})}getAncestors(n){return E(this,null,function*(){var i=n,{concept:e}=i,r=W(i,["concept"]);if(!e||!e.uri)throw new U({parameter:"concept"});if(e.ancestors&&e.ancestors[0]!==null)return e.ancestors;if(e=yield this._loadConcept(L(R({},r),{uri:e.uri})),!e||!e.broader||!e.broader.length)return[];let s=e.broader[0];return[s].concat(yield this.getAncestors(R({concept:s},r))).map(o=>({uri:o.uri}))})}getNarrower(n){return E(this,null,function*(){var i=n,{concept:e}=i,r=W(i,["concept"]);if(!e||!e.uri)throw new U({parameter:"concept"});return e.narrower&&e.narrower[0]!==null||(e=yield this._loadConcept(L(R({},r),{uri:e.uri}))),e.narrower})}search(i){return E(this,arguments,function*({search:e,scheme:r,limit:n=100}){if(r=yield this._loadScheme({scheme:r}),!r||!r.uri)throw new U({parameter:"scheme"});if(!e)throw new U({parameter:"search"});let s;this._index[r.uri]||(this._index[r.uri]={});for(let u of[""].concat(this.languages)){if(this._index[r.uri][u]){s=this._index[r.uri][u];break}if(this._index[r.uri][u]!==null)try{let l=u?`.${u}.index`:".index";r.uri.endsWith("/")&&(l=`index${l}`);let c=yield this.axios({url:`${r.uri}${l}`,_skipAdditionalParameters:!0});if(c.length<100){this._index[r.uri][u]=null;continue}s=cn.create(),s.import(c),this._index[r.uri][u]=s;break}catch(l){this._index[r.uri][u]=null}}if(!s)throw new Le({message:"Could not find search index for any of the available languages "+this.languages.join(",")});let o=s.search(e);return(yield this.getConcepts({concepts:o.map(u=>({uri:u}))})).slice(0,n)})}suggest(e){return E(this,null,function*(){e._raw=!0;let r=yield this.search(e),n=[e.search,[],[],[]];for(let i of r){let s=P.notation(i),o=P.prefLabel(i);n[1].push((s?s+" ":"")+o),n[2].push(""),n[3].push(i.uri)}return r._totalCount!=null?n._totalCount=r._totalCount:n._totalCount=r.length,n})}};ee(Je,"supports",{schemes:!0,top:!0,data:!0,concepts:!0,narrower:!0,ancestors:!0,suggest:!0,search:!0});Je.providerName="Skohub";Je.providerType="http://bartoc.org/api-type/skohub";var Bo="https://lobid.org/gnd/",Ke={uri:"http://bartoc.org/en/node/430",concepts:[null],topConcepts:[],type:["http://www.w3.org/2004/02/skos/core#ConceptScheme"],DISPLAY:{hideNotation:!0},identifier:["http://www.wikidata.org/entity/Q36578"],license:[{uri:"http://creativecommons.org/publicdomain/zero/1.0/"}],namespace:"https://d-nb.info/gnd/",notation:["GND"],notationPattern:"[0-9X-]+",prefLabel:{de:"Gemeinsame Normdatei",en:"Integrated Authority File"},types:[{uri:"https://d-nb.info/standards/elementset/gnd#DifferentiatedPerson",prefLabel:{de:"Person",en:"Person"}},{uri:"https://d-nb.info/standards/elementset/gnd#PlaceOrGeographicName",prefLabel:{de:"Geografikum",en:"Place"}},{uri:"https://d-nb.info/standards/elementset/gnd#CorporateBody",prefLabel:{de:"Organisation",en:"Organization"}},{uri:"https://d-nb.info/standards/elementset/gnd#SubjectHeading",prefLabel:{de:"Sachbegriff",en:"Subject"}},{uri:"https://d-nb.info/standards/elementset/gnd#Work",prefLabel:{de:"Werk",en:"Work"}},{uri:"https://d-nb.info/standards/elementset/gnd#ConferenceOrEvent",prefLabel:{de:"Konferenz oder Veranstaltung",en:"ConferenceOrEvent"}}]},Di=new P.ConceptScheme({uri:"https://d-nb.info/standards/elementset/gnd",namespace:"https://d-nb.info/standards/elementset/gnd#"});Ke.types.forEach(t=>{t.notation=[Di.notationFromUri(t.uri)]});var ac=new P.ConceptScheme(Ke),Uo=["broaderTerm","broaderTermGeneral","broaderTermGeneric","broaderTermInstantial","broaderTermPartitive"],jo={sameAs:"http://www.w3.org/2004/02/skos/core#exactMatch",exactMatch:"http://www.w3.org/2004/02/skos/core#exactMatch",closeMatch:"http://www.w3.org/2004/02/skos/core#closeMatch",relatedDdcWithDegreeOfDeterminacy1:"http://www.w3.org/2004/02/skos/core#narrowMatch",relatedDdcWithDegreeOfDeterminacy2:"http://www.w3.org/2004/02/skos/core#narrowMatch",relatedDdcWithDegreeOfDeterminacy3:"http://www.w3.org/2004/02/skos/core#closeMatch",relatedDdcWithDegreeOfDeterminacy4:"http://www.w3.org/2004/02/skos/core#exactMatch"},uc=[{uri:"http://bartoc.org/en/node/241",uriPattern:"http://dewey.info/class/(.+)/"},{uri:"http://bartoc.org/en/node/18",namespace:"https://data.bnf.fr/ark:/12148/"},{uri:"http://bartoc.org/en/node/20450",namespace:"https://datos.bne.es/resource/"},{uri:"http://bartoc.org/en/node/1940",namespace:"http://www.wikidata.org/entity/"},{uri:"http://bartoc.org/en/node/294",namespace:"http://lod.gesis.org/thesoz/"},{uri:"http://bartoc.org/en/node/20425",namespace:"http://uri.gbv.de/terminology/tpro/"},{uri:"http://bartoc.org/en/node/2053",namespace:"http://viaf.org/viaf/"},{uri:"http://bartoc.org/en/node/305",uriPattern:"http?://aims.fao.org/aos/agrovoc/(.+)"},{uri:"http://bartoc.org/en/node/391",uriPattern:"http?://id.nlm.nih.gov/mesh/(.+)"},{uri:"http://bartoc.org/en/node/313",uriPattern:"http?://zbw.eu/stw/descriptor/(.+)"},{uri:"http://bartoc.org/en/node/443",uriPattern:"https?://purl.org/bncf/tid/(.+)"},{uri:"http://bartoc.org/en/node/454",uriPattern:"http?://id.loc.gov/authorities/subjects/(.+)"},{uri:"http://bartoc.org/en/node/18536",uriPattern:"http?://id.loc.gov/authorities/names/(.+)"}].map(t=>new P.ConceptScheme(t));function Ti(t){var n,i;let e={uri:t.id,notation:[t.gndIdentifier],prefLabel:{de:t.preferredName},inScheme:[{uri:Ke.uri}]};t.variantName&&(e.altLabel={de:t.variantName}),(n=t.usingInstructions)!=null&&n.length&&(e.scopeNote={de:t.usingInstructions}),e.type=t.type.map(s=>Di.uriFromNotation(s)).filter(Boolean),e.broader=[],Uo.forEach(s=>{e.broader=e.broader.concat(t[s]||[])}),e.broader=e.broader.map(s=>({uri:s.id})),e.uri&&(e.identifier=[e.uri.replace("https://","http://")]);let r=[];for(let s of Object.keys(jo)){let o=jo[s];(i=t[s])!=null&&i.length&&(r=r.concat(t[s].map(a=>{let u=uc.find(c=>c.notationFromUri(a.id)),l=u==null?void 0:u.conceptFromUri(a.id);return!u||!l?null:(u.uri==="http://bartoc.org/en/node/241"&&(l.uri+="e23/"),{from:{memberSet:[{uri:e.uri,notation:e.notation}]},fromScheme:{uri:Ke.uri},to:{memberSet:[l]},toScheme:{uri:u.uri},type:[o]})}).filter(Boolean)))}return r.length&&(e.mappings=r),e}function Pi(t){return t&&t.startsWith("http://")?t.replace("http://","https://"):t}var Ye=class extends G{_setup(){this._api.api||(this._api.api=Bo)}static _registryConfigForBartocApiConfig({url:e,scheme:r}={}){return!e||!r||!P.compare(r,Ke)||e!=="https://lobid.org/gnd/api"?null:{api:Bo,schemes:[Ke]}}getSchemes(){return E(this,null,function*(){return[Ke]})}getTop(){return E(this,null,function*(){return[]})}getConcepts(r){return E(this,arguments,function*({concepts:e}){if(!e)throw new i.InvalidOrMissingParameterError({parameter:"concepts"});Array.isArray(e)||(e=[e]);let n=e.map(o=>{var a,u;return(a=o==null?void 0:o.notation)!=null&&a[0]?(u=o==null?void 0:o.notation)==null?void 0:u[0]:ac.notationFromUri(Pi(o==null?void 0:o.uri))}).filter(Boolean),i=[],s=yield Promise.all(n.map(o=>E(this,null,function*(){try{let a=yield pe.get(`${this._api.api}${o}.json`);return Ti(a.data)}catch(a){i.push(a)}})));if(i.length===e.length)throw i[0];return s.filter(Boolean)})}getNarrower(i){return E(this,arguments,function*({concept:e,limit:r=200,offset:n=0}){if(!e||!e.uri)throw new U({parameter:"concept"});let s=Pi(e.uri),o=Uo.map(u=>`${u}.id:"${s}"`).join(" OR ");return(yield pe.get(`${this._api.api}search`,{params:{q:o,format:"json",size:r,from:n}})).data.member.map(u=>Ti(u))})}suggest(e){return E(this,null,function*(){let r=yield this._search(L(R({},e),{format:"json:suggest"}));return[e.search,r.map(n=>n.label),[],r.map(n=>n.id)]})}search(e){return E(this,null,function*(){return(yield this._search(e)).member.map(n=>Ti(n))})}_search(o){return E(this,arguments,function*({search:e,types:r,limit:n=100,offset:i=0,format:s="json"}){if(!e)throw new U({parameter:"search"});let a="";return r=(r==null?void 0:r.map(l=>Di.notationFromUri(Pi(l))).filter(Boolean))||[],r.length&&(a=r.map(l=>`type:${l}`).join(" OR ")),(yield pe.get(`${this._api.api}search`,{params:{q:e,filter:a,format:s,size:n,from:i}})).data})}getTypes(r){return E(this,arguments,function*({scheme:e}){if(!e||!P.compare(e,Ke))throw new U({parameter:"search",message:e!=null&&e.uri?`scheme ${e==null?void 0:e.uri} not supported`:""});return Ke.types})}};ee(Ye,"supports",{schemes:!0,data:!0,concepts:!0,narrower:!0,suggest:!0,search:!0,types:!0});Ye.providerName="LobidApi";Ye.providerType="http://bartoc.org/api-type/lobid-gnd";var Xe=class extends G{_getApiUrl(e,r){let n=this.uri||"";n.endsWith("/")&&(n=n.slice(0,-1));for(let i of e)if(i)n+="/"+i;else return;if(r){let i=Object.keys(r).map(s=>`${s}=${encodeURIComponent(r[s])}`).join("&");n+=(n.includes("?")?"&":"?")+i}return n}_artefactToJSKOS(e){let r=e.language||this._language||"en",n={};return e.subject&&(n.subject=[e.subject]),e.includedInDataCatalog&&(n.api=[e.includedInDataCatalog]),e["@type"]&&(n["@type"]=e["@type"]),e.type&&(n.type=[e.type]),e.source_name&&(n.notation=[e.source_name]),e.short_form&&(n.notation?n.notation.push(e.short_form):n.notation=[e.short_form]),e.label&&(n.prefLabel={},n.prefLabel[r]=[],n.prefLabel[r].push(e.label)),e.synonyms&&(n.altLabel={},n.altLabel[r]=e.synonyms),e.descriptions&&(n.definition={},n.definition[r]=e.descriptions),e.language&&(n.languages=e.language),e["@id"]&&(n.uri=e["@id"]),e.iri&&(n.iri=e.iri),e.identifier&&(n.identifier=[e.identifier]),e.source&&(n.source=[e.source]),e.source_url&&(n.namespace=e.source_url),e.landingPage&&(n.url=e.landingPage),e.version&&(n.version=e.version),e.modified&&(n.modified=e.modified),e.created&&(n.created=e.created),e.hasFormat&&(n.format=e.hasFormat),e.license&&(n.license=[e.license]),e.creator&&(n.creator=e.creator),e.contributor&&(n.contributor={},n.contributor.prefLabel={},n.contributor.prefLabel[r]=e.contributor),e.publisher&&(n.publisher={},n.publisher[r]=e.publisher),e.released&&(n.issued=e.released),e.children&&(n.narrower={},n.narrower[r]=e.children),n}_request(e,...r){return E(this,null,function*(){if(!e)return;let n=yield this.axios(R({method:"get",url:e,headers:{"Content-Type":"application/json",Accept:"application/json"}},r));if(!(n!=null&&n._url)||Object.keys(n).length!=1)return n})}_getSchemesMod(){return E(this,null,function*(){let e=this._getApiUrl(["artefacts"],null);return yield this._request(e)})}_getSchemesModLimit(e){return E(this,null,function*(){let r=yield this._getSchemesMod();return e&&e>0?r.slice(0,e):r})}_getSchemeMod(e){return E(this,null,function*(){if(e.short)return yield this._getSchemeFromShort(e.short);if(e.uri)return yield this._getSchemeFromUri(e.uri)})}_getSchemeFromShort(e){return E(this,null,function*(){let r=this._getApiUrl(["artefacts",e],null);return yield this._request(r)})}_getSchemeFromUri(e){return E(this,null,function*(){let r=yield this._getSchemesMod();if(r){for(let n of yield r)if(n.source==e||n.source_url==e||n.source_name==e||n["@id"]==e||n.iri==e||n.includedInDataCatalog&&n.includedInDataCatalog.includes(e))return yield n}})}_getConceptsMod(e){return E(this,null,function*(){let r=yield this._schemeShortFromObj(e);if(!r)return[];let n=this._getApiUrl(["artefacts",r,"resources","concepts"],null),i=yield this._request(n);if(!i)return[];let{page:s,totalPages:o,member:a}=i,u=[];for(let l of a)l&&u.push(l);for(let l=s+1;l<=o;l++){let c=this._getApiUrl(["artefacts",r,"resources","concepts"],{page:l}),p=yield this._request(c);if(!p)break;let{member:m}=p;for(let g of m)g&&u.push(g)}return u})}_getConceptsModLimit(e,r){return E(this,null,function*(){let n=yield this._getConceptsMod(e);return r&&r>0?n.slice(0,r):n})}_getConceptMod(e){return E(this,null,function*(){let{conceptNotation:r,schemeShort:n}=yield this._conceptNotationFromObj(e),i=this._getApiUrl(["artefacts",n,"resources","concepts",r],null);return yield this._request(i)})}_containsString(e,r){for(let n in e){let i=e[n];if(typeof i=="string"&&i.includes(r)||typeof i=="object"&&i!==null&&this.containsString(i,r))return!0}return!1}_getSchemesContaining(e){return E(this,null,function*(){let r=[],n=yield this._getSchemesMod();for(let i of n)this.containsString(i,e)&&r.push(i);return r})}_getSchemeShort(e){return E(this,null,function*(){let r=yield this._getSchemeFromUri(e);if(r)return yield r.short_form.toLowerCase()})}_getconceptNotation(e){return e.split("/").pop()}_schemeShortFromObj(e){return E(this,null,function*(){if(e.short)return e.short;if(e.uri)return yield this._getSchemeShort(e.uri)})}_conceptNotationFromObj(e){return E(this,null,function*(){if(!e.inScheme||!e.inScheme[0])return;let r=yield this._schemeShortFromObj(e.inScheme[0]),n=e.notation;return n||(n=yield this._getconceptNotation(e.uri)),{conceptNotation:n,schemeShort:r}})}_prepare(){}_setup(){}getSchemes(i){return E(this,null,function*(){var s=i,{schemes:e,limit:r}=s,n=W(s,["schemes","limit"]);let o=[],a=[];if(e)for(let u of e){let l=yield this._getSchemeMod(u);l&&a.push(l)}else a=yield this._getSchemesModLimit(r);for(let u of a){let l=yield this._artefactToJSKOS(u);l?o.push(l):console.warn("JSKOS transformation failed for artefact: ",u)}return o})}getConcepts(s){return E(this,null,function*(){var o=s,{concepts:e,scheme:r,limit:n}=o,i=W(o,["concepts","scheme","limit"]);let a=[];if(e)for(let u of e){let l=yield this._getConceptMod(u);if(l){let c=yield this._artefactToJSKOS(l);c?a.push(c):console.warn("JSKOS transformation failed for concept: ",l)}}else if(r){let u=yield this._getConceptsModLimit(r,n);for(let l of u){let c=yield this._artefactToJSKOS(l);c?a.push(c):console.warn("JSKOS transformation failed for concept: ",l)}}return a})}get _language(){return this._jskos.language||this.languages[0]||this._defaultLanguages[0]||"en"}getMappings(){return[]}};ee(Xe,"providerName","ModApi"),ee(Xe,"providerType","http://bartoc.org/en/node/20333"),ee(Xe,"supports",{schemes:!0,top:!1,data:!1,concepts:!0,narrower:!1,ancestors:!1,types:!1,suggest:!1,search:!1,auth:!1,mappings:!1,concordances:!1,annotations:!1,occurrences:!1});var Ge=class extends G{constructor(e){super(e),this.endpoint=e.endpoint||e.uri}static _registryConfigForBartocApiConfig({url:e}={}){if(e)return{endpoint:e}}_getApiUrl(e,r={}){let n=this.endpoint+e.join("/");return r=Object.fromEntries(Object.entries(r).filter(([i,s])=>s!=null)),r=new URLSearchParams(r),r.size?`${n}?${r}`:n}_ontologyToJSKOS(e){var i;let r=e.lang||this._language||"en",n={};return e.iri&&(n.uri=e.iri),n.type=["http://www.w3.org/2004/02/skos/core#ConceptScheme"],e["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"]&&(n.type=n.type.concat(e["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"])),e.title&&(n.prefLabel={},n.prefLabel[r]=e.title),e.description&&(n.definition={},n.definition[r]=[e.description]),e.homepage&&(n.url=e.homepage),e.tracker&&(n.issueTracker=[{url:e.tracker}]),e.language&&(n.languages=e.language),e.ontologyId&&(n.VOCID=e.ontologyId,n.notation=[e.ontologyId]),(i=e.license)!=null&&i.url&&(n.license=[{uri:e.license.url}]),n}_termToJSKOS(e){let r=e.language||this._language||"en",n={};return e.curie&&(n.notation=[e.curie]),e.hasDirectChildren?n.narrower=[null]:n.narrower=[],e.hasDirectParents?n.broader=[null]:n.broader=[],e.iri&&(n.uri=e.iri),e["http://www.w3.org/2000/01/rdf-schema#label"]&&(n.prefLabel={},n.prefLabel[r]=e["http://www.w3.org/2000/01/rdf-schema#label"].value||e["http://www.w3.org/2000/01/rdf-schema#label"]),n.type=["http://www.w3.org/2004/02/skos/core#Concept","http://www.w3.org/2002/07/owl#Class"],e.ontologyIri&&(n.inScheme=[{uri:e.ontologyIri}]),n}_request(n){return E(this,arguments,function*(e,r={_skipAdditionalParameters:!0}){if(e){e=new URL(e);let i=Object.fromEntries(e.searchParams.entries());return this.axios(R({method:"get",url:e.origin+e.pathname,params:R(R({},i),r.params)},r))}})}_paginate(e,r,n){return E(this,null,function*(){let i=n>0?n:null,s=this._getApiUrl(e,L(R({},r),{size:i})),o=yield this._request(s),a=(o==null?void 0:o.elements)||[];if(!i){let u=(o==null?void 0:o.totalPages)||0;for(let l=1;l<u;l++)s=this._getApiUrl(e,L(R({},r),{page:l})),o=yield this._request(s),a=a.concat((o==null?void 0:o.elements)||[])}return a})}_getConceptOls(e){return E(this,null,function*(){var n,i;let r=yield this._getSchemeVOCID((n=e==null?void 0:e.inScheme)==null?void 0:n[0]);if(r){let s=null;e.notation?s=this._getApiUrl(["ontologies",r,"classes"],{curie:e.notation}):e.uri&&(s=this._getApiUrl(["ontologies",r,"classes"],{iri:e.uri}));let o=yield this._request(s);return((i=o==null?void 0:o.elements)==null?void 0:i[0])||null}})}_searchOls(e,r,n,i){return E(this,null,function*(){let s=[],o={"http://www.w3.org/2002/07/owl#Class":"classes","http://www.w3.org/1999/02/22-rdf-syntax-ns#Property":"properties"};i!=null&&i.length||(i=Object.keys(o));for(let a of i)if(a in o){let u=r?yield this._getSchemeVOCID(r):null,l={search:e,ontology:u};if(!r||u){let c=yield this._paginate([o[a]],l,n);s.push(...c)}}return s})}_conceptIriFromObj(e,r){return E(this,null,function*(){let n=this._getApiUrl(["ontologies",e,"classes"],{curie:r}),i=yield this._request(n);if(i&&i.elements&&i.elements.length>0)return i.elements[0].iri})}get _language(){return this._jskos.language||this.languages[0]||this._defaultLanguages[0]||"en"}_getSchemeVOCID(e){return E(this,null,function*(){return e!=null&&e.VOCID?e.VOCID:this._getScheme(e).then(r=>r==null?void 0:r.ontologyId)})}_getScheme(e){return E(this,null,function*(){if(e){let{VOCID:r,uri:n,notation:i,identifier:s}=e;if(r)return this._request(this._getApiUrl(["ontologies",r]));if(n&&(e=yield this._getSchemeFromUri(n),e)||i!=null&&i[0]&&(n||s!=null&&s.length)&&(e=yield this._request(this._getApiUrl(["ontologies",i[0]])),e.iri===n||s!=null&&s.includes(e.iri)))return e;for(let o of s||[]){let a=yield this._getSchemeFromUri(o);if(a)return a}}})}_getSchemeFromUri(e){return E(this,null,function*(){if(e){let r=this._getApiUrl(["ontologies"],{searchFields:"iri",search:e}),n=yield this._request(r),i=(n==null?void 0:n.elements)||[];return i.reduce((s,o)=>o.ontologyId.length<s.ontologyId.length?o:s,i[0])}return null})}getSchemes(n){return E(this,arguments,function*({schemes:e,limit:r}){let i=[];if(e)i=(yield Promise.all(e.map(s=>this._getScheme(s)))).filter(Boolean);else if(r>0){let s=this._getApiUrl(["ontologies"],{size:r});i=(yield this._request(s)).elements||[]}else i=yield this._paginate(["ontologies"],{});return Promise.all(i.map(s=>this._ontologyToJSKOS(s)))})}getConcepts(i){return E(this,arguments,function*({concepts:e,scheme:r,limit:n}){let s=[];if(e)for(let o of e){let a=yield this._getConceptOls(o);a&&s.push(yield this._termToJSKOS(a))}else if(r){let o=yield this._getSchemeVOCID(r);if(o){let a=yield this._paginate(["ontologies",o,"classes"],{},n);s=Promise.all(a.map(u=>this._termToJSKOS(u)))}}return s})}getTop(r){return E(this,arguments,function*({scheme:e}){let n=yield this._getSchemeVOCID(e);if(n){let i=yield this._paginate(["ontologies",n,"classes"],{hasDirectParents:"false"},null);return Promise.all(i.map(s=>this._termToJSKOS(s)))}return[]})}_splitConcept(e){return E(this,null,function*(){var n;let r={};return e&&(r.VOCID=yield this._getSchemeVOCID((n=e==null?void 0:e.inScheme)==null?void 0:n[0]),r.iri=e.uri||(yield this._conceptIriFromObj(r.VOCID,e.notation)),r.iri=encodeURIComponent(encodeURIComponent(r.iri))),r})}getNarrower(r){return E(this,arguments,function*({concept:e}){let{VOCID:n,iri:i}=yield this._splitConcept(e);if(n&&i){let s=yield this._paginate(["ontologies",n,"classes",i,"children"],{},0);return Promise.all(s.map(o=>this._termToJSKOS(o)))}return[]})}getAncestors(r){return E(this,arguments,function*({concept:e}){let{VOCID:n,iri:i}=yield this._splitConcept(e);if(n&&i){let s=yield this._paginate(["ontologies",n,"classes",i,"ancestors"],{},null);return Promise.all(s.map(o=>this._termToJSKOS(o)))}return[]})}getTypes(){return E(this,null,function*(){return[{uri:"http://www.w3.org/2002/07/owl#Class",prefLabel:{en:"Class",de:"Klasse"}},{uri:"http://www.w3.org/1999/02/22-rdf-syntax-ns#Property",prefLabel:{en:"Property",de:"Eigenschaft"}}]})}search(s){return E(this,arguments,function*({search:e,scheme:r=null,limit:n=0,types:i=["http://www.w3.org/2002/07/owl#Class"]}){let o=yield this._searchOls(e,r,n,i);return Promise.all(o.map(a=>this._termToJSKOS(a)))})}};ee(Ge,"providerName","OlsApi"),ee(Ge,"providerType","http://bartoc.org/api-type/ols"),ee(Ge,"supports",{schemes:!0,top:!0,data:!1,concepts:!0,narrower:!0,ancestors:!0,types:!0,suggest:!0,search:!0});var xe={},Qe=class extends G{_setup(){this._scheme=null}static _registryConfigForBartocApiConfig({url:e,scheme:r}={}){return!e||!r?null:{api:e}}_schemeInfoToJSKOS(e){let r=e.labels.find(s=>s.lang==="x-uri").text,n={};e.labels.filter(s=>!s.lang.startsWith("x-")).forEach(s=>{n[s.lang]=s.text});let i={uri:r,prefLabel:n};return e.categories&&e.categories.length&&(i.topConcepts=[null]),e.category&&e.category.length&&(i.concepts=[null]),i}_categoryToJSKOS(e,{scheme:r,broader:n=[]}){if(!e||!r)return null;let i=e.ID,s=`${r.uri}/${i}`;if(xe[r.uri].concepts[s])return xe[r.uri].concepts[s];let o={};e.labels.filter(u=>!u.lang.startsWith("x-")&&u.text).forEach(u=>{o[u.lang]=u.text.replace(`${i} `,""),xe[r.uri].searchIndex.add(s,o[u.lang])});let a={};return e.labels.filter(u=>!u.lang.startsWith("x-")&&u.description).forEach(u=>{a[u.lang]||(a[u.lang]=[]),a[u.lang].push(u.description)}),xe[r.uri].concepts[s]={uri:s,notation:[i],prefLabel:o,scopeNote:a,inScheme:[{uri:r.uri}],narrower:(e.categories||[]).map(u=>({uri:`${r.uri}/${u.ID}`})),broader:n},xe[r.uri].concepts[s]}_removeNarrower(e){return e&&Object.assign({},e,{narrower:e.narrower&&e.narrower.length?[null]:[]})}_loadSchemeData(e){return E(this,null,function*(){let r=yield this.axios(L(R({},e),{method:"get",url:this._api.api,_skipAdditionalParameters:!0}));this._scheme=this._schemeInfoToJSKOS(r);let n=this._scheme.uri;xe[n]={schemeInfo:r,searchIndex:cn.create({tokenize:"full"}),concepts:{}};let i=(s,{broader:o=[]}={})=>{let a=this._categoryToJSKOS(s,{scheme:this._scheme,broader:o});(s.categories||[]).forEach(u=>i(u,{broader:[{uri:a.uri}]}))};r.categories.forEach(s=>i(s)),xe[n].topConcepts=r.categories.map(s=>this._categoryToJSKOS(s,{scheme:this._scheme}))})}getSchemes(){return E(this,arguments,function*(e={}){if(!this._api.api)throw new Se;return this._scheme||(this._loadSchemeDataPromise||(this._loadSchemeDataPromise=this._loadSchemeData(e)),yield this._loadSchemeDataPromise),[this._scheme]})}getTop(n){return E(this,null,function*(){var i=n,{scheme:e}=i,r=W(i,["scheme"]);if(!e||!e.uri)throw new U({parameter:"scheme",message:"Missing scheme URI"});if(this._scheme||(yield this.getSchemes(r)),!P.compare(e,this._scheme))throw new U({parameter:"scheme",message:"Requested vocabulary seems to be unsupported by this API."});return xe[this._scheme.uri].topConcepts.map(this._removeNarrower)})}getConcepts(n){return E(this,null,function*(){var i=n,{concepts:e}=i,r=W(i,["concepts"]);return Array.isArray(e)||(e=[e]),this._scheme||(yield this.getSchemes(r)),e.map(s=>xe[this._scheme.uri].concepts[s.uri]).map(this._removeNarrower)})}getAncestors(n){return E(this,null,function*(){var i=n,{concept:e}=i,r=W(i,["concept"]);if(!e||!e.uri)throw new U({parameter:"concept"});if(e.ancestors&&e.ancestors[0]!==null)return e.ancestors;this._scheme||(yield this.getSchemes(r)),e=xe[this._scheme.uri].concepts[e.uri];let s=e&&e.broader&&e.broader[0];return s?[s].concat(yield this.getAncestors(R({concept:s},r))):[]})}getNarrower(n){return E(this,null,function*(){var i=n,{concept:e}=i,r=W(i,["concept"]);if(!e||!e.uri)throw new U({parameter:"concept"});return e.narrower&&e.narrower[0]!==null?e.narrower:(this._scheme||(yield this.getSchemes(r)),e=xe[this._scheme.uri].concepts[e.uri],(e&&e.narrower||[]).map(s=>xe[this._scheme.uri].concepts[s.uri]).map(this._removeNarrower))})}search(i){return E(this,arguments,function*({search:e,scheme:r,limit:n=100}){if(!r||!r.uri)throw new U({parameter:"scheme"});if(!e)throw new U({parameter:"search"});if(!r||!r.uri)throw new U({parameter:"scheme",message:"Missing scheme URI"});if(this._scheme||(yield this.getSchemes()),!P.compare(r,this._scheme))throw new U({parameter:"scheme",message:"Requested vocabulary seems to be unsupported by this API."});return(yield xe[this._scheme.uri].searchIndex.search(e)).map(o=>xe[this._scheme.uri].concepts[o]).map(this._removeNarrower).slice(0,n)})}suggest(e){return E(this,null,function*(){e._raw=!0;let r=yield this.search(e),n=[e.search,[],[],[]];for(let i of r){let s=P.notation(i),o=P.prefLabel(i);n[1].push((s?s+" ":"")+o),n[2].push(""),n[3].push(i.uri)}return r._totalCount!=null?n._totalCount=r._totalCount:n._totalCount=r.length,n})}};ee(Qe,"supports",{schemes:!0,top:!0,data:!0,concepts:!0,narrower:!0,ancestors:!0,suggest:!0,search:!0});Qe.providerName="MyCoRe";Qe.providerType="http://bartoc.org/api-type/mycore";var Sr={schemes:[]},Ze=class extends G{static _registryConfigForBartocApiConfig({url:e}={}){return e?{api:e}:null}getSchemes(){return E(this,null,function*(){var e,r;if(!Sr.schemes.length){let n=yield pe.post(this._api.api,{query:"query sources { sources { name uri description alternateName } }",operationName:"sources"}),i=((r=(e=n==null?void 0:n.data)==null?void 0:e.data)==null?void 0:r.sources)||[];if(i.length)Sr.schemes=i.map(s=>{let o={uri:s.uri,prefLabel:{und:s.name}};return s.desciption&&(o.description={und:[s.description]}),s.alternateName&&(o.notation=[s.alternateName]),o});else return[]}return Sr.schemes})}getConcepts(r){return E(this,arguments,function*({concepts:e}){var i,s;if(!e)throw new U({parameter:"concepts"});return Array.isArray(e)||(e=[e]),(((s=(i=(yield pe.post(this._api.api,{query:`query { lookup( uris: [${e.map(o=>`"${o.uri}"`)}], ) { uri source { ... on Source { uri } } result { ... on Term { uri prefLabel scopeNote altLabel broader { uri } narrower { uri } } } } }`})).data)==null?void 0:i.data)==null?void 0:s.lookup)||[]).map(o=>{var u,l,c,p,m,g,f,d,y,O;let a={uri:o.uri,inScheme:[Sr.schemes.find(I=>P.compare(I,{uri:o.source.uri}))]};return(l=(u=o.result)==null?void 0:u.prefLabel)!=null&&l[0]&&(a.prefLabel={und:o.result.prefLabel[0]}),(p=(c=o.result)==null?void 0:c.altLabel)!=null&&p[0]&&(a.altLabel={und:o.result.altLabel}),(g=(m=o.result)==null?void 0:m.scopeNote)!=null&&g[0]&&(a.scopeNote={und:o.result.scopeNote}),(d=(f=o.result)==null?void 0:f.broader)!=null&&d.length&&(a.broader=o.result.broader),(O=(y=o.result)==null?void 0:y.narrower)!=null&&O.length&&(a.narrower=o.result.narrower),a})})}suggest(e){return E(this,null,function*(){let r=e.search,n=yield this.search(e);return[r,n.map(i=>P.prefLabel(i,{fallbackToUri:!1})),[],n.map(i=>i.uri)]})}search(n){return E(this,arguments,function*({scheme:e,search:r}){var s,o,a,u,l;if(!r)throw new U({parameter:"search"});if(!e||!P.isContainedIn(e,Sr.schemes))throw new U({parameter:"scheme"});return(((l=(u=(a=(o=(s=(yield pe.post(this._api.api,{query:`query { terms( sources: ["${e.uri}"] query: "${r}" ) { source { uri } result { ... on Terms { terms { uri prefLabel scopeNote } } } }}`})).data)==null?void 0:s.data)==null?void 0:o.terms)==null?void 0:a[0])==null?void 0:u.result)==null?void 0:l.terms)||[]).map(c=>{var m,g,f;let p={uri:c.uri,inScheme:[e]};return(m=c.prefLabel)!=null&&m[0]&&(p.prefLabel={und:c.prefLabel[0]}),(g=c.altLabel)!=null&&g[0]&&(p.altLabel={und:c.altLabel}),(f=c.scopeNote)!=null&&f[0]&&(p.scopeNote={und:c.scopeNote[0]}),p})})}};ee(Ze,"supports",{schemes:!0,top:!1,data:!0,concepts:!0,narrower:!1,ancestors:!1,suggest:!0,search:!0});Ze.providerName="NoTApi";Ze.providerType="http://bartoc.org/api-type/noterms";var Ce={[G.providerName]:G,init(t){let e=t.provider;if(t.api&&Object.keys(this).find(r=>{if(Ce[r].prototype instanceof G&&t.api===Ce[r].providerType)return t=R({},t),delete t.api,e=r,!0}),this[e])return new this[e](t);throw new Ct},addProvider(t){if(t.prototype instanceof G||t===G)this[t.providerName]=t;else throw new Ct}};Ce.addProvider(Te);Ce.addProvider(Ie);Object.values(Ht).forEach(t=>{Ce.addProvider(t)});var Mi={},qt=class t{constructor(e){this.config=e,this.axios=pe.create()}setConfig(e){this.config=e}get config(){return this._config}set config(e){e=e||{},e.registries=e.registries||[],e.registries=e.registries.map(r=>Ce.init(r)).filter(r=>r),e.registries.forEach(r=>{r.cdk=this}),this._config=e}get providers(){return Ce}createInstance(e){return new t(e)}loadConfig(e){return E(this,null,function*(){let r=yield this.axios.get(e);this.config=r.data})}loadBuildInfo(o){var a=o,{url:e,buildInfo:r=null,interval:n=6e4,callback:i}=a,s=W(a,["url","buildInfo","interval","callback"]);if(!e&&!this.config.cocodaBaseUrl)throw new me({message:"Could not determine URL to load build config."});return e||(e=`${this.config.cocodaBaseUrl}build-info.json`),this.repeat(L(R({},s),{function:()=>E(this,null,function*(){return(yield this.axios.get(e,{headers:{"Cache-Control":"no-cache"}})).data}),interval:n,callback:(u,l,c)=>{u?i(u):(c||!c&&r&&!Re(l,r))&&i(null,l,c||r)}}))}getServiceForUri(e){return this.config.registries.find(r=>r.uri==e)}getRegistryForUri(e){return this.getRegistryForUri(e)}initializeService(e){return e=Ce.init(e),e.cdk=this,e}initializeRegistry(e){return this.initializeService(e)}addProvider(e){Ce.addProvider(e)}static addProvider(e){Ce.addProvider(e)}repeat({function:e,interval:r=15e3,callback:n,callImmediately:i=!0}={}){if(!e)throw new U({parameter:"function"});if(typeof e!="function")throw new U({parameter:"function",message:"function needs to be a function"});let s=()=>E(null,null,function*(){return e()});if(r=parseInt(r),isNaN(r))throw new U({parameter:"interval"});if(!n)throw new U({parameter:"callback"});if(typeof n!="function")throw new U({parameter:"callback",message:"callback needs to be a function"});let o={timer:null,result:null,error:null,isPaused:!1,interval:r},a=m=>{let g=o.result;Re(g,m)||(o.result=m,o.error=null,n(null,m,g))},u=m=>{o.error=m,n(m)},l=m=>{o.isPaused||(o.timer=setTimeout(()=>{m()},o.interval))},c=()=>s().then(a).catch(u).then(()=>l(c)),p=(m=i)=>{m?c():l(c)};return p(),{start:(...m)=>{o.isPaused=!1,p(...m)},stop:()=>{o.isPaused=!0,o.timer?clearTimeout(o.timer):setTimeout(()=>{o.timer&&clearTimeout(o.timer)},o.interval)},get isPaused(){return o.isPaused},get lastResult(){return o.result},get hasErrored(){return!!o.error},get interval(){return o.interval},set interval(m){o.interval=m}}}getSchemes(){return E(this,arguments,function*(e={}){let r=[],n=[];for(let i of this.config.registries)if(i.has.schemes!==!1){let s=i.getSchemes(e).then(o=>{for(let l of o){l._registry=i,l.__DETAILSLOADED__=1,l.type=l.type||["http://www.w3.org/2004/02/skos/core#ConceptScheme"];let c=r.find(f=>P.compare(f,l)),p,m,g=!1;if(c){p=this.config.registries.indexOf(i),p!=-1&&(p=this.config.registries.length-p),m=this.config.registries.indexOf(c==null?void 0:c._registry),m!=-1&&(m=this.config.registries.length-m);let f=l.concepts?l.concepts.length==0?-1:1:0,d=c.concepts?c.concepts.length==0?-1:1:0;f>d?g=!0:f<d?g=!1:g=m<p}if(!c||g){if(g){let f=r.findIndex(I=>P.compare(I,c));f!=-1&&r.splice(f,1);let a=c,{concepts:d,topConcepts:y}=a,O=W(a,["concepts","topConcepts"]);l=P.merge(l,O,{mergeUris:!0,skipPaths:["_registry"]})}l._registry=i,r.push(l)}else{let f=r.findIndex(d=>P.compare(d,l));if(f!=-1){let d=r[f]._registry,u=l,{concepts:y,topConcepts:O}=u,I=W(u,["concepts","topConcepts"]);r[f]=P.merge(r[f],I,{mergeUris:!0,skipPaths:["_registry"]}),r[f]._registry=d}}}}).catch(o=>{console.warn("Couldn't load schemes for registry",i.uri,o)});n.push(s)}return yield Promise.all(n),r.forEach(i=>{let s=i._registry;delete i._registry;let o=this.registryForScheme(i);!o||o._api.api===s._api.api?i._registry=s:i._registry=o}),P.sortSchemes(r.filter(Boolean))})}registryForScheme(e,r="concepts"){var i;let n=e._registry;if(n)return n;for(let s of e.API||[]){let o=s,{type:a}=o,u=W(o,["type"]);let l=u.url,c=`${a}-${l}`;if(Mi[c]){let p=Mi[c];return Array.isArray(p._jskos.schemes)&&!P.isContainedIn(e,p._jskos.schemes)&&p._jskos.schemes.push(e),p}else{u.scheme=e;for(let p of Object.values(Ce)){if((p==null?void 0:p.providerType)!==a||!p._registryConfigForBartocApiConfig||r&&!((i=p==null?void 0:p.supports)!=null&&i[r]))continue;let m=p.providerName,g=Ce[m]._registryConfigForBartocApiConfig(u);if(g){g.provider=m;try{if(n=this.initializeRegistry(g),n)return Mi[c]=n,n}catch(f){continue}}}}}return null}};var zo=new qt;function lc(t){Object.values(Ht).forEach(e=>(t||zo).addProvider(e))}return Wa(cc);})();
16
+ `,i=r+r,s=o=>r+(o==null?"":o.split(r).join(i))+r;return o=>o.map(s).join(e)+n},gt=(t,e)=>{let r=[];for(let n of["from","to"])(e==null||n===e)&&(r=r.concat(te(t,`${n}.memberSet`)||te(t,`${n}.memberChoice`)||te(t,`${n}.memberList`)||[]));return r.filter(n=>n!=null)},Al=(t={})=>{let e=El(t),r=t.language||"en";t.type==null&&(t.type=!0);let n=o=>{o=o||[];let a=[];for(let u of["from","to"]){t.schemes&&a.push(`${u}Scheme`);let l=Math.max(...o.map(c=>gt(c,u).length),1);for(let c=0;c<l;c+=1)a.push(`${u}Notation${c?c+1:""}`),t.labels&&a.push(`${u}Label${c?c+1:""}`)}return t.type&&a.push("type"),t.creator&&a.push("creator"),e(a)},i=(o,a={})=>{let u=[];for(let l of["from","to"]){t.schemes&&u.push(te(o,`${l}Scheme.notation[0]`,""));let c=gt(o,l),p=a[`${l}Count`];p==null&&(p=c.length),p=Math.max(p,1);for(let m=0;m<p;m+=1)u.push(te(c[m],"notation[0]","")),t.labels&&u.push(Ft(c[m],{language:r,fallbackToUri:!1}))}return t.type&&u.push(te(wr(te(o,"type[0]")),"SHORT","")),t.creator&&u.push(Ft(te(o,"creator[0]"),{language:r,fallbackToUri:!1})),e(u)};return{header:n,fromMapping:i,fromMappings:(o,a={header:!0})=>{let u="";a.header&&(u+=n(o));let l={fromCount:Math.max(...o.map(c=>gt(c,"from").length)),toCount:Math.max(...o.map(c=>gt(c,"to").length))};for(let c of o)u+=i(c,l);return u}}};function Cl(t,e){return Dt(t,e,(r,n,i)=>{let s={[i]:r},o={[i]:n};if(i=="from"||i=="to")return Dt(Object.getOwnPropertyNames(te(r,i,{})),Object.getOwnPropertyNames(te(n,i,{})))?Dt(gt(s,i),gt(o,i),(a,u,l)=>{if(l!=null)return it(a,u)}):!1;if(i=="fromScheme"||i=="toScheme")return it(r,n)})}var Ol=(t,e)=>{let r=Vr(t),n=Vr(e);return!(r&&n&&r!=n)},ao=t=>{Array.isArray(t)&&t.sort((e,r)=>e===null?1:r===null?-1:0)},uo=(t,e)=>(!t||!e||((Array.isArray(t.identifier)||Array.isArray(e.identifier))&&(t.identifier=Hs(t.identifier||[],e.identifier||[])),!t.uri&&e.uri&&(t.uri=e.uri),t.uri&&e.uri&&t.uri!=e.uri&&!(t.identifier||[]).includes(e.uri)&&(t.identifier=(t.identifier||[]).concat([e.uri])),Array.isArray(t.identifier)&&t.uri&&(t.identifier=t.identifier.filter(r=>r!==t.uri)),(t.identifier||[]).length==0&&delete t.identifier,ao(t.identifier)),t),lo=(t,e,r)=>{if(!t||!e)return t||e;r=r||{};let n=r._path||"",i=r.detectMismatch||[],s=r.skipPaths||[],o={};return pr(t,(a,u)=>{if(!s.includes(n+u))if(Array.isArray(a)&&Array.isArray(e[u]))o[u]=qs(a,e[u],(l,c)=>Nt(l)&&Nt(c)?it(l,c):l===c),ao(o[u]);else if(Nt(a)&&Nt(e[u]))o[u]=lo(a,e[u],Object.assign({_path:`${n}${u}.`},r));else{if(a&&e[u]&&i.includes(n+u)&&!Dt(a,e[u]))throw new Error("Property mismatch in "+n+u);o[u]=a}}),pr(e,(a,u)=>{t[u]||(o[u]=a)}),n==""&&Vs(o,s),r.mergeUris&&uo(o,e),o},ri=t=>Array.isArray(t)?t.map(e=>ri(e)):Nt(t)?(pr(t,(e,r)=>{t[r]=ri(e)}),t):dr(t)?t.normalize():t,kl=t=>{let e=/^[A-Za-z][A-Za-z0-9+\-.]*:(?:\/\/(?:(?:[A-Za-z0-9\-._~!$&'()*+,;=:]|%[0-9A-Fa-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9A-Fa-f]{1,4}:){6}|::(?:[0-9A-Fa-f]{1,4}:){5}|(?:[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){4}|(?:(?:[0-9A-Fa-f]{1,4}:){0,1}[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){3}|(?:(?:[0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){2}|(?:(?:[0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}:|(?:(?:[0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})?::)(?:[0-9A-Fa-f]{1,4}:[0-9A-Fa-f]{1,4}|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))|(?:(?:[0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})?::[0-9A-Fa-f]{1,4}|(?:(?:[0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})?::)|[Vv][0-9A-Fa-f]+\.[A-Za-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)|(?:[A-Za-z0-9\-._~!$&'()*+,;=]|%[0-9A-Fa-f]{2})*)(?::[0-9]*)?(?:\/(?:[A-Za-z0-9\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*|\/(?:(?:[A-Za-z0-9\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})+(?:\/(?:[A-Za-z0-9\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*)?|(?:[A-Za-z0-9\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})+(?:\/(?:[A-Za-z0-9\-._~!$&'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*|)(?:\?(?:[A-Za-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9A-Fa-f]{2})*)?(?:#(?:[A-Za-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9A-Fa-f]{2})*)?$/;return t.match(e)!==null},Rl={mappingsByConcepts:(t,e,r)=>{let n=["memberSet","memberList","memberChoice"],i,s;for(let o of n)i=i||te(t,r+"."+o+"[0].notation[0]"),s=s||te(e,r+"."+o+"[0].notation[0]");return i==null||i<s?-1:s==null||i>s?1:0}},Il=(t,e)=>!t||!e?!1:[t.uri].concat(Object.values(t.identities||{}).map(r=>r.uri)).filter(r=>r!=null).includes(te(e,"creator[0].uri"));function Tl(t,e){let r;if(t&&t.notation&&t.notation.length)r=t.notation[0],(io(t)||e=="scheme")&&(r=r.toUpperCase());else if(t&&t.inScheme&&t.inScheme[0]&&t.uri)try{r=new $r(t&&t.inScheme&&t.inScheme[0]).notationFromUri(t.uri)}catch(n){}return r||""}function ii(t,e,{language:r}={}){let n=t&&e?t[e]:t;return n&&(n[r]||(r=Hr.selectLanguage(n),r))?n[r]:null}function Ft(t,e={}){e=e||{};let r=e.fallbackToUri==null?!0:e.fallbackToUri;return te(t,`prefLabel.${e.language}`)||ii(t,"prefLabel",e)||(r&&t&&t.uri?t.uri:"")}function Pl(t,e={}){e=e||{};let r=te(t,`definition.${e.language}`)||ii(t,"definition",e)||[];return dr(r)&&(r=[r]),r}function Dl(t){return te(t,"stored",te(t,"constructor.stored",te(t,"provider.constructor.stored",!1)))}function Ml(t){return dr(t.creator)?t.creator:t.creator&&t.creator.id}function Nl(t){return te(t,"creator.name")||""}function Ll(t,e){return!!(t&&dr(t.creator)?e&&e.includes(t.creator):e&&t.creator&&e.includes(t.creator.id))}function Fl(t,e){return e.filter(({notationPattern:r})=>(r||".+")===".+"?!1:RegExp("^("+r+")$").test(t))}var P=L(R(R({},ei),si),{ConceptScheme:$r,languagePreference:Hr});var ui={};pt(ui,{concatUrl:()=>Ue,deepEqual:()=>Re,listOfCapabilities:()=>ai,requestMethods:()=>oi,withCustomProps:()=>wt});var oi=[{method:"getRegistries",fallback:[],type:"Registries"},{method:"getSchemes",fallback:[],type:"Schemes"},{method:"vocSearch",fallback:[],type:"Schemes"},{method:"getTypes",fallback:[],type:"Types"},{method:"suggest",fallback:["",[],[],[]]},{method:"vocSuggest",fallback:["",[],[],[]]},{method:"getConcordances",fallback:[],type:"Concordances"},{method:"getOccurrences",fallback:[],type:"Occurrences"},{method:"getTop",fallback:[],type:"Concepts"},{method:"getConcepts",fallback:[],type:"Concepts"},{method:"getNarrower",fallback:[],type:"Concepts"},{method:"getAncestors",fallback:[],type:"Concepts"},{method:"search",fallback:[],type:"Concepts"},{method:"getMapping",fallback:null,type:"Mapping"},{method:"getMappings",fallback:[],type:"Mappings"},{method:"postMapping",fallback:null,type:"Mapping"},{method:"postMappings",fallback:[],type:"Mapping"},{method:"putMapping",fallback:null,type:"Mapping"},{method:"patchMapping",fallback:null,type:"Mapping"},{method:"deleteMapping",fallback:!1},{method:"deleteMappings",fallback:[]},{method:"getAnnotations",fallback:[],type:"Annotations"},{method:"postAnnotation",fallback:null,type:"Annotation"},{method:"putAnnotation",fallback:null,type:"Annotation"},{method:"patchAnnotation",fallback:null,type:"Annotation"},{method:"deleteAnnotation",fallback:!1}];function Ue(...t){let[e,...r]=t;for(let n of r)e.endsWith("/")||(e+="/"),n.startsWith("/")&&(n=n.slice(1)),e+=n;return e}function wt(t,e){return t._totalCount=e._totalCount,t._url=e._url,t}var ai=["registries","schemes","top","data","concepts","narrower","ancestors","types","suggest","search","auth","mappings","concordances","annotations","occurrences"],Re=(t,e)=>{if(t===e)return!0;if(typeof t!="object"||typeof e!="object"||t===null||e===null)return!1;if(Object.keys(t).length===Object.keys(e).length){for(let r in t)if(!(r in e)||!Re(t[r],e[r]))return!1;return!0}return!1};var Ht={};pt(Ht,{BaseProvider:()=>G,ConceptApiProvider:()=>Te,LabelSearchSuggestionProvider:()=>We,LobidApiProvider:()=>Ye,LocApiProvider:()=>qe,LocalMappingsProvider:()=>st,MappingsApiProvider:()=>Ie,ModApiProvider:()=>Xe,MyCoReProvider:()=>Qe,NoTApiProvider:()=>Ze,OccurrencesApiProvider:()=>$e,OlsApiProvider:()=>Ge,ReconciliationApiProvider:()=>je,SkohubProvider:()=>Je,SkosmosApiProvider:()=>He});var li=(t,e)=>t.filter(r=>e.includes(r)),G=class{constructor(e={}){var n,i;this._jskos=e,this.axios=pe.create({timeout:2e5}),this._path=typeof window!="undefined"&&window.location.pathname,this.has={},(n=this.constructor)!=null&&n.supports&&(this.has=Object.assign({},(i=this.constructor)==null?void 0:i.supports)),ai.filter(s=>!this.has[s]).forEach(s=>{this.has[s]=!1}),this._defaultLanguages="en,de,fr,es,nl,it,fi,pl,ru,cs,jp".split(","),this.languages=[],this._auth={key:null,bearerToken:null},this._repeating=[],this._api={status:e.status,schemes:Array.isArray(e.schemes)?void 0:e.schemes,top:e.top,data:e.data,concepts:e.concepts,narrower:e.narrower,ancestors:e.ancestors,types:e.types,suggest:e.suggest,search:e.search,"voc-suggest":e["voc-suggest"],"voc-search":e["voc-search"],mappings:e.mappings,concordances:e.concordances,annotations:e.annotations,occurrences:e.occurrences,reconcile:e.reconcile,api:e.endpoint||e.api,registries:e.registries},this._config={},this.setRetryConfig(),this.axios.interceptors.request.use((s={})=>{var o,a,u;if(s._skipAdditionalParameters||(s.params||(s.params={}),s.params.language=[...new Set([].concat(((o=s.params.language)!=null?o:"").split(","),this.languages,this._defaultLanguages).filter(Boolean))].join(","),this.has.auth&&this._auth.bearerToken&&!((a=s==null?void 0:s.headers)!=null&&a.Authorization)&&(s.headers||(s.headers={}),s.headers.Authorization=`Bearer ${this._auth.bearerToken}`)),(u=s.url)!=null&&u.startsWith("http:")&&typeof window!="undefined"&&window.location.protocol=="https:")throw new pe.Cancel("Can't call http API from https.");return s}),this.axios.interceptors.response.use(({data:s,headers:o={},config:a={}})=>{s=P.normalize(s);let u=a.url;if(u.endsWith("?")||(u+="?"),u+=new URLSearchParams(a.params||{}).toString(),typeof s=="object"){let l=parseInt(o["x-total-count"]);isNaN(l)||(s._totalCount=l),s._url=u}return s},s=>{var u,l,c,p;let o=(l=(u=s.config)==null?void 0:u._retryCount)!=null?l:0,a=(c=s.response)==null?void 0:c.status;return this._retryConfig.methods.includes((p=s.config)==null?void 0:p.method)&&this._retryConfig.statusCodes.includes(a)&&o<this._retryConfig.count?(s.config._retryCount=o+1,s.config.data&&(s.config.data=JSON.parse(s.config.data)),new Promise((m,g)=>{setTimeout(()=>{this.axios(s.config).then(m).catch(g)},(()=>{let f=this._retryConfig.delay;return typeof f=="function"?f(o):f})())})):Promise.reject(s)});let r=[];for(let{method:s,type:o}of oi){let a=this[s]&&this[s].bind(this);if(!a){this[s]=()=>{throw new Qt({method:s})};continue}this[s]=(u={})=>{if(u._raw)return delete u._raw,a(u);let l=r.find(y=>y.method==s&&Re(y.options,u));if(l)return l.promise;let c;u.cancelToken||(c=this.getCancelTokenSource(),u.cancelToken=c.token);let p=this.init().then(()=>a(u)).then(y=>(typeof y=="object"&&y._totalCount===void 0&&(y._totalCount=Array.isArray(y)?y.length:1),y&&o&&this[`adjust${o}`]&&(y=this[`adjust${o}`](y)),y)).catch(y=>{throw y instanceof me?y:y.response?y.response.status.toString().startsWith(4)?new Le({relatedError:y,code:y.response.status}):new Zt({relatedError:y,code:y.response.status}):y.request?typeof navigator!="undefined"&&(navigator.connection||navigator.mozConnection||navigator.webkitConnection)?new er({relatedError:y}):new tr({relatedError:y}):(console.error(y),new me({relatedError:y}))});c&&(p.cancel=(...y)=>c.cancel(...y));let d=u,{cancelToken:m}=d,g=W(d,["cancelToken"]),f={method:s,options:g,promise:p};return r.push(f),p.catch(()=>{}).then(()=>r.splice(r.indexOf(f),1)),p}}}get uri(){return this._jskos.uri}get notation(){return this._jskos.notation}get prefLabel(){return this._jskos.prefLabel}get definition(){return this._jskos.definition}get schemes(){return this._jskos.schemes}get excludedSchemes(){return this._jskos.excludedSchemes}get stored(){return this._jskos.stored!==void 0?this._jskos.stored:this.constructor.stored}init(){return E(this,null,function*(){return this._init?this._init:(this._init=E(this,null,function*(){var r;this._prepare();let e;if(typeof this._api.status=="string")try{e=yield this.axios({method:"get",url:this._api.status})}catch(n){((r=n==null?void 0:n.response)==null?void 0:r.status)===404&&(this._api.status=null)}else e=this._api.status;if(typeof e=="object"&&Object.keys(e).length){this._config=e.config||{};for(let n of Object.keys(this._api))this._api[n]===void 0&&(this._api[n]=e[n]||null)}this._setup()}),this._init)})}_prepare(){}_setup(){}getCancelTokenSource(){return pe.CancelToken.source()}setAuth({key:e=this._auth.key,bearerToken:r=this._auth.bearerToken}){this._auth.key=e,this._auth.bearerToken=r}setRetryConfig(e={}){this._retryConfig=Object.assign({methods:["get","head","options"],statusCodes:[401,403],count:3,delay:r=>300*r},e)}suggest(e){return E(this,null,function*(){e._raw=!0;let r=yield this.search(e),n=[e.search,[],[],[]];for(let i of r){let s=P.notation(i),o=P.prefLabel(i);n[1].push((s?s+" ":"")+o),n[2].push(""),n[3].push(i.uri)}return r._totalCount!=null?n._totalCount=r._totalCount:n._totalCount=r.length,n})}isAuthorizedFor({type:e,action:r,user:n,crossUser:i}){var a,u,l,c;if(r=="read"&&this.has[e]===!0)return!0;if(!this.has[e])return!1;let s=(u=(a=this._config)==null?void 0:a[e])==null?void 0:u[r];if(!s)return!!this.has[e][r];if(s.auth&&(!n||!this._auth.key)||s.auth&&this._auth.key!=((c=(l=this._config)==null?void 0:l.auth)==null?void 0:c.key))return!1;let o=[n==null?void 0:n.uri].concat(Object.values((n==null?void 0:n.identities)||{}).map(p=>p.uri)).filter(Boolean);if(s.auth&&s.identities&&li(o,s.identities).length==0)return!1;if(s.auth&&s.identityProviders){let p=Object.keys((n==null?void 0:n.identities)||{});if(li(p,s.identityProviders).length==0)return!1}return i?s.crossUser===!0||li(s.crossUser||[],o).length>0:!!this.has[e][r]}supportsScheme(e){if(!e)return!1;let r=Array.isArray(this.schemes)?this.schemes:null;return r==null&&!P.isContainedIn(e,this.excludedSchemes||[])?!0:P.isContainedIn(e,r)}adjustConcept(e){if(!e||e.__SAVED__)return e;e._getNarrower=r=>this.getNarrower(L(R({},r),{concept:e})),e._getAncestors=r=>this.getAncestors(L(R({},r),{concept:e})),e._getDetails=r=>E(this,null,function*(){return(yield this.getConcepts(L(R({},r),{concepts:[e]})))[0]});for(let r of["broader","narrower","ancestors"])Array.isArray(e[r])&&e[r].length&&!e[r].includes(null)&&(e[r]=this.adjustConcepts(e[r]));return e._registry=this,e}adjustConcepts(e){return wt(e.map(r=>this.adjustConcept(r)),e)}adjustRegistries(e){return e}adjustScheme(e){if(!e||e.__SAVED__)return e;let r=e._registry;return e._registry=this.cdk&&this.cdk.registryForScheme(e),!e._registry||r===e._registry||e._registry._api.api===this._api.api?e._registry=r||this:["concepts","topConcepts"].forEach(n=>{Array.isArray(e[n])&&(e[n].length===0||e[n][0]===null)&&delete e[n]}),e._registry&&(e._getTop=n=>e._registry.getTop(L(R({},n),{scheme:e})),e._getTypes=n=>e._registry.getTypes(L(R({},n),{scheme:e})),e._suggest=s=>{var o=s,{search:n}=o,i=W(o,["search"]);return e._registry.suggest(L(R({},i),{search:n,scheme:e}))}),e}adjustSchemes(e){return wt(e.map(r=>this.adjustScheme(r)),e)}adjustConcordances(e){for(let r of e)r._registry=this;return e}adjustMapping(e){var r,n,i,s,o;for(let a of["from","to"]){let u=`${a}Scheme`;e[u]||(e[u]=(s=(i=(n=(r=P.conceptsOfMapping(e,a))==null?void 0:r[0])==null?void 0:n.inScheme)==null?void 0:i[0])!=null?s:null)}if(e._registry=this,!e.identifier){let a=(o=P.addMappingIdentifiers(e))==null?void 0:o.identifier;a&&(e.identifier=a)}return e}adjustMappings(e){return wt(e.map(r=>this.adjustMapping(r)),e)}postMappings(){return E(this,arguments,function*(n={}){var i=n,{mappings:e}=i,r=W(i,["mappings"]);if(!e||!e.length)throw new U({parameter:"mappings"});return this._callHelperForArrayWrappers({method:"postMapping",items:e,itemProperty:"mapping",config:r})})}deleteMappings(){return E(this,arguments,function*(n={}){var i=n,{mappings:e}=i,r=W(i,["mappings"]);if(!e||!e.length)throw new U({parameter:"mappings"});return this._callHelperForArrayWrappers({method:"deleteMapping",items:e,itemProperty:"mapping",config:r})})}_callHelperForArrayWrappers(s){return E(this,arguments,function*({method:e,items:r,itemProperty:n,config:i}){let o=[],a=yield Promise.all(r.map(u=>E(this,null,function*(){try{return yield this[e](L(R({[n]:u},i),{_raw:!0}))}catch(l){return o[r.indexOf(u)]=l,null}})));return a._errors=o,a})}};ee(G,"providerName","Base");var ze=ns(fo(),1);var we=[];for(let t=0;t<256;++t)we.push((t+256).toString(16).slice(1));function ho(t,e=0){return(we[t[e+0]]+we[t[e+1]]+we[t[e+2]]+we[t[e+3]]+"-"+we[t[e+4]]+we[t[e+5]]+"-"+we[t[e+6]]+we[t[e+7]]+"-"+we[t[e+8]]+we[t[e+9]]+"-"+we[t[e+10]]+we[t[e+11]]+we[t[e+12]]+we[t[e+13]]+we[t[e+14]]+we[t[e+15]]).toLowerCase()}var fi,Bl=new Uint8Array(16);function hi(){if(!fi){if(typeof crypto=="undefined"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");fi=crypto.getRandomValues.bind(crypto)}return fi(Bl)}var jl=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),pi={randomUUID:jl};function Ul(t,e,r){var i,s,o;t=t||{};let n=(o=(s=t.random)!=null?s:(i=t.rng)==null?void 0:i.call(t))!=null?o:hi();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){if(r=r||0,r<0||r+16>e.length)throw new RangeError(`UUID byte range ${r}:${r+15} is out of buffer bounds`);for(let a=0;a<16;++a)e[r+a]=n[a];return e}return ho(n)}function zl(t,e,r){return pi.randomUUID&&!e&&!t?pi.randomUUID():Ul(t,e,r)}var Kr=zl;var Yr="urn:uuid:",st=class extends G{static get supports(){return{mappings:{read:!0,create:!0,update:!0,delete:!0}}}_setup(){this.queue=[],this.localStorageKey="cocoda-mappings--"+this._path;let e="mappings",r=()=>ze.default.getItem(this.localStorageKey).then(n=>{n=n||[];let i=0;for(let s of n.filter(o=>!o.uri||!o.uri.startsWith(Yr)))s.uri&&(s.identifier||(s.identifier=[]),s.identifier.push(s.uri)),s.uri=`${Yr}${Kr()}`,i+=1;return i&&console.warn(`URIs added to ${i} local mappings.`),ze.default.setItem(this.localStorageKey,n)});ze.default.getItem(e).then(n=>{n&&console.warn(`Warning: There is old data in local storage (or IndexedDB, depending on the ) with the key "${e}". This data will not be used anymore. A manual export is necessary to get this data back.`)}),this.queue.push(r().catch(n=>{console.warn("Error when adding URIs to local mappings:",n)}))}isAuthorizedFor({type:e,action:r}){return e=="mappings"&&r!="anonymous"}_getMappingsQueue(){let e=this.queue.slice(-1)[0]||Promise.resolve();return new Promise(r=>{function n(){let o,a,u=new Promise((l,c)=>{o=l,a=c});return u.resolve=o,u.reject=a,u}let i=n(),s=()=>{i.resolve()};this.queue.push(i),e.then(()=>ze.default.getItem(this.localStorageKey)).then(o=>{r({mappings:o,done:s})})})}getMapping(n){return E(this,null,function*(){var i=n,{mapping:e}=i,r=W(i,["mapping"]);if(r._raw=!0,!e||!e.uri)throw new U({parameter:"mapping"});return(yield this.getMappings(L(R({},r),{uri:e.uri})))[0]})}getMappings(){return E(this,arguments,function*({from:e,fromScheme:r,to:n,toScheme:i,creator:s,type:o,partOf:a,offset:u,limit:l,direction:c,mode:p,identifier:m,uri:g}={}){let f={};return e&&(f.from=typeof e=="string"?e:e.uri),r&&(f.fromScheme=typeof r=="string"?{uri:r}:r),n&&(f.to=typeof n=="string"?n:n.uri),i&&(f.toScheme=typeof i=="string"?{uri:i}:i),s&&(f.creator=typeof s=="string"?s:P.prefLabel(s)),o&&(f.type=typeof o=="string"?o:o.uri),a&&(f.partOf=typeof a=="string"?a:a.uri),u&&(f.offset=u),l&&(f.limit=l),c&&(f.direction=c),p&&(f.mode=p),m&&(f.identifier=m),g&&(f.uri=g),this._getMappingsQueue().catch(d=>{throw new me({message:"Could not get mappings from local storage",relatedError:d})}).then(({mappings:d,done:y})=>{y();let O=(C,F)=>C.uri==F||F&&C.notation&&C.notation[0].toLowerCase()==F.toLowerCase();if((f.from||f.to)&&(d=d.filter(C=>{let F=P.conceptsOfMapping(C,"from").find(D=>O(D,f.from))!=null,N=P.conceptsOfMapping(C,"to").find(D=>O(D,f.from))!=null,S=P.conceptsOfMapping(C,"from").find(D=>O(D,f.to))!=null,k=P.conceptsOfMapping(C,"to").find(D=>O(D,f.to))!=null;return f.direction=="backward"?f.mode=="or"?f.from&&N||f.to&&S:(!f.from||N)&&(!f.to||S):f.direction=="both"?f.mode=="or"?f.from&&(F||N)||f.to&&(S||k):(!f.from||F)&&(!f.to||k)||(!f.from||N)&&(!f.to||S):f.mode=="or"?f.from&&F||f.to&&k:(!f.from||F)&&(!f.to||k)})),(f.fromScheme||f.toScheme)&&(d=d.filter(C=>{let F=P.compare(C.fromScheme,f.fromScheme),N=P.compare(C.toScheme,f.fromScheme),S=P.compare(C.fromScheme,f.toScheme),k=P.compare(C.toScheme,f.toScheme);return f.direction=="backward"?f.mode=="or"?f.fromScheme&&N||f.toScheme&&S:(!f.fromScheme||N)&&(!f.toScheme||S):f.direction=="both"?f.mode=="or"?f.fromScheme&&(F||N)||f.toScheme&&(S||k):(!f.fromScheme||F)&&(!f.toScheme||k)||(!f.fromScheme||N)&&(!f.toScheme||S):f.mode=="or"?f.fromScheme&&F||f.toScheme&&k:(!f.fromScheme||F)&&(!f.toScheme||k)})),f.creator){let C=f.creator.split("|");d=d.filter(F=>(F.creator&&F.creator.find(N=>C.includes(P.prefLabel(N))||C.includes(N.uri)))!=null)}f.type&&(d=d.filter(C=>(C.type||[P.defaultMappingType.uri]).includes(f.type))),f.partOf&&(d=d.filter(C=>C.partOf!=null&&C.partOf.find(F=>P.compare(F,{uri:f.partOf}))!=null)),f.identifier&&(d=d.filter(C=>f.identifier.split("|").map(F=>(C.identifier||[]).includes(F)||C.uri==F).reduce((F,N)=>F||N))),f.uri&&(d=d.filter(C=>C.uri==f.uri));let I=d.length;return d=d.sort((C,F)=>{let N=C.modified||C.created,S=F.modified||F.created;return S==null?-1:N==null?1:N>S?-1:1}),d=d.slice(f.offset||0),d=d.slice(0,f.limit),d._totalCount=I,d})})}postMapping(r){return E(this,arguments,function*({mapping:e}){if(!e)throw new U({parameter:"mapping"});let{mappings:n,done:i}=yield this._getMappingsQueue();if((!e.uri||!e.uri.startsWith(Yr))&&(e.uri&&(e.identifier||(e.identifier=[]),e.identifier.push(e.uri)),e.uri=`${Yr}${Kr()}`),n.find(s=>s.uri==e.uri))throw i(),new U({parameter:"mapping",message:"Duplicate URI"});e.created||(e.created=new Date().toISOString()),e.modified||(e.modified=e.created),delete e.partOf,n.push(e),n=n.map(s=>P.minifyMapping(s));try{return yield ze.default.setItem(this.localStorageKey,n),i(),e}catch(s){throw i(),s}})}putMapping(r){return E(this,arguments,function*({mapping:e}){if(!e)throw new U({parameter:"mapping"});let{mappings:n,done:i}=yield this._getMappingsQueue(),s=n.findIndex(o=>o.uri==e.uri);if(s==-1)throw i(),new U({parameter:"mapping",message:"Mapping not found"});e.created||(e.created=n[s].created),e.modified=new Date().toISOString(),delete e.partOf,n[s]=e,n=n.map(o=>P.minifyMapping(o));try{return yield ze.default.setItem(this.localStorageKey,n),i(),e}catch(o){throw i(),o}})}patchMapping(r){return E(this,arguments,function*({mapping:e}){if(!e)throw new U({parameter:"mapping"});let{mappings:n,done:i}=yield this._getMappingsQueue(),s=n.findIndex(o=>o.uri==e.uri);if(s==-1)throw i(),new U({parameter:"mapping",message:"Mapping not found"});e.created||(e.created=n[s].created),e.modified=new Date().toISOString(),delete e.partOf,n[s]=Object.assign(n[s],e),n=n.map(o=>P.minifyMapping(o));try{return yield ze.default.setItem(this.localStorageKey,n),i(),e}catch(o){throw i(),o}})}deleteMapping(r){return E(this,arguments,function*({mapping:e}){if(!e)throw new U({parameter:"mapping"});let{mappings:n,done:i}=yield this._getMappingsQueue();try{return n=n.filter(s=>s.uri!=e.uri),n=n.map(s=>P.minifyMapping(s)),yield ze.default.setItem(this.localStorageKey,n),i(),!0}catch(s){throw i(),s}})}};st.providerName="LocalMappings";st.stored=!0;var Ie=class extends G{_prepare(){this._api.api&&this._api.status===void 0&&(this._api.status=Ue(this._api.api,"/status"))}_setup(){var e,r,n,i,s,o,a,u,l,c,p,m,g,f,d,y,O,I,C,F,N,S,k,D,$,X,K,V,Z;if(this._api.api){let se={mappings:"/mappings",concordances:"/concordances",annotations:"/annotations"};for(let re of Object.keys(se))this._api[re]===void 0&&(this._api[re]=Ue(this._api.api,se[re]))}this.has.mappings=this._api.mappings?{}:!1,this.has.mappings&&(this.has.mappings.read=!!((n=(r=(e=this._config)==null?void 0:e.mappings)==null?void 0:r.read)==null||n),this.has.mappings.create=!!((s=(i=this._config)==null?void 0:i.mappings)!=null&&s.create),this.has.mappings.update=!!((a=(o=this._config)==null?void 0:o.mappings)!=null&&a.update),this.has.mappings.delete=!!((l=(u=this._config)==null?void 0:u.mappings)!=null&&l.delete),this.has.mappings.anonymous=!!((p=(c=this._config)==null?void 0:c.mappings)!=null&&p.anonymous)),this.has.concordances=this._api.concordances?{}:!1,this.has.concordances&&(this.has.concordances.read=!!((g=(m=this._config)==null?void 0:m.concordances)!=null&&g.read),this.has.concordances.create=!!((d=(f=this._config)==null?void 0:f.concordances)!=null&&d.create),this.has.concordances.update=!!((O=(y=this._config)==null?void 0:y.concordances)!=null&&O.update),this.has.concordances.delete=!!((C=(I=this._config)==null?void 0:I.concordances)!=null&&C.delete)),this.has.annotations=this._api.annotations?{}:!1,this.has.annotations&&(this.has.annotations.read=!!((N=(F=this._config)==null?void 0:F.annotations)!=null&&N.read),this.has.annotations.create=!!((k=(S=this._config)==null?void 0:S.annotations)!=null&&k.create),this.has.annotations.update=!!(($=(D=this._config)==null?void 0:D.annotations)!=null&&$.update),this.has.annotations.delete=!!((K=(X=this._config)==null?void 0:X.annotations)!=null&&K.delete)),this.has.auth=((Z=(V=this._config)==null?void 0:V.auth)==null?void 0:Z.key)!=null,this._defaultParams={properties:"annotations"}}getMapping(n){return E(this,null,function*(){var i=n,{mapping:e}=i,r=W(i,["mapping"]);var s;if(!e)throw new U({parameter:"mapping"});if(!e.uri||!e.uri.startsWith(this._api.mappings))throw new U({parameter:"mapping",message:"URI doesn't seem to be part of this registry."});try{return yield this.axios(L(R({},r),{url:e.uri,params:R(R({},this._defaultParams),r.params||{})}))}catch(o){if(((s=o==null?void 0:o.response)==null?void 0:s.status)==404)return null;throw o}})}getMappings(F){return E(this,null,function*(){var N=F,{from:e,fromScheme:r,to:n,toScheme:i,creator:s,type:o,partOf:a,offset:u,limit:l,direction:c,mode:p,identifier:m,cardinality:g,annotatedBy:f,annotatedFor:d,annotatedWith:y,sort:O,order:I}=N,C=W(N,["from","fromScheme","to","toScheme","creator","type","partOf","offset","limit","direction","mode","identifier","cardinality","annotatedBy","annotatedFor","annotatedWith","sort","order"]);let S={},k=this._api.mappings;return e&&(S.from=typeof e=="string"?e:e.uri),r&&(S.fromScheme=typeof r=="string"?r:r.uri),n&&(S.to=typeof n=="string"?n:n.uri),i&&(S.toScheme=typeof i=="string"?i:i.uri),s&&(S.creator=typeof s=="string"?s:P.prefLabel(s)),o&&(S.type=typeof o=="string"?o:o.uri),a&&(S.partOf=typeof a=="string"?a:a.uri),u&&(S.offset=u),l&&(S.limit=l),c&&(S.direction=c),g&&(S.cardinality=g),f&&(S.annotatedBy=f),d&&(S.annotatedFor=d),y&&(S.annotatedWith=y),p&&(S.mode=p),m&&(S.identifier=m),O&&(S.sort=O),I&&(S.order=I),this.axios(L(R({},C),{method:"get",url:k,params:R(R(R({},this._defaultParams),C.params||{}),S)}))})}postMapping(n){return E(this,null,function*(){var i=n,{mapping:e}=i,r=W(i,["mapping"]);if(!e)throw new U({parameter:"mapping"});return e=P.minifyMapping(e),e=P.addMappingIdentifiers(e),this.axios(L(R({},r),{method:"post",url:this._api.mappings,data:e,params:R(R({},this._defaultParams),r.params||{})}))})}putMapping(n){return E(this,null,function*(){var i=n,{mapping:e}=i,r=W(i,["mapping"]);if(!e)throw new U({parameter:"mapping"});e=P.minifyMapping(e),e=P.addMappingIdentifiers(e);let s=e.uri;if(!s||!s.startsWith(this._api.mappings))throw new U({parameter:"mapping",message:"URI doesn't seem to be part of this registry."});return this.axios(L(R({},r),{method:"put",url:s,data:e,params:R(R({},this._defaultParams),r.params||{})}))})}patchMapping(n){return E(this,null,function*(){var i=n,{mapping:e}=i,r=W(i,["mapping"]);var a;if(!e)throw new U({parameter:"mapping"});if(!((a=e.uri)!=null&&a.startsWith(this._api.mappings)))throw new U({parameter:"mapping",message:"URI doesn't seem to be part of this registry."});let u=e,{uri:s}=u,o=W(u,["uri"]);return this.axios(L(R({},r),{method:"patch",url:s,data:o,params:R(R({},this._defaultParams),r.params||{})}))})}deleteMapping(n){return E(this,null,function*(){var i=n,{mapping:e}=i,r=W(i,["mapping"]);if(!e)throw new U({parameter:"mapping"});let s=e.uri;if(!s||!s.startsWith(this._api.mappings))throw new U({parameter:"mapping",message:"URI doesn't seem to be part of this registry."});return yield this.axios(L(R({},r),{method:"delete",url:s})),!0})}getAnnotations(n){return E(this,null,function*(){var i=n,{target:e}=i,r=W(i,["target"]);return e&&(r.params||(r.params={}),r.params.target=e),this.axios(L(R({},r),{method:"get",url:this._api.annotations}))})}postAnnotation(n){return E(this,null,function*(){var i=n,{annotation:e}=i,r=W(i,["annotation"]);return this.axios(L(R({},r),{method:"post",url:this._api.annotations,data:e}))})}putAnnotation(n){return E(this,null,function*(){var i=n,{annotation:e}=i,r=W(i,["annotation"]);let s=e.id;if(!s||!s.startsWith(this._api.annotations))throw new U({parameter:"annotation",message:"URI doesn't seem to be part of this registry."});return this.axios(L(R({},r),{method:"put",url:s,data:e}))})}patchAnnotation(n){return E(this,null,function*(){var i=n,{annotation:e}=i,r=W(i,["annotation"]);let s=e.id;if(!s||!s.startsWith(this._api.annotations))throw new U({parameter:"annotation",message:"URI doesn't seem to be part of this registry."});return this.axios(L(R({},r),{method:"patch",url:s,data:e}))})}deleteAnnotation(n){return E(this,null,function*(){var i=n,{annotation:e}=i,r=W(i,["annotation"]);let s=e.id;if(!s||!s.startsWith(this._api.annotations))throw new U({parameter:"annotation",message:"URI doesn't seem to be part of this registry."});return yield this.axios(L(R({},r),{method:"delete",url:s})),!0})}getConcordances(e){return E(this,null,function*(){return this.axios(L(R({},e),{method:"get",url:this._api.concordances}))})}postConcordance(n){return E(this,null,function*(){var i=n,{concordance:e}=i,r=W(i,["concordance"]);if(!e)throw new U({parameter:"concordance"});return this.axios(L(R({},r),{method:"post",url:this._api.concordances,data:e,params:R(R({},this._defaultParams),r.params||{})}))})}putConcordance(n){return E(this,null,function*(){var i=n,{concordance:e}=i,r=W(i,["concordance"]);if(!e)throw new U({parameter:"concordance"});let s=e.uri;if(!s||!s.startsWith(this._api.concordances))throw new U({parameter:"concordance",message:"URI doesn't seem to be part of this registry."});return this.axios(L(R({},r),{method:"put",url:s,data:e,params:R(R({},this._defaultParams),r.params||{})}))})}patchConcordance(n){return E(this,null,function*(){var i=n,{concordance:e}=i,r=W(i,["concordance"]);var a;if(!e)throw new U({parameter:"concordance"});if(!((a=e.uri)!=null&&a.startsWith(this._api.concordances)))throw new U({parameter:"concordance",message:"URI doesn't seem to be part of this registry."});let u=e,{uri:s}=u,o=W(u,["uri"]);return this.axios(L(R({},r),{method:"patch",url:s,data:o,params:R(R({},this._defaultParams),r.params||{})}))})}deleteConcordance(n){return E(this,null,function*(){var i=n,{concordance:e}=i,r=W(i,["concordance"]);if(!e)throw new U({parameter:"concordance"});let s=e.uri;if(!s||!s.startsWith(this._api.concordances))throw new U({parameter:"concordance",message:"URI doesn't seem to be part of this registry."});return yield this.axios(L(R({},r),{method:"delete",url:s})),!0})}};ee(Ie,"supports",{mappings:!0,concordances:!0,annotations:!0});Ie.providerName="MappingsApi";Ie.stored=!0;var di={},$e=class extends G{get _cache(){return di[this.uri]}_prepare(){di[this.uri]=[],this._occurrencesSupportedSchemes=[]}_occurrencesIsSupported(e){return E(this,null,function*(){if(!(this._occurrencesSupportedSchemes&&this._occurrencesSupportedSchemes.length))try{let n=Ue(this._api.api,"voc"),i=yield this.axios({method:"get",url:n});this._occurrencesSupportedSchemes=i||[]}catch(n){}let r=!1;for(let n of this._occurrencesSupportedSchemes)P.compare(e,n)&&(r=!0);return r})}getMappings(e){return E(this,null,function*(){var u,l,c,p,m,g,f,d,y,O,I,C,F,N;let r=yield this.getOccurrences(e),n=e.from,i=((u=n==null?void 0:n.inScheme)==null?void 0:u[0])||e.fromScheme,s=e.to,o=((l=s==null?void 0:s.inScheme)==null?void 0:l[0])||e.toScheme,a=[];for(let S of r){if(!S)continue;let k={};k.from=(c=S==null?void 0:S.memberSet)==null?void 0:c[0],k.from?k.from={memberSet:[k.from]}:k.from=null,k.fromScheme=(g=(m=(p=S==null?void 0:S.memberSet)==null?void 0:p[0])==null?void 0:m.inScheme)==null?void 0:g[0],k.to=(f=S==null?void 0:S.memberSet)==null?void 0:f[1],k.to?k.to={memberSet:[k.to]}:k.to={memberSet:[]},k.toScheme=(O=(y=(d=S==null?void 0:S.memberSet)==null?void 0:d[1])==null?void 0:y.inScheme)==null?void 0:O[0],(n&&P.compare(n,(C=(I=k==null?void 0:k.to)==null?void 0:I.memberSet)==null?void 0:C[0])||s&&P.compare(s,(N=(F=k==null?void 0:k.from)==null?void 0:F.memberSet)==null?void 0:N[0]))&&([k.from,k.fromScheme,k.to,k.toScheme]=[k.to,k.toScheme,k.from,k.fromScheme]),!k.fromScheme&&i&&(k.fromScheme=i),!k.toScheme&&o&&(k.toScheme=o),k.type=[P.defaultMappingType.uri],k._occurrence=S,k=P.addMappingIdentifiers(k),a.push(k)}return a._url=r._url,a})}getOccurrences(o){return E(this,null,function*(){var a=o,{from:e,to:r,concepts:n,threshold:i=0}=a,s=W(a,["from","to","concepts","threshold"]);var f;let u=[];n=(n||[]).concat([e,r]).filter(d=>!!d);for(let d of n)u.push(this._occurrencesIsSupported((f=d==null?void 0:d.inScheme)==null?void 0:f[0]).then(y=>y&&d.uri?d.uri:null));let l=yield Promise.all(u);if(l=l.filter(d=>d!=null),l.length==0)throw new U({parameter:"concepts"});u=[];for(let d of l)u.push(this._getOccurrences(L(R({},s),{params:{member:d,scheme:"*",threshold:i}})));let c=yield Promise.all(u),p=c.flat(),m=[],g=[];for(let d=0;d<p.length;d+=1){let y=p[d];if(!y)continue;let O=y.memberSet.reduce((I,C)=>I.concat(C.uri),[]).sort().join(" ");m.includes(O)?g.push(d):m.push(O)}return g.forEach(d=>{delete p[d]}),p=p.filter(d=>d!=null),p=p.sort((d,y)=>parseInt(y.count||0)-parseInt(d.count||0)),p._url=c.map(d=>d._url),p})}_getOccurrences(e){return E(this,null,function*(){let r=this._cache.find(i=>Re(i.config.params,e.params));if(r)return r.data;let n=yield this.axios(L(R({},e),{method:"get",url:this._api.api}));return this._cache.push({config:e,data:n}),this._cache.length>20&&(di[this.uri]=this._cache.slice(this._cache.length-20)),n})}};ee($e,"supports",{occurrences:!0,mappings:!0});$e.providerName="OccurrencesApi";$e.stored=!1;var Te=class extends G{_prepare(){this._api.api&&this._api.status===void 0&&(this._api.status=Ue(this._api.api,"/status"))}_setup(){var e,r;if(this._api.api){let n={schemes:"/voc",top:"/voc/top",concepts:"/voc/concepts",data:"/data",narrower:"/narrower",ancestors:"/ancestors",types:"/types",suggest:"/suggest",search:"/search",registries:"/registries"};for(let i of Object.keys(n))this._api[i]===void 0&&(this._api[i]=Ue(this._api.api,n[i]))}this.has.registries=!!this._api.registries,this.has.schemes=!!this._api.schemes,!this.has.schemes&&Array.isArray(this.schemes)&&(this.has.schemes=!0),this.has.top=!!this._api.top,this.has.data=!!this._api.data,this.has.concepts=!!this._api.concepts||this.has.data,this.has.narrower=!!this._api.narrower,this.has.ancestors=!!this._api.ancestors,this.has.types=!!this._api.types,this.has.suggest=!!this._api.suggest,this.has.search=!!this._api.search,this.has.auth=(r=(e=this._config)==null?void 0:e.auth)==null?void 0:r.key,this._defaultParams={properties:"+created,issued,modified,editorialNote,scopeNote,note,definition,mappings,location"}}static _registryConfigForBartocApiConfig({url:e,scheme:r}={}){return!e||!r?null:{api:e,schemes:[r]}}_getSchemeUri(e){return E(this,null,function*(){this._approvedSchemes=this._approvedSchemes||[],this._rejectedSchemes=this._rejectedSchemes||[];let r=this._approvedSchemes.find(s=>P.compare(e,s));if(r)return r.uri;if(this._rejectedSchemes.find(s=>P.compare(e,s)))return null;let i=(yield this.getSchemes({params:{uri:P.getAllUris(e).join("|")}})).find(s=>P.compare(s,e));return i?(this._approvedSchemes.push({uri:i.uri,identifier:P.getAllUris(e)}),i.uri):(this._rejectedSchemes.push({uri:e.uri,identifier:e.identifier}),null)})}getRegistries(){return E(this,arguments,function*(e={}){if(!this._api.registries){if(Array.isArray(this.registries))return this.registries;throw new Se}return yield this.axios(L(R({},e),{method:"get",url:this._api.registries,params:R(L(R({},this._defaultParams),{limit:500}),e.params||{})}))})}getSchemes(){return E(this,arguments,function*(e={}){if(!this._api.schemes){if(Array.isArray(this.schemes))return this.schemes;throw new Se}let r=yield this.axios(L(R({},e),{method:"get",url:this._api.schemes,params:R(L(R({},this._defaultParams),{limit:500}),e.params||{})}));return Array.isArray(this.schemes)?wt(r.filter(n=>P.isContainedIn(n,this.schemes)),r):r})}getTop(n){return E(this,null,function*(){var i=n,{scheme:e}=i,r=W(i,["scheme"]);if(!this._api.top)throw new Se;if(!e)throw new U({parameter:"scheme"});let s=yield this._getSchemeUri(e);if(!s)throw new U({parameter:"scheme",message:"Requested vocabulary seems to be unsupported by this API."});return Array.isArray(this._api.top)?this._api.top:this.axios(L(R({},r),{method:"get",url:this._api.top,params:L(R(L(R({},this._defaultParams),{limit:1e4}),r.params||{}),{uri:s})}))})}getConcepts(n){return E(this,null,function*(){var i=n,{concepts:e}=i,r=W(i,["concepts"]);let s=this._api.concepts||this._api.data;if(!s)throw new Se;Array.isArray(e)||(e=e?[e]:[]);let o=e.map(a=>a.uri).filter(a=>a!=null);return this.axios(L(R({},r),{method:"get",url:s,params:L(R(L(R({},this._defaultParams),{limit:100}),r.params||{}),{uri:o.join("|")})}))})}getNarrower(n){return E(this,null,function*(){var i=n,{concept:e}=i,r=W(i,["concept"]);var s;if(!e||!e.uri)throw new U({parameter:"concept"});if(this._api.narrower)return this.axios(L(R({},r),{method:"get",url:this._api.narrower,params:L(R(L(R({},this._defaultParams),{limit:1e4}),r.params||{}),{uri:e.uri})}));{let o=R({params:{}},r);o.params.properties="narrower";let u=((s=(yield this.getConcepts(R({concepts:[e]},o)))[0])==null?void 0:s.narrower)||[];return u.length?this.getConcepts(R({concepts:u},r)):[]}})}getAncestors(n){return E(this,null,function*(){var i=n,{concept:e}=i,r=W(i,["concept"]);var s;if(!e||!e.uri)throw new U({parameter:"concept"});if(this._api.ancestors)return this.axios(L(R({},r),{method:"get",url:this._api.ancestors,params:L(R(L(R({},this._defaultParams),{limit:1e4}),r.params||{}),{uri:e.uri})}));{let o=R({params:{}},r);o.params.properties="ancestors";let u=((s=(yield this.getConcepts(R({concepts:[e]},o)))[0])==null?void 0:s.ancestors)||[];return u.length?this.getConcepts(R({concepts:u},r)):[]}})}suggest(o){return E(this,null,function*(){var a=o,{use:e="notation,label",types:r=[],sort:n="score",params:i={}}=a,s=W(a,["use","types","sort","params"]);return this._search(L(R({},s),{endpoint:"suggest",params:L(R({},i),{type:r.join("|"),use:e,sort:n})}))})}search(i){return E(this,null,function*(){var s=i,{types:e=[],params:r={}}=s,n=W(s,["types","params"]);return this._search(L(R({},n),{endpoint:"search",params:L(R({},r),{type:e.join("|")})}))})}vocSuggest(s){return E(this,null,function*(){var o=s,{use:e="notation,label",sort:r="score",params:n={}}=o,i=W(o,["use","sort","params"]);return this._search(L(R({},i),{endpoint:"voc-suggest",params:L(R({},n),{use:e,sort:r})}))})}vocSearch(e){return E(this,null,function*(){return this._search(L(R({},e),{endpoint:"voc-search"}))})}_search(l){return E(this,null,function*(){var c=l,{endpoint:e,scheme:r,search:n,limit:i,offset:s,params:o,url:a}=c,u=W(c,["endpoint","scheme","search","limit","offset","params","url"]);if(a=a!=null?a:this._api[e],!a)throw new Se;if(!n)throw new U({parameter:"search"});i=i||this._jskos.suggestResultLimit||100,s=s||0;let p=r&&(yield this._getSchemeUri(r));return a=a.replace("{searchTerms}",n),this.axios(L(R({},u),{params:L(R(R({},this._defaultParams),o),{limit:i,count:i,offset:s,search:n,query:n,voc:p}),method:"get",url:a}))})}getTypes(n){return E(this,null,function*(){var i=n,{scheme:e}=i,r=W(i,["scheme"]);if(!this._api.types)throw new Se;if(Array.isArray(this._api.types))return this._api.types;let s=e&&(yield this._getSchemeUri(e));s&&(r.params||(r.params={}),r.params.uri=s);let o=yield this.axios(L(R({},r),{method:"get",url:this._api.types}));return s&&(o=o.filter(a=>!a.inScheme||P.isContainedIn(e,a.inScheme))),o})}};ee(Te,"providerName","ConceptApi"),ee(Te,"providerType","http://bartoc.org/api-type/jskos"),ee(Te,"supports",{schemes:!0,top:!0,data:!0,concepts:!0,narrower:!0,ancestors:!0,types:!0,suggest:!0,search:!0,auth:!0,registries:!0});var mi={},je=class extends G{get _cache(){return mi[this.uri]}_prepare(){mi[this.uri]=[]}getMappings(s){return E(this,null,function*(){var o=s,{from:e,to:r,mode:n}=o,i=W(o,["from","to","mode"]);var S,k,D,$,X,K;let a=[];Array.isArray(this.schemes)&&(a=this.schemes);let u,l,c=(S=e==null?void 0:e.inScheme)==null?void 0:S[0],p=(k=r==null?void 0:r.inScheme)==null?void 0:k[0],m,g;if(!e||P.isContainedIn(c,a)?(u=!0,l=r,m=p,g=a.find(V=>P.compare(V,c))||a[0]):(u=!1,l=e,m=c,g=a.find(V=>P.compare(V,p))||a[0]),n!="or")return[];if(!this._api.api)throw new Se;if(!l)throw new U({parameter:u?"to":"from"});let f=P.languagePreference.selectLanguage(l.prefLabel);if(!f)throw new U({parameter:u?"to":"from",message:"Missing language"});let d=($=(D=l==null?void 0:l.altLabel)==null?void 0:D[f])!=null?$:[];typeof d=="string"&&(d=[d]);let y=(X=l==null?void 0:l.prefLabel)==null?void 0:X[f],O=d.concat([y]);O=[y];let{url:I,data:C}=yield this._getReconciliationResults(L(R({},i),{labels:O,language:f}));C=[].concat(...Object.values(C).map(V=>V.result)).filter(V=>V),C=C.sort((V,Z)=>V.score!=Z.score?Z.score-V.score:V.match!=Z.match?V.match?-1:1:V.id.length-Z.id.length);let F=(K=g==null?void 0:g.namespace)!=null?K:"",N=C.map(V=>({fromScheme:m,from:{memberSet:[l]},toScheme:g,to:{memberSet:[{uri:F+V.id}]},type:[V.match?"http://www.w3.org/2004/02/skos/core#exactMatch":V.score>=80?"http://www.w3.org/2004/02/skos/core#closeMatch":"http://www.w3.org/2004/02/skos/core#mappingRelation"]}));return u&&(N=N.map(V=>Object.assign(V,{fromScheme:V.toScheme,from:V.to,toScheme:V.fromScheme,to:V.from}))),N._url=I,N})}_getReconciliationResults(i){return E(this,null,function*(){var s=i,{labels:e,language:r}=s,n=W(s,["labels","language"]);e=e.sort();let o=this._cache.find(g=>Re(g.labels,e)&&g.language==r);if(o)return o;let a={},u=0;for(let g of e)a[`q${u}`]={query:g},u+=1;let l=this._api.api;r&&(l=l.replace("{language}",r));let c=`queries=${encodeURIComponent(JSON.stringify(a))}`;n.headers||(n.headers={}),n.headers["Content-Type"]="application/x-www-form-urlencoded";let p=yield this.axios(L(R({},n),{method:"post",url:l,data:c}));p=p||{};let m={labels:e,language:r,data:p,url:`${l}${l.includes("?")?"&":"?"}${c}`};return this._cache.push(m),this._cache.length>20&&(mi[this.uri]=this._cache.slice(this._cache.length-20)),m})}};ee(je,"supports",{mappings:!0});je.providerName="ReconciliationApi";je.providerType="http://bartoc.org/api-type/reconciliation";je.stored=!1;var We=class extends G{_prepare(){this._cache=[]}supportsScheme(e){var r,n;return super.supportsScheme(e)&&((n=(r=e==null?void 0:e._registry)==null?void 0:r.has)==null?void 0:n.search)}getMappings(a){return E(this,null,function*(){var u=a,{from:e,to:r,mode:n,selected:i,limit:s=10}=u,o=W(u,["from","to","mode","selected","limit"]);if(n!="or")return[];if(!i)throw new U({parameter:"selected"});let l=[];e&&this.supportsScheme(i.scheme[!1])?l.push(this._getMappings(L(R({},o),{concept:e,sourceScheme:i.scheme[!0],targetScheme:i.scheme[!1],limit:s}))):l.push(Promise.resolve([])),r&&this.supportsScheme(i.scheme[!0])?l.push(this._getMappings(L(R({},o),{concept:r,sourceScheme:i.scheme[!1],targetScheme:i.scheme[!0],limit:s,swap:!0}))):l.push(Promise.resolve([]));let[c,p]=yield Promise.all(l);for(p=p.filter(m=>!c.find(g=>P.compareMappingMembers(m,g)));c.length+p.length>s;)p.length>=c.length?p.pop():c.pop();return[...c,...p]})}_getMappings(a){return E(this,null,function*(){var u=a,{concept:e,sourceScheme:r,targetScheme:n,limit:i,swap:s=!1}=u,o=W(u,["concept","sourceScheme","targetScheme","limit","swap"]);var f;if(!e||!r||!n)return[];if(P.compare(r,n))return[];let l=P.languagePreference.selectLanguage(e.prefLabel)||this._defaultLanguages[0],c=P.prefLabel(e,{fallbackToUri:!1,language:l});if(!c)return[];let p=/^[\s\wäüöÄÜÖß]*\w/.exec(c);c=p?p[0]:c;let m=yield this._getResults(L(R({},o),{label:c,targetScheme:n,limit:i}));if(!m.length&&((f=e.broader)!=null&&f.length))for(let d of e.broader){let y=P.prefLabel(d,{fallbackToUri:!1,language:l});if(y&&(m=yield this._getResults(L(R({},o),{label:y,targetScheme:n,limit:i})),m.length))break}let g=m.map(d=>({fromScheme:r,from:{memberSet:[e]},toScheme:n,to:{memberSet:[d]},type:["http://www.w3.org/2004/02/skos/core#mappingRelation"]}));return s&&(g=g.map(d=>Object.assign(d,{fromScheme:d.toScheme,from:d.to,toScheme:d.fromScheme,to:d.from}))),g})}_getResults(s){return E(this,null,function*(){var o=s,{label:e,targetScheme:r,limit:n}=o,i=W(o,["label","targetScheme","limit"]);var p;let a=(this._cache[r.uri]||{})[e];if(a&&a._limit>=n)return a;let u=r==null?void 0:r._registry;if(!u||u.has.search===!1)return[];let l=(p=(this._jskos.overrides||[]).find(m=>P.compare(m,r)))==null?void 0:p.search,c=yield u.search(L(R({},i),{url:l,search:e,scheme:r,limit:n}));return this._cache[r.uri]||(this._cache[r.uri]={}),this._cache[r.uri][e]=c,this._cache[r.uri][e]._limit=n,c})}};ee(We,"supports",{mappings:!0});We.providerName="LabelSearchSuggestion";We.stored=!1;var He=class extends G{static _registryConfigForBartocApiConfig({url:e,scheme:r}={}){if(!e||!r)return null;let n={},i=e.match(/(.+\/)([^/]+)\/$/);return i?(n.api=i[1]+"rest/v1/",r.VOCID=i[2],n.schemes=[r],n):null}get _language(){return this.languages[0]||this._defaultLanguages[0]||"en"}_getApiUrl(e,r,n){var o;let i=(e==null?void 0:e.VOCID)||((o=this.schemes.find(a=>P.compare(a,e)))==null?void 0:o.VOCID);if(!i)throw new U({parameter:"scheme",message:"Missing scheme or VOCID property on scheme"});r=r||"",n=n||{},n.lang||(n.lang=this._language);let s=Object.keys(n).map(a=>`${a}=${encodeURIComponent(n[a])}`).join("&");return`${this._api.api}${i}${r}${s?"?"+s:""}`}_getDataUrl(e,{addFormatParameter:r=!0}={}){var i;let n=(i=e==null?void 0:e.inScheme)==null?void 0:i[0];if(!e||!e.uri)throw new U({parameter:"concept",message:"Missing concept URI"});return this._getApiUrl(n,"/data",r?{format:"application/json"}:{})}_getSchemeUri(e){return E(this,null,function*(){this._approvedSchemes=this._approvedSchemes||[],this._rejectedSchemes=this._rejectedSchemes||[];let r=this._approvedSchemes.find(o=>P.compare(e,o));if(r)return r.uri;if(this._rejectedSchemes.find(o=>P.compare(e,o)))return null;let n=this._getApiUrl(e,"/"),s=(yield this.axios({method:"get",url:n})).conceptschemes.find(o=>P.compare(o,e));return s?(this._approvedSchemes.push({uri:s.uri,identifier:P.getAllUris(e)}),s.uri):(this._rejectedSchemes.push({uri:e.uri,identifier:e.identifier}),null)})}_toJskosConcept(e,{concept:r,scheme:n,result:i,language:s}={}){var c,p;if(!e)return null;r=P.deepCopy(r||{}),s=s||e.lang||"en",r.uri=e.uri,n&&(r.inScheme=[n]);let o=e.matchedPrefLabel||e.prefLabel||e.label;if(typeof o=="string")r.prefLabel||(r.prefLabel={}),r.prefLabel[s]=o;else{o&&!Array.isArray(o)&&(o=[o]);for(let m of o||[])r.prefLabel||(r.prefLabel={}),r.prefLabel[m.lang]=m.value}let a=e.altLabel;if(typeof a=="string")r.altLabel||(r.altLabel={}),r.altLabel[s]=a;else{a&&!Array.isArray(a)&&(a=[a]);for(let m of a||[])(c=r==null?void 0:r.altLabel)!=null&&c[m.lang]?(r.altLabel[m.lang].push(m.value),r.altLabel[m.lang]=[...new Set(r.altLabel[m.lang])]):(r.altLabel||(r.altLabel={}),r.altLabel[m.lang]=[m.value])}let u=e.notation||e["skos:notation"]||P.notation(r);u&&(r.notation=[u.value||u]),e.broader&&(Array.isArray(e.broader)||(e.broader=[e.broader]),r.broader=e.broader.map(m=>typeof m=="string"?{uri:m}:m)),e.hasChildren===!0?r.narrower=[null]:e.hasChildren===!1&&(r.narrower=[]),e.type&&!Array.isArray(e.type)&&(e.type=[e.type]),r.type=r.type||[];for(let m of e.type||[]){if(!P.isValidUri(m))continue;let g=m.slice(0,m.indexOf(":"));i&&i["@context"]&&i["@context"][g]&&(m=m.replace(g+":",i["@context"][g])),r.type.push(m)}r.type=[...new Set(r.type)],r.type.length||(r.type=["http://www.w3.org/2004/02/skos/core#Concept"]);let l={"skos:definition":"definition","skos:note":"note","skos:scopeNote":"scopeNote","skos:example":"example","skos:historyNote":"historyNote","skos:editorialNote":"editorialNote","skos:changeNote":"changeNote"};for(let m in l){let g=e[m]||[];if(Array.isArray(g)||(g=[g]),g.length){r[l[m]]={};for(let{lang:f,value:d}of g)f&&d&&((p=r[l[m]])[f]||(p[f]=[]),r[l[m]][f].push(d))}}return r}getSchemes(){return E(this,arguments,function*(r={}){var e=W(r,[]);let n=[];for(let i of this.schemes||[]){let s=this._getApiUrl(i,"/"),a=(yield this.axios(L(R({},e),{method:"get",url:s}))).conceptschemes.find(l=>P.compare(l,i)),u=a&&(a.prefLabel||a.label||a.title);u&&(i.prefLabel||(i.prefLabel={}),i.prefLabel[this._language]=u),n.push(i),this._approvedSchemes=this._approvedSchemes||[],this._approvedSchemes.find(l=>P.compare(i,l))||this._approvedSchemes.push({uri:a.uri,identifier:P.getAllUris(i)})}return n})}getTop(n){return E(this,null,function*(){var i=n,{scheme:e}=i,r=W(i,["scheme"]);let s=this._getApiUrl(e,"/topConcepts"),o=yield this._getSchemeUri(e);if(!o)throw new U({parameter:"scheme",message:"Missing or unsupported scheme or VOCID property on scheme"});r.params||(r.params={}),r.params.scheme=o;let a=yield this.axios(L(R({},r),{method:"get",url:s})),u=[];for(let l of a.topconcepts||[]){let c=this._toJskosConcept(l,{scheme:e,language:this._language});c.topConceptOf=[e],u.push(c)}return u})}getConcepts(n){return E(this,null,function*(){var i=n,{concepts:e}=i,r=W(i,["concepts"]);var o,a;Array.isArray(e)||(e=[e]),e=e.map(u=>({uri:u.uri,inScheme:u.inScheme}));let s=[];for(let u of e){if(!u||!u.uri)throw new U({parameter:"concept",message:"Missing concept URI"});let l={uri:u.uri,format:"application/json"},c=this._getApiUrl((o=u==null?void 0:u.inScheme)==null?void 0:o[0],"/data",l);if(!c)continue;let p=yield this.axios(L(R({},r),{method:"get",url:c})),m=(a=p==null?void 0:p.graph)==null?void 0:a.find(g=>P.compare(g,u));if(m){let g=this._toJskosConcept(m,{concept:u,result:p});for(let f of["broader","narrower"]){let d=m[f]||g[f];d&&!Array.isArray(d)&&(d=[d]),d||(d=[]),g[f]=d.map(y=>this._toJskosConcept(p.graph.find(O=>P.compare(O,y)),{scheme:u.inScheme[0],result:p}))}g.ancestors=[],s.push(g)}}return s})}getNarrower(n){return E(this,null,function*(){var i=n,{concept:e}=i,r=W(i,["concept"]);if(!e||!e.uri)throw new U({parameter:"concept"});let s=e.inScheme[0],o=this._getApiUrl(s,"/children");return r.params||(r.params={}),r.params.uri=e.uri,((yield this.axios(L(R({},r),{method:"get",url:o}))).narrower||[]).map(l=>this._toJskosConcept(l,{scheme:s}))})}getAncestors(n){return E(this,null,function*(){var i=n,{concept:e}=i,r=W(i,["concept"]);var p,m,g,f;if(!e||!e.uri)throw new U({parameter:"concept"});let s=e.inScheme[0],o=this._getApiUrl(s,"/broaderTransitive");r.params||(r.params={}),r.params.uri=e.uri;let a=yield this.axios(L(R({},r),{method:"get",url:o})),u=[],l=e.uri;for(;l;){if(l!=e.uri){let d=(p=a==null?void 0:a.broaderTransitive)==null?void 0:p[l];u=u.concat([d])}l=(f=(g=(m=a==null?void 0:a.broaderTransitive)==null?void 0:m[l])==null?void 0:g.broader)==null?void 0:f[0]}return u.map(d=>this._toJskosConcept(d,{scheme:s})).filter(d=>d.uri!=e.uri)})}search(o){return E(this,null,function*(){var a=o,{search:e,scheme:r,limit:n,types:i=[]}=a,s=W(a,["search","scheme","limit","types"]);let u=this._getApiUrl(r,"/search");return s.params||(s.params={}),s.params.query=`${e}*`,s.params.unique=1,s.params.maxhits=n||100,s.params.type=i.join(" "),((yield this.axios(L(R({},s),{method:"get",url:u}))).results||[]).map(p=>this._toJskosConcept(p,{scheme:r}))})}getTypes(n){return E(this,null,function*(){var i=n,{scheme:e}=i,r=W(i,["scheme"]);let s=this._getApiUrl(e,"/types"),o=[],a=yield this.axios(L(R({},r),{method:"get",url:s}));for(let u of(a==null?void 0:a.types)||[])u.uri!="http://www.w3.org/2004/02/skos/core#Concept"&&(u.label&&(u.prefLabel={[a["@context"]["@language"]]:u.label},delete u.label),o.push(u));return o._url=s,o})}};ee(He,"supports",{scheme:!0,top:!0,data:!0,concepts:!0,narrower:!0,ancestors:!0,types:!0,suggest:!0,search:!0});He.providerName="SkosmosApi";He.providerType="http://bartoc.org/api-type/skosmos";var Gr="http://id.loc.gov/authorities/",Xr=[{uri:`${Gr}subjects`,identifier:["http://bartoc.org/en/node/454"],notation:["LCSH"],concepts:[null],topConcepts:[]},{uri:`${Gr}names`,identifier:["http://bartoc.org/en/node/18536"],notation:["LCNAF"],concepts:[null],topConcepts:[]}],po=`${Gr}classification`;function mo(t){let e={};e.uri=t["@id"],e.notation=(t["http://www.loc.gov/mads/rdf/v1#code"]||[]).map(i=>i["@value"]);let r=t["http://www.loc.gov/mads/rdf/v1#authoritativeLabel"]||t["http://www.w3.org/2000/01/rdf-schema#label"]||[];r.length&&(e.prefLabel={},e.prefLabel[r[0]["@language"]||"en"]=r[0]["@value"]);let n=t["http://www.w3.org/2004/02/skos/core#altLabel"]||[];n.length&&(e.altLabel={en:n.map(i=>i["@value"])});for(let i of t["http://www.w3.org/2000/01/rdf-schema#comment"]||[])e.definition=e.definition||{},e.definition.en=e.definition.en||[],e.definition.en.push(i["@value"]);return e}function $l(t){let e=mo(t);return e.namespace=e.uri+"/",e.type=["http://www.w3.org/2004/02/skos/core#ConceptScheme"],e}var gi=t=>e=>!e||!t||!t.namespace?!0:e.uri.startsWith(t.namespace);function Wl(t,{scheme:e}){let r=mo(t);r.type=["http://www.w3.org/2004/02/skos/core#Concept"],r.inScheme=e?[e]:(t["http://www.loc.gov/mads/rdf/v1#isMemberOfMADSScheme"]||[]).map(s=>Xr.find(o=>o.uri===s["@id"])),(!r.inScheme.length||!r.inScheme[0])&&delete r.inScheme;let n=t["http://www.loc.gov/mads/rdf/v1#hasNarrowerAuthority"]||P.compare(r.inScheme[0],{uri:po})&&t["http://www.loc.gov/mads/rdf/v1#hasMADSCollectionMember"]||[];r.narrower=n.map(s=>({uri:s["@id"]})).filter(gi(r.inScheme&&r.inScheme[0]));let i=t["http://www.loc.gov/mads/rdf/v1#hasBroaderAuthority"]||P.compare(r.inScheme[0],{uri:po})&&t["http://www.loc.gov/mads/rdf/v1#isMemberOfMADSCollection"]||[];return r.broader=i.map(s=>({uri:s["@id"]})).filter(gi(r.inScheme&&r.inScheme[0])),r}var qe=class extends G{static _registryConfigForBartocApiConfig({scheme:e}={}){return!e||!Xr.find(r=>P.compare(r,e))?null:{schemes:[e]}}getSchemes(){return E(this,null,function*(){let e=[];for(let r of yield Promise.all(Xr.filter(n=>!this.schemes||!this.schemes.length||this.schemes.find(i=>P.compare(n,i))).map(n=>pe({method:"get",url:`${n.uri.replace("http:","https:")}.json`}).then(({status:i,data:s})=>{if(i===200){let o=s.find(a=>n.uri===a["@id"]);if(o)return o=P.merge($l(o),n),o.topConcepts=(o.topConcepts||[]).filter(a=>a),o}return null}))))r&&e.push(r);return e})}getConcepts(r){return E(this,arguments,function*({concepts:e}){Array.isArray(e)||(e=[e]);let n=[];for(let i of yield Promise.all(e.map(s=>pe({method:"get",url:`${s.uri.replace("http:","https:")}.json`}).then(({status:o,data:a})=>{if(o===200){let u=a.find(l=>s.uri===l["@id"]);return u?Wl(u,{scheme:s.inScheme&&s.inScheme[0]}):null}}))))i&&n.push(i);return n})}suggest(e){return E(this,null,function*(){let r=yield this.search(e);return[e.search,r.map(n=>P.prefLabel(n,{fallbackToUri:!0})),[],r.map(n=>n.uri)]})}search(s){return E(this,arguments,function*({search:e,scheme:r,limit:n,offset:i}){let o=P.getAllUris(r).find(u=>u.startsWith(Gr));if(!o||!Xr.find(u=>P.compare(u,{uri:o})))throw new U({parameter:"scheme",message:"provided scheme is not supported (yet)"});if(!e)throw new U({parameter:"search",message:"parameter is empty or missing"});n=n||this._jskos.suggestResultLimit||100,i=i||0;let{data:a}=yield pe({method:"get",url:`${o}/suggest2`.replace("http:","https:"),params:{q:e,count:n||100,offset:i,searchtype:"keyword"}});return(a.hits||[]).map(u=>({uri:u.uri,notation:[u.token],prefLabel:{en:u.aLabel},inScheme:[r]})).filter(gi(r))})}};ee(qe,"supports",{schemes:!0,top:!1,data:!0,concepts:!0,narrower:!1,ancestors:!1,suggest:!0,search:!0});qe.providerName="LocApi";qe.providerType="http://bartoc.org/api-type/loc";var ko={};var H;function ye(t,e,r){let n=typeof r,i=typeof t;if(n!=="undefined"){if(i!=="undefined"){if(r){if(i==="function"&&n===i)return function(a){return t(r(a))};if(e=t.constructor,e===r.constructor){if(e===Array)return r.concat(t);if(e===Map){var s=new Map(r);for(var o of t)s.set(o[0],o[1]);return s}if(e===Set){o=new Set(r);for(s of t.values())o.add(s);return o}}}return t}return r}return i==="undefined"?e:t}function Bt(t,e){return typeof t=="undefined"?e:t}function le(){return Object.create(null)}function Pe(t){return typeof t=="string"}function _r(t){return typeof t=="object"}function br(t,e){if(Pe(e))t=t[e];else for(let r=0;t&&r<e.length;r++)t=t[e[r]];return t}var Hl=/[^\p{L}\p{N}]+/u,ql=/(\d{3})/g,Vl=/(\D)(\d{3})/g,Jl=/(\d{3})(\D)/g,go=/[\u0300-\u036f]/g;function $t(t={}){if(!this||this.constructor!==$t)return new $t(...arguments);if(arguments.length)for(t=0;t<arguments.length;t++)this.assign(arguments[t]);else this.assign(t)}H=$t.prototype;H.assign=function(t){this.normalize=ye(t.normalize,!0,this.normalize);let e=t.include,r=e||t.exclude||t.split,n;if(r||r===""){if(typeof r=="object"&&r.constructor!==RegExp){let i="";n=!e,e||(i+="\\p{Z}"),r.letter&&(i+="\\p{L}"),r.number&&(i+="\\p{N}",n=!!e),r.symbol&&(i+="\\p{S}"),r.punctuation&&(i+="\\p{P}"),r.control&&(i+="\\p{C}"),(r=r.char)&&(i+=typeof r=="object"?r.join(""):r);try{this.split=new RegExp("["+(e?"^":"")+i+"]+","u")}catch(s){this.split=/\s+/}}else this.split=r,n=r===!1||"a1a".split(r).length<2;this.numeric=ye(t.numeric,n)}else{try{this.split=ye(this.split,Hl)}catch(i){this.split=/\s+/}this.numeric=ye(t.numeric,ye(this.numeric,!0))}if(this.prepare=ye(t.prepare,null,this.prepare),this.finalize=ye(t.finalize,null,this.finalize),r=t.filter,this.filter=typeof r=="function"?r:ye(r&&new Set(r),null,this.filter),this.dedupe=ye(t.dedupe,!0,this.dedupe),this.matcher=ye((r=t.matcher)&&new Map(r),null,this.matcher),this.mapper=ye((r=t.mapper)&&new Map(r),null,this.mapper),this.stemmer=ye((r=t.stemmer)&&new Map(r),null,this.stemmer),this.replacer=ye(t.replacer,null,this.replacer),this.minlength=ye(t.minlength,1,this.minlength),this.maxlength=ye(t.maxlength,1024,this.maxlength),this.rtl=ye(t.rtl,!1,this.rtl),(this.cache=r=ye(t.cache,!0,this.cache))&&(this.F=null,this.L=typeof r=="number"?r:2e5,this.B=new Map,this.D=new Map,this.I=this.H=128),this.h="",this.J=null,this.A="",this.K=null,this.matcher)for(let i of this.matcher.keys())this.h+=(this.h?"|":"")+i;if(this.stemmer)for(let i of this.stemmer.keys())this.A+=(this.A?"|":"")+i;return this};H.addStemmer=function(t,e){return this.stemmer||(this.stemmer=new Map),this.stemmer.set(t,e),this.A+=(this.A?"|":"")+t,this.K=null,this.cache&&_t(this),this};H.addFilter=function(t){return typeof t=="function"?this.filter=t:(this.filter||(this.filter=new Set),this.filter.add(t)),this.cache&&_t(this),this};H.addMapper=function(t,e){return typeof t=="object"?this.addReplacer(t,e):t.length>1?this.addMatcher(t,e):(this.mapper||(this.mapper=new Map),this.mapper.set(t,e),this.cache&&_t(this),this)};H.addMatcher=function(t,e){return typeof t=="object"?this.addReplacer(t,e):t.length<2&&(this.dedupe||this.mapper)?this.addMapper(t,e):(this.matcher||(this.matcher=new Map),this.matcher.set(t,e),this.h+=(this.h?"|":"")+t,this.J=null,this.cache&&_t(this),this)};H.addReplacer=function(t,e){return typeof t=="string"?this.addMatcher(t,e):(this.replacer||(this.replacer=[]),this.replacer.push(t,e),this.cache&&_t(this),this)};H.encode=function(t,e){if(this.cache&&t.length<=this.H)if(this.F){if(this.B.has(t))return this.B.get(t)}else this.F=setTimeout(_t,50,this);this.normalize&&(typeof this.normalize=="function"?t=this.normalize(t):t=go?t.normalize("NFKD").replace(go,"").toLowerCase():t.toLowerCase()),this.prepare&&(t=this.prepare(t)),this.numeric&&t.length>3&&(t=t.replace(Vl,"$1 $2").replace(Jl,"$1 $2").replace(ql,"$1 "));let r=!(this.dedupe||this.mapper||this.filter||this.matcher||this.stemmer||this.replacer),n=[],i=le(),s,o,a=this.split||this.split===""?t.split(this.split):[t];for(let l=0,c,p;l<a.length;l++)if((c=p=a[l])&&!(c.length<this.minlength||c.length>this.maxlength)){if(e){if(i[c])continue;i[c]=1}else{if(s===c)continue;s=c}if(r)n.push(c);else if(!this.filter||(typeof this.filter=="function"?this.filter(c):!this.filter.has(c))){if(this.cache&&c.length<=this.I)if(this.F){var u=this.D.get(c);if(u||u===""){u&&n.push(u);continue}}else this.F=setTimeout(_t,50,this);if(this.stemmer){this.K||(this.K=new RegExp("(?!^)("+this.A+")$"));let m;for(;m!==c&&c.length>2;)m=c,c=c.replace(this.K,g=>this.stemmer.get(g))}if(c&&(this.mapper||this.dedupe&&c.length>1)){u="";for(let m=0,g="",f,d;m<c.length;m++)f=c.charAt(m),f===g&&this.dedupe||((d=this.mapper&&this.mapper.get(f))||d===""?d===g&&this.dedupe||!(g=d)||(u+=d):u+=g=f);c=u}if(this.matcher&&c.length>1&&(this.J||(this.J=new RegExp("("+this.h+")","g")),c=c.replace(this.J,m=>this.matcher.get(m))),c&&this.replacer)for(u=0;c&&u<this.replacer.length;u+=2)c=c.replace(this.replacer[u],this.replacer[u+1]);if(this.cache&&p.length<=this.I&&(this.D.set(p,c),this.D.size>this.L&&(this.D.clear(),this.I=this.I/1.1|0)),c){if(c!==p)if(e){if(i[c])continue;i[c]=1}else{if(o===c)continue;o=c}n.push(c)}}}return this.finalize&&(n=this.finalize(n)||n),this.cache&&t.length<=this.H&&(this.B.set(t,n),this.B.size>this.L&&(this.B.clear(),this.H=this.H/1.1|0)),n};function _t(t){t.F=null,t.B.clear(),t.D.clear()}function Ei(t,e,r){r||(e||typeof t!="object"?typeof e=="object"&&(r=e,e=0):r=t),r&&(t=r.query||t,e=r.limit||e);let n=""+(e||0);r&&(n+=(r.offset||0)+!!r.context+!!r.suggest+(r.resolve!==!1)+(r.resolution||this.resolution)+(r.boost||0)),t=(""+t).toLowerCase(),this.cache||(this.cache=new St);let i=this.cache.get(t+n);if(!i){let s=r&&r.cache;s&&(r.cache=!1),i=this.search(t,e,r),s&&(r.cache=s),this.cache.set(t+n,i)}return i}function St(t){this.limit=t&&t!==!0?t:1e3,this.cache=new Map,this.h=""}St.prototype.set=function(t,e){this.cache.set(this.h=t,e),this.cache.size>this.limit&&this.cache.delete(this.cache.keys().next().value)};St.prototype.get=function(t){let e=this.cache.get(t);return e&&this.h!==t&&(this.cache.delete(t),this.cache.set(this.h=t,e)),e};St.prototype.remove=function(t){for(let e of this.cache){let r=e[0];e[1].includes(t)&&this.cache.delete(r)}};St.prototype.clear=function(){this.cache.clear(),this.h=""};var wo={normalize:!1,numeric:!1,dedupe:!1},Qr={},yi=new Map([["b","p"],["v","f"],["w","f"],["z","s"],["x","s"],["d","t"],["n","m"],["c","k"],["g","k"],["j","k"],["q","k"],["i","e"],["y","e"],["u","o"]]),yo=new Map([["ae","a"],["oe","o"],["sh","s"],["kh","k"],["th","t"],["ph","f"],["pf","f"]]),_o=[/([^aeo])h(.)/g,"$1$2",/([aeo])h([^aeo]|$)/g,"$1$2",/(.)\1+/g,"$1"],bo={a:"",e:"",i:"",o:"",u:"",y:"",b:1,f:1,p:1,v:1,c:2,g:2,j:2,k:2,q:2,s:2,x:2,z:2,\u00DF:2,d:3,t:3,l:4,m:5,n:5,r:6},Ai={Exact:wo,Default:Qr,Normalize:Qr,LatinBalance:{mapper:yi},LatinAdvanced:{mapper:yi,matcher:yo,replacer:_o},LatinExtra:{mapper:yi,replacer:_o.concat([/(?!^)[aeo]/g,""]),matcher:yo},LatinSoundex:{dedupe:!1,include:{letter:!0},finalize:function(t){for(let r=0;r<t.length;r++){var e=t[r];let n=e.charAt(0),i=bo[n];for(let s=1,o;s<e.length&&(o=e.charAt(s),o==="h"||o==="w"||!(o=bo[o])||o===i||(n+=o,i=o,n.length!==4));s++);t[r]=n}}},CJK:{split:""},LatinExact:wo,LatinDefault:Qr,LatinSimple:Qr};function vo(t,e,r,n){let i=[];for(let s=0,o;s<t.index.length;s++)if(o=t.index[s],e>=o.length)e-=o.length;else{e=o[n?"splice":"slice"](e,r);let a=e.length;if(a&&(i=i.length?i.concat(e):e,r-=a,n&&(t.length-=a),!r))break;e=0}return i}function Wt(t){if(!this||this.constructor!==Wt)return new Wt(t);this.index=t?[t]:[],this.length=t?t.length:0;let e=this;return new Proxy([],{get(r,n){if(n==="length")return e.length;if(n==="push")return function(i){e.index[e.index.length-1].push(i),e.length++};if(n==="pop")return function(){if(e.length)return e.length--,e.index[e.index.length-1].pop()};if(n==="indexOf")return function(i){let s=0;for(let o=0,a,u;o<e.index.length;o++){if(a=e.index[o],u=a.indexOf(i),u>=0)return s+u;s+=a.length}return-1};if(n==="includes")return function(i){for(let s=0;s<e.index.length;s++)if(e.index[s].includes(i))return!0;return!1};if(n==="slice")return function(i,s){return vo(e,i||0,s||e.length,!1)};if(n==="splice")return function(i,s){return vo(e,i||0,s||e.length,!0)};if(n==="constructor")return Array;if(typeof n!="symbol")return(r=e.index[n/rt(2,31)|0])&&r[n]},set(r,n,i){return r=n/rt(2,31)|0,(e.index[r]||(e.index[r]=[]))[n]=i,e.length++,!0}})}Wt.prototype.clear=function(){this.index.length=0};Wt.prototype.push=function(){};function De(t=8){if(!this||this.constructor!==De)return new De(t);this.index=le(),this.h=[],this.size=0,t>32?(this.B=Io,this.A=BigInt(t)):(this.B=Ro,this.A=t)}De.prototype.get=function(t){let e=this.index[this.B(t)];return e&&e.get(t)};De.prototype.set=function(t,e){var r=this.B(t);let n=this.index[r];n?(r=n.size,n.set(t,e),(r-=n.size)&&this.size++):(this.index[r]=n=new Map([[t,e]]),this.h.push(n),this.size++)};function Me(t=8){if(!this||this.constructor!==Me)return new Me(t);this.index=le(),this.h=[],this.size=0,t>32?(this.B=Io,this.A=BigInt(t)):(this.B=Ro,this.A=t)}Me.prototype.add=function(t){var e=this.B(t);let r=this.index[e];r?(e=r.size,r.add(t),(e-=r.size)&&this.size++):(this.index[e]=r=new Set([t]),this.h.push(r),this.size++)};H=De.prototype;H.has=Me.prototype.has=function(t){let e=this.index[this.B(t)];return e&&e.has(t)};H.delete=Me.prototype.delete=function(t){let e=this.index[this.B(t)];e&&e.delete(t)&&this.size--};H.clear=Me.prototype.clear=function(){this.index=le(),this.h=[],this.size=0};H.values=Me.prototype.values=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].values())yield e};H.keys=Me.prototype.keys=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].keys())yield e};H.entries=Me.prototype.entries=function*(){for(let t=0;t<this.h.length;t++)for(let e of this.h[t].entries())yield e};function Ro(t){let e=rt(2,this.A)-1;if(typeof t=="number")return t&e;let r=0,n=this.A+1;for(let i=0;i<t.length;i++)r=(r*n^t.charCodeAt(i))&e;return this.A===32?r+rt(2,31):r}function Io(t){let e=rt(BigInt(2),this.A)-BigInt(1);var r=typeof t;if(r==="bigint")return t&e;if(r==="number")return BigInt(t)&e;r=BigInt(0);let n=this.A+BigInt(1);for(let i=0;i<t.length;i++)r=(r*n^BigInt(t.charCodeAt(i)))&e;return r}var jt,yr;function Kl(t){return E(this,null,function*(){t=t.data;var e=t.task;let r=t.id,n=t.args;if(e==="init")yr=t.options||{},(e=t.factory)?(Function("return "+e)()(self),jt=new self.FlexSearch.Index(yr),delete self.FlexSearch):jt=new Ne(yr),postMessage({id:r});else{let i;e==="export"&&(n[1]?(n[0]=yr.export,n[2]=0,n[3]=1):n=null),e==="import"?n[0]&&(t=yield yr.import.call(jt,n[0]),jt.import(n[0],t)):((i=n&&jt[e].apply(jt,n))&&i.then&&(i=yield i),i&&i.await&&(i=yield i.await),e==="search"&&i.result&&(i=i.result)),postMessage(e==="search"?{id:r,msg:i}:{id:r})}})}function Ci(t){Ut.call(t,"add"),Ut.call(t,"append"),Ut.call(t,"search"),Ut.call(t,"update"),Ut.call(t,"remove"),Ut.call(t,"searchCache")}var bi,So,tn;function Yl(){bi=tn=0}function Ut(t){this[t+"Async"]=function(){let e=arguments;var r=e[e.length-1];let n;if(typeof r=="function"&&(n=r,delete e[e.length-1]),bi?tn||(tn=Date.now()-So>=this.priority*this.priority*3):(bi=setTimeout(Yl,0),So=Date.now()),tn){let s=this;return new Promise(o=>{setTimeout(function(){o(s[t+"Async"].apply(s,e))},0)})}let i=this[t].apply(this,e);return r=i.then?i:new Promise(s=>s(i)),n&&r.then(n),r}}var ot=0;function bt(t={},e){function r(a){function u(l){l=l.data||l;let c=l.id,p=c&&s.h[c];p&&(p(l.msg),delete s.h[c])}if(this.worker=a,this.h=le(),this.worker)return i?this.worker.on("message",u):this.worker.onmessage=u,t.config?new Promise(function(l){ot>1e9&&(ot=0),s.h[++ot]=function(){l(s)},s.worker.postMessage({id:ot,task:"init",factory:n,options:t})}):(this.priority=t.priority||4,this.encoder=e||null,this.worker.postMessage({task:"init",factory:n,options:t}),this)}if(!this||this.constructor!==bt)return new bt(t);let n=typeof self!="undefined"?self._factory:typeof window!="undefined"?window._factory:null;n&&(n=n.toString());let i=typeof window=="undefined",s=this,o=Xl(n,i,t.worker);return o.then?o.then(function(a){return r.call(s,a)}):r.call(this,o)}at("add");at("append");at("search");at("update");at("remove");at("clear");at("export");at("import");bt.prototype.searchCache=Ei;Ci(bt.prototype);function at(t){bt.prototype[t]=function(){let e=this,r=[].slice.call(arguments);var n=r[r.length-1];let i;return typeof n=="function"&&(i=n,r.pop()),n=new Promise(function(s){t==="export"&&typeof r[0]=="function"&&(r[0]=null),ot>1e9&&(ot=0),e.h[++ot]=s,e.worker.postMessage({task:t,id:ot,args:r})}),i?(n.then(i),this):n}}function Xl(t,e,r){return e?typeof module!="undefined"?new(wi()).Worker(__dirname+"/worker/node.js"):Promise.resolve().then(()=>ns(wi(),1)).then(function(n){return new n.Worker(ko.dirname+"/node/node.mjs")}):t?new window.Worker(URL.createObjectURL(new Blob(["onmessage="+Kl.toString()],{type:"text/javascript"}))):new window.Worker(typeof r=="string"?r:ko.url.replace("/worker.js","/worker/worker.js").replace("flexsearch.bundle.module.min.js","module/worker/worker.js").replace("flexsearch.bundle.module.min.mjs","module/worker/worker.js"),{type:"module"})}vt.prototype.add=function(t,e,r){if(_r(t)&&(e=t,t=br(e,this.key)),e&&(t||t===0)){if(!r&&this.reg.has(t))return this.update(t,e);for(let a=0,u;a<this.field.length;a++){u=this.B[a];var n=this.index.get(this.field[a]);if(typeof u=="function"){var i=u(e);i&&n.add(t,i,r,!0)}else i=u.G,(!i||i(e))&&(u.constructor===String?u=[""+u]:Pe(u)&&(u=[u]),Si(e,u,this.D,0,n,t,u[0],r))}if(this.tag)for(n=0;n<this.A.length;n++){var s=this.A[n];i=this.tag.get(this.F[n]);let a=le();if(typeof s=="function"){if(s=s(e),!s)continue}else{var o=s.G;if(o&&!o(e))continue;s.constructor===String&&(s=""+s),s=br(e,s)}if(i&&s){Pe(s)&&(s=[s]);for(let u=0,l,c;u<s.length;u++)if(l=s[u],!a[l]&&(a[l]=1,(o=i.get(l))?c=o:i.set(l,c=[]),!r||!c.includes(t))){if(c.length===rt(2,31)-1){if(o=new Wt(c),this.fastupdate)for(let p of this.reg.values())p.includes(c)&&(p[p.indexOf(c)]=o);i.set(l,c=o)}c.push(t),this.fastupdate&&((o=this.reg.get(t))?o.push(c):this.reg.set(t,[c]))}}}if(this.store&&(!r||!this.store.has(t))){let a;if(this.h){a=le();for(let u=0,l;u<this.h.length;u++){if(l=this.h[u],(r=l.G)&&!r(e))continue;let c;if(typeof l=="function"){if(c=l(e),!c)continue;l=[l.O]}else if(Pe(l)||l.constructor===String){a[l]=e[l];continue}vi(e,a,l,0,l[0],c)}}this.store.set(t,a||e)}this.worker&&(this.fastupdate||this.reg.add(t))}return this};function vi(t,e,r,n,i,s){if(t=t[i],n===r.length-1)e[i]=s||t;else if(t)if(t.constructor===Array)for(e=e[i]=Array(t.length),i=0;i<t.length;i++)vi(t,e,r,n,i);else e=e[i]||(e[i]=le()),i=r[++n],vi(t,e,r,n,i)}function Si(t,e,r,n,i,s,o,a){if(t=t[o])if(n===e.length-1){if(t.constructor===Array){if(r[n]){for(e=0;e<t.length;e++)i.add(s,t[e],!0,!0);return}t=t.join(" ")}i.add(s,t,a,!0)}else if(t.constructor===Array)for(o=0;o<t.length;o++)Si(t,e,r,n,i,s,o,a);else o=e[++n],Si(t,e,r,n,i,s,o,a)}function Oi(t,e,r,n){if(!t.length)return t;if(t.length===1)return t=t[0],t=r||t.length>e?t.slice(r,r+e):t,n?zt.call(this,t):t;let i=[];for(let s=0,o,a;s<t.length;s++)if((o=t[s])&&(a=o.length)){if(r){if(r>=a){r-=a;continue}o=o.slice(r,r+e),a=o.length,r=0}if(a>e&&(o=o.slice(0,e),a=e),!i.length&&a>=e)return n?zt.call(this,o):o;if(i.push(o),e-=a,!e)break}return i=i.length>1?[].concat.apply([],i):i[0],n?zt.call(this,i):i}function ln(t,e,r,n){var i=n[0];if(i[0]&&i[0].query)return t[e].apply(t,i);if(!(e!=="and"&&e!=="not"||t.result.length||t.await||i.suggest))return n.length>1&&(i=n[n.length-1]),(n=i.resolve)?t.await||t.result:t;let s=[],o=0,a=0,u,l,c,p,m;for(e=0;e<n.length;e++)if(i=n[e]){var g=void 0;if(i.constructor===oe)g=i.await||i.result;else if(i.then||i.constructor===Array)g=i;else{o=i.limit||0,a=i.offset||0,c=i.suggest,l=i.resolve,u=((p=i.highlight||t.highlight)||i.enrich)&&l,g=i.queue;let f=i.async||g,d=i.index,y=i.query;if(d?t.index||(t.index=d):d=t.index,y||i.tag){let O=i.field||i.pluck;if(O&&(!y||t.query&&!p||(t.query=y,t.field=O,t.highlight=p),d=d.index.get(O)),g&&(m||t.await)){m=1;let I,C=t.C.length,F=new Promise(function(N){I=N});(function(N,S){F.h=function(){S.index=null,S.resolve=!1;let k=f?N.searchAsync(S):N.search(S);return k.then?k.then(function(D){return t.C[C]=D=D.result||D,I(D),D}):(k=k.result||k,I(k),k)}})(d,Object.assign({},i)),t.C.push(F),s[e]=F;continue}else i.resolve=!1,i.index=null,g=f?d.searchAsync(i):d.search(i),i.resolve=l,i.index=d}else if(i.and)g=Zr(i,"and",d);else if(i.or)g=Zr(i,"or",d);else if(i.not)g=Zr(i,"not",d);else if(i.xor)g=Zr(i,"xor",d);else continue}g.await?(m=1,g=g.await):g.then?(m=1,g=g.then(function(f){return f.result||f})):g=g.result||g,s[e]=g}if(m&&!t.await&&(t.await=new Promise(function(f){t.return=f})),m){let f=Promise.all(s).then(function(d){for(let y=0;y<t.C.length;y++)if(t.C[y]===f){t.C[y]=function(){return r.call(t,d,o,a,u,l,c,p)};break}ki(t)});t.C.push(f)}else if(t.await)t.C.push(function(){return r.call(t,s,o,a,u,l,c,p)});else return r.call(t,s,o,a,u,l,c,p);return l?t.await||t.result:t}function Zr(t,e,r){t=t[e];let n=t[0]||t;return n.index||(n.index=r),r=new oe(n),t.length>1&&(r=r[e].apply(r,t.slice(1))),r}oe.prototype.or=function(){return ln(this,"or",Gl,arguments)};function Gl(t,e,r,n,i,s,o){return t.length&&(this.result.length&&t.push(this.result),t.length<2?this.result=t[0]:(this.result=To(t,e,r,!1,this.h),r=0)),i&&(this.await=null),i?this.resolve(e,r,n,o):this}oe.prototype.and=function(){return ln(this,"and",Ql,arguments)};function Ql(t,e,r,n,i,s,o){if(!s&&!this.result.length)return i?this.result:this;let a;if(t.length)if(this.result.length&&t.unshift(this.result),t.length<2)this.result=t[0];else{let u=0;for(let l=0,c,p;l<t.length;l++)if((c=t[l])&&(p=c.length))u<p&&(u=p);else if(!s){u=0;break}u?(this.result=nn(t,u,e,r,s,this.h,i),a=!0):this.result=[]}else s||(this.result=t);return i&&(this.await=null),i?this.resolve(e,r,n,o,a):this}oe.prototype.xor=function(){return ln(this,"xor",Zl,arguments)};function Zl(t,e,r,n,i,s,o){if(t.length)if(this.result.length&&t.unshift(this.result),t.length<2)this.result=t[0];else{e:{s=r;var a=this.h;let u=[],l=le(),c=0;for(let p=0,m;p<t.length;p++)if(m=t[p]){c<m.length&&(c=m.length);for(let g=0,f;g<m.length;g++)if(f=m[g])for(let d=0,y;d<f.length;d++)y=f[d],l[y]=l[y]?2:1}for(let p=0,m,g=0;p<c;p++)for(let f=0,d;f<t.length;f++)if((d=t[f])&&(m=d[p])){for(let y=0,O;y<m.length;y++)if(O=m[y],l[O]===1)if(s)s--;else if(i){if(u.push(O),u.length===e){t=u;break e}}else{let I=p+(f?a:0);if(u[I]||(u[I]=[]),u[I].push(O),++g===e){t=u;break e}}}t=u}this.result=t,a=!0}else s||(this.result=t);return i&&(this.await=null),i?this.resolve(e,r,n,o,a):this}oe.prototype.not=function(){return ln(this,"not",ec,arguments)};function ec(t,e,r,n,i,s,o){if(!s&&!this.result.length)return i?this.result:this;if(t.length&&this.result.length){e:{s=r;var a=[];t=new Set(t.flat().flat());for(let u=0,l,c=0;u<this.result.length;u++)if(l=this.result[u]){for(let p=0,m;p<l.length;p++)if(m=l[p],!t.has(m)){if(s)s--;else if(i){if(a.push(m),a.length===e){t=a;break e}}else if(a[u]||(a[u]=[]),a[u].push(m),++c===e){t=a;break e}}}t=a}this.result=t,a=!0}return i&&(this.await=null),i?this.resolve(e,r,n,o,a):this}function rn(t,e,r,n,i){let s,o,a;typeof i=="string"?(s=i,i=""):s=i.template,o=s.indexOf("$1"),a=s.substring(o+2),o=s.substring(0,o);let u=i&&i.boundary,l=!i||i.clip!==!1,c=i&&i.merge&&a&&o&&new RegExp(a+" "+o,"g");i=i&&i.ellipsis;var p=0;if(typeof i=="object"){var m=i.template;p=m.length-2,i=i.pattern}typeof i!="string"&&(i=i===!1?"":"..."),p&&(i=m.replace("$1",i)),m=i.length-p;let g,f;typeof u=="object"&&(g=u.before,g===0&&(g=-1),f=u.after,f===0&&(f=-1),u=u.total||9e5),p=new Map;for(let lt=0,be,Vt,ct;lt<e.length;lt++){let ft;if(n)ft=e,ct=n;else{var d=e[lt];if(ct=d.field,!ct)continue;ft=d.result}Vt=r.get(ct),be=Vt.encoder,d=p.get(be),typeof d!="string"&&(d=be.encode(t),p.set(be,d));for(let ve=0;ve<ft.length;ve++){var y=ft[ve].doc;if(!y||(y=br(y,ct),!y))continue;var O=y.trim().split(/\s+/);if(!O.length)continue;y="";var I=[];let ht=[];for(var C=-1,F=-1,N=0,S=0;S<O.length;S++){var k=O[S],D=be.encode(k);D=D.length>1?D.join(" "):D[0];let J;if(D&&k){for(var $=k.length,X=(be.split?k.replace(be.split,""):k).length-D.length,K="",V=0,Z=0;Z<d.length;Z++){var se=d[Z];if(se){var re=se.length;re+=X<0?0:X,V&&re<=V||(se=D.indexOf(se),se>-1&&(K=(se?k.substring(0,se):"")+o+k.substring(se,se+re)+a+(se+re<$?k.substring(se+re):""),V=re,J=!0))}}K&&(u&&(C<0&&(C=y.length+(y?1:0)),F=y.length+(y?1:0)+K.length,N+=$,ht.push(I.length),I.push({match:K})),y+=(y?" ":"")+K)}if(!J)k=O[S],y+=(y?" ":"")+k,u&&I.push({text:k});else if(u&&N>=u)break}if(N=ht.length*(s.length-2),g||f||u&&y.length-N>u)if(N=u+N-m*2,S=F-C,g>0&&(S+=g),f>0&&(S+=f),S<=N)O=g?C-(g>0?g:0):C-((N-S)/2|0),I=f?F+(f>0?f:0):O+N,l||(O>0&&y.charAt(O)!==" "&&y.charAt(O-1)!==" "&&(O=y.indexOf(" ",O),O<0&&(O=0)),I<y.length&&y.charAt(I-1)!==" "&&y.charAt(I)!==" "&&(I=y.lastIndexOf(" ",I),I<F?I=F:++I)),y=(O?i:"")+y.substring(O,I)+(I<y.length?i:"");else{for(F=[],C={},N={},S={},k={},D={},K=X=$=0,Z=V=1;;){var _e=void 0;for(let J=0,ae;J<ht.length;J++){if(ae=ht[J],K)if(X!==K){if(S[J+1])continue;if(ae+=K,C[ae]){$-=m,N[J+1]=1,S[J+1]=1;continue}if(ae>=I.length-1){if(ae>=I.length){S[J+1]=1,ae>=O.length&&(N[J+1]=1);continue}$-=m}if(y=I[ae].text,re=f&&D[J])if(re>0){if(y.length>re)if(S[J+1]=1,l)y=y.substring(0,re);else continue;(re-=y.length)||(re=-1),D[J]=re}else{S[J+1]=1;continue}if($+y.length+1<=u)y=" "+y,F[J]+=y;else if(l)_e=u-$-1,_e>0&&(y=" "+y.substring(0,_e),F[J]+=y),S[J+1]=1;else{S[J+1]=1;continue}}else{if(S[J])continue;if(ae-=X,C[ae]){$-=m,S[J]=1,N[J]=1;continue}if(ae<=0){if(ae<0){S[J]=1,N[J]=1;continue}$-=m}if(y=I[ae].text,re=g&&k[J])if(re>0){if(y.length>re)if(S[J]=1,l)y=y.substring(y.length-re);else continue;(re-=y.length)||(re=-1),k[J]=re}else{S[J]=1;continue}if($+y.length+1<=u)y+=" ",F[J]=y+F[J];else if(l)_e=y.length+1-(u-$),_e>=0&&_e<y.length&&(y=y.substring(_e)+" ",F[J]=y+F[J]),S[J]=1;else{S[J]=1;continue}}else{y=I[ae].match,g&&(k[J]=g),f&&(D[J]=f),J&&$++;let Jt;if(ae?!J&&m&&($+=m):(N[J]=1,S[J]=1),ae>=O.length-1||ae<I.length-1&&I[ae+1].match?Jt=1:m&&($+=m),$-=s.length-2,!J||$+y.length<=u)F[J]=y;else{_e=V=Z=N[J]=0;break}Jt&&(N[J+1]=1,S[J+1]=1)}$+=y.length,_e=C[ae]=1}if(_e)X===K?K++:X++;else{if(X===K?V=0:Z=0,!V&&!Z)break;V?(X++,K=X):K++}}y="";for(let J=0,ae;J<F.length;J++)ae=(N[J]?J?" ":"":(J&&!i?" ":"")+i)+F[J],y+=ae;i&&!N[F.length]&&(y+=i)}c&&(y=y.replace(c," ")),ft[ve].highlight=y}if(n)break}return e}function oe(t,e){if(!this||this.constructor!==oe)return new oe(t,e);let r=0,n,i,s,o,a,u;if(t&&t.index){let l=t;if(e=l.index,r=l.boost||0,i=l.query){s=l.field||l.pluck,o=l.highlight;let c=l.resolve;t=l.async||l.queue,l.resolve=!1,l.index=null,t=t?e.searchAsync(l):e.search(l),l.resolve=c,l.index=e,t=t.result||t}else t=[]}if(t&&t.then){let l=this;t=t.then(function(c){l.C[0]=l.result=c.result||c,ki(l)}),n=[t],t=[],a=new Promise(function(c){u=c})}this.index=e||null,this.result=t||[],this.h=r,this.C=n||[],this.await=a||null,this.return=u||null,this.highlight=o||null,this.query=i||"",this.field=s||""}H=oe.prototype;H.limit=function(t){if(this.await){let e=this;this.C.push(function(){return e.limit(t).result})}else if(this.result.length){let e=[];for(let r=0,n;r<this.result.length;r++)if(n=this.result[r])if(n.length<=t){if(e[r]=n,t-=n.length,!t)break}else{e[r]=n.slice(0,t);break}this.result=e}return this};H.offset=function(t){if(this.await){let e=this;this.C.push(function(){return e.offset(t).result})}else if(this.result.length){let e=[];for(let r=0,n;r<this.result.length;r++)(n=this.result[r])&&(n.length<=t?t-=n.length:(e[r]=n.slice(t),t=0));this.result=e}return this};H.boost=function(t){if(this.await){let e=this;this.C.push(function(){return e.boost(t).result})}else this.h+=t;return this};function ki(t,e){let r=t.result;var n=t.await;t.await=null;for(let i=0,s;i<t.C.length;i++)if(s=t.C[i]){if(typeof s=="function")r=s(),t.C[i]=r=r.result||r,i--;else if(s.h)r=s.h(),t.C[i]=r=r.result||r,i--;else if(s.then)return t.await=n}return n=t.return,t.C=[],t.return=null,e||n(r),r}H.resolve=function(t,e,r,n,i){let s=this.await?ki(this,!0):this.result;if(s.then){let o=this;return s.then(function(){return o.resolve(t,e,r,n,i)})}return s.length&&(typeof t=="object"?(n=t.highlight||this.highlight,r=!!n||t.enrich,e=t.offset,t=t.limit):(n=n||this.highlight,r=!!n||r),s=i?r?zt.call(this.index,s):s:Oi.call(this.index,s,t||100,e,r)),this.finalize(s,n)};H.finalize=function(t,e){if(t.then){let n=this;return t.then(function(i){return n.finalize(i,e)})}e&&t.length&&this.query&&(t=rn(this.query,t,this.index.index,this.field,e));let r=this.return;return this.highlight=this.index=this.result=this.C=this.await=this.return=null,this.query=this.field="",r&&r(t),t};function nn(t,e,r,n,i,s,o){let a=t.length,u=[],l,c;l=le();for(let p=0,m,g,f,d;p<e;p++)for(let y=0;y<a;y++)if(f=t[y],p<f.length&&(m=f[p]))for(let O=0;O<m.length;O++){if(g=m[O],(c=l[g])?l[g]++:(c=0,l[g]=1),d=u[c]||(u[c]=[]),!o){let I=p+(y||!i?0:s||0);d=d[I]||(d[I]=[])}if(d.push(g),o&&r&&c===a-1&&d.length-n===r)return n?d.slice(n):d}if(t=u.length)if(i)u=u.length>1?To(u,r,n,o,s):(u=u[0])&&r&&u.length>r||n?u.slice(n,r+n):u;else{if(t<a)return[];if(u=u[t-1],r||n)if(o)(u.length>r||n)&&(u=u.slice(n,r+n));else{i=[];for(let p=0,m;p<u.length;p++)if(m=u[p]){if(n&&m.length>n)n-=m.length;else if((r&&m.length>r||n)&&(m=m.slice(n,r+n),r-=m.length,n&&(n-=m.length)),i.push(m),!r)break}u=i}}return u}function To(t,e,r,n,i){let s=[],o=le(),a;var u=t.length;let l;if(n){for(i=u-1;i>=0;i--)if(l=(n=t[i])&&n.length){for(u=0;u<l;u++)if(a=n[u],!o[a]){if(o[a]=1,r)r--;else if(s.push(a),s.length===e)return s}}}else for(let c=u-1,p,m=0;c>=0;c--){p=t[c];for(let g=0;g<p.length;g++)if(l=(n=p[g])&&n.length){for(let f=0;f<l;f++)if(a=n[f],!o[a])if(o[a]=1,r)r--;else{let d=(g+(c<u-1&&i||0))/(c+1)|0;if((s[d]||(s[d]=[])).push(a),++m===e)return s}}}return s}function tc(t,e,r,n,i){let s=le(),o=[];for(let a=0,u;a<e.length;a++){u=e[a];for(let l=0;l<u.length;l++)s[u[l]]=1}if(i){for(let a=0,u;a<t.length;a++)if(u=t[a],s[u]){if(n)n--;else if(o.push(u),s[u]=0,r&&--r===0)break}}else for(let a=0,u,l;a<t.result.length;a++)for(u=t.result[a],e=0;e<u.length;e++)l=u[e],s[l]&&((o[a]||(o[a]=[])).push(l),s[l]=0);return o}le();vt.prototype.search=function(t,e,r,n){r||(!e&&_r(t)?(r=t,t=""):_r(e)&&(r=e,e=0));let i=[];var s=[];let o,a,u,l,c,p,m=0,g=!0,f;if(r){r.constructor===Array&&(r={index:r}),t=r.query||t,o=r.pluck,a=r.merge,l=r.boost,p=o||r.field||(p=r.index)&&(p.index?null:p);var d=this.tag&&r.tag;u=r.suggest,g=r.resolve!==!1,c=r.cache,f=g&&this.store&&r.highlight;var y=!!f||g&&this.store&&r.enrich;e=r.limit||e;var O=r.offset||0;if(e||(e=g?100:0),d&&(!this.db||!n)){d.constructor!==Array&&(d=[d]);var I=[];for(let k=0,D;k<d.length;k++)if(D=d[k],D.field&&D.tag){var C=D.tag;if(C.constructor===Array)for(var F=0;F<C.length;F++)I.push(D.field,C[F]);else I.push(D.field,C)}else{C=Object.keys(D);for(let $=0,X,K;$<C.length;$++)if(X=C[$],K=D[X],K.constructor===Array)for(F=0;F<K.length;F++)I.push(X,K[F]);else I.push(X,K)}if(d=I,!t){if(s=[],I.length)for(d=0;d<I.length;d+=2){if(this.db){if(n=this.index.get(I[d]),!n)continue;s.push(n=n.db.tag(I[d+1],e,O,y))}else n=rc.call(this,I[d],I[d+1],e,O,y);i.push(g?{field:I[d],tag:I[d+1],result:n}:[n])}if(s.length){let k=this;return Promise.all(s).then(function(D){for(let $=0;$<D.length;$++)g?i[$].result=D[$]:i[$]=D[$];return g?i:new oe(i.length>1?nn(i,1,0,0,u,l):i[0],k)})}return g?i:new oe(i.length>1?nn(i,1,0,0,u,l):i[0],this)}}g||o||!(p=p||this.field)||(Pe(p)?o=p:(p.constructor===Array&&p.length===1&&(p=p[0]),o=p.field||p.index)),p&&p.constructor!==Array&&(p=[p])}p||(p=this.field);let N;I=(this.worker||this.db)&&!n&&[];for(let k=0,D,$,X;k<p.length;k++){if($=p[k],this.db&&this.tag&&!this.B[k])continue;let K;if(Pe($)||(K=$,$=K.field,t=K.query||t,e=Bt(K.limit,e),O=Bt(K.offset,O),u=Bt(K.suggest,u),f=g&&this.store&&Bt(K.highlight,f),y=!!f||g&&this.store&&Bt(K.enrich,y),c=Bt(K.cache,c)),n)D=n[k];else{C=K||r||{},F=C.enrich;var S=this.index.get($);if(d&&(this.db&&(C.tag=d,C.field=p,N=S.db.support_tag_search),!N&&F&&(C.enrich=!1),N||(C.limit=0,C.offset=0)),D=c?S.searchCache(t,d&&!N?0:e,C):S.search(t,d&&!N?0:e,C),d&&!N&&(C.limit=e,C.offset=O),F&&(C.enrich=F),I){I[k]=D;continue}}if(X=(D=D.result||D)&&D.length,d&&X){if(C=[],F=0,this.db&&n){if(!N)for(S=p.length;S<n.length;S++){let V=n[S];if(V&&V.length)F++,C.push(V);else if(!u)return g?i:new oe(i,this)}}else for(let V=0,Z,se;V<d.length;V+=2){if(Z=this.tag.get(d[V]),!Z){if(u)continue;return g?i:new oe(i,this)}if(se=(Z=Z&&Z.get(d[V+1]))&&Z.length)F++,C.push(Z);else if(!u)return g?i:new oe(i,this)}if(F){if(D=tc(D,C,e,O,g),X=D.length,!X&&!u)return g?D:new oe(D,this);F--}}if(X)s[m]=$,i.push(D),m++;else if(p.length===1)return g?i:new oe(i,this)}if(I){if(this.db&&d&&d.length&&!N)for(y=0;y<d.length;y+=2){if(s=this.index.get(d[y]),!s){if(u)continue;return g?i:new oe(i,this)}I.push(s.db.tag(d[y+1],e,O,!1))}let k=this;return Promise.all(I).then(function(D){return r&&(r.resolve=g),D.length&&(D=k.search(t,e,r,D)),D})}if(!m)return g?i:new oe(i,this);if(o&&(!y||!this.store))return i=i[0],g?i:new oe(i,this);for(I=[],O=0;O<s.length;O++){if(d=i[O],y&&d.length&&typeof d[0].doc=="undefined"&&(this.db?I.push(d=this.index.get(this.field[0]).db.enrich(d)):d=zt.call(this,d)),o)return g?f?rn(t,d,this.index,o,f):d:new oe(d,this);i[O]={field:s[O],result:d}}if(y&&this.db&&I.length){let k=this;return Promise.all(I).then(function(D){for(let $=0;$<D.length;$++)i[$].result=D[$];return f&&(i=rn(t,i,k.index,o,f)),a?xo(i):i})}return f&&(i=rn(t,i,this.index,o,f)),a?xo(i):i};function xo(t){let e=[],r=le(),n=le();for(let i=0,s,o,a,u,l,c,p;i<t.length;i++){s=t[i],o=s.field,a=s.result;for(let m=0;m<a.length;m++)l=a[m],typeof l!="object"?l={id:u=l}:u=l.id,(c=r[u])?c.push(o):(l.field=r[u]=[o],e.push(l)),(p=l.highlight)&&(c=n[u],c||(n[u]=c={},l.highlight=c),c[o]=p)}return e}function rc(t,e,r,n,i){return t=this.tag.get(t),t?(t=t.get(e),t?(e=t.length-n,e>0&&((r&&e>r||n)&&(t=t.slice(n,n+r)),i&&(t=zt.call(this,t))),t):[]):[]}function zt(t){if(!this||!this.store)return t;if(this.db)return this.index.get(this.field[0]).db.enrich(t);let e=Array(t.length);for(let r=0,n;r<t.length;r++)n=t[r],e[r]={id:n,doc:this.store.get(n)};return e}function vt(t){if(!this||this.constructor!==vt)return new vt(t);let e=t.document||t.doc||t,r,n;if(this.B=[],this.field=[],this.D=[],this.key=(r=e.key||e.id)&&sn(r,this.D)||"id",(n=t.keystore||0)&&(this.keystore=n),this.fastupdate=!!t.fastupdate,this.reg=!this.fastupdate||t.worker||t.db?n?new Me(n):new Set:n?new De(n):new Map,this.h=(r=e.store||null)&&r&&r!==!0&&[],this.store=r?n?new De(n):new Map:null,this.cache=(r=t.cache||null)&&new St(r),t.cache=!1,this.worker=t.worker||!1,this.priority=t.priority||4,this.index=nc.call(this,t,e),this.tag=null,(r=e.tag)&&(typeof r=="string"&&(r=[r]),r.length)){this.tag=new Map,this.A=[],this.F=[];for(let i=0,s,o;i<r.length;i++){if(s=r[i],o=s.field||s,!o)throw Error("The tag field from the document descriptor is undefined.");s.custom?this.A[i]=s.custom:(this.A[i]=sn(o,this.D),s.filter&&(typeof this.A[i]=="string"&&(this.A[i]=new String(this.A[i])),this.A[i].G=s.filter)),this.F[i]=o,this.tag.set(o,new Map)}}if(this.worker){this.fastupdate=!1,t=[];for(let i of this.index.values())i.then&&t.push(i);if(t.length){let i=this;return Promise.all(t).then(function(s){let o=0;for(let a of i.index.entries()){let u=a[0],l=a[1];l.then&&(l=s[o],i.index.set(u,l),o++)}return i})}}else t.db&&(this.fastupdate=!1,this.mount(t.db))}H=vt.prototype;H.mount=function(t){let e=this.field;if(this.tag)for(let s=0,o;s<this.F.length;s++){o=this.F[s];var r=void 0;this.index.set(o,r=new Ne({},this.reg)),e===this.field&&(e=e.slice(0)),e.push(o),r.tag=this.tag.get(o)}r=[];let n={db:t.db,type:t.type,fastupdate:t.fastupdate};for(let s=0,o,a;s<e.length;s++){n.field=a=e[s],o=this.index.get(a);let u=new t.constructor(t.id,n);u.id=t.id,r[s]=u.mount(o),o.document=!0,s?o.bypass=!0:o.store=this.store}let i=this;return this.db=Promise.all(r).then(function(){i.db=!0})};H.commit=function(){return E(this,null,function*(){let t=[];for(let e of this.index.values())t.push(e.commit());yield Promise.all(t),this.reg.clear()})};H.destroy=function(){let t=[];for(let e of this.index.values())t.push(e.destroy());return Promise.all(t)};function nc(t,e){let r=new Map,n=e.index||e.field||e;Pe(n)&&(n=[n]);for(let s=0,o,a;s<n.length;s++){if(o=n[s],Pe(o)||(a=o,o=o.field),a=_r(a)?Object.assign({},t,a):t,this.worker){var i=void 0;i=(i=a.encoder)&&i.encode?i:new $t(typeof i=="string"?Ai[i]:i||{}),i=new bt(a,i),r.set(o,i)}this.worker||r.set(o,new Ne(a,this.reg)),a.custom?this.B[s]=a.custom:(this.B[s]=sn(o,this.D),a.filter&&(typeof this.B[s]=="string"&&(this.B[s]=new String(this.B[s])),this.B[s].G=a.filter)),this.field[s]=o}if(this.h){t=e.store,Pe(t)&&(t=[t]);for(let s=0,o,a;s<t.length;s++)o=t[s],a=o.field||o,o.custom?(this.h[s]=o.custom,o.custom.O=a):(this.h[s]=sn(a,this.D),o.filter&&(typeof this.h[s]=="string"&&(this.h[s]=new String(this.h[s])),this.h[s].G=o.filter))}return r}function sn(t,e){let r=t.split(":"),n=0;for(let i=0;i<r.length;i++)t=r[i],t[t.length-1]==="]"&&(t=t.substring(0,t.length-2))&&(e[n]=!0),t&&(r[n++]=t);return n<r.length&&(r.length=n),n>1?r:r[0]}H.append=function(t,e){return this.add(t,e,!0)};H.update=function(t,e){return this.remove(t).add(t,e)};H.remove=function(t){_r(t)&&(t=br(t,this.key));for(var e of this.index.values())e.remove(t,!0);if(this.reg.has(t)){if(this.tag&&!this.fastupdate)for(let r of this.tag.values())for(let n of r){e=n[0];let i=n[1],s=i.indexOf(t);s>-1&&(i.length>1?i.splice(s,1):r.delete(e))}this.store&&this.store.delete(t),this.reg.delete(t)}return this.cache&&this.cache.remove(t),this};H.clear=function(){let t=[];for(let e of this.index.values()){let r=e.clear();r.then&&t.push(r)}if(this.tag)for(let e of this.tag.values())e.clear();return this.store&&this.store.clear(),this.cache&&this.cache.clear(),t.length?Promise.all(t):this};H.contain=function(t){return this.db?this.index.get(this.field[0]).db.has(t):this.reg.has(t)};H.cleanup=function(){for(let t of this.index.values())t.cleanup();return this};H.get=function(t){return this.db?this.index.get(this.field[0]).db.enrich(t).then(function(e){return e[0]&&e[0].doc||null}):this.store.get(t)||null};H.set=function(t,e){return typeof t=="object"&&(e=t,t=br(e,this.key)),this.store.set(t,e),this};H.searchCache=Ei;H.export=ic;H.import=sc;Ci(vt.prototype);function Ri(t,e=0){let r=[],n=[];e&&(e=25e4/e*5e3|0);for(let i of t.entries())n.push(i),n.length===e&&(r.push(n),n=[]);return n.length&&r.push(n),r}function Ii(t,e){e||(e=new Map);for(let r=0,n;r<t.length;r++)n=t[r],e.set(n[0],n[1]);return e}function Po(t,e=0){let r=[],n=[];e&&(e=25e4/e*1e3|0);for(let i of t.entries())n.push([i[0],Ri(i[1])[0]||[]]),n.length===e&&(r.push(n),n=[]);return n.length&&r.push(n),r}function Do(t,e){e||(e=new Map);for(let r=0,n,i;r<t.length;r++)n=t[r],i=e.get(n[0]),e.set(n[0],Ii(n[1],i));return e}function Mo(t){let e=[],r=[];for(let n of t.keys())r.push(n),r.length===25e4&&(e.push(r),r=[]);return r.length&&e.push(r),e}function No(t,e){e||(e=new Set);for(let r=0;r<t.length;r++)e.add(t[r]);return e}function on(t,e,r,n,i,s,o=0){let a=n&&n.constructor===Array;var u=a?n.shift():n;if(!u)return this.export(t,e,i,s+1);if((u=t((e?e+".":"")+(o+1)+"."+r,JSON.stringify(u)))&&u.then){let l=this;return u.then(function(){return on.call(l,t,e,r,a?n:null,i,s,o+1)})}return on.call(this,t,e,r,a?n:null,i,s,o+1)}function ic(t,e,r=0,n=0){if(r<this.field.length){let o=this.field[r];if((e=this.index.get(o).export(t,o,r,n=1))&&e.then){let a=this;return e.then(function(){return a.export(t,o,r+1)})}return this.export(t,o,r+1)}let i,s;switch(n){case 0:i="reg",s=Mo(this.reg),e=null;break;case 1:i="tag",s=this.tag&&Po(this.tag,this.reg.size),e=null;break;case 2:i="doc",s=this.store&&Ri(this.store),e=null;break;default:return}return on.call(this,t,e,i,s||null,r,n)}function sc(t,e){var r=t.split(".");r[r.length-1]==="json"&&r.pop();let n=r.length>2?r[0]:"";if(r=r.length>2?r[2]:r[1],this.worker&&n)return this.index.get(n).import(t);if(e){if(typeof e=="string"&&(e=JSON.parse(e)),n)return this.index.get(n).import(r,e);switch(r){case"reg":this.fastupdate=!1,this.reg=No(e,this.reg);for(let i=0,s;i<this.field.length;i++)s=this.index.get(this.field[i]),s.fastupdate=!1,s.reg=this.reg;if(this.worker){e=[];for(let i of this.index.values())e.push(i.import(t));return Promise.all(e)}break;case"tag":this.tag=Do(e,this.tag);break;case"doc":this.store=Ii(e,this.store)}}}function Eo(t,e){let r="";for(let n of t.entries()){t=n[0];let i=n[1],s="";for(let o=0,a;o<i.length;o++){a=i[o]||[""];let u="";for(let l=0;l<a.length;l++)u+=(u?",":"")+(e==="string"?'"'+a[l]+'"':a[l]);u="["+u+"]",s+=(s?",":"")+u}s='["'+t+'",['+s+"]]",r+=(r?",":"")+s}return r}Ne.prototype.remove=function(t,e){let r=this.reg.size&&(this.fastupdate?this.reg.get(t):this.reg.has(t));if(r){if(this.fastupdate){for(let n=0,i,s;n<r.length;n++)if((i=r[n])&&(s=i.length))if(i[s-1]===t)i.pop();else{let o=i.indexOf(t);o>=0&&i.splice(o,1)}}else vr(this.map,t),this.depth&&vr(this.ctx,t);e||this.reg.delete(t)}return this.db&&(this.commit_task.push({del:t}),this.M&&Lo(this)),this.cache&&this.cache.remove(t),this};function vr(t,e){let r=0;var n=typeof e=="undefined";if(t.constructor===Array){for(let i=0,s,o,a;i<t.length;i++)if((s=t[i])&&s.length){if(n)return 1;if(o=s.indexOf(e),o>=0){if(s.length>1)return s.splice(o,1),1;if(delete t[i],r)return 1;a=1}else{if(a)return 1;r++}}}else for(let i of t.entries())n=i[0],vr(i[1],e)?r++:t.delete(n);return r}var oc={memory:{resolution:1},performance:{resolution:3,fastupdate:!0,context:{depth:1,resolution:1}},match:{tokenize:"forward"},score:{resolution:9,context:{depth:2,resolution:3}}};Ne.prototype.add=function(t,e,r,n){if(e&&(t||t===0)){if(!n&&!r&&this.reg.has(t))return this.update(t,e);n=this.depth,e=this.encoder.encode(e,!n);let l=e.length;if(l){let c=le(),p=le(),m=this.resolution;for(let g=0;g<l;g++){let f=e[this.rtl?l-1-g:g];var i=f.length;if(i&&(n||!p[f])){var s=this.score?this.score(e,f,g,null,0):en(m,l,g),o="";switch(this.tokenize){case"tolerant":if(Ve(this,p,f,s,t,r),i>2){for(let d=1,y,O,I,C;d<i-1;d++)y=f.charAt(d),O=f.charAt(d+1),I=f.substring(0,d)+O,C=f.substring(d+2),o=I+y+C,Ve(this,p,o,s,t,r),o=I+C,Ve(this,p,o,s,t,r);Ve(this,p,f.substring(0,f.length-1),s,t,r)}break;case"full":if(i>2){for(let d=0,y;d<i;d++)for(s=i;s>d;s--){o=f.substring(d,s),y=this.rtl?i-1-d:d;var a=this.score?this.score(e,f,g,o,y):en(m,l,g,i,y);Ve(this,p,o,a,t,r)}break}case"bidirectional":case"reverse":if(i>1){for(a=i-1;a>0;a--){o=f[this.rtl?i-1-a:a]+o;var u=this.score?this.score(e,f,g,o,a):en(m,l,g,i,a);Ve(this,p,o,u,t,r)}o=""}case"forward":if(i>1){for(a=0;a<i;a++)o+=f[this.rtl?i-1-a:a],Ve(this,p,o,s,t,r);break}default:if(Ve(this,p,f,s,t,r),n&&l>1&&g<l-1)for(i=this.N,o=f,s=Math.min(n+1,this.rtl?g+1:l-g),a=1;a<s;a++){f=e[this.rtl?l-1-g-a:g+a],u=this.bidirectional&&f>o;let d=this.score?this.score(e,o,g,f,a-1):en(i+(l/2>i?0:1),l,g,s-1,a-1);Ve(this,c,u?o:f,d,t,r,u?f:o)}}}}this.fastupdate||this.reg.add(t)}}return this.db&&(this.commit_task.push(r?{ins:t}:{del:t}),this.M&&Lo(this)),this};function Ve(t,e,r,n,i,s,o){let a,u;if(!(a=e[r])||o&&!a[o]){if(o?(e=a||(e[r]=le()),e[o]=1,u=t.ctx,(a=u.get(o))?u=a:u.set(o,u=t.keystore?new De(t.keystore):new Map)):(u=t.map,e[r]=1),(a=u.get(r))?u=a:u.set(r,u=a=[]),s){for(let l=0,c;l<a.length;l++)if((c=a[l])&&c.includes(i)){if(l<=n)return;c.splice(c.indexOf(i),1),t.fastupdate&&(e=t.reg.get(i))&&e.splice(e.indexOf(c),1);break}}if(u=u[n]||(u[n]=[]),u.push(i),u.length===rt(2,31)-1){if(e=new Wt(u),t.fastupdate)for(let l of t.reg.values())l.includes(u)&&(l[l.indexOf(u)]=e);a[n]=u=e}t.fastupdate&&((n=t.reg.get(i))?n.push(u):t.reg.set(i,[u]))}}function en(t,e,r,n,i){return r&&t>1?e+(n||0)<=t?r+(i||0):(t-1)/(e+(n||0))*(r+(i||0))+1|0:0}Ne.prototype.search=function(t,e,r){if(r||(e||typeof t!="object"?typeof e=="object"&&(r=e,e=0):(r=t,t="")),r&&r.cache)return r.cache=!1,t=this.searchCache(t,e,r),r.cache=!0,t;let n=[],i,s,o,a=0,u,l,c,p,m;r&&(t=r.query||t,e=r.limit||e,a=r.offset||0,s=r.context,o=r.suggest,m=(u=r.resolve)&&r.enrich,c=r.boost,p=r.resolution,l=this.db&&r.tag),typeof u=="undefined"&&(u=this.resolve),s=this.depth&&s!==!1;let g=this.encoder.encode(t,!s);if(i=g.length,e=e||(u?100:0),i===1)return Co.call(this,g[0],"",e,a,u,m,l);if(i===2&&s&&!o)return Co.call(this,g[1],g[0],e,a,u,m,l);let f=le(),d=0,y;if(s&&(y=g[0],d=1),p||p===0||(p=y?this.N:this.resolution),this.db){if(this.db.search&&(r=this.db.search(this,g,e,a,o,u,m,l),r!==!1))return r;let O=this;return(function(){return E(this,null,function*(){for(let I,C;d<i;d++){if((C=g[d])&&!f[C]){if(f[C]=1,I=yield xi(O,C,y,0,0,!1,!1),I=Oo(I,n,o,p)){n=I;break}y&&(o&&I&&n.length||(y=C))}o&&y&&d===i-1&&!n.length&&(p=O.resolution,y="",d=-1,f=le())}return Ao(n,p,e,a,o,c,u)})})()}for(let O,I;d<i;d++){if((I=g[d])&&!f[I]){if(f[I]=1,O=xi(this,I,y,0,0,!1,!1),O=Oo(O,n,o,p)){n=O;break}y&&(o&&O&&n.length||(y=I))}o&&y&&d===i-1&&!n.length&&(p=this.resolution,y="",d=-1,f=le())}return Ao(n,p,e,a,o,c,u)};function Ao(t,e,r,n,i,s,o){let a=t.length,u=t;if(a>1)u=nn(t,e,r,n,i,s,o);else if(a===1)return o?Oi.call(null,t[0],r,n):new oe(t[0],this);return o?u:new oe(u,this)}function Co(t,e,r,n,i,s,o){return t=xi(this,t,e,r,n,i,s,o),this.db?t.then(function(a){return i?a||[]:new oe(a,this)}):t&&t.length?i?Oi.call(this,t,r,n):new oe(t,this):i?[]:new oe([],this)}function Oo(t,e,r,n){let i=[];if(t&&t.length){if(t.length<=n){e.push(t);return}for(let s=0,o;s<n;s++)(o=t[s])&&(i[s]=o);if(i.length){e.push(i);return}}if(!r)return i}function xi(t,e,r,n,i,s,o,a){let u;return r&&(u=t.bidirectional&&e>r)&&(u=r,r=e,e=u),t.db?t.db.get(e,r,n,i,s,o,a):(t=r?(t=t.ctx.get(r))&&t.get(e):t.map.get(e),t)}function Ne(t,e){if(!this||this.constructor!==Ne)return new Ne(t);if(t){var r=Pe(t)?t:t.preset;r&&(t=Object.assign({},oc[r],t))}else t={};r=t.context;let n=r===!0?{depth:1}:r||{},i=Pe(t.encoder)?Ai[t.encoder]:t.encode||t.encoder||{};this.encoder=i.encode?i:typeof i=="object"?new $t(i):{encode:i},this.resolution=t.resolution||9,this.tokenize=r=(r=t.tokenize)&&r!=="default"&&r!=="exact"&&r||"strict",this.depth=r==="strict"&&n.depth||0,this.bidirectional=n.bidirectional!==!1,this.fastupdate=!!t.fastupdate,this.score=t.score||null,(r=t.keystore||0)&&(this.keystore=r),this.map=r?new De(r):new Map,this.ctx=r?new De(r):new Map,this.reg=e||(this.fastupdate?r?new De(r):new Map:r?new Me(r):new Set),this.N=n.resolution||3,this.rtl=i.rtl||t.rtl||!1,this.cache=(r=t.cache||null)&&new St(r),this.resolve=t.resolve!==!1,(r=t.db)&&(this.db=this.mount(r)),this.M=t.commit!==!1,this.commit_task=[],this.commit_timer=null,this.priority=t.priority||4}H=Ne.prototype;H.mount=function(t){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),t.mount(this)};H.commit=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.commit(this)};H.destroy=function(){return this.commit_timer&&(clearTimeout(this.commit_timer),this.commit_timer=null),this.db.destroy()};function Lo(t){t.commit_timer||(t.commit_timer=setTimeout(function(){t.commit_timer=null,t.db.commit(t)},1))}H.clear=function(){return this.map.clear(),this.ctx.clear(),this.reg.clear(),this.cache&&this.cache.clear(),this.db?(this.commit_timer&&clearTimeout(this.commit_timer),this.commit_timer=null,this.commit_task=[],this.db.clear()):this};H.append=function(t,e){return this.add(t,e,!0)};H.contain=function(t){return this.db?this.db.has(t):this.reg.has(t)};H.update=function(t,e){let r=this,n=this.remove(t);return n&&n.then?n.then(()=>r.add(t,e)):this.add(t,e)};H.cleanup=function(){return this.fastupdate?(vr(this.map),this.depth&&vr(this.ctx),this):this};H.searchCache=Ei;H.export=function(t,e,r=0,n=0){let i,s;switch(n){case 0:i="reg",s=Mo(this.reg);break;case 1:i="cfg",s=null;break;case 2:i="map",s=Ri(this.map,this.reg.size);break;case 3:i="ctx",s=Po(this.ctx,this.reg.size);break;default:return}return on.call(this,t,e,i,s,r,n)};H.import=function(t,e){if(e)switch(typeof e=="string"&&(e=JSON.parse(e)),t=t.split("."),t[t.length-1]==="json"&&t.pop(),t.length===3&&t.shift(),t=t.length>1?t[1]:t[0],t){case"reg":this.fastupdate=!1,this.reg=No(e,this.reg);break;case"map":this.map=Ii(e,this.map);break;case"ctx":this.ctx=Do(e,this.ctx)}};H.serialize=function(t=!0){let e="",r="",n="";if(this.reg.size){let s;for(var i of this.reg.keys())s||(s=typeof i),e+=(e?",":"")+(s==="string"?'"'+i+'"':i);e="index.reg=new Set(["+e+"]);",r=Eo(this.map,s),r="index.map=new Map(["+r+"]);";for(let o of this.ctx.entries()){i=o[0];let a=Eo(o[1],s);a="new Map(["+a+"])",a='["'+i+'",'+a+"]",n+=(n?",":"")+a}n="index.ctx=new Map(["+n+"]);"}return t?"function inject(index){"+e+r+n+"}":e+r+n};Ci(Ne.prototype);var Fo=typeof window!="undefined"&&(window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB),an=["map","ctx","tag","reg","cfg"],yt=le();function un(t,e={}){if(!this||this.constructor!==un)return new un(t,e);typeof t=="object"&&(e=t,t=t.name),t||console.info("Default storage space was used, because a name was not passed."),this.id="flexsearch"+(t?":"+t.toLowerCase().replace(/[^a-z0-9_\-]/g,""):""),this.field=e.field?e.field.toLowerCase().replace(/[^a-z0-9_\-]/g,""):"",this.type=e.type,this.fastupdate=this.support_tag_search=!1,this.db=null,this.h={}}H=un.prototype;H.mount=function(t){return t.index?t.mount(this):(t.db=this,this.open())};H.open=function(){if(this.db)return this.db;let t=this;navigator.storage&&navigator.storage.persist&&navigator.storage.persist(),yt[t.id]||(yt[t.id]=[]),yt[t.id].push(t.field);let e=Fo.open(t.id,1);return e.onupgradeneeded=function(){let r=t.db=this.result;for(let n=0,i;n<an.length;n++){i=an[n];for(let s=0,o;s<yt[t.id].length;s++)o=yt[t.id][s],r.objectStoreNames.contains(i+(i!=="reg"&&o?":"+o:""))||r.createObjectStore(i+(i!=="reg"&&o?":"+o:""))}},t.db=ut(e,function(r){t.db=r,t.db.onversionchange=function(){t.close()}})};H.close=function(){this.db&&this.db.close(),this.db=null};H.destroy=function(){let t=Fo.deleteDatabase(this.id);return ut(t)};H.clear=function(){let t=[];for(let r=0,n;r<an.length;r++){n=an[r];for(let i=0,s;i<yt[this.id].length;i++)s=yt[this.id][i],t.push(n+(n!=="reg"&&s?":"+s:""))}let e=this.db.transaction(t,"readwrite");for(let r=0;r<t.length;r++)e.objectStore(t[r]).clear();return ut(e)};H.get=function(t,e,r=0,n=0,i=!0,s=!1){t=this.db.transaction((e?"ctx":"map")+(this.field?":"+this.field:""),"readonly").objectStore((e?"ctx":"map")+(this.field?":"+this.field:"")).get(e?e+":"+t:t);let o=this;return ut(t).then(function(a){let u=[];if(!a||!a.length)return u;if(i){if(!r&&!n&&a.length===1)return a[0];for(let l=0,c;l<a.length;l++)if((c=a[l])&&c.length){if(n>=c.length){n-=c.length;continue}let p=r?n+Math.min(c.length-n,r):c.length;for(let m=n;m<p;m++)u.push(c[m]);if(n=0,u.length===r)break}return s?o.enrich(u):u}return a})};H.tag=function(t,e=0,r=0,n=!1){t=this.db.transaction("tag"+(this.field?":"+this.field:""),"readonly").objectStore("tag"+(this.field?":"+this.field:"")).get(t);let i=this;return ut(t).then(function(s){return!s||!s.length||r>=s.length?[]:!e&&!r?s:(s=s.slice(r,r+e),n?i.enrich(s):s)})};H.enrich=function(t){typeof t!="object"&&(t=[t]);let e=this.db.transaction("reg","readonly").objectStore("reg"),r=[];for(let n=0;n<t.length;n++)r[n]=ut(e.get(t[n]));return Promise.all(r).then(function(n){for(let i=0;i<n.length;i++)n[i]={id:t[i],doc:n[i]?JSON.parse(n[i]):null};return n})};H.has=function(t){return t=this.db.transaction("reg","readonly").objectStore("reg").getKey(t),ut(t).then(function(e){return!!e})};H.search=null;H.info=function(){};H.transaction=function(t,e,r){t+=t!=="reg"&&this.field?":"+this.field:"";let n=this.h[t+":"+e];if(n)return r.call(this,n);let i=this.db.transaction(t,e);this.h[t+":"+e]=n=i.objectStore(t);let s=r.call(this,n);return this.h[t+":"+e]=null,ut(i).finally(function(){return s})};H.commit=function(t){return E(this,null,function*(){let e=t.commit_task,r=[];t.commit_task=[];for(let n=0,i;n<e.length;n++)i=e[n],i.del&&r.push(i.del);r.length&&(yield this.remove(r)),t.reg.size&&(yield this.transaction("map","readwrite",function(n){for(let i of t.map){let s=i[0],o=i[1];o.length&&(n.get(s).onsuccess=function(){let a=this.result;var u;if(a&&a.length){let l=Math.max(a.length,o.length);for(let c=0,p,m;c<l;c++)if((m=o[c])&&m.length){if((p=a[c])&&p.length)for(u=0;u<m.length;u++)p.push(m[u]);else a[c]=m;u=1}}else a=o,u=1;u&&n.put(a,s)})}}),yield this.transaction("ctx","readwrite",function(n){for(let i of t.ctx){let s=i[0],o=i[1];for(let a of o){let u=a[0],l=a[1];l.length&&(n.get(s+":"+u).onsuccess=function(){let c=this.result;var p;if(c&&c.length){let m=Math.max(c.length,l.length);for(let g=0,f,d;g<m;g++)if((d=l[g])&&d.length){if((f=c[g])&&f.length)for(p=0;p<d.length;p++)f.push(d[p]);else c[g]=d;p=1}}else c=l,p=1;p&&n.put(c,s+":"+u)})}}}),t.store?yield this.transaction("reg","readwrite",function(n){for(let i of t.store){let s=i[0],o=i[1];n.put(typeof o=="object"?JSON.stringify(o):1,s)}}):t.bypass||(yield this.transaction("reg","readwrite",function(n){for(let i of t.reg.keys())n.put(1,i)})),t.tag&&(yield this.transaction("tag","readwrite",function(n){for(let i of t.tag){let s=i[0],o=i[1];o.length&&(n.get(s).onsuccess=function(){let a=this.result;a=a&&a.length?a.concat(o):o,n.put(a,s)})}})),t.map.clear(),t.ctx.clear(),t.tag&&t.tag.clear(),t.store&&t.store.clear(),t.document||t.reg.clear())})};function _i(t,e,r){let n=t.value,i,s=0;for(let o=0,a;o<n.length;o++){if(a=r?n:n[o]){for(let u=0,l,c;u<e.length;u++)if(c=e[u],l=a.indexOf(c),l>=0)if(i=1,a.length>1)a.splice(l,1);else{n[o]=[];break}s+=a.length}if(r)break}s?i&&t.update(n):t.delete(),t.continue()}H.remove=function(t){return typeof t!="object"&&(t=[t]),Promise.all([this.transaction("map","readwrite",function(e){e.openCursor().onsuccess=function(){let r=this.result;r&&_i(r,t)}}),this.transaction("ctx","readwrite",function(e){e.openCursor().onsuccess=function(){let r=this.result;r&&_i(r,t)}}),this.transaction("tag","readwrite",function(e){e.openCursor().onsuccess=function(){let r=this.result;r&&_i(r,t,!0)}}),this.transaction("reg","readwrite",function(e){for(let r=0;r<t.length;r++)e.delete(t[r])})])};function ut(t,e){return new Promise((r,n)=>{t.onsuccess=t.oncomplete=function(){e&&e(this.result),e=null,r(this.result)},t.onerror=t.onblocked=n,t=null})}var cn={Index:Ne,Charset:Ai,Encoder:$t,Document:vt,Worker:bt,Resolver:oe,IndexedDB:un,Language:{}};function fn(t){return t.replace(/\\u[\dA-F]{4}/gi,function(e){return String.fromCharCode(parseInt(e.replace(/\\u/g,""),16))})}var xt={},Je=class extends G{_prepare(){xt[this.uri]={index:{},conceptCache:{},schemeCache:{}}}get _index(){return xt[this.uri]&&xt[this.uri].index}get _conceptCache(){return xt[this.uri]&&xt[this.uri].conceptCache}get _schemeCache(){return xt[this.uri]&&xt[this.uri].schemeCache}static _registryConfigForBartocApiConfig({url:e,scheme:r}={}){return!e||!r?null:{schemes:[{uri:e,identifier:P.getAllUris(r).filter(i=>i!==e)}]}}_loadScheme(n){return E(this,null,function*(){var i=n,{scheme:e}=i,r=W(i,["scheme"]);let s=P.getAllUris(e);for(let f of s)if(this._schemeCache[f])return this._schemeCache[f];let o=this.schemes.find(f=>P.compare(f,e));if(!o||!o.uri)throw new Le({message:`Tried to load unsupported scheme (${e&&e.uri})`});let a=o.uri;s=[...new Set(s.concat(P.getAllUris(o)))];let u=".json";a.endsWith("/")&&(u="index.json");let l=yield this.axios(L(R({},r),{url:`${a}${u}`,_skipAdditionalParameters:!0}));if(l.id!==a)throw new Le({message:"Skohub URL did not return expected concept scheme"});let{title:c,preferredNamespaceUri:p,hasTopConcept:m,description:g}=l;e={uri:a,identifier:s.filter(f=>f!==a)},e.prefLabel=c,Object.keys(e.prefLabel||{}).forEach(f=>{e.prefLabel[f]=fn(e.prefLabel[f])}),e.namespace=p,e.topConcepts=(m||[]).map(f=>this._toJskosConcept(f)),e.concepts=[null],g&&(e.definition=g,Object.keys(e.definition).forEach(f=>{e.definition[f]=[fn(e.definition[f])]}));for(let f of Object.keys(e).filter(d=>!e[d]))delete e[f];for(let f of s)this._schemeCache[f]=e;return e})}_loadConcept(n){return E(this,null,function*(){var i=n,{uri:e}=i,r=W(i,["uri"]);if(this._conceptCache[e])return this._conceptCache[e];try{let s=yield this.axios(L(R({},r),{url:`${e}.json`,_skipAdditionalParameters:!0}));if(s.id!==e)throw new Le({message:"Skohub URL did not return expected concept URI"});let o=this._toJskosConcept(s);return this._conceptCache[e]=o,o}catch(s){return null}})}_toJskosConcept(e){let r={uri:e.id};return r.prefLabel=e.prefLabel,Object.keys(r.prefLabel||{}).forEach(n=>{r.prefLabel[n]=fn(r.prefLabel[n])}),r.narrower=(e.narrower||[]).map(n=>this._toJskosConcept(n)),r.notation=e.notation||[],e.broader&&e.broader.id&&(r.broader=[{uri:e.broader.id}]),e.inScheme&&e.inScheme.id&&(r.inScheme=[{uri:e.inScheme.id}]),e.scopeNote&&(r.scopeNote=e.scopeNote,Object.keys(r.scopeNote).forEach(n=>{r.scopeNote[n]=[fn(r.scopeNote[n])]})),r}getSchemes(){return E(this,arguments,function*(r={}){var e=W(r,[]);return Promise.all(this.schemes.map(n=>this._loadScheme(L(R({},e),{scheme:n}))))})}getTop(n){return E(this,null,function*(){var i=n,{scheme:e}=i,r=W(i,["scheme"]);if(!e||!e.uri)throw new U({parameter:"scheme",message:"Missing scheme URI"});return e=yield this._loadScheme(R({scheme:e},r)),e.topConcepts||[]})}getConcepts(n){return E(this,null,function*(){var i=n,{concepts:e}=i,r=W(i,["concepts"]);return Array.isArray(e)||(e=[e]),(yield Promise.all(e.map(({uri:s})=>this._loadConcept(L(R({},r),{uri:s}))))).filter(Boolean)})}getAncestors(n){return E(this,null,function*(){var i=n,{concept:e}=i,r=W(i,["concept"]);if(!e||!e.uri)throw new U({parameter:"concept"});if(e.ancestors&&e.ancestors[0]!==null)return e.ancestors;if(e=yield this._loadConcept(L(R({},r),{uri:e.uri})),!e||!e.broader||!e.broader.length)return[];let s=e.broader[0];return[s].concat(yield this.getAncestors(R({concept:s},r))).map(o=>({uri:o.uri}))})}getNarrower(n){return E(this,null,function*(){var i=n,{concept:e}=i,r=W(i,["concept"]);if(!e||!e.uri)throw new U({parameter:"concept"});return e.narrower&&e.narrower[0]!==null||(e=yield this._loadConcept(L(R({},r),{uri:e.uri}))),e.narrower})}search(i){return E(this,arguments,function*({search:e,scheme:r,limit:n=100}){if(r=yield this._loadScheme({scheme:r}),!r||!r.uri)throw new U({parameter:"scheme"});if(!e)throw new U({parameter:"search"});let s;this._index[r.uri]||(this._index[r.uri]={});for(let u of[""].concat(this.languages)){if(this._index[r.uri][u]){s=this._index[r.uri][u];break}if(this._index[r.uri][u]!==null)try{let l=u?`.${u}.index`:".index";r.uri.endsWith("/")&&(l=`index${l}`);let c=yield this.axios({url:`${r.uri}${l}`,_skipAdditionalParameters:!0});if(c.length<100){this._index[r.uri][u]=null;continue}s=cn.create(),s.import(c),this._index[r.uri][u]=s;break}catch(l){this._index[r.uri][u]=null}}if(!s)throw new Le({message:"Could not find search index for any of the available languages "+this.languages.join(",")});let o=s.search(e);return(yield this.getConcepts({concepts:o.map(u=>({uri:u}))})).slice(0,n)})}suggest(e){return E(this,null,function*(){e._raw=!0;let r=yield this.search(e),n=[e.search,[],[],[]];for(let i of r){let s=P.notation(i),o=P.prefLabel(i);n[1].push((s?s+" ":"")+o),n[2].push(""),n[3].push(i.uri)}return r._totalCount!=null?n._totalCount=r._totalCount:n._totalCount=r.length,n})}};ee(Je,"supports",{schemes:!0,top:!0,data:!0,concepts:!0,narrower:!0,ancestors:!0,suggest:!0,search:!0});Je.providerName="Skohub";Je.providerType="http://bartoc.org/api-type/skohub";var Bo="https://lobid.org/gnd/",Ke={uri:"http://bartoc.org/en/node/430",concepts:[null],topConcepts:[],type:["http://www.w3.org/2004/02/skos/core#ConceptScheme"],DISPLAY:{hideNotation:!0},identifier:["http://www.wikidata.org/entity/Q36578"],license:[{uri:"http://creativecommons.org/publicdomain/zero/1.0/"}],namespace:"https://d-nb.info/gnd/",notation:["GND"],notationPattern:"[0-9X-]+",prefLabel:{de:"Gemeinsame Normdatei",en:"Integrated Authority File"},types:[{uri:"https://d-nb.info/standards/elementset/gnd#DifferentiatedPerson",prefLabel:{de:"Person",en:"Person"}},{uri:"https://d-nb.info/standards/elementset/gnd#PlaceOrGeographicName",prefLabel:{de:"Geografikum",en:"Place"}},{uri:"https://d-nb.info/standards/elementset/gnd#CorporateBody",prefLabel:{de:"Organisation",en:"Organization"}},{uri:"https://d-nb.info/standards/elementset/gnd#SubjectHeading",prefLabel:{de:"Sachbegriff",en:"Subject"}},{uri:"https://d-nb.info/standards/elementset/gnd#Work",prefLabel:{de:"Werk",en:"Work"}},{uri:"https://d-nb.info/standards/elementset/gnd#ConferenceOrEvent",prefLabel:{de:"Konferenz oder Veranstaltung",en:"ConferenceOrEvent"}}]},Di=new P.ConceptScheme({uri:"https://d-nb.info/standards/elementset/gnd",namespace:"https://d-nb.info/standards/elementset/gnd#"});Ke.types.forEach(t=>{t.notation=[Di.notationFromUri(t.uri)]});var ac=new P.ConceptScheme(Ke),Uo=["broaderTerm","broaderTermGeneral","broaderTermGeneric","broaderTermInstantial","broaderTermPartitive"],jo={sameAs:"http://www.w3.org/2004/02/skos/core#exactMatch",exactMatch:"http://www.w3.org/2004/02/skos/core#exactMatch",closeMatch:"http://www.w3.org/2004/02/skos/core#closeMatch",relatedDdcWithDegreeOfDeterminacy1:"http://www.w3.org/2004/02/skos/core#narrowMatch",relatedDdcWithDegreeOfDeterminacy2:"http://www.w3.org/2004/02/skos/core#narrowMatch",relatedDdcWithDegreeOfDeterminacy3:"http://www.w3.org/2004/02/skos/core#closeMatch",relatedDdcWithDegreeOfDeterminacy4:"http://www.w3.org/2004/02/skos/core#exactMatch"},uc=[{uri:"http://bartoc.org/en/node/241",uriPattern:"http://dewey.info/class/(.+)/"},{uri:"http://bartoc.org/en/node/18",namespace:"https://data.bnf.fr/ark:/12148/"},{uri:"http://bartoc.org/en/node/20450",namespace:"https://datos.bne.es/resource/"},{uri:"http://bartoc.org/en/node/1940",namespace:"http://www.wikidata.org/entity/"},{uri:"http://bartoc.org/en/node/294",namespace:"http://lod.gesis.org/thesoz/"},{uri:"http://bartoc.org/en/node/20425",namespace:"http://uri.gbv.de/terminology/tpro/"},{uri:"http://bartoc.org/en/node/2053",namespace:"http://viaf.org/viaf/"},{uri:"http://bartoc.org/en/node/305",uriPattern:"http?://aims.fao.org/aos/agrovoc/(.+)"},{uri:"http://bartoc.org/en/node/391",uriPattern:"http?://id.nlm.nih.gov/mesh/(.+)"},{uri:"http://bartoc.org/en/node/313",uriPattern:"http?://zbw.eu/stw/descriptor/(.+)"},{uri:"http://bartoc.org/en/node/443",uriPattern:"https?://purl.org/bncf/tid/(.+)"},{uri:"http://bartoc.org/en/node/454",uriPattern:"http?://id.loc.gov/authorities/subjects/(.+)"},{uri:"http://bartoc.org/en/node/18536",uriPattern:"http?://id.loc.gov/authorities/names/(.+)"}].map(t=>new P.ConceptScheme(t));function Ti(t){var n,i;let e={uri:t.id,notation:[t.gndIdentifier],prefLabel:{de:t.preferredName},inScheme:[{uri:Ke.uri}]};t.variantName&&(e.altLabel={de:t.variantName}),(n=t.usingInstructions)!=null&&n.length&&(e.scopeNote={de:t.usingInstructions}),e.type=t.type.map(s=>Di.uriFromNotation(s)).filter(Boolean),e.broader=[],Uo.forEach(s=>{e.broader=e.broader.concat(t[s]||[])}),e.broader=e.broader.map(s=>({uri:s.id})),e.uri&&(e.identifier=[e.uri.replace("https://","http://")]);let r=[];for(let s of Object.keys(jo)){let o=jo[s];(i=t[s])!=null&&i.length&&(r=r.concat(t[s].map(a=>{let u=uc.find(c=>c.notationFromUri(a.id)),l=u==null?void 0:u.conceptFromUri(a.id);return!u||!l?null:(u.uri==="http://bartoc.org/en/node/241"&&(l.uri+="e23/"),{from:{memberSet:[{uri:e.uri,notation:e.notation}]},fromScheme:{uri:Ke.uri},to:{memberSet:[l]},toScheme:{uri:u.uri},type:[o]})}).filter(Boolean)))}return r.length&&(e.mappings=r),e}function Pi(t){return t&&t.startsWith("http://")?t.replace("http://","https://"):t}var Ye=class extends G{_setup(){this._api.api||(this._api.api=Bo)}static _registryConfigForBartocApiConfig({url:e,scheme:r}={}){return!e||!r||!P.compare(r,Ke)||e!=="https://lobid.org/gnd/api"?null:{api:Bo,schemes:[Ke]}}getSchemes(){return E(this,null,function*(){return[Ke]})}getTop(){return E(this,null,function*(){return[]})}getConcepts(r){return E(this,arguments,function*({concepts:e}){if(!e)throw new i.InvalidOrMissingParameterError({parameter:"concepts"});Array.isArray(e)||(e=[e]);let n=e.map(o=>{var a,u;return(a=o==null?void 0:o.notation)!=null&&a[0]?(u=o==null?void 0:o.notation)==null?void 0:u[0]:ac.notationFromUri(Pi(o==null?void 0:o.uri))}).filter(Boolean),i=[],s=yield Promise.all(n.map(o=>E(this,null,function*(){try{let a=yield pe.get(`${this._api.api}${o}.json`);return Ti(a.data)}catch(a){i.push(a)}})));if(i.length===e.length)throw i[0];return s.filter(Boolean)})}getNarrower(i){return E(this,arguments,function*({concept:e,limit:r=200,offset:n=0}){if(!e||!e.uri)throw new U({parameter:"concept"});let s=Pi(e.uri),o=Uo.map(u=>`${u}.id:"${s}"`).join(" OR ");return(yield pe.get(`${this._api.api}search`,{params:{q:o,format:"json",size:r,from:n}})).data.member.map(u=>Ti(u))})}suggest(e){return E(this,null,function*(){let r=yield this._search(L(R({},e),{format:"json:suggest"}));return[e.search,r.map(n=>n.label),[],r.map(n=>n.id)]})}search(e){return E(this,null,function*(){return(yield this._search(e)).member.map(n=>Ti(n))})}_search(o){return E(this,arguments,function*({search:e,types:r,limit:n=100,offset:i=0,format:s="json"}){if(!e)throw new U({parameter:"search"});let a="";return r=(r==null?void 0:r.map(l=>Di.notationFromUri(Pi(l))).filter(Boolean))||[],r.length&&(a=r.map(l=>`type:${l}`).join(" OR ")),(yield pe.get(`${this._api.api}search`,{params:{q:e,filter:a,format:s,size:n,from:i}})).data})}getTypes(r){return E(this,arguments,function*({scheme:e}){if(!e||!P.compare(e,Ke))throw new U({parameter:"search",message:e!=null&&e.uri?`scheme ${e==null?void 0:e.uri} not supported`:""});return Ke.types})}};ee(Ye,"supports",{schemes:!0,data:!0,concepts:!0,narrower:!0,suggest:!0,search:!0,types:!0});Ye.providerName="LobidApi";Ye.providerType="http://bartoc.org/api-type/lobid-gnd";var Xe=class extends G{_getApiUrl(e,r){let n=this.uri||"";n.endsWith("/")&&(n=n.slice(0,-1));for(let i of e)if(i)n+="/"+i;else return;if(r){let i=Object.keys(r).map(s=>`${s}=${encodeURIComponent(r[s])}`).join("&");n+=(n.includes("?")?"&":"?")+i}return n}_artefactToJSKOS(e){let r=e.language||this._language||"en",n={};return e.subject&&(n.subject=[e.subject]),e.includedInDataCatalog&&(n.api=[e.includedInDataCatalog]),e["@type"]&&(n["@type"]=e["@type"]),e.type&&(n.type=[e.type]),e.source_name&&(n.notation=[e.source_name]),e.short_form&&(n.notation?n.notation.push(e.short_form):n.notation=[e.short_form]),e.label&&(n.prefLabel={},n.prefLabel[r]=[],n.prefLabel[r].push(e.label)),e.synonyms&&(n.altLabel={},n.altLabel[r]=e.synonyms),e.descriptions&&(n.definition={},n.definition[r]=e.descriptions),e.language&&(n.languages=e.language),e["@id"]&&(n.uri=e["@id"]),e.iri&&(n.iri=e.iri),e.identifier&&(n.identifier=[e.identifier]),e.source&&(n.source=[e.source]),e.source_url&&(n.namespace=e.source_url),e.landingPage&&(n.url=e.landingPage),e.version&&(n.version=e.version),e.modified&&(n.modified=e.modified),e.created&&(n.created=e.created),e.hasFormat&&(n.format=e.hasFormat),e.license&&(n.license=[e.license]),e.creator&&(n.creator=e.creator),e.contributor&&(n.contributor={},n.contributor.prefLabel={},n.contributor.prefLabel[r]=e.contributor),e.publisher&&(n.publisher={},n.publisher[r]=e.publisher),e.released&&(n.issued=e.released),e.children&&(n.narrower={},n.narrower[r]=e.children),n}_request(e,...r){return E(this,null,function*(){if(!e)return;let n=yield this.axios(R({method:"get",url:e,headers:{"Content-Type":"application/json",Accept:"application/json"}},r));if(!(n!=null&&n._url)||Object.keys(n).length!=1)return n})}_getSchemesMod(){return E(this,null,function*(){let e=this._getApiUrl(["artefacts"],null);return yield this._request(e)})}_getSchemesModLimit(e){return E(this,null,function*(){let r=yield this._getSchemesMod();return e&&e>0?r.slice(0,e):r})}_getSchemeMod(e){return E(this,null,function*(){if(e.short)return yield this._getSchemeFromShort(e.short);if(e.uri)return yield this._getSchemeFromUri(e.uri)})}_getSchemeFromShort(e){return E(this,null,function*(){let r=this._getApiUrl(["artefacts",e],null);return yield this._request(r)})}_getSchemeFromUri(e){return E(this,null,function*(){let r=yield this._getSchemesMod();if(r){for(let n of yield r)if(n.source==e||n.source_url==e||n.source_name==e||n["@id"]==e||n.iri==e||n.includedInDataCatalog&&n.includedInDataCatalog.includes(e))return yield n}})}_getConceptsMod(e){return E(this,null,function*(){let r=yield this._schemeShortFromObj(e);if(!r)return[];let n=this._getApiUrl(["artefacts",r,"resources","concepts"],null),i=yield this._request(n);if(!i)return[];let{page:s,totalPages:o,member:a}=i,u=[];for(let l of a)l&&u.push(l);for(let l=s+1;l<=o;l++){let c=this._getApiUrl(["artefacts",r,"resources","concepts"],{page:l}),p=yield this._request(c);if(!p)break;let{member:m}=p;for(let g of m)g&&u.push(g)}return u})}_getConceptsModLimit(e,r){return E(this,null,function*(){let n=yield this._getConceptsMod(e);return r&&r>0?n.slice(0,r):n})}_getConceptMod(e){return E(this,null,function*(){let{conceptNotation:r,schemeShort:n}=yield this._conceptNotationFromObj(e),i=this._getApiUrl(["artefacts",n,"resources","concepts",r],null);return yield this._request(i)})}_containsString(e,r){for(let n in e){let i=e[n];if(typeof i=="string"&&i.includes(r)||typeof i=="object"&&i!==null&&this.containsString(i,r))return!0}return!1}_getSchemesContaining(e){return E(this,null,function*(){let r=[],n=yield this._getSchemesMod();for(let i of n)this.containsString(i,e)&&r.push(i);return r})}_getSchemeShort(e){return E(this,null,function*(){let r=yield this._getSchemeFromUri(e);if(r)return yield r.short_form.toLowerCase()})}_getconceptNotation(e){return e.split("/").pop()}_schemeShortFromObj(e){return E(this,null,function*(){if(e.short)return e.short;if(e.uri)return yield this._getSchemeShort(e.uri)})}_conceptNotationFromObj(e){return E(this,null,function*(){if(!e.inScheme||!e.inScheme[0])return;let r=yield this._schemeShortFromObj(e.inScheme[0]),n=e.notation;return n||(n=yield this._getconceptNotation(e.uri)),{conceptNotation:n,schemeShort:r}})}_prepare(){}_setup(){}getSchemes(i){return E(this,null,function*(){var s=i,{schemes:e,limit:r}=s,n=W(s,["schemes","limit"]);let o=[],a=[];if(e)for(let u of e){let l=yield this._getSchemeMod(u);l&&a.push(l)}else a=yield this._getSchemesModLimit(r);for(let u of a){let l=yield this._artefactToJSKOS(u);l?o.push(l):console.warn("JSKOS transformation failed for artefact: ",u)}return o})}getConcepts(s){return E(this,null,function*(){var o=s,{concepts:e,scheme:r,limit:n}=o,i=W(o,["concepts","scheme","limit"]);let a=[];if(e)for(let u of e){let l=yield this._getConceptMod(u);if(l){let c=yield this._artefactToJSKOS(l);c?a.push(c):console.warn("JSKOS transformation failed for concept: ",l)}}else if(r){let u=yield this._getConceptsModLimit(r,n);for(let l of u){let c=yield this._artefactToJSKOS(l);c?a.push(c):console.warn("JSKOS transformation failed for concept: ",l)}}return a})}get _language(){return this._jskos.language||this.languages[0]||this._defaultLanguages[0]||"en"}getMappings(){return[]}};ee(Xe,"providerName","ModApi"),ee(Xe,"providerType","http://bartoc.org/en/node/20333"),ee(Xe,"supports",{schemes:!0,top:!1,data:!1,concepts:!0,narrower:!1,ancestors:!1,types:!1,suggest:!1,search:!1,auth:!1,mappings:!1,concordances:!1,annotations:!1,occurrences:!1});var Ge=class extends G{constructor(e){super(e),this.endpoint=e.endpoint||e.uri}static _registryConfigForBartocApiConfig({url:e}={}){if(e)return{endpoint:e}}_getApiUrl(e,r={}){let n=this.endpoint+e.join("/");return r=Object.fromEntries(Object.entries(r).filter(([i,s])=>s!=null)),r=new URLSearchParams(r),r.size?`${n}?${r}`:n}_ontologyToJSKOS(e){var i;let r=e.lang||this._language||"en",n={};return e.iri&&(n.uri=e.iri),n.type=["http://www.w3.org/2004/02/skos/core#ConceptScheme"],e["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"]&&(n.type=n.type.concat(e["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"])),e.title&&(n.prefLabel={},n.prefLabel[r]=e.title),e.description&&(n.definition={},n.definition[r]=[e.description]),e.homepage&&(n.url=e.homepage),e.tracker&&(n.issueTracker=[{url:e.tracker}]),e.language&&(n.languages=e.language),e.ontologyId&&(n.VOCID=e.ontologyId,n.notation=[e.ontologyId]),(i=e.license)!=null&&i.url&&(n.license=[{uri:e.license.url}]),n}_termToJSKOS(e){let r=e.language||this._language||"en",n={};return e.curie&&(n.notation=[e.curie]),e.hasDirectChildren?n.narrower=[null]:n.narrower=[],e.hasDirectParents?n.broader=[null]:n.broader=[],e.iri&&(n.uri=e.iri),e["http://www.w3.org/2000/01/rdf-schema#label"]&&(n.prefLabel={},n.prefLabel[r]=e["http://www.w3.org/2000/01/rdf-schema#label"].value||e["http://www.w3.org/2000/01/rdf-schema#label"]),n.type=["http://www.w3.org/2004/02/skos/core#Concept","http://www.w3.org/2002/07/owl#Class"],e.ontologyIri&&(n.inScheme=[{uri:e.ontologyIri}]),n}_request(n){return E(this,arguments,function*(e,r={_skipAdditionalParameters:!0}){if(e){e=new URL(e);let i=Object.fromEntries(e.searchParams.entries());return this.axios(R({method:"get",url:e.origin+e.pathname,params:R(R({},i),r.params)},r))}})}_paginate(e,r,n){return E(this,null,function*(){let i=n>0?n:null,s=this._getApiUrl(e,L(R({},r),{size:i})),o=yield this._request(s),a=(o==null?void 0:o.elements)||[];if(!i){let u=(o==null?void 0:o.totalPages)||0;for(let l=1;l<u;l++)s=this._getApiUrl(e,L(R({},r),{page:l})),o=yield this._request(s),a=a.concat((o==null?void 0:o.elements)||[])}return a})}_getConceptOls(e){return E(this,null,function*(){var n,i;let r=yield this._getSchemeVOCID((n=e==null?void 0:e.inScheme)==null?void 0:n[0]);if(r){let s=null;e.notation?s=this._getApiUrl(["ontologies",r,"classes"],{curie:e.notation}):e.uri&&(s=this._getApiUrl(["ontologies",r,"classes"],{iri:e.uri}));let o=yield this._request(s);return((i=o==null?void 0:o.elements)==null?void 0:i[0])||null}})}_searchOls(e,r,n,i){return E(this,null,function*(){let s=[],o={"http://www.w3.org/2002/07/owl#Class":"classes","http://www.w3.org/1999/02/22-rdf-syntax-ns#Property":"properties"};i!=null&&i.length||(i=Object.keys(o));for(let a of i)if(a in o){let u=r?yield this._getSchemeVOCID(r):null,l={search:e,ontology:u};if(!r||u){let c=yield this._paginate([o[a]],l,n);s.push(...c)}}return s})}_conceptIriFromObj(e,r){return E(this,null,function*(){let n=this._getApiUrl(["ontologies",e,"classes"],{curie:r}),i=yield this._request(n);if(i&&i.elements&&i.elements.length>0)return i.elements[0].iri})}get _language(){return this._jskos.language||this.languages[0]||this._defaultLanguages[0]||"en"}_getSchemeVOCID(e){return E(this,null,function*(){return e!=null&&e.VOCID?e.VOCID:this._getScheme(e).then(r=>r==null?void 0:r.ontologyId)})}_getScheme(e){return E(this,null,function*(){if(e){let{VOCID:r,uri:n,notation:i,identifier:s}=e;if(r)return this._request(this._getApiUrl(["ontologies",r]));if(n&&(e=yield this._getSchemeFromUri(n),e)||i!=null&&i[0]&&(n||s!=null&&s.length)&&(e=yield this._request(this._getApiUrl(["ontologies",i[0]])),e.iri===n||s!=null&&s.includes(e.iri)))return e;for(let o of s||[]){let a=yield this._getSchemeFromUri(o);if(a)return a}}})}_getSchemeFromUri(e){return E(this,null,function*(){if(e){let r=this._getApiUrl(["ontologies"],{searchFields:"iri",search:e}),n=yield this._request(r),i=(n==null?void 0:n.elements)||[];return i.reduce((s,o)=>o.ontologyId.length<s.ontologyId.length?o:s,i[0])}return null})}getSchemes(n){return E(this,arguments,function*({schemes:e,limit:r}){let i=[];if(e)i=(yield Promise.all(e.map(s=>this._getScheme(s)))).filter(Boolean);else if(r>0){let s=this._getApiUrl(["ontologies"],{size:r});i=(yield this._request(s)).elements||[]}else i=yield this._paginate(["ontologies"],{});return Promise.all(i.map(s=>this._ontologyToJSKOS(s)))})}getConcepts(i){return E(this,arguments,function*({concepts:e,scheme:r,limit:n}){let s=[];if(e)for(let o of e){let a=yield this._getConceptOls(o);a&&s.push(yield this._termToJSKOS(a))}else if(r){let o=yield this._getSchemeVOCID(r);if(o){let a=yield this._paginate(["ontologies",o,"classes"],{},n);s=Promise.all(a.map(u=>this._termToJSKOS(u)))}}return s})}getTop(r){return E(this,arguments,function*({scheme:e}){let n=yield this._getSchemeVOCID(e);if(n){let i=yield this._paginate(["ontologies",n,"classes"],{hasDirectParents:"false"},null);return Promise.all(i.map(s=>this._termToJSKOS(s)))}return[]})}_splitConcept(e){return E(this,null,function*(){var n;let r={};return e&&(r.VOCID=yield this._getSchemeVOCID((n=e==null?void 0:e.inScheme)==null?void 0:n[0]),r.iri=e.uri||(yield this._conceptIriFromObj(r.VOCID,e.notation)),r.iri=encodeURIComponent(encodeURIComponent(r.iri))),r})}getNarrower(r){return E(this,arguments,function*({concept:e}){let{VOCID:n,iri:i}=yield this._splitConcept(e);if(n&&i){let s=yield this._paginate(["ontologies",n,"classes",i,"children"],{},0);return Promise.all(s.map(o=>this._termToJSKOS(o)))}return[]})}getAncestors(r){return E(this,arguments,function*({concept:e}){let{VOCID:n,iri:i}=yield this._splitConcept(e);if(n&&i){let s=yield this._paginate(["ontologies",n,"classes",i,"ancestors"],{},null);return Promise.all(s.map(o=>this._termToJSKOS(o)))}return[]})}getTypes(){return E(this,null,function*(){return[{uri:"http://www.w3.org/2002/07/owl#Class",prefLabel:{en:"Class",de:"Klasse"}},{uri:"http://www.w3.org/1999/02/22-rdf-syntax-ns#Property",prefLabel:{en:"Property",de:"Eigenschaft"}}]})}search(s){return E(this,arguments,function*({search:e,scheme:r=null,limit:n=0,types:i=["http://www.w3.org/2002/07/owl#Class"]}){let o=yield this._searchOls(e,r,n,i);return Promise.all(o.map(a=>this._termToJSKOS(a)))})}};ee(Ge,"providerName","OlsApi"),ee(Ge,"providerType","http://bartoc.org/api-type/ols"),ee(Ge,"supports",{schemes:!0,top:!0,data:!1,concepts:!0,narrower:!0,ancestors:!0,types:!0,suggest:!0,search:!0});var xe={},Qe=class extends G{_setup(){this._scheme=null}static _registryConfigForBartocApiConfig({url:e,scheme:r}={}){return!e||!r?null:{api:e}}_schemeInfoToJSKOS(e){let r=e.labels.find(s=>s.lang==="x-uri").text,n={};e.labels.filter(s=>!s.lang.startsWith("x-")).forEach(s=>{n[s.lang]=s.text});let i={uri:r,prefLabel:n};return e.categories&&e.categories.length&&(i.topConcepts=[null]),e.category&&e.category.length&&(i.concepts=[null]),i}_categoryToJSKOS(e,{scheme:r,broader:n=[]}){if(!e||!r)return null;let i=e.ID,s=`${r.uri}/${i}`;if(xe[r.uri].concepts[s])return xe[r.uri].concepts[s];let o={};e.labels.filter(u=>!u.lang.startsWith("x-")&&u.text).forEach(u=>{o[u.lang]=u.text.replace(`${i} `,""),xe[r.uri].searchIndex.add(s,o[u.lang])});let a={};return e.labels.filter(u=>!u.lang.startsWith("x-")&&u.description).forEach(u=>{a[u.lang]||(a[u.lang]=[]),a[u.lang].push(u.description)}),xe[r.uri].concepts[s]={uri:s,notation:[i],prefLabel:o,scopeNote:a,inScheme:[{uri:r.uri}],narrower:(e.categories||[]).map(u=>({uri:`${r.uri}/${u.ID}`})),broader:n},xe[r.uri].concepts[s]}_removeNarrower(e){return e&&Object.assign({},e,{narrower:e.narrower&&e.narrower.length?[null]:[]})}_loadSchemeData(e){return E(this,null,function*(){let r=yield this.axios(L(R({},e),{method:"get",url:this._api.api,_skipAdditionalParameters:!0}));this._scheme=this._schemeInfoToJSKOS(r);let n=this._scheme.uri;xe[n]={schemeInfo:r,searchIndex:cn.create({tokenize:"full"}),concepts:{}};let i=(s,{broader:o=[]}={})=>{let a=this._categoryToJSKOS(s,{scheme:this._scheme,broader:o});(s.categories||[]).forEach(u=>i(u,{broader:[{uri:a.uri}]}))};r.categories.forEach(s=>i(s)),xe[n].topConcepts=r.categories.map(s=>this._categoryToJSKOS(s,{scheme:this._scheme}))})}getSchemes(){return E(this,arguments,function*(e={}){if(!this._api.api)throw new Se;return this._scheme||(this._loadSchemeDataPromise||(this._loadSchemeDataPromise=this._loadSchemeData(e)),yield this._loadSchemeDataPromise),[this._scheme]})}getTop(n){return E(this,null,function*(){var i=n,{scheme:e}=i,r=W(i,["scheme"]);if(!e||!e.uri)throw new U({parameter:"scheme",message:"Missing scheme URI"});if(this._scheme||(yield this.getSchemes(r)),!P.compare(e,this._scheme))throw new U({parameter:"scheme",message:"Requested vocabulary seems to be unsupported by this API."});return xe[this._scheme.uri].topConcepts.map(this._removeNarrower)})}getConcepts(n){return E(this,null,function*(){var i=n,{concepts:e}=i,r=W(i,["concepts"]);return Array.isArray(e)||(e=[e]),this._scheme||(yield this.getSchemes(r)),e.map(s=>xe[this._scheme.uri].concepts[s.uri]).map(this._removeNarrower)})}getAncestors(n){return E(this,null,function*(){var i=n,{concept:e}=i,r=W(i,["concept"]);if(!e||!e.uri)throw new U({parameter:"concept"});if(e.ancestors&&e.ancestors[0]!==null)return e.ancestors;this._scheme||(yield this.getSchemes(r)),e=xe[this._scheme.uri].concepts[e.uri];let s=e&&e.broader&&e.broader[0];return s?[s].concat(yield this.getAncestors(R({concept:s},r))):[]})}getNarrower(n){return E(this,null,function*(){var i=n,{concept:e}=i,r=W(i,["concept"]);if(!e||!e.uri)throw new U({parameter:"concept"});return e.narrower&&e.narrower[0]!==null?e.narrower:(this._scheme||(yield this.getSchemes(r)),e=xe[this._scheme.uri].concepts[e.uri],(e&&e.narrower||[]).map(s=>xe[this._scheme.uri].concepts[s.uri]).map(this._removeNarrower))})}search(i){return E(this,arguments,function*({search:e,scheme:r,limit:n=100}){if(!r||!r.uri)throw new U({parameter:"scheme"});if(!e)throw new U({parameter:"search"});if(!r||!r.uri)throw new U({parameter:"scheme",message:"Missing scheme URI"});if(this._scheme||(yield this.getSchemes()),!P.compare(r,this._scheme))throw new U({parameter:"scheme",message:"Requested vocabulary seems to be unsupported by this API."});return(yield xe[this._scheme.uri].searchIndex.search(e)).map(o=>xe[this._scheme.uri].concepts[o]).map(this._removeNarrower).slice(0,n)})}suggest(e){return E(this,null,function*(){e._raw=!0;let r=yield this.search(e),n=[e.search,[],[],[]];for(let i of r){let s=P.notation(i),o=P.prefLabel(i);n[1].push((s?s+" ":"")+o),n[2].push(""),n[3].push(i.uri)}return r._totalCount!=null?n._totalCount=r._totalCount:n._totalCount=r.length,n})}};ee(Qe,"supports",{schemes:!0,top:!0,data:!0,concepts:!0,narrower:!0,ancestors:!0,suggest:!0,search:!0});Qe.providerName="MyCoRe";Qe.providerType="http://bartoc.org/api-type/mycore";var Sr={schemes:[]},Ze=class extends G{static _registryConfigForBartocApiConfig({url:e}={}){return e?{api:e}:null}getSchemes(){return E(this,null,function*(){var e,r;if(!Sr.schemes.length){let n=yield pe.post(this._api.api,{query:"query sources { sources { name uri description alternateName } }",operationName:"sources"}),i=((r=(e=n==null?void 0:n.data)==null?void 0:e.data)==null?void 0:r.sources)||[];if(i.length)Sr.schemes=i.map(s=>{let o={uri:s.uri,prefLabel:{und:s.name}};return s.desciption&&(o.description={und:[s.description]}),s.alternateName&&(o.notation=[s.alternateName]),o});else return[]}return Sr.schemes})}getConcepts(r){return E(this,arguments,function*({concepts:e}){var i,s;if(!e)throw new U({parameter:"concepts"});return Array.isArray(e)||(e=[e]),(((s=(i=(yield pe.post(this._api.api,{query:`query { lookup( uris: [${e.map(o=>`"${o.uri}"`)}], ) { uri source { ... on Source { uri } } result { ... on Term { uri prefLabel scopeNote altLabel broader { uri } narrower { uri } } } } }`})).data)==null?void 0:i.data)==null?void 0:s.lookup)||[]).map(o=>{var u,l,c,p,m,g,f,d,y,O;let a={uri:o.uri,inScheme:[Sr.schemes.find(I=>P.compare(I,{uri:o.source.uri}))]};return(l=(u=o.result)==null?void 0:u.prefLabel)!=null&&l[0]&&(a.prefLabel={und:o.result.prefLabel[0]}),(p=(c=o.result)==null?void 0:c.altLabel)!=null&&p[0]&&(a.altLabel={und:o.result.altLabel}),(g=(m=o.result)==null?void 0:m.scopeNote)!=null&&g[0]&&(a.scopeNote={und:o.result.scopeNote}),(d=(f=o.result)==null?void 0:f.broader)!=null&&d.length&&(a.broader=o.result.broader),(O=(y=o.result)==null?void 0:y.narrower)!=null&&O.length&&(a.narrower=o.result.narrower),a})})}suggest(e){return E(this,null,function*(){let r=e.search,n=yield this.search(e);return[r,n.map(i=>P.prefLabel(i,{fallbackToUri:!1})),[],n.map(i=>i.uri)]})}search(n){return E(this,arguments,function*({scheme:e,search:r}){var s,o,a,u,l;if(!r)throw new U({parameter:"search"});if(!e||!P.isContainedIn(e,Sr.schemes))throw new U({parameter:"scheme"});return(((l=(u=(a=(o=(s=(yield pe.post(this._api.api,{query:`query { terms( sources: ["${e.uri}"] query: "${r}" ) { source { uri } result { ... on Terms { terms { uri prefLabel scopeNote } } } }}`})).data)==null?void 0:s.data)==null?void 0:o.terms)==null?void 0:a[0])==null?void 0:u.result)==null?void 0:l.terms)||[]).map(c=>{var m,g,f;let p={uri:c.uri,inScheme:[e]};return(m=c.prefLabel)!=null&&m[0]&&(p.prefLabel={und:c.prefLabel[0]}),(g=c.altLabel)!=null&&g[0]&&(p.altLabel={und:c.altLabel}),(f=c.scopeNote)!=null&&f[0]&&(p.scopeNote={und:c.scopeNote[0]}),p})})}};ee(Ze,"supports",{schemes:!0,top:!1,data:!0,concepts:!0,narrower:!1,ancestors:!1,suggest:!0,search:!0});Ze.providerName="NoTApi";Ze.providerType="http://bartoc.org/api-type/noterms";var Ce={[G.providerName]:G,init(t){let e=t.provider;if(t.api&&Object.keys(this).find(r=>{if(Ce[r].prototype instanceof G&&t.api===Ce[r].providerType)return t=R({},t),delete t.api,e=r,!0}),this[e])return new this[e](t);throw new Ct},addProvider(t){if(t.prototype instanceof G||t===G)this[t.providerName]=t;else throw new Ct}};Ce.addProvider(Te);Ce.addProvider(Ie);Object.values(Ht).forEach(t=>{Ce.addProvider(t)});var Mi={},qt=class t{constructor(e){this.config=e,this.axios=pe.create()}setConfig(e){this.config=e}get config(){return this._config}set config(e){e=e||{},e.registries=e.registries||[],e.registries=e.registries.map(r=>Ce.init(r)).filter(r=>r),e.registries.forEach(r=>{r.cdk=this}),this._config=e}get providers(){return Ce}createInstance(e){return new t(e)}loadConfig(e){return E(this,null,function*(){let r=yield this.axios.get(e);this.config=r.data})}loadBuildInfo(o){var a=o,{url:e,buildInfo:r=null,interval:n=6e4,callback:i}=a,s=W(a,["url","buildInfo","interval","callback"]);if(!e&&!this.config.cocodaBaseUrl)throw new me({message:"Could not determine URL to load build config."});return e||(e=`${this.config.cocodaBaseUrl}build-info.json`),this.repeat(L(R({},s),{function:()=>E(this,null,function*(){return(yield this.axios.get(e,{headers:{"Cache-Control":"no-cache"}})).data}),interval:n,callback:(u,l,c)=>{u?i(u):(c||!c&&r&&!Re(l,r))&&i(null,l,c||r)}}))}getServiceForUri(e){return this.config.registries.find(r=>r.uri==e)}getRegistryForUri(e){return this.getRegistryForUri(e)}initializeService(e){return e=Ce.init(e),e.cdk=this,e}initializeRegistry(e){return this.initializeService(e)}addProvider(e){Ce.addProvider(e)}static addProvider(e){Ce.addProvider(e)}repeat({function:e,interval:r=15e3,callback:n,callImmediately:i=!0}={}){if(!e)throw new U({parameter:"function"});if(typeof e!="function")throw new U({parameter:"function",message:"function needs to be a function"});let s=()=>E(null,null,function*(){return e()});if(r=parseInt(r),isNaN(r))throw new U({parameter:"interval"});if(!n)throw new U({parameter:"callback"});if(typeof n!="function")throw new U({parameter:"callback",message:"callback needs to be a function"});let o={timer:null,result:null,error:null,isPaused:!1,interval:r},a=m=>{let g=o.result;Re(g,m)||(o.result=m,o.error=null,n(null,m,g))},u=m=>{o.error=m,n(m)},l=m=>{o.isPaused||(o.timer=setTimeout(()=>{m()},o.interval))},c=()=>s().then(a).catch(u).then(()=>l(c)),p=(m=i)=>{m?c():l(c)};return p(),{start:(...m)=>{o.isPaused=!1,p(...m)},stop:()=>{o.isPaused=!0,o.timer?clearTimeout(o.timer):setTimeout(()=>{o.timer&&clearTimeout(o.timer)},o.interval)},get isPaused(){return o.isPaused},get lastResult(){return o.result},get hasErrored(){return!!o.error},get interval(){return o.interval},set interval(m){o.interval=m}}}getSchemes(){return E(this,arguments,function*(e={}){let r=[],n=[];for(let i of this.config.registries)if(i.has.schemes!==!1){let s=i.getSchemes(e).then(o=>{for(let l of o){l._registry=i,l.__DETAILSLOADED__=1,l.type=l.type||["http://www.w3.org/2004/02/skos/core#ConceptScheme"];let c=r.find(f=>P.compare(f,l)),p,m,g=!1;if(c){p=this.config.registries.indexOf(i),p!=-1&&(p=this.config.registries.length-p),m=this.config.registries.indexOf(c==null?void 0:c._registry),m!=-1&&(m=this.config.registries.length-m);let f=l.concepts?l.concepts.length==0?-1:1:0,d=c.concepts?c.concepts.length==0?-1:1:0;f>d?g=!0:f<d?g=!1:g=m<p}if(!c||g){if(g){let f=r.findIndex(I=>P.compare(I,c));f!=-1&&r.splice(f,1);let a=c,{concepts:d,topConcepts:y}=a,O=W(a,["concepts","topConcepts"]);l=P.merge(l,O,{mergeUris:!0,skipPaths:["_registry"]})}l._registry=i,r.push(l)}else{let f=r.findIndex(d=>P.compare(d,l));if(f!=-1){let d=r[f]._registry,u=l,{concepts:y,topConcepts:O}=u,I=W(u,["concepts","topConcepts"]);r[f]=P.merge(r[f],I,{mergeUris:!0,skipPaths:["_registry"]}),r[f]._registry=d}}}}).catch(o=>{console.warn("Couldn't load schemes for registry",i.uri,o)});n.push(s)}return yield Promise.all(n),r.forEach(i=>{let s=i._registry;delete i._registry;let o=this.registryForScheme(i);!o||o._api.api===s._api.api?i._registry=s:i._registry=o}),P.sortSchemes(r.filter(Boolean))})}registryForScheme(e,r="concepts"){var i;let n=e._registry;if(n)return n;for(let s of e.API||[]){let o=s,{type:a}=o,u=W(o,["type"]);let l=u.url,c=`${a}-${l}`;if(Mi[c]){let p=Mi[c];return Array.isArray(p._jskos.schemes)&&!P.isContainedIn(e,p._jskos.schemes)&&p._jskos.schemes.push(e),p}else{u.scheme=e;for(let p of Object.values(Ce)){if((p==null?void 0:p.providerType)!==a||!p._registryConfigForBartocApiConfig||r&&!((i=p==null?void 0:p.supports)!=null&&i[r]))continue;let m=p.providerName,g=Ce[m]._registryConfigForBartocApiConfig(u);if(g){g.provider=m;try{if(n=this.initializeRegistry(g),n)return Mi[c]=n,n}catch(f){continue}}}}}return null}};var zo=new qt;function lc(t){Object.values(Ht).forEach(e=>(t||zo).addProvider(e))}return Wa(cc);})();
17
17
  /*! Bundled license information:
18
18
 
19
19
  localforage/dist/localforage.js: