// @bun
var{defineProperty:G,getOwnPropertyNames:L,getOwnPropertyDescriptor:M}=Object,O=Object.prototype.hasOwnProperty;function Q(h){return this[h]}var A=(h)=>{var q=(J??=new WeakMap).get(h),x;if(q)return q;if(q=G({},"__esModule",{value:!0}),h&&typeof h==="object"||typeof h==="function"){for(var w of L(h))if(!O.call(q,w))G(q,w,{get:Q.bind(h,w),enumerable:!(x=M(h,w))||x.enumerable})}return J.set(h,q),q},J;var R=(h)=>h;function U(h,q){this[h]=R.bind(null,q)}var F=(h,q)=>{for(var x in q)G(h,x,{get:q[x],enumerable:!0,configurable:!0,set:U.bind(q,x)})};var V=(h,q)=>()=>(h&&(q=h(h=0)),q);var T=import.meta.require;function W(h){let q=$(h.name),x=X(h);return{id:q,title:h.name,variants:x,layout:{type:"single"}}}function X(h){let q=[],x={};for(let w of h.props)if(w.default!==void 0)x[w.name]=w.default;q.push({id:"default",title:"Default",state:x});for(let w of h.props)if(w.type==="boolean"&&w.default===!1){let z={...x,[w.name]:!0};q.push({id:`with-${w.name}`,title:`With ${H(w.name)}`,state:z})}for(let w of h.props)if(w.options&&w.options.length>0){for(let z of w.options)if(z!==w.default){let B={...x,[w.name]:z};q.push({id:`${w.name}-${String(z).toLowerCase()}`,title:`${H(w.name)}: ${z}`,state:B})}}return q}function Y(h){let x={type:Z(h)};if(h.options&&h.options.length>0)x.options=h.options.map((w)=>typeof w==="string"?{value:w,label:w}:w);return x.title=H(h.name),x}function Z(h){let q=h.type.toLowerCase();if(h.options&&h.options.length>0)return h.options.length<=4?"radio":"select";if(q==="boolean"||q==="bool")return"boolean";if(q==="number"||q==="int"||q==="float")return"number";if(q==="string"||q==="text"){if(h.name.toLowerCase().includes("color"))return"color";if(h.name.toLowerCase().includes("description")||h.name.toLowerCase().includes("content")||h.name.toLowerCase().includes("text"))return"textarea";return"text"}if(q==="array"||q==="object"||q.startsWith("{")||q.startsWith("["))return"json";if(q==="date")return"date";return"text"}function _(h){return h.map(Y)}function N(h,q){let x=Object.entries(q).map(([w,z])=>{if(typeof z==="string")return`${w}="${z}"`;if(typeof z==="boolean")return z?w:"";return`:${w}="${JSON.stringify(z)}"`}).filter(Boolean).join(" ");return`<${h} ${x} />`}function H(h){return h.replace(/([A-Z])/g," $1").replace(/^./,(q)=>q.toUpperCase()).trim()}function $(h){return h.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function P(h){let q=W(h),x=_(h.props),w=h.props.map((B)=>{let E=B.default!==void 0?JSON.stringify(B.default):j(B.type);return`    ${B.name}: ${E}`}).join(`,
`),z=x.map((B,E)=>{let K=h.props[E];return`      <${D(B.type)} v-model="state.${K.name}" title="${B.title}" />`}).join(`
`);return`<!-- Auto-generated story for ${h.name} -->
<script>
import ${h.name} from './${h.name}.stx'

function initState() {
  return {
${w}
  }
}
</script>

<Story title="${h.name}">
  <Variant title="Playground" :init-state="initState">
    <template #default="{ state }">
      <${h.name} v-bind="state" />
    </template>

    <template #controls="{ state }">
${z}
    </template>
  </Variant>

${q.variants.slice(1).map((B)=>`  <Variant title="${B.title}">
    <${h.name} ${I(B.state||{})} />
  </Variant>`).join(`

`)}
</Story>
`}function j(h){let q=h.toLowerCase();if(q==="boolean")return"false";if(q==="number")return"0";if(q==="array")return"[]";if(q==="object")return"{}";return"''"}function D(h){return{text:"StxText",number:"StxNumber",boolean:"StxCheckbox",select:"StxSelect",radio:"StxRadio",color:"StxColorSelect",json:"StxJson",date:"StxText",textarea:"StxTextarea",slider:"StxSlider",buttongroup:"StxButtonGroup"}[h]||"StxText"}function I(h){return Object.entries(h).map(([q,x])=>{if(typeof x==="string")return`${q}="${x}"`;if(typeof x==="boolean")return x?q:`:${q}="false"`;return`:${q}="${JSON.stringify(x)}"`}).join(" ")}export{Y as inferControl,N as generateStorySource,P as generateStoryFileContent,_ as generateControls,W as generateAutoStory};
