@mixpeek/react-searchkit 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +224 -0
- package/dist/AIAnswer.d.ts +9 -0
- package/dist/IntentCTA.d.ts +8 -0
- package/dist/PoweredBy.d.ts +9 -0
- package/dist/ResultCard.d.ts +11 -0
- package/dist/SearchButton.d.ts +9 -0
- package/dist/SearchInput.d.ts +11 -0
- package/dist/SearchKit.d.ts +35 -0
- package/dist/SearchModal.d.ts +28 -0
- package/dist/SearchResults.d.ts +14 -0
- package/dist/ShareLink.d.ts +7 -0
- package/dist/ZeroResults.d.ts +7 -0
- package/dist/api/client.d.ts +44 -0
- package/dist/filters/FacetFilter.d.ts +10 -0
- package/dist/filters/FilterPanel.d.ts +12 -0
- package/dist/filters/RangeFilter.d.ts +11 -0
- package/dist/filters/SmartFilter.d.ts +10 -0
- package/dist/filters/index.d.ts +4 -0
- package/dist/hooks/useFilters.d.ts +10 -0
- package/dist/hooks/useKeyboardShortcut.d.ts +12 -0
- package/dist/hooks/useRecentSearches.d.ts +7 -0
- package/dist/hooks/useSearch.d.ts +22 -0
- package/dist/index.d.ts +39 -0
- package/dist/searchkit.cjs.js +3 -0
- package/dist/searchkit.esm.js +1771 -0
- package/dist/searchkit.umd.js +3 -0
- package/dist/style.css +1 -0
- package/dist/types.d.ts +250 -0
- package/package.json +71 -0
- package/scripts/bootstrap.mjs +149 -0
- package/scripts/index.mjs +364 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("react"),Me=require("react-dom");function Ee(){return typeof navigator>"u"?"Ctrl K":navigator.platform.toUpperCase().indexOf("MAC")>=0?"⌘K":"Ctrl K"}const ce=({onClick:t,placeholder:s,keyboardShortcut:r})=>{const n=a.useMemo(()=>Ee(),[]);return e.jsxs("button",{className:"mixpeek-search-button",onClick:t,type:"button","aria-label":"Open search",children:[e.jsxs("svg",{className:"mixpeek-search-button-icon",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("span",{className:"mixpeek-search-button-text",children:s}),r&&e.jsx("kbd",{className:"mixpeek-search-button-kbd",children:n})]})},de=({value:t,onChange:s,placeholder:r,isLoading:n,onClear:l})=>{const i=a.useRef(null);return a.useEffect(()=>{const c=setTimeout(()=>{var h;(h=i.current)==null||h.focus()},50);return()=>clearTimeout(c)},[]),e.jsxs("div",{className:"mixpeek-search-input-wrapper",children:[e.jsx("div",{className:"mixpeek-search-input-icon",children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}),e.jsx("input",{ref:i,type:"text",className:"mixpeek-search-input",value:t,onChange:c=>s(c.target.value),placeholder:r,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,role:"combobox","aria-expanded":"true","aria-haspopup":"listbox","aria-label":"Search"}),n&&e.jsx("div",{className:"mixpeek-search-spinner","aria-label":"Loading",children:e.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"})})}),t&&!n&&e.jsx("button",{className:"mixpeek-search-clear",onClick:l,"aria-label":"Clear search",type:"button",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})},ue=({data:t,onCitationClick:s})=>t.answer?e.jsxs("div",{className:"mixpeek-ai-answer",role:"region","aria-label":"AI Answer",children:[e.jsxs("div",{className:"mixpeek-ai-answer-header",children:[e.jsx("div",{className:"mixpeek-ai-answer-icon",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12 2L2 7l10 5 10-5-10-5z"}),e.jsx("path",{d:"M2 17l10 5 10-5"}),e.jsx("path",{d:"M2 12l10 5 10-5"})]})}),e.jsx("span",{className:"mixpeek-ai-answer-label",children:"AI Answer"}),t.isStreaming&&e.jsx("span",{className:"mixpeek-ai-answer-streaming",children:"Generating..."})]}),e.jsx("div",{className:"mixpeek-ai-answer-text",children:t.answer}),t.citations&&t.citations.length>0&&e.jsxs("div",{className:"mixpeek-ai-answer-citations",children:[e.jsx("span",{className:"mixpeek-ai-answer-citations-label",children:"Sources:"}),t.citations.map((r,n)=>e.jsxs("button",{className:"mixpeek-ai-answer-citation",onClick:()=>s==null?void 0:s(r.resultIndex),type:"button",title:r.text,children:[e.jsx("span",{className:"mixpeek-citation-index",children:r.resultIndex+1}),e.jsx("span",{className:"mixpeek-citation-text",children:r.text})]},n))]})]}):null;function ae(t,s){if(!s.trim()||!t)return t;const r=s.trim().split(/\s+/).filter(i=>i.length>2).map(i=>i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"));if(r.length===0)return t;const n=new RegExp(`(${r.join("|")})`,"gi");return t.split(n).map((i,c)=>n.test(i)?e.jsx("mark",{className:"mixpeek-highlight",children:i},c):i)}function Ae(t){if(t.title)return t.title;if(t.page_url)try{const s=new URL(t.page_url);return s.pathname==="/"?s.hostname:s.pathname.split("/").pop()||s.hostname}catch{return t.page_url}return t.content?t.content.slice(0,80):"Untitled"}function Te(t){if(t.content)return t.content;for(const s of["description","snippet","summary","text","body"])if(typeof t[s]=="string"&&t[s])return t[s];return""}function $e(t){return t>=0&&t<=1?`${Math.round(t*100)}%`:t.toFixed(1)}function Re(t){return typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):t==null?"":JSON.stringify(t)}const Ke=new Set(["id","title","content","page_url","image_url","score","document_id","collection_id","namespace_id"]),me=({result:t,index:s,query:r,onResultClick:n})=>{const[l,i]=a.useState(!1),[c,h]=a.useState(!1),o=Ae(t),u=Te(t),d=u.length>200?u.slice(0,200)+"...":u,m=t.document_id||t.id||null,g=a.useMemo(()=>{const f=[];for(const[k,y]of Object.entries(t)){if(Ke.has(k)||k.startsWith("_")||k.startsWith("__")||y==null)continue;const v=Re(y);v&&f.push([k,v])}return f},[t]),_=a.useCallback(f=>{n==null||n(t,s),t.page_url&&n&&f.preventDefault()},[t,s,n]),w=a.useCallback(f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),n==null||n(t,s),t.page_url&&!n&&window.open(t.page_url,"_blank","noopener,noreferrer"))},[t,s,n]),$=a.useCallback(f=>{f.stopPropagation(),f.preventDefault();const k=`${o}${t.page_url?`
|
|
2
|
+
`+t.page_url:""}`;navigator.clipboard.writeText(k).then(()=>{i(!0),setTimeout(()=>i(!1),2e3)}).catch(()=>{})},[o,t.page_url]),L=a.useCallback(f=>{f.stopPropagation(),f.preventDefault(),h(k=>!k)},[]),R=t.page_url?"a":"div",M=t.page_url?{href:t.page_url,target:"_blank",rel:"noopener noreferrer"}:{};return e.jsxs(R,{className:"mixpeek-result-card",onClick:_,onKeyDown:w,tabIndex:0,...M,role:"option","aria-selected":!1,"data-index":s,children:[t.image_url&&e.jsx("div",{className:"mixpeek-result-thumbnail",children:e.jsx("img",{src:t.image_url,alt:"",loading:"lazy",onError:f=>{f.target.style.display="none"}})}),e.jsxs("div",{className:"mixpeek-result-body",children:[e.jsxs("div",{className:"mixpeek-result-header",children:[e.jsx("div",{className:"mixpeek-result-title",children:ae(o,r)}),typeof t.score=="number"&&e.jsx("span",{className:"mixpeek-result-score",children:$e(t.score)})]}),t.page_url&&e.jsx("div",{className:"mixpeek-result-url",children:t.page_url}),d&&e.jsx("div",{className:"mixpeek-result-content",children:ae(d,r)}),e.jsxs("div",{className:"mixpeek-result-footer",children:[m&&e.jsx("span",{className:"mixpeek-result-ref",title:m,children:m}),g.length>0&&e.jsxs("button",{className:"mixpeek-meta-toggle",onClick:L,type:"button","aria-expanded":c,"aria-label":c?"Hide details":"Show details",children:[e.jsx("svg",{className:`mixpeek-meta-chevron ${c?"mixpeek-meta-chevron-open":""}`,width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"9 18 15 12 9 6"})}),"Details"]})]}),c&&g.length>0&&e.jsx("div",{className:"mixpeek-result-metadata",children:g.map(([f,k])=>e.jsxs("div",{className:"mixpeek-meta-row",children:[e.jsx("span",{className:"mixpeek-meta-key",children:f}),e.jsx("span",{className:"mixpeek-meta-value",children:k})]},f))})]}),e.jsx("div",{className:"mixpeek-result-actions",children:e.jsx("button",{className:"mixpeek-result-copy",onClick:$,"aria-label":"Copy link",title:"Copy link",type:"button",children:l?e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}):e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),e.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})})]})},De={feature_search:"Search",attribute_filter:"Filter",sort_attribute:"Sort",llm_filter:"LLM Filter",rerank:"Rerank",llm_enrich:"Enrich",mmr:"Diversify",group_by:"Group",limit:"Limit",json_transform:"Transform",agent_search:"Agent",rag_prepare:"RAG",reduce:"Reduce"};function ee(t){return De[t]||t.replace(/_/g," ").replace(/\b\w/g,s=>s.toUpperCase())}function Fe(t){return t<1e3?`${Math.round(t)}ms`:`${(t/1e3).toFixed(1)}s`}const Be=({stages:t,isStreaming:s})=>t.length===0?null:e.jsxs("div",{className:"mixpeek-pipeline",role:"status","aria-label":"Pipeline progress",children:[t.map((r,n)=>{var l;return e.jsxs(a.Fragment,{children:[n>0&&e.jsx("div",{className:"mixpeek-pipeline-connector"}),e.jsxs("div",{className:"mixpeek-pipeline-stage","data-status":r.status,title:(l=r.statistics)!=null&&l.duration_ms?`${ee(r.name)}: ${r.documents.length} results in ${Fe(r.statistics.duration_ms)}`:ee(r.name),children:[e.jsxs("div",{className:"mixpeek-pipeline-dot",children:[r.status==="complete"&&e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),r.status==="error"&&e.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})]}),e.jsx("span",{className:"mixpeek-pipeline-label",children:ee(r.name)}),r.status==="complete"&&e.jsx("span",{className:"mixpeek-pipeline-count",children:r.documents.length})]})]},r.index)}),s&&e.jsx("div",{className:"mixpeek-pipeline-connector mixpeek-pipeline-connector-active"})]}),he=({results:t,stages:s,isStreaming:r,query:n,isLoading:l,onResultClick:i,renderResult:c})=>{const h=a.useRef(null),o=a.useCallback(d=>{if(!h.current)return;const m=h.current.querySelectorAll(".mixpeek-result-card");m[d]&&m[d].scrollIntoView({behavior:"smooth",block:"nearest"})},[]);a.useImperativeHandle(a.createRef(),()=>({scrollToResult:o}),[o]);const u=s.length>0;return l&&t.length===0&&s.length===0?e.jsx("div",{className:"mixpeek-results-loading",children:e.jsx("div",{className:"mixpeek-results-skeleton",children:Array.from({length:3}).map((d,m)=>e.jsxs("div",{className:"mixpeek-skeleton-card",children:[e.jsx("div",{className:"mixpeek-skeleton-line mixpeek-skeleton-title"}),e.jsx("div",{className:"mixpeek-skeleton-line mixpeek-skeleton-url"}),e.jsx("div",{className:"mixpeek-skeleton-line mixpeek-skeleton-content"}),e.jsx("div",{className:"mixpeek-skeleton-line mixpeek-skeleton-content-short"})]},m))})}):t.length===0&&!u?null:e.jsxs("div",{ref:h,children:[u&&e.jsx(Be,{stages:s,isStreaming:r}),t.length>0&&e.jsx("div",{className:"mixpeek-results-list",role:"listbox","aria-label":"Search results",children:t.map((d,m)=>c?e.jsx("div",{className:"mixpeek-result-custom",role:"option",children:c(d,m)},d.id||m):e.jsx(me,{result:d,index:m,query:n,onResultClick:i},d.id||m))}),r&&t.length===0&&e.jsx("div",{className:"mixpeek-results-loading",children:e.jsx("div",{className:"mixpeek-results-skeleton",children:Array.from({length:2}).map((d,m)=>e.jsxs("div",{className:"mixpeek-skeleton-card",children:[e.jsx("div",{className:"mixpeek-skeleton-line mixpeek-skeleton-title"}),e.jsx("div",{className:"mixpeek-skeleton-line mixpeek-skeleton-content"}),e.jsx("div",{className:"mixpeek-skeleton-line mixpeek-skeleton-content-short"})]},m))})})]})},pe=({query:t})=>e.jsxs("div",{className:"mixpeek-zero-results",role:"status",children:[e.jsx("div",{className:"mixpeek-zero-results-icon",children:e.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),e.jsx("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})}),e.jsx("div",{className:"mixpeek-zero-results-title",children:"No results found"}),e.jsxs("div",{className:"mixpeek-zero-results-text",children:["No results for “",e.jsx("strong",{children:t}),"”. Try different keywords or check for typos."]})]}),xe=({theme:t})=>e.jsxs("a",{className:`mixpeek-powered-by${t?` mixpeek-powered-by--${t}`:""}`,href:"https://mxp.co/searchkit",target:"_blank",rel:"noopener noreferrer","aria-label":"Search powered by Mixpeek",children:[e.jsx("span",{className:"mixpeek-powered-by__text",children:"Search by"}),e.jsxs("svg",{className:"mixpeek-powered-by__logo",width:"14",height:"14",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[e.jsx("rect",{width:"32",height:"32",rx:"6",fill:"currentColor",fillOpacity:"0.15"}),e.jsx("path",{d:"M8 22V10l5 6 5-6v12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M22 10v12",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})]}),e.jsx("span",{className:"mixpeek-powered-by__wordmark",children:"Mixpeek"})]}),fe=({query:t})=>{const[s,r]=a.useState(!1),n=a.useCallback(()=>{if(!t.trim())return;const l=new URL(window.location.href);l.searchParams.set("mixpeek_q",t),navigator.clipboard.writeText(l.toString()).then(()=>{r(!0),setTimeout(()=>r(!1),2500)})},[t]);return t.trim()?e.jsx("button",{className:"mixpeek-share-link",onClick:n,type:"button","aria-label":"Copy shareable link",title:"Copy shareable search link",children:s?e.jsxs(e.Fragment,{children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),e.jsx("span",{children:"Copied!"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),e.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),e.jsx("span",{children:"Share"})]})}):null},ke=({config:t})=>e.jsxs("div",{className:"mixpeek-intent-cta",role:"banner",children:[e.jsx("div",{className:"mixpeek-intent-cta-message",children:t.message}),e.jsx("a",{className:"mixpeek-intent-cta-button",href:t.buttonUrl,target:"_blank",rel:"noopener noreferrer",children:t.buttonText})]}),je=({isOpen:t,onClose:s,query:r,onQueryChange:n,results:l,stages:i,isStreaming:c,isLoading:h,error:o,aiAnswer:u,metadata:d,placeholder:m,showPoweredBy:g,enableShareLinks:_,enableAIAnswer:w,recentSearches:$,onClearRecent:L,onResultClick:R,renderResult:M,ctaConfig:f,theme:k="light"})=>{const y=a.useRef(null),v=a.useRef(null);a.useEffect(()=>{if(!t)return;const j=x=>{if(x.key==="Escape"){x.preventDefault(),s();return}if(x.key==="Tab"&&y.current){const A=y.current.querySelectorAll('input, button, a[href], [tabindex]:not([tabindex="-1"])');if(A.length===0)return;const U=A[0],W=A[A.length-1];x.shiftKey&&document.activeElement===U?(x.preventDefault(),W.focus()):!x.shiftKey&&document.activeElement===W&&(x.preventDefault(),U.focus())}};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[t,s]),a.useEffect(()=>{if(t){const j=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=j}}},[t]);const B=a.useCallback(j=>{j.target===v.current&&s()},[s]),I=a.useCallback(()=>{n("")},[n]),N=a.useCallback(j=>{n(j)},[n]),K=a.useCallback(j=>{var A;const x=(A=y.current)==null?void 0:A.querySelector(`[data-index="${j}"]`);x&&(x.scrollIntoView({behavior:"smooth",block:"nearest"}),x.classList.add("mixpeek-result-highlighted"),setTimeout(()=>{x.classList.remove("mixpeek-result-highlighted")},1500))},[]),S=!r&&$.length>0,D=!r&&$.length===0,F=r.trim()&&!h&&!c&&l.length===0&&!o,E=l.length>0||i.length>0,b=w&&u&&u.answer,p=f||(d==null?void 0:d.cta);if(!t)return null;const T=e.jsx("div",{ref:v,className:`mixpeek-search mixpeek-theme-${k} mixpeek-modal-backdrop`,onClick:B,role:"dialog","aria-modal":"true","aria-label":"Search",children:e.jsxs("div",{ref:y,className:"mixpeek-modal",children:[e.jsx("div",{className:"mixpeek-modal-header",children:e.jsx(de,{value:r,onChange:n,placeholder:m,isLoading:h,onClear:I})}),e.jsxs("div",{className:"mixpeek-modal-body",children:[o&&e.jsxs("div",{className:"mixpeek-error",role:"alert",children:[e.jsx("div",{className:"mixpeek-error-icon",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]})}),e.jsx("span",{children:o})]}),D&&e.jsxs("div",{className:"mixpeek-empty-state",children:[e.jsx("div",{className:"mixpeek-empty-state-icon",children:e.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}),e.jsxs("div",{className:"mixpeek-empty-state-text",children:["Type to search or press"," ",e.jsx("kbd",{className:"mixpeek-empty-state-kbd",children:"Esc"})," to close"]})]}),S&&e.jsxs("div",{className:"mixpeek-recent-searches",children:[e.jsxs("div",{className:"mixpeek-recent-header",children:[e.jsx("span",{className:"mixpeek-recent-title",children:"Recent searches"}),e.jsx("button",{className:"mixpeek-recent-clear",onClick:L,type:"button",children:"Clear"})]}),e.jsx("div",{className:"mixpeek-recent-list",children:$.map((j,x)=>e.jsxs("button",{className:"mixpeek-recent-item",onClick:()=>N(j),type:"button",children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),e.jsx("span",{children:j})]},x))})]}),b&&e.jsx(ue,{data:u,onCitationClick:K}),E&&e.jsx(he,{results:l,stages:i,isStreaming:c,query:r,isLoading:h,onResultClick:R,renderResult:M}),F&&e.jsx(pe,{query:r}),p&&e.jsx(ke,{config:p})]}),e.jsxs("div",{className:"mixpeek-modal-footer",children:[e.jsx("div",{className:"mixpeek-modal-footer-left",children:_&&e.jsx(fe,{query:r})}),e.jsxs("div",{className:"mixpeek-modal-footer-right",children:[e.jsxs("div",{className:"mixpeek-modal-footer-hints",children:[e.jsx("kbd",{className:"mixpeek-kbd-hint",children:"Esc"}),e.jsx("span",{children:"to close"})]}),g&&e.jsx(xe,{})]})]})]})});return Me.createPortal(T,document.body)},Ie="https://api.mixpeek.com";class ge{constructor(s){this.abortController=null,this.projectKey=s.projectKey,this.baseUrl=(s.baseUrl||Ie).replace(/\/+$/,""),this.retrieverSlug=s.retrieverSlug,this.bearerToken=s.bearerToken}isApiKey(){return this.projectKey.startsWith("ret_sk_")}getHeaders(){const s={"Content-Type":"application/json"};return this.bearerToken?s.Authorization=`Bearer ${this.bearerToken}`:this.isApiKey()&&(s["X-Public-API-Key"]=this.projectKey),s}getEndpoint(){return this.bearerToken?`${this.baseUrl}/v1/retrievers/${encodeURIComponent(this.projectKey)}/execute`:this.isApiKey()?this.retrieverSlug?`${this.baseUrl}/v1/public/retrievers/${encodeURIComponent(this.retrieverSlug)}/execute`:`${this.baseUrl}/v1/public/retrievers/execute`:`${this.baseUrl}/v1/public/retrievers/${encodeURIComponent(this.projectKey)}/execute`}cancel(){this.abortController&&(this.abortController.abort(),this.abortController=null)}async search(s){this.cancel(),this.abortController=new AbortController;const r={inputs:{query:s.query,...s.inputs},settings:{limit:s.limit||10}};s.stream&&(r.stream=!0);const n=await fetch(this.getEndpoint(),{method:"POST",headers:this.getHeaders(),body:JSON.stringify(r),signal:this.abortController.signal});if(!n.ok){const c=await n.text();let h=`Search request failed (${n.status})`;try{const o=JSON.parse(c);o.detail&&(h=typeof o.detail=="string"?o.detail:JSON.stringify(o.detail))}catch{}throw new Error(h)}const l=await n.json();return{results:l.results||l.documents||[],ai_answer:l.ai_answer||null,metadata:l.metadata||null}}async*searchStream(s){this.cancel(),this.abortController=new AbortController;const r={inputs:{query:s.query,...s.inputs},settings:{limit:s.limit||10},stream:!0},n=await fetch(this.getEndpoint(),{method:"POST",headers:{...this.getHeaders(),Accept:"text/event-stream"},body:JSON.stringify(r),signal:this.abortController.signal});if(!n.ok)throw new Error(`Search request failed (${n.status})`);if(!n.body)throw new Error("Streaming not supported");const l=n.body.getReader(),i=new TextDecoder;let c="";try{for(;;){const{done:h,value:o}=await l.read();if(h)break;c+=i.decode(o,{stream:!0});const u=c.split(`
|
|
3
|
+
`);c=u.pop()||"";for(const d of u){const m=d.trim();if(!m||!m.startsWith("data: "))continue;const g=m.slice(6);if(g==="[DONE]")return;try{const _=JSON.parse(g);_.event_type&&(yield _)}catch{}}}}finally{l.releaseLock()}}}const G=new Map,Oe=5*60*1e3;function We(t,s,r,n){const l=n&&Object.keys(n).length>0?`:${JSON.stringify(n)}`:"";return`${t}:${s}:${r}${l}`}function Ue(){const t=Date.now();for(const[s,r]of G.entries())t-r.timestamp>Oe&&G.delete(s)}function ye(t){const{config:s,filterInputs:r,onSearch:n,onSearchExecuted:l,onZeroResults:i,transformResults:c}=t,[h,o]=a.useState([]),[u,d]=a.useState([]),[m,g]=a.useState(!1),[_,w]=a.useState(!1),[$,L]=a.useState(null),[R,M]=a.useState(null),[f,k]=a.useState(null),y=a.useRef(null),v=a.useRef(null);a.useEffect(()=>(y.current=new ge({projectKey:s.projectKey,baseUrl:s.apiBaseUrl,retrieverSlug:s.retrieverSlug,bearerToken:s.bearerToken}),()=>{var N;(N=y.current)==null||N.cancel()}),[s.projectKey,s.apiBaseUrl,s.retrieverSlug,s.bearerToken]);const B=a.useCallback(async N=>{const K=y.current;if(!K)return;const S=N.trim();if(!S){o([]),d([]),L(null),M(null),k(null),g(!1),w(!1);return}const D=We(s.projectKey,S,s.maxResults,r);Ue();const F=G.get(D);if(F){const E=c?c(F.results):F.results;o(E),M(F.aiAnswer),k(F.metadata),d([]),L(null),g(!1),w(!1);return}g(!0),w(!0),L(null),d([]),o([]),M(null);try{n==null||n(S);let E=[];for await(const p of K.searchStream({query:S,limit:s.maxResults,inputs:r}))switch(p.event_type){case"stage_start":d(T=>{const j=[...T];return j[p.stage_index]={name:p.stage_name||`Stage ${p.stage_index}`,index:p.stage_index,status:"running",documents:[]},j});break;case"stage_complete":d(T=>{const j=[...T],x=j[p.stage_index];return j[p.stage_index]={name:(x==null?void 0:x.name)||p.stage_name||`Stage ${p.stage_index}`,index:p.stage_index,status:"complete",documents:p.documents||[],statistics:p.statistics},j}),p.documents&&o(c?c(p.documents):p.documents);break;case"stage_error":d(T=>{const j=[...T],x=j[p.stage_index];return j[p.stage_index]={name:(x==null?void 0:x.name)||p.stage_name||`Stage ${p.stage_index}`,index:p.stage_index,status:"error",documents:(x==null?void 0:x.documents)||[],error:p.error},j});break;case"execution_complete":E=p.documents||[];break;case"execution_error":L(p.error||"Execution failed"),w(!1),g(!1);return}const b=c?c(E):E;o(b),w(!1),g(!1),L(null),G.set(D,{results:E,aiAnswer:null,metadata:null,timestamp:Date.now()}),l==null||l(S),b.length===0&&(i==null||i(S))}catch(E){if(E instanceof Error&&E.name==="AbortError")return;w(!1),d([]);try{const b=await K.search({query:S,limit:s.maxResults,inputs:r}),p=b.results||[],T=c?c(p):p;o(T),M(b.ai_answer||null),k(b.metadata||null),L(null),G.set(D,{results:p,aiAnswer:b.ai_answer||null,metadata:b.metadata||null,timestamp:Date.now()}),l==null||l(S),T.length===0&&(i==null||i(S))}catch(b){if(b instanceof Error&&b.name==="AbortError")return;const p=b instanceof Error?b.message:"Search failed";L(p),o([]),M(null)}}finally{g(!1),w(!1)}},[s.projectKey,s.maxResults,s.apiBaseUrl,r,n,l,i,c]),I=a.useCallback(async N=>{var K;return v.current&&clearTimeout(v.current),(K=y.current)==null||K.cancel(),new Promise(S=>{v.current=setTimeout(async()=>{await B(N),S()},300)})},[B]);return a.useEffect(()=>()=>{v.current&&clearTimeout(v.current)},[]),{results:h,stages:u,isLoading:m,isStreaming:_,error:$,aiAnswer:R,metadata:f,search:I}}function be(t){const[s,r]=a.useState(t||{}),n=a.useCallback((o,u)=>{r(d=>{if(u==null||u===""||Array.isArray(u)&&u.length===0){const m={...d};return delete m[o],m}return{...d,[o]:u}})},[]),l=a.useCallback(o=>{r(u=>{const d={...u};return delete d[o],d})},[]),i=a.useCallback(()=>{r({})},[]),c=a.useMemo(()=>Object.keys(s).length>0,[s]),h=a.useCallback(o=>s[o],[s]);return{filterInputs:s,setFilter:n,removeFilter:l,clearFilters:i,hasActiveFilters:c,getFilter:h}}function ve(t){const{enabled:s,onTrigger:r}=t,n=a.useCallback(l=>{if(!s)return;(navigator.platform.toUpperCase().indexOf("MAC")>=0?l.metaKey:l.ctrlKey)&&l.key==="k"&&(l.preventDefault(),l.stopPropagation(),r())},[s,r]);a.useEffect(()=>{if(s)return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[s,n])}const we="mixpeek_recent_searches",Pe=10;function ze(){try{const t=localStorage.getItem(we);if(!t)return[];const s=JSON.parse(t);return Array.isArray(s)?s.filter(r=>typeof r=="object"&&r!==null&&"query"in r&&"timestamp"in r&&typeof r.query=="string"&&typeof r.timestamp=="number"):[]}catch{return[]}}function le(t){try{localStorage.setItem(we,JSON.stringify(t))}catch{}}function Ne(){const[t,s]=a.useState([]);a.useEffect(()=>{s(ze())},[]);const r=a.useCallback(l=>{const i=l.trim();i&&s(c=>{const h=c.filter(u=>u.query.toLowerCase()!==i.toLowerCase()),o=[{query:i,timestamp:Date.now()},...h].slice(0,Pe);return le(o),o})},[]),n=a.useCallback(()=>{s([]),le([])},[]);return{recentSearches:t.map(l=>l.query),addSearch:r,clearRecentSearches:n}}const se=a.createContext(null);function _e(){const t=a.useContext(se);if(!t)throw new Error("useSearchKit must be used within a SearchKit component");return t}const qe=_e,re=({projectKey:t,placeholder:s="Search...",maxResults:r=10,theme:n="auto",accentColor:l="#6366f1",position:i="modal",keyboardShortcut:c=!0,showPoweredBy:h=!0,enableShareLinks:o=!1,enableAIAnswer:u=!1,onSearch:d,onResultClick:m,onZeroResults:g,transformResults:_,renderResult:w,retrieverSlug:$,bearerToken:L,apiBaseUrl:R="https://api.mixpeek.com",className:M,defaultOpen:f=!1,ctaConfig:k,defaultFilters:y,onFilterChange:v})=>{const[B,I]=a.useState(f),[N,K]=a.useState(""),S=a.useMemo(()=>({projectKey:t,retrieverSlug:$,bearerToken:L,apiBaseUrl:R,maxResults:r,theme:n,accentColor:l,placeholder:s,showPoweredBy:h,enableShareLinks:o,enableAIAnswer:u,position:i}),[t,$,L,R,r,n,l,s,h,o,u,i]),{recentSearches:D,addSearch:F,clearRecentSearches:E}=Ne(),{filterInputs:b,setFilter:p,removeFilter:T,clearFilters:j,hasActiveFilters:x}=be(y),{results:A,stages:U,isLoading:W,isStreaming:V,error:P,aiAnswer:z,metadata:X,search:q}=ye({config:S,filterInputs:b,onSearch:d,onSearchExecuted:F,onZeroResults:g,transformResults:_});a.useEffect(()=>{N.trim()&&q(N)},[b]),a.useEffect(()=>{v==null||v(b)},[b]);const Y=a.useCallback(()=>I(!0),[]),Z=a.useCallback(()=>I(!1),[]),Q=a.useCallback(()=>I(C=>!C),[]);ve({enabled:c,onTrigger:Q});const J=a.useCallback(C=>{K(C),C.trim()&&q(C)},[q]);a.useEffect(()=>{if(typeof window>"u")return;const O=new URLSearchParams(window.location.search).get("mixpeek_q");O&&(K(O),I(!0),q(O))},[]);const H=a.useMemo(()=>n==="auto"?typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":n,[n]),ne=a.useMemo(()=>({"--mixpeek-accent":l,"--mixpeek-accent-rgb":Je(l)}),[l]),ie=a.useMemo(()=>({query:N,setQuery:J,results:A,stages:U,isLoading:W,isStreaming:V,error:P,aiAnswer:z,metadata:X,isOpen:B,open:Y,close:Z,toggle:Q,search:q,recentSearches:D,clearRecentSearches:E,config:S,filterInputs:b,setFilter:p,removeFilter:T,clearFilters:j,hasActiveFilters:x}),[N,J,A,U,W,V,P,z,X,B,Y,Z,Q,q,D,E,S,b,p,T,j,x]);return i==="inline"?e.jsx(se.Provider,{value:ie,children:e.jsx("div",{className:`mixpeek-search mixpeek-theme-${H} mixpeek-inline ${M||""}`,style:ne,"data-theme":H,children:e.jsxs("div",{className:"mixpeek-inline-container",children:[e.jsx("div",{className:"mixpeek-modal-header",children:e.jsxs("div",{className:"mixpeek-search-input-wrapper",children:[e.jsx("div",{className:"mixpeek-search-input-icon",children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}),e.jsx("input",{type:"text",className:"mixpeek-search-input",value:N,onChange:C=>J(C.target.value),placeholder:s,autoComplete:"off",autoCorrect:"off",autoCapitalize:"off",spellCheck:!1,"aria-label":"Search"}),N&&e.jsx("button",{className:"mixpeek-search-clear",onClick:()=>J(""),"aria-label":"Clear search",type:"button",children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}),e.jsxs("div",{className:"mixpeek-modal-body",children:[P&&e.jsx("div",{className:"mixpeek-error",role:"alert",children:P}),u&&z&&z.answer&&e.jsx("div",{className:"mixpeek-ai-answer",children:e.jsx("div",{className:"mixpeek-ai-answer-text",children:z.answer})}),A.length>0&&e.jsx("div",{className:"mixpeek-results-list",role:"listbox",children:A.map((C,O)=>w?e.jsx("div",{role:"option",children:w(C,O)},C.id||O):e.jsx("div",{children:e.jsx("a",{className:"mixpeek-result-card",href:C.page_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>m==null?void 0:m(C,O),role:"option",children:e.jsxs("div",{className:"mixpeek-result-body",children:[e.jsx("div",{className:"mixpeek-result-title",children:C.title||"Untitled"}),C.content&&e.jsx("div",{className:"mixpeek-result-content",children:C.content.slice(0,200)})]})})},C.id||O))}),N.trim()&&!W&&A.length===0&&!P&&e.jsxs("div",{className:"mixpeek-zero-results",children:[e.jsx("div",{className:"mixpeek-zero-results-title",children:"No results found"}),e.jsxs("div",{className:"mixpeek-zero-results-text",children:["No results for “",N,"”"]})]})]}),h&&e.jsxs("div",{className:"mixpeek-modal-footer",children:[e.jsx("div",{className:"mixpeek-modal-footer-left"}),e.jsx("div",{className:"mixpeek-modal-footer-right",children:e.jsxs("a",{className:"mixpeek-powered-by",href:"https://mxp.co/searchkit",target:"_blank",rel:"noopener noreferrer",children:[e.jsx("span",{className:"mixpeek-powered-by-text",children:"Search by"}),e.jsx("strong",{children:"Mixpeek"})]})})]})]})})}):e.jsx(se.Provider,{value:ie,children:e.jsxs("div",{className:`mixpeek-search mixpeek-theme-${H} ${M||""}`,style:ne,"data-theme":H,children:[e.jsx(ce,{onClick:Y,placeholder:s,keyboardShortcut:c}),e.jsx(je,{isOpen:B,onClose:Z,query:N,onQueryChange:J,results:A,stages:U,isStreaming:V,isLoading:W,error:P,aiAnswer:z,metadata:X,placeholder:s,showPoweredBy:h,enableShareLinks:o,enableAIAnswer:u,recentSearches:D,onClearRecent:E,onResultClick:m,renderResult:w,ctaConfig:k,theme:H})]})})};function Je(t){const s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return s?`${parseInt(s[1],16)}, ${parseInt(s[2],16)}, ${parseInt(s[3],16)}`:"99, 102, 241"}const He=re,Se=({config:t,value:s,onChange:r})=>{const{field:n,options:l,multiple:i}=t,c=o=>i&&Array.isArray(s)?s.includes(o):s===o,h=o=>{if(i){const u=Array.isArray(s)?s:[];u.includes(o)?r(n,u.filter(d=>d!==o)):r(n,[...u,o])}else r(n,s===o?null:o)};return e.jsx("div",{className:"mixpeek-facet-filter",children:l.map(o=>e.jsxs("label",{className:`mixpeek-facet-filter__option${c(o.value)?" mixpeek-facet-filter__option--active":""}`,children:[e.jsx("input",{type:"checkbox",className:"mixpeek-facet-filter__checkbox",checked:c(o.value),onChange:()=>h(o.value)}),e.jsx("span",{className:"mixpeek-facet-filter__label",children:o.label}),o.count!==void 0&&e.jsx("span",{className:"mixpeek-facet-filter__count",children:o.count})]},o.value))})},Ce=({config:t,minValue:s,maxValue:r,onChange:n})=>{const{field:l,min:i,max:c,step:h=1,unit:o=""}=t,[u,d]=a.useState(s??i),[m,g]=a.useState(r??c),_=a.useRef(null);a.useEffect(()=>{d(s??i)},[s,i]),a.useEffect(()=>{g(r??c)},[r,c]);const w=a.useCallback((k,y)=>{_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{n(`min_${l}`,k>i?k:null),n(`max_${l}`,y<c?y:null)},300)},[l,i,c,n]);a.useEffect(()=>()=>{_.current&&clearTimeout(_.current)},[]);const $=k=>{const y=Number(k.target.value),v=Math.min(y,m-h);d(v),w(v,m)},L=k=>{const y=Number(k.target.value),v=Math.max(y,u+h);g(v),w(u,v)},R=k=>`${o}${k}`,M=(u-i)/(c-i)*100,f=(m-i)/(c-i)*100;return e.jsxs("div",{className:"mixpeek-range-filter",children:[e.jsxs("div",{className:"mixpeek-range-filter__values",children:[e.jsx("span",{className:"mixpeek-range-filter__value",children:R(u)}),e.jsx("span",{className:"mixpeek-range-filter__separator",children:"–"}),e.jsx("span",{className:"mixpeek-range-filter__value",children:R(m)})]}),e.jsxs("div",{className:"mixpeek-range-filter__track",children:[e.jsx("div",{className:"mixpeek-range-filter__fill",style:{left:`${M}%`,width:`${f-M}%`}}),e.jsx("input",{type:"range",className:"mixpeek-range-filter__input mixpeek-range-filter__input--min",min:i,max:c,step:h,value:u,onChange:$,"aria-label":`Minimum ${t.label}`}),e.jsx("input",{type:"range",className:"mixpeek-range-filter__input mixpeek-range-filter__input--max",min:i,max:c,step:h,value:m,onChange:L,"aria-label":`Maximum ${t.label}`})]})]})},Le=({config:t,value:s,onChange:r})=>{const[n,l]=a.useState(s||""),i=a.useRef(null);a.useEffect(()=>{l(s||"")},[s]),a.useEffect(()=>()=>{i.current&&clearTimeout(i.current)},[]);const c=h=>{const o=h.target.value;l(o),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{r("smart_filter",o||null)},500)};return e.jsxs("div",{className:"mixpeek-smart-filter",children:[e.jsxs("div",{className:"mixpeek-smart-filter__header",children:[e.jsx("svg",{className:"mixpeek-smart-filter__icon",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("path",{d:"M12 2L9 9l-7 1 5 5-1.5 7L12 18l6.5 4L17 15l5-5-7-1z"})}),e.jsx("span",{className:"mixpeek-smart-filter__label",children:"AI Filter"})]}),e.jsx("input",{type:"text",className:"mixpeek-smart-filter__input",value:n,onChange:c,placeholder:t.placeholder||"Describe what you're looking for...","aria-label":"Smart filter"}),e.jsx("p",{className:"mixpeek-smart-filter__hint",children:"AI will interpret your description to filter results"})]})},te=({label:t,defaultOpen:s=!0,children:r})=>{const[n,l]=a.useState(s);return e.jsxs("div",{className:"mixpeek-filter-section",children:[e.jsxs("button",{className:"mixpeek-filter-section__header",onClick:()=>l(i=>!i),type:"button","aria-expanded":n,children:[e.jsx("span",{className:"mixpeek-filter-section__label",children:t}),e.jsx("svg",{className:`mixpeek-filter-section__chevron${n?" mixpeek-filter-section__chevron--open":""}`,width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"9 18 15 12 9 6"})})]}),n&&e.jsx("div",{className:"mixpeek-filter-section__body",children:r})]})},Ge=({config:t,filterInputs:s,onFilterChange:r,onClearAll:n,hasActiveFilters:l})=>e.jsxs("div",{className:"mixpeek-filter-panel",children:[e.jsxs("div",{className:"mixpeek-filter-panel__header",children:[e.jsx("span",{className:"mixpeek-filter-panel__title",children:t.title||"Filters"}),l&&n&&e.jsx("button",{className:"mixpeek-filter-panel__clear",onClick:n,type:"button",children:"Clear all"})]}),e.jsx("div",{className:"mixpeek-filter-panel__body",children:t.filters.map((i,c)=>{switch(i.type){case"facet":return e.jsx(te,{label:i.label,children:e.jsx(Se,{config:i,value:s[i.field],onChange:r})},i.field);case"range":return e.jsx(te,{label:i.label,children:e.jsx(Ce,{config:i,minValue:s[`min_${i.field}`],maxValue:s[`max_${i.field}`],onChange:r})},i.field);case"smart":return e.jsx(te,{label:i.label||"Smart Filter",children:e.jsx(Le,{config:i,value:s.smart_filter,onChange:r})},`smart-${c}`);default:return null}})})]});function oe(){if(typeof document>"u"||typeof window>"u")return;const t=document.querySelectorAll("script[data-project-key]");if(t.length===0)return;const s=window,r=s.React,n=s.ReactDOM;if(!r||!n){console.warn("[@mixpeek/react-searchkit] Auto-init requires React and ReactDOM as globals. Include React before the SearchKit script, or use the npm package instead.");return}t.forEach(l=>{var g;const i=l.getAttribute("data-project-key");if(!i)return;const c=l.getAttribute("data-theme")||"auto",h=l.getAttribute("data-placeholder")||void 0,o=l.getAttribute("data-container")||"mixpeek-search",u=l.getAttribute("data-accent-color")||void 0;let d=document.getElementById(o);d||(d=document.createElement("div"),d.id=o,(g=l.parentNode)==null||g.insertBefore(d,l));const m={projectKey:i,theme:c};h&&(m.placeholder=h),u&&(m.accentColor=u),n.createRoot&&n.createRoot(d).render(r.createElement(re,m))})}typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",oe):setTimeout(oe,0));exports.AIAnswer=ue;exports.FacetFilter=Se;exports.FilterPanel=Ge;exports.IntentCTA=ke;exports.MixpeekClient=ge;exports.MixpeekSearch=He;exports.PoweredBy=xe;exports.RangeFilter=Ce;exports.ResultCard=me;exports.SearchButton=ce;exports.SearchInput=de;exports.SearchKit=re;exports.SearchModal=je;exports.SearchResults=he;exports.ShareLink=fe;exports.SmartFilter=Le;exports.ZeroResults=pe;exports.useFilters=be;exports.useKeyboardShortcut=ve;exports.useMixpeekSearch=qe;exports.useRecentSearches=Ne;exports.useSearch=ye;exports.useSearchKit=_e;
|