"use strict";const c=require("@tempots/dom");function l(e,r,t){const u=["bc-card"];return e!=="default"&&u.push(`bc-card--${e}`),r!=="md"&&u.push(`bc-card--padding-${r}`),t!=="lg"&&u.push(`bc-card--rounded-${t}`),u.join(" ")}function g({variant:e="default",size:r="md",roundedness:t="lg"}={},...u){return c.html.div(c.attr.class(c.computedOf(e,r,t)((o,s,m)=>l(o??"default",s??"md",m??"lg"))),...u)}const a=["description","comment","notes","text"];function p(e){if(typeof e=="boolean")return a;const r=e["x:ui"];return r&&Array.isArray(r.textAreaTriggers)?[...a,...r.textAreaTriggers]:a}function n(e){if(typeof e=="boolean")return;const r=e["x:ui"];if(r!=null&&(typeof r=="string"||typeof r=="object"&&r!==null))return r}function d(e,r){if(typeof e=="boolean")return;const t=n(e);if(typeof t=="object"&&typeof t.widget=="string")return{widget:t.widget,source:"explicit-widget",options:t};const u=typeof t=="string"?t:typeof t=="object"&&typeof t.format=="string"?t.format:void 0;if(u)return{widget:u,source:"explicit-format",options:typeof t=="object"?t:void 0};if(typeof e.format=="string")return{widget:{datetime:"date-time",base64:"binary",bytes:"binary",iri:"uri","iri-reference":"uri-reference","idn-hostname":"hostname"}[e.format]||e.format,source:"schema-format"};if(e.contentMediaType==="text/markdown")return{widget:"markdown",source:"schema-media"};if(e.contentMediaType!=null||e.contentEncoding==="base64")return{widget:"binary",source:"schema-media",options:{mediaType:e.contentMediaType,encoding:e.contentEncoding}};if(e.enum!=null)return{widget:"enum",source:"constraints"};if(e.const!=null)return{widget:"const",source:"constraints"};if((e.type==="number"||e.type==="integer"||Array.isArray(e.type)&&e.type.some(s=>s==="number"||s==="integer"))&&e.minimum!=null&&e.maximum!=null)return e.maximum-e.minimum<=5&&e.minimum>=0&&e.minimum<=1&&(e.multipleOf==null||e.multipleOf>=1)?{widget:"rating",source:"constraints",options:{max:e.maximum}}:{widget:"slider",source:"constraints",options:{min:e.minimum,max:e.maximum,step:e.multipleOf}};if(e.type==="string"){if(e.minLength!=null&&e.minLength>20||e.maxLength!=null&&e.maxLength>100)return{widget:"textarea",source:"heuristics"};if(r){const s=r.toLowerCase();if(s.includes("password")||s.includes("secret"))return{widget:"password",source:"heuristics"};if(s.includes("email"))return{widget:"email",source:"heuristics"};if(s.includes("url")||s.includes("link"))return{widget:"url",source:"heuristics"};if(s.includes("color"))return{widget:"color",source:"heuristics"};if(p(e).some(i=>s.includes(i.toLowerCase())))return{widget:"textarea",source:"heuristics"}}}}exports.Card=g;exports.getXUIConfig=n;exports.resolveWidget=d;
