PageSourceSearch

https://app.lunary.ai/_next/static/chunks/pages/datasets/v2-73bfa46ff65a8eb2.js

js lunary.ai collected 2026-10-02 13:52:24 UTC 11,092 bytes, 4 lines download raw bytes

1
2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="52c1eaa0-88a0-526c-aa70-4faa9b1ff870")}catch(e){}}();
3(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4518],{8451:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/datasets/v2",function(){return s(42510)}])},42510:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>V});var l=s(81535),i=s(53087),n=s(24645),r=s(3992),a=s(92565),d=s(96907),c=s(61448),o=s(63051),h=s(82869),u=s(56454),x=s(97354),j=s(41757),m=s(33455),p=s(14958),f=s(34469),g=s(76438),w=s(8109),C=s(75529),v=s(19796),T=s(36088),b=s(4112),y=s(34667),X=s(90437),E=s(97377),S=s(12329),z=s(33347),$=s(56601),k=s(30328),D=s(67789),A=s(60268),N=s(50367),_=s(87127),P=s(20528),Y=s(12483),O=s(10321),L=s(91350),R=s(47403);let U=[{label:"Newest",value:"newest"},{label:"A → Z",value:"alphabetical"},{label:"Most items",value:"items"},{label:"Last updated",value:"updated"}];function F({dataset:e,onRefresh:t}){let s=(0,S.useRouter)(),{duplicateDataset:i,deleteDataset:o,isDuplicating:h,isDeleting:u}=(0,R.gF)(e.id),x=async s=>{s.stopPropagation();try{await i(void 0,{onSuccess(s){O.$e.show({title:"Dataset duplicated",message:`“${s.name}” was created from “${e.name}”.`,color:"green"}),t()}})}catch(e){}};return(0,l.jsxs)(r.X.Tr,{onClick:()=>{s.push(`/datasets/v2/${e.id}`)},style:{cursor:"pointer"},children:[(0,l.jsx)(r.X.Td,{w:"25%",children:(0,l.jsx)(n.E,{fw:600,children:e.name})}),(0,l.jsx)(r.X.Td,{w:"30%",children:e.description?(0,l.jsx)(a.m,{label:e.description,disabled:e.description.length<80,withArrow:!0,children:(0,l.jsx)(n.E,{size:"sm",c:"dimmed",lineClamp:1,children:e.description})}):(0,l.jsx)(n.E,{size:"sm",c:"dimmed",children:"—"})}),(0,l.jsx)(r.X.Td,{w:"10%",children:(0,l.jsxs)(n.E,{size:"sm",fw:600,children:[e.itemCount??0," ",(e.itemCount??0)===1?"item":"items"]})}),(0,l.jsx)(r.X.Td,{w:"15%",children:(0,l.jsx)(a.m,{label:new Date(e.updatedAt).toLocaleString(),children:(0,l.jsx)(n.E,{size:"sm",children:(0,L.h8)(e.updatedAt)})})}),(0,l.jsx)(r.X.Td,{w:"15%",children:(0,l.jsxs)(d.Y,{gap:"xs",children:[(0,l.jsx)(c.e,{size:"sm",radius:"xl",children:function(e,t){if(e){let t=e.trim().split(/\s+/);return 1===t.length?t[0].slice(0,2).toUpperCase():(t[0][0]??"").toUpperCase()+(t[t.length-1][0]??"").toUpperCase()}return t?t.slice(0,2).toUpperCase():"—"}(e.ownerName,e.ownerEmail)}),(0,l.jsx)(n.E,{size:"sm",children:e.ownerName||e.ownerEmail||"—"})]})}),(0,l.jsx)(r.X.Td,{w:"5%",onClick:e=>e.stopPropagation(),children:(0,l.jsx)(d.Y,{justify:"flex-end",children:(0,l.jsx)(I,{onDuplicate:x,onDelete:s=>{s.stopPropagation(),z.jQ.openConfirmModal({title:"Delete dataset?",confirmProps:{color:"red"},labels:{confirm:"Delete",cancel:"Cancel"},centered:!0,children:(0,l.jsxs)(n.E,{size:"sm",children:["This will permanently delete “",e.name,"” and all of its items. You cannot undo this action."]}),onConfirm:async()=>{try{await o(void 0,{onSuccess(){O.$e.show({title:"Dataset deleted",message:`“${e.name}” has been removed.`,color:"green"}),t()}})}catch(e){}}})},isDuplicating:h,isDeleting:u})})})]})}function I({onDuplicate:e,onDelete:t,isDuplicating:s,isDeleting:i}){return(0,l.jsxs)(o.W,{shadow:"md",withinPortal:!0,children:[(0,l.jsx)(o.W.Target,{children:(0,l.jsx)(h.M,{variant:"subtle","aria-label":"Dataset actions",children:(0,l.jsx)($.A,{size:18})})}),(0,l.jsxs)(o.W.Dropdown,{children:[(0,l.jsx)(o.W.Item,{leftSection:(0,l.jsx)(k.A,{size:16}),onClick:e,disabled:s||i,children:"Duplicate"}),(0,l.jsx)(o.W.Item,{color:"red",leftSection:(0,l.jsx)(D.A,{size:16}),onClick:t,disabled:i||s,children:"Delete"})]})]})}function B({opened:e,onClose:t,onSubmit:s,isSubmitting:r,isImporting:a}){let[c,o]=(0,i.useState)(""),[g,w]=(0,i.useState)(""),[C,v]=(0,i.useState)(null),[T,b]=(0,i.useState)(null),[y,X]=(0,i.useState)(!1),E=(0,i.useRef)(null);(0,i.useEffect)(()=>{!e&&(o(""),w(""),v(null),b(null),X(!1),E.current&&(E.current.value=""))},[e]);let S=()=>{r||a||(o(""),w(""),v(null),b(null),t())},z=async e=>{let t=e.target.files?.[0];if(!t)return;let s=t.name.split(".").pop()?.toLowerCase();if("csv"!==s&&"jsonl"!==s){b("Only CSV and JSONL files are supported"),v(null),e.target.value="";return}b(null),X(!0);let l=new FileReader;l.onload=()=>{let i=l.result??"",n="string"==typeof i?i.replace(/^\uFEFF/,""):"",r=n.split(/\r?\n/).map(e=>e.trim()).filter(e=>e.length>0);if(0===r.length){b("The selected file is empty"),v(null),X(!1),e.target.value="";return}let a="csv"===s?Math.max(r.length-1,0):r.length;v({name:t.name,format:s,content:n,size:t.size,rowCount:a}),X(!1),e.target.value=""},l.onerror=()=>{b("Failed to read the selected file"),v(null),X(!1),e.target.value=""},l.readAsText(t)},$=async()=>
3{if(c.trim())try{await s({name:c.trim(),description:g.trim(),file:C??void 0}),o(""),w(""),v(null),b(null)}catch(e){}};return(0,l.jsx)(u.a,{opened:e,onClose:S,title:"Create dataset",centered:!0,children:(0,l.jsxs)(x.B,{gap:"sm",children:[(0,l.jsx)(j.k,{label:"Name",placeholder:"Evaluation dataset",value:c,onChange:e=>o(e.currentTarget.value),required:!0,disabled:r||a,"data-autofocus":!0}),(0,l.jsx)(m.T,{label:"Description",placeholder:"Optional context for collaborators",minRows:3,value:g,onChange:e=>w(e.currentTarget.value),disabled:r||a}),(0,l.jsxs)(x.B,{gap:"xs",children:[(0,l.jsx)("input",{type:"file",hidden:!0,ref:E,accept:".csv,.jsonl",onChange:z}),(0,l.jsx)(p.$,{variant:"light",leftSection:(0,l.jsx)(A.A,{size:16}),onClick:()=>E.current?.click(),disabled:r||a||y,children:C?"Replace file":"Upload CSV or JSONL"}),T&&(0,l.jsx)(n.E,{size:"xs",c:"red",children:T}),C&&(0,l.jsxs)(d.Y,{gap:"xs",children:[(0,l.jsx)(f.E,{variant:"light",children:C.format.toUpperCase()}),(0,l.jsx)(n.E,{size:"sm",children:C.name}),(0,l.jsxs)(n.E,{size:"xs",c:"dimmed",children:[C.rowCount," ",1===C.rowCount?"row":"rows"]}),(0,l.jsx)(h.M,{size:"sm",variant:"subtle",onClick:()=>{v(null),b(null),E.current&&(E.current.value="")},"aria-label":"Remove file",children:(0,l.jsx)(N.A,{size:14})})]})]}),(0,l.jsxs)(d.Y,{justify:"flex-end",children:[(0,l.jsx)(p.$,{variant:"default",onClick:S,disabled:r||a,children:"Cancel"}),(0,l.jsx)(p.$,{leftSection:(0,l.jsx)(_.A,{size:16}),onClick:$,loading:r||a||y,disabled:!c.trim()||y,children:"Create"})]})]})})}function M(){return(0,l.jsxs)(r.X,{verticalSpacing:"md",children:[(0,l.jsx)(r.X.Thead,{children:(0,l.jsxs)(r.X.Tr,{children:[(0,l.jsx)(r.X.Th,{children:"Name"}),(0,l.jsx)(r.X.Th,{children:"Description"}),(0,l.jsx)(r.X.Th,{children:"Items"}),(0,l.jsx)(r.X.Th,{children:"Last updated"}),(0,l.jsx)(r.X.Th,{children:"Owner"}),(0,l.jsx)(r.X.Th,{})]})}),(0,l.jsx)(r.X.Tbody,{children:Array.from({length:5}).map((e,t)=>(0,l.jsxs)(r.X.Tr,{children:[(0,l.jsx)(r.X.Td,{children:(0,l.jsx)(g.E,{height:16,width:"60%"})}),(0,l.jsx)(r.X.Td,{children:(0,l.jsx)(g.E,{height:14,width:"85%"})}),(0,l.jsx)(r.X.Td,{children:(0,l.jsx)(g.E,{height:14,width:40})}),(0,l.jsx)(r.X.Td,{children:(0,l.jsx)(g.E,{height:14,width:"50%"})}),(0,l.jsx)(r.X.Td,{children:(0,l.jsxs)(d.Y,{gap:"xs",children:[(0,l.jsx)(g.E,{height:32,width:32,radius:"xl"}),(0,l.jsx)(g.E,{height:14,width:80})]})}),(0,l.jsx)(r.X.Td,{children:(0,l.jsx)(g.E,{height:14,width:24})})]},t))})]})}function W({onCreate:e}){return(0,l.jsx)(w.o,{py:"xl",children:(0,l.jsxs)(x.B,{align:"center",gap:"sm",children:[(0,l.jsx)(C.L,{variant:"light",radius:"xl",size:64,children:(0,l.jsx)(P.A,{size:32})}),(0,l.jsx)(v.h,{order:3,children:"Your datasets will appear here"}),(0,l.jsx)(n.E,{size:"sm",c:"dimmed",ta:"center",children:"Create a dataset to label, annotate, and evaluate your data. cases."}),(0,l.jsx)(p.$,{leftSection:(0,l.jsx)(_.A,{size:16}),onClick:e,variant:"default",children:"Create"}),(0,l.jsx)(p.$,{component:"a",href:"https://lunary.ai/docs/datasets",target:"_blank",rel:"noreferrer",variant:"subtle",children:"Documentation"})]})})}function J({onClear:e}){return(0,l.jsx)(w.o,{py:"xl",children:(0,l.jsxs)(x.B,{align:"center",gap:"sm",children:[(0,l.jsx)(v.h,{order:4,children:"No datasets match your search"}),(0,l.jsx)(n.E,{size:"sm",c:"dimmed",ta:"center",children:"Try another keyword or reset your filters to see all datasets."}),(0,l.jsx)(p.$,{variant:"default",onClick:e,children:"Clear filters"})]})})}let V=function(){let e=(0,S.useRouter)(),[t,s]=(0,i.useState)(""),[a]=(0,X.o)(t,250),[c,o]=(0,i.useState)("newest"),[h,{open:u,close:m}]=(0,E.j)(!1),{datasets:f,isLoading:g,isValidating:w,mutate:C,createDataset:z,isCreating:$,importDatasetItems:k}=(0,R.lu)({search:a,sort:c}),[D,A]=(0,i.useState)(!1),N=!!a,P=0===f.length,L=async({name:t,description:s,file:l})=>{let i=await z({name:t,description:s||null});if(i){if(O.$e.show({title:"Dataset created",message:`“${i.name}” is ready to use.`,color:"green"}),l&&i.id){A(!0);try{let e=await k(i.id,{format:l.format,content:l.content});e?.insertedCount&&O.$e.show({title:"Items imported",message:`Added ${e.insertedCount} ${1===e.insertedCount?"item":"items"} to “${i.name}”.`,color:"green"})}catch(e){}finally{A(!1)}}else if(i.id){A(!0);try{let e=Array.from({length:5}).map(()=>JSON.stringify({input:"",expected_output:null})).join("\n");await k(i.id,{format:"jsonl",content:e})}catch(e){O.$e.show({title:"Placeholder rows",message:"Dataset was created but default rows could not be added automatically.",color:"yellow"})}finally{A(!1)}}
3await C(),m(),i.id&&e.push(`/datasets/v2/${i.id}`)}},I=(0,l.jsxs)(d.Y,{align:"center",justify:"space-between",children:[(0,l.jsx)(j.k,{placeholder:"Search datasets",leftSection:(0,l.jsx)(Y.A,{size:16}),value:t,onChange:e=>s(e.currentTarget.value),w:"50%"}),(0,l.jsxs)(d.Y,{gap:"sm",children:[w&&!g&&(0,l.jsxs)(d.Y,{gap:4,children:[(0,l.jsx)(T.a,{size:"xs"}),(0,l.jsx)(n.E,{size:"xs",c:"dimmed",children:"Updating…"})]}),(0,l.jsx)(b.l,{placeholder:"Sort","aria-label":"Sort datasets",data:U,value:c,onChange:e=>{o(e??"newest")},withinPortal:!0,comboboxProps:{withinPortal:!0},style:{width:200}})]})]});return(0,l.jsxs)(y.m,{fluid:!0,py:"lg",px:"lg",children:[(0,l.jsxs)(x.B,{gap:"lg",children:[(0,l.jsxs)(d.Y,{align:"center",justify:"space-between",children:[(0,l.jsx)(v.h,{order:2,children:"Datasets"}),(0,l.jsx)(p.$,{variant:"default",leftSection:(0,l.jsx)(_.A,{size:12}),onClick:u,children:"Create"})]}),I,g?(0,l.jsx)(M,{}):P?N?(0,l.jsx)(J,{onClear:()=>{s("")}}):(0,l.jsx)(W,{onCreate:u}):(0,l.jsxs)(r.X,{highlightOnHover:!0,verticalSpacing:"md",children:[(0,l.jsx)(r.X.Thead,{children:(0,l.jsxs)(r.X.Tr,{children:[(0,l.jsx)(r.X.Th,{children:"Name"}),(0,l.jsx)(r.X.Th,{children:"Description"}),(0,l.jsx)(r.X.Th,{children:"Items"}),(0,l.jsx)(r.X.Th,{children:"Last updated"}),(0,l.jsx)(r.X.Th,{children:"Owner"}),(0,l.jsx)(r.X.Th,{})]})}),(0,l.jsx)(r.X.Tbody,{children:f.map(e=>(0,l.jsx)(F,{dataset:e,onRefresh:()=>C()},e.id))})]})]}),(0,l.jsx)(B,{opened:h,onClose:m,onSubmit:L,isSubmitting:$,isImporting:D})]})}}},e=>{e.O(0,[312,9538,636,6593,8792],()=>e(e.s=8451)),_N_E=e.O()}]);
4//# debugId=52c1eaa0-88a0-526c-aa70-4faa9b1ff870

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.