// @bun
var{defineProperty:B,getOwnPropertyNames:J,getOwnPropertyDescriptor:K}=Object,L=Object.prototype.hasOwnProperty;function M(b){return this[b]}var P=(b)=>{var h=(D??=new WeakMap).get(b),k;if(h)return h;if(h=B({},"__esModule",{value:!0}),b&&typeof b==="object"||typeof b==="function"){for(var j of J(b))if(!L.call(h,j))B(h,j,{get:M.bind(b,j),enumerable:!(k=K(b,j))||k.enumerable})}return D.set(b,h),h},D;var N=(b)=>b;function O(b,h){this[b]=N.bind(null,h)}var Q=(b,h)=>{for(var k in h)B(b,k,{get:h[k],enumerable:!0,configurable:!0,set:O.bind(h,k)})};var R=(b,h)=>()=>(b&&(h=b(b=0)),h);var S=import.meta.require;function V(b,h){let k=[],j=[];for(let q of h)if(q.required&&!(q.name in b))k.push({prop:q.name,message:`Required prop "${q.name}" is missing`,expected:q.type});for(let[q,A]of Object.entries(b)){let x=h.find((H)=>H.name===q);if(!x){j.push({prop:q,message:`Unknown prop "${q}" - not defined in component`});continue}let C=F(A,x.type,x.options);if(C)k.push({prop:q,message:C,expected:x.type,actual:typeof A})}return{valid:k.length===0,errors:k,warnings:j}}function F(b,h,k){if(b===null||b===void 0){if(h.includes("null")||h.includes("undefined")||h.includes("?"))return null;return`Expected ${h}, got ${b===null?"null":"undefined"}`}let j=typeof b,q=h.toLowerCase().trim();if(q.includes("|")){let A=q.split("|").map((x)=>x.trim());for(let x of A)if(F(b,x,k)===null)return null;return`Expected one of ${A.join(" | ")}, got ${j}`}if(k&&k.length>0){if(!k.includes(String(b)))return`Expected one of [${k.join(", ")}], got "${b}"`;return null}switch(q){case"string":if(j!=="string")return`Expected string, got ${j}`;break;case"number":if(j!=="number"||Number.isNaN(b))return`Expected number, got ${j}`;break;case"boolean":if(j!=="boolean")return`Expected boolean, got ${j}`;break;case"array":case"any[]":case"array<any>":if(!Array.isArray(b))return`Expected array, got ${j}`;break;case"object":case"record<string, any>":if(j!=="object"||Array.isArray(b))return`Expected object, got ${j}`;break;case"function":if(j!=="function")return`Expected function, got ${j}`;break;case"any":break;default:if(q.startsWith("array<")||q.endsWith("[]")){if(!Array.isArray(b))return`Expected array, got ${j}`}}return null}function W(b){return`
    window.__stxValidateProps = function(props) {
      const definitions = ${JSON.stringify(b)};
      const errors = [];
      const warnings = [];

      // Check required props
      for (const def of definitions) {
        if (def.required && !(def.name in props)) {
          errors.push({
            prop: def.name,
            message: 'Required prop "' + def.name + '" is missing',
            expected: def.type
          });
        }
      }

      // Validate provided props
      for (const [name, value] of Object.entries(props)) {
        const def = definitions.find(d => d.name === name);

        if (!def) {
          warnings.push({
            prop: name,
            message: 'Unknown prop "' + name + '"'
          });
          continue;
        }

        // Basic type validation
        const actualType = typeof value;
        const expectedType = def.type.toLowerCase();

        if (expectedType === 'string' && actualType !== 'string') {
          errors.push({ prop: name, message: 'Expected string, got ' + actualType });
        }
else if (expectedType === 'number' && actualType !== 'number') {
          errors.push({ prop: name, message: 'Expected number, got ' + actualType });
        }
else if (expectedType === 'boolean' && actualType !== 'boolean') {
          errors.push({ prop: name, message: 'Expected boolean, got ' + actualType });
        }
else if (expectedType === 'array' && !Array.isArray(value)) {
          errors.push({ prop: name, message: 'Expected array, got ' + actualType });
        }

        // Check options
        if (def.options && def.options.length > 0) {
          if (!def.options.includes(String(value))) {
            errors.push({
              prop: name,
              message: 'Expected one of [' + def.options.join(', ') + '], got "' + value + '"'
            });
          }
        }
      }

      return { valid: errors.length === 0, errors, warnings };
    };
  `}function X(b){let h=[];if(b.valid)h.push("\u2713 All props are valid");else{h.push("\u2717 Validation failed:");for(let k of b.errors)h.push(`  \u2022 ${k.prop}: ${k.message}`)}if(b.warnings.length>0){h.push(""),h.push("Warnings:");for(let k of b.warnings)h.push(`  \u26A0 ${k.prop}: ${k.message}`)}return h.join(`
`)}function Y(b){if(b.valid&&b.warnings.length===0)return"";let h=b.errors.map((j)=>`
    <div class="validation-error">
      <strong>${j.prop}:</strong> ${j.message}
    </div>
  `).join(""),k=b.warnings.map((j)=>`
    <div class="validation-warning">
      <strong>${j.prop}:</strong> ${j.message}
    </div>
  `).join("");return`
    <div class="stx-validation-panel ${b.valid?"warnings-only":"has-errors"}">
      ${h}
      ${k}
    </div>
  `}function Z(){return`
    .stx-validation-panel {
      padding: 12px;
      margin: 8px 0;
      border-radius: 4px;
      font-size: 13px;
    }
    .stx-validation-panel.has-errors {
      background: #fee2e2;
      border: 1px solid #ef4444;
    }
    .stx-validation-panel.warnings-only {
      background: #fef3c7;
      border: 1px solid #f59e0b;
    }
    .validation-error {
      color: #dc2626;
      margin-bottom: 4px;
    }
    .validation-warning {
      color: #d97706;
      margin-bottom: 4px;
    }
  `}export{V as validateProps,Z as getValidationStyles,W as getValidationScript,Y as generateValidationErrorsHTML,X as formatValidationResult};
