import{h}from"./index-ecdfb761.js";var __rest=undefined&&undefined.__rest||function(e,n){var t={};for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)&&n.indexOf(a)<0)t[a]=e[a];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var r=0,a=Object.getOwnPropertySymbols(e);r<a.length;r++){if(n.indexOf(a[r])<0&&Object.prototype.propertyIsEnumerable.call(e,a[r]))t[a[r]]=e[a[r]]}return t};function getWrappedValue(e,n){if(!e.includes(".")){return n[e]}var t=n;e.split(".").forEach((function(e){if(!t){return}t=t[e]}));return t}function mapFields(e){if(e===void 0){e={}}var n=e.conversionConfig,t=__rest(e,["conversionConfig"]);return convertValues(n,t)}function convertValues(e,n){if(!e){return n}Object.keys(e).forEach((function(t){var a=e[t]||t;n[a]=getWrappedValue(t,n)}));return n}var generateActionComponent=function(e,n,t,a,r,i){var o=r.data,c=r.ui;if(c.componentTag){var u=c.componentTag;return h(u,{index:e,item:t,data:o})}var s=c.buttonType||"button";var f=c.scale||"medium";var l=c.shape||(c.buttonType==="icon-button"?"circle":"rectangular");var p=c.tint||"primary";var v=c.view||"solid";var d=c.buttonType==="icon-button"?c.label:undefined;var b=c.buttonType==="icon-button"?undefined:c.label;var m=s==="button"?"dvn-button":"dvn-icon-button";return h(m,{abbrTitle:d,key:c.name,scale:f,shape:l,tint:p,view:v,iconName:c.iconName,onClick:function(){return a.emit(generateActionEmitData(n,t,o,c.name))},leaned:i?i.leaned:undefined},b)};var generateActionEmitData=function(e,n,t,a){var r=mapFields(Object.assign(Object.assign(Object.assign({},(t===null||t===void 0?void 0:t.params)||{}),e),{item:n}));return Object.assign(Object.assign({},t),{name:a||t.name,params:r})};export{generateActionComponent as a,convertValues as c,generateActionEmitData as g};