(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,38149,e=>{"use strict";var r=e.i(43476);function s({title:e,description:s,controls:t,output:a}){return(0,r.jsxs)("div",{className:"container mx-auto px-4 py-8 max-w-7xl",children:[(0,r.jsxs)("div",{className:"mb-8",children:[(0,r.jsx)("h1",{className:"text-3xl font-bold tracking-tight text-foreground mb-2",children:e}),(0,r.jsx)("p",{className:"text-muted-foreground",children:s})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8 items-start",children:[(0,r.jsx)("div",{className:"space-y-6",children:(0,r.jsx)("div",{className:"bg-card rounded-2xl border border-border p-6 shadow-sm",children:t})}),(0,r.jsx)("div",{className:"lg:sticky lg:top-24",children:(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("h2",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wider px-1",children:"Generated Output"}),a]})})]})]})}e.s(["ToolLayout",()=>s])},74886,e=>{"use strict";let r=(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",()=>r],74886)},43531,e=>{"use strict";let r=(0,e.i(75254).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["Check",()=>r],43531)},31067,e=>{"use strict";function r(){return(r=Object.assign.bind()).apply(null,arguments)}e.s(["default",()=>r])},74520,e=>{"use strict";var r=e.i(43476),s=e.i(71645),t=e.i(38149),a=e.i(74837);function o(){let[e,o]=(0,s.useState)("https://api.example.com"),[d,i]=(0,s.useState)("/users"),[l,n]=(0,s.useState)("GET"),[c,u]=(0,s.useState)("UserService"),[x,m]=(0,s.useState)("User"),p=`import 'package:dio/dio.dart';
import '../models/${x.toLowerCase()}.dart';

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

  Future<${"GET"===l?`List<${x}>`:x}> ${l.toLowerCase()}Data() async {
    try {
      final response = await _dio.${l.toLowerCase()}(
        '${e}${d}',
      );

      if (response.statusCode == 200) {
        ${"GET"===l?`return (response.data as List).map((e) => ${x}.fromJson(e)).toList();`:`return ${x}.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(() => ${c}(GetIt.I<Dio>()));
`;return(0,r.jsx)(t.ToolLayout,{title:"API to Flutter Service Generator",description:"Generate production-ready Dio service classes and repository patterns from API definitions.",controls:(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-muted-foreground",children:"Base URL"}),(0,r.jsx)("input",{type:"text",value:e,onChange:e=>o(e.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,r.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-muted-foreground",children:"Method"}),(0,r.jsxs)("select",{value:l,onChange:e=>n(e.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,r.jsx)("option",{value:"GET",children:"GET"}),(0,r.jsx)("option",{value:"POST",children:"POST"}),(0,r.jsx)("option",{value:"PUT",children:"PUT"}),(0,r.jsx)("option",{value:"DELETE",children:"DELETE"})]})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-muted-foreground",children:"Endpoint"}),(0,r.jsx)("input",{type:"text",value:d,onChange:e=>i(e.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,r.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-muted-foreground",children:"Service Name"}),(0,r.jsx)("input",{type:"text",value:c,onChange:e=>u(e.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,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-muted-foreground",children:"Model Name"}),(0,r.jsx)("input",{type:"text",value:x,onChange:e=>m(e.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,r.jsxs)("div",{className:"pt-8 border-t border-border flex flex-col items-center",children:[(0,r.jsx)("span",{className:"text-xs text-muted-foreground uppercase tracking-widest block mb-4 text-center",children:"Architecture Design"}),(0,r.jsx)("div",{className:"w-full aspect-video bg-secondary/30 rounded-2xl border border-border flex items-center justify-center p-6",children:(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.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,r.jsx)("div",{className:"w-4 h-0.5 bg-border"}),(0,r.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,r.jsx)("div",{className:"w-4 h-0.5 bg-border"}),(0,r.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,r.jsx)(a.CodeOutput,{code:p})})}e.s(["default",()=>o])}]);