/*!
 * KoliBri - The accessible HTML-Standard
 */
"use strict";const prop_validators=require("./prop.validators-476ef807.js"),reuse=require("./reuse-daa2baf3.js"),mapCustomIcon=(t,o,e)=>{reuse.isObject(e)?t[o]=e:reuse.isString(e,1)&&(t[o]={icon:e})},mapIconProp2State=t=>{let o={};return reuse.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,e,s;if(null===(o=t.nextState)||void 0===o?void 0:o.has("_icons")){const o=null===(e=t.nextState)||void 0===e?void 0:e.get("_icons");null===(s=t.nextState)||void 0===s||s.set("_icons",mapIconProp2State(o))}},isIcon=t=>"object"==typeof t&&null!==t&&(void 0===t.style||reuse.isStyle(t.style))&&(void 0===t.label||reuse.isString(t.label))&&reuse.isString(t.icon,1),validateIcons=(t,o,e={})=>{prop_validators.objectObjectHandler(o,(()=>{var s;try{o=prop_validators.parseJson(o)}catch(t){}prop_validators.watchValidator(t,"_icons",(t=>{const o="object"==typeof t&&null!==t&&0===Object.keys(t).length;return null===t||o||reuse.isString(t,1)||"object"==typeof t&&null!==t&&(reuse.isString(t.left,1)||isIcon(t.left)||reuse.isString(t.right,1)||isIcon(t.right)||reuse.isString(t.top,1)||isIcon(t.top)||reuse.isString(t.bottom,1)||isIcon(t.bottom))}),new Set(["KoliBriIcon"]),o,Object.assign(Object.assign({},e),{defaultValue:{},hooks:{afterPatch:null===(s=e.hooks)||void 0===s?void 0:s.afterPatch,beforePatch:(t,o,s,i)=>{var r,n;"function"==typeof(null===(r=e.hooks)||void 0===r?void 0:r.beforePatch)&&(null===(n=e.hooks)||void 0===n||n.beforePatch(t,o,s,i)),beforePatchIcon(s)}}}))}))};exports.isIcon=isIcon,exports.validateIcons=validateIcons;