(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,38149,e=>{"use strict";var t=e.i(43476);function r({title:e,description:r,controls:a,output:s}){return(0,t.jsxs)("div",{className:"container mx-auto px-4 py-8 max-w-7xl",children:[(0,t.jsxs)("div",{className:"mb-8",children:[(0,t.jsx)("h1",{className:"text-3xl font-bold tracking-tight text-foreground mb-2",children:e}),(0,t.jsx)("p",{className:"text-muted-foreground",children:r})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8 items-start",children:[(0,t.jsx)("div",{className:"space-y-6",children:(0,t.jsx)("div",{className:"bg-card rounded-2xl border border-border p-6 shadow-sm",children:a})}),(0,t.jsx)("div",{className:"lg:sticky lg:top-24",children:(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wider px-1",children:"Generated Output"}),s]})})]})]})}e.s(["ToolLayout",()=>r])},74886,e=>{"use strict";let t=(0,e.i(75254).default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["Copy",()=>t],74886)},43531,e=>{"use strict";let t=(0,e.i(75254).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["Check",()=>t],43531)},31067,e=>{"use strict";function t(){return(t=Object.assign.bind()).apply(null,arguments)}e.s(["default",()=>t])},2180,e=>{"use strict";var t=e.i(43476),r=e.i(71645),a=e.i(38149),s=e.i(74837);function n(e,t,r){let{useNum:a=!1}=r;return null===t?"dynamic":"string"==typeof t?"String":"number"==typeof t?a?"num":t%1==0?"int":"double":"boolean"==typeof t?"bool":Array.isArray(t)?t.length>0?`List<${n(e,t[0],r)}>`:"List<dynamic>":"object"==typeof t?l(e):"dynamic"}function o(e){return e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace("-","").replace("_","")).replace(/^[A-Z]/,e=>e.toLowerCase())}function l(e){let t=o(e);return t.charAt(0).toUpperCase()+t.slice(1)}let i=`{
  "id": 1,
  "name": "Leanne Graham",
  "username": "Bret",
  "email": "Sincere@april.biz",
  "address": {
    "street": "Kulas Light",
    "suite": "Apt. 556",
    "city": "Gwenborough",
    "zipcode": "92998-3874"
  },
  "tags": ["work", "important"]
}`;function c(){let[e,c]=(0,r.useState)(i),[u,p]=(0,r.useState)("UserResponse"),[m,g]=(0,r.useState)({className:"UserResponse",nullable:!0,useNum:!1,generateCopyWith:!0,generateToString:!1,generateEqHashCode:!1,useFreezed:!1,useEquatable:!1}),[h,b]=(0,r.useState)("");(0,r.useEffect)(()=>{b(function(e,t={}){let{className:r="Autogenerated",useFreezed:a}=t;try{let s=JSON.parse(e);if(a)return function e(t,r,a){let s=[],i=[],{nullable:c=!0}=a;for(let t of Object.keys(r)){let d=r[t],u=n(t,d,a),p=o(t),m=c?`${u}?`:u;if(s.push(`    ${m} ${p},`),"object"==typeof d&&null!==d&&!Array.isArray(d)){let r=l(t);i.push(e(r,d,a))}}let d=`import 'package:freezed_annotation/freezed_annotation.dart';

part '${t.toLowerCase()}.freezed.dart';
part '${t.toLowerCase()}.g.dart';

@freezed
class ${t} with _$${t} {
  const factory ${t}({
${s.join("\n")}
  }) = _${t};

  factory ${t}.fromJson(Map<String, dynamic> json) =>
      _$${t}FromJson(json);
}
`;return i.length>0&&(d+="\n"+i.join("\n")),d}(r,s,t);return function e(t,r,a){let s=[],i=[],c=[],d=[],u=[],p=[],{nullable:m=!0,generateCopyWith:g,generateToString:h,generateEqHashCode:b}=a;for(let t of Object.keys(r)){let g=r[t],h=n(t,g,a),b=o(t);p.push({camel:b,type:h});let x=m?`${h}?`:h;if(s.push(`  final ${x} ${b};`),m?i.push(`    this.${b},`):i.push(`    required this.${b},`),"object"!=typeof g||null===g||Array.isArray(g))c.push(`      ${b}: json['${t}'],`);else{let r=l(t),s=m?`json['${t}'] != null ? ${r}.fromJson(json['${t}']) : null`:`${r}.fromJson(json['${t}'])`;c.push(`      ${b}: ${s},`),u.push(e(r,g,a))}if("object"!=typeof g||null===g||Array.isArray(g))d.push(`    data['${t}'] = ${b};`);else{let e=m?`${b}?.toJson()`:`${b}.toJson()`;d.push(`    data['${t}'] = ${e};`)}}let{useEquatable:x}=a,f=x?`class ${t} extends Equatable {`:`class ${t} {`,y=`${f}
${s.join("\n")}

  ${t}({
${i.join("\n")}
  });

  factory ${t}.fromJson(Map<String, dynamic> json) {
    return ${t}(
${c.join("\n")}
    );
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = <String, dynamic>{};
${d.join("\n")}
    return data;
  }
`;if(x){let e=p.map(e=>e.camel).join(", ");y+=`
  @override
  List<Object?> get props => [${e}];
`}if(g){let e=p.map(e=>`    ${e.type}? ${e.camel},`).join("\n"),r=p.map(e=>`      ${e.camel}: ${e.camel} ?? this.${e.camel},`).join("\n");y+=`
  ${t} copyWith({
${e}
  }) {
    return ${t}(
${r}
    );
  }
`}if(h){let e=p.map(e=>`${e.camel}: $${e.camel}`).join(", ");y+=`
  @override
  String toString() {
    return '${t}(${e})';
  }
`}if(b){let e=p.map(e=>`other.${e.camel} == ${e.camel}`).join(" && "),r=p.map(e=>`${e.camel}.hashCode`).join(" ^ ");y+=`
  @override
  bool operator ==(Object other) {
    if (identical(this, other)) return true;
    return other is ${t} && ${e};
  }

  @override
  int get hashCode => ${r};
`}return y+="}\n",u.length>0&&(y+="\n"+u.join("\n")),y}(r,s,t)}catch(e){return`// Error parsing JSON: ${e.message}`}}(e,{...m,className:u}))},[e,u,m]);let x=e=>{g(t=>{let r={...t,[e]:!t[e]};return"useFreezed"===e&&r.useFreezed&&(r.useEquatable=!1),"useEquatable"===e&&r.useEquatable&&(r.useFreezed=!1),r})};return(0,t.jsx)(a.ToolLayout,{title:"JSON to Dart Model",description:"Advanced model generator with support for Standard Dart, Freezed, and Equatable.",controls:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"block text-xs font-black uppercase tracking-widest mb-2 text-muted-foreground/70",children:"Class Name"}),(0,t.jsx)("input",{type:"text",value:u,onChange:e=>p(e.target.value),className:"w-full px-4 py-3 bg-secondary/30 border border-border/50 rounded-2xl focus:ring-2 focus:ring-primary/50 outline-none transition-all font-bold text-sm",placeholder:"e.g. UserResponse"})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("label",{className:"block text-[10px] font-black uppercase tracking-[0.2em] text-muted-foreground/50",children:"Core Options"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsx)(d,{label:"Null Safety",active:m.nullable,onClick:()=>x("nullable")}),(0,t.jsx)(d,{label:"Use num",active:m.useNum,onClick:()=>x("useNum")})]})]}),(0,t.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,t.jsx)("label",{className:"block text-[10px] font-black uppercase tracking-[0.2em] text-muted-foreground/50",children:"Pro Features"}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsx)(d,{label:"Freezed",active:m.useFreezed,onClick:()=>x("useFreezed"),highlight:!0}),(0,t.jsx)(d,{label:"Equatable",active:m.useEquatable,onClick:()=>x("useEquatable"),highlight:!0})]})]}),!m.useFreezed&&(0,t.jsxs)("div",{className:"space-y-3 pt-2 animate-in fade-in slide-in-from-top-2 duration-300",children:[(0,t.jsx)("label",{className:"block text-[10px] font-black uppercase tracking-[0.2em] text-muted-foreground/50",children:"Boilerplate Generation"}),(0,t.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[(0,t.jsx)(d,{label:"copyWith",active:m.generateCopyWith,onClick:()=>x("generateCopyWith"),small:!0}),(0,t.jsx)(d,{label:"toString",active:m.generateToString,onClick:()=>x("generateToString"),small:!0}),!m.useEquatable&&(0,t.jsx)(d,{label:"Equality",active:m.generateEqHashCode,onClick:()=>x("generateEqHashCode"),small:!0})]})]})]}),(0,t.jsxs)("div",{className:"pt-4 border-t border-border/50",children:[(0,t.jsx)("label",{className:"block text-xs font-black uppercase tracking-widest mb-3 text-muted-foreground/70",children:"JSON Input"}),(0,t.jsx)("textarea",{value:e,onChange:e=>c(e.target.value),className:"w-full h-[350px] px-4 py-4 bg-secondary/20 border border-border/40 rounded-3xl font-mono text-[11px] focus:ring-2 focus:ring-primary/30 outline-none transition-all resize-none custom-scrollbar",placeholder:'{"key": "value"}'})]})]}),output:(0,t.jsx)(s.CodeOutput,{code:h,language:"dart"})})}function d({label:e,active:r,onClick:a,highlight:s=!1,small:n=!1}){return(0,t.jsx)("button",{onClick:a,className:`
        flex items-center justify-center gap-2 px-3 py-2 rounded-xl text-[11px] font-bold transition-all duration-300 border
        ${r?s?"bg-primary text-primary-foreground border-primary shadow-lg shadow-primary/20":"bg-primary/10 text-primary border-primary/50":"bg-secondary/20 text-muted-foreground border-border/50 hover:border-border hover:bg-secondary/40"}
        ${n?"py-1.5 text-[10px]":"py-2.5"}
      `,children:e})}e.s(["default",()=>c],2180)}]);