1import{r as s,j as e}from"./vendor-react-CjtdLP_L.js";import{O as W,P as de,A as pe,a as me,b as ue,m as he}from"./languageDetection-pnolG1oX.js";import{S as xe,a as fe,b as be,c as ge,d as ve,T as ke,f as H,g as Q,h as Y}from"./workspace-account-requests-DGgpqxXh.js";import{a as je}from"./vendor-query-Dm6IpjeQ.js";import{u as Ne}from"./use-mobile-Bd1fhZJu.js";import{u as ye}from"./useAuth-BOD9I5M3.js";import{q as Pe,a as Ce}from"./queryClient-CAqhRfHG.js";import{a as k}from"./utils-09jiQjc0.js";import{C as Z,z as Ae,D as Ie,g as we}from"./ExperienceToolbarToggle-CBDBsdl7.js";import{R as X}from"./run-in-platforms-67ql1g33.js";import{l as S,B as Oe}from"./BrandIcon-SNc4vegW.js";import{u as ae}from"./vendor-i18n-B-dTb0jX.js";import{r as T,a as J,a9 as Se,X as Te}from"./vendor-icons-CEtKkbCp.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./index-DYd1AhEw.js";import"./index-DMBtqBCC.js";import"./index-CfHttwlL.js";import"./index-Bnm5UW7A.js";import"./index-CaH9w3gZ.js";import"./index-CXo7hDKg.js";import"./index-CFQO6bFv.js";import"./index-DpJDnEHE.js";import"./dropdown-menu-YjUv8fUk.js";import"./index-NncAJq6c.js";import"./BeaconMark-BfuppPGY.js";import"./index-DC01emjG.js";import"./WorkspacePreferences-CMsTGmr9.js";import"./workspace-context-CmD3Vyun.js";import"./workspace-route-transition-Dap2JeOj.js";import"./beacon-request-Bo3SWsEZ.js";import"./beacon-access-LXtv0J6t.js";import"./consent-D3s5Yi52.js";import"./badge-C1_E7bcS.js";import"./AuthModal-XlKB8C9v.js";import"./button-CgHkADzY.js";import"./vendor-react-icons-C3u-PHNU.js";import"./supabase--Raqy1d_.js";import"./auth-return-to-JRaTzEJL.js";import"./Logo-Dtk25poC.js";import"./dialog-BmoBvzwc.js";import"./onedrive-icon-D-0ysOtI.js";import"./useSpeechRecognitionCapability-Bf-Y8gAf.js";import"./card-LCaJb0qG.js";import"./Navigation-BihYueM1.js";import"./app-chrome-Chb-SQcU.js";import"./index-CTrG49eW.js";import"./vendor-motion-DcfotHwo.js";import"./switch-DRsOhBdK.js";import"./index-D8gd2y9N.js";import"./AnnouncementBar-BorZMjYy.js";import"./CountryFlag-Cuw2ULar.js";import"./voice-locales-BScwBmSI.js";import"./DodoRetryBanner-DbLCLuUt.js";import"./useUpiPayment-CK9LfhwI.js";import"./useCountryDiscount-Dvd2i3oO.js";import"./dodo-retry-dismissal-BkI0LhOM.js";import"./types-CGFT8RdL.js";import"./aeo-format-xMMG7p15.js";import"./chip-BYlQls2d.js";import"./usePersonalIntelligence-BNePMUog.js";import"./professional-constants-CKppBf3L.js";import"./textarea-DFjcW1kC.js";import"./scroll-area-BNQxABXy.js";import"./index-Bl7FDrSo.js";import"./progress-Dh8k7oU0.js";import"./useAgenticUI-ChVqd-yT.js";import"./useCreateExperience-CkNH1PsD.js";import"./SarvamIcon-De_a9IwZ.js";import"./prompeteer-brand-DVsJ2OA0.js";const Ee="text-[17px] font-semibold leading-[1.2] tracking-[-0.02em] text-[var(--public-ink)]",C="focus-ring-brand",E="!bg-[var(--public-surface-2)]",R="grid size-5 shrink-0 place-items-center text-[var(--public-focus-color)]",M="grid size-9 shrink-0 place-items-center rounded-[var(--public-radius-control)] border border-[var(--public-hairline)] bg-[var(--public-ground)] dark:bg-[var(--public-invert)]";function Re(m,n){const d=m?.trim().replace(/^@/,"").replace(/:$/,"").trim()||n?.trim();if(!d)return null;const o=he(d);if(o)return{kind:"profile",id:o.id,name:o.displayName};const c=Ie(d);return c?{kind:c.category==="assistant"?"app":"platform",id:c.id,name:c.name}:null}const ee=[{name:"ChatGPT",id:"chatgpt",handle:"chatgpt",description:"OpenAI conversational AI"},{name:"Claude",id:"claude",handle:"claude",description:"Anthropic reasoning and writing assistant"},{name:"Gemini",id:"gemini",handle:"gemini",description:"Google multimodal AI assistant"},{name:"Perplexity",id:"perplexity",handle:"perplexity",description:"Answer engine with cited research"},{name:"Grok",id:"grok",handle:"grok",description:"xAI conversational assistant"},{name:"Meta AI",id:"meta-ai",handle:"meta-ai",description:"Meta assistant across its apps"},{name:"Sarvam",id:"sarvam",handle:"sarvam",description:"Indian-language AI assistant"}],Me={sol:{platformId:"chatgpt",brandLogo:"openai"},fable:{platformId:"claude",brandLogo:"claude"}},Le=[{id:"all",label:"All"},{id:"agentic",label:"Models"},{id:"top",label:"AI apps"},{id:"coding",label:"Coding"},{id:"research",label:"Research"},{id:"video",label:"Video"},{id:"audio",label:"Audio"},{id:"image",label:"Image"}],te=["coding","research","video","audio","image","automation","design","enterprise","productivity","legal","medical","fashion"],ze={automation:"#F97316",de
1sign:"#0D9488",legal:"#2563EB",medical:"#DC2626",enterprise:"#7C3AED",audio:"#16A34A",video:"#DB2777",research:"#D97706",image:"#4F46E5",productivity:"#0891B2",fashion:"#EA580C",coding:"#475569"},L=(m,n)=>{const u=n.trim().toLowerCase();if(!u)return!0;const d=u.replace(/[\s._-]+/g,"");return m.some(o=>{const c=(o??"").toLowerCase();return c.includes(u)||c.replace(/[\s._-]+/g,"").includes(d)})};function Jt({isOpen:m,onClose:n,onSelectPlatform:u,onSelectAgenticProfile:d,onResetToDefault:o,selectedPlatformId:c,selectedTopApp:x,triggerRef:f}){const{t:l}=ae(),re=Ne()||!f?.current,[h,z]=s.useState(""),[b,_]=s.useState("all"),A=s.useRef(null),D=s.useRef(null),j=s.useRef(!1),F=s.useId(),g=Re(c,x),I=s.useMemo(()=>Z.filter(t=>L([t.name,t.handle,t.description],h)),[h]),ie=s.useMemo(()=>d?W.filter(t=>L([t.displayName,t.shortName,t.vendor,t.targetModelId,t.handle,t.description,...t.aliases],h)):[],[d,h]),se=s.useMemo(()=>o?ee.filter(t=>L([t.name,t.id,t.handle,t.description],h)):[],[o,h]),P=s.useMemo(()=>b==="all"?I:["coding","research","video","audio","image"].includes(b)?I.filter(t=>t.category===b):[],[b,I]),N=b==="all"||b==="agentic"?ie:[],y=b==="all"||b==="top"?se:[],w=s.useMemo(()=>{const t={};for(const a of P)(t[a.category]??=[]).push(a);return Object.values(t).forEach(a=>a.sort((i,r)=>i.name.localeCompare(r.name))),t},[P]),oe=s.useMemo(()=>Object.keys(w).sort((t,a)=>{const i=te.indexOf(t),r=te.indexOf(a);return i!==r?(i<0?999:i)-(r<0?999:r):t.localeCompare(a)}),[w]),le=Z.length+(d?W.length:0)+(o?ee.length:0),B=P.length+N.length+y.length,ne=s.useCallback(t=>{j.current=!0,u(t),n()},[n,u]);s.useEffect(()=>{m?j.current=!1:(z(""),_("all"))},[m]);const G=s.useCallback(t=>{if(t.key==="Escape"){t.preventDefault(),n();return}const a=Array.from(D.current?.querySelectorAll("[data-platform-choice]")??[]);if(!a.length)return;const i=a.indexOf(t.target),r=t.target===A.current;if(t.key==="Enter"&&r&&h.trim()&&a.length===1){t.preventDefault(),a[0].click();return}let p;if(t.key==="ArrowDown")p=i<0?0:(i+1)%a.length;else if(t.key==="ArrowUp")p=i<0?a.length-1:(i-1+a.length)%a.length;else if(i>=0&&t.key==="Home")p=0;else if(i>=0&&t.key==="End")p=a.length-1;else return;t.preventDefault(),a[p].focus({preventScroll:!0}),a[p].scrollIntoView({block:"nearest",behavior:"instant"})},[n,h]),$=t=>{t.preventDefault(),A.current?.focus({preventScroll:!0})},K=t=>{t.preventDefault();const a=document.activeElement;(!j.current||!a||a===document.body||a.closest("[data-platform-picker]"))&&f?.current?.focus({preventScroll:!0})},U=e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{id:F,className:k("truncate",Ee),"data-testid":"platform-picker-title",children:l("platformPicker.selectAIPlatform","Select AI Platform")}),e.jsx("div",{className:"mt-1 text-[12px] text-[var(--public-ink-2)]",role:"status","aria-live":"polite",children:h.trim()?l("platformPicker.matchingOptions",B===1?"{{count}} matching option":"{{count}} matching options",{count:B}):g?l("platformPicker.currentTarget","Current target: {{name}}",{name:g.name}):l("platformPicker.catalogSize","{{count}} platforms and models",{count:le})})]}),q=t=>e.jsxs("div",{className:"shrink-0 border-b border-[var(--public-hairline)]","data-testid":"platform-picker-header",children:[e.jsx("div",{className:"flex items-start justify-between gap-4 px-4 pt-4 pb-3",children:t==="sheet"?e.jsxs(be,{className:"min-w-0 flex-1 space-y-0 p-0 text-left",children:[e.jsx(ge,{asChild:!0,children:U}),e.jsx(ve,{className:"sr-only",children:"Choose an AI platform or optimization target."})]}):U}),e.jsx("div",{className:"px-4 pb-3",children:e.jsxs("div",{className:"relative",children:[e.jsx(J,{className:"pointer-events-none absolute left-3 top-1/2 z-10 size-4 -translate-y-1/2 text-[var(--public-ink-3)]"}),e.jsx("input",{ref:A,"aria-label":l("platformPicker.searchPlatforms","Search platforms and models"),value:h,onChange:a=>z(a.target.value),placeholder:l("platformPicker.searchPlatforms","Search name, @handle, vendor, or capability"),className:"h-11 w-full rounded-[var(--public-radius-control)] border border-[var(--public-hairline)] !bg-[var(--public-surface-2)] pl-9 pr-3 text-[14px] text-[var(--public-ink)] outline-none placeholder:text-[var(--public-ink-3)] focus:!bg-[var(--public-ground)] focus:ring-2 focus:ring-[var(--public-focus-color)]","data-testid":"input-platform-search",autoComplete:"off",spellCheck:!1})]})}),e.jsx("div",{className:"scrollbar-none flex gap-1.5 overflow-x-auto px-4 pb-3",role:"group","aria-label":l("platformPicker.categories","Platform categories"),children:Le.map(a=>{const i=b===a.id;return e.jsx("button",{type:"button",onClick:()=>_(a.id),"aria-pressed":i,className:k("platform-picker-filter flex h-9 shrink-0 items-center gap-1.5 rounded-[var(--public-radius-control)] border border-transparent px-3 text-[12px] font-medium",C,i?"!bg-[var(--public-surface-2)] text-[var(--public-ink)]":"!bg-transparent text-[var(--public-ink-2)] hover:!bg-[var(--public-surface-2)] hover:text-[var(--public-ink)]"),"data-testid":`platform-filter-${a.id}`,children:l(a.id==="all"?"common.all":a.id==="agentic"?"platformPicker.models":a.id==="top"?"platformPicker.apps":`platformPicker.category${a.id.charAt(0).toUpperCase()}${a.id.slice(1)}`,a.label)},a.id)})})]}),O=(t,a)=>e.jsxs("div",{className:"sticky top-0 z-10 -mx-1 flex items-center justify-between bg-[var(--public-ground)] px-2 pb-2 pt-3",children:[e.jsx("h3",{className:"text-[12px] font-medium text-[var(--public-ink-2)]",children:t}),e.jsx("span",{className:"text-[11px] tabular-nums text-[var(--public-ink-3)]",children:a})]}),V=e.jsx("div",{ref:D,"data-testid":"platform-picker-body",className:"flex-1 min-h-0 overflow-y-auto overscroll-contain",style:{WebkitOverflowScrolling:"touch"},children:e.jsxs("div",{className:"space-y-3 px-3 pb-3 pt-1",children:[!!N.length&&e.jsxs("section",{children:[O(l("platformPicker.modelOptimization","Model optimization"),N.length),e.jsx("div",{className:"space-y-1",children:N.map(t=>{const a=g?.kind==="profile"&&g.id===t.id,i=Me[t.id],r=X.find(v=>v.id===i.platformId),p=r?.Icon;return e.jsxs("button",{type:"button",onClick:()=>{j.current=!0,d?.(t),n()}
1,"aria-pressed":a,"aria-label":t.displayName,"data-platform-choice":!0,className:k("platform-picker-choice group flex w-full items-center gap-3 rounded-[var(--public-radius-control)] !bg-transparent px-2.5 py-2.5 text-left",C,a?E:"hover:!bg-[var(--public-surface-2-hover)]"),"data-testid":`agentic-profile-option-${t.id}`,children:[e.jsx("span",{"aria-hidden":"true","data-testid":`agentic-profile-brand-${t.id}`,"data-brand-logo":i.brandLogo,className:M,children:p?e.jsx(p,{className:"size-5 sm:size-[22px]",style:{color:r.iconColor}}):e.jsx("span",{className:"text-[17px] leading-none",children:t.icon})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"flex items-center gap-2",children:e.jsx("span",{className:"truncate text-[14px] font-semibold text-[var(--public-ink)]",children:t.displayName})}),e.jsx("span",{className:"mt-0.5 line-clamp-2 text-[12px] leading-[1.45] text-[var(--public-ink-2)]",children:t.description})]}),a&&e.jsx("span",{className:R,"aria-hidden":"true",children:e.jsx(T,{className:"size-[18px]",strokeWidth:2})})]},t.id)})})]}),!!y.length&&e.jsxs("section",{children:[O(l("platformPicker.apps","AI apps"),y.length),e.jsx("div",{className:"space-y-0.5",children:y.map(t=>{const a=X.find(p=>p.id===t.id),i=g?.kind==="app"&&g.id===t.id,r=a?.Icon;return e.jsxs("button",{type:"button",onClick:()=>{j.current=!0,o?.(t.name),n()},"aria-pressed":i,"aria-label":t.name,"data-platform-choice":!0,className:k("platform-picker-choice group flex w-full items-center gap-3 rounded-[var(--public-radius-control)] !bg-transparent px-2.5 py-2.5 text-left",C,i?E:"hover:!bg-[var(--public-surface-2)]"),"data-testid":`top-app-option-${t.id}`,children:[e.jsx("span",{"aria-hidden":"true",className:M,children:r&&e.jsx(r,{className:"size-5",style:{color:a.iconColor}})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block truncate text-[14.5px] font-semibold text-[var(--public-ink)]",children:t.name}),e.jsx("span",{className:"mt-0.5 block text-[12px] leading-[1.45] text-[var(--public-ink-2)]",children:t.description})]}),i&&e.jsx("span",{className:R,"aria-hidden":"true",children:e.jsx(T,{className:"size-[18px]",strokeWidth:2})})]},t.id)})})]}),oe.map(t=>{const a=w[t],i=Ae[t]?.label??t;return e.jsxs("section",{children:[O(l(`platformPicker.category${t.charAt(0).toUpperCase()}${t.slice(1)}`,i),a.length),e.jsx("div",{className:"space-y-0.5",children:a.map(r=>{const p=g?.kind==="platform"&&g.id===r.id,v=S(r.id)??S(r.handle)??S(r.name),ce=v?.brandColor??ze[t]??"#64748B";return e.jsxs("button",{type:"button",onClick:()=>ne(r),"aria-pressed":p,"aria-label":r.name,"data-platform-choice":!0,className:k("platform-picker-choice group flex w-full items-center gap-3 rounded-[var(--public-radius-control)] !bg-transparent px-2.5 py-2.5 text-left",C,p?E:"hover:!bg-[var(--public-surface-2)]"),"data-testid":`platform-option-${r.id}`,children:[e.jsx("span",{"aria-hidden":"true",className:M,style:{color:ce},children:v?e.jsx(Oe,{name:v.id,domain:v.domain,size:20,background:null,title:r.name}):e.jsx("span",{className:"text-[17px] leading-none",children:r.icon})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block truncate text-[14.5px] font-semibold text-[var(--public-ink)]",children:r.name}),e.jsx("span",{className:"mt-0.5 block text-[12px] leading-[1.45] text-[var(--public-ink-2)]",children:r.description})]}),p&&e.jsx("span",{className:R,"aria-hidden":"true",children:e.jsx(T,{className:"size-[18px]",strokeWidth:2})})]},r.id)})})]},t)}),!N.length&&!y.length&&!P.length&&e.jsxs("div",{className:"px-6 py-12 text-center",children:[e.jsx(J,{className:"mx-auto mb-3 size-7 text-[var(--public-ink-3)]"}),e.jsx("p",{className:"text-[13px] font-semibold text-[var(--public-ink)]",children:l("platformPicker.noPlatformsFound","No platforms found")}),e.jsx("p",{className:"mt-1 text-[11.5px] text-[var(--public-ink-2)]",children:l("platformPicker.tryDifferentSearch","Try a different search or category")})]})]})});return re?e.jsx(xe,{open:m,onOpenChange:t=>{t||n()},children:e.jsxs(fe,{side:"bottom",onKeyDown:G,onOpenAutoFocus:$,onCloseAutoFocus:K,showCloseButton:!1,overlayClassName:"bg-[rgba(12,20,20,0.42)] backdrop-blur-[2px] !animate-none",className:"inset-x-2 bottom-2 flex h-auto max-h-[min(82dvh,680px)] w-auto flex-col gap-0 overflow-visible rounded-2xl border border-[var(--public-hairline)] bg-[var(--public-ground)] p-0 text-[var(--public-ink)] shadow-overlay dark:border-[var(--public-hairline)] dark:bg-[var(--public-ground)]","data-
1platform-picker":!0,"data-testid":"platform-picker-dialog",children:[e.jsx("div",{className:"absolute -top-3 left-1/2 h-[5px] w-10 -translate-x-1/2 rounded-[var(--public-radius-pill)] bg-[var(--public-ink-3)]","aria-hidden":!0,"data-testid":"platform-picker-grab-handle"}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden rounded-2xl pb-[env(safe-area-inset-bottom,0px)]",children:[q("sheet"),V]})]})}):e.jsxs(de,{modal:!0,open:m,onOpenChange:t=>{t||n()},children:[e.jsx(pe,{virtualRef:f}),e.jsxs(me,{side:"bottom",align:"start",sideOffset:8,collisionPadding:12,avoidCollisions:!0,onOpenAutoFocus:$,onCloseAutoFocus:K,onKeyDown:G,className:"flex w-[min(470px,calc(100vw-24px))] max-h-[min(584px,var(--radix-popover-content-available-height,calc(100dvh-2rem)))] flex-col gap-0 overflow-hidden rounded-[var(--public-radius-surface)] border border-[var(--public-hairline)] bg-[var(--public-ground)] p-0 text-[var(--public-ink)] shadow-overlay","aria-labelledby":F,"data-platform-picker":!0,"data-testid":"platform-picker-dialog",children:[e.jsxs("div",{className:"flex min-h-0 max-h-[calc(100dvh-2rem)] flex-1 flex-col overflow-hidden",children:[q("popover"),V]}),e.jsx(ue,{width:14,height:7,className:"fill-[var(--public-ground)]"})]})]})}function ea({onOpenFullPicker:m,selectedPlatformId:n,disabled:u=!1,onClearSelection:d}){const{t:o}=ae(),c=n?we(n):null,x=!!c;return e.jsx(ke,{delayDuration:0,children:e.jsxs("div",{className:"flex items-center",children:[e.jsxs(H,{
1children:[e.jsx(Q,{asChild:!0,children:e.jsxs("button",{onClick:f=>{f.stopPropagation(),m()},className:k("h-[38px] lg:h-[42px] text-sm lg:text-base transition-colors duration-75 flex items-center gap-2 focus-visible:outline-none focus-visible:ring-2 touch-manipulation select-none",x?"px-4 lg:px-5 bg-slate-800 text-white border border-slate-600 border-r-0 rounded-l-lg hover:border-slate-500 focus-visible:ring-slate-400/40":u?"px-4 lg:px-5 bg-transparent text-slate-500 border border-slate-700 rounded-lg opacity-60 focus-visible:ring-slate-400/40":"px-4 lg:px-5 bg-transparent text-slate-300 border border-slate-600 rounded-lg hover:border-slate-500 hover:text-white focus-visible:ring-slate-400/40"),"data-testid":"button-platform-picker",children:[e.jsx("span",{className:"font-medium",children:x?`@${c.handle}`:"LLMs"}),!x&&e.jsx(Se,{className:"size-3.5 text-slate-500"})]})}),e.jsx(Y,{side:"top",className:"max-w-xs",children:e.jsx("p",{children:x?o("platformPicker.usingPlatform",{name:c.name,defaultValue:`Using ${c.name}. Click to change platform.`}):o("platformPicker.defaultTooltip","Top AI Apps: ChatGPT, Claude, Gemini, Perplexity, Grok, Meta AI, Sarvam. Click here to select a specialized AI and tailor the prompt for that platform.")})})]}),x&&d&&e.jsxs(H,{children:[e.jsx(Q,{asChild:!0,children:e.jsx("button",{type:"button",onClick:f=>{f.stopPropagation(),d()},"aria-label":o("platformPicker.resetToDefault","Reset to default LLMs"),className:"flex h-[38px] min-w-[44px] items-center justify-center rounded-r-lg border border-l-0 border-slate-600 bg-slate-800 text-slate-400 transition-colors hover:bg-slate-700 hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-400/40 lg:h-[42px]","data-testid":"button-clear-platform",children:e.jsx(Te,{className:"size-4"})})}),e.jsx(Y,{side:"top",children:e.jsx("p",{children:"Reset to default LLMs"})})]})]})})}function ta(){const[m,n]=s.useState(!1),[u,d]=s.useState(null),{user:o}=ye(),c=je({mutationFn:async l=>{if(o)return Ce("/api/user/platform-stats","PATCH",{platformId:l})},onSuccess:()=>
1Pe.invalidateQueries({queryKey:["/api/user/platform-stats"]})}),x=s.useCallback(l=>{d(l),o&&c.mutate(l.id)},[c,o]),f=s.useCallback(()=>d(null),[]);return{isPickerOpen:m,setIsPickerOpen:n,selectedPlatform:u,handleSelectPlatform:x,clearSelection:f}}export{ea as PlatformPickerButton,Jt as PlatformPickerDialog,ta as usePlatformPicker};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.