easy_ml 0.2.0.pre.rc43 → 0.2.0.pre.rc45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/frontend/pages/SettingsPage.tsx +3 -7
- data/config/initializers/zhong.rb +1 -1
- data/lib/easy_ml/version.rb +1 -1
- data/public/easy_ml/assets/.vite/manifest.json +1 -1
- data/public/easy_ml/assets/assets/entrypoints/{Application.tsx-jPsqOyb0.js → Application.tsx-BQL_uYxE.js} +2 -2
- data/public/easy_ml/assets/assets/entrypoints/{Application.tsx-jPsqOyb0.js.map → Application.tsx-BQL_uYxE.js.map} +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6df30d23d49530894614483d7bebe0599aa1aa1fc62108024b7c417cd1bb550
|
4
|
+
data.tar.gz: ce317fa72227d618313d9b41b1d632d18628029253d33a69834c7ca878f18c4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1508d885e06d23f8e255d56499e2ab6757e9a5725b1f367a66b2b0a6e904c15aff437f0dc3b660a067e2d45730659248af4ff31f0dc02198b840735c3845c7a2
|
7
|
+
data.tar.gz: 3631f30b7825a0cb5a6a5b6a0044fbfc5ce2bc4f627d395c66045f34c9c2fde43be249e996ee37ab9eb36ef5bd74cbfdfcc4ad6d5f93325ea07a48914f29efd4
|
@@ -27,9 +27,6 @@ export default function SettingsPage({ settings: initialSettings }: { settings:
|
|
27
27
|
timezone: initialSettings?.settings?.timezone || 'America/New_York',
|
28
28
|
s3_bucket: initialSettings?.settings?.s3_bucket || '',
|
29
29
|
s3_region: initialSettings?.settings?.s3_region || 'us-east-1',
|
30
|
-
s3_access_key_id: initialSettings?.settings?.s3_access_key_id || '',
|
31
|
-
s3_secret_access_key: initialSettings?.settings?.s3_secret_access_key || '',
|
32
|
-
wandb_api_key: initialSettings?.settings?.wandb_api_key || ''
|
33
30
|
}
|
34
31
|
});
|
35
32
|
|
@@ -176,11 +173,10 @@ export default function SettingsPage({ settings: initialSettings }: { settings:
|
|
176
173
|
<button
|
177
174
|
type="submit"
|
178
175
|
disabled={processing}
|
179
|
-
className={`px-4 py-2 text-white text-sm font-medium rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 ${
|
180
|
-
|
181
|
-
? 'bg-blue-400 cursor-not-allowed'
|
176
|
+
className={`px-4 py-2 text-white text-sm font-medium rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 ${processing
|
177
|
+
? 'bg-blue-400 cursor-not-allowed'
|
182
178
|
: 'bg-blue-600 hover:bg-blue-700'
|
183
|
-
|
179
|
+
}`}
|
184
180
|
>
|
185
181
|
{processing ? 'Saving...' : 'Save Settings'}
|
186
182
|
</button>
|
data/lib/easy_ml/version.rb
CHANGED
@@ -426,7 +426,7 @@ end`})})]})})}function bR({options:e,initialFeatures:t=[],onFeaturesChange:n}){c
|
|
426
426
|
# df["column"] = df["column"].map { |value| value.upcase }
|
427
427
|
df
|
428
428
|
end`,spellCheck:!1})]}),a.jsx("div",{className:"bg-blue-50 rounded-lg p-4",children:a.jsxs("div",{className:"flex gap-2",children:[a.jsx(xn,{className:"w-5 h-5 text-blue-500 flex-shrink-0"}),a.jsxs("div",{className:"text-sm text-blue-700",children:[a.jsx("p",{className:"font-medium mb-1",children:"Feature Guidelines"}),a.jsxs("ul",{className:"list-disc pl-4 space-y-1",children:[a.jsx("li",{children:"The function must be named 'feature'"}),a.jsx("li",{children:"It should accept a DataFrame as its only parameter"}),a.jsx("li",{children:"All operations should be performed on the DataFrame object"}),a.jsx("li",{children:"The function must return the modified DataFrame"}),a.jsx("li",{children:"Use standard Ruby syntax and DataFrame operations"})]})]})]})})]})}function $R({dataset:e,code:t,inputColumns:n,outputColumns:r}){const[i,l]=A.useState(!1),[u,d]=A.useState(null),[f,m]=A.useState(null),h=()=>{l(!0),d(null),setTimeout(()=>{try{m(e.sampleData),l(!1)}catch(g){d(g instanceof Error?g.message:"An error occurred"),l(!1)}},1e3)};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("h4",{className:"text-sm font-medium text-gray-900",children:"Data Preview"}),a.jsxs("button",{onClick:h,disabled:i,className:"inline-flex items-center gap-2 px-3 py-1.5 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 disabled:opacity-50",children:[a.jsx(Mb,{className:"w-4 h-4"}),i?"Running...":"Run Preview"]})]}),u&&a.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4",children:a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx($b,{className:"w-5 h-5 text-red-500 mt-0.5"}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-red-800",children:"Feature Error"}),a.jsx("pre",{className:"mt-1 text-sm text-red-700 whitespace-pre-wrap font-mono",children:u})]})]})}),a.jsx("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:a.jsxs("div",{className:"grid grid-cols-2 divide-x divide-gray-200",children:[a.jsxs("div",{children:[a.jsx("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200",children:a.jsx("h5",{className:"text-sm font-medium text-gray-700",children:"Input Data"})}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[a.jsx("thead",{className:"bg-gray-50",children:a.jsx("tr",{children:n.map(g=>a.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:g},g))})}),a.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:e.sampleData.map((g,y)=>a.jsx("tr",{children:n.map(N=>a.jsx("td",{className:"px-4 py-2 text-sm text-gray-900 whitespace-nowrap",children:String(g[N])},N))},y))})]})})]}),a.jsxs("div",{children:[a.jsx("div",{className:"px-4 py-2 bg-gray-50 border-b border-gray-200",children:a.jsx("h5",{className:"text-sm font-medium text-gray-700",children:f?"Featureed Data":"Output Preview"})}),a.jsx("div",{className:"overflow-x-auto",children:f?a.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[a.jsx("thead",{className:"bg-gray-50",children:a.jsx("tr",{children:r.map(g=>a.jsx("th",{className:"px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:g},g))})}),a.jsx("tbody",{className:"bg-white divide-y divide-gray-200",children:f.map((g,y)=>a.jsx("tr",{children:r.map(N=>a.jsx("td",{className:"px-4 py-2 text-sm text-gray-900 whitespace-nowrap",children:String(g[N])},N))},y))})]}):a.jsx("div",{className:"p-8 text-center text-sm text-gray-500",children:"Run the feature to see the preview"})})]})]})})]})}function tw({datasets:e,groups:t,initialData:n,onSubmit:r,onCancel:i}){const[l,u]=A.useState({name:(n==null?void 0:n.name)||"",description:(n==null?void 0:n.description)||"",groupId:(n==null?void 0:n.groupId)||"",testDatasetId:(n==null?void 0:n.testDatasetId)||"",inputColumns:(n==null?void 0:n.inputColumns)||[],outputColumns:(n==null?void 0:n.outputColumns)||[],code:(n==null?void 0:n.code)||""}),[d,f]=A.useState(n!=null&&n.testDatasetId&&e.find(y=>y.id===n.testDatasetId)||null),m=y=>{y.preventDefault(),r(l)},h=y=>{const N=e.find(x=>x.id===Number(y))||null;f(N),u(x=>({...x,testDatasetId:y,inputColumns:[],outputColumns:[]}))},g=(y,N)=>{u(x=>({...x,[N==="input"?"inputColumns":"outputColumns"]:x[N==="input"?"inputColumns":"outputColumns"].includes(y)?x[N==="input"?"inputColumns":"outputColumns"].filter(b=>b!==y):[...x[N==="input"?"inputColumns":"outputColumns"],y]}))};return a.jsxs("form",{onSubmit:m,className:"p-6 space-y-8",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-700",children:"Name"}),a.jsx("input",{type:"text",id:"name",value:l.name,onChange:y=>u({...l,name:y.target.value}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500",required:!0})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"group",className:"block text-sm font-medium text-gray-700",children:"Group"}),a.jsxs("select",{id:"group",value:l.groupId,onChange:y=>u({...l,groupId:y.target.value}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500",required:!0,children:[a.jsx("option",{value:"",children:"Select a group..."}),t.map(y=>a.jsx("option",{value:y.id,children:y.name},y.id))]})]})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"description",className:"block text-sm font-medium text-gray-700",children:"Description"}),a.jsx("textarea",{id:"description",value:l.description,onChange:y=>u({...l,description:y.target.value}),rows:3,className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"dataset",className:"block text-sm font-medium text-gray-700",children:"Test Dataset"}),a.jsxs("select",{id:"dataset",value:l.testDatasetId,onChange:y=>h(y.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500",required:!0,children:[a.jsx("option",{value:"",children:"Select a dataset..."}),e.map(y=>a.jsx("option",{value:y.id,children:y.name},y.id))]})]}),d&&a.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Input Columns"}),a.jsx("div",{className:"space-y-2",children:d.columns.map(y=>a.jsxs("label",{className:"flex items-center gap-2 p-2 rounded-md hover:bg-gray-50",children:[a.jsx("input",{type:"checkbox",checked:l.inputColumns.includes(y.name),onChange:()=>g(y.name,"input"),className:"rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),a.jsx("span",{className:"text-sm text-gray-900",children:y.name}),a.jsxs("span",{className:"text-xs text-gray-500",children:["(",y.type,")"]})]},y.name))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Output Columns"}),a.jsx("div",{className:"space-y-2",children:d.columns.map(y=>a.jsxs("label",{className:"flex items-center gap-2 p-2 rounded-md hover:bg-gray-50",children:[a.jsx("input",{type:"checkbox",checked:l.outputColumns.includes(y.name),onChange:()=>g(y.name,"output"),className:"rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),a.jsx("span",{className:"text-sm text-gray-900",children:y.name}),a.jsxs("span",{className:"text-xs text-gray-500",children:["(",y.type,")"]})]},y.name))})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Feature Code"}),a.jsx("div",{className:"bg-gray-50 rounded-lg p-4",children:a.jsx(FR,{value:l.code,onChange:y=>u({...l,code:y}),language:"ruby"})})]}),d&&l.code&&a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-medium text-gray-900 mb-2",children:"Preview"}),a.jsx($R,{dataset:d,code:l.code,inputColumns:l.inputColumns,outputColumns:l.outputColumns})]}),a.jsxs("div",{className:"flex justify-end gap-3 pt-6 border-t",children:[a.jsx("button",{type:"button",onClick:i,className:"px-4 py-2 text-sm font-medium text-gray-700 hover:text-gray-900",children:"Cancel"}),a.jsx("button",{type:"submit",className:"px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:n?"Save Changes":"Create Feature"})]})]})}function DR(){const e=useNavigate(),{id:t}=useParams(),n=Ni.flatMap(i=>i.features).find(i=>i.id===Number(t));if(!n)return a.jsx("div",{className:"text-center py-12",children:a.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Feature not found"})});const r=i=>{console.log("Updating feature:",i),e("/features")};return a.jsx("div",{className:"max-w-4xl mx-auto p-8",children:a.jsxs("div",{className:"bg-white rounded-lg shadow-lg",children:[a.jsx("div",{className:"px-6 py-4 border-b border-gray-200",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Xh,{className:"w-6 h-6 text-blue-600"}),a.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Edit Feature"})]})}),a.jsx(tw,{datasets:ew,groups:Ni,initialData:{name:n.name,description:n.description,groupId:n.groupId,testDatasetId:n.testDatasetId,inputColumns:n.inputColumns,outputColumns:n.outputColumns,code:n.code},onSubmit:r,onCancel:()=>e("/features")})]})})}const zR=Object.freeze(Object.defineProperty({__proto__:null,default:DR},Symbol.toStringTag,{value:"Module"}));function UR({initialModel:e,onViewDetails:t,handleDelete:n,rootPath:r}){const[i,l]=A.useState(e),[u,d]=A.useState(!1);A.useEffect(()=>{let b;return i.is_training&&(b=window.setInterval(async()=>{const w=await(await fetch(`${r}/models/${i.id}`,{headers:{Accept:"application/json"}})).json();l(w.model)},2e3)),()=>{b&&window.clearInterval(b)}},[i.is_training,i.id,r]);const f=async()=>{try{l({...i,is_training:!0}),await rt.post(`${r}/models/${i.id}/train`,{},{preserveScroll:!0,preserveState:!0})}catch(b){console.error("Failed to start training:",b)}},m=i.dataset,h=i.retraining_job,g=i.last_run,y=()=>i.is_training?a.jsx(Li,{className:"w-4 h-4 animate-spin text-yellow-500"}):g?g.status==="failed"?a.jsx(Tb,{className:"w-4 h-4 text-red-500"}):g.status==="success"?a.jsx(gT,{className:"w-4 h-4 text-green-500"}):null:null,N=()=>i.is_training?"Training in progress...":g?g.status==="failed"?"Last run failed":g.status==="success"?g.deployable?"Last run succeeded":"Last run completed (below threshold)":"Unknown status":"Never trained",x=()=>i.is_training?"text-yellow-700":g?g.status==="failed"?"text-red-700":g.status==="success"?g.deployable?"text-green-700":"text-orange-700":"text-gray-700":"text-gray-500";return a.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6 hover:shadow-lg transition-shadow",children:[a.jsxs("div",{className:"flex flex-col gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium
|
429
|
-
${i.deployment_status==="inference"?"bg-blue-100 text-blue-800":"bg-gray-100 text-gray-800"}`,children:i.deployment_status}),i.is_training&&a.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800",children:[a.jsx(Li,{className:"w-3 h-3 animate-spin"}),"training"]})]}),a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:i.name}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:f,disabled:i.is_training,className:`text-gray-400 hover:text-green-600 transition-colors ${i.is_training?"opacity-50 cursor-not-allowed":""}`,title:"Train model",children:a.jsx(Mb,{className:"w-5 h-5"})}),i.metrics_url&&a.jsx("a",{href:i.metrics_url,target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-purple-600 transition-colors",title:"View metrics",children:a.jsx(Pb,{className:"w-5 h-5"})}),a.jsx(yr,{href:`${r}/models/${i.id}`,className:"text-gray-400 hover:text-gray-600",title:"View details",children:a.jsx(Ob,{className:"w-5 h-5"})}),a.jsx(yr,{href:`${r}/models/${i.id}/edit`,className:"text-gray-400 hover:text-gray-600",title:"Edit model",children:a.jsx(Bl,{className:"w-5 h-5"})}),a.jsx("button",{onClick:()=>n(i.id),className:"text-gray-400 hover:text-gray-600",title:"Delete model",children:a.jsx(aa,{className:"w-5 h-5"})})]})]}),a.jsxs("p",{className:"text-sm text-gray-500",children:[a.jsx("span",{className:"font-semibold",children:"Model Type: "}),i.formatted_model_type]}),a.jsxs("p",{className:"text-sm text-gray-500",children:[a.jsx("span",{className:"font-semibold",children:"Version: "}),i.version]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ln,{className:"w-4 h-4 text-gray-400"}),m?a.jsx(yr,{href:`${r}/datasets/${m.id}`,className:"text-sm text-blue-600 hover:text-blue-800",children:m.name}):a.jsx("span",{className:"text-sm text-gray-600",children:"Dataset not found"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Qh,{className:"w-4 h-4 text-gray-400"}),a.jsx("span",{className:"text-sm text-gray-600",children:h!=null&&h.active?`Retrains ${i.formatted_frequency}`:"Retrains manually"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(lT,{className:"w-4 h-4 text-gray-400"}),a.jsx("span",{className:"text-sm text-gray-600",children:i.last_run_at?`Last run: ${new Date(i.last_run_at||"").toLocaleDateString()}`:"Never run"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[y(),a.jsx("span",{className:gr("text-sm",x()),children:N()})]})]}),(g==null?void 0:g.metrics)&&a.jsx("div",{className:"mt-4 pt-4 border-t border-gray-100",children:a.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(g.metrics).map(([b,E])=>a.jsxs("div",{className:`px-2 py-1 rounded-md text-xs font-medium ${g.deployable?"bg-green-100 text-green-800":"bg-red-100 text-red-800"}`,children:[b,": ",E.toFixed(4)]},b))})}),!i.is_training&&(g==null?void 0:g.status)==="failed"&&g.stacktrace&&a.jsxs("div",{className:"mt-4 pt-4 border-t border-gray-100",children:[a.jsxs("button",{onClick:()=>d(!u),className:"flex items-center gap-2 text-sm text-red-600 hover:text-red-700",children:[a.jsx(xn,{className:"w-4 h-4"}),a.jsx("span",{children:"View Error Details"}),u?a.jsx(Ul,{className:"w-4 h-4"}):a.jsx(oa,{className:"w-4 h-4"})]}),u&&a.jsx("div",{className:"mt-2 p-3 bg-red-50 rounded-md",children:a.jsx("pre",{className:"text-xs text-red-700 whitespace-pre-wrap font-mono",children:g.stacktrace})})]})]})}const Kp=6;function BR({rootPath:e,models:t}){const[n,r]=A.useState(null),[i,l]=A.useState(""),[u,d]=A.useState(1),f=A.useMemo(()=>t.filter(y=>y.name.toLowerCase().includes(i.toLowerCase())||y.model_type.toLowerCase().includes(i.toLowerCase())),[i,t]),m=Math.ceil(f.length/Kp),h=f.slice((u-1)*Kp,u*Kp),g=y=>{confirm("Are you sure you want to delete this model?")&&rt.delete(`${e}/models/${y}`)};return t.length===0?a.jsx("div",{className:"p-8",children:a.jsx(Ad,{icon:Bs,title:"Create your first ML model",description:"Get started by creating a machine learning model. You can train models for classification, regression, and more.",actionLabel:"Create Model",onAction:()=>{rt.visit(`${e}/models/new`)}})}):a.jsx("div",{className:"p-8",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Models"}),a.jsx(Zh,{value:i,onChange:l,placeholder:"Search models..."})]}),a.jsxs("button",{onClick:()=>rt.visit(`${e}/models/new`),className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:[a.jsx(Js,{className:"w-4 h-4"}),"New Model"]})]}),h.length===0?a.jsxs("div",{className:"text-center py-12 bg-white rounded-lg shadow",children:[a.jsx(Bs,{className:"mx-auto h-12 w-12 text-gray-400"}),a.jsx("h3",{className:"mt-2 text-sm font-medium text-gray-900",children:"No models found"}),a.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"No models match your search criteria. Try adjusting your search or create a new model."}),a.jsx("div",{className:"mt-6",children:a.jsxs("button",{onClick:()=>rt.visit(`${e}/models/new`),className:"inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:[a.jsx(Js,{className:"w-4 h-4 mr-2"}),"New Model"]})})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:h.map(y=>a.jsx(UR,{rootPath:e,initialModel:y,onViewDetails:r,handleDelete:g},y.id))}),m>1&&a.jsx(eg,{currentPage:u,totalPages:m,onPageChange:d})]})]})})}const WR=Object.freeze(Object.defineProperty({__proto__:null,default:BR},Symbol.toStringTag,{value:"Module"}));function HR({attributes:e,columns:t,onChange:n}){return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"date_col",className:"block text-sm font-medium text-gray-700",children:"Date Column"}),a.jsx(ot,{id:"date_col",value:e.date_col,options:t.map(r=>({value:r,label:r})),onChange:r=>n({...e,date_col:r}),placeholder:"Select date column"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"months_test",className:"block text-sm font-medium text-gray-700",children:"Test Months"}),a.jsx("input",{type:"number",id:"months_test",value:e.months_test,onChange:r=>n({...e,months_test:parseInt(r.target.value)}),className:"mt-1 p-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm",min:"1"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"months_valid",className:"block text-sm font-medium text-gray-700",children:"Validation Months"}),a.jsx("input",{type:"number",id:"months_valid",value:e.months_valid,onChange:r=>n({...e,months_valid:parseInt(r.target.value)}),className:"mt-1 p-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm",min:"1"})]})]})]})}function VR({attributes:e,onChange:t}){return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(Lb,{className:"w-5 h-5 text-blue-500 mt-0.5"}),a.jsx("p",{className:"text-sm text-blue-700",children:"Random splitting will automatically split your data into 60% training, 20% test, and 20% validation sets."})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"train_ratio",className:"block text-sm font-medium text-gray-700",children:"Training Ratio"}),a.jsx("input",{type:"number",id:"train_ratio",value:e.train_ratio??.6,onChange:n=>t({...e,train_ratio:parseFloat(n.target.value)}),className:"mt-1 p-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm",min:"0",max:"1",step:"0.1"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"test_ratio",className:"block text-sm font-medium text-gray-700",children:"Test Ratio"}),a.jsx("input",{type:"number",id:"test_ratio",value:e.test_ratio??.2,onChange:n=>t({...e,test_ratio:parseFloat(n.target.value)}),className:"mt-1 p-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm",min:"0",max:"1",step:"0.1"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"valid_ratio",className:"block text-sm font-medium text-gray-700",children:"Validation Ratio"}),a.jsx("input",{type:"number",id:"valid_ratio",value:e.valid_ratio??.2,onChange:n=>t({...e,valid_ratio:parseFloat(n.target.value)}),className:"mt-1 p-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm",min:"0",max:"1",step:"0.1"})]})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"seed",className:"block text-sm font-medium text-gray-700",children:"Random Seed (optional)"}),a.jsx("input",{type:"number",id:"seed",value:e.seed??"",onChange:n=>t({...e,seed:n.target.value?parseInt(n.target.value):void 0}),className:"mt-1 p-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm",placeholder:"Enter a random seed"})]})]})}function qR({attributes:e,available_files:t,onChange:n}){const[r,i]=tr.useState([]);tr.useEffect(()=>{const h=[...e.train_files.map(g=>({path:g,type:"train"})),...e.test_files.map(g=>({path:g,type:"test"})),...e.valid_files.map(g=>({path:g,type:"valid"}))];i(h)},[e.train_files,e.test_files,e.valid_files]);const l=h=>{const g=[...r,{path:h,type:"train"}];i(g),f(g)},u=(h,g)=>{const y=r.map((N,x)=>x===h?{...N,type:g}:N);i(y),f(y)},d=h=>{const g=r.filter((y,N)=>N!==h);i(g),f(g)},f=h=>{n({splitter_type:"predefined",train_files:h.filter(g=>g.type==="train").map(g=>g.path),test_files:h.filter(g=>g.type==="test").map(g=>g.path),valid_files:h.filter(g=>g.type==="valid").map(g=>g.path)})},m=t.filter(h=>!r.find(g=>g.path===h));return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Add File"}),a.jsx(ot,{options:m.map(h=>({value:h,label:h.split("/").pop()||h,description:h})),value:null,onChange:h=>l(h),placeholder:"Select a file..."})]}),r.length>0?a.jsx("div",{className:"space-y-2",children:r.map((h,g)=>a.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx(vT,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),a.jsx("span",{className:"text-sm text-gray-900 truncate",children:h.path.split("/").pop()})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("select",{value:h.type,onChange:y=>u(g,y.target.value),className:"text-sm rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500",children:[a.jsx("option",{value:"train",children:"Training Set"}),a.jsx("option",{value:"test",children:"Test Set"}),a.jsx("option",{value:"valid",children:"Validation Set"})]}),a.jsx("button",{onClick:()=>d(g),className:"text-sm text-red-600 hover:text-red-700",children:"Remove"})]})]},h.path))}):a.jsx("div",{className:"text-center py-4 bg-gray-50 rounded-lg border-2 border-dashed border-gray-200",children:a.jsx("p",{className:"text-sm text-gray-500",children:"Select files to create your train/test/validation splits"})}),r.length>0&&a.jsxs("div",{className:"space-y-1 text-sm",children:[!r.some(h=>h.type==="train")&&a.jsx("p",{className:"text-yellow-600",children:"• You need at least one training set file"}),!r.some(h=>h.type==="test")&&a.jsx("p",{className:"text-yellow-600",children:"• You need at least one test set file"})]})]})}function ov({targetColumn:e,testSize:t,validSize:n,columns:r,onChange:i}){return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Target Column"}),a.jsx(ot,{options:r.map(l=>({value:l.name,label:l.name,description:`Type: ${l.type}`})),value:e,onChange:l=>i({targetColumn:l,testSize:t,validSize:n}),placeholder:"Select target column..."})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Test Set Size (%)"}),a.jsx("input",{type:"number",min:1,max:40,value:t,onChange:l=>i({targetColumn:e,testSize:parseInt(l.target.value)||0,validSize:n}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Validation Set Size (%)"}),a.jsx("input",{type:"number",min:1,max:40,value:n,onChange:l=>i({targetColumn:e,testSize:t,validSize:parseInt(l.target.value)||0}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"})]})]})]})}function GR({type:e,targetColumn:t,groupColumn:n,nSplits:r,columns:i,onChange:l}){return a.jsxs("div",{className:"space-y-4",children:[(e==="stratified"||e==="group")&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:e==="stratified"?"Target Column":"Group Column"}),a.jsx(ot,{options:i.map(u=>({value:u.name,label:u.name,description:`Type: ${u.type}`})),value:e==="stratified"?t:n,onChange:u=>l({targetColumn:e==="stratified"?u:t,groupColumn:e==="group"?u:n,nSplits:r}),placeholder:`Select ${e==="stratified"?"target":"group"} column...`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Number of Splits"}),a.jsx("input",{type:"number",min:2,max:10,value:r,onChange:u=>l({targetColumn:t,groupColumn:n,nSplits:parseInt(u.target.value)||2}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"})]})]})}function KR({p:e,onChange:t}){return a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Number of samples to leave out (P)"}),a.jsx("input",{type:"number",min:1,max:100,value:e,onChange:n=>t(parseInt(n.target.value)||1),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"}),a.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"Each training set will have P samples removed, which form the test set."})]})})}const QR=[{value:"date",label:"Date Split",description:"Split data based on a date/time column"},{value:"random",label:"Random Split",description:"Randomly split data into train/test/validation sets (70/20/10)"},{value:"predefined",label:"Predefined Splits",description:"Use separate files for train/test/validation sets"}],XR={date:{date_column:"",months_test:2,months_valid:1},random:{},predefined:{train_files:[],test_files:[],valid_files:[]},stratified:{targetColumn:"",testSize:20,validSize:10},stratified_kfold:{targetColumn:"",nSplits:5},group_kfold:{groupColumn:"",nSplits:5},group_shuffle:{groupColumn:"",testSize:20,validSize:10},leave_p_out:{p:1}};function YR({type:e,splitter_attributes:t,columns:n,available_files:r,onSplitterChange:i,onChange:l}){const u=n.filter(h=>h.type==="datetime").map(h=>h.name),d=h=>{l(h,XR[h])},f=(h,g)=>{l(h,g)},m=()=>{switch(e){case"date":return a.jsx(HR,{attributes:t,columns:u,onChange:h=>f(e,h)});case"random":return a.jsx(VR,{attributes:t,onChange:h=>f(e,h)});case"predefined":return a.jsx(qR,{attributes:t,available_files:r,onChange:h=>f(e,h)});case"stratified":return a.jsx(ov,{attributes:t,columns:n,onChange:h=>f(e,h)});case"stratified_kfold":case"group_kfold":return a.jsx(GR,{attributes:t,columns:n,onChange:h=>f(e,h)});case"group_shuffle":return a.jsx(ov,{attributes:t,columns:n,onChange:h=>f(e,{groupColumn:h.targetColumn,testSize:h.testSize,validSize:h.validSize})});case"leave_p_out":return a.jsx(KR,{attributes:t,onChange:h=>f(e,h)});default:return null}};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Split Type"}),a.jsx(ot,{options:QR,value:e,onChange:h=>d(h)})]}),a.jsx("div",{className:"bg-gray-50 rounded-lg p-4",children:m()})]})}const JR=e=>e.date_col?!e.months_test||e.months_test<=0?{isValid:!1,error:"Test months must be greater than 0"}:!e.months_valid||e.months_valid<=0?{isValid:!1,error:"Validation months must be greater than 0"}:{isValid:!0}:{isValid:!1,error:"Please select a date column"},ZR=e=>{const t=(e.train_ratio??.6)+(e.test_ratio??.2)+(e.valid_ratio??.2);return Math.abs(t-1)>=.001?{isValid:!1,error:`Split ratios must sum to 1.0 (current sum: ${t.toFixed(2)})`}:{isValid:!0}},e6=e=>!e.train_files||e.train_files.length===0?{isValid:!1,error:"Please select at least one file for splitting"}:{isValid:!0},t6=e=>{if(!e.stratify_column)return{isValid:!1,error:"Please select a column to stratify on"};const t=(e.train_ratio??0)+(e.test_ratio??0)+(e.valid_ratio??0);return Math.abs(t-1)>=.001?{isValid:!1,error:`Split ratios must sum to 1.0 (current sum: ${t.toFixed(2)})`}:{isValid:!0}},n6=e=>!e.n_splits||e.n_splits<=1?{isValid:!1,error:"Number of splits must be greater than 1"}:{isValid:!0},r6=e=>!e.p||e.p<=0?{isValid:!1,error:"P value must be greater than 0"}:{isValid:!0},s6=(e,t)=>{switch(e){case"date":return JR(t);case"random":return ZR(t);case"predefined":return e6(t);case"stratified":return t6(t);case"stratified_kfold":case"group_kfold":return n6(t);case"leave_p_out":return r6(t);default:return{isValid:!1,error:"Invalid splitter type"}}};function i6({constants:e,datasources:t}){var D;const[n,r]=A.useState(1),[i,l]=A.useState(null),[u,d]=A.useState("random"),{rootPath:f}=_r().props,m=z=>{switch(z){case"date":return{date_col:"",months_test:2,months_valid:2};case"random":return{};case"predefined":return{train_files:[],test_files:[],valid_files:[]};case"stratified":return{stratify_column:"",train_ratio:.6,test_ratio:.2,valid_ratio:.2};case"stratified_kfold":case"group_kfold":return{target_column:"",group_column:"",n_splits:5};case"leave_p_out":return{p:1,shuffle:!0,random_state:42};default:return{}}},h=Pd({dataset:{name:"",datasource_id:"",splitter_attributes:{splitter_type:u,...m(u)}}});A.useEffect(()=>{h.setData("dataset.splitter_attributes",{splitter_type:u,...m(u)})},[u]);const g=(z,B)=>{d(z),h.setData("dataset.splitter_attributes",{splitter_type:z,...B})};console.log((D=h.dataset)==null?void 0:D.splitter_attributes);const{data:y,setData:N,post:x}=h,b=y.dataset.datasource_id?t.find(z=>z.id===Number(y.dataset.datasource_id)):null,E=((b==null?void 0:b.columns)||[]).map(z=>({name:z,type:((b==null?void 0:b.schema)||{})[z]||""})),w=b&&!b.is_syncing&&!b.sync_error,S=y.dataset.name&&w,C=()=>{S&&r(2)},R=z=>{z.preventDefault(),x(`${f}/datasets`,{onSuccess:()=>{rt.visit(`${f}/datasets`)},onError:B=>{console.error("Failed to create dataset:",B)}})},O=()=>y.dataset.name?y.dataset.datasource_id?s6(y.dataset.splitter_attributes.splitter_type,y.dataset.splitter_attributes).error:"Please select a datasource":"Please enter a dataset name",F=()=>!O();return a.jsx("div",{className:"max-w-2xl mx-auto p-8",children:a.jsxs("div",{className:"bg-white rounded-lg shadow-lg p-6",children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-6",children:"Create New Dataset"}),a.jsxs("div",{className:"mb-8",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx("div",{className:`flex items-center justify-center w-8 h-8 rounded-full ${n>=1?"bg-blue-600":"bg-gray-200"} text-white font-medium text-sm`,children:"1"}),a.jsx("div",{className:`flex-1 h-0.5 mx-2 ${n>=2?"bg-blue-600":"bg-gray-200"}`}),a.jsx("div",{className:`flex items-center justify-center w-8 h-8 rounded-full ${n>=2?"bg-blue-600":"bg-gray-200"} text-white font-medium text-sm`,children:"2"})]}),a.jsxs("div",{className:"flex justify-between mt-2",children:[a.jsx("span",{className:"text-sm font-medium text-gray-600",children:"Basic Info"}),a.jsx("span",{className:"text-sm font-medium text-gray-600 mr-4",children:"Configure Split"})]})]}),n===1?a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-700",children:"Dataset Name"}),a.jsx("input",{type:"text",id:"name",value:y.dataset.name,onChange:z=>N("dataset.name",z.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 py-2 px-4 shadow-sm border-gray-300 border",required:!0})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"description",className:"block text-sm font-medium text-gray-700",children:"Description"}),a.jsx("textarea",{id:"description",value:y.dataset.description,onChange:z=>N("dataset.description",z.target.value),rows:3,className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 py-2 px-4 shadow-sm border-gray-300 border"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"datasource",className:"block text-sm font-medium text-gray-700 mb-1",children:"Datasource"}),a.jsx(ot,{value:y.dataset.datasource_id,onChange:z=>N("dataset.datasource_id",z),options:t.map(z=>({value:z.id,label:z.name})),placeholder:"Select a datasource..."})]}),b&&a.jsx("div",{className:`rounded-lg p-4 ${b.sync_error?"bg-red-50":b.is_syncing?"bg-blue-50":"bg-green-50"}`,children:a.jsx("div",{className:"flex items-start gap-2",children:b.is_syncing?a.jsxs(a.Fragment,{children:[a.jsx(Li,{className:"w-5 h-5 text-blue-500 animate-spin"}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-blue-800",children:"Datasource is syncing"}),a.jsx("p",{className:"mt-1 text-sm text-blue-700",children:"Please wait while we sync your data. This may take a few minutes."})]})]}):b.sync_error?a.jsxs(a.Fragment,{children:[a.jsx(xn,{className:"w-5 h-5 text-red-500"}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-red-800",children:"Sync failed"}),a.jsx("p",{className:"mt-1 text-sm text-red-700",children:"There was an error syncing your datasource."}),a.jsxs("button",{onClick:()=>l(b.id),className:"mt-2 flex items-center gap-1 text-sm text-red-700 hover:text-red-800",children:["View error details",i===b.id?a.jsx(Ul,{className:"w-4 h-4"}):a.jsx(oa,{className:"w-4 h-4"})]}),i===b.id&&a.jsx("pre",{className:"mt-2 p-2 text-xs text-red-700 bg-red-100 rounded-md whitespace-pre-wrap break-words font-mono max-h-32 overflow-y-auto",children:b.stacktrace})]})]}):a.jsxs(a.Fragment,{children:[a.jsx(Ln,{className:"w-5 h-5 text-green-500"}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-green-800",children:"Datasource ready"}),a.jsx("p",{className:"mt-1 text-sm text-green-700",children:"Your datasource is synced and ready to use."})]})]})})}),a.jsx("div",{className:"flex justify-end",children:a.jsx("button",{type:"button",onClick:C,disabled:!S,className:"px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-300 disabled:cursor-not-allowed",children:"Next"})})]}):a.jsxs("form",{onSubmit:R,className:"space-y-6",children:[a.jsx(YR,{type:u,splitter_attributes:h.data.dataset.splitter_attributes,columns:E,available_files:b.available_files,onChange:g}),O()&&a.jsx("div",{className:"mt-2 text-sm text-red-600",children:O()}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("button",{type:"button",onClick:()=>r(1),className:"px-4 py-2 text-sm font-medium text-gray-700 hover:text-gray-900",children:"Back"}),a.jsx("button",{type:"submit",disabled:!F(),className:"px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-300 disabled:cursor-not-allowed",children:"Create Dataset"})]})]})]})})}const o6=Object.freeze(Object.defineProperty({__proto__:null,default:i6},Symbol.toStringTag,{value:"Module"}));function a6({datasets:e,constants:t,errors:n}){return a.jsx("div",{className:"max-w-2xl mx-auto p-8",children:a.jsxs("div",{className:"bg-white rounded-lg shadow-lg p-6",children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-6",children:"Create New Model"}),a.jsx(Zb,{datasets:e,constants:t,errors:n})]})})}const l6=Object.freeze(Object.defineProperty({__proto__:null,default:a6},Symbol.toStringTag,{value:"Module"}));function u6(){const e=useNavigate();A.useState({name:"",description:"",groupId:"",testDatasetId:"",inputColumns:[],outputColumns:[],code:""});const t=n=>{console.log("Creating new feature:",n),e("/features")};return a.jsx("div",{className:"max-w-4xl mx-auto p-8",children:a.jsxs("div",{className:"bg-white rounded-lg shadow-lg",children:[a.jsx("div",{className:"px-6 py-4 border-b border-gray-200",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Xh,{className:"w-6 h-6 text-blue-600"}),a.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"New Feature"})]})}),a.jsx(tw,{datasets:ew,groups:Ni,onSubmit:t,onCancel:()=>e("/features")})]})})}const c6=Object.freeze(Object.defineProperty({__proto__:null,default:u6},Symbol.toStringTag,{value:"Module"})),d6=[{value:"America/New_York",label:"Eastern Time"},{value:"America/Chicago",label:"Central Time"},{value:"America/Denver",label:"Mountain Time"},{value:"America/Los_Angeles",label:"Pacific Time"}];function f6({settings:e}){var y,N,x,b,E,w;const{rootPath:t}=_r().props,n=Pd({settings:{timezone:((y=e==null?void 0:e.settings)==null?void 0:y.timezone)||"America/New_York",s3_bucket:((N=e==null?void 0:e.settings)==null?void 0:N.s3_bucket)||"",s3_region:((x=e==null?void 0:e.settings)==null?void 0:x.s3_region)||"us-east-1",s3_access_key_id:((b=e==null?void 0:e.settings)==null?void 0:b.s3_access_key_id)||"",s3_secret_access_key:((E=e==null?void 0:e.settings)==null?void 0:E.s3_secret_access_key)||"",wandb_api_key:((w=e==null?void 0:e.settings)==null?void 0:w.wandb_api_key)||""}}),{data:r,setData:i,patch:l,processing:u}=n;A.useState(!1);const[d,f]=A.useState(!1),[m,h]=A.useState(null),g=S=>{S.preventDefault(),f(!1),h(null);const C=setTimeout(()=>{h("Request timed out. Please try again.")},3e3);l(`${t}/settings`,{onSuccess:()=>{clearTimeout(C),f(!0)},onError:()=>{clearTimeout(C),h("Failed to save settings. Please try again.")}})};return a.jsx("div",{className:"max-w-4xl mx-auto p-8",children:a.jsxs("div",{className:"bg-white rounded-lg shadow-lg",children:[a.jsx("div",{className:"px-6 py-4 border-b border-gray-200",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Ui,{className:"w-6 h-6 text-blue-600"}),a.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Settings"})]})}),a.jsxs("form",{onSubmit:g,className:"p-6 space-y-8",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(xT,{className:"w-5 h-5 text-gray-500"}),a.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"General Settings"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"timezone",className:"block text-sm font-medium text-gray-700 mb-1",children:"Timezone"}),a.jsx("select",{id:"timezone",value:r.settings.timezone,onChange:S=>i({...r,settings:{...r.settings,timezone:S.target.value}}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500",children:d6.map(S=>a.jsx("option",{value:S.value,children:S.label},S.value))}),a.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"All dates and times will be displayed in this timezone"})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(Ln,{className:"w-5 h-5 text-gray-500"}),a.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"S3 Configuration"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"bucket",className:"block text-sm font-medium text-gray-700 mb-1",children:"Default S3 Bucket"}),a.jsx("input",{type:"text",id:"bucket",value:r.settings.s3_bucket,onChange:S=>i({...r,settings:{...r.settings,s3_bucket:S.target.value}}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500",placeholder:"my-bucket"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"region",className:"block text-sm font-medium text-gray-700 mb-1",children:"AWS Region"}),a.jsxs("select",{id:"region",value:r.settings.s3_region,onChange:S=>i({...r,settings:{...r.settings,s3_region:S.target.value}}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500",children:[a.jsx("option",{value:"us-east-1",children:"US East (N. Virginia)"}),a.jsx("option",{value:"us-east-2",children:"US East (Ohio)"}),a.jsx("option",{value:"us-west-1",children:"US West (N. California)"}),a.jsx("option",{value:"us-west-2",children:"US West (Oregon)"})]})]})]})]}),a.jsxs("div",{className:"pt-6 border-t flex items-center justify-between",children:[d&&a.jsxs("div",{className:"flex items-center gap-2 text-green-600",children:[a.jsx(Fb,{className:"w-4 h-4"}),a.jsx("span",{className:"text-sm font-medium",children:"Settings saved successfully"})]}),m&&a.jsxs("div",{className:"flex items-center gap-2 text-red-600",children:[a.jsx(xn,{className:"w-4 h-4"}),a.jsx("span",{className:"text-sm font-medium",children:m})]}),a.jsx("div",{className:"flex gap-3",children:a.jsx("button",{type:"submit",disabled:u,className:`px-4 py-2 text-white text-sm font-medium rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 ${u?"bg-blue-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700"}`,children:u?"Saving...":"Save Settings"})})]})]})]})})}const p6=Object.freeze(Object.defineProperty({__proto__:null,default:f6},Symbol.toStringTag,{value:"Module"})),ac=3;function m6({model:e,onBack:t,rootPath:n}){var C,R;const[r,i]=A.useState("overview"),[l,u]=A.useState(((C=e.retraining_runs)==null?void 0:C.runs)||[]);A.useState(!1);const[d,f]=A.useState({offset:0,limit:20,total_count:((R=e.retraining_runs)==null?void 0:R.total_count)||0}),[m,h]=A.useState(1),g=e.dataset,y=e.retraining_job,N=d.offset+d.limit<d.total_count;A.useEffect(()=>{let O;return l.find(D=>D.is_deploying)&&(O=window.setInterval(async()=>{rt.get(window.location.href,{preserveScroll:!0,preserveState:!0,only:["runs"]})},2e3)),()=>{O&&window.clearInterval(O)}},[l]);const x=async O=>{if(O.is_deploying)return;const F=l.map(D=>D.id===O.id?{...D,is_deploying:!0}:D);u(F);try{await rt.post(`${n}/models/${e.id}/deploys`,{retraining_run_id:O.id},{preserveScroll:!0,preserveState:!0})}catch(D){console.error("Failed to deploy model:",D);const z=l.map(B=>B.id===O.id?{...B,is_deploying:!1}:B);u(z)}};A.useEffect(()=>{Math.ceil(l.length/ac)-m<=2&&N&&loadMoreRuns()},[m,l,N]);const b=Math.ceil(l.length/ac),E=l.slice((m-1)*ac,m*ac),w=O=>{h(O),b-O<2&&N&&loadMoreRuns()},S=O=>O.status==="deployed";return a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsx("div",{className:"flex space-x-4 ml-auto",children:a.jsx("button",{onClick:()=>i("overview"),className:`px-4 py-2 text-sm font-medium rounded-md ${r==="overview"?"bg-blue-100 text-blue-700":"text-gray-500 hover:text-gray-700"}`,children:"Overview"})})}),a.jsxs("div",{className:"bg-white rounded-lg shadow-lg p-6",children:[a.jsxs("div",{className:"mb-8",children:[a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:e.name}),a.jsxs("p",{className:"text-gray-600 mt-1",children:[a.jsx("span",{className:"font-medium",children:"Version:"})," ",e.version," • ",a.jsx("span",{className:"font-medium",children:"Type:"})," ",e.formatted_model_type]})]}),a.jsx("span",{className:`px-3 py-1 rounded-full text-sm font-medium ${e.deployment_status==="inference"?"bg-blue-100 text-blue-800":"bg-gray-100 text-gray-800"}`,children:e.deployment_status})]}),y&&a.jsxs("div",{className:"mt-6 bg-gray-50 rounded-lg p-4",children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Training Schedule"}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Qh,{className:"w-5 h-5 text-gray-400"}),a.jsx("span",{children:y.active?`Runs ${y.formatted_frequency}`:"None (Triggered Manually)"})]}),y.active&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(yT,{className:"w-5 h-5 text-gray-400"}),a.jsxs("span",{children:["at ",y.at.hour,":00"]})]})]})]})]}),r==="overview"?a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"Retraining Runs"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>w(O=>Math.max(1,O-1)),disabled:m===1,className:"p-1 rounded-md hover:bg-gray-100 disabled:opacity-50",children:a.jsx(kd,{className:"w-5 h-5"})}),a.jsxs("span",{className:"text-sm text-gray-600",children:["Page ",m," of ",b]}),a.jsx("button",{onClick:()=>w(O=>Math.min(b,O+1)),disabled:m===b,className:"p-1 rounded-md hover:bg-gray-100 disabled:opacity-50",children:a.jsx(qo,{className:"w-5 h-5"})})]})]}),a.jsx("div",{className:"space-y-4",children:E.map((O,F)=>a.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 hover:border-gray-300 transition-colors",children:[a.jsxs("div",{className:"flex justify-between items-start mb-3",children:[a.jsx("div",{children:a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[!S(O)&&a.jsx("span",{className:`px-2 py-1 rounded-md text-sm font-medium ${O.status==="success"?"bg-green-100 text-green-800":O.status==="running"?"bg-blue-100 text-blue-800":"bg-red-100 text-red-800"}`,children:O.status}),S(O)&&a.jsxs("span",{className:"px-2 py-1 bg-purple-100 text-purple-800 rounded-md text-sm font-medium flex items-center gap-1",children:[a.jsx(Vx,{className:"w-4 h-4"}),"deployed"]}),O.metrics_url&&a.jsxs("a",{href:O.metrics_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 px-2 py-1 bg-gray-100 text-gray-700 rounded-md text-sm font-medium hover:bg-gray-200 transition-colors",title:"View run metrics",children:[a.jsx(Pb,{className:"w-4 h-4"}),"metrics"]})]})}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(pT,{className:"w-4 h-4 text-gray-400"}),a.jsx("span",{className:"text-sm text-gray-600",children:new Date(O.started_at).toLocaleString()}),O.status==="success"&&O.deployable&&a.jsx("div",{className:"flex gap-2 items-center",children:S(O)?a.jsx("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800",children:"deployed"}):a.jsx("button",{onClick:()=>x(O),disabled:O.is_deploying,className:`ml-4 inline-flex items-center gap-2 px-3 py-1 rounded-md text-sm font-medium
|
429
|
+
${i.deployment_status==="inference"?"bg-blue-100 text-blue-800":"bg-gray-100 text-gray-800"}`,children:i.deployment_status}),i.is_training&&a.jsxs("span",{className:"inline-flex items-center gap-1 px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800",children:[a.jsx(Li,{className:"w-3 h-3 animate-spin"}),"training"]})]}),a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:i.name}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:f,disabled:i.is_training,className:`text-gray-400 hover:text-green-600 transition-colors ${i.is_training?"opacity-50 cursor-not-allowed":""}`,title:"Train model",children:a.jsx(Mb,{className:"w-5 h-5"})}),i.metrics_url&&a.jsx("a",{href:i.metrics_url,target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-purple-600 transition-colors",title:"View metrics",children:a.jsx(Pb,{className:"w-5 h-5"})}),a.jsx(yr,{href:`${r}/models/${i.id}`,className:"text-gray-400 hover:text-gray-600",title:"View details",children:a.jsx(Ob,{className:"w-5 h-5"})}),a.jsx(yr,{href:`${r}/models/${i.id}/edit`,className:"text-gray-400 hover:text-gray-600",title:"Edit model",children:a.jsx(Bl,{className:"w-5 h-5"})}),a.jsx("button",{onClick:()=>n(i.id),className:"text-gray-400 hover:text-gray-600",title:"Delete model",children:a.jsx(aa,{className:"w-5 h-5"})})]})]}),a.jsxs("p",{className:"text-sm text-gray-500",children:[a.jsx("span",{className:"font-semibold",children:"Model Type: "}),i.formatted_model_type]}),a.jsxs("p",{className:"text-sm text-gray-500",children:[a.jsx("span",{className:"font-semibold",children:"Version: "}),i.version]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ln,{className:"w-4 h-4 text-gray-400"}),m?a.jsx(yr,{href:`${r}/datasets/${m.id}`,className:"text-sm text-blue-600 hover:text-blue-800",children:m.name}):a.jsx("span",{className:"text-sm text-gray-600",children:"Dataset not found"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Qh,{className:"w-4 h-4 text-gray-400"}),a.jsx("span",{className:"text-sm text-gray-600",children:h!=null&&h.active?`Retrains ${i.formatted_frequency}`:"Retrains manually"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(lT,{className:"w-4 h-4 text-gray-400"}),a.jsx("span",{className:"text-sm text-gray-600",children:i.last_run_at?`Last run: ${new Date(i.last_run_at||"").toLocaleDateString()}`:"Never run"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[y(),a.jsx("span",{className:gr("text-sm",x()),children:N()})]})]}),(g==null?void 0:g.metrics)&&a.jsx("div",{className:"mt-4 pt-4 border-t border-gray-100",children:a.jsx("div",{className:"flex flex-wrap gap-2",children:Object.entries(g.metrics).map(([b,E])=>a.jsxs("div",{className:`px-2 py-1 rounded-md text-xs font-medium ${g.deployable?"bg-green-100 text-green-800":"bg-red-100 text-red-800"}`,children:[b,": ",E.toFixed(4)]},b))})}),!i.is_training&&(g==null?void 0:g.status)==="failed"&&g.stacktrace&&a.jsxs("div",{className:"mt-4 pt-4 border-t border-gray-100",children:[a.jsxs("button",{onClick:()=>d(!u),className:"flex items-center gap-2 text-sm text-red-600 hover:text-red-700",children:[a.jsx(xn,{className:"w-4 h-4"}),a.jsx("span",{children:"View Error Details"}),u?a.jsx(Ul,{className:"w-4 h-4"}):a.jsx(oa,{className:"w-4 h-4"})]}),u&&a.jsx("div",{className:"mt-2 p-3 bg-red-50 rounded-md",children:a.jsx("pre",{className:"text-xs text-red-700 whitespace-pre-wrap font-mono",children:g.stacktrace})})]})]})}const Kp=6;function BR({rootPath:e,models:t}){const[n,r]=A.useState(null),[i,l]=A.useState(""),[u,d]=A.useState(1),f=A.useMemo(()=>t.filter(y=>y.name.toLowerCase().includes(i.toLowerCase())||y.model_type.toLowerCase().includes(i.toLowerCase())),[i,t]),m=Math.ceil(f.length/Kp),h=f.slice((u-1)*Kp,u*Kp),g=y=>{confirm("Are you sure you want to delete this model?")&&rt.delete(`${e}/models/${y}`)};return t.length===0?a.jsx("div",{className:"p-8",children:a.jsx(Ad,{icon:Bs,title:"Create your first ML model",description:"Get started by creating a machine learning model. You can train models for classification, regression, and more.",actionLabel:"Create Model",onAction:()=>{rt.visit(`${e}/models/new`)}})}):a.jsx("div",{className:"p-8",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Models"}),a.jsx(Zh,{value:i,onChange:l,placeholder:"Search models..."})]}),a.jsxs("button",{onClick:()=>rt.visit(`${e}/models/new`),className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:[a.jsx(Js,{className:"w-4 h-4"}),"New Model"]})]}),h.length===0?a.jsxs("div",{className:"text-center py-12 bg-white rounded-lg shadow",children:[a.jsx(Bs,{className:"mx-auto h-12 w-12 text-gray-400"}),a.jsx("h3",{className:"mt-2 text-sm font-medium text-gray-900",children:"No models found"}),a.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"No models match your search criteria. Try adjusting your search or create a new model."}),a.jsx("div",{className:"mt-6",children:a.jsxs("button",{onClick:()=>rt.visit(`${e}/models/new`),className:"inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",children:[a.jsx(Js,{className:"w-4 h-4 mr-2"}),"New Model"]})})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:h.map(y=>a.jsx(UR,{rootPath:e,initialModel:y,onViewDetails:r,handleDelete:g},y.id))}),m>1&&a.jsx(eg,{currentPage:u,totalPages:m,onPageChange:d})]})]})})}const WR=Object.freeze(Object.defineProperty({__proto__:null,default:BR},Symbol.toStringTag,{value:"Module"}));function HR({attributes:e,columns:t,onChange:n}){return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"date_col",className:"block text-sm font-medium text-gray-700",children:"Date Column"}),a.jsx(ot,{id:"date_col",value:e.date_col,options:t.map(r=>({value:r,label:r})),onChange:r=>n({...e,date_col:r}),placeholder:"Select date column"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"months_test",className:"block text-sm font-medium text-gray-700",children:"Test Months"}),a.jsx("input",{type:"number",id:"months_test",value:e.months_test,onChange:r=>n({...e,months_test:parseInt(r.target.value)}),className:"mt-1 p-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm",min:"1"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"months_valid",className:"block text-sm font-medium text-gray-700",children:"Validation Months"}),a.jsx("input",{type:"number",id:"months_valid",value:e.months_valid,onChange:r=>n({...e,months_valid:parseInt(r.target.value)}),className:"mt-1 p-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm",min:"1"})]})]})]})}function VR({attributes:e,onChange:t}){return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(Lb,{className:"w-5 h-5 text-blue-500 mt-0.5"}),a.jsx("p",{className:"text-sm text-blue-700",children:"Random splitting will automatically split your data into 60% training, 20% test, and 20% validation sets."})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"train_ratio",className:"block text-sm font-medium text-gray-700",children:"Training Ratio"}),a.jsx("input",{type:"number",id:"train_ratio",value:e.train_ratio??.6,onChange:n=>t({...e,train_ratio:parseFloat(n.target.value)}),className:"mt-1 p-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm",min:"0",max:"1",step:"0.1"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"test_ratio",className:"block text-sm font-medium text-gray-700",children:"Test Ratio"}),a.jsx("input",{type:"number",id:"test_ratio",value:e.test_ratio??.2,onChange:n=>t({...e,test_ratio:parseFloat(n.target.value)}),className:"mt-1 p-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm",min:"0",max:"1",step:"0.1"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"valid_ratio",className:"block text-sm font-medium text-gray-700",children:"Validation Ratio"}),a.jsx("input",{type:"number",id:"valid_ratio",value:e.valid_ratio??.2,onChange:n=>t({...e,valid_ratio:parseFloat(n.target.value)}),className:"mt-1 p-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm",min:"0",max:"1",step:"0.1"})]})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"seed",className:"block text-sm font-medium text-gray-700",children:"Random Seed (optional)"}),a.jsx("input",{type:"number",id:"seed",value:e.seed??"",onChange:n=>t({...e,seed:n.target.value?parseInt(n.target.value):void 0}),className:"mt-1 p-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm",placeholder:"Enter a random seed"})]})]})}function qR({attributes:e,available_files:t,onChange:n}){const[r,i]=tr.useState([]);tr.useEffect(()=>{const h=[...e.train_files.map(g=>({path:g,type:"train"})),...e.test_files.map(g=>({path:g,type:"test"})),...e.valid_files.map(g=>({path:g,type:"valid"}))];i(h)},[e.train_files,e.test_files,e.valid_files]);const l=h=>{const g=[...r,{path:h,type:"train"}];i(g),f(g)},u=(h,g)=>{const y=r.map((N,x)=>x===h?{...N,type:g}:N);i(y),f(y)},d=h=>{const g=r.filter((y,N)=>N!==h);i(g),f(g)},f=h=>{n({splitter_type:"predefined",train_files:h.filter(g=>g.type==="train").map(g=>g.path),test_files:h.filter(g=>g.type==="test").map(g=>g.path),valid_files:h.filter(g=>g.type==="valid").map(g=>g.path)})},m=t.filter(h=>!r.find(g=>g.path===h));return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Add File"}),a.jsx(ot,{options:m.map(h=>({value:h,label:h.split("/").pop()||h,description:h})),value:null,onChange:h=>l(h),placeholder:"Select a file..."})]}),r.length>0?a.jsx("div",{className:"space-y-2",children:r.map((h,g)=>a.jsxs("div",{className:"flex items-center justify-between p-3 bg-gray-50 rounded-lg",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx(vT,{className:"w-4 h-4 text-gray-400 flex-shrink-0"}),a.jsx("span",{className:"text-sm text-gray-900 truncate",children:h.path.split("/").pop()})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("select",{value:h.type,onChange:y=>u(g,y.target.value),className:"text-sm rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500",children:[a.jsx("option",{value:"train",children:"Training Set"}),a.jsx("option",{value:"test",children:"Test Set"}),a.jsx("option",{value:"valid",children:"Validation Set"})]}),a.jsx("button",{onClick:()=>d(g),className:"text-sm text-red-600 hover:text-red-700",children:"Remove"})]})]},h.path))}):a.jsx("div",{className:"text-center py-4 bg-gray-50 rounded-lg border-2 border-dashed border-gray-200",children:a.jsx("p",{className:"text-sm text-gray-500",children:"Select files to create your train/test/validation splits"})}),r.length>0&&a.jsxs("div",{className:"space-y-1 text-sm",children:[!r.some(h=>h.type==="train")&&a.jsx("p",{className:"text-yellow-600",children:"• You need at least one training set file"}),!r.some(h=>h.type==="test")&&a.jsx("p",{className:"text-yellow-600",children:"• You need at least one test set file"})]})]})}function ov({targetColumn:e,testSize:t,validSize:n,columns:r,onChange:i}){return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Target Column"}),a.jsx(ot,{options:r.map(l=>({value:l.name,label:l.name,description:`Type: ${l.type}`})),value:e,onChange:l=>i({targetColumn:l,testSize:t,validSize:n}),placeholder:"Select target column..."})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Test Set Size (%)"}),a.jsx("input",{type:"number",min:1,max:40,value:t,onChange:l=>i({targetColumn:e,testSize:parseInt(l.target.value)||0,validSize:n}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Validation Set Size (%)"}),a.jsx("input",{type:"number",min:1,max:40,value:n,onChange:l=>i({targetColumn:e,testSize:t,validSize:parseInt(l.target.value)||0}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"})]})]})]})}function GR({type:e,targetColumn:t,groupColumn:n,nSplits:r,columns:i,onChange:l}){return a.jsxs("div",{className:"space-y-4",children:[(e==="stratified"||e==="group")&&a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:e==="stratified"?"Target Column":"Group Column"}),a.jsx(ot,{options:i.map(u=>({value:u.name,label:u.name,description:`Type: ${u.type}`})),value:e==="stratified"?t:n,onChange:u=>l({targetColumn:e==="stratified"?u:t,groupColumn:e==="group"?u:n,nSplits:r}),placeholder:`Select ${e==="stratified"?"target":"group"} column...`})]}),a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Number of Splits"}),a.jsx("input",{type:"number",min:2,max:10,value:r,onChange:u=>l({targetColumn:t,groupColumn:n,nSplits:parseInt(u.target.value)||2}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"})]})]})}function KR({p:e,onChange:t}){return a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Number of samples to leave out (P)"}),a.jsx("input",{type:"number",min:1,max:100,value:e,onChange:n=>t(parseInt(n.target.value)||1),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"}),a.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"Each training set will have P samples removed, which form the test set."})]})})}const QR=[{value:"date",label:"Date Split",description:"Split data based on a date/time column"},{value:"random",label:"Random Split",description:"Randomly split data into train/test/validation sets (70/20/10)"},{value:"predefined",label:"Predefined Splits",description:"Use separate files for train/test/validation sets"}],XR={date:{date_column:"",months_test:2,months_valid:1},random:{},predefined:{train_files:[],test_files:[],valid_files:[]},stratified:{targetColumn:"",testSize:20,validSize:10},stratified_kfold:{targetColumn:"",nSplits:5},group_kfold:{groupColumn:"",nSplits:5},group_shuffle:{groupColumn:"",testSize:20,validSize:10},leave_p_out:{p:1}};function YR({type:e,splitter_attributes:t,columns:n,available_files:r,onSplitterChange:i,onChange:l}){const u=n.filter(h=>h.type==="datetime").map(h=>h.name),d=h=>{l(h,XR[h])},f=(h,g)=>{l(h,g)},m=()=>{switch(e){case"date":return a.jsx(HR,{attributes:t,columns:u,onChange:h=>f(e,h)});case"random":return a.jsx(VR,{attributes:t,onChange:h=>f(e,h)});case"predefined":return a.jsx(qR,{attributes:t,available_files:r,onChange:h=>f(e,h)});case"stratified":return a.jsx(ov,{attributes:t,columns:n,onChange:h=>f(e,h)});case"stratified_kfold":case"group_kfold":return a.jsx(GR,{attributes:t,columns:n,onChange:h=>f(e,h)});case"group_shuffle":return a.jsx(ov,{attributes:t,columns:n,onChange:h=>f(e,{groupColumn:h.targetColumn,testSize:h.testSize,validSize:h.validSize})});case"leave_p_out":return a.jsx(KR,{attributes:t,onChange:h=>f(e,h)});default:return null}};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Split Type"}),a.jsx(ot,{options:QR,value:e,onChange:h=>d(h)})]}),a.jsx("div",{className:"bg-gray-50 rounded-lg p-4",children:m()})]})}const JR=e=>e.date_col?!e.months_test||e.months_test<=0?{isValid:!1,error:"Test months must be greater than 0"}:!e.months_valid||e.months_valid<=0?{isValid:!1,error:"Validation months must be greater than 0"}:{isValid:!0}:{isValid:!1,error:"Please select a date column"},ZR=e=>{const t=(e.train_ratio??.6)+(e.test_ratio??.2)+(e.valid_ratio??.2);return Math.abs(t-1)>=.001?{isValid:!1,error:`Split ratios must sum to 1.0 (current sum: ${t.toFixed(2)})`}:{isValid:!0}},e6=e=>!e.train_files||e.train_files.length===0?{isValid:!1,error:"Please select at least one file for splitting"}:{isValid:!0},t6=e=>{if(!e.stratify_column)return{isValid:!1,error:"Please select a column to stratify on"};const t=(e.train_ratio??0)+(e.test_ratio??0)+(e.valid_ratio??0);return Math.abs(t-1)>=.001?{isValid:!1,error:`Split ratios must sum to 1.0 (current sum: ${t.toFixed(2)})`}:{isValid:!0}},n6=e=>!e.n_splits||e.n_splits<=1?{isValid:!1,error:"Number of splits must be greater than 1"}:{isValid:!0},r6=e=>!e.p||e.p<=0?{isValid:!1,error:"P value must be greater than 0"}:{isValid:!0},s6=(e,t)=>{switch(e){case"date":return JR(t);case"random":return ZR(t);case"predefined":return e6(t);case"stratified":return t6(t);case"stratified_kfold":case"group_kfold":return n6(t);case"leave_p_out":return r6(t);default:return{isValid:!1,error:"Invalid splitter type"}}};function i6({constants:e,datasources:t}){var D;const[n,r]=A.useState(1),[i,l]=A.useState(null),[u,d]=A.useState("random"),{rootPath:f}=_r().props,m=z=>{switch(z){case"date":return{date_col:"",months_test:2,months_valid:2};case"random":return{};case"predefined":return{train_files:[],test_files:[],valid_files:[]};case"stratified":return{stratify_column:"",train_ratio:.6,test_ratio:.2,valid_ratio:.2};case"stratified_kfold":case"group_kfold":return{target_column:"",group_column:"",n_splits:5};case"leave_p_out":return{p:1,shuffle:!0,random_state:42};default:return{}}},h=Pd({dataset:{name:"",datasource_id:"",splitter_attributes:{splitter_type:u,...m(u)}}});A.useEffect(()=>{h.setData("dataset.splitter_attributes",{splitter_type:u,...m(u)})},[u]);const g=(z,B)=>{d(z),h.setData("dataset.splitter_attributes",{splitter_type:z,...B})};console.log((D=h.dataset)==null?void 0:D.splitter_attributes);const{data:y,setData:N,post:x}=h,b=y.dataset.datasource_id?t.find(z=>z.id===Number(y.dataset.datasource_id)):null,E=((b==null?void 0:b.columns)||[]).map(z=>({name:z,type:((b==null?void 0:b.schema)||{})[z]||""})),w=b&&!b.is_syncing&&!b.sync_error,S=y.dataset.name&&w,C=()=>{S&&r(2)},R=z=>{z.preventDefault(),x(`${f}/datasets`,{onSuccess:()=>{rt.visit(`${f}/datasets`)},onError:B=>{console.error("Failed to create dataset:",B)}})},O=()=>y.dataset.name?y.dataset.datasource_id?s6(y.dataset.splitter_attributes.splitter_type,y.dataset.splitter_attributes).error:"Please select a datasource":"Please enter a dataset name",F=()=>!O();return a.jsx("div",{className:"max-w-2xl mx-auto p-8",children:a.jsxs("div",{className:"bg-white rounded-lg shadow-lg p-6",children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-6",children:"Create New Dataset"}),a.jsxs("div",{className:"mb-8",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx("div",{className:`flex items-center justify-center w-8 h-8 rounded-full ${n>=1?"bg-blue-600":"bg-gray-200"} text-white font-medium text-sm`,children:"1"}),a.jsx("div",{className:`flex-1 h-0.5 mx-2 ${n>=2?"bg-blue-600":"bg-gray-200"}`}),a.jsx("div",{className:`flex items-center justify-center w-8 h-8 rounded-full ${n>=2?"bg-blue-600":"bg-gray-200"} text-white font-medium text-sm`,children:"2"})]}),a.jsxs("div",{className:"flex justify-between mt-2",children:[a.jsx("span",{className:"text-sm font-medium text-gray-600",children:"Basic Info"}),a.jsx("span",{className:"text-sm font-medium text-gray-600 mr-4",children:"Configure Split"})]})]}),n===1?a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-700",children:"Dataset Name"}),a.jsx("input",{type:"text",id:"name",value:y.dataset.name,onChange:z=>N("dataset.name",z.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 py-2 px-4 shadow-sm border-gray-300 border",required:!0})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"description",className:"block text-sm font-medium text-gray-700",children:"Description"}),a.jsx("textarea",{id:"description",value:y.dataset.description,onChange:z=>N("dataset.description",z.target.value),rows:3,className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 py-2 px-4 shadow-sm border-gray-300 border"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"datasource",className:"block text-sm font-medium text-gray-700 mb-1",children:"Datasource"}),a.jsx(ot,{value:y.dataset.datasource_id,onChange:z=>N("dataset.datasource_id",z),options:t.map(z=>({value:z.id,label:z.name})),placeholder:"Select a datasource..."})]}),b&&a.jsx("div",{className:`rounded-lg p-4 ${b.sync_error?"bg-red-50":b.is_syncing?"bg-blue-50":"bg-green-50"}`,children:a.jsx("div",{className:"flex items-start gap-2",children:b.is_syncing?a.jsxs(a.Fragment,{children:[a.jsx(Li,{className:"w-5 h-5 text-blue-500 animate-spin"}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-blue-800",children:"Datasource is syncing"}),a.jsx("p",{className:"mt-1 text-sm text-blue-700",children:"Please wait while we sync your data. This may take a few minutes."})]})]}):b.sync_error?a.jsxs(a.Fragment,{children:[a.jsx(xn,{className:"w-5 h-5 text-red-500"}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-red-800",children:"Sync failed"}),a.jsx("p",{className:"mt-1 text-sm text-red-700",children:"There was an error syncing your datasource."}),a.jsxs("button",{onClick:()=>l(b.id),className:"mt-2 flex items-center gap-1 text-sm text-red-700 hover:text-red-800",children:["View error details",i===b.id?a.jsx(Ul,{className:"w-4 h-4"}):a.jsx(oa,{className:"w-4 h-4"})]}),i===b.id&&a.jsx("pre",{className:"mt-2 p-2 text-xs text-red-700 bg-red-100 rounded-md whitespace-pre-wrap break-words font-mono max-h-32 overflow-y-auto",children:b.stacktrace})]})]}):a.jsxs(a.Fragment,{children:[a.jsx(Ln,{className:"w-5 h-5 text-green-500"}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-green-800",children:"Datasource ready"}),a.jsx("p",{className:"mt-1 text-sm text-green-700",children:"Your datasource is synced and ready to use."})]})]})})}),a.jsx("div",{className:"flex justify-end",children:a.jsx("button",{type:"button",onClick:C,disabled:!S,className:"px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-300 disabled:cursor-not-allowed",children:"Next"})})]}):a.jsxs("form",{onSubmit:R,className:"space-y-6",children:[a.jsx(YR,{type:u,splitter_attributes:h.data.dataset.splitter_attributes,columns:E,available_files:b.available_files,onChange:g}),O()&&a.jsx("div",{className:"mt-2 text-sm text-red-600",children:O()}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx("button",{type:"button",onClick:()=>r(1),className:"px-4 py-2 text-sm font-medium text-gray-700 hover:text-gray-900",children:"Back"}),a.jsx("button",{type:"submit",disabled:!F(),className:"px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:bg-gray-300 disabled:cursor-not-allowed",children:"Create Dataset"})]})]})]})})}const o6=Object.freeze(Object.defineProperty({__proto__:null,default:i6},Symbol.toStringTag,{value:"Module"}));function a6({datasets:e,constants:t,errors:n}){return a.jsx("div",{className:"max-w-2xl mx-auto p-8",children:a.jsxs("div",{className:"bg-white rounded-lg shadow-lg p-6",children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-6",children:"Create New Model"}),a.jsx(Zb,{datasets:e,constants:t,errors:n})]})})}const l6=Object.freeze(Object.defineProperty({__proto__:null,default:a6},Symbol.toStringTag,{value:"Module"}));function u6(){const e=useNavigate();A.useState({name:"",description:"",groupId:"",testDatasetId:"",inputColumns:[],outputColumns:[],code:""});const t=n=>{console.log("Creating new feature:",n),e("/features")};return a.jsx("div",{className:"max-w-4xl mx-auto p-8",children:a.jsxs("div",{className:"bg-white rounded-lg shadow-lg",children:[a.jsx("div",{className:"px-6 py-4 border-b border-gray-200",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Xh,{className:"w-6 h-6 text-blue-600"}),a.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"New Feature"})]})}),a.jsx(tw,{datasets:ew,groups:Ni,onSubmit:t,onCancel:()=>e("/features")})]})})}const c6=Object.freeze(Object.defineProperty({__proto__:null,default:u6},Symbol.toStringTag,{value:"Module"})),d6=[{value:"America/New_York",label:"Eastern Time"},{value:"America/Chicago",label:"Central Time"},{value:"America/Denver",label:"Mountain Time"},{value:"America/Los_Angeles",label:"Pacific Time"}];function f6({settings:e}){var y,N,x;const{rootPath:t}=_r().props,n=Pd({settings:{timezone:((y=e==null?void 0:e.settings)==null?void 0:y.timezone)||"America/New_York",s3_bucket:((N=e==null?void 0:e.settings)==null?void 0:N.s3_bucket)||"",s3_region:((x=e==null?void 0:e.settings)==null?void 0:x.s3_region)||"us-east-1"}}),{data:r,setData:i,patch:l,processing:u}=n;A.useState(!1);const[d,f]=A.useState(!1),[m,h]=A.useState(null),g=b=>{b.preventDefault(),f(!1),h(null);const E=setTimeout(()=>{h("Request timed out. Please try again.")},3e3);l(`${t}/settings`,{onSuccess:()=>{clearTimeout(E),f(!0)},onError:()=>{clearTimeout(E),h("Failed to save settings. Please try again.")}})};return a.jsx("div",{className:"max-w-4xl mx-auto p-8",children:a.jsxs("div",{className:"bg-white rounded-lg shadow-lg",children:[a.jsx("div",{className:"px-6 py-4 border-b border-gray-200",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Ui,{className:"w-6 h-6 text-blue-600"}),a.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Settings"})]})}),a.jsxs("form",{onSubmit:g,className:"p-6 space-y-8",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(xT,{className:"w-5 h-5 text-gray-500"}),a.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"General Settings"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"timezone",className:"block text-sm font-medium text-gray-700 mb-1",children:"Timezone"}),a.jsx("select",{id:"timezone",value:r.settings.timezone,onChange:b=>i({...r,settings:{...r.settings,timezone:b.target.value}}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500",children:d6.map(b=>a.jsx("option",{value:b.value,children:b.label},b.value))}),a.jsx("p",{className:"mt-1 text-sm text-gray-500",children:"All dates and times will be displayed in this timezone"})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(Ln,{className:"w-5 h-5 text-gray-500"}),a.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"S3 Configuration"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"bucket",className:"block text-sm font-medium text-gray-700 mb-1",children:"Default S3 Bucket"}),a.jsx("input",{type:"text",id:"bucket",value:r.settings.s3_bucket,onChange:b=>i({...r,settings:{...r.settings,s3_bucket:b.target.value}}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500",placeholder:"my-bucket"})]}),a.jsxs("div",{children:[a.jsx("label",{htmlFor:"region",className:"block text-sm font-medium text-gray-700 mb-1",children:"AWS Region"}),a.jsxs("select",{id:"region",value:r.settings.s3_region,onChange:b=>i({...r,settings:{...r.settings,s3_region:b.target.value}}),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500",children:[a.jsx("option",{value:"us-east-1",children:"US East (N. Virginia)"}),a.jsx("option",{value:"us-east-2",children:"US East (Ohio)"}),a.jsx("option",{value:"us-west-1",children:"US West (N. California)"}),a.jsx("option",{value:"us-west-2",children:"US West (Oregon)"})]})]})]})]}),a.jsxs("div",{className:"pt-6 border-t flex items-center justify-between",children:[d&&a.jsxs("div",{className:"flex items-center gap-2 text-green-600",children:[a.jsx(Fb,{className:"w-4 h-4"}),a.jsx("span",{className:"text-sm font-medium",children:"Settings saved successfully"})]}),m&&a.jsxs("div",{className:"flex items-center gap-2 text-red-600",children:[a.jsx(xn,{className:"w-4 h-4"}),a.jsx("span",{className:"text-sm font-medium",children:m})]}),a.jsx("div",{className:"flex gap-3",children:a.jsx("button",{type:"submit",disabled:u,className:`px-4 py-2 text-white text-sm font-medium rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 ${u?"bg-blue-400 cursor-not-allowed":"bg-blue-600 hover:bg-blue-700"}`,children:u?"Saving...":"Save Settings"})})]})]})]})})}const p6=Object.freeze(Object.defineProperty({__proto__:null,default:f6},Symbol.toStringTag,{value:"Module"})),ac=3;function m6({model:e,onBack:t,rootPath:n}){var C,R;const[r,i]=A.useState("overview"),[l,u]=A.useState(((C=e.retraining_runs)==null?void 0:C.runs)||[]);A.useState(!1);const[d,f]=A.useState({offset:0,limit:20,total_count:((R=e.retraining_runs)==null?void 0:R.total_count)||0}),[m,h]=A.useState(1),g=e.dataset,y=e.retraining_job,N=d.offset+d.limit<d.total_count;A.useEffect(()=>{let O;return l.find(D=>D.is_deploying)&&(O=window.setInterval(async()=>{rt.get(window.location.href,{preserveScroll:!0,preserveState:!0,only:["runs"]})},2e3)),()=>{O&&window.clearInterval(O)}},[l]);const x=async O=>{if(O.is_deploying)return;const F=l.map(D=>D.id===O.id?{...D,is_deploying:!0}:D);u(F);try{await rt.post(`${n}/models/${e.id}/deploys`,{retraining_run_id:O.id},{preserveScroll:!0,preserveState:!0})}catch(D){console.error("Failed to deploy model:",D);const z=l.map(B=>B.id===O.id?{...B,is_deploying:!1}:B);u(z)}};A.useEffect(()=>{Math.ceil(l.length/ac)-m<=2&&N&&loadMoreRuns()},[m,l,N]);const b=Math.ceil(l.length/ac),E=l.slice((m-1)*ac,m*ac),w=O=>{h(O),b-O<2&&N&&loadMoreRuns()},S=O=>O.status==="deployed";return a.jsxs("div",{className:"space-y-6",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsx("div",{className:"flex space-x-4 ml-auto",children:a.jsx("button",{onClick:()=>i("overview"),className:`px-4 py-2 text-sm font-medium rounded-md ${r==="overview"?"bg-blue-100 text-blue-700":"text-gray-500 hover:text-gray-700"}`,children:"Overview"})})}),a.jsxs("div",{className:"bg-white rounded-lg shadow-lg p-6",children:[a.jsxs("div",{className:"mb-8",children:[a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl font-bold text-gray-900",children:e.name}),a.jsxs("p",{className:"text-gray-600 mt-1",children:[a.jsx("span",{className:"font-medium",children:"Version:"})," ",e.version," • ",a.jsx("span",{className:"font-medium",children:"Type:"})," ",e.formatted_model_type]})]}),a.jsx("span",{className:`px-3 py-1 rounded-full text-sm font-medium ${e.deployment_status==="inference"?"bg-blue-100 text-blue-800":"bg-gray-100 text-gray-800"}`,children:e.deployment_status})]}),y&&a.jsxs("div",{className:"mt-6 bg-gray-50 rounded-lg p-4",children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Training Schedule"}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Qh,{className:"w-5 h-5 text-gray-400"}),a.jsx("span",{children:y.active?`Runs ${y.formatted_frequency}`:"None (Triggered Manually)"})]}),y.active&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(yT,{className:"w-5 h-5 text-gray-400"}),a.jsxs("span",{children:["at ",y.at.hour,":00"]})]})]})]})]}),r==="overview"?a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"Retraining Runs"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>w(O=>Math.max(1,O-1)),disabled:m===1,className:"p-1 rounded-md hover:bg-gray-100 disabled:opacity-50",children:a.jsx(kd,{className:"w-5 h-5"})}),a.jsxs("span",{className:"text-sm text-gray-600",children:["Page ",m," of ",b]}),a.jsx("button",{onClick:()=>w(O=>Math.min(b,O+1)),disabled:m===b,className:"p-1 rounded-md hover:bg-gray-100 disabled:opacity-50",children:a.jsx(qo,{className:"w-5 h-5"})})]})]}),a.jsx("div",{className:"space-y-4",children:E.map((O,F)=>a.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 hover:border-gray-300 transition-colors",children:[a.jsxs("div",{className:"flex justify-between items-start mb-3",children:[a.jsx("div",{children:a.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[!S(O)&&a.jsx("span",{className:`px-2 py-1 rounded-md text-sm font-medium ${O.status==="success"?"bg-green-100 text-green-800":O.status==="running"?"bg-blue-100 text-blue-800":"bg-red-100 text-red-800"}`,children:O.status}),S(O)&&a.jsxs("span",{className:"px-2 py-1 bg-purple-100 text-purple-800 rounded-md text-sm font-medium flex items-center gap-1",children:[a.jsx(Vx,{className:"w-4 h-4"}),"deployed"]}),O.metrics_url&&a.jsxs("a",{href:O.metrics_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 px-2 py-1 bg-gray-100 text-gray-700 rounded-md text-sm font-medium hover:bg-gray-200 transition-colors",title:"View run metrics",children:[a.jsx(Pb,{className:"w-4 h-4"}),"metrics"]})]})}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(pT,{className:"w-4 h-4 text-gray-400"}),a.jsx("span",{className:"text-sm text-gray-600",children:new Date(O.started_at).toLocaleString()}),O.status==="success"&&O.deployable&&a.jsx("div",{className:"flex gap-2 items-center",children:S(O)?a.jsx("span",{className:"inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800",children:"deployed"}):a.jsx("button",{onClick:()=>x(O),disabled:O.is_deploying,className:`ml-4 inline-flex items-center gap-2 px-3 py-1 rounded-md text-sm font-medium
|
430
430
|
${O.is_deploying?"bg-yellow-100 text-yellow-800":"bg-blue-600 text-white hover:bg-blue-500"}`,children:O.is_deploying?a.jsxs(a.Fragment,{children:[a.jsx(Li,{className:"w-3 h-3 animate-spin"}),"Deploying..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Vx,{className:"w-3 h-3"}),"Deploy"]})})})]})]}),O&&O.metrics&&a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:Object.entries(O.metrics).map(([D,z])=>a.jsxs("div",{className:"bg-gray-50 rounded-md p-3",children:[a.jsx("div",{className:"text-sm font-medium text-gray-500",children:D}),a.jsx("div",{className:"mt-1 flex items-center gap-2",children:a.jsx("span",{className:"text-lg font-semibold",children:z.toFixed(4)})})]},D))})]},F))})]}):g&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(Ln,{className:"w-5 h-5 text-blue-600"}),a.jsx("h3",{className:"text-lg font-semibold",children:g.name})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Columns"}),a.jsx("div",{className:"bg-gray-50 rounded-lg p-4",children:a.jsx("div",{className:"space-y-2",children:g.columns.map(O=>a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-sm text-gray-900",children:O.name}),a.jsx("span",{className:"text-xs text-gray-500",children:O.type})]},O.name))})})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Statistics"}),a.jsx("div",{className:"bg-gray-50 rounded-lg p-4",children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-sm text-gray-900",children:"Total Rows"}),a.jsx("span",{className:"text-sm font-medium",children:g.num_rows.toLocaleString()})]}),a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-sm text-gray-900",children:"Last Updated"}),a.jsx("span",{className:"text-sm font-medium",children:new Date(g.updated_at).toLocaleDateString()})]})]})})]})]})]})]})]})}function h6({model:e,rootPath:t}){return a.jsx("div",{className:"max-w-3xl mx-auto py-8",children:a.jsx(m6,{model:e,rootPath:t})})}const g6=Object.freeze(Object.defineProperty({__proto__:null,default:h6},Symbol.toStringTag,{value:"Module"}));function y6({feature:e,group:t}){return a.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6 hover:shadow-lg transition-shadow",children:[a.jsxs("div",{className:"flex justify-between items-start mb-4",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Xh,{className:"w-5 h-5 text-blue-600 mt-1"}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:e.name}),a.jsx("p",{className:"text-sm text-gray-500 mt-1",children:e.description})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Link,{to:`/features/${e.id}/edit`,className:"text-gray-400 hover:text-blue-600 transition-colors",title:"Edit feature",children:a.jsx(Bl,{className:"w-5 h-5"})}),a.jsx("button",{className:"text-gray-400 hover:text-red-600 transition-colors",title:"Delete feature",children:a.jsx(aa,{className:"w-5 h-5"})})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 mt-4",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-gray-500",children:"Input Columns"}),a.jsx("div",{className:"flex flex-wrap gap-2 mt-1",children:e.inputColumns.map(n=>a.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800",children:n},n))})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-sm text-gray-500",children:"Output Columns"}),a.jsx("div",{className:"flex flex-wrap gap-2 mt-1",children:e.outputColumns.map(n=>a.jsx("span",{className:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800",children:n},n))})]})]}),a.jsx("div",{className:"mt-4 pt-4 border-t border-gray-100",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs(Link,{to:`/features/groups/${t.id}`,className:"flex items-center gap-2 text-sm text-gray-500 hover:text-gray-700",children:[a.jsx(Ib,{className:"w-4 h-4"}),t.name]}),a.jsxs("span",{className:"text-sm text-gray-500",children:["Last updated ",new Date(e.updatedAt).toLocaleDateString()]})]})})]})}function x6({group:e}){return a.jsxs("div",{className:"bg-white rounded-lg shadow-md p-6 hover:shadow-lg transition-shadow",children:[a.jsxs("div",{className:"flex justify-between items-start mb-4",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Ib,{className:"w-5 h-5 text-blue-600 mt-1"}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-lg font-semibold text-gray-900",children:e.name}),a.jsx("p",{className:"text-sm text-gray-500 mt-1",children:e.description})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Link,{to:`/features/groups/${e.id}/edit`,className:"text-gray-400 hover:text-blue-600 transition-colors",title:"Edit group",children:a.jsx(Bl,{className:"w-5 h-5"})}),a.jsx("button",{className:"text-gray-400 hover:text-red-600 transition-colors",title:"Delete group",children:a.jsx(aa,{className:"w-5 h-5"})})]})]}),a.jsx("div",{className:"mt-4 pt-4 border-t border-gray-100",children:a.jsxs("div",{className:"flex items-center justify-between text-sm",children:[a.jsxs("span",{className:"text-gray-500",children:[e.features.length," features"]}),a.jsxs("span",{className:"text-gray-500",children:["Last updated ",new Date(e.updatedAt).toLocaleDateString()]})]})})]})}function v6(){const[e,t]=A.useState("groups");if(Ni.length===0)return a.jsx("div",{className:"p-8",children:a.jsx(Ad,{icon:Hx,title:"Create your first feature group",description:"Create a group to organize your column features",actionLabel:"Create Group",onAction:()=>{}})});const n=Ni.flatMap(r=>r.features);return a.jsx("div",{className:"p-8",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"Features"}),a.jsxs("div",{className:"flex rounded-md shadow-sm",children:[a.jsx("button",{onClick:()=>t("groups"),className:`px-4 py-2 text-sm font-medium rounded-l-md ${e==="groups"?"bg-blue-600 text-white":"bg-white text-gray-700 hover:text-gray-900 border border-gray-300"}`,children:"Groups"}),a.jsx("button",{onClick:()=>t("all"),className:`px-4 py-2 text-sm font-medium rounded-r-md ${e==="all"?"bg-blue-600 text-white":"bg-white text-gray-700 hover:text-gray-900 border border-l-0 border-gray-300"}`,children:"All Features"})]})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs(Link,{to:"/features/groups/new",className:"inline-flex items-center gap-2 px-4 py-2 bg-white border border-gray-300 text-sm font-medium rounded-md text-gray-700 hover:bg-gray-50",children:[a.jsx(Hx,{className:"w-4 h-4"}),"New Group"]}),a.jsxs(Link,{to:"/features/new",className:"inline-flex items-center gap-2 px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded-md hover:bg-blue-700",children:[a.jsx(Js,{className:"w-4 h-4"}),"New Feature"]})]})]}),e==="groups"?a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:Ni.map(r=>a.jsx(x6,{group:r},r.id))}):a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:n.map(r=>a.jsx(y6,{feature:r,group:Ni.find(i=>i.id===r.groupId)},r.id))})]})})}const b6=Object.freeze(Object.defineProperty({__proto__:null,default:v6},Symbol.toStringTag,{value:"Module"}));var nw={exports:{}},$n={},rw={exports:{}},sw={};/**
|
431
431
|
* @license React
|
432
432
|
* scheduler.production.min.js
|
@@ -471,4 +471,4 @@ Error generating stack: `+l.message+`
|
|
471
471
|
flex-grow: 1;
|
472
472
|
}
|
473
473
|
`},nonce:l}),a.jsx(vs.div,{"data-radix-scroll-area-viewport":"",...u,asChild:i,ref:m,style:{overflowX:d.scrollbarXEnabled?"scroll":"hidden",overflowY:d.scrollbarYEnabled?"scroll":"hidden",...e.style},children:JL({asChild:i,children:r},h=>a.jsx("div",{"data-radix-scroll-area-content":"",ref:d.onContentChange,style:{minWidth:d.scrollbarXEnabled?"fit-content":void 0},children:h}))})]})});fS.displayName=dS;var zr="ScrollAreaScrollbar",qg=A.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=sr(zr,e.__scopeScrollArea),{onScrollbarXEnabledChange:l,onScrollbarYEnabledChange:u}=i,d=e.orientation==="horizontal";return A.useEffect(()=>(d?l(!0):u(!0),()=>{d?l(!1):u(!1)}),[d,l,u]),i.type==="hover"?a.jsx(WL,{...r,ref:t,forceMount:n}):i.type==="scroll"?a.jsx(HL,{...r,ref:t,forceMount:n}):i.type==="auto"?a.jsx(pS,{...r,ref:t,forceMount:n}):i.type==="always"?a.jsx(Gg,{...r,ref:t}):null});qg.displayName=zr;var WL=A.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=sr(zr,e.__scopeScrollArea),[l,u]=A.useState(!1);return A.useEffect(()=>{const d=i.scrollArea;let f=0;if(d){const m=()=>{window.clearTimeout(f),u(!0)},h=()=>{f=window.setTimeout(()=>u(!1),i.scrollHideDelay)};return d.addEventListener("pointerenter",m),d.addEventListener("pointerleave",h),()=>{window.clearTimeout(f),d.removeEventListener("pointerenter",m),d.removeEventListener("pointerleave",h)}}},[i.scrollArea,i.scrollHideDelay]),a.jsx(da,{present:n||l,children:a.jsx(pS,{"data-state":l?"visible":"hidden",...r,ref:t})})}),HL=A.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=sr(zr,e.__scopeScrollArea),l=e.orientation==="horizontal",u=Gd(()=>f("SCROLL_END"),100),[d,f]=UL("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return A.useEffect(()=>{if(d==="idle"){const m=window.setTimeout(()=>f("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(m)}},[d,i.scrollHideDelay,f]),A.useEffect(()=>{const m=i.viewport,h=l?"scrollLeft":"scrollTop";if(m){let g=m[h];const y=()=>{const N=m[h];g!==N&&(f("SCROLL"),u()),g=N};return m.addEventListener("scroll",y),()=>m.removeEventListener("scroll",y)}},[i.viewport,l,f,u]),a.jsx(da,{present:n||d!=="hidden",children:a.jsx(Gg,{"data-state":d==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:Ys(e.onPointerEnter,()=>f("POINTER_ENTER")),onPointerLeave:Ys(e.onPointerLeave,()=>f("POINTER_LEAVE"))})})}),pS=A.forwardRef((e,t)=>{const n=sr(zr,e.__scopeScrollArea),{forceMount:r,...i}=e,[l,u]=A.useState(!1),d=e.orientation==="horizontal",f=Gd(()=>{if(n.viewport){const m=n.viewport.offsetWidth<n.viewport.scrollWidth,h=n.viewport.offsetHeight<n.viewport.scrollHeight;u(d?m:h)}},10);return ea(n.viewport,f),ea(n.content,f),a.jsx(da,{present:r||l,children:a.jsx(Gg,{"data-state":l?"visible":"hidden",...i,ref:t})})}),Gg=A.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,i=sr(zr,e.__scopeScrollArea),l=A.useRef(null),u=A.useRef(0),[d,f]=A.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),m=xS(d.viewport,d.content),h={...r,sizes:d,onSizesChange:f,hasThumb:m>0&&m<1,onThumbChange:y=>l.current=y,onThumbPointerUp:()=>u.current=0,onThumbPointerDown:y=>u.current=y};function g(y,N){return XL(y,u.current,d,N)}return n==="horizontal"?a.jsx(VL,{...h,ref:t,onThumbPositionChange:()=>{if(i.viewport&&l.current){const y=i.viewport.scrollLeft,N=p1(y,d,i.dir);l.current.style.transform=`translate3d(${N}px, 0, 0)`}},onWheelScroll:y=>{i.viewport&&(i.viewport.scrollLeft=y)},onDragScroll:y=>{i.viewport&&(i.viewport.scrollLeft=g(y,i.dir))}}):n==="vertical"?a.jsx(qL,{...h,ref:t,onThumbPositionChange:()=>{if(i.viewport&&l.current){const y=i.viewport.scrollTop,N=p1(y,d);l.current.style.transform=`translate3d(0, ${N}px, 0)`}},onWheelScroll:y=>{i.viewport&&(i.viewport.scrollTop=y)},onDragScroll:y=>{i.viewport&&(i.viewport.scrollTop=g(y))}}):null}),VL=A.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...i}=e,l=sr(zr,e.__scopeScrollArea),[u,d]=A.useState(),f=A.useRef(null),m=ii(t,f,l.onScrollbarXChange);return A.useEffect(()=>{f.current&&d(getComputedStyle(f.current))},[f]),a.jsx(hS,{"data-orientation":"horizontal",...i,ref:m,sizes:n,style:{bottom:0,left:l.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:l.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":qd(n)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.x),onDragScroll:h=>e.onDragScroll(h.x),onWheelScroll:(h,g)=>{if(l.viewport){const y=l.viewport.scrollLeft+h.deltaX;e.onWheelScroll(y),bS(y,g)&&h.preventDefault()}},onResize:()=>{f.current&&l.viewport&&u&&r({content:l.viewport.scrollWidth,viewport:l.viewport.offsetWidth,scrollbar:{size:f.current.clientWidth,paddingStart:bd(u.paddingLeft),paddingEnd:bd(u.paddingRight)}})}})}),qL=A.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...i}=e,l=sr(zr,e.__scopeScrollArea),[u,d]=A.useState(),f=A.useRef(null),m=ii(t,f,l.onScrollbarYChange);return A.useEffect(()=>{f.current&&d(getComputedStyle(f.current))},[f]),a.jsx(hS,{"data-orientation":"vertical",...i,ref:m,sizes:n,style:{top:0,right:l.dir==="ltr"?0:void 0,left:l.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":qd(n)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.y),onDragScroll:h=>e.onDragScroll(h.y),onWheelScroll:(h,g)=>{if(l.viewport){const y=l.viewport.scrollTop+h.deltaY;e.onWheelScroll(y),bS(y,g)&&h.preventDefault()}},onResize:()=>{f.current&&l.viewport&&u&&r({content:l.viewport.scrollHeight,viewport:l.viewport.offsetHeight,scrollbar:{size:f.current.clientHeight,paddingStart:bd(u.paddingTop),paddingEnd:bd(u.paddingBottom)}})}})}),[GL,mS]=uS(zr),hS=A.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:l,onThumbPointerUp:u,onThumbPointerDown:d,onThumbPositionChange:f,onDragScroll:m,onWheelScroll:h,onResize:g,...y}=e,N=sr(zr,n),[x,b]=A.useState(null),E=ii(t,B=>b(B)),w=A.useRef(null),S=A.useRef(""),C=N.viewport,R=r.content-r.viewport,O=us(h),F=us(f),D=Gd(g,10);function z(B){if(w.current){const H=B.clientX-w.current.left,ce=B.clientY-w.current.top;m({x:H,y:ce})}}return A.useEffect(()=>{const B=H=>{const ce=H.target;(x==null?void 0:x.contains(ce))&&O(H,R)};return document.addEventListener("wheel",B,{passive:!1}),()=>document.removeEventListener("wheel",B,{passive:!1})},[C,x,R,O]),A.useEffect(F,[r,F]),ea(x,D),ea(N.content,D),a.jsx(GL,{scope:n,scrollbar:x,hasThumb:i,onThumbChange:us(l),onThumbPointerUp:us(u),onThumbPositionChange:F,onThumbPointerDown:us(d),children:a.jsx(vs.div,{...y,ref:E,style:{position:"absolute",...y.style},onPointerDown:Ys(e.onPointerDown,B=>{B.button===0&&(B.target.setPointerCapture(B.pointerId),w.current=x.getBoundingClientRect(),S.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",N.viewport&&(N.viewport.style.scrollBehavior="auto"),z(B))}),onPointerMove:Ys(e.onPointerMove,z),onPointerUp:Ys(e.onPointerUp,B=>{const H=B.target;H.hasPointerCapture(B.pointerId)&&H.releasePointerCapture(B.pointerId),document.body.style.webkitUserSelect=S.current,N.viewport&&(N.viewport.style.scrollBehavior=""),w.current=null})})})}),vd="ScrollAreaThumb",gS=A.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=mS(vd,e.__scopeScrollArea);return a.jsx(da,{present:n||i.hasThumb,children:a.jsx(KL,{ref:t,...r})})}),KL=A.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...i}=e,l=sr(vd,n),u=mS(vd,n),{onThumbPositionChange:d}=u,f=ii(t,g=>u.onThumbChange(g)),m=A.useRef(),h=Gd(()=>{m.current&&(m.current(),m.current=void 0)},100);return A.useEffect(()=>{const g=l.viewport;if(g){const y=()=>{if(h(),!m.current){const N=YL(g,d);m.current=N,d()}};return d(),g.addEventListener("scroll",y),()=>g.removeEventListener("scroll",y)}},[l.viewport,h,d]),a.jsx(vs.div,{"data-state":u.hasThumb?"visible":"hidden",...i,ref:f,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Ys(e.onPointerDownCapture,g=>{const N=g.target.getBoundingClientRect(),x=g.clientX-N.left,b=g.clientY-N.top;u.onThumbPointerDown({x,y:b})}),onPointerUp:Ys(e.onPointerUp,u.onThumbPointerUp)})});gS.displayName=vd;var Kg="ScrollAreaCorner",yS=A.forwardRef((e,t)=>{const n=sr(Kg,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(QL,{...e,ref:t}):null});yS.displayName=Kg;var QL=A.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,i=sr(Kg,n),[l,u]=A.useState(0),[d,f]=A.useState(0),m=!!(l&&d);return ea(i.scrollbarX,()=>{var g;const h=((g=i.scrollbarX)==null?void 0:g.offsetHeight)||0;i.onCornerHeightChange(h),f(h)}),ea(i.scrollbarY,()=>{var g;const h=((g=i.scrollbarY)==null?void 0:g.offsetWidth)||0;i.onCornerWidthChange(h),u(h)}),m?a.jsx(vs.div,{...r,ref:t,style:{width:l,height:d,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function bd(e){return e?parseInt(e,10):0}function xS(e,t){const n=e/t;return isNaN(n)?0:n}function qd(e){const t=xS(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function XL(e,t,n,r="ltr"){const i=qd(n),l=i/2,u=t||l,d=i-u,f=n.scrollbar.paddingStart+u,m=n.scrollbar.size-n.scrollbar.paddingEnd-d,h=n.content-n.viewport,g=r==="ltr"?[0,h]:[h*-1,0];return vS([f,m],g)(e)}function p1(e,t,n="ltr"){const r=qd(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,l=t.scrollbar.size-i,u=t.content-t.viewport,d=l-r,f=n==="ltr"?[0,u]:[u*-1,0],m=zL(e,f);return vS([0,u],[0,d])(m)}function vS(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function bS(e,t){return e>0&&e<t}var YL=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function i(){const l={left:e.scrollLeft,top:e.scrollTop},u=n.left!==l.left,d=n.top!==l.top;(u||d)&&t(),n=l,r=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(r)};function Gd(e,t){const n=us(e),r=A.useRef(0);return A.useEffect(()=>()=>window.clearTimeout(r.current),[]),A.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function ea(e,t){const n=us(t);Ll(()=>{let r=0;if(e){const i=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return i.observe(e),()=>{window.cancelAnimationFrame(r),i.unobserve(e)}}},[e,n])}function JL(e,t){const{asChild:n,children:r}=e;if(!n)return typeof t=="function"?t(r):t;const i=A.Children.only(r);return A.cloneElement(i,{children:typeof t=="function"?t(i.props.children):t})}var wS=cS,ZL=fS,eM=yS;const _S=A.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(wS,{ref:r,className:gr("relative overflow-hidden",e),...n,children:[a.jsx(ZL,{className:"h-full w-full rounded-[inherit]",children:t}),a.jsx(SS,{}),a.jsx(eM,{})]}));_S.displayName=wS.displayName;const SS=A.forwardRef(({className:e,orientation:t="vertical",...n},r)=>a.jsx(qg,{ref:r,orientation:t,className:gr("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:a.jsx(gS,{className:"relative flex-1 rounded-full bg-border"})}));SS.displayName=qg.displayName;var tM="Separator",m1="horizontal",nM=["horizontal","vertical"],jS=A.forwardRef((e,t)=>{const{decorative:n,orientation:r=m1,...i}=e,l=rM(r)?r:m1,d=n?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return a.jsx(vs.div,{"data-orientation":l,...d,...i,ref:t})});jS.displayName=tM;function rM(e){return nM.includes(e)}var NS=jS;const CS=A.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},i)=>a.jsx(NS,{ref:i,decorative:n,orientation:t,className:gr("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));CS.displayName=NS.displayName;function sM({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=iM({defaultProp:t,onChange:n}),l=e!==void 0,u=l?e:r,d=us(n),f=A.useCallback(m=>{if(l){const g=typeof m=="function"?m(e):m;g!==e&&d(g)}else i(m)},[l,e,i,d]);return[u,f]}function iM({defaultProp:e,onChange:t}){const n=A.useState(e),[r]=n,i=A.useRef(r),l=us(t);return A.useEffect(()=>{i.current!==r&&(l(r),i.current=r)},[r,i,l]),n}var oM=N4.useId||(()=>{}),aM=0;function lM(e){const[t,n]=A.useState(oM());return Ll(()=>{e||n(r=>r??String(aM++))},[e]),e||(t?`radix-${t}`:"")}var Qg="Collapsible",[uM,NM]=lS(Qg),[cM,Xg]=uM(Qg),ES=A.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:l,onOpenChange:u,...d}=e,[f=!1,m]=sM({prop:r,defaultProp:i,onChange:u});return a.jsx(cM,{scope:n,disabled:l,contentId:lM(),open:f,onOpenToggle:A.useCallback(()=>m(h=>!h),[m]),children:a.jsx(vs.div,{"data-state":Jg(f),"data-disabled":l?"":void 0,...d,ref:t})})});ES.displayName=Qg;var kS="CollapsibleTrigger",AS=A.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,i=Xg(kS,n);return a.jsx(vs.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":Jg(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:t,onClick:Ys(e.onClick,i.onOpenToggle)})});AS.displayName=kS;var Yg="CollapsibleContent",PS=A.forwardRef((e,t)=>{const{forceMount:n,...r}=e,i=Xg(Yg,e.__scopeCollapsible);return a.jsx(da,{present:n||i.open,children:({present:l})=>a.jsx(dM,{...r,ref:t,present:l})})});PS.displayName=Yg;var dM=A.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:i,...l}=e,u=Xg(Yg,n),[d,f]=A.useState(r),m=A.useRef(null),h=ii(t,m),g=A.useRef(0),y=g.current,N=A.useRef(0),x=N.current,b=u.open||d,E=A.useRef(b),w=A.useRef();return A.useEffect(()=>{const S=requestAnimationFrame(()=>E.current=!1);return()=>cancelAnimationFrame(S)},[]),Ll(()=>{const S=m.current;if(S){w.current=w.current||{transitionDuration:S.style.transitionDuration,animationName:S.style.animationName},S.style.transitionDuration="0s",S.style.animationName="none";const C=S.getBoundingClientRect();g.current=C.height,N.current=C.width,E.current||(S.style.transitionDuration=w.current.transitionDuration,S.style.animationName=w.current.animationName),f(r)}},[u.open,r]),a.jsx(vs.div,{"data-state":Jg(u.open),"data-disabled":u.disabled?"":void 0,id:u.contentId,hidden:!b,...l,ref:h,style:{"--radix-collapsible-content-height":y?`${y}px`:void 0,"--radix-collapsible-content-width":x?`${x}px`:void 0,...e.style},children:b&&i})});function Jg(e){return e?"open":"closed"}var fM=ES;const pM=fM,mM=AS,hM=PS;function h1({href:e,className:t=l=>"",activeClassName:n="active",children:r,...i}){const{rootPath:l,url:u}=_r().props,d=u===e;let f=t(d);return a.jsx(yr,{href:`${l}${e}`,className:gr(f,d&&n),...i,children:r})}const gM=[{title:"Models",icon:Bs,href:"/",children:[{title:"All Models",icon:Bs,href:"/models"},{title:"New Model",icon:Bs,href:"/models/new"}]},{title:"Datasources",icon:Ro,href:"/datasources",children:[{title:"All Datasources",icon:Ro,href:"/datasources"},{title:"New Datasource",icon:Ro,href:"/datasources/new"}]},{title:"Datasets",icon:Ln,href:"/datasets",children:[{title:"All Datasets",icon:Ln,href:"/datasets"},{title:"New Dataset",icon:Ln,href:"/datasets/new"}]}];function yM(e){const{rootPath:t}=_r().props,n=e.split("/").filter(Boolean),r=[];let i=t;if(n.length===0)return[];let l,u;switch(["datasources","datasets","models","settings"].includes(n[0])?(l=n[0],u=0):(l=n[1],u=1),l){case"models":r.push({title:"Models",href:`${t}/models`});break;case"datasources":r.push({title:"Datasources",href:`${t}/datasources`});break;case"datasets":r.push({title:"Datasets",href:`${t}/datasets`});break;case"settings":r.push({title:"Settings",href:`${t}/settings`});break;default:r.push({title:"Models",href:`${t}/models`})}for(let d=u+1;d<n.length;d++){const f=n[d];if(i+=`/${n[d]}`,n[d-1]==="datasets"&&f!=="new")r.push({title:"Details",href:i});else if(n[d-1]==="models"&&f!=="new")r.push({title:"Details",href:i});else{const m=f==="new"?"New":f==="edit"?"Edit":f.charAt(0).toUpperCase()+f.slice(1);r.push({title:m,href:i})}}return r}function xM({children:e}){const[t,n]=A.useState(!0),[r,i]=A.useState(["Models"]),l=yM(location.pathname),u=d=>{i(f=>f.includes(d)?f.filter(m=>m!==d):[...f,d])};return a.jsxs("div",{className:"min-h-screen bg-gray-50",children:[a.jsxs("div",{className:gr("fixed left-0 top-0 z-40 h-screen bg-white border-r transition-all duration-300",t?"w-64":"w-16"),children:[a.jsxs("div",{className:"flex h-16 items-center border-b px-4",children:[t?a.jsxs(a.Fragment,{children:[a.jsx(Bs,{className:"w-8 h-8 text-blue-600"}),a.jsx("h1",{className:"text-xl font-bold text-gray-900 ml-2",children:"EasyML"})]}):a.jsx(Bs,{className:"w-8 h-8 text-blue-600"}),a.jsx("button",{onClick:()=>n(!t),className:"ml-auto p-2 hover:bg-gray-100 rounded-md",children:a.jsx(ST,{className:"w-4 h-4"})})]}),a.jsx(_S,{className:"h-[calc(100vh-4rem)] px-3",children:a.jsxs("div",{className:"space-y-2 py-4",children:[gM.map(d=>{var f;return a.jsxs(pM,{open:r.includes(d.title),onOpenChange:()=>u(d.title),children:[a.jsxs(mM,{className:"flex items-center w-full p-2 hover:bg-gray-100 rounded-md",children:[a.jsx(d.icon,{className:"w-4 h-4"}),t&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"ml-2 text-sm font-medium flex-1 text-left",children:d.title}),r.includes(d.title)?a.jsx(oa,{className:"w-4 h-4"}):a.jsx(qo,{className:"w-4 h-4"})]})]}),a.jsx(hM,{children:t&&((f=d.children)==null?void 0:f.map(m=>a.jsxs(h1,{href:m.href,className:({isActive:h})=>gr("flex items-center pl-8 pr-2 py-2 text-sm rounded-md",h?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-50"),children:[a.jsx(m.icon,{className:"w-4 h-4"}),a.jsx("span",{className:"ml-2",children:m.title})]},m.href)))})]},d.title)}),a.jsx(CS,{className:"my-4"}),a.jsxs(h1,{href:"/settings",className:({isActive:d})=>gr("flex items-center w-full p-2 rounded-md",d?"bg-blue-50 text-blue-600":"text-gray-600 hover:bg-gray-50"),children:[a.jsx(Ui,{className:"w-4 h-4"}),t&&a.jsx("span",{className:"ml-2 text-sm font-medium",children:"Settings"})]})]})})]}),a.jsxs("div",{className:gr("transition-all duration-300",t?"ml-64":"ml-16"),children:[a.jsx(EL,{}),a.jsx("div",{className:"h-16 border-b bg-white flex items-center px-4",children:a.jsx("nav",{className:"flex","aria-label":"Breadcrumb",children:a.jsx("ol",{className:"flex items-center space-x-2",children:l.map((d,f)=>a.jsxs(tr.Fragment,{children:[f>0&&a.jsx(qo,{className:"w-4 h-4 text-gray-400"}),a.jsx("li",{children:a.jsx(yr,{href:d.href,className:gr("text-sm",f===l.length-1?"text-blue-600 font-medium":"text-gray-500 hover:text-gray-700"),children:d.title})})]},d.href))})})}),a.jsx("main",{className:"min-h-[calc(100vh-4rem)]",children:e})]})]})}function vM({children:e}){const{showAlert:t}=iS(),{flash:n}=_r().props;return A.useEffect(()=>{n&&n.forEach(({type:r,message:i})=>{t(r,i)})},[n,t]),a.jsx(a.Fragment,{children:e})}function bM({children:e}){return a.jsx(CL,{children:a.jsx(vM,{children:a.jsx(xM,{children:e})})})}document.addEventListener("DOMContentLoaded",()=>{sT({resolve:e=>{let n=Object.assign({"../pages/DatasetDetailsPage.tsx":SR,"../pages/DatasetsPage.tsx":NR,"../pages/DatasourceFormPage.tsx":PR,"../pages/DatasourcesPage.tsx":OR,"../pages/EditModelPage.tsx":LR,"../pages/EditTransformationPage.tsx":zR,"../pages/ModelsPage.tsx":WR,"../pages/NewDatasetPage.tsx":o6,"../pages/NewModelPage.tsx":l6,"../pages/NewTransformationPage.tsx":c6,"../pages/SettingsPage.tsx":p6,"../pages/ShowModelPage.tsx":g6,"../pages/TransformationsPage.tsx":b6})[`../${e}.tsx`];if(!n.default){alert(`The page ${e} could not be found, you probably forgot to export default.`);return}return n.default.layout=n.default.layout||(r=>a.jsx(bM,{children:r})),n},setup({el:e,App:t,props:n}){rS(e).render(a.jsx(t,{...n}))}})});
|
474
|
-
//# sourceMappingURL=Application.tsx-
|
474
|
+
//# sourceMappingURL=Application.tsx-BQL_uYxE.js.map
|