@inkeep/cxkit-primitives 0.5.32 → 0.5.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),R=require("../atoms/cmdk/index.cjs"),r=require("./factory.cjs"),m=require("../utils/misc.cjs"),h=require("react"),d=require("./embedded-search/search-provider.cjs"),Te=require("./tagline-logo-icon.cjs"),_=require("../atoms/icons/custom-icon.cjs"),fe=require("@radix-ui/react-scroll-area"),Ae=require("@radix-ui/react-tabs"),P=require("../providers/config-provider.cjs"),Le=require("../providers/search-events-provider.cjs"),L=require("../atoms/link.cjs"),I=require("../providers/source-item-provider.cjs"),x=require("../atoms/icons/built-in-icon-renderer.cjs"),xe=require("../utils/highlight-emphasis.cjs"),ye=require("../hooks/use-scrolling-fades.cjs"),Ce=require("@inkeep/cxkit-color-mode"),Oe=require("../atoms/avatars/ai.cjs"),j=require("./modal/modal-provider.cjs"),k=require("../utils/compose-refs.cjs"),g=require("../utils/compose-event-handlers.cjs"),je=require("../atoms/shadow/context.cjs"),qe=require("../atoms/markdown/index.cjs");function q(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const i in e)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>e[i]})}}return t.default=e,Object.freeze(t)}const E=q(fe),w=q(Ae),p="__ask_ai__",Be=r.ikp("div",{_id:"aiSearchWrapper"}),B=e=>{const{searchSettings:{view:t}}=P.useInkeepConfig(),{isHidden:i,hasContent:s,isMobile:a}=d.useSearch(),c=j.useModal();return n.jsx(Be,{"data-hidden":m.dataAttr(i),"data-has-content":m.dataAttr(s),"data-in-modal":m.dataAttr(!!c),"data-mobile":m.dataAttr(a),"data-view":t,"data-dual-pane-search-expanded":m.dataAttr(s&&t==="dual-pane"&&!i),...e})},He=r.ikp(R.Command,{_id:"aiSearchRoot"}),H=e=>{const{isHidden:t,selectedItem:i,onSelectedItemChange:s}=d.useSearch();return n.jsx(He,{"data-hidden":m.dataAttr(t),shouldFilter:!1,loop:!1,value:i,onValueChange:s,...e})},N=r.ikp(R.Command.List,{_id:"aiSearchContent"}),M=h.forwardRef((e,t)=>{const{selectedItem:i}=d.useSearch();return n.jsx(N,{"aria-activedescendant":`aiSearchResults__Item-${i}`,...e,ref:t})}),D=r.ikp("div",{_id:"aiSearchInputGroup"}),F=r.ikp(_.CustomIcon,{_id:"aiSearchInputIcon",iconKey:"search"}),Ne=r.ikp(R.Command.Input,{_id:"aiSearchInput"}),U=h.forwardRef(({onInput:e,...t},i)=>{const{query:s,onInput:a,placeholder:c,inputRef:o,shouldAutoFocusInput:u,selectedItem:l}=d.useSearch(),S=k.useComposedRefs(i,o),v=j.useModal();return h.useEffect(()=>{requestAnimationFrame(()=>{u&&o?.current&&(o.current.focus(),o.current.selectionStart=o.current.value.length)})},[u,o,v?.isOpen]),n.jsx(Ne,{ref:S,placeholder:c,value:s,onInput:g.composeEventHandlers(e,a),"aria-activedescendant":`aiSearchResults__Item-${l}`,...t})}),Me=r.ikp(x.BuiltInIconRenderer,{_id:"aiSearchLoading",iconSettings:{builtIn:"LuLoaderCircle"}}),V=e=>{const{loading:t,resultsList:i}=d.useSearch();return!t||i.length===0?null:n.jsx(Me,{...e})},De=r.ikp(R.Command.Item,{_id:"aiAskAITrigger",value:p}),K=e=>{const{setSelectedItem:t,results:i,tab:s}=d.useSearch(),a=i[s]?.[0]?.id??"NONE";return n.jsx(De,{...e,id:`aiSearchResults__Item-${p}`,tabIndex:0,onPointerLeave:()=>t(a)})},Fe=r.ikp("img",{_id:"aiAskAITrigger__Icon"}),G=e=>{const{aiChatSettings:t}=P.useInkeepConfig(),{aiAssistantAvatar:i}=t??{},s=typeof i=="string"?i:i?.light,a=(typeof i=="string"?i:i?.dark)??s,c=Ce.useColorModeValue(s,a),[o,u]=h.useState(c);h.useEffect(()=>{u(c)},[c]);const l=()=>{u(null)};return n.jsx(Fe,{asChild:!0,...e,children:o?n.jsx("img",{src:o,alt:"AI Avatar","data-type":"image",onError:g.composeEventHandlers(l),...e}):n.jsx(Oe.default,{"data-type":"icon",...e})})},W=r.ikp("span",{_id:"aiAskAITrigger__Label"}),$=r.ikp(_.CustomIcon,{_id:"aiAskAITrigger__Indicator",iconKey:"openLinkInSameTab"}),Ue=r.ikp(w.Root,{_id:"aiSearchResults"}),Q=e=>{const{tab:t,onTabChange:i,hasContent:s}=d.useSearch();return n.jsx(Ue,{value:t,onValueChange:i,"data-has-content":m.dataAttr(s),...e})},Ve=r.ikp("div",{_id:"aiSearchResults__Loading"}),z=e=>{const{loading:t,resultsList:i}=d.useSearch();return!t||i.length>0?null:n.jsx(Ve,{...e})},Ke=r.ikp(R.Command.Empty,{_id:"aiSearchResults__Empty"}),J=e=>{const{query:t,loading:i,results:s,tab:a}=d.useSearch(),c=s[a]?.length;return i||!t||c?null:n.jsx(Ke,{children:"No results found.",...e})},Ge=r.ikp(w.List,{_id:"aiSearchResults__TabList"}),X=e=>{const{children:t,...i}=e,{searchSettings:{tabs:s}}=P.useInkeepConfig(),{results:a,loading:c,resultsList:o}=d.useSearch();if(c&&o.length===0)return null;const u=Object.keys(a);return!s.length||!u.length?null:n.jsx(Ge,{tabIndex:-1,children:m.maybeRender(t,u),...i})},We=r.ikp(w.Trigger,{_id:"aiSearchResults__Tab"}),Y=h.forwardRef((e,t)=>{const i=h.useRef(null),s=k.useComposedRefs(t,i),{tab:a,onClick:c,...o}=e,{results:u,tab:l,inputRef:S}=d.useSearch(),v=u[a].length,b=a===l,T=()=>{S.current?.focus()},f=je.useShadow();return h.useEffect(()=>{b&&f?.shadowHost?.shadowRoot?.activeElement?.hasAttribute("ikp-tab")&&i.current?.focus()},[b]),n.jsx(We,{ref:s,"ikp-tab":"",tabIndex:b?0:-1,value:a,children:`${a} (${v})`,onClick:g.composeEventHandlers(c,T),...o})}),Z=r.ikp("div",{_id:"aiSearchResults__Content"}),$e=r.ikp(E.Root,{_id:"aiSearchResults__ScrollArea"}),ee=e=>{const{loading:t,resultsList:i}=d.useSearch();return t&&i.length===0?null:n.jsx($e,{tabIndex:-1,...e})},Qe=r.ikp(E.Viewport,{_id:"aiSearchResults__ScrollAreaViewport"}),te=h.forwardRef(({children:e,...t},i)=>{const s=ye.useScrollingFades(),a=k.useComposedRefs(i,s),{tab:c}=d.useSearch();return h.useEffect(()=>{c&&s.current?.scrollTo({top:0,behavior:"auto"})},[c]),n.jsx(Qe,{ref:a,tabIndex:-1,children:n.jsx("div",{tabIndex:-1,style:{display:"grid"},children:e}),...t})}),ze=r.ikp(E.ScrollAreaScrollbar,{_id:"aiSearchResults__ScrollAreaScrollbar"}),Je=r.ikp(E.ScrollAreaThumb,{_id:"aiSearchResults__ScrollAreaThumb"}),Xe=r.ikp(E.Corner,{_id:"aiSearchResults__ScrollAreaCorner"}),Ye=r.ikp(w.Content,{_id:"aiSearchResults__List"}),ie=e=>{const{children:t,...i}=e,{results:s,tab:a}=d.useSearch(),c=s[a]??[];return n.jsx(Ye,{value:a,"data-has-results":m.dataAttr(c.length>0),"aria-label":"Search results",children:m.maybeRender(t,c),tabIndex:-1,...i})},Ze=r.ikp(R.Command.Item,{_id:"aiSearchResults__Item",asChild:!0}),re=h.forwardRef(({item:e,onClick:t,onSelect:i,children:s,...a},c)=>{const{searchSettings:{shouldOpenLinksInNewTab:o}}=P.useInkeepConfig(),{logEvent:u}=Le.useSearchEvents(),{query:l,transitionsDisabled:S,selectedItem:v}=d.useSearch(),b=h.useRef(null),T=k.useComposedRefs(c,b),f=()=>{b.current?.click()},C=()=>{u({eventName:"search_result_clicked",properties:{searchQuery:l,title:e.title,url:e.url}})},A=e.shouldOpenInNewTab!==void 0?e.shouldOpenInNewTab:o,O=v===e.id,we=O||(v==="NONE"||v===p);return n.jsx(I.SourceItemProvider,{source:{...e,isExternal:A},children:n.jsx(Ze,{ref:T,value:e.id,"data-type":e.type,"data-breadcrumbs":!!e.breadcrumbs?.length,"data-disable-transitions":m.dataAttr(S),onSelect:g.composeEventHandlers(i,f),onClick:g.composeEventHandlers(t,C),"data-selected":m.dataAttr(O),tabIndex:we?0:-1,...a,children:n.jsx(L.LinkWithQueryParams,{href:e.url,isExternal:A,appendToUrl:e.appendToUrl,children:s,id:`aiSearchResults__Item-${e.id}`})})})}),et=r.ikp("div",{_id:"aiSearchResults__ItemBreadcrumbs"}),y=e=>{const{source:t}=I.useSourceItem(),{tab:i}=d.useSearch();if(!t.breadcrumbs?.length)return null;const{children:s,...a}=e,o=t.tabs?.find(u=>typeof u!="string"&&u[0]===i)?.[1]?.breadcrumbs??t.breadcrumbs??[];return n.jsx(et,{"aria-hidden":"true",children:m.maybeRender(s,o),...a})},se=r.ikp(_.CustomIcon,{_id:"aiSearchResults__ItemBreadcrumbIcon",iconKey:"breadcrumbSeparator"}),tt=r.ikp(x.BuiltInIconRenderer,{_id:"aiSearchResults__ItemIcon"}),ne=e=>{const{source:t}=I.useSourceItem();return n.jsx(tt,{iconSettings:t.icon,"data-type":t.type,...e})},it=r.ikp("span",{_id:"aiSearchResults__ItemTitle"}),ae=e=>{const{source:t}=I.useSourceItem();return n.jsx(it,{"data-type":t.type,children:t.title,...e})},rt=r.ikp("span",{_id:"aiSearchResults__ItemTag"}),ce=e=>{const{source:t}=I.useSourceItem();return n.jsx(rt,{"data-type":t.type,children:t.tag,...e})},st=r.ikp("span",{_id:"aiSearchResults__ItemDescription"}),de=e=>{const{source:t}=I.useSourceItem(),{children:i,...s}=e,a=h.useMemo(()=>t.description?xe.highlightEmphasis(t.description):[],[t.description]);return a.length?n.jsx(st,{"data-type":t.type,"aria-hidden":"true",children:m.maybeRender(i,a),...s}):null},nt=r.ikp("span",{_id:"aiSearchResults__ItemDescriptionPart"}),oe=e=>{const{part:t,...i}=e,{source:s}=I.useSourceItem();return typeof t=="string"?t:n.jsx(nt,{"data-type":s.type,children:t.content,"data-highlighted":m.dataAttr(t.highlighted),...i})},at=r.ikp(_.CustomIcon,{_id:"aiSearchResults__ItemIndicator"}),ue=e=>{const{source:t}=I.useSourceItem();return n.jsx(at,{iconKey:t.isExternal?"openLinkInNewTab":"openLinkInSameTab",...e})},ct=r.ikp("div",{_id:"aiSearchResults__ItemPreview","aria-hidden":!0}),le=e=>{const{searchSettings:{view:t,shouldOpenLinksInNewTab:i}}=P.useInkeepConfig(),{results:s,tab:a,selectedItem:c}=d.useSearch(),o=s[a]??[],u=h.useRef(null),l=h.useMemo(()=>{if(c===p)return u.current;const v=o.find(b=>b.id===c);return u.current=v??null,v},[c]);if(t!=="dual-pane"||c===p||!l)return null;const S=l.shouldOpenInNewTab!==void 0?l.shouldOpenInNewTab:i;return n.jsx(I.SourceItemProvider,{source:{...l,isExternal:S},children:n.jsx(ct,{...e})})},dt=r.ikp("div",{_id:"aiSearchResults__ItemPreview__Header"}),ot=r.ikp(L.LinkWithQueryParams,{_id:"aiSearchResults__ItemPreview__Heading"}),me=e=>{const{source:t}=I.useSourceItem();return n.jsx(ot,{href:t.url,isExternal:t.isExternal,appendToUrl:t.appendToUrl,"data-type":t.type,...e})},ut=r.ikp("span",{_id:"aiSearchResults__ItemPreview__Title"}),he=e=>{const{source:t}=I.useSourceItem();return n.jsx(ut,{children:t.title,...e})},lt=r.ikp(_.CustomIcon,{_id:"aiSearchResults__ItemPreview__Title__LinkIcon",iconKey:"openLinkInNewTab"}),Ie=e=>{const{source:t}=I.useSourceItem();return n.jsx(lt,{iconKey:t.isExternal?"openLinkInNewTab":"openLinkInSameTab",...e})},mt=r.ikp(y,{_id:"aiSearchResults__ItemPreview__Breadcrumbs"}),ve=r.ikp(se,{_id:"aiSearchResults__ItemPreview__BreadcrumbIcon"}),ht=r.ikp(qe.Markdown,{_id:"aiSearchResults__ItemPreview__Body"}),Se=e=>{const{source:t}=I.useSourceItem(),{resultsList:i}=d.useSearch(),s=i.find(c=>c.id===t.id),{searchSettings:{shouldOpenLinksInNewTab:a}}=P.useInkeepConfig();return s?n.jsx(ht,{shouldOpenLinksInNewTab:a,children:s.preview,...e}):null},It=r.ikp("div",{_id:"aiSearchResults__ItemPreview__Outline"}),be=e=>{const{source:t}=I.useSourceItem(),{resultsList:i}=d.useSearch();return i.find(c=>c.id===t.id)?.rootRecord.topLevelHeadings?.length?n.jsx(It,{...e}):null},Pe=r.ikp("span",{_id:"aiSearchResults__ItemPreview__Outline__Title",children:"On this page"}),vt=r.ikp("ul",{_id:"aiSearchResults__ItemPreview__Outline__List"}),pe=e=>{const{source:t}=I.useSourceItem(),{resultsList:i}=d.useSearch(),s=i.find(l=>l.id===t.id),a=s?.rootRecord.topLevelHeadings;if(!a?.length)return null;const c=a.map(l=>{const S=l?.anchor&&l?.anchor===s?.content?.anchor,v=l?.anchor===s?.pathHeadings?.[0]?.anchor;return{...l,isMatch:S||v}}),{children:o,...u}=e;return n.jsx(vt,{children:m.maybeRender(o,c),...u})},St=r.ikp(L.LinkWithQueryParams,{_id:"aiSearchResults__ItemPreview__Outline__Item"}),Re=e=>{const{searchSettings:{shouldOpenLinksInNewTab:t}}=P.useInkeepConfig();return n.jsx(St,{isExternal:t,...e})},_e=r.ikp(_.CustomIcon,{_id:"aiSearchResults__ItemPreview__Outline__ItemIcon",iconKey:"newLine"}),bt=r.ikp("span",{_id:"aiSearchResults__ItemPreview__Outline__ItemText"}),ge=e=>n.jsx(bt,{...e}),Ee=r.ikp(x.BuiltInIconRenderer,{_id:"aiSearchResults__ItemPreview__Outline__ItemLinkIcon",iconSettings:{builtIn:"LuLink"}}),Pt=r.ikp("div",{_id:"aiSearchFooter"}),ke=e=>{const{hasContent:t}=d.useSearch();return n.jsx(Pt,{"data-has-results":m.dataAttr(t),...e})},pt=r.ikp("div",{_id:"aiSearchTagline__Container"}),Rt=r.ikp("span",{_id:"aiSearchTagline__Text",children:"Powered by"}),_t=r.ikp(Te.default,{_id:"aiSearchTagline__Logo"}),gt=r.ikp("a",{_id:"aiSearchTagline__BrandName",children:"inkeep",href:"https://www.inkeep.com/",target:"_blank",rel:"noopener noreferrer"});exports.Provider=d.SearchProvider;exports.ASK_AI_TRIGGER_VALUE=p;exports.AskAITrigger=K;exports.AskAITriggerIcon=G;exports.AskAITriggerIndicator=$;exports.AskAITriggerLabel=W;exports.Content=M;exports.EmbeddedSearchInputIcon=F;exports.EmbeddedSearchPrimitiveAskAITrigger=K;exports.EmbeddedSearchPrimitiveAskAITriggerIcon=G;exports.EmbeddedSearchPrimitiveAskAITriggerIndicator=$;exports.EmbeddedSearchPrimitiveAskAITriggerLabel=W;exports.EmbeddedSearchPrimitiveContent=M;exports.EmbeddedSearchPrimitiveFooter=ke;exports.EmbeddedSearchPrimitiveInput=U;exports.EmbeddedSearchPrimitiveInputGroup=D;exports.EmbeddedSearchPrimitiveLoading=V;exports.EmbeddedSearchPrimitiveResults=Q;exports.EmbeddedSearchPrimitiveResultsContent=Z;exports.EmbeddedSearchPrimitiveResultsEmpty=J;exports.EmbeddedSearchPrimitiveResultsItem=re;exports.EmbeddedSearchPrimitiveResultsItemBreadcrumbs=y;exports.EmbeddedSearchPrimitiveResultsItemDescription=de;exports.EmbeddedSearchPrimitiveResultsItemDescriptionPart=oe;exports.EmbeddedSearchPrimitiveResultsItemIcon=ne;exports.EmbeddedSearchPrimitiveResultsItemIndicator=ue;exports.EmbeddedSearchPrimitiveResultsItemPreview=le;exports.EmbeddedSearchPrimitiveResultsItemPreviewBody=Se;exports.EmbeddedSearchPrimitiveResultsItemPreviewBreadcrumbIcon=ve;exports.EmbeddedSearchPrimitiveResultsItemPreviewHeading=me;exports.EmbeddedSearchPrimitiveResultsItemPreviewOutline=be;exports.EmbeddedSearchPrimitiveResultsItemPreviewOutlineItem=Re;exports.EmbeddedSearchPrimitiveResultsItemPreviewOutlineItemIcon=_e;exports.EmbeddedSearchPrimitiveResultsItemPreviewOutlineItemLinkIcon=Ee;exports.EmbeddedSearchPrimitiveResultsItemPreviewOutlineItemText=ge;exports.EmbeddedSearchPrimitiveResultsItemPreviewOutlineList=pe;exports.EmbeddedSearchPrimitiveResultsItemPreviewOutlineTitle=Pe;exports.EmbeddedSearchPrimitiveResultsItemPreviewTitle=he;exports.EmbeddedSearchPrimitiveResultsItemPreviewTitleLinkIcon=Ie;exports.EmbeddedSearchPrimitiveResultsItemTag=ce;exports.EmbeddedSearchPrimitiveResultsItemTitle=ae;exports.EmbeddedSearchPrimitiveResultsList=ie;exports.EmbeddedSearchPrimitiveResultsLoading=z;exports.EmbeddedSearchPrimitiveResultsScrollArea=ee;exports.EmbeddedSearchPrimitiveResultsScrollAreaViewport=te;exports.EmbeddedSearchPrimitiveResultsTab=Y;exports.EmbeddedSearchPrimitiveResultsTabList=X;exports.EmbeddedSearchPrimitiveRoot=H;exports.EmbeddedSearchPrimitiveWrapper=B;exports.Footer=ke;exports.Input=U;exports.InputGroup=D;exports.InputIcon=F;exports.Loading=V;exports.PrimitiveContent=N;exports.Results=Q;exports.ResultsContent=Z;exports.ResultsEmpty=J;exports.ResultsItem=re;exports.ResultsItemBreadcrumbIcon=se;exports.ResultsItemBreadcrumbs=y;exports.ResultsItemDescription=de;exports.ResultsItemDescriptionPart=oe;exports.ResultsItemIcon=ne;exports.ResultsItemIndicator=ue;exports.ResultsItemPreview=le;exports.ResultsItemPreviewBody=Se;exports.ResultsItemPreviewBreadcrumbIcon=ve;exports.ResultsItemPreviewBreadcrumbs=mt;exports.ResultsItemPreviewHeader=dt;exports.ResultsItemPreviewHeading=me;exports.ResultsItemPreviewOutline=be;exports.ResultsItemPreviewOutlineItem=Re;exports.ResultsItemPreviewOutlineItemIcon=_e;exports.ResultsItemPreviewOutlineItemLinkIcon=Ee;exports.ResultsItemPreviewOutlineItemText=ge;exports.ResultsItemPreviewOutlineList=pe;exports.ResultsItemPreviewOutlineTitle=Pe;exports.ResultsItemPreviewTitle=he;exports.ResultsItemPreviewTitleLinkIcon=Ie;exports.ResultsItemTag=ce;exports.ResultsItemTitle=ae;exports.ResultsList=ie;exports.ResultsLoading=z;exports.ResultsScrollArea=ee;exports.ResultsScrollAreaCorner=Xe;exports.ResultsScrollAreaScrollbar=ze;exports.ResultsScrollAreaThumb=Je;exports.ResultsScrollAreaViewport=te;exports.ResultsTab=Y;exports.ResultsTabList=X;exports.Root=H;exports.TaglineBrandName=gt;exports.TaglineContainer=pt;exports.TaglineLogo=_t;exports.TaglineText=Rt;exports.Wrapper=B;
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),R=require("../atoms/cmdk/index.cjs"),r=require("./factory.cjs"),m=require("../utils/misc.cjs"),h=require("react"),d=require("./embedded-search/search-provider.cjs"),fe=require("./tagline-logo-icon.cjs"),_=require("../atoms/icons/custom-icon.cjs"),Ae=require("@radix-ui/react-scroll-area"),Le=require("@radix-ui/react-tabs"),p=require("../providers/config-provider.cjs"),xe=require("../providers/search-events-provider.cjs"),A=require("../atoms/link.cjs"),I=require("../providers/source-item-provider.cjs"),L=require("../atoms/icons/built-in-icon-renderer.cjs"),Ce=require("../utils/highlight-emphasis.cjs"),ye=require("../hooks/use-scrolling-fades.cjs"),Oe=require("@inkeep/cxkit-color-mode"),je=require("../atoms/avatars/ai.cjs"),q=require("./modal/modal-provider.cjs"),w=require("../utils/compose-refs.cjs"),g=require("../utils/compose-event-handlers.cjs"),qe=require("../atoms/shadow/context.cjs"),Be=require("../atoms/markdown/index.cjs");function B(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const i in e)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>e[i]})}}return t.default=e,Object.freeze(t)}const E=B(Ae),T=B(Le),P="__ask_ai__",He=r.ikp("div",{_id:"aiSearchWrapper"}),H=e=>{const{searchSettings:{view:t}}=p.useInkeepConfig(),{isHidden:i,hasContent:s,isMobile:n}=d.useSearch(),c=q.useModal();return a.jsx(He,{"data-hidden":m.dataAttr(i),"data-has-content":m.dataAttr(s),"data-in-modal":m.dataAttr(!!c),"data-mobile":m.dataAttr(n),"data-view":t,"data-dual-pane-search-expanded":m.dataAttr(s&&t==="dual-pane"&&!i),...e})},Ne=r.ikp(R.Command,{_id:"aiSearchRoot"}),N=e=>{const{isHidden:t,selectedItem:i,onSelectedItemChange:s}=d.useSearch();return a.jsx(Ne,{"data-hidden":m.dataAttr(t),shouldFilter:!1,loop:!1,value:i,onValueChange:s,...e})},M=r.ikp(R.Command.List,{_id:"aiSearchContent"}),D=h.forwardRef((e,t)=>{const{selectedItem:i}=d.useSearch();return a.jsx(M,{"aria-activedescendant":`aiSearchResults__Item-${i}`,...e,ref:t})}),F=r.ikp("div",{_id:"aiSearchInputGroup"}),U=r.ikp(_.CustomIcon,{_id:"aiSearchInputIcon",iconKey:"search"}),Me=r.ikp(R.Command.Input,{_id:"aiSearchInput"}),V=h.forwardRef(({onInput:e,...t},i)=>{const{query:s,onInput:n,placeholder:c,inputRef:o,shouldAutoFocusInput:u,selectedItem:l}=d.useSearch(),S=w.useComposedRefs(i,o),v=q.useModal();return h.useEffect(()=>{requestAnimationFrame(()=>{u&&o?.current&&(o.current.focus(),o.current.selectionStart=o.current.value.length)})},[u,o,v?.isOpen]),a.jsx(Me,{ref:S,placeholder:c,value:s,onInput:g.composeEventHandlers(e,n),"aria-activedescendant":`aiSearchResults__Item-${l}`,...t})}),De=r.ikp(L.BuiltInIconRenderer,{_id:"aiSearchLoading",iconSettings:{builtIn:"LuLoaderCircle"}}),K=e=>{const{loading:t,resultsList:i}=d.useSearch();return!t||i.length===0?null:a.jsx(De,{...e})},Fe=r.ikp(R.Command.Item,{_id:"aiAskAITrigger",value:P}),G=e=>{const{setSelectedItem:t,results:i,tab:s}=d.useSearch(),n=i[s]?.[0]?.id??"NONE";return a.jsx(Fe,{...e,id:`aiSearchResults__Item-${P}`,tabIndex:0,onPointerLeave:()=>t(n)})},Ue=r.ikp("img",{_id:"aiAskAITrigger__Icon"}),W=e=>{const{aiChatSettings:t}=p.useInkeepConfig(),{aiAssistantAvatar:i}=t??{},s=typeof i=="string"?i:i?.light,n=(typeof i=="string"?i:i?.dark)??s,c=Oe.useColorModeValue(s,n),[o,u]=h.useState(c);h.useEffect(()=>{u(c)},[c]);const l=()=>{u(null)};return a.jsx(Ue,{asChild:!0,...e,children:o?a.jsx("img",{src:o,alt:"AI Avatar","data-type":"image",onError:g.composeEventHandlers(l),...e}):a.jsx(je.default,{"data-type":"icon",...e})})},$=r.ikp("span",{_id:"aiAskAITrigger__Label"}),Q=r.ikp(_.CustomIcon,{_id:"aiAskAITrigger__Indicator",iconKey:"openLinkInSameTab"}),Ve=r.ikp(T.Root,{_id:"aiSearchResults"}),z=e=>{const{searchSettings:{view:t}}=p.useInkeepConfig(),{tab:i,onTabChange:s,hasContent:n,isHidden:c}=d.useSearch();return a.jsx(Ve,{value:i,onValueChange:s,"data-has-content":m.dataAttr(n),"data-dual-pane-search-expanded":m.dataAttr(n&&t==="dual-pane"&&!c),...e})},Ke=r.ikp("div",{_id:"aiSearchResults__Loading"}),J=e=>{const{loading:t,resultsList:i}=d.useSearch();return!t||i.length>0?null:a.jsx(Ke,{...e})},Ge=r.ikp(R.Command.Empty,{_id:"aiSearchResults__Empty"}),X=e=>{const{query:t,loading:i,results:s,tab:n}=d.useSearch(),c=s[n]?.length;return i||!t||c?null:a.jsx(Ge,{children:"No results found.",...e})},We=r.ikp(T.List,{_id:"aiSearchResults__TabList"}),Y=e=>{const{children:t,...i}=e,{searchSettings:{tabs:s}}=p.useInkeepConfig(),{results:n,loading:c,resultsList:o}=d.useSearch();if(c&&o.length===0)return null;const u=Object.keys(n);return!s.length||!u.length?null:a.jsx(We,{tabIndex:-1,children:m.maybeRender(t,u),...i})},$e=r.ikp(T.Trigger,{_id:"aiSearchResults__Tab"}),Z=h.forwardRef((e,t)=>{const i=h.useRef(null),s=w.useComposedRefs(t,i),{tab:n,onClick:c,...o}=e,{results:u,tab:l,inputRef:S}=d.useSearch(),v=u[n].length,b=n===l,k=()=>{S.current?.focus()},f=qe.useShadow();return h.useEffect(()=>{b&&f?.shadowHost?.shadowRoot?.activeElement?.hasAttribute("ikp-tab")&&i.current?.focus()},[b]),a.jsx($e,{ref:s,"ikp-tab":"",tabIndex:b?0:-1,value:n,children:`${n} (${v})`,onClick:g.composeEventHandlers(c,k),...o})}),ee=r.ikp("div",{_id:"aiSearchResults__Content"}),Qe=r.ikp(E.Root,{_id:"aiSearchResults__ScrollArea"}),te=e=>{const{loading:t,resultsList:i}=d.useSearch();return t&&i.length===0?null:a.jsx(Qe,{tabIndex:-1,...e})},ze=r.ikp(E.Viewport,{_id:"aiSearchResults__ScrollAreaViewport"}),ie=h.forwardRef(({children:e,...t},i)=>{const s=ye.useScrollingFades(),n=w.useComposedRefs(i,s),{tab:c}=d.useSearch();return h.useEffect(()=>{c&&s.current?.scrollTo({top:0,behavior:"auto"})},[c]),a.jsx(ze,{ref:n,tabIndex:-1,children:a.jsx("div",{tabIndex:-1,style:{display:"grid"},children:e}),...t})}),Je=r.ikp(E.ScrollAreaScrollbar,{_id:"aiSearchResults__ScrollAreaScrollbar"}),Xe=r.ikp(E.ScrollAreaThumb,{_id:"aiSearchResults__ScrollAreaThumb"}),Ye=r.ikp(E.Corner,{_id:"aiSearchResults__ScrollAreaCorner"}),Ze=r.ikp(T.Content,{_id:"aiSearchResults__List"}),re=e=>{const{children:t,...i}=e,{results:s,tab:n}=d.useSearch(),c=s[n]??[];return a.jsx(Ze,{value:n,"data-has-results":m.dataAttr(c.length>0),"aria-label":"Search results",children:m.maybeRender(t,c),tabIndex:-1,...i})},et=r.ikp(R.Command.Item,{_id:"aiSearchResults__Item",asChild:!0}),se=h.forwardRef(({item:e,onClick:t,onSelect:i,children:s,...n},c)=>{const{searchSettings:{shouldOpenLinksInNewTab:o,view:u}}=p.useInkeepConfig(),{logEvent:l}=xe.useSearchEvents(),{query:S,transitionsDisabled:v,selectedItem:b}=d.useSearch(),k=h.useRef(null),f=w.useComposedRefs(c,k),C=()=>{k.current?.click()},y=()=>{l({eventName:"search_result_clicked",properties:{searchQuery:S,title:e.title,url:e.url}})},O=e.shouldOpenInNewTab!==void 0?e.shouldOpenInNewTab:o,j=b===e.id,Te=j||(b==="NONE"||b===P);return a.jsx(I.SourceItemProvider,{source:{...e,isExternal:O},children:a.jsx(et,{ref:f,value:e.id,"data-type":e.type,"data-breadcrumbs":!!e.breadcrumbs?.length,"data-disable-transitions":m.dataAttr(v),"data-view":u,onSelect:g.composeEventHandlers(i,C),onClick:g.composeEventHandlers(t,y),"data-selected":m.dataAttr(j),tabIndex:Te?0:-1,...n,children:a.jsx(A.LinkWithQueryParams,{href:e.url,isExternal:O,appendToUrl:e.appendToUrl,children:s,id:`aiSearchResults__Item-${e.id}`})})})}),tt=r.ikp("div",{_id:"aiSearchResults__ItemBreadcrumbs"}),x=e=>{const{source:t}=I.useSourceItem(),{tab:i}=d.useSearch();if(!t.breadcrumbs?.length)return null;const{children:s,...n}=e,o=t.tabs?.find(u=>typeof u!="string"&&u[0]===i)?.[1]?.breadcrumbs??t.breadcrumbs??[];return a.jsx(tt,{"aria-hidden":"true",children:m.maybeRender(s,o),...n})},ne=r.ikp(_.CustomIcon,{_id:"aiSearchResults__ItemBreadcrumbIcon",iconKey:"breadcrumbSeparator"}),it=r.ikp(L.BuiltInIconRenderer,{_id:"aiSearchResults__ItemIcon"}),ae=e=>{const{source:t}=I.useSourceItem();return a.jsx(it,{iconSettings:t.icon,"data-type":t.type,...e})},rt=r.ikp("span",{_id:"aiSearchResults__ItemTitle"}),ce=e=>{const{source:t}=I.useSourceItem();return a.jsx(rt,{"data-type":t.type,children:t.title,...e})},st=r.ikp("span",{_id:"aiSearchResults__ItemTag"}),de=e=>{const{source:t}=I.useSourceItem();return a.jsx(st,{"data-type":t.type,children:t.tag,...e})},nt=r.ikp("span",{_id:"aiSearchResults__ItemDescription"}),oe=e=>{const{source:t}=I.useSourceItem(),{children:i,...s}=e,n=h.useMemo(()=>t.description?Ce.highlightEmphasis(t.description):[],[t.description]);return n.length?a.jsx(nt,{"data-type":t.type,"aria-hidden":"true",children:m.maybeRender(i,n),...s}):null},at=r.ikp("span",{_id:"aiSearchResults__ItemDescriptionPart"}),ue=e=>{const{part:t,...i}=e,{source:s}=I.useSourceItem();return typeof t=="string"?t:a.jsx(at,{"data-type":s.type,children:t.content,"data-highlighted":m.dataAttr(t.highlighted),...i})},ct=r.ikp(_.CustomIcon,{_id:"aiSearchResults__ItemIndicator"}),le=e=>{const{source:t}=I.useSourceItem(),{searchSettings:{view:i}}=p.useInkeepConfig();return a.jsx(ct,{iconKey:t.isExternal?"openLinkInNewTab":"openLinkInSameTab","data-view":i,...e})},dt=r.ikp("div",{_id:"aiSearchResults__ItemPreview","aria-hidden":!0}),me=e=>{const{searchSettings:{view:t,shouldOpenLinksInNewTab:i}}=p.useInkeepConfig(),{results:s,tab:n,selectedItem:c}=d.useSearch(),o=s[n]??[],u=h.useRef(null),l=h.useMemo(()=>{if(c===P)return u.current;const v=o.find(b=>b.id===c);return u.current=v??null,v},[c]);if(t!=="dual-pane"||c===P||!l)return null;const S=l.shouldOpenInNewTab!==void 0?l.shouldOpenInNewTab:i;return a.jsx(I.SourceItemProvider,{source:{...l,isExternal:S},children:a.jsx(dt,{...e})})},ot=r.ikp("div",{_id:"aiSearchResults__ItemPreview__Header"}),ut=r.ikp(A.LinkWithQueryParams,{_id:"aiSearchResults__ItemPreview__Heading"}),he=e=>{const{source:t}=I.useSourceItem();return a.jsx(ut,{href:t.url,isExternal:t.isExternal,appendToUrl:t.appendToUrl,"data-type":t.type,...e})},lt=r.ikp("span",{_id:"aiSearchResults__ItemPreview__Title"}),Ie=e=>{const{source:t}=I.useSourceItem();return a.jsx(lt,{children:t.title,...e})},mt=r.ikp(_.CustomIcon,{_id:"aiSearchResults__ItemPreview__Title__LinkIcon",iconKey:"openLinkInNewTab"}),ve=e=>{const{source:t}=I.useSourceItem();return a.jsx(mt,{iconKey:t.isExternal?"openLinkInNewTab":"openLinkInSameTab",...e})},ht=r.ikp(x,{_id:"aiSearchResults__ItemPreview__Breadcrumbs"}),Se=r.ikp(ne,{_id:"aiSearchResults__ItemPreview__BreadcrumbIcon"}),It=r.ikp(Be.Markdown,{_id:"aiSearchResults__ItemPreview__Body"}),be=e=>{const{source:t}=I.useSourceItem(),{resultsList:i}=d.useSearch(),s=i.find(c=>c.id===t.id),{searchSettings:{shouldOpenLinksInNewTab:n}}=p.useInkeepConfig();return s?a.jsx(It,{shouldOpenLinksInNewTab:n,children:s.preview,...e}):null},vt=r.ikp("div",{_id:"aiSearchResults__ItemPreview__Outline"}),pe=e=>{const{source:t}=I.useSourceItem(),{resultsList:i}=d.useSearch();return i.find(c=>c.id===t.id)?.rootRecord.topLevelHeadings?.length?a.jsx(vt,{...e}):null},Pe=r.ikp("span",{_id:"aiSearchResults__ItemPreview__Outline__Title",children:"On this page"}),St=r.ikp("ul",{_id:"aiSearchResults__ItemPreview__Outline__List"}),Re=e=>{const{source:t}=I.useSourceItem(),{resultsList:i}=d.useSearch(),s=i.find(l=>l.id===t.id),n=s?.rootRecord.topLevelHeadings;if(!n?.length)return null;const c=n.map(l=>{const S=l?.anchor&&l?.anchor===s?.content?.anchor,v=l?.anchor===s?.pathHeadings?.[0]?.anchor;return{...l,isMatch:S||v}}),{children:o,...u}=e;return a.jsx(St,{children:m.maybeRender(o,c),...u})},bt=r.ikp(A.LinkWithQueryParams,{_id:"aiSearchResults__ItemPreview__Outline__Item"}),_e=e=>{const{searchSettings:{shouldOpenLinksInNewTab:t}}=p.useInkeepConfig();return a.jsx(bt,{isExternal:t,...e})},ge=r.ikp(_.CustomIcon,{_id:"aiSearchResults__ItemPreview__Outline__ItemIcon",iconKey:"newLine"}),pt=r.ikp("span",{_id:"aiSearchResults__ItemPreview__Outline__ItemText"}),Ee=e=>a.jsx(pt,{...e}),ke=r.ikp(L.BuiltInIconRenderer,{_id:"aiSearchResults__ItemPreview__Outline__ItemLinkIcon",iconSettings:{builtIn:"LuLink"}}),Pt=r.ikp("div",{_id:"aiSearchFooter"}),we=e=>{const{hasContent:t}=d.useSearch();return a.jsx(Pt,{"data-has-results":m.dataAttr(t),...e})},Rt=r.ikp("div",{_id:"aiSearchTagline__Container"}),_t=r.ikp("span",{_id:"aiSearchTagline__Text",children:"Powered by"}),gt=r.ikp(fe.default,{_id:"aiSearchTagline__Logo"}),Et=r.ikp("a",{_id:"aiSearchTagline__BrandName",children:"inkeep",href:"https://www.inkeep.com/",target:"_blank",rel:"noopener noreferrer"});exports.Provider=d.SearchProvider;exports.ASK_AI_TRIGGER_VALUE=P;exports.AskAITrigger=G;exports.AskAITriggerIcon=W;exports.AskAITriggerIndicator=Q;exports.AskAITriggerLabel=$;exports.Content=D;exports.EmbeddedSearchInputIcon=U;exports.EmbeddedSearchPrimitiveAskAITrigger=G;exports.EmbeddedSearchPrimitiveAskAITriggerIcon=W;exports.EmbeddedSearchPrimitiveAskAITriggerIndicator=Q;exports.EmbeddedSearchPrimitiveAskAITriggerLabel=$;exports.EmbeddedSearchPrimitiveContent=D;exports.EmbeddedSearchPrimitiveFooter=we;exports.EmbeddedSearchPrimitiveInput=V;exports.EmbeddedSearchPrimitiveInputGroup=F;exports.EmbeddedSearchPrimitiveLoading=K;exports.EmbeddedSearchPrimitiveResults=z;exports.EmbeddedSearchPrimitiveResultsContent=ee;exports.EmbeddedSearchPrimitiveResultsEmpty=X;exports.EmbeddedSearchPrimitiveResultsItem=se;exports.EmbeddedSearchPrimitiveResultsItemBreadcrumbs=x;exports.EmbeddedSearchPrimitiveResultsItemDescription=oe;exports.EmbeddedSearchPrimitiveResultsItemDescriptionPart=ue;exports.EmbeddedSearchPrimitiveResultsItemIcon=ae;exports.EmbeddedSearchPrimitiveResultsItemIndicator=le;exports.EmbeddedSearchPrimitiveResultsItemPreview=me;exports.EmbeddedSearchPrimitiveResultsItemPreviewBody=be;exports.EmbeddedSearchPrimitiveResultsItemPreviewBreadcrumbIcon=Se;exports.EmbeddedSearchPrimitiveResultsItemPreviewHeading=he;exports.EmbeddedSearchPrimitiveResultsItemPreviewOutline=pe;exports.EmbeddedSearchPrimitiveResultsItemPreviewOutlineItem=_e;exports.EmbeddedSearchPrimitiveResultsItemPreviewOutlineItemIcon=ge;exports.EmbeddedSearchPrimitiveResultsItemPreviewOutlineItemLinkIcon=ke;exports.EmbeddedSearchPrimitiveResultsItemPreviewOutlineItemText=Ee;exports.EmbeddedSearchPrimitiveResultsItemPreviewOutlineList=Re;exports.EmbeddedSearchPrimitiveResultsItemPreviewOutlineTitle=Pe;exports.EmbeddedSearchPrimitiveResultsItemPreviewTitle=Ie;exports.EmbeddedSearchPrimitiveResultsItemPreviewTitleLinkIcon=ve;exports.EmbeddedSearchPrimitiveResultsItemTag=de;exports.EmbeddedSearchPrimitiveResultsItemTitle=ce;exports.EmbeddedSearchPrimitiveResultsList=re;exports.EmbeddedSearchPrimitiveResultsLoading=J;exports.EmbeddedSearchPrimitiveResultsScrollArea=te;exports.EmbeddedSearchPrimitiveResultsScrollAreaViewport=ie;exports.EmbeddedSearchPrimitiveResultsTab=Z;exports.EmbeddedSearchPrimitiveResultsTabList=Y;exports.EmbeddedSearchPrimitiveRoot=N;exports.EmbeddedSearchPrimitiveWrapper=H;exports.Footer=we;exports.Input=V;exports.InputGroup=F;exports.InputIcon=U;exports.Loading=K;exports.PrimitiveContent=M;exports.Results=z;exports.ResultsContent=ee;exports.ResultsEmpty=X;exports.ResultsItem=se;exports.ResultsItemBreadcrumbIcon=ne;exports.ResultsItemBreadcrumbs=x;exports.ResultsItemDescription=oe;exports.ResultsItemDescriptionPart=ue;exports.ResultsItemIcon=ae;exports.ResultsItemIndicator=le;exports.ResultsItemPreview=me;exports.ResultsItemPreviewBody=be;exports.ResultsItemPreviewBreadcrumbIcon=Se;exports.ResultsItemPreviewBreadcrumbs=ht;exports.ResultsItemPreviewHeader=ot;exports.ResultsItemPreviewHeading=he;exports.ResultsItemPreviewOutline=pe;exports.ResultsItemPreviewOutlineItem=_e;exports.ResultsItemPreviewOutlineItemIcon=ge;exports.ResultsItemPreviewOutlineItemLinkIcon=ke;exports.ResultsItemPreviewOutlineItemText=Ee;exports.ResultsItemPreviewOutlineList=Re;exports.ResultsItemPreviewOutlineTitle=Pe;exports.ResultsItemPreviewTitle=Ie;exports.ResultsItemPreviewTitleLinkIcon=ve;exports.ResultsItemTag=de;exports.ResultsItemTitle=ce;exports.ResultsList=re;exports.ResultsLoading=J;exports.ResultsScrollArea=te;exports.ResultsScrollAreaCorner=Ye;exports.ResultsScrollAreaScrollbar=Je;exports.ResultsScrollAreaThumb=Xe;exports.ResultsScrollAreaViewport=ie;exports.ResultsTab=Z;exports.ResultsTabList=Y;exports.Root=N;exports.TaglineBrandName=Et;exports.TaglineContainer=Rt;exports.TaglineLogo=gt;exports.TaglineText=_t;exports.Wrapper=H;
|
|
@@ -1,55 +1,55 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { Command as
|
|
2
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
3
|
+
import { Command as R } from "../atoms/cmdk/index.js";
|
|
4
4
|
import { ikp as r } from "./factory.js";
|
|
5
|
-
import { dataAttr as
|
|
6
|
-
import { forwardRef as
|
|
5
|
+
import { dataAttr as m, maybeRender as g } from "../utils/misc.js";
|
|
6
|
+
import { forwardRef as w, useEffect as E, useState as V, useRef as y, useMemo as F } from "react";
|
|
7
7
|
import { useSearch as l } from "./embedded-search/search-provider.js";
|
|
8
|
-
import { SearchProvider as
|
|
9
|
-
import
|
|
8
|
+
import { SearchProvider as Yt } from "./embedded-search/search-provider.js";
|
|
9
|
+
import K from "./tagline-logo-icon.js";
|
|
10
10
|
import { CustomIcon as b } from "../atoms/icons/custom-icon.js";
|
|
11
|
-
import * as
|
|
12
|
-
import * as
|
|
13
|
-
import { useInkeepConfig as
|
|
14
|
-
import { useSearchEvents as
|
|
15
|
-
import { LinkWithQueryParams as
|
|
16
|
-
import { SourceItemProvider as
|
|
17
|
-
import { BuiltInIconRenderer as
|
|
18
|
-
import { highlightEmphasis as
|
|
19
|
-
import { useScrollingFades as
|
|
20
|
-
import { useColorModeValue as
|
|
21
|
-
import
|
|
22
|
-
import { useModal as
|
|
23
|
-
import { useComposedRefs as
|
|
11
|
+
import * as T from "@radix-ui/react-scroll-area";
|
|
12
|
+
import * as L from "@radix-ui/react-tabs";
|
|
13
|
+
import { useInkeepConfig as S } from "../providers/config-provider.js";
|
|
14
|
+
import { useSearchEvents as $ } from "../providers/search-events-provider.js";
|
|
15
|
+
import { LinkWithQueryParams as O } from "../atoms/link.js";
|
|
16
|
+
import { SourceItemProvider as M, useSourceItem as h } from "../providers/source-item-provider.js";
|
|
17
|
+
import { BuiltInIconRenderer as C } from "../atoms/icons/built-in-icon-renderer.js";
|
|
18
|
+
import { highlightEmphasis as G } from "../utils/highlight-emphasis.js";
|
|
19
|
+
import { useScrollingFades as W } from "../hooks/use-scrolling-fades.js";
|
|
20
|
+
import { useColorModeValue as q } from "@inkeep/cxkit-color-mode";
|
|
21
|
+
import j from "../atoms/avatars/ai.js";
|
|
22
|
+
import { useModal as U } from "./modal/modal-provider.js";
|
|
23
|
+
import { useComposedRefs as A } from "../utils/compose-refs.js";
|
|
24
24
|
import { composeEventHandlers as p } from "../utils/compose-event-handlers.js";
|
|
25
|
-
import { useShadow as
|
|
26
|
-
import { Markdown as
|
|
27
|
-
const P = "__ask_ai__",
|
|
25
|
+
import { useShadow as Q } from "../atoms/shadow/context.js";
|
|
26
|
+
import { Markdown as z } from "../atoms/markdown/index.js";
|
|
27
|
+
const P = "__ask_ai__", J = r("div", {
|
|
28
28
|
_id: "aiSearchWrapper"
|
|
29
|
-
}),
|
|
29
|
+
}), et = (e) => {
|
|
30
30
|
const {
|
|
31
31
|
searchSettings: { view: t }
|
|
32
|
-
} =
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
-
|
|
32
|
+
} = S(), { isHidden: i, hasContent: s, isMobile: n } = l(), o = U();
|
|
33
|
+
return /* @__PURE__ */ a(
|
|
34
|
+
J,
|
|
35
35
|
{
|
|
36
|
-
"data-hidden":
|
|
37
|
-
"data-has-content":
|
|
38
|
-
"data-in-modal":
|
|
39
|
-
"data-mobile":
|
|
36
|
+
"data-hidden": m(i),
|
|
37
|
+
"data-has-content": m(s),
|
|
38
|
+
"data-in-modal": m(!!o),
|
|
39
|
+
"data-mobile": m(n),
|
|
40
40
|
"data-view": t,
|
|
41
|
-
"data-dual-pane-search-expanded":
|
|
41
|
+
"data-dual-pane-search-expanded": m(s && t === "dual-pane" && !i),
|
|
42
42
|
...e
|
|
43
43
|
}
|
|
44
44
|
);
|
|
45
|
-
},
|
|
45
|
+
}, X = r(R, {
|
|
46
46
|
_id: "aiSearchRoot"
|
|
47
|
-
}),
|
|
47
|
+
}), tt = (e) => {
|
|
48
48
|
const { isHidden: t, selectedItem: i, onSelectedItemChange: s } = l();
|
|
49
|
-
return /* @__PURE__ */
|
|
50
|
-
|
|
49
|
+
return /* @__PURE__ */ a(
|
|
50
|
+
X,
|
|
51
51
|
{
|
|
52
|
-
"data-hidden":
|
|
52
|
+
"data-hidden": m(t),
|
|
53
53
|
shouldFilter: !1,
|
|
54
54
|
loop: !1,
|
|
55
55
|
value: i,
|
|
@@ -57,73 +57,73 @@ const P = "__ask_ai__", z = r("div", {
|
|
|
57
57
|
...e
|
|
58
58
|
}
|
|
59
59
|
);
|
|
60
|
-
},
|
|
60
|
+
}, Y = r(R.List, {
|
|
61
61
|
_id: "aiSearchContent"
|
|
62
|
-
}),
|
|
62
|
+
}), it = w((e, t) => {
|
|
63
63
|
const { selectedItem: i } = l();
|
|
64
|
-
return /* @__PURE__ */
|
|
65
|
-
|
|
64
|
+
return /* @__PURE__ */ a(
|
|
65
|
+
Y,
|
|
66
66
|
{
|
|
67
67
|
"aria-activedescendant": `aiSearchResults__Item-${i}`,
|
|
68
68
|
...e,
|
|
69
69
|
ref: t
|
|
70
70
|
}
|
|
71
71
|
);
|
|
72
|
-
}),
|
|
72
|
+
}), rt = r("div", {
|
|
73
73
|
_id: "aiSearchInputGroup"
|
|
74
|
-
}),
|
|
74
|
+
}), st = r(b, {
|
|
75
75
|
_id: "aiSearchInputIcon",
|
|
76
76
|
iconKey: "search"
|
|
77
|
-
}),
|
|
77
|
+
}), Z = r(R.Input, {
|
|
78
78
|
_id: "aiSearchInput"
|
|
79
|
-
}),
|
|
80
|
-
const { query: s, onInput:
|
|
81
|
-
return
|
|
79
|
+
}), nt = w(({ onInput: e, ...t }, i) => {
|
|
80
|
+
const { query: s, onInput: n, placeholder: o, inputRef: c, shouldAutoFocusInput: d, selectedItem: u } = l(), _ = A(i, c), I = U();
|
|
81
|
+
return E(() => {
|
|
82
82
|
requestAnimationFrame(() => {
|
|
83
83
|
d && c?.current && (c.current.focus(), c.current.selectionStart = c.current.value.length);
|
|
84
84
|
});
|
|
85
|
-
}, [d, c,
|
|
86
|
-
|
|
85
|
+
}, [d, c, I?.isOpen]), /* @__PURE__ */ a(
|
|
86
|
+
Z,
|
|
87
87
|
{
|
|
88
88
|
ref: _,
|
|
89
89
|
placeholder: o,
|
|
90
90
|
value: s,
|
|
91
|
-
onInput: p(e,
|
|
91
|
+
onInput: p(e, n),
|
|
92
92
|
"aria-activedescendant": `aiSearchResults__Item-${u}`,
|
|
93
93
|
...t
|
|
94
94
|
}
|
|
95
95
|
);
|
|
96
|
-
}),
|
|
96
|
+
}), ee = r(C, {
|
|
97
97
|
_id: "aiSearchLoading",
|
|
98
98
|
iconSettings: {
|
|
99
99
|
builtIn: "LuLoaderCircle"
|
|
100
100
|
}
|
|
101
|
-
}),
|
|
101
|
+
}), at = (e) => {
|
|
102
102
|
const { loading: t, resultsList: i } = l();
|
|
103
|
-
return !t || i.length === 0 ? null : /* @__PURE__ */
|
|
104
|
-
},
|
|
103
|
+
return !t || i.length === 0 ? null : /* @__PURE__ */ a(ee, { ...e });
|
|
104
|
+
}, te = r(R.Item, {
|
|
105
105
|
_id: "aiAskAITrigger",
|
|
106
106
|
value: P
|
|
107
|
-
}),
|
|
108
|
-
const { setSelectedItem: t, results: i, tab: s } = l(),
|
|
109
|
-
return /* @__PURE__ */
|
|
110
|
-
|
|
107
|
+
}), ot = (e) => {
|
|
108
|
+
const { setSelectedItem: t, results: i, tab: s } = l(), n = i[s]?.[0]?.id ?? "NONE";
|
|
109
|
+
return /* @__PURE__ */ a(
|
|
110
|
+
te,
|
|
111
111
|
{
|
|
112
112
|
...e,
|
|
113
113
|
id: `aiSearchResults__Item-${P}`,
|
|
114
114
|
tabIndex: 0,
|
|
115
|
-
onPointerLeave: () => t(
|
|
115
|
+
onPointerLeave: () => t(n)
|
|
116
116
|
}
|
|
117
117
|
);
|
|
118
|
-
},
|
|
118
|
+
}, ie = r("img", {
|
|
119
119
|
_id: "aiAskAITrigger__Icon"
|
|
120
|
-
}),
|
|
121
|
-
const { aiChatSettings: t } =
|
|
122
|
-
return
|
|
120
|
+
}), ct = (e) => {
|
|
121
|
+
const { aiChatSettings: t } = S(), { aiAssistantAvatar: i } = t ?? {}, s = typeof i == "string" ? i : i?.light, n = (typeof i == "string" ? i : i?.dark) ?? s, o = q(s, n), [c, d] = V(o);
|
|
122
|
+
return E(() => {
|
|
123
123
|
d(o);
|
|
124
|
-
}, [o]), /* @__PURE__ */
|
|
124
|
+
}, [o]), /* @__PURE__ */ a(ie, { asChild: !0, ...e, children: c ? (
|
|
125
125
|
// biome-ignore lint/a11y/useAltText: <explanation>
|
|
126
|
-
/* @__PURE__ */
|
|
126
|
+
/* @__PURE__ */ a(
|
|
127
127
|
"img",
|
|
128
128
|
{
|
|
129
129
|
src: c,
|
|
@@ -135,149 +135,153 @@ const P = "__ask_ai__", z = r("div", {
|
|
|
135
135
|
...e
|
|
136
136
|
}
|
|
137
137
|
)
|
|
138
|
-
) : /* @__PURE__ */
|
|
139
|
-
},
|
|
138
|
+
) : /* @__PURE__ */ a(j, { "data-type": "icon", ...e }) });
|
|
139
|
+
}, lt = r("span", {
|
|
140
140
|
_id: "aiAskAITrigger__Label"
|
|
141
|
-
}),
|
|
141
|
+
}), dt = r(b, {
|
|
142
142
|
_id: "aiAskAITrigger__Indicator",
|
|
143
143
|
iconKey: "openLinkInSameTab"
|
|
144
|
-
}),
|
|
144
|
+
}), re = r(L.Root, {
|
|
145
145
|
_id: "aiSearchResults"
|
|
146
|
-
}),
|
|
147
|
-
const {
|
|
148
|
-
|
|
149
|
-
|
|
146
|
+
}), ut = (e) => {
|
|
147
|
+
const {
|
|
148
|
+
searchSettings: { view: t }
|
|
149
|
+
} = S(), { tab: i, onTabChange: s, hasContent: n, isHidden: o } = l();
|
|
150
|
+
return /* @__PURE__ */ a(
|
|
151
|
+
re,
|
|
150
152
|
{
|
|
151
|
-
value:
|
|
152
|
-
onValueChange:
|
|
153
|
-
"data-has-content":
|
|
153
|
+
value: i,
|
|
154
|
+
onValueChange: s,
|
|
155
|
+
"data-has-content": m(n),
|
|
156
|
+
"data-dual-pane-search-expanded": m(n && t === "dual-pane" && !o),
|
|
154
157
|
...e
|
|
155
158
|
}
|
|
156
159
|
);
|
|
157
|
-
},
|
|
160
|
+
}, se = r("div", {
|
|
158
161
|
_id: "aiSearchResults__Loading"
|
|
159
|
-
}),
|
|
162
|
+
}), mt = (e) => {
|
|
160
163
|
const { loading: t, resultsList: i } = l();
|
|
161
|
-
return !t || i.length > 0 ? null : /* @__PURE__ */
|
|
162
|
-
},
|
|
164
|
+
return !t || i.length > 0 ? null : /* @__PURE__ */ a(se, { ...e });
|
|
165
|
+
}, ne = r(R.Empty, {
|
|
163
166
|
_id: "aiSearchResults__Empty"
|
|
164
|
-
}), mt = (e) => {
|
|
165
|
-
const { query: t, loading: i, results: s, tab: a } = l(), o = s[a]?.length;
|
|
166
|
-
return i || !t || o ? null : /* @__PURE__ */ n(se, { children: "No results found.", ...e });
|
|
167
|
-
}, ne = r(E.List, {
|
|
168
|
-
_id: "aiSearchResults__TabList"
|
|
169
167
|
}), ht = (e) => {
|
|
168
|
+
const { query: t, loading: i, results: s, tab: n } = l(), o = s[n]?.length;
|
|
169
|
+
return i || !t || o ? null : /* @__PURE__ */ a(ne, { children: "No results found.", ...e });
|
|
170
|
+
}, ae = r(L.List, {
|
|
171
|
+
_id: "aiSearchResults__TabList"
|
|
172
|
+
}), It = (e) => {
|
|
170
173
|
const { children: t, ...i } = e, {
|
|
171
174
|
searchSettings: { tabs: s }
|
|
172
|
-
} =
|
|
175
|
+
} = S(), { results: n, loading: o, resultsList: c } = l();
|
|
173
176
|
if (o && c.length === 0) return null;
|
|
174
|
-
const d = Object.keys(
|
|
175
|
-
return !s.length || !d.length ? null : /* @__PURE__ */
|
|
176
|
-
},
|
|
177
|
+
const d = Object.keys(n);
|
|
178
|
+
return !s.length || !d.length ? null : /* @__PURE__ */ a(ae, { tabIndex: -1, children: g(t, d), ...i });
|
|
179
|
+
}, oe = r(L.Trigger, {
|
|
177
180
|
_id: "aiSearchResults__Tab"
|
|
178
|
-
}),
|
|
179
|
-
const i =
|
|
181
|
+
}), _t = w((e, t) => {
|
|
182
|
+
const i = y(null), s = A(t, i), { tab: n, onClick: o, ...c } = e, { results: d, tab: u, inputRef: _ } = l(), I = d[n].length, v = n === u, f = () => {
|
|
180
183
|
_.current?.focus();
|
|
181
|
-
}, k =
|
|
182
|
-
return
|
|
184
|
+
}, k = Q();
|
|
185
|
+
return E(() => {
|
|
183
186
|
v && k?.shadowHost?.shadowRoot?.activeElement?.hasAttribute("ikp-tab") && i.current?.focus();
|
|
184
|
-
}, [v]), /* @__PURE__ */
|
|
185
|
-
|
|
187
|
+
}, [v]), /* @__PURE__ */ a(
|
|
188
|
+
oe,
|
|
186
189
|
{
|
|
187
190
|
ref: s,
|
|
188
191
|
"ikp-tab": "",
|
|
189
192
|
tabIndex: v ? 0 : -1,
|
|
190
|
-
value:
|
|
191
|
-
children: `${
|
|
192
|
-
onClick: p(o,
|
|
193
|
+
value: n,
|
|
194
|
+
children: `${n} (${I})`,
|
|
195
|
+
onClick: p(o, f),
|
|
193
196
|
...c
|
|
194
197
|
}
|
|
195
198
|
);
|
|
196
|
-
}),
|
|
199
|
+
}), vt = r("div", {
|
|
197
200
|
_id: "aiSearchResults__Content"
|
|
198
|
-
}),
|
|
201
|
+
}), ce = r(T.Root, {
|
|
199
202
|
_id: "aiSearchResults__ScrollArea"
|
|
200
|
-
}),
|
|
203
|
+
}), St = (e) => {
|
|
201
204
|
const { loading: t, resultsList: i } = l();
|
|
202
|
-
return t && i.length === 0 ? null : /* @__PURE__ */
|
|
203
|
-
},
|
|
205
|
+
return t && i.length === 0 ? null : /* @__PURE__ */ a(ce, { tabIndex: -1, ...e });
|
|
206
|
+
}, le = r(T.Viewport, {
|
|
204
207
|
_id: "aiSearchResults__ScrollAreaViewport"
|
|
205
|
-
}), Rt =
|
|
206
|
-
const s =
|
|
207
|
-
return
|
|
208
|
+
}), Rt = w(({ children: e, ...t }, i) => {
|
|
209
|
+
const s = W(), n = A(i, s), { tab: o } = l();
|
|
210
|
+
return E(() => {
|
|
208
211
|
o && s.current?.scrollTo({ top: 0, behavior: "auto" });
|
|
209
|
-
}, [o]), /* @__PURE__ */
|
|
210
|
-
|
|
212
|
+
}, [o]), /* @__PURE__ */ a(
|
|
213
|
+
le,
|
|
211
214
|
{
|
|
212
|
-
ref:
|
|
215
|
+
ref: n,
|
|
213
216
|
tabIndex: -1,
|
|
214
217
|
children: (
|
|
215
218
|
/* added this to fix an overflow issue see https://github.com/radix-ui/primitives/issues/926 */
|
|
216
|
-
/* @__PURE__ */
|
|
219
|
+
/* @__PURE__ */ a("div", { tabIndex: -1, style: { display: "grid" }, children: e })
|
|
217
220
|
),
|
|
218
221
|
...t
|
|
219
222
|
}
|
|
220
223
|
);
|
|
221
|
-
}),
|
|
222
|
-
|
|
224
|
+
}), bt = r(
|
|
225
|
+
T.ScrollAreaScrollbar,
|
|
223
226
|
{
|
|
224
227
|
_id: "aiSearchResults__ScrollAreaScrollbar"
|
|
225
228
|
}
|
|
226
|
-
),
|
|
229
|
+
), pt = r(T.ScrollAreaThumb, {
|
|
227
230
|
_id: "aiSearchResults__ScrollAreaThumb"
|
|
228
|
-
}),
|
|
231
|
+
}), Pt = r(T.Corner, {
|
|
229
232
|
_id: "aiSearchResults__ScrollAreaCorner"
|
|
230
|
-
}),
|
|
233
|
+
}), de = r(L.Content, {
|
|
231
234
|
_id: "aiSearchResults__List"
|
|
232
|
-
}),
|
|
233
|
-
const { children: t, ...i } = e, { results: s, tab:
|
|
234
|
-
return /* @__PURE__ */
|
|
235
|
-
|
|
235
|
+
}), gt = (e) => {
|
|
236
|
+
const { children: t, ...i } = e, { results: s, tab: n } = l(), o = s[n] ?? [];
|
|
237
|
+
return /* @__PURE__ */ a(
|
|
238
|
+
de,
|
|
236
239
|
{
|
|
237
|
-
value:
|
|
238
|
-
"data-has-results":
|
|
240
|
+
value: n,
|
|
241
|
+
"data-has-results": m(o.length > 0),
|
|
239
242
|
"aria-label": "Search results",
|
|
240
243
|
children: g(t, o),
|
|
241
244
|
tabIndex: -1,
|
|
242
245
|
...i
|
|
243
246
|
}
|
|
244
247
|
);
|
|
245
|
-
},
|
|
248
|
+
}, ue = r(R.Item, {
|
|
246
249
|
_id: "aiSearchResults__Item",
|
|
247
250
|
asChild: !0
|
|
248
|
-
}),
|
|
251
|
+
}), wt = w(({ item: e, onClick: t, onSelect: i, children: s, ...n }, o) => {
|
|
249
252
|
const {
|
|
250
|
-
searchSettings: { shouldOpenLinksInNewTab: c }
|
|
251
|
-
} =
|
|
252
|
-
|
|
253
|
+
searchSettings: { shouldOpenLinksInNewTab: c, view: d }
|
|
254
|
+
} = S(), { logEvent: u } = $(), { query: _, transitionsDisabled: I, selectedItem: v } = l(), f = y(null), k = A(o, f), x = () => {
|
|
255
|
+
f.current?.click();
|
|
253
256
|
}, B = () => {
|
|
254
|
-
|
|
257
|
+
u({
|
|
255
258
|
eventName: "search_result_clicked",
|
|
256
259
|
properties: {
|
|
257
|
-
searchQuery:
|
|
260
|
+
searchQuery: _,
|
|
258
261
|
title: e.title,
|
|
259
262
|
url: e.url
|
|
260
263
|
}
|
|
261
264
|
});
|
|
262
|
-
},
|
|
263
|
-
return /* @__PURE__ */
|
|
264
|
-
|
|
265
|
+
}, N = e.shouldOpenInNewTab !== void 0 ? e.shouldOpenInNewTab : c, H = v === e.id, D = H || (v === "NONE" || v === P);
|
|
266
|
+
return /* @__PURE__ */ a(M, { source: { ...e, isExternal: N }, children: /* @__PURE__ */ a(
|
|
267
|
+
ue,
|
|
265
268
|
{
|
|
266
|
-
ref:
|
|
269
|
+
ref: k,
|
|
267
270
|
value: e.id,
|
|
268
271
|
"data-type": e.type,
|
|
269
272
|
"data-breadcrumbs": !!e.breadcrumbs?.length,
|
|
270
|
-
"data-disable-transitions": I
|
|
271
|
-
|
|
273
|
+
"data-disable-transitions": m(I),
|
|
274
|
+
"data-view": d,
|
|
275
|
+
onSelect: p(i, x),
|
|
272
276
|
onClick: p(t, B),
|
|
273
|
-
"data-selected":
|
|
274
|
-
tabIndex:
|
|
275
|
-
...
|
|
276
|
-
children: /* @__PURE__ */
|
|
277
|
-
|
|
277
|
+
"data-selected": m(H),
|
|
278
|
+
tabIndex: D ? 0 : -1,
|
|
279
|
+
...n,
|
|
280
|
+
children: /* @__PURE__ */ a(
|
|
281
|
+
O,
|
|
278
282
|
{
|
|
279
283
|
href: e.url,
|
|
280
|
-
isExternal:
|
|
284
|
+
isExternal: N,
|
|
281
285
|
appendToUrl: e.appendToUrl,
|
|
282
286
|
children: s,
|
|
283
287
|
id: `aiSearchResults__Item-${e.id}`
|
|
@@ -285,97 +289,100 @@ const P = "__ask_ai__", z = r("div", {
|
|
|
285
289
|
)
|
|
286
290
|
}
|
|
287
291
|
) });
|
|
288
|
-
}),
|
|
292
|
+
}), me = r("div", {
|
|
289
293
|
_id: "aiSearchResults__ItemBreadcrumbs"
|
|
290
|
-
}),
|
|
291
|
-
const { source: t } =
|
|
294
|
+
}), he = (e) => {
|
|
295
|
+
const { source: t } = h(), { tab: i } = l();
|
|
292
296
|
if (!t.breadcrumbs?.length) return null;
|
|
293
|
-
const { children: s, ...
|
|
294
|
-
return /* @__PURE__ */
|
|
295
|
-
|
|
297
|
+
const { children: s, ...n } = e, c = t.tabs?.find((d) => typeof d != "string" && d[0] === i)?.[1]?.breadcrumbs ?? t.breadcrumbs ?? [];
|
|
298
|
+
return /* @__PURE__ */ a(
|
|
299
|
+
me,
|
|
296
300
|
{
|
|
297
301
|
"aria-hidden": "true",
|
|
298
302
|
children: g(s, c),
|
|
299
|
-
...
|
|
303
|
+
...n
|
|
300
304
|
}
|
|
301
305
|
);
|
|
302
|
-
},
|
|
306
|
+
}, Ie = r(b, {
|
|
303
307
|
_id: "aiSearchResults__ItemBreadcrumbIcon",
|
|
304
308
|
iconKey: "breadcrumbSeparator"
|
|
305
|
-
}),
|
|
309
|
+
}), _e = r(C, {
|
|
306
310
|
_id: "aiSearchResults__ItemIcon"
|
|
307
311
|
}), Tt = (e) => {
|
|
308
|
-
const { source: t } =
|
|
309
|
-
return /* @__PURE__ */
|
|
310
|
-
}, _e = r("span", {
|
|
311
|
-
_id: "aiSearchResults__ItemTitle"
|
|
312
|
-
}), wt = (e) => {
|
|
313
|
-
const { source: t } = m();
|
|
314
|
-
return /* @__PURE__ */ n(_e, { "data-type": t.type, children: t.title, ...e });
|
|
312
|
+
const { source: t } = h();
|
|
313
|
+
return /* @__PURE__ */ a(_e, { iconSettings: t.icon, "data-type": t.type, ...e });
|
|
315
314
|
}, ve = r("span", {
|
|
316
|
-
_id: "
|
|
315
|
+
_id: "aiSearchResults__ItemTitle"
|
|
317
316
|
}), ft = (e) => {
|
|
318
|
-
const { source: t } =
|
|
319
|
-
return /* @__PURE__ */
|
|
317
|
+
const { source: t } = h();
|
|
318
|
+
return /* @__PURE__ */ a(ve, { "data-type": t.type, children: t.title, ...e });
|
|
319
|
+
}, Se = r("span", {
|
|
320
|
+
_id: "aiSearchResults__ItemTag"
|
|
321
|
+
}), Et = (e) => {
|
|
322
|
+
const { source: t } = h();
|
|
323
|
+
return /* @__PURE__ */ a(Se, { "data-type": t.type, children: t.tag, ...e });
|
|
320
324
|
}, Re = r("span", {
|
|
321
325
|
_id: "aiSearchResults__ItemDescription"
|
|
322
|
-
}),
|
|
323
|
-
const { source: t } =
|
|
324
|
-
return
|
|
326
|
+
}), Lt = (e) => {
|
|
327
|
+
const { source: t } = h(), { children: i, ...s } = e, n = F(() => t.description ? G(t.description) : [], [t.description]);
|
|
328
|
+
return n.length ? /* @__PURE__ */ a(
|
|
325
329
|
Re,
|
|
326
330
|
{
|
|
327
331
|
"data-type": t.type,
|
|
328
332
|
"aria-hidden": "true",
|
|
329
|
-
children: g(i,
|
|
333
|
+
children: g(i, n),
|
|
330
334
|
...s
|
|
331
335
|
}
|
|
332
336
|
) : null;
|
|
333
|
-
},
|
|
337
|
+
}, be = r("span", {
|
|
334
338
|
_id: "aiSearchResults__ItemDescriptionPart"
|
|
335
|
-
}),
|
|
336
|
-
const { part: t, ...i } = e, { source: s } =
|
|
337
|
-
return typeof t == "string" ? t : /* @__PURE__ */
|
|
338
|
-
|
|
339
|
+
}), At = (e) => {
|
|
340
|
+
const { part: t, ...i } = e, { source: s } = h();
|
|
341
|
+
return typeof t == "string" ? t : /* @__PURE__ */ a(
|
|
342
|
+
be,
|
|
339
343
|
{
|
|
340
344
|
"data-type": s.type,
|
|
341
345
|
children: t.content,
|
|
342
|
-
"data-highlighted":
|
|
346
|
+
"data-highlighted": m(t.highlighted),
|
|
343
347
|
...i
|
|
344
348
|
}
|
|
345
349
|
);
|
|
346
|
-
},
|
|
350
|
+
}, pe = r(b, {
|
|
347
351
|
_id: "aiSearchResults__ItemIndicator"
|
|
348
|
-
}),
|
|
349
|
-
const { source: t } =
|
|
350
|
-
|
|
351
|
-
|
|
352
|
+
}), kt = (e) => {
|
|
353
|
+
const { source: t } = h(), {
|
|
354
|
+
searchSettings: { view: i }
|
|
355
|
+
} = S();
|
|
356
|
+
return /* @__PURE__ */ a(
|
|
357
|
+
pe,
|
|
352
358
|
{
|
|
353
359
|
iconKey: t.isExternal ? "openLinkInNewTab" : "openLinkInSameTab",
|
|
360
|
+
"data-view": i,
|
|
354
361
|
...e
|
|
355
362
|
}
|
|
356
363
|
);
|
|
357
|
-
},
|
|
364
|
+
}, Pe = r("div", {
|
|
358
365
|
_id: "aiSearchResults__ItemPreview",
|
|
359
366
|
"aria-hidden": !0
|
|
360
|
-
}),
|
|
367
|
+
}), yt = (e) => {
|
|
361
368
|
const {
|
|
362
369
|
searchSettings: { view: t, shouldOpenLinksInNewTab: i }
|
|
363
|
-
} =
|
|
370
|
+
} = S(), { results: s, tab: n, selectedItem: o } = l(), c = s[n] ?? [], d = y(null), u = F(() => {
|
|
364
371
|
if (o === P) return d.current;
|
|
365
|
-
const
|
|
366
|
-
return d.current =
|
|
372
|
+
const I = c.find((v) => v.id === o);
|
|
373
|
+
return d.current = I ?? null, I;
|
|
367
374
|
}, [o]);
|
|
368
375
|
if (t !== "dual-pane" || o === P || !u) return null;
|
|
369
376
|
const _ = u.shouldOpenInNewTab !== void 0 ? u.shouldOpenInNewTab : i;
|
|
370
|
-
return /* @__PURE__ */
|
|
371
|
-
},
|
|
377
|
+
return /* @__PURE__ */ a(M, { source: { ...u, isExternal: _ }, children: /* @__PURE__ */ a(Pe, { ...e }) });
|
|
378
|
+
}, Ot = r("div", {
|
|
372
379
|
_id: "aiSearchResults__ItemPreview__Header"
|
|
373
|
-
}),
|
|
380
|
+
}), ge = r(O, {
|
|
374
381
|
_id: "aiSearchResults__ItemPreview__Heading"
|
|
375
|
-
}),
|
|
376
|
-
const { source: t } =
|
|
377
|
-
return /* @__PURE__ */
|
|
378
|
-
|
|
382
|
+
}), Ct = (e) => {
|
|
383
|
+
const { source: t } = h();
|
|
384
|
+
return /* @__PURE__ */ a(
|
|
385
|
+
ge,
|
|
379
386
|
{
|
|
380
387
|
href: t.url,
|
|
381
388
|
isExternal: t.isExternal,
|
|
@@ -384,101 +391,101 @@ const P = "__ask_ai__", z = r("div", {
|
|
|
384
391
|
...e
|
|
385
392
|
}
|
|
386
393
|
);
|
|
387
|
-
},
|
|
394
|
+
}, we = r("span", {
|
|
388
395
|
_id: "aiSearchResults__ItemPreview__Title"
|
|
389
|
-
}),
|
|
390
|
-
const { source: t } =
|
|
391
|
-
return /* @__PURE__ */
|
|
396
|
+
}), xt = (e) => {
|
|
397
|
+
const { source: t } = h();
|
|
398
|
+
return /* @__PURE__ */ a(we, { children: t.title, ...e });
|
|
392
399
|
}, Te = r(b, {
|
|
393
400
|
_id: "aiSearchResults__ItemPreview__Title__LinkIcon",
|
|
394
401
|
iconKey: "openLinkInNewTab"
|
|
395
|
-
}),
|
|
396
|
-
const { source: t } =
|
|
397
|
-
return /* @__PURE__ */
|
|
402
|
+
}), Bt = (e) => {
|
|
403
|
+
const { source: t } = h();
|
|
404
|
+
return /* @__PURE__ */ a(
|
|
398
405
|
Te,
|
|
399
406
|
{
|
|
400
407
|
iconKey: t.isExternal ? "openLinkInNewTab" : "openLinkInSameTab",
|
|
401
408
|
...e
|
|
402
409
|
}
|
|
403
410
|
);
|
|
404
|
-
},
|
|
405
|
-
|
|
411
|
+
}, Nt = r(
|
|
412
|
+
he,
|
|
406
413
|
{
|
|
407
414
|
_id: "aiSearchResults__ItemPreview__Breadcrumbs"
|
|
408
415
|
}
|
|
409
|
-
),
|
|
410
|
-
|
|
416
|
+
), Ht = r(
|
|
417
|
+
Ie,
|
|
411
418
|
{
|
|
412
419
|
_id: "aiSearchResults__ItemPreview__BreadcrumbIcon"
|
|
413
420
|
}
|
|
414
|
-
),
|
|
421
|
+
), fe = r(z, {
|
|
415
422
|
_id: "aiSearchResults__ItemPreview__Body"
|
|
416
|
-
}),
|
|
417
|
-
const { source: t } =
|
|
418
|
-
searchSettings: { shouldOpenLinksInNewTab:
|
|
419
|
-
} =
|
|
420
|
-
return s ? /* @__PURE__ */
|
|
421
|
-
|
|
423
|
+
}), Ft = (e) => {
|
|
424
|
+
const { source: t } = h(), { resultsList: i } = l(), s = i.find((o) => o.id === t.id), {
|
|
425
|
+
searchSettings: { shouldOpenLinksInNewTab: n }
|
|
426
|
+
} = S();
|
|
427
|
+
return s ? /* @__PURE__ */ a(
|
|
428
|
+
fe,
|
|
422
429
|
{
|
|
423
|
-
shouldOpenLinksInNewTab:
|
|
430
|
+
shouldOpenLinksInNewTab: n,
|
|
424
431
|
children: s.preview,
|
|
425
432
|
...e
|
|
426
433
|
}
|
|
427
434
|
) : null;
|
|
428
|
-
},
|
|
435
|
+
}, Ee = r("div", {
|
|
429
436
|
_id: "aiSearchResults__ItemPreview__Outline"
|
|
430
|
-
}),
|
|
431
|
-
const { source: t } =
|
|
432
|
-
return i.find((o) => o.id === t.id)?.rootRecord.topLevelHeadings?.length ? /* @__PURE__ */
|
|
433
|
-
},
|
|
437
|
+
}), Mt = (e) => {
|
|
438
|
+
const { source: t } = h(), { resultsList: i } = l();
|
|
439
|
+
return i.find((o) => o.id === t.id)?.rootRecord.topLevelHeadings?.length ? /* @__PURE__ */ a(Ee, { ...e }) : null;
|
|
440
|
+
}, Ut = r("span", {
|
|
434
441
|
_id: "aiSearchResults__ItemPreview__Outline__Title",
|
|
435
442
|
children: "On this page"
|
|
436
|
-
}),
|
|
443
|
+
}), Le = r("ul", {
|
|
437
444
|
_id: "aiSearchResults__ItemPreview__Outline__List"
|
|
438
|
-
}),
|
|
439
|
-
const { source: t } =
|
|
440
|
-
if (!
|
|
441
|
-
const o =
|
|
442
|
-
const _ = u?.anchor && u?.anchor === s?.content?.anchor,
|
|
445
|
+
}), Dt = (e) => {
|
|
446
|
+
const { source: t } = h(), { resultsList: i } = l(), s = i.find((u) => u.id === t.id), n = s?.rootRecord.topLevelHeadings;
|
|
447
|
+
if (!n?.length) return null;
|
|
448
|
+
const o = n.map((u) => {
|
|
449
|
+
const _ = u?.anchor && u?.anchor === s?.content?.anchor, I = u?.anchor === s?.pathHeadings?.[0]?.anchor;
|
|
443
450
|
return {
|
|
444
451
|
...u,
|
|
445
|
-
isMatch: _ ||
|
|
452
|
+
isMatch: _ || I
|
|
446
453
|
};
|
|
447
454
|
}), { children: c, ...d } = e;
|
|
448
|
-
return /* @__PURE__ */
|
|
449
|
-
},
|
|
455
|
+
return /* @__PURE__ */ a(Le, { children: g(c, o), ...d });
|
|
456
|
+
}, Ae = r(O, {
|
|
450
457
|
_id: "aiSearchResults__ItemPreview__Outline__Item"
|
|
451
|
-
}),
|
|
458
|
+
}), Vt = (e) => {
|
|
452
459
|
const {
|
|
453
460
|
searchSettings: { shouldOpenLinksInNewTab: t }
|
|
454
|
-
} =
|
|
455
|
-
return /* @__PURE__ */
|
|
456
|
-
},
|
|
461
|
+
} = S();
|
|
462
|
+
return /* @__PURE__ */ a(Ae, { isExternal: t, ...e });
|
|
463
|
+
}, Kt = r(b, {
|
|
457
464
|
_id: "aiSearchResults__ItemPreview__Outline__ItemIcon",
|
|
458
465
|
iconKey: "newLine"
|
|
459
|
-
}),
|
|
466
|
+
}), ke = r("span", {
|
|
460
467
|
_id: "aiSearchResults__ItemPreview__Outline__ItemText"
|
|
461
|
-
}),
|
|
462
|
-
|
|
468
|
+
}), $t = (e) => /* @__PURE__ */ a(ke, { ...e }), Gt = r(
|
|
469
|
+
C,
|
|
463
470
|
{
|
|
464
471
|
_id: "aiSearchResults__ItemPreview__Outline__ItemLinkIcon",
|
|
465
472
|
iconSettings: {
|
|
466
473
|
builtIn: "LuLink"
|
|
467
474
|
}
|
|
468
475
|
}
|
|
469
|
-
),
|
|
476
|
+
), ye = r("div", {
|
|
470
477
|
_id: "aiSearchFooter"
|
|
471
|
-
}),
|
|
478
|
+
}), Wt = (e) => {
|
|
472
479
|
const { hasContent: t } = l();
|
|
473
|
-
return /* @__PURE__ */
|
|
474
|
-
},
|
|
480
|
+
return /* @__PURE__ */ a(ye, { "data-has-results": m(t), ...e });
|
|
481
|
+
}, qt = r("div", {
|
|
475
482
|
_id: "aiSearchTagline__Container"
|
|
476
|
-
}),
|
|
483
|
+
}), jt = r("span", {
|
|
477
484
|
_id: "aiSearchTagline__Text",
|
|
478
485
|
children: "Powered by"
|
|
479
|
-
}),
|
|
486
|
+
}), Qt = r(K, {
|
|
480
487
|
_id: "aiSearchTagline__Logo"
|
|
481
|
-
}),
|
|
488
|
+
}), zt = r("a", {
|
|
482
489
|
_id: "aiSearchTagline__BrandName",
|
|
483
490
|
children: "inkeep",
|
|
484
491
|
href: "https://www.inkeep.com/",
|
|
@@ -487,100 +494,100 @@ const P = "__ask_ai__", z = r("div", {
|
|
|
487
494
|
});
|
|
488
495
|
export {
|
|
489
496
|
P as ASK_AI_TRIGGER_VALUE,
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
497
|
+
ot as AskAITrigger,
|
|
498
|
+
ct as AskAITriggerIcon,
|
|
499
|
+
dt as AskAITriggerIndicator,
|
|
500
|
+
lt as AskAITriggerLabel,
|
|
501
|
+
it as Content,
|
|
502
|
+
st as EmbeddedSearchInputIcon,
|
|
503
|
+
ot as EmbeddedSearchPrimitiveAskAITrigger,
|
|
504
|
+
ct as EmbeddedSearchPrimitiveAskAITriggerIcon,
|
|
505
|
+
dt as EmbeddedSearchPrimitiveAskAITriggerIndicator,
|
|
506
|
+
lt as EmbeddedSearchPrimitiveAskAITriggerLabel,
|
|
507
|
+
it as EmbeddedSearchPrimitiveContent,
|
|
508
|
+
Wt as EmbeddedSearchPrimitiveFooter,
|
|
509
|
+
nt as EmbeddedSearchPrimitiveInput,
|
|
510
|
+
rt as EmbeddedSearchPrimitiveInputGroup,
|
|
511
|
+
at as EmbeddedSearchPrimitiveLoading,
|
|
512
|
+
ut as EmbeddedSearchPrimitiveResults,
|
|
513
|
+
vt as EmbeddedSearchPrimitiveResultsContent,
|
|
514
|
+
ht as EmbeddedSearchPrimitiveResultsEmpty,
|
|
515
|
+
wt as EmbeddedSearchPrimitiveResultsItem,
|
|
516
|
+
he as EmbeddedSearchPrimitiveResultsItemBreadcrumbs,
|
|
517
|
+
Lt as EmbeddedSearchPrimitiveResultsItemDescription,
|
|
518
|
+
At as EmbeddedSearchPrimitiveResultsItemDescriptionPart,
|
|
512
519
|
Tt as EmbeddedSearchPrimitiveResultsItemIcon,
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
520
|
+
kt as EmbeddedSearchPrimitiveResultsItemIndicator,
|
|
521
|
+
yt as EmbeddedSearchPrimitiveResultsItemPreview,
|
|
522
|
+
Ft as EmbeddedSearchPrimitiveResultsItemPreviewBody,
|
|
523
|
+
Ht as EmbeddedSearchPrimitiveResultsItemPreviewBreadcrumbIcon,
|
|
524
|
+
Ct as EmbeddedSearchPrimitiveResultsItemPreviewHeading,
|
|
525
|
+
Mt as EmbeddedSearchPrimitiveResultsItemPreviewOutline,
|
|
526
|
+
Vt as EmbeddedSearchPrimitiveResultsItemPreviewOutlineItem,
|
|
527
|
+
Kt as EmbeddedSearchPrimitiveResultsItemPreviewOutlineItemIcon,
|
|
528
|
+
Gt as EmbeddedSearchPrimitiveResultsItemPreviewOutlineItemLinkIcon,
|
|
529
|
+
$t as EmbeddedSearchPrimitiveResultsItemPreviewOutlineItemText,
|
|
530
|
+
Dt as EmbeddedSearchPrimitiveResultsItemPreviewOutlineList,
|
|
531
|
+
Ut as EmbeddedSearchPrimitiveResultsItemPreviewOutlineTitle,
|
|
532
|
+
xt as EmbeddedSearchPrimitiveResultsItemPreviewTitle,
|
|
533
|
+
Bt as EmbeddedSearchPrimitiveResultsItemPreviewTitleLinkIcon,
|
|
534
|
+
Et as EmbeddedSearchPrimitiveResultsItemTag,
|
|
535
|
+
ft as EmbeddedSearchPrimitiveResultsItemTitle,
|
|
536
|
+
gt as EmbeddedSearchPrimitiveResultsList,
|
|
537
|
+
mt as EmbeddedSearchPrimitiveResultsLoading,
|
|
538
|
+
St as EmbeddedSearchPrimitiveResultsScrollArea,
|
|
532
539
|
Rt as EmbeddedSearchPrimitiveResultsScrollAreaViewport,
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
540
|
+
_t as EmbeddedSearchPrimitiveResultsTab,
|
|
541
|
+
It as EmbeddedSearchPrimitiveResultsTabList,
|
|
542
|
+
tt as EmbeddedSearchPrimitiveRoot,
|
|
543
|
+
et as EmbeddedSearchPrimitiveWrapper,
|
|
544
|
+
Wt as Footer,
|
|
545
|
+
nt as Input,
|
|
546
|
+
rt as InputGroup,
|
|
547
|
+
st as InputIcon,
|
|
548
|
+
at as Loading,
|
|
549
|
+
Y as PrimitiveContent,
|
|
550
|
+
Yt as Provider,
|
|
551
|
+
ut as Results,
|
|
552
|
+
vt as ResultsContent,
|
|
553
|
+
ht as ResultsEmpty,
|
|
554
|
+
wt as ResultsItem,
|
|
555
|
+
Ie as ResultsItemBreadcrumbIcon,
|
|
556
|
+
he as ResultsItemBreadcrumbs,
|
|
557
|
+
Lt as ResultsItemDescription,
|
|
558
|
+
At as ResultsItemDescriptionPart,
|
|
552
559
|
Tt as ResultsItemIcon,
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
560
|
+
kt as ResultsItemIndicator,
|
|
561
|
+
yt as ResultsItemPreview,
|
|
562
|
+
Ft as ResultsItemPreviewBody,
|
|
563
|
+
Ht as ResultsItemPreviewBreadcrumbIcon,
|
|
564
|
+
Nt as ResultsItemPreviewBreadcrumbs,
|
|
565
|
+
Ot as ResultsItemPreviewHeader,
|
|
566
|
+
Ct as ResultsItemPreviewHeading,
|
|
567
|
+
Mt as ResultsItemPreviewOutline,
|
|
568
|
+
Vt as ResultsItemPreviewOutlineItem,
|
|
569
|
+
Kt as ResultsItemPreviewOutlineItemIcon,
|
|
570
|
+
Gt as ResultsItemPreviewOutlineItemLinkIcon,
|
|
571
|
+
$t as ResultsItemPreviewOutlineItemText,
|
|
572
|
+
Dt as ResultsItemPreviewOutlineList,
|
|
573
|
+
Ut as ResultsItemPreviewOutlineTitle,
|
|
574
|
+
xt as ResultsItemPreviewTitle,
|
|
575
|
+
Bt as ResultsItemPreviewTitleLinkIcon,
|
|
576
|
+
Et as ResultsItemTag,
|
|
577
|
+
ft as ResultsItemTitle,
|
|
578
|
+
gt as ResultsList,
|
|
579
|
+
mt as ResultsLoading,
|
|
580
|
+
St as ResultsScrollArea,
|
|
581
|
+
Pt as ResultsScrollAreaCorner,
|
|
582
|
+
bt as ResultsScrollAreaScrollbar,
|
|
583
|
+
pt as ResultsScrollAreaThumb,
|
|
577
584
|
Rt as ResultsScrollAreaViewport,
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
585
|
+
_t as ResultsTab,
|
|
586
|
+
It as ResultsTabList,
|
|
587
|
+
tt as Root,
|
|
588
|
+
zt as TaglineBrandName,
|
|
589
|
+
qt as TaglineContainer,
|
|
590
|
+
Qt as TaglineLogo,
|
|
591
|
+
jt as TaglineText,
|
|
592
|
+
et as Wrapper
|
|
586
593
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),t=require("react"),y=require("../atoms/api/analytics/events.cjs"),B=require("./config-provider.cjs"),b=require("./user-provider.cjs"),p=t.createContext(void 0),f=({children:e})=>{const{baseSettings:s,componentType:n}=B.useInkeepConfig(),{apiKey:o,analyticsApiBaseUrl:r,tags:i,privacyPreferences:d,env:E}=s,{userProperties:c}=b.useUser(),a=t.useMemo(()=>({widgetLibraryVersion:"0.5.
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),t=require("react"),y=require("../atoms/api/analytics/events.cjs"),B=require("./config-provider.cjs"),b=require("./user-provider.cjs"),p=t.createContext(void 0),f=({children:e})=>{const{baseSettings:s,componentType:n}=B.useInkeepConfig(),{apiKey:o,analyticsApiBaseUrl:r,tags:i,privacyPreferences:d,env:E}=s,{userProperties:c}=b.useUser(),a=t.useMemo(()=>({widgetLibraryVersion:"0.5.33",componentType:n,tags:i}),[n,i]),u=!d.optOutAllAnalytics&&E!=="development",g={logEvent:t.useCallback(async v=>{const m={...a,...v.properties},l={eventName:v.eventName,properties:m,userProperties:c};u&&y.logEvent(l,o,r),s.onEvent?.(l)},[u,s,o,r,c,a])};return P.jsx(p.Provider,{value:g,children:e})},x=()=>{const e=t.useContext(p);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=f;exports.useBaseEvents=x;
|
|
@@ -7,7 +7,7 @@ import { useUser as b } from "./user-provider.js";
|
|
|
7
7
|
const m = x(void 0), U = ({ children: e }) => {
|
|
8
8
|
const { baseSettings: t, componentType: o } = C(), { apiKey: n, analyticsApiBaseUrl: s, tags: r, privacyPreferences: u, env: l } = t, { userProperties: i } = b(), a = d(
|
|
9
9
|
() => ({
|
|
10
|
-
widgetLibraryVersion: "0.5.
|
|
10
|
+
widgetLibraryVersion: "0.5.33",
|
|
11
11
|
componentType: o,
|
|
12
12
|
tags: r
|
|
13
13
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/cxkit-primitives",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.33",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Inkeep, Inc. Customer License (IICL) v1.1",
|
|
6
6
|
"homepage": "",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"remark-gfm": "^4.0.1",
|
|
60
60
|
"unist-util-visit": "^5.0.0",
|
|
61
61
|
"use-sync-external-store": "^1.4.0",
|
|
62
|
-
"@inkeep/cxkit-color-mode": "0.5.
|
|
63
|
-
"@inkeep/cxkit-theme": "0.5.
|
|
64
|
-
"@inkeep/cxkit-types": "0.5.
|
|
62
|
+
"@inkeep/cxkit-color-mode": "0.5.33",
|
|
63
|
+
"@inkeep/cxkit-theme": "0.5.33",
|
|
64
|
+
"@inkeep/cxkit-types": "0.5.33"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@biomejs/biome": "1.9.4",
|