/*
 * Copyright (c) 2018, 2025, Oracle and/or its affiliates.
 * Licensed under The Universal Permissive License (UPL), Version 1.0
 * as shown at https://oss.oracle.com/licenses/upl/
 */
const PRODUCTION="production";const OOS="Not in service";const DISABLED="disabled";function show(nd,arg,appCtx){var packs;if(packs=nd.builtinpacks.getPackMetadata(nd,appCtx)){let prefixes=nd.builtinpacks.getPrefixes();arg=arg?arg.toLowerCase():arg;for(let pack of prefixes){if(!arg||arg===pack)_display(packs[pack],appCtx.colors)}}};function _display(pack,clr){var rules,rule,opts;let sorted=[],list=[],max=0;console.log(`\n\n${clr.BRIGHTRED("\u25CF")}  ${clr.CYAN("Pack")} ${clr.BRIGHTRED(`${pack.prefix}`)} ${clr.CYAN(" - Rules Not in Production Status")}\n`);rules=pack.rules;_getSortedRulesByName(rules,sorted);for(rule of sorted){opts=rules[rule];if(opts.status!==undefined&&opts.status!==PRODUCTION){list.push(rule);list.push(opts.status);max=rule.length>max?rule.length:max;list.push(opts.hasOwnProperty("inservice")?opts.inservice:true);list.push(opts.hasOwnProperty("enabled")?opts.enabled:true)}}_displayRules(list,max,clr);console.log("")};function _displayRules(list,max,clr){console.log("  "+clr.BRIGHTCYAN("--- Non-Production Rules : ")+clr.BRIGHTGREEN(""+list.length/4));for(let i=0;i<list.length;i++){let rule,status,insrvc,enabled,avail;rule=list[i++];status=list[i++];insrvc=list[i++];enabled=list[i];if(!(insrvc&&enabled)){avail="  ("+(!insrvc?clr.BRIGHTRED(OOS):"")+(!insrvc&&!enabled?", ":"")+(!enabled?DISABLED:"")+")"}else{avail=""}console.log(clr.BRIGHTYELLOW(`●  ${rule}`)+_spacer(rule,max)+"   "+clr.BRIGHTCYAN(status)+avail)}};function _getSortedRulesByName(rules,sorted){for(let rule in rules){sorted.push(rule)}sorted.sort()};function _spacer(s,max){return" ".repeat(max-s.length+2)};module.exports.show=show;