@appbaseio/autocomplete-suggestions-plugin
Advanced tools
Comparing version 1.0.14-alpha to 1.0.15-alpha
@@ -1,2 +0,2 @@ | ||
var ye=Object.create;var Q=Object.defineProperty,ve=Object.defineProperties,me=Object.getOwnPropertyDescriptor,be=Object.getOwnPropertyDescriptors,ge=Object.getOwnPropertyNames,Y=Object.getOwnPropertySymbols,we=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable;var W=(t,e,n)=>e in t?Q(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,I=(t,e)=>{for(var n in e||(e={}))k.call(e,n)&&W(t,n,e[n]);if(Y)for(var n of Y(e))Ae.call(e,n)&&W(t,n,e[n]);return t},V=(t,e)=>ve(t,be(e)),_e=t=>Q(t,"__esModule",{value:!0});var L=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Re=(t,e,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ge(e))!k.call(t,s)&&s!=="default"&&Q(t,s,{get:()=>e[s],enumerable:!(n=me(e,s))||n.enumerable});return t},G=t=>Re(_e(Q(t!=null?ye(we(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var C=L((ke,Z)=>{function Se(t){var e=RegExp("^(([^:/?#]*)?://)?(((.*)?@)?([^/?#]*)?)([^?#]*)(\\?([^#]*))?(#(.*))?"),n=t.match(e);return{protocol:n[2],auth:n[5],host:n[6],path:n[7],query:n[9],hash:n[11]}}Z.exports=Se});var te=L((We,ee)=>{"use strict";function xe(t,e){return Object.prototype.hasOwnProperty.call(t,e)}ee.exports=function(t,e,n,s){e=e||"&",n=n||"=";var i={};if(typeof t!="string"||t.length===0)return i;var h=/\+/g;t=t.split(e);var u=1e3;s&&typeof s.maxKeys=="number"&&(u=s.maxKeys);var f=t.length;u>0&&f>u&&(f=u);for(var m=0;m<f;++m){var c=t[m].replace(h,"%20"),v=c.indexOf(n),p,y,d,g;v>=0?(p=c.substr(0,v),y=c.substr(v+1)):(p=c,y=""),d=decodeURIComponent(p),g=decodeURIComponent(y),xe(i,d)?Array.isArray(i[d])?i[d].push(g):i[d]=[i[d],g]:i[d]=g}return i}});var ne=L((Ze,re)=>{"use strict";var q=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};re.exports=function(t,e,n,s){return e=e||"&",n=n||"=",t===null&&(t=void 0),typeof t=="object"?Object.keys(t).map(function(i){var h=encodeURIComponent(q(i))+n;return Array.isArray(t[i])?t[i].map(function(u){return h+encodeURIComponent(q(u))}).join(e):h+encodeURIComponent(q(t[i]))}).filter(Boolean).join(e):s?encodeURIComponent(q(s))+n+encodeURIComponent(q(t)):""}});var oe=L(H=>{"use strict";H.decode=H.parse=te();H.encode=H.stringify=ne()});var ie=L((se,M)=>{var D=function(t){function e(){this.fetch=!1}return e.prototype=t,new e}(typeof self!="undefined"?self:se);(function(t){(function(e){if(e.fetch)return;var n={searchParams:"URLSearchParams"in e,iterable:"Symbol"in e&&"iterator"in Symbol,blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(r){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};if(n.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],i=function(r){return r&&DataView.prototype.isPrototypeOf(r)},h=ArrayBuffer.isView||function(r){return r&&s.indexOf(Object.prototype.toString.call(r))>-1};function u(r){if(typeof r!="string"&&(r=String(r)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(r))throw new TypeError("Invalid character in header field name");return r.toLowerCase()}function f(r){return typeof r!="string"&&(r=String(r)),r}function m(r){var o={next:function(){var a=r.shift();return{done:a===void 0,value:a}}};return n.iterable&&(o[Symbol.iterator]=function(){return o}),o}function c(r){this.map={},r instanceof c?r.forEach(function(o,a){this.append(a,o)},this):Array.isArray(r)?r.forEach(function(o){this.append(o[0],o[1])},this):r&&Object.getOwnPropertyNames(r).forEach(function(o){this.append(o,r[o])},this)}c.prototype.append=function(r,o){r=u(r),o=f(o);var a=this.map[r];this.map[r]=a?a+","+o:o},c.prototype.delete=function(r){delete this.map[u(r)]},c.prototype.get=function(r){return r=u(r),this.has(r)?this.map[r]:null},c.prototype.has=function(r){return this.map.hasOwnProperty(u(r))},c.prototype.set=function(r,o){this.map[u(r)]=f(o)},c.prototype.forEach=function(r,o){for(var a in this.map)this.map.hasOwnProperty(a)&&r.call(o,this.map[a],a,this)},c.prototype.keys=function(){var r=[];return this.forEach(function(o,a){r.push(a)}),m(r)},c.prototype.values=function(){var r=[];return this.forEach(function(o){r.push(o)}),m(r)},c.prototype.entries=function(){var r=[];return this.forEach(function(o,a){r.push([a,o])}),m(r)},n.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);function v(r){if(r.bodyUsed)return Promise.reject(new TypeError("Already read"));r.bodyUsed=!0}function p(r){return new Promise(function(o,a){r.onload=function(){o(r.result)},r.onerror=function(){a(r.error)}})}function y(r){var o=new FileReader,a=p(o);return o.readAsArrayBuffer(r),a}function d(r){var o=new FileReader,a=p(o);return o.readAsText(r),a}function g(r){for(var o=new Uint8Array(r),a=new Array(o.length),w=0;w<o.length;w++)a[w]=String.fromCharCode(o[w]);return a.join("")}function B(r){if(r.slice)return r.slice(0);var o=new Uint8Array(r.byteLength);return o.set(new Uint8Array(r)),o.buffer}function T(){return this.bodyUsed=!1,this._initBody=function(r){if(this._bodyInit=r,!r)this._bodyText="";else if(typeof r=="string")this._bodyText=r;else if(n.blob&&Blob.prototype.isPrototypeOf(r))this._bodyBlob=r;else if(n.formData&&FormData.prototype.isPrototypeOf(r))this._bodyFormData=r;else if(n.searchParams&&URLSearchParams.prototype.isPrototypeOf(r))this._bodyText=r.toString();else if(n.arrayBuffer&&n.blob&&i(r))this._bodyArrayBuffer=B(r.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else if(n.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(r)||h(r)))this._bodyArrayBuffer=B(r);else throw new Error("unsupported BodyInit type");this.headers.get("content-type")||(typeof r=="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(r)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n.blob&&(this.blob=function(){var r=v(this);if(r)return r;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?v(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var r=v(this);if(r)return r;if(this._bodyBlob)return d(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(g(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($)}),this.json=function(){return this.text().then(JSON.parse)},this}var P=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function j(r){var o=r.toUpperCase();return P.indexOf(o)>-1?o:r}function R(r,o){o=o||{};var a=o.body;if(r instanceof R){if(r.bodyUsed)throw new TypeError("Already read");this.url=r.url,this.credentials=r.credentials,o.headers||(this.headers=new c(r.headers)),this.method=r.method,this.mode=r.mode,!a&&r._bodyInit!=null&&(a=r._bodyInit,r.bodyUsed=!0)}else this.url=String(r);if(this.credentials=o.credentials||this.credentials||"omit",(o.headers||!this.headers)&&(this.headers=new c(o.headers)),this.method=j(o.method||this.method||"GET"),this.mode=o.mode||this.mode||null,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&a)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(a)}R.prototype.clone=function(){return new R(this,{body:this._bodyInit})};function $(r){var o=new FormData;return r.trim().split("&").forEach(function(a){if(a){var w=a.split("="),A=w.shift().replace(/\+/g," "),l=w.join("=").replace(/\+/g," ");o.append(decodeURIComponent(A),decodeURIComponent(l))}}),o}function J(r){var o=new c,a=r.replace(/\r?\n[\t ]+/g," ");return a.split(/\r?\n/).forEach(function(w){var A=w.split(":"),l=A.shift().trim();if(l){var x=A.join(":").trim();o.append(l,x)}}),o}T.call(R.prototype);function b(r,o){o||(o={}),this.type="default",this.status=o.status===void 0?200:o.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in o?o.statusText:"OK",this.headers=new c(o.headers),this.url=o.url||"",this._initBody(r)}T.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},b.error=function(){var r=new b(null,{status:0,statusText:""});return r.type="error",r};var O=[301,302,303,307,308];b.redirect=function(r,o){if(O.indexOf(o)===-1)throw new RangeError("Invalid status code");return new b(null,{status:o,headers:{location:r}})},e.Headers=c,e.Request=R,e.Response=b,e.fetch=function(r,o){return new Promise(function(a,w){var A=new R(r,o),l=new XMLHttpRequest;l.onload=function(){var x={status:l.status,statusText:l.statusText,headers:J(l.getAllResponseHeaders()||"")};x.url="responseURL"in l?l.responseURL:x.headers.get("X-Request-URL");var F="response"in l?l.response:l.responseText;a(new b(F,x))},l.onerror=function(){w(new TypeError("Network request failed"))},l.ontimeout=function(){w(new TypeError("Network request failed"))},l.open(A.method,A.url,!0),A.credentials==="include"?l.withCredentials=!0:A.credentials==="omit"&&(l.withCredentials=!1),"responseType"in l&&n.blob&&(l.responseType="blob"),A.headers.forEach(function(x,F){l.setRequestHeader(F,x)}),l.send(typeof A._bodyInit=="undefined"?null:A._bodyInit)})},e.fetch.polyfill=!0})(typeof t!="undefined"?t:this)}).call(D,void 0);var N=D.fetch,et=N.Response=D.Response,tt=N.Request=D.Request,rt=N.Headers=D.Headers;typeof M=="object"&&M.exports&&(M.exports=N,M.exports.default=N)});var ae=G(C()),ue=G(oe()),pe=G(ie()),Te=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function Pe(t,e){return t.indexOf(e)!==-1}function Oe(t){return Pe(t,"scalr.api.appbase.io")}function Ie(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n=t,s="",i=0,h,u=0,f=e;n.charAt(u|0)||(f="=",u%1);s+=f.charAt(63&i>>8-u%1*8)){if(h=n.charCodeAt(u+=3/4),h>255)throw new Error('"btoa" failed: The string to be encoded contains characters outside of the Latin1 range.');i=i<<8|h}return s}function K(t){if(t&&Object.prototype.toString.call(t)==="[object Array]"){for(var e=0;e<t.length;e+=1){var n=t[e];if(n){if(!n.id)return new Error("'id' field must be present in query object")}else return new Error("query object can not have an empty value")}return!0}return new Error("invalid query value, 'query' value must be an array")}function E(t,e){var n=[],s={object:null,string:"",number:0},i=Object.keys(e);i.forEach(function(f){var m=e[f].split("|"),c=m.find(function(v){return Te(t[f])===v});(!c||t[f]===s[c])&&n.push(f)});for(var h="",u=0;u<n.length;u+=1)h+=n[u]+", ";return n.length>0?new Error("fields missing: "+h):!0}function S(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t||!(Object.keys(t).length===0&&t.constructor===Object)?JSON.parse(JSON.stringify(t)):null}function Be(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n={};return e?Object.keys(t).forEach(function(s){n[s]=encodeURI(t[s])}):n=t,n}function X(t){var e={};return Object.assign(e,{"X-Search-Client":"Appbase JS"}),t===!1&&Object.assign(e,{"X-Enable-Telemetry":t}),e}function _(t){var e=(0,ae.default)(t.url||""),n=e.auth,s=n===void 0?null:n,i=e.host,h=i===void 0?"":i,u=e.path,f=u===void 0?"":u,m=e.protocol,c=m===void 0?"":m,v=h+f;if(typeof v!="string"||v==="")throw new Error("URL not present in options.");if(typeof t.app!="string"||t.app==="")throw new Error("App name is not present in options.");if(typeof c!="string"||c==="")throw new Error("Protocol is not present in url. URL should be of the form https://appbase-demo-ansible-abxiydt-arc.searchbase.io");v.slice(-1)==="/"&&(v=v.slice(0,-1));var p=s||null;if(typeof t.credentials=="string"&&t.credentials!==""?p=t.credentials:typeof t.username=="string"&&t.username!==""&&typeof t.password=="string"&&t.password!==""&&(p=t.username+":"+t.password),Oe(v)&&p===null)throw new Error("Authentication information is not present. Did you add credentials?");this.url=v,this.protocol=c,this.app=t.app,this.credentials=p,typeof t.enableTelemetry=="boolean"&&(this.enableTelemetry=t.enableTelemetry)}function Ue(t){var e=this;return new Promise(function(n,s){var i=S(t);try{var h=i.method,u=i.path,f=i.params,m=i.body,c=i.isRSAPI,v=i.isSuggestionsAPI,p=v?".suggestions":e.app,y=m,d=u.endsWith("msearch")||u.endsWith("bulk")?"application/x-ndjson":"application/json",g=Object.assign({},{Accept:"application/json","Content-Type":d},e.headers,t.headers),B=Date.now();e.credentials&&(g.Authorization="Basic "+Ie(e.credentials));var T={method:h,headers:g};if(Array.isArray(y)){var P="";y.forEach(function(b){P+=JSON.stringify(b),P+=` | ||
`}),y=P}else y=JSON.stringify(y)||{};Object.keys(y).length!==0&&(T.body=y);var j=function(O){if(e.transformRequest&&typeof e.transformRequest=="function"){var r=e.transformRequest(O);return r instanceof Promise?r:Promise.resolve(r)}return Promise.resolve(O)},R={},$="";f&&($="?"+ue.default.stringify(f));var J=e.protocol+"://"+e.url+"/"+p+"/"+u+$;return j(Object.assign({},{url:J},T)).then(function(b){var O=Object.assign({},b),r=O.url;return delete O.url,(0,pe.default)(r||J,O).then(function(o){return o.status>=500?s(o):(R=o.headers,o.json().then(function(a){if(o.status>=400)return s(o);if(a&&a.error)return s(a);if(c&&a&&Object.prototype.toString.call(a)==="[object Object]"&&m&&m.query&&m.query instanceof Array){var w=0,A=m.query.filter(function(U){return U.execute||U.execute===void 0}).length;if(a&&Object.keys(a).forEach(function(U){a[U]&&Object.prototype.hasOwnProperty.call(a[U],"error")&&(w+=1)}),w>0&&A===w)return s(a)}if(a&&a.responses instanceof Array){var l=a.responses.length,x=a.responses.filter(function(U){return Object.prototype.hasOwnProperty.call(U,"error")}).length;if(l===x)return s(a)}var F=Object.assign({},a,{_timestamp:B,_headers:R});return n(F)}).catch(function(a){return s(a)}))}).catch(function(o){return s(o)})}).catch(function(b){return s(b)})}catch(b){return s(b)}})}function Ee(t){var e=S(t),n=E(e,{body:"object"});if(n!==!0)throw n;var s=e.type,i=s===void 0?"_doc":s,h=e.id,u=e.body;delete e.type,delete e.body,delete e.id;var f=void 0;return h?f=i?i+"/"+encodeURIComponent(h):encodeURIComponent(h):f=i,this.performFetchRequest({method:"POST",path:f,params:e,body:u})}function je(t){var e=S(t),n=E(e,{id:"string|number"});if(n!==!0)throw n;var s=e.type,i=s===void 0?"_doc":s,h=e.id;delete e.type,delete e.id;var u=i+"/"+encodeURIComponent(h);return this.performFetchRequest({method:"GET",path:u,params:e})}function Fe(t){var e=S(t),n=E(e,{id:"string|number",body:"object"});if(n!==!0)throw n;var s=e.type,i=s===void 0?"_doc":s,h=e.id,u=e.body;delete e.type,delete e.id,delete e.body;var f=i+"/"+encodeURIComponent(h)+"/_update";return this.performFetchRequest({method:"POST",path:f,params:e,body:u})}function Le(t){var e=S(t),n=E(e,{id:"string|number"});if(n!==!0)throw n;var s=e.type,i=s===void 0?"_doc":s,h=e.id;delete e.type,delete e.id;var u=i+"/"+encodeURIComponent(h);return this.performFetchRequest({method:"DELETE",path:u,params:e})}function qe(t){var e=S(t),n=E(e,{body:"object"});if(n!==!0)throw n;var s=e.type,i=e.body;delete e.type,delete e.body;var h=void 0;return s?h=s+"/_bulk":h="_bulk",this.performFetchRequest({method:"POST",path:h,params:e,body:i})}function He(t){var e=S(t),n=E(e,{body:"object"});if(n!==!0)throw n;var s=void 0;Array.isArray(e.type)?s=e.type.join():s=e.type;var i=e.body;delete e.type,delete e.body;var h=void 0;return s?h=s+"/_search":h="_search",this.performFetchRequest({method:"POST",path:h,params:e,body:i})}function De(t){var e=S(t),n=E(e,{body:"object"});if(n!==!0)throw n;var s=void 0;Array.isArray(e.type)?s=e.type.join():s=e.type;var i=e.body;delete e.type,delete e.body;var h=void 0;return s?h=s+"/_msearch":h="_msearch",this.performFetchRequest({method:"POST",path:h,params:e,body:i})}function Ne(t,e){var n=S(e),s=K(t);if(s!==!0)throw s;var i={settings:n,query:t};return this.performFetchRequest({method:"POST",path:"_reactivesearch",body:i,headers:X(this.enableTelemetry),isRSAPI:!0})}function Me(t,e){var n=S(e),s=K(t);if(s!==!0)throw s;var i={settings:n,query:t};return this.performFetchRequest({method:"POST",path:"_reactivesearch.v3",body:i,headers:X(this.enableTelemetry),isRSAPI:!0})}function ze(){return this.performFetchRequest({method:"GET",path:"_mapping"})}function $e(t,e){var n=S(e),s=K(t);if(s!==!0)throw s;var i={settings:n,query:t};return this.performFetchRequest({method:"POST",path:"_reactivesearch.v3",body:i,headers:X(this.enableTelemetry),isRSAPI:!0,isSuggestionsAPI:!0})}function Je(t){var e=new _(t);return _.prototype.performFetchRequest=Ue,_.prototype.index=Ee,_.prototype.get=je,_.prototype.update=Fe,_.prototype.delete=Le,_.prototype.bulk=qe,_.prototype.search=He,_.prototype.msearch=De,_.prototype.reactiveSearch=Ne,_.prototype.reactiveSearchv3=Me,_.prototype.getQuerySuggestions=$e,_.prototype.getMappings=ze,_.prototype.setHeaders=function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;i?this.headers=Be(s):this.headers=s},typeof window!="undefined"&&(window.Appbase=e),e}var he=Je;var z="suggestions",ce=["url","index","app","username","password","credentials","enableTelemetry"];var Qe=t=>t("svg",{xmlns:"http://www.w3.org/2000/svg",alt:"Recent Search",height:"20",width:"20",viewBox:"0 0 24 24",style:{fill:"#707070"}},t("path",{d:"M0 0h24v24H0z",fill:"none"}),t("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"})),Ve=t=>t("svg",{xmlns:"http://www.w3.org/2000/svg",alt:"Popular Search",height:"20",width:"20",viewBox:"0 0 24 24",style:{fill:"#707070"}},t("path",{d:"M0 0h24v24H0z",fill:"none"}),t("path",{d:"M16 6l2.29 2.29-4.88 4.88-4-4L2 16.59 3.41 18l6-6 4 4 6.3-6.29L22 12V6z"})),Ge=t=>t("svg",{viewBox:"0 0 24 24",width:"20",height:"20",style:{fill:"#707070"}},t("path",{d:"M16.041 15.856c-0.034 0.026-0.067 0.055-0.099 0.087s-0.060 0.064-0.087 0.099c-1.258 1.213-2.969 1.958-4.855 1.958-1.933 0-3.682-0.782-4.95-2.050s-2.050-3.017-2.050-4.95 0.782-3.682 2.050-4.95 3.017-2.050 4.95-2.050 3.682 0.782 4.95 2.050 2.050 3.017 2.050 4.95c0 1.886-0.745 3.597-1.959 4.856zM21.707 20.293l-3.675-3.675c1.231-1.54 1.968-3.493 1.968-5.618 0-2.485-1.008-4.736-2.636-6.364s-3.879-2.636-6.364-2.636-4.736 1.008-6.364 2.636-2.636 3.879-2.636 6.364 1.008 4.736 2.636 6.364 3.879 2.636 6.364 2.636c2.125 0 4.078-0.737 5.618-1.968l3.675 3.675c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414z"})),Ke=t=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",style:{fill:"#707070"}},t("path",{d:"M12 .587l3.668 7.568 8.332 1.151-6.064 5.828 1.48 8.279-7.416-3.967-7.417 3.967 1.481-8.279-6.064-5.828 8.332-1.151z"})),fe=t=>{switch(t){case"index":return Ge;case"recent":return Qe;case"popular":return Ve;case"promoted":return Ke;default:return()=>{}}},de=t=>t.map(e=>V(I({},e),{type:e._suggestion_type})),le=t=>{let e={};return ce.forEach(n=>{t[n]&&Object.assign(e,{[n]:t[n]})}),e};function Xe(t={},e={},n={}){let s=he(I({},le(t))),i=`suggestions_source_${Math.random()*Math.random()*1e3}`;return{getSources:function(u){var f=u.query,m=u.setQuery,c=u.refresh,v=u.setContext;return[{sourceId:i,getItems(){return s.reactiveSearchv3([I(I({id:z,type:"suggestion"},!!f&&{value:f}),e)],I({},t.settings)).then(function(p){var y,d,g,B,T,P,j,R;return(n==null?void 0:n.useContextValue)&&v({total:(g=(d=(y=p==null?void 0:p[z])==null?void 0:y.hits)==null?void 0:d.total)==null?void 0:g.value,time:(B=p==null?void 0:p[z])==null?void 0:B.took,resultsJson:(P=(T=p==null?void 0:p[z])==null?void 0:T.hits)==null?void 0:P.hits}),de(((R=(j=p==null?void 0:p.suggestions)==null?void 0:j.hits)==null?void 0:R.hits)||[])}).catch(function(p){return console.log("suggestions search error: ",p),[]})},onSelect(p){let{item:y,setQuery:d,refresh:g}=p;if(typeof(n==null?void 0:n.onItemSelect)=="function"){n.onItemSelect(p);return}d(y.label),g()},templates:{header(p){return typeof(n==null?void 0:n.renderHeader)=="function"?n.renderHeader(p):null},item(p){let{item:y,createElement:d}=p;return typeof(n==null?void 0:n.renderItem)=="function"?n.renderItem(V(I({},p),{setQuery:m,refresh:c,setContext:v})):d("div",{className:"item"},d("div",{className:"item__content-wrapper"},fe(y.type)(d),d("span",{dangerouslySetInnerHTML:{__html:y.label}})),d("div",{className:"item__actions-wrapper"}," ",d("button",{onClick:g=>{g.stopPropagation(),m(y.value),c()},type:"button",className:"set-search-arrow"},d("svg",{viewBox:"0 0 24 24",fill:"currentColor"},d("path",{d:"M8 17v-7.586l8.293 8.293c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414l-8.293-8.293h7.586c0.552 0 1-0.448 1-1s-0.448-1-1-1h-10c-0.552 0-1 0.448-1 1v10c0 0.552 0.448 1 1 1s1-0.448 1-1z"})))))},footer(p){return typeof(n==null?void 0:n.renderFooter)=="function"?n.renderFooter(p):null},noResults(p){let{createElement:y}=p;return typeof(n==null?void 0:n.renderNoResults)=="function"?n.renderNoResults(p):y("span",{style:{marginLeft:"-9px"}},"No Results Found!")}}}]}}}var dt=Xe;export{dt as default}; | ||
var ye=Object.create;var Q=Object.defineProperty,ve=Object.defineProperties,me=Object.getOwnPropertyDescriptor,be=Object.getOwnPropertyDescriptors,ge=Object.getOwnPropertyNames,X=Object.getOwnPropertySymbols,we=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable;var W=(t,e,n)=>e in t?Q(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,I=(t,e)=>{for(var n in e||(e={}))Y.call(e,n)&&W(t,n,e[n]);if(X)for(var n of X(e))Ae.call(e,n)&&W(t,n,e[n]);return t},V=(t,e)=>ve(t,be(e)),Re=t=>Q(t,"__esModule",{value:!0});var L=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var _e=(t,e,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ge(e))!Y.call(t,s)&&s!=="default"&&Q(t,s,{get:()=>e[s],enumerable:!(n=me(e,s))||n.enumerable});return t},G=t=>_e(Re(Q(t!=null?ye(we(t)):{},"default",t&&t.__esModule&&"default"in t?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t);var C=L((Ye,Z)=>{function Se(t){var e=RegExp("^(([^:/?#]*)?://)?(((.*)?@)?([^/?#]*)?)([^?#]*)(\\?([^#]*))?(#(.*))?"),n=t.match(e);return{protocol:n[2],auth:n[5],host:n[6],path:n[7],query:n[9],hash:n[11]}}Z.exports=Se});var te=L((We,ee)=>{"use strict";function xe(t,e){return Object.prototype.hasOwnProperty.call(t,e)}ee.exports=function(t,e,n,s){e=e||"&",n=n||"=";var i={};if(typeof t!="string"||t.length===0)return i;var h=/\+/g;t=t.split(e);var u=1e3;s&&typeof s.maxKeys=="number"&&(u=s.maxKeys);var c=t.length;u>0&&c>u&&(c=u);for(var m=0;m<c;++m){var f=t[m].replace(h,"%20"),v=f.indexOf(n),p,y,l,g;v>=0?(p=f.substr(0,v),y=f.substr(v+1)):(p=f,y=""),l=decodeURIComponent(p),g=decodeURIComponent(y),xe(i,l)?Array.isArray(i[l])?i[l].push(g):i[l]=[i[l],g]:i[l]=g}return i}});var ne=L((Ze,re)=>{"use strict";var q=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};re.exports=function(t,e,n,s){return e=e||"&",n=n||"=",t===null&&(t=void 0),typeof t=="object"?Object.keys(t).map(function(i){var h=encodeURIComponent(q(i))+n;return Array.isArray(t[i])?t[i].map(function(u){return h+encodeURIComponent(q(u))}).join(e):h+encodeURIComponent(q(t[i]))}).filter(Boolean).join(e):s?encodeURIComponent(q(s))+n+encodeURIComponent(q(t)):""}});var oe=L(H=>{"use strict";H.decode=H.parse=te();H.encode=H.stringify=ne()});var ie=L((se,M)=>{var D=function(t){function e(){this.fetch=!1}return e.prototype=t,new e}(typeof self!="undefined"?self:se);(function(t){(function(e){if(e.fetch)return;var n={searchParams:"URLSearchParams"in e,iterable:"Symbol"in e&&"iterator"in Symbol,blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(r){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};if(n.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],i=function(r){return r&&DataView.prototype.isPrototypeOf(r)},h=ArrayBuffer.isView||function(r){return r&&s.indexOf(Object.prototype.toString.call(r))>-1};function u(r){if(typeof r!="string"&&(r=String(r)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(r))throw new TypeError("Invalid character in header field name");return r.toLowerCase()}function c(r){return typeof r!="string"&&(r=String(r)),r}function m(r){var o={next:function(){var a=r.shift();return{done:a===void 0,value:a}}};return n.iterable&&(o[Symbol.iterator]=function(){return o}),o}function f(r){this.map={},r instanceof f?r.forEach(function(o,a){this.append(a,o)},this):Array.isArray(r)?r.forEach(function(o){this.append(o[0],o[1])},this):r&&Object.getOwnPropertyNames(r).forEach(function(o){this.append(o,r[o])},this)}f.prototype.append=function(r,o){r=u(r),o=c(o);var a=this.map[r];this.map[r]=a?a+","+o:o},f.prototype.delete=function(r){delete this.map[u(r)]},f.prototype.get=function(r){return r=u(r),this.has(r)?this.map[r]:null},f.prototype.has=function(r){return this.map.hasOwnProperty(u(r))},f.prototype.set=function(r,o){this.map[u(r)]=c(o)},f.prototype.forEach=function(r,o){for(var a in this.map)this.map.hasOwnProperty(a)&&r.call(o,this.map[a],a,this)},f.prototype.keys=function(){var r=[];return this.forEach(function(o,a){r.push(a)}),m(r)},f.prototype.values=function(){var r=[];return this.forEach(function(o){r.push(o)}),m(r)},f.prototype.entries=function(){var r=[];return this.forEach(function(o,a){r.push([a,o])}),m(r)},n.iterable&&(f.prototype[Symbol.iterator]=f.prototype.entries);function v(r){if(r.bodyUsed)return Promise.reject(new TypeError("Already read"));r.bodyUsed=!0}function p(r){return new Promise(function(o,a){r.onload=function(){o(r.result)},r.onerror=function(){a(r.error)}})}function y(r){var o=new FileReader,a=p(o);return o.readAsArrayBuffer(r),a}function l(r){var o=new FileReader,a=p(o);return o.readAsText(r),a}function g(r){for(var o=new Uint8Array(r),a=new Array(o.length),w=0;w<o.length;w++)a[w]=String.fromCharCode(o[w]);return a.join("")}function B(r){if(r.slice)return r.slice(0);var o=new Uint8Array(r.byteLength);return o.set(new Uint8Array(r)),o.buffer}function T(){return this.bodyUsed=!1,this._initBody=function(r){if(this._bodyInit=r,!r)this._bodyText="";else if(typeof r=="string")this._bodyText=r;else if(n.blob&&Blob.prototype.isPrototypeOf(r))this._bodyBlob=r;else if(n.formData&&FormData.prototype.isPrototypeOf(r))this._bodyFormData=r;else if(n.searchParams&&URLSearchParams.prototype.isPrototypeOf(r))this._bodyText=r.toString();else if(n.arrayBuffer&&n.blob&&i(r))this._bodyArrayBuffer=B(r.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else if(n.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(r)||h(r)))this._bodyArrayBuffer=B(r);else throw new Error("unsupported BodyInit type");this.headers.get("content-type")||(typeof r=="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(r)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n.blob&&(this.blob=function(){var r=v(this);if(r)return r;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?v(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(y)}),this.text=function(){var r=v(this);if(r)return r;if(this._bodyBlob)return l(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(g(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($)}),this.json=function(){return this.text().then(JSON.parse)},this}var P=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function j(r){var o=r.toUpperCase();return P.indexOf(o)>-1?o:r}function _(r,o){o=o||{};var a=o.body;if(r instanceof _){if(r.bodyUsed)throw new TypeError("Already read");this.url=r.url,this.credentials=r.credentials,o.headers||(this.headers=new f(r.headers)),this.method=r.method,this.mode=r.mode,!a&&r._bodyInit!=null&&(a=r._bodyInit,r.bodyUsed=!0)}else this.url=String(r);if(this.credentials=o.credentials||this.credentials||"omit",(o.headers||!this.headers)&&(this.headers=new f(o.headers)),this.method=j(o.method||this.method||"GET"),this.mode=o.mode||this.mode||null,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&a)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(a)}_.prototype.clone=function(){return new _(this,{body:this._bodyInit})};function $(r){var o=new FormData;return r.trim().split("&").forEach(function(a){if(a){var w=a.split("="),A=w.shift().replace(/\+/g," "),d=w.join("=").replace(/\+/g," ");o.append(decodeURIComponent(A),decodeURIComponent(d))}}),o}function J(r){var o=new f,a=r.replace(/\r?\n[\t ]+/g," ");return a.split(/\r?\n/).forEach(function(w){var A=w.split(":"),d=A.shift().trim();if(d){var x=A.join(":").trim();o.append(d,x)}}),o}T.call(_.prototype);function b(r,o){o||(o={}),this.type="default",this.status=o.status===void 0?200:o.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in o?o.statusText:"OK",this.headers=new f(o.headers),this.url=o.url||"",this._initBody(r)}T.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},b.error=function(){var r=new b(null,{status:0,statusText:""});return r.type="error",r};var O=[301,302,303,307,308];b.redirect=function(r,o){if(O.indexOf(o)===-1)throw new RangeError("Invalid status code");return new b(null,{status:o,headers:{location:r}})},e.Headers=f,e.Request=_,e.Response=b,e.fetch=function(r,o){return new Promise(function(a,w){var A=new _(r,o),d=new XMLHttpRequest;d.onload=function(){var x={status:d.status,statusText:d.statusText,headers:J(d.getAllResponseHeaders()||"")};x.url="responseURL"in d?d.responseURL:x.headers.get("X-Request-URL");var F="response"in d?d.response:d.responseText;a(new b(F,x))},d.onerror=function(){w(new TypeError("Network request failed"))},d.ontimeout=function(){w(new TypeError("Network request failed"))},d.open(A.method,A.url,!0),A.credentials==="include"?d.withCredentials=!0:A.credentials==="omit"&&(d.withCredentials=!1),"responseType"in d&&n.blob&&(d.responseType="blob"),A.headers.forEach(function(x,F){d.setRequestHeader(F,x)}),d.send(typeof A._bodyInit=="undefined"?null:A._bodyInit)})},e.fetch.polyfill=!0})(typeof t!="undefined"?t:this)}).call(D,void 0);var z=D.fetch,et=z.Response=D.Response,tt=z.Request=D.Request,rt=z.Headers=D.Headers;typeof M=="object"&&M.exports&&(M.exports=z,M.exports.default=z)});var ae=G(C()),ue=G(oe()),pe=G(ie()),Te=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};function Pe(t,e){return t.indexOf(e)!==-1}function Oe(t){return Pe(t,"scalr.api.appbase.io")}function Ie(){for(var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n=t,s="",i=0,h,u=0,c=e;n.charAt(u|0)||(c="=",u%1);s+=c.charAt(63&i>>8-u%1*8)){if(h=n.charCodeAt(u+=3/4),h>255)throw new Error('"btoa" failed: The string to be encoded contains characters outside of the Latin1 range.');i=i<<8|h}return s}function k(t){if(t&&Object.prototype.toString.call(t)==="[object Array]"){for(var e=0;e<t.length;e+=1){var n=t[e];if(n){if(!n.id)return new Error("'id' field must be present in query object")}else return new Error("query object can not have an empty value")}return!0}return new Error("invalid query value, 'query' value must be an array")}function E(t,e){var n=[],s={object:null,string:"",number:0},i=Object.keys(e);i.forEach(function(c){var m=e[c].split("|"),f=m.find(function(v){return Te(t[c])===v});(!f||t[c]===s[f])&&n.push(c)});for(var h="",u=0;u<n.length;u+=1)h+=n[u]+", ";return n.length>0?new Error("fields missing: "+h):!0}function S(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return t||!(Object.keys(t).length===0&&t.constructor===Object)?JSON.parse(JSON.stringify(t)):null}function Be(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n={};return e?Object.keys(t).forEach(function(s){n[s]=encodeURI(t[s])}):n=t,n}function K(t){var e={};return Object.assign(e,{"X-Search-Client":"Appbase JS"}),t===!1&&Object.assign(e,{"X-Enable-Telemetry":t}),e}function R(t){var e=(0,ae.default)(t.url||""),n=e.auth,s=n===void 0?null:n,i=e.host,h=i===void 0?"":i,u=e.path,c=u===void 0?"":u,m=e.protocol,f=m===void 0?"":m,v=h+c;if(typeof v!="string"||v==="")throw new Error("URL not present in options.");if(typeof t.app!="string"||t.app==="")throw new Error("App name is not present in options.");if(typeof f!="string"||f==="")throw new Error("Protocol is not present in url. URL should be of the form https://appbase-demo-ansible-abxiydt-arc.searchbase.io");v.slice(-1)==="/"&&(v=v.slice(0,-1));var p=s||null;if(typeof t.credentials=="string"&&t.credentials!==""?p=t.credentials:typeof t.username=="string"&&t.username!==""&&typeof t.password=="string"&&t.password!==""&&(p=t.username+":"+t.password),Oe(v)&&p===null)throw new Error("Authentication information is not present. Did you add credentials?");this.url=v,this.protocol=f,this.app=t.app,this.credentials=p,typeof t.enableTelemetry=="boolean"&&(this.enableTelemetry=t.enableTelemetry)}function Ue(t){var e=this;return new Promise(function(n,s){var i=S(t);try{var h=i.method,u=i.path,c=i.params,m=i.body,f=i.isRSAPI,v=i.isSuggestionsAPI,p=v?".suggestions":e.app,y=m,l=u.endsWith("msearch")||u.endsWith("bulk")?"application/x-ndjson":"application/json",g=Object.assign({},{Accept:"application/json","Content-Type":l},e.headers,t.headers),B=Date.now();e.credentials&&(g.Authorization="Basic "+Ie(e.credentials));var T={method:h,headers:g};if(Array.isArray(y)){var P="";y.forEach(function(b){P+=JSON.stringify(b),P+=` | ||
`}),y=P}else y=JSON.stringify(y)||{};Object.keys(y).length!==0&&(T.body=y);var j=function(O){if(e.transformRequest&&typeof e.transformRequest=="function"){var r=e.transformRequest(O);return r instanceof Promise?r:Promise.resolve(r)}return Promise.resolve(O)},_={},$="";c&&($="?"+ue.default.stringify(c));var J=e.protocol+"://"+e.url+"/"+p+"/"+u+$;return j(Object.assign({},{url:J},T)).then(function(b){var O=Object.assign({},b),r=O.url;return delete O.url,(0,pe.default)(r||J,O).then(function(o){return o.status>=500?s(o):(_=o.headers,o.json().then(function(a){if(o.status>=400)return s(o);if(a&&a.error)return s(a);if(f&&a&&Object.prototype.toString.call(a)==="[object Object]"&&m&&m.query&&m.query instanceof Array){var w=0,A=m.query.filter(function(U){return U.execute||U.execute===void 0}).length;if(a&&Object.keys(a).forEach(function(U){a[U]&&Object.prototype.hasOwnProperty.call(a[U],"error")&&(w+=1)}),w>0&&A===w)return s(a)}if(a&&a.responses instanceof Array){var d=a.responses.length,x=a.responses.filter(function(U){return Object.prototype.hasOwnProperty.call(U,"error")}).length;if(d===x)return s(a)}var F=Object.assign({},a,{_timestamp:B,_headers:_});return n(F)}).catch(function(a){return s(a)}))}).catch(function(o){return s(o)})}).catch(function(b){return s(b)})}catch(b){return s(b)}})}function Ee(t){var e=S(t),n=E(e,{body:"object"});if(n!==!0)throw n;var s=e.type,i=s===void 0?"_doc":s,h=e.id,u=e.body;delete e.type,delete e.body,delete e.id;var c=void 0;return h?c=i?i+"/"+encodeURIComponent(h):encodeURIComponent(h):c=i,this.performFetchRequest({method:"POST",path:c,params:e,body:u})}function je(t){var e=S(t),n=E(e,{id:"string|number"});if(n!==!0)throw n;var s=e.type,i=s===void 0?"_doc":s,h=e.id;delete e.type,delete e.id;var u=i+"/"+encodeURIComponent(h);return this.performFetchRequest({method:"GET",path:u,params:e})}function Fe(t){var e=S(t),n=E(e,{id:"string|number",body:"object"});if(n!==!0)throw n;var s=e.type,i=s===void 0?"_doc":s,h=e.id,u=e.body;delete e.type,delete e.id,delete e.body;var c=i+"/"+encodeURIComponent(h)+"/_update";return this.performFetchRequest({method:"POST",path:c,params:e,body:u})}function Le(t){var e=S(t),n=E(e,{id:"string|number"});if(n!==!0)throw n;var s=e.type,i=s===void 0?"_doc":s,h=e.id;delete e.type,delete e.id;var u=i+"/"+encodeURIComponent(h);return this.performFetchRequest({method:"DELETE",path:u,params:e})}function qe(t){var e=S(t),n=E(e,{body:"object"});if(n!==!0)throw n;var s=e.type,i=e.body;delete e.type,delete e.body;var h=void 0;return s?h=s+"/_bulk":h="_bulk",this.performFetchRequest({method:"POST",path:h,params:e,body:i})}function He(t){var e=S(t),n=E(e,{body:"object"});if(n!==!0)throw n;var s=void 0;Array.isArray(e.type)?s=e.type.join():s=e.type;var i=e.body;delete e.type,delete e.body;var h=void 0;return s?h=s+"/_search":h="_search",this.performFetchRequest({method:"POST",path:h,params:e,body:i})}function De(t){var e=S(t),n=E(e,{body:"object"});if(n!==!0)throw n;var s=void 0;Array.isArray(e.type)?s=e.type.join():s=e.type;var i=e.body;delete e.type,delete e.body;var h=void 0;return s?h=s+"/_msearch":h="_msearch",this.performFetchRequest({method:"POST",path:h,params:e,body:i})}function ze(t,e){var n=S(e),s=k(t);if(s!==!0)throw s;var i={settings:n,query:t};return this.performFetchRequest({method:"POST",path:"_reactivesearch",body:i,headers:K(this.enableTelemetry),isRSAPI:!0})}function Me(t,e){var n=S(e),s=k(t);if(s!==!0)throw s;var i={settings:n,query:t};return this.performFetchRequest({method:"POST",path:"_reactivesearch.v3",body:i,headers:K(this.enableTelemetry),isRSAPI:!0})}function Ne(){return this.performFetchRequest({method:"GET",path:"_mapping"})}function $e(t,e){var n=S(e),s=k(t);if(s!==!0)throw s;var i={settings:n,query:t};return this.performFetchRequest({method:"POST",path:"_reactivesearch.v3",body:i,headers:K(this.enableTelemetry),isRSAPI:!0,isSuggestionsAPI:!0})}function Je(t){var e=new R(t);return R.prototype.performFetchRequest=Ue,R.prototype.index=Ee,R.prototype.get=je,R.prototype.update=Fe,R.prototype.delete=Le,R.prototype.bulk=qe,R.prototype.search=He,R.prototype.msearch=De,R.prototype.reactiveSearch=ze,R.prototype.reactiveSearchv3=Me,R.prototype.getQuerySuggestions=$e,R.prototype.getMappings=Ne,R.prototype.setHeaders=function(){var s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;i?this.headers=Be(s):this.headers=s},typeof window!="undefined"&&(window.Appbase=e),e}var he=Je;var N="suggestions",fe=["url","index","app","username","password","credentials","enableTelemetry"];var Qe=t=>t("svg",{xmlns:"http://www.w3.org/2000/svg",alt:"Recent Search",height:"20",width:"20",viewBox:"0 0 24 24",style:{fill:"#707070"}},t("path",{d:"M0 0h24v24H0z",fill:"none"}),t("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"})),Ve=t=>t("svg",{xmlns:"http://www.w3.org/2000/svg",alt:"Popular Search",height:"20",width:"20",viewBox:"0 0 24 24",style:{fill:"#707070"}},t("path",{d:"M0 0h24v24H0z",fill:"none"}),t("path",{d:"M16 6l2.29 2.29-4.88 4.88-4-4L2 16.59 3.41 18l6-6 4 4 6.3-6.29L22 12V6z"})),Ge=t=>t("svg",{viewBox:"0 0 24 24",width:"20",height:"20",style:{fill:"#707070"}},t("path",{d:"M16.041 15.856c-0.034 0.026-0.067 0.055-0.099 0.087s-0.060 0.064-0.087 0.099c-1.258 1.213-2.969 1.958-4.855 1.958-1.933 0-3.682-0.782-4.95-2.050s-2.050-3.017-2.050-4.95 0.782-3.682 2.050-4.95 3.017-2.050 4.95-2.050 3.682 0.782 4.95 2.050 2.050 3.017 2.050 4.95c0 1.886-0.745 3.597-1.959 4.856zM21.707 20.293l-3.675-3.675c1.231-1.54 1.968-3.493 1.968-5.618 0-2.485-1.008-4.736-2.636-6.364s-3.879-2.636-6.364-2.636-4.736 1.008-6.364 2.636-2.636 3.879-2.636 6.364 1.008 4.736 2.636 6.364 3.879 2.636 6.364 2.636c2.125 0 4.078-0.737 5.618-1.968l3.675 3.675c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414z"})),ke=t=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",style:{fill:"#707070"}},t("path",{d:"M12 .587l3.668 7.568 8.332 1.151-6.064 5.828 1.48 8.279-7.416-3.967-7.417 3.967 1.481-8.279-6.064-5.828 8.332-1.151z"})),ce=t=>{switch(t){case"index":return Ge;case"recent":return Qe;case"popular":return Ve;case"promoted":return ke;default:return()=>{}}},le=t=>t.map(e=>V(I({},e),{type:e._suggestion_type})),de=t=>{let e={};return fe.forEach(n=>{t[n]&&Object.assign(e,{[n]:t[n]})}),e};function Ke(t={},e={},n={}){let s=he(I({},de(t))),i=`suggestions_source_${Math.random()*Math.random()*1e3}`;return{getSources:function(u){var c=u.query,m=u.setQuery,f=u.refresh,v=u.setContext;return[{sourceId:i,getItems(){return s.reactiveSearchv3([I(I({id:N,type:"suggestion"},!!c&&{value:c}),e)],I({},t.settings)).then(function(p){var y,l,g,B,T,P,j,_;return(n==null?void 0:n.useContextValue)&&v({total:(g=(l=(y=p==null?void 0:p[N])==null?void 0:y.hits)==null?void 0:l.total)==null?void 0:g.value,time:(B=p==null?void 0:p[N])==null?void 0:B.took,resultsJson:(P=(T=p==null?void 0:p[N])==null?void 0:T.hits)==null?void 0:P.hits}),le(((_=(j=p==null?void 0:p.suggestions)==null?void 0:j.hits)==null?void 0:_.hits)||[])}).catch(function(p){return console.log("suggestions search error: ",p),[]})},onSelect(p){let{item:y,setQuery:l,refresh:g}=p;if(typeof(n==null?void 0:n.onItemSelect)=="function"){n.onItemSelect(p);return}l(y.label),g()},templates:{header(p){return typeof(n==null?void 0:n.renderHeader)=="function"?n.renderHeader(p):null},item(p){let{item:y,createElement:l}=p;return typeof(n==null?void 0:n.renderItem)=="function"?n.renderItem(V(I({},p),{setQuery:m,refresh:f,setContext:v})):l("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},l("div",{style:{display:"grid",gridTemplateColumns:"max-content 1fr"}},ce(y.type)(l),l("span",{style:{display:"block",overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",paddingRight:"1rem"},dangerouslySetInnerHTML:{__html:y.label}})),l("div",{style:{display:"grid"}}," ",l("button",{onClick:g=>{g.stopPropagation(),m(y.value),f()},type:"button"},l("svg",{style:{fontSize:"20px",cursor:"pointer",color:"#707070",height:"22px",":hover":{color:"#000"}},viewBox:"0 0 24 24",fill:"currentColor"},l("path",{d:"M8 17v-7.586l8.293 8.293c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414l-8.293-8.293h7.586c0.552 0 1-0.448 1-1s-0.448-1-1-1h-10c-0.552 0-1 0.448-1 1v10c0 0.552 0.448 1 1 1s1-0.448 1-1z"})))))},footer(p){return typeof(n==null?void 0:n.renderFooter)=="function"?n.renderFooter(p):null},noResults(p){let{createElement:y}=p;return typeof(n==null?void 0:n.renderNoResults)=="function"?n.renderNoResults(p):y("span",{style:{marginLeft:"-9px"}},"No Results Found!")}}}]}}}var lt=Ke;export{lt as default}; |
{ | ||
"name": "@appbaseio/autocomplete-suggestions-plugin", | ||
"version": "1.0.14-alpha", | ||
"version": "1.0.15-alpha", | ||
"description": "A suggestions plugin for autocomplete-js, backed by appbase client.", | ||
@@ -9,3 +9,3 @@ "main": "lib/index.js", | ||
"scripts": { | ||
"build": "./node_modules/.bin/esbuild src/index.js --bundle --minify --loader:.js=jsx --jsx-factory= --format=esm --target=es6 --outfile=lib/index.js", | ||
"build": "./node_modules/.bin/esbuild src/index.js --bundle --minify --loader:.js=jsx --jsx-factory= --format=esm --target=es6 --outfile=lib/index.js", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
@@ -12,0 +12,0 @@ }, |
@@ -86,6 +86,26 @@ /** @jsx createElement */ | ||
return ( | ||
<div className="item"> | ||
<div className="item__content-wrapper"> | ||
<div | ||
style={{ | ||
display: "flex", | ||
alignItems: "center", | ||
justifyContent: "space-between", | ||
flexDirection: "row", | ||
width: "100%", | ||
}} | ||
> | ||
<div | ||
style={{ | ||
display: "grid", | ||
gridTemplateColumns: "max-content 1fr", | ||
}} | ||
> | ||
{getIcon(item.type)(createElement)} | ||
<span | ||
style={{ | ||
display: "block", | ||
overflow: "hidden", | ||
whiteSpace: "nowrap", | ||
textOverflow: "ellipsis", | ||
paddingRight: "1rem", | ||
}} | ||
dangerouslySetInnerHTML={{ | ||
@@ -96,3 +116,3 @@ __html: item.label, | ||
</div> | ||
<div className="item__actions-wrapper"> | ||
<div style={{ display: "grid" }}> | ||
{" "} | ||
@@ -107,5 +127,16 @@ <button | ||
type="button" | ||
className="set-search-arrow" | ||
> | ||
<svg viewBox="0 0 24 24" fill="currentColor"> | ||
<svg | ||
style={{ | ||
fontSize: "20px", | ||
cursor: "pointer", | ||
color: "#707070", | ||
height: "22px", | ||
":hover": { | ||
color: "#000", | ||
}, | ||
}} | ||
viewBox="0 0 24 24" | ||
fill="currentColor" | ||
> | ||
<path d="M8 17v-7.586l8.293 8.293c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414l-8.293-8.293h7.586c0.552 0 1-0.448 1-1s-0.448-1-1-1h-10c-0.552 0-1 0.448-1 1v10c0 0.552 0.448 1 1 1s1-0.448 1-1z"></path> | ||
@@ -112,0 +143,0 @@ </svg> |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
12
45950
454
1