module.exports=[69147,a=>{"use strict";var b=a.i(87924);function c({title:a,description:c,controls:d,output:e}){return(0,b.jsxs)("div",{className:"container mx-auto px-4 py-8 max-w-7xl",children:[(0,b.jsxs)("div",{className:"mb-8",children:[(0,b.jsx)("h1",{className:"text-3xl font-bold tracking-tight text-foreground mb-2",children:a}),(0,b.jsx)("p",{className:"text-muted-foreground",children:c})]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8 items-start",children:[(0,b.jsx)("div",{className:"space-y-6",children:(0,b.jsx)("div",{className:"bg-card rounded-2xl border border-border p-6 shadow-sm",children:d})}),(0,b.jsx)("div",{className:"lg:sticky lg:top-24",children:(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsx)("h2",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wider px-1",children:"Generated Output"}),e]})})]})]})}a.s(["ToolLayout",()=>c])},5151,a=>{"use strict";let b=(0,a.i(70106).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"}]]);a.s(["Copy",()=>b],5151)},33441,a=>{"use strict";let b=(0,a.i(70106).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);a.s(["Check",()=>b],33441)},70920,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(69147),e=a.i(62258);function f(){let[a,f]=(0,c.useState)("https://api.example.com"),[g,h]=(0,c.useState)("/users"),[i,j]=(0,c.useState)("GET"),[k,l]=(0,c.useState)("UserService"),[m,n]=(0,c.useState)("User"),o=`import 'package:dio/dio.dart';
import '../models/${m.toLowerCase()}.dart';

class ${k} {
  final Dio _dio;
  
  ${k}(this._dio);

  Future<${"GET"===i?`List<${m}>`:m}> ${i.toLowerCase()}Data() async {
    try {
      final response = await _dio.${i.toLowerCase()}(
        '${a}${g}',
      );

      if (response.statusCode == 200) {
        ${"GET"===i?`return (response.data as List).map((e) => ${m}.fromJson(e)).toList();`:`return ${m}.fromJson(response.data);`}
      } else {
        throw Exception('Failed to load data: \${response.statusCode}');
      }
    } on DioError catch (e) {
      throw Exception('Dio error: \${e.message}');
    }
  }
}

// Example provider using get_it
// GetIt.I.registerLazySingleton(() => ${k}(GetIt.I<Dio>()));
`;return(0,b.jsx)(d.ToolLayout,{title:"API to Flutter Service Generator",description:"Generate production-ready Dio service classes and repository patterns from API definitions.",controls:(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{className:"text-sm font-medium text-muted-foreground",children:"Base URL"}),(0,b.jsx)("input",{type:"text",value:a,onChange:a=>f(a.target.value),className:"w-full px-4 py-2 bg-background border border-border rounded-xl focus:ring-2 focus:ring-primary outline-none",placeholder:"https://api.example.com"})]}),(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{className:"text-sm font-medium text-muted-foreground",children:"Method"}),(0,b.jsxs)("select",{value:i,onChange:a=>j(a.target.value),className:"w-full px-4 py-2 bg-background border border-border rounded-xl focus:ring-2 focus:ring-primary outline-none",children:[(0,b.jsx)("option",{value:"GET",children:"GET"}),(0,b.jsx)("option",{value:"POST",children:"POST"}),(0,b.jsx)("option",{value:"PUT",children:"PUT"}),(0,b.jsx)("option",{value:"DELETE",children:"DELETE"})]})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{className:"text-sm font-medium text-muted-foreground",children:"Endpoint"}),(0,b.jsx)("input",{type:"text",value:g,onChange:a=>h(a.target.value),className:"w-full px-4 py-2 bg-background border border-border rounded-xl focus:ring-2 focus:ring-primary outline-none",placeholder:"/users"})]})]}),(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{className:"text-sm font-medium text-muted-foreground",children:"Service Name"}),(0,b.jsx)("input",{type:"text",value:k,onChange:a=>l(a.target.value),className:"w-full px-4 py-2 bg-background border border-border rounded-xl focus:ring-2 focus:ring-primary outline-none"})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{className:"text-sm font-medium text-muted-foreground",children:"Model Name"}),(0,b.jsx)("input",{type:"text",value:m,onChange:a=>n(a.target.value),className:"w-full px-4 py-2 bg-background border border-border rounded-xl focus:ring-2 focus:ring-primary outline-none"})]})]}),(0,b.jsxs)("div",{className:"pt-8 border-t border-border flex flex-col items-center",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground uppercase tracking-widest block mb-4 text-center",children:"Architecture Design"}),(0,b.jsx)("div",{className:"w-full aspect-video bg-secondary/30 rounded-2xl border border-border flex items-center justify-center p-6",children:(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsx)("div",{className:"w-16 h-16 rounded-xl bg-orange-500/20 border border-orange-500/30 flex items-center justify-center text-xs font-bold text-orange-500",children:"UI"}),(0,b.jsx)("div",{className:"w-4 h-0.5 bg-border"}),(0,b.jsx)("div",{className:"w-16 h-16 rounded-xl bg-primary/20 border border-primary/30 flex items-center justify-center text-xs font-bold text-primary",children:"REPO"}),(0,b.jsx)("div",{className:"w-4 h-0.5 bg-border"}),(0,b.jsx)("div",{className:"w-16 h-16 rounded-xl bg-green-500/20 border border-green-500/30 flex items-center justify-center text-xs font-bold text-green-500 text-center",children:"API SERVICE"})]})})]})]}),output:(0,b.jsx)(e.CodeOutput,{code:o})})}a.s(["default",()=>f])}];

//# sourceMappingURL=_404e3100._.js.map