/*!
 * KoliBri - The accessible HTML-Standard
 */
import{o as objectObjectHandler,p as parseJson,w as watchValidator}from"./prop.validators-5a58fa40.js";import{i as isString,a as isStyle,b as isObject}from"./common-54bf85ba.js";const mapCustomIcon=(t,o,i)=>{isObject(i)?t[o]=i:isString(i,1)&&(t[o]={icon:i})},mapIconProp2State=t=>{let o={};return isString(t,1)?o={left:{icon:t}}:"object"==typeof t&&null!==t&&(mapCustomIcon(o,"top",t.top),mapCustomIcon(o,"right",t.right),mapCustomIcon(o,"bottom",t.bottom),mapCustomIcon(o,"left",t.left)),o},beforePatchIcon=t=>{var o,i,e;if(null===(o=t.nextState)||void 0===o?void 0:o.has("_icons")){const o=null===(i=t.nextState)||void 0===i?void 0:i.get("_icons");null===(e=t.nextState)||void 0===e||e.set("_icons",mapIconProp2State(o))}},isIcon=t=>"object"==typeof t&&null!==t&&(void 0===t.style||isStyle(t.style))&&(void 0===t.label||isString(t.label))&&isString(t.icon,1),validateIcons=(t,o,i={})=>{objectObjectHandler(o,(()=>{var e;try{o=parseJson(o)}catch(t){}watchValidator(t,"_icons",(t=>{const o="object"==typeof t&&null!==t&&0===Object.keys(t).length;return null===t||o||isString(t,1)||"object"==typeof t&&null!==t&&(isString(t.left,1)||isIcon(t.left)||isString(t.right,1)||isIcon(t.right)||isString(t.top,1)||isIcon(t.top)||isString(t.bottom,1)||isIcon(t.bottom))}),new Set(["KoliBriIcon"]),o,Object.assign(Object.assign({},i),{defaultValue:{},hooks:{afterPatch:null===(e=i.hooks)||void 0===e?void 0:e.afterPatch,beforePatch:(t,o,e,n)=>{var s,a;"function"==typeof(null===(s=i.hooks)||void 0===s?void 0:s.beforePatch)&&(null===(a=i.hooks)||void 0===a||a.beforePatch(t,o,e,n)),beforePatchIcon(e)}}}))}))};export{isIcon as i,validateIcons as v};