import{ow as e,a3 as t,w as n}from"./c6eedc03a-CsEFTfjy.js";import{r as s}from"./vendor-react-Dp9pL_Wn.js";import{u as r}from"./vendor-intl-D2wGIp4M.js";const o=["email","email address","email_address","e-mail"],i=["role"],a=["seat_tier","seat tier","seat","tier"];function c(e){const t=[];let n="",s=!1;for(let r=0;r<e.length;r++){const o=e[r];'"'===o?s&&'"'===e[r+1]?(n+='"',r++):s=!s:","!==o||s?n+=o:(t.push(n),n="")}return t.push(n),t.map(e=>e.trim())}function l(e,t){return e.findIndex(e=>t.includes(e))}function p({source:p,onParsed:d}){const m=r(),{addError:g}=t(),{track:u}=n(),f=s.useRef(null),x=s.useRef(!0),h=s.useRef(d);s.useEffect(()=>{h.current=d},[d]),s.useEffect(()=>(x.current=!0,()=>{x.current=!1}),[]);const b=s.useCallback(async t=>{if(!/\.csv$/i.test(t.name)&&"text/csv"!==t.type)return void g(m.formatMessage({defaultMessage:"Please choose a .csv file.",id:"fiUP5zDImT"}));const n=await t.text();if(!x.current)return;const{rows:s,skipped:r}=function(t){const n=t.replace(/^\ufeff/,"").split(/\r\n|\r|\n/).filter(e=>e.trim().length>0);if(0===n.length)return{emails:[],rows:[],skipped:[]};const s=c(n[0]).map(e=>e.toLowerCase()),r=l(s,o),p=-1!==r,d=p?r:0,m=p?l(s,i):-1,g=p?l(s,a):-1,u=p?n.slice(1):n,f=[],x=[],h=new Set;return u.forEach((t,n)=>{const s=n+(p?2:1),r=c(t),o=r[d]??"";if(0===o.length)return void x.push({row:s,value:o,reason:"empty"});const i=o.toLowerCase();if(!e(o))return void x.push({row:s,value:o,reason:"invalid_email"});if(h.has(i))return void x.push({row:s,value:o,reason:"duplicate_in_file"});h.add(i);const a=-1!==m&&r[m]||void 0,l=-1!==g&&r[g]||void 0;f.push({email:o,role:a,seatTier:l})}),{emails:f.map(e=>e.email),rows:f,skipped:x}}(n);if(0===s.length)return g(m.formatMessage({defaultMessage:"No valid email addresses were found in that CSV file.",id:"M/hk1LFpsi"})),void u({event_key:"claudeai.csv_invite.file_uploaded",source:p,email_count:0,skipped_count:r.length});const d=s.length>500,f=d?s.slice(0,500):s;d&&g(m.formatMessage({defaultMessage:"Only the first {max} rows were imported.",id:"AB2EVdRKmB"},{max:500})),u({event_key:"claudeai.csv_invite.file_uploaded",source:p,email_count:f.length,skipped_count:r.length,capped:d,has_role_column:f.some(e=>void 0!==e.role),has_seat_tier_column:f.some(e=>void 0!==e.seatTier)}),h.current({rows:f,emails:f.map(e=>e.email),fileName:t.name})},[g,m,p,u]),v=s.useCallback(e=>{const t=e.dataTransfer?.files?.[0];t&&b(t)},[b]),w=s.useCallback(e=>{const t=e.target.files?.[0];t&&b(t),e.target.value=""},[b]),k=s.useCallback(()=>{f.current?.click()},[]);return{fileInputRef:f,openFilePicker:k,handleDrop:v,handleInputChange:w}}
/*!-----------------------------------------------------------------------------
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
 * Released under the MIT license
 * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
 *-----------------------------------------------------------------------------*/const d=Object.freeze(Object.defineProperty({__proto__:null,conf:{comments:{lineComment:"//",blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:"'",close:"'",notIn:["string","comment"]},{open:'"',close:'"',notIn:["string"]},{open:"`",close:"`",notIn:["string","comment"]},{open:"/**",close:" */",notIn:["string"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:"<",close:">"},{open:"'",close:"'"},{open:"(",close:")"},{open:'"',close:'"'},{open:"`",close:"`"}],folding:{markers:{start:/^\s*\s*#?region\b/,end:/^\s*\s*#?endregion\b/}}},language:{defaultToken:"invalid",tokenPostfix:".dart",keywords:["abstract","dynamic","implements","show","as","else","import","static","assert","enum","in","super","async","export","interface","switch","await","extends","is","sync","break","external","library","this","case","factory","mixin","throw","catch","false","new","true","class","final","null","try","const","finally","on","typedef","continue","for","operator","var","covariant","Function","part","void","default","get","rethrow","while","deferred","hide","return","with","do","if","set","yield"],typeKeywords:["int","double","String","bool"],operators:["+","-","*","/","~/","%","++","--","==","!=",">","<",">=","<=","=","-=","/=","%=",">>=","^=","+=","*=","~/=","<<=","&=","!=","||","&&","&","|","^","~","<<",">>","!",">>>","??","?",":","|="],symbols:/[=><!~?:&|+\-*\/\^%]+/,escapes:/\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,digits:/\d+(_+\d+)*/,octaldigits:/[0-7]+(_+[0-7]+)*/,binarydigits:/[0-1]+(_+[0-1]+)*/,hexdigits:/[[0-9a-fA-F]+(_+[0-9a-fA-F]+)*/,regexpctl:/[(){}\[\]\$\^|\-*+?\.]/,regexpesc:/\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/,tokenizer:{root:[[/[{}]/,"delimiter.bracket"],{include:"common"}],common:[[/[a-z_$][\w$]*/,{cases:{"@typeKeywords":"type.identifier","@keywords":"keyword","@default":"identifier"}}],[/[A-Z_$][\w\$]*/,"type.identifier"],{include:"@whitespace"},[/\/(?=([^\\\/]|\\.)+\/([gimsuy]*)(\s*)(\.|;|,|\)|\]|\}|$))/,{token:"regexp",bracket:"@open",next:"@regexp"}],[/@[a-zA-Z]+/,"annotation"],[/[()\[\]]/,"@brackets"],[/[<>](?!@symbols)/,"@brackets"],[/!(?=([^=]|$))/,"delimiter"],[/@symbols/,{cases:{"@operators":"delimiter","@default":""}}],[/(@digits)[eE]([\-+]?(@digits))?/,"number.float"],[/(@digits)\.(@digits)([eE][\-+]?(@digits))?/,"number.float"],[/0[xX](@hexdigits)n?/,"number.hex"],[/0[oO]?(@octaldigits)n?/,"number.octal"],[/0[bB](@binarydigits)n?/,"number.binary"],[/(@digits)n?/,"number"],[/[;,.]/,"delimiter"],[/"([^"\\]|\\.)*$/,"string.invalid"],[/'([^'\\]|\\.)*$/,"string.invalid"],[/"/,"string","@string_double"],[/'/,"string","@string_single"]],whitespace:[[/[ \t\r\n]+/,""],[/\/\*\*(?!\/)/,"comment.doc","@jsdoc"],[/\/\*/,"comment","@comment"],[/\/\/\/.*$/,"comment.doc"],[/\/\/.*$/,"comment"]],comment:[[/[^\/*]+/,"comment"],[/\*\//,"comment","@pop"],[/[\/*]/,"comment"]],jsdoc:[[/[^\/*]+/,"comment.doc"],[/\*\//,"comment.doc","@pop"],[/[\/*]/,"comment.doc"]],regexp:[[/(\{)(\d+(?:,\d*)?)(\})/,["regexp.escape.control","regexp.escape.control","regexp.escape.control"]],[/(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,["regexp.escape.control",{token:"regexp.escape.control",next:"@regexrange"}]],[/(\()(\?:|\?=|\?!)/,["regexp.escape.control","regexp.escape.control"]],[/[()]/,"regexp.escape.control"],[/@regexpctl/,"regexp.escape.control"],[/[^\\\/]/,"regexp"],[/@regexpesc/,"regexp.escape"],[/\\\./,"regexp.invalid"],[/(\/)([gimsuy]*)/,[{token:"regexp",bracket:"@close",next:"@pop"},"keyword.other"]]],regexrange:[[/-/,"regexp.escape.control"],[/\^/,"regexp.invalid"],[/@regexpesc/,"regexp.escape"],[/[^\]]/,"regexp"],[/\]/,{token:"regexp.escape.control",next:"@pop",bracket:"@close"}]],string_double:[[/[^\\"\$]+/,"string"],[/[^\\"]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/"/,"string","@pop"],[/\$\w+/,"identifier"]],string_single:[[/[^\\'\$]+/,"string"],[/@escapes/,"string.escape"],[/\\./,"string.escape.invalid"],[/'/,"string","@pop"],[/\$\w+/,"identifier"]]}}},Symbol.toStringTag,{value:"Module"}));export{d,p as u};
