{"version":3,"file":"split-widget-actions.cjs","names":["mergeWidgetActions"],"sources":["../../src/utils/split-widget-actions.ts"],"sourcesContent":["import type {\n\tWidgetRuntimeAction,\n\tWidgetType,\n} from '@wordpress/widget-primitives';\nimport { mergeWidgetActions } from './merge-widget-actions';\n\n/**\n * Splits a widget's actions across the chrome surfaces: the footer takes\n * `relevance: 'high'` and `'medium'`, the More menu the rest. Full-bleed\n * widgets have no footer, so every action stays in the menu.\n *\n * @param {WidgetType | undefined} widgetType     The widget type.\n * @param {WidgetRuntimeAction[]}  runtimeActions The instance's actions.\n */\nexport function splitWidgetActions(\n\twidgetType?: WidgetType,\n\truntimeActions: WidgetRuntimeAction[] = []\n): {\n\tfooter: WidgetRuntimeAction[];\n\tmenu: WidgetRuntimeAction[];\n} {\n\tconst actions = mergeWidgetActions(\n\t\twidgetType?.actions ?? [],\n\t\truntimeActions\n\t);\n\n\tif ( widgetType?.presentation === 'full-bleed' ) {\n\t\treturn { footer: [], menu: actions };\n\t}\n\n\tconst isPromoted = ( action: WidgetRuntimeAction ) =>\n\t\taction.relevance === 'high' || action.relevance === 'medium';\n\n\treturn {\n\t\tfooter: actions.filter( isPromoted ),\n\t\tmenu: actions.filter( ( action ) => ! isPromoted( action ) ),\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;AAcA,SAAgB,mBACf,YACA,iBAAwC,CAAC,GAIxC;CACD,MAAM,WAAA,GAAUA,0BAAAA,mBAAAA,CACf,YAAY,WAAW,CAAC,GACxB,cACD;CAEA,IAAK,YAAY,iBAAiB,cACjC,OAAO;EAAE,QAAQ,CAAC;EAAG,MAAM;CAAQ;CAGpC,MAAM,cAAe,WACpB,OAAO,cAAc,UAAU,OAAO,cAAc;CAErD,OAAO;EACN,QAAQ,QAAQ,OAAQ,UAAW;EACnC,MAAM,QAAQ,QAAU,WAAY,CAAE,WAAY,MAAO,CAAE;CAC5D;AACD"}