1 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="8025b8a9-884b-54d8-82d5-507de73cd018")}catch(e){}}(); 3(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,460579,e=>{"use strict";var t=e.i(373985),s=e.i(954878);let i={essential:0,enhanced:1,expert:2};e.s(["ComplexityGuard",0,function({minimumLevel:e="enhanced",fallback:a=null,children:r}){var n;let o=(0,s.useComplexity)();return o.hydrated&&(n=o.level,i[n]>=i[e])?"function"==typeof r?(0,t.jsx)(t.Fragment,{children:r(o)}):(0,t.jsx)(t.Fragment,{children:r}):"function"==typeof a?(0,t.jsx)(t.Fragment,{children:a(o)}):(0,t.jsx)(t.Fragment,{children:a})}])},72517,e=>{"use strict";var t=e.i(657527),s=e.i(380485),i=e.i(816882),a=e.i(427343),r=e.i(358786);let n=(0,e.i(687559).createSimpleQueryKeys)("suggestions",{list:(e,t)=>["suggestions",e,t],detail:e=>["suggestions","detail",e]});e.s(["useAISuggestions",0,function({contextType:e,entityId:t},i){return(0,s.useQuery)({queryKey:n.list(e,t),queryFn:async()=>{let s=new URLSearchParams;s.set("context_type",e),t&&s.set("entity_id",t);let i=(await a.apiAxios.get(`/api/v1/ai/suggestions?${s.toString()}`)).data.data;return{success:i.success,suggestions:i.suggestions||[],metadata:i.metadata||{context_type:e,entity_id:t,generated_at:new Date().toISOString(),source:"static_fallback"}}},staleTime:3e5,gcTime:6e5,refetchOnWindowFocus:!1,enabled:i?.enabled??!0})},"useDismissSuggestion",0,function(){let e=(0,i.useQueryClient)();return(0,t.useMutation)({mutationFn:async e=>{let t=await a.apiAxios.post(`/api/v1/ai/suggestions/${e}/dismiss`);return(0,r.unwrapApiResponse)(t)},onSuccess:(t,s)=>{e.invalidateQueries({queryKey:n.all})},onError:e=>{(0,r.showApiError)(e,"Failed to dismiss suggestion")}})}])},371792,e=>{"use strict";let t=(0,e.i(182233).default)("command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);e.s(["Command",0,t],371792)},11013,976649,e=>{"use strict";var t=e.i(373985),s=e.i(623955);e.i(264060),e.i(64618),e.i(353463),e.i(969912),e.i(304089),e.i(691799);var i=e.i(53559);e.i(314469),e.i(7629),e.i(371792);var a=e.i(352237),r=e.i(184094),n=e.i(696498),o=e.i(29221),l=e.i(465418),c=e.i(305657),d=e.i(911015),u=e.i(228218),m=e.i(764095),x=e.i(880331),p=e.i(273577),g=e.i(13082);e.i(11475),e.i(890325),e.i(936972),e.i(856474),e.i(926599),e.i(293916),e.i(250850),e.i(928472),n.BarChart3,c.TrendingUp,r.Lightbulb,a.Brain,n.BarChart3,e.s(["buildContextConfig",0,function(e){return{dashboard:{title:e("contextualAI.dashboard.title"),icon:(0,t.jsx)(n.BarChart3,{className:"w-4 h-4"}),description:e("contextualAI.dashboard.description"),quickActions:[{id:"daily-summary",label:e("contextualAI.dashboard.dailySummaryLabel"),description:e("contextualAI.dashboard.dailySummaryDesc"),icon:(0,t.jsx)(u.FileText,{className:"w-4 h-4"}),prompt:e("contextualAI.dashboard.dailySummaryPrompt")},{id:"priority-tasks",label:e("contextualAI.dashboard.priorityTasksLabel"),description:e("contextualAI.dashboard.priorityTasksDesc"),icon:(0,t.jsx)(i.Zap,{className:"w-4 h-4"}),prompt:e("contextualAI.dashboard.priorityTasksPrompt")},{id:"health-overview",label:e("contextualAI.dashboard.healthOverviewLabel"),description:e("contextualAI.dashboard.healthOverviewDesc"),icon:(0,t.jsx)(l.AlertTriangle,{className:"w-4 h-4"}),prompt:e("contextualAI.dashboard.healthOverviewPrompt")}],suggestedPrompts:[{id:"1",text:e("contextualAI.dashboard.suggestedTrends"),category:"analyze"},{id:"2",text:e("contextualAI.dashboard.suggestedAttention"),category:"recommend"},{id:"3",text:e("contextualAI.dashboard.suggestedCompare"),category:"compare"}]},hive:{title:e("contextualAI.hive.title"),icon:(0,t.jsx)(m.Hexagon,{className:"w-4 h-4"}),description:e("contextualAI.hive.description"),quickActions:[{id:"health-analysis",label:e("contextualAI.hive.healthAnalysisLabel"),description:e("contextualAI.hive.healthAnalysisDesc"),icon:(0,t.jsx)(l.AlertTriangle,{className:"w-4 h-4"}),prompt:e("contextualAI.hive.healthAnalysisPrompt")},{id:"inspection-due",label:e("contextualAI.hive.nextInspectionLabel"),description:e("contextualAI.hive.nextInspectionDesc"),icon:(0,t.jsx)(o.ClipboardCheck,{className:"w-4 h-4"}),prompt:e("contextualAI.hive.nextInspectionPrompt")},{id:"predict-yield",label:e("contextualAI.hive.predictYieldLabel"),description:e("contextualAI.hive.predictYieldDesc"),icon:(0,t.jsx)(c.TrendingUp,{className:"w-4 h-4"}),prompt:e("contextualAI.hive.predictYieldPrompt")}],suggestedPrompts:[{id:"1",text:e("contextualAI.hive.suggestedCompare"),category:"compare"},{id:"2",text:e("contextualAI.hive.suggestedIssues"),category:"predict"},{id:"3",text:e("contextualAI.hive.suggestedPatterns"),category:"explain"}
3]},"hive-list":{title:e("contextualAI.hiveList.title"),icon:(0,t.jsx)(m.Hexagon,{className:"w-4 h-4"}),description:e("contextualAI.hiveList.description"),quickActions:[{id:"compare-hives",label:e("contextualAI.hiveList.compareHivesLabel"),description:e("contextualAI.hiveList.compareHivesDesc"),icon:(0,t.jsx)(n.BarChart3,{className:"w-4 h-4"}),prompt:e("contextualAI.hiveList.compareHivesPrompt")},{id:"find-issues",label:e("contextualAI.hiveList.findIssuesLabel"),description:e("contextualAI.hiveList.findIssuesDesc"),icon:(0,t.jsx)(l.AlertTriangle,{className:"w-4 h-4"}),prompt:e("contextualAI.hiveList.findIssuesPrompt")}],suggestedPrompts:[{id:"1",text:e("contextualAI.hiveList.suggestedRank"),category:"analyze"},{id:"2",text:e("contextualAI.hiveList.suggestedInspect"),category:"recommend"}]},apiary:{title:e("contextualAI.apiary.title"),icon:(0,t.jsx)(x.MapPin,{className:"w-4 h-4"}),description:e("contextualAI.apiary.description"),quickActions:[{id:"location-analysis",label:e("contextualAI.apiary.locationAnalysisLabel"),description:e("contextualAI.apiary.locationAnalysisDesc"),icon:(0,t.jsx)(x.MapPin,{className:"w-4 h-4"}),prompt:e("contextualAI.apiary.locationAnalysisPrompt")},{id:"optimize-layout",label:e("contextualAI.apiary.optimizeLayoutLabel"),description:e("contextualAI.apiary.optimizeLayoutDesc"),icon:(0,t.jsx)(r.Lightbulb,{className:"w-4 h-4"}),prompt:e("contextualAI.apiary.optimizeLayoutPrompt")}],suggestedPrompts:[{id:"1",text:e("contextualAI.apiary.suggestedWeather"),category:"analyze"},{id:"2",text:e("contextualAI.apiary.suggestedForage"),category:"explain"}]},"apiary-list":{title:e("contextualAI.apiaryList.title"),icon:(0,t.jsx)(x.MapPin,{className:"w-4 h-4"}),description:e("contextualAI.apiaryList.description"),quickActions:[{id:"compare-locations",label:e("contextualAI.apiaryList.compareLocationsLabel"),description:e("contextualAI.apiaryList.compareLocationsDesc"),icon:(0,t.jsx)(n.BarChart3,{className:"w-4 h-4"}),prompt:e("contextualAI.apiaryList.compareLocationsPrompt")}],suggestedPrompts:[{id:"1",text:e("contextualAI.apiaryList.suggestedBest"),category:"compare"}]},inspection:{title:e("contextualAI.inspection.title"),icon:(0,t.jsx)(o.ClipboardCheck,{className:"w-4 h-4"}),description:e("contextualAI.inspection.description"),quickActions:[{id:"interpret-findings",label:e("contextualAI.inspection.interpretFindingsLabel"),description:e("contextualAI.inspection.interpretFindingsDesc"),icon:(0,t.jsx)(a.Brain,{className:"w-4 h-4"}),prompt:e("contextualAI.inspection.interpretFindingsPrompt")},{id:"suggest-actions",label:e("contextualAI.inspection.suggestActionsLabel"),description:e("contextualAI.inspection.suggestActionsDesc"),icon:(0,t.jsx)(r.Lightbulb,{className:"w-4 h-4"}),prompt:e("contextualAI.inspection.suggestActionsPrompt")}],suggestedPrompts:[{id:"1",text:e("contextualAI.inspection.suggestedNormal"),category:"explain"},{id:"2",text:e("contextualAI.inspection.suggestedProblems"),category:"predict"}]},"inspection-list":{title:e("contextualAI.inspectionList.title"),icon:(0,t.jsx)(o.ClipboardCheck,{className:"w-4 h-4"}),description:e("contextualAI.inspectionList.description"),quickActions:[{id:"find-patterns",label:e("contextualAI.inspectionList.findPatternsLabel"),description:e("contextualAI.inspectionList.findPatternsDesc"),icon:(0,t.jsx)(c.TrendingUp,{className:"w-4 h-4"}),prompt:e("contextualAI.inspectionList.findPatternsPrompt")}],suggestedPrompts:[{id:"1",text:e("contextualAI.inspectionList.suggestedHealth"),category:"analyze"}]},task:{title:e("contextualAI.task.title"),icon:(0,t.jsx)(i.Zap,{className:"w-4 h-4"}),description:e("contextualAI.task.description"),quickActions:[{id:"explain-task",label:e("contextualAI.task.explainTaskLabel"),description:e("contextualAI.task.explainTaskDesc"),icon:(0,t.jsx)(r.Lightbulb,{className:"w-4 h-4"}),prompt:e("contextualAI.task.explainTaskPrompt")}],suggestedPrompts:[{id:"1",text:e("contextualAI.task.suggestedTools"),category:"explain"},{id:"2",text:e("contextualAI.task.suggestedWatchOut"),category:"recommend"}]},"task-list":{title:e("contextualAI.taskList.title"),icon:(0,t.jsx)(i.Zap,{className:"w-4 h-4"}),description:e("contextualAI.taskList.description"),quickActions:[{id:"prioritize",label:e("contextualAI.taskList.prioritizeLabel"),description:e("contextualAI.taskList.prioritizeDesc"),icon:(0,t.jsx)(c.TrendingUp,{className:"w-4 h-4"}),prompt:e("contextualAI.taskList.prioritizePrompt")},{id:"schedule",label:e("contextualAI.taskList.scheduleLabel"),description:e("contextualAI.taskList.scheduleDesc"),icon:(0,t.jsx)(d.
3Calendar,{className:"w-4 h-4"}),prompt:e("contextualAI.taskList.schedulePrompt")}],suggestedPrompts:[{id:"1",text:e("contextualAI.taskList.suggestedDelegate"),category:"recommend"}]},harvest:{title:e("contextualAI.harvest.title"),icon:(0,t.jsx)(g.Wheat,{className:"w-4 h-4"}),description:e("contextualAI.harvest.description"),quickActions:[{id:"quality-analysis",label:e("contextualAI.harvest.qualityAnalysisLabel"),description:e("contextualAI.harvest.qualityAnalysisDesc"),icon:(0,t.jsx)(n.BarChart3,{className:"w-4 h-4"}),prompt:e("contextualAI.harvest.qualityAnalysisPrompt")}],suggestedPrompts:[{id:"1",text:e("contextualAI.harvest.suggestedCompare"),category:"compare"}]},"harvest-list":{title:e("contextualAI.harvestList.title"),icon:(0,t.jsx)(g.Wheat,{className:"w-4 h-4"}),description:e("contextualAI.harvestList.description"),quickActions:[{id:"yield-analysis",label:e("contextualAI.harvestList.yieldAnalysisLabel"),description:e("contextualAI.harvestList.yieldAnalysisDesc"),icon:(0,t.jsx)(c.TrendingUp,{className:"w-4 h-4"}),prompt:e("contextualAI.harvestList.yieldAnalysisPrompt")}],suggestedPrompts:[{id:"1",text:e("contextualAI.harvestList.suggestedFactors"),category:"analyze"}]},queen:{title:e("contextualAI.queen.title"),icon:(0,t.jsx)(p.Crown,{className:"w-4 h-4"}),description:e("contextualAI.queen.description"),quickActions:[{id:"performance-analysis",label:e("contextualAI.queen.performanceAnalysisLabel"),description:e("contextualAI.queen.performanceAnalysisDesc"),icon:(0,t.jsx)(n.BarChart3,{className:"w-4 h-4"}),prompt:e("contextualAI.queen.performanceAnalysisPrompt")}],suggestedPrompts:[{id:"1",text:e("contextualAI.queen.suggestedReplace"),category:"predict"}]},"queen-list":{title:e("contextualAI.queenList.title"),icon:(0,t.jsx)(p.Crown,{className:"w-4 h-4"}),description:e("contextualAI.queenList.description"),quickActions:[{id:"breeding-recommendations",label:e("contextualAI.queenList.breedingRecsLabel"),description:e("contextualAI.queenList.breedingRecsDesc"),icon:(0,t.jsx)(r.Lightbulb,{className:"w-4 h-4"}),prompt:e("contextualAI.queenList.breedingRecsPrompt")}],suggestedPrompts:[{id:"1",text:e("contextualAI.queenList.suggestedBest"),category:"compare"}]},report:{title:e("contextualAI.report.title"),icon:(0,t.jsx)(u.FileText,{className:"w-4 h-4"}),description:e("contextualAI.report.description"),quickActions:[{id:"summarize",label:e("contextualAI.report.summarizeLabel"),description:e("contextualAI.report.summarizeDesc"),icon:(0,t.jsx)(a.Brain,{className:"w-4 h-4"}),prompt:e("contextualAI.report.summarizePrompt")}],suggestedPrompts:[{id:"1",text:e("contextualAI.report.suggestedFindings"),category:"analyze"}]},analytics:{title:e("contextualAI.analyticsCtx.title"),icon:(0,t.jsx)(n.BarChart3,{className:"w-4 h-4"}),description:e("contextualAI.analyticsCtx.description"),quickActions:[{id:"explain-trends",label:e("contextualAI.analyticsCtx.explainTrendsLabel"),description:e("contextualAI.analyticsCtx.explainTrendsDesc"),icon:(0,t.jsx)(c.TrendingUp,{className:"w-4 h-4"}),prompt:e("contextualAI.analyticsCtx.explainTrendsPrompt")}],suggestedPrompts:[{id:"1",text:e("contextualAI.analyticsCtx.suggestedAnomalies"),category:"analyze"}]},settings:{title:e("contextualAI.settings.title"),icon:(0,t.jsx)(i.Zap,{className:"w-4 h-4"}),description:e("contextualAI.settings.description"),quickActions:[{id:"optimize-settings",label:e("contextualAI.settings.optimizeLabel"),description:e("contextualAI.settings.optimizeDesc"),icon:(0,t.jsx)(r.Lightbulb,{className:"w-4 h-4"}),prompt:e("contextualAI.settings.optimizePrompt")}],suggestedPrompts:[{id:"1",text:e("contextualAI.settings.suggestedChange"),category:"recommend"}]}}}],11013);var h=e.i(338277),b=e.i(72517),f=e.i(190823),y=e.i(453575);let A="ai-suggestions-dismissed";e.s(["useProactiveAISuggestions",0,function({contextType:e,entityId:t,maxSuggestions:i=5,enabled:a=!0}){let r=(0,h.useRouter)(),{online:n}=(0,f.useOffline)(),{data:o,isLoading:l,error:c,refetch:d}=(0,b.useAISuggestions)({contextType:e,entityId:t},{enabled:a&&n}
3),u=(0,b.useDismissSuggestion)(),[m,x]=(0,s.useState)({});(0,s.useEffect)(()=>{x(function(){try{let e=localStorage.getItem(A);if(!e)return{};return JSON.parse(e)}catch{return{}}}())},[]);let p=(0,s.useCallback)(e=>{x(t=>{let s=e(t);try{localStorage.setItem(A,JSON.stringify(s))}catch(e){y.logger.warn("Failed to save dismissed suggestions",e)}return s})},[]),[g,v]=(0,s.useState)(new Set),j=(0,s.useCallback)(e=>{let t=Date.now();return e.filter(e=>{let s=m[e.id];return!s||!(t-s<864e5)}).slice(0,i)},[m,i]),k=(0,s.useCallback)(async s=>{v(e=>{let t=new Set(e);return t.add(s.id),t});try{let{run_action:i}=s;if(i?.create_task)try{(await fetch("/api/proxy/tasks",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({title:i.task_data?.title||s.title,description:i.task_data?.description||s.description,taskType:{health:"inspection",maintenance:"maintenance",records:"other",feeding:"feeding",seasonal:"other",safety:"other"}[s.category]||i.task_data?.category||"other",priority:{high:"urgent",medium:"medium",low:"low"}[s.priority]||"medium",status:"pending",hiveId:"hive"===e?t:void 0,apiaryId:"apiary"===e?t:void 0})})).ok||y.logger.warn("Failed to create task for suggestion")}catch(e){y.logger.warn("Error creating task for suggestion",e)}if(i?.navigation_path){let e=i.navigation_path;t&&(e=e.replace("{hive_id}",t).replace("{apiary_id}",t)),r.push(e)}}finally{v(e=>{let t=new Set(e);return t.delete(s.id),t})}},[r,e,t]),w=(0,s.useCallback)(async e=>{p(t=>({...t,[e]:Date.now()}));try{await u.mutateAsync(e)}catch(e){y.logger.warn("Failed to persist suggestion dismissal to server",e)}},[p,u]),N=o?.success?j(o.suggestions||[]):[],I=o?.metadata?.source||null,L=o?.metadata?.generated_at?new Date(o.metadata.generated_at):null;return{suggestions:N,isLoading:l,error:c?Error(c.message):null,runSuggestion:k,dismissSuggestion:w,dismissKey:`${e}:${t||"global"}`,source:I,lastUpdated:L,refetch:d}}],976649)},786803,e=>{"use strict";let t=(0,e.i(182233).default)("utensils",[["path",{d:"M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2",key:"cjf0a3"}],["path",{d:"M7 2v20",key:"1473qp"}],["path",{d:"M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7",key:"j28e5"}]]);e.s(["Utensils",0,t],786803)},559391,e=>{"use strict";var t=e.i(373985),s=e.i(623955),i=e.i(338277);e.i(264060);var a=e.i(64618),r=e.i(353463),n=e.i(969912),o=e.i(304089),l=e.i(11475),c=e.i(813096),d=e.i(890325),u=e.i(691799),m=e.i(53559),x=e.i(314469),p=e.i(926599),g=e.i(293916),h=e.i(250850),b=e.i(460579),f=e.i(943887),y=e.i(994370),A=e.i(399780),v=e.i(222334),j=e.i(109376),k=e.i(11013),w=e.i(161944),N=e.i(976649),I=e.i(465418),L=e.i(149214),C=e.i(228218),P=e.i(786803),S=e.i(70199),q=e.i(608491),T=e.i(653614);let D={health:(0,t.jsx)(I.AlertTriangle,{className:"w-4 h-4 text-warning-600"}),maintenance:(0,t.jsx)(L.Wrench,{className:"w-4 h-4 text-muted-foreground"}),records:(0,t.jsx)(C.FileText,{className:"w-4 h-4 text-primary-600"}),feeding:(0,t.jsx)(P.Utensils,{className:"w-4 h-4 text-success-600"}),seasonal:(0,t.jsx)(q.Sun,{className:"w-4 h-4 text-warning-500"}),safety:(0,t.jsx)(S.Shield,{className:"w-4 h-4 text-danger-600"})},z={health:"bg-warning-50/80 dark:bg-warning-900/30 border-warning-200 dark:border-warning-800",maintenance:"bg-background border-border",records:"bg-primary-50/80 dark:bg-primary-900/30 border-primary-200 dark:border-primary-800",feeding:"bg-success-50/80 dark:bg-success-900/30 border-success-200 dark:border-success-800",seasonal:"bg-warning-50/80 dark:bg-warning-900/30 border-warning-200 dark:border-warning-800",safety:"bg-danger-50/80 dark:bg-danger-900/30 border-danger-200 dark:border-danger-800"},B={high:"bg-danger-100 text-danger-700 dark:bg-danger-900/30 dark:text-danger-400",medium:"bg-warning-100 text-warning-700 dark:bg-warning-900/30 dark:text-warning-400",low:"bg-success-100 text-success-700 dark:bg-success-900/30 dark:text-success-400"},F=(0,s.memo)(function({suggestion:e,isRunning:s=!1,onRun:i,onDismiss:c,className:d}){let{t:u}=(0,a.useTranslations)(),m=B[e.priority],p=z[e.category];return(0,t.jsxs)("div",{className:(0,n.cn)("relative rounded-lg border p-3 transition-all hover:shadow-hive-sm",p,d),children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2 flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"shrink-0 mt-0.5",children:D[e.category]}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,t.jsx)("span",{className:"text-sm font-semibold text-foreground truncate",children:e.title}),(0,t.jsx)("span",{className:(0,n.cn)("text-sm px-1.5 py-0.5 rounded-full shrink-0 font-medium",m),children:u(`aiSuggestion.priority.${e.priority}`)})]}),(0,t.jsx)("p",{className:"text-sm font-medium text-foreground line-clamp-2",children:e.description})]})]}),(0,t.jsx)("div",{className:"flex items-center gap-1 shrink-0",children:(0,t.jsx)(r.Button,{variant:"ghost",size:"sm",onClick:t=>{t.stopPropagation(),c(e.id)},className:"h-7 w-7 p-0 text-muted-foreground hover:text-foreground","aria-label":u("aiSuggestion.dismiss"),children:(0,t.jsx)(l.X,{className:"w-4 h-4"})})})]}),(0,t.jsxs)("div",{className:"mt-3 flex items-center justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1 text-sm font-medium text-foreground
3/90 dark:text-foreground",children:[(0,t.jsx)(o.Sparkles,{className:"w-3 h-3"}),(0,t.jsx)("span",{children:u("aiSuggestion.label")})]}),(0,t.jsx)(r.Button,{size:"sm",variant:"default",onClick:t=>{t.stopPropagation(),i(e)},disabled:s||!e.run_action,className:"h-7 px-3 text-sm",title:e.run_action?void 0:u("aiSuggestion.noActionAvailable"),children:s?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(T.Loader2,{className:"w-3.5 h-3.5 animate-spin mr-1.5"}),u("aiSuggestion.running")]}):(0,t.jsxs)(t.Fragment,{children:[u("aiSuggestion.run"),(0,t.jsx)(x.ChevronRight,{className:"w-3.5 h-3.5 ml-1"})]})})]})]})});F.displayName="AISuggestionItem";var E=e.i(803613),R=e.i(877045),_=e.i(7629),M=e.i(710380),O=e.i(932656);function U({contextType:e,entityId:i,maxSuggestions:l=5,showHeader:c=!0,showSource:d=!0,className:u,onRunAction:m}){let{t:x}=(0,a.useTranslations)(),[p,g]=(0,s.useState)(!0),{formatTime:h}=(0,w.useTimezoneSafe)(),{suggestions:f,isLoading:y,error:A,runSuggestion:v,dismissSuggestion:j,source:k,lastUpdated:I,refetch:L}=(0,N.useProactiveAISuggestions)({contextType:e,entityId:i,maxSuggestions:l,enabled:!0}),C=async e=>{m?m(e):await v(e)},P=p?f:f.slice(0,2),S=f.length>2&&!p;return A&&0===f.length?(0,t.jsx)(M.AIErrorBoundary,{componentName:"AISuggestionsCard",children:(0,t.jsx)(r.Card,{className:(0,n.cn)("border-ai-200 dark:border-ai-800",u),children:(0,t.jsxs)("div",{className:"p-4 text-center",children:[(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:x("ai.suggestions.unableToLoad")}),(0,t.jsxs)(r.Button,{variant:"ghost",size:"sm",onClick:()=>L(),className:"mt-2",children:[(0,t.jsx)(E.RefreshCw,{className:"w-4 h-4 mr-1"}),x("ai.suggestions.tryAgain")]})]})})}):0!==f.length||y?(0,t.jsx)(M.AIErrorBoundary,{componentName:"AISuggestionsCard",children:(0,t.jsx)(r.Card,{className:(0,n.cn)("border-ai-200 dark:border-ai-800",u),children:(0,t.jsxs)("div",{className:"p-4 space-y-3",children:[c&&(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("div",{className:"w-7 h-7 bg-gradient-to-br from-ai-500 to-ai-600 rounded-lg flex items-center justify-center",children:(0,t.jsx)(o.Sparkles,{className:"w-4 h-4 text-white"})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:x("ai.suggestions.title")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:x("ai.suggestions.count",{count:f.length})})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[y?(0,t.jsx)(T.Loader2,{className:"w-4 h-4 animate-spin text-muted-foreground"}):(0,t.jsx)(r.Button,{variant:"ghost",size:"sm",onClick:()=>L(),className:"h-7 w-7 p-0","aria-label":x("ai.suggestions.refresh"),children:(0,t.jsx)(E.RefreshCw,{className:"w-4 h-4"})}),(0,t.jsx)(r.Button,{variant:"ghost",size:"sm",onClick:()=>g(!p),className:"h-7 w-7 p-0","aria-label":x(p?"ai.suggestions.collapse":"ai.suggestions.expand"),children:p?(0,t.jsx)(_.ChevronUp,{className:"w-4 h-4"}):(0,t.jsx)(R.ChevronDown,{className:"w-4 h-4"})})]})]}),y&&0===f.length?(0,t.jsx)("div",{className:"space-y-3",children:[1,2,3].map(e=>(0,t.jsxs)("div",{className:"rounded-lg border border-muted animate-pulse p-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)("div",{className:"h-4 w-4 bg-muted rounded"}),(0,t.jsx)("div",{className:"h-4 w-24 bg-muted rounded"})]}),(0,t.jsx)("div",{className:"h-3 w-full bg-muted rounded"})]},e))}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"space-y-2",children:P.map(e=>(0,t.jsx)(F,{suggestion:e,onRun:C,onDismiss:j},e.id))}),S&&(0,t.jsxs)(r.Button,{variant:"ghost",size:"sm",onClick:()=>g(!0),className:"w-full text-muted-foreground",children:[(0,t.jsx)(R.ChevronDown,{className:"w-4 h-4 mr-1"}),x("ai.suggestions.showMore",{count:f.length-2})]})]}),d&&k&&(0,t.jsx)(b.ComplexityGuard,{minimumLevel:"expert",children:(0,t.jsx)("div",{className:"pt-2 border-t border-border/50",children:(0,t.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[(0,t.jsxs)("span",{className:"truncate",children:[x("ai.suggestions.source"),": ",k]}),I&&(0,t.jsxs)("span",{children:[x("ai.suggestions.updated"),": ",h(I)]})]})})})]})})}):(0,t.jsx)(M.AIErrorBoundary,{componentName:"AISuggestionsCard",children:(0,t.jsx)(r.Card,{className:(0,n.cn)("border-dashed border-muted-foreground
3/30",u),children:(0,t.jsx)(O.AIEmptyState,{customIcon:o.Sparkles,customTitle:x("ai.suggestions.noSuggestionsTitle"),customDescription:x("ai.suggestions.noSuggestionsDescription")})})})}var H=e.i(19871);let K={analyze:(0,t.jsx)(o.Sparkles,{className:"w-3 h-3"}),predict:(0,t.jsx)(m.Zap,{className:"w-3 h-3"}),recommend:(0,t.jsx)(c.HelpCircle,{className:"w-3 h-3"}),explain:(0,t.jsx)(c.HelpCircle,{className:"w-3 h-3"}),compare:(0,t.jsx)(o.Sparkles,{className:"w-3 h-3"})};e.s(["UnifiedAIAssistant",0,function({defaultCollapsed:e=!1,icon:m,showStatus:N=!0,onQuerySubmit:I}){let{t:L}=(0,a.useTranslations)(),{formatTime:C}=(0,w.useTimezone)(),P=(0,i.useRouter)(),S=(0,i.usePathname)(),{isQuickActionsOpen:q}=(0,f.useMobileQuickActions)(),T=(0,v.useMobile)(),D=(0,H.useCanAccess)("/ai-copilot"),z=(0,j.useAIAssistant)();z?.isOpen;let B=z?.trigger,[F,E]=(0,s.useState)(!0),[R,_]=(0,s.useState)(!1),[M,O]=(0,s.useState)([]),[Q,W]=(0,s.useState)(!1),[Z,$]=(0,s.useState)(""),G=(0,s.useRef)(null),J=(0,s.useRef)(null),V=(0,s.useRef)(null);(0,s.useEffect)(()=>{W(!0)},[]),(0,s.useEffect)(()=>{q&&!F&&E(!0)},[q,F]),(0,s.useEffect)(()=>{if(F)return;let e=e=>{"Escape"===e.key&&(E(!0),z&&z.closeAssistant())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[F,z]),(0,s.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"j"===e.key&&(e.preventDefault(),E(!F),F||setTimeout(()=>V.current?.focus(),100))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[F]),(0,s.useEffect)(()=>{if(F||T)return;J.current=document.activeElement;let e=G.current?.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),t=e?.[0];return t?.focus(),()=>{J.current?.focus()}},[F,T]),(0,s.useEffect)(()=>{if(!T&&!F)return F?document.body.style.overflow="":document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[F,T]);let Y=(0,s.useMemo)(()=>(function(e){let t=e.match(/\/hives\/([^\/]+)/),s=e.match(/\/apiaries\/([^\/]+)/);if("/"===e||"/dashboard"===e);else if(e.startsWith("/hives"))return{category:"hive",entityId:t?.[1]};else if(e.startsWith("/apiaries"))return{category:"apiary",entityId:s?.[1]};return{category:"dashboard"}})(S),[S]),X=(0,s.useMemo)(()=>{let e=Y.category;return"hive"===e&&Y.entityId?"hive":"apiary"===e&&Y.entityId?"apiary":"hive"===e?"hive-list":"apiary"===e?"apiary-list":"dashboard"},[Y]),ee=(0,s.useMemo)(()=>(0,k.buildContextConfig)(L),[L]),et=(0,s.useMemo)(()=>ee[X]||ee.dashboard,[ee,X]),es=et.title,ei=et.description,ea=(0,s.useCallback)(e=>{if(e.trim())if(I)I(e);else if(D){let t=`/ai-command?tab=copilot&q=${encodeURIComponent(e)}`;P.push(t),$(""),E(!0)}else $(e),E(!1),setTimeout(()=>V.current?.focus(),100)},[I,P,D]),er=(0,s.useCallback)(e=>{e.preventDefault(),ea(Z)},[Z,ea]),en=(0,s.useCallback)(e=>{e.action?(e.action(),E(!0)):e.prompt&&ea(e.prompt)},[ea]),eo=(0,s.useCallback)(e=>{ea(e.text)},[ea]),el=(0,t.jsx)(o.Sparkles,{className:"w-5 h-5 text-white dark:text-white"}),ec=!F,ed=()=>(0,t.jsxs)("div",{className:"flex flex-col h-full",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border/50 dark:border-border/50",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"w-8 h-8 bg-gradient-to-r from-primary-500 to-ai-500 rounded-xl flex items-center justify-center flex-shrink-0","aria-hidden":"true",children:m||et.icon||el}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("h3",{id:"ai-assistant-title",className:"text-sm font-semibold text-foreground dark:text-foreground truncate",children:B?.contextDescription?L("ai.askAI"):es}),(B?.contextDescription||ei)&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground dark:text-muted-foreground truncate",children:B?.contextDescription||ei})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[(0,t.jsx)(r.Button,{variant:"ghost",size:"sm",onClick:e=>{e.preventDefault(),e.stopPropagation(),E(!0),z&&z.closeAssistant(),(0,y.openContextualHelp)("UnifiedAIAssistant","how-to-use")},className:"h-8 w-8 p-0","aria-label":L("ai.helpWithAssistant"),title:L("common.help"),type:"button",children:(0,t.jsx)(c.HelpCircle,{className:"w-4 h-4","aria-hidden":"true"})}),(0,t.jsx)(r.Button,{variant:"ghost",size:"sm",onClick:()=>{E(!0),z&&z.closeAssistant()}
3,className:"h-8 w-8 p-0","aria-label":L("ai.closeAssistant"),children:(0,t.jsx)(l.X,{className:"w-4 h-4","aria-hidden":"true"})})]})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto overscroll-contain px-5 py-4",children:[B&&(0,t.jsxs)("div",{className:"mb-4 space-y-3",children:[B.contextDescription&&(0,t.jsxs)("div",{className:"rounded-lg border border-ai-200/50 dark:border-ai-200/50 dark:border-ai-700/50 bg-ai-50/50 dark:bg-ai-50/50 dark:bg-ai-900/20 p-3",children:[(0,t.jsxs)("p",{className:"text-sm font-medium text-foreground dark:text-foreground mb-1",children:[L("ai.about"),":"]}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground dark:text-muted-foreground",children:B.contextDescription})]}),B.quickQuestions&&B.quickQuestions.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-sm text-muted-foreground dark:text-muted-foreground mb-2 font-medium uppercase tracking-wider",children:L("ai.quickQuestions")}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:B.quickQuestions.map((e,s)=>(0,t.jsx)("button",{onClick:()=>{$(e.text),setTimeout(()=>V.current?.focus(),100),z?.clearTrigger()},className:"text-sm px-3 py-1.5 rounded-full bg-ai-100/50 dark:bg-ai-100/50 dark:bg-ai-900/30 text-ai-700 dark:text-ai-700 dark:text-ai-300 hover:bg-ai-200 hover:dark:bg-ai-200 dark:hover:bg-ai-900/50 transition-colors border border-ai-200/50 dark:border-ai-200/50 dark:border-ai-700/50",children:e.label||e.text.slice(0,30)},s))})]})]}),et.quickActions.length>0&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)("div",{className:"text-sm text-muted-foreground dark:text-muted-foreground mb-2 font-medium uppercase tracking-wider",children:L("ai.quickActions")}),(0,t.jsx)("div",{className:"space-y-2",children:et.quickActions.slice(0,4).map(e=>(0,t.jsx)("button",{onClick:()=>en(e),className:(0,n.cn)("w-full rounded-lg border p-3 text-sm transition-all duration-200","bg-gradient-to-r from-ai-50 to-ai-50 dark:from-ai-900/30 dark:to-ai-900/30","border-ai-200/50 dark:border-ai-700/50","hover:from-ai-100 hover:to-ai-100 dark:hover:from-ai-800/40 dark:hover:to-ai-800/40","text-left group"),children:(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"text-foreground dark:text-foreground",children:e.icon}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("div",{className:"font-semibold text-foreground dark:text-foreground",children:e.label}),e.description&&(0,t.jsx)("div",{className:"text-sm font-medium text-foreground/90 dark:text-foreground/90 dark:text-foreground mt-0.5",children:e.description})]}),(0,t.jsx)(x.ChevronRight,{className:"w-4 h-4 text-foreground/70 dark:text-foreground/70 dark:text-foreground opacity-0 group-hover:opacity-100 transition-opacity"})]})},e.id))})]}),(0,t.jsx)("div",{className:"mb-4",children:(0,t.jsx)(U,{contextType:Y.category,entityId:Y.entityId,showSource:!0,className:"border-ai-200 dark:border-ai-200 dark:border-ai-800"})}),et.suggestedPrompts.length>0&&(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)("div",{className:"text-sm text-muted-foreground dark:text-muted-foreground mb-2 font-medium uppercase tracking-wider",children:L("ai.tryAsking")}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:et.suggestedPrompts.map(e=>(0,t.jsxs)("button",{onClick:()=>eo(e),className:(0,n.cn)("inline-flex items-center gap-1 px-2.5 py-1.5 rounded-full text-sm","bg-muted/50 text-foreground hover:bg-muted transition-colors","border border-border/50"),children:[K[e.category],(0,t.jsx)("span",{className:"truncate",children:e.text})]},e.id))})]}),Q&&(0,t.jsx)(b.ComplexityGuard,{minimumLevel:"expert",children:(0,t.jsxs)("div",{className:"mt-4 pt-4 border-t dark:border-t border-border/50 dark:border-border/50",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between text-sm mb-2",children:[(0,t.jsx)("span",{className:"font-medium text-foreground dark:text-foreground",children:L("ai.promptHistory")}),(0,t.jsx)(r.Button,{size:"sm",variant:"ghost",className:"h-7 px-2 text-sm",onClick:()=>_(e=>!e),children:R?L("common.hide"):L("common.show")})]}),R&&(0,t.jsx)("div",{className:"max-h-40 overflow-auto space-y-2 pr-1",children:0===M.length?(0,t.jsx)("p",{className:"text-sm text-muted-foreground dark:text-muted-foreground",children:L("ai.noPromptHistory")}):M.map(e=>(0,t.jsxs)("div",{className:"rounded-lg border border-muted-foreground
3/20 dark:border-muted-foreground/20 bg-muted/30 dark:bg-muted/30 p-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between text-sm text-muted-foreground dark:text-muted-foreground",children:[(0,t.jsx)("span",{className:"font-semibold text-foreground dark:text-foreground",children:e.label}),(0,t.jsx)("span",{children:C(e.timestamp)})]}),e.description&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground dark:text-muted-foreground mt-1",children:e.description})]},e.id))})]})})]}),(0,t.jsx)("div",{className:"px-5 py-4 border-t dark:border-t border-border/50 dark:border-border/50",children:(0,t.jsx)("form",{onSubmit:er,children:(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(u.MessageSquare,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground dark:text-muted-foreground"}),(0,t.jsx)("input",{ref:V,type:"text",value:Z,onChange:e=>$(e.target.value),onKeyDown:e=>{"Escape"===e.key&&E(!0)},placeholder:L("ai.askAnythingPlaceholder"),className:(0,n.cn)("w-full pl-10 pr-12 py-2.5 rounded-lg border text-sm","bg-background text-foreground placeholder:text-muted-foreground","focus:outline-none focus:ring-2 focus:ring-primary-500","disabled:opacity-50")}),(0,t.jsx)("button",{type:"submit","aria-label":"Send",disabled:!Z.trim(),className:(0,n.cn)("absolute right-2 top-1/2 -translate-y-1/2 p-1.5 rounded","text-muted-foreground hover:text-primary-600 transition-colors","disabled:opacity-50 disabled:cursor-not-allowed"),children:(0,t.jsx)(d.ArrowRight,{className:"w-4 h-4"})})]})})})]});return Q?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(g.AnimatePresence,{children:F&&(0,t.jsx)(p.motion.button,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},transition:{type:"spring",stiffness:300,damping:25},onClick:()=>E(!1),className:(0,n.cn)("fixed z-fab left-4 bottom-[calc(4.5rem+var(--safe-area-inset-bottom))] md:left-auto md:right-6 md:bottom-6","w-14 h-14 rounded-full","bg-gradient-to-r from-primary-500 to-ai-500","shadow-hive hover:shadow-hive-lg","flex items-center justify-center","focus:outline-none focus:ring-2 focus:ring-primary-500 focus:ring-offset-2","transition-shadow duration-200"),"aria-label":L("ai.openAssistant",{title:es}),type:"button",children:m||el})}),T?(0,t.jsx)(A.MobileBottomSheet,{open:ec,onClose:()=>E(!0),title:es,closeOnBackdrop:!0,dismissible:!0,children:(0,t.jsx)(ed,{})}):(0,t.jsx)(g.AnimatePresence,{children:ec&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.motion.div,{initial:{opacity:0}
3,animate:{opacity:1},exit:{opacity:0},transition:{duration:h.durations.normal/1e3},className:"fixed inset-0 z-dropdown bg-surface-950/50 dark:bg-surface-950/50",onClick:()=>E(!0),"aria-hidden":"true"}),(0,t.jsx)(p.motion.div,{ref:G,initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",stiffness:300,damping:30},className:(0,n.cn)("fixed top-0 bottom-0 right-0 z-overlay","w-[400px] max-w-[calc(100vw-2rem)]","bg-background shadow-hive-lg","flex flex-col","hidden md:flex"),role:"dialog","aria-modal":"true","aria-labelledby":"ai-assistant-title","aria-describedby":ei?"ai-assistant-subtitle":void 0,"data-sidebar":"true",children:(0,t.jsx)(ed,{})})]})})]}):null}],559391)}]); 4 5//# sourceMappingURL=0nophsgjd89rx.js.map 6//# debugId=8025b8a9-884b-54d8-82d5-507de73cd018
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.