import{r as n,j as e,P,S as W,o as F,T as V,D as A,z as g,n as b,O as H,J as M,V as q,_ as O,L as D}from"./index-DuuohOak.js";const G=({title:c,titleId:i,...r})=>n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",viewBox:"0 0 24 24",fill:"currentColor",width:"1em",height:"1em","aria-labelledby":i},r),c?n.createElement("title",{id:i},c):null,n.createElement("g",{clipPath:"url(#checkbox-indeterminate-line_svg__a)"},n.createElement("path",{d:"M4 3h16a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1Zm1 2v14h14V5H5Zm2 6h10v2H7v-2Z"})),n.createElement("defs",null,n.createElement("clipPath",{id:"checkbox-indeterminate-line_svg__a"},n.createElement("path",{d:"M0 0h24v24H0z"})))),$=({title:c,titleId:i,...r})=>n.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",viewBox:"0 0 24 24",fill:"currentColor",width:"1em",height:"1em","aria-labelledby":i},r),c?n.createElement("title",{id:i},c):null,n.createElement("g",{clipPath:"url(#filter-line_svg__a)"},n.createElement("path",{d:"M9 13.5 4 6H3V4h18v2h-1l-5 7.5V22H9v-8.5ZM6.404 6 11 12.894V20h2v-7.106L17.596 6H6.404Z"})),n.createElement("defs",null,n.createElement("clipPath",{id:"filter-line_svg__a"},n.createElement("path",{d:"M0 0h24v24H0z"}))));function R(c){const{className:i,indeterminate:r,value:v}=c;return e.jsxs(e.Fragment,{children:[r&&e.jsx(G,{className:i}),v&&!r&&e.jsx(P,{className:i}),!v&&!r&&e.jsx(W,{className:i})]})}const U="_checkbox_12g7n_1",Z="_with-background_12g7n_7",Y="_checkmark-container_12g7n_12",J="_input_12g7n_18",K="_content_12g7n_33",Q="_description_12g7n_40",X="_checked_12g7n_45",L="_checkmark_12g7n_12",ee="_disabled-checkbox_12g7n_58",m={checkbox:U,withBackground:Z,checkmarkContainer:Y,input:J,content:K,description:Q,checked:X,checkmark:L,disabledCheckbox:ee};function B(c){const{className:i,checkmark:r=R,checkmarkClassName:v,checkmarkContainerClassName:T,disabled:s,error:h,indeterminate:y,inputClassName:w,invertedLogic:d=!1,label:j,labelContainerClassName:_,name:I,onChange:f,readOnly:x,tooltip:k,value:C,description:u,withBackground:E,...S}=c,z=n.useCallback(t=>{const o=t.currentTarget.checked;f(d?!o:o,I)},[I,f,d]),N=d?!C:C,p=F(m.checkbox,i,!y&&N&&m.checked,E&&m.withBackground,s&&m.disabledCheckbox,x&&m.readOnly);return e.jsxs("label",{className:p,title:k,children:[e.jsxs("div",{className:F(m.checkmarkContainer,T),children:[e.jsx("input",{onChange:z,className:F(m.input,w),type:"checkbox",checked:N??!1,disabled:s||x,readOnly:x,...S}),e.jsx(r,{className:F(m.checkmark,v),value:N??!1,indeterminate:y,"aria-hidden":"true"})]}),(j||u)&&e.jsxs("div",{className:m.content,children:[j&&e.jsx("div",{className:_,children:j}),u&&e.jsx("div",{className:m.description,children:u})]}),h&&e.jsx(V,{children:h})]})}function _e({sources:c,types:i,regions:r,countries:v,imageTypes:T,isLoadingFilters:s=!1}){const[h,y]=n.useState(!1),[w,d]=n.useState(""),{search:j,setSearch:_,srcFilter:I,setSrcFilter:f,catFilter:x,setCatFilter:k,regionFilter:C,setRegionFilter:u,countryFilter:E,setCountryFilter:S,imageTypeFilter:z,setImageTypeFilter:N,uploadTypeFilter:p,setUploadTypeFilter:t,clearAllFilters:o}=A();return n.useEffect(()=>{d(j)},[j]),e.jsxs("div",{className:"mb-6 space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[e.jsx(g,{withInternalPadding:!0,className:"bg-white/20 backdrop-blur-sm rounded-md p-2",children:e.jsx(b,{name:"toggle-filters",variant:"secondary",onClick:()=>y(!h),className:"whitespace-nowrap",title:h?"Hide Filters":"Show Filters",children:e.jsx($,{className:"w-4 h-4"})})}),e.jsx(g,{withInternalPadding:!0,className:"bg-white/20 backdrop-blur-sm rounded-md p-2 flex-1 min-w-[300px]",children:e.jsx(H,{name:"search",placeholder:"Search",value:w,onChange:a=>d(a||""),onKeyDown:a=>{a.key==="Enter"&&_(w)}})}),e.jsx(g,{withInternalPadding:!0,className:"bg-white/20 backdrop-blur-sm rounded-md p-2",children:e.jsx(b,{name:"clear-filters",variant:"secondary",onClick:o,children:"Clear Filters"})})]}),h&&e.jsx("div",{className:"bg-white/20 backdrop-blur-sm rounded-md p-4",children:e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:[e.jsx(g,{withInternalPadding:!0,className:"p-2",children:e.jsx(M,{name:"source",placeholder:s?"Loading...":"All Sources",options:c,value:I||null,onChange:a=>f(a||""),keySelector:a=>a.s_code,labelSelector:a=>a.label,required:!1,disabled:s})}),e.jsx(g,{withInternalPadding:!0,className:"p-2",children:e.jsx(M,{name:"category",placeholder:s?"Loading...":"All Categories",options:i,value:x||null,onChange:a=>k(a||""),keySelector:a=>a.t_code,labelSelector:a=>a.label,required:!1,disabled:s})}),e.jsx(g,{withInternalPadding:!0,className:"p-2",children:e.jsx(M,{name:"region",placeholder:s?"Loading...":"All Regions",options:r,value:C||null,onChange:a=>u(a||""),keySelector:a=>a.r_code,labelSelector:a=>a.label,required:!1,disabled:s})}),e.jsx(g,{withInternalPadding:!0,className:"p-2",children:e.jsx(q,{name:"country",placeholder:s?"Loading...":"All Countries",options:v,value:E?[E]:[],onChange:a=>S(a[0]||""),keySelector:a=>a.c_code,labelSelector:a=>a.label,disabled:s})}),e.jsx(g,{withInternalPadding:!0,className:"p-2",children:e.jsx(M,{name:"imageType",placeholder:s?"Loading...":"All Image Types",options:T,value:z||null,onChange:a=>N(a||""),keySelector:a=>a.image_type,labelSelector:a=>a.label,required:!1,disabled:s})}),e.jsx(g,{withInternalPadding:!0,className:"p-2",children:e.jsx(M,{name:"uploadType",placeholder:"All Upload Types",options:[{key:"single",label:"Single Upload"},{key:"multiple",label:"Multiple Upload"}],value:p||null,onChange:a=>t(a||""),keySelector:a=>a.key,labelSelector:a=>a.label,required:!1,disabled:!1})})]})})]})}const ae="_fullSizeModalOverlay_cyz3b_1",le="_fullSizeModalContent_cyz3b_29",te="_ratingWarningContent_cyz3b_53",se="_ratingWarningTitle_cyz3b_65",ne="_exportModeSection_cyz3b_133",ie="_splitConfigSection_cyz3b_143",re="_splitConfigTitle_cyz3b_153",ce="_splitInputsContainer_cyz3b_167",oe="_splitInputGroup_cyz3b_183",de="_splitInputLabel_cyz3b_197",pe="_splitInput_cyz3b_167",me="_splitTotal_cyz3b_247",he="_splitTotalError_cyz3b_261",xe="_checkboxesContainer_cyz3b_271",ue="_ratingWarningButtons_cyz3b_289",ge="_singleExportMessage_cyz3b_309",be="_navigateButtonContainer_cyz3b_333",ve="_loadingOverlay_cyz3b_349",l={fullSizeModalOverlay:ae,fullSizeModalContent:le,ratingWarningContent:te,ratingWarningTitle:se,exportModeSection:ne,splitConfigSection:ie,splitConfigTitle:re,splitInputsContainer:ce,splitInputGroup:oe,splitInputLabel:de,splitInput:pe,splitTotal:me,splitTotalError:he,checkboxesContainer:xe,ratingWarningButtons:ue,singleExportMessage:ge,navigateButtonContainer:be,loadingOverlay:ve};function fe({isOpen:c,onClose:i,onExport:r,crisisMapsCount:v,droneImagesCount:T,isLoading:s=!1,exportSuccess:h=!1,variant:y="bulk",onNavigateAndExport:w}){const[d,j]=n.useState("standard"),[_,I]=n.useState(80),[f,x]=n.useState(10),[k,C]=n.useState(10),[u,E]=n.useState(!0),[S,z]=n.useState(!0),N=()=>{if(y==="single"){r(d,["crisis_map","drone_image"]);return}if(!u&&!S){alert("Please select at least one image type to export.");return}const t=[];u&&t.push("crisis_map"),S&&t.push("drone_image"),r(d,t)},p=()=>{i()};return c?y==="single"?e.jsx("div",{className:l.fullSizeModalOverlay,onClick:p,children:e.jsxs("div",{className:l.fullSizeModalContent,onClick:t=>t.stopPropagation(),children:[s&&e.jsx("div",{className:l.loadingOverlay,children:e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx(O,{className:"text-ifrcRed"}),e.jsx("div",{className:"text-lg font-medium",children:"Exporting..."}),e.jsx("div",{className:"text-sm text-gray-600",children:"This might take a few seconds"})]})}),h&&e.jsx("div",{className:l.loadingOverlay,children:e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx("div",{className:"text-lg font-medium",children:"Export Successful!"}),e.jsx("div",{className:"text-sm text-gray-600",children:"Your dataset has been downloaded"}),e.jsx(b,{name:"close-export-success",onClick:p,className:"mt-4",children:"Close"})]})}),e.jsxs("div",{className:l.ratingWarningContent,children:[e.jsx("h3",{className:l.ratingWarningTitle,children:"Export Single Item"}),e.jsxs("div",{className:l.singleExportMessage,children:[e.jsx("p",{children:"This only exports the 1 item currently on display."}),e.jsx("p",{children:'You may export the entire dataset from the "list view" here:'})]}),e.jsx("div",{className:l.navigateButtonContainer,children:e.jsx(b,{name:"navigate-to-list",variant:"secondary",onClick:w,children:"Navigate to List View"})}),e.jsxs("div",{className:l.ratingWarningButtons,children:[e.jsx(b,{name:"continue-export",onClick:N,disabled:s,children:s?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{className:"text-white"}),"Exporting..."]}):"Continue"}),e.jsx(b,{name:"cancel-export",variant:"tertiary",onClick:p,disabled:s,children:"Cancel"})]})]})]})}):e.jsx("div",{className:l.fullSizeModalOverlay,onClick:p,children:e.jsxs("div",{className:l.fullSizeModalContent,onClick:t=>t.stopPropagation(),children:[s&&e.jsx("div",{className:l.loadingOverlay,children:e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx(O,{className:"text-ifrcRed"}),e.jsx("div",{className:"text-lg font-medium",children:"Exporting..."}),e.jsx("div",{className:"text-sm text-gray-600",children:"This might take a few seconds"})]})}),h&&e.jsx("div",{className:l.loadingOverlay,children:e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx("div",{className:"text-lg font-medium",children:"Export Successful!"}),e.jsx("div",{className:"text-sm text-gray-600",children:"Your dataset has been downloaded"}),e.jsx(b,{name:"close-export-success",onClick:p,className:"mt-4",children:"Close"})]})}),e.jsxs("div",{className:l.ratingWarningContent,children:[e.jsx("h3",{className:l.ratingWarningTitle,children:"Export Dataset"}),e.jsx("div",{className:l.exportModeSection,children:e.jsx(D,{name:"export-mode",value:d,onChange:t=>{(t==="standard"||t==="fine-tuning")&&j(t)},options:[{key:"standard",label:"Standard"},{key:"fine-tuning",label:"Fine-tuning"}],keySelector:t=>t.key,labelSelector:t=>t.label,disabled:s})}),d==="fine-tuning"&&e.jsxs("div",{className:l.splitConfigSection,children:[e.jsx("div",{className:l.splitConfigTitle,children:"Dataset Split Configuration"}),e.jsxs("div",{className:l.splitInputsContainer,children:[e.jsxs("div",{className:l.splitInputGroup,children:[e.jsx("label",{htmlFor:"train-split",className:l.splitInputLabel,children:"Train (%)"}),e.jsx("input",{id:"train-split",type:"number",min:"0",max:"100",value:_,onChange:t=>{const o=parseInt(t.target.value)||0,a=100-o;a>=0&&(I(o),f+k>a&&(x(Math.floor(a/2)),C(a-Math.floor(a/2))))},className:l.splitInput,disabled:s})]}),e.jsxs("div",{className:l.splitInputGroup,children:[e.jsx("label",{htmlFor:"test-split",className:l.splitInputLabel,children:"Test (%)"}),e.jsx("input",{id:"test-split",type:"number",min:"0",max:"100",value:f,onChange:t=>{const o=parseInt(t.target.value)||0,a=100-_-o;a>=0&&(x(o),C(a))},className:l.splitInput,disabled:s})]}),e.jsxs("div",{className:l.splitInputGroup,children:[e.jsx("label",{htmlFor:"val-split",className:l.splitInputLabel,children:"Val (%)"}),e.jsx("input",{id:"val-split",type:"number",min:"0",max:"100",value:k,onChange:t=>{const o=parseInt(t.target.value)||0,a=100-_-o;a>=0&&(C(o),x(a))},className:l.splitInput,disabled:s})]})]}),_+f+k!==100&&e.jsx("div",{className:l.splitTotal,children:e.jsx("span",{className:l.splitTotalError,children:"Must equal 100%"})})]}),e.jsxs("div",{className:l.checkboxesContainer,children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsx(B,{name:"crisis-maps",label:`Crisis Maps (${v} images)`,value:u,onChange:t=>E(t),disabled:s})}),e.jsx("div",{className:"flex items-center gap-3",children:e.jsx(B,{name:"drone-images",label:`Drone Images (${T} images)`,value:S,onChange:t=>z(t),disabled:s})})]}),e.jsxs("div",{className:l.ratingWarningButtons,children:[e.jsx(b,{name:"confirm-export",onClick:N,disabled:s,children:s?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{className:"text-white"}),"Exporting..."]}):"Export Selected"}),e.jsx(b,{name:"cancel-export",variant:"tertiary",onClick:p,disabled:s,children:"Cancel"})]})]})]})}):null}export{fe as E,_e as F};