@fluid-topics/ft-reader-search-in-document 1.1.98 → 1.1.99
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.
|
@@ -932,7 +932,7 @@ Also for action icons.`,c.colorGray200),contentGlobalSubtle:r.extend("--ft-conte
|
|
|
932
932
|
`}update(e){var o;super.update(e),["context","key","defaultMessage"].some(n=>e.has(n))&&this.context&&this.key&&this.addI18nMessages(this.context,{[this.key]:(o=this.defaultMessage)!==null&&o!==void 0?o:""})}};Ge.elementDefinitions={};Ge.styles=fu;no([(0,bn.redux)()],Ge.prototype,"editorMode",void 0);no([(0,gn.property)()],Ge.prototype,"context",void 0);no([(0,gn.property)()],Ge.prototype,"key",void 0);no([(0,bn.jsonProperty)([])],Ge.prototype,"args",void 0);no([(0,gn.property)()],Ge.prototype,"defaultMessage",void 0)});var Qe,Dd=f(()=>{"use strict";br();Qe=class t{static build(e){return new t(e)}static fromGwt(e){return new t(e)}constructor(e){this.name=e,this.properties=new Proxy({},{get:(o,n)=>{let i=n;return a=>({context:this.name,key:i,args:typeof a=="function"?void 0:a,argsProvider:typeof a=="function"?a:void 0})}}),this.messages=new Proxy({},{get:(o,n)=>(...i)=>pr.resolveMessage(this.name,n,...i)})}}});var Md=f(()=>{"use strict";mn()});var Bd=f(()=>{"use strict"});var Ud,Je=f(()=>{"use strict";Ud=y(A());ga();Dd();mn();Md();Ni();Bd();ga();(0,Ud.customElement)("ft-i18n")(Ge)});var Hd=_t(zd=>{(function(t){var e=function(o){var n={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{return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};function i(m){return m&&DataView.prototype.isPrototypeOf(m)}if(n.arrayBuffer)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],s=ArrayBuffer.isView||function(m){return m&&a.indexOf(Object.prototype.toString.call(m))>-1};function l(m){if(typeof m!="string"&&(m=String(m)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(m))throw new TypeError("Invalid character in header field name");return m.toLowerCase()}function d(m){return typeof m!="string"&&(m=String(m)),m}function p(m){var S={next:function(){var I=m.shift();return{done:I===void 0,value:I}}};return n.iterable&&(S[Symbol.iterator]=function(){return S}),S}function h(m){this.map={},m instanceof h?m.forEach(function(S,I){this.append(I,S)},this):Array.isArray(m)?m.forEach(function(S){this.append(S[0],S[1])},this):m&&Object.getOwnPropertyNames(m).forEach(function(S){this.append(S,m[S])},this)}h.prototype.append=function(m,S){m=l(m),S=d(S);var I=this.map[m];this.map[m]=I?I+", "+S:S},h.prototype.delete=function(m){delete this.map[l(m)]},h.prototype.get=function(m){return m=l(m),this.has(m)?this.map[m]:null},h.prototype.has=function(m){return this.map.hasOwnProperty(l(m))},h.prototype.set=function(m,S){this.map[l(m)]=d(S)},h.prototype.forEach=function(m,S){for(var I in this.map)this.map.hasOwnProperty(I)&&m.call(S,this.map[I],I,this)},h.prototype.keys=function(){var m=[];return this.forEach(function(S,I){m.push(I)}),p(m)},h.prototype.values=function(){var m=[];return this.forEach(function(S){m.push(S)}),p(m)},h.prototype.entries=function(){var m=[];return this.forEach(function(S,I){m.push([I,S])}),p(m)},n.iterable&&(h.prototype[Symbol.iterator]=h.prototype.entries);function g(m){if(m.bodyUsed)return Promise.reject(new TypeError("Already read"));m.bodyUsed=!0}function b(m){return new Promise(function(S,I){m.onload=function(){S(m.result)},m.onerror=function(){I(m.error)}})}function v(m){var S=new FileReader,I=b(S);return S.readAsArrayBuffer(m),I}function x(m){var S=new FileReader,I=b(S);return S.readAsText(m),I}function O(m){for(var S=new Uint8Array(m),I=new Array(S.length),Q=0;Q<S.length;Q++)I[Q]=String.fromCharCode(S[Q]);return I.join("")}function P(m){if(m.slice)return m.slice(0);var S=new Uint8Array(m.byteLength);return S.set(new Uint8Array(m)),S.buffer}function R(){return this.bodyUsed=!1,this._initBody=function(m){this._bodyInit=m,m?typeof m=="string"?this._bodyText=m:n.blob&&Blob.prototype.isPrototypeOf(m)?this._bodyBlob=m:n.formData&&FormData.prototype.isPrototypeOf(m)?this._bodyFormData=m:n.searchParams&&URLSearchParams.prototype.isPrototypeOf(m)?this._bodyText=m.toString():n.arrayBuffer&&n.blob&&i(m)?(this._bodyArrayBuffer=P(m.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):n.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(m)||s(m))?this._bodyArrayBuffer=P(m):this._bodyText=m=Object.prototype.toString.call(m):this._bodyText="",this.headers.get("content-type")||(typeof m=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n.searchParams&&URLSearchParams.prototype.isPrototypeOf(m)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n.blob&&(this.blob=function(){var m=g(this);if(m)return m;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?g(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(v)}),this.text=function(){var m=g(this);if(m)return m;if(this._bodyBlob)return x(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(O(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},n.formData&&(this.formData=function(){return this.text().then(V)}),this.json=function(){return this.text().then(JSON.parse)},this}var N=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function M(m){var S=m.toUpperCase();return N.indexOf(S)>-1?S:m}function _(m,S){S=S||{};var I=S.body;if(m instanceof _){if(m.bodyUsed)throw new TypeError("Already read");this.url=m.url,this.credentials=m.credentials,S.headers||(this.headers=new h(m.headers)),this.method=m.method,this.mode=m.mode,this.signal=m.signal,!I&&m._bodyInit!=null&&(I=m._bodyInit,m.bodyUsed=!0)}else this.url=String(m);if(this.credentials=S.credentials||this.credentials||"same-origin",(S.headers||!this.headers)&&(this.headers=new h(S.headers)),this.method=M(S.method||this.method||"GET"),this.mode=S.mode||this.mode||null,this.signal=S.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&I)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(I)}_.prototype.clone=function(){return new _(this,{body:this._bodyInit})};function V(m){var S=new FormData;return m.trim().split("&").forEach(function(I){if(I){var Q=I.split("="),de=Q.shift().replace(/\+/g," "),K=Q.join("=").replace(/\+/g," ");S.append(decodeURIComponent(de),decodeURIComponent(K))}}),S}function ve(m){var S=new h,I=m.replace(/\r?\n[\t ]+/g," ");return I.split(/\r?\n/).forEach(function(Q){var de=Q.split(":"),K=de.shift().trim();if(K){var fo=de.join(":").trim();S.append(K,fo)}}),S}R.call(_.prototype);function ce(m,S){S||(S={}),this.type="default",this.status=S.status===void 0?200:S.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in S?S.statusText:"OK",this.headers=new h(S.headers),this.url=S.url||"",this._initBody(m)}R.call(ce.prototype),ce.prototype.clone=function(){return new ce(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new h(this.headers),url:this.url})},ce.error=function(){var m=new ce(null,{status:0,statusText:""});return m.type="error",m};var Pr=[301,302,303,307,308];ce.redirect=function(m,S){if(Pr.indexOf(S)===-1)throw new RangeError("Invalid status code");return new ce(null,{status:S,headers:{location:m}})},o.DOMException=t.DOMException;try{new o.DOMException}catch{o.DOMException=function(S,I){this.message=S,this.name=I;var Q=Error(S);this.stack=Q.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function ke(m,S){return new Promise(function(I,Q){var de=new _(m,S);if(de.signal&&de.signal.aborted)return Q(new o.DOMException("Aborted","AbortError"));var K=new XMLHttpRequest;function fo(){K.abort()}K.onload=function(){var Ir={status:K.status,statusText:K.statusText,headers:ve(K.getAllResponseHeaders()||"")};Ir.url="responseURL"in K?K.responseURL:Ir.headers.get("X-Request-URL");var Bn="response"in K?K.response:K.responseText;I(new ce(Bn,Ir))},K.onerror=function(){Q(new TypeError("Network request failed"))},K.ontimeout=function(){Q(new TypeError("Network request failed"))},K.onabort=function(){Q(new o.DOMException("Aborted","AbortError"))},K.open(de.method,de.url,!0),de.credentials==="include"?K.withCredentials=!0:de.credentials==="omit"&&(K.withCredentials=!1),"responseType"in K&&n.blob&&(K.responseType="blob"),de.headers.forEach(function(Ir,Bn){K.setRequestHeader(Bn,Ir)}),de.signal&&(de.signal.addEventListener("abort",fo),K.onreadystatechange=function(){K.readyState===4&&de.signal.removeEventListener("abort",fo)}),K.send(typeof de._bodyInit>"u"?null:de._bodyInit)})}return ke.polyfill=!0,t.fetch||(t.fetch=ke,t.Headers=h,t.Request=_,t.Response=ce),o.Headers=h,o.Request=_,o.Response=ce,o.fetch=ke,Object.defineProperty(o,"__esModule",{value:!0}),o}({})})(typeof self<"u"?self:zd)});var jd=f(()=>{});var Gd,Vd,Kd,Zd,qd,Yd,Xd,Qd,Jd,ep,tp,xr,rp,vn,op,vr,Sr,ue,va=f(()=>{(function(t){t.black="black",t.green="green",t.blue="blue",t.purple="purple",t.red="red",t.orange="orange",t.yellow="yellow"})(Gd||(Gd={}));(function(t){t.OFFICIAL="OFFICIAL",t.PERSONAL="PERSONAL",t.SHARED="SHARED"})(Vd||(Vd={}));(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"})(Kd||(Kd={}));(function(t){t.HOMEPAGE="HOMEPAGE",t.CUSTOM="CUSTOM",t.HEADER="HEADER",t.READER="READER",t.TOPIC_TEMPLATE="TOPIC_TEMPLATE",t.SEARCH="SEARCH",t.SEARCH_RESULT="SEARCH_RESULT"})(Zd||(Zd={}));(function(t){t.CLASSIC="CLASSIC",t.CUSTOM="CUSTOM",t.DESIGNER="DESIGNER"})(qd||(qd={}));(function(t){t.AND="AND",t.OR="OR",t.MONOVALUED="MONOVALUED"})(Yd||(Yd={}));(function(t){t.NONE="NONE",t.ALPHABET="ALPHABET",t.VERSION="VERSION"})(Xd||(Xd={}));(function(t){t.STARS="STARS",t.LIKE="LIKE",t.DICHOTOMOUS="DICHOTOMOUS",t.NO_RATING="NO_RATING"})(Qd||(Qd={}));(function(t){t.LAST_WEEK="LAST_WEEK",t.LAST_MONTH="LAST_MONTH",t.LAST_QUARTER="LAST_QUARTER",t.LAST_YEAR="LAST_YEAR",t.CUSTOM="CUSTOM"})(Jd||(Jd={}));(function(t){t.ASC="ASC",t.DESC="DESC"})(ep||(ep={}));(function(t){t.ALPHA="ALPHA",t.NATURAL="NATURAL"})(tp||(tp={}));(function(t){t.EVERYWHERE="EVERYWHERE",t.TITLE_ONLY="TITLE_ONLY",t.NONE="NONE"})(xr||(xr={}));(function(t){t.ARTICLE="ARTICLE",t.BOOK="BOOK",t.SHARED_BOOK="SHARED_BOOK"})(rp||(rp={}));(function(t){t.FLUIDTOPICS="FLUIDTOPICS",t.EXTERNAL="EXTERNAL"})(vn||(vn={}));(function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC",t.PERSONAL_BOOK="PERSONAL_BOOK",t.SHARED_BOOK="SHARED_BOOK"})(op||(op={}));(function(t){t.MAP="MAP",t.DOCUMENT="DOCUMENT",t.TOPIC="TOPIC"})(vr||(vr={}));(function(t){t.DEFAULT="DEFAULT",t.DOCUMENTS="DOCUMENTS",t.ALL_TOPICS="ALL_TOPICS"})(Sr||(Sr={}));(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.GENERATIVE_AI_USER="GENERATIVE_AI_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"})(ue||(ue={}))});var np,ip=f(()=>{(function(t){t.VALID="VALID",t.INVALID="INVALID"})(np||(np={}))});var QO,ap=f(()=>{va();QO={[ue.PERSONAL_BOOK_SHARE_USER]:[ue.PERSONAL_BOOK_USER],[ue.HTML_EXPORT_USER]:[ue.PERSONAL_BOOK_USER],[ue.PDF_EXPORT_USER]:[ue.PERSONAL_BOOK_USER],[ue.KHUB_ADMIN]:[ue.CONTENT_PUBLISHER],[ue.ADMIN]:[ue.KHUB_ADMIN,ue.USERS_ADMIN,ue.PORTAL_ADMIN],[ue.DEVELOPER]:[ue.BETA_USER,ue.DEBUG_USER]}});var sp=f(()=>{});var rC,Sa=f(()=>{rC=y(Hd(),1);jd();va();ip();ap();sp()});var cp,lp=f(()=>{qn();cp=t=>t??ae});var up=f(()=>{lp()});function dp(t){var e,o,n,i,a;return((i=(o=(e=t.map)===null||e===void 0?void 0:e.openMode)!==null&&o!==void 0?o:(n=t.topic)===null||n===void 0?void 0:n.openMode)!==null&&i!==void 0?i:(a=t.document)===null||a===void 0?void 0:a.openMode)===vn.EXTERNAL}function Sn(t){var e,o,n,i,a;if(dp(t))return(i=(o=(e=t.map)===null||e===void 0?void 0:e.originUrl)!==null&&o!==void 0?o:(n=t.topic)===null||n===void 0?void 0:n.originUrl)!==null&&i!==void 0?i:(a=t.document)===null||a===void 0?void 0:a.originUrl;switch(t.type){case vr.MAP:return t.map.readerUrl;case vr.DOCUMENT:return t.document.viewerUrl;case vr.TOPIC:return t.topic.readerUrl}return""}function pp(t,e){return cp(e&&dp(t)?"_blank":void 0)}var Or,Oa=f(()=>{"use strict";Sa();up();Or=class extends CustomEvent{constructor(e,o){super("ft-search-result-click",{detail:{result:e,rank:o},bubbles:!0,composed:!0})}}});var yp,Qh,Ea,wa=f(()=>{"use strict";yp=y(k()),Qh={},Ea=yp.css`
|
|
933
933
|
`});var gp=f(()=>{"use strict"});var bp,Jh,xp,vp=f(()=>{"use strict";bp=y(A()),Jh={setRequest:(t,e)=>{t.request=e.payload},setRequestQuery:(t,e)=>{t.request.query=e.payload},setRequestContentLocale:(t,e)=>{t.request.contentLocale=e.payload},setPageSize:(t,e)=>{t.request.paging.perPage=e.payload},setPageNumber:(t,e)=>{t.request.paging.page=e.payload},setRequestSort:(t,e)=>{t.request.sort=e.payload},setRequestFilters:(t,e)=>{t.request.filters=e.payload},setRequestFacets:(t,e)=>{t.request.facets=e.payload},setRequestVirtualField:(t,e)=>{t.request.virtualField=e.payload},setRequestScope:(t,e)=>{t.request.scope=e.payload},setRequestClusterSortCriterion:(t,e)=>{var o;t.request.clusterSortCriterions=(o=e.payload)!==null&&o!==void 0?o:[]},setResults:(t,e)=>{t.results=e.payload},setFacets:(t,e)=>{t.facets=e.payload},setSpellcheck:(t,e)=>{t.spellcheck=e.payload},setLocales:(t,e)=>{t.locales=e.payload},setPaging:(t,e)=>{t.paging=e.payload},setLiveQuery:(t,e)=>{t.liveQuery=e.payload},setSuggestResults:(t,e)=>{t.suggestResults=e.payload},setRequestPeriodFilter:(t,e)=>{t.request.periodFilter=e.payload}},xp=t=>bp.FtReduxStore.get({name:"ft-search-"+t,initialState:{request:{query:"",clusterSortCriterions:[],filters:[],facets:[],sort:[],paging:{page:1,perPage:20}},liveQuery:""},reducers:Jh})});var En,Sp=f(()=>{"use strict";br();En=class extends Ye{async launchSearch(e){return this.cache.get(this.hash(e),async()=>(await this.awaitApi).search(e),2*60*1e3)}async launchSuggest(e){return this.cache.get(this.hash(e),async()=>(await this.awaitApi).getSuggestions(e),2*60*1e3)}async getAvailableSearchLocales(){return this.cache.get("available-locales",async()=>(await this.awaitApi).getAvailableSearchLocales())}hash(e){return""+Array.from(JSON.stringify(e)).reduce((o,n)=>0|31*o+n.charCodeAt(0),0)}}});var et,Op,so,Cr,Aa=f(()=>{"use strict";et=y(A());vp();Sa();Sp();Op=t=>t.request.virtualField===xr.TITLE_ONLY&&t.request.scope===Sr.DOCUMENTS,so=class t extends Event{constructor(){super(t.eventName)}};so.eventName="search-context-clear-all-filters";Cr=class t{static build(e,o){return new t(xp(e.trim()||"context"),o)}constructor(e,o){this.store=e,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.localesDebouncer=new et.Debouncer(10),this.searchDebouncer=new et.Debouncer(100),this.suggestDebouncer=new et.Debouncer(300),this.service=o??new En}async initService(){return this.updateLocales(),this.launchSearch()}setQuery(e){this.store.actions.setRequestQuery(e),this.store.actions.setLiveQuery(e),this.store.actions.setPageNumber(1),this.launchSearch()}setContentLocale(e){let o=this.store.getState().locales,n=this.store.getState().request.contentLocale;if(e!=n){if(o){let i=a=>o.some(s=>s.lang==a);i(e)||(e=i(n)?n:o[0].lang)}this.store.actions.setRequestContentLocale(e),this.store.actions.setPageNumber(1),this.store.actions.setRequestFilters([]),this.launchSearch()}return e}setPageSize(e){this.store.actions.setPageSize(e),this.launchSearch()}setPageNumber(e){this.store.actions.setPageNumber(e),this.launchSearch()}setSort(e){this.store.actions.setRequestSort(e),this.store.actions.setPageNumber(1),this.launchSearch()}setFilters(e){let o=e.filter(n=>n.values.length>0);this.store.actions.setRequestFilters(o),this.store.actions.setPageNumber(1),o.forEach(n=>{this.facetIds.includes(n.key)||(this.facetIds=[...this.facetIds,n.key])}),this.launchSearch()}setClusterSortCriterion(e){this.store.actions.setRequestClusterSortCriterion(e),this.launchSearch()}setSearchInDocumentTitlesOnly(e){e?(this.store.actions.setRequestVirtualField(xr.TITLE_ONLY),this.store.actions.setRequestScope(Sr.DOCUMENTS)):(this.store.actions.setRequestVirtualField(xr.EVERYWHERE),this.store.actions.setRequestScope(Sr.DEFAULT)),this.launchSearch()}setVirtualField(e){this.store.actions.setRequestVirtualField(e),this.launchSearch()}get searchInDocumentTitlesOnly(){return Op(this.store.getState())}get periodFilter(){return this.store.getState().request.periodFilter}clearAllFilters(){this.setFilters([]),this.store.eventBus.dispatchEvent(new so)}addFacet(e){this.facetIds=[...this.facetIds,e],this.launchSearch()}replaceFacet(e,o){let n=this.facetIds.filter(i=>i!=e);o&&n.push(o),this.facetIds=n,this.launchSearch()}get facetIds(){return this.store.getState().request.facets.map(e=>e.id)}set facetIds(e){let n=[...new Set(e)].map(i=>({id:i}));this.store.actions.setRequestFacets(n)}setFilter(e,o){let n=this.store.getState().request.filters,i={key:e,values:o,negative:!1},a=[...n.filter(s=>s.key!==e),i];this.setFilters(a)}setLiveQuery(e){this.store.actions.setLiveQuery(e),this.launchSuggest()}setRequest(e){this.store.actions.setRequest(e),this.store.actions.setLiveQuery(e.query),this.store.actions.setPageNumber(1),this.launchSearch()}setScope(e){this.store.actions.setRequestScope(e),this.launchSearch()}setIgnoreEmptyQuery(e){this.ignoreEmptyQuery=e,this.launchSearch()}setOpenExternalDocumentInNewTab(e){this.openExternalDocumentInNewTab=e}setPeriodFilter(e){this.store.actions.setRequestPeriodFilter(e),this.store.actions.setPageNumber(1),this.launchSearch()}updateLocales(){return this.localesDebouncer.run(async()=>this.store.actions.setLocales((await this.service.getAvailableSearchLocales()).contentLocales))}launchSearch(){return this.searchDebouncer.run(()=>this.fetchSearchData())}launchSuggest(){return this.suggestDebouncer.run(()=>this.fetchSuggestData())}async fetchSearchData(){var e,o;try{(e=this.cancelableSearch)===null||e===void 0||e.cancel();let n=this.store.getState().request;if(this.store.actions.setPaging(void 0),this.ignoreEmptyQuery&&n.query.length==0)this.store.actions.setResults(void 0),this.store.actions.setFacets(void 0),this.store.actions.setSpellcheck(void 0);else{this.cancelableSearch=(0,et.cancelable)(this.service.launchSearch(n));let i=await this.cancelableSearch;if(i.paging.currentPage<=1)this.store.actions.setResults(i.results),this.store.actions.setFacets(i.facets),this.store.actions.setSpellcheck(i.spellcheck);else{let a=((o=this.store.getState().results)!==null&&o!==void 0?o:[]).concat(i.results);this.store.actions.setResults(a)}this.store.actions.setPaging(i.paging)}}catch(n){!(n instanceof et.CanceledPromiseError)&&this.errorHandler&&this.errorHandler(n)}}async fetchSuggestData(){var e;try{let o=this.store.getState(),n=o.request,i={input:o.liveQuery,filters:n.filters,sort:n.sort,contentLocale:n.contentLocale,scope:n.scope};(e=this.cancelableSuggest)===null||e===void 0||e.cancel(),this.cancelableSuggest=(0,et.cancelable)(this.service.launchSuggest(i));let a=await this.cancelableSuggest;this.store.actions.setSuggestResults(a.suggestions)}catch(o){!(o instanceof et.CanceledPromiseError)&&this.errorHandler&&this.errorHandler(o)}}clear(){this.store.clear()}}});function tm(t){var e;class o extends t{constructor(){super(...arguments),this[e]=0}setSearchStateManager(i){this.clearStateManager(),this.stateManager=i,this.addStore(i.store,"search")}clearStateManager(){this.stateManager&&(this.removeStore(this.stateManager.store),this.stateManager=void 0)}connectedCallback(){super.connectedCallback(),this[Ra]=window.setInterval(()=>this.tryToRegisterToContext(),50)}tryToRegisterToContext(){this.stateManager!=null?window.clearInterval(this[Ra]):this.dispatchEvent(new Na)}disconnectedCallback(){super.disconnectedCallback(),this.clearStateManager()}}return e=Ra,em([(0,Ep.state)()],o.prototype,"stateManager",void 0),o}var Cp,Ep,em,Na,Ra,we,Pt=f(()=>{"use strict";Cp=y(A()),Ep=y(X());gp();Aa();em=function(t,e,o,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,o):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,o,n);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(a=(i<3?s(a):i>3?s(e,o,a):s(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},Na=class extends Event{constructor(){super("register-ft-search-component",{bubbles:!0,composed:!0})}},Ra=Symbol("registerInterval");we=class extends tm(Cp.FtLitElementRedux){}});var wp,tt,Ve,me,wn,An,Rn,ee,Pa=f(()=>{"use strict";wp=y(k()),tt=y(X()),Ve=y(A());wa();Pt();br();pa();me=function(t,e,o,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,o):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,o,n);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(a=(i<3?s(a):i>3?s(e,o,a):s(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},wn=class extends CustomEvent{constructor(e){super("ft-search-load-error",{detail:e})}},An=class extends CustomEvent{constructor(e){super("ft-search-request-change",{detail:e})}},Rn=class extends CustomEvent{constructor(e,o,n){super("ft-search-results-change",{detail:{request:e,paging:o,spellcheck:n}})}},ee=class extends Ve.FtLitElementRedux{get stateManager(){if(this._stateManager==null){let e=this.searchServiceProvider?this.searchServiceProvider():void 0;this._stateManager=Cr.build(this.id||(""+Math.round(Math.random()*999e3)).padStart(6,"0"),e),this._stateManager.errorHandler=o=>this.handleLoadError(o),this.addStore(this.stateManager.store,"search")}return this._stateManager}constructor(){super(),this.query="",this.pageSize=20,this.searchInDocumentTitlesOnly=!1,this.ignoreEmptyQuery=!1,this.openExternalDocumentInNewTab=!1,this.filters=[],this.sort=[],this.addStore(D)}render(){return wp.html`
|
|
934
934
|
<slot @register-ft-search-component=${this.registerComponent}></slot>
|
|
935
|
-
`}update(e){super.update(e),e.has("query")&&this.query!==void 0&&this.stateManager.setQuery(this.query),e.has("contentLocale")&&this.contentLocale!==void 0&&this.stateManager.setContentLocale(this.contentLocale),e.has("filters")&&this.filters!==void 0&&this.stateManager.setFilters(this.filters),e.has("sort")&&this.sort!==void 0&&this.stateManager.setSort(this.sort),e.has("pageSize")&&this.pageSize!==void 0&&this.stateManager.setPageSize(this.pageSize),e.has("searchInDocumentTitlesOnly")&&this.searchInDocumentTitlesOnly!==void 0&&this.stateManager.setSearchInDocumentTitlesOnly(this.searchInDocumentTitlesOnly),e.has("scope")&&this.scope!==void 0&&this.stateManager.setScope(this.scope),e.has("virtualField")&&this.virtualField!==void 0&&this.stateManager.setVirtualField(this.virtualField),e.has("ignoreEmptyQuery")&&this.ignoreEmptyQuery!==void 0&&this.stateManager.setIgnoreEmptyQuery(this.ignoreEmptyQuery),e.has("openExternalDocumentInNewTab")&&this.openExternalDocumentInNewTab!==void 0&&this.stateManager.setOpenExternalDocumentInNewTab(this.openExternalDocumentInNewTab),e.has("periodFilter")&&this.periodFilter!==void 0&&this.stateManager.setPeriodFilter(this.periodFilter),e.has("session")&&this.session!==void 0&&(this.stateManager.service.clearCache(),this.stateManager.initService())}connectedCallback(){super.connectedCallback(),this.stateManager.initService(),this.stateManager.setQuery(this.query),this.stateManager.setContentLocale(this.contentLocale),this.stateManager.setFilters(this.filters),this.stateManager.setPageSize(this.pageSize),this.stateManager.setSort(this.sort)}contentAvailableCallback(e){super.contentAvailableCallback(e),e.has("request")&&this.request&&this.dispatchEvent(new An(this.request)),e.has("paging")&&this.paging!==void 0&&this.dispatchEvent(new Rn(this.request,this.paging,this.autocorrect))}registerComponent(e){e.stopPropagation();let o=e.composedPath()[0];this.register(o)}register(e){e.setSearchStateManager(this.stateManager)}handleLoadError(e){this.dispatchEvent(new wn(e))}reloadSavedSearches(){Ed.clearMySearches()}clear(){this.stateManager.clear()}};ee.elementDefinitions={};ee.styles=Ea;me([(0,Ve.redux)({store:D.name})],ee.prototype,"session",void 0);me([(0,tt.property)()],ee.prototype,"query",void 0);me([(0,tt.property)()],ee.prototype,"contentLocale",void 0);me([(0,tt.property)({type:Number})],ee.prototype,"pageSize",void 0);me([(0,tt.property)({type:Boolean})],ee.prototype,"searchInDocumentTitlesOnly",void 0);me([(0,tt.property)()],ee.prototype,"periodFilter",void 0);me([(0,tt.property)()],ee.prototype,"scope",void 0);me([(0,tt.property)()],ee.prototype,"virtualField",void 0);me([(0,tt.property)({type:Boolean})],ee.prototype,"ignoreEmptyQuery",void 0);me([(0,Ve.redux)({store:D.name})],ee.prototype,"openExternalDocumentInNewTab",void 0);me([(0,Ve.jsonProperty)([])],ee.prototype,"filters",void 0);me([(0,Ve.jsonProperty)([])],ee.prototype,"sort",void 0);me([(0,Ve.redux)({store:"search"})],ee.prototype,"request",void 0);me([(0,Ve.redux)({store:"search"})],ee.prototype,"paging",void 0);me([(0,Ve.redux)({store:"search",selector:t=>t.spellcheck})],ee.prototype,"autocorrect",void 0);me([(0,tt.property)({attribute:!1})],ee.prototype,"searchServiceProvider",void 0)});var Ap=f(()=>{"use strict"});var Np={};kt(Np,{ClearAllFiltersEvent:()=>so,FtSearchContext:()=>ee,FtSearchContextCssVariables:()=>Qh,FtSearchStateManager:()=>Cr,LoadErrorEvent:()=>wn,SearchRequestChangeEvent:()=>An,SearchResultsChangeEvent:()=>Rn,searchInDocumentTitlesOnlySelector:()=>Op,styles:()=>Ea});var Rp,Pp=f(()=>{"use strict";Rp=y(A());Pa();wa();Ap();Pa();Aa();(0,Rp.customElement)("ft-search-context")(ee)});var co,Ip=f(()=>{"use strict";Je();co=Qe.build("designedSearchInput")});var Tp,Lp,_p=f(()=>{"use strict";Tp=y(k());qr();Lp=Tp.css`
|
|
935
|
+
`}update(e){super.update(e),e.has("query")&&this.query!==void 0&&this.stateManager.setQuery(this.query),e.has("contentLocale")&&this.contentLocale!==void 0&&this.stateManager.setContentLocale(this.contentLocale),e.has("filters")&&this.filters!==void 0&&this.stateManager.setFilters(this.filters),e.has("sort")&&this.sort!==void 0&&this.stateManager.setSort(this.sort),e.has("pageSize")&&this.pageSize!==void 0&&this.stateManager.setPageSize(this.pageSize),e.has("searchInDocumentTitlesOnly")&&this.searchInDocumentTitlesOnly!==void 0&&this.stateManager.setSearchInDocumentTitlesOnly(this.searchInDocumentTitlesOnly),e.has("scope")&&this.scope!==void 0&&this.stateManager.setScope(this.scope),e.has("virtualField")&&this.virtualField!==void 0&&this.stateManager.setVirtualField(this.virtualField),e.has("ignoreEmptyQuery")&&this.ignoreEmptyQuery!==void 0&&this.stateManager.setIgnoreEmptyQuery(this.ignoreEmptyQuery),e.has("openExternalDocumentInNewTab")&&this.openExternalDocumentInNewTab!==void 0&&this.stateManager.setOpenExternalDocumentInNewTab(this.openExternalDocumentInNewTab),e.has("periodFilter")&&this.periodFilter!==void 0&&this.stateManager.setPeriodFilter({key:"ft:lastEdition",periodType:this.periodFilter}),e.has("session")&&this.session!==void 0&&(this.stateManager.service.clearCache(),this.stateManager.initService())}connectedCallback(){super.connectedCallback(),this.stateManager.initService(),this.stateManager.setQuery(this.query),this.stateManager.setContentLocale(this.contentLocale),this.stateManager.setFilters(this.filters),this.stateManager.setPageSize(this.pageSize),this.stateManager.setSort(this.sort)}contentAvailableCallback(e){super.contentAvailableCallback(e),e.has("request")&&this.request&&this.dispatchEvent(new An(this.request)),e.has("paging")&&this.paging!==void 0&&this.dispatchEvent(new Rn(this.request,this.paging,this.autocorrect))}registerComponent(e){e.stopPropagation();let o=e.composedPath()[0];this.register(o)}register(e){e.setSearchStateManager(this.stateManager)}handleLoadError(e){this.dispatchEvent(new wn(e))}reloadSavedSearches(){Ed.clearMySearches()}clear(){this.stateManager.clear()}};ee.elementDefinitions={};ee.styles=Ea;me([(0,Ve.redux)({store:D.name})],ee.prototype,"session",void 0);me([(0,tt.property)()],ee.prototype,"query",void 0);me([(0,tt.property)()],ee.prototype,"contentLocale",void 0);me([(0,tt.property)({type:Number})],ee.prototype,"pageSize",void 0);me([(0,tt.property)({type:Boolean})],ee.prototype,"searchInDocumentTitlesOnly",void 0);me([(0,tt.property)()],ee.prototype,"periodFilter",void 0);me([(0,tt.property)()],ee.prototype,"scope",void 0);me([(0,tt.property)()],ee.prototype,"virtualField",void 0);me([(0,tt.property)({type:Boolean})],ee.prototype,"ignoreEmptyQuery",void 0);me([(0,Ve.redux)({store:D.name})],ee.prototype,"openExternalDocumentInNewTab",void 0);me([(0,Ve.jsonProperty)([])],ee.prototype,"filters",void 0);me([(0,Ve.jsonProperty)([])],ee.prototype,"sort",void 0);me([(0,Ve.redux)({store:"search"})],ee.prototype,"request",void 0);me([(0,Ve.redux)({store:"search"})],ee.prototype,"paging",void 0);me([(0,Ve.redux)({store:"search",selector:t=>t.spellcheck})],ee.prototype,"autocorrect",void 0);me([(0,tt.property)({attribute:!1})],ee.prototype,"searchServiceProvider",void 0)});var Ap=f(()=>{"use strict"});var Np={};kt(Np,{ClearAllFiltersEvent:()=>so,FtSearchContext:()=>ee,FtSearchContextCssVariables:()=>Qh,FtSearchStateManager:()=>Cr,LoadErrorEvent:()=>wn,SearchRequestChangeEvent:()=>An,SearchResultsChangeEvent:()=>Rn,searchInDocumentTitlesOnlySelector:()=>Op,styles:()=>Ea});var Rp,Pp=f(()=>{"use strict";Rp=y(A());Pa();wa();Ap();Pa();Aa();(0,Rp.customElement)("ft-search-context")(ee)});var co,Ip=f(()=>{"use strict";Je();co=Qe.build("designedSearchInput")});var Tp,Lp,_p=f(()=>{"use strict";Tp=y(k());qr();Lp=Tp.css`
|
|
936
936
|
* {
|
|
937
937
|
box-sizing: border-box;
|
|
938
938
|
}
|