import{Build}from"@stencil/core/internal/client";function isNumeric(e){return!Number.isNaN(parseFloat(e))}function getSlottedNodes(e,t,r="slot"){const n=e.shadowRoot.querySelector(r).assignedNodes();return null!==t?Array.from(n).filter(e=>e.nodeName.toLowerCase()===t):Array.from(n)}function consoleDevError(e){Build.isDev&&!Build.isTesting&&console.error(e)}function plurality(e){return 1===e?"":"s"}function getCharacterMessage(e,t){if(void 0===e||""===e)return`${t} character${plurality(t)} allowed`;let r;if(e.length<=t){const n=t-e.length;r=`${n} character${plurality(n)} left`}else{const n=e.length-t;r=`${n} character${plurality(n)} over limit`}return r}function makeArray(e,t){return Array.from({length:t-e+1},(t,r)=>e+r)}const isElement=e=>e&&"object"==typeof e&&1===e.nodeType;function select(e,t){if("string"!=typeof e)return[];if(!t||!isElement(t))return[];const r=t.shadowRoot.querySelectorAll(e);return Array.from(r)}function selectOrMatches(e,t){const r=select(e,t);return"string"!=typeof e||isElement(t)&&t.matches(e)&&r.push(t),r}const Sanitizer={_entity:/[&<>"'/]/g,_entities:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&apos;","/":"&#x2F;"},getEntity:function(e){return Sanitizer._entities[e]},escapeHTML:function(e){for(var t="",r=0;r<e.length;r++)t+=e[r],r+1<arguments.length&&(t+=String(arguments[r+1]||"").replace(Sanitizer._entity,Sanitizer.getEntity));return t}};function getHeaderLevel(e){let t=null;return t="string"==typeof e?parseInt(e,10):Math.floor(e),t>=1&&t<=6?`h${t}`:null}function isInteractiveLinkOrButton(e){return["VA-BUTTON","VA-LINK","BUTTON","A"].includes(e.tagName)}function isMessageSet(e){return e&&"false"!==e||!1}function isArguments(e){return"[object Arguments]"===Object.prototype.toString.call(e)}function deepEquals(e,t){const r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];if(e===t)return!0;if("function"==typeof e||"function"==typeof t)return!0;if("object"!=typeof e||"object"!=typeof t)return!1;if(null===e||null===t)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof RegExp&&t instanceof RegExp)return e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase;if(isArguments(e)||isArguments(t)){if(!isArguments(e)||!isArguments(t))return!1;const i=Array.prototype.slice;return deepEquals(i.call(e),i.call(t),r,n)}{if(e.constructor!==t.constructor)return!1;const i=Object.keys(e),o=Object.keys(t);if(0===i.length&&0===o.length)return!0;if(i.length!==o.length)return!1;let s,a=r.length;for(;a--;)if(r[a]===e)return n[a]===t;r.push(e),n.push(t),i.sort(),o.sort();for(let e=i.length-1;e>=0;e--)if(i[e]!==o[e])return!1;for(let o=i.length-1;o>=0;o--)if(s=i[o],!deepEquals(e[s],t[s],r,n))return!1;return r.pop(),n.pop(),!0}}function debounce(e,t){let r;return function(...n){clearTimeout(r),r=setTimeout(()=>e.apply(this,n),t)}}function getMaxLength(e){if(null==e)return;const t="string"==typeof e?parseInt(e,10):e;if(!(t<=0||isNaN(t)))return t;consoleDevError("The maxlength prop must be positive!")}function normalizeStringArrayProp(e,t){if(Array.isArray(e))return e.map(e=>null==e?void 0:e.trim()).filter(Boolean);if("string"!=typeof e)return[];const r=e.trim();if(!r)return[];try{const e=JSON.parse(r);return Array.isArray(e)?e.filter(e=>"string"==typeof e).map(e=>e.trim()).filter(Boolean):[]}catch(e){return t&&consoleDevError(t),[]}}function updateScreenReaderCount(e,t,r){e&&(e.innerText=getCharacterMessage(t,getMaxLength(r)))}export{Sanitizer as S,getSlottedNodes as a,isNumeric as b,consoleDevError as c,deepEquals as d,debounce as e,getMaxLength as f,getHeaderLevel as g,getCharacterMessage as h,isMessageSet as i,isInteractiveLinkOrButton as j,makeArray as m,normalizeStringArrayProp as n,selectOrMatches as s,updateScreenReaderCount as u};