@salesforce/storefront-next-dev 1.5.0-alpha.0 → 1.5.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -359,3 +359,9 @@ For optimal tree-shaking, use subpath exports:
359
359
  - `@salesforce/storefront-next-dev` - Vite plugin (default export)
360
360
  - `@salesforce/storefront-next-dev/react-router-preset` - React Router preset
361
361
  - `@salesforce/storefront-next-dev/react-router/Scripts` - React Router Scripts component
362
+
363
+ ## Usage data
364
+
365
+ The hidden `sfnext audit prepare` and `sfnext audit finalize` commands report anonymous usage to the same Application Insights resource as the B2C CLI: the command (`command`: `sfnext:audit:prepare` or `sfnext:audit:finalize`, the same under `pnpm exec sfnext` and `b2c sfnext`), its duration, the error type and exit code on failure, and per-run counts (pages collected, failed and missing, rules, findings by severity, runs, whether a build ran), the bundle analysis status, the launch guidance (`go`, `go-with-fixes`, `no-go`) and the run id. Each event also carries a `surface: sfnext-audit` tag, the version of this package, the name of the running CLI (`hostCli`: `@salesforce/storefront-next-dev` under `pnpm exec sfnext`, `@salesforce/b2c-cli` under `b2c`), and the SDK's usual fields: an anonymous random install id (`cliId`, kept in a file in the CLI's data directory), session id, version, platform, architecture, Node version, `NODE_ENV`, process uptime, timestamps, a CI flag, and, when an AI agent drives the command, the agent name and a one-way hash of its session. CI runs report too. URLs, hosts, page names, paths, finding text and error messages are never sent. Event names are always `@salesforce/storefront-next-dev/<event>`, whichever CLI runs the command. To tell one run from another, join on the install id (`cliId`) together with `auditRunId`; the run id alone is a timestamp.
366
+
367
+ Turn it off with `SF_DISABLE_TELEMETRY=true` or `SFCC_DISABLE_TELEMETRY=true`. Other `sfnext` commands (`push`, `scapi`, `config inspect`, `deploy-cartridge`) do not report because of this, unless `SFCC_APP_INSIGHTS_KEY` is set or they run under a host CLI that configures telemetry.
@@ -38,7 +38,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
38
38
  `}}),p)),p}}]),l})(O.Component);dm(yf,"displayName",M_);dm(yf,"propTypes",{checkmark:c.bool,className:c.string,getListItemId:c.func,itemRefs:c.func,itemRenderer:c.func,length:c.oneOf([null,"5","7","10",5,7,10]),onSelect:c.func,options:c.array,selectedIndex:c.number,tooltipMenuItem:c.node,triggerId:c.string});dm(yf,"defaultProps",{length:"5",options:[],selectedIndex:-1});function dc(n){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?dc=function(l){return typeof l}:dc=function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},dc(n)}function Rh(){return Rh=Object.assign||function(n){for(var a=1;a<arguments.length;a++){var l=arguments[a];for(var o in l)Object.prototype.hasOwnProperty.call(l,o)&&(n[o]=l[o])}return n},Rh.apply(this,arguments)}function Lw(n,a){if(n==null)return{};var l=zw(n,a),o,i;if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(n);for(i=0;i<f.length;i++)o=f[i],!(a.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(n,o)&&(l[o]=n[o])}return l}function zw(n,a){if(n==null)return{};var l={},o=Object.keys(n),i,f;for(f=0;f<o.length;f++)i=o[f],!(a.indexOf(i)>=0)&&(l[i]=n[i]);return l}function Iw(n,a){if(!(n instanceof a))throw new TypeError("Cannot call a class as a function")}function $w(n,a){for(var l=0;l<a.length;l++){var o=a[l];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}function Bw(n,a,l){return a&&$w(n.prototype,a),n}function Uw(n,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(a&&a.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),a&&Ah(n,a)}function Ah(n,a){return Ah=Object.setPrototypeOf||function(o,i){return o.__proto__=i,o},Ah(n,a)}function Hw(n){var a=Gw();return function(){var o=Qc(n),i;if(a){var f=Qc(this).constructor;i=Reflect.construct(o,arguments,f)}else i=o.apply(this,arguments);return qw(this,i)}}function qw(n,a){return a&&(dc(a)==="object"||typeof a=="function")?a:kw(n)}function kw(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function Gw(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Qc(n){return Qc=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},Qc(n)}function bO(n,a,l){return a in n?Object.defineProperty(n,a,{value:l,enumerable:!0,configurable:!0,writable:!0}):n[a]=l,n}var pm=(function(n){Uw(l,n);var a=Hw(l);function l(){return Iw(this,l),a.apply(this,arguments)}return Bw(l,[{key:"render",value:function(){var i=this.props,f=i.assistiveText;i.children;var p=i.className,h=i.id;i.isInline;var m=i.isOpen,b=i.onBlur,E=i.menu,N=i.onClick,C=i.onFocus,D=i.onKeyDown,H=i.onMouseDown,Q=i.onMouseEnter,V=i.onMouseLeave,he=i.triggerRef,fe=i.triggerClassName,te=Lw(i,["assistiveText","children","className","id","isInline","isOpen","onBlur","menu","onClick","onFocus","onKeyDown","onMouseDown","onMouseEnter","onMouseLeave","triggerRef","triggerClassName"]),me=this.props.openOn==="hover"?"click":this.props.openOn,Oe={};return O.Children.count(this.props.children)!==0&&O.Children.forEach(this.props.children,function(Te){Te&&Te.type.displayName===da.displayName&&(Oe=Te.props)}),O.createElement("div",{className:ce("slds-dropdown-trigger slds-dropdown-trigger_".concat(me),{"slds-is-open":m},fe),id:h,onBlur:b,onClick:N,onKeyDown:D,onFocus:C,onMouseDown:H,onMouseEnter:Q,onMouseLeave:V},O.createElement(da,Rh({assistiveText:f,className:p,"aria-expanded":m,"aria-haspopup":!0},te,Oe,{buttonRef:he})),E)}}]),l})(O.Component);bO(pm,"displayName",P_);bO(pm,"propTypes",{children:c.element,className:c.oneOfType([c.array,c.object,c.string]),id:c.string,isOpen:c.bool,menu:c.node,onBlur:c.func,onClick:c.func,onFocus:c.func,onKeyDown:c.func,onMouseDown:c.func,onMouseEnter:c.func,onMouseLeave:c.func,openOn:c.oneOf(["hover","click","hybrid"]),triggerRef:c.func,triggerClassName:c.oneOfType([c.array,c.object,c.string])});function n_(n,a){return Xw(n)||Vw(n,a)||Yw(n,a)||Kw()}function Kw(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
39
39
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Yw(n,a){if(n){if(typeof n=="string")return a_(n,a);var l=Object.prototype.toString.call(n).slice(8,-1);if(l==="Object"&&n.constructor&&(l=n.constructor.name),l==="Map"||l==="Set")return Array.from(n);if(l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return a_(n,a)}}function a_(n,a){(a==null||a>n.length)&&(a=n.length);for(var l=0,o=new Array(a);l<a;l++)o[l]=n[l];return o}function Vw(n,a){var l=n&&(typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"]);if(l!=null){var o=[],i=!0,f=!1,p,h;try{for(l=l.call(n);!(i=(p=l.next()).done)&&(o.push(p.value),!(a&&o.length===a));i=!0);}catch(m){f=!0,h=m}finally{try{!i&&l.return!=null&&l.return()}finally{if(f)throw h}}return o}}function Xw(n){if(Array.isArray(n))return n}var Qw=function(a){var l=a.componentContext,o=a.currentFocusedIndex,i=a.isOpen,f=a.event,p=a.key,h=a.keyCode,m=a.navigableItems,b=a.onFocus,E=a.onSelect,N=a.target,C=a.toggleOpen,D=m.indexes,H=D.length-1,Q,V=p||String.fromCharCode(h);/^[ -~]$/.test(V)?V=V.toLowerCase():V=null;var he=h===et.ENTER||h===et.SPACE||h===et.UP;if(h===et.ESCAPE)i&&C();else if(i)if(h===et.ENTER||h===et.SPACE)E(o);else{var te=D.indexOf(o);if(h===et.DOWN)if(te<H){var me=te+1;Q=D[me]}else{var Oe=n_(D,1);Q=Oe[0]}else if(h===et.UP)if(te>0){var Te=te-1;Q=D[Te]}else Q=D[H];else if(V){var F=m.keyBuffer(V),ge=0;F.length>1&&new RegExp("^[".concat(gO(V),"]+$")).test(F)&&(ge=F.length),m.forEach(function(je){(Q===void 0&&je.text.substr(0,F.length)===F||ge>0&&je.text.substr(0,1)===V)&&(ge-=1,Q=je.index)})}}else{var fe=n_(D,1);Q=fe[0],(he||V)&&C(),he&&l.trigger&&Qi.findDOMNode(l.trigger)===N&&l.handleClick(f)}return b(Q),Q};function pc(n){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?pc=function(l){return typeof l}:pc=function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},pc(n)}function r_(n,a){var l=Object.keys(n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);a&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),l.push.apply(l,o)}return l}function Vp(n){for(var a=1;a<arguments.length;a++){var l=arguments[a]!=null?arguments[a]:{};a%2?r_(Object(l),!0).forEach(function(o){Ve(n,o,l[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(l)):r_(Object(l)).forEach(function(o){Object.defineProperty(n,o,Object.getOwnPropertyDescriptor(l,o))})}return n}function Fc(){return Fc=Object.assign||function(n){for(var a=1;a<arguments.length;a++){var l=arguments[a];for(var o in l)Object.prototype.hasOwnProperty.call(l,o)&&(n[o]=l[o])}return n},Fc.apply(this,arguments)}function Fw(n,a){if(!(n instanceof a))throw new TypeError("Cannot call a class as a function")}function Zw(n,a){for(var l=0;l<a.length;l++){var o=a[l];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}function Jw(n,a,l){return a&&Zw(n.prototype,a),n}function Ww(n,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(a&&a.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),a&&Dh(n,a)}function Dh(n,a){return Dh=Object.setPrototypeOf||function(o,i){return o.__proto__=i,o},Dh(n,a)}function ej(n){var a=nj();return function(){var o=Zc(n),i;if(a){var f=Zc(this).constructor;i=Reflect.construct(o,arguments,f)}else i=o.apply(this,arguments);return tj(this,i)}}function tj(n,a){return a&&(pc(a)==="object"||typeof a=="function")?a:Ge(n)}function Ge(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function nj(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Zc(n){return Zc=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},Zc(n)}function Ve(n,a,l){return a in n?Object.defineProperty(n,a,{value:l,enumerable:!0,configurable:!0,writable:!0}):n[a]=l,n}var Mh=typeof document<"u",yi=Mh?document.createElement("span"):{style:{}};yi.style.top=0;yi.style.left=0;yi.style.width="100%";yi.style.height="100%";yi.style.position="absolute";var Ki,aj=function(){},rj=function(a){return a.type!=="header"&&a.type!=="divider"&&!a.disabled},i_=function(a){var l=[];return l.indexes=[],l.keyBuffer=new vO,Array.isArray(a)&&a.forEach(function(o,i){rj(o)&&(l.push({index:i,text:"".concat(o.label).toLowerCase()}),l.indexes.push(i))}),l};function ij(n){return Qi.findDOMNode(n).querySelector("ul.dropdown__list")}function lj(n){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:document,l;return n&&(l=a.getElementById(n)),l}var l_={top:"bottom","top left":"bottom left","top right":"bottom right",bottom:"top","bottom left":"top left","bottom right":"top right"},oj={align:c.oneOf(["center","left","right"]),assistiveText:c.object,buttonClassName:c.oneOfType([c.array,c.object,c.string]),buttonInverse:c.bool,buttonVariant:c.oneOf(["base","neutral","brand","destructive","icon"]),checkmark:c.bool,children:c.node,className:c.oneOfType([c.array,c.object,c.string]),containerClassName:c.oneOfType([c.array,c.object,c.string]),disabled:c.bool,hasStaticAlignment:c.bool,hint:c.bool,hoverCloseDelay:c.number,iconCategory:q_(c.oneOf(["action","custom","doctype","standard","utility"]),function(n){return!!n.iconName}),iconName:c.string,iconPosition:c.oneOf(["left","right"]),iconVariant:c.oneOf(["bare","container","border","border-filled","small","more"]),iconSize:c.oneOf(["x-small","small","medium","large"]),id:c.string,inverse:c.bool,isOpen:c.bool,label:c.oneOfType([c.string,c.node]),listItemRenderer:c.func,length:c.oneOf([null,"5","7","10",5,7,10]),menuPosition:c.oneOf(["absolute","overflowBoundaryElement","relative"]),menuStyle:c.object,nubbinPosition:c.oneOf(["top left","top","top right","bottom left","bottom","bottom right"]),onBlur:c.func,onClick:c.func,onFocus:c.func,openOn:c.oneOf(["hover","click","hybrid"]),onKeyDown:c.func,onMouseDown:c.func,onMouseEnter:c.func,onMouseLeave:c.func,onSelect:c.func,onOpen:c.func,onClose:c.func,options:c.array,style:c.object,tabIndex:c.string,overlay:c.oneOfType([c.bool,c.func]),value:c.oneOfType([c.number,c.string,c.array]),tooltip:c.node,tooltipMenuItem:c.node,triggerClassName:c.oneOfType([c.array,c.object,c.string]),multiple:c.bool,width:c.oneOf(["xx-small","x-small","small","medium","bottom","large"])},sj={align:"left",hoverCloseDelay:300,length:"5",menuPosition:"absolute",openOn:"click",width:"medium",inverse:!1},Ms=(function(n){Ww(l,n);var a=ej(l);function l(o){var i;Fw(this,l),i=a.call(this,o),Ve(Ge(i),"getId",function(){return i.props.id||i.generatedId}),Ve(Ge(i),"getIsOpen",function(){return!!(typeof i.props.isOpen=="boolean"?i.props.isOpen:i.state.isOpen)}),Ve(Ge(i),"getIndexByValue",function(p,h){var m=-1;return h&&h.length&&h.some(function(b,E){return b&&b.value===p?(m=E,!0):!1}),m}),Ve(Ge(i),"getValueByIndex",function(p){return i.props.options[p]}),Ve(Ge(i),"getListItemRenderer",function(){return i.props.listItemRenderer?i.props.listItemRenderer:vf}),Ve(Ge(i),"getListItemId",function(p){var h;if(p!==void 0){var m=_r(i.getId)?i.getId():i.props.id;h="".concat(m,"-item-").concat(p)}return h}),Ve(Ge(i),"setFocus",function(){!i.isHover&&!i.isUnmounting&&i.trigger&&Qi.findDOMNode(i.trigger).focus()}),Ve(Ge(i),"getMenu",function(){return Qi.findDOMNode(i.list)}),Ve(Ge(i),"getMenuItem",function(p){if(p!==void 0&&i.listItems)return Qi.findDOMNode(i.listItems[p])}),Ve(Ge(i),"getCurrentSelectedIndices",function(p){if(i.props.multiple===!0){var h=[],m=[];return Array.isArray(p.value)?h=p.value:h.push(p.value),h=h.filter(function(b){return i.getIndexByValue(b,p.options)!==-1}),m=h.map(function(b){return i.getIndexByValue(b,p.options)}),{selectedIndices:m}}return{selectedIndex:i.getIndexByValue(p.value,p.options)}}),Ve(Ge(i),"saveRefToTrigger",function(p){i.trigger=p,i.state.triggerRendered||i.setState({triggerRendered:!0}),p&&i.props.requestFocus&&i.props.onRequestFocus&&i.props.onRequestFocus(p)}),Ve(Ge(i),"saveRefToTriggerContainer",function(p){i.triggerContainer=p,i.trigger||(i.trigger=p)}),Ve(Ge(i),"saveRefToList",function(p){i.list=p}),Ve(Ge(i),"saveRefToListItem",function(p,h){i.listItems||(i.listItems={}),i.listItems[h]=p,h===i.state.focusedIndex&&i.handleKeyboardFocus(i.state.focusedIndex)}),Ve(Ge(i),"handleClose",function(){var p=i.getIsOpen();p&&(Ki===Ge(i)&&(Ki=void 0),i.setState({isOpen:!1}),i.isHover=!1,i.props.onClose&&i.props.onClose())}),Ve(Ge(i),"handleOpen",function(){var p=i.getIsOpen();p||(Ki&&_r(Ki.handleClose)&&Ki.handleClose(),Ki=Ge(i),i.setState({isOpen:!0}),i.props.onOpen&&i.props.onOpen())}),Ve(Ge(i),"handleMouseEnter",function(p){var h=i.getIsOpen();i.isHover=!0,!h&&i.props.openOn==="hover"?i.handleOpenForHover():clearTimeout(i.isClosing),i.props.onMouseEnter&&i.props.onMouseEnter(p)}),Ve(Ge(i),"handleMouseLeave",function(p){var h=i.getIsOpen();h&&(i.isClosing=setTimeout(function(){i.handleCloseForHover()},i.props.hoverCloseDelay)),i.props.onMouseLeave&&i.props.onMouseLeave(p)}),Ve(Ge(i),"handleCloseForHover",function(){var p=i.getIsOpen();p&&i.handleClose()}),Ve(Ge(i),"handleOpenForHover",function(){var p=i.getIsOpen();p||(i.handleOpen(),i.setFocus())}),Ve(Ge(i),"handleClick",function(p){var h=i.getIsOpen();h?i.handleClose():(i.handleOpen(),i.setFocus()),i.props.onClick&&i.props.onClick(p)}),Ve(Ge(i),"handleFocus",function(p){i.props.onFocus&&i.props.onFocus(p)}),Ve(Ge(i),"handleClickCustomContent",function(){i.setFocus(),i.handleClose(),i.props.onSelect&&i.props.onSelect()}),Ve(Ge(i),"handleSelect",function(p){if(!i.props.multiple)i.setState({selectedIndex:p}),i.handleClose(),i.setFocus();else if(i.props.multiple&&i.state.selectedIndices.indexOf(p)===-1){var h=i.state.selectedIndices.concat(p);i.setState({selectedIndices:h})}else if(i.props.multiple){var m=i.state.selectedIndices.indexOf(p),b=i.state.selectedIndices;b.splice(m,1),i.setState({selectedIndices:b})}if(i.props.onSelect){var E=i.getValueByIndex(p);i.props.onSelect(E,{option:E,optionIndex:p})}}),Ve(Ge(i),"handleKeyDown",function(p){if(p.keyCode){if(p.keyCode===et.TAB)i.handleCancel();else if(p.keyCode===et.ENTER||p.keyCode===et.SPACE||p.keyCode===et.DOWN||p.keyCode===et.UP||p.keyCode===et.ESCAPE){Pn.trap(p);var h=i.getIsOpen();i.handleKeyboardNavigate({event:p,isOpen:h,key:p.key,keyCode:p.keyCode,onSelect:i.handleSelect,target:p.target,toggleOpen:i.toggleOpen})}i.props.onKeyDown&&i.props.onKeyDown(p)}}),Ve(Ge(i),"handleCancel",function(){i.setFocus(),i.handleClose()}),Ve(Ge(i),"handleClickOutside",function(){i.handleClose()}),Ve(Ge(i),"handleKeyboardNavigate",function(p){var h=p.event,m=p.isOpen,b=m===void 0?!0:m,E=p.keyCode,N=p.onFocus,C=N===void 0?i.handleKeyboardFocus:N,D=p.onSelect,H=p.target,Q=p.toggleOpen,V=Q===void 0?aj:Q;Qw({componentContext:Ge(i),currentFocusedIndex:i.state.focusedIndex,event:h,isOpen:b,keyCode:E,navigableItems:i.navigableItems,onFocus:C,onSelect:D,target:H,toggleOpen:V})}),Ve(Ge(i),"handleKeyboardFocus",function(p){i.state.focusedIndex!==p&&p!==void 0&&i.setState({focusedIndex:p});var h=_r(i.getMenu)?i.getMenu():ij(Ge(i)),m=_r(i.getMenuItem)?i.getMenuItem(p,h):lj(i.getListItemId(p));m&&(i.focusMenuItem(m),i.scrollToMenuItem(h,m))}),Ve(Ge(i),"focusMenuItem",function(p){p.getElementsByTagName("a")[0].focus()}),Ve(Ge(i),"scrollToMenuItem",function(p,h){if(p&&h){var m=p.offsetHeight,b=p.scrollTop,E=h.offsetTop-p.offsetTop;if(E<b)p.scrollTop=E;else{var N=b+m+p.offsetTop,C=E+h.offsetHeight+p.offsetTop;C>N&&(p.scrollTop=C-m-p.offsetTop)}}}),Ve(Ge(i),"toggleOpen",function(){var p=i.getIsOpen();i.setFocus(),p?i.handleClose():i.handleOpen()}),Ve(Ge(i),"renderDefaultMenuContent",function(p){return O.createElement(yf,Fc({key:"".concat(i.getId(),"-dropdown-list"),checkmark:i.props.checkmark,getListItemId:i.getListItemId,itemRefs:i.saveRefToListItem,itemRenderer:i.getListItemRenderer(),onCancel:i.handleCancel,onSelect:i.handleSelect,options:i.props.options,ref:i.saveRefToList,selectedIndex:i.props.multiple?void 0:i.state.selectedIndex,selectedIndices:i.props.multiple?i.state.selectedIndices:void 0,tooltipMenuItem:i.props.tooltipMenuItem,triggerId:i.getId(),length:i.props.length},p))}),Ve(Ge(i),"renderMenuContent",function(p){var h=[];return O.Children.forEach(p,function(m){if(m&&m.type.displayName===M_)h.push(i.renderDefaultMenuContent(m.props));else if(m){var b=O.cloneElement(m,{onClick:i.handleClickCustomContent,key:bi()});h.push(b)}}),h.length===0&&(h=null),h||i.renderDefaultMenuContent()}),Ve(Ge(i),"renderDialog",function(p,h,m){var b="bottom",E=!1,N="";i.props.nubbinPosition?(E=!0,b=l_[i.props.nubbinPosition]):i.props.align&&(b=i.props.align==="center"?"bottom":"bottom ".concat(i.props.align));var C=l_[b].split(" ");N=ce(C.map(function(Q){return"slds-dropdown_".concat(Q)}));var D=i.props.isInline?"relative":i.props.menuPosition,H={};return i.props.align==="center"&&!E&&(H.transform="none"),h?O.createElement(pf,{align:b,className:ce(i.props.containerClassName),closeOnTabKey:!0,contentsClassName:ce("slds-dropdown","slds-dropdown_".concat(i.props.width),"slds-text-align_left","ignore-react-onclickoutside",i.props.className,N,{"slds-dropdown_inverse":i.props.inverse}),context:i.context,hasNubbin:E,hasStaticAlignment:i.props.hasStaticAlignment,inheritWidthOf:i.props.inheritTargetWidth?"target":"none",offset:i.props.offset,onClose:i.handleClose,onKeyDown:i.handleKeyDown,outsideClickIgnoreClass:m,position:D,style:Vp(Vp({},H),i.props.menuStyle),onRequestTargetElement:function(){return i.trigger}},i.renderMenuContent(p)):null}),Ve(Ge(i),"renderOverlay",function(p){_r(yi)&&Mh?yi(p,yi):i.props.overlay&&p&&!i.overlay&&Mh?(i.overlay=yi,document.querySelector("body").appendChild(i.overlay)):!p&&i.overlay&&i.overlay.parentNode&&(i.overlay.parentNode.removeChild(i.overlay),i.overlay=void 0)}),i.generatedId=bi();var f=i.getCurrentSelectedIndices(o);return i.state=Vp({focusedIndex:-1,selectedIndex:-1,selectedIndices:[]},f),i.navigableItems=i_(o.options),i}return Jw(l,[{key:"componentDidUpdate",value:function(i){if(i.value!==this.props.value){var f=this.getCurrentSelectedIndices(this.props);this.setState(f)}i.isOpen!==this.props.isOpen&&this.setFocus(),uo(i.options,this.props.options)||(this.navigableItems=i_(this.props.options))}},{key:"componentWillUnmount",value:function(){Ki===this&&(Ki=void 0),this.isUnmounting=!0,this.renderOverlay(!1)}},{key:"render",value:function(){var i=pm,f={},p=[];O.Children.forEach(this.props.children,function(b){b&&b.type.displayName===P_?(f=b.props,i=b.type):b&&p.push(b)}),p.length===0&&(p=null);var h="ignore-click-".concat(this.getId()),m=!this.props.disabled&&this.getIsOpen()&&!!this.trigger;return this.renderOverlay(m),O.createElement(i,Fc({"aria-haspopup":!0,assistiveText:this.props.assistiveText,className:ce(h,this.props.buttonClassName),disabled:this.props.disabled,hint:this.props.hint,iconCategory:this.props.iconCategory,iconName:this.props.iconName,iconPosition:this.props.iconPosition,iconSize:this.props.iconSize,iconVariant:this.props.iconVariant,id:this.getId(),inverse:this.props.buttonInverse,isOpen:m,label:this.props.label,menu:this.renderDialog(p,m,h),onBlur:this.props.onBlur,onClick:this.props.openOn==="click"||this.props.openOn==="hybrid"?this.handleClick:this.props.onClick,onFocus:this.handleFocus,onKeyDown:this.handleKeyDown,onMouseDown:this.props.onMouseDown,onMouseEnter:this.props.openOn==="hover"||this.props.openOn==="hybrid"?this.handleMouseEnter:null,onMouseLeave:this.props.openOn==="hover"||this.props.openOn==="hybrid"?this.handleMouseLeave:null,openOn:this.props.openOn,ref:this.saveRefToTriggerContainer,style:this.props.style,tabIndex:this.props.tabIndex||(m?"-1":"0"),tooltip:this.props.tooltip,triggerClassName:this.props.triggerClassName,triggerRef:this.saveRefToTrigger,variant:this.props.buttonVariant},f))}}]),l})(O.Component);Ve(Ms,"displayName",JS);Ms.contextType=Sl;Ms.propTypes=oj;Ms.defaultProps=sj;const uj=fO(Ms);function cj(n,a){if(n==null)return{};var l=fj(n,a),o,i;if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(n);for(i=0;i<f.length;i++)o=f[i],!(a.indexOf(o)>=0)&&Object.prototype.propertyIsEnumerable.call(n,o)&&(l[o]=n[o])}return l}function fj(n,a){if(n==null)return{};var l={},o=Object.keys(n),i,f;for(f=0;f<o.length;f++)i=o[f],!(a.indexOf(i)>=0)&&(l[i]=n[i]);return l}function o_(n,a){var l=Object.keys(n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);a&&(o=o.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),l.push.apply(l,o)}return l}function _s(n){for(var a=1;a<arguments.length;a++){var l=arguments[a]!=null?arguments[a]:{};a%2?o_(Object(l),!0).forEach(function(o){dj(n,o,l[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(l)):o_(Object(l)).forEach(function(o){Object.defineProperty(n,o,Object.getOwnPropertyDescriptor(l,o))})}return n}function dj(n,a,l){return a in n?Object.defineProperty(n,a,{value:l,enumerable:!0,configurable:!0,writable:!0}):n[a]=l,n}var pj={assistiveText:c.shape({label:c.string}),id:c.string,overflowDropdownMenu:c.node,styleContainer:c.object,trail:c.array.isRequired},s_={assistiveText:{label:"Breadcrumbs"}},hj=function(a,l){var o=_s(_s({},a.props),{},{id:"".concat(l.id,"-dropdown"),iconCategory:"utility",iconName:"threedots",iconVariant:"bare",threedots:!0});return O.createElement("li",{className:"slds-breadcrumb__item"},O.createElement(uj,o))},hm=function(a){var l=a.assistiveText,o=l===void 0?s_.assistiveText:l,i=a.id,f=a.overflowDropdownMenu,p=a.styleContainer,h=a.trail,m=cj(a,["assistiveText","id","overflowDropdownMenu","styleContainer","trail"]);bw(C_,_s({assistiveText:o,id:i,overflowDropdownMenu:f,styleContainer:p,trail:h},m));var b=typeof o=="string"?o:_s(_s({},s_.assistiveText),o).label;return O.createElement("nav",{role:"navigation","aria-label":b,style:p},O.createElement("ol",{className:"slds-breadcrumb slds-list_horizontal"},f&&hj(f,{id:i}),h.map(function(E,N){return O.createElement("li",{key:N,className:"slds-breadcrumb__item"},E)})))};hm.displayName=C_;hm.propTypes=pj;var mj="PageHeaderLabel",vj={content:c.node,trail:c.array},Ps=function(a){return a.trail&&a.trail.length>0?O.createElement(hm,{styleContainer:a.style,trail:a.trail}):a.content?typeof a.content=="string"?O.createElement("span",null,a.content):a.content:null};Ps.displayName=mj;Ps.propTypes=vj;function hc(n){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?hc=function(l){return typeof l}:hc=function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},hc(n)}function gj(n,a,l){return a in n?Object.defineProperty(n,a,{value:l,enumerable:!0,configurable:!0,writable:!0}):n[a]=l,n}function yj(n,a){if(!(n instanceof a))throw new TypeError("Cannot call a class as a function")}function bj(n,a){for(var l=0;l<a.length;l++){var o=a[l];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}function _j(n,a,l){return a&&bj(n.prototype,a),n}function Oj(n,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(a&&a.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),a&&Ph(n,a)}function Ph(n,a){return Ph=Object.setPrototypeOf||function(o,i){return o.__proto__=i,o},Ph(n,a)}function xj(n){var a=Ej();return function(){var o=Jc(n),i;if(a){var f=Jc(this).constructor;i=Reflect.construct(o,arguments,f)}else i=o.apply(this,arguments);return Sj(this,i)}}function Sj(n,a){return a&&(hc(a)==="object"||typeof a=="function")?a:Tj(n)}function Tj(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function Ej(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Jc(n){return Jc=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},Jc(n)}var Nj="PageHeaderTitle",wj={align:c.oneOf(["top","middle","bottom"]),className:c.oneOfType([c.array,c.object,c.string]),content:c.node,label:c.node,truncate:c.bool},jj={title:"Page Header Title",truncate:!0},Nl=(function(n){Oj(l,n);var a=xj(l);function l(){return yj(this,l),a.apply(this,arguments)}return _j(l,[{key:"render",value:function(){if(!this.props.content)return null;var i=ce("slds-page-header__title",this.props.className,gj({"slds-truncate":this.props.truncate},"slds-align-".concat(this.props.align),this.props.align));return O.createElement("div",{className:"slds-page-header__name-title"},O.createElement("h1",null,O.createElement(Ps,{content:this.props.label}),O.createElement("span",{className:i,title:typeof this.props.content=="string"?this.props.content:void 0},this.props.content)))}}]),l})(Pe.Component);Nl.displayName=Nj;Nl.propTypes=wj;Nl.defaultProps=jj;function mc(n){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?mc=function(l){return typeof l}:mc=function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},mc(n)}function Cj(n,a,l){return a in n?Object.defineProperty(n,a,{value:l,enumerable:!0,configurable:!0,writable:!0}):n[a]=l,n}function Rj(n,a){if(!(n instanceof a))throw new TypeError("Cannot call a class as a function")}function Aj(n,a){for(var l=0;l<a.length;l++){var o=a[l];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}function Dj(n,a,l){return a&&Aj(n.prototype,a),n}function Mj(n,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(a&&a.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),a&&Lh(n,a)}function Lh(n,a){return Lh=Object.setPrototypeOf||function(o,i){return o.__proto__=i,o},Lh(n,a)}function Pj(n){var a=Ij();return function(){var o=Wc(n),i;if(a){var f=Wc(this).constructor;i=Reflect.construct(o,arguments,f)}else i=o.apply(this,arguments);return Lj(this,i)}}function Lj(n,a){return a&&(mc(a)==="object"||typeof a=="function")?a:zj(n)}function zj(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function Ij(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Wc(n){return Wc=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},Wc(n)}var $j="PageHeaderDetailRow",Bj={className:c.oneOfType([c.array,c.object,c.string]),content:c.node,flavor:c.string,label:c.node,truncate:c.bool},Uj={content:"",label:"",truncate:!0},bf=(function(n){Mj(l,n);var a=Pj(l);function l(){return Rj(this,l),a.apply(this,arguments)}return Dj(l,[{key:"renderContent",value:function(){var i=this,f=this.props,p=f.content,h=f.truncate;if(typeof p=="string"){var m=ce({"slds-truncate":h});return O.createElement("div",{className:m,ref:function(E){i.fieldContentRef=E},title:p},p)}return p}},{key:"renderLabel",value:function(){var i=this.props,f=i.label,p=i.truncate;if(typeof f=="string"){var h=ce("slds-text-title",{"slds-truncate":p});return O.createElement("div",{className:h,title:f},f)}return f}},{key:"render",value:function(){var i=this.props,f=i.className,p=i.flavor,h=ce("slds-page-header__detail-block",f,Cj({},"slds-size_".concat(p),p));return O.createElement("li",{className:h},this.renderLabel(),this.renderContent())}}]),l})(Pe.Component);bf.displayName=$j;bf.propTypes=Bj;bf.defaultProps=Uj;function vc(n){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?vc=function(l){return typeof l}:vc=function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},vc(n)}function Hj(n,a){if(!(n instanceof a))throw new TypeError("Cannot call a class as a function")}function qj(n,a){for(var l=0;l<a.length;l++){var o=a[l];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}function kj(n,a,l){return a&&qj(n.prototype,a),n}function Gj(n,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(a&&a.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),a&&zh(n,a)}function zh(n,a){return zh=Object.setPrototypeOf||function(o,i){return o.__proto__=i,o},zh(n,a)}function Kj(n){var a=Xj();return function(){var o=ef(n),i;if(a){var f=ef(this).constructor;i=Reflect.construct(o,arguments,f)}else i=o.apply(this,arguments);return Yj(this,i)}}function Yj(n,a){return a&&(vc(a)==="object"||typeof a=="function")?a:Vj(n)}function Vj(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function Xj(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ef(n){return ef=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},ef(n)}var Qj="PageHeaderDetailRow",Fj={children:c.node,className:c.oneOfType([c.array,c.object,c.string]),details:c.array},Zj={},_f=(function(n){Gj(l,n);var a=Kj(l);function l(){return Hj(this,l),a.apply(this,arguments)}return kj(l,[{key:"renderDetails",value:function(){return this.props.children!==void 0?this.props.children:this.props.details?this.props.details.map(function(i,f){var p="page-header-detail-block-".concat(f);return O.createElement(bf,{key:p,flavor:i.flavor,label:i.label,content:i.content,truncate:i.truncate})}):null}},{key:"render",value:function(){var i=ce("slds-page-header__detail-row",this.props.className);return O.createElement("ul",{className:i},this.renderDetails())}}]),l})(Pe.Component);_f.displayName=Qj;_f.propTypes=Fj;_f.defaultProps=Zj;function gc(n){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?gc=function(l){return typeof l}:gc=function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},gc(n)}function Ih(){return Ih=Object.assign||function(n){for(var a=1;a<arguments.length;a++){var l=arguments[a];for(var o in l)Object.prototype.hasOwnProperty.call(l,o)&&(n[o]=l[o])}return n},Ih.apply(this,arguments)}function Jj(n,a){if(!(n instanceof a))throw new TypeError("Cannot call a class as a function")}function Wj(n,a){for(var l=0;l<a.length;l++){var o=a[l];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}function eC(n,a,l){return a&&Wj(n.prototype,a),n}function tC(n,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(a&&a.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),a&&$h(n,a)}function $h(n,a){return $h=Object.setPrototypeOf||function(o,i){return o.__proto__=i,o},$h(n,a)}function nC(n){var a=iC();return function(){var o=tf(n),i;if(a){var f=tf(this).constructor;i=Reflect.construct(o,arguments,f)}else i=o.apply(this,arguments);return aC(this,i)}}function aC(n,a){return a&&(gc(a)==="object"||typeof a=="function")?a:rC(n)}function rC(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function iC(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function tf(n){return tf=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},tf(n)}var lC="PageHeaderControls",oC={className:c.oneOfType([c.array,c.object,c.string]),type:c.oneOf(["actions","controls"])},sC={},_i=(function(n){tC(l,n);var a=nC(l);function l(){return Jj(this,l),a.apply(this,arguments)}return eC(l,[{key:"render",value:function(){var i,f,p,h;return this.props.type==="actions"?this.props.onRenderActions?i=this.props.onRenderActions():this.props.contentRight&&(i=this.props.contentRight,f=!0):this.props.onRenderControls?i=this.props.onRenderControls():this.props.navRight&&(i=this.props.navRight,f=!0),i?(i.type&&i.type.displayName===Wp?h=i:i.props&&i.props.children&&(h=[],O.Children.forEach(i.props.children,function(m){m&&m.type&&m.type.displayName===Wp&&h.push(m)})),f&&(!h||h.length<1)&&(typeof i!="string"?p=O.createElement("div",Ih({className:"slds-page-header__controls"},i.props)):p=O.createElement("div",{className:"slds-page-header__controls"},i)),O.createElement("div",{className:ce("slds-page-header__col-".concat(this.props.type),this.props.className)},p||O.createElement("div",{className:"slds-page-header__controls"},h))):null}}]),l})(Pe.Component);_i.displayName=lC;_i.propTypes=oC;_i.defaultProps=sC;var uC="PageHeaderBase",cC={icon:c.node,info:c.node,onRenderControls:c.func,title:c.node,variant:c.string},mm=function(a){var l;if(a.iconName)l=O.createElement(De,{category:a.iconCategory,className:"slds-page-header__icon",name:a.iconName,position:a.iconPosition,size:a.iconSize,variant:a.iconVariant});else if(a.icon){var o="slds-page-header__icon";a.icon.props&&(o=ce(a.icon.props.className,o)),l=O.cloneElement(a.icon,{className:o})}return O.createElement("div",{className:"slds-page-header__row"},O.createElement("div",{className:"slds-page-header__col-title"},O.createElement(Ji,{body:O.createElement(O.Fragment,null,O.createElement("div",{className:"slds-page-header__name"},O.createElement(Nl,{content:a.title})),O.createElement(Ds,{content:a.info,variant:a.variant})),figure:l})),O.createElement(_i,{className:"slds-align-middle",navRight:a.navRight,onRenderControls:a.onRenderControls,type:"controls"}))};mm.displayName=uC;mm.propTypes=cC;var fC="PageHeaderRecordHome",dC={details:c.array,label:c.node,icon:c.element,onRenderActions:c.func,title:c.node},vm=function(a){var l;if(a.iconName)l=O.createElement(De,{category:a.iconCategory,className:"slds-page-header__icon",name:a.iconName,position:a.iconPosition,size:a.iconSize,variant:a.iconVariant});else if(a.icon){var o="slds-page-header__icon";a.icon.props&&(o=ce(a.icon.props.className,o)),l=O.cloneElement(a.icon,{className:o})}return O.createElement(O.Fragment,null,O.createElement("div",{className:"slds-page-header__row"},O.createElement("div",{className:"slds-page-header__col-title"},O.createElement(Ji,{body:O.createElement(O.Fragment,null,O.createElement("div",{className:"slds-page-header__name"},O.createElement(Nl,{content:a.title,label:a.label}))),figure:l})),O.createElement(_i,{contentRight:a.contentRight,onRenderActions:a.onRenderActions,type:"actions"})),a.details?O.createElement("div",{className:"slds-page-header__row slds-page-header__row_gutters"},O.createElement("div",{className:"slds-page-header__col-details"},O.createElement(_f,{details:a.details}))):null)};vm.displayName=fC;vm.propTypes=dC;var pC="PageHeaderObjectHome",hC={label:c.node,icon:c.element,info:c.node,nameSwitcherDropdown:c.node,onRenderActions:c.func,onRenderControls:c.func,title:c.node,trail:c.array,variant:c.string},gm=function(a){var l;if(a.iconName)l=O.createElement(De,{category:a.iconCategory,className:"slds-page-header__icon",name:a.iconName,position:a.iconPosition,size:a.iconSize,variant:a.iconVariant});else if(a.icon){var o="slds-page-header__icon";a.icon.props&&(o=ce(a.icon.props.className,o)),l=O.cloneElement(a.icon,{className:o})}return O.createElement(O.Fragment,null,O.createElement("div",{className:"slds-page-header__row"},O.createElement("div",{className:"slds-page-header__col-title"},O.createElement(Ji,{body:O.createElement(O.Fragment,null,a.trail?O.createElement(Ps,{style:{lineHeight:"1.3"},trail:a.trail}):null,O.createElement("div",{className:"slds-page-header__name"},O.createElement(Nl,{content:a.title,label:a.trail?null:a.label}),a.nameSwitcherDropdown?O.createElement("div",{className:"slds-page-header__name-switcher"},a.nameSwitcherDropdown):null)),figure:l})),O.createElement(_i,{className:ce({"slds-align-middle slds-p-bottom_none":!a.onRenderControls&&!a.navRight}),contentRight:a.contentRight,onRenderActions:a.onRenderActions,type:"actions"})),O.createElement("div",{className:"slds-page-header__row"},O.createElement("div",{className:"slds-page-header__col-meta"},O.createElement(Ds,{content:a.info,variant:a.variant})),O.createElement(_i,{className:ce({"slds-align-middle":!a.onRenderActions&&!a.comntentRight}),navRight:a.navRight,onRenderControls:a.onRenderControls,type:"controls"})))};gm.displayName=pC;gm.propTypes=hC;var mC="PageHeaderRelatedList",vC={label:c.node,info:c.node,onRenderActions:c.func,onRenderControls:c.func,title:c.node,trail:c.array,variant:c.string},ym=function(a){return O.createElement(O.Fragment,null,O.createElement("div",{className:"slds-page-header__row"},O.createElement("div",{className:"slds-page-header__col-title"},O.createElement(Ps,{content:a.label,trail:a.trail}),O.createElement(Ji,{body:O.createElement("div",{className:"slds-page-header__name"},O.createElement(Nl,{content:a.title,label:a.label}))})),O.createElement(_i,{contentRight:a.contentRight,onRenderActions:a.onRenderActions,type:"actions"})),O.createElement("div",{className:"slds-page-header__row"},O.createElement("div",{className:"slds-page-header__col-meta"},O.createElement(Ds,{content:a.info,variant:a.variant})),O.createElement(_i,{navRight:a.navRight,onRenderControls:a.onRenderControls,type:"controls"})))};ym.displayName=mC;ym.propTypes=vC;function yc(n){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?yc=function(l){return typeof l}:yc=function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},yc(n)}function gC(n,a){if(!(n instanceof a))throw new TypeError("Cannot call a class as a function")}function yC(n,a){for(var l=0;l<a.length;l++){var o=a[l];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}function bC(n,a,l){return a&&yC(n.prototype,a),n}function _C(n,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(a&&a.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),a&&Bh(n,a)}function Bh(n,a){return Bh=Object.setPrototypeOf||function(o,i){return o.__proto__=i,o},Bh(n,a)}function OC(n){var a=TC();return function(){var o=nf(n),i;if(a){var f=nf(this).constructor;i=Reflect.construct(o,arguments,f)}else i=o.apply(this,arguments);return xC(this,i)}}function xC(n,a){return a&&(yc(a)==="object"||typeof a=="function")?a:SC(n)}function SC(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function TC(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function nf(n){return nf=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},nf(n)}var EC=L_,NC={className:c.oneOfType([c.array,c.object,c.string]),details:c.array,label:c.oneOfType([c.string,c.element]),icon:c.element,info:c.oneOfType([c.string,c.element]),joined:c.bool,nameSwitcherDropdown:c.node,onRenderActions:c.func,onRenderControls:c.func,title:c.oneOfType([c.string,c.element]),trail:c.array,variant:c.oneOf(["base","object-home","record-home","related-list"])},wC={variant:"base"},Ls=(function(n){_C(l,n);var a=OC(l);function l(){return gC(this,l),a.apply(this,arguments)}return bC(l,[{key:"componentDidMount",value:function(){vw(L_,this.props)}},{key:"render",value:function(){var i=this.props,f=i.className,p=i.variant,h=ce("slds-page-header",{"slds-page-header_record-home":p==="record-home"||p==="recordHome","slds-page-header_related-list":p==="related-list"||p==="relatedList","slds-page-header_joined":this.props.joined},f),m;switch(p){case"object-home":case"objectHome":m=gm;break;case"record-home":case"recordHome":m=vm;break;case"related-list":case"relatedList":m=ym;break;default:m=mm}return O.createElement("div",{className:h},O.createElement(m,this.props))}}]),l})(Pe.Component);Ls.displayName=EC;Ls.propTypes=NC;Ls.defaultProps=wC;function bc(n){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?bc=function(l){return typeof l}:bc=function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},bc(n)}function jC(n,a){if(!(n instanceof a))throw new TypeError("Cannot call a class as a function")}function CC(n,a){for(var l=0;l<a.length;l++){var o=a[l];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}function RC(n,a,l){return a&&CC(n.prototype,a),n}function AC(n,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(a&&a.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),a&&Uh(n,a)}function Uh(n,a){return Uh=Object.setPrototypeOf||function(o,i){return o.__proto__=i,o},Uh(n,a)}function DC(n){var a=LC();return function(){var o=af(n),i;if(a){var f=af(this).constructor;i=Reflect.construct(o,arguments,f)}else i=o.apply(this,arguments);return MC(this,i)}}function MC(n,a){return a&&(bc(a)==="object"||typeof a=="function")?a:PC(n)}function PC(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function LC(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function af(n){return af=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},af(n)}var zC={assistiveText:c.shape({progress:c.string}),id:c.string,className:c.oneOfType([c.array,c.object,c.string]),labels:c.shape({label:c.oneOfType([c.string,c.node]),complete:c.oneOfType([c.string,c.node])}),radius:c.oneOf(["circular"]),color:c.oneOf(["success"]),thickness:c.oneOf(["x-small","small","medium","large"]),value:c.number.isRequired,orientation:c.oneOf(["horizontal","vertical"]),style:c.object},_c={assistiveText:{progress:"Progress"},labels:{complete:"Complete"},orientation:"horizontal",style:{height:"100%"}},Of=(function(n){AC(l,n);var a=DC(l);function l(o){var i;return jC(this,l),i=a.call(this,o),i.generatedId=bi(),i}return RC(l,[{key:"getId",value:function(){return this.props.id||this.generatedId}},{key:"getDescription",value:function(i){var f=i.labels;return f.label?O.createElement("div",{className:"slds-grid slds-grid_align-spread slds-p-bottom_x-small",id:"progress-bar-label-".concat(this.getId())},O.createElement("span",null,f.label),O.createElement("span",null,O.createElement("strong",null,this.props.value,"% ",f.complete))):""}},{key:"render",value:function(){var i=Mr({},_c.labels,this.props.labels),f=Mr({},_c.assistiveText,this.props.assistiveText),p=Mr({},_c.style,this.props.style);return O.createElement("div",{id:this.getId(),style:p},this.props.orientation==="horizontal"&&this.getDescription({labels:i}),O.createElement("div",{"aria-labelledby":this.props.orientation==="horizontal"&&i.label?"progress-bar-label-".concat(this.getId()):void 0,"aria-valuemin":"0","aria-valuemax":"100","aria-valuenow":this.props.value,"aria-valuetext":"".concat(f.progress,": ").concat(this.props.value,"%"),role:"progressbar",className:ce("slds-progress-bar",this.props.radius?"slds-progress-bar_".concat(this.props.radius):null,this.props.thickness?"slds-progress-bar_".concat(this.props.thickness):null,this.props.className,{"slds-progress-bar_vertical":this.props.orientation==="vertical"})},O.createElement("span",{className:ce("slds-progress-bar__value",this.props.color?"slds-progress-bar__value_".concat(this.props.color):null),style:this.props.orientation==="vertical"?{height:"".concat(this.props.value,"%")}:{width:"".concat(this.props.value,"%")}},O.createElement("span",{className:"slds-assistive-text"},"".concat(f.progress,": "),"".concat(this.props.value,"%")))))}}]),l})(O.Component);Of.displayName=n0;Of.propTypes=zC;Of.defaultProps=_c;var bm=function(a){var l=a.id,o=a.className,i=a.children,f=a.variant;return O.createElement("ul",{id:"".concat(l,"-slds-tabs__nav"),className:ce(o,{"slds-tabs_default__nav":f==="default","slds-tabs_scoped__nav":f==="scoped","slds-vertical-tabs__nav":f==="vertical"}),role:"tablist","aria-orientation":f==="vertical"?"vertical":void 0},i)};bm.displayName=o0;bm.propTypes={id:c.string,className:c.oneOfType([c.array,c.object,c.string]),children:c.oneOfType([c.object,c.array]),variant:c.oneOf(["default","scoped","vertical"])};function Oc(n){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Oc=function(l){return typeof l}:Oc=function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},Oc(n)}function IC(n,a){if(!(n instanceof a))throw new TypeError("Cannot call a class as a function")}function $C(n,a){for(var l=0;l<a.length;l++){var o=a[l];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}function BC(n,a,l){return a&&$C(n.prototype,a),n}function UC(n,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(a&&a.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),a&&Hh(n,a)}function Hh(n,a){return Hh=Object.setPrototypeOf||function(o,i){return o.__proto__=i,o},Hh(n,a)}function HC(n){var a=kC();return function(){var o=rf(n),i;if(a){var f=rf(this).constructor;i=Reflect.construct(o,arguments,f)}else i=o.apply(this,arguments);return qC(this,i)}}function qC(n,a){return a&&(Oc(a)==="object"||typeof a=="function")?a:_O(n)}function _O(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function kC(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function rf(n){return rf=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},rf(n)}function Na(n,a,l){return a in n?Object.defineProperty(n,a,{value:l,enumerable:!0,configurable:!0,writable:!0}):n[a]=l,n}var xf=(function(n){UC(l,n);var a=HC(l);function l(){var o;IC(this,l);for(var i=arguments.length,f=new Array(i),p=0;p<i;p++)f[p]=arguments[p];return o=a.call.apply(a,[this].concat(f)),Na(_O(o),"checkFocus",function(){o.props.selected&&o.props.focus&&o.node&&o.node.focus()}),o}return BC(l,[{key:"componentDidMount",value:function(){this.checkFocus()}},{key:"componentDidUpdate",value:function(){this.checkFocus()}},{key:"render",value:function(){var i,f,p=this,h=this.props,m=h.selected,b=h.disabled,E=h.panelId,N=h.activeTabClassName,C=h.disabledTabClassName,D=h.className,H=h.children,Q=h.id,V=h.variant,he=h.hasError,fe;return m?fe="0":fe="-1",O.createElement("li",{className:ce(D,(i={},Na(i,N,m),Na(i,C,b),Na(i,"slds-tabs_default__item",V==="default"),Na(i,"slds-tabs_scoped__item",V==="scoped"),Na(i,"slds-vertical-tabs__nav-item",V==="vertical"),i)),role:"presentation",id:Q,title:typeof H=="string"?H:null},O.createElement("a",{className:ce((f={},Na(f,N,m),Na(f,C,b),Na(f,"slds-tabs_default__link",V==="default"),Na(f,"slds-tabs_scoped__link",V==="scoped"),Na(f,"slds-vertical-tabs__link",V==="vertical"),f)),href:"#",role:"tab",ref:function(me){p.node=me},tabIndex:fe,"aria-controls":E,"aria-disabled":b,"aria-selected":m?"true":"false",onClick:function(me){return me.preventDefault()}},H,he&&O.createElement("span",{className:ce({"slds-tabs__right-icon":V!=="vertical","slds-vertical-tabs__right-icon":V==="vertical"})},O.createElement(De,{assistiveText:{label:this.props.assistiveText.withErrorIcon},category:"utility",containerClassName:"slds-icon_container slds-icon-utility-error",size:"x-small",name:"error",colorVariant:"error",title:this.props.assistiveText.withErrorIcon}))))}}]),l})(O.Component);Na(xf,"displayName",r0);Na(xf,"propTypes",{className:c.string,id:c.string,focus:c.bool,selected:c.bool,disabled:c.bool,activeTabClassName:c.string,disabledTabClassName:c.string,panelId:c.string,children:c.oneOfType([c.string,c.element]),variant:c.oneOf(["default","scoped","vertical"]),hasError:c.bool,assistiveText:c.shape({withErrorIcon:c.string})});Na(xf,"defaultProps",{focus:!1,selected:!1,activeTabClassName:"slds-is-active",disabledTabClassName:"slds-disabled",variant:"default",hasError:!1,assistiveText:{withErrorIcon:"This item has an error"}});var _m=function(a){var l=a.className,o=a.children,i=a.variant,f=i===void 0?"default":i,p=a.selected,h=p===void 0?!1:p,m=a.id,b=a.tabId;return O.createElement("div",{"aria-labelledby":b,className:ce(l,{"slds-show":h,"slds-hide":!h,"slds-tabs_default__content":f==="default","slds-tabs_scoped__content":f==="scoped","slds-vertical-tabs__content":f==="vertical"}),id:m,role:"tabpanel"},o.props.children)};_m.displayName=i0;_m.propTypes={children:c.oneOfType([c.array,c.object,c.string]),className:c.string,id:c.string,selected:c.bool,variant:c.oneOf(["default","scoped","vertical"]),tabId:c.string};function xc(n){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?xc=function(l){return typeof l}:xc=function(l){return l&&typeof Symbol=="function"&&l.constructor===Symbol&&l!==Symbol.prototype?"symbol":typeof l},xc(n)}function GC(n,a){if(!(n instanceof a))throw new TypeError("Cannot call a class as a function")}function KC(n,a){for(var l=0;l<a.length;l++){var o=a[l];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}function YC(n,a,l){return a&&KC(n.prototype,a),n}function VC(n,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(a&&a.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),a&&qh(n,a)}function qh(n,a){return qh=Object.setPrototypeOf||function(o,i){return o.__proto__=i,o},qh(n,a)}function XC(n){var a=FC();return function(){var o=lf(n),i;if(a){var f=lf(this).constructor;i=Reflect.construct(o,arguments,f)}else i=o.apply(this,arguments);return QC(this,i)}}function QC(n,a){return a&&(xc(a)==="object"||typeof a=="function")?a:kh(n)}function kh(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function FC(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function lf(n){return lf=Object.setPrototypeOf?Object.getPrototypeOf:function(l){return l.__proto__||Object.getPrototypeOf(l)},lf(n)}function u_(n,a,l){return a in n?Object.defineProperty(n,a,{value:l,enumerable:!0,configurable:!0,writable:!0}):n[a]=l,n}function ZC(n){return n.nodeName==="A"&&n.getAttribute("role")==="tab"||n.nodeName==="LI"&&(n.classList.contains("slds-tabs_default__item")||n.classList.contains("slds-tabs_scoped__item")||n.classList.contains("slds-vertical-tabs__nav-item"))}function ss(n){return n.classList&&n.classList.contains("slds-disabled")?!0:n.getAttribute?n.getAttribute("aria-disabled")==="true":!!n.props.disabled}var JC=l0,WC={id:c.string,children:c.oneOfType([c.arrayOf(c.node),c.node,c.element]).isRequired,className:c.oneOfType([c.array,c.object,c.string]),defaultSelectedIndex:c.number,onSelect:c.func,variant:c.oneOf(["default","scoped","vertical"]),selectedIndex:c.number},eR={defaultSelectedIndex:0,variant:"default"},Sf=(function(n){VC(l,n);var a=XC(l);function l(o){var i;return GC(this,l),i=a.call(this,o),u_(kh(i),"handleClick",function(f){var p=f.target;do if(i.isTabFromContainer(p)){if(ss(p))return;var h=p.parentNode;h.nodeName==="LI"&&(p=p.parentNode,h=p.parentNode);var m=[].slice.call(h.children).indexOf(p);i.setSelected(m);return}while((p=p.parentNode)!==null)}),u_(kh(i),"handleKeyDown",function(f){if(i.isTabFromContainer(f.target)){var p=i.getSelectedIndex(),h=!1;f.keyCode===et.LEFT||f.keyCode===et.UP?(p=i.getPrevTab(p),h=!0):(f.keyCode===et.RIGHT||f.keyCode===et.DOWN)&&(p=i.getNextTab(p),h=!0),h&&Pn.trap(f),i.setSelected(p,!0)}}),i.tabs=[],i.generatedId=bi(),i.flavor=i.getVariant(),i.state={selectedIndex:o.defaultSelectedIndex},i}return YC(l,[{key:"getNextTab",value:function(i){for(var f=this.getTabsCount(),p=i+1;p<f;p++){var h=this.getTab(p);if(!ss(h))return p}for(var m=0;m<i;m++){var b=this.getTab(m);if(!ss(b))return m}return i}},{key:"getPanelsCount",value:function(){return this.props.children?O.Children.count(this.props.children):0}},{key:"getPrevTab",value:function(i){for(var f=i;f--;){var p=this.getTab(f);if(!ss(p))return f}for(f=this.getTabsCount();f-- >i;){var h=this.getTab(f);if(!ss(h))return f}return i}},{key:"getSelectedIndex",value:function(){return Number.isInteger(this.props.selectedIndex)?this.props.selectedIndex:this.state.selectedIndex}},{key:"getTab",value:function(i){return this.tabs[i].tab}},{key:"getTabNode",value:function(i){return this.tabs[i].node}},{key:"getTabsCount",value:function(){return this.props.children?O.Children.count(this.props.children):0}},{key:"getVariant",value:function(){return this.props.variant||"default"}},{key:"setSelected",value:function(i,f){if(!(i<0||i>=this.getTabsCount())){var p=this.getSelectedIndex(),h;_r(this.props.onSelect)&&(h=this.props.onSelect(i,p)),h!==!1&&i!==this.state.selectedIndex&&this.setState({selectedIndex:i,focus:f===!0})}}},{key:"isTabFromContainer",value:function(i){if(!ZC(i))return!1;var f=i.parentElement;do{if(f===this.tabsNode)return!0;if(f.getAttribute("data-tabs"))break;f=f.parentElement}while(f);return!1}},{key:"renderTabPanels",value:function(i){var f=this,p=O.Children.toArray(this.props.children),h=this.getSelectedIndex(),m=null;return m=p.map(function(b,E){var N="".concat(i,"-slds-tabs_tab-").concat(E),C="".concat(i,"-slds-tabs_panel-").concat(E),D=h===E,H=f.getVariant();return O.createElement(_m,{key:b.key,selected:D,id:C,tabId:N,variant:H},p[E])}),m}},{key:"renderTabsList",value:function(i){var f=this,p=O.Children.toArray(this.props.children);return O.createElement(bm,{id:i,variant:this.getVariant()},p.map(function(h,m){var b="".concat(i,"-slds-tabs_tab-").concat(m),E="".concat(i,"-slds-tabs_panel-").concat(m),N=f.getSelectedIndex()===m,C=N&&f.state.focus,D=f.getVariant();return O.createElement(xf,{key:h.key,ref:function(Q){f.tabs[m]={tab:h,node:Q},f.state.focus&&f.setState({focus:!1})},focus:C,selected:N,id:b,panelId:E,disabled:h.props.disabled,variant:D,hasError:h.props.hasError,assistiveText:h.props.assistiveText},h.props.label)}))}},{key:"render",value:function(){var i=this,f=this.props,p=f.className,h=f.id,m=h===void 0?this.generatedId:h,b=f.variant,E=b===void 0?this.getVariant:b;return O.createElement("div",{id:m,className:ce({"slds-tabs_default":E==="default","slds-tabs_scoped":E==="scoped","slds-vertical-tabs":E==="vertical"},p),onClick:this.handleClick,onKeyDown:this.handleKeyDown,"data-tabs":!0,ref:function(C){i.tabsNode=C}},this.renderTabsList(m),this.renderTabPanels(m))}}]),l})(O.Component);Sf.displayName=JC;Sf.propTypes=WC;Sf.defaultProps=eR;var Om=function(a){var l=a.children;return O.createElement("div",null,O.Children.toArray(l))};Om.displayName=s0;Om.propTypes={label:c.oneOfType([c.string,c.element]).isRequired,children:c.oneOfType([c.arrayOf(c.node),c.node,c.element]).isRequired,hasError:c.bool,assistiveText:c.shape({withErrorIcon:c.string})};const tR=cf,xm=uf,nR=ff,Gh=Fh;function aR(n){const a=new Set(n.filter(l=>l.disposition==="finding").map(l=>l.severity));return a.has("critical")?"no-go":a.has("high")||a.has("medium")?"go-with-fixes":"go"}const yo=["critical","high","medium","low","info"],c_=()=>Object.fromEntries(yo.map(n=>[n,0])),rR=(n,a)=>Math.max(0,new Date(a).getTime()-new Date(n).getTime());function iR(n){return n.replace(/^Lighthouse ·\s*/,"").split(" / ").pop()??n}function f_(n){const a={status:"preparing",hasRun:!1,steps:[],activeIndex:0,stepsComplete:0,findings:[],counts:c_(),logs:[],finalScores:[]},l=new Map;let o,i=!1;for(const p of n)if(!(a.status==="complete"&&p.type!=="run.start"))switch(a.status==="error"&&i&&p.type!=="run.error"&&(a.status="running",a.error=void 0,a.completedAt=void 0),p.type){case"run.start":{a.hasRun=!0,a.status="running",a.startedAt=p.startedAt,a.completedAt=void 0,a.target=p.target,a.guidance=void 0,a.error=void 0,a.logs=[],a.findings=[],a.counts=c_(),a.finalScores=[],l.clear(),o=void 0,a.steps=p.plan.map(h=>{const m={id:h.id,title:h.title,detail:h.detail,state:"pending"};return l.set(h.id,m),m});break}case"stage.start":{a.hasRun=!0,o=p.stageId;const h=l.get(p.stageId);h&&h.state!=="done"&&(h.state="running",h.startedAt=p.at);break}case"stage.complete":{const h=l.get(p.stageId);h&&(h.state="done",h.durationMs=p.durationMs??(h.startedAt?rR(h.startedAt,p.at):void 0),p.summary&&(h.summary=p.summary)),o===p.stageId&&(o=void 0);break}case"page.complete":{const h=l.get(p.pageId);h&&(h.score=p.score,h.metrics=p.metrics);break}case"rules.progress":{const h=o?l.get(o):void 0;if(h){const m=h.rules??{evaluated:0,total:p.total,categories:[]};if(m.evaluated=p.evaluated,m.total=p.total,p.category){const b=m.categories.find(N=>N.name===p.category),E=b??{name:p.category,evaluated:0,total:p.categoryTotal??0,flagged:0};E.evaluated=p.categoryEvaluated??E.evaluated,p.categoryTotal!==void 0&&(E.total=p.categoryTotal),b||m.categories.push(E)}h.rules=m}break}case"finding":{a.findings.push({id:p.id,severity:p.severity,title:p.title,category:p.category,source:p.source}),a.counts[p.severity]+=1;const m=(o?l.get(o):void 0)?.rules?.categories.find(b=>b.name===p.category);m&&(m.flagged+=1);break}case"log":{a.logs.push({at:p.at,level:p.level,message:p.message});break}case"run.complete":{a.status="complete",a.completedAt=p.at,a.guidance=p.guidance;for(const h of a.steps)h.state!=="done"&&(h.state="done");p.scores.length&&(a.finalScores=p.scores);break}case"run.error":{a.status="error",a.error=p.message,i=p.stageId!==void 0,a.completedAt=p.at;break}}a.stepsComplete=a.steps.filter(p=>p.state==="done").length;const f=a.steps.findIndex(p=>p.state==="running");return a.activeIndex=f===-1?a.stepsComplete:f,a.finalScores.length||(a.finalScores=a.steps.flatMap(p=>p.score===void 0?[]:[{label:iR(p.title),score:p.score}])),a.status==="preparing"&&(a.startedAt||a.steps.some(p=>p.state!=="pending"))&&(a.status="running"),a}const _l=new URLSearchParams(window.location.search).get("run")??void 0,Sm=n=>_l?`${n}?run=${encodeURIComponent(_l)}`:n,d_=n=>n.replace(/T(\d{2})-(\d{2})-(\d{2})Z$/," $1:$2:$3 UTC"),p_=n=>{window.location.href=n?`/?run=${encodeURIComponent(n)}`:"/"};function lR(){const[n,a]=Pe.useState([]),[l,o]=Pe.useState(null),[i,f]=Pe.useState(null),[p,h]=Pe.useState(null),[m,b]=Pe.useState(!1),[E,N]=Pe.useState(!1),C=Pe.useRef([]);if(Pe.useEffect(()=>{if(!_l)return;let Q=!0;return(async()=>{try{const V=await fetch(Sm("/api/audit"));if(!Q)return;V.status===409?N(!0):V.ok?o(await V.json()):h(`run ${_l} was not found`)}catch(V){Q&&h(V instanceof Error?V.message:String(V))}})(),()=>{Q=!1}},[]),Pe.useEffect(()=>{if(_l)return;let Q=!0,V,he,fe=!1,te,me=!1;const Oe=()=>{te=void 0,fe=!0,Q&&!me&&b(!0)},Te=async()=>{try{const ae=await fetch("/api/audit");ae.ok&&Q&&o(await ae.json())}catch{}},F=async()=>{try{const ae=await(await fetch("/api/status")).json();if(!Q)return;if(f(ae.status),ae.status==="complete")return void Te();he=setTimeout(()=>{F()},1e3)}catch(ae){Q&&h(ae instanceof Error?ae.message:String(ae))}},ge=()=>{V=new EventSource("/api/events"),V.addEventListener("open",()=>{C.current=[],fe=!1,te&&(clearTimeout(te),te=void 0),Q&&b(!1)}),V.addEventListener("message",ae=>{if(Q)try{const $e=JSON.parse(ae.data);C.current=[...C.current,$e],a(C.current),$e.type==="run.complete"&&Te()}catch{}}),V.addEventListener("end",()=>{me=!0,V?.close()}),V.addEventListener("error",()=>{if(!me){if(V?.readyState===EventSource.CLOSED&&C.current.length===0){V=void 0,F();return}C.current.length>0&&!fe&&!te&&(te=setTimeout(Oe,4e3))}})};let je;const at=async()=>{try{const{runId:ae}=await(await fetch("/api/status")).json(),$e=C.current.findLast(rt=>rt.type==="run.start");if(ae&&$e?.type==="run.start"&&$e.runId!==ae)return void window.location.reload()}catch{}Q&&(je=setTimeout(()=>{at()},2e3))};return ge(),at(),()=>{Q=!1,me=!0,V?.close(),je&&clearTimeout(je),he&&clearTimeout(he),te&&clearTimeout(te)}},[]),p)return{status:"error",message:p};if(E)return{status:"unfinished"};if(_l)return l?{status:"complete",model:f_([]),result:l,connectionLost:!1}:{status:"loading"};const D=f_(n);return D.status==="complete"||i==="complete"?l?{status:"complete",model:D,result:l,connectionLost:m}:{status:"loading"}:D.hasRun?{status:"running",model:D,connectionLost:m}:i?{status:"running",model:D,connectionLost:m}:{status:"loading"}}const lo=n=>n&&typeof n=="object"&&!Array.isArray(n)?n:void 0,h_=n=>Array.isArray(n)?n:[];function oR(n){const a=lo(n)?.lcp;return typeof a=="number"&&Number.isFinite(a)&&a>0}function sR(n){const a=n.slice().sort((o,i)=>o-i),l=Math.floor(a.length/2);return a.length%2===0?((a[l-1]??0)+(a[l]??0))/2:a[l]??0}function uR(n,a,l=oR){const o=lo(n),i=lo(h_(o?.cells)[a]);if(!i)return;const f=h_(o?.runs).map((N,C)=>({entry:lo(N),index:C})).flatMap(({entry:N,index:C})=>{const D=lo(N?.row);return D&&typeof D.lcp=="number"&&N?.formFactor===i.formFactor&&N?.cacheState===i.cacheState?[{row:D,index:C}]:[]}),p=f.filter(({row:N})=>l(N)),h=lo(i.medianRun);if(h&&l(h)&&p.length===f.length)return{run:h,pointer:`/cells/${a}/medianRun`,unmeasuredRuns:0};if(!p.length)return;const m=N=>N.row.lcp,b=sR(p.map(m)),E=p.reduce((N,C)=>Math.abs(m(C)-b)<Math.abs(m(N)-b)?C:N);return{run:E.row,pointer:`/runs/${E.index}/row`,unmeasuredRuns:f.length-p.length}}const Tf=n=>n!==null&&typeof n=="object"&&!Array.isArray(n)?n:void 0,OO=n=>Array.isArray(n)?n:[],xO=n=>typeof n=="number"&&Number.isFinite(n)?n:void 0,m_=n=>typeof n=="string"&&n.length?n:void 0;function cR(n){return n===void 0?"—":n>=1e3?`${(n/1e3).toFixed(n%1e3?1:0)}s`:`${Math.round(n)}ms`}function Ef(n){return n===void 0?"—":n>=1024*1024?`${(n/1024/1024).toFixed(1)} MB`:`${Math.round(n/1024)} KB`}function fR(n){return n.replace("T"," ").replace(/\.\d+Z$/," UTC")}const dR=n=>n.toLowerCase().replace(/[^a-z0-9-]/g,"-"),Tm=(n,a)=>Tf(n.playhouse.artifacts[a]),SO=n=>OO(n).map(Tf).filter(a=>!!a),pR=(n,a)=>SO(Tm(n,a)?.cells),Xp=n=>`${m_(n.formFactor)??""}:${m_(n.cacheState)??""}`;function hR(n,a){const l=pR(n,a).slice().sort((o,i)=>Xp(o).localeCompare(Xp(i)));return l.find(o=>Xp(o)==="mobile:cold")??l[0]}function TO(n){const a=Tm(n,"summary.json"),l=hR(n,"summary.json");return l?Tf(uR(a,OO(a?.cells).indexOf(l))?.run):void 0}const mR=n=>SO(Tm(n,"summary.json")?.runs).filter(a=>a.formFactor==="mobile"&&a.cacheState==="cold").length;function bo(n,a){const l=TO(n);if(!l)return;const o=a.toLowerCase(),i=xO(l[o]);if(i!==void 0)return{value:i,display:o==="cls"?i.toFixed(2):cR(i)}}const EO=n=>xO(TO(n)?.score),xl={home:"Home",plp:"Category / PLP",pdp:"Product / PDP",cart:"Cart",checkout:"Checkout"},of={LCP:"2.5s",TBT:"200ms",CLS:"0.10",TTFB:"800ms"},v_={LCP:"4.0s",TBT:"600ms",CLS:"0.25",TTFB:"1.8s"},Nf=["LCP","TBT","CLS","TTFB"],NO={LCP:2500,TBT:200,CLS:.1,TTFB:800},vR={LCP:4e3,TBT:600,CLS:.25,TTFB:1800};function wO(n,a){const l=bo(n,a)?.value,o=NO[a];if(!(l===void 0||o===void 0))return l>o}function gR(n,a){const l=bo(n,a)?.value,o=NO[a],i=vR[a];if(!(l===void 0||o===void 0))return l<=o?"pass":i!==void 0&&l<=i?"warn":"fail"}function yR(){return Nf.map(n=>({label:n,pass:`≤ ${of[n]}`,warn:`${of[n]} – ${v_[n]}`,fail:`> ${v_[n]}`}))}function bR(n){try{const a=new URL(n);return`${a.pathname}${a.search}`}catch{return n}}const g_=new Map(yo.map((n,a)=>[n,a])),zs=n=>n.ruleId.split("/")[0]??n.ruleId,jO=(n,a)=>n.catalog.categories.find(l=>l.id===a)?.title??a;function _R(n,a){return(g_.get(n.severity??"info")??99)-(g_.get(a.severity??"info")??99)||n.ruleId.localeCompare(a.ruleId)}function Em(n){return n.evaluations.filter(a=>a.disposition==="finding").slice().sort(_R)}function OR(n){return[...new Set(n.flatMap(a=>a.type==="playhouse"?[a.page]:[]))]}const xR=[[/^summary\.json$/,"Lighthouse summary"],[/^summary-lcp\.json$/,"LCP breakdown"],[/^summary-tbt\.json$/,"TBT breakdown"],[/^summary-third-party\.json$/,"Third-party summary"],[/^opportunities\.json$/,"Lighthouse opportunities"],[/^report-.*\.html$/,"Lighthouse report"],[/^network(-.*)?\.(har|json)$/,"Network log"],[/^diagnostics-.*\.json$/,"Browser console & issues"],[/^console-.*\.json$/,"Browser console"],[/^document\.json$/,"HTML document"],[/^index\.json$/,"Page scripts"],[/^[0-9a-f]{64}\.js$/,"Page script"],[/^lhr\.json$/,"Lighthouse result"],[/^(trace|profile|devtoolslog)-.*\.json$/,"Performance trace"]];function SR(n){const a=n.split("/").pop()??n;return xR.find(([l])=>l.test(a))?.[1]??a}function sf(n){return n?n.type==="source"?`${n.file}${n.line?`:${n.line}`:""}`:n.type==="playhouse"?`${xl[n.page]??n.page} · ${SR(n.artifact)}`:n.location?xl[n.location]??n.location:n.description:""}function Qp(n){return n.type==="source"?`${n.file}${n.line?`:${n.line}`:""}${n.excerpt?`
40
40
  ${n.excerpt}`:""}`:n.type==="playhouse"?n.value===void 0?"":String(n.value):`${n.description}${n.location?`
41
- ${n.location}`:""}`}const TR={pass:"pass",warn:"high",fail:"critical"},Ln=n=>`audit-tone_${n}`,ER=n=>TR[n],Nm=n=>({"--audit-share":Math.max(0,Math.min(1,n))}),NR=n=>({"--audit-weight":n}),wR=n=>({"--audit-columns":n}),jR=n=>({"--audit-column":n});function CO(n){var a,l,o="";if(typeof n=="string"||typeof n=="number")o+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(a=0;a<i;a++)n[a]&&(l=CO(n[a]))&&(o&&(o+=" "),o+=l)}else for(l in n)n[l]&&(o&&(o+=" "),o+=l);return o}function CR(){for(var n,a,l=0,o="",i=arguments.length;l<i;l++)(n=arguments[l])&&(a=CO(n))&&(o&&(o+=" "),o+=a);return o}function Xe(...n){return CR(n)}const RR="https://forms.gle/kJtg4Tfudxvqykri7";function Os({nav:n=[],active:a,onNavigate:l,banner:o,children:i}){return v.jsxs("div",{className:"audit-app",children:[o,v.jsx(El,{variant:"info",icon:v.jsx(De,{category:"utility",name:"info"}),labels:{heading:"Site Audit is in preview and under active development. Features and results may change."}}),v.jsxs(cm,{children:[v.jsx(bs,{region:"primary",children:v.jsxs("div",{className:"slds-context-bar__item slds-context-bar__dropdown-trigger slds-no-hover",children:[v.jsx("div",{className:"slds-context-bar__icon-action",children:v.jsx(De,{category:"standard",name:"dashboard",size:"small",assistiveText:{label:""}})}),v.jsx("span",{className:"slds-context-bar__label-action slds-context-bar__app-name",children:v.jsx("span",{className:"slds-truncate",children:"Site Audit"})})]})}),n.length?v.jsx(bs,{region:"secondary",navigation:!0,children:n.map(f=>v.jsx(fm,{id:`nav-${f.id}`,href:`#${f.id}`,label:f.count===void 0?f.label:`${f.label} (${f.count})`,active:f.id===a,onClick:()=>l?.(f.id)},f.id))}):null,v.jsx(bs,{region:"tertiary",children:v.jsx("div",{className:"slds-context-bar__item slds-no-hover audit-feedback",children:v.jsxs("a",{className:"slds-button slds-button_neutral",href:RR,target:"_blank",rel:"noreferrer",children:[v.jsx(De,{category:"utility",name:"comments",size:"xx-small",className:"slds-button__icon slds-button__icon_left"}),"Give feedback",v.jsx("span",{className:"slds-assistive-text",children:"(opens in a new tab)"})]})})})]}),v.jsx("div",{className:"audit-page",children:i})]})}function Is({children:n="AI analysis",className:a}){return v.jsx(xm,{className:Xe("audit-badge audit-badge_ai",a),iconAlignment:"left",icon:v.jsx(De,{category:"utility",name:"sparkles",size:"xx-small",className:"audit-badge__icon"}),content:n})}function AR(n){return n===void 0?"info":n>=90?"pass":n>=50?"high":"critical"}function wf({score:n,size:a="small",className:l}){return v.jsx("span",{role:"img","aria-label":n===void 0?"Performance score unavailable":`Performance score ${n} of 100`,className:Xe("audit-score",`audit-score_${a}`,Ln(AR(n)),l),style:Nm((n??0)/100),children:v.jsx("span",{className:"audit-score__value",children:n??"—"})})}function Vn({label:n,value:a,detail:l,ok:o,size:i="medium",className:f}){return v.jsxs("div",{className:Xe("audit-stat",f),children:[v.jsx("div",{className:"slds-text-title slds-truncate",children:n}),v.jsx("div",{className:Xe("audit-stat__value",i==="small"?"slds-text-heading_small":"slds-text-heading_medium",o!==void 0&&Xe("audit-stat__value_toned",Ln(o?"pass":"critical"))),children:a}),l?v.jsx("div",{className:"slds-text-body_small slds-text-color_weak",children:l}):null]})}function RO({page:n,selected:a,onSelect:l}){const o=v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"slds-media slds-media_center",children:[v.jsxs("div",{className:"slds-media__body slds-truncate",children:[v.jsx("div",{className:"slds-text-heading_small slds-truncate",children:xl[n.label]??n.label}),v.jsx("div",{className:"slds-text-body_small slds-text-color_weak slds-text-font_monospace slds-truncate",children:bR(n.url)})]}),v.jsx("div",{className:"slds-media__figure slds-media__figure_reverse",children:v.jsx(wf,{score:EO(n)})})]}),v.jsx("div",{className:"audit-metric-row slds-m-top_small",children:Nf.map(i=>v.jsx(Vn,{label:i,value:bo(n,i)?.display??"—",ok:DR(wO(n,i)),size:"small",className:"audit-metric-row__item"},i))})]});return l?v.jsx("button",{type:"button",onClick:l,"aria-pressed":a,className:Xe("audit-tile slds-box slds-box_link slds-theme_default",a&&"audit-tile_selected"),children:o}):v.jsx("article",{className:"audit-tile slds-box slds-theme_default",children:o})}const DR=n=>n===void 0?void 0:!n;function Es({severity:n,children:a,className:l}){return v.jsx(xm,{className:Xe("audit-badge",Ln(n),l),content:a})}function MR({category:n,onSelect:a}){const l=yo.filter(o=>n.counts[o]>0);return v.jsxs("button",{type:"button",onClick:a,className:"audit-tile slds-box slds-box_link slds-theme_default",children:[v.jsxs("div",{className:"slds-grid slds-grid_align-spread slds-grid_vertical-align-center",children:[v.jsx("span",{className:"slds-text-heading_small slds-truncate",children:n.title}),v.jsx("span",{className:"slds-text-heading_medium",children:n.total})]}),v.jsx("span",{className:"audit-segments slds-m-top_small","aria-hidden":"true",children:l.map(o=>v.jsx("span",{className:Xe("audit-segments__item",Ln(o)),style:NR(n.counts[o])},o))}),l.length?v.jsx("ul",{className:"slds-list_horizontal slds-has-dividers_right slds-m-top_x-small slds-text-body_small",children:l.map(o=>v.jsxs("li",{className:Xe("slds-item audit-tone-text",Ln(o)),children:[n.counts[o]," ",o]},o))}):null,v.jsx("p",{className:"audit-tile__footer slds-text-body_small slds-text-color_weak slds-truncate",children:n.topLine})]})}function PR({label:n,heading:a,align:l="bottom right",fit:o=!1,children:i}){return v.jsx(go,{align:l,heading:a,body:i,classNameBody:o?"audit-popover__body_fit":void 0,children:v.jsx(da,{assistiveText:{icon:n},iconCategory:"utility",iconName:"info",iconVariant:"bare",variant:"icon",title:n})})}const y_={"no-go":{label:"Not ready to launch",tone:"critical",icon:"error"},"go-with-fixes":{label:"Launch with fixes",tone:"high",icon:"warning"},go:{label:"Ready to launch",tone:"pass",icon:"success"}},LR=new Set(["critical","high","medium"]),b_=2,__=(n,a,l)=>`${n} ${n===1?a:l}`;function zR(n,a){return n?`${__(n,"critical finding blocks","critical findings block")} launch.`:a?`${__(a,"finding","findings")} to fix before launch; nothing blocks launch.`:"No findings need a fix before launch."}const IR=n=>n.split(new RegExp("(?<=[.!?])\\s+(?=[A-Z])"));function $R({result:n,className:a,onShowManualReview:l}){const o=Em(n),i=o.filter(b=>b.severity==="critical").length,f=o.filter(b=>LR.has(b.severity??"info")).length,p=n.evaluations.filter(b=>b.disposition==="pass").length,h=n.evaluations.filter(b=>b.disposition==="not-verified"),m=y_[n.summary?.guidance]??y_[aR(n.evaluations)];return v.jsxs(Za,{className:a,heading:"Launch readiness",icon:v.jsx(De,{category:"standard",name:"approval",size:"small"}),bodyClassName:"slds-card__body_inner audit-stack",children:[v.jsxs("div",{className:Xe("audit-verdict",Ln(m.tone)),role:"status",children:[v.jsx(De,{category:"utility",name:m.icon,size:"small"}),v.jsxs("div",{children:[v.jsx("h2",{className:"slds-text-heading_medium",children:m.label}),v.jsx("p",{className:"slds-text-body_regular",children:zR(i,f)})]})]}),v.jsxs("div",{className:"audit-metric-row",children:[v.jsx(Vn,{label:"To fix before launch",value:f,detail:"critical, high or medium",className:"audit-metric-row__item"}),v.jsx(Vn,{label:"Suggestions",value:o.length-f,detail:"low or info",className:"audit-metric-row__item"}),v.jsx(Vn,{label:"Passed",value:p,detail:"rules met",className:"audit-metric-row__item"}),v.jsx(Vn,{label:"Manual review",value:h.length?v.jsxs("span",{className:"slds-grid slds-grid_vertical-align-center audit-gap_x-small",children:[v.jsx(De,{category:"utility",name:"warning",size:"x-small",assistiveText:{label:"Needs attention"}}),h.length]}):0,detail:h.length?v.jsx("button",{type:"button",className:"slds-button_reset slds-text-link",onClick:l,children:"View in All Findings"}):"nothing to review",className:Xe("audit-metric-row__item",h.length&&Xe("audit-metric-row__item_attention",Ln("high")))})]}),n.summary?.narrative||n.summary?.highlights?.length?v.jsx(BR,{text:n.summary.narrative,highlights:n.summary.highlights??[]}):null]})}function BR({text:n,highlights:a}){const[l,o]=Pe.useState(!1),i=IR(n),f=!a.length&&i.length>b_,p=l||!f?n:i.slice(0,b_).join(" ");return v.jsxs("section",{className:"slds-media","aria-label":"AI summary",children:[v.jsx("div",{className:"slds-media__figure",children:v.jsx("img",{src:"/einstein.png",alt:"",width:360,height:549,draggable:!1,className:"audit-mascot"})}),v.jsxs("div",{className:"slds-media__body",children:[v.jsx(Is,{children:"AI summary"}),p?v.jsx("p",{className:"audit-prose slds-text-title_bold slds-m-top_x-small",children:p}):null,a.length?v.jsx("ul",{className:"slds-list_dotted audit-prose slds-m-top_x-small",children:a.map(h=>v.jsx("li",{className:"slds-m-bottom_xx-small",children:h},h))}):null,f?v.jsx(da,{className:"slds-m-top_xx-small",variant:"base",label:l?"Show less":"Show full summary","aria-expanded":l,onClick:()=>o(!l)}):null]})]})}const UR=n=>(xl[n]??n).split(" / ").pop()??n,HR=()=>Object.fromEntries(yo.map(n=>[n,0]));function qR({result:n,onNavigateCategory:a,onShowManualReview:l}){const o=Em(n),i=Nf.map(D=>({label:D,target:of[D],cells:n.pages.map(H=>({page:H,display:bo(H,D)?.display??"—",state:gR(H,D)}))})),f=i.flatMap(D=>D.cells),p=f.filter(D=>D.state==="pass").length,h=f.filter(D=>D.state==="warn").length,m=f.filter(D=>D.state==="fail").length,b=p+h+m,E=f.length-b,N=[`${p} pass`,...h?[`${h} warn`]:[],`${m} fail`,...E?[`${E} n/a`]:[]].join(" · "),C=n.catalog.categories.map(D=>{const H=o.filter(V=>zs(V)===D.id),Q=HR();for(const V of H)Q[V.severity??"info"]+=1;return{id:D.id,title:D.title,total:H.length,counts:Q,topLine:H[0]?.title??(D.ruleIds.length?"No confirmed findings":"No codified rules — coverage gap")}});return v.jsxs("div",{className:"audit-stack",children:[v.jsxs("div",{className:"slds-grid slds-wrap slds-gutters_small audit-row-stretch",children:[v.jsx("div",{className:Xe("slds-col slds-size_1-of-1",n.pages.length&&"slds-large-size_1-of-2"),children:v.jsx($R,{result:n,className:"audit-fill",onShowManualReview:l})}),n.pages.length?v.jsx("div",{className:"slds-col slds-size_1-of-1 slds-large-size_1-of-2",children:v.jsx(Za,{className:"audit-fill",heading:"Performance budget",icon:v.jsx(De,{category:"standard",name:"metrics",size:"small"}),headerActions:v.jsxs("span",{className:"slds-grid slds-grid_vertical-align-center audit-gap_x-small",children:[v.jsx("span",{className:"slds-text-body_small slds-text-color_weak slds-text-font_monospace",children:N}),v.jsx(PR,{label:"How the performance budget is scored",heading:"How each cell is scored",fit:!0,children:v.jsx(kR,{})})]}),bodyClassName:"slds-card__body_inner",children:v.jsxs("table",{className:"audit-budget","aria-label":"Performance budget by page",children:[v.jsx("thead",{children:v.jsxs("tr",{children:[v.jsx("th",{scope:"col",className:"audit-budget__metric",children:v.jsx("span",{className:"slds-assistive-text",children:"Metric"})}),n.pages.map(D=>v.jsx("th",{scope:"col",className:"slds-text-title_bold slds-truncate",children:UR(D.label)},D.label))]})}),v.jsx("tbody",{children:i.map(D=>v.jsxs("tr",{children:[v.jsxs("th",{scope:"row",className:"audit-budget__metric",children:[v.jsx("div",{className:"slds-text-title_bold",children:D.label}),v.jsxs("div",{className:"slds-text-body_small slds-text-color_weak",children:["≤ ",D.target]})]}),D.cells.map(H=>v.jsx("td",{children:v.jsx(GR,{display:H.display,state:H.state})},H.page.label))]},D.label))})]})})}):null]}),v.jsxs("section",{"aria-labelledby":"overview-categories",children:[v.jsx("h2",{id:"overview-categories",className:"slds-text-heading_small slds-m-bottom_small",children:"Findings by category"}),v.jsx("div",{className:"audit-tile-grid",children:C.map(D=>v.jsx(MR,{category:D,onSelect:()=>a(D.id)},D.id))})]}),n.pages.length?v.jsxs("section",{"aria-labelledby":"overview-pages",children:[v.jsx("h2",{id:"overview-pages",className:"slds-text-heading_small slds-m-bottom_small",children:"Critical entry pages"}),v.jsx("div",{className:"audit-tile-grid audit-tile-grid_wide",children:n.pages.map(D=>v.jsx(RO,{page:D},D.label))})]}):null,v.jsx(Za,{heading:"Highest-severity fixes, ranked",icon:v.jsx(De,{category:"standard",name:"task",size:"small"}),headerActions:v.jsx(Is,{}),children:o.length?v.jsxs("table",{className:"slds-table slds-table_cell-buffer slds-table_bordered slds-table_fixed-layout","aria-label":"Ranked fixes",children:[v.jsx("thead",{children:v.jsxs("tr",{className:"slds-line-height_reset",children:[v.jsx("th",{scope:"col",className:"audit-col_rank",children:v.jsx("div",{className:"slds-truncate",children:"#"})}),v.jsx("th",{scope:"col",children:v.jsx("div",{className:"slds-truncate",children:"Recommended fix"})}),v.jsx("th",{scope:"col",className:"audit-col_severity",children:v.jsx("div",{className:"slds-truncate",children:"Severity"})})]})}),v.jsx("tbody",{children:o.slice(0,6).map((D,H)=>v.jsxs("tr",{className:"slds-hint-parent",children:[v.jsx("td",{className:"slds-text-color_weak",children:H+1}),v.jsxs("th",{scope:"row",className:"slds-cell-wrap",children:[v.jsx("div",{children:D.remediation??D.title}),v.jsx("div",{className:Xe("slds-text-body_small slds-text-color_weak slds-truncate",(D.evidence[0]?.type??"source")==="source"&&"slds-text-font_monospace"),children:sf(D.evidence[0])||D.ruleId})]}),v.jsx("td",{children:v.jsx(Es,{severity:D.severity??"info",children:D.severity??"review"})})]},D.ruleId))})]}):v.jsx("p",{className:"slds-p-horizontal_medium slds-text-align_center slds-text-color_weak",children:"No ranked findings."})})]})}function kR(){return v.jsxs("div",{children:[v.jsxs("table",{className:"slds-table slds-table_bordered slds-no-row-hover audit-legend",children:[v.jsx("thead",{children:v.jsxs("tr",{className:"slds-line-height_reset",children:[v.jsx("th",{scope:"col",children:"Metric"}),v.jsx("th",{scope:"col",className:Xe("audit-tone-text",Ln("pass")),children:"Pass"}),v.jsx("th",{scope:"col",className:Xe("audit-tone-text",Ln("high")),children:"Warn"}),v.jsx("th",{scope:"col",className:Xe("audit-tone-text",Ln("critical")),children:"Fail"})]})}),v.jsx("tbody",{children:yR().map(n=>v.jsxs("tr",{children:[v.jsx("th",{scope:"row",className:"slds-text-title_bold",children:n.label}),v.jsx("td",{className:"slds-text-font_monospace",children:n.pass}),v.jsx("td",{className:"slds-text-font_monospace",children:n.warn}),v.jsx("td",{className:"slds-text-font_monospace",children:n.fail})]},n.label))})]}),v.jsx("p",{className:"slds-text-body_small slds-text-color_weak slds-m-top_small",children:"A fail is reported as a finding to fix before launch; a warn is over budget but within tolerance. Budgets are fixed audit-config thresholds, not per-run values."})]})}function GR({display:n,state:a}){return v.jsxs("div",{className:Xe("audit-budget__cell",Ln(a?ER(a):"info")),children:[v.jsx("span",{className:"audit-budget__value",children:n}),v.jsx("span",{className:"slds-assistive-text",children:a??"n/a"})]})}const KR=["critical","high","medium","low"];function AO({category:n,evaluations:a,icon:l="category"}){const o=a.filter(h=>h.disposition==="finding"),i=a.filter(h=>h.disposition==="not-verified").length,f=h=>o.filter(m=>m.severity===h).length,p=n.ruleIds.length;return v.jsx(Za,{heading:n.title,icon:v.jsx(De,{category:"standard",name:l,size:"small"}),bodyClassName:"slds-card__body_inner",children:v.jsxs("div",{className:"slds-grid slds-wrap slds-grid_vertical-align-center slds-gutters",children:[v.jsx("p",{className:"slds-col slds-size_1-of-1 slds-medium-size_7-of-12 audit-prose",children:p?`${p} codified ${p===1?"rule":"rules"}; ${o.length} ${o.length===1?"finding":"findings"}${i?`, ${i} need${i===1?"s":""} a manual review`:""}.`:"No codified rules for this category yet — this is a visible coverage gap, not a pass."}),v.jsx("ul",{className:"slds-col slds-size_1-of-1 slds-medium-size_5-of-12 slds-grid slds-grid_align-end audit-gap_large",children:KR.map(h=>v.jsxs("li",{children:[v.jsx("div",{className:"slds-text-title",children:h}),v.jsx("div",{className:Xe("slds-text-heading_medium audit-highlight",Ln(h)),children:f(h)})]},h))})]})})}function YR({items:n}){if(!n.length)return v.jsx("p",{className:"slds-text-color_weak",children:"No evidence supplied."});const a=new Map(n.map(l=>[`${sf(l)}
41
+ ${n.location}`:""}`}const TR={pass:"pass",warn:"high",fail:"critical"},Ln=n=>`audit-tone_${n}`,ER=n=>TR[n],Nm=n=>({"--audit-share":Math.max(0,Math.min(1,n))}),NR=n=>({"--audit-weight":n}),wR=n=>({"--audit-columns":n}),jR=n=>({"--audit-column":n});function CO(n){var a,l,o="";if(typeof n=="string"||typeof n=="number")o+=n;else if(typeof n=="object")if(Array.isArray(n)){var i=n.length;for(a=0;a<i;a++)n[a]&&(l=CO(n[a]))&&(o&&(o+=" "),o+=l)}else for(l in n)n[l]&&(o&&(o+=" "),o+=l);return o}function CR(){for(var n,a,l=0,o="",i=arguments.length;l<i;l++)(n=arguments[l])&&(a=CO(n))&&(o&&(o+=" "),o+=a);return o}function Xe(...n){return CR(n)}const RR="https://forms.gle/kJtg4Tfudxvqykri7";function Os({nav:n=[],active:a,onNavigate:l,banner:o,children:i}){return v.jsxs("div",{className:"audit-app",children:[o,v.jsx(El,{variant:"info",icon:v.jsx(De,{category:"utility",name:"info"}),labels:{heading:"Site Audit is in preview and under active development. Features and results may change."}}),v.jsxs(cm,{children:[v.jsx(bs,{region:"primary",children:v.jsxs("div",{className:"slds-context-bar__item slds-context-bar__dropdown-trigger slds-no-hover",children:[v.jsx("div",{className:"slds-context-bar__icon-action",children:v.jsx(De,{category:"standard",name:"dashboard",size:"small",assistiveText:{label:""}})}),v.jsx("span",{className:"slds-context-bar__label-action slds-context-bar__app-name",children:v.jsx("span",{className:"slds-truncate",children:"Site Audit"})})]})}),n.length?v.jsx(bs,{region:"secondary",navigation:!0,children:n.map(f=>v.jsx(fm,{id:`nav-${f.id}`,href:`#${f.id}`,label:f.count===void 0?f.label:`${f.label} (${f.count})`,active:f.id===a,onClick:()=>l?.(f.id)},f.id))}):null,v.jsx(bs,{region:"tertiary",children:v.jsx("div",{className:"slds-context-bar__item slds-no-hover audit-feedback",children:v.jsxs("a",{className:"slds-button slds-button_neutral",href:RR,target:"_blank",rel:"noreferrer",children:[v.jsx(De,{category:"utility",name:"comments",size:"xx-small",className:"slds-button__icon slds-button__icon_left"}),"Give feedback",v.jsx("span",{className:"slds-assistive-text",children:"(opens in a new tab)"})]})})})]}),v.jsx("div",{className:"audit-page",children:i})]})}function Is({children:n="AI analysis",className:a}){return v.jsx(xm,{className:Xe("audit-badge audit-badge_ai",a),iconAlignment:"left",icon:v.jsx(De,{category:"utility",name:"sparkles",size:"xx-small",className:"audit-badge__icon"}),content:n})}function AR(n){return n===void 0?"info":n>=90?"pass":n>=50?"high":"critical"}function wf({score:n,size:a="small",className:l}){const o=n===void 0?void 0:Math.round(n);return v.jsx("span",{role:"img","aria-label":o===void 0?"Performance score unavailable":`Performance score ${o} of 100`,className:Xe("audit-score",`audit-score_${a}`,Ln(AR(n)),l),style:Nm((n??0)/100),children:v.jsx("span",{className:"audit-score__value",children:o??"—"})})}function Vn({label:n,value:a,detail:l,ok:o,size:i="medium",className:f}){return v.jsxs("div",{className:Xe("audit-stat",f),children:[v.jsx("div",{className:"slds-text-title slds-truncate",children:n}),v.jsx("div",{className:Xe("audit-stat__value",i==="small"?"slds-text-heading_small":"slds-text-heading_medium",o!==void 0&&Xe("audit-stat__value_toned",Ln(o?"pass":"critical"))),children:a}),l?v.jsx("div",{className:"slds-text-body_small slds-text-color_weak",children:l}):null]})}function RO({page:n,selected:a,onSelect:l}){const o=v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"slds-media slds-media_center",children:[v.jsxs("div",{className:"slds-media__body slds-truncate",children:[v.jsx("div",{className:"slds-text-heading_small slds-truncate",children:xl[n.label]??n.label}),v.jsx("div",{className:"slds-text-body_small slds-text-color_weak slds-text-font_monospace slds-truncate",children:bR(n.url)})]}),v.jsx("div",{className:"slds-media__figure slds-media__figure_reverse",children:v.jsx(wf,{score:EO(n)})})]}),v.jsx("div",{className:"audit-metric-row slds-m-top_small",children:Nf.map(i=>v.jsx(Vn,{label:i,value:bo(n,i)?.display??"—",ok:DR(wO(n,i)),size:"small",className:"audit-metric-row__item"},i))})]});return l?v.jsx("button",{type:"button",onClick:l,"aria-pressed":a,className:Xe("audit-tile slds-box slds-box_link slds-theme_default",a&&"audit-tile_selected"),children:o}):v.jsx("article",{className:"audit-tile slds-box slds-theme_default",children:o})}const DR=n=>n===void 0?void 0:!n;function Es({severity:n,children:a,className:l}){return v.jsx(xm,{className:Xe("audit-badge",Ln(n),l),content:a})}function MR({category:n,onSelect:a}){const l=yo.filter(o=>n.counts[o]>0);return v.jsxs("button",{type:"button",onClick:a,className:"audit-tile slds-box slds-box_link slds-theme_default",children:[v.jsxs("div",{className:"slds-grid slds-grid_align-spread slds-grid_vertical-align-center",children:[v.jsx("span",{className:"slds-text-heading_small slds-truncate",children:n.title}),v.jsx("span",{className:"slds-text-heading_medium",children:n.total})]}),v.jsx("span",{className:"audit-segments slds-m-top_small","aria-hidden":"true",children:l.map(o=>v.jsx("span",{className:Xe("audit-segments__item",Ln(o)),style:NR(n.counts[o])},o))}),l.length?v.jsx("ul",{className:"slds-list_horizontal slds-has-dividers_right slds-m-top_x-small slds-text-body_small",children:l.map(o=>v.jsxs("li",{className:Xe("slds-item audit-tone-text",Ln(o)),children:[n.counts[o]," ",o]},o))}):null,v.jsx("p",{className:"audit-tile__footer slds-text-body_small slds-text-color_weak slds-truncate",children:n.topLine})]})}function PR({label:n,heading:a,align:l="bottom right",fit:o=!1,children:i}){return v.jsx(go,{align:l,heading:a,body:i,classNameBody:o?"audit-popover__body_fit":void 0,children:v.jsx(da,{assistiveText:{icon:n},iconCategory:"utility",iconName:"info",iconVariant:"bare",variant:"icon",title:n})})}const y_={"no-go":{label:"Not ready to launch",tone:"critical",icon:"error"},"go-with-fixes":{label:"Launch with fixes",tone:"high",icon:"warning"},go:{label:"Ready to launch",tone:"pass",icon:"success"}},LR=new Set(["critical","high","medium"]),b_=2,__=(n,a,l)=>`${n} ${n===1?a:l}`;function zR(n,a){return n?`${__(n,"critical finding blocks","critical findings block")} launch.`:a?`${__(a,"finding","findings")} to fix before launch; nothing blocks launch.`:"No findings need a fix before launch."}const IR=n=>n.split(new RegExp("(?<=[.!?])\\s+(?=[A-Z])"));function $R({result:n,className:a,onShowManualReview:l}){const o=Em(n),i=o.filter(b=>b.severity==="critical").length,f=o.filter(b=>LR.has(b.severity??"info")).length,p=n.evaluations.filter(b=>b.disposition==="pass").length,h=n.evaluations.filter(b=>b.disposition==="not-verified"),m=y_[n.summary?.guidance]??y_[aR(n.evaluations)];return v.jsxs(Za,{className:a,heading:"Launch readiness",icon:v.jsx(De,{category:"standard",name:"approval",size:"small"}),bodyClassName:"slds-card__body_inner audit-stack",children:[v.jsxs("div",{className:Xe("audit-verdict",Ln(m.tone)),role:"status",children:[v.jsx(De,{category:"utility",name:m.icon,size:"small"}),v.jsxs("div",{children:[v.jsx("h2",{className:"slds-text-heading_medium",children:m.label}),v.jsx("p",{className:"slds-text-body_regular",children:zR(i,f)})]})]}),v.jsxs("div",{className:"audit-metric-row",children:[v.jsx(Vn,{label:"To fix before launch",value:f,detail:"critical, high or medium",className:"audit-metric-row__item"}),v.jsx(Vn,{label:"Suggestions",value:o.length-f,detail:"low or info",className:"audit-metric-row__item"}),v.jsx(Vn,{label:"Passed",value:p,detail:"rules met",className:"audit-metric-row__item"}),v.jsx(Vn,{label:"Manual review",value:h.length?v.jsxs("span",{className:"slds-grid slds-grid_vertical-align-center audit-gap_x-small",children:[v.jsx(De,{category:"utility",name:"warning",size:"x-small",assistiveText:{label:"Needs attention"}}),h.length]}):0,detail:h.length?v.jsx("button",{type:"button",className:"slds-button_reset slds-text-link",onClick:l,children:"View in All Findings"}):"nothing to review",className:Xe("audit-metric-row__item",h.length&&Xe("audit-metric-row__item_attention",Ln("high")))})]}),n.summary?.narrative||n.summary?.highlights?.length?v.jsx(BR,{text:n.summary.narrative,highlights:n.summary.highlights??[]}):null]})}function BR({text:n,highlights:a}){const[l,o]=Pe.useState(!1),i=IR(n),f=!a.length&&i.length>b_,p=l||!f?n:i.slice(0,b_).join(" ");return v.jsxs("section",{className:"slds-media","aria-label":"AI summary",children:[v.jsx("div",{className:"slds-media__figure",children:v.jsx("img",{src:"/einstein.png",alt:"",width:360,height:549,draggable:!1,className:"audit-mascot"})}),v.jsxs("div",{className:"slds-media__body",children:[v.jsx(Is,{children:"AI summary"}),p?v.jsx("p",{className:"audit-prose slds-text-title_bold slds-m-top_x-small",children:p}):null,a.length?v.jsx("ul",{className:"slds-list_dotted audit-prose slds-m-top_x-small",children:a.map(h=>v.jsx("li",{className:"slds-m-bottom_xx-small",children:h},h))}):null,f?v.jsx(da,{className:"slds-m-top_xx-small",variant:"base",label:l?"Show less":"Show full summary","aria-expanded":l,onClick:()=>o(!l)}):null]})]})}const UR=n=>(xl[n]??n).split(" / ").pop()??n,HR=()=>Object.fromEntries(yo.map(n=>[n,0]));function qR({result:n,onNavigateCategory:a,onShowManualReview:l}){const o=Em(n),i=Nf.map(D=>({label:D,target:of[D],cells:n.pages.map(H=>({page:H,display:bo(H,D)?.display??"—",state:gR(H,D)}))})),f=i.flatMap(D=>D.cells),p=f.filter(D=>D.state==="pass").length,h=f.filter(D=>D.state==="warn").length,m=f.filter(D=>D.state==="fail").length,b=p+h+m,E=f.length-b,N=[`${p} pass`,...h?[`${h} warn`]:[],`${m} fail`,...E?[`${E} n/a`]:[]].join(" · "),C=n.catalog.categories.map(D=>{const H=o.filter(V=>zs(V)===D.id),Q=HR();for(const V of H)Q[V.severity??"info"]+=1;return{id:D.id,title:D.title,total:H.length,counts:Q,topLine:H[0]?.title??(D.ruleIds.length?"No confirmed findings":"No codified rules — coverage gap")}});return v.jsxs("div",{className:"audit-stack",children:[v.jsxs("div",{className:"slds-grid slds-wrap slds-gutters_small audit-row-stretch",children:[v.jsx("div",{className:Xe("slds-col slds-size_1-of-1",n.pages.length&&"slds-large-size_1-of-2"),children:v.jsx($R,{result:n,className:"audit-fill",onShowManualReview:l})}),n.pages.length?v.jsx("div",{className:"slds-col slds-size_1-of-1 slds-large-size_1-of-2",children:v.jsx(Za,{className:"audit-fill",heading:"Performance budget",icon:v.jsx(De,{category:"standard",name:"metrics",size:"small"}),headerActions:v.jsxs("span",{className:"slds-grid slds-grid_vertical-align-center audit-gap_x-small",children:[v.jsx("span",{className:"slds-text-body_small slds-text-color_weak slds-text-font_monospace",children:N}),v.jsx(PR,{label:"How the performance budget is scored",heading:"How each cell is scored",fit:!0,children:v.jsx(kR,{})})]}),bodyClassName:"slds-card__body_inner",children:v.jsxs("table",{className:"audit-budget","aria-label":"Performance budget by page",children:[v.jsx("thead",{children:v.jsxs("tr",{children:[v.jsx("th",{scope:"col",className:"audit-budget__metric",children:v.jsx("span",{className:"slds-assistive-text",children:"Metric"})}),n.pages.map(D=>v.jsx("th",{scope:"col",className:"slds-text-title_bold slds-truncate",children:UR(D.label)},D.label))]})}),v.jsx("tbody",{children:i.map(D=>v.jsxs("tr",{children:[v.jsxs("th",{scope:"row",className:"audit-budget__metric",children:[v.jsx("div",{className:"slds-text-title_bold",children:D.label}),v.jsxs("div",{className:"slds-text-body_small slds-text-color_weak",children:["≤ ",D.target]})]}),D.cells.map(H=>v.jsx("td",{children:v.jsx(GR,{display:H.display,state:H.state})},H.page.label))]},D.label))})]})})}):null]}),v.jsxs("section",{"aria-labelledby":"overview-categories",children:[v.jsx("h2",{id:"overview-categories",className:"slds-text-heading_small slds-m-bottom_small",children:"Findings by category"}),v.jsx("div",{className:"audit-tile-grid",children:C.map(D=>v.jsx(MR,{category:D,onSelect:()=>a(D.id)},D.id))})]}),n.pages.length?v.jsxs("section",{"aria-labelledby":"overview-pages",children:[v.jsx("h2",{id:"overview-pages",className:"slds-text-heading_small slds-m-bottom_small",children:"Critical entry pages"}),v.jsx("div",{className:"audit-tile-grid audit-tile-grid_wide",children:n.pages.map(D=>v.jsx(RO,{page:D},D.label))})]}):null,v.jsx(Za,{heading:"Highest-severity fixes, ranked",icon:v.jsx(De,{category:"standard",name:"task",size:"small"}),headerActions:v.jsx(Is,{}),children:o.length?v.jsxs("table",{className:"slds-table slds-table_cell-buffer slds-table_bordered slds-table_fixed-layout","aria-label":"Ranked fixes",children:[v.jsx("thead",{children:v.jsxs("tr",{className:"slds-line-height_reset",children:[v.jsx("th",{scope:"col",className:"audit-col_rank",children:v.jsx("div",{className:"slds-truncate",children:"#"})}),v.jsx("th",{scope:"col",children:v.jsx("div",{className:"slds-truncate",children:"Recommended fix"})}),v.jsx("th",{scope:"col",className:"audit-col_severity",children:v.jsx("div",{className:"slds-truncate",children:"Severity"})})]})}),v.jsx("tbody",{children:o.slice(0,6).map((D,H)=>v.jsxs("tr",{className:"slds-hint-parent",children:[v.jsx("td",{className:"slds-text-color_weak",children:H+1}),v.jsxs("th",{scope:"row",className:"slds-cell-wrap",children:[v.jsx("div",{children:D.remediation??D.title}),v.jsx("div",{className:Xe("slds-text-body_small slds-text-color_weak slds-truncate",(D.evidence[0]?.type??"source")==="source"&&"slds-text-font_monospace"),children:sf(D.evidence[0])||D.ruleId})]}),v.jsx("td",{children:v.jsx(Es,{severity:D.severity??"info",children:D.severity??"review"})})]},D.ruleId))})]}):v.jsx("p",{className:"slds-p-horizontal_medium slds-text-align_center slds-text-color_weak",children:"No ranked findings."})})]})}function kR(){return v.jsxs("div",{children:[v.jsxs("table",{className:"slds-table slds-table_bordered slds-no-row-hover audit-legend",children:[v.jsx("thead",{children:v.jsxs("tr",{className:"slds-line-height_reset",children:[v.jsx("th",{scope:"col",children:"Metric"}),v.jsx("th",{scope:"col",className:Xe("audit-tone-text",Ln("pass")),children:"Pass"}),v.jsx("th",{scope:"col",className:Xe("audit-tone-text",Ln("high")),children:"Warn"}),v.jsx("th",{scope:"col",className:Xe("audit-tone-text",Ln("critical")),children:"Fail"})]})}),v.jsx("tbody",{children:yR().map(n=>v.jsxs("tr",{children:[v.jsx("th",{scope:"row",className:"slds-text-title_bold",children:n.label}),v.jsx("td",{className:"slds-text-font_monospace",children:n.pass}),v.jsx("td",{className:"slds-text-font_monospace",children:n.warn}),v.jsx("td",{className:"slds-text-font_monospace",children:n.fail})]},n.label))})]}),v.jsx("p",{className:"slds-text-body_small slds-text-color_weak slds-m-top_small",children:"A fail is reported as a finding to fix before launch; a warn is over budget but within tolerance. Budgets are fixed audit-config thresholds, not per-run values."})]})}function GR({display:n,state:a}){return v.jsxs("div",{className:Xe("audit-budget__cell",Ln(a?ER(a):"info")),children:[v.jsx("span",{className:"audit-budget__value",children:n}),v.jsx("span",{className:"slds-assistive-text",children:a??"n/a"})]})}const KR=["critical","high","medium","low"];function AO({category:n,evaluations:a,icon:l="category"}){const o=a.filter(h=>h.disposition==="finding"),i=a.filter(h=>h.disposition==="not-verified").length,f=h=>o.filter(m=>m.severity===h).length,p=n.ruleIds.length;return v.jsx(Za,{heading:n.title,icon:v.jsx(De,{category:"standard",name:l,size:"small"}),bodyClassName:"slds-card__body_inner",children:v.jsxs("div",{className:"slds-grid slds-wrap slds-grid_vertical-align-center slds-gutters",children:[v.jsx("p",{className:"slds-col slds-size_1-of-1 slds-medium-size_7-of-12 audit-prose",children:p?`${p} codified ${p===1?"rule":"rules"}; ${o.length} ${o.length===1?"finding":"findings"}${i?`, ${i} need${i===1?"s":""} a manual review`:""}.`:"No codified rules for this category yet — this is a visible coverage gap, not a pass."}),v.jsx("ul",{className:"slds-col slds-size_1-of-1 slds-medium-size_5-of-12 slds-grid slds-grid_align-end audit-gap_large",children:KR.map(h=>v.jsxs("li",{children:[v.jsx("div",{className:"slds-text-title",children:h}),v.jsx("div",{className:Xe("slds-text-heading_medium audit-highlight",Ln(h)),children:f(h)})]},h))})]})})}function YR({items:n}){if(!n.length)return v.jsx("p",{className:"slds-text-color_weak",children:"No evidence supplied."});const a=new Map(n.map(l=>[`${sf(l)}
42
42
  ${Qp(l)}`,l]));return v.jsx("ul",{className:"slds-list_vertical-space",children:[...a].map(([l,o])=>v.jsxs("li",{className:"slds-item",children:[v.jsx("div",{className:Xe("slds-text-body_small slds-text-link",o.type==="source"&&"slds-text-font_monospace"),children:sf(o)}),Qp(o)?v.jsx("pre",{className:"audit-code slds-m-top_xx-small",children:Qp(o)}):null]},l))})}function Vu({label:n,options:a,value:l,onChange:o}){const i=a.find(f=>f.id===l)??a[0];return v.jsx(As,{variant:"readonly",labels:{label:n},options:a,selection:i?[i]:[],menuItemVisibleLength:7,events:{onSelect:(f,p)=>{const h=p.selection[0];h&&o(h.id)}}})}const DO=n=>n.split("`").map((a,l)=>l%2?v.jsx("code",{children:a},l):a),yr="all",O_="site-wide",MO=6,Fp=(n,a)=>n.kind==="evaluation"?`e:${n.item.ruleId}`:`o:${a}`,xs=n=>n.kind==="observation"?"info":n.item.severity??"info",Kh=n=>n.kind==="observation"?n.item.category:zs(n.item),Yh=n=>OR(n.item.evidence);function VR(n){return n.kind==="observation"?"Manual":n.item.disposition==="not-verified"?"Needs manual review":n.item.method==="script"?"Deterministic":"AI-evaluated"}const XR={pass:"pass","not-applicable":"n/a","not-verified":"not verified"},QR=[{id:"finding",label:"Findings"},{id:"not-verified",label:"Not verified"},{id:"pass",label:"Passed"},{id:"not-applicable",label:"Not applicable"},{id:"observation",label:"Observations"}],x_=n=>n.kind==="observation"?"observation":n.item.disposition,S_=new Map(yo.map((n,a)=>[n,a])),FR=n=>n.charAt(0).toUpperCase()+n.slice(1);function wm({result:n,evaluations:a,observations:l,heading:o="Findings",showCategoryFilter:i=!1,initialOutcome:f=yr}){const p=Pe.useMemo(()=>[...a.map(F=>({kind:"evaluation",item:F})),...l.map(F=>({kind:"observation",item:F}))],[a,l]),[h,m]=Pe.useState(yr),[b,E]=Pe.useState(f),[N,C]=Pe.useState(yr),[D,H]=Pe.useState(yr),[Q,V]=Pe.useState(new Set),he=[{id:yr,label:"All severities"},...yo.map(F=>({id:F,label:FR(F)}))],fe=Pe.useMemo(()=>[{id:yr,label:"All categories"},...[...new Set(p.map(Kh).filter(F=>!!F))].map(F=>({id:F,label:jO(n,F)}))],[p,n]),te=Pe.useMemo(()=>{const F=new Set(p.map(x_));return[{id:yr,label:"All outcomes"},...QR.filter(ge=>F.has(ge.id))]},[p]),me=Pe.useMemo(()=>{const F=new Set;let ge=!1;for(const je of p){const at=Yh(je);at.length?at.forEach(ae=>F.add(ae)):ge=!0}return[{id:yr,label:"Any page"},...[...F].map(je=>({id:je,label:xl[je]??je})),...ge?[{id:O_,label:"Site-wide"}]:[]]},[p]),Oe=Pe.useMemo(()=>p.filter(F=>b===yr||x_(F)===b).filter(F=>h===yr||xs(F)===h).filter(F=>!i||N===yr||Kh(F)===N).filter(F=>{if(D===yr)return!0;const ge=Yh(F);return D===O_?ge.length===0:ge.includes(D)}).toSorted((F,ge)=>(S_.get(xs(F))??99)-(S_.get(xs(ge))??99)||F.item.title.localeCompare(ge.item.title)),[p,b,h,N,D,i]),Te=F=>V(ge=>{const je=new Set(ge);return je.has(F)?je.delete(F):je.add(F),je});return v.jsxs(Za,{heading:`${o} (${p.length})`,icon:v.jsx(De,{category:"standard",name:"incident",size:"small"}),headerActions:v.jsxs("span",{className:"slds-text-body_small slds-text-color_weak",children:["Showing ",Oe.length," of ",p.length]}),children:[v.jsxs("div",{className:"audit-filters slds-p-horizontal_medium slds-p-bottom_small",children:[te.length>2?v.jsx(Vu,{label:"Outcome",options:te,value:b,onChange:E}):null,v.jsx(Vu,{label:"Severity",options:he,value:h,onChange:m}),i&&fe.length>1?v.jsx(Vu,{label:"Category",options:fe,value:N,onChange:C}):null,me.length>1?v.jsx(Vu,{label:"Page",options:me,value:D,onChange:H}):null]}),v.jsxs("table",{className:"slds-table slds-table_cell-buffer slds-table_bordered slds-table_fixed-layout","aria-label":o,children:[v.jsx("thead",{children:v.jsxs("tr",{className:"slds-line-height_reset",children:[v.jsx("th",{scope:"col",className:"audit-col_toggle",children:v.jsx("span",{className:"slds-assistive-text",children:"Expand row"})}),v.jsx("th",{scope:"col",className:"audit-col_severity",children:v.jsx("div",{className:"slds-truncate",children:"Severity"})}),v.jsx("th",{scope:"col",children:v.jsx("div",{className:"slds-truncate",children:"Finding"})}),v.jsx("th",{scope:"col",className:"audit-col_meta",children:v.jsx("div",{className:"slds-truncate",children:"Category"})}),v.jsx("th",{scope:"col",className:"audit-col_meta",children:v.jsx("div",{className:"slds-truncate",children:"Page"})}),v.jsx("th",{scope:"col",className:"audit-col_source",children:v.jsx("div",{className:"slds-truncate",children:"Source"})})]})}),v.jsxs("tbody",{children:[Oe.map((F,ge)=>v.jsx(ZR,{row:F,result:n,open:Q.has(Fp(F,ge)),onToggle:()=>Te(Fp(F,ge))},Fp(F,ge))),Oe.length===0?v.jsx("tr",{children:v.jsx("td",{colSpan:MO,className:"slds-text-align_center slds-text-color_weak slds-p-vertical_large",children:"No findings match the current filters."})}):null]})]})]})}function ZR({row:n,result:a,open:l,onToggle:o}){const i=Pe.useId(),f=n.kind==="evaluation"&&n.item.disposition==="pass",p=n.kind==="observation"?"observation":XR[n.item.disposition]??xs(n),h=n.kind==="evaluation"&&n.item.method==="ai",m=Yh(n),b=Kh(n),E=b?jO(a,b):"Cross-category",N=sf(n.item.evidence[0]),C=JR(m,a);return v.jsxs(Pe.Fragment,{children:[v.jsxs("tr",{className:Xe("slds-hint-parent",l&&"audit-row_open"),children:[v.jsx("td",{className:"audit-col_toggle",children:v.jsx(da,{assistiveText:{icon:l?"Collapse details":"Expand details"},iconCategory:"utility",iconName:l?"chevrondown":"chevronright",iconVariant:"bare",variant:"icon",onClick:o,"aria-expanded":l,"aria-controls":i})}),v.jsx("td",{children:v.jsx(Es,{severity:f?"pass":xs(n),children:p})}),v.jsx("th",{scope:"row",children:v.jsxs("div",{className:"slds-grid slds-grid_vertical-align-center audit-gap_x-small",children:[v.jsx("button",{type:"button",className:"slds-button audit-row-title slds-truncate",onClick:o,title:n.item.title,children:n.item.title}),h?v.jsx(Is,{children:"AI"}):null]})}),v.jsx("td",{children:v.jsx("div",{className:"slds-truncate",title:E,children:E})}),v.jsx("td",{children:v.jsx("div",{className:"slds-truncate",title:C,children:C})}),v.jsx("td",{children:v.jsx("div",{className:Xe("slds-truncate slds-text-body_small slds-text-color_weak",n.item.evidence[0]?.type==="source"&&"slds-text-font_monospace"),title:N,children:N||"—"})})]}),l?v.jsx("tr",{id:i,className:"audit-detail-row",children:v.jsx("td",{colSpan:MO,className:"slds-cell-wrap",children:v.jsxs("div",{className:"slds-grid slds-wrap slds-gutters slds-p-vertical_small",children:[v.jsxs("div",{className:"slds-col slds-size_1-of-1 slds-large-size_8-of-12",children:[n.kind==="evaluation"&&n.item.description?v.jsxs(v.Fragment,{children:[v.jsx("h4",{className:"slds-text-title_caps slds-m-bottom_x-small",children:"What this checks"}),v.jsx("p",{className:"audit-prose slds-m-bottom_medium",children:DO(n.item.description)}),v.jsx("h4",{className:"slds-text-title_caps slds-m-bottom_x-small",children:"Result"})]}):null,v.jsx("p",{className:"audit-prose",children:n.item.summary}),v.jsx("h4",{className:"slds-text-title_caps slds-m-top_medium slds-m-bottom_x-small",children:"Evidence"}),v.jsx(YR,{items:n.item.evidence}),n.kind==="evaluation"&&n.item.remediation?v.jsxs(v.Fragment,{children:[v.jsx("h4",{className:"slds-text-title_caps slds-m-top_medium slds-m-bottom_x-small",children:"Recommended fix"}),v.jsx("p",{className:"audit-prose",children:n.item.remediation})]}):null]}),v.jsx("div",{className:"slds-col slds-size_1-of-1 slds-large-size_4-of-12",children:v.jsx("div",{className:"slds-box slds-theme_default",children:v.jsxs("dl",{className:"slds-list_stacked",children:[n.kind==="evaluation"?v.jsx(Zp,{label:"Disposition",value:n.item.disposition}):null,n.kind==="evaluation"?v.jsx(Zp,{label:"Rule",value:n.item.ruleId,mono:!0}):null,v.jsx(Zp,{label:"Confidence",value:VR(n)})]})})})]})})}):null]})}function JR(n,a){if(!n.length)return"Site-wide";const l=a.pages.map(o=>o.label);return l.length>1&&l.every(o=>n.includes(o))?"All pages":n.map(o=>xl[o]??o).join(", ")}function Zp({label:n,value:a,mono:l}){return v.jsxs("div",{className:"slds-form-element slds-form-element_readonly slds-form-element_stacked",children:[v.jsx("dt",{className:"slds-form-element__label",children:n}),v.jsx("dd",{className:Xe("slds-form-element__control slds-form-element__static",l&&"slds-text-font_monospace"),children:a})]})}function Zi({children:n}){return v.jsx(nR,{theme:"light",icon:v.jsx(De,{category:"utility",name:"warning",colorVariant:"warning",size:"small",assistiveText:{label:"Caveat"}}),children:n})}const PO="performance/server-request-waterfall";function WR(n,a){const l=n.evaluations.find(i=>i.ruleId===PO),o=l?.waterfall?.pages.find(i=>i.page===a);return l&&o?{evaluation:l,waterfall:o}:void 0}function eA(n){const a=new Map(n.map(i=>[i.id,i])),l=new Map,o=i=>{const f=l.get(i);if(f!==void 0)return f;const p=a.get(i)?.after??[],h=p.length?1+Math.max(...p.map(o)):0;return l.set(i,h),h};for(const i of n)o(i.id);return l}function tA(n){const a=new Map(n.map(f=>[f.id,f])),l=new Map,o=f=>{const p=l.get(f);if(p)return p;let h=[];for(const b of a.get(f)?.after??[]){if(!a.get(b)?.blocking)continue;const E=o(b);E.length>h.length&&(h=E)}const m=[...h,f];return l.set(f,m),m};let i=[];for(const f of n)f.blocking&&o(f.id).length>i.length&&(i=o(f.id));return i}function nA(n){const a=new Map(n.map(l=>[l.id,l.kind]));return new Set(n.filter(l=>l.kind!=="render"&&l.blocking&&l.after.some(o=>a.get(o)!=="middleware")).map(l=>l.id))}const aA=n=>n.filter(a=>a.kind!=="render").length;function rA(n){const a=nA(n);return n.filter(l=>a.has(l.id)||l.opportunity).slice().sort((l,o)=>Number(a.has(o.id))-Number(a.has(l.id)))}const iA={parallelize:"Run in parallel","scapi-hook":"Combine with a SCAPI hook",stream:"Stream instead of awaiting"},lA=n=>n.opportunity?iA[n.opportunity]:"No change needed",Vh=n=>`${n.source.file}${n.source.line?`:${n.source.line}`:""}`,oA=n=>Vh(n).split("/").at(-1)??"";function sA({evaluation:n,waterfall:a,ttfb:l}){const{steps:o}=a,i=eA(o),f=Math.max(...i.values())+1,p=new Map(o.map(C=>[C.id,C.kind])),h=tA(o).filter(C=>p.get(C)!=="render").length,m=rA(o),b=o.filter(C=>C.opportunity).length,E=new Map(m.map((C,D)=>[C.id,D+1])),N=C=>o.find(D=>D.id===C)?.label??C;return v.jsxs("div",{className:"audit-stack",children:[v.jsxs("div",{className:"audit-explainer slds-text-body_regular",children:[v.jsxs("p",{className:"audit-prose",children:[v.jsx("strong",{children:"How this works."})," AI reads your storefront’s source code and traces the server-side calls each page makes while it renders: middleware, loaders and API requests. The chart places each call by round trip. Calls in the same column run in parallel, and each column to the right waits for an earlier call to finish. It shows order, not timing."]}),v.jsx("p",{className:"audit-prose slds-m-top_x-small",children:"Every awaited call in a chain adds a full round trip before the server can send the first HTML (the page shell), so fewer sequential round trips usually means a faster response. The aim is to keep blocking chains short: run independent calls in parallel and stream data the page doesn’t need right away. Some chains are necessary, when a call needs an earlier result."})]}),v.jsxs("header",{children:[v.jsx("h3",{className:"slds-text-heading_small",children:"Server requests"}),v.jsx("div",{className:"slds-text-body_small slds-text-font_monospace slds-text-color_weak",children:a.route}),v.jsxs("p",{className:"slds-text-body_regular audit-prose slds-m-top_x-small",children:[a.summary," ",v.jsx(Is,{})]})]}),n.disposition==="not-verified"?v.jsxs(Zi,{children:[v.jsx("strong",{children:"Some call sites could not be traced."})," ",n.summary]}):null,v.jsxs("div",{className:"audit-metric-row",children:[v.jsx(Vn,{label:"TTFB",value:l,detail:"measured, mobile cold",className:"audit-metric-row__item"}),v.jsx(Vn,{label:"Server calls",value:aA(o),detail:"traced from source",className:"audit-metric-row__item"}),v.jsx(Vn,{label:"Round trips before the shell",value:h,detail:"on the longest chain of awaited calls",className:"audit-metric-row__item"}),v.jsx(Vn,{label:"Suggestions",value:b,detail:"options to consider",className:"audit-metric-row__item"})]}),v.jsxs("div",{children:[v.jsxs("div",{className:"audit-waterfall__toolbar",children:[v.jsx("span",{className:"slds-text-title",children:"Calls by round trip"}),v.jsx(uA,{})]}),v.jsxs("div",{className:"audit-waterfall",style:wR(f),children:[v.jsxs("div",{className:"audit-waterfall__row audit-waterfall__head","aria-hidden":"true",children:[v.jsx("span",{children:"Call"}),v.jsx("span",{children:"Source"}),v.jsx("span",{className:"audit-waterfall__track",children:Array.from({length:f},(C,D)=>v.jsx("span",{children:D+1},D))})]}),v.jsx("ul",{"aria-label":"Server calls by round trip",children:o.map(C=>{const D=E.get(C.id),H=[`round trip ${(i.get(C.id)??0)+1}`,C.kind==="render"?"shell sent":C.blocking?"blocks the shell":"streamed",C.conditional??"",D?`call to review ${D}`:""].filter(Boolean);return v.jsxs("li",{className:"audit-waterfall__row","aria-label":`${C.label}: ${H.join(", ")}`,children:[v.jsxs("span",{className:"audit-waterfall__call",children:[v.jsxs("span",{className:"audit-waterfall__name",children:[v.jsx("span",{className:"slds-truncate",title:C.label,children:C.label}),D?v.jsx("span",{className:"audit-waterfall__marker",children:D}):null]}),C.conditional?v.jsx("span",{className:"audit-waterfall__condition slds-truncate",title:C.conditional,children:C.conditional}):null]}),v.jsx("span",{className:"audit-waterfall__source slds-truncate",title:Vh(C),children:oA(C)}),v.jsx("span",{className:"audit-waterfall__track",children:v.jsx("span",{className:Xe("audit-waterfall__bar",C.kind==="render"?"audit-waterfall__bar_shell":!C.blocking&&"audit-waterfall__bar_streamed",C.opportunity&&"audit-waterfall__bar_suggested"),style:jR((i.get(C.id)??0)+1)})})]},C.id)})})]})]}),m.length?v.jsxs("section",{"aria-labelledby":"waterfall-suggestions-heading",children:[v.jsx("h3",{id:"waterfall-suggestions-heading",className:"slds-text-heading_small",children:"Calls to review"}),v.jsx("p",{className:"slds-text-body_small slds-text-color_weak",children:"Chained calls that hold back the shell, and calls with a suggestion. Suggestions are options to consider, not required fixes."}),v.jsx("ol",{className:"audit-suggestions",children:m.map(C=>v.jsxs("li",{className:"audit-suggestions__item",children:[v.jsx("span",{className:"audit-waterfall__marker",children:E.get(C.id)}),v.jsxs("div",{className:"audit-suggestions__body",children:[v.jsxs("div",{className:"slds-text-body_regular",children:[v.jsx("strong",{children:lA(C)}),v.jsx("span",{className:"slds-text-color_weak",children:" · "}),v.jsx("span",{className:"slds-text-font_monospace",children:C.label})]}),C.note?v.jsx("p",{className:"slds-text-body_regular audit-prose",children:C.note}):null,v.jsxs("div",{className:"slds-text-body_small slds-text-color_weak",children:[v.jsx("span",{className:"slds-text-font_monospace",children:Vh(C)}),C.after.length?v.jsxs(v.Fragment,{children:[" · waits on ",C.after.map(N).join(", ")]}):null]})]})]},C.id))})]}):null]})}function uA(){const n=[{label:"Blocks the shell",className:""},{label:"Streamed after the shell",className:"audit-waterfall__bar_streamed"},{label:"Has a suggestion",className:"audit-waterfall__bar_suggested"},{label:"Shell sent",className:"audit-waterfall__bar_shell"}];return v.jsx("ul",{className:"slds-list_horizontal slds-wrap audit-gap_small slds-text-body_small slds-text-color_weak",children:n.map(a=>v.jsxs("li",{children:[v.jsx("span",{className:Xe("audit-waterfall__bar","audit-waterfall__swatch",a.className),"aria-hidden":"true"}),a.label]},a.label))})}const cA="performance/reduce-javascript-on-load",fA=2,T_=14e5,dA=12,pA=10,hA=6,Xh=n=>`${(n/1e6).toFixed(2)} MB`,mA={npm:"package",project:"project code",build:"added by the bundler"},vA={"lazy-component":"Load the component later","dynamic-import":"Import it when it's needed","narrower-import":"Import less of it",replace:"Replace it",remove:"Remove it from the client"},gA={interaction:"on interaction",visible:"when it scrolls into view",navigation:"with the route that uses it",idle:"after load, when the browser is idle"};function yA({result:n,label:a}){const l=n.bundle;if(l&&l.schemaVersion!==fA)return v.jsx("div",{className:"slds-p-around_medium",children:v.jsxs(Zi,{children:[v.jsx("strong",{children:"This run's bundle analysis is from an earlier version of the audit."})," Run the audit again to see it."]})});const o=l?.pages.find(i=>i.page===a);if(!l||!o){const i=l?.skipped.find(f=>f.page===a);return v.jsx("div",{className:"slds-p-around_medium",children:v.jsxs(Zi,{children:[v.jsx("strong",{children:"No bundle analysis for this page."})," ",i?.reason??(l?"The run's bundle analysis doesn't include this page.":"This run has no bundle analysis; runs prepared before it was added have none.")]})})}return v.jsxs("div",{className:"slds-p-around_medium audit-stack",children:[v.jsx(bA,{page:o}),v.jsx(_A,{bundle:l,page:o}),v.jsx(xA,{result:n,page:o})]})}function bA({page:n}){const{live:a}=n;return v.jsxs("section",{"aria-labelledby":"bundle-live",children:[v.jsxs("h3",{id:"bundle-live",className:"slds-text-heading_small",children:["Measured on the live site"," ",v.jsx("span",{className:"slds-text-body_small slds-text-color_weak",children:"first-party JavaScript · mobile · cold cache"})]}),v.jsx("p",{className:"slds-text-body_small slds-text-color_weak audit-prose slds-m-bottom_small",children:"Everything the storefront serves from its own bundle path (/mobify/bundle/), npm packages included, as the browser downloaded it. Tags such as analytics and pixels aren't counted."}),v.jsxs("div",{className:"audit-metric-row",children:[v.jsx(Vn,{label:"JavaScript size",value:Xh(a.decodedBytes),ok:a.decodedBytes<=T_,detail:`budget ${Xh(T_)}, uncompressed`,className:"audit-metric-row__item"}),v.jsx(Vn,{label:"Transferred",value:Ef(a.transferBytes),detail:"compressed, over the network",className:"audit-metric-row__item"}),v.jsx(Vn,{label:"Scripts",value:String(a.scripts),detail:a.beforeLoad===a.scripts?"all before the load event":`${a.beforeLoad} before the load event`,className:"audit-metric-row__item"})]})]})}function _A({bundle:n,page:a}){const l=n.build?.visualizer?Sm("/api/bundle/visualizer"):void 0,o=a.local,i=a.route?.ids.at(-1);let f;return o||(f=n.status==="unavailable"?"The project wasn't built, so there is no local analysis for this page. The notes above say why.":"This page's route wasn't found in the local build, so there is no local analysis for it."),v.jsxs("section",{className:"slds-border_top slds-p-top_medium audit-stack","aria-labelledby":"bundle-local",children:[v.jsxs("div",{children:[v.jsxs("div",{className:"slds-grid slds-grid_vertical-align-center slds-grid_align-spread audit-gap_small",children:[v.jsx("h3",{id:"bundle-local",className:"slds-text-heading_small",children:"Local build analysis"}),l?v.jsxs("a",{className:"slds-button slds-button_neutral",href:l,target:"_blank",rel:"noreferrer",children:["Open bundle visualizer",v.jsx(De,{category:"utility",name:"new_window",size:"xx-small",className:"slds-button__icon slds-button__icon_right"})]}):null]}),v.jsxs("p",{className:"slds-text-body_regular audit-prose slds-m-top_x-small",children:["Everything from here down comes from building the project folder on this machine, not from the live site. The live site may run other code, so these numbers won't match the measurements above exactly.",i?v.jsxs(v.Fragment,{children:[" ","The page is matched to the build by its route,"," ",v.jsx("span",{className:"slds-text-font_monospace",children:i}),a.route?.source==="url"?", found from its URL.":"."]}):null]})]}),n.notes.length?v.jsxs(Zi,{children:[n.status==="complete"?null:v.jsxs("p",{children:[v.jsx("strong",{children:"The local build analysis is incomplete."})," The live measurements above aren't affected."]}),v.jsx("ul",{className:"slds-list_dotted",children:n.notes.map(p=>v.jsx("li",{children:p},p))})]}):null,f||!o?v.jsx("p",{className:"slds-text-color_weak",children:f}):v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"audit-metric-row",children:[v.jsx(Vn,{label:"Loaded up front",value:Xh(o.bytes),detail:"minified, uncompressed",className:"audit-metric-row__item"}),v.jsx(Vn,{label:"Chunks",value:String(o.chunks),detail:"the entry, the page's routes and their static imports",className:"audit-metric-row__item"})]}),v.jsxs("div",{className:"slds-grid slds-wrap slds-gutters",children:[v.jsxs("section",{className:"slds-col slds-size_1-of-1 slds-large-size_1-of-2","aria-labelledby":"bundle-owners",children:[v.jsx("h4",{id:"bundle-owners",className:"slds-text-title_bold slds-m-bottom_small",children:"What it's made of"}),v.jsx(E_,{items:o.packages.slice(0,dA).map(p=>({key:p.name,name:p.name,bytes:p.bytes,detail:[mA[p.kind],p.versions?`${p.versions.length} versions bundled`:""].filter(Boolean).join(" · ")}))})]}),v.jsxs("section",{className:"slds-col slds-size_1-of-1 slds-large-size_1-of-2","aria-labelledby":"bundle-chunks",children:[v.jsx("h4",{id:"bundle-chunks",className:"slds-text-title_bold slds-m-bottom_small",children:"Largest chunks"}),v.jsx(E_,{items:o.largest.slice(0,pA).map(p=>({key:p.file,name:p.file,bytes:p.bytes,detail:p.owners.map(h=>h.name).join(", ")}))})]})]}),v.jsx(OA,{local:o,graph:n.status==="complete"})]})]})}function OA({local:n,graph:a}){return v.jsxs("section",{"aria-labelledby":"bundle-candidates",children:[v.jsx("h4",{id:"bundle-candidates",className:"slds-text-title_bold",children:"Imports that pull in the most code"}),v.jsx("p",{className:"slds-text-body_small slds-text-color_weak audit-prose",children:"Static imports in project code, by how much less the page would load up front if each one loaded later. Whether that's possible depends on when the page needs the code; see the recommendations below."}),a?n.candidates.length?v.jsx("ul",{className:"audit-suggestions",children:n.candidates.slice(0,hA).map(l=>v.jsx("li",{className:"audit-suggestions__item",children:v.jsxs("div",{className:"audit-suggestions__body",children:[v.jsxs("div",{className:"slds-text-body_regular",children:[v.jsx("span",{className:"slds-text-font_monospace",children:l.target}),v.jsxs("span",{className:"slds-text-color_weak",children:[" · ",Ef(l.savedBytes)]})]}),v.jsxs("div",{className:"slds-text-body_small slds-text-color_weak",children:["imported by"," ",v.jsxs("span",{className:"slds-text-font_monospace",children:[l.importer.file,l.importer.line?`:${l.importer.line}`:null]}),l.lazyElsewhere?v.jsxs(v.Fragment,{children:[" ","· already loaded lazily in"," ",v.jsx("span",{className:"slds-text-font_monospace",children:l.lazyElsewhere.join(", ")})]}):null]})]})},`${l.importer.file}
43
43
  ${l.target}`))}):v.jsx("p",{className:"slds-text-color_weak slds-m-top_small",children:"No single import in the project pulls 10 KB or more into this page."}):v.jsx("p",{className:"slds-text-color_weak slds-m-top_small",children:"Tracing imports needs the build's module graph; see the notes above."})]})}function E_({items:n}){const a=n[0]?.bytes??0;return v.jsx("ul",{className:"slds-list_vertical-space",children:n.map(l=>v.jsxs("li",{className:"slds-item",children:[v.jsxs("div",{className:"slds-grid slds-grid_align-spread audit-gap_small slds-text-body_small",children:[v.jsx("span",{className:"slds-truncate slds-text-font_monospace",title:l.name,children:l.name}),v.jsx("span",{className:"slds-no-flex slds-text-font_monospace slds-text-color_weak",children:Ef(l.bytes)})]}),v.jsx("div",{className:"audit-meter audit-meter_thin slds-m-top_xx-small",children:v.jsx("div",{className:Xe("audit-meter__fill",Ln("info")),style:Nm(a?l.bytes/a:0)})}),l.detail?v.jsx("div",{className:"slds-text-body_small slds-text-color_weak slds-truncate",children:l.detail}):null]},l.key))})}function xA({result:n,page:a}){const l=n.evaluations.find(h=>h.ruleId===cA),o=(l?.recommendations??[]).filter(h=>h.pages.includes(a.page)),i=h=>h.savings?.find(m=>m.page===a.page),f=(h,m)=>{const b=a.local?.candidates.find(E=>E.importer.file===h.file&&E.target===m)?.importer;return b&&(h.line??b.line)===b.line?b.excerpt:void 0};let p;return o.length||(p=l?l.disposition==="not-verified"||l.disposition==="pass"?l.summary:"The AI made no recommendations for this page.":"This run has no AI review of the local build."),v.jsxs("section",{className:"slds-border_top slds-p-top_medium","aria-labelledby":"bundle-recommendations",children:[v.jsxs("div",{className:"slds-grid slds-grid_vertical-align-center audit-gap_small",children:[v.jsx("h3",{id:"bundle-recommendations",className:"slds-text-heading_small",children:"Recommendations"}),v.jsx(Is,{children:"AI recommendations"})]}),v.jsx("p",{className:"slds-text-body_small slds-text-color_weak audit-prose slds-m-top_x-small",children:`Written by an AI agent that traced the local build's imports into the project source to find code this page loads up front but needs only later. Savings are measured on the local build ("up to" when part of the code stays). Review each one before you make it: they're options to consider, not required fixes.`}),p?v.jsx("p",{className:"slds-text-color_weak slds-m-top_small",children:p}):v.jsx("ol",{className:"audit-suggestions",children:o.map((h,m)=>{const b=i(h);return v.jsxs("li",{className:"audit-suggestions__item",children:[v.jsx("span",{className:"audit-waterfall__marker",children:m+1}),v.jsxs("div",{className:"audit-suggestions__body",children:[v.jsx("div",{className:"slds-text-body_regular",children:v.jsx("strong",{children:h.title})}),v.jsxs("div",{className:"slds-text-body_small slds-text-color_weak",children:[vA[h.change],h.trigger?` ${gA[h.trigger]}`:null,b?` · ${b.upTo?"up to ":""}${Ef(b.bytes)} less up front`:null," · ",v.jsx("span",{className:"slds-text-font_monospace",children:h.target})]}),v.jsx("p",{className:"slds-text-body_regular audit-prose",children:DO(h.how)}),h.files.map(E=>v.jsxs("div",{children:[v.jsxs("span",{className:"slds-text-body_small slds-text-font_monospace",children:[E.file,E.line?`:${E.line}`:null]}),f(E,h.target)?v.jsx("code",{className:"audit-code slds-show",children:f(E,h.target)}):null]},`${E.file}:${E.line??""}`))]})]},`${h.change}
44
44
  ${h.target}`)})})]})}const SA=[{id:"lighthouse",label:"Lighthouse"},{id:"server",label:"Server side rendering"},{id:"bundle",label:"Bundle size"}],LO=n=>xl[n.label]??n.label;function TA({result:n}){const a=n.catalog.categories.find(i=>i.id==="performance"),l=n.evaluations.filter(i=>zs(i)==="performance"),o=n.observations.filter(i=>i.category==="performance");return v.jsxs("div",{className:"audit-stack",children:[a?v.jsx(AO,{category:a,evaluations:l,icon:"performance"}):null,v.jsx(wm,{result:n,heading:"Performance findings",evaluations:l,observations:o}),v.jsx(EA,{result:n})]})}function EA({result:n}){const[a,l]=Pe.useState(0),[o,i]=Pe.useState(0),f=n.pages[a]??n.pages[0];return f?v.jsxs("section",{className:"audit-stack","aria-labelledby":"performance-diagnostics",children:[v.jsxs("div",{children:[v.jsxs("div",{className:"slds-grid slds-grid_vertical-align-end audit-gap_small slds-m-bottom_small",children:[v.jsx("h2",{id:"performance-diagnostics",className:"slds-text-heading_small",children:"Page diagnostics"}),v.jsx("span",{className:"slds-text-body_small slds-text-color_weak",children:"every view below is scoped to the selected entry page"})]}),v.jsx("div",{className:"audit-tile-grid audit-tile-grid_wide",children:n.pages.map((p,h)=>v.jsx(RO,{page:p,selected:h===a,onSelect:()=>l(h)},p.label))})]}),v.jsx(Za,{heading:`Diagnostics — ${LO(f)}`,icon:v.jsx(De,{category:"standard",name:"performance",size:"small"}),children:v.jsx(Sf,{id:"performance-views",selectedIndex:o,onSelect:p=>i(p),children:SA.map(p=>v.jsxs(Om,{label:p.label,children:[p.id==="lighthouse"?v.jsx(NA,{page:f}):null,p.id==="server"?v.jsx(wA,{result:n,page:f}):null,p.id==="bundle"?v.jsx(yA,{result:n,label:f.label}):null]},p.id))})})]}):v.jsx(Zi,{children:"Lighthouse was not run — no page diagnostics are available."})}function NA({page:n}){const a=jA(n),l=mR(n);return v.jsxs("div",{className:"slds-p-around_medium",children:[v.jsxs("div",{className:"slds-grid slds-grid_vertical-align-center slds-grid_align-spread slds-m-bottom_small",children:[v.jsxs("h3",{className:"slds-text-heading_small",children:["Lighthouse"," ",v.jsxs("span",{className:"slds-text-body_small slds-text-color_weak",children:["mobile · cold cache · v",n.playhouse.lighthouseVersion,l>0?v.jsxs("span",{title:l>1?`Playhouse ran Lighthouse ${l} times. This report and the metrics below come from the one run whose LCP is closest to the median.`:"Playhouse ran Lighthouse once for this page.",children:[" ","· ",l>1?`representative of ${l} runs`:"single run"]}):null]})]}),a?v.jsxs("a",{className:"slds-button slds-button_neutral",href:a,target:"_blank",rel:"noreferrer",children:["Open full report",v.jsx(De,{category:"utility",name:"new_window",size:"xx-small",className:"slds-button__icon slds-button__icon_right"})]}):null]}),v.jsxs("div",{className:"slds-box slds-theme_default slds-grid slds-grid_vertical-align-center audit-gap_large slds-m-bottom_small",children:[v.jsx(wf,{score:EO(n),size:"large"}),v.jsx("div",{className:"audit-metric-row slds-col",children:Nf.map(o=>{const i=wO(n,o);return v.jsx(Vn,{label:o,value:bo(n,o)?.display??"—",ok:i===void 0?void 0:!i,detail:`target ${of[o]}`,className:"audit-metric-row__item"},o)})})]}),a?v.jsx("iframe",{src:a,title:`Lighthouse report — ${LO(n)}`,sandbox:"allow-scripts allow-popups allow-popups-to-escape-sandbox",className:"audit-embed"}):v.jsxs("div",{className:"audit-embed audit-embed_empty slds-text-align_center",children:[v.jsx("div",{className:"slds-text-font_monospace slds-text-color_weak",children:"no Lighthouse report"}),v.jsx("p",{className:"slds-text-body_small slds-text-color_weak audit-prose",children:"This page's Playhouse archive has no Lighthouse HTML report, so there is nothing to embed."})]})]})}function wA({result:n,page:a}){const l=bo(a,"TTFB")?.display??"—",o=WR(n,a.label);return o?v.jsx("div",{className:"slds-p-around_medium",children:v.jsx(sA,{...o,ttfb:l},a.label)}):v.jsxs("div",{className:"slds-p-around_medium audit-stack",children:[v.jsx(Vn,{label:"TTFB (measured)",value:l}),v.jsxs(Zi,{children:[v.jsx("strong",{children:"Server request analysis was not supplied for this page."})," The"," ",v.jsx("code",{children:PO})," rule traces middleware and loader calls from source to show which server requests run in parallel and which are chained. TTFB above is the only measured server signal."]})]})}function jA(n){if(Tf(n.playhouse.artifacts["report-mobile-cold.html"])?.available===!0)return Sm(`/api/pages/${encodeURIComponent(n.label)}/report`)}function CA({result:n,id:a}){const l=n.catalog.categories.find(f=>f.id===a);if(!l)return null;const o=n.evaluations.filter(f=>zs(f)===a),i=n.observations.filter(f=>f.category===a);return v.jsxs("div",{className:"audit-stack",children:[v.jsx(AO,{category:l,evaluations:o}),l.ruleIds.length?v.jsx(wm,{result:n,evaluations:o,observations:i}):v.jsx(Zi,{children:"No codified rules. This is a visible coverage gap, not a pass."})]})}function RA({result:n,initialOutcome:a}){return v.jsx("div",{className:"audit-stack",children:v.jsx(wm,{result:n,heading:"All findings",evaluations:n.evaluations,observations:n.observations,showCategoryFilter:!0,initialOutcome:a})})}const AA=["critical","high","medium","low"],N_={"no-go":{label:"Not ready to launch",tone:"critical"},"go-with-fixes":{label:"Launch with fixes",tone:"high"},go:{label:"Ready to launch",tone:"pass"},unknown:{label:"Audit complete",tone:"info"}},zO=n=>String(n).padStart(2,"0"),jm=n=>`${Math.floor(n/6e4)}:${zO(Math.floor(n%6e4/1e3))}`,IO=n=>`${Math.floor(n/6e4)}m ${zO(Math.floor(n%6e4/1e3))}s`,$O=n=>new Date(n).toTimeString().slice(0,8);function DA(n,a){if(!n)return a;try{return new URL(n).host||a}catch{return a}}function MA(n,a){const[l,o]=Pe.useState(()=>Date.now());if(Pe.useEffect(()=>{if(a||!n)return;const f=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(f)},[n,a]),!n)return 0;const i=a?new Date(a).getTime():l;return Math.max(0,i-new Date(n).getTime())}function w_({model:n,onOpenReport:a,connectionLost:l=!1}){const o=n.status==="complete",i=n.steps.length,f=n.status==="error",p=MA(n.startedAt,o||f?n.completedAt:void 0),h=n.steps[n.activeIndex]?.title??"Preparing…",m=i?`Step ${Math.min(n.activeIndex+1,i)} of ${i}`:"Preparing…";return v.jsxs(Os,{banner:f?v.jsx(PA,{message:n.error}):l?v.jsx(LA,{}):void 0,children:[v.jsx(zA,{model:n,isDone:o,elapsedMs:p,onOpenReport:a}),v.jsxs("main",{className:"slds-m-top_medium audit-stack",children:[o?v.jsx($A,{model:n,elapsedMs:p}):v.jsxs(Za,{heading:h,icon:v.jsx(De,{category:"standard",name:"timeslot",size:"small"}),headerActions:v.jsx("span",{className:"slds-text-body_small slds-text-color_weak",children:m}),bodyClassName:"slds-card__body_inner",children:[v.jsx(Of,{value:i?n.stepsComplete/i*100:0,radius:"circular",thickness:"small",assistiveText:{progress:"Audit progress"}}),v.jsxs("div",{className:"slds-grid slds-grid_align-spread slds-wrap audit-gap_small slds-m-top_x-small slds-text-body_small slds-text-color_weak",children:[v.jsxs("span",{children:["Elapsed"," ",v.jsx("span",{className:"slds-text-font_monospace slds-text-color_default",children:jm(p)})]}),v.jsx("span",{children:"This page updates live. You can keep working in your terminal."})]})]}),v.jsxs("div",{className:"slds-grid slds-wrap slds-gutters_small",children:[v.jsx("div",{className:"slds-col slds-size_1-of-1 slds-large-size_8-of-12",children:v.jsx(Za,{heading:"Audit steps",icon:v.jsx(De,{category:"standard",name:"task",size:"small"}),headerActions:v.jsxs("span",{className:"slds-text-body_small slds-text-color_weak",children:[n.stepsComplete," of ",i," complete"]}),children:v.jsx("ul",{className:"slds-has-dividers_top",children:n.steps.map(b=>v.jsx(UA,{step:b,elapsedMs:p,startedAtRun:n.startedAt},b.id))})})}),v.jsxs("aside",{className:"slds-col slds-size_1-of-1 slds-large-size_4-of-12 audit-stack",children:[v.jsx(GA,{model:n}),v.jsx(YA,{logs:n.logs,isDone:o})]})]})]})]})}function PA({message:n}){return v.jsx(El,{variant:"error",icon:v.jsx(De,{category:"utility",name:"error"}),labels:{heading:`The audit stopped with an error${n?`: ${n}`:"."}`},className:"audit-banner"})}function LA(){return v.jsx(El,{variant:"error",icon:v.jsx(De,{category:"utility",name:"error"}),labels:{heading:"Connection to the audit server lost. This page has stopped updating. It will resume automatically if the server comes back — if the audit was running in an AI assistant's terminal, that process may have stopped."},className:"audit-banner"})}function zA({model:n,isDone:a,elapsedMs:l,onOpenReport:o}){const i=DA(n.target?.url,"storefront"),f=[...n.target?.env?[{label:"Env",content:n.target.env}]:[],...n.target?.commit?[{label:"Commit",content:v.jsx("span",{className:"slds-text-font_monospace",children:n.target.commit})}]:[],...n.startedAt?[{label:"Started",content:$O(n.startedAt)}]:[],{label:"Elapsed",content:v.jsx("span",{className:"slds-text-font_monospace",children:jm(l)})},...AA.map(p=>({label:`${p.charAt(0).toUpperCase()}${p.slice(1)}`,content:v.jsx("span",{className:Xe("audit-highlight",Ln(p)),children:n.counts[p]})}))];return v.jsx(Ls,{variant:"record-home",icon:v.jsx(De,{category:"standard",name:"dashboard",assistiveText:{label:"Audit"}}),label:"Pre-Launch Site Audit",title:i,details:f,onRenderActions:()=>v.jsxs(v.Fragment,{children:[v.jsx(Gh,{children:v.jsx(IA,{isDone:a,error:n.status==="error"})}),a?v.jsx(Gh,{children:v.jsx("a",{className:"slds-button slds-button_brand",href:"#report",onClick:o,children:"Open report"})}):null]})})}function IA({isDone:n,error:a}){return a?v.jsx(Es,{severity:"critical",children:"Error"}):n?v.jsx(Es,{severity:"pass",children:"Complete"}):v.jsx(xm,{className:"audit-badge audit-badge_live",content:v.jsx("span",{className:"audit-live",children:"Running"})})}function $A({model:n,elapsedMs:a}){const l=N_[n.guidance??"unknown"]??N_.unknown,o=n.finalScores.length,i=`${n.counts.critical} critical and ${n.counts.high} major findings open${o?` across ${o} entry page${o===1?"":"s"}`:""}. Audit finished in ${IO(a)}.`;return v.jsx(Za,{heading:"Audit complete",icon:v.jsx(De,{category:"standard",name:"approval",size:"small"}),bodyClassName:"slds-card__body_inner",children:v.jsxs("div",{className:"slds-grid slds-wrap slds-grid_vertical-align-center slds-grid_align-spread audit-gap_large",children:[v.jsxs("div",{className:"slds-col",children:[v.jsx("h2",{className:Xe("slds-text-heading_medium audit-tone-text",Ln(l.tone)),children:l.label}),v.jsx("p",{className:"audit-prose slds-m-top_xx-small",children:i})]}),v.jsx("ul",{className:"slds-grid slds-wrap audit-gap_large",children:n.finalScores.map(f=>v.jsxs("li",{className:"slds-grid slds-grid_vertical-align-center audit-gap_x-small",children:[v.jsx(wf,{score:f.score}),v.jsx("span",{className:"slds-text-title_bold",children:f.label})]},f.label))})]})})}function BA({state:n}){return n==="done"?v.jsx(De,{category:"utility",name:"success",colorVariant:"success",size:"x-small",assistiveText:{label:"Done"}}):n==="running"?v.jsx("span",{className:"audit-step__spinner",children:v.jsx(vo,{size:"x-small",variant:"brand",assistiveText:{label:"Running"}})}):v.jsx("span",{className:"audit-step__pending","aria-label":"Pending",role:"img"})}function UA({step:n,elapsedMs:a,startedAtRun:l}){const o=n.state==="running",i=o&&n.startedAt&&l?a-(new Date(n.startedAt).getTime()-new Date(l).getTime()):0,f=n.state==="done"&&n.durationMs!==void 0?IO(n.durationMs):o?jm(Math.max(0,i)):"";return v.jsx("li",{className:Xe("slds-item audit-step",o&&"audit-step_active"),children:v.jsxs("div",{className:"slds-media",children:[v.jsx("div",{className:"slds-media__figure audit-step__icon",children:v.jsx(BA,{state:n.state})}),v.jsxs("div",{className:"slds-media__body",children:[v.jsxs("div",{className:"slds-grid slds-grid_align-spread audit-gap_small",children:[v.jsxs("div",{children:[v.jsx("div",{className:Xe("slds-text-title_bold",n.state==="pending"&&"slds-text-color_weak"),children:n.title}),n.detail?v.jsx("div",{className:"slds-text-body_small slds-text-color_weak",children:n.detail}):null]}),f?v.jsx("span",{className:Xe("slds-no-flex slds-text-font_monospace slds-text-body_small",o?"slds-text-link":"slds-text-color_weak"),children:f}):null]}),n.score!==void 0||n.metrics?.length?v.jsx(HA,{step:n}):null,n.rules?v.jsx(qA,{rules:n.rules}):null,o&&n.score===void 0&&!n.rules?v.jsx("p",{className:"slds-text-body_small slds-text-color_weak slds-m-top_x-small",children:"Collecting evidence…"}):null,n.state==="done"&&n.summary?v.jsx("p",{className:"slds-text-body_small slds-text-color_weak slds-m-top_x-small",children:n.summary}):null]})]})})}function HA({step:n}){return v.jsxs("div",{className:"slds-grid slds-grid_vertical-align-center audit-gap_large slds-m-top_small",children:[v.jsx(wf,{score:n.score}),v.jsx("div",{className:"audit-metric-row slds-col",children:(n.metrics??[]).map(a=>v.jsx(Vn,{label:a.key,value:a.value,ok:!a.bad,size:"small",className:"audit-metric-row__item"},a.key))})]})}function qA({rules:n}){return v.jsx("ul",{className:"audit-tile-grid audit-tile-grid_compact slds-m-top_small",children:n.categories.map(a=>v.jsx(kA,{category:a},a.name))})}function kA({category:n}){const a=n.total?Math.min(1,n.evaluated/n.total):0;return v.jsxs("li",{children:[v.jsxs("div",{className:"slds-grid slds-grid_align-spread audit-gap_x-small slds-text-body_small",children:[v.jsx("span",{className:Xe(a>0?"slds-text-title_bold":"slds-text-color_weak"),children:n.name}),v.jsxs("span",{className:"slds-text-font_monospace slds-text-color_weak",children:[n.evaluated,"/",n.total]})]}),v.jsx("div",{className:"audit-meter audit-meter_thin slds-m-vertical_xx-small",children:v.jsx("div",{className:Xe("audit-meter__fill",Ln(a>=1?"pass":"medium")),style:Nm(a)})}),v.jsx("div",{className:Xe("slds-text-body_small",n.flagged?Xe("audit-tone-text",Ln("high")):"slds-text-color_weak"),children:n.flagged?`${n.flagged} flagged`:a>=1?"no issues":" "})]})}function GA({model:n}){const a=n.findings.slice(-6).toReversed(),l=n.findings.length,o=l?l>a.length?`${l} found · showing latest ${a.length}`:`${l} found`:"";return v.jsx(Za,{heading:"Latest findings",icon:v.jsx(De,{category:"standard",name:"incident",size:"small"}),headerActions:v.jsx("span",{className:"slds-text-body_small slds-text-color_weak",children:o}),footer:v.jsx("span",{className:"slds-text-body_small slds-text-color_weak",children:"Preliminary. Severities are confirmed when the report compiles."}),children:a.length===0?v.jsx("p",{className:"slds-p-horizontal_medium slds-text-color_weak",children:"Nothing flagged yet. Findings appear here as each check completes."}):v.jsx("ul",{className:"slds-has-dividers_top-space",children:a.map(i=>v.jsx(KA,{finding:i},i.id))})})}function KA({finding:n}){return v.jsx("li",{className:"slds-item audit-feed-item",children:v.jsxs("div",{className:"slds-media",children:[v.jsx("div",{className:"slds-media__figure audit-feed-item__severity",children:v.jsx(Es,{severity:n.severity,children:n.severity})}),v.jsxs("div",{className:"slds-media__body",children:[v.jsx("div",{children:n.title}),v.jsx("div",{className:"slds-text-body_small slds-text-color_weak",children:[n.category,n.source].filter(Boolean).join(" · ")})]})]})})}function YA({logs:n,isDone:a}){const l=n.map((i,f)=>({...i,position:f})).slice(-14),o=Pe.useRef(null);return Pe.useEffect(()=>{const i=o.current;i&&(i.scrollTop=i.scrollHeight)},[n]),v.jsx(Za,{heading:"Activity",icon:v.jsx(De,{category:"standard",name:"logging",size:"small"}),headerActions:v.jsx("span",{className:Xe("audit-live slds-text-body_small slds-text-font_monospace",a&&"audit-live_done"),children:a?"finished":"live"}),children:v.jsx("div",{ref:o,className:"audit-log",children:v.jsx("ol",{className:"audit-log__list",children:l.map(i=>v.jsxs("li",{className:"audit-log__line",children:[v.jsx("span",{className:"audit-log__time",children:$O(i.at)}),v.jsx("span",{className:`audit-log__message audit-log__message_${i.level}`,children:i.message})]},i.position))})})})}function BO(){const[n,a]=Pe.useState([]);Pe.useEffect(()=>{fetch("/api/runs").then(p=>p.ok?p.json():[]).then(a).catch(()=>a([]))},[]);const[l]=n;if(n.length<2||!l)return null;const o=l.id,i=_l??o,f=async()=>{if(!window.confirm(`Delete the run from ${d_(i)}? Its report and collected evidence are removed from disk.`))return;const p=await fetch(`/api/runs/${encodeURIComponent(i)}`,{method:"DELETE"});if(p.ok){p_(void 0);return}const{error:h}=await p.json();window.alert(`The run could not be deleted: ${h??p.statusText}`)};return v.jsxs("div",{className:"slds-grid slds-grid_vertical-align-center audit-gap_x-small",children:[v.jsx("div",{className:"slds-select_container",children:v.jsx("select",{className:"slds-select","aria-label":"Run",value:i,onChange:p=>p_(p.target.value===o?void 0:p.target.value),children:n.map(p=>v.jsxs("option",{value:p.id,children:[d_(p.id),p.id===o?" (latest)":p.complete?"":" (unfinished)"]},p.id))})}),i===o?null:v.jsx(da,{variant:"destructive",label:"Delete run",onClick:()=>{f()}})]})}const VA=["critical","high","medium","low"];function XA(){const n=lR(),[a,l]=Pe.useState(!1);return n.status==="loading"?v.jsx(Os,{children:v.jsx(vo,{size:"medium",variant:"brand",assistiveText:{label:"Loading audit"}})}):n.status==="error"?v.jsx(Os,{children:v.jsx(El,{variant:"error",icon:v.jsx(De,{category:"utility",name:"error"}),labels:{heading:`Failed to load audit: ${n.message}`}})}):n.status==="unfinished"?v.jsx(Os,{children:v.jsxs("main",{className:"slds-m-top_medium audit-stack",children:[v.jsx(BO,{}),v.jsx(Zi,{children:"This run did not finish, so it has no report."})]})}):n.status==="running"?v.jsx(w_,{model:n.model,connectionLost:n.connectionLost}):n.status==="complete"&&n.model.hasRun&&!a?v.jsx(w_,{model:n.model,connectionLost:n.connectionLost,onOpenReport:()=>l(!0)}):v.jsx(QA,{result:n.result})}function Jp(n){return n==="performance"?"performance":`category-${dR(n)}`}function QA({result:n}){const a=Em(n),l=C=>a.filter(D=>D.severity===C).length,o=C=>a.filter(D=>zs(D)===C).length,i=n.catalog.categories.filter(C=>C.id!=="performance"),f=[{id:"overview",label:"Overview"},{id:"performance",label:"Performance",count:o("performance")},...i.map(C=>({id:Jp(C.id),label:C.title,count:o(C.id)})),{id:"all-findings",label:"All Findings",count:a.length}],[p,h]=Pe.useState("overview"),[m,b]=Pe.useState(),E=(C,D)=>{b(D),h(C)},N=i.find(C=>Jp(C.id)===p);return v.jsxs(Os,{nav:f,active:p,onNavigate:C=>E(C),children:[p==="overview"?v.jsx(Ls,{variant:"record-home",icon:v.jsx(De,{category:"standard",name:"dashboard",assistiveText:{label:"Audit"}}),label:"Pre-Launch Site Audit",title:n.project.name??"storefront",onRenderActions:()=>v.jsx(Gh,{children:v.jsx(BO,{})}),details:[{label:"Generated",content:fR(n.run.generatedAt)},{label:"Tool version",content:`v${n.run.toolVersion}`},...VA.map(C=>({label:C.charAt(0).toUpperCase()+C.slice(1),content:v.jsx("span",{className:Xe("audit-highlight",Ln(C)),children:l(C)})}))]}):null,v.jsxs("main",{className:Xe(p==="overview"&&"slds-m-top_medium"),children:[p==="overview"?v.jsx(qR,{result:n,onNavigateCategory:C=>E(Jp(C)),onShowManualReview:()=>E("all-findings","not-verified")}):null,p==="performance"?v.jsx(TA,{result:n}):null,N?v.jsx(CA,{result:n,id:N.id}):null,p==="all-findings"?v.jsx(RA,{result:n,initialOutcome:m},m):null]})]})}const UO=document.getElementById("root");if(!UO)throw new Error("The dashboard page has no #root element");ES.createRoot(UO).render(v.jsx(Pe.StrictMode,{children:v.jsx(tR,{standardSprite:NS,utilitySprite:wS,children:v.jsx(XA,{})})}));
@@ -4,7 +4,7 @@
4
4
  <meta charset="utf-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <title>Site Audit</title>
7
- <script type="module" crossorigin src="/assets/index-aSdbHIeq.js"></script>
7
+ <script type="module" crossorigin src="/assets/index-DM8l6IcE.js"></script>
8
8
  <link rel="stylesheet" crossorigin href="/assets/index-CtE_JUcs.css">
9
9
  </head>
10
10
  <body>
package/dist/audit.js CHANGED
@@ -1,9 +1,8 @@
1
- import { n as VERSION, t as AUDIT_ROOT } from "./assets.js";
1
+ import { S as VERSION, a as evidenceSchema, b as sanitizeUrl, c as validateAuditResult, d as validateWaterfall, g as runIdFor, h as runDir, i as evaluationSchema, l as validateEvidence, n as SEVERITY_ORDER, o as parsePrepared, p as latestRunDir, r as auditResultSchema, t as LIGHTHOUSE_REPORT, u as validateRecommendations, v as sanitizeJsonValue, x as AUDIT_ROOT, y as sanitizeText } from "./results.js";
2
2
  import { n as discoverCatalog, t as defaultCategoriesDir } from "./catalog.js";
3
3
  import { i as perfFromSummary } from "./measured-run.js";
4
- import { n as sanitizeText, r as sanitizeUrl, t as sanitizeJsonValue } from "./sanitize.js";
5
4
  import { i as BUNDLE_VISUALIZER, n as BUNDLE_DIR, o as bundleAnalysisSchema, r as BUNDLE_SCHEMA_VERSION, t as BUNDLE_ANALYSIS } from "./schema.js";
6
- import { S as runIdFor, _ as validateWaterfall, c as SEVERITY_ORDER, d as evidenceSchema, f as parsePrepared, g as validateRecommendations, h as validateEvidence, i as latestRunEvents, l as auditResultSchema, m as validateAuditResult, o as readEvents, s as LIGHTHOUSE_REPORT, t as appendEvent, u as evaluationSchema, x as runDir, y as latestRunDir } from "./events.js";
5
+ import { i as latestRunEvents, o as readEvents, t as appendEvent } from "./events.js";
7
6
  import { a as parseRouterManifest, i as parseChunk, n as lexerReady, o as parseVisualizerHtml, r as moduleIdResolver, t as readLivePage } from "./live.js";
8
7
  import { createRequire } from "node:module";
9
8
  import { promisify } from "node:util";
package/dist/catalog.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as AUDIT_ROOT } from "./assets.js";
1
+ import { x as AUDIT_ROOT } from "./results.js";
2
2
  import path from "node:path";
3
3
  import { readFile, readdir } from "node:fs/promises";
4
4
  import { z } from "zod";
@@ -1,13 +1,14 @@
1
1
  import "../../package.js";
2
2
  import { r as commonFlags } from "../../flags.js";
3
- import "../../assets.js";
3
+ import "../../results.js";
4
4
  import { n as discoverCatalog, t as defaultCategoriesDir } from "../../catalog.js";
5
- import "../../sanitize.js";
5
+ import "../../schema.js";
6
6
  import { i as AuditCommand, t as text } from "../../flags2.js";
7
7
 
8
8
  //#region src/commands/audit/catalog.ts
9
9
  var Catalog = class Catalog extends AuditCommand {
10
10
  static hidden = true;
11
+ static reportsUsage = false;
11
12
  static summary = "Inspect the discovered category and rule catalog";
12
13
  static examples = ["<%= config.bin %> <%= command.id %>"];
13
14
  static flags = {
@@ -1,14 +1,13 @@
1
1
  import "../../package.js";
2
2
  import { r as commonFlags } from "../../flags.js";
3
- import "../../assets.js";
3
+ import "../../results.js";
4
4
  import "../../catalog.js";
5
5
  import "../../measured-run.js";
6
6
  import { n as finalize } from "../../audit.js";
7
- import "../../sanitize.js";
8
7
  import "../../schema.js";
9
8
  import "../../events.js";
10
9
  import "../../live.js";
11
- import { i as AuditCommand, n as workspaceFlag, r as workspaceFor, t as text } from "../../flags2.js";
10
+ import { a as finalizedAttributes, i as AuditCommand, n as workspaceFlag, r as workspaceFor, t as text } from "../../flags2.js";
12
11
 
13
12
  //#region src/commands/audit/finalize.ts
14
13
  var Finalize = class Finalize extends AuditCommand {
@@ -30,11 +29,13 @@ var Finalize = class Finalize extends AuditCommand {
30
29
  };
31
30
  async run() {
32
31
  const { flags } = await this.parse(Finalize);
33
- this.log(await finalize({
32
+ const resultPath = await finalize({
34
33
  workspace: workspaceFor(flags),
35
34
  categories: flags.categories,
36
35
  events: flags.events
37
- }));
36
+ });
37
+ await this.track("AUDIT_FINALIZED", () => finalizedAttributes(resultPath));
38
+ this.log(resultPath);
38
39
  }
39
40
  };
40
41
 
@@ -1,14 +1,13 @@
1
1
  import "../../package.js";
2
2
  import { n as PROJECT_DIRECTORY_FLAG, r as commonFlags } from "../../flags.js";
3
- import "../../assets.js";
3
+ import "../../results.js";
4
4
  import "../../catalog.js";
5
5
  import "../../measured-run.js";
6
6
  import { r as prepare } from "../../audit.js";
7
- import "../../sanitize.js";
8
7
  import "../../schema.js";
9
8
  import "../../events.js";
10
9
  import "../../live.js";
11
- import { i as AuditCommand, t as text } from "../../flags2.js";
10
+ import { i as AuditCommand, o as preparedAttributes, t as text } from "../../flags2.js";
12
11
  import { Flags } from "@oclif/core";
13
12
 
14
13
  //#region src/commands/audit/prepare.ts
@@ -65,7 +64,7 @@ var Prepare = class Prepare extends AuditCommand {
65
64
  };
66
65
  async run() {
67
66
  const { flags } = await this.parse(Prepare);
68
- this.log(await prepare({
67
+ const preparedPath = await prepare({
69
68
  urls: flags.url,
70
69
  archives: flags.archive,
71
70
  expectedPages: flags["expected-page"],
@@ -76,7 +75,12 @@ var Prepare = class Prepare extends AuditCommand {
76
75
  categories: flags.categories,
77
76
  events: flags.events,
78
77
  build: flags.build
78
+ });
79
+ await this.track("AUDIT_PREPARED", () => preparedAttributes(preparedPath, {
80
+ runs: flags.runs,
81
+ build: flags.build
79
82
  }));
83
+ this.log(preparedPath);
80
84
  }
81
85
  };
82
86
 
@@ -1,12 +1,11 @@
1
1
  import "../../package.js";
2
2
  import { r as commonFlags } from "../../flags.js";
3
- import "../../assets.js";
3
+ import { p as latestRunDir } from "../../results.js";
4
4
  import "../../catalog.js";
5
5
  import "../../measured-run.js";
6
6
  import { t as eventsFileFor } from "../../audit.js";
7
- import "../../sanitize.js";
8
7
  import "../../schema.js";
9
- import { a as progressEventSchema, t as appendEvent, y as latestRunDir } from "../../events.js";
8
+ import { a as progressEventSchema, t as appendEvent } from "../../events.js";
10
9
  import "../../live.js";
11
10
  import { i as AuditCommand, n as workspaceFlag, r as workspaceFor, t as text } from "../../flags2.js";
12
11
  import path from "node:path";
@@ -15,6 +14,7 @@ import { mkdir } from "node:fs/promises";
15
14
  //#region src/commands/audit/progress.ts
16
15
  var Progress = class Progress extends AuditCommand {
17
16
  static hidden = true;
17
+ static reportsUsage = false;
18
18
  static summary = "Append one live-progress event to the run event log";
19
19
  static examples = ["<%= config.bin %> <%= command.id %> --event '{\"type\":\"log\",\"level\":\"info\",\"message\":\"Checking SEO rules\"}'"];
20
20
  static flags = {
@@ -1,5 +1,7 @@
1
+ import "../../package.js";
1
2
  import { r as commonFlags } from "../../flags.js";
2
- import "../../sanitize.js";
3
+ import "../../results.js";
4
+ import "../../schema.js";
3
5
  import { i as AuditCommand, n as workspaceFlag, r as workspaceFor, t as text } from "../../flags2.js";
4
6
  import { Flags } from "@oclif/core";
5
7
  import path from "node:path";
@@ -8,6 +10,7 @@ import { spawn } from "node:child_process";
8
10
  //#region src/commands/audit/serve.ts
9
11
  var Serve = class Serve extends AuditCommand {
10
12
  static hidden = true;
13
+ static reportsUsage = false;
11
14
  static summary = "Serve the dashboard for a finalized audit-result.json or a live run";
12
15
  static examples = ["<%= config.bin %> <%= command.id %> -d ./my-storefront --no-open"];
13
16
  static flags = {