@fluid-topics/ft-search-result-context 1.0.37 → 1.0.39
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.
|
@@ -3,13 +3,21 @@ import { ElementDefinitionsMap, FtLitElement } from "@fluid-topics/ft-wc-utils";
|
|
|
3
3
|
import { FtSearchResultContextProperties } from "./ft-search-result-context.properties";
|
|
4
4
|
import { FtSearchResultClusterEntry } from "@fluid-topics/public-api";
|
|
5
5
|
import { FtSearchResultComponentInterface } from "./registration";
|
|
6
|
+
export declare class SearchResultClickEvent extends CustomEvent<{
|
|
7
|
+
result: FtSearchResultClusterEntry;
|
|
8
|
+
rank: number;
|
|
9
|
+
}> {
|
|
10
|
+
constructor(result: FtSearchResultClusterEntry, rank: number);
|
|
11
|
+
}
|
|
6
12
|
export declare class FtSearchResultContext extends FtLitElement implements FtSearchResultContextProperties {
|
|
7
13
|
static elementDefinitions: ElementDefinitionsMap;
|
|
8
14
|
static styles: import("lit").CSSResult;
|
|
9
15
|
result?: FtSearchResultClusterEntry;
|
|
16
|
+
index: number;
|
|
10
17
|
private registeredComponents;
|
|
11
18
|
protected render(): import("lit-html").TemplateResult<1>;
|
|
12
19
|
get url(): string;
|
|
20
|
+
private onResultClick;
|
|
13
21
|
private registerComponent;
|
|
14
22
|
register(component: FtSearchResultComponentInterface): void;
|
|
15
23
|
protected updated(changedProperties: PropertyValues): void;
|
|
@@ -9,14 +9,20 @@ import { property } from "lit/decorators.js";
|
|
|
9
9
|
import { FtLitElement } from "@fluid-topics/ft-wc-utils";
|
|
10
10
|
import { styles } from "./ft-search-result-context.css";
|
|
11
11
|
import { FtSearchResultType } from "@fluid-topics/public-api";
|
|
12
|
+
export class SearchResultClickEvent extends CustomEvent {
|
|
13
|
+
constructor(result, rank) {
|
|
14
|
+
super("ft-search-result-click", { detail: { result, rank }, bubbles: true, composed: true });
|
|
15
|
+
}
|
|
16
|
+
}
|
|
12
17
|
class FtSearchResultContext extends FtLitElement {
|
|
13
18
|
constructor() {
|
|
14
19
|
super(...arguments);
|
|
20
|
+
this.index = 0;
|
|
15
21
|
this.registeredComponents = [];
|
|
16
22
|
}
|
|
17
23
|
render() {
|
|
18
24
|
return html `
|
|
19
|
-
<a href="${this.url}">
|
|
25
|
+
<a href="${this.url}" @click=${this.onResultClick}>
|
|
20
26
|
<slot @register-ft-search-result-component=${this.registerComponent}></slot>
|
|
21
27
|
</a>
|
|
22
28
|
`;
|
|
@@ -33,6 +39,9 @@ class FtSearchResultContext extends FtLitElement {
|
|
|
33
39
|
}
|
|
34
40
|
return "";
|
|
35
41
|
}
|
|
42
|
+
onResultClick() {
|
|
43
|
+
this.dispatchEvent(new SearchResultClickEvent(this.result, this.index + 1));
|
|
44
|
+
}
|
|
36
45
|
registerComponent(e) {
|
|
37
46
|
e.stopPropagation();
|
|
38
47
|
const component = e.composedPath()[0];
|
|
@@ -58,4 +67,7 @@ FtSearchResultContext.styles = styles;
|
|
|
58
67
|
__decorate([
|
|
59
68
|
property({ attribute: false })
|
|
60
69
|
], FtSearchResultContext.prototype, "result", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
property()
|
|
72
|
+
], FtSearchResultContext.prototype, "index", void 0);
|
|
61
73
|
export { FtSearchResultContext };
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
color: inherit;
|
|
4
4
|
text-decoration: inherit;
|
|
5
5
|
}
|
|
6
|
-
`;var o,s,u,a,h,c,f,l,E;!function(t){!function(n){var r={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(r.arrayBuffer)var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],e=ArrayBuffer.isView||function(t){return t&&i.indexOf(Object.prototype.toString.call(t))>-1};function o(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function s(t){return"string"!=typeof t&&(t=String(t)),t}function u(t){var n={next:function(){var n=t.shift();return{done:void 0===n,value:n}}};return r.iterable&&(n[Symbol.iterator]=function(){return n}),n}function a(t){this.map={},t instanceof a?t.forEach((function(t,n){this.append(n,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(n){this.append(n,t[n])}),this)}function h(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function c(t){return new Promise((function(n,r){t.onload=function(){n(t.result)},t.onerror=function(){r(t.error)}}))}function f(t){var n=new FileReader,r=c(n);return n.readAsArrayBuffer(t),r}function l(t){if(t.slice)return t.slice(0);var n=new Uint8Array(t.byteLength);return n.set(new Uint8Array(t)),n.buffer}function E(){return this.bodyUsed=!1,this._initBody=function(t){var n;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:r.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:r.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():r.arrayBuffer&&r.blob&&((n=t)&&DataView.prototype.isPrototypeOf(n))?(this._bodyArrayBuffer=l(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||e(t))?this._bodyArrayBuffer=l(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var t=h(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(f)}),this.text=function(){var t,n,r,i=h(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,n=new FileReader,r=c(n),n.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var n=new Uint8Array(t),r=new Array(n.length),i=0;i<n.length;i++)r[i]=String.fromCharCode(n[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}a.prototype.append=function(t,n){t=o(t),n=s(n);var r=this.map[t];this.map[t]=r?r+", "+n:n},a.prototype.delete=function(t){delete this.map[o(t)]},a.prototype.get=function(t){return t=o(t),this.has(t)?this.map[t]:null},a.prototype.has=function(t){return this.map.hasOwnProperty(o(t))},a.prototype.set=function(t,n){this.map[o(t)]=s(n)},a.prototype.forEach=function(t,n){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(n,this.map[r],r,this)},a.prototype.keys=function(){var t=[];return this.forEach((function(n,r){t.push(r)})),u(t)},a.prototype.values=function(){var t=[];return this.forEach((function(n){t.push(n)})),u(t)},a.prototype.entries=function(){var t=[];return this.forEach((function(n,r){t.push([r,n])})),u(t)},r.iterable&&(a.prototype[Symbol.iterator]=a.prototype.entries);var A=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function d(t,n){var r,i,e=(n=n||{}).body;if(t instanceof d){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,n.headers||(this.headers=new a(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,e||null==t._bodyInit||(e=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=n.credentials||this.credentials||"same-origin",!n.headers&&this.headers||(this.headers=new a(n.headers)),this.method=(r=n.method||this.method||"GET",i=r.toUpperCase(),A.indexOf(i)>-1?i:r),this.mode=n.mode||this.mode||null,this.signal=n.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&e)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(e)}function w(t){var n=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),i=r.shift().replace(/\+/g," "),e=r.join("=").replace(/\+/g," ");n.append(decodeURIComponent(i),decodeURIComponent(e))}})),n}function T(t,n){n||(n={}),this.type="default",this.status=void 0===n.status?200:n.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in n?n.statusText:"OK",this.headers=new a(n.headers),this.url=n.url||"",this._initBody(t)}d.prototype.clone=function(){return new d(this,{body:this._bodyInit})},E.call(d.prototype),E.call(T.prototype),T.prototype.clone=function(){return new T(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new a(this.headers),url:this.url})},T.error=function(){var t=new T(null,{status:0,statusText:""});return t.type="error",t};var R=[301,302,303,307,308];T.redirect=function(t,n){if(-1===R.indexOf(n))throw new RangeError("Invalid status code");return new T(null,{status:n,headers:{location:t}})},n.DOMException=t.DOMException;try{new n.DOMException}catch(t){n.DOMException=function(t,n){this.message=t,this.name=n;var r=Error(t);this.stack=r.stack},n.DOMException.prototype=Object.create(Error.prototype),n.DOMException.prototype.constructor=n.DOMException}function b(t,i){return new Promise((function(e,o){var s=new d(t,i);if(s.signal&&s.signal.aborted)return o(new n.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function h(){u.abort()}u.onload=function(){var t,n,r={status:u.status,statusText:u.statusText,headers:(t=u.getAllResponseHeaders()||"",n=new a,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),i=r.shift().trim();if(i){var e=r.join(":").trim();n.append(i,e)}})),n)};r.url="responseURL"in u?u.responseURL:r.headers.get("X-Request-URL");var i="response"in u?u.response:u.responseText;e(new T(i,r))},u.onerror=function(){o(new TypeError("Network request failed"))},u.ontimeout=function(){o(new TypeError("Network request failed"))},u.onabort=function(){o(new n.DOMException("Aborted","AbortError"))},u.open(s.method,s.url,!0),"include"===s.credentials?u.withCredentials=!0:"omit"===s.credentials&&(u.withCredentials=!1),"responseType"in u&&r.blob&&(u.responseType="blob"),s.headers.forEach((function(t,n){u.setRequestHeader(n,t)})),s.signal&&(s.signal.addEventListener("abort",h),u.onreadystatechange=function(){4===u.readyState&&s.signal.removeEventListener("abort",h)}),u.send(void 0===s._bodyInit?null:s._bodyInit)}))}b.polyfill=!0,t.fetch||(t.fetch=b,t.Headers=a,t.Request=d,t.Response=T),n.Headers=a,n.Request=d,n.Response=T,n.fetch=b,Object.defineProperty(n,"t",{value:!0})}({})}("undefined"!=typeof self?self:void 0),function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"}(o||(o={})),function(t){t.THIRD_PARTY="THIRD_PARTY",t.OFF_THE_GRID="OFF_THE_GRID",t.CONTENT_PACKAGER="CONTENT_PACKAGER",t.PAGES="PAGES",t.DESIGNED_READER="DESIGNED_READER"}(s||(s={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(u||(u={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}(a||(a={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK"}(h||(h={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(c||(c={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(f||(f={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(l||(l={})),function(t){t.PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",t.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",t.HTML_EXPORT_USER="HTML_EXPORT_USER",t.PDF_EXPORT_USER="PDF_EXPORT_USER",t.SAVED_SEARCH_USER="SAVED_SEARCH_USER",t.COLLECTION_USER="COLLECTION_USER",t.OFFLINE_USER="OFFLINE_USER",t.ANALYTICS_USER="ANALYTICS_USER",t.BETA_USER="BETA_USER",t.DEBUG_USER="DEBUG_USER",t.PRINT_USER="PRINT_USER",t.RATING_USER="RATING_USER",t.FEEDBACK_USER="FEEDBACK_USER",t.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN",t.DEVELOPER="DEVELOPER"}(E||(E={}));var A=function(t,n,r,i){for(var e,o=arguments.length,s=o<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i,u=t.length-1;u>=0;u--)(e=t[u])&&(s=(o<3?e(s):o>3?e(n,r,s):e(n,r))||s);return o>3&&s&&Object.defineProperty(n,r,s),s};class d extends n.FtLitElement{constructor(){super(...arguments),this.registeredComponents=[]}render(){return r.html`
|
|
7
|
-
<a href="${this.url}">
|
|
6
|
+
`;var s,o,u,a,h,c,f,l,E;!function(t){!function(n){var r={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(r.arrayBuffer)var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],e=ArrayBuffer.isView||function(t){return t&&i.indexOf(Object.prototype.toString.call(t))>-1};function s(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function o(t){return"string"!=typeof t&&(t=String(t)),t}function u(t){var n={next:function(){var n=t.shift();return{done:void 0===n,value:n}}};return r.iterable&&(n[Symbol.iterator]=function(){return n}),n}function a(t){this.map={},t instanceof a?t.forEach((function(t,n){this.append(n,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(n){this.append(n,t[n])}),this)}function h(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function c(t){return new Promise((function(n,r){t.onload=function(){n(t.result)},t.onerror=function(){r(t.error)}}))}function f(t){var n=new FileReader,r=c(n);return n.readAsArrayBuffer(t),r}function l(t){if(t.slice)return t.slice(0);var n=new Uint8Array(t.byteLength);return n.set(new Uint8Array(t)),n.buffer}function E(){return this.bodyUsed=!1,this._initBody=function(t){var n;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:r.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:r.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():r.arrayBuffer&&r.blob&&((n=t)&&DataView.prototype.isPrototypeOf(n))?(this._bodyArrayBuffer=l(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||e(t))?this._bodyArrayBuffer=l(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var t=h(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?h(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(f)}),this.text=function(){var t,n,r,i=h(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,n=new FileReader,r=c(n),n.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var n=new Uint8Array(t),r=new Array(n.length),i=0;i<n.length;i++)r[i]=String.fromCharCode(n[i]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}a.prototype.append=function(t,n){t=s(t),n=o(n);var r=this.map[t];this.map[t]=r?r+", "+n:n},a.prototype.delete=function(t){delete this.map[s(t)]},a.prototype.get=function(t){return t=s(t),this.has(t)?this.map[t]:null},a.prototype.has=function(t){return this.map.hasOwnProperty(s(t))},a.prototype.set=function(t,n){this.map[s(t)]=o(n)},a.prototype.forEach=function(t,n){for(var r in this.map)this.map.hasOwnProperty(r)&&t.call(n,this.map[r],r,this)},a.prototype.keys=function(){var t=[];return this.forEach((function(n,r){t.push(r)})),u(t)},a.prototype.values=function(){var t=[];return this.forEach((function(n){t.push(n)})),u(t)},a.prototype.entries=function(){var t=[];return this.forEach((function(n,r){t.push([r,n])})),u(t)},r.iterable&&(a.prototype[Symbol.iterator]=a.prototype.entries);var d=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function A(t,n){var r,i,e=(n=n||{}).body;if(t instanceof A){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,n.headers||(this.headers=new a(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,e||null==t._bodyInit||(e=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=n.credentials||this.credentials||"same-origin",!n.headers&&this.headers||(this.headers=new a(n.headers)),this.method=(r=n.method||this.method||"GET",i=r.toUpperCase(),d.indexOf(i)>-1?i:r),this.mode=n.mode||this.mode||null,this.signal=n.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&e)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(e)}function w(t){var n=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),i=r.shift().replace(/\+/g," "),e=r.join("=").replace(/\+/g," ");n.append(decodeURIComponent(i),decodeURIComponent(e))}})),n}function b(t,n){n||(n={}),this.type="default",this.status=void 0===n.status?200:n.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in n?n.statusText:"OK",this.headers=new a(n.headers),this.url=n.url||"",this._initBody(t)}A.prototype.clone=function(){return new A(this,{body:this._bodyInit})},E.call(A.prototype),E.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new a(this.headers),url:this.url})},b.error=function(){var t=new b(null,{status:0,statusText:""});return t.type="error",t};var R=[301,302,303,307,308];b.redirect=function(t,n){if(-1===R.indexOf(n))throw new RangeError("Invalid status code");return new b(null,{status:n,headers:{location:t}})},n.DOMException=t.DOMException;try{new n.DOMException}catch(t){n.DOMException=function(t,n){this.message=t,this.name=n;var r=Error(t);this.stack=r.stack},n.DOMException.prototype=Object.create(Error.prototype),n.DOMException.prototype.constructor=n.DOMException}function T(t,i){return new Promise((function(e,s){var o=new A(t,i);if(o.signal&&o.signal.aborted)return s(new n.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function h(){u.abort()}u.onload=function(){var t,n,r={status:u.status,statusText:u.statusText,headers:(t=u.getAllResponseHeaders()||"",n=new a,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),i=r.shift().trim();if(i){var e=r.join(":").trim();n.append(i,e)}})),n)};r.url="responseURL"in u?u.responseURL:r.headers.get("X-Request-URL");var i="response"in u?u.response:u.responseText;e(new b(i,r))},u.onerror=function(){s(new TypeError("Network request failed"))},u.ontimeout=function(){s(new TypeError("Network request failed"))},u.onabort=function(){s(new n.DOMException("Aborted","AbortError"))},u.open(o.method,o.url,!0),"include"===o.credentials?u.withCredentials=!0:"omit"===o.credentials&&(u.withCredentials=!1),"responseType"in u&&r.blob&&(u.responseType="blob"),o.headers.forEach((function(t,n){u.setRequestHeader(n,t)})),o.signal&&(o.signal.addEventListener("abort",h),u.onreadystatechange=function(){4===u.readyState&&o.signal.removeEventListener("abort",h)}),u.send(void 0===o._bodyInit?null:o._bodyInit)}))}T.polyfill=!0,t.fetch||(t.fetch=T,t.Headers=a,t.Request=A,t.Response=b),n.Headers=a,n.Request=A,n.Response=b,n.fetch=T,Object.defineProperty(n,"t",{value:!0})}({})}("undefined"!=typeof self?self:void 0),function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"}(s||(s={})),function(t){t.THIRD_PARTY="THIRD_PARTY",t.OFF_THE_GRID="OFF_THE_GRID",t.CONTENT_PACKAGER="CONTENT_PACKAGER",t.PAGES="PAGES",t.DESIGNED_READER="DESIGNED_READER"}(o||(o={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(u||(u={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}(a||(a={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK"}(h||(h={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(c||(c={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(f||(f={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(l||(l={})),function(t){t.PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",t.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",t.HTML_EXPORT_USER="HTML_EXPORT_USER",t.PDF_EXPORT_USER="PDF_EXPORT_USER",t.SAVED_SEARCH_USER="SAVED_SEARCH_USER",t.COLLECTION_USER="COLLECTION_USER",t.OFFLINE_USER="OFFLINE_USER",t.ANALYTICS_USER="ANALYTICS_USER",t.BETA_USER="BETA_USER",t.DEBUG_USER="DEBUG_USER",t.PRINT_USER="PRINT_USER",t.RATING_USER="RATING_USER",t.FEEDBACK_USER="FEEDBACK_USER",t.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN",t.DEVELOPER="DEVELOPER"}(E||(E={})),E.PERSONAL_BOOK_SHARE_USER,E.PERSONAL_BOOK_USER,E.HTML_EXPORT_USER,E.PERSONAL_BOOK_USER,E.PDF_EXPORT_USER,E.PERSONAL_BOOK_USER,E.KHUB_ADMIN,E.CONTENT_PUBLISHER,E.ADMIN,E.KHUB_ADMIN,E.USERS_ADMIN,E.PORTAL_ADMIN,E.DEVELOPER,E.BETA_USER,E.DEBUG_USER;var d=function(t,n,r,i){for(var e,s=arguments.length,o=s<3?n:null===i?i=Object.getOwnPropertyDescriptor(n,r):i,u=t.length-1;u>=0;u--)(e=t[u])&&(o=(s<3?e(o):s>3?e(n,r,o):e(n,r))||o);return s>3&&o&&Object.defineProperty(n,r,o),o};class A extends CustomEvent{constructor(t,n){super("ft-search-result-click",{detail:{result:t,rank:n},bubbles:!0,composed:!0})}}class w extends n.FtLitElement{constructor(){super(...arguments),this.index=0,this.registeredComponents=[]}render(){return r.html`
|
|
7
|
+
<a href="${this.url}" @click=${this.onResultClick}>
|
|
8
8
|
<slot @register-ft-search-result-component=${this.registerComponent}></slot>
|
|
9
9
|
</a>
|
|
10
|
-
`}get url(){var t;switch(null===(t=this.result)||void 0===t?void 0:t.type){case l.MAP:return this.result.map.readerUrl;case l.DOCUMENT:return this.result.document.viewerUrl;case l.TOPIC:return this.result.topic.readerUrl}return""}registerComponent(t){t.stopPropagation();const n=t.composedPath()[0];this.register(n)}register(t){this.registeredComponents.push(t),t.result=this.result}updated(t){super.updated(t),t.has("result")&&this.registeredComponents.forEach((t=>t.result=this.result))}disconnectedCallback(){super.disconnectedCallback(),this.registeredComponents=[]}}
|
|
10
|
+
`}get url(){var t;switch(null===(t=this.result)||void 0===t?void 0:t.type){case l.MAP:return this.result.map.readerUrl;case l.DOCUMENT:return this.result.document.viewerUrl;case l.TOPIC:return this.result.topic.readerUrl}return""}onResultClick(){this.dispatchEvent(new A(this.result,this.index+1))}registerComponent(t){t.stopPropagation();const n=t.composedPath()[0];this.register(n)}register(t){this.registeredComponents.push(t),t.result=this.result}updated(t){super.updated(t),t.has("result")&&this.registeredComponents.forEach((t=>t.result=this.result))}disconnectedCallback(){super.disconnectedCallback(),this.registeredComponents=[]}}w.elementDefinitions={},w.styles=e,d([i.property({attribute:!1})],w.prototype,"result",void 0),d([i.property()],w.prototype,"index",void 0),n.customElement("ft-search-result-context")(w),t.FtSearchResultContext=w,t.FtSearchResultContextCssVariables={},t.SearchResultClickEvent=A,t.styles=e}({},ftGlobals.wcUtils,ftGlobals.lit,ftGlobals.litDecorators);
|
|
@@ -41,7 +41,7 @@ const o=window,a=o.ShadowRoot&&(void 0===o.ShadyCSS||o.ShadyCSS.nativeShadow)&&"
|
|
|
41
41
|
* Copyright 2017 Google LLC
|
|
42
42
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
43
43
|
*/
|
|
44
|
-
var R;O.finalized=!0,O.elementProperties=new Map,O.elementStyles=[],O.shadowRootOptions={mode:"open"},null==m||m({ReactiveElement:O}),(null!==(v=b.reactiveElementVersions)&&void 0!==v?v:b.reactiveElementVersions=[]).push("1.6.1");const S=window,N=S.trustedTypes,A=N?N.createPolicy("lit-html",{createHTML:t=>t}):void 0,
|
|
44
|
+
var R;O.finalized=!0,O.elementProperties=new Map,O.elementStyles=[],O.shadowRootOptions={mode:"open"},null==m||m({ReactiveElement:O}),(null!==(v=b.reactiveElementVersions)&&void 0!==v?v:b.reactiveElementVersions=[]).push("1.6.1");const S=window,N=S.trustedTypes,A=N?N.createPolicy("lit-html",{createHTML:t=>t}):void 0,C="$lit$",U=`lit$${(Math.random()+"").slice(9)}$`,T="?"+U,M=`<${T}>`,_=document,L=()=>_.createComment(""),k=t=>null===t||"object"!=typeof t&&"function"!=typeof t,F=Array.isArray,$="[ \t\n\f\r]",j=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,B=/-->/g,P=/>/g,D=RegExp(`>|${$}(?:([^\\s"'>=/]+)(${$}*=${$}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),I=/'/g,K=/"/g,H=/^(?:script|style|textarea|title)$/i,W=(t=>(i,...e)=>({_$litType$:t,strings:i,values:e}))(1),G=Symbol.for("lit-noChange"),z=Symbol.for("lit-nothing"),V=new WeakMap,q=_.createTreeWalker(_,129,null,!1),J=(t,i)=>{const e=t.length-1,s=[];let n,r=2===i?"<svg>":"",o=j;for(let i=0;i<e;i++){const e=t[i];let a,h,c=-1,l=0;for(;l<e.length&&(o.lastIndex=l,h=o.exec(e),null!==h);)l=o.lastIndex,o===j?"!--"===h[1]?o=B:void 0!==h[1]?o=P:void 0!==h[2]?(H.test(h[2])&&(n=RegExp("</"+h[2],"g")),o=D):void 0!==h[3]&&(o=D):o===D?">"===h[0]?(o=null!=n?n:j,c=-1):void 0===h[1]?c=-2:(c=o.lastIndex-h[2].length,a=h[1],o=void 0===h[3]?D:'"'===h[3]?K:I):o===K||o===I?o=D:o===B||o===P?o=j:(o=D,n=void 0);const u=o===D&&t[i+1].startsWith("/>")?" ":"";r+=o===j?e+M:c>=0?(s.push(a),e.slice(0,c)+C+e.slice(c)+U+u):e+U+(-2===c?(s.push(void 0),i):u)}const a=r+(t[e]||"<?>")+(2===i?"</svg>":"");if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return[void 0!==A?A.createHTML(a):a,s]};class X{constructor({strings:t,_$litType$:i},e){let s;this.parts=[];let n=0,r=0;const o=t.length-1,a=this.parts,[h,c]=J(t,i);if(this.el=X.createElement(h,e),q.currentNode=this.el.content,2===i){const t=this.el.content,i=t.firstChild;i.remove(),t.append(...i.childNodes)}for(;null!==(s=q.nextNode())&&a.length<o;){if(1===s.nodeType){if(s.hasAttributes()){const t=[];for(const i of s.getAttributeNames())if(i.endsWith(C)||i.startsWith(U)){const e=c[r++];if(t.push(i),void 0!==e){const t=s.getAttribute(e.toLowerCase()+C).split(U),i=/([.?@])?(.*)/.exec(e);a.push({type:1,index:n,name:i[2],strings:t,ctor:"."===i[1]?it:"?"===i[1]?st:"@"===i[1]?nt:tt})}else a.push({type:6,index:n})}for(const i of t)s.removeAttribute(i)}if(H.test(s.tagName)){const t=s.textContent.split(U),i=t.length-1;if(i>0){s.textContent=N?N.emptyScript:"";for(let e=0;e<i;e++)s.append(t[e],L()),q.nextNode(),a.push({type:2,index:++n});s.append(t[i],L())}}}else if(8===s.nodeType)if(s.data===T)a.push({type:2,index:n});else{let t=-1;for(;-1!==(t=s.data.indexOf(U,t+1));)a.push({type:7,index:n}),t+=U.length-1}n++}}static createElement(t,i){const e=_.createElement("template");return e.innerHTML=t,e}}function Z(t,i,e=t,s){var n,r,o,a;if(i===G)return i;let h=void 0!==s?null===(n=e._$Co)||void 0===n?void 0:n[s]:e._$Cl;const c=k(i)?void 0:i._$litDirective$;return(null==h?void 0:h.constructor)!==c&&(null===(r=null==h?void 0:h._$AO)||void 0===r||r.call(h,!1),void 0===c?h=void 0:(h=new c(t),h._$AT(t,e,s)),void 0!==s?(null!==(o=(a=e)._$Co)&&void 0!==o?o:a._$Co=[])[s]=h:e._$Cl=h),void 0!==h&&(i=Z(t,h._$AS(t,i.values),h,s)),i}class Y{constructor(t,i){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=i}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){var i;const{el:{content:e},parts:s}=this._$AD,n=(null!==(i=null==t?void 0:t.creationScope)&&void 0!==i?i:_).importNode(e,!0);q.currentNode=n;let r=q.nextNode(),o=0,a=0,h=s[0];for(;void 0!==h;){if(o===h.index){let i;2===h.type?i=new Q(r,r.nextSibling,this,t):1===h.type?i=new h.ctor(r,h.name,h.strings,this,t):6===h.type&&(i=new rt(r,this,t)),this._$AV.push(i),h=s[++a]}o!==(null==h?void 0:h.index)&&(r=q.nextNode(),o++)}return n}v(t){let i=0;for(const e of this._$AV)void 0!==e&&(void 0!==e.strings?(e._$AI(t,e,i),i+=e.strings.length-2):e._$AI(t[i])),i++}}class Q{constructor(t,i,e,s){var n;this.type=2,this._$AH=z,this._$AN=void 0,this._$AA=t,this._$AB=i,this._$AM=e,this.options=s,this._$Cp=null===(n=null==s?void 0:s.isConnected)||void 0===n||n}get _$AU(){var t,i;return null!==(i=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==i?i:this._$Cp}get parentNode(){let t=this._$AA.parentNode;const i=this._$AM;return void 0!==i&&11===(null==t?void 0:t.nodeType)&&(t=i.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,i=this){t=Z(this,t,i),k(t)?t===z||null==t||""===t?(this._$AH!==z&&this._$AR(),this._$AH=z):t!==this._$AH&&t!==G&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>F(t)||"function"==typeof(null==t?void 0:t[Symbol.iterator]))(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==z&&k(this._$AH)?this._$AA.nextSibling.data=t:this.$(_.createTextNode(t)),this._$AH=t}g(t){var i;const{values:e,_$litType$:s}=t,n="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=X.createElement(s.h,this.options)),s);if((null===(i=this._$AH)||void 0===i?void 0:i._$AD)===n)this._$AH.v(e);else{const t=new Y(n,this),i=t.u(this.options);t.v(e),this.$(i),this._$AH=t}}_$AC(t){let i=V.get(t.strings);return void 0===i&&V.set(t.strings,i=new X(t)),i}T(t){F(this._$AH)||(this._$AH=[],this._$AR());const i=this._$AH;let e,s=0;for(const n of t)s===i.length?i.push(e=new Q(this.k(L()),this.k(L()),this,this.options)):e=i[s],e._$AI(n),s++;s<i.length&&(this._$AR(e&&e._$AB.nextSibling,s),i.length=s)}_$AR(t=this._$AA.nextSibling,i){var e;for(null===(e=this._$AP)||void 0===e||e.call(this,!1,!0,i);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var i;void 0===this._$AM&&(this._$Cp=t,null===(i=this._$AP)||void 0===i||i.call(this,t))}}class tt{constructor(t,i,e,s,n){this.type=1,this._$AH=z,this._$AN=void 0,this.element=t,this.name=i,this._$AM=s,this.options=n,e.length>2||""!==e[0]||""!==e[1]?(this._$AH=Array(e.length-1).fill(new String),this.strings=e):this._$AH=z}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,i=this,e,s){const n=this.strings;let r=!1;if(void 0===n)t=Z(this,t,i,0),r=!k(t)||t!==this._$AH&&t!==G,r&&(this._$AH=t);else{const s=t;let o,a;for(t=n[0],o=0;o<n.length-1;o++)a=Z(this,s[e+o],i,o),a===G&&(a=this._$AH[o]),r||(r=!k(a)||a!==this._$AH[o]),a===z?t=z:t!==z&&(t+=(null!=a?a:"")+n[o+1]),this._$AH[o]=a}r&&!s&&this.j(t)}j(t){t===z?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class it extends tt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===z?void 0:t}}const et=N?N.emptyScript:"";class st extends tt{constructor(){super(...arguments),this.type=4}j(t){t&&t!==z?this.element.setAttribute(this.name,et):this.element.removeAttribute(this.name)}}class nt extends tt{constructor(t,i,e,s,n){super(t,i,e,s,n),this.type=5}_$AI(t,i=this){var e;if((t=null!==(e=Z(this,t,i,0))&&void 0!==e?e:z)===G)return;const s=this._$AH,n=t===z&&s!==z||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,r=t!==z&&(s===z||n);n&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var i,e;"function"==typeof this._$AH?this._$AH.call(null!==(e=null===(i=this.options)||void 0===i?void 0:i.host)&&void 0!==e?e:this.element,t):this._$AH.handleEvent(t)}}class rt{constructor(t,i,e){this.element=t,this.type=6,this._$AN=void 0,this._$AM=i,this.options=e}get _$AU(){return this._$AM._$AU}_$AI(t){Z(this,t)}}const ot=S.litHtmlPolyfillSupport;null==ot||ot(X,Q),(null!==(R=S.litHtmlVersions)&&void 0!==R?R:S.litHtmlVersions=[]).push("2.7.3");
|
|
45
45
|
/**
|
|
46
46
|
* @license
|
|
47
47
|
* Copyright 2017 Google LLC
|
|
@@ -84,8 +84,8 @@ var at,ht;class ct extends O{constructor(){super(...arguments),this.renderOption
|
|
|
84
84
|
color: inherit;
|
|
85
85
|
text-decoration: inherit;
|
|
86
86
|
}
|
|
87
|
-
`;var Et,Ot,Rt,St,Nt,At,Ut,Ct,Tt;!function(t){!function(i){var e={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(e.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=ArrayBuffer.isView||function(t){return t&&s.indexOf(Object.prototype.toString.call(t))>-1};function r(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function o(t){return"string"!=typeof t&&(t=String(t)),t}function a(t){var i={next:function(){var i=t.shift();return{done:void 0===i,value:i}}};return e.iterable&&(i[Symbol.iterator]=function(){return i}),i}function h(t){this.map={},t instanceof h?t.forEach((function(t,i){this.append(i,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(i){this.append(i,t[i])}),this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function l(t){return new Promise((function(i,e){t.onload=function(){i(t.result)},t.onerror=function(){e(t.error)}}))}function u(t){var i=new FileReader,e=l(i);return i.readAsArrayBuffer(t),e}function d(t){if(t.slice)return t.slice(0);var i=new Uint8Array(t.byteLength);return i.set(new Uint8Array(t)),i.buffer}function f(){return this.bodyUsed=!1,this._initBody=function(t){var i;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:e.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:e.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():e.arrayBuffer&&e.blob&&((i=t)&&DataView.prototype.isPrototypeOf(i))?(this._bodyArrayBuffer=d(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):e.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||n(t))?this._bodyArrayBuffer=d(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},e.blob&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(u)}),this.text=function(){var t,i,e,s=c(this);if(s)return s;if(this._bodyBlob)return t=this._bodyBlob,i=new FileReader,e=l(i),i.readAsText(t),e;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var i=new Uint8Array(t),e=new Array(i.length),s=0;s<i.length;s++)e[s]=String.fromCharCode(i[s]);return e.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},e.formData&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}h.prototype.append=function(t,i){t=r(t),i=o(i);var e=this.map[t];this.map[t]=e?e+", "+i:i},h.prototype.delete=function(t){delete this.map[r(t)]},h.prototype.get=function(t){return t=r(t),this.has(t)?this.map[t]:null},h.prototype.has=function(t){return this.map.hasOwnProperty(r(t))},h.prototype.set=function(t,i){this.map[r(t)]=o(i)},h.prototype.forEach=function(t,i){for(var e in this.map)this.map.hasOwnProperty(e)&&t.call(i,this.map[e],e,this)},h.prototype.keys=function(){var t=[];return this.forEach((function(i,e){t.push(e)})),a(t)},h.prototype.values=function(){var t=[];return this.forEach((function(i){t.push(i)})),a(t)},h.prototype.entries=function(){var t=[];return this.forEach((function(i,e){t.push([e,i])})),a(t)},e.iterable&&(h.prototype[Symbol.iterator]=h.prototype.entries);var p=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function v(t,i){var e,s,n=(i=i||{}).body;if(t instanceof v){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,i.headers||(this.headers=new h(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=i.credentials||this.credentials||"same-origin",!i.headers&&this.headers||(this.headers=new h(i.headers)),this.method=(e=i.method||this.method||"GET",s=e.toUpperCase(),p.indexOf(s)>-1?s:e),this.mode=i.mode||this.mode||null,this.signal=i.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function b(t){var i=new FormData;return t.trim().split("&").forEach((function(t){if(t){var e=t.split("="),s=e.shift().replace(/\+/g," "),n=e.join("=").replace(/\+/g," ");i.append(decodeURIComponent(s),decodeURIComponent(n))}})),i}function w(t,i){i||(i={}),this.type="default",this.status=void 0===i.status?200:i.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in i?i.statusText:"OK",this.headers=new h(i.headers),this.url=i.url||"",this._initBody(t)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},f.call(v.prototype),f.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},w.error=function(){var t=new w(null,{status:0,statusText:""});return t.type="error",t};var y=[301,302,303,307,308];w.redirect=function(t,i){if(-1===y.indexOf(i))throw new RangeError("Invalid status code");return new w(null,{status:i,headers:{location:t}})},i.DOMException=t.DOMException;try{new i.DOMException}catch(t){i.DOMException=function(t,i){this.message=t,this.name=i;var e=Error(t);this.stack=e.stack},i.DOMException.prototype=Object.create(Error.prototype),i.DOMException.prototype.constructor=i.DOMException}function m(t,s){return new Promise((function(n,r){var o=new v(t,s);if(o.signal&&o.signal.aborted)return r(new i.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var t,i,e={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",i=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var e=t.split(":"),s=e.shift().trim();if(s){var n=e.join(":").trim();i.append(s,n)}})),i)};e.url="responseURL"in a?a.responseURL:e.headers.get("X-Request-URL");var s="response"in a?a.response:a.responseText;n(new w(s,e))},a.onerror=function(){r(new TypeError("Network request failed"))},a.ontimeout=function(){r(new TypeError("Network request failed"))},a.onabort=function(){r(new i.DOMException("Aborted","AbortError"))},a.open(o.method,o.url,!0),"include"===o.credentials?a.withCredentials=!0:"omit"===o.credentials&&(a.withCredentials=!1),"responseType"in a&&e.blob&&(a.responseType="blob"),o.headers.forEach((function(t,i){a.setRequestHeader(i,t)})),o.signal&&(o.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&o.signal.removeEventListener("abort",c)}),a.send(void 0===o._bodyInit?null:o._bodyInit)}))}m.polyfill=!0,t.fetch||(t.fetch=m,t.Headers=h,t.Request=v,t.Response=w),i.Headers=h,i.Request=v,i.Response=w,i.fetch=m,Object.defineProperty(i,"i",{value:!0})}({})}("undefined"!=typeof self?self:void 0),function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"}(Et||(Et={})),function(t){t.THIRD_PARTY="THIRD_PARTY",t.OFF_THE_GRID="OFF_THE_GRID",t.CONTENT_PACKAGER="CONTENT_PACKAGER",t.PAGES="PAGES",t.DESIGNED_READER="DESIGNED_READER"}(Ot||(Ot={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(Rt||(Rt={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}(St||(St={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK"}(Nt||(Nt={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(At||(At={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(Ut||(Ut={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(Ct||(Ct={})),function(t){t.PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",t.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",t.HTML_EXPORT_USER="HTML_EXPORT_USER",t.PDF_EXPORT_USER="PDF_EXPORT_USER",t.SAVED_SEARCH_USER="SAVED_SEARCH_USER",t.COLLECTION_USER="COLLECTION_USER",t.OFFLINE_USER="OFFLINE_USER",t.ANALYTICS_USER="ANALYTICS_USER",t.BETA_USER="BETA_USER",t.DEBUG_USER="DEBUG_USER",t.PRINT_USER="PRINT_USER",t.RATING_USER="RATING_USER",t.FEEDBACK_USER="FEEDBACK_USER",t.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN",t.DEVELOPER="DEVELOPER"}(Tt||(Tt={}));var Mt,_t=function(t,i,e,s){for(var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s,a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o};class Lt extends yt{constructor(){super(...arguments),this.registeredComponents=[]}render(){return W`
|
|
88
|
-
<a href="${this.url}">
|
|
87
|
+
`;var Et,Ot,Rt,St,Nt,At,Ct,Ut,Tt;!function(t){!function(i){var e={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(e.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],n=ArrayBuffer.isView||function(t){return t&&s.indexOf(Object.prototype.toString.call(t))>-1};function r(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function o(t){return"string"!=typeof t&&(t=String(t)),t}function a(t){var i={next:function(){var i=t.shift();return{done:void 0===i,value:i}}};return e.iterable&&(i[Symbol.iterator]=function(){return i}),i}function h(t){this.map={},t instanceof h?t.forEach((function(t,i){this.append(i,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(i){this.append(i,t[i])}),this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function l(t){return new Promise((function(i,e){t.onload=function(){i(t.result)},t.onerror=function(){e(t.error)}}))}function u(t){var i=new FileReader,e=l(i);return i.readAsArrayBuffer(t),e}function d(t){if(t.slice)return t.slice(0);var i=new Uint8Array(t.byteLength);return i.set(new Uint8Array(t)),i.buffer}function f(){return this.bodyUsed=!1,this._initBody=function(t){var i;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:e.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:e.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():e.arrayBuffer&&e.blob&&((i=t)&&DataView.prototype.isPrototypeOf(i))?(this._bodyArrayBuffer=d(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):e.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||n(t))?this._bodyArrayBuffer=d(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):e.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},e.blob&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(u)}),this.text=function(){var t,i,e,s=c(this);if(s)return s;if(this._bodyBlob)return t=this._bodyBlob,i=new FileReader,e=l(i),i.readAsText(t),e;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var i=new Uint8Array(t),e=new Array(i.length),s=0;s<i.length;s++)e[s]=String.fromCharCode(i[s]);return e.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},e.formData&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}h.prototype.append=function(t,i){t=r(t),i=o(i);var e=this.map[t];this.map[t]=e?e+", "+i:i},h.prototype.delete=function(t){delete this.map[r(t)]},h.prototype.get=function(t){return t=r(t),this.has(t)?this.map[t]:null},h.prototype.has=function(t){return this.map.hasOwnProperty(r(t))},h.prototype.set=function(t,i){this.map[r(t)]=o(i)},h.prototype.forEach=function(t,i){for(var e in this.map)this.map.hasOwnProperty(e)&&t.call(i,this.map[e],e,this)},h.prototype.keys=function(){var t=[];return this.forEach((function(i,e){t.push(e)})),a(t)},h.prototype.values=function(){var t=[];return this.forEach((function(i){t.push(i)})),a(t)},h.prototype.entries=function(){var t=[];return this.forEach((function(i,e){t.push([e,i])})),a(t)},e.iterable&&(h.prototype[Symbol.iterator]=h.prototype.entries);var p=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function v(t,i){var e,s,n=(i=i||{}).body;if(t instanceof v){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,i.headers||(this.headers=new h(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=i.credentials||this.credentials||"same-origin",!i.headers&&this.headers||(this.headers=new h(i.headers)),this.method=(e=i.method||this.method||"GET",s=e.toUpperCase(),p.indexOf(s)>-1?s:e),this.mode=i.mode||this.mode||null,this.signal=i.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function b(t){var i=new FormData;return t.trim().split("&").forEach((function(t){if(t){var e=t.split("="),s=e.shift().replace(/\+/g," "),n=e.join("=").replace(/\+/g," ");i.append(decodeURIComponent(s),decodeURIComponent(n))}})),i}function w(t,i){i||(i={}),this.type="default",this.status=void 0===i.status?200:i.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in i?i.statusText:"OK",this.headers=new h(i.headers),this.url=i.url||"",this._initBody(t)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},f.call(v.prototype),f.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},w.error=function(){var t=new w(null,{status:0,statusText:""});return t.type="error",t};var y=[301,302,303,307,308];w.redirect=function(t,i){if(-1===y.indexOf(i))throw new RangeError("Invalid status code");return new w(null,{status:i,headers:{location:t}})},i.DOMException=t.DOMException;try{new i.DOMException}catch(t){i.DOMException=function(t,i){this.message=t,this.name=i;var e=Error(t);this.stack=e.stack},i.DOMException.prototype=Object.create(Error.prototype),i.DOMException.prototype.constructor=i.DOMException}function m(t,s){return new Promise((function(n,r){var o=new v(t,s);if(o.signal&&o.signal.aborted)return r(new i.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var t,i,e={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",i=new h,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var e=t.split(":"),s=e.shift().trim();if(s){var n=e.join(":").trim();i.append(s,n)}})),i)};e.url="responseURL"in a?a.responseURL:e.headers.get("X-Request-URL");var s="response"in a?a.response:a.responseText;n(new w(s,e))},a.onerror=function(){r(new TypeError("Network request failed"))},a.ontimeout=function(){r(new TypeError("Network request failed"))},a.onabort=function(){r(new i.DOMException("Aborted","AbortError"))},a.open(o.method,o.url,!0),"include"===o.credentials?a.withCredentials=!0:"omit"===o.credentials&&(a.withCredentials=!1),"responseType"in a&&e.blob&&(a.responseType="blob"),o.headers.forEach((function(t,i){a.setRequestHeader(i,t)})),o.signal&&(o.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&o.signal.removeEventListener("abort",c)}),a.send(void 0===o._bodyInit?null:o._bodyInit)}))}m.polyfill=!0,t.fetch||(t.fetch=m,t.Headers=h,t.Request=v,t.Response=w),i.Headers=h,i.Request=v,i.Response=w,i.fetch=m,Object.defineProperty(i,"i",{value:!0})}({})}("undefined"!=typeof self?self:void 0),function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"}(Et||(Et={})),function(t){t.THIRD_PARTY="THIRD_PARTY",t.OFF_THE_GRID="OFF_THE_GRID",t.CONTENT_PACKAGER="CONTENT_PACKAGER",t.PAGES="PAGES",t.DESIGNED_READER="DESIGNED_READER"}(Ot||(Ot={})),function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"}(Rt||(Rt={})),function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"}(St||(St={})),function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK"}(Nt||(Nt={})),function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"}(At||(At={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"}(Ct||(Ct={})),function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"}(Ut||(Ut={})),function(t){t.PERSONAL_BOOK_USER="PERSONAL_BOOK_USER",t.PERSONAL_BOOK_SHARE_USER="PERSONAL_BOOK_SHARE_USER",t.HTML_EXPORT_USER="HTML_EXPORT_USER",t.PDF_EXPORT_USER="PDF_EXPORT_USER",t.SAVED_SEARCH_USER="SAVED_SEARCH_USER",t.COLLECTION_USER="COLLECTION_USER",t.OFFLINE_USER="OFFLINE_USER",t.ANALYTICS_USER="ANALYTICS_USER",t.BETA_USER="BETA_USER",t.DEBUG_USER="DEBUG_USER",t.PRINT_USER="PRINT_USER",t.RATING_USER="RATING_USER",t.FEEDBACK_USER="FEEDBACK_USER",t.CONTENT_PUBLISHER="CONTENT_PUBLISHER",t.KHUB_ADMIN="KHUB_ADMIN",t.USERS_ADMIN="USERS_ADMIN",t.PORTAL_ADMIN="PORTAL_ADMIN",t.ADMIN="ADMIN",t.DEVELOPER="DEVELOPER"}(Tt||(Tt={})),Tt.PERSONAL_BOOK_SHARE_USER,Tt.PERSONAL_BOOK_USER,Tt.HTML_EXPORT_USER,Tt.PERSONAL_BOOK_USER,Tt.PDF_EXPORT_USER,Tt.PERSONAL_BOOK_USER,Tt.KHUB_ADMIN,Tt.CONTENT_PUBLISHER,Tt.ADMIN,Tt.KHUB_ADMIN,Tt.USERS_ADMIN,Tt.PORTAL_ADMIN,Tt.DEVELOPER,Tt.BETA_USER,Tt.DEBUG_USER;var Mt,_t=function(t,i,e,s){for(var n,r=arguments.length,o=r<3?i:null===s?s=Object.getOwnPropertyDescriptor(i,e):s,a=t.length-1;a>=0;a--)(n=t[a])&&(o=(r<3?n(o):r>3?n(i,e,o):n(i,e))||o);return r>3&&o&&Object.defineProperty(i,e,o),o};class Lt extends CustomEvent{constructor(t,i){super("ft-search-result-click",{detail:{result:t,rank:i},bubbles:!0,composed:!0})}}class kt extends yt{constructor(){super(...arguments),this.index=0,this.registeredComponents=[]}render(){return W`
|
|
88
|
+
<a href="${this.url}" @click=${this.onResultClick}>
|
|
89
89
|
<slot @register-ft-search-result-component=${this.registerComponent}></slot>
|
|
90
90
|
</a>
|
|
91
|
-
`}get url(){var t;switch(null===(t=this.result)||void 0===t?void 0:t.type){case
|
|
91
|
+
`}get url(){var t;switch(null===(t=this.result)||void 0===t?void 0:t.type){case Ut.MAP:return this.result.map.readerUrl;case Ut.DOCUMENT:return this.result.document.viewerUrl;case Ut.TOPIC:return this.result.topic.readerUrl}return""}onResultClick(){this.dispatchEvent(new Lt(this.result,this.index+1))}registerComponent(t){t.stopPropagation();const i=t.composedPath()[0];this.register(i)}register(t){this.registeredComponents.push(t),t.result=this.result}updated(t){super.updated(t),t.has("result")&&this.registeredComponents.forEach((t=>t.result=this.result))}disconnectedCallback(){super.disconnectedCallback(),this.registeredComponents=[]}}kt.elementDefinitions={},kt.styles=gt,_t([s({attribute:!1})],kt.prototype,"result",void 0),_t([s()],kt.prototype,"index",void 0),(Mt="ft-search-result-context",t=>{window.customElements.get(Mt)||window.customElements.define(Mt,t)})(kt),t.FtSearchResultContext=kt,t.FtSearchResultContextCssVariables={},t.SearchResultClickEvent=Lt,t.styles=gt}({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-search-result-context",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
4
4
|
"description": "Search result context for integrated search component",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/ft-wc-utils": "1.0.
|
|
22
|
+
"@fluid-topics/ft-wc-utils": "1.0.39",
|
|
23
23
|
"lit": "2.7.2"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@fluid-topics/public-api": "1.0.
|
|
26
|
+
"@fluid-topics/public-api": "1.0.39"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "247753f78fc5d88af2bb1024c328d3fa1409e39c"
|
|
29
29
|
}
|