PageSourceSearch

https://lpcwashingtondc.com/assets/software-dc1bc8fb4271a1311abe.js

js lpcwashingtondc.com collected 2026-10-04 12:18:20 UTC 256,895 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_fleetdm_fleet=self.webpackChunk_fleetdm_fleet||[]).push([[944],{19:function(e,t,a){a.d(t,{A:function(){return k}});var l=a(96540),n=a(92308),r=a(81607),i=a(2095),o=a(42008),s=a(32485),c=a.n(s),u=a(74953),d=a(52978),m=a(76190),p=a(36257),f=Object.defineProperty,v=Object.defineProperties,g=Object.getOwnPropertyDescriptors,E=Object.getOwnPropertySymbols,b=Object.prototype.hasOwnProperty,y=Object.prototype.propertyIsEnumerable,_=(e,t,a)=>t in e?f(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,h=(e,t)=>{for(var a in t||(t={}))b.call(t,a)&&_(e,a,t[a]);if(E)for(var a of E(t))y.call(t,a)&&_(e,a,t[a]);return e},A=(e,t)=>v(e,g(t));const w="actions-dropdown",S=e=>e.isFocused?o.l["ui-fleet-black-5"]:"transparent",T=e=>"secondary"===e?o.l["ui-off-white"]:"initial",C=e=>{switch(e){case"right":return"auto";case"left":return"0";default:return"undefined"}},I=e=>{switch(e){case"right":return"0";case"left":return"auto";default:return"undefined"}},x=e=>{const{isFocused:t,selectProps:a}=e,r=a.variant,i=t||a.menuIsOpen||"subdued"===r||"secondary"===r?"ui-fleet-black-75":"core-fleet-black";return l.createElement(n.c.DropdownIndicator,A(h({},e),{className:w}),l.createElement(d.A,{name:"chevron-down",color:i,size:"secondary"===r?"small":void 0,className:`${w}__icon`}))},P=e=>{const{innerRef:t,data:a,isDisabled:r}=e,i=l.createElement("div",{className:`${w}__option`,"data-testid":"dropdown-option",ref:t,tabIndex:r?-1:0,"aria-disabled":r},a.label,a.helpText&&l.createElement("span",{className:`${w}__help-text`},a.helpText));return l.createElement(n.c.Option,h({},e),a.tooltipContent?l.createElement(m.A,{tipContent:a.tooltipContent},i):i)};var k=({options:e,placeholder:t,onChange:a,disabled:n,isSearchable:s=!1,className:m,menuAlign:f="default",menuPlacement:v,variant:g="subdued",buttonLabel:E,triggerIcon:b})=>{const y=c()(w,m),{insideTable:_}=(0,l.useContext)(p.A),[k,O]=(0,l.useState)(!1),N=(0,l.useRef)(null),F=(0,l.useRef)(null),[$,L]=(0,l.useState)(!1);(0,l.useEffect)(()=>{const e=e=>{"Tab"===e.key&&L(!0)},t=()=>{L(!1)};return document.addEventListener("keydown",e),document.addEventListener("mousedown",t),()=>{document.removeEventListener("keydown",e),document.removeEventListener("mousedown",t)}},[]),(0,l.useEffect)(()=>{const e=e=>{if(!k||!F.current)return;const t=e.target;t instanceof Node&&(F.current.contains(t)||t instanceof Element&&t.closest(`.${w}-select__menu-portal`)||O(!1))};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[k]);const D="primary"===g,R=!!b,V=()=>O(e=>!e),j={control:(e,t)=>h(h(A(h({},e),{display:"flex",flexDirection:"row",gap:"8px",width:"max-content",minHeight:"secondary"===g?"28px":"32px",padding:"secondary"===g?"4px 8px":"8px",backgroundColor:T(g),border:"secondary"===g?`1px solid ${o.l["ui-fleet-black-25"]}`:0,boxSizing:"border-box",boxShadow:"none",cursor:"pointer","&:hover":{background:o.l["ui-fleet-black-5"],boxShadow:"none",".actions-dropdown-select__placeholder":{color:o.l["ui-fleet-black-75-over"]},".actions-dropdown-select__indicator path":{stroke:o.l["ui-fleet-black-75-over"]}},"&:active":{background:"secondary"===g?o.l["ui-fleet-black-10"]:o.l["ui-fleet-black-5"],".actions-dropdown-select__indicator path":{stroke:o.l["ui-fleet-black-75-down"]}}}),t.menuIsOpen&&{background:o.l["ui-fleet-black-5"],".actions-dropdown-select__indicator svg":{transform:"rotate(180deg)",transition:"transform 0.25s ease"}}),t.isFocused&&$&&{outline:`1px solid ${o.l["core-fleet-black"]}`,outlineOffset:"-1px"}),placeholder:(e,t)=>h(A(h({},e),{color:t.isFocused||"subdued"===g||"secondary"===g?o.l["ui-fleet-black-75"]:o.l["core-fleet-black"],fontSize:"14px",fontWeight:"subdued"===g||"secondary"===g?"600":void 0,lineHeight:"normal",paddingLeft:0,margin:0}),t.isDisabled&&{filter:"grayscale(0.5)",opacity:.5}),dropdownIndicator:(e,t)=>h(A(h({},e),{display:"flex",padding:"2px",svg:{transition:"transform 0.25s ease"}}),t.isDisabled&&{filter:"grayscale(0.5)",opacity:.5}),container:e=>h(h({},e),R&&{position:"absolute",inset:0,pointerEvents:"none"}),menu:e=>h(A(h({},e),{backgroundColor:o.l["core-fleet-white"],boxShadow:`0 2px 6px rgba(0, 0, 0, 0.1), 0 0 0 1px ${o.l["ui-fleet-black-10"]}`,borderRadius:"4px",zIndex:6,border:0,marginTop:D?"20px":"0",marginBottom:D?"20px":"0",width:"auto",minWidth:"100%",position:"absolute",left:C(f),right:I(f),animation:"fade-in 150ms ease-out"}),R&&{marginTop:"1px",marginBottom:"1px",pointerEvents:"auto"}),menuPortal:e=>A(h({},e),{zIndex:999}),menuList:e=>A(h({},e),{padding:i.K["pad-small"],maxHeight:"initial"}),valueContainer:e=>A(h({},e),{padding:0}),option:(e,t)=>h(A(h({},e),{padding:"10px 8px",borderRadius:"4px",fontSize:"13px",backgroundColor:S(t),whiteSpace:"nowrap",cursor:t.isDisabled?"not-allowed":"pointer","&:hover":{backgroundColor:t.isDisabled?"transparent":o.l["ui-fleet-black-5"]},"&:active":{backgroundColor:t.isDisabled?"transparent":o.l["ui-fleet-black-5"]}}),t.isDisabled&&{color:o.l["ui-fleet-black-50"],fontStyle:"italic"})},U=c()(`${w}__wrapper`,{[`${w}__wrapper--icon-trigger`]:R});return l.createElement("div",{className:U,ref:F},D&&l.createElement(u.A,{type:"button",onClick:()=>O(e=>!e),className:`${w}__button`,disabled:n,"aria-haspopup":"listbox","aria-expanded":k},l.createElement("span",null,E||"Actions"),l.createElement(d.A,{name:"chevron-down",color:"core-fleet-white",className:"actions-dropdown__icon"+(k?" actions-dropdown__icon--open":"")})),R&&l.createElement(u.A,{type:"button",variant:"secondary",onClick:V,customOnKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),V())},className:`${w}__icon-trigger`,disabled:n,ariaHasPopup:"listbox",ariaExpanded:k,ariaLabel:t},b&&l.createElement(d.A,{name:b})),l.createElement(r.Ay,h({ref:N,options:e,placeholder:D||R?"":t,onChange:e=>{e&&(a(e.value.toString()),O(!1))},isDisabled:n,isSearchable:s,styles:j,menuIsOpen:k,onMenuOpen:()=>O(!0),onMenuClose:()=>O(!1),components:h({DropdownIndicator:x,IndicatorSeparator:()=>null,Option:P,SingleValue:()=>null},(D||R)&&{Control:()=>null}),controlShouldRenderValue:!1,isOptionSelected:()=>!1,value:null,className:y,classNamePrefix:`${w}-select`,isOptionDisabled:e=>!!e.disabled,menuPlacement:null!=v?v:_?"auto":"bottom",menuPortalTarget:_?document.body:void 0},{variant:g})))}},96470:function(e,t,a){var l=a(96540),n=a(45584),r=Object.defineProperty,i=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,c=(e,t,a)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;const u=l.lazy(()=>Promise.all([a.e(124),a.e(19),a.e(638)]).then(a.bind(a,73339)));t.A=e=>l.createElement(l.Suspense,{fallback:l.createElement(n.A,{verticalPadding:"small"})},l.createElement(u,((e,t)=>
1{for(var a in t||(t={}))o.call(t,a)&&c(e,a,t[a]);if(i)for(var a of i(t))s.call(t,a)&&c(e,a,t[a]);return e})({},e)))},70699:function(e,t,a){a.d(t,{A:function(){return c}});var l=a(81766),n=a(36291),r=a(99958),i=a(2543),o=a(96540);const s="file-progress-modal";var c=({graphicNames:e="file-pkg",fileDetails:t,fileProgress:a})=>o.createElement(r.A,{className:s,title:"Add software",width:"large",onExit:i.noop,disableClosingModal:!0},o.createElement(l.A,{color:"grey",className:`${s}__card`},o.createElement(n.A,{graphicNames:e,fileDetails:t,progress:a,canEdit:!1,onFileSelect:i.noop})))},5719:function(e,t,a){a.d(t,{A:function(){return r}});var l=a(96540),n=a(431),r=({hostCount:e,lastUpdatedAt:t})=>{const a=l.createElement(l.Fragment,null,"The last time host data was updated. ",l.createElement("br",null),"Click the host count to see the most",l.createElement("br",null)," up-to-date host count.");return l.createElement("div",{className:"last-updated-host-count"},l.createElement(l.Fragment,null,e),void 0!==t&&l.createElement(n.A,{lastUpdatedAt:t,customTooltipText:a}))}},431:function(e,t,a){a.d(t,{A:function(){return o}});var l=a(96540),n=a(30178),r=a(9467),i=a(52603),o=({lastUpdatedAt:e,whatToRetrieve:t,customTooltipText:a})=>{e=e&&"0001-01-01T00:00:00Z"!==e?(0,r.yo)((0,n.fF)(new Date(e),{addSuffix:!0,strict:!0})):"never";const o=a||l.createElement(l.Fragment,null,"Fleet periodically queries all hosts ",l.createElement("br",null),"to retrieve ",t,".");return l.createElement("span",{className:"component__last-updated-text"},l.createElement(i.A,{tipContent:o},`Updated ${e}`))}},48571:function(e,t,a){a.d(t,{A:function(){return s}});var l=a(96540),n=a(24432),r=a(52603),i=a(12968),o=a(89937),s=({androidPlayStoreId:e})=>l.createElement(r.A,{tipContent:l.createElement("span",null,"See latest version on the"," ",l.createElement(n.A,{text:"Play Store",url:(0,i.M8)(o.nQ,{id:e}),newTab:!0,variant:"tooltip-link"}))},l.createElement("span",null,"Latest"))},39435:function(e,t,a){var l=a(96540),n=a(89937),r=a(9467),i=a(52978),o=a(52603);const s="probability-of-exploit";t.A=({probabilityOfExploit:e,cisaKnownExploit:t,tooltipPosition:a="top"})=>"number"!=typeof e?l.createElement("span",{className:`${s}__unknown`},n.r2):l.createElement("span",{className:s},(0,r.i8)(e),t&&l.createElement(o.A,{tipContent:l.createElement(l.Fragment,null,"The vulnerability has been actively exploited in the wild. This data is reported by the Cybersecurity and Infrastructure Security Agency (CISA)."),position:a,underline:!1,showArrow:!0,tipOffset:8},l.createElement(i.A,{name:"error",size:"small",color:"status-error"})))},98220:function(e,t,a){var l=a(96540),n=a(45584),r=Object.defineProperty,i=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,c=(e,t,a)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;const u=l.lazy(()=>Promise.all([a.e(124),a.e(19),a.e(638)]).then(a.bind(a,80999)));t.A=e=>l.createElement(l.Suspense,{fallback:l.createElement(n.A,{verticalPadding:"small"})},l.createElement(u,((e,t)=>{for(var a in t||(t={}))o.call(t,a)&&c(e,a,t[a]);if(i)for(var a of i(t))s.call(t,a)&&c(e,a,t[a]);return e})({},e)))},96948:function(e,t,a){a.d(t,{A:function(){return o}});var l=a(96540),n=a(32485),r=a.n(n);const i="section-header";var o=({title:e,subTitle:t,details:a,wrapperCustomClass:n,alignLeftHeaderVertically:o,greySubtitle:s})=>{const c=r()(i,n),u=r()(`${i}__left-header`,{[`${i}__left-header--vertical`]:o}),d=r()(`${i}__sub-title`,{[`${i}__sub-title--grey`]:s});return l.createElement("div",{className:c},l.createElement("div",{className:u},l.createElement("h2",null,e),t&&l.createElement("div",{className:d},t)),a&&l.createElement("div",{className:`${i}__right-header`},a))}},40925:function(e,t,a){a.d(t,{A:function(){return l.A}});var l=a(72828)},81790:function(e,t,a){a.d(t,{A:function(){return l.A}});var l=a(3798)},48392:function(e,t,a){a.d(t,{A:function(){return r}});var l=a(96540),n=a(82196),r=({isOnGlobalTeam:e,currentTeamId:t,userTeams:a=[],onTeamChange:r})=>{if(a){if(a.length>1||e)return l.createElement(n.A,{currentUserFleets:a,selectedFleetId:t,onChange:r,includeUnassigned:!0});if(1===a.length&&!e)return l.createElement("h1",null,a[0].name)}return l.createElement(l.Fragment,null)}},24039:function(e,t,a){a.d(t,{A:function(){return u}});var l=a(96540),n=a(32485),r=a.n(n),i=a(74953),o=a(52603);const s="truncated-text-list",c=e=>l.createElement(l.Fragment,null,e.map((t,a)=>l.createElement(l.Fragment,{key:t},t,a<e.length-1&&l.createElement("br",null))));var u=({items:e,separator:t=", ",tooltipPosition:a="top",truncatedFirstMaxChars:n=30,onClick:u,className:d})=>{const m=(0,l.useRef)(null),p=(0,l.useRef)([]),f=(0,l.useRef)(null),[v,g]=(0,l.useState)(e.length);if((0,l.useLayoutEffect)(()=>{const t=()=>{var t,a;if(!m.current)return;const l=m.current.getBoundingClientRect().width-16,n=null!=(a=null==(t=f.current)?void 0:t.getBoundingClientRect().width)?a:0,r=p.current.map(e=>{var t;return null!=(t=null==e?void 0:e.getBoundingClientRect().width)?t:0});if(r.reduce((e,t)=>
1e+t,0)<=l)return void g(e.length);let i=0,o=0;for(let e=0;e<r.length&&!(i+r[e]+n>l);e+=1)i+=r[e],o+=1;g(o)};if(t(),!m.current)return;const a=new ResizeObserver(t);return a.observe(m.current),()=>a.disconnect()},[e]),0===e.length)return null;const E=e.slice(0,v),b=e.slice(v);return l.createElement("div",{ref:m,className:r()(s,d)},l.createElement("div",{className:`${s}__measure`,"aria-hidden":!0},e.map((e,a)=>l.createElement("span",{key:`measure-${e}-${a}`,ref:e=>{p.current[a]=e}},a>0?t:"",e)),l.createElement("span",{ref:f},t,"+",e.length," more")),(({visibleCount:e,visible:t,hidden:a,items:n,separator:u,tooltipPosition:d,truncatedFirstMaxChars:m,onClick:p})=>{var f,v;const g=(b=m,(E=null!=(f=n[0])?f:"").length>b?`${E.slice(0,b).trimEnd()}...`:E);var E,b;const y=g!==(null!=(v=n[0])?v:""),_=l.createElement(l.Fragment,null,y?l.createElement(o.A,{tipContent:n[0],showArrow:!0,underline:!1,position:d,tipOffset:8,fixedPositionStrategy:!0},l.createElement("span",null,g)):l.createElement("span",null,g),n.length>1&&l.createElement(l.Fragment,null,u,l.createElement(o.A,{tipContent:c(n.slice(1)),showArrow:!0,underline:!1,position:d,tipOffset:8,fixedPositionStrategy:!0},l.createElement("span",{className:`${s}__more`},"+",n.length-1," more")))),h=l.createElement(l.Fragment,null,t.join(u),a.length>0&&l.createElement(l.Fragment,null,t.length>0?u:"",l.createElement(o.A,{tipContent:c(a),showArrow:!0,underline:!1,position:d,tipOffset:8,fixedPositionStrategy:!0},l.createElement("span",{className:`${s}__more`},"+",a.length," more")))),A=0===e,w=A?_:h,S=r()(`${s}__visible`,{[`${s}__visible--truncated`]:A});return p?l.createElement(i.A,{variant:"link",className:S,onClick:p},l.createElement("span",null,w)):l.createElement("span",{className:S},w)})({visibleCount:v,visible:E,hidden:b,items:e,separator:t,tooltipPosition:a,truncatedFirstMaxChars:n,onClick:u}))}},67050:function(e,t,a){a.d(t,{A:function(){return o}});var l=a(96540),n=a(32485),r=a.n(n);const i="upload-list";var o=({keyAttribute:e,listItems:t,HeadingComponent:a,ListItemComponent:n,className:o})=>{const s=t.map(t=>l.createElement("li",{key:e?`${t[e]}`:`${t}`,className:`${i}__list-item`},l.createElement(n,{listItem:t}))),c=r()(i,o);return l.createElement("div",{className:c},a&&l.createElement("div",{className:`${i}__header`},l.createElement(a,null)),l.createElement("ul",{className:`${i}__list`},s))}},85396:function(e,t,a){a.d(t,{A:function(){return o}});var l=a(96540),n=a(32485),r=a.n(n),i=a(74953),o=({onClick:e,disabled:t,className:a,size:n})=>{const o=r()("automations-button",a);return l.createElement(i.A,{className:o,onClick:e,disabled:t,variant:"secondary",size:n},"Manage automations")}},33427:function(e,t,a){var l=a(96540),n=a(32485),r=a.n(n),i=a(2543),o=a(25663),s=a(52603),c=Object.defineProperty,u=Object.defineProperties,d=Object.getOwnPropertyDescriptors,m=Object.getOwnPropertySymbols,p=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable,v=(e,t,a)=>t in e?c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;const g="fleet-slider";t.A=e=>{const{onChange:t,value:a,inactiveText:n,activeText:c,labelTooltip:E,autoFocus:b,disabled:y}=e,_=(0,l.useRef)(null);(0,l.useEffect)(()=>{b&&_.current&&_.current.focus()},[b]);const h=r()(g,{[`${g}--active`]:a}),A=r()(`${g}__dot`,{[`${g}__dot--active`]:a}),w=(0,i.pick)(e,["helpText","label","error","name","className","disabled"]),S=r()(`${g}__wrapper`,{[`${g}__wrapper--disabled`]:y}),T=a?c:n;return l.createElement(o.A,(C=((e,t)=>{for(var a in t||(t={}))p.call(t,a)&&v(e,a,t[a]);if(m)for(var a of m(t))f.call(t,a)&&v(e,a,t[a]);return e})({},w),u(C,d({type:"slider"}))),l.createElement("div",{className:S},l.createElement("button",{role:"switch","aria-checked":a,className:`button button--unstyled ${h}`,onClick:e=>{e.preventDefault(),y||t()},disabled:y,ref:_},l.createElement("div",{className:A})),E?l.createElement(s.A,{tipContent:E}," ",l.createElement("span",{className:`${g}__label ${g}__label--${a?"active":"inactive"}`},T)):l.createElement("span",{className:`${g}__label ${g}__label--${a?"active":"inactive"}`},T)));var C}},26806:function(e,t,a){a.d(t,{A:function(){return l.A}});var l=a(33427)},22184:function(e,t,a){a.d(t,{B4:function(){return s},Ni:function(){return n}});var l=a(72124);const n="Query text must be present",r=e=>({valid:!1,error:e}),i={valid:!0,error:null},o=new l.Parser,s=e=>{if(!(null==e?void 0:e.trim()))return r(n);try{return o.astify(e,{database:"sqlite"}),i}catch(e){return r("Syntax error. Please review before saving.")}}},37863:function(e,t,a){a.d(t,{A:function(){return q}});var l=a(96540),n=a(67694),r=a(41995),i=a(44515),o=a(93250),s=a(32485),c=a.n(s),u=a(2543),d=a(98220),m=a(24432),p=Object.defineProperty,f=Object.getOwnPropertySymbols,v=Object.prototype.hasOwnProperty,g=Object.prototype.propertyIsEnumerable,E=(e,t,a)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;const b="fleet-markdown";var y=({markdown:e,className:t,name:a})=>{const n=c()(b,t);return l.createElement("div",{className:n},l.createElement(i.oz,{remarkPlugins:[o.A],components:{a:({href:e="",children:t})=>l.createElement(m.A,{text:String(t),url:e,newTab:!0}),pre:({children:e})=>{var t;let n="";if(l.isValidElement(e)){const a=null==(t=e.props)?void 0:t.children;n=String(a||"")}else n=String(e||"");return l.createElement("pre",null,l.createElement(d.A,{wrapperClassName:`${b}__ace-display`,value:n.replace(/\n$/,""),showGutter:!1,onBlur:e=>{e&&e.clearSelection()},onLoad:e=>{e.setOptions({indentedSoftWrap:!1}
1),e.renderer.visualizeFocus=u.noop},style:{border:"none"},wrapEnabled:!0,readOnly:!0,name:a}))},code:e=>{var t=e,{children:a}=t,n=((e,t)=>{var a={};for(var l in e)v.call(e,l)&&t.indexOf(l)<0&&(a[l]=e[l]);if(null!=e&&f)for(var l of f(e))t.indexOf(l)<0&&g.call(e,l)&&(a[l]=e[l]);return a})(t,["children"]);return l.createElement("code",((e,t)=>{for(var a in t||(t={}))v.call(t,a)&&E(e,a,t[a]);if(f)for(var a of f(t))g.call(t,a)&&E(e,a,t[a]);return e})({},n),a)}}},e))},_=a(45847),h=a(83535),A=a(52603),w=a(12968);const S="column-list-item",T=(e,t)=>l.createElement(l.Fragment,null,l.createElement("span",{className:`${S}__column-description`},e.description),e.required&&l.createElement("span",{className:`${S}__footnote`},"Required in WHERE clause."),e.requires_user_context&&(()=>{const e=`https://fleetdm.com/guides/osquery-consider-joining-against-the-users-table?${(0,w.IM)({utm_source:"fleet-ui",utm_table:`table-${t}`})}`,a=c()(`${S}__footnote`,`${S}__footnote-link`);return l.createElement("a",{href:e,target:"__blank",className:a},"$","Defaults to root.")})(),e.hidden&&l.createElement("span",{className:`${S}__footnote`},"Not returned in SELECT * FROM ",t),e.platforms&&(e=>{let t;switch(e.length){case 1:t=e[0];break;case 2:t=`${e[0]} and ${e[1]}`;break;case 3:t=`${e[0]}, ${e[1]}, and ${e[2]}`;break;default:t=e.join(", ")}return l.createElement("span",{className:`${S}__footnote`},"Only available on"," ",t)})(e.platforms)),C=e=>e.required||e.requires_user_context||void 0!==e.platforms&&0!==e.platforms.length;var I=({column:e,selectedTableName:t})=>{const a=(e=>c()(`${S}__name`,{[`${S}__has-footnotes`]:C(e)}))(e);return l.createElement("li",{key:e.name,className:S},l.createElement("div",{className:`${S}__name-wrapper`},l.createElement("span",{className:a},l.createElement(A.A,{tipContent:T(e,t),className:`${S}__tooltip`},e.name)),e.required&&l.createElement("span",{className:`${S}__asterisk`},"*")),l.createElement("span",{className:`${S}__type`},e.type.replace("_"," ").toUpperCase()))};const x=(e,t)=>e.name.localeCompare(t.name),P="query-table-columns";var k=({columns:e})=>{const{selectedOsqueryTable:t}=(0,l.useContext)(h.c),a=(e=>{const t=e.filter(e=>e.required),a=e.filter(e=>!e.required);return[...t.sort(x),...a.sort(x)]})(e).map(e=>l.createElement(I,{key:e.name,column:e,selectedTableName:t.name}));return l.createElement("div",{className:P},l.createElement("h3",null,"Columns"),l.createElement("ul",{className:`${P}__column-list`},a))},O=a(89937),N=a(52978);const F=({platform:e})=>l.createElement("li",{key:e,className:"platform-list-item"},l.createElement(N.A,{name:e}),l.createElement("span",null,O.uc[e])),$=["darwin","windows","linux","chrome"],L="query-table-platforms";var D=({platforms:e})=>{const t=e.filter(e=>"freebsd"!==e).sort((e,t)=>$.indexOf(e)-$.indexOf(t)).map(e=>l.createElement(F,{key:e,platform:e}));return l.createElement("div",{className:L,"data-testid":"compatibility"},l.createElement("h3",null,"Compatible with"),l.createElement("ul",{className:`${L}__platform-list`},t))},R=({example:e})=>l.createElement("div",{className:"query-table-example"},l.createElement("h3",null,"Example"),l.createElement(y,{markdown:e,name:"query-table-example"}));const V="query-table-notes";var j=({notes:e})=>l.createElement("div",{className:V},l.createElement("h3",null,"Notes"),l.createElement(y,{markdown:e,className:`${V}__notes-markdown`})),U=({selectedTableName:e})=>{const t=(0,w.IM)({utm_source:"fleet-ui",utm_table:`table-${e}`});return l.createElement("a",{href:`https://fleetdm.com/guides/osquery-evented-tables-overview?${t}`,className:"evented-table-tag",target:"__blank"},l.createElement(N.A,{name:"calendar-check"}),l.createElement("span",null,"EVENTED TABLE"))};const M="query-side-panel";var q=({selectedOsqueryTable:e,onOsqueryTableSelect:t,onClose:a})=>{const{name:i,description:o,platforms:s,columns:c,examples:u,notes:d,evented:p}=e,f="managed_policies"===i,v=e=>{e&&t(e.value)};return l.createElement(l.Fragment,null,l.createElement("div",{role:"button",className:`${M}__close-button`,tabIndex:0,onClick:a,onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||a()}},l.createElement(_.A,{name:"close",color:"ui-fleet-black-50",size:"small"})),l.createElement("div",{className:`${M}__choose-table`},l.createElement("h2",{className:`${M}__header`},"Tables",l.createElement("span",{className:`${M}__table-count`},n.NC.length)),(()=>{const e=n.NC.map(e=>({label:e,value:e}));return l.createElement(r.A,{name:"osquery-table-select",options:e,value:i,onChange:v,placeholder:"Select a table",className:`${M}__table-select`,isSearchable:!0})})()),p&&l.createElement(U,{selectedTableName:i}),f&&l.createElement("span",{className:`${M}__mdm-required`},"Requires MDM"),l.createElement("div",{className:`${M}__description`},l.createElement(y,{markdown:o})),l.createElement(D,{platforms:s}),l.createElement(k,{columns:c}),u&&l.createElement(R,{example:u}),d&&l.createElement(j,{notes:d}),l.createElement(m.A,{url:`https://www.fleetdm.com/tables/${i}`,text:"Source",newTab:!0}))}},63898:function(e,t,a){var l=a(96540);t.A=e=>{(0,l.useEffect)(()=>
1{if(!e)return;const t=e=>{e.preventDefault(),e.returnValue=!0};return addEventListener("beforeunload",t),()=>removeEventListener("beforeunload",t)},[e])}},7714:function(e,t,a){var l=a(96540);t.A=e=>{const[t,a]=(0,l.useState)(e),n=(0,l.useCallback)(()=>{a(!t)},[a,t]),r=(0,l.useCallback)(e=>{a(e)},[a]);return{isSidePanelOpen:t,toggleSidePanel:n,setSidePanelOpen:r}}},77906:function(e,t,a){a.d(t,{Wf:function(){return n},Xh:function(){return r},fx:function(){return l}});const l=30,n=e=>{const t=null==e?void 0:e.conditional_access;return!!((null==t?void 0:t.okta_idp_id)&&(null==t?void 0:t.okta_assertion_consumer_service_url)&&(null==t?void 0:t.okta_audience_uri)&&(null==t?void 0:t.okta_certificate))},r=e=>n(e)||(e=>{var t,a;return null!=(a=null==(t=null==e?void 0:e.conditional_access)?void 0:t.microsoft_entra_connection_configured)&&a})(e)},49817:function(e,t,a){a.d(t,{t4:function(){return n},uG:function(){return l},xE:function(){return r}});const l={darwin:"Apple",windows:"Microsoft"},n={darwin:"https://endoflife.date/macos",windows:"https://endoflife.date/windows"},r=e=>{let t=e;return t.startsWith("Microsoft Windows")&&(t=t.replace("Microsoft Windows","Windows")),t}},93588:function(e,t,a){var l=a(96540),n=a(12968),r=a(78263),i=a(49817),o=a(56906),s=a(75679),c=a(40925),u=a(2837),d=a(24228),m=a(52603),p=a(24432),f=a(29844),v=a(90581),g=a(43015),E=a(64018);t.A=(e,t,a)=>{let b=((e,t,a)=>[{Header:"Name",disableSortBy:!0,accessor:"name_only",Cell:o=>{if(!(null==a?void 0:a.includeIcon))return l.createElement(s.A,{value:o.cell.value,formatter:e=>(0,i.xE)(e)});const{name_only:c,os_version_id:u,platform:m}=o.row.original,p=(0,n.M8)(r.A.SOFTWARE_OS_DETAILS(u),{fleet_id:e});return l.createElement(d.A,{path:p,customOnClick:e=>{e.stopPropagation(),null==t||t.push(p)},tooltipTruncate:!0,prefix:l.createElement(v.A,{name:m}),value:c})}},{Header:"Version",disableSortBy:!0,Cell:e=>{const{version:t,name_only:a}=e.row.original;return o.DN.includes(a)&&"rolling"===t?l.createElement(s.A,{value:l.createElement(E.A,{capitalized:!0})}):l.createElement(s.A,{value:t})}},{Header:"Vulnerabilities",disableSortBy:!0,accessor:"vulnerabilities",Cell:e=>{const t=e.row.original.platform;return(0,g._7)(t)?l.createElement(m.A,{tipContent:l.createElement(l.Fragment,null,"Vulnerabilities are currently supported on",l.createElement("br",null),"macOS, Windows, Linux, and Android."," ",l.createElement(p.A,{url:"https://fleetdm.com/guides/vulnerability-processing#coverage",variant:"tooltip-link",text:"Learn more",newTab:!0})),position:"top",underline:!1,showArrow:!0,fixedPositionStrategy:!0},l.createElement(s.A,{value:"Not supported",grey:!0})):l.createElement(f.A,{vulnerabilities:e.cell.value,vulnerabilitiesCount:e.row.original.vulnerabilities_count})}},{Header:e=>l.createElement(c.A,{value:"Hosts",disableSortBy:!1,isSortedDesc:e.column.isSortedDesc}),disableSortBy:!1,accessor:"hosts_count",Cell:e=>{const{hosts_count:t}=e.row.original;return l.createElement("span",{className:"hosts-cell__count"},l.createElement(s.A,{value:t}))}},{Header:"",id:"view-all-hosts",disableSortBy:!0,Cell:t=>{const{os_version_id:a}=t.row.original;return l.createElement(u.A,{queryParams:{os_version_id:a,fleet_id:e},className:"os-hosts-link",rowHover:!0})}}])(e,t,a);return(null==a?void 0:a.includeName)||(b=b.filter(e=>"name_only"!==e.accessor)),(null==a?void 0:a.includeVulnerabilities)||(b=b.filter(e=>"vulnerabilities"!==e.accessor)),b}},37965:function(e,t,a){a.r(t),a.d(t,{default:function(){return ie}});var l=a(96540),n=a(78263),r=a(12968),i=a(41995),o=a(75942),s=a(68774),c=a(82635),u=a(77931),d=a(97873),m=a(89937),p=a(46157),f=a(2367),v=a(24432),g=a(79519),E=a(45584),b=a(17981),y=a(74953),_=a(72753),h=a(26783),A=a(12755),w=a(54184),S=Object.defineProperty,T=Object.defineProperties,C=Object.getOwnPropertyDescriptors,I=Object.getOwnPropertySymbols,x=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,k=(e,t,a)=>t in e?S(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,O=(e,t)=>{for(var a in t||(t={}))x.call(t,a)&&k(e,a,t[a]);if(I)for(var a of I(t))P.call(t,a)&&k(e,a,t[a]);return e},N=(e,t)=>T(e,C(t));const F="software-app-store-vpp",$=({onEnableVpp:e,isGlobalAdmin:t})=>l.createElement(f.A,{variant:"list",header:"Volume Purchasing Program (VPP) isn't enabled",info:t?"Enable VPP to add App Store apps (MDM required).":"To add App Store apps, ask your admin to enable VPP.",primaryButton:t?l.createElement(y.A,{onClick:e},"Enable VPP"):void 0}),L=({onEditVpp:e,isGlobalAdmin:t})=>l.createElement(f.A,{variant:"list",header:"This fleet isn't added to Volume Purchasing Program (VPP)",info:t?"To add App Store apps, first add this fleet to VPP.":"To add App Store apps, ask your admin to add this fleet to VPP.",primaryButton:t?l.createElement(y.A,{onClick:e},"Edit VPP"):void 0}),D=()=>l.createElement(f.A,{variant:"list",header:"You don't have any App Store apps",info:l.createElement(l.Fragment,null,"You must purchase apps in"," ",l.createElement(v.A,{url:`${m.CW}/abm-apps`,text:"Apple Business",newTab:!0}),l.createElement("br",null),"App Store apps that are already added to this fleet are not listed.")});var R=({currentTeamId:e,router:t})=>{const{isPremiumTier:a,isGlobalAdmin:i}=(0,l.useContext)(s.BR),f=(0,o.useQueryClient)(),[v,y]=(0,l.useState)(!1),[S,T]=(0,l.useState)(!1),[C,I]=(0,l.useState)(!1),{data:x,isLoading:P,error:k}=(0,o.useQuery)(["vppInfo",e],()=>c.A.getVppTokens(),N(O({},m.QL),{staleTime:3e4,retry:(e,t)=>404!==t.status&&e<=3})),{data:R,isLoading:V,isError:j}=(0,o.useQuery)(["custom_labels"],()=>d.Ay.summary(e).then(e=>(0,d.f2)(e.labels)),N(O({},m.QL),{enabled:a,staleTime:1e4})),U=!x||!x.vpp_tokens.length,M=((e,t)=>!(!t||0===t.length)&&t.some(t=>{var a,l;return 0===(null==(a=t.teams)?void 0:a.length)||(null==(l=t.teams)?void 0:l.some(t=>t.team_id===e))}))(e,null==x?void 0:x.vpp_tokens),{data:q,isLoading:B,error:H}=(0,o.useQuery)(["vppSoftware",e],()=>c.A.getVppApps(e),N(O({},m.QL),{enabled:M,staleTime:3e4,select:e=>e.app_store_apps})),z=e=>{T(!S),I(e||!1)};return l.createElement("div",{className:F},a?P||B||V?l.createElement(E.A,null):k||H||j?l.createElement(g.A,{verticalPaddingSize:"pad-xxxlarge"}):U?l.createElement($,{onEnableVpp:()=>t.push(n.A.ADMIN_INTEGRATIONS_VPP),isGlobalAdmin:i}):M?q?l.createElement("div",{className:`${F}__content`},l.createElement(h.A,{labels:R||[],onSubmit:a=>{return i=function*(){if(a.selectedApp){y(!0);try{const{software_title_id:i}=yield u.A.addAppStoreApp(e,a);p.me.success(l.createElement(l.Fragment,null,l.createElement("b",null,a.selectedApp.name)," successfully added.")),f.invalidateQueries({queryKey:[{scope:"softw
1are-titles"}]}),f.invalidateQueries({queryKey:[{scope:"software-library"}]}),f.invalidateQueries({queryKey:["vppSoftware",e]}),t.push((0,r.M8)(n.A.SOFTWARE_TITLE_DETAILS(i.toString()),{fleet_id:e}))}catch(e){p.me.error((e=>{const t=(0,A.F3)(e);if(t.toLowerCase().includes("already")){const e=(0,w.JZ)(t);if(e)return e;if(t.includes("VPPApp"))return`${w.wy} The software is already available to install in this fleet.`}return t?`${w.wy} ${(0,w.U_)(t)}`:w.Zx})(e),{response:e})}y(!1)}},new Promise((e,t)=>{var a=e=>{try{n(i.next(e))}catch(e){t(e)}},l=e=>{try{n(i.throw(e))}catch(e){t(e)}},n=t=>t.done?e(t.value):Promise.resolve(t.value).then(a,l);n((i=i.apply(null,null)).next())});var i},onCancel:()=>{t.push((0,r.M8)(n.A.SOFTWARE_LIBRARY,{fleet_id:e}))},onClickPreviewEndUserExperience:z,isLoading:v,vppApps:q}),S&&l.createElement(_.A,{onCancel:z,teamId:e,isIosOrIpadosApp:C})):l.createElement(D,null):l.createElement(L,{onEditVpp:()=>t.push(n.A.ADMIN_INTEGRATIONS_VPP),isGlobalAdmin:i}):l.createElement(b.A,{className:`${F}__premium-message`}))},V=a(32485),j=a.n(V),U=a(4346),M=a(80717),q=a(59333),B=a(30104),H=a(36321),z=a(65019),W=Object.defineProperty,Q=Object.defineProperties,K=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertySymbols,Y=Object.prototype.hasOwnProperty,Z=Object.prototype.propertyIsEnumerable,J=(e,t,a)=>t in e?W(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;const X="software-android-form";var ee=({softwareAndroidForEdit:e,onSubmit:t,isLoading:a=!1,onCancel:n})=>{const{gitOpsModeEnabled:r}=(0,U.A)("software"),[i,o]=(0,l.useState)(e?{applicationID:e.app_store_id||"",selfService:e.self_service||!1,automaticInstall:e.automatic_install||!1,targetType:(0,B.Ag)(e),customTarget:(0,B.lQ)(e),labelTargets:(0,B.ER)(e),categories:e.categories||[],platform:"android"}:{applicationID:"",selfService:!0,automaticInstall:!1,targetType:"All hosts",customTarget:"labelsIncludeAny",labelTargets:{},categories:[],platform:"android"}),[s,c]=(0,l.useState)({isValid:!!e}),u=!s.isValid,d=j()(`${X}__content-wrapper`,{[`${X}__content-disabled`]:a}),p=j()(`${X}__form-content`,{[`${X}__form-content--disabled`]:r});return l.createElement("form",{className:X,onSubmit:e=>{e.preventDefault(),t(i)}},a&&l.createElement("div",{className:`${X}__overlay`}),l.createElement("div",{className:d},l.createElement("div",{className:p},l.createElement(l.Fragment,null,e?null:l.createElement(l.Fragment,null,l.createElement("div",{className:`${X}__form-fields`},l.createElement(M.A,{autofocus:!0,label:"Application ID",placeholder:"com.android.chrome",helpText:l.createElement(l.Fragment,null,"The ID at the end of the app's"," ",l.createElement(v.A,{text:"Google Play URL",url:`${m.CW}/google-play-store`,newTab:!0})," ",'E.g. "com.android.chrome" from "https://play.google.com/store/apps/details?id=com.android.chrome"'),onChange:({name:e,value:t})=>{const a=(l=((e,t)=>{for(var a in t||(t={}))Y.call(t,a)&&J(e,a,t[a]);if(G)for(var a of G(t))Z.call(t,a)&&J(e,a,t[a]);return e})({},i),Q(l,K({[e]:t})));var l;o(a),c((e=>{const t={isValid:!0};return e.applicationID||(t.isValid=!1),t})(a))},name:"applicationID",value:i.applicationID,parseTarget:!0,disabled:r})),(0,B.VI)(i.applicationID)&&l.createElement(H.A,{color:"yellow",cta:l.createElement(v.A,{url:`${m.CW}/android-web-apps-chrome-required`,text:"Learn more",newTab:!0})},"This is an Android web app and it requires Google Chrome to work. Please make sure you add Google Chrome to this fleet."),l.createElement("div",null,l.createElement(z.e,null))))),l.createElement("div",{className:`${X}__action-buttons`},l.createElement(q.A,{entityType:"software",position:"top",tipOffset:8,renderChildren:t=>l.createElement(y.A,{type:"submit",disabled:t||u,isLoading:a,className:`${X}__add-software-btn`},e?"Save":"Add software")}),l.createElement(y.A,{onClick:n,variant:"secondary"},"Cancel"))))};const te="software-app-store-android",ae=({onEnableMdm:e,isGlobalAdmin:t})=>l.createElement(f.A,{variant:"form",header:"Android MDM isn't enabled",info:t?"To add Android apps, first enable Android MDM.":"To add Android apps, ask your admin to enable Android MDM.",primaryButton:t?l.createElement(y.A,{onClick:e},"Enable Android MDM"):void 0});var le=({currentTeamId:e,router:t})=>{const{isPremiumTier:a,isAndroidMdmEnabledAndConfigured:i,isGlobalAdmin:o}=(0,l.useContext)(s.BR),[c,d]=(0,l.useState)(!1);return l.createElement("div",{className:te},a?i?l.createElement("div",{className:`${te}__content`},l.createElement(ee,{onSubmit:a=>{return i=function*(){if(a.applicationID){d(!0);try{const{software_title_id:i,name:o}=yield u.A.addAppStoreApp(e,a);p.me.success(l.createElement(l.Fragment,null,l.createElement("strong",null,o||"Android app")," successfully added.")),t.push((0,r.M8)(n.A.SOFTWARE_TITLE_DETAILS(i.toString()),{fleet_id:e}))}catch(e){p.me.error((e=>{const t=(0,A.F3)(e);if(t.includes("find ID on the Play Store"))return t;if(t.toLowerCase().includes("already")){const e=(0,w.JZ)(t);if(e)return e;if(t.includes("VPPApp"))return`${w.wy}
1 The software is already available to install in this fleet.`}return t?`${w.wy} ${(0,w.U_)(t)}`:w.Zx})(e),{response:e})}d(!1)}},new Promise((e,t)=>{var a=e=>{try{n(i.next(e))}catch(e){t(e)}},l=e=>{try{n(i.throw(e))}catch(e){t(e)}},n=t=>t.done?e(t.value):Promise.resolve(t.value).then(a,l);n((i=i.apply(null,null)).next())});var i},onCancel:()=>{t.push((0,r.M8)(n.A.SOFTWARE_LIBRARY,{fleet_id:e}))},isLoading:c})):l.createElement(ae,{onEnableMdm:()=>{t.push(n.A.ADMIN_INTEGRATIONS_MDM_ANDROID)},isGlobalAdmin:o}):l.createElement(b.A,{className:`${te}__premium-message`}))};const ne="software-app-store",re=[{label:"Apple (macOS, iOS, and iPadOS)",value:"apple"},{label:"Android",value:"android"}];var ie=({currentTeamId:e,router:t,location:a})=>{const o=a.query.platform||"apple";return l.createElement("div",{className:ne},l.createElement(i.A,{name:"platform",label:"Platform",onChange:a=>{t.push((0,r.M8)(n.A.SOFTWARE_ADD_APP_STORE,{fleet_id:e,platform:null==a?void 0:a.value}))},value:o,options:re,className:`${ne}__platform-dropdown`,wrapperClassname:`${ne}__form-field ${ne}__form-field--platform`}),"apple"===o?l.createElement(R,{currentTeamId:e,router:t}):l.createElement(le,{currentTeamId:e,router:t}))}},64922:function(e,t,a){a.d(t,{E:function(){return N}});var l=a(96540),n=a(75942),r=a(78263),i=a(89937),o=a(9106),s=a(12968),c=a(77931),u=a(97873),d=a(68774),m=a(63898),p=a(4346),f=a(46157),v=a(24432),g=a(70699),E=a(38021),b=a(17981),y=a(45584),_=a(79519),h=a(72753),A=a(62190),w=a(30415),S=Object.defineProperty,T=Object.defineProperties,C=Object.getOwnPropertyDescriptors,I=Object.getOwnPropertySymbols,x=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,k=(e,t,a)=>t in e?S(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;const O="software-custom-package",N=()=>l.createElement(E.A,{icon:"info-outline",iconColor:"ui-fleet-black-50",borderRadius:"medium"},"Add custom packages in GitOps mode so Fleet can host your software. After adding, copy its SHA-256 hash into your YAML so the next GitOps workflow doesn't delete it."," ",l.createElement(v.A,{url:`${i.CW}/yaml-software`,text:"YAML docs",newTab:!0}));t.A=({currentTeamId:e,router:t,isSidePanelOpen:a,setSidePanelOpen:v})=>{const{isPremiumTier:E}=(0,l.useContext)(d.BR),S=(0,n.useQueryClient)(),{gitOpsModeEnabled:F}=(0,p.A)("software"),[$,L]=(0,l.useState)(0),[D,R]=(0,l.useState)(null),[V,j]=(0,l.useState)(!1),[U,M]=(0,l.useState)(!1),{data:q,isLoading:B,isError:H}=(0,n.useQuery)(["custom_labels"],()=>u.Ay.summary(e).then(e=>(0,u.f2)(e.labels)),(z=((e,t)=>{for(var a in t||(t={}))x.call(t,a)&&k(e,a,t[a]);if(I)for(var a of I(t))P.call(t,a)&&k(e,a,t[a]);return e})({},i.QL),T(z,C({enabled:E}))));var z;(0,m.A)(!!D);const W=(e=!1)=>{j(!V),M(e)};return E?l.createElement("div",{className:O},B?l.createElement(y.A,null):H?l.createElement(_.A,{verticalPaddingSize:"pad-xxxlarge"}):l.createElement(l.Fragment,null,F&&l.createElement(N,null),l.createElement(A.A,{labels:q||[],showSchemaButton:!a,onClickShowSchema:()=>v(!0),className:`${O}__package-form`,onCancel:()=>{t.push((0,s.M8)(r.A.SOFTWARE_LIBRARY,{fleet_id:e}))},onSubmit:a=>{return n=function*(){var n,i;if(a.software){R((0,o.P$)(a.software));try{const{software_package:{title_id:i}}=yield c.A.addSoftwarePackage({data:a,teamId:e,onUploadProgress:e=>{const t=e.progress||0;L(Math.max(t-.03,.01))}});F||f.me.success(l.createElement(l.Fragment,null,l.createElement("b",null,null==(n=a.software)?void 0:n.name)," successfully added.",a.selfService?" The end user can install from Fleet Desktop.":"")),S.invalidateQueries({queryKey:[{scope:"software-titles"}]}),S.invalidateQueries({queryKey:[{scope:"software-library"}]});const o={fleet_id:e};t.push((0,s.M8)(r.A.SOFTWARE_TITLE_DETAILS(i.toString()),o))}catch(e){f.me.error((0,w.u)(e,null==(i=a.software)?void 0:i.name),{response:e})}R(null)}else f.me.error("Couldn't add. Please refresh the page and try again.")},new Promise((e,t)=>{var a=e=>{try{r(n.next(e))}catch(e){t(e)}},l=e=>{try{r(n.throw(e))}catch(e){t(e)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(a,l);r((n=n.apply(null,null)).next())});var n},onClickPreviewEndUserExperience:W}),D&&l.createElement(g.A,{fileDetails:D,fileProgress:$}),V&&l.createElement(h.A,{onCancel:W,teamId:e,isIosOrIpadosApp:U}))):l.createElement(b.A,{className:`${O}__premium-message`})}},30415:function(e,t,a){a.d(t,{u:function(){return u}});var l=a(96540),n=a(53110),r=a(12755),i=a(89937),o=a(24432),s=a(30104),c=a(54184);const u=(e,t)=>
1{var a,u;const d=(0,n.F0)(e)&&(504===(null==(a=e.response)?void 0:a.status)||408===(null==(u=e.response)?void 0:u.status)),m=(0,r.F3)(e);if(d)return c.pX;if(m.toLowerCase().includes("already")){const e=(0,c.JZ)(m);if(e)return e}return(0,c.i0)(m,t)||(m.includes("Secret variable")?(0,s.C3)(e):m.includes("Unable to extract necessary metadata")?l.createElement(l.Fragment,null,c.wy," Unable to extract necessary metadata."," ",l.createElement(o.A,{url:`${i.CW}/package-metadata-extraction`,text:"Learn more",newTab:!0,variant:"flash-message-link"})):m.includes("not a valid .tar.gz archive")?l.createElement(l.Fragment,null,c.wy," This is not a valid .tar.gz archive."," ",l.createElement(o.A,{url:`${i.CW}/tarball-archives`,text:"Learn more",newTab:!0,variant:"flash-message-link"})):m.startsWith("Couldn't add.")?`${(0,c.U_)(m)}`:m?`${c.wy} ${(0,c.U_)(m)}`:c.Zx)}},88848:function(e,t,a){a.r(t),a.d(t,{default:function(){return l.A}});var l=a(64922)},55133:function(e,t,a){a.d(t,{A:function(){return L},E:function(){return $}});var l=a(96540),n=a(75942),r=a(4346),i=a(12968),o=a(89937),s=a(78263),c=a(97873),u=a(74953),d=a(52603),m=a(24432),p=a(59333),f=a(25087),v=a(22676),g=a(98601),E=a(59012),b=a(66081),y=a(30104),_=a(22184);const h={preInstallQuery:{validations:[{name:"invalidQuery",isValid:e=>{var t;const a=null!=(t=e.preInstallQuery)?t:"";if(""===a.trim())return!0;const{valid:l}=(0,_.B4)(a);return l},message:e=>{var t;const a=null!=(t=e.preInstallQuery)?t:"";if(""===a.trim())return"";const{error:l}=(0,_.B4)(a);return null!=l?l:"Invalid query"}}]},customTarget:{validations:[{name:"requiredLabelTargets",isValid:e=>"All hosts"===e.targetType||void 0!==Object.keys(e.labelTargets).find(t=>e.labelTargets[t])}]}},A=(e,t)=>void 0===t||"string"==typeof t?t:t(e),w=e=>{const t={isValid:!0};return Object.keys(h).forEach(a=>{const l=h[a].validations.find(t=>!t.isValid(e));l?(t.isValid=!1,t[a]={isValid:!1,message:A(e,l.message)}):t[a]={isValid:!0}}),t};var S=Object.defineProperty,T=Object.defineProperties,C=Object.getOwnPropertyDescriptors,I=Object.getOwnPropertySymbols,x=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,k=(e,t,a)=>t in e?S(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,O=(e,t)=>{for(var a in t||(t={}))x.call(t,a)&&k(e,a,t[a]);if(I)for(var a of I(t))P.call(t,a)&&k(e,a,t[a]);return e},N=(e,t)=>T(e,C(t));const F="fleet-app-details-form",$=(e,t)=>{const a=e?(0,i.M8)(s.A.SOFTWARE_TITLE_DETAILS(e.toString()),{fleet_id:t}):"";return l.createElement(l.Fragment,null,"You already added this software.",l.createElement("br",null),l.createElement(m.A,{url:a,text:"View software",variant:"tooltip-link"}))};var L=({categories:e,defaultInstallScript:t,defaultPostInstallScript:a,defaultUninstallScript:i,teamId:s,onCancel:_,onSubmit:h,softwareTitleId:A})=>{var S;const[T,C]=(0,l.useState)({selfService:!1,forceInstall:!1,patch:!1,patchOption:"closed",preInstallQuery:"",installScript:t,postInstallScript:a,uninstallScript:i,targetType:"All hosts",customTarget:"labelsIncludeAny",labelTargets:{},categories:e||[]}),[I,x]=(0,l.useState)({isValid:!0}),{data:P,isLoading:k,isError:L}=(0,n.useQuery)(["custom_labels",s],()=>c.Ay.summary(s?parseInt(s,10):null).then(e=>(0,c.f2)(e.labels)),O({},o.QL)),{gitOpsModeEnabled:D}=(0,r.A)("software"),[R,V]=(0,l.useState)(!1),j=e=>{const t=N(O({},T),{targetType:e});C(t),x(w(t))},U=e=>{const t=N(O({},T),{customTarget:e});C(t),x(w(t))},M=({name:e,value:t})=>{const a=N(O({},T),{labelTargets:N(O({},T.labelTargets),{[e]:t})});C(a),x(w(a))},q=!!A,B=q||!I.isValid;return l.createElement("form",{className:F,onSubmit:e=>{e.preventDefault(),h(T)}},l.createElement(g.A,{formData:T,onToggleSelfService:()=>{C(e=>N(O({},e),{selfService:!e.selfService}))},onClickPreviewEndUserExperience:()=>{},onSelectCategory:()=>{}}),l.createElement(p.A,{entityType:"software",renderChildren:e=>l.createElement(b.Yw,{forceInstall:T.forceInstall,patch:T.patch,patchOption:T.patchOption,onToggleForceInstall:e=>C(t=>N(O({},t),{forceInstall:e})),onTogglePatch:e=>C(t=>N(O({},t),{patch:e})),onSelectPatchOption:e=>C(t=>N(O({},t),{patchOption:e})),disabled:e})}
1),l.createElement(p.A,{entityType:"software",renderChildren:e=>l.createElement(v.m,{selectedTargetType:T.targetType,selectedCustomTarget:T.customTarget,selectedLabels:T.labelTargets,customTargetOptions:y.fK,className:`${F}__target`,onSelectTargetType:j,onSelectCustomTarget:U,onSelectLabel:M,labels:P||[],isLoadingLabels:k,isErrorLabels:L,dropdownHelpText:(0,y.a3)(T.forceInstall,T.customTarget),disableOptions:e})}),l.createElement("div",{className:`${F}__advanced-options`},l.createElement(f.A,{isShowing:R,showText:"Advanced options",hideText:"Advanced options",caretPosition:"after",onClick:()=>V(!R)}),R&&l.createElement(E.A,{showSchemaButton:!1,installScriptHelpText:l.createElement(l.Fragment,null,"Use the $INSTALLER_PATH variable to point to the installer."," ",l.createElement(m.A,{url:`${o.CW}/install-scripts`,text:"Learn more about install scripts",newTab:!0})),postInstallScriptHelpText:"",uninstallScriptHelpText:l.createElement(l.Fragment,null,"$PACKAGE_ID will be populated after the software is added."," ",l.createElement(m.A,{url:`${o.CW}/uninstall-scripts`,text:"Learn more about uninstall scripts",newTab:!0})),errors:{preInstallQuery:null==(S=I.preInstallQuery)?void 0:S.message},preInstallQuery:T.preInstallQuery,installScript:T.installScript,postInstallScript:T.postInstallScript,uninstallScript:T.uninstallScript,onClickShowSchema:()=>{},onChangePreInstallQuery:e=>{const t=N(O({},T),{preInstallQuery:e});C(t),x(w(t))},onChangeInstallScript:e=>{C(t=>N(O({},t),{installScript:e}))},onChangePostInstallScript:e=>{C(t=>N(O({},t),{postInstallScript:e}))},onChangeUninstallScript:e=>{C(t=>N(O({},t),{uninstallScript:e}))},gitopsCompatible:!0,gitOpsModeEnabled:D,patchWhenClosed:T.patch&&"closed"===T.patchOption})),l.createElement("div",{className:`${F}__action-buttons`},l.createElement(p.A,{entityType:"software",renderChildren:e=>l.createElement(d.A,{tipContent:$(A,s),disableTooltip:!q,position:"left",showArrow:!0,underline:!1,tipOffset:10},l.createElement(u.A,{type:"submit",disabled:e||B},"Add software"))}),l.createElement(u.A,{onClick:_,variant:"secondary"},"Cancel")))}},99301:function(e,t,a){a.d(t,{S4:function(){return s},fP:function(){return o},u1:function(){return c}});var l=a(53110),n=a(12755),r=a(30104),i=a(54184);const o=e=>`[Install software] ${e}`,s=e=>`Policy triggers automatic install of ${e} on each host that's missing this software.`,c=e=>{var t,a;const o=null!=(a=(0,l.F0)(e)?null==(t=e.response)?void 0:t.status:void 0)?a:(0,n.S0)(e)?e.status:void 0,s=504===o||408===o||499===o,c=(0,n.F3)(e);if(s||c.includes("json decoder error"))return i.pX;if(c.includes("can be added to the same fleet"))return(0,i.U_)(c);if(c.toLowerCase().includes("already")){const e=(0,i.JZ)(c);if(e)return e}return c.includes("Secret variable")?(0,r.C3)(e):c?`${i.wy} ${(0,i.U_)(c)}`:i.Zx}},67902:function(e,t,a){a.r(t),a.d(t,{default:function(){return Z}});var l=a(96540),n=a(75942),r=a(24740),i=a(78263),o=a(12968),s=a(89937),c=a(77931),u=a(80396),d=a(68774),m=a(43015),p=a(46157),f=a(56118),v=a(84945),g=a(827),E=a(45584),b=a(79519),y=a(17981),_=a(81766),h=a(69906),A=a(74953),w=a(29448),S=a(66081),T=a(55133),C=a(2543),I=a(99958);const x="add-fleet-app-software-modal";var P=()=>l.createElement(I.A,{className:x,title:"Add software",width:"large",onExit:C.noop,disableClosingModal:!0},l.createElement(E.A,{centered:!1,className:`${x}__spinner`}),l.createElement("p",null,"Uploading software so that it's available for install. This may take a few minutes.")),k=a(83573),O=a(52603),N=a(25809),F=a(57390),$=a(24432);const L="fleet-app-details-modal",D=l.createElement(l.Fragment,null,"Used to manage apps in Gitops."," ",l.createElement($.A,{newTab:!0,url:`${s.CW}/gitops`,text:"Learn more",variant:"tooltip-link"})),R=l.createElement(l.Fragment,null,"Fleet downloads the package from the URL and stores it. Hosts download it from Fleet before install.");var V=({name:e,platform:t,version:a,slug:n,url:r,onCancel:i})=>{let o=l.createElement(l.Fragment,null,a);return"latest"===a&&(o=l.createElement(O.A,{tipContent:l.createElement(l.Fragment,null,"To preview the version, download ",e," using the URL below.")},"Latest")),l.createElement(I.A,{className:L,title:"Software details",onExit:i},l.createElement("div",{className:`${L}__modal-content`},l.createElement(k.A,{title:"Name",value:e}),l.createElement(k.A,{title:"Version",value:o}),n&&l.createElement(k.A,{title:l.createElement(O.A,{tipContent:D},"Fleet-maintained app slug"),value:l.createElement(l.Fragment,null,n,l.createElement(F.A,{copyText:n,variant:"compact"}))}),l.createElement(k.A,{title:"Platform",value:s.uc[t]}),r&&l.createElement(k.A,{title:l.createElement(O.A,{tipContent:R},"URL"),value:l.createElement(N.A,{value:r})})),l.createElement("div",{className:"modal-cta-wrap"},l.createElement(A.A,{onClick:i},"Close")))},j=a(99301),U=Object.defineProperty,M=Object.defineProperties,q=Object.getOwnPropertyDescriptors,B=Object.getOwnPropertySymbols,H=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable,W=(e,t,a)=>t in e?U(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,Q=(e,t)=>{for(var a in t||(t={}))H.call(t,a)&&W(e,a,t[a]);if(B)for(var a of B(t))z.call(t,a)&&W(e,a,t[a]);return e},K=(e,t)=>M(e,q(t));const G="fleet-maintained-app-details-page",Y=({name:e,platform:t,version:a,onClickShowAppDetails:n})=>{let r=l.createElement(l.Fragment,null,a);return"latest"===a&&(r=l.createElement(O.A,{tipContent:l.createElement(l.Fragment,null,"To preview the version, select ",l.createElement("strong",null,"Show details")," and download ",e," using the URL.")},"Latest")),l.createElement(_.A,{className:`${G}__fleet-app-summary`,borderRadiusSize:"medium"},l.createElement("div",{className:`${G}__fleet-app-summary--left`},l.createElement(h.A,{name:e,size:"medium"}),l.createElement("div",{className:`${G}
1__fleet-app-summary--details`},l.createElement("div",{className:`${G}__fleet-app-summary--title`},e),l.createElement("div",{className:`${G}__fleet-app-summary--info`},l.createElement("div",{className:`${G}__fleet-app-summary--details--platform`},m.uc[t]),"•",l.createElement("div",{className:`${G}__fleet-app-summary--details--version`},r)))),l.createElement("div",{className:`${G}__fleet-app-summary--show-details`},l.createElement(A.A,{variant:"subdued",onClick:n,icon:"info"},"Show details")))};var Z=({location:e,router:t,routeParams:a})=>{const m=e.query.fleet_id,_=parseInt(a.id,10);isNaN(_)&&t.push(i.A.SOFTWARE_ADD_FLEET_MAINTAINED);const h=(0,n.useQueryClient)(),A=(0,r.useErrorHandler)(),{isPremiumTier:C}=(0,l.useContext)(d.BR),[I,x]=(0,l.useState)(!1),[k,O]=(0,l.useState)(!1),{data:N,isLoading:F,isError:$}=(0,n.useQuery)(["fleet-maintained-app",_],()=>c.A.getFleetMaintainedApp(_,m),K(Q({},s.QL),{enabled:C,retry:!1,select:e=>e.fleet_maintained_app,onError:e=>A(e)})),L=(0,o.M8)(i.A.SOFTWARE_ADD_FLEET_MAINTAINED,{fleet_id:m});return l.createElement(f.A,null,l.createElement(l.Fragment,null,l.createElement(g.A,{className:G},l.createElement(l.Fragment,null,C?F?l.createElement(E.A,null):$?l.createElement(b.A,{verticalPaddingSize:"pad-xxxlarge"}):N?l.createElement(l.Fragment,null,l.createElement(v.A,{text:"Back to add software",path:L,className:`${G}__back-to-add-software`}),l.createElement("h1",null,N.name),l.createElement(w.A,{content:"Add software to your library."}),l.createElement("div",{className:`${G}__page-content`},l.createElement(Y,{name:N.name,platform:N.platform,version:N.version,onClickShowAppDetails:()=>{O(!0)}}),l.createElement(T.A,{categories:N.categories,defaultInstallScript:N.install_script,defaultPostInstallScript:N.post_install_script,defaultUninstallScript:N.uninstall_script,teamId:m,onCancel:()=>{t.push(L)},onSubmit:e=>{return a=function*(){if(!m)return;x(!0);const a=e=>{h.invalidateQueries({queryKey:[{scope:"software-titles"}]}),h.invalidateQueries({queryKey:[{scope:"software-library"}]}),h.invalidateQueries({queryKey:[{scope:"fleet-maintained-apps"}]}),t.push((0,o.M8)(i.A.SOFTWARE_TITLE_DETAILS(e.toString()),{fleet_id:m}))};let n;try{const t=(yield c.A.addFleetMaintainedApp(parseInt(m,10),K(Q({},e),{appId:_}))).software_title_id;n=t,e.patch&&(yield u.A.create(Q(Q({team_id:parseInt(m,10),type:"patch",patch_software_title_id:t},"manual"!==e.patchOption&&{software_title_id:t}),(0,S.kl)(e.patchOption)))),a(t),p.me.success(l.createElement(l.Fragment,null,l.createElement("b",null,null==N?void 0:N.name)," successfully added."))}catch(e){const t="object"==typeof e?e:{};n?(a(n),p.me.error("Software was added, but the deployment settings couldn't be saved. Try again from Actions > Deploy.",{response:e})):p.me.error((0,j.u1)(t),{response:e})}x(!1)},new Promise((e,t)=>{var l=e=>{try{r(a.next(e))}catch(e){t(e)}},n=e=>{try{r(a.throw(e))}catch(e){t(e)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(l,n);r((a=a.apply(null,null)).next())});var a},softwareTitleId:N.software_title_id}))):null:l.createElement(y.A,null))),I&&l.createElement(P,null),k&&N&&l.createElement(V,{name:N.name,platform:N.platform,version:N.version,slug:N.slug,url:N.url,onCancel:()=>O(!1)})))}},23952:function(e,t,a){a.r(t),a.d(t,{default:function(){return X}});var l=a(96540),n=a(75942),r=a(2543),i=a(77931),o=a(89937),s=a(68774),c=a(45584),u=a(79519),d=a(17981),m=a(78263),p=a(9467),f=a(34724),v=a(46692),g=a(2367),E=a(24432),b=a(33427),y=a(78131);const _="fma-platform-select",h=({value:e,onChange:t,className:a})=>{const n=(0,l.useMemo)(()=>[{value:"all",label:"All platforms",isDisabled:!1},{value:"macos",label:"macOS",isDisabled:!1},{value:"windows",label:"Windows",isDisabled:!1}],[]);return l.createElement("div",{className:`${_} ${a||""}`},l.createElement(y.Ay,{name:"fma-platform-filter",options:n,value:e,onChange:e=>{e&&t(e.value)},variant:"table-filter",isSearchable:!1,placeholder:"Filter by platform",className:_,iconName:"filter-alt"}))},A=({value:e,onChange:t,className:a})=>{const n="available"===e;return l.createElement("div",{className:`fma-status-select ${a||""}`},l.createElement(b.A,{onChange:()=>{t("all"===e?"available":"all")},value:n,inactiveText:"Hide added apps",activeText:"Hide added apps"}))};var w=a(40925),S=a(81790),T=a(12968),C=a(55133),I=a(32485),x=a.n(I),P=a(52978),k=a(74953),O=a(52603),N=a(75679),F=({value:e,router:t,className:a="w250",teamId:n})=>{const r=x()("installer-action-cell",a);if(!e)return l.createElement(N.A,{className:r,emptyCellTooltipText:"Currently unavailable for this platform."});
1const{id:i,software_title_id:o}=e;return o?l.createElement("div",{className:r},l.createElement(O.A,{tipContent:(0,C.E)(o,null==n?void 0:n.toString()),disableTooltip:!o,position:"top",underline:!1,showArrow:!0,clickable:!0,tipOffset:10},l.createElement(P.A,{name:"success"}))):l.createElement("div",{className:r},l.createElement(k.A,{variant:"pill",onClick:()=>{const e=(0,T.M8)(m.A.SOFTWARE_FLEET_MAINTAINED_DETAILS(i),{fleet_id:n});t&&e&&(null==t||t.push(e))}},"Add"))},$=Object.defineProperty,L=Object.getOwnPropertySymbols,D=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable,V=(e,t,a)=>t in e?$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,j=(e,t)=>{for(var a in t||(t={}))D.call(t,a)&&V(e,a,t[a]);if(L)for(var a of L(t))R.call(t,a)&&V(e,a,t[a]);return e};const U="fleet-maintained-apps-table",M=()=>l.createElement(g.A,{header:"No items match the current search criteria",info:l.createElement(l.Fragment,null,"Can't find app?"," ",l.createElement(E.A,{newTab:!0,url:"https://fleetdm.com/feature-request",text:"File an issue on GitHub"}))});var q=({teamId:e,isLoading:t,data:a,router:n,query:r,perPage:i,orderDirection:o,platformParam:s,statusParam:c,orderKey:u,currentPage:d})=>{var g,E;const b=c||"all",y=s||"all",_=(0,l.useCallback)(e=>{var t;const a=Object.entries(e).find(([e,t])=>{switch(e){case"searchQuery":return t!==r;case"sortDirection":return t!==o;case"sortHeader":return t!==u;case"pageIndex":return t!==d;case"platform":return t!==s;case"status":return t!==c;default:return!1}});return null!=(t=null==a?void 0:a[0])?t:""},[d,o,u,r,s,c]),T=(0,l.useCallback)((t,a,l,n)=>({query:t.searchQuery,fleet_id:e,order_direction:t.sortDirection,order_key:t.sortHeader,page:"pageIndex"===a?t.pageIndex:0,platform:"all"===l?void 0:l,status:"all"===n?void 0:n}),[e]),C=(0,l.useCallback)(e=>{const t=_(e);if(""===t)return;const a=(0,p.g2)({pathPrefix:m.A.SOFTWARE_ADD_FLEET_MAINTAINED,routeTemplate:"",queryParams:T(e,t,y,b)});n.replace(a)},[_,T,n,y,b]),I=(0,l.useMemo)(()=>a?((e,t)=>[{Header:e=>l.createElement(w.A,{value:"Name",isSortedDesc:e.column.isSortedDesc}),accessor:"name",Cell:e=>{const{name:t}=e.row.original;return l.createElement(S.A,{name:t})},sortType:"caseInsensitive"},{Header:"macOS",accessor:"macos",Cell:a=>{const{macos:n}=a.row.original;return l.createElement(F,{teamId:t,value:n,router:e})},disableSortBy:!0},{Header:"Windows",accessor:"windows",Cell:a=>{const{windows:n}=a.row.original;return l.createElement(F,{teamId:t,value:n,router:e})},disableSortBy:!0}])(n,e):[],[a,n,e]),x=null!=(E=a&&(e=>{const t={};return e.forEach(e=>{const a=e,{name:l,platform:n}=a,r=((e,t)=>{var a={};for(var l in e)D.call(e,l)&&t.indexOf(l)<0&&(a[l]=e[l]);if(null!=e&&L)for(var l of L(e))t.indexOf(l)<0&&R.call(e,l)&&(a[l]=e[l]);return a})(a,["name","platform"]),i=e.slug.split("/")[0];t[i]||(t[i]={name:l,macos:null,windows:null}),"darwin"===n?t[i].macos=j({platform:n},r):"windows"===n&&(t[i].windows=j({platform:n},r))}),Object.values(t)})(null!=(g=a.fleet_maintained_apps)?g:[]))?E:[],P=e=>{const t=(0,p.g2)({pathPrefix:m.A.SOFTWARE_ADD_FLEET_MAINTAINED,routeTemplate:"",queryParams:T({searchQuery:r,sortDirection:o,sortHeader:u,pageIndex:d,pageSize:i},"status",y,e)});n.replace(t)},k=e=>{const t=(0,p.g2)({pathPrefix:m.A.SOFTWARE_ADD_FLEET_MAINTAINED,routeTemplate:"",queryParams:T({searchQuery:r,sortDirection:o,sortHeader:u,pageIndex:d,pageSize:i},"platform",e,b)});n.replace(t)};return l.createElement(f.A,{className:U,columnConfigs:I,data:x,isLoading:t,resultsTitle:"items",emptyComponent:M,defaultSortHeader:u,defaultSortDirection:o,pageIndex:d,defaultSearchQuery:r,manualSortBy:!0,pageSize:i,showMarkAllPages:!1,isAllPagesSelected:!1,disableNextPage:!(null==a?void 0:a.meta.has_next_results),searchable:!0,inputPlaceHolder:"Search by name",onQueryChange:C,renderCount:()=>a?l.createElement(v.A,{name:"items",count:a.count}):null,customControl:()=>l.createElement("div",{className:`${U}__filters`},l.createElement(A,{value:b,onChange:P,className:`${U}__status-filter`}),l.createElement(h,{value:y,onChange:k,className:`${U}__platform-filter`})),stackControls:!0})},B=Object.defineProperty,H=Object.getOwnPropertySymbols,z=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable,Q=(e,t,a)=>t in e?B(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,K=(e,t)=>{for(var a in t||(t={}))z.call(t,a)&&Q(e,a,t[a]);if(H)for(var a of H(t))W.call(t,a)&&Q(e,a,t[a]);return e};
1const G="software-fleet-maintained",Y={keepPreviousData:!0,staleTime:3e4},Z="asc",J="name";var X=({currentTeamId:e,router:t,location:a})=>{const{isPremiumTier:m}=(0,l.useContext)(s.BR),{order_key:p=J,order_direction:f=Z,query:v="",page:g,platform:E,status:b}=a.query,y=g?parseInt(g,10):0;let _;"macos"===E?_="darwin":"windows"===E&&(_="windows");const h="available"===b||void 0,{data:A,isLoading:w,isFetching:S,isError:T}=(0,n.useQuery)([{scope:"fleet-maintained-apps",page:y,per_page:100,query:v,order_direction:f,order_key:p,team_id:e,platform:_,available:h}],({queryKey:[e]})=>i.A.getFleetMaintainedApps((0,r.omit)(e,"scope")),K(K({},o.QL),Y));return m?w?l.createElement(c.A,null):T?l.createElement(u.A,{verticalPaddingSize:"pad-xxxlarge"}):l.createElement("div",{className:G},l.createElement(q,{data:A,isLoading:S,router:t,query:v,teamId:e,orderDirection:f,orderKey:p,perPage:100,currentPage:y,platformParam:E,statusParam:b})):l.createElement(d.A,{className:`${G}__premium-message`})}},54184:function(e,t,a){a.d(t,{JZ:function(){return s},U_:function(){return o},Zx:function(){return r},i0:function(){return c},pX:function(){return i},wy:function(){return n}});var l=a(96540);const n="Couldn't add.",r=`${n} Please try again.`,i=`${n} The request timed out. Make sure your server, and any proxy or load balancer in front of Fleet, allows enough time to transfer large installers.`,o=e=>e&&!e.endsWith(".")?`${e}.`:e,s=e=>{const t=e.replace(/^Couldn't add software\.?\s*/,""),a=t.match(/^(.+?) already has a Fleet-maintained app on the (.+?) fleet\./);if(a)return l.createElement(l.Fragment,null,n," ",l.createElement("b",null,a[1])," already has a Fleet-maintained app on the ",l.createElement("b",null,a[2])," fleet.");const r=t.match(/^(.+?) already has an Apple App Store \(VPP\) on the (.+?) fleet\./);if(r)return l.createElement(l.Fragment,null,n," ",l.createElement("b",null,r[1])," already has an Apple App Store (VPP) on the ",l.createElement("b",null,r[2])," fleet.");const i=t.match(/^(.+?) already has a software package on the (.+?) fleet\./);if(i)return l.createElement(l.Fragment,null,n," ",l.createElement("b",null,i[1])," already has a software package on the ",l.createElement("b",null,i[2])," fleet.");const o=t.match(/^(.+?) already has (\d+) packages\. Before adding, delete one you no longer use\./);if(o)return l.createElement(l.Fragment,null,n," ",l.createElement("b",null,o[1])," already has"," ",o[2]," packages. Before adding, delete one you no longer use.");const s=t.match(/^(.+?) already has an installer available for the (.+?) fleet\./);if(s)return l.createElement(l.Fragment,null,n," ",l.createElement("b",null,s[1])," already has an installer available for the ",l.createElement("b",null,s[2])," fleet.");const c=t.match(/^(?:SoftwareInstaller|In-house app) "(.+?)" already.+ fleet "(.+?)"\./);return c?l.createElement(l.Fragment,null,n," ",l.createElement("b",null,c[1])," already has an installer available for the ",l.createElement("b",null,c[2])," fleet."):null},c=(e,t)=>t&&e.includes("The selected package is for a different file type.")?l.createElement(l.Fragment,null,n," ",l.createElement("b",null,t)," already has an installer of a different file type."):null},33277:function(e,t,a){a.r(t),a.d(t,{default:function(){return _}});var l=a(96540),n=a(53806),r=a(78263),i=a(12968),o=a(83535),s=a(7714),c=a(62131),u=a(56118),d=a(827),m=a(84945),p=a(15570),f=a(37738),v=a(90125),g=a(37863),E=a(29448);const b="software-add-page",y=[{name:"Fleet-maintained",pathname:r.A.SOFTWARE_ADD_FLEET_MAINTAINED},{name:"App store",pathname:r.A.SOFTWARE_ADD_APP_STORE},{name:"Custom package",pathname:r.A.SOFTWARE_ADD_PACKAGE}];var _=({children:e,location:t,router:a})=>{const{selectedOsqueryTable:_,setSelectedOsqueryTable:h}=(0,l.useContext)(o.c),{isSidePanelOpen:A,setSidePanelOpen:w}=(0,s.A)(!1),S=(0,l.useCallback)(e=>{w(!1);const l=(0,i.M8)(y[e].pathname,{fleet_id:t.query.fleet_id});a.replace(l)},[t.query.fleet_id,a,w]);if(!t.query.fleet_id)return a.replace((0,i.M8)(t.pathname,{fleet_id:c.Gl})),null;const T=(0,i.M8)(r.A.SOFTWARE_LIBRARY,{fleet_id:t.query.fleet_id});return l.createElement(u.A,null,l.createElement(l.Fragment,null,l.createElement(d.A,{className:b},l.createElement("div",{className:`${b}__header-links`},l.createElement(m.A,{text:"Back to software",path:T,className:`${b}__back-to-software`})),l.createElement("h1",null,"Add software"),l.createElement(E.A,{content:"Add software to your library. You can add it to self service later."}),l.createElement(p.A,null,l.createElement(n.tU,{selectedIndex:(C=(null==t?void 0:t.pathname)||"",y.findIndex(e=>C.startsWith(e.pathname))),onSelect:S},l.createElement(n.wb,null,y.map(e=>l.createElement(n.oz,{key:e.name,"data-text":e.name},l.createElement(f.A,null,e.name)))))),l.createElement("div",{key:null==t?void 0:t.pathname,className:"tab-nav-routed-content"},l.cloneElement(e,{router:a,currentTeamId:parseInt(t.query.fleet_id,10),isSidePanelOpen:A,setSidePanelOpen:w}))),A&&l.createElement(v.A,null,l.createElement(g.A,{key:"query-side-panel",onOsqueryTableSelect:e=>{h(e)},selectedOsqueryTable:_,onClose:()=>w(!1)}))));var C}},71554:function(e,t,a){a.r(t),a.d(t,{default:function(){return Y}});var l=a(96540),n=a(75942),r=a(2543),i=a(78263),o=a(77931),s=a(45584),c=a(79519),u=a(9467),d=a(89937),m=a(12968),p=a(34724),f=a(26806),v=a(24432),g=a(431),E=a(46692),b=a(74953),y=a(52603),_=a(73870),h=a(56906),A=a(30104),w=a(40925),S=a(75679),T=a(2837),C=a(81790),I=a(33745),x=a(29844),P=a(91262),k=(e,t)=>[{Header:e=>l.createElement(w.A,{value:"Name",isSortedDesc:e.column.isSortedDesc}),disableSortBy:!1,accessor:"name",Cell:a=>{var n;const r=((e,t)=>{const a=(0,m.M8)(i.A.SOFTWARE_TITLE_DETAILS(e.id.toString()),{fleet_id:t}),{software_package:l,app_store_app:n}=e;let r,o=!1,s=!1,c=null;l?(o=!0,s=l.self_service,r=l.automatic_install_policies&&l.automatic_install_policies.length>0?"automatic":"manual"):n&&(o=!0,s=n.self_service,c=n.icon_url,r=n.automatic_install_policies&&n.automatic_install_policies.length>0?"automatic":"manual"),e.icon_url&&(c=e.icon_url);const u=(0,A.YQ)(e),d=void 0===t;return{name:e.name,displayName:e.display_name,bundleIdentifier:e.bundle_identifier,source:e.source,path:a,hasInstaller:o&&!d,isSelfService:s,installType:r,iconUrl:c,automaticInstallPoliciesCount:u}})(a.row.original,t),o=!!a.row.original.app_store_app&&"android_apps"===a.row.original.source;return l.createElement(C.A,{name:r.name,display_name:r.displayName,bundle_identifier:r.bundleIdentifier,source:r.source,path:r.path,router:e,hasInstaller:r.hasInstaller,isSelfService:r.isSelfService,iconUrl:null!=(n=r.iconUrl)?n:void 0,automaticInstallPoliciesCount:r.automaticInstallPoliciesCount,isIosOrIpadosApp:(0,h.bV)(r.source),isAndroidPlayStoreApp:o})},sortType:"caseInsensitive"},{Header:"Version",disableSortBy:!0,accessor:"versions",Cell:e=>l.createElement(I.A,{versions:e.cell.value})},{Header:"Type",disableSortBy:!0,accessor:"source",Cell:e=>l.createElement(S.A,{value:(0,h.Nt)(e.row.original)})},{Header:"Vulnerabilities",disableSortBy:!0,Cell:e=>{var t;if((0,h.bV)(e.row.original.source)||"tgz_packages"===e.row.original.source)return l.createElement(S.A,{value:"Not supported",grey:!0});const a=(0,P.JF)(null!=(t=e.row.original.versions)?t:[]);return l.createElement(x.A,{vulnerabilities:a})}},{Header:e=>l.createElement(w.A,{value:"Hosts",disableSortBy:!1,isSortedDesc:e.column.isSortedDesc}),disableSortBy:!1,accessor:"hosts_count",Cell:e=>l.createElement(S.A,{value:e.cell.value})},{Header:"",id:"view-all-hosts",disableSortBy:!0,Cell:e=>{const{source:a}=e.row.original;return h.gm.includes(a)?null:l.createElement(T.A,{queryParams:{software_title_id:e.row.original.id,fleet_id:t},className:"software-link",rowHover:!0})}}],O=(e,t)=>[{Header:e=>l.createElement(w.A,{value:"Name",isSortedDesc:e.column.isSortedDesc}),disableSortBy:!1,accessor:"name",Cell:a=>{const{id:n,name:r,display_name:o,bundle_identifier:s,source:c}=a.row.original,u=(0,m.M8)(i.A.SOFTWARE_VERSION_DETAILS(n.toString()),{fleet_id:t});return l.createElement(C.A,{name:r,display_name:o,bundle_identifier:s,source:c,path:u,router:e})},sortType:"caseInsensitive"},{Header:"Version",disableSortBy:!0,accessor:"version",Cell:e=>l.createElement(S.A,{value:e.cell.value})},{Header:"Type",disableSortBy:!0,accessor:"source",Cell:e=>l.createElement(S.A,{value:(0,h.Nt)(e.row.original)})},{Header:"Vulnerabilities",disableSortBy:!0,accessor:"vulnerabilities",Cell:e=>
1["ipados_apps","ios_apps"].includes(e.row.original.source)?l.createElement(S.A,{value:"Not supported",grey:!0}):l.createElement(x.A,{vulnerabilities:e.cell.value})},{Header:e=>l.createElement(w.A,{value:"Hosts",disableSortBy:!1,isSortedDesc:e.column.isSortedDesc}),disableSortBy:!1,accessor:"hosts_count",Cell:e=>l.createElement(S.A,{value:e.cell.value})},{Header:"",id:"view-all-hosts",disableSortBy:!0,Cell:e=>l.createElement(l.Fragment,null,e.row.original&&l.createElement(T.A,{queryParams:{software_version_id:e.row.original.id,fleet_id:t},className:"software-link",rowHover:!0}))}],N=Object.defineProperty,F=Object.getOwnPropertySymbols,$=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable,D=(e,t,a)=>t in e?N(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,R=(e,t)=>{for(var a in t||(t={}))$.call(t,a)&&D(e,a,t[a]);if(F)for(var a of F(t))L.call(t,a)&&D(e,a,t[a]);return e};const V="software-inventory-table";var j=({router:e,data:t,showVersions:a,installableSoftwareExists:n,isSoftwareEnabled:r,query:o,perPage:s,orderDirection:c,orderKey:h,vulnFilters:A,currentPage:w,teamId:S,isLoading:T,onAddFiltersClick:C})=>{const I=a?i.A.SOFTWARE_VERSIONS:i.A.SOFTWARE_INVENTORY,x=(0,l.useCallback)(e=>{var t;const a=Object.entries(e).find(([e,t])=>{switch(e){case"searchQuery":return t!==o;case"sortDirection":return t!==c;case"sortHeader":return t!==h;case"pageIndex":return t!==w;default:return!1}});return null!=(t=null==a?void 0:a[0])?t:""},[w,c,h,o]),N=(0,l.useCallback)((e,t)=>R({query:e.searchQuery,fleet_id:S,order_direction:e.sortDirection,order_key:e.sortHeader,page:"pageIndex"===t||""===t?e.pageIndex:0},(0,P.yz)(A)),[S,A]),F=(0,l.useCallback)(t=>{const a=x(t),l=(0,u.g2)({pathPrefix:I,routeTemplate:"",queryParams:N(t,a)});e.replace(l)},[x,N,e,I]);let $,L;void 0===t?L=()=>[]:(e=>!!e&&void 0!==e.software_titles)(t)?($=t.software_titles,L=k):($=t.software,L=O);const D=(0,l.useMemo)(()=>t?L(e,S):[],[L,t,e,S]),j=$&&$.length>0,U=""!==o,M=(0,P.ol)(A),q=M.filterCount>0,B=!r||!(j||U||q||a),H=()=>{const t=R({query:o,fleet_id:S,order_direction:c,order_key:h,page:0},(0,P.yz)(A));e.replace((0,u.g2)({pathPrefix:a?i.A.SOFTWARE_INVENTORY:i.A.SOFTWARE_VERSIONS,routeTemplate:"",queryParams:t}))};return l.createElement("div",{className:V},l.createElement(p.A,{columnConfigs:D,data:null!=$?$:[],isLoading:T,resultsTitle:"items",emptyComponent:()=>l.createElement(_.A,{vulnFilters:A,isSoftwareDisabled:!r,noSearchQuery:""===o,installableSoftwareExists:n}),defaultSortHeader:h,defaultSortDirection:c,pageIndex:w,defaultSearchQuery:o,manualSortBy:!0,pageSize:s,showMarkAllPages:!1,isAllPagesSelected:!1,disableNextPage:!(null==t?void 0:t.meta.has_next_results),searchable:!0,disableSearch:B,inputPlaceHolder:"Search by name or vulnerability (CVE)",onQueryChange:F,customControl:()=>l.createElement(l.Fragment,null,l.createElement(f.A,{value:a,onChange:H,inactiveText:"Show versions",activeText:"Show versions",disabled:B}),l.createElement(y.A,{className:`${V}__filters`,position:"left",underline:!1,showArrow:!0,tipOffset:12,tipContent:M.tooltipText,disableTooltip:!q},l.createElement(b.A,{variant:"secondary",onClick:C,disabled:B,icon:"filter"},l.createElement("span",null,M.buttonText)))),stackControls:!0,renderCount:()=>l.createElement(l.Fragment,null,l.createElement(E.A,{name:"items",count:null==t?void 0:t.count}),$&&(null==t?void 0:t.counts_updated_at)&&l.createElement(g.A,{lastUpdatedAt:t.counts_updated_at,customTooltipText:l.createElement(l.Fragment,null,"The last time software data was ",l.createElement("br",null),"updated, including vulnerabilities ",l.createElement("br",null),"and host counts.")})),renderTableHelpText:()=>l.createElement("div",null,"Seeing unexpected software or vulnerabilities?"," ",l.createElement(v.A,{url:d.CO,text:"File an issue on GitHub",newTab:!0})),disableMultiRowSelect:!0,onSelectSingleRow:t=>{if(!t.original.id)return;const l=a?i.A.SOFTWARE_VERSION_DETAILS(t.original.id.toString()):i.A.SOFTWARE_TITLE_DETAILS(t.original.id.toString());e.push((0,m.M8)(l,{fleet_id:S}))}}))},U=Object.defineProperty,M=Object.defineProperties,q=Object.getOwnPropertyDescriptors,B=Object.getOwnPropertySymbols,H=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable,W=(e,t,a)=>t in e?U(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,Q=(e,t)=>{for(var a in t||(t={}))H.call(t,a)&&W(e,a,t[a]);if(B)for(var a of B(t))z.call(t,a)&&W(e,a,t[a]);return e},K=(e,t)=>M(e,q(t));const G={keepPreviousData:!0,staleTime:3e4};var Y=({router:e,isSoftwareEnabled:t,query:a,perPage:u,orderDirection:d,orderKey:m,vulnFilters:p,currentPage:f,teamId:v,onAddFiltersClick:g})=>{const E=location.pathname===i.A.SOFTWARE_VERSIONS,{data:b,isFetching:y,isLoading:_,isError:h}
1=(0,n.useQuery)([Q({scope:"software-titles",page:f,perPage:u,query:a,orderDirection:d,orderKey:m,teamId:v},p)],({queryKey:[e]})=>o.A.getSoftwareTitles((0,r.omit)(e,"scope")),K(Q({},G),{enabled:location.pathname===i.A.SOFTWARE_INVENTORY})),{data:A,isFetching:w,isLoading:S,isError:T}=(0,n.useQuery)([Q(Q({scope:"software-versions",page:f,perPage:u,query:a,orderDirection:d,orderKey:m,teamId:v},p),E?{without_vulnerability_details:!0}:{})],({queryKey:[e]})=>o.A.getSoftwareVersions((0,r.omit)(e,"scope")),K(Q({},G),{enabled:location.pathname===i.A.SOFTWARE_VERSIONS})),{data:C,isFetching:I,isLoading:x,isError:P}=(0,n.useQuery)([Q({scope:"software-titles",page:0,perPage:u,query:"",orderDirection:d,orderKey:m,teamId:v,availableForInstall:!0},p)],({queryKey:[e]})=>o.A.getSoftwareTitles((0,r.omit)(e,"scope")),K(Q({},G),{enabled:location.pathname===i.A.SOFTWARE_VERSIONS&&!S&&!w&&void 0!==A&&0===A.count}));return _||S||x?l.createElement(s.A,null):h||T||P?l.createElement(c.A,{verticalPaddingSize:"pad-xxxlarge"}):l.createElement("div",{className:"software-inventory"},l.createElement(j,{router:e,data:E?A:b,showVersions:E,installableSoftwareExists:!!(null==C?void 0:C.count),isSoftwareEnabled:t,query:a,perPage:u,orderDirection:d,orderKey:m,currentPage:f,teamId:v,isLoading:y||w||I,onAddFiltersClick:g,vulnFilters:p}))}},68063:function(e,t,a){a.r(t),a.d(t,{default:function(){return R}});var l=a(96540),n=a(75942),r=a(78263),i=a(68774),o=a(38944),s=a(12968),c=a(23543),u=a(46157),d=a(84945),m=a(74953),p=a(24432),f=a(79519),v=a(2367),g=a(827),E=a(29448),b=a(17981),y=a(45584),_=a(82196),h=a(25809),A=a(67050),w=a(12755),S=a(89937),T=a(80717),C=a(99958);const I="add-category-modal";var x=({fleetId:e,onExit:t,onSuccess:a})=>{const[n,r]=(0,l.useState)(""),[i,o]=(0,l.useState)(null),[s,u]=(0,l.useState)(!1),d=n.trim(),p=0===d.length||s;return l.createElement(C.A,{title:"Add category",onExit:t,className:I,isContentDisabled:s},l.createElement("form",{className:`${I}__form`,onSubmit:t=>{return l=function*(){if(t.preventDefault(),!p){u(!0);try{yield c.A.addCategory({fleet_id:e,name:d}),a()}catch(e){(0,w.S0)(e)&&409===e.status?o("A self-service category with this name already exists in this fleet."):o("Couldn't add self-service category."),u(!1)}}},new Promise((e,t)=>{var a=e=>{try{r(l.next(e))}catch(e){t(e)}},n=e=>{try{r(l.throw(e))}catch(e){t(e)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(a,n);r((l=l.apply(null,null)).next())});var l}},l.createElement(T.A,{label:"Name",name:"name",value:n,onChange:e=>{r(e),i&&o(null)},error:i,autofocus:!0,ignore1password:!0,inputOptions:{maxLength:S.fQ}}),l.createElement("div",{className:"modal-cta-wrap"},l.createElement(m.A,{type:"submit",disabled:p,isLoading:s},"Add"),l.createElement(m.A,{variant:"secondary",onClick:t,disabled:s},"Cancel"))))};const P="edit-category-modal";var k=({category:e,onExit:t,onSuccess:a})=>{const[n,r]=(0,l.useState)(e.name),[i,o]=(0,l.useState)(null),[s,u]=(0,l.useState)(!1),d=n.trim(),p=d===e.name,f=0===d.length||p||s;return l.createElement(C.A,{title:"Edit category",onExit:t,className:P,isContentDisabled:s},l.createElement("form",{className:`${P}__form`,onSubmit:t=>{return l=function*(){if(t.preventDefault(),!f){u(!0);try{yield c.A.updateCategory(e.id,{name:d}),a()}catch(e){(0,w.S0)(e)&&409===e.status?o("A self-service category with this name already exists in this fleet."):o("Couldn't update self-service category."),u(!1)}}},new Promise((e,t)=>{var a=e=>{try{r(l.next(e))}catch(e){t(e)}},n=e=>{try{r(l.throw(e))}catch(e){t(e)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(a,n);r((l=l.apply(null,null)).next())});var l}},l.createElement(T.A,{label:"Name",name:"name",value:n,onChange:e=>{r(e),i&&o(null)},error:i,autofocus:!0,ignore1password:!0,inputOptions:{maxLength:S.fQ}}),l.createElement("div",{className:"modal-cta-wrap"},l.createElement(m.A,{type:"submit",disabled:f,isLoading:s},"Save"),l.createElement(m.A,{variant:"secondary",onClick:t,disabled:s},"Cancel"))))};const O="delete-category-modal";var N=({category:e,onExit:t,onSuccess:a})=>{const[n,r]=(0,l.useState)(!1);return l.createElement(C.A,{title:"Delete category",onExit:t,className:O,isContentDisabled:n},l.createElement(l.Fragment,null,l.createElement("p",{className:`${O}__body`},"The category will be removed from all associated software."),l.createElement("div",{className:"modal-cta-wrap"},l.createElement(m.A,{variant:"alert",disabled:n,isLoading:n,onClick:()=>{return t=function*(){if(!n){r(!0);try{yield c.A.deleteCategory(e.id),a()}catch(e){u.me.error("Couldn't delete self-service category.",{response:e}),r(!1)}}},new Promise((e,a)=>{var l=e=>{try{r(t.next(e))}catch(e){a(e)}},n=e=>{try{r(t.throw(e))}catch(e){a(e)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(l,n);r((t=t.apply(null,null)).next())});var t}},"Delete"),l.createElement(m.A,{variant:"secondary",onClick:t,disabled:n},"Cancel"))))},F=Object.getOwnPropertySymbols,$=Object.prototype.hasOwnProperty,L=Object.prototype.propertyIsEnumerable;const D="self-service-categories-page";var R=({router:e,location:t})=>{var a;const{config:w,isPremiumTier:S,isGlobalAdmin:T,isGlobalMaintainer:C}=(0,l.useContext)(i.BR),I=(null==(a=null==w?void 0:w.partnerships)?void 0:a.enable_primo)||
1!1,P=(0,n.useQueryClient)(),{currentTeamId:O,teamIdForApi:R,userTeams:V,handleTeamChange:j,isRouteOk:U,isTeamAdmin:M,isTeamMaintainer:q}=(0,o.Ay)({location:t,router:e,includeAllTeams:!1,includeNoTeam:!0}),B=null!=R?R:0,H=(0,s.M8)(r.A.SOFTWARE_LIBRARY,{fleet_id:R}),z=!!(T||C||M||q),[W,Q]=(0,l.useState)(!1);(0,l.useEffect)(()=>{if("1"!==t.query.add_category)return;z&&Q(!0);const a=t.query,{add_category:l}=a,n=((e,t)=>{var a={};for(var l in e)$.call(e,l)&&t.indexOf(l)<0&&(a[l]=e[l]);if(null!=e&&F)for(var l of F(e))t.indexOf(l)<0&&L.call(e,l)&&(a[l]=e[l]);return a})(a,["add_category"]);e.replace({pathname:t.pathname,query:n})},[t.query,t.pathname,e,z]);const[K,G]=(0,l.useState)(null),[Y,Z]=(0,l.useState)(null),{data:J,isLoading:X,isError:ee}=(0,n.useQuery)(["selfServiceCategories",R],()=>c.A.getCategories(R),{enabled:!!S&&U&&void 0!==R,refetchOnWindowFocus:!1}),te=()=>{P.invalidateQueries(["selfServiceCategories",R])};return l.createElement(g.A,{className:D},l.createElement(l.Fragment,null,l.createElement(l.Fragment,null,l.createElement(d.A,{text:"Back to software library",path:H}),S&&!I?l.createElement("div",{className:`${D}__fleet-row`},l.createElement(_.A,{currentUserFleets:null!=V?V:[],selectedFleetId:O,onChange:j,includeAllFleets:!1,includeUnassigned:!0})):l.createElement("h1",null,"Self-service categories"),l.createElement(E.A,{content:l.createElement(l.Fragment,null,"Manage self-service categories."," ",l.createElement(p.A,{url:"https://fleetdm.com/learn-more-about/self-service-software-categories",text:"Learn more",newTab:!0}))})),(()=>{var e;if(!S)return l.createElement("div",{className:`${D}__premium-card`},l.createElement(b.A,null));if(!U||X)return l.createElement(y.A,null);if(ee)return l.createElement(f.A,{verticalPaddingSize:"pad-xxxlarge",selfCenter:!0});const t=null!=(e=null==J?void 0:J.self_service_categories)?e:[];return t.length>0?l.createElement(A.A,{className:`${D}__list`,keyAttribute:"id",listItems:t,HeadingComponent:()=>l.createElement("div",{className:`${D}__list-header`},l.createElement("span",{className:`${D}__list-title`},"Self-service categories"),z&&l.createElement(m.A,{variant:"secondary",onClick:()=>Q(!0),icon:"plus"},"Add category")),ListItemComponent:({listItem:e})=>l.createElement("div",{className:`${D}__row`},l.createElement("div",{className:`${D}__row-name`},l.createElement(h.A,{value:e.name})),z&&l.createElement("div",{className:`${D}__row-actions`},l.createElement(m.A,{variant:"secondary",onClick:()=>G(e),ariaLabel:`Edit ${e.name}`,title:"Edit",icon:"pencil"}),l.createElement(m.A,{variant:"secondary",onClick:()=>Z(e),ariaLabel:`Delete ${e.name}`,title:"Delete",icon:"trash"})))}):l.createElement(v.A,{variant:"header-list",header:"No self-service categories",info:z?"Add category to group your software and scripts in self service.":"No self-service categories are available.",primaryButton:z?l.createElement(m.A,{onClick:()=>Q(!0)},"Add category"):void 0})})(),W&&l.createElement(x,{fleetId:B,onExit:()=>Q(!1),onSuccess:()=>{te(),Q(!1),u.me.success("Successfully added self-service category.")}}),K&&l.createElement(k,{category:K,onExit:()=>G(null),onSuccess:()=>{te(),G(null),u.me.success("Successfully updated self-service category.")}}),Y&&l.createElement(N,{category:Y,onExit:()=>Z(null),onSuccess:()=>{te(),Z(null),u.me.success("Successfully deleted self-service category.")}})))}},18016:function(e,t,a){a.r(t),a.d(t,{default:function(){return M}});var l=a(96540),n=a(75942),r=a(2543),i=a(78263),o=a(77931),s=a(45584),c=a(79519),u=a(68774),d=a(9467),m=a(89937),p=a(12968),f=a(34724),v=a(74953),g=a(24432),E=a(2367),b=a(431),y=a(26806),_=a(46692),h=a(73870),A=a(56906),w=a(30104),S=a(40925),T=a(75679),C=a(52603),I=a(2837),x=a(81790),P=a(33745);const k="software-library-table";var O=({router:e,data:t,isSoftwareEnabled:a,query:n,perPage:r,orderDirection:o,orderKey:s,selfServiceOnly:c,currentPage:O,teamId:N,isLoading:F})=>{const{isGlobalAdmin:$,isGlobalMaintainer:L,isTeamAdmin:D,isTeamMaintainer:R}=(0,l.useContext)(u.BR),V=$||L||D||R,j=(0,l.useCallback)(e=>{var t;const a=Object.entries(e).find(([e,t])=>{switch(e){case"searchQuery":return t!==n;case"sortDirection":return t!==o;case"sortHeader":return t!==s;case"pageIndex":return t!==O;default:return!1}});return null!=(t=null==a?void 0:a[0])?t:""},[O,o,s,n]),U=(0,l.useCallback)((e,t)=>{const a={query:e.searchQuery,fleet_id:N,order_direction:e.sortDirection,order_key:e.sortHeader,page:"pageIndex"===t||""===t?e.pageIndex:0};return c&&(a.self_service="true"),a},[c,N]),M=(0,l.useCallback)(t=>{const a=j(t),l=(0,d.g2)({pathPrefix:i.A.SOFTWARE_LIBRARY,routeTemplate:"",queryParams:U(t,a)});e.replace(l)},[j,U,e]),q=null==t?void 0:t.software_titles,B=(0,l.useMemo)(()=>t?((e,t)=>[{Header:e=>l.createElement(S.A,{value:"Name",isSortedDesc:e.column.isSortedDesc}),disableSortBy:!1,accessor:"name",Cell:a=>{var n;const r=((e,t)=>{const a=(0,p.M8)(i.A.SOFTWARE_TITLE_DETAILS(e.id.toString()),{fleet_id:t}),{software_package:l,app_store_app:n}=e;let r,o=!1,s=!1,c=null;l?(o=!0,s=l.self_service,r=l.automatic_install_policies&&l.automatic_install_policies.length>0?"automatic":"manual"):n&&(o=!0,s=n.self_service,c=n.icon_url,r=n.automatic_install_policies&&n.automatic_install_policies.length>0?"automatic":"manual"),e.icon_url&&(c=e.icon_url);const u=(0,w.YQ)(e);return{name:e.name,displayName:e.display_name,source:e.source,path:a,hasInstaller:o,isSelfService:s,installType:r,iconUrl:c,automaticInstallPoliciesCount:u}})(a.row.original,t),o=!!a.row.original.app_store_app&&"android_apps"===a.row.original.source;return l.createElement(x.A,{name:r.name,display_name:r.displayName,source:r.source,path:r.path,router:e,hasInstaller:r.hasInstaller,isSelfService:r.isSelfService,iconUrl:null!=(n=r.iconUrl)?n:void 0,automaticInstallPoliciesCount:r.automaticInstallPoliciesCount,isIosOrIpadosApp:(0,A.bV)(r.source),isAndroidPlayStoreApp:o})},sortType:"caseInsensitive"},{Header:"Installed version",disableSortBy:!0,accessor:"versions",Cell:e=>l.createElement(P.A,{versions:e.cell.value})},{Header:"Library version",disableSortBy:!0,id:"library_version",Cell:e=>
1{const t=(a=e.row.original).software_package?a.software_package.version||null:a.app_store_app&&a.app_store_app.latest_version||null;var a;return l.createElement(T.A,{value:t||"---",grey:!t})}},{Header:"Type",disableSortBy:!0,accessor:"source",Cell:e=>l.createElement(T.A,{value:(0,A.Nt)(e.row.original)})},{Header:e=>l.createElement(S.A,{value:l.createElement(C.A,{tipContent:"Hosts with any version installed."},"Hosts"),disableSortBy:!1,isSortedDesc:e.column.isSortedDesc}),disableSortBy:!1,accessor:"hosts_count",Cell:e=>l.createElement(T.A,{value:e.cell.value})},{Header:"",id:"view-all-hosts",disableSortBy:!0,Cell:e=>{const{source:a}=e.row.original;return A.gm.includes(a)?null:l.createElement(I.A,{queryParams:{software_title_id:e.row.original.id,fleet_id:t},className:"software-link",rowHover:!0})}}])(e,N):[],[t,e,N]),H=q&&q.length>0,z=!(a&&(H||""!==n||c)),W=()=>{const t={query:n,fleet_id:N,order_direction:o,order_key:s,page:0};c||(t.self_service="true"),e.replace((0,d.g2)({pathPrefix:i.A.SOFTWARE_LIBRARY,routeTemplate:"",queryParams:t}))},Q=()=>{e.push((0,p.M8)(i.A.SOFTWARE_LIBRARY_CATEGORIES,{fleet_id:N}))};return l.createElement("div",{className:k},l.createElement(f.A,{columnConfigs:B,data:null!=q?q:[],isLoading:F,resultsTitle:"items",emptyComponent:()=>a?""!==n||c?l.createElement(E.A,{header:"No items match the current search criteria",info:"Expecting to see software? Check back later."}):l.createElement(E.A,{header:"No software available",info:V?"Add software to your library to get started.":"Software added to this fleet's library will appear here.",primaryButton:V?l.createElement(v.A,{onClick:()=>e.push((0,p.M8)(i.A.SOFTWARE_ADD_FLEET_MAINTAINED,{fleet_id:N}))},"Add software"):void 0}):l.createElement(h.A,{isSoftwareDisabled:!0}),defaultSortHeader:s,defaultSortDirection:o,pageIndex:O,defaultSearchQuery:n,manualSortBy:!0,pageSize:r,showMarkAllPages:!1,isAllPagesSelected:!1,disableNextPage:!(null==t?void 0:t.meta.has_next_results),searchable:!0,disableSearch:z,inputPlaceHolder:"Search by name",onQueryChange:M,customControl:()=>l.createElement("div",{className:`${k}__controls`},l.createElement(v.A,{variant:"secondary",onClick:Q,icon:"settings"},"Categories"),l.createElement(y.A,{value:c,onChange:W,inactiveText:"Self service only",activeText:"Self service only",disabled:z})),stackControls:!0,renderCount:()=>l.createElement(l.Fragment,null,l.createElement(_.A,{name:"items",count:null==t?void 0:t.count}),q&&(null==t?void 0:t.counts_updated_at)&&l.createElement(b.A,{lastUpdatedAt:t.counts_updated_at,customTooltipText:l.createElement(l.Fragment,null,"The last time software data was ",l.createElement("br",null),"updated, including vulnerabilities ",l.createElement("br",null),"and host counts.")})),renderTableHelpText:()=>l.createElement("div",null,"Seeing unexpected software?"," ",l.createElement(g.A,{url:m.CO,text:"File an issue on GitHub",newTab:!0})),disableMultiRowSelect:!0,onSelectSingleRow:t=>{if(!t.original.id)return;const a=i.A.SOFTWARE_TITLE_DETAILS(t.original.id.toString());e.push((0,p.M8)(a,{fleet_id:N}))}}))},N=Object.defineProperty,F=Object.defineProperties,$=Object.getOwnPropertyDescriptors,L=Object.getOwnPropertySymbols,D=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable,V=(e,t,a)=>t in e?N(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,j=(e,t)=>{for(var a in t||(t={}))D.call(t,a)&&V(e,a,t[a]);if(L)for(var a of L(t))R.call(t,a)&&V(e,a,t[a]);return e};const U={keepPreviousData:!0,staleTime:3e4};var M=({router:e,isSoftwareEnabled:t,query:a,perPage:u,orderDirection:d,orderKey:m,selfServiceOnly:p,currentPage:f,teamId:v})=>{const{data:g,isFetching:E,isLoading:b,isError:y}=(0,n.useQuery)([j({scope:"software-library",page:f,perPage:u,query:a,orderDirection:d,orderKey:m,teamId:v,availableForInstall:!0},p?{selfService:!0}:{})],({queryKey:[e]})=>o.A.getSoftwareTitles((0,r.omit)(e,"scope")),(_=j({},U),h={enabled:void 0!==v&&window.location.pathname===i.A.SOFTWARE_LIBRARY},F(_,$(h))));var _,h;return b?l.createElement(s.A,null):y?l.createElement(c.A,{verticalPaddingSize:"pad-xxxlarge"}):l.createElement("div",{className:"software-library"},l.createElement(O,{router:e,data:g,isSoftwareEnabled:t,query:a,perPage:u,orderDirection:d,orderKey:m,selfServiceOnly:p,currentPage:f,teamId:v,isLoading:E}))}},78833:function(e,t,a){a.r(t),a.d(t,{default:function(){return x}});var l=a(96540),n=a(75942),r=a(91310),i=a(79519),o=a(45584),s=a(78263),c=a(89937),u=a(24432),d=a(34724),m=a(431),p=a(46692),f=a(41995),v=a(73870),g=a(93588),E=a(12968),b=a(9467);const y="software-os-table",_=[{disabled:!1,label:"All platforms",value:"all"},{disabled:!1,label:"macOS",value:"darwin"},{disabled:!1,label:"Windows",value:"windows"},{disabled:!1,label:"Linux",value:"linux"},{disabled:!1,label:"ChromeOS",value:"chrome"},{disabled:!1,label:"iOS",value:"ios"},{disabled:!1,label:"iPadOS",value:"ipados"},{disabled:!1,label:"Android",value:"android"}];var h=({router:e,isSoftwareEnabled:t,data:a,perPage:n,orderDirection:r,orderKey:i,currentPage:o,teamId:h,isLoading:A,platform:w="all"})=>{var S;const T=(0,l.useCallback)(e=>{var t;const a=Object.entries(e).find(([e,t])=>{switch(e){case"sortDirection":return t!==r;case"sortHeader":return t!==i;case"pageIndex":return t!==o;case"platform":return t!==w;default:return!1}});return null!=(t=null==a?void 0:a[0])?t:""},[w,o,r,i]),C=(0,l.useCallback)((e,t)=>({fleet_id:h,order_direction:e.sortDirection,order_key:e.sortHeader,page:"pageIndex"===t?e.pageIndex:0,platform:w}),[h,w]),I=(0,l.useCallback)(t=>{const a=T(t);if(""===a)return;const l=(0,b.g2)({pathPrefix:s.A.SOFTWARE_OS,routeTemplate:"",queryParams:C(t,a)});e.replace(l)},[T,C,e]),x=(0,l.useMemo)(()=>a?(0,g.A)(h,e,{includeName:!0,includeVulnerabilities:!0,includeIcon:!0}):[],[a,e,h]),P=(null==a?void 0:a.os_versions)&&(null==a?void 0:a.os_versions.length)>0,k=!t||!P&&!("all"!==w),O=t=>{null==e||e.replace((0,b.g2)({pathPrefix:s.A.SOFTWARE_OS,queryParams:{fleet_id:h,order_direction:r,order_key:i,page:0,platform:null==t?void 0:t.value}}))};return l.createElement("div",{className:y},l.createElement(d.A,{columnConfigs:x,data:null!=(S=null==a?void 0:a.os_versions)?S:[],isLoading:A,resultsTitle:"items",emptyComponent:()=>l.createElement(v.A,{tableName:"operating systems",isSoftwareDisabled:!t,noSearchQuery:!0}),defaultSortHeader:i,defaultSortDirection:r,pageIndex:o,manualSortBy:!0,pageSize:n,showMarkAllPages:!1,isAllPagesSelected:!1,customControl:()=>l.createElement(f.A,{name:"os-platform-dropdown",value:w||"all",className:`${y}__platform-dropdown`,options:_,onChange:O,variant:"table-filter",isDisabled:k}),disableNextPage:!(null==a?void 0:a.meta.has_next_results),searchable:!1,onQueryChange:I,renderCount:()=>a?l.createElement(l.Fragment,null,l.createElement(p.A,{name:"items",count:null==a?void 0:a.count}),!k&&(null==a?void 0:a.counts_updated_at)&&l.createElement(m.A,{lastUpdatedAt:a.counts_updated_at,customTooltipText:l.createElement(l.Fragment,null,"The last time software data was ",l.createElement("br",null),"updated, including vulnerabilities ",l.createElement("br",null),"and host counts.")})):null,renderTableHelpText:()=>l.createElement("div",null,"Seeing unexpected software or vulnerabilities?"," ",l.createElement(u.A,{url:c.CO,text:"File an issue on GitHub",newTab:!0})),disableMultiRowSelect:!0,onSelectSingleRow:t=>{const a=(0,E.M8)(s.A.SOFTWARE_OS_DETAILS(Number(t.original.os_version_id)),{fleet_id:h});e.push(a)}}))},A=Object.defineProperty,w=Object.getOwnPropertySymbols,S=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable,C=(e,t,a)=>t in e?A(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,I=(e,t)=>{for(var a in t||(t={}))S.call(t,a)&&C(e,a,t[a]);if(w)for(var a of w(t))T.call(t,a)&&C(e,a,t[a]);return e},x=({router:e,isSoftwareEnabled:t,perPage:a,orderDirection:s,orderKey:c,currentPage:u,teamId:d,platform:m})=>{const p={page:u,per_page:a,order_direction:s,order_key:c,platform:"all"===m?void 0:m,teamId:d,max_vulnerabilities:3},{data:f,isFetching:v,isLoading:g,isError:E}
1=(0,n.useQuery)([I({scope:"software-os"},p)],()=>(0,r.kT)(p),{keepPreviousData:!0,staleTime:3e4});return g?l.createElement(o.A,null):E?l.createElement(i.A,{verticalPaddingSize:"pad-xxxlarge"}):l.createElement("div",{className:"software-os"},l.createElement(h,{router:e,data:f,isSoftwareEnabled:t,perPage:a,orderDirection:s,orderKey:c,currentPage:u,teamId:d,isLoading:v,platform:m}))}},2221:function(e,t,a){a.r(t),a.d(t,{default:function(){return K}});var l=a(96540),n=a(75942),r=a(24740),i=a(38944),o=a(68774),s=a(12755),c=a(43015),u=a(91310),d=a(89937),m=a(45584),p=a(827),f=a(48392),v=a(81766),g=a(60678),E=a(71436),b=a(82296),y=a(49634),_=a(56884),h=a(32485),A=a.n(h),w=a(78263),S=a(12968),T=a(34724),C=a(46692),I=a(2367),x=a(24432),P=a(2837),k=a(52603),O=a(75679),N=a(24228),F=a(40925),$=a(29844);const L=()=>l.createElement(I.A,{header:"No kernels detected",info:l.createElement(l.Fragment,null,"Expecting to see kernels?"," ",l.createElement(x.A,{url:d.CO,text:"File an issue on GitHub",newTab:!0}))});var D=({osName:e,osVersion:t,data:a,isLoading:n,className:r,router:i,teamIdForApi:o})=>{const s=A()("os-kernels-table",r),c=(({teamId:e,osName:t,osVersion:a})=>[{title:"Version",Header:"Version",disableSortBy:!0,accessor:"version",Cell:t=>{if(!t.cell.value)return l.createElement(O.A,null);const{id:a}=t.row.original,n=(0,S.M8)(w.A.SOFTWARE_VERSION_DETAILS(a.toString()),{fleet_id:e});return l.createElement(N.A,{className:"name-link",path:n,value:t.cell.value})}},{title:"Vulnerabilities",Header:"Vulnerabilities",disableSortBy:!0,accessor:"vulnerabilities",Cell:e=>l.createElement($.A,{vulnerabilities:e.cell.value})},{title:"Hosts",Header:()=>{const e=l.createElement(k.A,{tipContent:l.createElement(l.Fragment,null,"Linux hosts may have multiple kernels",l.createElement("br",null)," installed. Containers do not have their",l.createElement("br",null)," own kernel."),className:"status-header"},"Hosts");return l.createElement(F.A,{value:e,disableSortBy:!0})},disableSortBy:!0,accessor:"hosts_count",Cell:e=>l.createElement(O.A,{value:e.cell.value})},{title:"",Header:"",accessor:"linkToFilteredHosts",disableSortBy:!0,Cell:n=>l.createElement(l.Fragment,null,n.row.original&&l.createElement(P.A,{queryParams:{software_version_id:n.row.original.id,fleet_id:e,os_name:t,os_version:a},className:"software-link",rowHover:!0}))}])({teamId:o,osName:e,osVersion:t});return l.createElement("div",{className:s},l.createElement(T.A,{columnConfigs:c,data:a,defaultSortHeader:"hosts_count",emptyComponent:L,isLoading:n,isClientSidePagination:!0,isClientSideFilter:!0,pageSize:20,resultsTitle:"items",showMarkAllPages:!1,isAllPagesSelected:!1,disableMultiRowSelect:!0,onSelectSingleRow:e=>{if(e.original.cve){const t=e.original.cve.toString(),a=(0,S.M8)(w.A.SOFTWARE_VULNERABILITY_DETAILS(t),{fleet_id:o});i.push(a)}},disableTableHeader:0===a.length,renderCount:()=>l.createElement(C.A,{name:"items",count:null==a?void 0:a.length})}))},R=Object.defineProperty,V=Object.defineProperties,j=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,M=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable,B=(e,t,a)=>t in e?R(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;const H="software-os-details-page",z=({osVersion:e,countsUpdatedAt:t,teamIdForApi:a})=>l.createElement(v.A,{borderRadiusSize:"xxlarge",className:`${H}__summary-section`},l.createElement(E.A,{displayName:e.name,hostCount:e.hosts_count,countsUpdatedAt:t,queryParams:{os_name:e.name_only,os_version:e.version,fleet_id:a},name:e.platform,isOperatingSystem:!0})),W=({osVersion:e,isLoading:t,router:a,teamIdForApi:n})=>{const r=c.qE.includes(e.platform)||(0,c.eX)(e.platform);return l.createElement(v.A,{borderRadiusSize:"xxlarge",className:`${H}__vulnerabilities-section`},l.createElement(g.A,{header:"Vulnerabilities"}),r?l.createElement(b.A,{data:e.vulnerabilities,itemName:"version",isLoading:t,router:a,teamIdForApi:n}):l.createElement(_.s,{platformText:d.uc[e.platform]||e.platform}))},Q=({osVersion:e,isLoading:t,router:a,teamIdForApi:n})=>l.createElement(v.A,{borderRadiusSize:"xxlarge",className:`${H}__summary-section`},l.createElement(g.A,{header:"Kernels"}
1),l.createElement(D,{osName:e.name_only,osVersion:e.version,data:e.kernels,isLoading:t,router:a,teamIdForApi:n}));var K=({routeParams:e,router:t,location:a})=>{const{isPremiumTier:v,isOnGlobalTeam:g,config:E}=(0,l.useContext)(o.BR),b=(0,r.useErrorHandler)(),_=parseInt(e.id,10),{currentTeamId:h,teamIdForApi:A,userTeams:w,handleTeamChange:S}=(0,i.Ay)({location:a,router:t,includeAllTeams:!0,includeNoTeam:!0}),[T,C]=(0,l.useState)(0),{data:{os_version:I,counts_updated_at:x}={},isLoading:P,isError:k}=(0,n.useQuery)([{scope:"osVersionDetails",os_version_id:_,teamId:A,max_vulnerabilities:T}],({queryKey:e})=>u.Ay.getOSVersion(e[0]),(O=((e,t)=>{for(var a in t||(t={}))M.call(t,a)&&B(e,a,t[a]);if(U)for(var a of U(t))q.call(t,a)&&B(e,a,t[a]);return e})({},d.QL),V(O,j({retry:!1,enabled:!!_,select:e=>({os_version:e.os_version,counts_updated_at:e.counts_updated_at}),onError:e=>{(0,s.j8)(e,[403,404])||b(e)},onSuccess:e=>{const{os_version:{platform:t,vulnerabilities_count:a}}=e;!(0,c.eX)(t)&&a&&a>0&&0===T&&C(void 0)}}))));var O;const N=(0,l.useCallback)(e=>{S(e)},[S]);return l.createElement(p.A,{className:H},l.createElement(l.Fragment,null,(()=>{var e;if(P)return l.createElement(m.A,null);if(!I&&!k)return null;const a=(0,c.eX)((null==I?void 0:I.platform)||"");return l.createElement(l.Fragment,null,v&&!(null==(e=null==E?void 0:E.partnerships)?void 0:e.enable_primo)&&l.createElement(f.A,{isOnGlobalTeam:g,currentTeamId:h,userTeams:w,onTeamChange:N}),k||!I?l.createElement(y.A,{header:"OS not detected",details:"No hosts have this OS installed."}):l.createElement(l.Fragment,null,l.createElement(z,{osVersion:I,countsUpdatedAt:x,teamIdForApi:A}),!a&&l.createElement(W,{osVersion:I,isLoading:P,router:t,teamIdForApi:A}),a&&l.createElement(Q,{osVersion:I,isLoading:P,router:t,teamIdForApi:A})))})()))}},79244:function(e,t,a){a.d(t,{V:function(){return s},u:function(){return u}});var l=a(96540),n=a(53110),r=a(12755),i=a(30104),o=a(54184);const s="Couldn't edit software.",c=`${s} Please try again.`,u=(e,t)=>{var a,u;const d=(0,n.F0)(e)&&(504===(null==(a=e.response)?void 0:a.status)||408===(null==(u=e.response)?void 0:u.status)),m=(0,r.F3)(e);if(d)return`${s} Request timeout. Please make sure your server and load balancer timeout is long enough.`;if(m.includes("selected package is"))return l.createElement(l.Fragment,null,"Couldn't edit"," ",l.createElement("b",null,(0,i.Yd)(t.name,t.display_name)),"."," ",m);if(m.includes("Secret variable"))return(0,i.C3)(e).replace("Couldn't add","Couldn't edit");if(m.includes("some or all of the categories provided"))return l.createElement(l.Fragment,null,"Couldn't edit"," ",l.createElement("b",null,(0,i.Yd)(t.name,t.display_name)),"."," ","Some or all of the categories provided were not found. Please refresh the page and try again.");if(!m)return c;const p=m.replace(/^Couldn't [^.]*\.\s*/,"");return p?`${s} ${(0,o.U_)(p)}`:c}},95576:function(e,t,a){a.r(t),a.d(t,{default:function(){return Ta}});var l=a(96540),n=a(75942),r=a(24740),i=a(78263),o=a(38944),s=a(4346),c=a(68774),u=a(43015),d=a(56906),m=a(90508),p=a(67409),f=a(30104),v=Object.defineProperty,g=Object.getOwnPropertySymbols,E=Object.prototype.hasOwnProperty,b=Object.prototype.propertyIsEnumerable,y=(e,t,a)=>t in e?v(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,_=(e,t)=>{for(var a in t||(t={}))E.call(t,a)&&y(e,a,t[a]);if(g)for(var a of g(t))b.call(t,a)&&y(e,a,t[a]);return e},h=a(9467);const A=e=>{const t=(0,l.useContext)(c.BR),{gitOpsModeEnabled:a,repoURL:n}=(0,s.A)("software");return(0,l.useMemo)(()=>{if(!e.software_package&&!e.app_store_app)return;const l=(e=>{const t=e.software_package?e.software_package:e.app_store_app,a=(0,d.Az)(t);return{softwareTitleName:e.name,softwareDisplayName:(0,f.Yd)(e.name,e.display_name),softwareInstaller:t,name:a&&t.name||e.name,version:(a?t.version:t.latest_version)||null,source:e.source,iconUrl:e.icon_url,displayName:e.display_name,addedTimestamp:a?t.uploaded_at:t.created_at,status:a?(0,d.BY)(t.status):t.status,isSelfService:t.self_service,isScriptPackage:d.i0.includes(e.source)||!1,autoUpdateEnabled:e.auto_update_enabled,autoUpdateStartTime:e.auto_update_window_start,autoUpdateEndTime:e.auto_update_window_end}}
1)(e),{softwareInstaller:r,source:i}=l,o=(0,d.bV)(i),s=(0,d.Az)(r)?"package":"app-store",c="platform"in r&&(0,u.m0)(r.platform),m=!(!c||!("app_store_id"in r))&&(0,f.VI)(r.app_store_id),p="fleet_maintained_app_id"in r&&!!r.fleet_maintained_app_id,v=p&&"fleet_maintained_versions"in r&&!!r.fleet_maintained_versions&&r.fleet_maintained_versions.every(e=>{var t,a;return(0,h.Zy)(null!=(t=r.version)?t:"",null!=(a=e.version)?a:"")>=0}),g=p&&"fleet_maintained_versions"in r?r.fleet_maintained_versions:[],E="package"===s&&!p,b="hash_sha256"in r&&r.hash_sha256||void 0,y=c&&"app_store_id"in r?null==r?void 0:r.app_store_id:void 0,{automatic_install_policies:_}=r,A="patch_policy"in r?r.patch_policy:void 0,{isGlobalAdmin:w,isGlobalMaintainer:S,isTeamAdmin:T,isTeamMaintainer:C}=t;return{cardInfo:l,meta:{installerType:s,isAndroidPlayStoreApp:c,isAndroidPlayStoreWebApp:m,isFleetMaintainedApp:p,isLatestFmaVersion:v,fmaVersions:g,isCustomPackage:E,isIosOrIpadosApp:o,sha256:b,androidPlayStoreId:y,patchPolicy:A,automaticInstallPolicies:_,gitOpsModeEnabled:a,repoURL:n,canManageSoftware:!!(w||S||T||C),softwareInstaller:r}}},[e,t,a,n])};var w=a(12755),S=a(62131),T=a(95681),C=a(77931),I=a(12968),x=a(89937),P=a(46157),k=a(74953),O=a(52603),N=a(45584),F=a(827),$=a(48392),L=a(96948),D=a(29448),R=a(49634),V=a(18165),j=a(81766),U=a(32485),M=a.n(U),q=a(52978);const B="chip";var H=({icon:e,text:t,trailingIcon:a,className:n,onClick:r,tooltip:i})=>{const o=M()(B,n,r&&`${B}__clickable-chip`),s=l.createElement(l.Fragment,null,e&&l.createElement(q.A,{name:e,size:"small",color:"ui-fleet-black-75"}),l.createElement("span",{className:`${B}__text`},t),a&&l.createElement(q.A,{name:a,size:"small",color:"ui-fleet-black-75"})),c=r?l.createElement("button",{type:"button",className:o,onClick:r},s):l.createElement("div",{className:o},s);return i?l.createElement(O.A,{tipContent:i,position:"top",underline:!1,showArrow:!0,tipOffset:8},c):c},z=a(71436),W=a(53806),Q=a(23543),K=a(99958),G=a(48262),Y=a(80717),Z=a(6511),J=a(15570),X=a(37738),ee=a(69906),te=a(46692),ae=a(73967),le=a(25862),ne=a(42526),re=a(34724),ie=a(2367),oe=a(24432),se=a(431),ce=a(75679),ue=a(40925),de=a(2837),me=a(24228),pe=a(29844);const fe=e=>l.createElement(se.A,{lastUpdatedAt:e,customTooltipText:l.createElement(l.Fragment,null,"The last time software data was ",l.createElement("br",null),"updated, including vulnerabilities ",l.createElement("br",null),"and host counts.")});var ve=({router:e,data:t,isLoading:a,teamIdForApi:n,isIPadOSOrIOSApp:r,isAvailableForInstall:o,countsUpdatedAt:s})=>{const c=(0,l.useMemo)(()=>(({teamId:e,isIPadOSOrIOSApp:t})=>[{title:"Version",Header:e=>l.createElement(ue.A,{value:"Version",isSortedDesc:e.column.isSortedDesc}),disableSortBy:!1,accessor:"version",sortType:"version",Cell:t=>{if(!t.cell.value)return l.createElement(ce.A,null);const{id:a}=t.row.original,n=(0,I.M8)(i.A.SOFTWARE_VERSION_DETAILS(a.toString()),{fleet_id:e});return l.createElement(me.A,{className:"name-link",path:n,value:t.cell.value})}},{title:"Vulnerabilities",Header:"Vulnerabilities",disableSortBy:!0,accessor:"vulnerabilities",Cell:e=>t?l.createElement(ce.A,{value:"Not supported",grey:!0}):l.createElement(pe.A,{vulnerabilities:e.cell.value})},{title:"Hosts",Header:e=>l.createElement(ue.A,{value:"Hosts",isSortedDesc:e.column.isSortedDesc}),disableSortBy:!1,accessor:"hosts_count",Cell:e=>l.createElement(ce.A,{value:e.cell.value})},{title:"",Header:"",accessor:"linkToFilteredHosts",disableSortBy:!0,Cell:t=>l.createElement(l.Fragment,null,t.row.original&&l.createElement(de.A,{queryParams:{software_version_id:t.row.original.id,fleet_id:e},className:"software-link",rowHover:!0}))}])({teamId:n,isIPadOSOrIOSApp:r}),[n,r]);return l.createElement(re.A,{className:"software-title-versions-table",columnConfigs:c,data:t,isLoading:a,emptyComponent:()=>((e=!1)=>l.createElement(ie.A,{header:e?"No versions detected":"No versions detected for this software item",info:e?"Install this software on a host to see versions.":l.createElement(l.Fragment,null,"Expecting to see versions?"," ",l.createElement(oe.A,{url:x.CO,text:"File an issue on GitHub",newTab:!0}))}))(o),showMarkAllPages:!1,isAllPagesSelected:!1,defaultSortHeader:"hosts_count",defaultSortDirection:"desc",pageSize:10,isClientSidePagination:!0,disableMultiRowSelect:!0,onSelectSingleRow:t=>{if(t.original.id){const a=t.original.id,l=(0,I.M8)(i.A.SOFTWARE_VERSION_DETAILS(a.toString()),{fleet_id:n});e.push(l)}},renderCount:()=>l.createElement(l.Fragment,null,(null==t?void 0:t.length)>0&&l.createElement(te.A,{name:"versions",count:null==t?void 0:t.length}),s&&fe(s)),hideFooter:(null==t?void 0:t.length)<=10})},ge=Object.defineProperty,Ee=Object.defineProperties,be=Object.getOwnPropertyDescriptors,ye=Object.getOwnPropertySymbols,_e=Object.prototype.hasOwnProperty,he=Object.prototype.propertyIsEnumerable,Ae=(e,t,a)=>t in e?ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,we=(e,t)=>{for(var a in t||(t={}))_e.call(t,a)&&Ae(e,a,t[a]);if(ye)for(var a of ye(t))he.call(t,a)&&Ae(e,a,t[a]);return e},Se=(e,t)=>Ee(e,be(t));const Te="edit-icon-modal",Ce="Couldn't edit. Please try again.",Ie=e=>{if(!e)return null;const t=e.match(/filename\*\s*=\s*([^;
1]+)/);if(t){const e=t[1].trim().replace(/^UTF-8''/,"");return decodeURIComponent(e)}const a=e.match(/filename\s*=\s*["']?([^"';]+)["']?/);return a?a[1]:null},xe=(e,t)=>({name:e.name,description:`Software icon • ${t||"?"}x${t||"?"} px`}),Pe={previewUrl:null,formData:null,dimensions:null,fileDetails:null,status:"apiCustom"};var ke=({softwareId:e,teamIdForApi:t,software:a,onExit:r,refetchSoftwareTitle:i,iconUploadedAt:o,setIconUploadedAt:s,installerType:u,previewInfo:m})=>{var p;const{config:v}=(0,l.useContext)(c.BR),g=(0,n.useQueryClient)(),E="package"===u,b=(0,d.bV)((null==m?void 0:m.source)||""),y=(0,d._K)((null==m?void 0:m.source)||""),_=!!m.currentIconUrl&&m.currentIconUrl.startsWith("/api/"),h=m.titleName!==m.name,A=h?m.name:"",[S,T]=(0,l.useState)(A),[I,x]=(0,l.useState)(Pe),[O,F]=(0,l.useState)(0),[$,L]=(0,l.useState)(!1),[D,R]=(0,l.useState)(_),V=!!m.currentIconUrl&&m.currentIconUrl.startsWith("/api/"),U=!!m.currentIconUrl&&!m.currentIconUrl.startsWith("/api/"),M="customUpload"===I.status,q=V&&"fallback"===I.status&&!I.formData,B=M||q,H=h&&""===S||!h&&""!==S||h&&""!==S&&S!==m.name,z=B||H,re=(0,l.useCallback)((e,t,a)=>x({previewUrl:a,formData:{icon:e,display_name:S},dimensions:t,fileDetails:xe(e,t),status:"apiCustom"}),[S]),ie=(0,l.useCallback)(()=>{const e=m.currentIconUrl&&!m.currentIconUrl.startsWith("/api/")?m.currentIconUrl:null;x({previewUrl:e,formData:null,dimensions:null,fileDetails:null,status:"fallback"})},[m.currentIconUrl]),{data:oe,isError:se}=(0,n.useQuery)(["softwareIcon",e,t,o],()=>C.A.getSoftwareIcon(e,t),{enabled:_,retry:!1,select:e=>e?{blob:e.data,filename:Ie(e.headers["content-disposition"]),url:URL.createObjectURL(e.data)}:""}),{data:ce}=(0,n.useQuery)(["selfServiceCategories",t],()=>Q.A.getCategories(t),{select:e=>e.self_service_categories,staleTime:6e4}),ue=(null!=(p=null==ce?void 0:ce.length)?p:0)>0,de=()=>{ie(),r()};(0,l.useEffect)(()=>{if(se&&D)return R(!1),void ie();if(_&&"apiCustom"===I.status&&oe&&!I.previewUrl){const e=new Image;return e.onload=()=>{fetch(oe.url).then(e=>{const t=oe.filename||"icon.png";return e.blob().then(e=>({blob:e,filename:t}))}).then(({blob:t,filename:a})=>{re(new File([t],a,{type:"image/png"}),e.width,oe.url),R(!1)})},void(e.src=oe.url)}U&&"customUpload"!==I.status&&x({previewUrl:m.currentIconUrl,formData:null,dimensions:null,fileDetails:null,status:"fallback"})},[oe,se,D,I.status,_,I.previewUrl,m.currentIconUrl,U,re,ie]);const me=I.formData&&I.formData.icon?{name:I.formData.icon.name,description:`Software icon • ${I.dimensions||"?"}x${I.dimensions||"?"} px`}:void 0,pe=()=>{const{type:e,versions:t,source:n,currentIconUrl:r,countsUpdatedAt:i}=m;return l.createElement(j.A,{borderRadiusSize:"medium",color:"grey",className:`${Te}__preview-card`,paddingSize:"xlarge"},l.createElement(j.A,{borderRadiusSize:"xxlarge",className:`${Te}__preview-card__fleet`},l.createElement(ae.Ay,{displayName:S||m.titleName,name:m.titleName,type:e,source:n,iconUrl:!r&&a.icon_url?a.icon_url:null,versions:t,iconPreviewUrl:I.previewUrl,iconUploadedAt:o}),l.createElement("div",{className:`${Te}__preview-results-count`},l.createElement(te.A,{name:"versions",count:t}),i&&fe(i)),l.createElement("div",{className:`data-table-block ${Te}__preview-table`},l.createElement("div",{className:"data-table data-table__wrapper"},l.createElement("table",{className:"data-table__table"},l.createElement("thead",null,l.createElement("tr",{role:"row"},l.createElement("th",{className:"version__header",colSpan:1,role:"columnheader"},l.createElement("div",{className:"column-header"},"Version")),l.createElement("th",{className:"vulnerabilities__header",colSpan:1,role:"columnheader"},l.createElement("div",{className:"column-header"},"Vulnerabilities")))),l.createElement("tbody",null,l.createElement("tr",{className:"single-row",role:"row"},l.createElement("td",{className:"version__cell",role:"cell"},"88.0.1"),l.createElement("td",{className:"vulnerabilities__cell",role:"cell"},l.createElement("div",{className:"vulnerabilities-cell__vulnerability-text-with-tooltip","data-tip":"true","data-for":"86"},l.createElement("span",{className:"text-cell w250 italic-cell"},"20 vulnerabilities"))))))))),l.createElement("div",{className:`${Te}__mask-overlay ${Te}__mask-overlay--fleet`}))},ve=(0,f.Yd)(m.titleName);return l.createElement(K.A,{className:Te,title:"Edit appearance",onExit:de},D?l.createElement(N.A,null):l.createElement(l.Fragment,null,l.createElement(Y.A,{label:"Display name",onChange:({value:e})=>{T(e||""),x(t=>t.formData?Se(we({},t),{formData:Se(we({},t.formData),{display_name:e})}):t)},name:"displayName",value:S,parseTarget:!0,helpText:l.createElement(l.Fragment,null,"Optional. If left blank, Fleet will use"," ",l.createElement("strong",null,ve),"."),autofocus:!0}),l.createElement(Z.A,{label:"Icon",canEdit:!0,onDeleteFile:()=>ie(),graphicName:"file-png",accept:".png",message:"The icon must be a PNG file and square, with dimensions ranging from 120x120 px to 1024x1024 px.",onFileUpload:e=>{if(e&&e.length>0){const t=e[0];if(t.size>102400)return void P.me.error("Couldn't edit. Icon must be 100KB or less.");
1if("image/png"!==t.type)return void P.me.error("Couldn't edit. Must be a PNG file.");const a=new FileReader;a.onload=e=>{const a=new Image;a.onload=()=>{const{width:e,height:l}=a;if(e!==l||e<120||e>1024)return void P.me.error("Couldn't edit. Icon must be square, between 120x120px and 1024x1024px.");const n=URL.createObjectURL(t);((e,t,a)=>{x({previewUrl:a,formData:{icon:e},dimensions:t,fileDetails:xe(e,t),status:"customUpload"})})(t,e,n)},e.target&&"string"==typeof e.target.result?a.src=e.target.result:P.me.error("FileReader result was not a string.")},a.readAsDataURL(t)}},buttonMessage:"Choose file",buttonType:"secondary",className:`${Te}__file-uploader`,fileDetails:me,gitopsCompatible:!1}),l.createElement("h2",null,"Preview"),y?pe():l.createElement(J.A,null,l.createElement(W.tU,{selectedIndex:O,onSelect:e=>F(e)},l.createElement(W.wb,null,l.createElement(W.oz,null,l.createElement(X.A,null,"Fleet")),l.createElement(W.oz,null,l.createElement(X.A,null,"Self service"))),l.createElement(W.Kp,null,pe()),l.createElement(W.Kp,null,l.createElement(ne.A,{isIosOrIpadosApp:b,contactUrl:(null==v?void 0:v.org_info.contact_url)||"",name:m.name,displayName:S||m.titleName,versionLabel:"latest_version"in a?a.latest_version:a.version||m.selfServiceVersion||"Version (unknown)",hasCategories:ue,renderIcon:()=>I.previewUrl&&(0,f.KY)(I.previewUrl)?l.createElement("img",{src:I.previewUrl,alt:"Uploaded self-service icon",style:{width:24,height:24,borderRadius:"4px",overflow:"hidden"}}):l.createElement(ee.A,{name:m.name,source:m.source,url:E?void 0:a.icon_url,uploadedAt:o}),renderTable:()=>l.createElement(le.k,{name:S||m.titleName,displayName:S||m.titleName,source:m.source,iconUrl:E?void 0:a.icon_url,previewIcon:I.previewUrl&&(0,f.KY)(I.previewUrl)?l.createElement("img",{src:I.previewUrl,alt:"Uploaded self-service icon",style:{width:24,height:24,borderRadius:"4px",overflow:"hidden"}}):l.createElement(ee.A,{name:m.titleName,source:m.source,url:E?void 0:a.icon_url,uploadedAt:o})})}))))),l.createElement(G.A,{primaryButtons:l.createElement(k.A,{type:"submit",onClick:()=>{return n=function*(){var n;L(!0);const r=[];let o=!1,c=!1,d=null,p=null;try{try{"fallback"===I.status&&V&&!(null==(n=I.formData)?void 0:n.icon)?(yield C.A.deleteSoftwareIcon(e,t),o=!0,d=l.createElement(l.Fragment,null,"Successfully removed icon from ",l.createElement("b",null,null==a?void 0:a.name),".")):"customUpload"===I.status&&I.formData&&(yield C.A.editSoftwareIcon(e,t,I.formData),o=!0,d=l.createElement(l.Fragment,null,"Successfully edited ",l.createElement("b",null,m.name),"."))}catch(e){const t=(0,w.F3)(e)||Ce;r.push({variant:"error",message:t,options:{response:e}})}if(H)try{const n=(null!=S?S:"").trim();yield"package"===u?C.A.editSoftwarePackage({data:{displayName:n},softwareId:e,installerId:a.installer_id,teamId:t}):C.A.editAppStoreApp(e,t,{displayName:n}),c=!0,p=""===n?l.createElement(l.Fragment,null,"Successfully removed custom name for ",l.createElement("b",null,m.name),"."):l.createElement(l.Fragment,null,"Successfully renamed ",l.createElement("b",null,m.name)," to"," ",l.createElement("b",null,n),".")}catch(e){const t=(0,w.F3)(e)||Ce;r.push({variant:"error",message:t,options:{response:e}})}r.length>0?P.me.batch(r):o&&c?(P.me.success(l.createElement(l.Fragment,null,"Successfully edited"," ",l.createElement("b",null,""===S?m.name:S),".")),g.invalidateQueries({queryKey:[{scope:"software-titles"}]}),g.invalidateQueries({queryKey:[{scope:"software-library"}]}),i(),s((new Date).toISOString()),de()):o&&d?(P.me.success(d),g.invalidateQueries({queryKey:[{scope:"software-titles"}]}),g.invalidateQueries({queryKey:[{scope:"software-library"}]}),i(),s((new Date).toISOString()),de()):c&&p&&(P.me.success(p),g.invalidateQueries({queryKey:[{scope:"software-titles"}]}),g.invalidateQueries({queryKey:[{scope:"software-library"}]}),i(),s((new Date).toISOString()),de())}catch(e){const t=(0,w.F3)(e)||Ce;P.me.error(t,{response:e})}finally{L(!1)}},new Promise((e,t)=>{var a=e=>{try{r(n.next(e))}catch(e){t(e)}},l=e=>{try{r(n.throw(e))}catch(e){t(e)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(a,l);r((n=n.apply(null,null)).next())});var n},isLoading:$,disabled:!z||$},"Save")}))},Oe=a(63898),Ne=a(97873),Fe=a(65273),$e=a(9106),Le=a(70699),De=a(72753),Re=a(62190),Ve=a(26783),je=a(79244),Ue=({onSaveChanges:e,softwareInstallerName:t,installerType:a,onClose:n,isLoading:r})=>{const i="package"===a?l.createElement(l.Fragment,null,l.createElement("p",null,"The changes you are making will cancel any pen
1ding installs and uninstalls",t?l.createElement(l.Fragment,null," ","for ",l.createElement("b",null," ",t)):"","."),l.createElement("p",null,"Installs or uninstalls currently running on a host will still complete, but results won't appear in Fleet."),l.createElement("p",null,"You cannot undo this action.")):l.createElement("p",null,"When targets change, pending installs will still complete.");return l.createElement(K.A,{title:"Save changes?",onExit:n},l.createElement("form",{className:"save-changes-modal__form"},i,l.createElement("div",{className:"modal-cta-wrap"},l.createElement(k.A,{type:"button",onClick:e,className:"save-loading",isLoading:r},"Save"),l.createElement(k.A,{onClick:n,variant:"secondary"},"Cancel"))))},Me=Object.defineProperty,qe=Object.getOwnPropertySymbols,Be=Object.prototype.hasOwnProperty,He=Object.prototype.propertyIsEnumerable,ze=(e,t,a)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,We=(e,t,a)=>new Promise((l,n)=>{var r=e=>{try{o(a.next(e))}catch(e){n(e)}},i=e=>{try{o(a.throw(e))}catch(e){n(e)}},o=e=>e.done?l(e.value):Promise.resolve(e.value).then(r,i);o((a=a.apply(e,t)).next())});const Qe="edit-software-modal";var Ke=({softwareId:e,teamId:t,installerId:a,softwareInstaller:r,onExit:i,refetchSoftwareTitle:o,installerType:c,isFleetMaintainedApp:u=!1,isIosOrIpadosApp:d=!1,name:m,displayName:p,source:v,iconUrl:g,canActivateMultiplePackages:E=!1,patchWhenClosed:b=!1})=>{var y;const _=(0,n.useQueryClient)(),{gitOpsModeEnabled:h}=(0,s.A)("software"),A=h&&(u||E),w=b||"patch_policy"in r&&!!(null==(y=r.patch_policy)?void 0:y.patch_when_closed),S=M()(`${Qe}__package-form`,{[`${Qe}__package-form--disabled`]:A}),[T,I]=(0,l.useState)(Qe),[k,O]=(0,l.useState)(!1),[N,F]=(0,l.useState)(!1),[$,L]=(0,l.useState)(!1),[D,R]=(0,l.useState)({software:null,installScript:"",selfService:!1,automaticInstall:!1,targetType:"",customTarget:"",labelTargets:{},categories:[]}),[V,j]=(0,l.useState)({selfService:!1,automaticInstall:!1,targetType:"",customTarget:"",labelTargets:{},categories:[]}),[U,q]=(0,l.useState)(0),[B,H]=(0,l.useState)(!1),{data:z}=(0,n.useQuery)(["custom_labels"],()=>Ne.Ay.summary(t).then(e=>(0,Ne.f2)(e.labels)),((e,t)=>{for(var a in t||(t={}))Be.call(t,a)&&ze(e,a,t[a]);if(qe)for(var a of qe(t))He.call(t,a)&&ze(e,a,t[a]);return e})({},x.QL));(0,l.useEffect)(()=>{I(M()(Qe,{[`${Qe}--hidden`]:N||$||!!D.software&&k}))},[N,$,D.software,k]),(0,Oe.A)(k),(0,l.useEffect)(()=>{let e;return k?e=setTimeout(()=>{H(!0)},3e3):H(!1),()=>{e&&clearTimeout(e)}},[k]),(0,l.useEffect)(()=>{B&&F(!1)},[B]);const W=()=>{L(!$)},Q=n=>We(null,null,function*(){var s;O(!0);try{yield C.A.editSoftwarePackage({data:n,orignalPackage:r,softwareId:e,installerId:a,teamId:t,onUploadProgress:e=>{const t=e.progress||0;q(Math.max(t-.03,.01))},omitPreInstallQuery:w}),P.me.success(l.createElement(l.Fragment,null,"Successfully edited ",l.createElement("b",null,null==(s=n.software)?void 0:s.name),".",n.selfService?" The end user can install from Fleet Desktop.":"")),_.invalidateQueries({queryKey:[{scope:"software-titles"}]}),_.invalidateQueries({queryKey:[{scope:"software-library"}]}),o(),i()}catch(e){P.me.error((0,je.u)(e,r),{response:e})}O(!1)}),G=e=>1===Object.keys(e).length&&"selfService"in e,Y=e=>{var t;const a=r,l={software:null,installScript:a.install_script||"",preInstallQuery:a.pre_install_query||"",postInstallScript:a.post_install_script||"",uninstallScript:a.uninstall_script||"",selfService:a.self_service||!1,installType:(0,f.Kr)(a),targetType:(0,f.Ag)(a),customTarget:(0,f.lQ)(a),labelTargets:(0,f.ER)(a)};R(e);const n=(0,Fe.A)(e,l);(null==(t=e.categories)?void 0:t.length)||(e.categories=[""]),G(n)?Q(e):F(!0)},Z=a=>We(null,null,function*(){O(!0);try{yield C.A.editAppStoreApp(e,t,a),P.me.success(l.createElement(l.Fragment,null,"Successfully edited ",l.createElement("b",null,r.name),".",a.selfService?" The end user can install from Fleet Desktop.":"")),_.invalidateQueries({queryKey:[{scope:"software-titles"}]}),_.invalidateQueries({queryKey:[{scope:"software-library"}]}),i(),o()}catch(e){P.me.error((0,je.u)(e,r),{response:e})}O(!1)}),J=e=>We(null,null,function*(){const t={selfService:r.self_service||!1,automaticInstall:r.automatic_install||!1,targetType:(0,f.Ag)(r),customTarget:(0,f.lQ)(r),labelTargets:(0,f.ER)(r)};j(e);const a=(0,Fe.A)(e,t);G(a)?Z(e):F(!0)});return l.createElement(l.Fragment,null,l.createElement(K.A,{className:T,title:E?"Edit package":"Edit software",onExit:i,width:"large"},(()=>{if("package"===c){const e=r;return l.createElement(Re.A,{labels:z||[],className:S,isEditingSoftware:!0,isFleetMaintainedApp:u,onCancel:i,onSubmit:Y,onClickPreviewEndUserExperience:W,defaultSoftware:r,defaultInstallScript:e.install_script,defaultPreInstallQuery:e.pre_install_query,defaultPostInstallScript:e.post_install_script,defaultUninstallScript:e.uninstall_script,defaultSelfService:e.self_service,defaultCategories:e.categories,gitopsCompatible:A,teamId:t,patchWhenClosed:w})}return l.createElement(Ve.A,{labels:z||[],softwareVppForEdit:r,onSubmit:J,onCancel:i,isLoading:k,onClickPreviewEndUserExperience:W,teamId:t})})()),N&&l.createElement(Ue,{onClose:()=>{F(!N)},softwareInstallerName:null==r?void 0:r.name,installerType:c,onSaveChanges:()=>{"package"===c?Q(D):Z(V)},isLoading:k}),$&&l.createElement(De.A,{name:m,displayName:p,source:v,iconUrl:g,onCancel:W,teamId:t,isIosOrIpadosApp:d,mobileVersion:"latest_version"in r&&r.latest_version||r.version}),!!D.software&&B&&l.createElement(Le.A,{fileDetails:(0,$e.P$)(D.software),fileProgress:U}))},Ge=a(96470),Ye=a(30178),Ze=a(16087),Je=a(20881),Xe=a(48571);const et="installer-details-widget",tt=({name:e,disableTooltip:t})=>{const a=l.useRef(null),n=(0,Ze.K)(a);return l.createElement(O.A,{tipContent:e,position:"top",underline:!1,disableTooltip:t||!n,showArrow:!0},l.createElement("div",{ref:a,className:`${et}__title`},e))};var at=({className:e,softwareName:t,installerType:a,addedTimestamp:n,version:r,isFma:i,isLatestFmaVersion:o=!1,isScriptPackage:s,source:c,androidPlayStoreId:u,customDetails:d,hideInstallerType:m=!1,disableTooltips:p=!1})=>{const v=M()(et,e);return l.createElement("div",{className:v},"app-store"===a?u?l.createElement(ee.A,{name:"androidPlayStore",size:"medium"}):l.createElement(ee.A,{name:"appleAppStore",size:"medium"}):"py_packages"===c?l.createElement(Je.A,{name:"file-py"}):l.createElement(Je.A,{name:"file-pkg"}),l.createElement("div",{className:`${et}__info`},l.createElement(tt,{name:t,disableTooltip:p}),l.createElement("div",{className:`${et}__details`},(()=>{if(d)return l.createElement(l.Fragment,null,d);const e=[];m||e.push(((e,t,a)=>"package"===e?t?"Fleet-maintained":"Custom package":a?(0,f.VI)(a)?"Web app":"Google Play Store":"App Store (VPP)")(a,i,u));const c=s||(0,f.VI)(u)?null:u?p?l.createElement("span",null,"Latest"):l.createElement(Xe.A,{androidPlayStoreId:u}):r?i?l.createElement(O.A,{disableTooltip:p,tipContent:l.createElement("span",null,"You can change the version in ",l.createElement("strong",null,"Actions > Edit")," ","software.")},l.createElement("span",null,r," ",o?"(latest)":"")):"app-store"===a?l.createElement(O.A,{disableTooltip:p,tipContent:l.createElement("span",null,"Updated every hour.")},l.createElement("span",null,r)):l.createElement("span",null,r):l.createElement(O.A,{disableTooltip:p,tipContent:l.createElement("span",null,"Fleet couldn't read the version from ",t,".","package"===a&&l.createElement(l.Fragment,null," ",l.createElement(oe.A,{newTab:!0,url:`${x.CW}/read-package-version`,text:"Learn more",variant:"tooltip-link"})))},l.createElement("span",null,"Version (unknown)"));c&&e.push(c);const v=n?l.createElement(O.A,{disableTooltip:p,tipContent:(0,h.Fs)(new Date(n)),underline:!1},(0,Ye.PI)(n)):null;return v&&e.push(v),e.map((e,t)=>l.createElement(l.Fragment,{key:t},t>0&&l.createElement(l.Fragment,null," • "),e))})())))};const lt="Couldn't update configuration. Please try again.",nt=[/^NDES_SCEP_(CHALLENGE|PROXY_URL)$/,/^CUSTOM_SCEP_(CHALLENGE|PROXY_URL)_/,/^SCEP_RENEWAL_ID$/,/^DIGICERT_(DATA|PASSWORD)_/,/^SCEP_WINDOWS_CERTIFICATE_ID$/,/^SMALLST
1EP_SCEP_(CHALLENGE|PROXY_URL)_/],rt=(e,t)=>{const a=(0,w.F3)(e);return t||!a.includes("managedConfiguration")&&!a.includes("workProfileWidgets")?a.includes("unsupported variable")&&a.includes("$FLEET_VAR_")?(e=>{const t=e.match(/\$FLEET_VAR_(\w+)/);if(!t)return lt;const a=t[0];return l=t[1],nt.some(e=>e.test(l))?`Couldn't edit. Variable "${a}" isn't supported in managed configuration. It can only be used in configuration profiles.`:`Couldn't edit. Variable "${a}" doesn't exist.`;var l})(a):a.includes("missing from database")&&a.includes("$FLEET_SECRET_")?(e=>{const t=/"\$FLEET_SECRET_\w+"/g,a=[];let l=t.exec(e);for(;l;)a.push(l[0].replace(/"/g,"")),l=t.exec(e);if(0===a.length)return lt;const n=a.length>1?"s":"",r=a.length>1?"don't":"doesn't";return`Couldn't edit. Variable${n} ${a.map(e=>`"${e}"`).join(", ")} ${r} exist.`})(a):a||lt:l.createElement(l.Fragment,null,'Couldn\'t update configuration. Only "managedConfiguration" and "workProfileWidgets" are supported as top-level keys.')},it=e=>{switch(e){case"ios":return"iOS";case"ipados":return"iPadOS";case"android":return"Android";default:return e}},ot="edit-configuration-modal";var st=({softwareInstaller:e,softwareId:t,teamId:a,isApplePlatform:n,refetchSoftwareTitle:r,onExit:i})=>{const o=(0,d.Az)(e),s=e=>n?(e=>{var t;if(!e)return null;const a=(new DOMParser).parseFromString(e,"application/xml");if(a.querySelector("parsererror"))return"Invalid XML";const l=a.documentElement;return"dict"===l.tagName||"plist"===l.tagName&&"dict"===(null==(t=l.firstElementChild)?void 0:t.tagName)?null:"plist"===l.tagName?"<plist> root must contain a <dict> element.":"Root element must be <dict>. Apple managed app configurations require a <dict> root element."})(e):(e=>{if(!e)return null;try{JSON.parse(e)}catch(e){if("object"==typeof(t=e)&&null!==t&&"message"in t&&"string"==typeof t.message)return e.message.toString();throw e}var t;return null})(e),c=n&&!e.configuration,u=(0,l.useCallback)(e=>{c&&(e.moveCursorTo(1,2),e.clearSelection())},[c]),m=n?e.configuration||"<dict>\n  \n</dict>":JSON.stringify(e.configuration,null,"\t")||"{}",[p,v]=(0,l.useState)(!1),[g,E]=(0,l.useState)(!s(m)),[b,y]=(0,l.useState)(m),[_,h]=(0,l.useState)(()=>s(m)),A=()=>n?{configuration:b}:""===b?{configuration:{}}:{configuration:JSON.parse(b)},w=s=>{return c=function*(){v(!0),s.preventDefault();try{o?yield C.A.editSoftwarePackage({data:A(),softwareId:t,teamId:a}):yield C.A.editAppStoreApp(t,a,A()),P.me.success(l.createElement(l.Fragment,null,l.createElement("strong",null,(0,f.Yd)(e.name,e.display_name))," ","configuration updated.")),r(),i()}catch(e){P.me.error(rt(e,n),{response:e})}v(!1)},new Promise((e,t)=>{var a=e=>{try{n(c.next(e))}catch(e){t(e)}},l=e=>{try{n(c.throw(e))}catch(e){t(e)}},n=t=>t.done?e(t.value):Promise.resolve(t.value).then(a,l);n((c=c.apply(null,null)).next())});var c},S=n?"xml":"json";return l.createElement(K.A,{className:ot,title:"Edit configuration",onExit:i,width:"large"},(()=>{if(n){const t=o?e.version:e.latest_version;return l.createElement(at,{softwareName:e.name,installerType:o?"package":"app-store",version:t,isFma:!1,isScriptPackage:!1})}const t=e;return l.createElement(at,{softwareName:t.name,androidPlayStoreId:t.app_store_id,customDetails:it(t.platform),installerType:"app-store",isFma:!1,isScriptPackage:!1})})(),n?l.createElement("p",{className:`${ot}__description`},"Configuration edits, including variable changes, are only applied during future installs and updates. Learn more about"," ",l.createElement(oe.A,{newTab:!0,text:"variables",url:`${x.CW}/fleet-variables`})):null,l.createElement(Ge.A,{mode:S,value:b,helpText:n?l.createElement("div",{className:`${ot}__help-text`},"Managed app configuration, also known as App Config."," ",l.createElement(oe.A,{newTab:!0,text:"Learn more",url:`${x.CW}/ios-software-managed-configuration`})):l.createElement("div",{className:`${ot}__help-text`},"The Android app's configuration in JSON format."," ",l.createElement(oe.A,{newTab:!0,text:"Learn more",url:`${x.CW}/android-software-managed-configuration`})),onChange:e=>{y(e);const t=s(e);h(t),E(!t)},onLoad:u,readOnly:p,error:_,label:"Configuration"}),n?l.createElement(G.A,{primaryButtons:l.createElement(l.Fragment,null,l.createElement(k.A,{onClick:i,variant:"secondary"},"Cancel"),l.createElement(k.A,{type:"submit",onClick:w,isLoading:p,disabled:!g||p},"Save"))}):l.createElement(G.A,{primaryButtons:l.createElement(k.A,{type:"submit",onClick:w,isLoading:p,disabled:!g||p},"Save")}))},ct=a(5410),ut=a(22676),dt=a(59333);const mt=e=>{if(!e.match(/^[0-9]{2}:[0-9]{2}$/))return!1;const[t,a]=e.split(":").map(Number);return!(t<0||t>23||a<0||a>59)},pt={autoUpdateStartTime:{validations:[{name:"required",isValid:e=>e.autoUpdateStartTime.length>0,message:"Earliest start time is required"},{name:"valid",isValid:e=>0===e.autoUpdateStartTime.length||mt(e.autoUpdateStartTime),message:"Use HH:MM format (24-hour clock)"}]},autoUpdateEndTime:{validations:[{name:"required",isValid:e=>e.autoUpdateEndTime.length>0,message:"Latest start time is required"},{name:"valid",isValid:e=>0===e.autoUpdateEndTime.length||mt(e.autoUpdateEndTime),message:"Use HH:MM format (24-hour clock)"}]},targets:{validations:[{name:"custom_labels_selected",isValid:e=>
1"Custom"!==e.targetType||Object.values(e.labelTargets).filter(e=>e).length>0,message:"At least one label target must be selected"}]},windowLength:{validations:[{name:"minimum_length",isValid:(e,t)=>{if(!(0!==e.autoUpdateStartTime.length&&0!==e.autoUpdateEndTime.length&&(null==t?void 0:t.autoUpdateStartTime)&&t.autoUpdateStartTime.isValid&&t.autoUpdateEndTime&&t.autoUpdateEndTime.isValid))return!0;const[a,l]=e.autoUpdateStartTime.split(":").map(Number),[n,r]=e.autoUpdateEndTime.split(":").map(Number),i=60*a+l,o=60*n+r;return o<i||o-i>=60},message:"Update window must be at least 60 minutes long"}]}},ft=(e,t)=>void 0===t||"string"==typeof t?t:t(e),vt=(e,t=!1)=>{const a={isValid:!0};return Object.keys(pt).forEach(l=>{if(!e.autoUpdateEnabled&&"targets"!==l)return;const n=l,r=pt[n].validations.find(l=>!(!t&&"required"===l.name||l.isValid(e,a)));r?(a.isValid=!1,a[n]={isValid:!1,message:ft(e,r.message)}):a[n]={isValid:!0}}),a};var gt=Object.defineProperty,Et=Object.defineProperties,bt=Object.getOwnPropertyDescriptors,yt=Object.getOwnPropertySymbols,_t=Object.prototype.hasOwnProperty,ht=Object.prototype.propertyIsEnumerable,At=(e,t,a)=>t in e?gt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,wt=(e,t)=>{for(var a in t||(t={}))_t.call(t,a)&&At(e,a,t[a]);if(yt)for(var a of yt(t))ht.call(t,a)&&At(e,a,t[a]);return e},St=(e,t)=>Et(e,bt(t));const Tt="edit-auto-update-config-form";var Ct=({softwareTitle:e,teamId:t,refetchSoftwareTitle:a,onExit:r})=>{var i,o,c,u,d,m;const{gitOpsModeEnabled:p}=(0,s.A)("software"),v=M()(Tt,{"edit-auto-update-config-form--disabled":p}),[g,E]=(0,l.useState)(!1),[b,y]=(0,l.useState)({autoUpdateEnabled:e.auto_update_enabled||!1,autoUpdateStartTime:e.auto_update_window_start||"",autoUpdateEndTime:e.auto_update_window_end||"",targetType:(0,f.Ag)(e.app_store_app),customTarget:(0,f.lQ)(e.app_store_app),labelTargets:(0,f.ER)(e.app_store_app)}),{data:_}=(0,n.useQuery)(["custom_labels"],()=>Ne.Ay.summary(t).then(e=>(0,Ne.f2)(e.labels)),wt({},x.QL)),[h,A]=(0,l.useState)(()=>vt(b)),w=n=>{return i=function*(){n.preventDefault();const i=vt(b,!0);if(A(i),!i.isValid)return!1;E(!0);try{yield C.A.editAppStoreApp(e.id,t,b),P.me.success(l.createElement(l.Fragment,null,l.createElement("strong",null,(0,f.Yd)(e.name,e.display_name))," ","configuration updated.")),a(),r()}catch(e){P.me.error("An error occurred while updating the configuration. Please try again.",{response:e})}return E(!1),!0},new Promise((e,t)=>{var a=e=>{try{n(i.next(e))}catch(e){t(e)}},l=e=>{try{n(i.throw(e))}catch(e){t(e)}},n=t=>t.done?e(t.value):Promise.resolve(t.value).then(a,l);n((i=i.apply(null,null)).next())});var i},S=e=>{const t=e.value.substring(0,5).replace(/[^0-9:]/g,""),a=St(wt({},b),{[e.name]:t});y(a);const l=vt(a),n=l[e.name];(null==n?void 0:n.isValid)&&A(l)},T=(null==(i=h.autoUpdateStartTime)?void 0:i.message)||((null==(o=h.windowLength)?void 0:o.message)?"Earliest start time":void 0),I=(null==(c=h.autoUpdateEndTime)?void 0:c.message)||((null==(u=h.windowLength)?void 0:u.message)?"Latest start time":void 0),O=(null==(d=h.windowLength)?void 0:d.message)||l.createElement(l.Fragment,null,"Update window (host’s local time)"),N=M()("form-field__label",{"form-field__label--error":!!(null==(m=h.windowLength)?void 0:m.message)});return l.createElement(K.A,{className:"edit-auto-update-config-modal",title:"Schedule auto updates",onExit:r},l.createElement("div",{className:v},l.createElement("div",{className:`${Tt}__form-frame`},l.createElement(j.A,{paddingSize:"medium",borderRadiusSize:"medium"},l.createElement("div",{className:`${Tt}__auto-update-config`},l.createElement("div",{className:"form-field"},l.createElement("div",{className:"form-field__label"},"Auto updates"),l.createElement("div",{className:"form-field__subtitle"},"Automatically update"," ",l.createElement("strong",null,(0,f.Yd)(e.name,e.display_name))," ","on all targeted hosts when a new version is available."),l.createElement("div",null,l.createElement(ct.A,{value:b.autoUpdateEnabled,onChange:e=>(e=>{const t=St(wt({},b),{autoUpdateEnabled:e});y(t),A(vt(t))})(e)},"Enable auto updates"))),b.autoUpdateEnabled&&l.createElement(l.Fragment,null,l.createElement("div",null,l.createElement("div",{className:"form-field"},l.createElement("div",{className:N},O),l.createElement("div",{className:"form-field__subtitle"},'Times are formatted as HH:MM in 24 hour time (e.g., "13:37").'))),l.createElement("div",null,l.createElement("div",{className:`${Tt}__auto-update-schedule-form`},l.createElement("span",{className:"date-time-inputs"},l.createElement(Y.A,{value:b.autoUpdateStartTime,onChange:S,onBlur:()=>A(vt(b)),label:"Earliest start time",name:"autoUpdateStartTime",parseTarget:!0,error:T}),l.createElement(Y.A,{value:b.autoUpdateEndTime,onChange:S,onBlur:()=>A(vt(b)),label:"Latest start time",name:"autoUpdateEndTime",parseTarget:!0,error:I}))))))),l.createElement(j.A,{paddingSize:"medium",borderRadiusSize:"medium"},l.createElement(ut.m,{selectedTargetType:b.targetType,selectedCustomTarget:b.customTarget,selectedLabels:b.labelTargets,customTargetOptions:f.fK,className:`${Tt}__target`,onSelectTargetType:e=>{const t=St(wt({},b),{targetType:e});y(t),A(vt(t))},onSelectCustomTarget:e=>{const t=St(wt({},b),{customTarget:e});y(t),A(vt(t))},onSelectLabel:({name:e,value:t})=>{const a=St(wt({},b),{labelTargets:St(wt({},b.labelTargets),{[e]:t})});y(a),A(vt(a))},labels:_||[],dropdownHelpText:(0,f.a3)(!1,b.customTarget),subTitle:"Changes to targets will also apply to self service."})))),l.createElement(G.A,{primaryButtons:l.createElement(l.Fragment,null,l.createElement(k.A,{onClick:r,variant:"secondary"}
1,"Cancel"),l.createElement(dt.A,{entityType:"software",position:"top",tipOffset:8,renderChildren:e=>l.createElement(k.A,{type:"submit",onClick:w,isLoading:g,disabled:!h.isValid||g||e},"Save")}))}))},It=a(80396),xt=a(66081),Pt=a(99301),kt=Object.defineProperty,Ot=Object.defineProperties,Nt=Object.getOwnPropertyDescriptors,Ft=Object.getOwnPropertySymbols,$t=Object.prototype.hasOwnProperty,Lt=Object.prototype.propertyIsEnumerable,Dt=(e,t,a)=>t in e?kt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,Rt=(e,t)=>{for(var a in t||(t={}))$t.call(t,a)&&Dt(e,a,t[a]);if(Ft)for(var a of Ft(t))Lt.call(t,a)&&Dt(e,a,t[a]);return e},Vt=({softwareTitle:e,teamId:t,onExit:a,onSuccess:r})=>{var i;const o=e.software_package,s=null!=(i=null==o?void 0:o.automatic_install_policies)?i:[],c=null==o?void 0:o.patch_policy,u=s.find(t=>"dynamic"===t.type&&t.name===(0,Pt.fP)(e.name)),d=!!c&&s.some(e=>e.id===c.id);let m=c?"manual":"closed";(null==c?void 0:c.patch_when_closed)?m="closed":d&&(m="force");const[p,f]=(0,l.useState)(!!u),[v,g]=(0,l.useState)(!!c),[E,b]=(0,l.useState)(m),[y,_]=(0,l.useState)(!1),h=null==o?void 0:o.fleet_maintained_app_id,{data:A,isLoading:S}=(0,n.useQuery)(["fleet-maintained-app",h,t],()=>C.A.getFleetMaintainedApp(h,String(t)),(T=Rt({},x.QL),Ot(T,Nt({enabled:!!h&&!u,select:e=>e.fleet_maintained_app}))));var T;const I=()=>{return l=function*(){_(!0);let l=!1;try{if(p!==!!u){if(p){if(!(null==A?void 0:A.automatic_install_query))return void P.me.error("Couldn't create the Force install policy. Try again.");yield It.A.create({team_id:t,name:(0,Pt.fP)(e.name),description:(0,Pt.S4)(e.name),query:A.automatic_install_query,platform:A.platform,software_title_id:e.id})}else u&&(yield It.A.destroy(t,[u.id]));l=!0}v!==!!c?(v?yield It.A.create(Rt(Rt({team_id:t,type:"patch",patch_software_title_id:e.id},"manual"!==E&&{software_title_id:e.id}),(0,xt.kl)(E))):c&&(yield It.A.destroy(t,[c.id])),l=!0):v&&c&&(E!==m||d!==("manual"!==E)||c.patch_when_closed!==(0,xt.kl)(E).patch_when_closed||c.continuous_automations_enabled!==(0,xt.kl)(E).continuous_automations_enabled)&&(yield It.A.update(c.id,Rt({team_id:t,software_title_id:"manual"===E?null:e.id},(0,xt.kl)(E))),l=!0),l&&P.me.success("Successfully updated deploy options."),r(),a()}catch(e){l?(P.me.error("Some changes were saved, but others couldn't be. Try again.",{response:e}),r(),a()):P.me.error((0,w.F3)(e),{response:e})}finally{_(!1)}},new Promise((e,t)=>{var a=e=>{try{r(l.next(e))}catch(e){t(e)}},n=e=>{try{r(l.throw(e))}catch(e){t(e)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(a,n);r((l=l.apply(null,null)).next())});var l};return l.createElement(K.A,{className:"deploy-modal",title:"Deploy",onExit:a,isContentDisabled:y},l.createElement(l.Fragment,null,l.createElement(dt.A,{entityType:"software",renderChildren:e=>l.createElement(xt.Yw,{forceInstall:p,patch:v,patchOption:E,onToggleForceInstall:f,onTogglePatch:g,onSelectPatchOption:b,disabled:e||S,showPatchWhenClosedNotice:!0,hideLabel:!0})}),l.createElement("div",{className:"modal-cta-wrap"},l.createElement(dt.A,{entityType:"software",position:"top",tipOffset:8,renderChildren:e=>l.createElement(k.A,{onClick:I,isLoading:y,disabled:e||S},"Save")}),l.createElement(k.A,{variant:"secondary",onClick:a},"Cancel"))))},jt=a(77823),Ut=({className:e,teamId:t,isLoading:a=!1,policies:n,hideCount:r=!1})=>{const o=M()("installer-policies-table",e),s=(({teamId:e})=>[{accessor:"name",title:"Name",Header:e=>l.createElement(ue.A,{value:e.column.title,isSortedDesc:e.column.isSortedDesc}),Cell:t=>l.createElement(me.A,{value:t.cell.value,tooltipTruncate:!0,path:(0,I.M8)(i.A.POLICY_DETAILS(t.row.original.id),{fleet_id:e}),className:"w400",suffix:l.createElement(jt.A,{policyType:t.row.original.type})})}])({teamId:t}),c=(0,l.useCallback)(()=>l.createElement(te.A,{name:"policies",count:null==n?void 0:n.length}),[null==n?void 0:n.length]);return l.createElement(re.A,{className:o,isLoading:a,columnConfigs:s,data:n||[],renderCount:c,disableCount:r,disablePagination:!0,disableMultiRowSelect:!0,emptyComponent:()=>l.createElement(l.Fragment,null),showMarkAllPages:!1,isAllPagesSelected:!1,hideFooter:!0})};const Mt="policies-modal";var qt=({policies:e,teamId:t,onExit:a})=>l.createElement(K.A,{className:Mt,title:"Policies",onExit:a},l.createElement(l.Fragment,null,0===e.length?l.createElement("p",{className:`${Mt}__empty`},"No policies are linked to this software."):l.createElement(Ut,{teamId:t,policies:e,hideCount:!0}),l.createElement("div",{className:"modal-cta-wrap"},l.createElement(k.A,{onClick:a},"Done"))));const Bt="software-summary-card",Ht=(e,t)=>
1e?l.createElement(l.Fragment,null,"Policy fails if the host is on an older version."):t?l.createElement(l.Fragment,null,"Policy triggers install."):l.createElement(l.Fragment,null,"Policies trigger install.");var zt=({softwareTitle:e,softwareId:t,teamId:a,router:n,refetchSoftwareTitle:r,onClickVersions:o,canActivateMultiplePackages:s=!1})=>{var u,m,p,v,g,E,b,y,_,h,w,S,T,C,x,P;const{isPremiumTier:k}=(0,l.useContext)(c.BR),O=A(e),[N,F]=(0,l.useState)(""),[$,L]=(0,l.useState)(!1),[D,R]=(0,l.useState)(!1),[U,M]=(0,l.useState)(!1),[q,B]=(0,l.useState)(!1),[W,Q]=(0,l.useState)(!1),[K,G]=(0,l.useState)(!1),Y=(0,f.Yd)(e.name,e.display_name,e.bundle_identifier),Z=null==O?void 0:O.meta.installerType,J=!!(null==O?void 0:O.meta.isFleetMaintainedApp),X=!!(null==O?void 0:O.meta.isAndroidPlayStoreApp),ee=!!(null==O?void 0:O.meta.isCustomPackage),te=null==(u=e.software_package)?void 0:u.automatic_install_policies,ae=null==(m=e.app_store_app)?void 0:m.automatic_install_policies,le=null==(p=e.software_package)?void 0:p.patch_policy,ne=(0,l.useMemo)(()=>(0,f.$p)({automaticInstallPolicies:null!=te?te:ae,patchPolicy:le}),[te,ae,le]),re=!!(null==(v=e.software_package)?void 0:v.self_service)||!!(null==(g=e.app_store_app)?void 0:g.self_service),ie=ne.length>0,oe=ie&&ne.every(e=>!e.type.has("dynamic")),se="app-store"===Z&&!X,ce=null!=(b=null==(E=e.packages)?void 0:E.length)?b:1,ue=null==(y=[[J,"Fleet-maintained"],[se,"App Store (VPP)"],[X,"Play Store"],[ee,(0,V.td)(ce,"Custom package")]].find(([e])=>e))?void 0:y[1],de=re&&!s,me=ie&&!s,pe=!!ue||de||me,fe=(0,l.useMemo)(()=>{if(pe)return l.createElement(l.Fragment,null,ue&&l.createElement(H,{text:ue}),de&&l.createElement(H,{icon:"user",text:"Self service",tooltip:(0,f.F$)((0,d.bV)(e.source),(0,d._K)(e.source))}),me&&l.createElement(H,{icon:oe?void 0:"refresh",text:oe?"Patch policy":"Auto install",onClick:()=>{1!==ne.length?G(!0):n.push((0,I.M8)(i.A.POLICY_DETAILS(ne[0].id),{fleet_id:a}))},tooltip:Ht(oe,1===ne.length)}))},[pe,ue,de,me,oe,ne,e.source,n,a]),ve=K&&l.createElement(qt,{policies:ne,teamId:a,onExit:()=>G(!1)});if(!O)return l.createElement(l.Fragment,null,l.createElement(j.A,{borderRadiusSize:"xxlarge",className:Bt},l.createElement(z.A,{displayName:Y,type:(0,d.Nt)(e),versions:null!=(h=null==(_=e.versions)?void 0:_.length)?h:0,hostCount:e.hosts_count,countsUpdatedAt:e.counts_updated_at,queryParams:{software_title_id:t,fleet_id:a},name:e.name,source:e.source,iconUrl:e.icon_url,iconUploadedAt:N,headerPills:fe})),ve);const{softwareInstaller:ge,isIosOrIpadosApp:Ee,isAndroidPlayStoreWebApp:be,canManageSoftware:ye}=O.meta,_e=ye,he=ye&&!X,Ae=ye&&(X&&!be||Ee),we=ye&&J&&!!k,Se=ye&&J&&!!k,Te="number"==typeof a&&a>=0&&ge,Ce=e.app_store_app&&Ee&&ye;return l.createElement(l.Fragment,null,l.createElement(j.A,{borderRadiusSize:"xxlarge",className:Bt},l.createElement(z.A,{displayName:Y,type:(0,d.Nt)(e),versions:null!=(S=null==(w=e.versions)?void 0:w.length)?S:0,hostCount:e.hosts_count,countsUpdatedAt:e.counts_updated_at,queryParams:{software_title_id:t,fleet_id:a},name:e.name,source:e.source,iconUrl:e.icon_url,iconUploadedAt:N,canManageSoftware:ye,onClickEditAppearance:_e?()=>L(!0):void 0,onClickEditSoftware:he&&!s?()=>R(!0):void 0,useSingleEditAppearanceButton:s,onClickDeploy:we?()=>M(!0):void 0,onClickVersions:Se?o:void 0,onClickEditConfiguration:Ae?()=>B(!0):void 0,onClickEditAutoUpdateConfig:Ce?()=>Q(!0):void 0,headerPills:fe,isAppleVpp:se})),$&&Te&&l.createElement(ke,{softwareId:t,teamIdForApi:a,software:ge,onExit:()=>L(!1),refetchSoftwareTitle:r,iconUploadedAt:N,setIconUploadedAt:F,installerType:O.meta.installerType,previewInfo:{name:Y,titleName:e.name,type:(0,d.Nt)(e),source:e.source,currentIconUrl:e.icon_url,versions:null!=(C=null==(T=e.versions)?void 0:T.length)?C:0,countsUpdatedAt:e.counts_updated_at,selfServiceVersion:ge.version}}),D&&Te&&l.createElement(Ke,{softwareId:t,teamId:a,softwareInstaller:ge,onExit:()=>R(!1),refetchSoftwareTitle:r,installerType:O.meta.installerType,isFleetMaintainedApp:J,isIosOrIpadosApp:Ee,name:e.name,displayName:Y,source:e.source,iconUrl:e.icon_url,patchWhenClosed:null==(P=null==(x=e.software_package)?void 0:x.patch_policy)?void 0:P.patch_when_closed}),U&&Te&&l.createElement(Vt,{softwareTitle:e,teamId:a,onSuccess:r,onExit:()=>M(!1)}),q&&Te&&l.createElement(st,{softwareInstaller:ge,softwareId:t,teamId:a,isApplePlatform:Ee,refetchSoftwareTitle:r,onExit:()=>B(!1)}),W&&Te&&l.createElement(Ct,{softwareTitle:e,teamId:a,refetchSoftwareTitle:r,onExit:()=>Q(!1)}),ve)},Wt=a(57390),Qt=a(25809),Kt=a(24039);const Gt="library-item-accordion",Yt={includeAny:"Include any",includeAll:"Include all",excludeAny:"Exclude any"},Zt="All hosts";var Jt=({filename:e,version:t,addedAt:a,installerType:n="package",androidPlayStoreId:r,isFma:i=!1,isLatestFmaVersion:o,isScriptPackage:s=!1,source:c,isTarballPackage:u=!1,isIosOrIpadosApp:d=!1,isActive:m,canEditSoftw
1are:p,badgeState:v,labels:g,labelKind:E="includeAny",installed:b,pending:y,failed:_,installedPath:h,pendingPath:A,failedPath:w,hashSha256:S,canDownload:T,onBadgeClick:C,onLabelCountClick:I,onLabelsClick:x,onEditClick:P,onDownloadClick:N,onTrashClick:F,canActivateMultiplePackages:$=!1,isSelfService:L=!1,hasAutoInstallPolicy:D=!1,isAndroidPlayStoreApp:R=!1,onSelfServiceClick:V,onAutoInstallClick:j})=>{var U;const[B,H]=(0,l.useState)(!1),z=null!=(U=null==g?void 0:g.length)?U:0,W=z>0,Q=m&&!W,K=m,G=K&&B,Y=()=>{K&&H(e=>!e)},Z=l.createElement(l.Fragment,null,"Select ",l.createElement("strong",null,"Actions > Versions")," and pin this version to rollback."),J=(null!=g?g:[]).map(e=>e.name).sort((e,t)=>e.localeCompare(t)),X=e=>t=>{t.stopPropagation(),null==e||e()},ee=(e,t)=>C?l.createElement(k.A,{variant:"subdued",size:"small",onClick:X(C),className:`${Gt}__badge-button`,icon:e},l.createElement("span",null,t)):l.createElement("span",{className:`${Gt}__badge-button ${Gt}__badge-button--static`},l.createElement(q.A,{name:e}),l.createElement("span",null,t)),te=({iconName:e,tooltipContent:t,ariaLabel:a,onClick:n,canClick:r=!0})=>l.createElement(O.A,{tipContent:t,showArrow:!0,underline:!1,position:"top",tipOffset:8},n&&r?l.createElement(k.A,{variant:"subdued",onClick:X(n),className:`${Gt}__icon-button`,ariaLabel:a,icon:e}):l.createElement(q.A,{name:e})),ae=(e,t,a,n,r,i)=>l.createElement("div",{className:`${Gt}__status-count`},n?l.createElement(O.A,{tipContent:n,showArrow:!0,underline:!1,position:"top",tipOffset:8,clickable:!1},l.createElement(q.A,{name:e})):l.createElement(q.A,{name:e}),l.createElement(oe.A,{url:r,text:`${t} ${a}`,className:`${Gt}__status-count-link`}),i),le=!!r,ne=s?"ran":"installed",re=s?l.createElement(l.Fragment,null,"The script successfully",l.createElement("br",null),"ran on these hosts."):le?null:l.createElement(l.Fragment,null,"Software is installed on these hosts",l.createElement("br",null),"(install script finished with exit code 0).",l.createElement("br",null),"Currently, if the software is uninstalled,",l.createElement("br",null),'the "Installed" status won\'t be updated.'),ie=s?l.createElement(l.Fragment,null,"Fleet is running the script or will do",l.createElement("br",null),"so when the host comes online."):le?l.createElement(l.Fragment,null,"Software will be installed or configuration will",l.createElement("br",null),"be applied the next time the host checks in."):l.createElement(l.Fragment,null,"Fleet is installing/uninstalling or will",l.createElement("br",null),"do so when the host comes online."),se=s?l.createElement(l.Fragment,null,"These hosts failed to run the script.",l.createElement("br",null),"Click on a host to view error(s)."):le?l.createElement(l.Fragment,null,"Software failed to install or configuration failed to apply."):l.createElement(l.Fragment,null,"These hosts failed to install/uninstall",l.createElement("br",null),"software. Click on a host to view error(s)."),ce=le?l.createElement(l.Fragment,null,"Latest status from the Google Play Store"):u?l.createElement(l.Fragment,null,"Latest status from policy automation or manual install."):d?l.createElement(l.Fragment,null,"Latest status from setup experience or manual install."):l.createElement(l.Fragment,null,"Latest status from policy automation,",l.createElement("br",null),"setup experience, or manual install."),ue=e=>l.createElement(k.A,{variant:"secondary",disabled:e,onClick:F,ariaLabel:"Delete this version",className:`${Gt}__trash-button`,icon:"trash"}),de=i||"app-store"===n||$,me=l.createElement("div",{role:"button",className:`${Gt}__header`,onClick:Y,onKeyDown:e=>{K&&("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),Y()))},"aria-expanded":G,"aria-disabled":!K,tabIndex:K?0:-1},l.createElement("span",{className:M()(`${Gt}__chevron`,{[`${Gt}__chevron--open`]:G})},l.createElement(q.A,{name:"chevron-right",color:"ui-fleet-black-75"})),l.createElement(at,{className:`${Gt}__installer-details`,softwareName:e,installerType:n,version:t,addedTimestamp:a,isFma:i,isLatestFmaVersion:o,isScriptPackage:s,source:c,androidPlayStoreId:r,hideInstallerType:!0,disableTooltips:!m}),l.createElement("div",{className:`${Gt}__header-right`},m?l.createElement("div",{className:`${Gt}__badges`},i&&"latest"===v&&ee("refresh","Latest"),$&&L&&te({iconName:"user",tooltipContent:(0,f.F$)(!!d,!!R),ariaLabel:"Edit package",onClick:V,canClick:p}),$&&D&&te({iconName:"refresh",tooltipContent:l.createElement(l.Fragment,null,"Policy triggers install."),ariaLabel:"View auto-install policies",onClick:j}),"pinned"===v&&ee("pin","Pinned"),"majorVersion"===v&&ee("pin","Major version"),W&&l.createElement(O.A,{tipContent:l.createElement("div",{style:{textAlign:"center"}},l.createElement("strong",null,Yt[E],":"),l.createElement("br",null),J.map((e,t)=>l.createElement(l.Fragment,{key:e},e,t<J.length-1&&l.createElement("br",null)))),showArrow:!0,underline:!1,position:"top",tipOffset:8},p?l.createElement(k.A,{variant:"subdued",size:"small",onClick:X(I),className:`${Gt}__badge-button`,icon:"tag"},l.createElement("span",null,z)):l.createElement("span",{className:`${Gt}__badge-button ${Gt}__badge-button--static`},l.createElement(q.A,{name:"tag"}),l.createElement("span",null,z))),Q&&(p?l.createElement(k.A,{variant:"subdued",size:"small",onClick:X(I),className:`${Gt}__badge-button`,icon:"tag"},l.createElement("span",null,Zt)):l.createElement("span",{className:`${Gt}__badge-button ${Gt}__badge-button--static`},l.createElement(q.A,{name:"tag"}),l.createElement("span",null,Zt)))):null));return l.createElement("div",{className:M()(Gt,{[`${Gt}--inactive`]:!m,[`${Gt}--expanded`]:G})},m?me:l.createElement(O.A,{className:`${Gt}__inactive-tooltip`,tipContent:Z,showArrow:!0,underline:!1,position:"top",tipOffset:8,disableTooltip:!p},me),G&&l.createElement("div",{className:`${Gt}__panel`},l.createElement("div",{className:`${Gt}__status-column`},l.createElement("div",{className:`${Gt}__status-counts`},ae("success",b,ne,re,h,l.createElement(O.A,{className:`${Gt}__status-counts-info`,tipContent:ce,showArrow:!0,underline:!1,position:"top",tipOffset:8},l.createElement(q.A,{name:"info-outline",color:"ui-fleet-black-50"}))),ae("pending-outline",y,"pending",ie,A),ae("error",_,"failed",se,w))),l.createElement("div",{className:`${Gt}__details-column`},W?l.createElement("div",{className:`${Gt}__data-row`},l.createElement("p",{className:`${Gt}__data-heading`},Yt[E]),l.createElement(Kt.A,{className:`${Gt}__data-value`,items:J,onClick:p?x:void 0})):null,S?l.createElement("div",{className:`${Gt}__data-row`},l.createElement("p",{className:`${Gt}__data-heading`},"Hash"),l.createElement("div",{className:`${Gt}__hash-row`},l.createElement(Qt.A,{className:`${Gt}__hash`,value:S}),l.createElement(Wt.A,{copyText:S,variant:"subdued",ariaLabel:"Copy hash to clipboard"}))):null),l.createElement("div",{className:`${Gt}__actions-column`},p&&P&&l.createElement(k.A,{variant:"secondary",onClick:P,ariaLabel:"Edit software",className:`${Gt}__edit-button`,icon:"pencil"}),T&&l.createElement(k.A,{variant:"secondary",onClick:N,ariaLabel:"Download installer",className:`${Gt}__download-button`,icon:"download"}),p&&(de?l.createElement(dt.A,{position:"top",tipOffset:8,entityType:"softw
1are",renderChildren:e=>ue(!!e)}):ue(!1)))))};const Xt="library-item-accordion-list";var ea=({children:e,className:t})=>{const a=t?`${Xt} ${t}`:Xt;return l.createElement("div",{className:a},e)},ta=a(38021);const aa="delete-software-modal",la=l.createElement(l.Fragment,null,"Couldn't delete. This software is installed during new host setup. Please remove software in ",l.createElement("strong",null,"Controls > Setup experience")," ","and try again.");var na=({softwareId:e,teamId:t,installerId:a,onExit:n,onSuccess:r,gitOpsModeEnabled:i,isAppStoreApp:o=!1,isAndroidApp:s=!1,canActivateMultiplePackages:c=!1})=>{const[u,d]=(0,l.useState)(!1),m=(0,l.useCallback)(()=>{return l=function*(){d(!0);try{yield C.A.deleteSoftwareInstaller(e,t,a),P.me.success("Successfully deleted software."),r()}catch(e){const t=(0,w.F3)(e);t.includes("This software has a patch policy")?P.me.error("Couldn't delete. This software has a patch policy. Please remove the patch policy and try again.",{response:e}):t.includes("Policy automation uses this software")?P.me.error("Couldn't delete. Policy automation uses this software. Please disable policy automation for this software and try again.",{response:e}):t.includes("This software is installed during")?P.me.error(la,{response:e}):P.me.error("Couldn't delete. Please try again.",{response:e})}d(!1),n()},new Promise((e,t)=>{var a=e=>{try{r(l.next(e))}catch(e){t(e)}},n=e=>{try{r(l.throw(e))}catch(e){t(e)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(a,n);r((l=l.apply(null,null)).next())});var l},[e,t,a,r,n]);return l.createElement(K.A,{className:aa,title:c?"Delete package":"Delete software",onExit:n,isContentDisabled:u},i&&l.createElement(ta.A,{className:`${aa}__gitops-warning`},"You are currently in GitOps mode. If the package is defined in GitOps, it will reappear when GitOps runs."),((e,t)=>t?l.createElement("p",null,"Software ",l.createElement("strong",null,"will be uninstalled")," from hosts."):e?l.createElement(l.Fragment,null,l.createElement("p",null,"Software ",l.createElement("strong",null,"won't be uninstalled")," from hosts."),l.createElement("p",null,"Pending or already started installs and uninstalls won't be canceled, and the results won't appear in Fleet.")):l.createElement(l.Fragment,null,l.createElement("p",null,"Software ",l.createElement("strong",null,"won't be uninstalled")," from hosts."),l.createElement("p",null,"Pending installs and uninstalls will be canceled. If they have already started, they won' be canceled, and the results won't appear in Fleet.")))(o,s),!c&&l.createElement("p",null,"Custom icon and display name will be deleted."),l.createElement("div",{className:"modal-cta-wrap"},l.createElement(k.A,{variant:"alert",onClick:m,isLoading:u},"Delete"),l.createElement(k.A,{variant:"secondary",onClick:n},"Cancel")))},ra=a(30415),ia=Object.defineProperty,oa=Object.getOwnPropertySymbols,sa=Object.prototype.hasOwnProperty,ca=Object.prototype.propertyIsEnumerable,ua=(e,t,a)=>t in e?ia(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;const da="add-package-modal";var ma=({softwareTitleId:e,softwareTitleName:t,teamId:a,existingPackageName:r,onExit:i,onSuccess:o})=>{const c=(0,n.useQueryClient)(),{gitOpsModeEnabled:u}=(0,s.A)("software"),d=(e=>{const t=(0,$e.bv)(e);if(!t)return null;const a=$e.HZ[t];return a?{accept:"tar.gz"===t?"application/gzip,.tgz":`.${t}`,label:`${a} (.${t})`}:null})(r),[m,p]=(0,l.useState)(0),[f,v]=(0,l.useState)(null),[g,E]=(0,l.useState)(!1),[b,y]=(0,l.useState)(!1),{data:_}=(0,n.useQuery)(["custom_labels"],()=>Ne.Ay.summary(a).then(e=>(0,Ne.f2)(e.labels)),((e,t)=>{for(var a in t||(t={}))sa.call(t,a)&&ua(e,a,t[a]);if(oa)for(var a of oa(t))ca.call(t,a)&&ua(e,a,t[a]);return e})({},x.QL));(0,Oe.A)(!!f);const h=(e=!1)=>{E(!g),y(e)};return l.createElement(l.Fragment,null,l.createElement(K.A,{className:da,title:"Add package",onExit:i,width:"large"},l.createElement(Re.A,{labels:_||[],className:`${da}__package-form`,onCancel:i,onSubmit:n=>
1{return r=function*(){if(n.software){v((0,$e.P$)(n.software));try{yield C.A.addSoftwarePackage({data:n,teamId:a,softwareTitleId:e,onUploadProgress:e=>{const t=e.progress||0;p(Math.max(t-.03,.01))}}),u||P.me.success(l.createElement(l.Fragment,null,"Successfully added new ",l.createElement("b",null,n.software.name)," package.")),c.invalidateQueries({queryKey:[{scope:"software-titles"}]}),c.invalidateQueries({queryKey:[{scope:"software-library"}]}),o()}catch(e){P.me.error((0,ra.u)(e,t),{response:e})}v(null)}else P.me.error("Couldn't add. Please refresh the page and try again.")},new Promise((e,t)=>{var a=e=>{try{n(r.next(e))}catch(e){t(e)}},l=e=>{try{n(r.throw(e))}catch(e){t(e)}},n=t=>t.done?e(t.value):Promise.resolve(t.value).then(a,l);n((r=r.apply(null,null)).next())});var r},onClickPreviewEndUserExperience:h,multiPackageContext:!0,restrictedFileAccept:null==d?void 0:d.accept,restrictedFileTypeLabel:null==d?void 0:d.label,initialTargetType:"Custom"})),f&&l.createElement(Le.A,{fileDetails:f,fileProgress:m}),g&&l.createElement(De.A,{onCancel:h,teamId:a,isIosOrIpadosApp:b}))},pa=a(48862);const fa="versions-modal";var va=({softwareTitle:e,softwareId:t,teamId:a,refetchSoftwareTitle:n,onExit:r})=>{const i=e.software_package,o=(null==i?void 0:i.pinned_version)||"",s=(0,l.useMemo)(()=>{var e;const t=(e=>{const t=[...e].sort((e,t)=>(0,h.Zy)(t.version,e.version)),a=[{value:"",label:"Automatically update to latest"}];if(t.forEach(e=>{a.push({value:e.version,label:`Pin to ${e.version}`})}),t.length){const e=t[0].version.split(".")[0];a.push({value:`^${e}`,label:`Pin to major version (${e})`})}return a})(null!=(e=null==i?void 0:i.fleet_maintained_versions)?e:[]);if(o&&!t.some(e=>e.value===o)){const e=o.startsWith("^")?`Pin to major version (${o.slice(1)})`:`Pin to ${o}`;t.push({value:o,label:e})}return t},[null==i?void 0:i.fleet_maintained_versions,o]),[c,u]=(0,l.useState)(o),[d,m]=(0,l.useState)(!1),p=c!==o,v=i=>{return o=function*(){i.preventDefault(),m(!0);try{yield C.A.editSoftwarePackage({data:{pinnedVersion:c},softwareId:t,teamId:a}),P.me.success(l.createElement(l.Fragment,null,"Successfully updated"," ",l.createElement("b",null,(0,f.Yd)(e.name,e.display_name))," ","version.")),n(),r()}catch(e){P.me.error("Couldn't update version. Please try again."),m(!1)}},new Promise((e,t)=>{var a=e=>{try{n(o.next(e))}catch(e){t(e)}},l=e=>{try{n(o.throw(e))}catch(e){t(e)}},n=t=>t.done?e(t.value):Promise.resolve(t.value).then(a,l);n((o=o.apply(null,null)).next())});var o};return l.createElement(K.A,{className:fa,title:"Versions",onExit:r},l.createElement(l.Fragment,null,l.createElement("fieldset",{className:`${fa}__form form-field`},s.map(e=>{const t=e.value||"latest";return l.createElement(pa.A,{key:t,name:"versionPin",id:`version-pin-${t}`,label:e.label,value:e.value,checked:c===e.value,onChange:u})})),l.createElement(G.A,{primaryButtons:l.createElement(l.Fragment,null,l.createElement(k.A,{onClick:r,variant:"secondary"},"Cancel"),l.createElement(dt.A,{entityType:"software",position:"top",tipOffset:8,renderChildren:e=>l.createElement(k.A,{type:"submit",onClick:v,isLoading:d,disabled:!p||d||!!e},"Save")}))})))},ga=Object.defineProperty,Ea=Object.defineProperties,ba=Object.getOwnPropertyDescriptors,ya=Object.getOwnPropertySymbols,_a=Object.prototype.hasOwnProperty,ha=Object.prototype.propertyIsEnumerable,Aa=(e,t,a)=>t in e?ga(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;const wa="software-title-details-page",Sa=e=>{var t,a;return(null==(t=e.labels_include_all)?void 0:t.length)?{labels:e.labels_include_all,kind:"includeAll"}:(null==(a=e.labels_exclude_any)?void 0:a.length)?{labels:e.labels_exclude_any,kind:"excludeAny"}:{labels:e.labels_include_any,kind:"includeAny"}};var Ta=({router:e,routeParams:t,location:u})=>{var v;const{isPremiumTier:g,isOnGlobalTeam:E,currentUser:b,config:y}=(0,l.useContext)(c.BR),h=(0,r.useErrorHandler)(),V=(0,n.useQueryClient)(),j=parseInt(t.id,10),{gitOpsModeEnabled:U}=(0,s.A)("software"),{currentTeamId:M,teamIdForApi:q,userTeams:B,handleTeamChange:H}=(0,o.Ay)({location:u,router:e,includeAllTeams:!0,includeNoTeam:!0}),z=(0,T.T1)(b,null!=M?M:null),W=(0,T.kp)(b,null!=M?M:null),[Q,K]=(0,l.useState)(!1),[G,Y]=(0,l.useState)(!1),[Z,J]=(0,l.useState)(!1),[X,ee]=(0,l.useState)(null),[te,ae]=(0,l.useState)(null),[le,ne]=(0,l.useState)(!1),{data:re,isLoading:ie,isError:oe,refetch:se}
1=(0,n.useQuery)([{scope:"softwareById",softwareId:j,teamId:q}],({queryKey:e})=>C.A.getSoftwareTitle(e[0]),(ce=((e,t)=>{for(var a in t||(t={}))_a.call(t,a)&&Aa(e,a,t[a]);if(ya)for(var a of ya(t))ha.call(t,a)&&Aa(e,a,t[a]);return e})({},x.QL),Ea(ce,ba({retry:!1,select:e=>e.software_title,onError:e=>{(0,w.j8)(e,[403,404])||h(e)}}))));var ce;const ue=!!(null==re?void 0:re.software_package)||!!(null==re?void 0:re.app_store_app),de=A(null!=re?re:{}),me=!!g&&!!(null==de?void 0:de.meta.isCustomPackage)&&!de.meta.isIosOrIpadosApp,pe=(0,l.useCallback)(()=>{var t;V.invalidateQueries({queryKey:[{scope:"software-titles"}]}),V.invalidateQueries({queryKey:[{scope:"software-library"}]}),(null==(t=null==re?void 0:re.versions)?void 0:t.length)?se():e.push((0,I.M8)(i.A.SOFTWARE_LIBRARY,{fleet_id:q}))},[V,se,e,re,q]),fe=(0,l.useCallback)(e=>{return t=function*(){const t=((e,t)=>{var a;return null!=(a=null!=e?e:t)?a:null})(e,null==re?void 0:re.software_package);if(t&&"number"==typeof q)try{const e=yield C.A.getSoftwarePackageToken(j,q,t.installer_id);if(!e.token)throw new Error("No download token returned");const l=document.createElement("a");l.href=((e,t,l=a.g.window.location.origin)=>`${l}${p.A}/api${m.A.SOFTWARE_PACKAGE_TOKEN(e)}/${t}`)(j,e.token),l.download=t.name,l.click(),l.remove()}catch(e){P.me.error("Couldn't download. Please try again.")}},new Promise((e,a)=>{var l=e=>{try{r(t.next(e))}catch(e){a(e)}},n=e=>{try{r(t.throw(e))}catch(e){a(e)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(l,n);r((t=t.apply(null,null)).next())});var t},[j,re,q]),ge=(0,l.useCallback)(e=>{H(e)},[H]),Ee=e=>{var t,a;return null===te?null:null!=(a=null==(t=e.packages)?void 0:t.find(e=>e.installer_id===te))?a:null},be=()=>{Y(!1),ae(null)},ye=()=>{K(!1),ae(null)};return l.createElement(F.A,{className:wa},g&&!(null==(v=null==y?void 0:y.partnerships)?void 0:v.enable_primo)&&l.createElement($.A,{isOnGlobalTeam:E,currentTeamId:M,userTeams:B,onTeamChange:ge}),l.createElement(l.Fragment,null,ie?l.createElement(N.A,null):oe?l.createElement(R.A,{header:M===S.jc?"Software not found":"Software not found in this fleet",details:"Expecting to see software? Check back later."}):re?l.createElement(l.Fragment,null,(_e=re,l.createElement(zt,{softwareTitle:_e,softwareId:j,teamId:q,router:e,refetchSoftwareTitle:se,onClickVersions:()=>
1ne(!0),canActivateMultiplePackages:me})),(t=>{var a;if(!g||!ue)return null;const n=null!=(a=t.packages)?a:t.software_package?[t.software_package]:[],r=t.app_store_app;if(0===n.length&&!r)return null;const o=e=>{ae(null!=e?e:null),K(!0)},s=e=>{ae(null!=e?e:null),Y(!0)},c=e=>(0,I.M8)(i.A.MANAGE_HOSTS,{software_title_id:j,software_status:e,fleet_id:null!=M?M:S.Gl}),u=me&&z,m=n.length>=d.Of,p=u&&l.createElement(k.A,{variant:"secondary",onClick:()=>J(!0),disabled:m,icon:"plus"},"Add package"),v=u&&m?l.createElement(O.A,{tipContent:l.createElement(l.Fragment,null,"This title already has ",d.Of," packages. Delete one you no longer use before adding."),showArrow:!0,position:"left",underline:!1},p):p;return l.createElement("section",{className:`${wa}__section`},l.createElement(L.A,{title:"Library"}),l.createElement("div",{className:`${wa}__library-description-row`},l.createElement(D.A,{content:me&&z?"Add packages for a staged rollout or to support multiple architectures.":"Software available to be installed"}),v),l.createElement(ea,null,r?(()=>{var e,a,n,i,u,m;if(!r)return null;const{labels:p,kind:f}=Sa(r),v="android"===r.platform,g=(0,d.bV)(t.source);return l.createElement(Jt,{filename:r.name,version:r.latest_version,addedAt:r.created_at,installerType:"app-store",androidPlayStoreId:v?r.app_store_id:void 0,isIosOrIpadosApp:g,isActive:!0,badgeState:"latest",labels:p,labelKind:f,canEditSoftware:z,installed:null!=(a=null==(e=r.status)?void 0:e.installed)?a:0,pending:null!=(i=null==(n=r.status)?void 0:n.pending)?i:0,failed:null!=(m=null==(u=r.status)?void 0:u.failed)?m:0,installedPath:c("installed"),pendingPath:c("pending"),failedPath:c("failed"),onLabelCountClick:()=>o(),onLabelsClick:()=>o(),onEditClick:()=>o(),onTrashClick:()=>s()})})():n.map(a=>{var n,r,u;if(!a)return null;const{labels:m,kind:p}=Sa(a),v=null!=(n=null==de?void 0:de.meta.isFleetMaintainedApp)&&n,g=null!=(r=null==de?void 0:de.meta.isLatestFmaVersion)&&r,E=null!=(u=null==de?void 0:de.cardInfo.isScriptPackage)&&u,b=(0,d.bV)(t.source),y=(0,f.$p)({automaticInstallPolicies:a.automatic_install_policies,patchPolicy:a.patch_policy}),h=y.length>0,{installed:A,pending:w,failed:S}=(0,d.BY)(a.status);return(({fleetMaintainedVersions:e,activeVersion:t,pinnedVersion:a,addedTimestamp:l})=>(null==e?void 0:e.length)?e.map(e=>_(_({},e),(({rowVersion:e,activeVersion:t,pinnedVersion:a})=>t&&e===t?a?a.startsWith("^")?{isActive:!0,badgeState:"majorVersion"}:{isActive:!0,badgeState:"pinned"}:{isActive:!0,badgeState:"latest"}:{isActive:!1})({rowVersion:e.version,activeVersion:t,pinnedVersion:a}))):[{id:-1,version:null!=t?t:"",uploaded_at:l,isActive:!0}])({fleetMaintainedVersions:a.fleet_maintained_versions,activeVersion:a.version,pinnedVersion:a.pinned_version,addedTimestamp:a.uploaded_at}).map(n=>{var r,u,d,f;return l.createElement(Jt,{key:`${a.installer_id}-${n.id}`,filename:null!=(r=n.filename)?r:a.name,version:n.version,addedAt:n.uploaded_at,installerType:"package",isFma:v,isLatestFmaVersion:n.isActive&&g,isScriptPackage:E,source:t.source,isTarballPackage:"tgz_packages"===t.source,isIosOrIpadosApp:b,isActive:n.isActive,badgeState:n.badgeState,canActivateMultiplePackages:me,isSelfService:a.self_service,hasAutoInstallPolicy:h,labels:n.isActive?m:null,labelKind:p,canEditSoftware:z,installed:n.isActive?A:0,pending:n.isActive?w:0,failed:n.isActive?S:0,installedPath:c("installed"),pendingPath:c("pending"),failedPath:c("failed"),hashSha256:n.isActive&&null!=(u=a.hash_sha256)?u:null,canDownload:(d=n.isActive,f=W,d&&f),onBadgeClick:v&&z?()=>ne(!0):void 0,onLabelCountClick:()=>o(a.installer_id),onLabelsClick:()=>o(a.installer_id),onEditClick:()=>o(a.installer_id),onDownloadClick:()=>fe(a),onTrashClick:()=>s(a.installer_id),onSelfServiceClick:()=>o(a.installer_id),onAutoInstallClick:()=>{1!==y.length?ee(y):e.push((0,I.M8)(i.A.POLICY_DETAILS(y[0].id),{fleet_id:q}))}})})})))})(re),(t=>{var a;return t.hosts_count&&!d.gm.includes(t.source)?l.createElement("section",{className:`${wa}__section`},l.createElement(L.A,{title:"Inventory"}),l.createElement(D.A,{content:"Versions installed across all hosts"}
1),l.createElement(ve,{router:e,data:null!=(a=t.versions)?a:[],isLoading:ie,teamIdForApi:q,isIPadOSOrIOSApp:(0,d.bV)(t.source),isAvailableForInstall:ue,countsUpdatedAt:t.counts_updated_at})):null})(re),(e=>{if(!Q||!de)return null;const{meta:t}=de,a=Ee(e);return l.createElement(Ke,{softwareId:j,teamId:null!=M?M:S.Gl,installerId:null==a?void 0:a.installer_id,softwareInstaller:null!=a?a:t.softwareInstaller,refetchSoftwareTitle:se,onExit:ye,installerType:t.installerType,isFleetMaintainedApp:t.isFleetMaintainedApp,isIosOrIpadosApp:t.isIosOrIpadosApp,name:e.name,displayName:(0,f.Yd)(e.name,e.display_name),source:e.source,iconUrl:e.icon_url,canActivateMultiplePackages:me})})(re),(e=>{if(!G||"number"!=typeof q)return null;const t=null==de?void 0:de.meta,a=!!(null==t?void 0:t.isAndroidPlayStoreApp),n="app-store"===(null==t?void 0:t.installerType)&&!a,r=Ee(e);return l.createElement(na,{softwareId:j,teamId:q,installerId:null==r?void 0:r.installer_id,gitOpsModeEnabled:U,isAppStoreApp:n,isAndroidApp:a,canActivateMultiplePackages:me,onExit:be,onSuccess:()=>{be(),pe()}})})(re),(e=>{var t,a,n,r,i;if(!Z||"number"!=typeof q)return null;const o=null!=(i=null!=(r=null==(a=null==(t=e.packages)?void 0:t[0])?void 0:a.name)?r:null==(n=e.software_package)?void 0:n.name)?i:"";
1return l.createElement(ma,{softwareTitleId:j,softwareTitleName:(0,f.Yd)(e.name,e.display_name),teamId:q,existingPackageName:o,onExit:()=>J(!1),onSuccess:()=>{J(!1),se()}})})(re),X?l.createElement(qt,{policies:X,teamId:q,onExit:()=>ee(null)}):null,(e=>le&&e.software_package&&"number"==typeof q?l.createElement(va,{softwareTitle:e,softwareId:j,teamId:q,refetchSoftwareTitle:se,onExit:()=>ne(!1)}):null)(re)):null));var _e}},94580:function(e,t,a){a.r(t),a.d(t,{default:function(){return k}});var l=a(96540),n=a(75942),r=a(24740),i=a(38944),o=a(68774),s=a(77931),c=a(12740),u=a(56906),d=a(12755),m=a(89937),p=a(45584),f=a(827),v=a(48392),g=a(81766),E=a(71436),b=a(82296),y=a(49634),_=a(56884),h=a(30104),A=Object.defineProperty,w=Object.defineProperties,S=Object.getOwnPropertyDescriptors,T=Object.getOwnPropertySymbols,C=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable,x=(e,t,a)=>t in e?A(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;const P="software-version-details-page";var k=({routeParam
1s:e,router:t,location:a})=>{const{isPremiumTier:A,isOnGlobalTeam:k,config:O}=(0,l.useContext)(o.BR),N=(0,r.useErrorHandler)(),F=parseInt(e.id,10),{currentTeamId:$,teamIdForApi:L,userTeams:D,handleTeamChange:R}=(0,i.Ay)({location:a,router:t,includeAllTeams:!0,includeNoTeam:!0}),{data:V,isLoading:j,isError:U}=(0,n.useQuery)([{scope:"softwareVersion",versionId:F,teamId:L}],({queryKey:e})=>s.A.getSoftwareVersion(e[0]),(M=((e,t)=>{for(var a in t||(t={}))C.call(t,a)&&x(e,a,t[a]);if(T)for(var a of T(t))I.call(t,a)&&x(e,a,t[a]);return e})({},m.QL),w(M,S({retry:!1,select:e=>e.software,onError:e=>{(0,d.j8)(e,[403,404])||N(e)}}))));var M;const{data:q}=(0,n.useQuery)([{scope:"hosts_count",softwareVersionId:F}],({queryKey:e})=>c.A.load(e[0]),{keepPreviousData:!0,staleTime:1e4,select:e=>e.count}),B=(0,l.useCallback)(e=>{R(e)},[R]);return l.createElement(f.A,{className:P},l.createElement(l.Fragment,null,j?l.createElement(p.A,null):V||U?l.createElement(l.Fragment,null,A&&!(null==(H=null==O?void 0:O.partnerships)?void 0:H.enable_primo)&&l.createElement(v.A,{isOnGlobalTeam:k,currentTeamId:$,userTeams:D,onTeamChange:B}),U?l.createElement(y.A,{header:"Software not detected",details:"No hosts have this software installed."}):l.createElement(l.Fragment,null,l.createElement(g.A,{borderRadiusSize:"xxlarge",className:`${P}__summary-section`},l.createElement(E.A,{displayName:`${(0,h.Yd)(V.name,V.display_name,V.bundle_identifier)}, ${V.version}`,type:(0,u.Nt)(V),hostCount:q,queryParams:{software_version_id:V.id,fleet_id:L},name:V.name,source:V.source})),l.createElement(g.A,{borderRadiusSize:"xxlarge",className:`${P}__vulnerabilities-section`},l.createElement("h2",{className:"section__header"},"Vulnerabilities"),(e=>{var a;const n=(r=e.source,(0,u._K)(r)?"Android":(0,u.bV)(r)?"ios_apps"===r?"iOS":"iPadOS":void 0);var r;return n?l.createElement(_.s,{platformText:n}):l.createElement(b.A,{data:null!=(a=e.vulnerabilities)?a:[],itemName:"software item",isLoading:j,router:t,teamIdForApi:L})})(V)))):null));var H}},61133:function(e,t,a){a.r(t),a.d(t,{default:function(){return K}});var l=a(96540),n=a(75942),r=a(4514),i=a(89937),o=a(18165),s=a(79519),c=a(45584),u=a(78263),d=a(68774),m=a(24432),p=a(34724),f=a(431),v=a(46692),g=a(41995),E=a(2367),b=Object.defineProperty,y=Object.getOwnPropertySymbols,_=Object.prototype.hasOwnProperty,h=Object.prototype.propertyIsEnumerable,A=(e,t,a)=>t in e?b(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,w=(e,t)=>{for(var a in t||(t={}))_.call(t,a)&&A(e,a,t[a]);if(y)for(var a of y(t))h.call(t,a)&&A(e,a,t[a]);return e};const S=()=>l.createElement(m.A,{url:"https://fleetdm.com/learn-more-about/vulnerability-processing",text:"Learn more",newTab:!0}),T={"no-vulns-detected":{header:"No vulnerabilities detected",info:"Vulnerability data will appear after the next scheduled check-in."},"no-matching-items":{header:"No items match the current search criteria",info:"Expecting to see vulnerabilities? Check back later."},"invalid-cve":{header:"That vulnerability (CVE) is not valid",info:'Try updating your search to use CVE format: "CVE-YYYY-<4 or more digits>"'},"unknown-cve":{header:"This is not a known CVE",info:"None of Fleet's vulnerability sources are aware of this CVE.",additionalInfo:l.createElement(S,null)},"known-vuln":{header:"This is a known vulnerability (CVE), but it wasn't detected on any hosts",additionalInfo:l.createElement(S,null)}};var C=({isPremiumTier:e,teamId:t,exploitedFilter:a,isSoftwareDisabled:n,emptyStateReason:r})=>{if(n)return l.createElement(E.A,{header:"Software inventory disabled",info:l.createElement(l.Fragment,null,"Users with the admin role can"," ",l.createElement(m.A,{url:"https://fleetdm.com/docs/using-fleet/vulnerability-processing#configuration",text:"turn on software inventory",newTab:!0}),".")});const i={header:"No items match the current search criteria",info:"Expecting to see vulnerabilities? Check back later."},o=r?w(w({},i),T[r]):i;return"known-vuln"===r&&void 0!==t&&(o.header+=" in this fleet"),e&&a&&"unknown-cve"!==r&&"invalid-cve"!==r&&(o.info="Try removing the exploited vulnerabilities filter to expand your search."),l.createElement(E.A,w({},o))},I=a(12968),x=a(9467),P=a(49817),k=a(39435),O=a(75679),N=a(40925),F=a(2837),$=a(24228),L=a(52603),D=a(24292);const R=(e=!1)=>[{isDisabled:!1,label:"All vulnerabilities",value:"false",helpText:"All vulnerabilities detected on your hosts."},{isDisabled:!e,label:"Exploited vulnerabilities",value:"true",helpText:"Vulnerabilities that have been actively exploited in the wild.",tooltipContent:e?void 0:"Available in Fleet Premium."}],V="software-vulnerabilities-table";var j=({router:e,isSoftwareEnabled:t,data:a,emptyStateReason:n,query:r="",perPage:s,orderDirection:c,orderKey:E,showExploitedVulnerabilitiesOnly:b,currentPage:y,teamId:_,isLoading:h})=>{var A,w;const{isPremiumTier:S}=(0,l.useContext)(d.BR),T=(0,l.useCallback)(e=>{var t;const a=Object.entries(e).find(([e,t])=>{switch(e){case"sortDirection":return t!==c;case"sortHeader":return t!==E;case"pageIndex":return t!==y;case"searchQuery":return t!==r;case"exploit":return t!==b.toString();default:return!1}});return null!=(t=null==a?void 0:a[0])?t:""},[y,c,E,r,b]),j=(0,l.useCallback)((e,t)=>({fleet_id:_,exploit:b.toString(),query:e.searchQuery,order_direction:e.sortDirection,order_key:e.sortHeader,page:"pageIndex"===t?e.pageIndex:0}),[_,b]),U=(0,l.useCallback)(t=>{if((0,o.XX)(t.searchQuery))return;const a=T(t);if(""===a)return;const l=(0,x.g2)({pathPrefix:u.A.SOFTWARE_VULNERABILITIES,routeTemplate:"",queryParams:j(t,a)});e.replace(l)},[T,j,e]),M=(null!=(w=null==(A=null==a?void 0:a.vulnerabilities)?void 0:A.length)?w:0)>0,q=!(t&&(M||""!==r||b)),B=(0,l.useMemo)(()=>a?((e,t,a,n)=>{const r=[{title:"Vulnerability",Header:"Vulnerability",disableSortBy:!0,accessor:"cve",Cell:e=>{if(!(null==a?void 0:a.includeIcon))return l.createElement(O.A,{value:e.cell.value,formatter:e=>(0,P.xE)(e)});const{cve:r}=e.row.original,i=(0,I.M8)(u.A.SOFTWARE_VULNERABILITY_DETAILS(r),{fleet_id:n});return l.createElement($.A,{path:i,customOnClick:e=>{e.stopPropagation(),null==t||t.push(i)},value:r})}},{title:"Severity",accessor:"cvss_score",disableSortBy:!1,Header:e=>{const t=l.createElement(L.A,{tipContent:l.createElement(l.Fragment,null,"The worst case impact across different environments (CVSS version 3.x base score).")},"Severity");return l.createElement(l.Fragment,null,l.createElement(N.A,{value:t,isSortedDesc:e.column.isSortedDesc}))},Cell:({cell:{value:e}})=>l.createElement(O.A,{formatter:x.JE,value:e})},{title:"Probability of exploit",accessor:"epss_probability",disableSortBy:!1,Header:e=>{const t=l.createElement(L.A,{className:"epss_probability",tipContent:l.createElement(l.Fragment,null,"The probability that this vulnerability will be exploited in the next 30 days (EPSS probability). ",l.createElement("br",null),"This data is reported by FIRST.org."),fixedPositionStrategy:!0},"Probability of exploit");return l.createElement(l.Fragment,null,l.createElement(N.A,{value:t,isSortedDesc:e.column.isSortedDesc}))},Cell:e=>l.createElement(k.A,{probabilityOfExploit:e.row.original.epss_probability,cisaKnownExploit:e.row.original.cisa_known_exploit})},{title:"Published",accessor:"cve_published",disableSortBy:!1,Header:e=>{const t=l.createElement(L.A,{tipContent:l.createElement(l.Fragment,null,"The date this vulnerability was published in the National Vulnerability Database (NVD).")},"Published");return l.createElement(l.Fragment,null,l.createElement(N.A,{value:t,isSortedDesc:e.column.isSortedDesc}))},Cell:({cell:{value:e}})=>{const t="number"==typeof e?e.toString():e;return l.createElement(O.A,{value:t?{timeString:t}:void 0,formatter:t?D.T:void 0})}},{title:"Detected",accessor:"created_at",disableSortBy:!1,Header:e=>{const t=l.createElement(L.A,{tipContent:l.createElement(l.Fragment,null,"The date this vulnerability first appeared on a host.")},"Detected");return l.createElement(l.Fragment,null,l.createElement(N.A,{value:t,isSortedDesc:e.column.isSortedDesc}))},Cell:e=>{const t=e.row.original.created_at||"";
1return l.createElement(O.A,{value:{timeString:t},formatter:D.T})}},{title:"Hosts",Header:e=>l.createElement(N.A,{value:"Hosts",disableSortBy:!1,isSortedDesc:e.column.isSortedDesc}),disableSortBy:!1,accessor:"hosts_count",Cell:e=>{const{hosts_count:t}=e.row.original;return l.createElement(O.A,{value:t})}},{title:"",Header:"",accessor:"linkToFilteredHosts",disableSortBy:!0,Cell:e=>l.createElement(l.Fragment,null,e.row.original&&l.createElement(F.A,{queryParams:{vulnerability:e.row.original.cve,fleet_id:n},className:"vulnerabilities-link",rowHover:!0}))}];return e?r:r.filter(e=>"epss_probability"!==e.accessor&&"cve_published"!==e.accessor&&"cvss_score"!==e.accessor)})(S,e,{includeName:!0,includeVulnerabilities:!0,includeIcon:!0},_):[],[a,S,e,_]);return l.createElement("div",{className:V},l.createElement(p.A,{columnConfigs:B,data:(null==a?void 0:a.vulnerabilities)||[],isLoading:h,resultsTitle:"items",emptyComponent:()=>l.createElement(C,{isPremiumTier:S,teamId:_,exploitedFilter:b,isSoftwareDisabled:!t,emptyStateReason:n}),defaultSearchQuery:r,defaultSortHeader:E,defaultSortDirection:c,pageIndex:y,manualSortBy:!0,pageSize:s,showMarkAllPages:!1,isAllPagesSelected:!1,disableNextPage:!(null==a?void 0:a.meta.has_next_results),searchable:!0,disableSearch:q,searchQueryColumn:"vulnerability",inputPlaceHolder:"Search by CVE",searchToolTipText:i.wr,onQueryChange:U,customControl:()=>l.createElement(g.A,{name:"exploited-vuln-filter",value:b.toString(),className:`${V}__exploited-vulnerabilities-filter`,options:R(S),onChange:t=>{return t&&(a=t.value,void e.replace((0,x.g2)({pathPrefix:u.A.SOFTWARE_VULNERABILITIES,routeTemplate:"",queryParams:{query:r,fleet_id:_,order_direction:c,order_key:E,exploit:a,page:0}})));var a},variant:"table-filter",isDisabled:q}),stackControls:!0,renderCount:()=>{if(!a)return null;const e=null==a?void 0:a.count;return l.createElement(l.Fragment,null,l.createElement(v.A,{name:"items",count:e}),(null==a?void 0:a.vulnerabilities)&&(null==a?void 0:a.counts_updated_at)&&l.createElement(f.A,{lastUpdatedAt:a.counts_updated_at,customTooltipText:l.createElement(l.Fragment,null,"The last time software data was ",l.createElement("br",null),"updated, including vulnerabilities ",l.createElement("br",null),"and host counts.")}))},renderTableHelpText:()=>l.createElement("div",null,"Seeing unexpected software or vulnerabilities?"," ",l.createElement(m.A,{url:i.CO,text:"File an issue on GitHub",newTab:!0})),disableMultiRowSelect:!0,onSelectSingleRow:t=>{if(t.original.cve){const a=t.original.cve.toString(),l=(0,I.M8)(u.A.SOFTWARE_VULNERABILITY_DETAILS(a),{fleet_id:_});e.push(l)}}}))},U=Object.defineProperty,M=Object.defineProperties,q=Object.getOwnPropertyDescriptors,B=Object.getOwnPropertySymbols,H=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable,W=(e,t,a)=>t in e?U(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,Q=(e,t)=>{for(var a in t||(t={}))H.call(t,a)&&W(e,a,t[a]);if(B)for(var a of B(t))z.call(t,a)&&W(e,a,t[a]);return e},K=({router:e,isSoftwareEnabled:t,query:a,perPage:u,orderDirection:d,orderKey:m,currentPage:p,teamId:f,showExploitedVulnerabilitiesOnly:v})=>{const[g,E]=(0,l.useState)(),[b,y]=(0,l.useState)(),_={page:p,per_page:u,order_direction:d,order_key:m,teamId:f,query:a,exploit:v},h=!!a&&/^(['"]).*\1$/.test(a),{isFetching:A,isLoading:w,isError:S}=(0,n.useQuery)([Q({scope:"software-vulnerabilities"},_)],()=>(0,r.J)(_),{keepPreviousData:!0,enabled:!h&&t,onSuccess:e=>{E(e),0===e.count&&(_.exploit||_.query&&_.query.length>0?y("no-matching-items"):y("no-vulns-detected"))}}),{isLoading:T,isFetching:C,refetch:I}=(0,n.useQuery)([{scope:"softwareVulnByCVE",vulnerability:a&&(0,o.Ir)(a)||"",teamId:f}],({queryKey:e})=>r.A.getVulnerability(e[0]),(x=Q({},i.QL),P={retry:!1,onSuccess:e=>{e?_.exploit&&!e.vulnerability.cisa_known_exploit?(E({count:0,counts_updated_at:"",vulnerabilities:[],meta:{has_next_results:!1,has_previous_results:!1}}),y("no-matching-items")):E({count:1,counts_updated_at:e.vulnerability.hosts_count_updated_at,vulnerabilities:[e.vulnerability],meta:{has_next_results:!1,has_previous_results:!1}}):(E({count:0,counts_updated_at:"",vulnerabilities:[],meta:{has_next_results:!1,has_previous_results:!1}}),y("known-vuln"))},onError:e=>{var t,l;const n=e;400===n.status?(null==(t=null==n?void 0:n.data)?void 0:t.errors)&&n.data.errors[0].reason.includes("That vulnerability (CVE) is not val
1id.")&&(E({count:0,counts_updated_at:"",vulnerabilities:[],meta:{has_next_results:!1,has_previous_results:!1}}),y("invalid-cve")):404===n.status&&((null==(l=null==n?void 0:n.data)?void 0:l.errors)&&(n.data.errors[0].reason.includes("This is not a known CVE.")||n.data.errors[0].reason.includes("was not found in the datastore"))&&(a&&!(e=>!(e.length<9)&&/^CVE-\d{4}-\d{4,}$/i.test(e))((0,o.Ir)(a))?y("invalid-cve"):y("unknown-cve")),E({count:0,counts_updated_at:"",vulnerabilities:[],meta:{has_next_results:!1,has_previous_results:!1}}))},enabled:h&&t},M(x,q(P))));var x,P;return(0,l.useEffect)(()=>{h&&I()},[_.exploit,h]),g||!w&&!T?S?l.createElement(s.A,{verticalPaddingSize:"pad-xxxlarge"}):l.createElement("div",{className:"software-vulnerabilities"},l.createElement(j,{router:e,data:g,emptyStateReason:b,query:a,showExploitedVulnerabilitiesOnly:v,isSoftwareEnabled:t,perPage:u,orderDirection:d,orderKey:m,currentPage:p,teamId:f,isLoading:A||C})):l.createElement(c.A,null)}},54676:function(e,t,a){a.r(t),a.d(t,{default:function(){return H}});var l=a(96540),n=a(75942),r=a(24740),i=a(38944),o=a(68774),s=a(4514),c=a(12755),u=a(89937),d=a(45584),m=a(827),p=a(48392),f=a(78263),v=a(12968),g=a(24432),E=a(81766),b=a(83573),y=a(52603),_=a(39435),h=a(24292),A=a(5719);const w="software-vuln-summary";var S=({vuln:e,isPremiumTier:t,teamIdForApi:a})=>{const{cve:n,details_link:r,cve_description:i,cvss_score:o,epss_probability:s,cisa_known_exploit:c,cve_published:u,created_at:d,hosts_count:m,hosts_count_updated_at:p}=e,S=(0,v.M8)(f.A.MANAGE_HOSTS,{vulnerability:n,fleet_id:a});return l.createElement(E.A,{borderRadiusSize:"xxlarge",className:w},l.createElement("span",{className:`${w}__header`},l.createElement("h1",null,n),l.createElement("span",{className:`${w}__header__links`},l.createElement(g.A,{url:r,text:"Visit NVD page",newTab:!0}))),t&&i&&l.createElement("div",{className:`${w}__description`},i),l.createElement("dl",{className:`${w}__description-list`},t&&l.createElement(l.Fragment,null,o&&l.createElement(b.A,{title:l.createElement(y.A,{tipContent:"The worst case impact across different environments (CVSS version 3.x base score). This data is reported by the National Vulnerability Database (NVD)."},"Severity"),value:o,textOnly:!0}),s&&l.createElement(b.A,{title:l.createElement(y.A,{tipContent:"The probability that this vulnerability will be exploited in the next 30 days (EPSS probability). This data is reported by FIRST.org."},"Probability of exploit"),value:l.createElement(_.A,{probabilityOfExploit:s,cisaKnownExploit:c,tooltipPosition:"bottom"})}),u&&l.createElement(b.A,{title:l.createElement(y.A,{tipContent:l.createElement(l.Fragment,null,"The date this vulnerability was published in the National Vulnerability Database (NVD).")},"Published"),value:l.createElement(h.T,{timeString:u,tooltipPosition:"bottom"}),textOnly:!0})),l.createElement(b.A,{title:l.createElement(y.A,{tipContent:l.createElement(l.Fragment,null,"The date this vulnerability first appeared on a host.")},"Detected"),value:l.createElement(h.T,{timeString:d,tooltipPosition:"bottom"}),textOnly:!0}),l.createElement(b.A,{title:"Affected hosts",value:l.createElement(A.A,{hostCount:l.createElement(y.A,{tipContent:"View all affected hosts"},l.createElement(g.A,{url:S,text:m.toString()})),lastUpdatedAt:p}),textOnly:!0})))},T=a(34724),C=a(13566),I=a(46692),x=a(24228),P=a(40925),k=a(90581),O=a(75679),N=a(2837),F=({osVersions:e,isPremiumTier:t,router:a,teamIdForApi:n})=>{const r=(0,l.useMemo)(()=>((e,t,a)=>{const n=[{Header:"Name",disableSortBy:!0,accessor:"name_only",Cell:({row:e})=>{const{name:t,os_version_id:n,platform:r}=e.original,i=(0,v.M8)(f.A.SOFTWARE_OS_DETAILS(n),{fleet_id:a});return l.createElement(x.A,{path:i,tooltipTruncate:!0,prefix:l.createElement(k.A,{name:r}),value:t})}},{Header:"Version",disableSortBy:!0,accessor:"version",Cell:({cell:e})=>l.createElement(O.A,{value:e.value})},{Header:()=>l.createElement(P.A,{value:l.createElement("span",null,"Resolved in ",l.createElement("span",{className:"resolved-suffix"},"version")),disableSortBy:!0}),disableSortBy:!0,accessor:"resolved_in_version",Cell:({cell:e})=>l.createElement(O.A,{value:e.value})},{Header:"Hosts",disableSortBy:!0,accessor:"hosts_count",Cell:({row:e})=>{const{hosts_count:t}=e.original;return l.createElement(O.A,{value:t})}},{Header:"",id:"view-all-hosts",disableSortBy:!0,Cell:e=>l.createElement(l.Fragment,null,e.row.original&&l.createElement(N.A,{queryParams:{os_version_id:e.row.original.os_version_id},responsive:!0,rowHover:!0}))}];return e?n:n.filter(e=>"resolved_in_version"!==e.accessor)})(t,0,n),[t,a,n]),i=(0,l.useCallback)(()=>l.createElement(I.A,{name:"items",count:null==e?void 0:e.length}),[null==e?void 0:e.length]);return l.createElement(E.A,{borderRadiusSize:"xxlarge",className:"software-vuln-os-versions"},l.createElement("h2",null,"Vulnerable OS"),l.createElement(T.A,{columnConfigs:r,data:e,defaultSortHeader:"hosts",defaultSortDirection:"desc",isClientSidePagination:!0,isLoading:!1,emptyComponent:()=>l.createElement(l.Fragment,null),showMarkAllPages:!1,isAllPagesSelected:!1,disableMultiRowSelect:!0,hideFooter:e.length<=C.y,onSelectSingleRow:e=>{if(e.original.os_version_id){const t=Number(e.original.os_version_id),l=(0,v.M8)(f.A.SOFTWARE_OS_DETAILS(t),{fleet_id:n});a.push(l)}},renderCount:i}))},$=a(69906),L=({vulnSoftware:e,isPremiumTier:t,router:a,teamIdForApi:n})=>{const r=(0,l.useMemo)(()=>((e,t,a)=>{const n=[{Header:"Name",disableSortBy:!0,accessor:"name",Cell:({row:e})=>{const{name:t,id:n}=e.original,r=(0,v.M8)(f.A.SOFTWARE_VERSION_DETAILS(n.toString()),{fleet_id:a});return l.createElement(x.A,{path:r,tooltipTruncate:!0,prefix:l.createElement($.A,{name:t}),value:t})}},{Header:"Version",disableSortBy:!0,accessor:"version",Cell:({cell:e})=>l.createElement(O.A,{value:e.value})},{Header:()=>l.createElement(P.A,{value:l.createElement("span",null,"Resolved in ",l.createElement("span",{className:"resolved-suffix"},"version")),disableSortBy:!0}),disableSortBy:!0,accessor:"resolved_in_version",Cell:({cell:e})=>l.createElement(O.A,{value:e.value})},{Header:"Hosts",disableSortBy:!0,accessor:"hosts_count",Cell:({row:e})=>{const{hosts_count:t}=e.original;return l.createElement(O.A,{value:t})}},{Header:"",id:"view-all-hosts",disableSortBy:!0,Cell:e=>l.createElement(l.Fragment,null,e.row.original&&l.createElement(N.A,{queryParams:{software_version_id:e.row.original.id},responsive:!0,rowHover:!0}))}];return e?n:n.filter(e=>"resolved_in_version"!==e.accessor)})(t,0,n),[t,a,n]),i=(0,l.useCallback)(()=>l.createElement(I.A,{name:"items",count:null==e?void 0:e.length}),[null==e?void 0:e.length]);return l.createElement(E.A,{borderRadiusSize:"xxlarge",className:"software-vuln-software-versions"},l.createElement("h2",null,"Vulnerable software"),l.createElement(T.A,{columnConfigs:r,data:e,defaultSortHeader:"hosts",defaultSortDirection:"desc",isClientSidePagination:!0,isLoading:!1,emptyComponent:()=>l.createElement(l.Fragment,null),showMarkAllPages:!1,isAllPagesSelected:!1,disableMultiRowSelect:!0,onSelectSingleRow:e=>{if(e.original.id){const t=e.original.id,l=(0,v.M8)(f.A.SOFTWARE_VERSION_DETAILS(t.toString()),{fleet_id:n});a.push(l)}},renderCount:i}))},D=a(49634),R=Object.defineProperty,V=Object.defineProperties,j=Object.getOwnPropertyDescriptors,U=Object.getOwnPropertySymbols,M=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable,B=(e,t,a)=>t in e?R(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}
1):e[t]=a,H=({router:e,routeParams:t,location:a})=>{const{isPremiumTier:f,isOnGlobalTeam:v,config:g}=(0,l.useContext)(o.BR),E=(0,r.useErrorHandler)(),{currentTeamId:b,teamIdForApi:y,userTeams:_,handleTeamChange:h}=(0,i.Ay)({location:a,router:e,includeAllTeams:!0,includeNoTeam:!0}),{data:A,isLoading:w,isError:T}=(0,n.useQuery)([{scope:"softwareVulnByCVE",vulnerability:t.cve,teamId:y}],({queryKey:e})=>s.A.getVulnerability(e[0]),(C=((e,t)=>{for(var a in t||(t={}))M.call(t,a)&&B(e,a,t[a]);if(U)for(var a of U(t))q.call(t,a)&&B(e,a,t[a]);return e})({},u.QL),V(C,j({retry:!1,onError:e=>{(0,c.j8)(e,[403,404])||E(e)}}))));var C;const I=(0,l.useCallback)(e=>{h(e)},[h]);return l.createElement(m.A,{className:"software-vulnerability-details-page"},l.createElement(l.Fragment,null,w?l.createElement(d.A,null):l.createElement(l.Fragment,null,f&&!(null==(x=null==g?void 0:g.partnerships)?void 0:x.enable_primo)&&l.createElement(p.A,{isOnGlobalTeam:v,currentTeamId:b,userTeams:_,onTeamChange:I}),T||!A?l.createElement(D.A,{header:"Vulnerability not detected",details:`No hosts are affected by ${t.cve}.`}):(P=A,l.createElement(l.Fragment,null,l.createElement(S,{vuln:P.vulnerability,isPremiumTier:null!=f&&f,teamIdForApi:y}),!!P.os_versions&&P.os_versions.length>0&&l.createElement(F,{osVersions:P.os_versions,isPremiumTier:null!=f&&f,router:e,teamIdForApi:y}),!!P.software&&P.software.length>0&&l.createElement(L,{vulnSoftware:P.software,isPremiumTier:null!=f&&f,router:e,teamIdForApi:y}))))));var x,P}},49634:function(e,t,a){a.d(t,{A:function(){return r}});var l=a(96540),n=a(81766),r=({header:e,details:t})=>l.createElement(n.A,{borderRadiusSize:"xxlarge",className:"details-no-hosts"},l.createElement("h2",null,e),l.createElement("p",null,t))},42526:function(e,t,a){a.d(t,{A:function(){return m}});var l=a(96540),n=a(2543),r=a(81766),i=a(52978),o=a(90710),s=a(25809),c=a(33429),u=a.p+"[email protected]";const d="self-service-preview";var m=({isIosOrIpadosApp:e,contactUrl:t,name:a,displayName:m,versionLabel:p,hasCategories:f,renderIcon:v,renderTable:g})=>e?l.createElement(r.A,{borderRadiusSize:"medium",color:"white",className:`${d}__preview-card ${d}__preview-card--mobile`,paddingSize:"xlarge"},l.createElement("div",{className:`${d}__preview-img-container--mobile`},l.createElement("img",{className:`${d}__preview-img--mobile`,src:u,alt:"Preview icon on Fleet Desktop > Self service"})),l.createElement("div",{className:`${d}__self-service-preview--mobile`},v(),l.createElement("div",{className:`${d}__self-service-preview-name-version--mobile`},l.createElement("div",{className:`${d}__self-service-preview-name--mobile`},l.createElement(s.A,{value:m||a})),l.createElement("div",{className:`${d}__self-service-preview-version--mobile`},p)))):l.createElement(r.A,{borderRadiusSize:"medium",color:"grey",className:`${d}__preview-card`,paddingSize:"xlarge"},l.createElement("div",{className:`${d}__disabled-overlay`}),l.createElement(r.A,{className:`${d}__preview-card__self-service`,borderRadiusSize:"xxlarge"},l.createElement(c.A,{contactUrl:t,variant:"preview"}),l.createElement("div",{className:`${d}__filter-row`},f&&l.createElement("div",{className:`${d}__static-dropdown`,"aria-hidden":"true"},l.createElement("span",{className:`${d}__static-dropdown-label`},"All"),l.createElement(i.A,{name:"chevron-down",color:"ui-fleet-black-75"})),l.createElement(o.A,{placeholder:"Search by name",onChange:n.noop,disabled:!0})),g&&g()))},73967:function(e,t,a){var l=a(96540),n=a(32485),r=a.n(n),i=a(12968),o=a(9467),s=a(30104),c=a(78263),u=a(56906),d=a(4346),m=a(83573),p=a(5719),f=a(74953),v=a(19),g=a(59333),E=a(52603),b=a(25809),y=a(24432),_=a(64018),h=a(69906),A=a(90581);const w="edit_appearance",S="edit_software",T="edit_configuration",C="deploy",I="versions",x="edit_auto_update_configuration",P="software-details-summary";t.Ay=({displayName:e,type:t,hostCount:a,countsUpdatedAt:n,queryParams:k,name:O,source:N,versions:F,iconUrl:$,isOperatingSystem:L,canManageSoftware:D=!1,onClickEditAppearance:R,onClickEditSoftware:V,onClickDeploy:j,onClickVersions:U,onClickEditConfiguration:M,onClickEditAutoUp
1dateConfig:q,iconPreviewUrl:B,iconUploadedAt:H,headerPills:z,isAppleVpp:W=!1,useSingleEditAppearanceButton:Q=!1})=>{const K=(0,i.M8)(c.A.MANAGE_HOSTS,k),{gitOpsModeEnabled:G,repoURL:Y}=(0,d.A)("software"),Z=u.s.includes(e),J=!!a&&!u.gm.includes(N||""),X=(({gitOpsModeEnabled:e,repoURL:t,isAppleVpp:a=!1,canEditSoftware:l,canEditConfiguration:n,canDeploySoftware:r,canManageVersions:i,canConfigureAutoUpdate:s})=>{let c,u,d;if(e){const e=t&&(0,o.qV)(t);c=e,d=e,a&&(u=e)}const m=[{label:"Edit appearance",value:w,disabled:e,tooltipContent:c}];return l&&m.push({label:"Edit software",value:S,disabled:!!e&&a,tooltipContent:u}),n&&m.push({label:"Edit configuration",value:T,disabled:e,tooltipContent:d}),r&&m.push({label:"Deploy",value:C}),i&&m.push({label:"Versions",value:I}),s&&m.push({label:"Schedule auto updates",value:x}),m})({gitOpsModeEnabled:G,repoURL:Y,isAppleVpp:W,canEditSoftware:!!V,canEditConfiguration:!!M,canDeploySoftware:!!j,canManageVersions:!!U,canConfigureAutoUpdate:!!q});return l.createElement(l.Fragment,null,l.createElement("div",{className:r()(P,{[`${P}--has-pills`]:!!z})},l.createElement("div",{className:`${P}__icon-wrap`},L?l.createElement(A.A,{name:O,size:"xlarge"}):"string"==typeof B&&(0,s.KY)(B)?l.createElement("img",{src:B,alt:"Uploaded icon preview",style:{width:96,height:96}}):l.createElement(h.A,{name:O,source:N,url:$,uploadedAt:H,size:"xlarge"})),l.createElement("div",{className:`${P}__info`},l.createElement("h1",{"aria-label":"software display name",className:`${P}__title`},Z?l.createElement(l.Fragment,null,e.slice(0,-8),l.createElement(_.A,null)):l.createElement(b.A,{value:e})),D&&l.createElement("div",{className:`${P}__actions-wrapper`},Q?l.createElement(g.A,{entityType:"software",position:"top",renderChildren:e=>l.createElement(f.A,{variant:"subdued",onClick:R,disabled:e||!R,icon:"pencil"},"Edit")}):l.createElement(v.A,{className:`${P}__actions-dropdown`,onChange:e=>{switch(e){case w:R&&R();break;case S:V&&V();break;case C:j&&j();break;case I:U&&U();break;case T:M&&M();break;case x:q&&q()}},placeholder:"Actions",options:X,variant:"secondary",menuAlign:"right"})),l.createElement("dl",{className:`${P}__description-list`},!!t&&l.createElement(m.A,{title:"Type",value:t}),!!F&&l.createElement(m.A,{title:"Versions",value:F}),J&&l.createElement(m.A,{title:"Hosts",value:l.createElement(p.A,{hostCount:l.createElement(E.A,{tipContent:"View all hosts"},l.createElement(y.A,{url:K,text:a.toString()})),lastUpdatedAt:n})})),z&&l.createElement("div",{className:`${P}__header-pills`}
1,z))))}},71436:function(e,t,a){a.d(t,{A:function(){return l.Ay}});var l=a(73967)},59012:function(e,t,a){a.d(t,{A:function(){return c}});var l=a(96540),n=a(32485),r=a.n(n),i=a(96470),o=a(98220),s=a(74953),c=l.memo(({showSchemaButton:e,installScriptTooltip:t,installScriptHelpText:a,installScriptReadOnly:n=!1,postInstallScriptHelpText:c,uninstallScriptTooltip:u,uninstallScriptHelpText:d,errors:m,preInstallQuery:p,installScript:f,postInstallScript:v,uninstallScript:g,className:E,onClickShowSchema:b,onChangePreInstallQuery:y,onChangeInstallScript:_,onChangePostInstallScript:h,onChangeUninstallScript:A,gitopsCompatible:w=!1,gitOpsModeEnabled:S=!1,patchWhenClosed:T=!1})=>{const C=r()("advanced-options-fields",E),I=w&&S;return l.createElement("div",{className:C},l.createElement(o.A,{className:"form-field",focus:!0,error:m.preInstallQuery,value:p,placeholder:"SELECT * FROM osquery_info WHERE start_time > 1",label:"Pre-install query",name:"preInstallQuery",maxLines:10,onChange:y,labelActionComponent:e?l.createElement(s.A,{variant:"subdued",onClick:b,icon:"info",iconPosition:"right"},"Schema"):null,helpText:l.createElement(l.Fragment,null,"Software will be installed only if the query returns results.",T&&l.createElement(l.Fragment,null," ","Pre-install query won't run when install is triggered via self-service, manually on the host, or during the setup experience.")),readOnly:I||T}),l.createElement(i.A,{wrapEnabled:!0,maxLines:10,name:"install-script",onChange:_,value:f,helpText:a,label:"Install script",labelTooltip:t,readOnly:I||n}),l.createElement(i.A,{label:"Post-install script",focus:!0,error:m.postInstallScript,wrapEnabled:!0,name:"post-install-script-editor",maxLines:10,onChange:h,value:v,helpText:c,readOnly:I}),l.createElement(i.A,{label:"Uninstall script",labelTooltip:u,focus:!0,wrapEnabled:!0,name:"uninstall-script-editor",maxLines:20,onChange:A,value:g,helpText:d,readOnly:I}))})},62190:function(e,t,a){a.d(t,{A:function(){return ue}});var l=a(96540),n=a(32485),r=a.n(n),i=a(68774),o=a(4346),s=a(89937),c=a(9106);const u=["dmg","zip"],d=["msi","msix","exe","zip"],m=["sh","ps1","py"],p=["pkg","deb","rpm","dmg","zip","tar.gz",...d,...m,"ipa"],f=e=>d.includes(e),v=e=>m.includes(e);var g=a(46157),E=a(74953),b=a(52603),y=a(6511),_=a(30104),h=a(22676),A=a(98601),w=a(64922),S=a(54184),T=a(79244),C=a(38021),I=a(24432),x=a(2543),P=a(25087),k=a(59012);const O=e=>`Currently, ${f(e)||"ps1"===e?"PowerS":"s"}hell scripts are supported.`,N={pkg:"package IDs",deb:"package name",rpm:"package name",msi:"product code",msix:"product code or package family name",exe:"software name",zip:"software name",sh:"package name",ps1:"package name",ipa:"software name"},F=e=>v(e)?"The uploaded script's contents are used as the install script. To change it, upload a new file.":"exe"===e||"zip"===e?l.createElement(l.Fragment,null,"For Windows, Fleet only creates install scripts for .msi packages. Use the $INSTALLER_PATH variable to point to the installer."," ",O(e)," ",l.createElement(I.A,{url:`${s.CW}/exe-install-scripts`,text:"Learn more",newTab:!0})):l.createElement(l.Fragment,null,"Use the $INSTALLER_PATH variable to point to the installer."," ",O(e)," ",l.createElement(I.A,{url:`${s.CW}/install-scripts`,text:"Learn more about install scripts",newTab:!0})),$=e=>O(e),L=e=>"exe"===e||"tar.gz"===e?"exe"===e?"Required for .exe packages.":"Required for .tar.gz archives.":"zip"===e&&f(e)?"Required for .zip packages.":void 0,D=e=>{return v(e)?O(e):"zip"===e&&f(e)?l.createElement(l.Fragment,null,"For Windows, Fleet only creates uninstall scripts for .msi packages. $PACKAGE_ID will be populated with the software name from the .zip file after it's added. ",O(e)," ",l.createElement(I.A,{url:`${s.CW}/exe-install-scripts`,text:"Learn more",newTab:!0})):(t=e,u.includes(t)?"Currently, only shell scripts are supported.":"exe"===e?l.createElement(l.Fragment,null,"For Windows, Fleet only creates uninstall scripts for .msi packages. $PACKAGE_ID will be populated with the software name from the .exe file after it's added. ",O(e)," ",l.createElement(I.A,{url:`${s.CW}/exe-install-scripts`,text:"Learn more",newTab:!0})):"tar.gz"===e?l.createElement(l.Fragment,null,"Currently, only shell scripts are supported."," ",l.createElement(I.A,{url:`${s.CW}/uninstall-scripts`,text:"Learn more about uninstall scripts",newTab:!0})):"msi"===e?l.createElement(l.Fragment,null,"$UPGRADE_CODE will be populated with the .msi's upgrade code if available, and $PACKAGE_ID will be populated with its product code, after the softw
1are is added. ",O(e)," ",l.createElement(I.A,{url:`${s.CW}/uninstall-scripts`,text:"Learn more about uninstall scripts",newTab:!0})):l.createElement(l.Fragment,null,"$PACKAGE_ID will be populated with the ",N[e]," from the .",e," file after the software is added."," ",O(e)," ",l.createElement(I.A,{url:`${s.CW}/uninstall-scripts`,text:"Learn more about uninstall scripts",newTab:!0})));var t},R="package-advanced-options";var V=({showSchemaButton:e=!1,errors:t,selectedPackage:a,preInstallQuery:n,installScript:r,postInstallScript:i,uninstallScript:o,onClickShowSchema:s=x.noop,onChangePreInstallQuery:u,onChangeInstallScript:d,onChangePostInstallScript:m,onChangeUninstallScript:g,gitopsCompatible:E=!1,gitOpsModeEnabled:b=!1,patchWhenClosed:y=!1})=>{const[_,h]=(0,l.useState)(!1),A=(null==a?void 0:a.name)||"",w=(0,c.bv)(A),S="exe"===w||"zip"===w||"tar.gz"===w;return l.createElement("div",{className:R},l.createElement(P.A,{className:`${R}__accordion-title`,isShowing:_,showText:"Advanced options",hideText:"Advanced options",caretPosition:"after",onClick:()=>h(!_),disabled:!a||S,disabledTooltipContent:S?l.createElement(l.Fragment,null,"Install and uninstall scripts are required for .",w," packages."):l.createElement(l.Fragment,null,"Choose a file to modify advanced options.")}),(_||"exe"===w||"zip"===w||"tar.gz"===w)&&!!a&&(T=w,p.includes(T)?l.createElement(k.A,{className:`${R}__input-fields`,showSchemaButton:e,installScriptTooltip:(C=w,"exe"===C||"tar.gz"===C?"exe"===C?"Required for .exe packages.":"Required for .tar.gz archives.":"zip"===C&&f(C)?"Required for .zip packages.":void 0),installScriptHelpText:F(w),installScriptReadOnly:v(w),postInstallScriptHelpText:$(w),uninstallScriptTooltip:L(w),uninstallScriptHelpText:D(w),errors:t,preInstallQuery:n,installScript:r,postInstallScript:i,uninstallScript:o,onClickShowSchema:s,onChangePreInstallQuery:u,onChangeInstallScript:d,onChangePostInstallScript:m,onChangeUninstallScript:g,gitopsCompatible:E,gitOpsModeEnabled:b,patchWhenClosed:y}):null));var T,C},j=a(22184),U=a(97873),M=a(91176),q=a(9467),B=Object.defineProperty,H=Object.getOwnPropertySymbols,z=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable,Q=(e,t,a)=>t in e?B(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;const K={software:{validations:[{name:"required",isValid:e=>null!==e.software}]},preInstallQuery:{validations:[{name:"invalidQuery",isValid:()=>!0,message:e=>{const t=e.preInstallQuery;if(!t)return"";const{error:a}=(0,j.B4)(t);return a||""}}]},installScript:{validations:[{name:"requiredForExe",isValid:e=>{var t,a,l;return"exe"!==(null==(t=e.software)?void 0:t.type)&&"exe"!==(0,c.bv)((null==(a=e.software)?void 0:a.name)||"")||(null!=(l=e.installScript)?l:"").trim().length>0},message:"Install script is required for .exe packages."},{name:"requiredForZip",isValid:e=>{var t,a,l;return"zip"!==(null==(t=e.software)?void 0:t.type)&&"zip"!==(0,c.bv)((null==(a=e.software)?void 0:a.name)||"")||(null!=(l=e.installScript)?l:"").trim().length>0},message:"Install script is required for .zip packages."},{name:"requiredForTgz",isValid:e=>{var t,a;return!(null==(t=e.software)?void 0:t.name)||"tar.gz"!==(0,c.bv)(e.software.name)||(null!=(a=e.installScript)?a:"").trim().length>0},message:"Install script is required for .tar.gz archives."}]},uninstallScript:{validations:[{name:"requiredForExe",isValid:e=>{var t,a,l;return"exe"!==(null==(t=e.software)?void 0:t.type)&&"exe"!==(0,c.bv)((null==(a=e.software)?void 0:a.name)||"")||(null!=(l=e.uninstallScript)?l:"").trim().length>0},message:"Uninstall script is required for .exe packages."},{name:"requiredForZip",isValid:e=>{var t,a,l;return"zip"!==(null==(t=e.software)?void 0:t.type)&&"zip"!==(0,c.bv)((null==(a=e.software)?void 0:a.name)||"")||(null!=(l=e.uninstallScript)?l:"").trim().length>0},message:"Uninstall script is required for .zip packages."},{name:"requiredForTgz",isValid:e=>{var t,a;return!(null==(t=e.software)?void 0:t.name)||"tar.gz"!==(0,c.bv)(e.software.name)||(null!=(a=e.uninstallScript)?a:"").trim().length>0},message:"Uninstall script is required for .tar.gz archives."}]},customTarget:{validations:[{name:"requiredLabelTargets",isValid:e=>"All hosts"===e.targetType||void 0!==Object.keys(e.labelTargets).find(t=>e.labelTargets[t])}]}},G=(e,t)=>void 0===t||"string"==typeof t?t:t(e),Y=e=>{const t={isValid:!0,software:{isValid:!1}};
1return Object.keys(K).forEach(a=>{const l=a,n=K[l].validations.find(t=>!t.isValid(e));n?(t.isValid=!1,t[l]={isValid:!1,message:G(e,n.message)}):t[l]=((e,t)=>{for(var a in t||(t={}))z.call(t,a)&&Q(e,a,t[a]);if(H)for(var a of H(t))W.call(t,a)&&Q(e,a,t[a]);return e})({isValid:!0},"preInstallQuery"===l&&{message:G(e,K[l].validations[0].message)})}),t},Z=e=>{var t;const a=[e.installScript,e.uninstallScript,e.preInstallQuery,e.postInstallScript];let l=0;a.forEach(e=>{var t;l+=(null==(t=(0,M.p)(e))?void 0:t.length)||0});let n=String(e.selfService).length+String(e.automaticInstall).length;const r=new TextEncoder;return e.categories.forEach(e=>{n+=r.encode(e).length}),"Custom"===e.targetType&&(0,U.XX)(e.labelTargets).forEach(e=>{n+=r.encode(e).length}),((null==(t=e.software)?void 0:t.size)||0)+l+n};var J=a(2191),X=Object.defineProperty,ee=Object.defineProperties,te=Object.getOwnPropertyDescriptors,ae=Object.getOwnPropertySymbols,le=Object.prototype.hasOwnProperty,ne=Object.prototype.propertyIsEnumerable,re=(e,t,a)=>t in e?X(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,ie=(e,t)=>{for(var a in t||(t={}))le.call(t,a)&&re(e,a,t[a]);if(ae)for(var a of ae(t))ne.call(t,a)&&re(e,a,t[a]);return e},oe=(e,t)=>ee(e,te(t));const se="package-form",ce=e=>"sh"===e?"file-sh":"ps1"===e?"file-ps1":"py"===e?"file-py":"file-pkg";var ue=l.memo(({labels:e,showSchemaButton:t=!1,onClickShowSchema:a,onCancel:n,onSubmit:u,onClickPreviewEndUserExperience:d,isEditingSoftware:m=!1,isFleetMaintainedApp:p=!1,defaultSoftware:f,defaultInstallScript:x,defaultPreInstallQuery:P,defaultPostInstallScript:k,defaultUninstallScript:O,defaultSelfService:N,defaultCategories:F,className:$,gitopsCompatible:L=!1,teamId:D,multiPackageContext:R=!1,restrictedFileAccept:j,restrictedFileTypeLabel:U,initialTargetType:M,patchWhenClosed:B=!1})=>{var H,z;const{gitOpsModeEnabled:W,repoURL:Q}=(0,o.A)("software"),{config:K}=(0,l.useContext)(i.BR),G=null==K?void 0:K.max_software_package_size,X={software:f||null,installScript:x||"",preInstallQuery:P||"",postInstallScript:k||"",uninstallScript:O||"",selfService:N||!1,targetType:null!=M?M:(0,_.Ag)(f),customTarget:(0,_.lQ)(f),labelTargets:(0,_.ER)(f),automaticInstall:!1,categories:F||[]},[ee,te]=(0,l.useState)(X),[ae,le]=(0,l.useState)({isValid:!1,software:{isValid:!1}});(0,l.useEffect)(()=>{if(!W)return;const e=Object.values(ee.labelTargets).some(Boolean);if("Custom"!==ee.targetType||e)return;const t=oe(ie({},ee),{targetType:"All hosts"});te(t),le(Y(t))},[W,ee]);const ne=()=>{const e=m?T.V:S.wy;g.me.error(`${e} The maximum file size is ${(0,c.v7)(G||0)}.`)},re=(0,l.useCallback)(e=>{const t="boolean"==typeof e?e:!ee.automaticInstall;te(oe(ie({},ee),{automaticInstall:t}))},[ee]),ue=L&&W,de=!ae.isValid||ue,me=((e,t,a)=>{if(a&&t)return(0,q.qV)(t);const n=Object.values(e).filter(e=>!1===e.isValid&&e.message).map(e=>e.message);return 0===n.length?null:l.createElement(l.Fragment,null,n.map((e,t)=>l.createElement(l.Fragment,null,e,t<n.length-1&&l.createElement("br",null))))})(ae,Q,ue),pe=r()(se,$),fe=(0,c.bv)((null==(H=null==ee?void 0:ee.software)?void 0:H.name)||""),ve="exe"===fe,ge="tar.gz"===fe,Ee=v(fe),be="ipa"===fe,ye=m&&!ge&&!p;(0,l.useEffect)(()=>{(ve||ge||Ee||be)&&ee.automaticInstall&&re(!1)},[ee.automaticInstall,ve,ge,Ee,be,re]);const _e=ee.software&&!be,he=!(!ee.software||W||m||R||be||ve||ge||Ee),Ae=!W&&(m||!!ee.software),we=!W&&(m||R||!!ee.software);return l.createElement("div",{className:pe},l.createElement("form",{className:`${se}__form`,onSubmit:e=>{e.preventDefault(),void 0!==G&&Z(ee)>G?ne():u(ee)}},l.createElement(y.A,{canEdit:ye,graphicName:ce(fe||""),accept:null!=j?j:".pkg,.msi,.exe,.deb,.rpm,application/gzip,.tgz,.sh,.ps1,.py,.ipa",message:null!=U?U:l.createElement(l.Fragment,null,l.createElement(b.A,{tipContent:"Supports .pkg, .sh, and .py"},"macOS"),", ",l.createElement(b.A,{tipContent:"Supports .ipa"},"iOS/iPadOS"),","," ",l.createElement(b.A,{tipContent:"Supports .msi, .exe, .ps1"},"Windows"),", or"," ",l.createElement(b.A,{tipContent:"Supports .deb, .rpm, .tar.gz, .sh, and .py"},"Linux")),onFileUpload:e=>{if(e&&e.length>0){const t=e[0];if(void 0!==G&&t.size>G)return void ne();if(m){const e=oe(ie({}
1,ee),{software:t});te(e),le(Y(e))}else{let e,a;try{e=(e=>{const t=(0,c.bv)(e);switch(t){case"pkg":return'#!/bin/sh\n\ninstaller -pkg "$INSTALLER_PATH" -target /\n';case"msi":return'$logFile = "${env:TEMP}/fleet-install-software.log"\n\n# MSI exit codes that indicate success. 3010 = ERROR_SUCCESS_REBOOT_REQUIRED,\n# 1641 = ERROR_SUCCESS_REBOOT_INITIATED. Treat these as success rather than failure.\n$successCodes = @(0, 3010, 1641)\n\ntry {\n\n$installProcess = Start-Process msiexec.exe `\n  -ArgumentList "/quiet /norestart /lv `"${logFile}`" /i `"${env:INSTALLER_PATH}`"" `\n  -PassThru -Verb RunAs -Wait\n\nGet-Content $logFile -Tail 500\n\nif ($successCodes -contains $installProcess.ExitCode) {\n  Exit 0\n}\n\nExit $installProcess.ExitCode\n\n} catch {\n  Write-Host "Error: $_"\n  Exit 1\n}\n';case"deb":return'#!/bin/sh\n\napt-get install --assume-yes -f "$INSTALLER_PATH"\n';case"rpm":return'#!/bin/sh\n\ndnf install --assumeyes "$INSTALLER_PATH"\n';case"exe":case"zip":case"tar.gz":case"sh":case"ps1":case"py":case"ipa":return"";default:throw new Error(`unsupported file extension: ${t}`)}})(t.name)}catch(e){return void g.me.error(S.wy,{response:{data:{message:e instanceof Error?e.message:String(e)}}})}try{a=(e=>{const t=(0,c.bv)(e);switch(t){case"pkg":return'#!/bin/sh\n\n# Fleet extracts and saves package IDs.\npkg_ids=$PACKAGE_ID\n\n# For each package id, get all .app folders associated with the package and remove them.\nfor pkg_id in "${pkg_ids[@]}"\ndo\n  # Get volume and location of the package.\n  volume=$(pkgutil --pkg-info "$pkg_id" | grep -i "volume" | awk \'{if (NF>1) print $NF}\')\n  location=$(pkgutil --pkg-info "$pkg_id" | grep -i "location" | awk \'{if (NF>1) print $NF}\')\n  # Check if this package id corresponds to a valid/installed package\n  if [[ ! -z "$volume" ]]; then\n    # Remove individual directories that end with ".app" belonging to the package.\n    # Only process directories that end with ".app" to prevent Fleet from removing top level directories.\n    pkgutil --only-dirs --files "$pkg_id" | grep "\\.app$" | sed -e \'s@^@\'"$volume""$location"\'/@\' | tr \'\\n\' \'\\0\' | xargs -n 1 -0 rm -rf\n    # Remove receipts\n    pkgutil --forget "$pkg_id"\n  else\n    echo "WARNING: volume is empty for package ID $pkg_id"\n  fi\ndone\n';case"msi":return'# Fleet uninstalls app by finding all related product codes for the specified upgrade code\n$inst = New-Object -ComObject "WindowsInstaller.Installer"\n$timeoutSeconds = 300  # 5 minute timeout per product\n\n# MSI exit codes that indicate success. 3010 = ERROR_SUCCESS_REBOOT_REQUIRED,\n# 1641 = ERROR_SUCCESS_REBOOT_INITIATED. Treat these as success rather than failure.\n$successCodes = @(0, 3010, 1641)\n\nforeach ($product_code in $inst.RelatedProducts("$UPGRADE_CODE")) {\n    $process = Start-Process msiexec -ArgumentList @("/quiet", "/x", $product_code, "/norestart") -PassThru\n\n    # Wait for process with timeout\n    $completed = $process.WaitForExit($timeoutSeconds * 1000)\n\n    if (-not $completed) {\n        Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue\n        Exit 1603  # ERROR_UNINSTALL_FAILURE\n    }\n\n    # If the uninstall failed, bail\n    if ($successCodes -notcontains $process.ExitCode) {\n        Write-Output "Uninstall for $($product_code) exited $($process.ExitCode)"\n        Exit $process.ExitCode\n    }\n}\n\n# All uninstalls succeeded; exit success\nExit 0\n';case"deb":return'package_name=$PACKAGE_ID\n\n# Fleet uninstalls app using product name that\'s extracted on upload\napt-get remove --purge --assume-yes "$package_name"\n';case"rpm":return'package_name=$PACKAGE_ID\n\n# Fleet uninstalls app using product name that\'s extracted on upload\ndnf remove --assumeyes "$package_name"\n';case"exe":case"tar.gz":case"sh":case"ps1":case"py":case"ipa":return"";default:throw new Error(`unsupported file extension: ${t}`)}})(t.name)}catch(e){return void g.me.error(S.wy,{response:{data:{message:e instanceof Error?e.message:String(e)}}})}const l=oe(ie({},ee),{software:t,installScript:e||"",uninstallScript:a||""});te(l),le(Y(l))}}},buttonMessage:"Choose file",buttonType:"secondary",className:`${se}__file-uploader`,fileDetails:ee.software?(0,c.P$)(ee.software):void 0,gitopsCompatible:L,gitOpsModeEnabled:W}),R&&W&&l.createElement(w.E,null),(he||Ae||we)&&l.createElement("div",{className:L&&W?`${se}__form-fields--gitops-disabled form`:"form"},he&&l.createElement(l.Fragment,null,l.createElement(J.A,{deploySoftware:ee.automaticInstall,onToggleDeploySoftware:re}),ee.automaticInstall&&l.createElement(C.A,{color:"yellow",className:`${se}__deploy-warning`,cta:l.createElement(I.A,{url:`${s.CW}/query-templates-for-automatic-install-software`,text:"Learn more",newTab:!0})},"Installing software over existing installations might cause issues. Fleet's policy may not detect these existing installations. Please create a test fleet in Fleet to verify a smooth installation.")),(Ae||we)&&l.createElement("div",{className:`${se}__form-frame`},Ae&&l.createElement(A.A,{formData:ee,onToggleSelfService:()=>{const e=oe(ie({},ee),{selfService:!ee.selfService});te(e),le(Y(e))},onSelectCategory:({name:e,value:t})=>{let a;a=t?ee.categories.includes(e)?ee.categories:[...ee.categories,e]:ee.categories.filter(t=>t!==e);const l=oe(ie({},ee),{categories:a});te(l),le(Y(l))},isEditingSoftware:m,onClickPreviewEndUserExperience:()=>d(be),teamId:D}),we&&l.createElement(l.Fragment,null,!m&&l.createElement(C.A,{icon:"info-outline",iconColor:"ui-fleet-black-50",className:`${se}__multi-package-banner`,borderRadius:"medium"},"If multiple packages of the same software target the same host, Fleet will install the one that was added first."),l.createElement(h.m,{selectedTargetType:ee.targetType,selectedCustomTarget:ee.customTarget,selectedLabels:ee.labelTargets,customTargetOptions:_.fK,className:`${se}__target`,onSelectTargetType:e=>{const t=oe(ie({},ee),{targetType:e});te(t),le(Y(t))},onSelectCustomTarget:e=>{const t=oe(ie({},ee),{customTarget:e});te(t),le(Y(t))},onSelectLabel:({name:e,value:t})=>{const a=oe(ie({},ee),{labelTargets:oe(ie({},ee.labelTargets),{[e]:t})});te(a),le(Y(a))},labels:e||[],dropdownHelpText:"Custom"===ee.targetType&&(0,_.a3)(ee.automaticInstall,ee.customTarget)})))),_e&&l.createElement(V,{showSchemaButton:t,selectedPackage:ee.software,errors:{preInstallQuery:null==(z=ae.preInstallQuery)?void 0:z.message},preInstallQuery:ee.preInstallQuery,installScript:ee.installScript,postInstallScript:ee.postInstallScript,uninstallScript:ee.uninstallScript,onClickShowSchema:a,onChangePreInstallQuery:e=>{const t=oe(ie({},ee),{preInstallQuery:e});te(t),le(Y(t))},onChangeInstallScript:e=>{const t=oe(ie({},ee),{installScript:e});
1te(t),le(Y(t))},onChangePostInstallScript:e=>{const t=oe(ie({},ee),{postInstallScript:e});te(t),le(Y(t))},onChangeUninstallScript:e=>{const t=oe(ie({},ee),{uninstallScript:e});te(t),le(Y(t))},gitopsCompatible:L,gitOpsModeEnabled:W,patchWhenClosed:B}),l.createElement("div",{className:`${se}__action-buttons`},(()=>{const e=l.createElement(E.A,{type:"submit",disabled:de},m||R?"Save":"Add software");return me?l.createElement(b.A,{tipContent:me,underline:!1,showArrow:!0,tipOffset:10,position:"left"},e):e})(),l.createElement(E.A,{variant:"secondary",onClick:n},"Cancel"))))})},66081:function(e,t,a){a.d(t,{dw:function(){return c},Yw:function(){return u},kl:function(){return s}});var l=a(96540),n=a(5410),r=a(48862),i=a(38021);const o="software-deploy-selector",s=e=>({patch_when_closed:"closed"===e,continuous_automations_enabled:"closed"===e}),c=({patchOption:e,onSelectPatchOption:t,disabled:a=!1,showPatchWhenClosedNotice:n=!1})=>{const s=e=>t(e);return l.createElement(l.Fragment,null,l.createElement("div",{className:`${o}__patch-options`,role:"radiogroup","aria-label":"Patch options"},l.createElement(r.A,{id:"patch-when-closed",name:"patch-option",value:"closed",label:"Patch when app is closed",checked:"closed"===e,onChange:s,disabled:a}),l.createElement(r.A,{id:"force-patch",name:"patch-option",value:"force",label:"Force patch",checked:"force"===e,onChange:s,disabled:a}),l.createElement(r.A,{id:"manual-patch",name:"patch-option",value:"manual",label:"End user initiated (manual)",checked:"manual"===e,onChange:s,disabled:a}),"force"===e&&l.createElement(i.A,{icon:"error-outline",iconColor:"ui-fleet-black-50"},"End user is not notified. Patch is forced as soon as policy fails. Notifications are coming soon.")),"closed"===e&&n&&l.createElement("p",{className:`${o}__patch-when-closed-notice`},l.createElement("b",null,"Patch when app is closed")," overrides the pre-install query (advanced option) to check if the app is closed."))};var u=({forceInstall:e,patch:t,patchOption:a,onToggleForceInstall:r,onTogglePatch:i,onSelectPatchOption:s,disabled:u=!1,showPatchWhenClosedNotice:d=!1,hideLabel:m=!1})=>l.createElement("div",{className:`form-field ${o}`},!m&&l.createElement("div",{className:"form-field__label"},"Deploy"),l.createElement("div",{className:`${o}__checkboxes`},l.createElement(n.A,{name:"force-install",value:e,onChange:r,disabled:u},"Force install"),l.createElement(n.A,{name:"patch",value:t,onChange:i,disabled:u},"Patch")),t&&l.createElement(c,{patchOption:a,onSelectPatchOption:s,disabled:u,showPatchWhenClosedNotice:d}))},2191:function(e,t,a){a.d(t,{A:function(){return s}});var l=a(96540),n=a(32485),r=a.n(n),i=a(26806);const o="software-deploy-slider";var s=({deploySoftware:e,onToggleDeploySoftware:t,className:a})=>{const n=r()(`${o}__container`,a);return l.createElement("div",{className:n},l.createElement(i.A,{value:e,onChange:t,activeText:"Deploy",inactiveText:"Deploy",className:`${o}__deploy-slider`,labelTooltip:"Automatically install only on hosts missing this software."}))}},65019:function(e,t,a){a.d(t,{e:function(){return x}});var l=a(96540),n=a(32485),r=a.n(n),i=a(75942),o=a(5410),s=a(26806),c=a(24432),u=a(79519),d=a(45584),m=a(78263),p=a(12968),f=a(89937),v=a(30104),g=a(17190),E=a(74953),b=a(43015),y=a(23543),_=Object.defineProperty,h=Object.defineProperties,A=Object.getOwnPropertyDescriptors,w=Object.getOwnPropertySymbols,S=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable,C=(e,t,a)=>t in e?_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;const I="software-options-selector",x=()=>l.createElement("p",null,"Currently, Android apps can only be added as self-service and the end user can install them from the ",l.createElement("strong",null,"Play Store")," in their work profile. Additionally, you can install it when hosts enroll on the"," ",l.createElement(c.A,{url:m.A.CONTROLS_INSTALL_SOFTWARE("android"),text:"Setup experience"})," ","page."),P=({onSelectCategory:e,selectedCategories:t,onClickPreviewEndUserExperience:a,teamId:n})=>{const r=void 0!==n,{data:s,isLoading:v,isError:b}=(0,i.useQuery)(["selfServiceCategories",n],()=>y.A.getCategories(n),(_=((e,t)=>{for(var a in t||(t={}))S.call(t,a)&&C(e,a,t[a]);if(w)for(var a of w(t))T.call(t,a)&&C(e,a,t[a]);return e})({},f.QL),h(_,A({retry:!1,enabled:r,select:e=>e.self_service_categories.map(e=>({id:e.id,label:e.name,value:e.name}))}))));var _;const x=r?s||[]:g.iT.map(e=>({id:e.id,label:e.label,value:e.value})),P=r&&!v&&!b&&0===x.length;return l.createElement(l.Fragment,null,l.createElement("div",{className:"form-field__label"},"Categories"),r&&v?l.createElement("div",{className:`${I}__categories-loading`},l.createElement(d.A,{centered:!1,small:!0})):r&&b?l.createElement(u.A,{className:`${I}__categories-error`,verticalPaddingSize:"pad-large"}):P?l.createElement("div",{className:`${I}__categories-empty`},l.createElement(c.A,{url:(0,p.M8)(m.A.SOFTWARE_LIBRARY_CATEGORIES,{fleet_id:n}),text:"Add category"}
1),l.createElement("span",null,"to assign software to it.")):l.createElement("div",{className:`${I}__categories-selector`},x.map(a=>l.createElement("div",{className:`${I}__label`,key:a.id},l.createElement(o.A,{className:`${I}__checkbox`,name:a.value,value:t.includes(a.value),onChange:e,parseTarget:!0},l.createElement("div",{className:`${I}__label-name`},a.label))))),l.createElement(E.A,{variant:"secondary",onClick:a,className:`${I}__preview-button`},"Preview end user experience"))};t.A=({formData:e,onToggleSelfService:t,onClickPreviewEndUserExperience:a,onSelectCategory:n,platform:i,className:o,isIpaPackage:c,isEditingSoftware:u,disableOptions:d=!1,teamId:m})=>{const p=r()(I,o),f=(0,b.l)(i||"")||c||!1,g=(0,b.m0)(i||""),E=d,y=e.selfService&&u,_=E?void 0:(0,v.F$)(f,g);return l.createElement("div",{className:`form-field ${p}`},l.createElement("div",{className:"form-field__label"},"Options"),g?l.createElement(x,null):null,l.createElement("div",{className:`${I}__self-service`},l.createElement(s.A,{value:e.selfService,onChange:t,inactiveText:"Self service",activeText:"Self service",labelTooltip:_,className:`${I}__self-service-slider`,disabled:E}),y&&l.createElement(P,{onSelectCategory:n,selectedCategories:e.categories,onClickPreviewEndUserExperience:a,teamId:m})))}},98601:function(e,t,a){a.d(t,{A:function(){return l.A}});var l=a(65019)},26783:function(e,t,a){a.d(t,{A:function(){return $}});var l=a(96540),n=a(32485),r=a.n(n),i=a(4346),o=a(43015),s=a(56906),c=a(24432),u=a(48862),d=a(74953),m=a(36291),p=a(98601),f=a(22676),v=a(59333),g=a(69906),E=a(30104);const b={customTarget:{validations:[{name:"requiredLabelTargets",isValid:e=>"All hosts"===e.targetType||void 0!==Object.keys(e.labelTargets).find(t=>e.labelTargets[t])}]}},y=e=>`${e.app_store_id}_${e.platform}`,_=e=>{const t={isValid:!0};return Object.keys(b).forEach(a=>{const l=a;b[l].validations.find(t=>!t.isValid(e))?(t.isValid=!1,t[l]={isValid:!1}):t[l]={isValid:!0}}),t};var h=a(2191),A=Object.defineProperty,w=Object.defineProperties,S=Object.getOwnPropertyDescriptors,T=Object.getOwnPropertySymbols,C=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable,x=(e,t,a)=>t in e?A(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,P=(e,t)=>{for(var a in t||(t={}))C.call(t,a)&&x(e,a,t[a]);if(T)for(var a of T(t))I.call(t,a)&&x(e,a,t[a]);return e},k=(e,t)=>w(e,S(t));const O="software-vpp-form",N=({app:e,selected:t,uniqueAppId:a,onSelect:n})=>l.createElement("li",{className:`${O}__list-item`},l.createElement(u.A,{label:l.createElement("div",{className:`${O}__app-info`},l.createElement(g.A,{url:e.icon_url}),l.createElement("span",null,e.name)),id:`vppApp-${a}`,checked:t,value:a,name:"vppApp",onChange:()=>n(e)}),e.platform&&l.createElement("div",{className:"app-platform"},o.uc[e.platform])),F=({apps:e,selectedApp:t,onSelect:a})=>{const n=t?y(t):null;return l.createElement("div",{className:`${O}__list-container`},l.createElement("ul",{className:`${O}__list`},e.map(e=>{const t=y(e);return l.createElement(N,{key:t,app:e,selected:n===t,uniqueAppId:t,onSelect:a})})))};var $=({labels:e,vppApps:t,softwareVppForEdit:a,onSubmit:n,isLoading:u=!1,onCancel:g,onClickPreviewEndUserExperience:b,teamId:y})=>{const{gitOpsModeEnabled:A}=(0,i.A)("software"),[w,S]=(0,l.useState)(a?{selfService:a.self_service||!1,automaticInstall:a.automatic_install||!1,targetType:(0,E.Ag)(a),customTarget:(0,E.lQ)(a),labelTargets:(0,E.ER)(a),categories:a.categories||[]}:{selectedApp:null,selfService:!1,automaticInstall:!1,targetType:"All hosts",customTarget:"labelsIncludeAny",labelTargets:{},categories:[]}),[T,C]=(0,l.useState)({isValid:!1}),I=e=>{if("selectedApp"in w){const t=k(P({},w),{selectedApp:e,selfService:"ios"!==e.platform&&"ipados"!==e.platform&&w.selfService,automaticInstall:"ios"!==e.platform&&"ipados"!==e.platform&&w.automaticInstall});S(t),C(_(t))}},x=()=>{const e=k(P({},w),{selfService:!w.selfService});S(e),C(_(e))},N=({name:e,value:t})=>{let a;a=t?w.categories.includes(e)?w.categories:[...w.categories,e]:w.categories.filter(t=>t!==e);const l=k(P({},w),{categories:a});S(l),C(_(l))},$=()=>{const e=k(P({},w),{automaticInstall:!w.automaticInstall});S(e),C(_(e))},L=e=>{const t=k(P({},w),{targetType:e});S(t),C(_(t))},D=e=>{const t=k(P({},w),{customTarget:e});S(t),C(_(t))},R=({name:e,value:t})=>{const a=k(P({},w),{labelTargets:k(P({},w.labelTargets),{[e]:t})});S(a),C(_(a))},V=!T.isValid,j=r()(`${O}__content-wrapper`,{[`${O}__content-disabled`]:u}),U=r()(`${O}__form-content`,{[`${O}__form-content--disabled`]:A});return l.createElement("form",{className:O,onSubmit:e=>{e.preventDefault(),n(w)}},u&&l.createElement("div",{className:`${O}__overlay`}),l.createElement("div",{className:j},l.createElement("div",{className:U},l.createElement(l.Fragment,null,(()=>{if(a){const t=(0,s.w9)(a.platform);return l.createElement("div",{className:`${O}__form-fields`},l.createElement(m.A,{graphicNames:"app-store",fileDetails:{name:a.name,description:o.uc[a.platform]},canEdit:!1}),l.createElement("div",{className:`${O}__form-frame`},l.createElement(p.A,{platform:a.platform,formData:w,onToggleSelfService:x,onSelectCategory:N,isEditingSoftware:!0,onClickPreviewEndUserExperience:()=>b(t),teamId:y}),l.createElement(f.m,{selectedTargetType:w.targetType,selectedCustomTarget:w.customTarget,selectedLabels:w.labelTargets,customTargetOptions:E.fK,className:`${O}__target`,onSelectTargetType:L,onSelectCustomTarget:D,onSelectLabel:R,labels:e||[],dropdownHelpText:(0,E.a3)(!1,w.customTarget),subTitle:t?"Changing this will also apply to targets for auto-updates.":""})))}const n=!!w.selectedApp&&!(0,s.w9)(w.selectedApp.platform);return t?l.createElement("div",{className:`${O}__form-fields`},l.createElement(F,{apps:t,selectedApp:w.selectedApp||null,onSelect:I}),l.createElement("div",{className:`${O}__help-text`},"These apps were added in Apple Business (AB). To add more apps, head to ",l.createElement(c.A,{url:"https://business.apple.com",text:"AB",newTab:!0})),w.selectedApp&&l.createElement(p.A,{platform:w.selectedApp.platform,formData:w,onToggleSelfService:x,onSelectCategory:N,onClickPreviewEndUserExperience:()=>{var e;return b((0,s.w9)((null==(e=w.selectedApp)?void 0:e.platform)||""))},teamId:y}),n&&l.createElement(h.A,{deploySoftware:w.automaticInstall,onToggleDeploySoftware:$})):null})())),l.createElement("div",{className:`${O}__action-buttons`}
1,l.createElement(v.A,{entityType:"software",position:"top",tipOffset:8,renderChildren:e=>l.createElement(d.A,{type:"submit",disabled:e||V,isLoading:u,className:`${O}__add-software-btn`},a?"Save":"Add software")}),l.createElement(d.A,{onClick:g,variant:"secondary"},"Cancel"))))}},90581:function(e,t,a){a.d(t,{A:function(){return c}});var l=a(96540),n=a(32485),r=a.n(n),i=a(71879),o=a(45902);const s="os-icon";var c=({name:e="",size:t="small",url:a})=>{const n=r()(s,`${s}__${t}`);if(a){const e=r()(`${s}__os-img`,`${s}__os-img-${t}`);return l.createElement("div",{className:n},l.createElement("img",{className:e,src:a,alt:""}))}return l.createElement(o.A,{icon:(0,i.Ob)({name:e}),size:t,className:n})}},25862:function(e,t,a){a.d(t,{k:function(){return w}});var l=a(96540),n=a(75942),r=a(68774),i=a(23543),o=a(89937),s=a(34724),c=a(81790),u=a(99958),d=a(74953),m=a(40925),p=a(52978),f=a(42526),v=a(69906);const g="categories-end-user-experience-preview-modal",E=()=>l.createElement("span",{className:`${g}__status-cell ${g}__status-cell--installed`},l.createElement(p.A,{name:"success"}),"Installed"),b=()=>l.createElement("span",{className:`${g}__status-cell ${g}__status-cell--never-installed`},o.r2),y=[{Header:e=>l.createElement(m.A,{value:"Name",isSortedDesc:e.column.isSortedDesc}),accessor:"name",disableSortBy:!0},{Header:e=>l.createElement(m.A,{value:"Install status",isSortedDesc:e.column.isSortedDesc}),accessor:"install_status",disableSortBy:!0}],_=[{title:"Adobe Acrobat Reader"},{title:"Box Drive"}],h=(e,t,a,n,r)=>[{name:l.createElement(c.A,{name:e,display_name:t,source:n,iconUrl:a,pageContext:"deviceUser",isSelfService:!0,previewIcon:r}),install_status:l.createElement(b,null)},..._.filter(t=>t.title!==e).map(e=>({name:l.createElement(c.A,{name:e.title,source:"apps",pageContext:"deviceUser",isSelfService:!0}),install_status:l.createElement(E,null)}))],A=()=>l.createElement("div",null,"No software found"),w=({name:e,displayName:t,source:a,iconUrl:n=null,previewIcon:r})=>l.createElement(s.A,{columnConfigs:y,data:h(e,t,n,a,r),isLoading:!1,emptyComponent:A,showMarkAllPages:!1,isAllPagesSelected:!1,searchable:!1,disablePagination:!0,disableCount:!0,disableTableHeader:!0,disableHighlightOnHover:!0});t.A=({onCancel:e,teamId:t,isIosOrIpadosApp:a=!1,name:o="Software name",displayName:s="Software name",iconUrl:c,source:m,mobileVersion:p})=>{var E;const{config:b}=(0,l.useContext)(r.BR),{data:y}=(0,n.useQuery)(["selfServiceCategories",t],()=>i.A.getCategories(t),{select:e=>e.self_service_categories,staleTime:6e4}),_=(null!=(E=null==y?void 0:y.length)?E:0)>0;return l.createElement(u.A,{title:"End user experience",onExit:e,className:g},l.createElement("span",null,"What end users see:"),l.createElement(f.A,{isIosOrIpadosApp:a,contactUrl:(null==b?void 0:b.org_info.contact_url)||"",name:o,displayName:s||o,versionLabel:p||"Version (unknown)",hasCategories:_,renderIcon:()=>l.createElement(v.A,{name:o,source:m,url:null!=c?c:void 0}),renderTable:()=>l.createElement(w,{name:o,displayName:s,source:m,iconUrl:c})}),l.createElement("div",{className:"modal-cta-wrap"},l.createElement(d.A,{onClick:e},"Close")))}},72753:function(e,t,a){a.d(t,{A:function(){return l.A}});var l=a(25862)},26046:function(e,t,a){a.d(t,{A:function(){return b}});var l=a(96540),n=a(99958),r=a(74953),i=a(26806),o=a(5410),s=a(79456),c=Object.defineProperty,u=Object.defineProperties,d=Object.getOwnPropertyDescriptors,m=Object.getOwnPropertySymbols,p=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable,v=(e,t,a)=>t in e?c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,g=(e,t)=>{for(var a in t||(t={}))p.call(t,a)&&v(e,a,t[a]);if(m)for(var a of m(t))f.call(t,a)&&v(e,a,t[a]);return e},E=(e,t)=>u(e,d(t)),b=({onExit:e,onSubmit:t,vulnFilters:a,isPremiumTier:c})=>{var u,d,m,p;const[f,v]=(0,l.useState)(a.vulnerable||!1),[b,y]=(0,l.useState)((0,s.S1)(a.minCvssScore,a.maxCvssScore)),[_,h]=(0,l.useState)({minScore:null!=(d=null==(u=a.minCvssScore)?void 0:u.toString())?d:"",maxScore:null!=(p=null==(m=a.maxCvssScore)?void 0:m.toString())?p:""}),[A,w]=(0,l.useState)(a.exploit),[S,T]=(0,l.useState)({}),C=(0,l.useRef)(new Set);return l.createElement(n.A,{title:"Filters",onExit:e,className:"software-filters-modal"},l.createElement("form",{onSubmit:e=>{if(e.preventDefault(),f){const e=(0,s.Jx)(_);if(Object.keys(e).length>0)return void T(e)}const{min:a,max:l}=(0,s.$l)(_);t({vulnerable:f,exploit:A||void 0,minCvssScore:a,maxCvssScore:l})}},l.createElement(i.A,{value:f,onChange:()=>{const e=!f;e||T({}),v(e)},inactiveText:"Vulnerable software",activeText:"Vulnerable software"}),c&&l.createElement(l.Fragment,null,l.createElement(s.Ay,{severity:b,minScore:_.minScore,maxScore:_.maxScore,onChange:({severity:e,minScore:t,maxScore:a})=>{e===b?(t!==_.minScore&&C.current.add("minScore"),a!==_.maxScore&&C.current.add("maxScore")):T({}),y(e),h({minScore:t,maxScore:a})},disabled:!f,errors:S,onScoreBlur:e=>{if(!C.current.has(e))return;const{[e]:t}=(0,s.Jx)(_);T(a=>E(g({},a),{[e]:t}))},onScoreFocus:e=>{T(t=>t[e]?E(g({},t),{[e]:void 0}):t)}}),l.createElement(o.A,{onChange:({value:e})=>w(e),name:"hasKnownExploit",value:A,parseTarget:!0,helpText:"Software has vulnerabilities that have been actively exploited in the wild.",disabled:!f},"Has known exploit")),l.createElement("div",{className:"modal-cta-wrap"},l.createElement(r.A,{type:"submit"},"Apply"),l.createElement(r.A,{variant:"secondary",onClick:e},"Cancel"))))}},56884:function(e,t,a){a.d(t,{s:function(){return w},A:function(){return S}});var l=a(96540),n=a(32485),r=a.n(n),i=a(78263),o=a(68774),s=a(89937),c=a(12968),u=a(34724),d=a(46692),m=a(2367),p=a(24432),f=a(9467),v=a(72828),g=a(75679),E=a(52603),b=a(24292),y=a(39435),_=a(2837),h=a(24228);const A=({itemName:e})=>l.createElement(m.A,{header:`No vulnerabilities detected for this ${e}`,info:l.createElement(l.Fragment,null,"Expecting to see vulnerabilities?"," ",l.createElement(p.A,{url:"https://fleetdm.com/guides/vulnerability-processing#coverage",text:"What Fleet covers",newTab:!0}))}),w=({platformText:e})=>l.createElement(m.A,{header:"Vulnerabilities are not supported for this type of host",info:l.createElement(l.Fragment,null,"Interested in vulnerabilities in ",null!=e?e:"this platform","?"," ",l.createElement(p.A,{url:s.F6,text:"Let us know",
1newTab:!0}))});var S=({data:e,itemName:t,isLoading:a,className:n,router:s,teamIdForApi:m})=>{const{isPremiumTier:p}=(0,l.useContext)(o.BR),w=r()("software-vulnerabilities-table",n),S=(0,l.useMemo)(()=>((e,t,a)=>{const n=[{title:"Vulnerability",accessor:"cve",disableSortBy:!0,Header:"Vulnerability",Cell:({cell:{value:e}})=>{const t=e.toString(),n=(0,c.M8)(i.A.SOFTWARE_VULNERABILITY_DETAILS(t),{fleet_id:a});return l.createElement(h.A,{value:t,path:n})}},{title:"Severity",accessor:"cvss_score",disableSortBy:!1,Header:e=>{const t=l.createElement(E.A,{tipContent:l.createElement(l.Fragment,null,"The worst case impact across different environments (CVSS version 3.x base score).")},"Severity");return l.createElement(l.Fragment,null,l.createElement(v.A,{value:t,isSortedDesc:e.column.isSortedDesc}))},Cell:({cell:{value:e}})=>l.createElement(g.A,{formatter:f.JE,value:e})},{title:"Probability of exploit",accessor:"epss_probability",disableSortBy:!1,Header:e=>{const t=l.createElement(E.A,{className:"epss_probability",tipContent:l.createElement(l.Fragment,null,"The probability that this vulnerability will be exploited in the next 30 days (EPSS probability). ",l.createElement("br",null),"This data is reported by FIRST.org."),fixedPositionStrategy:!0},"Probability of exploit");return l.createElement(l.Fragment,null,l.createElement(v.A,{value:t,isSortedDesc:e.column.isSortedDesc}))},Cell:e=>l.createElement(y.A,{probabilityOfExploit:e.row.original.epss_probability,cisaKnownExploit:e.row.original.cisa_known_exploit})},{title:"Published",accessor:"cve_published",disableSortBy:!1,Header:e=>{const t=l.createElement(E.A,{tipContent:l.createElement(l.Fragment,null,"The date this vulnerability was published in the National Vulnerability Database (NVD).")},"Published");return l.createElement(l.Fragment,null,l.createElement(v.A,{value:t,isSortedDesc:e.column.isSortedDesc}))},Cell:({cell:{value:e}})=>{const t="number"==typeof e?e.toString():e;return l.createElement(g.A,{value:t?{timeString:t}:void 0,formatter:t?b.T:void 0})}},{title:"Detected",accessor:"created_at",disableSortBy:!1,Header:e=>{const t=l.createElement(E.A,{tipContent:l.createElement(l.Fragment,null,"The date this vulnerability first appeared on a host.")},"Detected");return l.createElement(l.Fragment,null,l.createElement(v.A,{value:t,isSortedDesc:e.column.isSortedDesc}))},Cell:e=>{const t=e.row.original.created_at||"";return l.createElement(g.A,{value:{timeString:t},formatter:b.T})}},{title:"",Header:"",accessor:"linkToFilteredHosts",disableSortBy:!0,Cell:e=>l.createElement(l.Fragment,null,e.row.original&&l.createElement(_.A,{queryParams:{vulnerability:e.row.original.cve,fleet_id:a},className:"vulnerabilities-link",rowHover:!0}))}];return e?n:n.filter(e=>"epss_probability"!==e.accessor&&"cve_published"!==e.accessor&&"cvss_score"!==e.accessor)})(Boolean(p),0,m),[p]);return l.createElement("div",{className:w},l.createElement(u.A,{columnConfigs:S,data:e,defaultSortHeader:p?"updated_at":"cve",defaultSortDirection:"desc",emptyComponent:()=>l.createElement(A,{itemName:t}),isAllPagesSelected:!1,isLoading:a,isClientSidePagination:!0,pageSize:20,resultsTitle:"items",showMarkAllPages:!1,disableMultiRowSelect:!0,onSelectSingleRow:e=>{if(e.original.cve){const t=e.original.cve.toString(),a=(0,c.M8)(i.A.SOFTWARE_VULNERABILITY_DETAILS(t),{fleet_id:m});s.push(a)}},disableTableHeader:0===e.length,renderCount:()=>l.createElement(d.A,{name:"items",count:null==e?void 0:e.length})}))}},82296:function(e,t,a){a.d(t,{A:function(){return l.A}});var l=a(56884)},33745:function(e,t,a){a.d(t,{A:function(){return s}});var l=a(96540),n=a(75679),r=a(52603),i=a(16240),o=a(89937),s=({versions:e})=>e&&0!==e.length&&""!==e[0].version?1===e.length?l.createElement(i.A,{value:e[0].version}):l.createElement(r.A,{tipContent:l.createElement(l.Fragment,null,e.map(e=>e.version).join(", ")),tipOffset:14,position:"top",showArrow:!0,underline:!1,fixedPositionStrategy:!0},l.createElement(n.A,{value:`${e.length} versions`,italic:!0})):l.createElement(n.A,{value:o.r2,grey:!0})},49827:function(e,t,a){a.r(t),a.d(t,{default:function(){return ge}});var l=a(96540),n=a(75942),r=a(53806),i=a(78263),o=a(62131),s=a(98544),c=a(19677),u=a(68774),d=a(38944),m=a(12968),p=a(9467),f=a(46157),v=a(74953),g=a(85396),E=a(827),b=a(48392),y=a(52603),_=a(15570),h=a(37738),A=a(29448),w=a(2543),S=a(98598),T=a(4346),C=a(89937),I=a(77906),x=a(79973),P=a(99958),k=a(26806),O=a(48862),N=a(80717),F=a(24432),$=a(90879),L=a(59333);const D="preview-data-modal";var R=({onCancel:e})=>{const{isFreeTier:t}=(0,l.useContext)(u.BR),a={timestamp:"0000-00-00T00:00:00Z",vulnerability:{cve:"CVE-2014-9471",details_link:"https://nvd.nist.gov/vuln/detail/CVE-2014-9471",epss_probability:.7,cvss_score:5.7,cisa_known_exploit:!0,cve_published:"2014-10-10T00:00:00Z",hosts_affected:[{id:1,display_name:"macbook-1",url:"https://fleet.example.com/hosts/1",software_installed_paths:["/usr/lib/some-path"]},{id:2,display_name:"macbook-2",url:"https://fleet.example.com/hosts/2"}]}};return t&&(delete a.vulnerability.epss_probability,delete a.vulnerability.cvss_score,delete a.vulnerability.cisa_known_exploit,delete a.vulnerability.cve_published),l.createElement(P.A,{title:"Example payload",onExit:e,onEnter:e,className:D},l.createElement("div",{className:`${D}__preview-modal`},l.createElement("p",null,"Want to learn more about how automations in Fleet work?"," ",l.createElement(F.A,{url:"https://fleetdm.com/docs/using-fleet/automations",text:"Check out the Fleet documentation",newTab:!0})),l.createElement("div",{className:`${D}__payload-request-preview`},l.createElement("pre",null,"POST https://server.com/example")),l.createElement("div",{className:`${D}__payload-webhook-preview`},l.createElement("pre",{dangerouslySetInnerHTML:{__html:(0,p._j)(a)}})),l.createElement("div",{className:"modal-cta-wrap"},l.createElement(v.A,{onClick:e},"Close"))))},V=a.p+"jira-vuln-software-preview-400x517@[email protected]",j=a.p+"zendesk-vuln-software-preview-400x455@[email protected]",U=a.p+"jira-vuln-software-preview-premium-400x517@[email protected]",M=a.p+"zendesk-vuln-software-preview-premium-400x455@[email protected]";const q="preview-ticket-modal";var B=({onCancel:e,integrationType:t})=>{const{isPremiumTier:a}=(0,l.useContext)(u.BR),n="jira"===t?l.createElement("img",{src:a?U:V,alt:"Jira ticket",className:`${q}__jira-screenshot`}):l.createElement("img",{src:a?M:j,alt:"Zendesk ticket",className:`${q}__zendesk-screenshot`});return l.createElement(P.A,{title:"Example ticket",onExit:e,onEnter:e,className:q,width:"large"},l.createElement("p",{className:"automations-learn-more"},"Want to learn more about how automations in Fleet work?"," ",l.createElement(F.A,{url:"https://fleetdm.com/docs/using-fleet/automations",text:"Check out the Fleet documentation",newTab:!0})),l.createElement("div",{className:`${q}__example`},n),l.createElement("div",{className:"modal-cta-wrap"},l.createElement(v.A,{onClick:e},"Close")))},H=Object.defineProperty,z=Object.defineProperties,W=Object.getOwnPropertyDescriptors,Q=Object.getOwnPropertySymbols,K=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable,Y=(e,t,a)=>t in e?H(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,Z=(e,t)=>{for(var a in t||(t={}))K.call(t,a)&&Y(e,a,t[a]);if(Q)for(var a of Q(t))G.call(t,a)&&Y(e,a,t[a]);return e},J=(e,t)=>
1z(e,W(t));const X=e=>{const t={};return e?(0,$.A)({url:e})?delete t.url:t.url="Destination URL is not a valid URL":t.url="Please add a destination URL",{valid:(0,w.isEmpty)(t),errors:t}},ee="manage-software-automations-modal";var te=({router:e,onCancel:t,onCreateWebhookSubmit:a,togglePreviewPayloadModal:r,togglePreviewTicketModal:o,showPreviewPayloadModal:c,showPreviewTicketModal:d,softwareConfig:m})=>{var p,f,g;const E=null==(p=null==m?void 0:m.webhook_settings)?void 0:p.vulnerabilities_webhook,b=!!(null==E?void 0:E.enable_vulnerabilities_webhook),_=(null==E?void 0:E.destination_url)||"",h=!!(null==(f=null==m?void 0:m.integrations.jira)?void 0:f.some(e=>e.enable_software_vulnerabilities))||!!(null==(g=null==m?void 0:m.integrations.zendesk)?void 0:g.some(e=>e.enable_software_vulnerabilities)),A=b||h,[$,D]=(0,l.useState)(_||""),[V,j]=(0,l.useState)({}),[U,M]=(0,l.useState)(A||!1),[q,H]=(0,l.useState)(!b),[z,W]=(0,l.useState)(),[Q,K]=(0,l.useState)(),[G,Y]=(0,l.useState)(),[te,ae]=(0,l.useState)(),{config:le,isFreeTier:ne}=(0,l.useContext)(u.BR),{gitOpsModeEnabled:re}=(0,T.A)("software"),ie=(e=>"vulnerabilities"in e)(m)?m.vulnerabilities.recent_vulnerability_max_age:null==le?void 0:le.vulnerabilities.recent_vulnerability_max_age,oe=ie?Math.round(ie/864e11):I.fx;(0,S.A)(()=>{M(A||!1)},[A]),(0,S.A)(()=>{$&&j({})},[$]);const{data:se}=(0,n.useQuery)(["integrations"],()=>s.A.loadAll(),{select:e=>e.integrations,onSuccess:e=>{const t=e.jira?e.jira.map((e,t)=>J(Z({},e),{originalIndex:t,type:"jira"})):[];W(t);const a=e.zendesk?e.zendesk.map((e,t)=>J(Z({},e),{originalIndex:t,type:"zendesk"})):[];K(a)}});(0,l.useEffect)(()=>{if(z&&Q){const e=z.concat(Q);Y(null==e?void 0:e.map((e,t)=>J(Z({},e),{dropdownIndex:t})))}},[z,Q,Y]),(0,l.useEffect)(()=>{if(G){const e=G.find(e=>!0===e.enable_software_vulnerabilities);ae(e)}},[G]);const ce=e=>{e.preventDefault();const{valid:l,errors:n}=X($);j(l?e=>(0,w.omit)(e,"url"):e=>Z(Z({},e),n));const r={webhook_settings:{vulnerabilities_webhook:{destination_url:l?$:_,enable_vulnerabilities_webhook:b}},integrations:{jira:(null==se?void 0:se.jira)||[],zendesk:(null==se?void 0:se.zendesk)||[]}};(()=>{if(!U){r.webhook_settings.vulnerabilities_webhook.enable_vulnerabilities_webhook=!1;const e=r.integrations.jira.map(e=>J(Z({},e),{enable_software_vulnerabilities:!1}));r.integrations.jira=e;const t=r.integrations.zendesk.map(e=>J(Z({},e),{enable_software_vulnerabilities:!1}));return r.integrations.zendesk=t,!0}if(!q){if(!(0,w.isEmpty)(n))return!1;r.webhook_settings.vulnerabilities_webhook.enable_vulnerabilities_webhook=!0;const e=r.integrations.jira.map(e=>J(Z({},e),{enable_software_vulnerabilities:!1}));r.integrations.jira=e;const t=r.integrations.zendesk.map(e=>J(Z({},e),{enable_software_vulnerabilities:!1}));return r.integrations.zendesk=t,!0}r.webhook_settings.vulnerabilities_webhook.enable_vulnerabilities_webhook=!1;const e=r.integrations.jira.map((e,t)=>J(Z({},e),{enable_software_vulnerabilities:"jira"===(null==te?void 0:te.type)&&t===(null==te?void 0:te.originalIndex)}));r.integrations.jira=e;const t=r.integrations.zendesk.map((e,t)=>J(Z({},e),{enable_software_vulnerabilities:"zendesk"===(null==te?void 0:te.type)&&t===(null==te?void 0:te.originalIndex)}));return r.integrations.zendesk=t,!0})()&&(a(r),t())},ue=e=>()=>{H(e)};return d&&(null==te?void 0:te.type)?l.createElement(B,{integrationType:te.type,onCancel:o}):c?l.createElement(R,{onCancel:r}):l.createElement(P.A,{onExit:t,title:"Manage automations",className:ee,width:"large"},l.createElement("div",{className:`${ee} form`},l.createElement(k.A,{disabled:re,value:U,onChange:()=>M(!U),inactiveText:"Vulnerability automations disabled",activeText:"Vulnerability automations enabled"}),l.createElement("div",{className:`form ${ee}
1__software-automations${U?"":"__disabled"}`},l.createElement("div",{className:"form-field"},l.createElement("div",{className:"form-field__label"},"Workflow"),l.createElement(O.A,{className:`${ee}__radio-input`,label:"Ticket",id:"ticket-radio-btn",checked:q,value:"ticket",name:"workflow-type",onChange:ue(!0),disabled:!U||re}),l.createElement(O.A,{className:`${ee}__radio-input`,label:"Webhook",id:"webhook-radio-btn",checked:!q,value:"webhook",name:"workflow-type",onChange:ue(!1),disabled:!U||re})),q?l.createElement(l.Fragment,null,l.createElement("div",{className:`${ee}__software-automation-description`},ne?l.createElement(l.Fragment,null,"A ticket will be created in your ",l.createElement("b",null,"Integration")," for each detected vulnerability (CVE)."):l.createElement(l.Fragment,null,"A ticket will be created in your ",l.createElement("b",null,"Integration")," if a detected vulnerability (CVE) was published in the last"," ",oe||I.fx," ","days.")),z&&z.length>0||Q&&Q.length>0?l.createElement(x.A,{disabled:re,searchable:!0,options:null==G?void 0:G.map(e=>({value:String(e.dropdownIndex),label:`${e.url} - ${e.project_key||e.group_id}`})),onChange:e=>{const t=null==G?void 0:G.find(t=>t.dropdownIndex===parseInt(e,10));ae(t)},placeholder:"Select integration",value:null==te?void 0:te.dropdownIndex,label:"Integration",wrapperClassName:`${ee}__form-field ${ee}__form-field--frequency`,helpText:"For each new vulnerability detected, Fleet will create a ticket with a list of the affected hosts."}):l.createElement("div",{className:`form-field ${ee}__no-integrations`},l.createElement("div",{className:"form-field__label"},"You have no integrations."),l.createElement("div",null,l.createElement(v.A,{onClick:()=>{e.push(i.A.ADMIN_INTEGRATIONS)},disabled:re||!U},"Add integration"))),!!te&&l.createElement(v.A,{type:"button",variant:"secondary",onClick:o},"Preview ticket")):l.createElement(l.Fragment,null,l.createElement("div",{className:`${ee}
1__software-automation-description`},l.createElement("p",null,ne?l.createElement(l.Fragment,null,"A request will be sent to your configured ",l.createElement("b",null,"Destination URL")," ","for each detected vulnerability (CVE)."):l.createElement(l.Fragment,null,"A request will be sent to your configured ",l.createElement("b",null,"Destination URL")," ","if a detected vulnerability (CVE) was published in the last"," ",oe||"30"," days."))),l.createElement(N.A,{inputWrapperClass:`${ee}__url-input`,name:"webhook-url",label:"Destination URL",type:"text",value:$,onChange:e=>{D(e)},onBlur:()=>{if(!U||re)return;const{errors:e}=X($);j(t=>Z(Z({},(0,w.omit)(t,"url")),e))},error:V.url,helpText:"For each new vulnerability detected, Fleet will send a JSON payload to this URL with a list of the affected hosts.",placeholder:"https://server.com/example",tooltip:"Provide a URL to deliver a webhook request to.",disabled:!U||re}),l.createElement(v.A,{type:"button",variant:"secondary",onClick:r},"Example payload")),l.createElement("p",null,"Vulnerability automations currently run for software vulnerabilities. Interested in automations for OS vulnerabilities?"," ",l.createElement(F.A,{url:C.FI,text:"Let us know",newTab:!0,disableKeyboardNavigation:!U}))),l.createElement("div",{className:"modal-cta-wrap"},(()=>{const e=!((z&&0===z.length||Q&&0===Q.length)&&q&&U);return l.createElement(L.A,{entityType:"software",renderChildren:(t=!1)=>l.createElement(y.A,{tipContent:l.createElement(l.Fragment,null,"Add an integration to create tickets for vulnerability automations."),disableTooltip:e||t,position:"bottom",underline:!1,showArrow:!0,tipOffset:6},l.createElement(v.A,{type:"submit",onClick:ce,disabled:U&&q&&!te||U&&!q&&""===$||t},"Save")),tipOffset:6})})(),l.createElement(v.A,{onClick:t,variant:"secondary"},"Cancel"))))},ae=a(17981);const le=({onExit:e})=>l.createElement(l.Fragment,null,l.createElement("p",null,"Please select a fleet first. Software can't be added when"," ",l.createElement("b",null,"All teams")," is selected."),l.createElement("div",{className:"modal-cta-wrap"},l.createElement(v.A,{onClick:e},"Close")));var ne=({onExit:e,isFreeTier:t})=>l.createElement(P.A,{title:"Add software",onExit:e,className:"add-software-modal"},t?l.createElement(l.Fragment,null,l.createElement(ae.A,null),l.createElement("div",{className:"modal-cta-wrap"},l.createElement(v.A,{onClick:e},"Close"))):l.createElement(le,{onExit:e})),re=a(91262),ie=a(26046),oe=Object.defineProperty,se=Object.getOwnPropertySymbols,ce=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable,de=(e,t,a)=>t in e?oe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;const me=[{name:"Inventory",pathname:i.A.SOFTWARE_INVENTORY},{name:"OS",pathname:i.A.SOFTWARE_OS},{name:"Vulnerabilities",pathname:i.A.SOFTWARE_VULNERABILITIES}],pe=[...me,{name:"Library",pathname:i.A.SOFTWARE_LIBRARY}],fe=(e,t)=>t.findIndex(t=>"Inventory"===t.name&&i.A.SOFTWARE_VERSIONS===e||e.startsWith(t.pathname)),ve="software-page";var ge=({children:e,router:t,location:a})=>{var w;const{config:S,isFreeTier:T,isGlobalAdmin:C,isGlobalMaintainer:I,isOnGlobalTeam:x,isTeamAdmin:P,isTeamMaintainer:k,isPremiumTier:O}=(0,l.useContext)(u.BR),N=(null==(w=null==S?void 0:S.partnerships)?void 0:w.enable_primo)||!1,F=a.query,$=F&&F.order_key?F.order_key:"hosts_count",L=void 0===(null==F?void 0:F.order_direction)?"desc":F.order_direction,D=F&&F.page?parseInt(F.page,10):0,R=(null==F?void 0:F.platform)||"all",V=F&&F.query?F.query:"",j=void 0!==F&&"true"===F.exploit,U="true"===(null==F?void 0:F.self_service),M=(0,re.WB)(F),[q,B]=(0,l.useState)(!1),[H,z]=(0,l.useState)(!1),[W,Q]=(0,l.useState)(!1),[K,G]=(0,l.useState)(!1),[Y,Z]=(0,l.useState)(!1),{currentTeamId:J,isAllTeamsSelected:X,isRouteOk:ee,teamIdForApi:ae,userTeams:le,handleTeamChange:oe}=(0,d.Ay)({location:a,router:t,includeAllTeams:!0,includeNoTeam:!0,overrideParamsOnTeamChange:{self_service:e=>e===o.jc}}),{data:ge,error:Ee,isFetching:be,refetch:ye}=(0,n.useQuery)([{scope:"softwareConfig",teamId:ae}],({queryKey:e})=>{const{teamId:t}=e[0];return t?c.A.load(t):s.A.loadAll()},{enabled:ee,select:e=>"team"in e?e.team:e}),_e=!be&&!Ee&&!!ge;(0,l.useEffect)(()=>
1{if("1"!==(null==F?void 0:F.manage_automations))return;if(!_e)return;C&&(X||N)&&B(!0);const e=F,{manage_automations:l}=e,n=((e,t)=>{var a={};for(var l in e)ce.call(e,l)&&t.indexOf(l)<0&&(a[l]=e[l]);if(null!=e&&se)for(var l of se(e))t.indexOf(l)<0&&ue.call(e,l)&&(a[l]=e[l]);return a})(e,["manage_automations"]);t.replace({pathname:a.pathname,query:n})},[F,_e,X,N,C,a.pathname,t]);const he=(0,l.useCallback)(()=>{B(!q)},[B,q]),Ae=(0,l.useCallback)(()=>{z(!H)},[z,H]),we=(0,l.useCallback)(()=>{Q(!W)},[Q,W]),Se=(0,l.useCallback)(()=>{Z(!Y)},[Z,Y]),Te=(0,l.useCallback)(()=>{J===o.jc?G(!0):t.push((0,m.M8)(i.A.SOFTWARE_ADD_FLEET_MAINTAINED,{fleet_id:J}))},[J,t]),Ce=(0,l.useCallback)(e=>{oe(e)},[oe]),Ie=a.pathname.startsWith(i.A.SOFTWARE_LIBRARY);(0,l.useEffect)(()=>{void 0!==O&&(!Ie||O&&!X||t.replace((0,m.M8)(i.A.SOFTWARE_INVENTORY,{fleet_id:J})))},[O,X,Ie,J,t]);const xe=O?pe:me,Pe=(0,l.useCallback)(e=>{const l={fleet_id:null==a?void 0:a.query.fleet_id,page:0},n=(0,m.M8)(xe[e].pathname,l);t.replace(n)},[null==a?void 0:a.query.fleet_id,xe,t]);return l.createElement(E.A,{className:ve},l.createElement(l.Fragment,null,l.createElement("div",{className:`${ve}__header-wrap`},l.createElement("div",{className:`${ve}__header`},l.createElement("div",{className:`${ve}__header`},l.createElement("div",{className:`${ve}__text`},l.createElement("div",{className:`${ve}__title`},O&&!N?l.createElement(b.A,{isOnGlobalTeam:x,currentTeamId:J,userTeams:le,onTeamChange:Ce}):l.createElement("h1",null,"Software")))),(()=>{const e=C,t=C||I||P||k;return _e?l.createElement("div",{className:`${ve}__action-buttons`},e&&l.createElement(y.A,{underline:!1,tipContent:l.createElement("div",{className:`${ve}__header__tooltip`},"Select “All fleets” to manage automations."),disableTooltip:X||N,position:"top",showArrow:!0},l.createElement(g.A,{disabled:!X&&!N,onClick:he,className:`${ve}__manage-automations`})),t&&l.createElement(y.A,{underline:!1,tipContent:l.createElement("div",{className:`${ve}__header__tooltip`},O?"Select a fleet to add software.":"This feature is included in Fleet Premium."),disableTooltip:!X,position:"top",showArrow:!0},l.createElement(v.A,{onClick:Te,disabled:X},l.createElement("span",null,"Add software")))):null})()),l.createElement(A.A,{content:l.createElement(l.Fragment,null,"Manage software and search for installed software, OS, and vulnerabilities.")})),(()=>{var n;const i=X;return l.createElement("div",null,l.createElement(_.A,null,l.createElement(r.tU,{selectedIndex:fe((null==a?void 0:a.pathname)||"",xe),onSelect:e=>Pe(e)},l.createElement(r.wb,null,xe.map(e=>"Library"===e.name&&i?l.createElement(r.oz,{key:e.name,"data-text":e.name,disabled:!0},l.createElement(y.A,{tipContent:"Select a fleet to view its software library.",showArrow:!0,position:"top",tipOffset:12,underline:!1},l.createElement(h.A,null,e.name))):l.createElement(r.oz,{key:e.name,"data-text":e.name},l.createElement(h.A,null,e.name)))))),l.createElement("div",{key:null==a?void 0:a.pathname,className:"tab-nav-routed-content"},l.cloneElement(e,{router:t,isSoftwareEnabled:Boolean(null==(n=null==ge?void 0:ge.features)?void 0:n.enable_software_inventory),perPage:50,orderDirection:L,orderKey:$,currentPage:D,teamId:ae,platform:R,query:V,showExploitedVulnerabilitiesOnly:j,selfServiceOnly:U,vulnFilters:M,onAddFiltersClick:Se})))})(),q&&ge&&l.createElement(te,{router:t,onCancel:he,onCreateWebhookSubmit:e=>{return t=function*(){try{const t=s.A.update(e);yield t.then(()=>{f.me.success("Successfully updated vulnerability automations."),ye()})}catch(e){f.me.error("Could not update vulnerability automations. Please try again.")}finally{he()}},new Promise((e,a)=>{var l=e=>{try{r(t.next(e))}catch(e){a(e)}},n=e=>{try{r(t.throw(e))}catch(e){a(e)}},r=t=>t.done?e(t.value):Promise.resolve(t.value).then(l,n);r((t=t.apply(null,null)).next())});var t},togglePreviewPayloadModal:Ae,togglePreviewTicketModal:we,showPreviewPayloadModal:H,showPreviewTicketModal:W,softwareConfig:ge}),K&&l.createElement(ne,{onExit:()=>G(!1),isFreeTier:T}),Y&&l.createElement(ie.A,{onExit:Se,onSubmit:e=>{const l=((e,t)=>{for(var a in t||(t={}))ce.call(t,a)&&de(e,a,t[a]);if(se)for(var a of se(t))ue.call(t,a)&&de(e,a,t[a]);return e})({query:V,teamId:J,orderDirection:L,orderKey:$,page:0},(0,re.yz)(e));t.replace((0,p.g2)({pathPrefix:a.pathname,routeTemplate:"",queryParams:(0,m.vF)(l)})),Se()},vulnFilters:M,isPremiumTier:O||!1})))}},33429:function(e,t,a){a.d(t,{A:function(){return i}});var l=a(96540),n=a(60678),r=a(24432),i=({contactUrl:e,variant:t})=>{const a="mobile-header"===t?t:void 0;return l.createElement(n.A,{header:"Self service",subheader:l.createElement(l.Fragment,null,"Install organization-approved apps provided by your IT department."," ",e&&l.createElement("span",null,"If you need help,"," ",l.createElement(r.A,{url:e,text:"reach out to IT",newTab:!0,disableKeyboardNavigation:"preview"===t}))),variant:a})}},17190:function(e,t,a){a.d(t,{Js:function(){return c},WO:function(){return d},_$:function(){return u},hB:function(){return m},iT:function(){return o},qI:function(){return s}});var l=a(56906);const n=new Set([...l.JL,...l.XO]),r=new Set(["installing","running_script","pending_install","pending_script"]),i=new Set([...n,"installed","recently_installed","recently_updated","update_available","recently_uninstalled","failed_uninstall","failed_uninstall_installed","failed_uninstall_update_available","ran_script"]),o=[{id:1,label:"🌎 Browsers",value:"Browsers"},{id:2,label:"👬 Communication",value:"Communication"},{id:3,label:"🧰 Developer tools",value:"Developer tools"},{id:4,label:"🖥️ Productivity",value:"Productivity"},{id:5,label:"🔐 Security",value:"Security"},{id:6,label:"🛟 Support",value:"Support"},{id:7,label:"🛠️ Utilities",value:"Utilities"}],s=(e,t,a)=>{if(void 0===a)return e;const l=t.find(e=>e.id===a);if(!l)return[];const n=l.name.toLowerCase();return e.filter(e=>{var t,a,l,r;return[...null!=(a=null==(t=e.software_package)?void 0:t.categories)?a:[],...null!=(r=null==(l=e.app_store_app)?void 0:l.categories)?r:[]].some(e=>e.toLowerCase()===n)})},c=(e,t)=>{var a;const l=null!=(a=null==t?void 0:t.toLowerCase().trim())?a:"";return l?e.filter(e=>[e.name,e.display_name,e.bundle_identifier].some(e=>null==e?void 0:e.toLowerCase().includes(l))):e},u=(e,t)=>
1{const a=new Set;return t.forEach(e=>{var t,l,n,r;[...null!=(l=null==(t=e.software_package)?void 0:t.categories)?l:[],...null!=(r=null==(n=e.app_store_app)?void 0:n.categories)?r:[]].forEach(e=>a.add(e.toLowerCase()))}),e.filter(e=>a.has(e.name.toLowerCase()))},d=e=>e.filter(e=>!i.has(e.ui_status)).length,m=e=>e.some(e=>r.has(e.ui_status))},91310:function(e,t,a){a.d(t,{Mj:function(){return i},kT:function(){return o}});var l=a(97126),n=a(90508),r=a(12968);const i=["darwin","windows","linux","chrome","ios","ipados","android"],o=({platform:e,teamId:t,os_name:a,os_version:i,order_key:o,order_direction:s,page:c,per_page:u,max_vulnerabilities:d=0,query:m=""}={})=>{const{OS_VERSIONS:p}=n.A;let f=p;const v={platform:e,fleet_id:t,os_name:a,os_version:i,order_key:o,order_direction:s,page:c,per_page:u,max_vulnerabilities:d,query:m},g=(0,r.IM)(v);return g&&(f+=`?${g}`),(0,l.Ay)("GET",f)};t.Ay={getOSVersions:o,getOSVersion:({os_version_id:e,teamId:t,max_vulnerabilities:a})=>{const i=n.A.OS_VERSION(e),o=(0,r.IM)({fleet_id:t,max_vulnerabilities:a}),s=o?`${i}?${o}`:i;return(0,l.Ay)("GET",s)}}},23543:function(e,t,a){var l=a(97126),n=a(90508),r=a(12968);t.A={getCategories:e=>{const{SELF_SERVICE_CATEGORIES:t}=n.A,a=(0,r.IM)({fleet_id:e});return(0,l.Ay)("GET",`${t}?${a}`)},getDeviceCategories:e=>{const{DEVICE_SELF_SERVICE_CATEGORIES:t}=n.A;return(0,l.Ay)("GET",t(e))},addCategory:e=>{const{SELF_SERVICE_CATEGORIES:t}=n.A;return(0,l.Ay)("POST",t,e)},updateCategory:(e,t)=>{const{SELF_SERVICE_CATEGORY:a}=n.A;return(0,l.Ay)("PATCH",a(e),t)},deleteCategory:e=>{const{SELF_SERVICE_CATEGORY:t}=n.A;return(0,l.Ay)("DELETE",t(e))}}},4514:function(e,t,a){a.d(t,{J:function(){return i}});var l=a(97126),n=a(90508),r=a(12968);const i=({teamId:e,order_key:t,order_direction:a,page:i,per_page:o,exploit:s,query:c}={})=>{const{VULNERABILITIES:u}=n.A;let d=u;const m=(0,r.IM)({fleet_id:e,order_key:t,order_direction:a,page:i,per_page:o,exploit:s,query:c});return m&&(d+=`?${m}`),(0,l.Ay)("GET",d)};t.A={getVulnerabilities:i,getVulnerability:({vulnerability:e,teamId:t})=>{const a=n.A.VULNERABILITY(e),i=(0,r.IM)({fleet_id:t}),o=void 0===t?a:`${a}?${i}`;return(0,l.Ay)("GET",o)}}},9106:function(e,t,a){a.d(t,{HZ:function(){return r},P$:function(){return u},bv:function(){return s},v7:function(){return f}});var l=a(96540),n=a(52603);const r={json:"macOS",pkg:"macOS",mobileconfig:"macOS",exe:"Windows",msi:"Windows",xml:"Windows",deb:"Linux",rpm:"Linux","tar.gz":"Linux",sh:"macOS & Linux",ps1:"Windows",py:"macOS & Linux",ipa:"iOS/iPadOS"},i=["tar.gz","tar.xz","tar.bz2","tar.zst"],o={tgz:"tar.gz",tbz2:"tar.bz2",tzst:"tar.zst",txz:"tar.xz"},s=e=>{const t=e.toLowerCase().split("."),a=i.find(e=>{const a=e.split(".");return t.slice(-a.length).join(".")===e});let l;return a?l=a:t.length>1&&(l=t.pop()),l&&o[l]&&(l=o[l]),l},c=e=>{const t=s(e.name);if(t)return"ipa"===t?l.createElement(n.A,{tipContent:"Software will be added for both platforms."},r[t]):r[t]},u=e=>({name:e.name,description:c(e)}),d=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],m=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],p=(e,t,a)=>{let l=e,n=0;for(;l>=t&&n<a.length-1;)l/=t,n+=1;return`${Number(l.toPrecision(4))}${a[n]}`},f=e=>{const t=p(e,1e3,d),a=p(e,1024,m);return a.length<t.length?a:t}}}]);

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.