/*! Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one or more contributor license agreements. * Licensed under the Elastic License 2.0; you may not use this file except in compliance with the Elastic License 2.0. */ (window.osquery_bundle_jsonpfunction=window.osquery_bundle_jsonpfunction||[]).push([[13],{176:function(e,t,i){"use strict";i.r(t),i.d(t,"OsqueryAction",(function(){return h})),i.d(t,"default",(function(){return h}));var s=i(7),n=i.n(s),l=i(6),c=i(1),o=i.n(c),a=i(14),u=i(62),j=i(28),d=i(0);const r=()=>Object(d.jsx)(l.EuiEmptyPrompt,{icon:Object(d.jsx)(u.a,null),title:Object(d.jsx)("h2",null,j.e),titleSize:"xs",body:Object(d.jsx)("p",null,j.b)}),b=()=>Object(d.jsx)(l.EuiEmptyPrompt,{icon:Object(d.jsx)(u.a,null),title:Object(d.jsx)("h2",null,j.e),titleSize:"xs",body:Object(d.jsx)("p",null,j.c)});var p=i(4),O=i(97),y=i(15),x=i(74),g=i(9),m=i(103);const v=({agentId:e,formType:t="simple",defaultValues:i,hideAgentsField:s,onSuccess:o})=>{const v=Object(p.e)().services.application.capabilities.osquery,{osqueryAvailable:h,agentFetched:E,isLoading:f,policyFetched:q,policyLoading:S,agentData:F}=(e=>{const{data:t,isFetched:i,isLoading:s}=Object(m.a)({agentId:e,silent:!0,skip:!e}),{data:n,isFetched:l,isError:o,isLoading:a}=Object(x.b)({policyId:null==t?void 0:t.policy_id,skip:!t,silent:!0});return{osqueryAvailable:Object(c.useMemo)((()=>{if(o)return!1;const e=Object(y.find)(null==n?void 0:n.package_policies,["package.name",g.OSQUERY_INTEGRATION_NAME]);return!Object(y.isString)(e)&&!(null==e||!e.enabled)}),[null==n?void 0:n.package_policies,o]),agentFetched:i,isLoading:s,policyFetched:l,policyLoading:a,agentData:t}})(e);return e&&E&&!F?Object(d.jsx)(r,null):v.runSavedQueries&&v.readSavedQueries||v.writeLiveQueries?e&&f||e&&!q&&S?Object(d.jsx)(l.EuiSkeletonText,{lines:10}):e&&!h?Object(d.jsx)(b,null):e&&"online"!==(null==F?void 0:F.status)?Object(d.jsx)(l.EuiEmptyPrompt,{icon:Object(d.jsx)(u.a,null),title:Object(d.jsx)("h2",null,j.e),titleSize:"xs",body:Object(d.jsx)("p",null,j.a)}):Object(d.jsx)(O.a,n()({formType:t,agentId:e,hideAgentsField:s,onSuccess:o},i)):Object(d.jsx)(l.EuiEmptyPrompt,{icon:Object(d.jsx)(u.a,null),title:Object(d.jsx)("h2",null,j.d),titleSize:"xs",body:Object(d.jsx)("p",null,Object(d.jsx)(a.FormattedMessage,{id:"xpack.osquery.action.missingPrivileges",defaultMessage:"To access this page, ask your administrator for {osquery} Kibana privileges.",values:{osquery:Object(d.jsx)(l.EuiCode,null,"osquery")}}))})};v.displayName="OsqueryAction";const h=o.a.memo(v)}}]);