@aiquants/contact-map 0.3.0 → 0.4.0

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.
package/dist/client.mjs CHANGED
@@ -1,2 +1,2 @@
1
- var Fr=Object.defineProperty;var Qe=(e,t)=>()=>(e&&(t=e(e=0)),t);var zr=(e,t)=>{for(var a in t)Fr(e,a,{get:t[a],enumerable:!0})};import{DIRECTORY_TREE_LABEL_CATALOGS as Mn,DIRECTORY_TREE_LABEL_KEYS as za,resolveDirectoryTreeLabels as Br}from"@aiquants/directory-tree";import{resolveVirtualScrollLocale as Ur,VIRTUAL_SCROLL_LABEL_KEYS as $r}from"@aiquants/virtualscroll";var Vr,G,lt,la,En,Wt,Tt,Fa,Kr,jr,Ba,Ua,$a,dt=Qe(()=>{"use strict";Vr=Object.freeze({en:"en-US",ja:"ja-JP"}),G=(e,t)=>t.toLocaleString(Vr[e]),lt=(e,t,a)=>e==="1"?t:a,la=Object.freeze({en:Object.freeze({appTitle:"Contact Map",annotationTotalLabel:"Total:",annotationCompaniesLabel:"Companies:",annotationStreamingProgress:({loaded:e,total:t,percent:a})=>`Streaming (${G("en",e)} / ${G("en",t)} \xB7 ${a}%)`,annotationStreamingCount:e=>`Streaming (${G("en",e)} loaded)`,annotationLoadFailed:e=>`Failed to load (${G("en",e)} received)`,annotationRetry:"Retry",recordUnit:e=>lt(e,"record","records"),companyUnit:e=>lt(e,"company","companies"),searchTab:"Fuzzy search",searchSettings:"Search settings",searchStatistics:"Search statistics",operatorAndTitle:"AND search (all terms match)",operatorOrTitle:"OR search (any term matches)",operatorAnd:"AND",operatorOr:"OR",operatorAndHint:"All terms",operatorOrHint:"Any term",searchPlaceholder:"Fuzzy search...",searchBusyTitle:"Searching",clearSearch:"Clear search",searching:"Searching...",registeredCountLabel:"Registered:",rebuildingIndex:"Rebuilding index...",errorLabel:"Error:",resultCountLabel:"Results:",resultUnit:e=>lt(e,"match","matches"),listViewTab:"List",treeViewTab:"Tree",columnNo:"No",columnId:"ID",columnScore:"Score",columnName:"Name",columnTitle:"Title",columnCompany:"Company",columnDepartment:"Department",columnPhone:"Phone",columnEmail:"Email",columnUpdatedAt:"Updated",listRowNumber:e=>`No. ${e}`,listNoSearchResults:"No search results found",listNoData:"No data",listResizeHandle:"Resize the border between the contact list and the detail pane",detailHeading:"Contact details",close:"Close",noName:"(No Name)",treeNodeCountTitle:"Number of nodes built in the tree view",treeNodeCountLabel:"Nodes:",treeNodeCount:e=>G("en",e),uncategorizedCompany:"Uncategorized",treeDirectoryName:(e,t)=>`${e} (${G("en",t)})`,treeStreamInterruptedTitle:"Streaming was interrupted. Only the data received so far is shown",treeStreamInterrupted:"Interrupted",treeStreamLoadingTitle:"Receiving data streamed from the network",treeStreamLoading:"Loading...",treeBuildingTitle:"Building and expanding the directory tree from the received data",treeBuilding:"Treeing...",treeCompleteTitle:"Every tree node has been built",treeComplete:"Complete",treeShowEntireCompanyTitle:"Show the whole company of every search hit",treeShowEntireCompany:"Whole company",treeExpandAll:"Expand all directories",treeExpandAllTitle:"Expand all",treeCollapseAll:"Collapse all directories",treeCollapseAllTitle:"Collapse all",treeNoMatches:"No contacts match the criteria",treeEmpty:"No contacts to display",treeResizeHandle:"Resize the border between the directory tree and the detail pane",copyField:e=>`Copy ${e}`,detailEmptyTitle:"Select a contact to see its details",detailEmptyHint:"Choose a person from the list",detailTabSummary:"Summary",detailTabBasic:"Basic info",detailBasicProfile:"Profile",detailTabContact:"Contact",detailTabMeta:"Metadata",preferred:"Preferred",summaryEmail:"Email",summaryPhone:"Phone",summaryLastContact:"Last contact",sectionEmail:"Email",sectionEmailEmpty:"No email addresses registered",sectionPhone:"Phone / Fax",sectionPhoneEmpty:"No phone numbers registered",fieldFullName:"Name",fieldFullNameReading:"Name (reading)",fieldTitle:"Title",fieldDepartment:"Department",fieldCompanyName:"Company",fieldCompanyNameReading:"Company (reading)",fieldAddress:"Address",fieldPostalCode:"Postal code",fieldUrl:"URL",fieldCustomEmail:"Custom email",fieldEmail:"Email",fieldCustomMobilePhone:"Custom mobile",fieldMobilePhone:"Mobile",fieldCompanyPhone:"Company phone",fieldCompanyFax:"Company fax",fieldCreatedBy:"Created by",fieldCreatedAt:"Created at",fieldUpdatedBy:"Updated by",fieldUpdatedAt:"Updated at",popupCustomMobilePhone:"Mobile (custom)",popupMobilePhone:"Mobile",popupCustomCompanyPhone:"Company phone (custom)",popupCompanyPhone:"Company phone",popupCustomEmail:"Email (custom)",popupEmail:"Email",popupGmailHint:"Double-click or double-tap to open Gmail",popupLastContactDate:"Last contact:",popupNoContactMethods:"No contact information to display",overlayTitle:"Details",overlayBackdrop:"Tap the background to close",settingsResetAllTitle:"Reset all settings",settingsResetAll:"Reset all",settingsTabsLabel:"Search option tabs",settingsBasicTab:"Basic settings",settingsAdvancedTab:"Advanced settings",indexWorkerName:"Index Worker",levenshteinWorkerName:"Levenshtein Worker",currentValueLabel:"Current:",resetToDefaultsTitle:"Reset to defaults",reset:"Reset",relevanceOnlyNotice:"Editable only when sorting by relevance",relevanceWeightsHeading:"Relevance score weights",fieldWeight:"Field weight",scoreTuningHeading:"Score tuning",maxResults:"Maximum results",basicThresholdHeading:"Final similarity threshold",basicThresholdLabel:"Adjust the minimum score",basicThresholdRangeRelevance:"In relevance mode a score can exceed 1.0 (range: 0.0-1.5)",basicThresholdRange:"Range: 0.0-1.0",basicDisplayHeading:"Display options",basicCaseSensitive:"Case-sensitive",basicHighlight:"Highlight matches",basicOpenEmailsWithGmail:"Open email addresses in Gmail compose",basicMultiTermOperator:"Multi-term query operator",basicOperatorOr:"OR (any term matches)",basicOperatorAnd:"AND (all terms match)",basicMultiTermHint:"How space-separated terms are combined (default: OR)",basicSortHeading:"Sorting",basicSortBy:"Sort by",basicSortByScore:"Score",basicSortByRelevance:"Relevance",basicSortByOriginal:"Original order",basicSortOrder:"Sort order",basicSortDescending:"Descending",basicSortAscending:"Ascending",basicEngineHeading:"Search engine",basicStrategy:"Parallel search strategy",basicStrategyBalanced:"Balanced",basicStrategyIndexFirst:"Index first",basicStrategyLevenshteinFirst:"Levenshtein first",basicIndexFiltering:"Index filtering",basicLevenshtein:"Levenshtein distance",advancedLearningHeading:"Learning weight",advancedLearningLabel:"Weight factor",advancedLearningHint:"Weight applied when re-learning (higher favors past search results)",advancedDebounceHeading:"Debounce time",advancedDebounceLabel:"Input delay (ms)",advancedDebounceHint:"How long input is awaited. Shorter is more real-time, longer reduces load",indexSettingsHeading:"Index Worker settings",indexBuildHeading:"Index build",indexNgramSize:"N-gram size",indexNgramSizeHint:"How many characters each chunk holds. Smaller is faster but less accurate",indexMinNgramOverlap:"Minimum N-gram matches",indexMinNgramOverlapHint:"Candidates with fewer matches are excluded",indexCandidateHeading:"Candidate filtering",indexThreshold:"Index threshold",indexThresholdHint:"Lower bound of the Jaro-Winkler similarity (range: 0.0-1.0)",indexNgramOverlapThreshold:"N-gram overlap threshold",indexNgramOverlapThresholdHint:"How much N-grams must overlap. Higher narrows candidates more strictly",indexStrategyHeading:"Search strategy and candidates",indexStrategy:"Search strategy",indexStrategyFast:"Fast",indexStrategyAccurate:"Accurate",indexStrategyHybrid:"Hybrid (adaptive)",indexStrategyHint:"Balance processing load against accuracy",indexMinCandidatesRatio:"Minimum candidate ratio",indexMinCandidatesRatioHint:"Share of candidates always kept",indexMaxCandidatesRatio:"Maximum candidate ratio",indexMaxCandidatesRatioHint:"Upper bound on candidates; narrowed dynamically when exceeded",indexJaroWinklerPrefix:"Jaro-Winkler prefix weight",indexJaroWinklerPrefixHint:"Bonus given to a matching prefix",indexMaxResultsHint:"Maximum number of results to fetch. Larger is more thorough but slower",indexFieldWeightHint:"How much the number of matched fields counts",indexPerfectMatchBonus:"Exact match bonus",indexPerfectMatchBonusHint:"Bonus added on an exact match",indexContainmentHeading:"Containment score (Japanese / substrings)",indexContainmentBase:"Containment base score (containmentScoreBase)",indexContainmentBaseHint:"Minimum base score when the query is fully contained in the string (rescues short Japanese queries such as 2 characters)",indexContainmentCoverage:"Containment coverage weight (containmentCoverageWeight)",indexContainmentCoverageHint:"Extra score by the query length / field length ratio (total capped at 1.0)",levenshteinSettingsHeading:"Levenshtein Worker settings",levenshteinCandidateHeading:"Candidate filter",levenshteinThreshold:"Levenshtein threshold",levenshteinThresholdHintRelevance:"Keep only results at or above this threshold (range: 0.0-1.5)",levenshteinThresholdHint:"Keep only results at or above this threshold (range: 0.0-1.0)",levenshteinLengthSimilarity:"Length similarity threshold",levenshteinLengthSimilarityHint:"Exclude candidates whose length differs greatly, for speed",levenshteinLengthPenalty:"Length difference penalty",levenshteinLengthPenaltyHint:"How much a length difference is penalized. Larger favors equal lengths",levenshteinResultsHeading:"Result count",levenshteinMaxResultsHint:"Maximum number of results to return. Larger is more thorough but slower",levenshteinFieldWeightHint:"Weight of the number of matched fields",levenshteinPartialBonus:"Partial match bonus",levenshteinPartialBonusHint:"Extra score for a partial match",statsRebuildingTitle:"Rebuilding the index",statsRebuildIndexTabOnlyTitle:"Available on the Index tab only",statsRebuildTitle:"Rebuild the index",statsRebuilding:"Rebuilding...",statsRebuild:"Rebuild Index",statsResetTitle:"Reset statistics",statsOverviewTab:"Overview",statsIndexTab:"Index",statsLevenshteinTab:"Levenshtein",statTotalSearches:"Total searches",statAverageSearchTime:"Average search time",statDataCount:"Data items",statResultCount:"Search results",statDisplayedCount:"Displayed items",statsNoData:"No statistics yet",statsBasicHeading:"Basic statistics",statTotalProcessingTime:"Total processing time",statLastSearchTime:"Last search time",statErrorCount:"Errors",statUpdatedAt:"Statistics updated at",statsOperationsHeading:"Operations",statTotalOperations:"Total operations",statsIndexHeading:"Index statistics",statIndexBuilds:"Index builds",statDataSize:"Data size",statLastBuildTime:"Last build time",statsCacheHeading:"Cache statistics",statCacheNgram:"N-gram",statCacheWord:"Words",statCachePhonetic:"Phonetic",statsIndexMetadataHeading:"Index metadata",statsCalculationsHeading:"Calculations",statTotalCalculations:"Total calculations",statDistanceCalculations:"Distance calculations",statAverageDistance:"Average distance",statMinDistance:"Minimum distance",statMaxDistance:"Maximum distance",notAvailable:"N/A",statsMatchesHeading:"Matches",statPartialMatches:"Partial matches",statPerfectMatches:"Exact matches",statEarlyTerminations:"Early terminations",statsSimilarityHeading:"Similarity distribution",statAbove80:"80% or more",statAbove60:"60% or more",statAbove40:"40% or more",statBelow40:"Below 40%",statsDistanceHeading:"Distance distribution (top 6)",statDistance:e=>`Distance ${e}`,statsQueryLengthHeading:"Query lengths (top 6)",statQueryLength:e=>`Length ${e}`,statQueryLengthValue:({count:e,averagePercent:t})=>{let a=G("en",e);return`${a} ${lt(a,"time","times")} / average ${t}%`},statsFieldPerformanceHeading:"Field performance (top 6)",statAverageScore:"Average score",statMatchCount:"Matches",statBestWorstScore:"Best / worst score",statsInsightsHeading:"Performance insights",statBestField:"Best-performing field",statRecentAverageTime:"Recent average processing time",statRecentAverageResults:"Recent average results",statThroughput:"Throughput",statCommonQueryLength:"Most common query length",statHistoryEntries:"History entries",statHighSimilarity:"High similarity",statMediumSimilarity:"Medium similarity",statLowSimilarity:"Low similarity",statVeryLowSimilarity:"Very low similarity",statsRecentHistoryHeading:"Recent history (latest 3)",statsHistoryEntry:({processingTimeMs:e,resultCount:t})=>`Processing time: ${e} ms / results: ${G("en",t)}`,timesUnit:e=>lt(e," time"," times"),itemsUnit:e=>lt(e," item"," items"),charactersUnit:e=>lt(e," character"," characters"),throughputUnit:" ops/s"}),ja:Object.freeze({appTitle:"Contact Map",annotationTotalLabel:"\u7DCF\u4EF6\u6570:",annotationCompaniesLabel:"\u4F01\u696D\u6570:",annotationStreamingProgress:({loaded:e,total:t,percent:a})=>`\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u8AAD\u307F\u8FBC\u307F\u4E2D (${G("ja",e)} / ${G("ja",t)} \u4EF6\u30FB${a}%)`,annotationStreamingCount:e=>`\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u8AAD\u307F\u8FBC\u307F\u4E2D (${G("ja",e)} \u4EF6)`,annotationLoadFailed:e=>`\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F (${G("ja",e)} \u4EF6\u53D7\u4FE1\u6E08)`,annotationRetry:"\u518D\u8A66\u884C",recordUnit:()=>"\u4EF6",companyUnit:()=>"\u793E",searchTab:"\u3042\u3044\u307E\u3044\u691C\u7D22",searchSettings:"\u691C\u7D22\u8A2D\u5B9A",searchStatistics:"\u691C\u7D22\u7D71\u8A08",operatorAndTitle:"AND \u691C\u7D22 (\u3059\u3079\u3066\u4E00\u81F4)",operatorOrTitle:"OR \u691C\u7D22 (\u3044\u305A\u308C\u304B\u4E00\u81F4)",operatorAnd:"AND",operatorOr:"OR",operatorAndHint:"\u5168\u8A9E\u4E00\u81F4",operatorOrHint:"\u3044\u305A\u308C\u304B\u4E00\u81F4",searchPlaceholder:"\u3042\u3044\u307E\u3044\u691C\u7D22...",searchBusyTitle:"\u691C\u7D22\u51E6\u7406\u4E2D",clearSearch:"\u691C\u7D22\u3092\u30AF\u30EA\u30A2",searching:"\u691C\u7D22\u4E2D...",registeredCountLabel:"\u767B\u9332\u4EF6\u6570:",rebuildingIndex:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u518D\u69CB\u7BC9\u4E2D...",errorLabel:"\u30A8\u30E9\u30FC:",resultCountLabel:"\u691C\u7D22\u7D50\u679C:",resultUnit:()=>"\u4EF6",listViewTab:"\u4E00\u89A7",treeViewTab:"\u30C4\u30EA\u30FC",columnNo:"No",columnId:"ID",columnScore:"\u30B9\u30B3\u30A2",columnName:"\u6C0F\u540D",columnTitle:"\u5F79\u8077",columnCompany:"\u4F1A\u793E\u540D",columnDepartment:"\u90E8\u7F72",columnPhone:"\u96FB\u8A71\u756A\u53F7",columnEmail:"\u30E1\u30FC\u30EB",columnUpdatedAt:"\u66F4\u65B0\u65E5\u6642",listRowNumber:e=>`No. ${e}`,listNoSearchResults:"\u691C\u7D22\u7D50\u679C\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",listNoData:"\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093",listResizeHandle:"\u9023\u7D61\u5148\u4E00\u89A7\u3068\u8A73\u7D30\u30DA\u30A4\u30F3\u306E\u5883\u754C\u306E\u30B5\u30A4\u30BA\u5909\u66F4\u30CF\u30F3\u30C9\u30EB",detailHeading:"\u9023\u7D61\u5148\u8A73\u7D30",close:"\u9589\u3058\u308B",noName:"\u540D\u524D\u672A\u8A2D\u5B9A",treeNodeCountTitle:"\u30C4\u30EA\u30FC\u30D3\u30E5\u30FC\u3067\u69CB\u7BC9\u3055\u308C\u305F\u5168\u30CE\u30FC\u30C9\u6570",treeNodeCountLabel:"\u30CE\u30FC\u30C9:",treeNodeCount:e=>`${G("ja",e)} \u500B`,uncategorizedCompany:"\u672A\u5206\u985E",treeDirectoryName:(e,t)=>`${e} (${G("ja",t)})`,treeStreamInterruptedTitle:"\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u304C\u4E2D\u65AD\u3055\u308C\u307E\u3057\u305F\u3002\u53D7\u4FE1\u6E08\u307F\u30C7\u30FC\u30BF\u306E\u307F\u8868\u793A\u3057\u3066\u3044\u307E\u3059",treeStreamInterrupted:"\u4E2D\u65AD",treeStreamLoadingTitle:"\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u304B\u3089\u306E\u30C7\u30FC\u30BF\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u3092\u53D7\u4FE1\u4E2D",treeStreamLoading:"\u8AAD\u307F\u8FBC\u307F\u4E2D...",treeBuildingTitle:"\u53D7\u53D6\u30C7\u30FC\u30BF\u3092\u57FA\u306B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u30C4\u30EA\u30FC\u69CB\u9020\u3092\u6700\u7D42\u69CB\u7BC9\u30FB\u5C55\u958B\u4E2D",treeBuilding:"\u30C4\u30EA\u30FC\u69CB\u7BC9\u4E2D...",treeCompleteTitle:"\u30C4\u30EA\u30FC\u30CE\u30FC\u30C9\u306E\u5168\u4EF6\u69CB\u7BC9\u304C\u5B8C\u4E86\u3057\u307E\u3057\u305F",treeComplete:"\u5B8C\u4E86",treeShowEntireCompanyTitle:"\u691C\u7D22\u30D2\u30C3\u30C8\u3057\u305F\u4F1A\u793E\u5168\u4F53\u3092\u8868\u793A",treeShowEntireCompany:"\u5168\u4F53\u8868\u793A",treeExpandAll:"\u5168\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u5C55\u958B",treeExpandAllTitle:"\u3059\u3079\u3066\u5C55\u958B",treeCollapseAll:"\u5168\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u6298\u308A\u305F\u305F\u307F",treeCollapseAllTitle:"\u3059\u3079\u3066\u6298\u308A\u305F\u305F\u307F",treeNoMatches:"\u6761\u4EF6\u306B\u4E00\u81F4\u3059\u308B\u9023\u7D61\u5148\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",treeEmpty:"\u8868\u793A\u3059\u308B\u9023\u7D61\u5148\u304C\u3042\u308A\u307E\u305B\u3093",treeResizeHandle:"\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u30C4\u30EA\u30FC\u3068\u8A73\u7D30\u30DA\u30A4\u30F3\u306E\u5883\u754C\u306E\u30B5\u30A4\u30BA\u5909\u66F4\u30CF\u30F3\u30C9\u30EB",copyField:e=>`\u300C${e}\u300D\u3092\u30B3\u30D4\u30FC`,detailEmptyTitle:"\u9023\u7D61\u5148\u3092\u9078\u629E\u3059\u308B\u3068\u8A73\u7D30\u304C\u8868\u793A\u3055\u308C\u307E\u3059",detailEmptyHint:"\u4E00\u89A7\u304B\u3089\u5BFE\u8C61\u306E\u4EBA\u7269\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",detailTabSummary:"\u30B5\u30DE\u30EA\u30FC",detailTabBasic:"\u57FA\u672C\u60C5\u5831",detailBasicProfile:"\u57FA\u672C\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB",detailTabContact:"\u9023\u7D61\u5148",detailTabMeta:"\u30E1\u30BF\u60C5\u5831",preferred:"\u512A\u5148",summaryEmail:"\u30E1\u30FC\u30EB",summaryPhone:"\u96FB\u8A71",summaryLastContact:"\u6700\u7D42\u63A5\u89E6",sectionEmail:"\u30E1\u30FC\u30EB",sectionEmailEmpty:"\u767B\u9332\u3055\u308C\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u306F\u3042\u308A\u307E\u305B\u3093",sectionPhone:"\u96FB\u8A71\u30FBFAX",sectionPhoneEmpty:"\u767B\u9332\u3055\u308C\u305F\u96FB\u8A71\u756A\u53F7\u306F\u3042\u308A\u307E\u305B\u3093",fieldFullName:"\u6C0F\u540D",fieldFullNameReading:"\u6C0F\u540D (\u304B\u306A)",fieldTitle:"\u5F79\u8077",fieldDepartment:"\u90E8\u7F72",fieldCompanyName:"\u4F1A\u793E\u540D",fieldCompanyNameReading:"\u4F1A\u793E\u540D (\u304B\u306A)",fieldAddress:"\u4F4F\u6240",fieldPostalCode:"\u90F5\u4FBF\u756A\u53F7",fieldUrl:"URL",fieldCustomEmail:"\u30AB\u30B9\u30BF\u30E0\u30E1\u30FC\u30EB",fieldEmail:"\u30E1\u30FC\u30EB",fieldCustomMobilePhone:"\u30AB\u30B9\u30BF\u30E0\u643A\u5E2F\u756A\u53F7",fieldMobilePhone:"\u643A\u5E2F\u756A\u53F7",fieldCompanyPhone:"\u4F1A\u793E\u96FB\u8A71\u756A\u53F7",fieldCompanyFax:"\u4F1A\u793E FAX \u756A\u53F7",fieldCreatedBy:"\u4F5C\u6210\u8005",fieldCreatedAt:"\u4F5C\u6210\u65E5\u6642",fieldUpdatedBy:"\u66F4\u65B0\u8005",fieldUpdatedAt:"\u66F4\u65B0\u65E5\u6642",popupCustomMobilePhone:"\u643A\u5E2F\u96FB\u8A71 (\u30AB\u30B9\u30BF\u30E0)",popupMobilePhone:"\u643A\u5E2F\u96FB\u8A71",popupCustomCompanyPhone:"\u4F1A\u793E\u96FB\u8A71 (\u30AB\u30B9\u30BF\u30E0)",popupCompanyPhone:"\u4F1A\u793E\u96FB\u8A71",popupCustomEmail:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9 (\u30AB\u30B9\u30BF\u30E0)",popupEmail:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",popupGmailHint:"\u30C0\u30D6\u30EB\u30AF\u30EA\u30C3\u30AF\u307E\u305F\u306F\u4E8C\u5EA6\u30BF\u30C3\u30D7\u3067 Gmail \u3092\u958B\u304D\u307E\u3059",popupLastContactDate:"\u6700\u7D42\u30B3\u30F3\u30BF\u30AF\u30C8\u65E5:",popupNoContactMethods:"\u8868\u793A\u3067\u304D\u308B\u9023\u7D61\u5148\u60C5\u5831\u304C\u3042\u308A\u307E\u305B\u3093",overlayTitle:"\u8A73\u7D30",overlayBackdrop:"\u80CC\u666F\u3092\u30BF\u30C3\u30D7\u3057\u3066\u9589\u3058\u308B",settingsResetAllTitle:"\u3059\u3079\u3066\u306E\u8A2D\u5B9A\u3092\u30EA\u30BB\u30C3\u30C8",settingsResetAll:"\u3059\u3079\u3066\u30EA\u30BB\u30C3\u30C8",settingsTabsLabel:"\u691C\u7D22\u30AA\u30D7\u30B7\u30E7\u30F3\u8A2D\u5B9A\u30BF\u30D6",settingsBasicTab:"\u57FA\u672C\u8A2D\u5B9A",settingsAdvancedTab:"\u8A73\u7D30\u8A2D\u5B9A",indexWorkerName:"Index Worker",levenshteinWorkerName:"Levenshtein Worker",currentValueLabel:"\u73FE\u5728\u5024:",resetToDefaultsTitle:"\u30C7\u30D5\u30A9\u30EB\u30C8\u5024\u306B\u30EA\u30BB\u30C3\u30C8",reset:"\u30EA\u30BB\u30C3\u30C8",relevanceOnlyNotice:"Relevance \u30BD\u30FC\u30C8\u6642\u306E\u307F\u5909\u66F4\u53EF\u80FD",relevanceWeightsHeading:"Relevance \u30B9\u30B3\u30A2\u91CD\u307F",fieldWeight:"\u30D5\u30A3\u30FC\u30EB\u30C9\u91CD\u307F",scoreTuningHeading:"\u30B9\u30B3\u30A2\u8ABF\u6574",maxResults:"\u6700\u5927\u7D50\u679C\u6570",basicThresholdHeading:"\u6700\u7D42\u985E\u4F3C\u5EA6\u95BE\u5024",basicThresholdLabel:"\u30B9\u30B3\u30A2\u306E\u4E0B\u9650\u3092\u8ABF\u6574",basicThresholdRangeRelevance:"Relevance \u30E2\u30FC\u30C9\u3067\u306F\u30B9\u30B3\u30A2\u304C 1.0 \u3092\u8D85\u3048\u308B\u5834\u5408\u304C\u3042\u308A\u307E\u3059 (\u7BC4\u56F2: 0.0-1.5)",basicThresholdRange:"\u7BC4\u56F2: 0.0-1.0",basicDisplayHeading:"\u8868\u793A\u30AA\u30D7\u30B7\u30E7\u30F3",basicCaseSensitive:"\u5927\u6587\u5B57\u5C0F\u6587\u5B57\u3092\u533A\u5225",basicHighlight:"\u30CF\u30A4\u30E9\u30A4\u30C8\u8868\u793A",basicOpenEmailsWithGmail:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092 Gmail \u306E\u4F5C\u6210\u753B\u9762\u3067\u958B\u304F",basicMultiTermOperator:"\u8907\u6570\u8A9E\u30AF\u30A8\u30EA\u306E\u6F14\u7B97\u5B50",basicOperatorOr:"OR (\u3044\u305A\u308C\u304B\u4E00\u81F4)",basicOperatorAnd:"AND (\u3059\u3079\u3066\u4E00\u81F4)",basicMultiTermHint:"\u8907\u6570\u8A9E\u3092\u30B9\u30DA\u30FC\u30B9\u3067\u5165\u529B\u3057\u305F\u3068\u304D\u306E\u7D50\u5408\u65B9\u6CD5 (\u65E2\u5B9A\u306F OR)",basicSortHeading:"\u30BD\u30FC\u30C8\u8A2D\u5B9A",basicSortBy:"\u30BD\u30FC\u30C8\u57FA\u6E96",basicSortByScore:"\u30B9\u30B3\u30A2",basicSortByRelevance:"\u95A2\u9023\u6027",basicSortByOriginal:"\u5143\u306E\u9806\u5E8F",basicSortOrder:"\u30BD\u30FC\u30C8\u9806\u5E8F",basicSortDescending:"\u964D\u9806",basicSortAscending:"\u6607\u9806",basicEngineHeading:"\u691C\u7D22\u30A8\u30F3\u30B8\u30F3\u8A2D\u5B9A",basicStrategy:"\u4E26\u5217\u691C\u7D22\u6226\u7565",basicStrategyBalanced:"\u30D0\u30E9\u30F3\u30B9",basicStrategyIndexFirst:"Index \u512A\u5148",basicStrategyLevenshteinFirst:"Levenshtein \u512A\u5148",basicIndexFiltering:"Index \u30D5\u30A3\u30EB\u30BF\u30EA\u30F3\u30B0",basicLevenshtein:"Levenshtein \u8DDD\u96E2\u8A08\u7B97",advancedLearningHeading:"\u5B66\u7FD2\u91CD\u307F",advancedLearningLabel:"\u91CD\u307F\u4FC2\u6570",advancedLearningHint:"\u518D\u5B66\u7FD2\u6642\u306E\u91CD\u307F\u4ED8\u3051 (\u5927\u304D\u3044\u307B\u3069\u904E\u53BB\u306E\u691C\u7D22\u7D50\u679C\u3092\u512A\u5148)",advancedDebounceHeading:"\u30C7\u30D0\u30A6\u30F3\u30B9\u6642\u9593",advancedDebounceLabel:"\u5165\u529B\u9045\u5EF6 (ms)",advancedDebounceHint:"\u5165\u529B\u306E\u5F85\u3061\u6642\u9593\u3002\u77ED\u3044\u307B\u3069\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u3001\u9577\u3044\u307B\u3069\u8CA0\u8377\u8EFD\u6E1B",indexSettingsHeading:"Index Worker \u8A2D\u5B9A",indexBuildHeading:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u69CB\u7BC9",indexNgramSize:"N-gram \u30B5\u30A4\u30BA",indexNgramSizeHint:"\u6587\u5B57\u5217\u3092\u4F55\u6587\u5B57\u5358\u4F4D\u3067\u5206\u5272\u3059\u308B\u304B\u3002\u5C0F\u3055\u3044\u307B\u3069\u9AD8\u901F\u3060\u304C\u7CBE\u5EA6\u4F4E\u4E0B",indexMinNgramOverlap:"\u6700\u5C0F N-gram \u4E00\u81F4\u6570",indexMinNgramOverlapHint:"\u4E00\u81F4\u6570\u304C\u3053\u306E\u5024\u3092\u4E0B\u56DE\u308B\u5019\u88DC\u306F\u9664\u5916",indexCandidateHeading:"\u5019\u88DC\u7D5E\u308A\u8FBC\u307F",indexThreshold:"Index \u95BE\u5024",indexThresholdHint:"Jaro-Winkler \u985E\u4F3C\u5EA6\u306E\u4E0B\u9650 (\u7BC4\u56F2: 0.0-1.0)",indexNgramOverlapThreshold:"N-gram \u91CD\u8907\u5EA6\u95BE\u5024",indexNgramOverlapThresholdHint:"N-gram \u306E\u91CD\u306A\u308A\u5177\u5408\u3002\u9AD8\u3044\u307B\u3069\u53B3\u5BC6\u306B\u5019\u88DC\u3092\u7D5E\u308B",indexStrategyHeading:"\u691C\u7D22\u6226\u7565\u3068\u5019\u88DC\u6570",indexStrategy:"\u691C\u7D22\u6226\u7565",indexStrategyFast:"Fast (\u9AD8\u901F)",indexStrategyAccurate:"Accurate (\u6B63\u78BA)",indexStrategyHybrid:"Hybrid (\u52D5\u7684)",indexStrategyHint:"\u51E6\u7406\u8CA0\u8377\u3068\u7CBE\u5EA6\u306E\u30D0\u30E9\u30F3\u30B9\u3092\u9078\u629E",indexMinCandidatesRatio:"\u6700\u5C0F\u5019\u88DC\u6BD4\u7387",indexMinCandidatesRatioHint:"\u6700\u4F4E\u9650\u78BA\u4FDD\u3059\u308B\u5019\u88DC\u5272\u5408",indexMaxCandidatesRatio:"\u6700\u5927\u5019\u88DC\u6BD4\u7387",indexMaxCandidatesRatioHint:"\u5019\u88DC\u6570\u306E\u4E0A\u9650\u3002\u8D85\u3048\u308B\u3068\u52D5\u7684\u306B\u7D5E\u308A\u8FBC\u307F",indexJaroWinklerPrefix:"Jaro-Winkler \u63A5\u982D\u8F9E\u91CD\u307F",indexJaroWinklerPrefixHint:"\u5148\u982D\u4E00\u81F4\u306B\u4ED8\u4E0E\u3059\u308B\u30DC\u30FC\u30CA\u30B9\u5024",indexMaxResultsHint:"\u53D6\u5F97\u3059\u308B\u6700\u5927\u4EF6\u6570\u3002\u5927\u304D\u3044\u307B\u3069\u5305\u62EC\u7684\u3060\u304C\u9045\u5EF6\u304C\u5897\u52A0",indexFieldWeightHint:"\u30DE\u30C3\u30C1\u30D5\u30A3\u30FC\u30EB\u30C9\u6570\u306B\u3069\u308C\u3060\u3051\u91CD\u307F\u4ED8\u3051\u3059\u308B\u304B",indexPerfectMatchBonus:"\u5B8C\u5168\u4E00\u81F4\u30DC\u30FC\u30CA\u30B9",indexPerfectMatchBonusHint:"\u5B8C\u5168\u4E00\u81F4\u6642\u306B\u8FFD\u52A0\u3059\u308B\u30DC\u30FC\u30CA\u30B9\u5024",indexContainmentHeading:"\u548C\u6587\u30FB\u90E8\u5206\u6587\u5B57\u5217\u5305\u542B\u30B9\u30B3\u30A2",indexContainmentBase:"\u5305\u542B \u57FA\u790E\u30B9\u30B3\u30A2 (containmentScoreBase)",indexContainmentBaseHint:"\u30AF\u30A8\u30EA\u304C\u6587\u5B57\u5217\u4E2D\u306B\u5B8C\u5168\u306B\u542B\u307E\u308C\u308B\u5834\u5408\u306E\u6700\u4F4E\u57FA\u790E\u30B9\u30B3\u30A2 (\u548C\u6587 2 \u6587\u5B57\u7B49\u306E\u6551\u6E08)",indexContainmentCoverage:"\u5305\u542B \u88AB\u8986\u7387\u91CD\u307F (containmentCoverageWeight)",indexContainmentCoverageHint:"\u30AF\u30A8\u30EA\u9577 / \u30D5\u30A3\u30FC\u30EB\u30C9\u9577\u306E\u6BD4\u7387\u306B\u5FDC\u3058\u305F\u52A0\u7B97\u30B9\u30B3\u30A2 (\u5408\u8A08 1.0 \u4EE5\u4E0B\u306B\u5236\u9650)",levenshteinSettingsHeading:"Levenshtein Worker \u8A73\u7D30\u8A2D\u5B9A",levenshteinCandidateHeading:"\u5019\u88DC\u30D5\u30A3\u30EB\u30BF",levenshteinThreshold:"Levenshtein \u95BE\u5024",levenshteinThresholdHintRelevance:"\u3053\u306E\u95BE\u5024\u4EE5\u4E0A\u306E\u7D50\u679C\u306E\u307F\u4FDD\u6301 (\u7BC4\u56F2: 0.0-1.5)",levenshteinThresholdHint:"\u3053\u306E\u95BE\u5024\u4EE5\u4E0A\u306E\u7D50\u679C\u306E\u307F\u4FDD\u6301 (\u7BC4\u56F2: 0.0-1.0)",levenshteinLengthSimilarity:"\u9577\u3055\u985E\u4F3C\u5EA6\u95BE\u5024",levenshteinLengthSimilarityHint:"\u9577\u3055\u304C\u5927\u304D\u304F\u7570\u306A\u308B\u5019\u88DC\u3092\u4E8B\u524D\u306B\u9664\u5916\u3057\u3066\u901F\u5EA6\u5411\u4E0A",levenshteinLengthPenalty:"\u9577\u3055\u5DEE\u30DA\u30CA\u30EB\u30C6\u30A3",levenshteinLengthPenaltyHint:"\u9577\u3055\u5DEE\u3092\u3069\u308C\u3060\u3051\u6E1B\u70B9\u3059\u308B\u304B\u3002\u5927\u304D\u3044\u307B\u3069\u9577\u3055\u4E00\u81F4\u3092\u91CD\u8996",levenshteinResultsHeading:"\u7D50\u679C\u6570\u5236\u5FA1",levenshteinMaxResultsHint:"\u8FD4\u5374\u3059\u308B\u6700\u5927\u4EF6\u6570\u3002\u5927\u304D\u3044\u307B\u3069\u7DB2\u7F85\u7684\u3060\u304C\u51E6\u7406\u6642\u9593\u304C\u5897\u52A0",levenshteinFieldWeightHint:"\u4E00\u81F4\u30D5\u30A3\u30FC\u30EB\u30C9\u6570\u306E\u8A55\u4FA1\u91CD\u307F",levenshteinPartialBonus:"\u90E8\u5206\u4E00\u81F4\u30DC\u30FC\u30CA\u30B9",levenshteinPartialBonusHint:"\u90E8\u5206\u4E00\u81F4\u306B\u4ED8\u4E0E\u3059\u308B\u8FFD\u52A0\u30B9\u30B3\u30A2",statsRebuildingTitle:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u518D\u69CB\u7BC9\u4E2D",statsRebuildIndexTabOnlyTitle:"Index \u30BF\u30D6\u3067\u306E\u307F\u4F7F\u7528\u53EF\u80FD",statsRebuildTitle:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u3092\u518D\u69CB\u7BC9",statsRebuilding:"\u518D\u69CB\u7BC9\u4E2D...",statsRebuild:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u518D\u69CB\u7BC9",statsResetTitle:"\u7D71\u8A08\u3092\u30EA\u30BB\u30C3\u30C8",statsOverviewTab:"\u6982\u8981",statsIndexTab:"Index",statsLevenshteinTab:"Levenshtein",statTotalSearches:"\u7DCF\u691C\u7D22\u56DE\u6570",statAverageSearchTime:"\u5E73\u5747\u691C\u7D22\u6642\u9593",statDataCount:"\u30C7\u30FC\u30BF\u4EF6\u6570",statResultCount:"\u691C\u7D22\u7D50\u679C\u4EF6\u6570",statDisplayedCount:"\u8868\u793A\u4EF6\u6570",statsNoData:"\u7D71\u8A08\u30C7\u30FC\u30BF\u306A\u3057",statsBasicHeading:"\u57FA\u672C\u7D71\u8A08",statTotalProcessingTime:"\u7DCF\u51E6\u7406\u6642\u9593",statLastSearchTime:"\u6700\u5F8C\u306E\u691C\u7D22\u6642\u9593",statErrorCount:"\u30A8\u30E9\u30FC\u6570",statUpdatedAt:"\u7D71\u8A08\u66F4\u65B0\u6642\u523B",statsOperationsHeading:"\u64CD\u4F5C\u7D71\u8A08",statTotalOperations:"\u7DCF\u64CD\u4F5C\u6570",statsIndexHeading:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u7D71\u8A08",statIndexBuilds:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u69CB\u7BC9\u56DE\u6570",statDataSize:"\u30C7\u30FC\u30BF\u30B5\u30A4\u30BA",statLastBuildTime:"\u6700\u5F8C\u306E\u69CB\u7BC9\u6642\u9593",statsCacheHeading:"\u30AD\u30E3\u30C3\u30B7\u30E5\u7D71\u8A08",statCacheNgram:"N-gram",statCacheWord:"\u5358\u8A9E",statCachePhonetic:"\u97F3\u97FB",statsIndexMetadataHeading:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u30E1\u30BF\u30C7\u30FC\u30BF",statsCalculationsHeading:"\u8A08\u7B97\u7D71\u8A08",statTotalCalculations:"\u7DCF\u8A08\u7B97\u6570",statDistanceCalculations:"\u8DDD\u96E2\u8A08\u7B97\u6570",statAverageDistance:"\u5E73\u5747\u8DDD\u96E2",statMinDistance:"\u6700\u5C0F\u8DDD\u96E2",statMaxDistance:"\u6700\u5927\u8DDD\u96E2",notAvailable:"N/A",statsMatchesHeading:"\u30DE\u30C3\u30C1\u7D71\u8A08",statPartialMatches:"\u90E8\u5206\u30DE\u30C3\u30C1\u6570",statPerfectMatches:"\u5B8C\u5168\u30DE\u30C3\u30C1\u6570",statEarlyTerminations:"\u65E9\u671F\u7D42\u4E86\u6570",statsSimilarityHeading:"\u985E\u4F3C\u5EA6\u5206\u5E03",statAbove80:"80% \u4EE5\u4E0A",statAbove60:"60% \u4EE5\u4E0A",statAbove40:"40% \u4EE5\u4E0A",statBelow40:"40% \u672A\u6E80",statsDistanceHeading:"\u8DDD\u96E2\u5206\u5E03 (\u4E0A\u4F4D 6)",statDistance:e=>`\u8DDD\u96E2 ${e}`,statsQueryLengthHeading:"\u30AF\u30A8\u30EA\u9577\u7D71\u8A08 (\u4E0A\u4F4D 6)",statQueryLength:e=>`\u9577\u3055 ${e}`,statQueryLengthValue:({count:e,averagePercent:t})=>`${G("ja",e)} \u56DE / \u5E73\u5747 ${t}%`,statsFieldPerformanceHeading:"\u30D5\u30A3\u30FC\u30EB\u30C9\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9 (\u4E0A\u4F4D 6)",statAverageScore:"\u5E73\u5747\u30B9\u30B3\u30A2",statMatchCount:"\u30DE\u30C3\u30C1\u6570",statBestWorstScore:"\u6700\u9AD8 / \u6700\u4F4E\u30B9\u30B3\u30A2",statsInsightsHeading:"\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u6D1E\u5BDF",statBestField:"\u6700\u9AD8\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u30D5\u30A3\u30FC\u30EB\u30C9",statRecentAverageTime:"\u6700\u8FD1\u306E\u5E73\u5747\u51E6\u7406\u6642\u9593",statRecentAverageResults:"\u6700\u8FD1\u306E\u5E73\u5747\u7D50\u679C\u6570",statThroughput:"\u30B9\u30EB\u30FC\u30D7\u30C3\u30C8",statCommonQueryLength:"\u6700\u983B\u51FA\u30AF\u30A8\u30EA\u9577",statHistoryEntries:"\u5C65\u6B74\u30A8\u30F3\u30C8\u30EA\u6570",statHighSimilarity:"\u9AD8\u985E\u4F3C",statMediumSimilarity:"\u4E2D\u985E\u4F3C",statLowSimilarity:"\u4F4E\u985E\u4F3C",statVeryLowSimilarity:"\u6975\u4F4E\u985E\u4F3C",statsRecentHistoryHeading:"\u6700\u8FD1\u306E\u5C65\u6B74 (\u6700\u65B0 3 \u4EF6)",statsHistoryEntry:({processingTimeMs:e,resultCount:t})=>`\u51E6\u7406\u6642\u9593: ${e} ms / \u7D50\u679C: ${G("ja",t)} \u4EF6`,timesUnit:()=>" \u56DE",itemsUnit:()=>" \u4EF6",charactersUnit:()=>" \u6587\u5B57",throughputUnit:" ops/\u79D2"})}),En=Object.freeze(Object.keys(la.en)),Wt=Object.freeze([...za,...En]),Tt=Object.freeze({en:Object.freeze({...Mn.en,...la.en}),ja:Object.freeze({...Mn.ja,...la.ja})}),Fa=e=>typeof e=="string"?JSON.stringify(e):e===null?"null":typeof e,Kr=e=>{let t={},a=!1;for(let s of za){let l=Object.hasOwn(e,s)?e[s]:void 0;l!==void 0&&(t[s]=l,a=!0)}return a?t:void 0},jr=(e,t,a)=>{e[t]=a},Ba=(e,t)=>{let a=Ur(e);if(t===void 0)return Tt[a];if(t===null||typeof t!="object")throw new RangeError(`[contact-map] labels must be an object; got ${Fa(t)}`);let s=Object.getPrototypeOf(t);if(s!==Object.prototype&&s!==null)throw new RangeError(`[contact-map] labels must be a plain object (prototype Object.prototype or null); got ${Array.isArray(t)?"an array":"an object with a non-plain prototype"}`);for(let d of Object.keys(t))if(!Wt.includes(d))throw new RangeError(`[contact-map] labels.${d} is not a known label key; expected one of ${Wt.join(", ")}`);let l=Br(a,Kr(t)),n=la[a],r={...l,...n};for(let d of En){let o=Object.hasOwn(t,d)?t[d]:void 0;if(o!==void 0){if(typeof n[d]=="function"){if(typeof o!="function")throw new RangeError(`[contact-map] labels.${d} must be a function; got ${Fa(o)}`)}else if(typeof o!="string"||o.trim()==="")throw new RangeError(`[contact-map] labels.${d} must be a non-blank string; got ${Fa(o)}`);jr(r,d,o)}}return Object.freeze(r)},Ua=e=>{let t={};for(let a of za)t[a]=e[a];return Object.freeze(t)},$a=e=>{let t={};for(let a of $r)t[a]=e[a];return Object.freeze(t)}});import{DIRECTORY_TREE_LABEL_KEYS as Gr}from"@aiquants/directory-tree";import{resolveVirtualScrollLocale as qr,VIRTUAL_SCROLL_LABEL_KEYS as Qr}from"@aiquants/virtualscroll";import{createContext as Yr,useContext as Dn,useMemo as On,useRef as Xr}from"react";import{jsx as Zr}from"react/jsx-runtime";var Jr,Ka,Va,Hn,fe,q,oe=Qe(()=>{"use strict";dt();Jr=Object.freeze({locale:"en",labels:Tt.en,treeLabels:Ua(Tt.en),engineLabels:$a(Tt.en)}),Ka=Yr(Jr),Va=(e,t)=>{let a=Xr(null),s=a.current;return s!==null&&t.every(l=>s[l]===e[l])?s:(a.current=e,e)},Hn=({locale:e,labels:t,children:a})=>{let s=qr(e),l=On(()=>Ba(s,t),[s,t]),n=Va(l,Wt),r=Va(Ua(n),Gr),d=Va($a(n),Qr),o=On(()=>({locale:s,labels:n,treeLabels:r,engineLabels:d}),[s,n,r,d]);return Zr(Ka.Provider,{value:o,children:a})},fe=()=>Dn(Ka),q=()=>Dn(Ka).labels});var da,ca,_n,pa,ua,_t,Be,In,Pe,j,pt=Qe(()=>{"use strict";da=e=>{if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null},ca=e=>!e||typeof e!="object"?null:"item"in e?e.item??null:"person_id"in e?e:null,_n=(e,t)=>{if(!e)return{value:null,fieldKey:null};for(let a of t){let s=da(e[a]);if(s)return{value:s,fieldKey:a}}return{value:null,fieldKey:null}},pa=e=>_n(e,["custom_email","email"]),ua=e=>_n(e,["custom_mobile_phone_number","mobile_phone_number","company_phone_number"]),_t=e=>{let t=da(e);if(!t)return null;let a=t.replace(/[^0-9+#*]/g,"");return a.length===0?null:`tel:${a}`},Be=(e,t)=>{let a=da(e);return a?t?`https://mail.google.com/mail/?view=cm&fs=1&to=${encodeURIComponent(a)}`:`mailto:${encodeURIComponent(a)}`:null},In=e=>{if(!e)return"-";let t=typeof e=="string"||typeof e=="number"?new Date(e):e;return!(t instanceof Date)||Number.isNaN(t.getTime())?typeof e=="string"?e:"-":t.toISOString().split("T")[0]},Pe=e=>{if(!e)return"-";let t=typeof e=="string"||typeof e=="number"?new Date(e):e;return!(t instanceof Date)||Number.isNaN(t.getTime())?typeof e=="string"?e:"-":t.toISOString()},j=e=>e==null?"-":typeof e=="string"?da(e)??"-":typeof e=="number"?Number.isFinite(e)?String(e):"-":e instanceof Date?Pe(e):String(e)});import as from"lucide-react/dist/esm/icons/check.js";import ns from"lucide-react/dist/esm/icons/copy.js";import rs from"lucide-react/dist/esm/icons/x.js";import{useCallback as Ye,useEffect as Ya,useMemo as It,useRef as Xa,useState as zn}from"react";import{createPortal as ss}from"react-dom";import{jsx as Q,jsxs as Le}from"react/jsx-runtime";var is,An,Ft,wt,os,ls,At,qa,Fn,Qa,ma,Ja=Qe(()=>{"use strict";pt();oe();is=350,An=["dblclick","pointerdown","pointerup","mousedown","mouseup","touchstart","touchend","contextmenu"],Ft=0,wt=null,os=()=>{let e=document.body.style;Ft+=1,Ft===1&&(wt={userSelect:e.userSelect,webkitUserSelect:e.webkitUserSelect}),e.userSelect="none",typeof e.webkitUserSelect<"u"&&(e.webkitUserSelect="none")},ls=()=>{if(Ft=Math.max(0,Ft-1),Ft>0||!wt)return;let e=document.body.style;e.userSelect=wt.userSelect,typeof wt.webkitUserSelect<"u"&&(e.webkitUserSelect=wt.webkitUserSelect),wt=null},At=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},qa=(e,t)=>{let a=new Set;return e.reduce((s,l)=>{let n=typeof l.value=="string"?l.value.trim():"";if(!n)return s;let{normalized:r,key:d,entry:o}=t(n,l);return r&&!a.has(d)&&(a.add(d),s.push(o(r))),s},[])},Fn=(e,t)=>e===t,Qa=({value:e,ariaLabel:t,size:a="md"})=>{let[s,l]=zn(!1),n=Xa(null),r=Ye(async c=>{if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(c),!0}catch{}if(typeof document>"u")return!1;let i=document.createElement("textarea");i.value=c,i.setAttribute("readonly",""),i.style.position="absolute",i.style.left="-9999px",document.body.appendChild(i),i.select(),i.setSelectionRange(0,i.value.length);let p=document.execCommand("copy");return document.body.removeChild(i),p},[]),d=Ye(async c=>{c.preventDefault(),c.stopPropagation(),n.current!==null&&typeof window<"u"&&(window.clearTimeout(n.current),n.current=null);let i=await r(e);l(i),i&&typeof window<"u"&&(n.current=window.setTimeout(()=>{l(!1),n.current=null},1500))},[r,e]);Ya(()=>()=>{n.current!==null&&typeof window<"u"&&(window.clearTimeout(n.current),n.current=null)},[]);let o=a==="sm"?"h-6 w-6":"h-7 w-7",u=a==="sm"?"h-3.5 w-3.5":"h-4 w-4",m=s?as:ns;return Q("button",{type:"button",className:`inline-flex ${o} shrink-0 items-center justify-center rounded-md border border-gray-200 text-slate-600 transition-colors hover:bg-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-200 dark:text-slate-300`,onClick:d,"aria-label":t,title:t,children:Q(m,{className:u,"aria-hidden":"true"})})},ma=({contactData:e,openEmailsWithGmail:t,openGmailCompose:a,onRequestClose:s})=>{let l=q(),[n,r]=zn(null);Ya(()=>{r(document.body)},[]);let d=Xa(null),o=Xa(null),u=It(()=>e.contacted_at?In(e.contacted_at):null,[e.contacted_at]),m=e.full_name||"-",c=At(e.company_name),i=At(e.department),p=At(e.title),f=It(()=>qa([{fieldKey:"company_name",label:l.fieldCompanyName,value:c},{fieldKey:"department",label:l.fieldDepartment,value:i},{fieldKey:"title",label:l.fieldTitle,value:p}],(h,{fieldKey:x,label:O})=>({normalized:h,key:`${x}-${h.toLowerCase()}`,entry:D=>({fieldKey:x,label:O,value:D})})),[c,i,p,l]),v=It(()=>qa([{fieldKey:"custom_mobile_phone_number",label:l.popupCustomMobilePhone,value:e.custom_mobile_phone_number},{fieldKey:"mobile_phone_number",label:l.popupMobilePhone,value:e.mobile_phone_number},{fieldKey:"custom_company_phone_number",label:l.popupCustomCompanyPhone,value:e.custom_company_phone_number},{fieldKey:"company_phone_number",label:l.popupCompanyPhone,value:e.company_phone_number}],(h,{fieldKey:x,label:O})=>{let D=_t(h);return{normalized:At(h),key:(D??h).toLowerCase(),entry:N=>({fieldKey:x,label:O,value:N,href:D})}}),[e.custom_mobile_phone_number,e.mobile_phone_number,e.custom_company_phone_number,e.company_phone_number,l]),S=It(()=>qa([{fieldKey:"custom_email",label:l.popupCustomEmail,value:e.custom_email},{fieldKey:"email",label:l.popupEmail,value:e.email}],(h,{fieldKey:x,label:O})=>{let D=At(h),ee=Be(h,t),N=!!ee?.startsWith("https://mail.google.com");return{normalized:D,key:h.toLowerCase(),entry:w=>({fieldKey:x,label:O,value:w,href:ee,isGmailLink:N})}}),[e.custom_email,e.email,t,l]),C=v.length>0||S.length>0,F=It(()=>`contact-methods-${e.person_id}`,[e.person_id]),k=Ye(h=>{s(h),o.current=null},[s]),b=Ye(h=>{h.stopPropagation(),Fn(h.target,h.currentTarget)&&k()},[k]),g=Ye(h=>{h.stopPropagation(),Fn(h.target,h.currentTarget)&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),k())},[k]),E=Ye(h=>{h.stopPropagation(),k()},[k]),V=Ye((h,x)=>{x.isGmailLink&&(h.preventDefault(),a(x.value))},[a]),y=Ye((h,x)=>{if(!x.isGmailLink){o.current=null;return}let O=Date.now(),D=o.current;if(D&&D.email===x.value&&O-D.timestamp<=is){o.current=null,h.preventDefault(),a(x.value);return}o.current={email:x.value,timestamp:O}},[a]);return Ya(()=>{let h=[];if(typeof window<"u"){let x=O=>{if(O.key==="Escape"){k();return}if(O.key==="Tab"&&d.current){let D=d.current.querySelectorAll('a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])');if(D.length===0)return;let ee=D[0],N=D[D.length-1];O.shiftKey?document.activeElement===ee&&(O.preventDefault(),N.focus()):document.activeElement===N&&(O.preventDefault(),ee.focus())}};window.addEventListener("keydown",x),h.push(()=>window.removeEventListener("keydown",x))}if(typeof document<"u"){let x=d.current;if(x){let N=w=>{w.stopPropagation()};for(let w of An)x.addEventListener(w,N);h.push(()=>{for(let w of An)x.removeEventListener(w,N)})}let O=N=>{let w=d.current;return w&&N instanceof Node?w.contains(N):!1},D=N=>{O(N.target)||k({suppressLongPress:!0,cancelLongPressTimer:!0})},ee=["pointerdown","wheel","touchmove"];for(let N of ee)document.addEventListener(N,D,!0);h.push(()=>{for(let N of ee)document.removeEventListener(N,D,!0)}),os(),h.push(ls)}return()=>{for(let x of h)x()}},[k,n]),n?ss(Q("div",{"data-contact-popup-root":"true",className:"fixed top-0 right-0 bottom-0 left-0 z-50 flex items-center justify-center bg-black/50 px-4 py-6",style:{right:"var(--aqcm-overlay-right, var(--aiquants-menu-pinned-width, 0px))",transition:"right 0.5s"},role:"dialog","aria-modal":"true","aria-labelledby":F,tabIndex:-1,onClick:b,onKeyDown:g,children:Le("div",{ref:d,className:"w-full max-w-md rounded-lg border border-slate-200 bg-white p-4 shadow-lg transition-colors dark:border-transparent dark:bg-slate-900 dark:shadow-slate-950/40 dark:ring-1 dark:ring-white/70",children:[Le("div",{className:"flex items-start justify-between gap-4",children:[Le("div",{children:[Q("h2",{id:F,className:"font-semibold text-gray-900 text-lg dark:text-slate-100",children:m}),f.length>0?Q("div",{className:"mt-2 space-y-2 text-slate-700 text-sm dark:text-slate-200",children:f.map(h=>Le("div",{className:"flex items-center gap-3",children:[Q("p",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:h.value}),Q(Qa,{value:h.value,ariaLabel:l.copyField(h.label),size:"sm"})]},h.fieldKey))}):null]}),Q("button",{type:"button",className:"rounded-md p-0.5 text-slate-600 transition-colors hover:bg-gray-100 focus:outline-none focus-visible:ring focus-visible:ring-blue-200 dark:text-slate-300 dark:hover:bg-slate-800/70",onClick:E,"aria-label":l.close,children:Q(rs,{className:"h-4 w-4","aria-hidden":"true"})})]}),Le("div",{className:"mt-4 space-y-4 text-slate-700 dark:text-slate-200",children:[v.length>0?Q("div",{children:Q("ul",{className:"space-y-3 text-sm",children:v.map(h=>Q("li",{className:"flex items-start gap-3",children:Le("div",{className:"flex-1",children:[Q("span",{className:"text-slate-600 text-xs dark:text-slate-300",children:h.label}),Le("div",{className:"mt-1 flex items-center gap-3",children:[Q("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:h.href?Q("a",{href:h.href,className:"wrap-break-word text-blue-600 underline-offset-2 transition-colors hover:underline focus:underline focus:outline-none dark:text-blue-300",children:h.value}):Q("span",{className:"wrap-break-word text-slate-800 dark:text-slate-100",children:h.value})}),Q(Qa,{value:h.value,ariaLabel:l.copyField(h.label),size:"sm"})]})]})},`${h.fieldKey}-${h.value}`))})}):null,S.length>0?Q("div",{children:Q("ul",{className:"space-y-3 text-sm",children:S.map(h=>Q("li",{className:"flex items-start gap-3",children:Le("div",{className:"flex-1",children:[Q("span",{className:"text-slate-600 text-xs dark:text-slate-300",children:h.label}),Le("div",{className:"mt-1 flex items-start gap-3",children:[Le("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:[h.href?Q("a",{href:h.href,className:"wrap-break-word text-blue-600 underline-offset-2 transition-colors hover:underline focus:underline focus:outline-none dark:text-blue-300",target:h.isGmailLink?"_blank":void 0,rel:h.isGmailLink?"noopener noreferrer":void 0,onDoubleClick:x=>V(x,h),onTouchEnd:x=>y(x,h),children:h.value}):Q("span",{className:"wrap-break-word text-slate-800 dark:text-slate-100",children:h.value}),h.isGmailLink?Q("span",{className:"mt-1 block text-[11px] text-slate-500 dark:text-slate-400",children:l.popupGmailHint}):null]}),Q(Qa,{value:h.value,ariaLabel:l.copyField(h.label),size:"sm"})]})]})},`${h.fieldKey}-${h.value}`))})}):null,u?Le("div",{className:"mt-2 flex items-center gap-2 text-slate-600 text-sm dark:text-slate-300",children:[Q("span",{className:"text-xs",children:l.popupLastContactDate}),Q("span",{children:u})]}):null,C?null:Q("p",{className:"text-slate-600 text-sm dark:text-slate-300",children:l.popupNoContactMethods})]})]})}),n):null}});import{jsx as be,jsxs as zt}from"react/jsx-runtime";var ga,Za=Qe(()=>{"use strict";ga=({fullName:e,title:t="-",companyName:a="-",department:s="-",phoneNumber:l="-",email:n="-",updatedAtText:r="-"})=>zt("div",{className:"flex h-full w-full flex-col justify-center gap-0.5 text-slate-800 text-xs leading-tight transition-colors sm:grid sm:grid-cols-3 sm:gap-2 sm:text-sm xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto] dark:text-slate-200",children:[zt("div",{className:"flex items-center gap-1 sm:hidden",children:[be("div",{className:"flex-1 truncate font-medium text-gray-900 text-sm leading-tight dark:text-slate-100",children:e}),be("div",{className:"shrink-0 whitespace-nowrap text-[11px] text-slate-600 dark:text-slate-300",children:l})]}),be("div",{className:"flex items-center gap-1 sm:hidden",children:be("div",{className:"flex-1 truncate text-slate-700 text-xs leading-tight dark:text-slate-200",children:a})}),be("div",{className:"block sm:hidden",children:be("span",{className:"w-full truncate text-left text-[11px] text-slate-700 leading-tight dark:text-slate-200",children:s})}),zt("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[be("span",{className:"truncate font-medium text-gray-900 dark:text-slate-100",children:e}),be("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:t})]}),zt("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[be("span",{className:"truncate text-slate-800 dark:text-slate-100",children:a}),be("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:s})]}),zt("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[be("span",{className:"truncate text-slate-700 dark:text-slate-200",children:l}),be("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:n})]}),be("div",{className:"hidden items-end justify-end text-[11px] text-slate-600 xl:flex dark:text-slate-300",children:be("span",{className:"truncate",children:r})})]})});import{getNormalizedVariants as ds,normalizeText as cs,romajiToKatakana as ps}from"@aiquants/select-box";var us,ms,gs,hs,fs,Un,bs,ys,Bn,ha,$n,en=Qe(()=>{"use strict";us=/[​]/g,ms=/^[\s  ]+|[\s  ]+$/g,gs=/\s+/,hs=/^[\p{Script=Latin}\s]+$/u,fs=/\p{Script=Latin}/u,Un=Object.freeze({convertWidth:!0,convertKana:!0,convertCase:!0,convertRomaji:!1}),bs=e=>cs(e.replace(us,"").replace(ms,""),Un),ys=e=>{if(!hs.test(e))return null;let t=ps(e);return fs.test(t)?null:t},Bn=e=>e.split(gs).filter(Boolean),ha=e=>{let t=bs(e),a=ys(t);return a===null?t:a},$n=e=>{let t=new Set([...Bn(e),...Bn(ha(e))]),a=new Set;for(let s of t)for(let l of ds(s,Un)){let n=l.trim();n&&a.add(n)}return Array.from(a)}});import{memo as xs}from"react";import{Fragment as tn,jsx as fa}from"react/jsx-runtime";var vs,ue,ba=Qe(()=>{"use strict";en();vs=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),ue=xs(({text:e,query:t,enabled:a=!0})=>{if(!(a&&t?.trim()&&e))return fa(tn,{children:e});let s=$n(t.trim());if(s.length===0)return fa(tn,{children:e});let n=`(${s.map(vs).sort((c,i)=>i.length-c.length).join("|")})`,r=new RegExp(n,"gi"),d=[],o=0,u=r.exec(e),m=0;for(;u;){let c=u[0],i=u.index;if(i>o&&d.push(e.substring(o,i)),c.length===0){r.lastIndex++,u=r.exec(e);continue}d.push(fa("mark",{className:"rounded bg-yellow-200 px-1 text-gray-900",children:c},`highlight-${i}-${m}`)),o=i+c.length,m+=1,u=r.exec(e)}return o<e.length&&d.push(e.substring(o)),fa(tn,{children:d})});ue.displayName="HighlightedText"});var Kn={};zr(Kn,{ContactDetailGrid:()=>Vn,default:()=>Cs});import{useMemo as an}from"react";import{Fragment as ks,jsx as rn,jsxs as Ss}from"react/jsx-runtime";var nn,Vn,Cs,jn=Qe(()=>{"use strict";pt();oe();Ja();Za();ba();nn=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},Vn=({contactData:e,searchTerm:t,enableHighlighting:a,openEmailsWithGmail:s,openGmailCompose:l,isPopupVisible:n,onRequestClose:r})=>{let d=q(),o=an(()=>pa(e),[e]),u=an(()=>ua(e),[e]),m=o.value??"-",c=u.value??"-",i=an(()=>Pe(e.updated_at),[e.updated_at]),p=nn(e.full_name)??d.noName,f=nn(e.company_name),v=nn(e.department),S=(C,F="-")=>rn(ue,{text:C??F,query:t,enabled:a});return Ss(ks,{children:[rn(ga,{fullName:S(p),title:S(e.title),companyName:S(f),department:S(v),phoneNumber:c,email:S(m),updatedAtText:i}),n?rn(ma,{contactData:e,openEmailsWithGmail:s,openGmailCompose:l,onRequestClose:r}):null]})},Cs=Vn});oe();import{DEFAULT_FUZZY_SEARCH_OPTIONS as Nt}from"@aiquants/fuzzy-search";import{memo as es,useId as Wn}from"react";import{jsx as Oe,jsxs as ze}from"react/jsx-runtime";var ja=es(({searchOptions:e,setSearchOptions:t})=>{let a=q(),s="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",l="text-xs font-semibold",n=Wn(),r=Wn(),d=[];return d.push(ze("div",{className:`${s} border-sky-200 border-l-4 dark:border-sky-400/60`,children:[ze("div",{className:`${l} text-sky-700 dark:text-sky-300`,children:["\u{1F4D8} ",a.advancedLearningHeading]}),Oe("label",{htmlFor:n,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.advancedLearningLabel}),Oe("input",{id:n,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.learningWeight||Nt.learningWeight,onChange:o=>t(u=>({...u,learningWeight:parseFloat(o.target.value)})),className:"w-full"}),ze("span",{className:"text-sky-600 text-xs dark:text-sky-300",children:[a.currentValueLabel," ",e.learningWeight||Nt.learningWeight]}),Oe("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.advancedLearningHint})]},"learning")),d.push(ze("div",{className:`${s} border-indigo-200 border-l-4 dark:border-indigo-400/60`,children:[ze("div",{className:`${l} text-indigo-700 dark:text-indigo-300`,children:["\u23F1\uFE0F ",a.advancedDebounceHeading]}),Oe("label",{htmlFor:r,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.advancedDebounceLabel}),Oe("input",{id:r,type:"range",min:"100",max:"1000",step:"50",value:e.debounceMs||Nt.debounceMs,onChange:o=>t(u=>({...u,debounceMs:parseInt(o.target.value,10)})),className:"w-full"}),ze("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[a.currentValueLabel," ",e.debounceMs||Nt.debounceMs]}),Oe("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.advancedDebounceHint})]},"debounce")),ze("section",{className:"space-y-3",children:[ze("div",{className:"flex items-center justify-between gap-3",children:[ze("div",{className:"flex items-center gap-2 font-semibold text-gray-700 text-xs transition-colors dark:text-slate-200",children:[Oe("span",{children:"\u26A1"}),Oe("span",{className:"tracking-wide",children:a.settingsAdvancedTab})]}),Oe("button",{type:"button",onClick:()=>t(o=>({...o,learningWeight:Nt.learningWeight,debounceMs:Nt.debounceMs})),className:"rounded border border-gray-300 bg-gray-100 px-2 py-1 font-medium text-gray-700 text-xs transition-colors hover:bg-gray-200 dark:border-slate-600 dark:bg-slate-800/70 dark:text-slate-200 dark:hover:bg-slate-700/70",title:a.resetToDefaultsTitle,children:a.reset})]}),Oe("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:d})]})});ja.displayName="AdvancedSearchSettings";oe();import{DEFAULT_FUZZY_SEARCH_OPTIONS as ct}from"@aiquants/fuzzy-search";import{memo as ts,useId as De}from"react";import{jsx as X,jsxs as Z}from"react/jsx-runtime";var Ga=ts(({searchOptions:e,setSearchOptions:t,enableHighlighting:a,setEnableHighlighting:s,openEmailsWithGmail:l,setOpenEmailsWithGmail:n})=>{let r=q(),d="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",o="text-xs font-semibold",u=De(),m=De(),c=De(),i=De(),p=De(),f=De(),v=De(),S=De(),C=De(),F=De(),k=[];return k.push(Z("div",{className:`${d} border-blue-200 border-l-4 dark:border-blue-500/50`,children:[Z("div",{className:`${o} text-blue-700 dark:text-blue-300`,children:["\u{1F3AF} ",r.basicThresholdHeading]}),X("label",{htmlFor:u,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:r.basicThresholdLabel}),X("input",{id:u,type:"range",min:"0.0",max:e.sortBy==="relevance"?"1.5":"1.0",step:"0.05",value:e.threshold??ct.threshold,onChange:b=>t(g=>({...g,threshold:parseFloat(b.target.value)})),className:"w-full"}),Z("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[r.currentValueLabel," ",e.threshold??ct.threshold]}),X("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:e.sortBy==="relevance"?r.basicThresholdRangeRelevance:r.basicThresholdRange})]},"threshold")),k.push(Z("div",{className:`${d} border-amber-200 border-l-4 dark:border-amber-400/60`,children:[Z("div",{className:`${o} text-amber-700 dark:text-amber-300`,children:["\u{1FA84} ",r.basicDisplayHeading]}),Z("label",{htmlFor:m,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[X("input",{id:m,type:"checkbox",checked:e.caseSensitive??ct.caseSensitive,onChange:b=>t(g=>({...g,caseSensitive:b.target.checked})),className:"h-3 w-3"}),r.basicCaseSensitive]}),Z("label",{htmlFor:c,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[X("input",{id:c,type:"checkbox",checked:a,onChange:b=>s(b.target.checked),className:"h-3 w-3"}),r.basicHighlight]}),Z("label",{htmlFor:i,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[X("input",{id:i,type:"checkbox",checked:l,onChange:b=>n(b.target.checked),className:"h-3 w-3"}),r.basicOpenEmailsWithGmail]}),Z("div",{className:"flex flex-col gap-1",children:[X("label",{htmlFor:p,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:r.basicMultiTermOperator}),Z("select",{id:p,value:e.multiTermOperator??ct.multiTermOperator,onChange:b=>t(g=>({...g,multiTermOperator:b.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[X("option",{value:"or",children:r.basicOperatorOr}),X("option",{value:"and",children:r.basicOperatorAnd})]}),X("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:r.basicMultiTermHint})]})]},"display")),k.push(Z("div",{className:`${d} border-emerald-200 border-l-4 dark:border-emerald-400/60`,children:[Z("div",{className:`${o} text-emerald-700 dark:text-emerald-300`,children:["\u{1F4DA} ",r.basicSortHeading]}),Z("div",{className:"flex flex-col gap-2",children:[X("label",{htmlFor:f,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:r.basicSortBy}),Z("select",{id:f,value:e.sortBy||ct.sortBy,onChange:b=>t(g=>({...g,sortBy:b.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[X("option",{value:"score",children:r.basicSortByScore}),X("option",{value:"relevance",children:r.basicSortByRelevance}),X("option",{value:"original",children:r.basicSortByOriginal})]})]}),Z("div",{className:"flex flex-col gap-2",children:[X("label",{htmlFor:v,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:r.basicSortOrder}),Z("select",{id:v,value:e.sortOrder||ct.sortOrder,onChange:b=>t(g=>({...g,sortOrder:b.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[X("option",{value:"desc",children:r.basicSortDescending}),X("option",{value:"asc",children:r.basicSortAscending})]})]})]},"sorting")),k.push(Z("div",{className:`${d} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[Z("div",{className:`${o} text-purple-700 dark:text-purple-300`,children:["\u2699\uFE0F ",r.basicEngineHeading]}),X("label",{htmlFor:S,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:r.basicStrategy}),Z("select",{id:S,value:e.parallelSearchStrategy||ct.parallelSearchStrategy,onChange:b=>t(g=>({...g,parallelSearchStrategy:b.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[X("option",{value:"balanced",children:r.basicStrategyBalanced}),X("option",{value:"index-first",children:r.basicStrategyIndexFirst}),X("option",{value:"levenshtein-first",children:r.basicStrategyLevenshteinFirst})]}),Z("div",{className:"mt-2 space-y-2",children:[Z("label",{htmlFor:C,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[X("input",{id:C,type:"checkbox",checked:e.enableIndexFiltering!==!1,onChange:b=>t(g=>({...g,enableIndexFiltering:b.target.checked})),className:"h-3 w-3"}),r.basicIndexFiltering]}),Z("label",{htmlFor:F,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[X("input",{id:F,type:"checkbox",checked:e.enableLevenshtein!==!1,onChange:b=>t(g=>({...g,enableLevenshtein:b.target.checked})),className:"h-3 w-3"}),r.basicLevenshtein]})]})]},"engine")),Z("section",{className:"space-y-3",children:[Z("div",{className:"flex items-center gap-2 font-semibold text-blue-700 text-xs transition-colors dark:text-sky-400",children:[X("span",{children:"\u{1F527}"}),X("span",{className:"tracking-wide",children:r.settingsBasicTab})]}),X("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:k})]})});Ga.displayName="BasicSearchSettings";pt();import ws from"lucide-react/dist/esm/icons/badge-check.js";import Ps from"lucide-react/dist/esm/icons/building-2.js";import Ls from"lucide-react/dist/esm/icons/calendar-clock.js";import Rs from"lucide-react/dist/esm/icons/check.js";import Ms from"lucide-react/dist/esm/icons/copy.js";import Es from"lucide-react/dist/esm/icons/id-card.js";import Os from"lucide-react/dist/esm/icons/mail.js";import Ds from"lucide-react/dist/esm/icons/phone.js";import Hs from"lucide-react/dist/esm/icons/user-round.js";import{useCallback as Ws,useEffect as _s,useMemo as va,useRef as Is,useState as As}from"react";var Xe={info:(e,...t)=>console.info(`[contact-map] ${e}`,...t),warn:(e,...t)=>console.warn(`[contact-map] ${e}`,...t),error:(e,...t)=>console.error(`[contact-map] ${e}`,...t)};oe();import*as Re from"@radix-ui/react-tabs";import*as ya from"react";import{clsx as Ts}from"clsx";import{twMerge as Ns}from"tailwind-merge";function ut(...e){return Ns(Ts(e))}import{jsx as sn}from"react/jsx-runtime";var xa=Re.Root,Bt=ya.forwardRef(({className:e,...t},a)=>sn(Re.List,{ref:a,className:ut("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Bt.displayName=Re.List.displayName;var mt=ya.forwardRef(({className:e,...t},a)=>sn(Re.Trigger,{ref:a,className:ut("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 font-medium text-sm ring-offset-background transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-2xs",e),...t}));mt.displayName=Re.Trigger.displayName;var gt=ya.forwardRef(({className:e,...t},a)=>sn(Re.Content,{ref:a,className:ut("mt-2 ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=inactive]:hidden",e),...t}));gt.displayName=Re.Content.displayName;ba();import{jsx as P,jsxs as de}from"react/jsx-runtime";var Gn={height:"var(--contact-panel-height, 100%)",maxHeight:"100%"},Fs=({icon:e,label:t,value:a,fieldKey:s,copyValue:l,onCopy:n,isCopied:r,linkHref:d,searchTerm:o,enableHighlighting:u})=>{let m=q(),c=!!(n&&s&&l),i=d?.startsWith("https://mail.google.com")?"_blank":void 0;return de("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1.5 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[de("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[P("div",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-white text-slate-500 transition-colors dark:bg-slate-800 dark:text-slate-200",children:P(e,{size:14})}),de("div",{className:"min-w-0 flex-1",children:[P("div",{className:"font-medium text-[10px] text-slate-500 dark:text-slate-400",children:t}),P("div",{className:"truncate font-semibold text-slate-900 text-xs dark:text-slate-100",children:d?P("a",{href:d,className:"text-inherit underline-offset-2 hover:underline focus:underline focus:outline-none",target:i,rel:i?"noopener noreferrer":void 0,children:P(ue,{text:a,query:o??"",enabled:u})}):P(ue,{text:a,query:o??"",enabled:u})})]})]}),c?P("button",{type:"button",onClick:()=>n&&s&&l&&n(s,l,t),className:"inline-flex h-6 w-6 items-center justify-center rounded-full border border-slate-200 bg-white text-slate-500 transition-colors hover:border-blue-400 hover:text-blue-500 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:hover:border-blue-400 dark:hover:text-blue-300","aria-label":m.copyField(t),children:r?P(Rs,{size:14}):P(Ms,{size:14})}):null]})},qn=({items:e,searchTerm:t,enableHighlighting:a})=>P("dl",{className:"grid grid-cols-1 gap-x-3 gap-y-1.5 sm:grid-cols-2",children:e.map(s=>de("div",{className:"flex flex-col gap-0.5 rounded-md border border-slate-200 bg-white/60 px-2 py-1 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[P("dt",{className:"font-semibold text-[10px] text-slate-500 uppercase tracking-wide dark:text-slate-400",children:s.label}),P("dd",{className:"wrap-break-word text-slate-900 text-xs dark:text-slate-100",children:P(ue,{text:s.value,query:t??"",enabled:a})})]},s.fieldKey))}),on=({title:e})=>P("h3",{className:"font-semibold text-slate-700 text-xs dark:text-slate-200",children:e}),zs=()=>{let e=q();return de("div",{className:"flex h-full min-h-40 w-full flex-1 flex-col items-center justify-center gap-2 rounded-xl border border-slate-300 border-dashed bg-white/60 p-4 text-center transition-colors dark:border-slate-700 dark:bg-slate-900/40",children:[P("p",{className:"font-medium text-slate-600 text-xs dark:text-slate-200",children:e.detailEmptyTitle}),P("p",{className:"text-[11px] text-slate-500 dark:text-slate-400",children:e.detailEmptyHint})]})},Je=({contact:e,searchTerm:t,enableHighlighting:a,style:s,className:l=""})=>{let n=q(),[r,d]=As(null),o=Is(null),u=va(()=>({...Gn,...s}),[s]);_s(()=>()=>{o.current!==null&&window.clearTimeout(o.current)},[]);let m=va(()=>pa(e),[e]),c=va(()=>ua(e),[e]),i=va(()=>Pe(e?.contacted_at??null),[e?.contacted_at]),p=Ws(async(y,h,x)=>{try{await navigator.clipboard.writeText(h),d(y),o.current!==null&&window.clearTimeout(o.current),o.current=window.setTimeout(()=>{d(null)},2e3)}catch(O){Xe.error("Failed to copy contact detail",O)}},[]);if(!e)return P("div",{className:"flex h-full min-h-0 w-full flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-950",style:Gn,children:P(zs,{})});let f=[j(e.title),j(e.department)].filter(y=>y!=="-"),v=[f.join(" / "),j(e.company_name)].filter(y=>y&&y!=="-").join(" \u30FB ")||"-",S=j(e.full_name),C=[{fieldKey:"full_name",label:n.fieldFullName,value:S==="-"?n.noName:S},{fieldKey:"full_name_reading",label:n.fieldFullNameReading,value:j(e.full_name_reading)},{fieldKey:"title",label:n.fieldTitle,value:j(e.title)},{fieldKey:"department",label:n.fieldDepartment,value:j(e.department)},{fieldKey:"company_name",label:n.fieldCompanyName,value:j(e.company_name)},{fieldKey:"company_name_reading",label:n.fieldCompanyNameReading,value:j(e.company_name_reading)},{fieldKey:"address",label:n.fieldAddress,value:j(e.address)},{fieldKey:"postal_code",label:n.fieldPostalCode,value:j(e.postal_code)},{fieldKey:"url",label:n.fieldUrl,value:j(e.url)}],F=[{label:n.fieldCustomEmail,value:j(e.custom_email),fieldKey:"custom_email",rawValue:e.custom_email},{label:n.fieldEmail,value:j(e.email),fieldKey:"email",rawValue:e.email}].filter(y=>y.value!=="-"),k=[{label:n.fieldCustomMobilePhone,value:j(e.custom_mobile_phone_number),fieldKey:"custom_mobile_phone_number",rawValue:e.custom_mobile_phone_number},{label:n.fieldMobilePhone,value:j(e.mobile_phone_number),fieldKey:"mobile_phone_number",rawValue:e.mobile_phone_number},{label:n.fieldCompanyPhone,value:j(e.company_phone_number),fieldKey:"company_phone_number",rawValue:e.company_phone_number},{label:n.fieldCompanyFax,value:j(e.company_fax_number),fieldKey:"company_fax_number",rawValue:e.company_fax_number}].filter(y=>y.value!=="-"),b=[{fieldKey:"person_id",label:"person_id",value:j(e.person_id)},{fieldKey:"person_id_redirect_to",label:"person_id_redirect_to",value:j(e.person_id_redirect_to)},{fieldKey:"is_active",label:"is_active",value:j(e.is_active)},{fieldKey:"is_contact_synced",label:"is_contact_synced",value:j(e.is_contact_synced)},{fieldKey:"is_incomplete",label:"is_incomplete",value:j(e.is_incomplete)},{fieldKey:"is_in_eight",label:"is_in_eight",value:j(e.is_in_eight)},{fieldKey:"created_by",label:n.fieldCreatedBy,value:j(e.created_by)},{fieldKey:"created_at",label:n.fieldCreatedAt,value:Pe(e.created_at)},{fieldKey:"updated_by",label:n.fieldUpdatedBy,value:j(e.updated_by)},{fieldKey:"updated_at",label:n.fieldUpdatedAt,value:Pe(e.updated_at)}],g=[{rowKey:"person_id",icon:Es,label:"person_id",value:j(e.person_id),fieldKey:"person_id",copyValue:String(e.person_id)},{rowKey:"primary_email",icon:Os,label:n.summaryEmail,value:m.value??"-",fieldKey:"primary_email",copyValue:m.value,linkHref:Be(m.value,!1)},{rowKey:"primary_phone",icon:Ds,label:n.summaryPhone,value:c.value??"-",fieldKey:"primary_phone",copyValue:c.value,linkHref:_t(c.value)},{rowKey:"contacted_at",icon:Ls,label:n.summaryLastContact,value:i}],E=[{sectionKey:"email",title:n.sectionEmail,emptyText:n.sectionEmailEmpty,entries:F,recommendedKey:m.fieldKey??null,resolveHref:y=>Be(y!=null?String(y):null,!1)},{sectionKey:"phone",title:n.sectionPhone,emptyText:n.sectionPhoneEmpty,entries:k,recommendedKey:c.fieldKey??null,resolveHref:y=>_t(y!=null?String(y):null)}],V=[{value:"summary",label:n.detailTabSummary,content:de("div",{className:"flex flex-col gap-4",children:[de("div",{className:"flex flex-col gap-1",children:[de("div",{className:"flex items-center gap-2 text-slate-600 text-sm dark:text-slate-300",children:[P(Ps,{size:16}),P("span",{children:P(ue,{text:j(e.company_name),query:t??"",enabled:a})})]}),f.length>0?P("div",{className:"text-slate-600 text-sm dark:text-slate-300",children:f.map((y,h)=>de("span",{children:[h>0&&" / ",P(ue,{text:y,query:t??"",enabled:a})]},`header-line-${h}`))}):null]}),P("div",{className:"flex flex-col gap-3",children:g.map(y=>P(Fs,{icon:y.icon,label:y.label,value:y.value,fieldKey:y.fieldKey,copyValue:y.copyValue,onCopy:p,isCopied:y.fieldKey?r===y.fieldKey:!1,linkHref:y.linkHref,searchTerm:t,enableHighlighting:a},y.rowKey))})]})},{value:"basic",label:n.detailTabBasic,content:de("div",{className:"flex flex-col gap-3",children:[P(on,{title:n.detailBasicProfile}),P(qn,{items:C,searchTerm:t,enableHighlighting:a})]})},{value:"contact",label:n.detailTabContact,content:P("div",{className:"flex flex-col gap-4",children:E.map(({sectionKey:y,title:h,emptyText:x,entries:O,recommendedKey:D,resolveHref:ee})=>de("div",{className:"flex flex-col gap-2",children:[P(on,{title:h}),O.length===0?P("p",{className:"text-slate-500 text-xs dark:text-slate-400",children:x}):P("div",{className:"flex flex-col gap-2",children:O.map(N=>{let w=ee(N.rawValue),H=N.fieldKey===D;return de("div",{className:"flex items-center justify-between rounded-lg border border-slate-200 bg-white px-3 py-2 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[de("div",{children:[P("div",{className:"font-medium text-slate-500 text-xs dark:text-slate-400",children:N.label}),P("div",{className:"text-slate-900 text-sm dark:text-slate-100",children:w?P("a",{href:w,className:"text-inherit underline-offset-2 hover:underline focus:underline focus:outline-none",children:P(ue,{text:N.value,query:t??"",enabled:a})}):P(ue,{text:N.value,query:t??"",enabled:a})})]}),H?de("span",{className:"inline-flex items-center gap-1 rounded-full bg-emerald-100 px-2 py-0.5 font-semibold text-[11px] text-emerald-700 transition-colors dark:bg-emerald-300/20 dark:text-emerald-200",children:[P(ws,{size:14}),n.preferred]}):null]},N.fieldKey)})})]},y))})},{value:"meta",label:n.detailTabMeta,content:de("div",{className:"flex flex-col gap-3",children:[P(on,{title:n.detailTabMeta}),P(qn,{items:b,searchTerm:t,enableHighlighting:a})]})}];return de("div",{className:`flex h-full min-h-0 w-full flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-950 ${l}`.trim(),style:u,children:[P("div",{className:"border-slate-200 border-b px-3 py-1.5 transition-colors dark:border-slate-700 dark:bg-slate-900/50",children:de("div",{className:"flex items-center gap-2",children:[P("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-blue-50 text-blue-600 transition-colors dark:bg-sky-900/40 dark:text-sky-300",children:P(Hs,{size:16})}),de("div",{className:"min-w-0 flex-1",children:[P("div",{className:"truncate font-semibold text-slate-900 text-sm dark:text-slate-100",children:P(ue,{text:j(e.full_name),query:t??"",enabled:a})}),P("div",{className:"truncate text-[11px] text-slate-600 dark:text-slate-300",children:P(ue,{text:v,query:t??"",enabled:a})})]})]})}),de(xa,{defaultValue:"summary",className:"flex flex-1 flex-col overflow-hidden",children:[P(Bt,{className:"flex gap-1.5 border-slate-200 border-b bg-slate-50 px-2 py-1 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:V.map(y=>P(mt,{value:y.value,className:"rounded-md px-1.5 py-0.5 font-semibold text-[11px] transition-colors data-[state=active]:bg-white data-[state=active]:text-blue-600 dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-sky-300",children:y.label},y.value))}),V.map(y=>P(gt,{value:y.value,className:"scrollbar-thin flex-1 overflow-y-auto px-2.5 py-2 transition-colors dark:text-slate-200",children:y.content},y.value))]})]})};dt();oe();import{memo as Bs}from"react";import{jsx as Ze,jsxs as Ca}from"react/jsx-runtime";var ln=Bs(({recordCount:e,companyCount:t,phase:a,loadedCount:s,totalCount:l,errorMessage:n,onRetry:r})=>{let{locale:d,labels:o}=fe(),u=G(d,e),m=G(d,t);return Ca("div",{"data-testid":"contact-map-annotation",className:"flex flex-wrap items-center gap-2 leading-1 transition-colors",role:"status",children:[Ca("span",{className:"flex items-baseline gap-1",children:[Ze("span",{className:"text-slate-600 dark:text-slate-300",children:o.annotationTotalLabel}),Ze("span",{className:"text-slate-800 dark:text-slate-200","data-testid":"contact-map-record-count",children:u}),Ze("span",{className:"text-slate-600 dark:text-slate-300",children:o.recordUnit(u)})]}),Ca("span",{className:"flex items-baseline gap-1",children:[Ze("span",{className:"text-slate-600 dark:text-slate-300",children:o.annotationCompaniesLabel}),Ze("span",{className:"text-slate-800 dark:text-slate-200","data-testid":"contact-map-company-count",children:m}),Ze("span",{className:"text-slate-600 dark:text-slate-300",children:o.companyUnit(m)})]}),a==="streaming"||a==="retrying"||a==="idle"?Ze("span",{"data-testid":"contact-map-stream-badge",className:"ml-2 inline-flex items-center gap-1.5 rounded-full bg-blue-50 px-2 py-0.5 font-medium text-blue-700 text-xs dark:bg-blue-900/30 dark:text-blue-300",children:l!==null&&l>0?o.annotationStreamingProgress({loaded:s,total:l,percent:Math.min(100,Math.round(s/l*100))}):o.annotationStreamingCount(s)}):null,a==="failed"||a==="auth-required"?Ca("span",{"data-testid":"contact-map-error-badge",className:"ml-2 inline-flex items-center gap-1.5 rounded-full bg-rose-50 px-2 py-0.5 font-medium text-rose-700 text-xs dark:bg-rose-900/30 dark:text-rose-300",title:n??void 0,children:["\u26D4 ",o.annotationLoadFailed(s),r?Ze("button",{type:"button","data-testid":"contact-map-retry-button",onClick:r,className:"rounded border border-rose-300 bg-white px-1.5 py-0.5 font-semibold text-rose-700 transition-colors hover:bg-rose-100 dark:border-rose-700 dark:bg-rose-950 dark:text-rose-200 dark:hover:bg-rose-900",children:o.annotationRetry}):null]}):null]})});ln.displayName="ContactMapAnnotation";import{useMemo as Nn}from"react";oe();import{createContext as Us,useContext as $s,useMemo as Vs}from"react";import{jsx as Qn}from"react/jsx-runtime";var Yn={streamEndpoint:"/api/contact_map/stream"},Xn=Us(Yn);function Jn({config:e,children:t}){let a=Vs(()=>({...Yn,...e}),[e]);return Qn(Xn.Provider,{value:a,children:Qn(Hn,{locale:a.locale,labels:a.labels,children:t})})}function et(){return $s(Xn)}import{useEffect as Xs,useMemo as Js,useSyncExternalStore as Zs}from"react";var Ks=1e3,js=3e4,Gs=6,qs="/api/contact_map/stream",Qs=e=>({...e,contacted_at:e.contacted_at?new Date(e.contacted_at):null,created_at:e.created_at?new Date(e.created_at):void 0,updated_at:e.updated_at?new Date(e.updated_at):void 0}),Ys=e=>Array.isArray(e.records),ka=class{constructor(t={}){this.recordMap=new Map;this.listeners=new Set;this.lastCursor=null;this.consecutiveFailures=0;this.started=!1;this.disposed=!1;this.activeController=null;this.wakeRetryWait=null;this.state={records:[],loadedCount:0,totalCount:null,isLoading:!0,isComplete:!1,phase:"idle",error:null};this.handleOnline=()=>{this.wakeRetryWait?.()};this.fetchFn=t.fetchFn??((...a)=>fetch(...a)),this.endpoint=t.endpoint??qs,this.initialRetryDelayMs=t.initialRetryDelayMs??Ks,this.maxRetryDelayMs=t.maxRetryDelayMs??js,this.maxConsecutiveFailures=t.maxConsecutiveFailures??Gs,this.logger=t.logger??Xe}getState(){return this.state}getRecordMap(){return this.recordMap}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}start(){this.started||this.disposed||(this.started=!0,typeof window<"u"&&window.addEventListener("online",this.handleOnline),this.runStreamLoop())}retry(){this.disposed||this.state.phase!=="failed"||(this.consecutiveFailures=0,this.setState({error:null,isLoading:this.recordMap.size===0}),this.runStreamLoop())}retryNow(){this.retry()}dispose(){this.disposed=!0,this.activeController?.abort(),this.wakeRetryWait?.(),typeof window<"u"&&window.removeEventListener("online",this.handleOnline)}setState(t){this.state={...this.state,...t};for(let a of this.listeners)a(this.state)}publishRecords(t={}){let a=Array.from(this.recordMap.values());this.setState({records:a,loadedCount:a.length,isLoading:!1,...t})}async runStreamLoop(){for(this.setState({phase:"streaming"});!this.disposed;){let t=await this.streamOnce();if(t==="aborted")return;if(t==="complete"){this.publishRecords({isComplete:!0,phase:"complete",error:null});return}if(t==="auth-required"){this.setState({phase:"auth-required",isLoading:!1,error:new Error("Authentication required")});return}if(this.consecutiveFailures+=1,this.consecutiveFailures>=this.maxConsecutiveFailures){this.setState({phase:"failed",isLoading:!1});return}let a=Math.min(this.initialRetryDelayMs*2**(this.consecutiveFailures-1),this.maxRetryDelayMs);if(this.setState({phase:"retrying",isLoading:this.recordMap.size===0}),this.logger.warn(`[ContactMapStream] retrying in ${a}ms (attempt ${this.consecutiveFailures})`),await this.waitBeforeRetry(a),this.disposed)return;this.setState({phase:"streaming"})}}waitBeforeRetry(t){return new Promise(a=>{let s=setTimeout(()=>{this.wakeRetryWait=null,a()},t);this.wakeRetryWait=()=>{clearTimeout(s),this.wakeRetryWait=null,a()}})}buildStreamUrl(){if(!this.lastCursor)return this.endpoint;let t=this.endpoint.includes("?")?"&":"?",a=new URLSearchParams;return this.lastCursor.contacted_at!==null&&a.set("cursor_contacted_at",this.lastCursor.contacted_at),a.set("cursor_person_id",String(this.lastCursor.person_id)),`${this.endpoint}${t}${a.toString()}`}async streamOnce(){this.activeController=new AbortController;try{let t=await this.fetchFn(this.buildStreamUrl(),{signal:this.activeController.signal,credentials:"same-origin"});if(t.status===401||t.status===403)return"auth-required";if(!(t.ok&&t.body))return this.logger.warn(`[ContactMapStream] unexpected response: ${t.status}`),"retryable";let a=t.body.getReader(),s=new TextDecoder,l="",n=!1,r=!1;for(;;){let{done:d,value:o}=await a.read();if(d)break;let u=s.decode(o,{stream:!0}),m=(l+u).split(`
2
- `);l=m.pop()??"";let c=!1;for(let i of m){let p=i.trim();if(!p)continue;let f;try{f=JSON.parse(p)}catch(v){this.logger.warn("[ContactMapStream] failed to parse NDJSON line:",v);continue}if("type"in f&&f.type==="METADATA"){typeof f.total=="number"&&Number.isFinite(f.total)&&this.setState({totalCount:f.total});continue}if(!Ys(f)){this.logger.warn("[ContactMapStream] server reported error:","error"in f?f.error:""),r=!0;continue}for(let v of f.records)v&&typeof v.person_id=="number"&&(this.recordMap.set(v.person_id,Qs(v)),c=!0);typeof f.total=="number"&&Number.isFinite(f.total)&&this.setState({totalCount:f.total}),f.nextCursor&&(this.lastCursor=f.nextCursor),f.isLast&&(n=!0)}c&&(this.consecutiveFailures=0,this.publishRecords({error:null}))}return r?(this.setState({error:new Error("Stream interrupted by server error")}),"retryable"):n?"complete":(this.setState({error:new Error("Stream ended before completion")}),"retryable")}catch(t){if(t instanceof Error&&t.name==="AbortError")return"aborted";let a=t instanceof Error?t:new Error(String(t));return this.setState({error:a}),"retryable"}finally{this.activeController=null}}};var Sa=null,Zn=e=>(Sa??(Sa=new ka({endpoint:e})),Sa),cd=()=>{Sa?.dispose(),Sa=null},er=()=>Zn().getRecordMap(),ei={records:[],loadedCount:0,totalCount:null,isLoading:!0,isComplete:!1,phase:"idle",error:null};function Ta(e){let t=et(),a=e??t.streamEndpoint??"/api/contact_map/stream",s=Js(()=>Zn(a),[a]);return Xs(()=>{s.start(),s.retry()},[s]),{...Zs(n=>s.subscribe(n),()=>s.getState(),()=>ei),retryNow:()=>s.retryNow()}}oe();import{DEFAULT_FUZZY_SEARCH_OPTIONS as Sn}from"@aiquants/fuzzy-search";import{useFuzzySearch as So}from"@aiquants/fuzzy-search/react";import To from"lucide-react/dist/esm/icons/search.js";import{useCallback as Yt,useEffect as $e,useMemo as bt,useRef as Wr,useState as Ve,useTransition as No}from"react";import{useNavigation as wo,useSearchParams as Po}from"react-router";en();import{useCallback as ht,useEffect as ti,useRef as tr}from"react";var tt=e=>{let t=tr(null),a=tr({isPointerDown:!1,isDragging:!1,startX:0,scrollLeft:0,pointerId:0,hasCapture:!1,didDrag:!1,pointerType:""}),s=e?.dragThreshold??4,l=ht(c=>{let i=c.currentTarget,p=c.deltaY;!i||p===0||(c.preventDefault(),i.scrollBy({left:p,behavior:"smooth"}))},[]),n=ht(c=>{t.current?.removeEventListener("wheel",l),t.current=c,c?.addEventListener("wheel",l,{passive:!1})},[l]);ti(()=>()=>{t.current&&t.current.removeEventListener("wheel",l)},[l]);let r=ht(c=>{if(c.pointerType==="touch")return;let i=a.current;i.isPointerDown=!0,i.isDragging=!1,i.startX=c.clientX,i.scrollLeft=c.currentTarget.scrollLeft,i.pointerId=c.pointerId,i.hasCapture=!1,i.pointerType=c.pointerType},[]),d=ht(c=>{let i=a.current;if(!i.isPointerDown||i.pointerType==="touch")return;let p=c.currentTarget,f=c.clientX-i.startX;!i.isDragging&&Math.abs(f)>s&&(i.isDragging=!0,i.hasCapture||(p.setPointerCapture?.(c.pointerId),i.hasCapture=!0)),i.isDragging&&(c.preventDefault(),p.scrollLeft=i.scrollLeft-f)},[s]),o=ht(c=>{let i=a.current;if(i.pointerType==="touch")return;let p=c.currentTarget;i.isPointerDown&&i.hasCapture&&p.hasPointerCapture?.(c.pointerId)&&p.releasePointerCapture(c.pointerId),i.isDragging&&(i.didDrag=!0,window.setTimeout(()=>{i.didDrag=!1},0)),i.isPointerDown=!1,i.isDragging=!1,i.pointerId=0,i.hasCapture=!1},[]),u=ht(c=>{o(c)},[o]),m=ht(c=>{a.current.didDrag&&(c.preventDefault(),c.stopPropagation(),a.current.didDrag=!1)},[]);return{setScrollableRef:n,onPointerDown:r,onPointerMove:d,onPointerUp:u,onPointerLeave:u,onPointerCancel:u,onClickCapture:m}};dt();oe();import{jsx as ar}from"react/jsx-runtime";function nr({value:e,max:t=100,className:a,indicatorClassName:s,...l}){let n=e===void 0,r=n?0:Math.min(100,Math.max(0,e/t*100));return ar("div",{role:"progressbar","aria-valuenow":n?void 0:r,"aria-valuemin":0,"aria-valuemax":100,"data-slot":"progress",className:ut("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",a),...l,children:ar("div",{"data-slot":"progress-indicator",className:ut("h-full rounded-full bg-primary transition-[width] duration-300 ease-in-out will-change-transform",n&&"w-1/3 animate-progress-indeterminate",s),style:n?void 0:{width:`${r}%`}})})}import{useCallback as co,useState as po}from"react";import{useSearchParams as uo}from"react-router";oe();pt();import{Panel as cr,PanelGroup as hi,PanelResizeHandle as fi}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as bi,VirtualScroll as yi}from"@aiquants/virtualscroll";import{lazy as xi,memo as vi,Suspense as Ci,useCallback as Ue,useEffect as mr,useLayoutEffect as gr,useMemo as Kt,useRef as jt,useState as Ra}from"react";var Ut={listPanelMinWidth:320,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35},$t={listPanelMinWidth:280,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35};function Na(e){let t=e.listPanelMinWidth+e.detailPanelMinWidth+e.handleThickness+e.listPaddingAndBorder+e.detailPaddingAndBorder,a=t+e.scrollbarSafetyBuffer,s=a+e.hysteresisSafetyMargin,l=s-a;return{physicalMinWidth:t,collapseThreshold:a,expandThreshold:s,hysteresisWidth:l}}import{useCallback as ai,useEffect as ni,useState as ri}from"react";var rr=(e,t)=>{let{enableMutationObserver:a=!1,bottomGap:s=4,minFallbackHeight:l=240}=t??{},[n,r]=ri(600),d=ai(()=>{if(typeof window>"u")return;let o=e.current;if(!o||o.offsetParent===null&&window.getComputedStyle(o).position!=="fixed")return;let u=x=>Number.parseFloat(x)||0,{top:m}=o.getBoundingClientRect(),c=o.parentElement?.getBoundingClientRect(),i=window.getComputedStyle(document.documentElement),p=u(i.getPropertyValue("--footer-height")),f=u(i.getPropertyValue("--header-height")),v=u(i.getPropertyValue("--scrollbar-height")),S=window.getComputedStyle(o),C=u(S.marginBottom),F=u(S.paddingBottom),k=window.innerHeight-p-v-s,b=c?Math.min(c.bottom,k):k,g=c?Math.max(c.top,f):f,E=Math.max(m,g),V=b-E-C-F,y=Number.isFinite(V)?Math.floor(V):0,h=y>0?y:l;h>0&&Number.isFinite(h)&&r(x=>Math.abs(x-h)>1?h:x)},[s,e,l]);return ni(()=>{if(typeof window>"u")return;let o=null,u=null,m=null,c=null,i=()=>{o!==null&&window.cancelAnimationFrame(o),o=window.requestAnimationFrame(()=>{d()})};i(),u=window.setTimeout(()=>{i()},150);let p=e.current;return typeof ResizeObserver<"u"&&p&&(m=new ResizeObserver(()=>{i()}),m.observe(p),p.parentElement&&m.observe(p.parentElement)),a&&typeof MutationObserver<"u"&&(c=new MutationObserver(()=>{i()}),c.observe(document.body,{attributes:!0,childList:!0,subtree:!0})),window.addEventListener("resize",i),()=>{o!==null&&window.cancelAnimationFrame(o),u!==null&&window.clearTimeout(u),m&&m.disconnect(),c&&c.disconnect(),window.removeEventListener("resize",i)}},[e,a,d]),{viewportHeight:n,updateViewportHeight:d}};import{useCallback as at,useEffect as sr,useRef as Vt,useState as ir}from"react";var si=600,or=8,wa=({ref:e,onSelect:t,resolveItem:a,item:s})=>{let[l,n]=ir(!1),[r,d]=ir(null),o=Vt(null),u=Vt(!1),m=Vt(!1),c=Vt(null),i=Vt({onSelect:t,resolveItem:a,item:s});sr(()=>{i.current={onSelect:t,resolveItem:a,item:s}},[t,a,s]);let p=at(()=>{typeof window>"u"||o.current!==null&&(window.clearTimeout(o.current),o.current=null)},[]),f=at(()=>{c.current&&(p(),m.current=!1,c.current=null)},[p]),v=at(g=>{typeof window>"u"||g.button!==0&&g.pointerType==="mouse"||(p(),m.current=!1,u.current=!1,c.current={x:g.clientX,y:g.clientY,pointerId:g.pointerId},o.current=window.setTimeout(()=>{let E=i.current,V=null;E.item!==void 0?V=E.item:E.resolveItem&&g.target&&(V=E.resolveItem(g.target)),V!==null&&(u.current=!0,E.onSelect?.(V),d(V),n(!0)),f()},si))},[p,f]),S=at(g=>{c.current&&g.pointerId===c.current.pointerId&&(p(),c.current=null,m.current=!1)},[p]),C=at(g=>{u.current&&(g.preventDefault(),g.stopPropagation(),u.current=!1)},[]),F=at(g=>{if(!c.current||g.pointerId!==c.current.pointerId)return;let E=Math.abs(g.clientX-c.current.x),V=Math.abs(g.clientY-c.current.y);(E>or||V>or)&&(p(),c.current=null)},[p]),k=at(g=>{(l||o.current!==null)&&(g.preventDefault(),g.stopPropagation())},[l]),b=at(g=>{g?.cancelLongPressTimer&&p(),g?.suppressLongPress&&(m.current=!0),n(!1),d(null),u.current=!1,c.current=null},[p]);return sr(()=>{let g=e.current;if(!(g&&typeof window<"u"))return;let E=[["pointerdown",v,void 0],["pointerup",S,void 0],["pointercancel",S,void 0],["pointermove",F,void 0],["pointerleave",S,void 0],["click",C,!0],["contextmenu",k,void 0]],V=[["contextmenu",k,!0],["pointerup",S,!0],["pointercancel",S,!0]];for(let[y,h,x]of E)g.addEventListener(y,h,x);for(let[y,h,x]of V)window.addEventListener(y,h,x);return()=>{for(let[y,h,x]of E)g.removeEventListener(y,h,x);for(let[y,h,x]of V)window.removeEventListener(y,h,x);p()}},[e,v,S,F,C,k,p]),{isPopupVisible:l,popupItem:r,handleClosePopup:b}};import{useCallback as ii,useEffect as oi,useState as lr,useSyncExternalStore as li}from"react";function Pa(e,t,a){let s=a?.mediaQuery??"(min-width: 1024px)",l=li(ii(m=>{if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};let c=window.matchMedia(s);return c.addEventListener("change",m),()=>c.removeEventListener("change",m)},[s]),()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(s).matches:!0,()=>!1),[n,r]=lr(!1),[d,o]=lr(0);return oi(()=>{if(typeof window>"u"||typeof ResizeObserver>"u")return;let m=e.current;if(!m)return;let c=new ResizeObserver(i=>{for(let p of i){if(p.target!==m)continue;let f=0;p.borderBoxSize&&p.borderBoxSize.length>0?f=p.borderBoxSize[0].inlineSize:f=p.contentRect.width,!(!Number.isFinite(f)||f<=0)&&(o(f),r(v=>v&&f>=t.expandThreshold?!1:!v&&f<t.collapseThreshold?!0:v))}});return c.observe(m),()=>c.disconnect()},[e,t.collapseThreshold,t.expandThreshold]),{isTwoColumn:l&&!n,isContainerNarrow:n,isMediaMatches:l,containerWidth:d}}oe();oe();import{useSwipeToDismissOverlay as di,useTapClick as ci}from"@aiquants/swipe-overlay";import{useCallback as pi,useEffect as ui,useRef as mi}from"react";import{jsx as dr,jsxs as gi}from"react/jsx-runtime";var La=({isOpen:e,onClose:t,children:a,className:s="",title:l})=>{let n=q(),r=mi(null),{overlayRef:d,overlayStyle:o,attemptClose:u}=di({isOpen:e,onClose:t,isCloseBlocked:pi(()=>!1,[]),skipWhenTextSelected:!0}),m=ci(()=>u());return ui(()=>{!e&&r.current?.contains(document.activeElement)&&document.activeElement.blur()},[e]),e?gi("div",{ref:r,"data-testid":"contact-map-mobile-overlay",className:`fixed top-0 bottom-0 left-0 z-50 flex touch-manipulation transition-[visibility] duration-200 ${e?"pointer-events-auto visible":"pointer-events-none invisible"}`,style:{right:"var(--aqcm-overlay-right, var(--aiquants-menu-pinned-width, 0px))",transition:"right 0.5s, visibility 0.2s"},"aria-hidden":!e,children:[dr("button",{type:"button","aria-label":n.overlayBackdrop,className:`absolute inset-0 touch-manipulation bg-slate-900/50 transition-opacity duration-200 focus:outline-none ${e?"opacity-100":"opacity-0"}`,...m}),dr("aside",{role:"dialog","aria-modal":"true","aria-label":l===void 0?n.overlayTitle:l,style:o,ref:d,className:`relative ml-auto flex h-full w-full max-w-lg transform touch-pan-y flex-col bg-white shadow-xl transition-transform duration-200 ease-out dark:bg-slate-900 ${s}`,onKeyDown:c=>{c.key==="Escape"&&(c.stopPropagation(),u())},children:a})]}):null};Za();import{Fragment as Wi,jsx as W,jsxs as ve}from"react/jsx-runtime";var ki=xi(async()=>({default:(await Promise.resolve().then(()=>(jn(),Kn))).default})),hr=64,pr="h-[64px]",ur=240,Si=4,dn=Na(Ut),Ti=Ut.listPanelMinWidth,Ni=Ut.detailPanelMinWidth,wi=Ut.handleThickness,Bd=dn.collapseThreshold,Ud=dn.expandThreshold,Pi=({contactData:e})=>{let t=q(),a=e?.full_name??t.noName,s=e?.title??"-",l=e?.company_name??"-",n=e?.department??"-",r=e?.email??"-",d=e?.company_phone_number??e?.mobile_phone_number??"-",o=e?.updated_at?Pe(e.updated_at):"-";return W(ga,{fullName:a,title:s,companyName:l,department:n,phoneNumber:d,email:r,updatedAtText:o})},Li=e=>({"--contact-panel-height":`${e}px`}),Ri=e=>typeof e=="object"&&e!==null&&"item"in e,Mi=(e,t)=>t!==void 0?`${e}:${t.toFixed(3)}`:void 0,Ei=(e,t)=>{for(let a of e){let s=ca(a);if(s?.person_id===t)return s}return null},cn=(e,t,a)=>{let{viewportHeight:s}=rr(t,{enableMutationObserver:!0,bottomGap:Si,minFallbackHeight:ur}),[l,n]=Ra(0),r=Ue(()=>{let c=a.current,i=t.current;if(!(c&&i))return;let p=c.getBoundingClientRect(),f=i.getBoundingClientRect(),v=Math.ceil(f.top-p.top);Number.isFinite(v)&&v>0&&n(S=>Math.abs(S-v)>1?v:S)},[t,a]);gr(()=>{if(!e)return;r();let c=requestAnimationFrame(r);return window.addEventListener("resize",r),()=>{cancelAnimationFrame(c),window.removeEventListener("resize",r)}},[e,r]);let d=s>0?s:ur,o=l>0?l:0,u=d+o,m=Kt(()=>Li(u),[u]);return{normalizedViewportHeight:d,normalizedDetailHeight:u,panelSizingStyle:m}},Oi=new Set,Di=()=>{let[e,t]=Ra(Oi),a=Ue((s,l)=>{t(n=>{if(n.has(s)===l)return n;let r=new Set(n);return l?r.add(s):r.delete(s),r})},[]);return{isAnyPopupVisible:e.size>0,handlePopupVisibilityChange:a}},Hi=(e,t,a)=>{let s=jt(a);gr(()=>{s.current=a},[a]),mr(()=>{if(e!==null)return s.current(e,t),()=>{s.current(e,!1)}},[e,t])},fr=vi(({entry:e,index:t,selectedPersonId:a,onSelect:s,searchTerm:l,enableHighlighting:n,openEmailsWithGmail:r,openGmailCompose:d,onPopupVisibilityChange:o})=>{let u=q(),m=jt(null),c=W("div",{className:pr}),i=Ri(e)?e:null,p=ca(e),{isPopupVisible:f,handleClosePopup:v}=wa({ref:m,onSelect:s,item:p?.person_id});if(Hi(p?.person_id??null,f,o),!e||!p)return c;let{person_id:S}=p,C=a===S,F=t%2===0?"bg-white dark:bg-slate-900":"bg-gray-50 dark:bg-slate-900/70",b=C?"border-blue-300 bg-blue-50 ring-1 ring-blue-200 dark:border-blue-500 dark:bg-blue-500/20 dark:ring-blue-500/40":F,g=["B","F"].map(E=>Mi(E,E==="B"?i?.baseScore:i?.score)).filter(Boolean);return ve("div",{ref:m,className:`flex ${pr} w-full items-center overflow-hidden border-gray-200 border-b px-4 py-2 text-left transition-colors hover:bg-blue-50 dark:border-slate-700 dark:hover:bg-blue-500/10 ${b}`,style:{height:hr},role:"button","aria-pressed":C,"data-selected":C?"true":"false",onClick:()=>s(S),children:[ve("div",{className:"hidden w-28 shrink-0 flex-col items-center gap-0.5 text-center sm:flex",children:[W("div",{className:"whitespace-nowrap font-medium text-slate-700 text-xs leading-tight dark:text-slate-200",children:u.listRowNumber(t+1)}),W("div",{className:"truncate text-[11px] text-slate-700 leading-tight dark:text-slate-200",children:S}),W("div",{className:"flex items-center gap-1 whitespace-nowrap font-mono text-[11px] text-slate-600 leading-tight dark:text-slate-300",children:g.length?g.map(E=>W("span",{children:E},E)):W("span",{children:"-"})})]}),W(Ci,{fallback:W(Pi,{contactData:p}),children:W(ki,{contactData:p,searchTerm:l,enableHighlighting:n,openEmailsWithGmail:r,openGmailCompose:d,isPopupVisible:f,onRequestClose:v})})]})});fr.displayName="ContactListRow";var br=({context:e})=>{let{contactMapRecords:t,filteredItems:a,searchTerm:s,hasSearchTerm:l,enableHighlighting:n,openEmailsWithGmail:r,isSearchTabActive:d}=e,{locale:o,labels:u,engineLabels:m}=fe(),c=jt(null),i=jt(null),[p,f]=Ra(null),{normalizedViewportHeight:v,panelSizingStyle:S}=cn(d,i,c),{isAnyPopupVisible:C,handlePopupVisibilityChange:F}=Di(),k=Kt(()=>({enablePointerDrag:!C,enableKeyboardNavigation:!C}),[C]),b=Kt(()=>l?a:t,[l,a,t]),g=Ue(ie=>{f(ie)},[]),E=Ue(ie=>{if(!r)return;let ne=ie.trim();if(!ne||ne==="-"||typeof window>"u")return;let rt=Be(ne,!0);rt&&window.open(rt,"_blank","noopener,noreferrer")},[r]),[V,y]=Ra(!1),h=Ue(ie=>{g(ie),y(!0)},[g]),x=Ue((ie,ne)=>W(fr,{entry:ie,index:ne,selectedPersonId:p,onSelect:h,searchTerm:s,enableHighlighting:n,openEmailsWithGmail:r,openGmailCompose:E,onPopupVisibilityChange:F}),[p,h,s,n,r,E,F]),O=Ue(ie=>b[ie],[b]),D=Ue(ie=>ca(b[ie])?.person_id??`row-${ie}`,[b]),ee=Ue(()=>hr,[]),N=b.length,w=Kt(()=>({enabled:!0,renderVisual:bi}),[]),H=Kt(()=>p===null?null:Ei(b,p),[p,b]);mr(()=>{p!==null&&!H&&f(null)},[p,H]);let B=jt(null),{isTwoColumn:ae}=Pa(B,dn),me=ve("div",{ref:c,className:"flex min-h-0 flex-1 flex-col gap-1",children:[W("div",{className:"hidden rounded-t-lg border border-gray-200 bg-gray-50 px-4 py-2 transition-colors sm:block dark:border-slate-700 dark:bg-slate-900/70",children:ve("div",{className:"flex items-center",children:[ve("div",{className:"flex w-28 shrink-0 flex-col items-center gap-0.5 text-center text-[11px] text-slate-700 uppercase tracking-wider dark:text-slate-200",children:[W("span",{className:"font-semibold text-slate-900 text-xs dark:text-slate-100",children:u.columnNo}),W("span",{className:"leading-tight",children:u.columnId}),W("span",{className:"whitespace-nowrap leading-tight",children:u.columnScore})]}),ve("div",{className:"hidden w-full grid-cols-3 gap-2 font-medium text-slate-700 text-xs uppercase tracking-wider transition-colors sm:grid xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto] dark:text-slate-200",children:[ve("div",{className:"flex flex-col gap-0.5",children:[W("span",{children:u.columnName}),W("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:u.columnTitle})]}),ve("div",{className:"flex flex-col gap-0.5",children:[W("span",{children:u.columnCompany}),W("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:u.columnDepartment})]}),ve("div",{className:"flex flex-col gap-0.5",children:[W("span",{children:u.columnPhone}),W("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:u.columnEmail})]}),W("div",{className:"hidden items-end justify-end xl:flex",children:W("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:u.columnUpdatedAt})})]})]})}),W("div",{ref:i,className:"flex-1",children:W(yi,{itemCount:N,getItemKey:D,behaviorOptions:k,getItem:O,getItemHeight:ee,viewportSize:v,overscanCount:10,scrollBarOptions:{width:8,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:w},locale:o,labels:m,className:"w-full rounded-b-lg border border-gray-200 border-t-0 bg-white pr-0.75 transition-colors dark:border-slate-700 dark:bg-slate-950",children:(ie,ne)=>x(ie,ne)})}),a.length===0&&l?W("div",{className:"py-8 text-center",children:W("p",{className:"text-slate-600 dark:text-slate-300",children:u.listNoSearchResults})}):null,N===0&&!l?W("div",{className:"py-8 text-center",children:W("p",{className:"text-slate-600 dark:text-slate-300",children:u.listNoData})}):null]});return W("div",{ref:B,"data-testid":"contact-map-list-root",className:"flex min-h-0 flex-1 flex-col",style:S,children:ae?ve(hi,{id:"contact-map-list-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-list-panel-group",children:[W(cr,{id:"contact-map-list-pane",defaultSize:{value:68,unit:"percentage"},minSize:{value:Ti,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:me}),W(fi,{id:"contact-map-list-handle",thickness:wi,indicator:{visible:!0,thickness:6,length:32,barThickness:2,barLength:16},className:"cursor-col-resize rounded transition-colors hover:bg-slate-200/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-1 dark:hover:bg-slate-700/60","aria-label":u.listResizeHandle}),W(cr,{id:"contact-map-list-detail-pane",defaultSize:{value:32,unit:"percentage"},minSize:{value:Ni,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:W(Je,{contact:H,searchTerm:s,enableHighlighting:n})})]}):ve(Wi,{children:[me,W("div",{className:"hidden","aria-hidden":"true",children:W(Je,{contact:H,searchTerm:s,enableHighlighting:n})}),H?W(La,{isOpen:V,onClose:()=>y(!1),className:"z-50 bg-white dark:bg-slate-900",children:ve("div",{className:"flex h-full flex-col overflow-hidden p-3 sm:p-4",children:[ve("div",{className:"mb-2 flex items-center justify-between border-b pr-10 pb-2 dark:border-slate-700",children:[W("h3",{className:"font-semibold text-slate-900 text-sm dark:text-slate-100",children:u.detailHeading}),W("button",{type:"button",onClick:()=>y(!1),className:"rounded px-2.5 py-1 font-medium text-slate-600 text-xs hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800",children:u.close})]}),W("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",style:{height:"100%"},children:W(Je,{contact:H,searchTerm:s,enableHighlighting:n})})]})}):null]})})};pt();import{DirectoryTree as Ki}from"@aiquants/directory-tree";import{Panel as kr,PanelGroup as ji,PanelResizeHandle as Gi}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as qi}from"@aiquants/virtualscroll";import Qi from"@heroicons/react/24/solid/FolderMinusIcon.js";import Yi from"@heroicons/react/24/solid/FolderPlusIcon.js";import{useCallback as He,useEffect as ft,useMemo as Me,useRef as Oa,useState as nt}from"react";import{createPortal as Xi}from"react-dom";var pn=(e,t)=>e&&e.trim()||t;import{useEffect as _i,useRef as Ma,useState as Ii}from"react";var yr=(e,t=250)=>{let[a,s]=Ii(e),l=Ma(null),n=Ma(e),r=Ma(null),d=Ma(!1);return _i(()=>{if(!d.current){d.current=!0,s(e),n.current=e;return}n.current=a,l.current=null;let o=u=>{l.current??(l.current=u);let m=u-l.current,c=Math.min(1,Math.max(0,m/t)),i=1-(1-c)**3,p=Math.max(0,Math.round(n.current+(e-n.current)*i));s(p),c<1&&(r.current=requestAnimationFrame(o))};return r.current=requestAnimationFrame(o),()=>{r.current!==null&&cancelAnimationFrame(r.current)}},[e,t]),Math.max(0,a)};import{useEffect as Ai,useMemo as xr,useSyncExternalStore as Fi}from"react";oe();var zi=250,Bi=4e3,vr=3,Ui=(e,t)=>e.uncategorizedCompany===t.uncategorizedCompany&&e.unnamedPerson===t.unnamedPerson,Ea=class{constructor(t){this.worker=null;this.generation=0;this.postedCount=0;this.latestSnapshot=null;this.workerNeedsReset=!1;this.lastSyncedRecords=[];this.postedNaming=null;this.lastSyncedNaming=null;this.consecutiveFailures=0;this.finalizeRequested=!1;this.retryTimer=null;this.listeners=new Set;this.state={snapshot:null,isBuilding:!1};this.getState=()=>this.state;this.subscribe=t=>(this.listeners.add(t),()=>this.listeners.delete(t));this.handleMessage=t=>{let a=t.data;a.type!=="TREE_CHUNK"||a.generation!==this.generation||a.uniquePersonCount===0&&this.postedCount>0&&(this.latestSnapshot?.uniquePersonCount??0)>0||this.latestSnapshot!==null&&a.uniquePersonCount<this.latestSnapshot.uniquePersonCount&&!(a.isIdle&&a.consumedRecords>=this.postedCount)||(a.isIdle&&a.consumedRecords>=this.postedCount&&(this.consecutiveFailures=0),this.latestSnapshot={tree:a.tree,directoryPaths:a.directoryPaths,consumedRecords:a.consumedRecords,uniquePersonCount:a.uniquePersonCount,isIdle:a.isIdle,rebuildEpoch:a.rebuildEpoch},this.updateState())};this.handleFailure=t=>{if(this.worker?.terminate(),this.worker=null,this.postedCount=0,this.workerNeedsReset=!0,this.consecutiveFailures+=1,this.updateState(),this.consecutiveFailures>=vr)return;let a=Math.min(zi*2**(this.consecutiveFailures-1),Bi);this.retryTimer!==null&&clearTimeout(this.retryTimer),this.retryTimer=setTimeout(()=>{this.retryTimer=null;let s=this.lastSyncedNaming;s!==null&&(this.syncRecords(this.lastSyncedRecords,s),this.finalizeRequested&&this.finalize())},a)};this.workerFactory=t}updateState(){let t=this.postedCount>(this.latestSnapshot?.consumedRecords??0);this.state.snapshot===this.latestSnapshot&&this.state.isBuilding===t||(this.state={snapshot:this.latestSnapshot,isBuilding:t},this.notify())}notify(){for(let t of this.listeners)t()}ensureWorker(){if(this.consecutiveFailures>=vr)return null;if(!this.worker)try{this.worker=this.workerFactory(),this.worker.onerror=this.handleFailure,this.worker.onmessageerror=this.handleFailure,this.worker.onmessage=this.handleMessage}catch(t){return this.handleFailure(t),null}return this.worker}syncRecords(t,a){this.lastSyncedRecords=t,this.lastSyncedNaming=a;let s=this.ensureWorker();if(!s)return;let l=this.postedNaming===null||!Ui(this.postedNaming,a);if((this.workerNeedsReset||l||t.length<this.postedCount)&&(this.generation+=1,this.postedCount=0,this.workerNeedsReset=!1,this.postedNaming=a,s.postMessage({type:"RESET_TREE",generation:this.generation,epochBase:this.latestSnapshot?.rebuildEpoch??0,naming:a}),this.updateState()),t.length>this.postedCount){let n=t.slice(this.postedCount);this.postedCount=t.length,s.postMessage({type:"APPEND_RECORDS",generation:this.generation,records:n}),this.updateState()}}finalize(){this.finalizeRequested=!0,this.worker&&this.worker.postMessage({type:"FINALIZE_TREE",generation:this.generation})}dispose(){this.retryTimer!==null&&clearTimeout(this.retryTimer),this.worker?.terminate(),this.worker=null,this.listeners.clear(),this.latestSnapshot=null,this.postedCount=0,this.workerNeedsReset=!1,this.lastSyncedRecords=[],this.postedNaming=null,this.lastSyncedNaming=null,this.consecutiveFailures=0,this.finalizeRequested=!1,this.state={snapshot:null,isBuilding:!1}}},$i=e=>{if(e)return new Worker(e,{type:"module"});let t=typeof import.meta<"u"?import.meta.url:void 0;if(t){let s=t.includes(".ts")?"../workers/treeWorker.ts":"./worker/treeWorker.mjs";return new Worker(new URL(s,t),{type:"module"})}throw new Error("Tree Worker requires workerUrl or ESM import.meta.url")},Gt=null,un=(e,t)=>{if(!Gt){let a=e??(()=>$i(t));Gt=new Ea(a)}return Gt},Xd=(e,t)=>{un().syncRecords(e,t)},Jd=()=>{un().finalize()},Zd=()=>{Gt?.dispose(),Gt=null},Vi={snapshot:null,isBuilding:!1};function Cr(e,t=!1){let a=et(),s=a.treeWorkerFactory,l=a.workerUrls?.treeWorker,{labels:n}=fe(),r=n.uncategorizedCompany,d=n.noName,o=xr(()=>({uncategorizedCompany:r,unnamedPerson:d}),[r,d]),u=xr(()=>s?new Ea(s):un(void 0,l),[s,l]);return Ai(()=>{u.syncRecords(e,o),t&&u.finalize()},[u,e,t,o]),Fi(u.subscribe,u.getState,()=>Vi)}oe();Ja();ba();import{Fragment as lo,jsx as _,jsxs as ge}from"react/jsx-runtime";var hn=Na($t),Ji=$t.listPanelMinWidth,Zi=$t.detailPanelMinWidth,eo=$t.handleThickness,Sc=hn.collapseThreshold,Tc=hn.expandThreshold,to=(e,t)=>{let{searchTerm:a,enableHighlighting:s}=t,l=pn(e.full_name,t.noName),n=pn(e.title,""),r=_(ue,{text:l,query:a,enabled:s});return n?ge("span",{className:"flex items-center gap-1.5",children:[_("span",{children:r}),_("span",{className:"text-slate-400 text-xs dark:text-slate-500",children:_(ue,{text:n,query:a,enabled:s})})]}):r},ao="contact-map-tree h-full w-full",no={hoverClassName:"bg-slate-100/70 dark:bg-slate-800/60",directorySelectedClassName:"bg-sky-100/55 dark:bg-sky-900/40 [&_.directory-tree-name]:text-sky-700 dark:[&_.directory-tree-name]:text-sky-300",itemSelectedClassName:"bg-sky-100/70 dark:bg-sky-900/55 [&_.directory-tree-name]:text-sky-700 dark:[&_.directory-tree-name]:text-sky-300"},mn="h-4 w-4 shrink-0 transition-colors duration-150",ro=(e,t,a)=>({...e,viewportHeightOverride:t,behaviorOptions:{...e.behaviorOptions,enablePointerDrag:!a,enableKeyboardNavigation:!a}}),Da=null,Sr=null,qt=new Map,Tr="",Nr=null,so=(e,t,a,s,l)=>{let n=`${a?"icons":"plain"}#${s}#${l.noName}`;(n!==Tr||l.formatDirectoryName!==Nr)&&(qt.clear(),Tr=n,Nr=l.formatDirectoryName);let r={entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},d=new Set;for(let o of e){d.add(o.absolutePath);let u=`${o.name}\0${o.memberCount}`,m=qt.get(o.absolutePath);(!m||m.signature!==u)&&(m={signature:u,result:Pr([o],t,a,{searchTerm:"",enableHighlighting:!1,noName:l.noName,formatDirectoryName:l.formatDirectoryName})},qt.set(o.absolutePath,m));let c=m.result;c.entries.length>0&&r.entries.push(c.entries[0]);for(let[i,p]of c.personPathMap){let f=r.personPathMap.get(i);if(f)for(let v of p)f.add(v);else r.personPathMap.set(i,new Set(p))}for(let[i,p]of c.contactByPath)r.contactByPath.set(i,p);for(let[i,p]of c.ancestorsByPath)r.ancestorsByPath.set(i,p);r.totalCount+=c.totalCount,!r.firstPerson&&c.firstPerson&&(r.firstPerson=c.firstPerson)}for(let o of qt.keys())d.has(o)||qt.delete(o);return r},gn=e=>e.isSelected||e.isItemSelected?"text-sky-600 dark:text-sky-300":e.isExpanded&&e.isDirectory?"text-slate-600 dark:text-slate-200":"text-slate-500 dark:text-slate-400",wr=e=>{let t=[];for(let a of e)a.type==="directory"&&(t.push(a.absolutePath),a.children&&t.push(...wr(a.children)));return t},io=e=>{if(e.memberCount===void 0)throw new Error(`[contact-map] directory entry ${e.absolutePath} has no memberCount`);return e.memberCount},Pr=(e,t,a,s,l)=>{let n=new Map,r=new Map,d=new Map,o=0,u=null,m=(i,p)=>{let f=[...p,i.absolutePath];d.set(i.absolutePath,f);let v,S,C=i.type==="directory"?s.formatDirectoryName(i.name,io(i)):i.name,F=_(ue,{text:C,query:s.searchTerm,enabled:s.enableHighlighting});if(i.type==="file"&&i.personId){if(l&&!l.has(i.personId))return null;let k=t.get(i.personId);if(k){r.set(i.absolutePath,k),n.has(i.personId)||n.set(i.personId,new Set);let b=n.get(i.personId);b&&b.add(i.absolutePath),o++,u||(u={personId:i.personId,path:i.absolutePath}),a&&(S=g=>{let E=gn(g);return g.isSelected||g.isItemSelected||i.isPrimary&&(E=i.title?"text-indigo-600 dark:text-indigo-400":"text-orange-500 dark:text-orange-400"),_(a.person,{"aria-hidden":"true",className:`${mn} ${E}`})},i.title&&(F=to(k,s))),F=_("span",{"data-contact-path":i.absolutePath,className:"block w-full",children:F})}}else if(i.children){let k=i.children.map(b=>m(b,f)).filter(b=>b!==null);if(l&&k.length===0)return null;if(v=k,a){let b=i.relativePath.startsWith("company:")?a.company:a.department;S=g=>_(b,{"aria-hidden":"true",className:`${mn} ${gn(g)}`})}}return{name:C,label:F,type:i.type,absolutePath:i.absolutePath,relativePath:i.relativePath,icon:S,children:v}};return{entries:e.map(i=>m(i,[])).filter(i=>i!==null),personPathMap:n,contactByPath:r,ancestorsByPath:d,firstPerson:u,totalCount:o}},oo=(e,t,a)=>{let s=new Set,l=new Set,n=new Map;t.forEach((m,c)=>{n.set(m.item.person_id,c)});for(let m of t){let c=m.item.person_id,i=e.personPathMap.get(c);if(i)for(let p of i){s.add(p);let f=e.ancestorsByPath.get(p);if(f){for(let v of f)s.add(v);a&&f.length>0&&l.add(f[0])}}}let r=new Map,d=m=>{let c=r.get(m.absolutePath);if(c!==void 0)return c;let i=1/0;if(m.type==="file"){let p=e.contactByPath.get(m.absolutePath);p&&(i=n.get(p.person_id)??1/0)}else if(m.children)for(let p of m.children)i=Math.min(i,d(p));return r.set(m.absolutePath,i),i},o=(m,c=0)=>m.filter(i=>a&&c===0&&l.has(i.absolutePath)?!0:s.has(i.absolutePath)).map(i=>a&&c===0&&l.has(i.absolutePath)?i:i.type==="directory"&&i.children?{...i,children:o(i.children,c+1)}:i).sort((i,p)=>c===0?d(i)-d(p):0),u=o(e.entries);return{...e,entries:u}},Lr=({context:e,controlsContainer:t})=>{let{contactMapRecords:a,filteredItems:s,hasSearchTerm:l,isSearchInProgress:n,isSearchTabActive:r}=e,{locale:d,labels:o,treeLabels:u}=fe(),m=o.noName,c=o.treeDirectoryName,i=Me(()=>({noName:m,formatDirectoryName:c}),[m,c]),[p,f]=nt(null),[v,S]=nt(!1),{snapshot:C,isBuilding:F}=Cr(a),k=C?.tree??null,b=er(),g=C?.rebuildEpoch??0,E=Me(()=>k?so(k,b,p,g,i):null,[k,b,p,g,i]),V=Me(()=>{if(!k)return null;if(!l)return E;let R;v||(R=new Set(s.map(Y=>Y.item.person_id)));let U=Pr(k,b,p,{...i,searchTerm:e.searchTerm,enableHighlighting:e.enableHighlighting},R);return oo(U,s,v)},[k,E,b,p,e.searchTerm,e.enableHighlighting,l,s,v,i]),y=Me(()=>V||{entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},[V]),h=l&&e.errorMessage!==null,[x,O]=nt(y),D=Oa(!1);ft(()=>{if(!(n||h)){D.current=!!k,O(y);return}!D.current&&k&&y.entries.length>0&&(D.current=!0,O(y))},[y,k,n,h]);let ee=l&&(n||h)?x:y,{entries:N,personPathMap:w,contactByPath:H,totalCount:B}=ee,ae=Me(()=>wr(N),[N]),[me,ie]=nt(()=>Sr??new Set),ne=He(R=>!me.has(R),[me]),rt=He(R=>{ie(U=>{let Y=new Set(U);return Y.has(R)?Y.delete(R):Y.add(R),Y})},[]),yt=He(R=>{R.length!==0&&ie(U=>{let Y=new Set(U);for(let we of R)Y.add(we);return Y})},[]),xt=He(R=>{ie(U=>{if(U.size===0)return U;let Y=!1,we=new Set(U);for(let St of R)we.delete(St)&&(Y=!0);return Y?we:U})},[]);ft(()=>{Sr=me},[me]),ft(()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem("contact-map.tree-expanded")}catch{}},[]);let[Ee,Xt]=nt(null),[pe,vt]=nt(null),[Jt,J]=nt(!1),[Zt,Ie]=nt(!1),Ae=Oa(null),ye=Oa(null),{normalizedViewportHeight:Et,panelSizingStyle:Wa}=cn(r,ye,Ae),ke=He(R=>{let U=H.get(R);U&&(Ee!==U.person_id&&Xt(U.person_id),R!==pe&&vt(R),J(!0))},[H,pe,Ee]),ea=He(R=>{ke(R.entry.absolutePath)},[ke]),Ct=He(R=>R instanceof Element?R.closest("[data-contact-path]")?.getAttribute("data-contact-path")??null:null,[]),{isPopupVisible:Ke,popupItem:st,handleClosePopup:Ot}=wa({ref:ye,resolveItem:Ct,onSelect:ke}),Dt=He(R=>{if(!e.openEmailsWithGmail)return;let U=R.trim();if(!U||U==="-"||typeof window>"u")return;let Y=Be(U,!0);Y&&window.open(Y,"_blank","noopener,noreferrer")},[e.openEmailsWithGmail]),xe=st?H.get(st):null,Ht=Ke&&xe!==null&&xe!==void 0;ft(()=>{Ke&&!xe&&Ot()},[Ke,xe,Ot]);let ta=Me(()=>({overscanCount:16,callbackThrottleMs:16,scrollBarOptions:{width:8,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:{enabled:!0,renderVisual:qi}},behaviorOptions:{resetOnGetItemHeightChange:!1},preserveScrollAnchor:!0}),[]),_a=Me(()=>ro(ta,Et,Ht),[ta,Et,Ht]);ft(()=>{let R=!1;return typeof window>"u"?()=>{R=!0}:Da?(f(Da),()=>{R=!0}):((async()=>{try{let[Y,we,St,qe]=await Promise.all([import("lucide-react/dist/esm/icons/building-2.js"),import("lucide-react/dist/esm/icons/users-round.js"),import("lucide-react/dist/esm/icons/id-card.js"),import("lucide-react/dist/esm/icons/user-round.js")]);if(R)return;let ot=Y.default,Aa=we.default,Ln=St.default,Rn=qe.default;ot&&Aa&&Ln&&Rn&&(Da={company:ot,department:Aa,title:Ln,person:Rn},f(Da))}catch(Y){Xe.warn("Failed to load lucide icons",Y)}})(),()=>{R=!0})},[]);let it=Me(()=>{if(!p)return;let R=qe=>ot=>_(qe,{"aria-hidden":"true",className:`${mn} ${gn(ot)}`}),U={company:R(p.company),department:R(p.department),title:R(p.title)},Y=R(p.person),we=qe=>qe in U,St=qe=>{let[ot]=qe.entry.relativePath.split(":",1);return(we(ot)?U[ot]:U.company)(qe)};return{directory:St,directoryExpanded:St,file:Y}},[p]),aa=He(()=>{ie(R=>R.size===0?R:new Set)},[]),je=He(()=>{ae.length>0&&yt(ae)},[ae,yt]);ft(()=>{if(typeof window>"u")return;let R=document.documentElement,U=window.matchMedia("(prefers-color-scheme: dark)"),Y=()=>Ie(R.classList.contains("dark")||U.matches);Y(),U.addEventListener("change",Y);let we=new MutationObserver(Y);return we.observe(R,{attributes:!0,attributeFilter:["class"]}),()=>{U.removeEventListener("change",Y),we.disconnect()}},[]),ft(()=>{if(B===0){Ee!==null&&Xt(null),pe!==null&&vt(null);return}if(Ee!==null){let R=w.get(Ee);if(R){if(pe&&R.has(pe))return;let U=R.values().next().value;U&&vt(U);return}}Ee!==null&&Xt(null),pe!==null&&vt(null)},[B,Ee,pe,w]);let Fe=pe?H.get(pe)??null:null,na=Zt?"#475569":"#94A3B8",kt=e.isStreamingComplete,ra=e.isStreamingFailed,sa=kt&&a.length===0,ia=(F||!k)&&!sa,oa=yr(B,250),wn=k!==null||sa,Pn=ge("div",{className:"flex items-center gap-1.5",children:[ge("span",{className:"inline-flex h-5 items-center gap-1 rounded bg-slate-100 px-1.5 font-medium font-mono text-[10px] text-slate-700 dark:bg-slate-800 dark:text-slate-200",title:o.treeNodeCountTitle,children:[_("span",{className:"text-[10px]",children:"\u{1F333}"})," ",o.treeNodeCountLabel," ",wn?o.treeNodeCount(oa):"\u2026"]}),ra&&!kt?ge("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-rose-200 bg-rose-50 px-1.5 font-medium text-[10px] text-rose-700 dark:border-rose-800 dark:bg-rose-950/60 dark:text-rose-300",title:o.treeStreamInterruptedTitle,children:[_("span",{className:"h-1.5 w-1.5 rounded-full bg-rose-500"}),_("span",{className:"text-[10px]",children:"\u26D4"})," ",o.treeStreamInterrupted]}):kt?ia?ge("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-amber-200 bg-amber-50 px-1.5 font-medium text-[10px] text-amber-700 dark:border-amber-800 dark:bg-amber-950/60 dark:text-amber-300",title:o.treeBuildingTitle,children:[ge("span",{className:"relative flex h-1.5 w-1.5",children:[_("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),_("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-amber-500"})]}),_("span",{className:"text-[10px]",children:"\u{1F33F}"})," ",o.treeBuilding]}):ge("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-emerald-200 bg-emerald-50 px-1.5 font-medium text-[10px] text-emerald-700 dark:border-emerald-800 dark:bg-emerald-950/60 dark:text-emerald-300",title:o.treeCompleteTitle,children:[_("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),_("span",{className:"text-[10px]",children:"\u2705"})," ",o.treeComplete]}):ge("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-sky-200 bg-sky-50 px-1.5 font-medium text-[10px] text-sky-700 dark:border-sky-800 dark:bg-sky-950/60 dark:text-sky-300",title:o.treeStreamLoadingTitle,children:[ge("span",{className:"relative flex h-1.5 w-1.5",children:[_("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-sky-400 opacity-75"}),_("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-sky-500"})]}),_("span",{className:"text-[10px]",children:"\u23F3"})," ",o.treeStreamLoading]}),l&&ge("button",{type:"button",onClick:()=>S(!v),className:`inline-flex h-5 items-center rounded px-1.5 text-[10px] transition-colors ${v?"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300":"text-slate-500 hover:bg-slate-100 dark:text-slate-400 dark:hover:bg-slate-800"}`,title:o.treeShowEntireCompanyTitle,children:[_("span",{className:"text-[10px]",children:"\u{1F3E2}"})," ",o.treeShowEntireCompany]}),ae.length>0?ge("div",{className:"flex items-center gap-1",children:[_("button",{type:"button",onClick:aa,className:"inline-flex h-5 w-5 items-center justify-center rounded border border-slate-300 bg-white text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700 dark:hover:text-slate-100","aria-label":o.treeExpandAll,title:o.treeExpandAllTitle,children:_(Yi,{className:"h-3 w-3"})}),_("button",{type:"button",onClick:je,className:"inline-flex h-5 w-5 items-center justify-center rounded border border-slate-300 bg-white text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700 dark:hover:text-slate-100","aria-label":o.treeCollapseAll,title:o.treeCollapseAllTitle,children:_(Qi,{className:"h-3 w-3"})})]}):null]}),Ia=Oa(null),{isTwoColumn:z}=Pa(Ia,hn,{mediaQuery:"(min-width: 768px)"}),K=Me(()=>({toggle:rt,isExpanded:ne,expandMultiple:xt,collapseMultiple:yt,isPending:n}),[yt,xt,ne,rt,n]),le=Me(()=>({onEntryClick:ea,selectedPath:pe}),[ea,pe]),Se=Me(()=>({className:ao,lineColor:na,iconOverrides:it,showDirectoryIcons:!!it,showFileIcons:!!it,highlightStyles:no,entryClassName:"rounded-md px-1 py-0.5",nameClassName:"text-xs tracking-tight",directoryNameClassName:"font-normal text-slate-800 dark:text-slate-100",fileNameClassName:"text-slate-700 dark:text-slate-200"}),[na,it]),Ge=_("div",{ref:Ae,className:"flex min-h-0 flex-1 flex-col rounded-xl border border-slate-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-950",children:_("div",{ref:ye,className:"flex min-h-0 flex-1 flex-col overflow-hidden p-2",children:N.length>0?_(Ki,{entries:N,expansion:K,selection:le,visual:Se,virtualScroll:_a,locale:d,labels:u}):_("div",{className:"flex h-full w-full items-center justify-center rounded-lg border border-slate-300 border-dashed bg-white/70 px-6 text-center text-slate-500 text-sm transition-colors dark:border-slate-700 dark:bg-slate-900/50 dark:text-slate-300",children:l?o.treeNoMatches:o.treeEmpty})})});return ge("div",{ref:Ia,"data-testid":"contact-map-tree-root",className:"flex min-h-0 flex-1 flex-col",style:Wa,children:[t&&Xi(Pn,t),z?ge(ji,{id:"contact-map-tree-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-tree-panel-group",children:[_(kr,{id:"contact-map-tree-pane",defaultSize:{value:60,unit:"percentage"},minSize:{value:Ji,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:Ge}),_(Gi,{id:"contact-map-tree-handle",thickness:eo,indicator:{visible:!0,thickness:6,length:32,barThickness:2,barLength:16},className:"cursor-col-resize rounded transition-colors hover:bg-slate-200/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-1 dark:hover:bg-slate-700/60","aria-label":o.treeResizeHandle}),_(kr,{id:"contact-map-tree-detail-pane",defaultSize:{value:40,unit:"percentage"},minSize:{value:Zi,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:_(Je,{contact:Fe??null,searchTerm:e.searchTerm,enableHighlighting:e.enableHighlighting})})]}):ge(lo,{children:[Ge,_("div",{className:"hidden","aria-hidden":"true",children:_(Je,{contact:Fe,searchTerm:e.searchTerm,enableHighlighting:e.enableHighlighting})}),Jt&&Fe?_(La,{isOpen:Jt,onClose:()=>J(!1),className:"z-50 bg-white dark:bg-slate-900",children:ge("div",{className:"flex h-full flex-col overflow-hidden p-3 sm:p-4",children:[ge("div",{className:"mb-2 flex items-center justify-between border-b pr-10 pb-2 dark:border-slate-700",children:[_("h3",{className:"font-semibold text-slate-900 text-sm dark:text-slate-100",children:o.detailHeading}),_("button",{type:"button",onClick:()=>J(!1),className:"rounded px-2.5 py-1 font-medium text-slate-600 text-xs hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800",children:o.close})]}),_("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",style:{height:"100%"},children:_(Je,{contact:Fe,searchTerm:e.searchTerm,enableHighlighting:e.enableHighlighting})})]})}):null]}),Ht&&xe&&_(ma,{contactData:xe,openEmailsWithGmail:e.openEmailsWithGmail,openGmailCompose:Dt,onRequestClose:Ot})]})};import{jsx as Qt,jsxs as Pt}from"react/jsx-runtime";var fn="view",mo={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},go=e=>e==="tree"?"tree":"list",Rr=({context:e})=>{let t=q(),[a,s]=uo(),[l,n]=po(null),r=go(a.get(fn)),{setScrollableRef:d,onPointerDown:o,onPointerMove:u,onPointerUp:m,onPointerLeave:c,onPointerCancel:i,onClickCapture:p}=tt(),f=co(v=>{let S=v==="tree"?"tree":"list";if(S===r)return;let C=new URLSearchParams(typeof window<"u"?window.location.search:"");S==="list"?C.delete(fn):C.set(fn,S),s(C,{replace:!0})},[r,s]);return Pt("div",{"data-testid":"contact-map-search-tab-group",className:"flex h-full flex-1 flex-col",children:[Pt("div",{className:"mt-1 mb-1.5 flex shrink-0 items-center gap-2",children:[Pt("div",{ref:d,className:"flex space-x-1 overflow-x-auto text-nowrap rounded-lg bg-gray-100 p-0.5 transition-colors dark:bg-slate-800/80",style:mo,onPointerDown:o,onPointerMove:u,onPointerUp:m,onPointerLeave:c,onPointerCancel:i,onClickCapture:p,children:[Pt("button",{type:"button","data-testid":"contact-map-tab-list",onClick:()=>f("list"),className:`rounded px-2 py-0.5 text-xs transition-colors ${r==="list"?"bg-blue-500 text-white dark:bg-blue-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4C4} ",t.listViewTab]}),Pt("button",{type:"button","data-testid":"contact-map-tab-tree",onClick:()=>f("tree"),className:`rounded px-2 py-0.5 text-xs transition-colors ${r==="tree"?"bg-green-500 text-white dark:bg-green-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F333} ",t.treeViewTab]})]}),Qt("div",{ref:n,className:"flex items-center gap-1.5"})]}),Pt("div",{className:"flex h-full flex-1 flex-col",children:[Qt("div",{className:`${r==="list"?"flex h-full flex-1 flex-col":"hidden"}`,children:r==="list"?Qt(br,{context:e}):null}),Qt("div",{className:`${r==="tree"?"flex h-full flex-1 flex-col":"hidden"}`,children:r==="tree"?Qt(Lr,{context:e,controlsContainer:l}):null})]})]})};import{DEFAULT_FUZZY_SEARCH_OPTIONS as xn}from"@aiquants/fuzzy-search";import{memo as bo}from"react";oe();oe();import{DEFAULT_FUZZY_SEARCH_OPTIONS as A}from"@aiquants/fuzzy-search";import{memo as ho,useId as Ce}from"react";import{jsx as M,jsxs as I}from"react/jsx-runtime";var bn=ho(({searchOptions:e,setSearchOptions:t})=>{let a=q(),s="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",l="text-xs font-semibold",n=e.sortBy==="relevance",r=Ce(),d=Ce(),o=Ce(),u=Ce(),m=Ce(),c=Ce(),i=Ce(),p=Ce(),f=Ce(),v=Ce(),S=Ce(),C=[];C.push(I("div",{className:`${s} border-green-200 border-l-4 dark:border-green-400/60`,children:[I("div",{className:`${l} text-green-700 dark:text-green-300`,children:["\u{1F3D7}\uFE0F ",a.indexBuildHeading]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:r,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexNgramSize}),M("input",{id:r,type:"range",min:"1",max:"4",step:"1",value:e.ngramSize||A.ngramSize,onChange:b=>t(g=>({...g,ngramSize:parseInt(b.target.value,10)})),className:"w-full"}),I("span",{className:"text-green-600 text-xs dark:text-green-300",children:[a.currentValueLabel," ",e.ngramSize||A.ngramSize]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexNgramSizeHint})]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:d,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexMinNgramOverlap}),M("input",{id:d,type:"range",min:"1",max:"5",step:"1",value:e.minNgramOverlap||A.minNgramOverlap,onChange:b=>t(g=>({...g,minNgramOverlap:parseInt(b.target.value,10)})),className:"w-full"}),I("span",{className:"text-green-600 text-xs dark:text-green-300",children:[a.currentValueLabel," ",e.minNgramOverlap||A.minNgramOverlap]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexMinNgramOverlapHint})]})]},"index-build")),C.push(I("div",{className:`${s} border-blue-200 border-l-4 dark:border-blue-500/60`,children:[I("div",{className:`${l} text-blue-700 dark:text-blue-300`,children:["\u{1F50D} ",a.indexCandidateHeading]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:o,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexThreshold}),M("input",{id:o,type:"range",min:"0.0",max:"1.0",step:"0.05",value:e.indexWorkerOptions?.threshold??A.indexWorkerOptions?.threshold,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,threshold:parseFloat(b.target.value)}})),className:"w-full"}),I("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.threshold??A.indexWorkerOptions?.threshold]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexThresholdHint})]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:m,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexNgramOverlapThreshold}),M("input",{id:m,type:"range",min:"0.1",max:"0.9",step:"0.1",value:e.indexWorkerOptions?.ngramOverlapThreshold??A.indexWorkerOptions?.ngramOverlapThreshold,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,ngramOverlapThreshold:parseFloat(b.target.value)}})),className:"w-full"}),I("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.ngramOverlapThreshold??A.indexWorkerOptions?.ngramOverlapThreshold]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexNgramOverlapThresholdHint})]})]},"candidate-control")),C.push(I("div",{className:`${s} border-cyan-200 border-l-4 dark:border-cyan-400/60`,children:[I("div",{className:`${l} text-cyan-700 dark:text-cyan-300`,children:["\u{1F9ED} ",a.indexStrategyHeading]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:u,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexStrategy}),I("select",{id:u,value:e.indexWorkerOptions?.strategy??A.indexWorkerOptions?.strategy??"hybrid",onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,strategy:b.target.value}})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[M("option",{value:"fast",children:a.indexStrategyFast}),M("option",{value:"accurate",children:a.indexStrategyAccurate}),M("option",{value:"hybrid",children:a.indexStrategyHybrid})]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexStrategyHint})]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:c,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexMinCandidatesRatio}),M("input",{id:c,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.minCandidatesRatio??A.indexWorkerOptions?.minCandidatesRatio,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,minCandidatesRatio:parseFloat(b.target.value)}})),className:"w-full"}),I("span",{className:"text-cyan-600 text-xs dark:text-cyan-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.minCandidatesRatio??A.indexWorkerOptions?.minCandidatesRatio]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexMinCandidatesRatioHint})]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:i,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexMaxCandidatesRatio}),M("input",{id:i,type:"range",min:"0.3",max:"0.8",step:"0.1",value:e.indexWorkerOptions?.maxCandidatesRatio??A.indexWorkerOptions?.maxCandidatesRatio,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxCandidatesRatio:parseFloat(b.target.value)}})),className:"w-full"}),I("span",{className:"text-cyan-600 text-xs dark:text-cyan-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.maxCandidatesRatio??A.indexWorkerOptions?.maxCandidatesRatio]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexMaxCandidatesRatioHint})]})]},"strategy")),C.push(I("div",{className:`${s} border-indigo-200 border-l-4 dark:border-indigo-500/60`,children:[I("div",{className:`${l} text-indigo-700 dark:text-indigo-300`,children:["\u{1F521} ",a.scoreTuningHeading]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:p,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexJaroWinklerPrefix}),M("input",{id:p,type:"range",min:"0.05",max:"0.25",step:"0.05",value:e.indexWorkerOptions?.jaroWinklerPrefix??A.indexWorkerOptions?.jaroWinklerPrefix,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,jaroWinklerPrefix:parseFloat(b.target.value)}})),className:"w-full"}),I("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.jaroWinklerPrefix??A.indexWorkerOptions?.jaroWinklerPrefix]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexJaroWinklerPrefixHint})]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:f,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.maxResults}),M("input",{id:f,type:"range",min:"1000",max:"10000",step:"1000",value:e.indexWorkerOptions?.maxResults??A.indexWorkerOptions?.maxResults,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxResults:parseInt(b.target.value,10)}})),className:"w-full"}),I("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.maxResults??A.indexWorkerOptions?.maxResults]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexMaxResultsHint})]})]},"jaro")),C.push(I("div",{className:`${s} border-emerald-200 border-l-4 ${n?"":"opacity-50"} dark:border-emerald-400/60`,children:[I("div",{className:`${l} text-emerald-700 dark:text-emerald-300`,children:["\u{1F3AF} ",a.relevanceWeightsHeading]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:v,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.fieldWeight}),M("input",{id:v,type:"range",min:"0",max:"1",step:"0.05",value:e.indexWorkerOptions?.relevanceFieldWeight??A.indexWorkerOptions?.relevanceFieldWeight??.2,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,relevanceFieldWeight:parseFloat(b.target.value)}})),disabled:!n,className:"w-full disabled:cursor-not-allowed"}),I("span",{className:"text-emerald-600 text-xs dark:text-emerald-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.relevanceFieldWeight??A.indexWorkerOptions?.relevanceFieldWeight??.2]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexFieldWeightHint})]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:S,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexPerfectMatchBonus}),M("input",{id:S,type:"range",min:"0",max:"0.3",step:"0.1",value:e.indexWorkerOptions?.relevancePerfectMatchBonus??A.indexWorkerOptions?.relevancePerfectMatchBonus??.1,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,relevancePerfectMatchBonus:parseFloat(b.target.value)}})),disabled:!n,className:"w-full disabled:cursor-not-allowed"}),I("span",{className:"text-emerald-600 text-xs dark:text-emerald-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.relevancePerfectMatchBonus??A.indexWorkerOptions?.relevancePerfectMatchBonus??.1]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexPerfectMatchBonusHint})]}),!n&&M("p",{className:"text-[11px] text-emerald-600 dark:text-emerald-300",children:a.relevanceOnlyNotice})]},"relevance"));let F=Ce(),k=Ce();return C.push(I("div",{className:`${s} border-teal-200 border-l-4 dark:border-teal-400/60`,children:[I("div",{className:`${l} text-teal-700 dark:text-teal-300`,children:["\u{1F524} ",a.indexContainmentHeading]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:F,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexContainmentBase}),M("input",{id:F,type:"range",min:"0.0",max:"0.7",step:"0.05",value:e.indexWorkerOptions?.containmentScoreBase??A.indexWorkerOptions?.containmentScoreBase??.7,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,containmentScoreBase:parseFloat(b.target.value)}})),className:"w-full"}),I("span",{className:"text-teal-600 text-xs dark:text-teal-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.containmentScoreBase??A.indexWorkerOptions?.containmentScoreBase??.7]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexContainmentBaseHint})]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:k,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexContainmentCoverage}),M("input",{id:k,type:"range",min:"0.0",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.containmentCoverageWeight??A.indexWorkerOptions?.containmentCoverageWeight??.3,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,containmentCoverageWeight:parseFloat(b.target.value)}})),className:"w-full"}),I("span",{className:"text-teal-600 text-xs dark:text-teal-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.containmentCoverageWeight??A.indexWorkerOptions?.containmentCoverageWeight??.3]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexContainmentCoverageHint})]})]},"containment")),I("section",{className:"space-y-3",children:[I("div",{className:"flex items-center justify-between gap-3",children:[I("div",{className:"flex items-center gap-2 font-semibold text-green-700 text-xs transition-colors dark:text-green-300",children:[M("span",{children:"\u{1F4CA}"}),M("span",{className:"tracking-wide",children:a.indexSettingsHeading})]}),M("button",{type:"button",onClick:()=>t(b=>({...b,indexWorkerOptions:{threshold:A.indexWorkerOptions?.threshold||.4,ngramOverlapThreshold:A.indexWorkerOptions?.ngramOverlapThreshold||.3,minCandidatesRatio:A.indexWorkerOptions?.minCandidatesRatio||.1,maxCandidatesRatio:A.indexWorkerOptions?.maxCandidatesRatio||.5,jaroWinklerPrefix:A.indexWorkerOptions?.jaroWinklerPrefix||.1,maxResults:A.indexWorkerOptions?.maxResults||100,relevanceFieldWeight:A.indexWorkerOptions?.relevanceFieldWeight||.2,relevancePerfectMatchBonus:A.indexWorkerOptions?.relevancePerfectMatchBonus||.1,containmentScoreBase:A.indexWorkerOptions?.containmentScoreBase||.7,containmentCoverageWeight:A.indexWorkerOptions?.containmentCoverageWeight||.3,strategy:A.indexWorkerOptions?.strategy},ngramSize:A.ngramSize,minNgramOverlap:A.minNgramOverlap})),className:"rounded border border-green-300 bg-green-100 px-2 py-1 font-medium text-green-700 text-xs transition-colors hover:bg-green-200 dark:border-green-400/60 dark:bg-green-900/20 dark:text-green-200 dark:hover:bg-green-800/30",title:a.resetToDefaultsTitle,children:a.reset})]}),M("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:C})]})});bn.displayName="IndexWorkerSettings";oe();import{DEFAULT_FUZZY_SEARCH_OPTIONS as ce}from"@aiquants/fuzzy-search";import{memo as fo,useId as Lt}from"react";import{jsx as te,jsxs as re}from"react/jsx-runtime";var yn=fo(({searchOptions:e,setSearchOptions:t})=>{let a=q(),s="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",l="text-xs font-semibold",n=e.sortBy==="relevance",r=Lt(),d=Lt(),o=Lt(),u=Lt(),m=Lt(),c=Lt(),i=[];return i.push(re("div",{className:`${s} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[re("div",{className:`${l} text-purple-700 dark:text-purple-300`,children:["\u{1F9EE} ",a.levenshteinCandidateHeading]}),re("div",{className:"space-y-2",children:[te("label",{htmlFor:r,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.levenshteinThreshold}),te("input",{id:r,type:"range",min:"0.0",max:n?"1.5":"1.0",step:"0.05",value:e.levenshteinWorkerOptions?.threshold??ce.levenshteinWorkerOptions?.threshold,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,threshold:parseFloat(p.target.value)}})),className:"w-full"}),re("span",{className:"text-purple-600 text-xs dark:text-purple-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.threshold??ce.levenshteinWorkerOptions?.threshold]}),te("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n?a.levenshteinThresholdHintRelevance:a.levenshteinThresholdHint})]}),re("div",{className:"space-y-2",children:[te("label",{htmlFor:d,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.levenshteinLengthSimilarity}),te("input",{id:d,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.lengthSimilarityThreshold??ce.levenshteinWorkerOptions?.lengthSimilarityThreshold,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,lengthSimilarityThreshold:parseFloat(p.target.value)}})),className:"w-full"}),re("span",{className:"text-purple-600 text-xs dark:text-purple-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthSimilarityThreshold??ce.levenshteinWorkerOptions?.lengthSimilarityThreshold]}),te("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinLengthSimilarityHint})]})]},"threshold")),i.push(re("div",{className:`${s} border-pink-200 border-l-4 dark:border-pink-400/60`,children:[re("div",{className:`${l} text-pink-700 dark:text-pink-300`,children:["\u{1FA84} ",a.scoreTuningHeading]}),re("div",{className:"space-y-2",children:[te("label",{htmlFor:o,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.levenshteinLengthPenalty}),te("input",{id:o,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.levenshteinWorkerOptions?.lengthDiffPenalty??ce.levenshteinWorkerOptions?.lengthDiffPenalty,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,lengthDiffPenalty:parseFloat(p.target.value)}})),className:"w-full"}),re("span",{className:"text-pink-600 text-xs dark:text-pink-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthDiffPenalty??ce.levenshteinWorkerOptions?.lengthDiffPenalty]}),te("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinLengthPenaltyHint})]})]},"penalty")),i.push(re("div",{className:`${s} border-violet-200 border-l-4 dark:border-violet-400/60`,children:[re("div",{className:`${l} text-violet-700 dark:text-violet-300`,children:["\u{1F4E6} ",a.levenshteinResultsHeading]}),te("label",{htmlFor:u,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.maxResults}),te("input",{id:u,type:"range",min:"1000",max:"10000",step:"1000",value:e.levenshteinWorkerOptions?.maxResults??ce.levenshteinWorkerOptions?.maxResults,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,maxResults:parseInt(p.target.value,10)}})),className:"w-full"}),re("span",{className:"text-violet-600 text-xs dark:text-violet-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.maxResults??ce.levenshteinWorkerOptions?.maxResults]}),te("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinMaxResultsHint})]},"max-results")),i.push(re("div",{className:`${s} border-rose-200 border-l-4 ${n?"":"opacity-50"} dark:border-rose-400/60`,children:[re("div",{className:`${l} text-rose-700 dark:text-rose-300`,children:["\u{1F3AF} ",a.relevanceWeightsHeading]}),re("div",{className:"space-y-2",children:[te("label",{htmlFor:m,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.fieldWeight}),te("input",{id:m,type:"range",min:"0",max:"1",step:"0.05",value:e.levenshteinWorkerOptions?.relevanceFieldWeight??ce.levenshteinWorkerOptions?.relevanceFieldWeight??.15,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,relevanceFieldWeight:parseFloat(p.target.value)}})),disabled:!n,className:"w-full disabled:cursor-not-allowed"}),re("span",{className:"text-rose-600 text-xs dark:text-rose-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.relevanceFieldWeight??ce.levenshteinWorkerOptions?.relevanceFieldWeight??.15]}),te("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinFieldWeightHint})]}),re("div",{className:"space-y-2",children:[te("label",{htmlFor:c,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.levenshteinPartialBonus}),te("input",{id:c,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.partialMatchBonus??ce.levenshteinWorkerOptions?.partialMatchBonus,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,partialMatchBonus:parseFloat(p.target.value)}})),disabled:!n,className:"w-full disabled:cursor-not-allowed"}),re("span",{className:"text-rose-600 text-xs dark:text-rose-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.partialMatchBonus??ce.levenshteinWorkerOptions?.partialMatchBonus]}),te("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinPartialBonusHint})]}),!n&&te("p",{className:"text-[11px] text-rose-600 dark:text-rose-300",children:a.relevanceOnlyNotice})]},"relevance")),re("section",{className:"space-y-3",children:[re("div",{className:"flex items-center justify-between gap-3",children:[re("div",{className:"flex items-center gap-2 font-semibold text-purple-700 text-xs transition-colors dark:text-purple-300",children:[te("span",{children:"\u{1F4CF}"}),te("span",{className:"tracking-wide",children:a.levenshteinSettingsHeading})]}),te("button",{type:"button",onClick:()=>t(p=>({...p,levenshteinWorkerOptions:{threshold:ce.levenshteinWorkerOptions?.threshold||.3,lengthSimilarityThreshold:ce.levenshteinWorkerOptions?.lengthSimilarityThreshold||.1,partialMatchBonus:ce.levenshteinWorkerOptions?.partialMatchBonus||.1,lengthDiffPenalty:ce.levenshteinWorkerOptions?.lengthDiffPenalty||1,maxResults:ce.levenshteinWorkerOptions?.maxResults||100,relevanceFieldWeight:ce.levenshteinWorkerOptions?.relevanceFieldWeight||.15}})),className:"rounded border border-purple-300 bg-purple-100 px-2 py-1 font-medium text-purple-700 text-xs transition-colors hover:bg-purple-200 dark:border-purple-400/60 dark:bg-purple-900/20 dark:text-purple-200 dark:hover:bg-purple-800/30",title:a.resetToDefaultsTitle,children:a.reset})]}),te("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:i})]})});yn.displayName="LevenshteinWorkerSettings";import{jsx as _e,jsxs as We}from"react/jsx-runtime";var yo={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},vn=bo(({searchOptions:e,setSearchOptions:t,enableHighlighting:a,setEnableHighlighting:s,openEmailsWithGmail:l,setOpenEmailsWithGmail:n,activeTab:r,onTabChange:d})=>{let o=q(),{setScrollableRef:u,onPointerDown:m,onPointerMove:c,onPointerUp:i,onPointerLeave:p,onPointerCancel:f,onClickCapture:v}=tt();return We("div",{className:"wrap-break-word flex w-full flex-col gap-1.5 rounded-lg border border-blue-300 bg-white p-1.5 shadow-md transition-colors dark:border-blue-500/40 dark:bg-slate-900/80 dark:shadow-blue-900/30",children:[We("div",{className:"mb-0.5 flex shrink-0 flex-col gap-1 rounded bg-blue-50 px-1.5 py-0.5 transition-colors sm:flex-row sm:items-center sm:justify-between dark:bg-blue-900/30",children:[We("h3",{className:"font-semibold text-gray-700 text-xs transition-colors dark:text-slate-100",children:["\u2699\uFE0F ",o.searchSettings]}),_e("div",{className:"flex flex-wrap gap-1.5",children:We("button",{type:"button",onClick:()=>t(S=>({...xn,autoSearchOnIndexRebuild:!1,debounceMs:0,workerUrls:S.workerUrls,indexWorkerOptions:{...xn.indexWorkerOptions},levenshteinWorkerOptions:{...xn.levenshteinWorkerOptions}})),className:"rounded bg-red-500 px-1.5 py-0.5 text-[10px] text-white transition-colors hover:bg-red-600 dark:hover:bg-red-700",title:o.settingsResetAllTitle,children:["\u{1F504} ",o.settingsResetAll]})})]}),_e("div",{className:"mb-0 shrink-0",children:We("div",{ref:u,role:"tablist","aria-label":o.settingsTabsLabel,className:"flex space-x-1 overflow-x-auto text-nowrap rounded-md bg-gray-100 p-0.5 transition-colors dark:bg-slate-800/80",style:yo,onPointerDown:m,onPointerMove:c,onPointerUp:i,onPointerLeave:p,onPointerCancel:f,onClickCapture:v,children:[We("button",{type:"button",role:"tab","aria-selected":r==="basic",onClick:()=>d("basic"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${r==="basic"?"bg-blue-500 text-white dark:bg-blue-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F527} ",o.settingsBasicTab]}),We("button",{type:"button",role:"tab","aria-selected":r==="advanced",onClick:()=>d("advanced"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${r==="advanced"?"bg-orange-500 text-white dark:bg-orange-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u26A1 ",o.settingsAdvancedTab]}),We("button",{type:"button",role:"tab","aria-selected":r==="index",onClick:()=>d("index"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${r==="index"?"bg-green-500 text-white dark:bg-green-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CA} ",o.indexWorkerName]}),We("button",{type:"button",role:"tab","aria-selected":r==="levenshtein",onClick:()=>d("levenshtein"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${r==="levenshtein"?"bg-purple-500 text-white dark:bg-purple-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CF} ",o.levenshteinWorkerName]})]})}),We("div",{className:"flex flex-col gap-1",children:[_e("div",{className:`${r==="basic"?"block":"hidden"}`,children:_e(Ga,{searchOptions:e,setSearchOptions:t,enableHighlighting:a,setEnableHighlighting:s,openEmailsWithGmail:l,setOpenEmailsWithGmail:n})}),_e("div",{className:`${r==="advanced"?"block":"hidden"}`,children:_e(ja,{searchOptions:e,setSearchOptions:t})}),_e("div",{className:`${r==="index"?"block":"hidden"}`,children:_e(bn,{searchOptions:e,setSearchOptions:t})}),_e("div",{className:`${r==="levenshtein"?"block":"hidden"}`,children:_e(yn,{searchOptions:e,setSearchOptions:t})})]})]})});vn.displayName="SearchOptionsPanel";import{memo as Co}from"react";dt();oe();import{memo as xo}from"react";import{jsxs as Cn}from"react/jsx-runtime";var L=xo(({label:e,value:t,unit:a,color:s="text-gray-600 dark:text-slate-300"})=>Cn("div",{className:"wrap-break-word flex min-w-0 flex-col overflow-hidden text-gray-700 transition-colors sm:flex-row sm:justify-between dark:text-slate-200",children:[Cn("span",{className:"wrap-break-word overflow-hidden text-left",children:[e,":"]}),Cn("span",{className:`font-medium ${s} min-w-0 overflow-hidden break-all transition-colors sm:ml-2`,children:[t,a]})]}));L.displayName="StatItem";pt();dt();oe();import{memo as vo}from"react";import{jsx as T,jsxs as $}from"react/jsx-runtime";var Rt=vo(({kind:e,icon:t,stats:a,color:s})=>{let{locale:l,labels:n}=fe(),r=w=>G(l,w);if(!a)return T("section",{className:"rounded-lg border border-gray-200 border-dashed bg-white/40 p-3 text-gray-400 text-xs transition-colors dark:border-slate-700 dark:bg-slate-900/40 dark:text-slate-400",children:n.statsNoData});let d=a.basic||{},o=a.workerSpecific||{},u=a.analysis||{},m=d.totalSearches??0,c=d.totalProcessingTime??0,i=d.averageSearchTime??0,p=d.lastSearchTime??0,f=d.errorCount??0,v=d.timestamp,S=u.fieldPerformance||{},C=u.performanceInsights||{},F=u.recentHistory||[],k=o.specificMetrics||{},b=o.operationCount??0,g=o.operationDistribution||{},E=e==="index",V=e==="levenshtein",y=E?n.indexWorkerName:n.levenshteinWorkerName,h=k,x=k,O="flex flex-col gap-1 rounded-lg border border-gray-200 bg-white/80 p-3 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",D="text-xs font-semibold transition-colors",ee=w=>{if(w)return Pe(w)},N=[];if(N.push($("div",{className:`${O} border-blue-200 border-l-4 dark:border-blue-500/60`,children:[$("div",{className:`${D} ${s}`,children:["\u{1F4CA} ",n.statsBasicHeading]}),T(L,{label:n.statTotalSearches,value:r(m),color:s}),T(L,{label:n.statAverageSearchTime,value:i.toFixed(2),unit:"ms",color:s}),T(L,{label:n.statTotalProcessingTime,value:c.toFixed(2),unit:"ms",color:s}),T(L,{label:n.statLastSearchTime,value:p.toFixed(2),unit:"ms",color:s}),T(L,{label:n.statErrorCount,value:f,color:f>0?"text-red-600 dark:text-red-400":s}),ee(v)&&T(L,{label:n.statUpdatedAt,value:ee(v),color:"text-gray-500 dark:text-slate-400"})]},"basic")),b>0||Object.keys(g).length>0){let w=Object.entries(g).sort(([,H],[,B])=>(Number(B)||0)-(Number(H)||0)).slice(0,6);N.push($("div",{className:`${O} border-amber-200 border-l-4 dark:border-amber-400/60`,children:[$("div",{className:`${D} text-amber-600 dark:text-amber-300`,children:["\u{1F527} ",n.statsOperationsHeading]}),T(L,{label:n.statTotalOperations,value:r(b),color:"text-amber-700 dark:text-amber-300"}),w.length>0&&T("div",{className:"mt-1 space-y-1",children:w.map(([H,B])=>T(L,{label:H,value:r(Number(B)),unit:n.timesUnit(r(Number(B))),color:"text-amber-700 dark:text-amber-300"},H))})]},"operations"))}if(E&&(N.push($("div",{className:`${O} border-green-200 border-l-4 dark:border-green-400/60`,children:[$("div",{className:`${D} text-green-700 dark:text-green-300`,children:["\u{1F3D7}\uFE0F ",n.statsIndexHeading]}),T(L,{label:n.statIndexBuilds,value:r(h.totalIndexBuilds??0),color:"text-green-700 dark:text-green-300"}),T(L,{label:n.statDataSize,value:r(h.currentDataSize??0),unit:n.itemsUnit(r(h.currentDataSize??0)),color:"text-green-700 dark:text-green-300"}),T(L,{label:n.statLastBuildTime,value:(h.lastIndexTime??0).toFixed(2),unit:"ms",color:"text-green-700 dark:text-green-300"})]},"index-core")),h.cacheSize&&N.push($("div",{className:`${O} border-emerald-200 border-l-4 dark:border-emerald-400/60`,children:[$("div",{className:`${D} text-emerald-700 dark:text-emerald-300`,children:["\u{1F4BE} ",n.statsCacheHeading]}),T(L,{label:n.statCacheNgram,value:r(h.cacheSize.ngram??0),color:"text-emerald-700 dark:text-emerald-300"}),T(L,{label:n.statCacheWord,value:r(h.cacheSize.word??0),color:"text-emerald-700 dark:text-emerald-300"}),T(L,{label:n.statCachePhonetic,value:r(h.cacheSize.phonetic??0),color:"text-emerald-700 dark:text-emerald-300"})]},"index-cache")),h.indexMetadata)){let w=Object.entries(h.indexMetadata).slice(0,6);w.length>0&&N.push($("div",{className:`${O} border-teal-200 border-l-4 dark:border-teal-400/60`,children:[$("div",{className:`${D} text-teal-700 dark:text-teal-300`,children:["\u{1F4CB} ",n.statsIndexMetadataHeading]}),w.map(([H,B])=>{let ae;if(typeof B=="number"){let me=H.toLowerCase();me.includes("time")&&!me.includes("timestamp")?ae=`${B.toFixed(2)}ms`:me.includes("timestamp")||me.includes("at")?ae=ee(B)??B.toString():ae=r(B)}else ae=String(B);return T(L,{label:H,value:ae,color:"text-teal-700 dark:text-teal-300"},H)})]},"index-meta"))}if(V){if(N.push($("div",{className:`${O} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[$("div",{className:`${D} text-purple-700 dark:text-purple-300`,children:["\u{1F522} ",n.statsCalculationsHeading]}),T(L,{label:n.statTotalCalculations,value:r(x.totalCalculations??0),color:"text-purple-700 dark:text-purple-300"}),T(L,{label:n.statDistanceCalculations,value:r(x.totalDistanceCalculations??0),color:"text-purple-700 dark:text-purple-300"}),T(L,{label:n.statAverageDistance,value:typeof x.averageDistance=="number"?x.averageDistance.toFixed(2):"0.00",color:"text-purple-700 dark:text-purple-300"}),T(L,{label:n.statMinDistance,value:x.minDistance??n.notAvailable,color:"text-purple-700 dark:text-purple-300"}),T(L,{label:n.statMaxDistance,value:x.maxDistance??0,color:"text-purple-700 dark:text-purple-300"})]},"lev-basic")),N.push($("div",{className:`${O} border-fuchsia-200 border-l-4 dark:border-fuchsia-400/60`,children:[$("div",{className:`${D} text-fuchsia-700 dark:text-fuchsia-300`,children:["\u{1F3AF} ",n.statsMatchesHeading]}),T(L,{label:n.statPartialMatches,value:r(x.partialMatches??0),color:"text-fuchsia-700 dark:text-fuchsia-300"}),T(L,{label:n.statPerfectMatches,value:r(x.perfectMatches??0),color:"text-fuchsia-700 dark:text-fuchsia-300"}),T(L,{label:n.statEarlyTerminations,value:r(x.earlyTerminations??0),color:"text-fuchsia-700 dark:text-fuchsia-300"})]},"lev-match")),x.similarityThresholds&&N.push($("div",{className:`${O} border-rose-200 border-l-4 dark:border-rose-400/60`,children:[$("div",{className:`${D} text-rose-700 dark:text-rose-300`,children:["\u{1F4C8} ",n.statsSimilarityHeading]}),T(L,{label:n.statAbove80,value:r(x.similarityThresholds.above80??0),color:"text-emerald-700 dark:text-emerald-300"}),T(L,{label:n.statAbove60,value:r(x.similarityThresholds.above60??0),color:"text-lime-700 dark:text-lime-300"}),T(L,{label:n.statAbove40,value:r(x.similarityThresholds.above40??0),color:"text-orange-600 dark:text-orange-300"}),T(L,{label:n.statBelow40,value:r(x.similarityThresholds.below40??0),color:"text-red-600 dark:text-red-400"})]},"lev-similarity")),x.distanceDistribution){let w=Object.entries(x.distanceDistribution).sort(([,H],[,B])=>Number(B)-Number(H)).slice(0,6);w.length>0&&N.push($("div",{className:`${O} border-indigo-200 border-l-4 dark:border-indigo-500/60`,children:[$("div",{className:`${D} text-indigo-700 dark:text-indigo-300`,children:["\u{1F4CA} ",n.statsDistanceHeading]}),w.map(([H,B])=>T(L,{label:n.statDistance(H),value:r(Number(B)),unit:n.timesUnit(r(Number(B))),color:"text-indigo-700 dark:text-indigo-300"},H))]},"lev-distance"))}if(x.queryLengthStats){let w=Object.entries(x.queryLengthStats).sort(([,H],[,B])=>(B.count??0)-(H.count??0)).slice(0,6);w.length>0&&N.push($("div",{className:`${O} border-violet-200 border-l-4 dark:border-violet-400/60`,children:[$("div",{className:`${D} text-violet-700 dark:text-violet-300`,children:["\u{1F4CF} ",n.statsQueryLengthHeading]}),w.map(([H,B])=>{let ae=Number(B.count??0),me=Number(B.averageScore??0);return T(L,{label:n.statQueryLength(H),value:n.statQueryLengthValue({count:ae,averagePercent:(me*100).toFixed(1)}),color:"text-violet-700 dark:text-violet-300"},H)})]},"lev-query-length"))}}if(Object.keys(S).length>0){let w=Object.entries(S).sort(([,H],[,B])=>(B.averageScore??0)-(H.averageScore??0)).slice(0,6);N.push($("div",{className:`${O} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[$("div",{className:`${D} text-purple-700 dark:text-purple-300`,children:["\u{1F4CB} ",n.statsFieldPerformanceHeading]}),w.map(([H,B])=>{let ae=B;return $("div",{className:"space-y-1 rounded bg-purple-50/60 p-2 transition-colors dark:bg-slate-900/50",children:[T("div",{className:"font-semibold text-purple-700 text-xs transition-colors dark:text-purple-300",children:H}),T(L,{label:n.statAverageScore,value:`${((ae.averageScore??0)*100).toFixed(1)}%`,color:"text-purple-700 dark:text-purple-300"}),T(L,{label:n.statMatchCount,value:r(ae.matchCount??0),unit:n.itemsUnit(r(ae.matchCount??0)),color:"text-purple-700 dark:text-purple-300"}),T(L,{label:n.statBestWorstScore,value:`${((ae.bestScore??0)*100).toFixed(1)}% / ${((ae.worstScore??0)*100).toFixed(1)}%`,color:"text-purple-700 dark:text-purple-300"})]},H)})]},"field-performance"))}if(C.bestPerformingField||C.totalHistoryEntries||C.similarityDistribution){let w=(C.recentAverageResultCount??0).toFixed(1);N.push($("div",{className:`${O} border-blue-200 border-l-4 dark:border-blue-400/60`,children:[$("div",{className:`${D} text-blue-700 dark:text-blue-300`,children:["\u{1F50D} ",n.statsInsightsHeading]}),C.bestPerformingField&&T(L,{label:n.statBestField,value:C.bestPerformingField,color:"text-blue-700 dark:text-blue-300"}),T(L,{label:n.statRecentAverageTime,value:(C.recentAverageProcessingTime??0).toFixed(2),unit:"ms",color:"text-blue-700 dark:text-blue-300"}),T(L,{label:n.statRecentAverageResults,value:w,unit:n.itemsUnit(w),color:"text-blue-700 dark:text-blue-300"}),T(L,{label:n.statThroughput,value:(C.throughputPerSecond??0).toFixed(2),unit:n.throughputUnit,color:"text-blue-700 dark:text-blue-300"}),T(L,{label:n.statCommonQueryLength,value:r(C.mostCommonQueryLength??0),unit:n.charactersUnit(r(C.mostCommonQueryLength??0)),color:"text-blue-700 dark:text-blue-300"}),T(L,{label:n.statHistoryEntries,value:r(C.totalHistoryEntries??0),color:"text-blue-700 dark:text-blue-300"}),C.similarityDistribution&&$("div",{className:"mt-1 grid grid-cols-2 gap-1",children:[T(L,{label:n.statHighSimilarity,value:r(C.similarityDistribution.highSimilarity??0),color:"text-emerald-700 dark:text-emerald-300"}),T(L,{label:n.statMediumSimilarity,value:r(C.similarityDistribution.mediumSimilarity??0),color:"text-lime-700 dark:text-lime-300"}),T(L,{label:n.statLowSimilarity,value:r(C.similarityDistribution.lowSimilarity??0),color:"text-orange-600 dark:text-orange-300"}),T(L,{label:n.statVeryLowSimilarity,value:r(C.similarityDistribution.veryLowSimilarity??0),color:"text-red-600 dark:text-red-400"})]})]},"performance-insights"))}return F.length>0&&N.push($("div",{className:`${O} border-sky-200 border-l-4 dark:border-sky-400/60`,children:[$("div",{className:`${D} text-sky-700 dark:text-sky-300`,children:["\u{1F4C8} ",n.statsRecentHistoryHeading]}),F.slice(-3).reverse().map((w,H)=>$("div",{className:"rounded bg-sky-50/70 p-2 transition-colors dark:bg-slate-900/50",children:[T("div",{className:"font-medium text-sky-700 transition-colors dark:text-sky-300",children:w.operationType}),T("div",{className:"text-sky-600 text-xs transition-colors dark:text-sky-200",children:n.statsHistoryEntry({processingTimeMs:w.processingTime.toFixed(2),resultCount:w.resultCount??0})}),ee(w.timestamp)&&T("div",{className:"text-[10px] text-sky-500 transition-colors dark:text-sky-200",children:ee(w.timestamp)})]},`${w.operationType}-${w.timestamp??H}`))]},"recent-history")),$("section",{className:"space-y-2",children:[$("div",{className:`flex items-center gap-2 font-semibold text-xs ${s}`,children:[T("span",{children:t}),T("span",{className:"tracking-wide",children:y})]}),T("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:N})]})});Rt.displayName="WorkerStatsSection";import{jsx as Ne,jsxs as Te}from"react/jsx-runtime";var ko={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},kn=Co(({performanceMetrics:e,searchTerm:t,totalDataCount:a,resultsCount:s,resetStats:l,rebuildIndex:n,isIndexBuilding:r,activeTab:d,onTabChange:o})=>{let{locale:u,labels:m}=fe(),c=t.trim(),i=c?s:a,{setScrollableRef:p,onPointerDown:f,onPointerMove:v,onPointerUp:S,onPointerLeave:C,onPointerCancel:F,onClickCapture:k}=tt(),b=d!=="index"||r,g=r?m.statsRebuildingTitle:d!=="index"?m.statsRebuildIndexTabOnlyTitle:m.statsRebuildTitle,E=b?"cursor-not-allowed bg-gray-300 text-gray-500 dark:bg-slate-700 dark:text-slate-400":"bg-blue-500 text-white hover:bg-blue-600 dark:bg-blue-500 dark:hover:bg-blue-600",V=r?`\u23F3 ${m.statsRebuilding}`:`\u{1F3D7}\uFE0F ${m.statsRebuild}`;return Te("div",{className:"wrap-break-word flex w-full flex-col gap-1.5 rounded-lg border border-blue-300 bg-white p-1.5 shadow-md transition-colors dark:border-blue-500/40 dark:bg-slate-900/80 dark:shadow-blue-900/30",children:[Te("div",{className:"mb-0.5 flex shrink-0 flex-col gap-1 rounded bg-blue-50 px-1.5 py-0.5 transition-colors sm:flex-row sm:items-center sm:justify-between dark:bg-blue-900/30",children:[Te("h3",{className:"font-semibold text-gray-700 text-xs transition-colors dark:text-slate-100",children:["\u{1F4CA} ",m.searchStatistics]}),Te("div",{className:"flex flex-wrap gap-1.5",children:[Ne("button",{type:"button",onClick:()=>n(),disabled:b,className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${E}`,title:g,children:V}),Te("button",{type:"button",onClick:l,className:"rounded bg-red-500 px-1.5 py-0.5 text-[10px] text-white transition-colors hover:bg-red-600 dark:hover:bg-red-700",title:m.statsResetTitle,children:["\u{1F504} ",m.reset]})]})]}),Ne("div",{className:"mb-0 shrink-0",children:Te("div",{ref:p,className:"flex space-x-1 overflow-x-auto text-nowrap rounded-md bg-gray-100 p-0.5 transition-colors dark:bg-slate-800/80",style:ko,onPointerDown:f,onPointerMove:v,onPointerUp:S,onPointerLeave:C,onPointerCancel:F,onClickCapture:k,children:[Te("button",{type:"button",onClick:()=>o("overview"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${d==="overview"?"bg-blue-500 text-white dark:bg-blue-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CB} ",m.statsOverviewTab]}),Te("button",{type:"button",onClick:()=>o("index"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${d==="index"?"bg-green-500 text-white dark:bg-green-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CA} ",m.statsIndexTab]}),Te("button",{type:"button",onClick:()=>o("levenshtein"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${d==="levenshtein"?"bg-purple-500 text-white dark:bg-purple-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CF} ",m.statsLevenshteinTab]})]})}),Te("div",{className:"flex flex-col gap-1 pb-0.5",children:[Te("div",{className:`${d==="overview"?"grid":"hidden"} grid-cols-1 gap-2 pr-1 text-gray-600 text-xs transition-colors sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 dark:text-slate-300`,children:[Ne(L,{label:m.statTotalSearches,value:G(u,e.totalSearches)}),Ne(L,{label:m.statAverageSearchTime,value:e.averageSearchTime.toFixed(1),unit:"ms"}),Ne(L,{label:m.statDataCount,value:G(u,e.itemCount)}),Ne(L,{label:c?m.statResultCount:m.statDisplayedCount,value:G(u,i)})]}),Ne("div",{className:`${d==="index"?"space-y-3":"hidden"} pr-1 text-gray-600 text-xs transition-colors dark:text-slate-300`,children:Ne(Rt,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:"text-green-600 dark:text-green-300"})}),Ne("div",{className:`${d==="levenshtein"?"space-y-3":"hidden"} pr-1 text-gray-600 text-xs transition-colors dark:text-slate-300`,children:Ne(Rt,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:"text-purple-600 dark:text-purple-300"})}),Te("div",{className:"hidden",children:[Ne(Rt,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:"text-green-600 dark:text-green-300"}),Ne(Rt,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:"text-purple-600 dark:text-purple-300"})]})]})]})});kn.displayName="StatisticsPanel";import{Fragment as Hr,jsx as se,jsxs as he}from"react/jsx-runtime";var Lo=/[\u200B\uFEFF]/g,Tn=typeof window<"u",_r=Tn&&typeof document<"u",Ha=(e,t=[],a=!1)=>{let s=Wr(e);s.current=e,$e(()=>{if(!(!Tn||a&&!_r))return s.current()},[a,...t])},Mr=(e,t,a)=>{let[s,l]=Ve(()=>{let n=Er(r=>r.getItem(e));return n&&t.includes(n)?n:a});return Ha(()=>{Er(n=>{n.setItem(e,s)})},[e,s]),[s,l]},Er=e=>{if(!Tn)return null;try{return e(window.sessionStorage)}catch{return null}},Or=(e,t)=>{let[a,s]=Ve(e);return $e(()=>{let l=setTimeout(()=>{s(e)},t);return()=>{clearTimeout(l)}},[e,t]),a},Ro="contact-map.settings-tab",Mo="contact-map.statistics-tab",Eo=["basic","advanced","index","levenshtein"],Oo=["overview","index","levenshtein"],Dr=["full_name","company_name","department","title","email","company_phone_number","mobile_phone_number"],Do={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},Ir=({streamState:e,workerUrls:t,onFooterVisibilityChange:a,children:s}={})=>{let l=et(),{locale:n,labels:r}=fe(),d=Ta(),o=bt(()=>e||{contactMapRecords:d.records,isStreamingComplete:d.isComplete,isStreamingFailed:d.phase==="failed",streamPhase:d.phase,loadedCount:d.loadedCount,companyCount:0,totalCount:d.totalCount,errorMessage:d.error?.message??null},[e,d]),{contactMapRecords:u,isStreamingComplete:m,isStreamingFailed:c}=o,i=wo(),[p]=Po(),f=Wr(null),[v,S]=Ve(!0),[C,F]=Ve(l.openEmailsWithGmail??!1),[k,b]=Ve(p.get("q")||""),g=Or(k,300);$e(()=>{let z=p.get("q")||"";b(K=>K!==z?z:K)},[p]),$e(()=>{if(typeof window>"u")return;let z=new URL(window.location.href);(z.searchParams.get("q")||"")!==g&&(g?z.searchParams.set("q",g):z.searchParams.delete("q"),window.history.replaceState(window.history.state,"",z.toString()))},[g]);let[E,V]=No(),[y,h]=Ve("search"),[x,O]=Mr(Ro,Eo,"basic"),[D,ee]=Mr(Mo,Oo,"overview"),{setScrollableRef:N,onPointerDown:w,onPointerMove:H,onPointerUp:B,onPointerLeave:ae,onPointerCancel:me,onClickCapture:ie}=tt(),ne=Yt(()=>{if(!_r)return;let z=f.current;!z||document.activeElement===z||window.requestAnimationFrame(()=>{try{z.focus({preventScroll:!0})}catch{}})},[]),rt=Yt(z=>{let K=z;h(K),K==="search"&&ne()},[ne]),yt=bt(()=>{let{indexWorkerOptions:z={},levenshteinWorkerOptions:K={},...le}=Sn;return{...le,autoSearchOnIndexRebuild:!1,debounceMs:0,workerUrls:t,indexWorkerOptions:{...z},levenshteinWorkerOptions:{...K}}},[t]),[xt,Ee]=Ve(yt),pe=(xt.multiTermOperator??Sn.multiTermOperator)==="and",vt=pe?r.operatorAndTitle:r.operatorOrTitle,Jt=Or(u,m?0:800),{searchTerm:J,setSearchTerm:Zt,filteredItems:Ie,isSearching:Ae,isIndexBuilding:ye,clearSearch:Et,resetStats:Wa,performanceMetrics:ke,rebuildIndex:ea,error:Ct}=So(Jt,Dr,xt),Ke=J.trim().length>0,[st,Ot]=Ve(()=>J),Dt=bt(()=>ha(k),[k]),xe=bt(()=>ha(g),[g]);$e(()=>{xe!==J&&V(()=>{Zt(xe)})},[xe,J,Zt]);let Ht=Yt(z=>{let le=z.target.value.replace(Lo,"");b(le)},[]),ta=Yt(()=>{b(""),Et(),ne()},[Et,ne]),_a=Yt(()=>{Ee(z=>{let le=(z.multiTermOperator??Sn.multiTermOperator??"and")==="and"?"or":"and";return{...z,multiTermOperator:le}}),ne()},[ne]);Ha(()=>{if(!(y==="search"&&i.state==="idle"&&!E))return;let K=document.activeElement;if(!!!(K?.matches('[role="tab"]')||K?.closest('[role="tablist"]')?.getAttribute("role")==="tablist")&&K&&K!==document.body&&K!==f.current)return;let Se=window.requestAnimationFrame(()=>{ne()});return()=>{window.cancelAnimationFrame(Se)}},[y,i.state,E,ne],!0),Ha(()=>{if(y!=="search")return;let z=[[document,"visibilitychange",()=>{document.visibilityState==="visible"&&ne()}],[window,"pageshow",()=>{ne()}]];for(let[K,le,Se]of z)K.addEventListener(le,Se);return()=>{for(let[K,le,Se]of z)K.removeEventListener(le,Se)}},[y,ne],!0),$e(()=>(a&&a(y==="search"?"mobile-hidden":"visible"),()=>{a&&a("visible")}),[y,a]),Ha(()=>{let z=document.body,K=z.style.overflow;return y==="search"&&(z.style.overflow="hidden"),()=>{z.style.overflow=K}},[y],!0),$e(()=>{ke&&Xe.info("\u{1F4CA} [STATE] \u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u6307\u6A19\u304C\u66F4\u65B0\u3055\u308C\u307E\u3057\u305F:",{totalSearches:ke.totalSearches,averageSearchTime:ke.averageSearchTime,itemCount:ke.itemCount,resultsCount:ke.resultsCount,workersAvailable:!!ke.workerStats})},[ke]);let{isAwaitingDebounce:it,isAwaitingSearchTermSync:aa,isSearchInProgress:je}=bt(()=>{let z=Dt!==xe,K=xe!==J,le=J.trim().length>0||Dt.trim().length>0;return{isAwaitingDebounce:z,isAwaitingSearchTermSync:K,isSearchInProgress:E||Ae||le&&ye||z||K||st!==J}},[Dt,xe,J,E,Ae,ye,st]),[Fe,na]=Ve(J);$e(()=>{Fe!==J&&na(J)},[J,Fe]),$e(()=>{it||aa||E||Ae||ye||Fe===J&&st!==J&&Ot(J)},[J,st,it,aa,E,Ae,ye,Fe]);let kt=bt(()=>{if(!Ie.length)return Ie;let z=J.toLowerCase();if(!z)return Ie;let K=le=>Dr.some(Se=>{let Ge=le[Se];return typeof Ge=="string"?Ge.toLowerCase().includes(z):!1});return[...Ie].sort((le,Se)=>{let Ge=K(le.item),R=K(Se.item);return Ge&&!R?-1:!Ge&&R?1:0})},[Ie,J]),ra=bt(()=>({contactMapRecords:u,filteredItems:kt,searchTerm:J,isSearching:Ae,isIndexBuilding:ye,isPending:E,hasSearchTerm:Ke,enableHighlighting:v,openEmailsWithGmail:C,isSearchInProgress:je,isSearchTabActive:y==="search",errorMessage:Ct??null,isStreamingComplete:m,isStreamingFailed:c}),[u,kt,J,Ae,ye,E,Ke,v,C,je,y,Ct,m,c]),sa=Ke?Ie.length:u.length,ia=G(n,u.length),oa=G(n,Ie.length);return se("div",{className:`scrollbar-hidden bg-slate-50 text-slate-900 dark:bg-slate-900 dark:text-slate-100${y==="search"?" h-full min-h-0":""}`,children:he(xa,{value:y,onValueChange:rt,className:`flex flex-col${y==="search"?" h-full min-h-0":""}`,children:[he(Bt,{ref:N,style:Do,className:"scrollbar-none mt-0 mb-1 flex w-full touch-pan-x flex-nowrap overflow-x-auto overflow-y-hidden rounded-md bg-slate-50 transition-colors dark:bg-slate-900/70 dark:text-slate-200",onPointerDown:w,onPointerMove:H,onPointerUp:B,onPointerLeave:ae,onPointerCancel:me,onClickCapture:ie,children:[he(mt,{value:"search",className:"min-w-16 px-2 py-0.5 text-xs transition-colors sm:min-w-24 sm:px-2.5 sm:py-0.5 sm:text-xs dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100",children:["\u{1F50D} ",r.searchTab]}),he(mt,{value:"settings",className:"min-w-16 px-2 py-0.5 text-xs transition-colors sm:min-w-24 sm:px-2.5 sm:py-0.5 sm:text-xs dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100",children:["\u2699\uFE0F ",r.searchSettings]}),he(mt,{value:"statistics",className:"min-w-16 px-2 py-0.5 text-xs transition-colors sm:min-w-24 sm:px-2.5 sm:py-0.5 sm:text-xs dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100",children:["\u{1F4CA} ",r.searchStatistics]})]}),se(gt,{value:"search",className:"mt-0 flex h-full min-h-0 flex-col overflow-hidden",children:he("div",{className:"flex h-full flex-col",children:[se("div",{className:"rounded-md border border-gray-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/80 dark:shadow-none",children:he("div",{className:"flex flex-col",children:[se("div",{className:"relative",children:he("div",{className:"flex items-center gap-1 p-1",children:[he("button",{type:"button",onClick:_a,"aria-pressed":pe,title:vt,className:`inline-flex min-w-9 items-center justify-center gap-0.5 rounded border px-1.5 py-0.5 font-semibold text-[10px] transition-colors sm:min-w-12 sm:px-2 sm:py-0.5 sm:text-xs ${pe?"border-blue-500 bg-blue-600 text-white hover:bg-blue-700 dark:border-blue-400 dark:bg-blue-500 dark:hover:bg-blue-600":"border-amber-400 bg-amber-100 text-amber-800 hover:bg-amber-200 dark:border-amber-500/70 dark:bg-amber-300/20 dark:text-amber-200 dark:hover:bg-amber-300/30"}`,children:[se("span",{className:"text-[10px] sm:text-xs",children:pe?r.operatorAnd:r.operatorOr}),se("span",{className:"hidden text-[10px] sm:inline",children:pe?r.operatorAndHint:r.operatorOrHint})]}),se("input",{ref:f,type:"text",value:k,onChange:Ht,placeholder:r.searchPlaceholder,className:"flex-1 rounded border border-gray-300 border-solid px-2 py-0.5 text-xs shadow-sm transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 sm:px-2 sm:py-0.5 sm:text-xs dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100 dark:shadow-none"}),k&&se("button",{type:"button",onClick:ta,className:"flex items-center justify-center gap-1 rounded border border-gray-300 px-1.5 py-0.5 text-[10px] transition-colors hover:text-gray-700 sm:px-2 sm:py-0.5 sm:text-xs dark:border-slate-600 dark:bg-slate-800/70 dark:text-slate-300 dark:hover:text-slate-100",title:je?r.searchBusyTitle:r.clearSearch,disabled:je,children:je?he(Hr,{children:[se(To,{"aria-hidden":"true",className:"h-3 w-3 animate-spin sm:h-3.5 sm:w-3.5"}),se("span",{className:"hidden sm:inline",children:r.searching})]}):"\u2715"})]})}),he("p",{className:"px-1.5 py-0.5 text-[10px] text-slate-700 leading-snug transition-colors sm:text-[11px] dark:text-slate-200",children:[r.registeredCountLabel," ",se("span",{className:"font-semibold text-[11px] text-slate-900 sm:text-xs dark:text-white",children:ia})," ",r.recordUnit(ia),ye?he("span",{className:"ml-1.5 inline-flex items-center rounded bg-blue-50 px-1.5 py-0.2 text-[10px] text-blue-700 sm:text-[11px] dark:bg-blue-900/40 dark:text-blue-200",children:["\u23F3 ",r.rebuildingIndex]}):null,Ct?he("span",{className:"ml-1.5 inline-flex items-center rounded bg-rose-50 px-1.5 py-0.2 text-[10px] text-rose-700 sm:text-[11px] dark:bg-rose-900/40 dark:text-rose-200",children:["\u26A0\uFE0F ",r.errorLabel,se("span",{className:"ml-1 break-all font-semibold",children:Ct})]}):null,Ke&&he("span",{className:"ml-1.5 text-[10px] text-blue-600 sm:text-[11px] dark:text-sky-400",children:["| ",r.resultCountLabel,je?se("span",{className:"ml-1 font-semibold text-[10px] sm:text-[11px]",children:r.searching}):he(Hr,{children:[se("span",{className:"ml-1 font-semibold text-[11px] text-slate-900 sm:text-xs dark:text-white",children:oa}),se("span",{className:"ml-0.5 text-[10px] sm:text-[11px]",children:r.resultUnit(oa)})]})]})]}),se("div",{className:"h-2.5 px-2 pb-1.5",children:ye?se(nr,{className:"h-1 bg-blue-200 dark:bg-blue-800",indicatorClassName:"bg-blue-500 dark:bg-blue-400"}):null})]})}),s?s(ra):se(Rr,{context:ra})]})}),se(gt,{value:"settings",className:"mt-0",children:se(vn,{searchOptions:xt,setSearchOptions:Ee,enableHighlighting:v,setEnableHighlighting:S,openEmailsWithGmail:C,setOpenEmailsWithGmail:F,activeTab:x,onTabChange:O})}),se(gt,{value:"statistics",className:"mt-0",children:se(kn,{performanceMetrics:ke,searchTerm:J,totalDataCount:u.length,resultsCount:sa,resetStats:Wa,rebuildIndex:ea,isIndexBuilding:ye,activeTab:D,onTabChange:ee})})]})})};import{jsx as Mt,jsxs as Ar}from"react/jsx-runtime";var Ho=({renderHeader:e,title:t,streamEndpoint:a,workerUrls:s,onFooterVisibilityChange:l})=>{let n=q(),r=t===void 0?n.appTitle:t,d=Ta(a),o=d.records,u=Nn(()=>o.reduce((i,{company_name:p})=>(typeof p=="string"&&p.trim().length>0&&i.add(p),i),new Set).size,[o]),m=Mt(ln,{recordCount:o.length,companyCount:u,phase:d.phase,loadedCount:d.loadedCount,totalCount:d.totalCount,errorMessage:d.error?.message??null,onRetry:d.retryNow}),c=Nn(()=>({contactMapRecords:o,isStreamingComplete:d.isComplete,isStreamingFailed:d.phase==="failed",streamPhase:d.phase,loadedCount:d.loadedCount,companyCount:u,totalCount:d.totalCount,errorMessage:d.error?.message??null}),[o,d.isComplete,d.phase,d.loadedCount,u,d.totalCount,d.error]);return Ar("div",{"data-testid":"contact-map-app-view",className:"flex h-full w-full flex-col",children:[e?e({title:r,annotation:m}):Ar("div",{"data-testid":"contact-map-default-header",className:"mb-2 flex items-center justify-between",children:[Mt("h1",{className:"font-bold text-xl",children:r}),m]}),Mt("div",{className:"min-h-0 flex-1",children:Mt(Ir,{streamState:c,workerUrls:s,onFooterVisibilityChange:l})})]})},Vp=e=>{let t=et(),a=Nn(()=>({...t,streamEndpoint:e.streamEndpoint??t.streamEndpoint,workerUrls:{...t.workerUrls,...e.workerUrls},locale:e.locale===void 0?t.locale:e.locale,labels:e.labels===void 0?t.labels:e.labels}),[t,e.streamEndpoint,e.workerUrls,e.locale,e.labels]);return Mt(Jn,{config:a,children:Mt(Ho,{...e})})};dt();oe();function Gp(){return!1}export{ja as AdvancedSearchSettings,Ga as BasicSearchSettings,Tt as CONTACT_MAP_LABEL_CATALOGS,Wt as CONTACT_MAP_LABEL_KEYS,Vn as ContactDetailGrid,Je as ContactDetailPanel,ma as ContactDetailPopup,ga as ContactDetailRowLayout,ln as ContactMapAnnotation,Vp as ContactMapAppView,Jn as ContactMapConfigProvider,br as ContactMapSearchListView,Ir as ContactMapSearchPage,Rr as ContactMapSearchTabGroup,Lr as ContactMapSearchTreeView,ka as ContactMapStreamClient,ue as HighlightedText,bn as IndexWorkerSettings,Bd as LIST_COLLAPSE_THRESHOLD,Ni as LIST_DETAIL_PANEL_MIN_WIDTH,Ud as LIST_EXPAND_THRESHOLD,Ti as LIST_PANEL_MIN_WIDTH,wi as LIST_RESIZE_HANDLE_THICKNESS,yn as LevenshteinWorkerSettings,nr as Progress,vn as SearchOptionsPanel,L as StatItem,kn as StatisticsPanel,La as SwipeOverlay,Sc as TREE_COLLAPSE_THRESHOLD,Zi as TREE_DETAIL_PANEL_MIN_WIDTH,Tc as TREE_EXPAND_THRESHOLD,Ji as TREE_PANEL_MIN_WIDTH,eo as TREE_RESIZE_HANDLE_THICKNESS,xa as Tabs,gt as TabsContent,Bt as TabsList,mt as TabsTrigger,Ea as TreeWorkerSession,Rt as WorkerStatsSection,ro as composeTreeVirtualScrollOptions,Gp as contactMapShouldRevalidate,Qs as deserializeStreamRecord,Jd as finalizeTreeWorker,er as getContactMapRecordMap,Zn as getContactMapStreamClient,un as getTreeWorkerSession,cd as resetContactMapStreamClientForTesting,Zd as resetTreeWorkerSessionForTesting,Ba as resolveContactMapLabels,Xd as syncTreeWorkerRecords,yr as useAnimatedNumber,et as useContactMapConfig,q as useContactMapLabels,Ta as useContactMapStream,cn as useContactPanelSizing,rr as useDynamicViewportHeight,tt as useHorizontalDragScroll,wa as useLongPressPopup,Hi as useReportPopupVisibility,Pa as useResponsiveTwoColumnLayout,Di as useRowPopupRegistry,Cr as useTreeWorker};
1
+ var zr=Object.defineProperty;var Ge=(e,t)=>()=>(e&&(t=e(e=0)),t);var Br=(e,t)=>{for(var a in t)zr(e,a,{get:t[a],enumerable:!0})};import{DIRECTORY_TREE_LABEL_CATALOGS as En,DIRECTORY_TREE_LABEL_KEYS as Fa,resolveDirectoryTreeLabels as Ur}from"@aiquants/directory-tree";import{resolveVirtualScrollLocale as $r,VIRTUAL_SCROLL_LABEL_KEYS as Vr}from"@aiquants/virtualscroll";var Kr,G,ot,sa,On,Wt,Nt,Aa,jr,Gr,za,Ba,Ua,lt=Ge(()=>{"use strict";Kr=Object.freeze({en:"en-US",ja:"ja-JP"}),G=(e,t)=>t.toLocaleString(Kr[e]),ot=(e,t,a)=>e==="1"?t:a,sa=Object.freeze({en:Object.freeze({appTitle:"Contact Map",annotationTotalLabel:"Total:",annotationCompaniesLabel:"Companies:",annotationStreamingProgress:({loaded:e,total:t,percent:a})=>`Streaming (${G("en",e)} / ${G("en",t)} \xB7 ${a}%)`,annotationStreamingCount:e=>`Streaming (${G("en",e)} loaded)`,annotationLoadFailed:e=>`Failed to load (${G("en",e)} received)`,annotationRetry:"Retry",recordUnit:e=>ot(e,"record","records"),companyUnit:e=>ot(e,"company","companies"),searchTab:"Fuzzy search",searchSettings:"Search settings",searchStatistics:"Search statistics",operatorAndTitle:"AND search (all terms match)",operatorOrTitle:"OR search (any term matches)",operatorAnd:"AND",operatorOr:"OR",operatorAndHint:"All terms",operatorOrHint:"Any term",searchPlaceholder:"Fuzzy search...",searchBusyTitle:"Searching",clearSearch:"Clear search",searching:"Searching...",registeredCountLabel:"Registered:",rebuildingIndex:"Rebuilding index...",errorLabel:"Error:",resultCountLabel:"Results:",resultUnit:e=>ot(e,"match","matches"),listViewTab:"List",treeViewTab:"Tree",columnNo:"No",columnId:"ID",columnScore:"Score",columnName:"Name",columnTitle:"Title",columnCompany:"Company",columnDepartment:"Department",columnPhone:"Phone",columnEmail:"Email",columnUpdatedAt:"Updated",listRowNumber:e=>`No. ${e}`,listNoSearchResults:"No search results found",listNoData:"No data",listResizeHandle:"Resize the border between the contact list and the detail pane",detailHeading:"Contact details",close:"Close",noName:"(No Name)",treeNodeCountTitle:"Number of nodes built in the tree view",treeNodeCountLabel:"Nodes:",treeNodeCount:e=>G("en",e),uncategorizedCompany:"Uncategorized",treeDirectoryName:(e,t)=>`${e} (${G("en",t)})`,treeStreamInterruptedTitle:"Streaming was interrupted. Only the data received so far is shown",treeStreamInterrupted:"Interrupted",treeStreamLoadingTitle:"Receiving data streamed from the network",treeStreamLoading:"Loading...",treeBuildingTitle:"Building and expanding the directory tree from the received data",treeBuilding:"Treeing...",treeCompleteTitle:"Every tree node has been built",treeComplete:"Complete",treeShowEntireCompanyTitle:"Show the whole company of every search hit",treeShowEntireCompany:"Whole company",treeExpandAll:"Expand all directories",treeExpandAllTitle:"Expand all",treeCollapseAll:"Collapse all directories",treeCollapseAllTitle:"Collapse all",treeNoMatches:"No contacts match the criteria",treeEmpty:"No contacts to display",treeResizeHandle:"Resize the border between the directory tree and the detail pane",copyField:e=>`Copy ${e}`,detailEmptyTitle:"Select a contact to see its details",detailEmptyHint:"Choose a person from the list",detailTabSummary:"Summary",detailTabBasic:"Basic info",detailBasicProfile:"Profile",detailTabContact:"Contact",detailTabMeta:"Metadata",preferred:"Preferred",summaryEmail:"Email",summaryPhone:"Phone",summaryLastContact:"Last contact",sectionEmail:"Email",sectionEmailEmpty:"No email addresses registered",sectionPhone:"Phone / Fax",sectionPhoneEmpty:"No phone numbers registered",fieldFullName:"Name",fieldFullNameReading:"Name (reading)",fieldTitle:"Title",fieldDepartment:"Department",fieldCompanyName:"Company",fieldCompanyNameReading:"Company (reading)",fieldAddress:"Address",fieldPostalCode:"Postal code",fieldUrl:"URL",fieldCustomEmail:"Custom email",fieldEmail:"Email",fieldCustomMobilePhone:"Custom mobile",fieldMobilePhone:"Mobile",fieldCompanyPhone:"Company phone",fieldCompanyFax:"Company fax",fieldCreatedBy:"Created by",fieldCreatedAt:"Created at",fieldUpdatedBy:"Updated by",fieldUpdatedAt:"Updated at",popupCustomMobilePhone:"Mobile (custom)",popupMobilePhone:"Mobile",popupCustomCompanyPhone:"Company phone (custom)",popupCompanyPhone:"Company phone",popupCustomEmail:"Email (custom)",popupEmail:"Email",popupGmailHint:"Double-click or double-tap to open Gmail",popupLastContactDate:"Last contact:",popupNoContactMethods:"No contact information to display",overlayTitle:"Details",overlayBackdrop:"Tap the background to close",settingsResetAllTitle:"Reset all settings",settingsResetAll:"Reset all",settingsTabsLabel:"Search option tabs",settingsBasicTab:"Basic settings",settingsAdvancedTab:"Advanced settings",indexWorkerName:"Index Worker",levenshteinWorkerName:"Levenshtein Worker",currentValueLabel:"Current:",resetToDefaultsTitle:"Reset to defaults",reset:"Reset",relevanceOnlyNotice:"Editable only when sorting by relevance",relevanceWeightsHeading:"Relevance score weights",fieldWeight:"Field weight",scoreTuningHeading:"Score tuning",maxResults:"Maximum results",basicThresholdHeading:"Final similarity threshold",basicThresholdLabel:"Adjust the minimum score",basicThresholdRangeRelevance:"In relevance mode a score can exceed 1.0 (range: 0.0-1.5)",basicThresholdRange:"Range: 0.0-1.0",basicDisplayHeading:"Display options",basicCaseSensitive:"Case-sensitive",basicHighlight:"Highlight matches",basicOpenEmailsWithGmail:"Open email addresses in Gmail compose",basicMultiTermOperator:"Multi-term query operator",basicOperatorOr:"OR (any term matches)",basicOperatorAnd:"AND (all terms match)",basicMultiTermHint:"How space-separated terms are combined (default: OR)",basicSortHeading:"Sorting",basicSortBy:"Sort by",basicSortByScore:"Score",basicSortByRelevance:"Relevance",basicSortByOriginal:"Original order",basicSortOrder:"Sort order",basicSortDescending:"Descending",basicSortAscending:"Ascending",basicEngineHeading:"Search engine",basicStrategy:"Parallel search strategy",basicStrategyBalanced:"Balanced",basicStrategyIndexFirst:"Index first",basicStrategyLevenshteinFirst:"Levenshtein first",basicIndexFiltering:"Index filtering",basicLevenshtein:"Levenshtein distance",advancedLearningHeading:"Learning weight",advancedLearningLabel:"Weight factor",advancedLearningHint:"Weight applied when re-learning (higher favors past search results)",advancedDebounceHeading:"Debounce time",advancedDebounceLabel:"Input delay (ms)",advancedDebounceHint:"How long input is awaited. Shorter is more real-time, longer reduces load",indexSettingsHeading:"Index Worker settings",indexBuildHeading:"Index build",indexNgramSize:"N-gram size",indexNgramSizeHint:"How many characters each chunk holds. Smaller is faster but less accurate",indexMinNgramOverlap:"Minimum N-gram matches",indexMinNgramOverlapHint:"Candidates with fewer matches are excluded",indexCandidateHeading:"Candidate filtering",indexThreshold:"Index threshold",indexThresholdHint:"Lower bound of the Jaro-Winkler similarity (range: 0.0-1.0)",indexNgramOverlapThreshold:"N-gram overlap threshold",indexNgramOverlapThresholdHint:"How much N-grams must overlap. Higher narrows candidates more strictly",indexStrategyHeading:"Search strategy and candidates",indexStrategy:"Search strategy",indexStrategyFast:"Fast",indexStrategyAccurate:"Accurate",indexStrategyHybrid:"Hybrid (adaptive)",indexStrategyHint:"Balance processing load against accuracy",indexMinCandidatesRatio:"Minimum candidate ratio",indexMinCandidatesRatioHint:"Share of candidates always kept",indexMaxCandidatesRatio:"Maximum candidate ratio",indexMaxCandidatesRatioHint:"Upper bound on candidates; narrowed dynamically when exceeded",indexJaroWinklerPrefix:"Jaro-Winkler prefix weight",indexJaroWinklerPrefixHint:"Bonus given to a matching prefix",indexMaxResultsHint:"Maximum number of results to fetch. Larger is more thorough but slower",indexFieldWeightHint:"How much the number of matched fields counts",indexPerfectMatchBonus:"Exact match bonus",indexPerfectMatchBonusHint:"Bonus added on an exact match",indexContainmentHeading:"Containment score (Japanese / substrings)",indexContainmentBase:"Containment base score (containmentScoreBase)",indexContainmentBaseHint:"Minimum base score when the query is fully contained in the string (rescues short Japanese queries such as 2 characters)",indexContainmentCoverage:"Containment coverage weight (containmentCoverageWeight)",indexContainmentCoverageHint:"Extra score by the query length / field length ratio (total capped at 1.0)",levenshteinSettingsHeading:"Levenshtein Worker settings",levenshteinCandidateHeading:"Candidate filter",levenshteinThreshold:"Levenshtein threshold",levenshteinThresholdHintRelevance:"Keep only results at or above this threshold (range: 0.0-1.5)",levenshteinThresholdHint:"Keep only results at or above this threshold (range: 0.0-1.0)",levenshteinLengthSimilarity:"Length similarity threshold",levenshteinLengthSimilarityHint:"Exclude candidates whose length differs greatly, for speed",levenshteinLengthPenalty:"Length difference penalty",levenshteinLengthPenaltyHint:"How much a length difference is penalized. Larger favors equal lengths",levenshteinResultsHeading:"Result count",levenshteinMaxResultsHint:"Maximum number of results to return. Larger is more thorough but slower",levenshteinFieldWeightHint:"Weight of the number of matched fields",levenshteinPartialBonus:"Partial match bonus",levenshteinPartialBonusHint:"Extra score for a partial match",statsRebuildingTitle:"Rebuilding the index",statsRebuildIndexTabOnlyTitle:"Available on the Index tab only",statsRebuildTitle:"Rebuild the index",statsRebuilding:"Rebuilding...",statsRebuild:"Rebuild Index",statsResetTitle:"Reset statistics",statsOverviewTab:"Overview",statsIndexTab:"Index",statsLevenshteinTab:"Levenshtein",statTotalSearches:"Total searches",statAverageSearchTime:"Average search time",statDataCount:"Data items",statResultCount:"Search results",statDisplayedCount:"Displayed items",statsNoData:"No statistics yet",statsBasicHeading:"Basic statistics",statTotalProcessingTime:"Total processing time",statLastSearchTime:"Last search time",statErrorCount:"Errors",statUpdatedAt:"Statistics updated at",statsOperationsHeading:"Operations",statTotalOperations:"Total operations",statsIndexHeading:"Index statistics",statIndexBuilds:"Index builds",statDataSize:"Data size",statLastBuildTime:"Last build time",statsCacheHeading:"Cache statistics",statCacheNgram:"N-gram",statCacheWord:"Words",statCachePhonetic:"Phonetic",statsIndexMetadataHeading:"Index metadata",statsCalculationsHeading:"Calculations",statTotalCalculations:"Total calculations",statDistanceCalculations:"Distance calculations",statAverageDistance:"Average distance",statMinDistance:"Minimum distance",statMaxDistance:"Maximum distance",notAvailable:"N/A",statsMatchesHeading:"Matches",statPartialMatches:"Partial matches",statPerfectMatches:"Exact matches",statEarlyTerminations:"Early terminations",statsSimilarityHeading:"Similarity distribution",statAbove80:"80% or more",statAbove60:"60% or more",statAbove40:"40% or more",statBelow40:"Below 40%",statsDistanceHeading:"Distance distribution (top 6)",statDistance:e=>`Distance ${e}`,statsQueryLengthHeading:"Query lengths (top 6)",statQueryLength:e=>`Length ${e}`,statQueryLengthValue:({count:e,averagePercent:t})=>{let a=G("en",e);return`${a} ${ot(a,"time","times")} / average ${t}%`},statsFieldPerformanceHeading:"Field performance (top 6)",statAverageScore:"Average score",statMatchCount:"Matches",statBestWorstScore:"Best / worst score",statsInsightsHeading:"Performance insights",statBestField:"Best-performing field",statRecentAverageTime:"Recent average processing time",statRecentAverageResults:"Recent average results",statThroughput:"Throughput",statCommonQueryLength:"Most common query length",statHistoryEntries:"History entries",statHighSimilarity:"High similarity",statMediumSimilarity:"Medium similarity",statLowSimilarity:"Low similarity",statVeryLowSimilarity:"Very low similarity",statsRecentHistoryHeading:"Recent history (latest 3)",statsHistoryEntry:({processingTimeMs:e,resultCount:t})=>`Processing time: ${e} ms / results: ${G("en",t)}`,timesUnit:e=>ot(e," time"," times"),itemsUnit:e=>ot(e," item"," items"),charactersUnit:e=>ot(e," character"," characters"),throughputUnit:" ops/s"}),ja:Object.freeze({appTitle:"Contact Map",annotationTotalLabel:"\u7DCF\u4EF6\u6570:",annotationCompaniesLabel:"\u4F01\u696D\u6570:",annotationStreamingProgress:({loaded:e,total:t,percent:a})=>`\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u8AAD\u307F\u8FBC\u307F\u4E2D (${G("ja",e)} / ${G("ja",t)} \u4EF6\u30FB${a}%)`,annotationStreamingCount:e=>`\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u8AAD\u307F\u8FBC\u307F\u4E2D (${G("ja",e)} \u4EF6)`,annotationLoadFailed:e=>`\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F (${G("ja",e)} \u4EF6\u53D7\u4FE1\u6E08)`,annotationRetry:"\u518D\u8A66\u884C",recordUnit:()=>"\u4EF6",companyUnit:()=>"\u793E",searchTab:"\u3042\u3044\u307E\u3044\u691C\u7D22",searchSettings:"\u691C\u7D22\u8A2D\u5B9A",searchStatistics:"\u691C\u7D22\u7D71\u8A08",operatorAndTitle:"AND \u691C\u7D22 (\u3059\u3079\u3066\u4E00\u81F4)",operatorOrTitle:"OR \u691C\u7D22 (\u3044\u305A\u308C\u304B\u4E00\u81F4)",operatorAnd:"AND",operatorOr:"OR",operatorAndHint:"\u5168\u8A9E\u4E00\u81F4",operatorOrHint:"\u3044\u305A\u308C\u304B\u4E00\u81F4",searchPlaceholder:"\u3042\u3044\u307E\u3044\u691C\u7D22...",searchBusyTitle:"\u691C\u7D22\u51E6\u7406\u4E2D",clearSearch:"\u691C\u7D22\u3092\u30AF\u30EA\u30A2",searching:"\u691C\u7D22\u4E2D...",registeredCountLabel:"\u767B\u9332\u4EF6\u6570:",rebuildingIndex:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u518D\u69CB\u7BC9\u4E2D...",errorLabel:"\u30A8\u30E9\u30FC:",resultCountLabel:"\u691C\u7D22\u7D50\u679C:",resultUnit:()=>"\u4EF6",listViewTab:"\u4E00\u89A7",treeViewTab:"\u30C4\u30EA\u30FC",columnNo:"No",columnId:"ID",columnScore:"\u30B9\u30B3\u30A2",columnName:"\u6C0F\u540D",columnTitle:"\u5F79\u8077",columnCompany:"\u4F1A\u793E\u540D",columnDepartment:"\u90E8\u7F72",columnPhone:"\u96FB\u8A71\u756A\u53F7",columnEmail:"\u30E1\u30FC\u30EB",columnUpdatedAt:"\u66F4\u65B0\u65E5\u6642",listRowNumber:e=>`No. ${e}`,listNoSearchResults:"\u691C\u7D22\u7D50\u679C\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",listNoData:"\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093",listResizeHandle:"\u9023\u7D61\u5148\u4E00\u89A7\u3068\u8A73\u7D30\u30DA\u30A4\u30F3\u306E\u5883\u754C\u306E\u30B5\u30A4\u30BA\u5909\u66F4\u30CF\u30F3\u30C9\u30EB",detailHeading:"\u9023\u7D61\u5148\u8A73\u7D30",close:"\u9589\u3058\u308B",noName:"\u540D\u524D\u672A\u8A2D\u5B9A",treeNodeCountTitle:"\u30C4\u30EA\u30FC\u30D3\u30E5\u30FC\u3067\u69CB\u7BC9\u3055\u308C\u305F\u5168\u30CE\u30FC\u30C9\u6570",treeNodeCountLabel:"\u30CE\u30FC\u30C9:",treeNodeCount:e=>`${G("ja",e)} \u500B`,uncategorizedCompany:"\u672A\u5206\u985E",treeDirectoryName:(e,t)=>`${e} (${G("ja",t)})`,treeStreamInterruptedTitle:"\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u304C\u4E2D\u65AD\u3055\u308C\u307E\u3057\u305F\u3002\u53D7\u4FE1\u6E08\u307F\u30C7\u30FC\u30BF\u306E\u307F\u8868\u793A\u3057\u3066\u3044\u307E\u3059",treeStreamInterrupted:"\u4E2D\u65AD",treeStreamLoadingTitle:"\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u304B\u3089\u306E\u30C7\u30FC\u30BF\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u3092\u53D7\u4FE1\u4E2D",treeStreamLoading:"\u8AAD\u307F\u8FBC\u307F\u4E2D...",treeBuildingTitle:"\u53D7\u53D6\u30C7\u30FC\u30BF\u3092\u57FA\u306B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u30C4\u30EA\u30FC\u69CB\u9020\u3092\u6700\u7D42\u69CB\u7BC9\u30FB\u5C55\u958B\u4E2D",treeBuilding:"\u30C4\u30EA\u30FC\u69CB\u7BC9\u4E2D...",treeCompleteTitle:"\u30C4\u30EA\u30FC\u30CE\u30FC\u30C9\u306E\u5168\u4EF6\u69CB\u7BC9\u304C\u5B8C\u4E86\u3057\u307E\u3057\u305F",treeComplete:"\u5B8C\u4E86",treeShowEntireCompanyTitle:"\u691C\u7D22\u30D2\u30C3\u30C8\u3057\u305F\u4F1A\u793E\u5168\u4F53\u3092\u8868\u793A",treeShowEntireCompany:"\u5168\u4F53\u8868\u793A",treeExpandAll:"\u5168\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u5C55\u958B",treeExpandAllTitle:"\u3059\u3079\u3066\u5C55\u958B",treeCollapseAll:"\u5168\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u6298\u308A\u305F\u305F\u307F",treeCollapseAllTitle:"\u3059\u3079\u3066\u6298\u308A\u305F\u305F\u307F",treeNoMatches:"\u6761\u4EF6\u306B\u4E00\u81F4\u3059\u308B\u9023\u7D61\u5148\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",treeEmpty:"\u8868\u793A\u3059\u308B\u9023\u7D61\u5148\u304C\u3042\u308A\u307E\u305B\u3093",treeResizeHandle:"\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u30C4\u30EA\u30FC\u3068\u8A73\u7D30\u30DA\u30A4\u30F3\u306E\u5883\u754C\u306E\u30B5\u30A4\u30BA\u5909\u66F4\u30CF\u30F3\u30C9\u30EB",copyField:e=>`\u300C${e}\u300D\u3092\u30B3\u30D4\u30FC`,detailEmptyTitle:"\u9023\u7D61\u5148\u3092\u9078\u629E\u3059\u308B\u3068\u8A73\u7D30\u304C\u8868\u793A\u3055\u308C\u307E\u3059",detailEmptyHint:"\u4E00\u89A7\u304B\u3089\u5BFE\u8C61\u306E\u4EBA\u7269\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",detailTabSummary:"\u30B5\u30DE\u30EA\u30FC",detailTabBasic:"\u57FA\u672C\u60C5\u5831",detailBasicProfile:"\u57FA\u672C\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB",detailTabContact:"\u9023\u7D61\u5148",detailTabMeta:"\u30E1\u30BF\u60C5\u5831",preferred:"\u512A\u5148",summaryEmail:"\u30E1\u30FC\u30EB",summaryPhone:"\u96FB\u8A71",summaryLastContact:"\u6700\u7D42\u63A5\u89E6",sectionEmail:"\u30E1\u30FC\u30EB",sectionEmailEmpty:"\u767B\u9332\u3055\u308C\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u306F\u3042\u308A\u307E\u305B\u3093",sectionPhone:"\u96FB\u8A71\u30FBFAX",sectionPhoneEmpty:"\u767B\u9332\u3055\u308C\u305F\u96FB\u8A71\u756A\u53F7\u306F\u3042\u308A\u307E\u305B\u3093",fieldFullName:"\u6C0F\u540D",fieldFullNameReading:"\u6C0F\u540D (\u304B\u306A)",fieldTitle:"\u5F79\u8077",fieldDepartment:"\u90E8\u7F72",fieldCompanyName:"\u4F1A\u793E\u540D",fieldCompanyNameReading:"\u4F1A\u793E\u540D (\u304B\u306A)",fieldAddress:"\u4F4F\u6240",fieldPostalCode:"\u90F5\u4FBF\u756A\u53F7",fieldUrl:"URL",fieldCustomEmail:"\u30AB\u30B9\u30BF\u30E0\u30E1\u30FC\u30EB",fieldEmail:"\u30E1\u30FC\u30EB",fieldCustomMobilePhone:"\u30AB\u30B9\u30BF\u30E0\u643A\u5E2F\u756A\u53F7",fieldMobilePhone:"\u643A\u5E2F\u756A\u53F7",fieldCompanyPhone:"\u4F1A\u793E\u96FB\u8A71\u756A\u53F7",fieldCompanyFax:"\u4F1A\u793E FAX \u756A\u53F7",fieldCreatedBy:"\u4F5C\u6210\u8005",fieldCreatedAt:"\u4F5C\u6210\u65E5\u6642",fieldUpdatedBy:"\u66F4\u65B0\u8005",fieldUpdatedAt:"\u66F4\u65B0\u65E5\u6642",popupCustomMobilePhone:"\u643A\u5E2F\u96FB\u8A71 (\u30AB\u30B9\u30BF\u30E0)",popupMobilePhone:"\u643A\u5E2F\u96FB\u8A71",popupCustomCompanyPhone:"\u4F1A\u793E\u96FB\u8A71 (\u30AB\u30B9\u30BF\u30E0)",popupCompanyPhone:"\u4F1A\u793E\u96FB\u8A71",popupCustomEmail:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9 (\u30AB\u30B9\u30BF\u30E0)",popupEmail:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",popupGmailHint:"\u30C0\u30D6\u30EB\u30AF\u30EA\u30C3\u30AF\u307E\u305F\u306F\u4E8C\u5EA6\u30BF\u30C3\u30D7\u3067 Gmail \u3092\u958B\u304D\u307E\u3059",popupLastContactDate:"\u6700\u7D42\u30B3\u30F3\u30BF\u30AF\u30C8\u65E5:",popupNoContactMethods:"\u8868\u793A\u3067\u304D\u308B\u9023\u7D61\u5148\u60C5\u5831\u304C\u3042\u308A\u307E\u305B\u3093",overlayTitle:"\u8A73\u7D30",overlayBackdrop:"\u80CC\u666F\u3092\u30BF\u30C3\u30D7\u3057\u3066\u9589\u3058\u308B",settingsResetAllTitle:"\u3059\u3079\u3066\u306E\u8A2D\u5B9A\u3092\u30EA\u30BB\u30C3\u30C8",settingsResetAll:"\u3059\u3079\u3066\u30EA\u30BB\u30C3\u30C8",settingsTabsLabel:"\u691C\u7D22\u30AA\u30D7\u30B7\u30E7\u30F3\u8A2D\u5B9A\u30BF\u30D6",settingsBasicTab:"\u57FA\u672C\u8A2D\u5B9A",settingsAdvancedTab:"\u8A73\u7D30\u8A2D\u5B9A",indexWorkerName:"Index Worker",levenshteinWorkerName:"Levenshtein Worker",currentValueLabel:"\u73FE\u5728\u5024:",resetToDefaultsTitle:"\u30C7\u30D5\u30A9\u30EB\u30C8\u5024\u306B\u30EA\u30BB\u30C3\u30C8",reset:"\u30EA\u30BB\u30C3\u30C8",relevanceOnlyNotice:"Relevance \u30BD\u30FC\u30C8\u6642\u306E\u307F\u5909\u66F4\u53EF\u80FD",relevanceWeightsHeading:"Relevance \u30B9\u30B3\u30A2\u91CD\u307F",fieldWeight:"\u30D5\u30A3\u30FC\u30EB\u30C9\u91CD\u307F",scoreTuningHeading:"\u30B9\u30B3\u30A2\u8ABF\u6574",maxResults:"\u6700\u5927\u7D50\u679C\u6570",basicThresholdHeading:"\u6700\u7D42\u985E\u4F3C\u5EA6\u95BE\u5024",basicThresholdLabel:"\u30B9\u30B3\u30A2\u306E\u4E0B\u9650\u3092\u8ABF\u6574",basicThresholdRangeRelevance:"Relevance \u30E2\u30FC\u30C9\u3067\u306F\u30B9\u30B3\u30A2\u304C 1.0 \u3092\u8D85\u3048\u308B\u5834\u5408\u304C\u3042\u308A\u307E\u3059 (\u7BC4\u56F2: 0.0-1.5)",basicThresholdRange:"\u7BC4\u56F2: 0.0-1.0",basicDisplayHeading:"\u8868\u793A\u30AA\u30D7\u30B7\u30E7\u30F3",basicCaseSensitive:"\u5927\u6587\u5B57\u5C0F\u6587\u5B57\u3092\u533A\u5225",basicHighlight:"\u30CF\u30A4\u30E9\u30A4\u30C8\u8868\u793A",basicOpenEmailsWithGmail:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092 Gmail \u306E\u4F5C\u6210\u753B\u9762\u3067\u958B\u304F",basicMultiTermOperator:"\u8907\u6570\u8A9E\u30AF\u30A8\u30EA\u306E\u6F14\u7B97\u5B50",basicOperatorOr:"OR (\u3044\u305A\u308C\u304B\u4E00\u81F4)",basicOperatorAnd:"AND (\u3059\u3079\u3066\u4E00\u81F4)",basicMultiTermHint:"\u8907\u6570\u8A9E\u3092\u30B9\u30DA\u30FC\u30B9\u3067\u5165\u529B\u3057\u305F\u3068\u304D\u306E\u7D50\u5408\u65B9\u6CD5 (\u65E2\u5B9A\u306F OR)",basicSortHeading:"\u30BD\u30FC\u30C8\u8A2D\u5B9A",basicSortBy:"\u30BD\u30FC\u30C8\u57FA\u6E96",basicSortByScore:"\u30B9\u30B3\u30A2",basicSortByRelevance:"\u95A2\u9023\u6027",basicSortByOriginal:"\u5143\u306E\u9806\u5E8F",basicSortOrder:"\u30BD\u30FC\u30C8\u9806\u5E8F",basicSortDescending:"\u964D\u9806",basicSortAscending:"\u6607\u9806",basicEngineHeading:"\u691C\u7D22\u30A8\u30F3\u30B8\u30F3\u8A2D\u5B9A",basicStrategy:"\u4E26\u5217\u691C\u7D22\u6226\u7565",basicStrategyBalanced:"\u30D0\u30E9\u30F3\u30B9",basicStrategyIndexFirst:"Index \u512A\u5148",basicStrategyLevenshteinFirst:"Levenshtein \u512A\u5148",basicIndexFiltering:"Index \u30D5\u30A3\u30EB\u30BF\u30EA\u30F3\u30B0",basicLevenshtein:"Levenshtein \u8DDD\u96E2\u8A08\u7B97",advancedLearningHeading:"\u5B66\u7FD2\u91CD\u307F",advancedLearningLabel:"\u91CD\u307F\u4FC2\u6570",advancedLearningHint:"\u518D\u5B66\u7FD2\u6642\u306E\u91CD\u307F\u4ED8\u3051 (\u5927\u304D\u3044\u307B\u3069\u904E\u53BB\u306E\u691C\u7D22\u7D50\u679C\u3092\u512A\u5148)",advancedDebounceHeading:"\u30C7\u30D0\u30A6\u30F3\u30B9\u6642\u9593",advancedDebounceLabel:"\u5165\u529B\u9045\u5EF6 (ms)",advancedDebounceHint:"\u5165\u529B\u306E\u5F85\u3061\u6642\u9593\u3002\u77ED\u3044\u307B\u3069\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u3001\u9577\u3044\u307B\u3069\u8CA0\u8377\u8EFD\u6E1B",indexSettingsHeading:"Index Worker \u8A2D\u5B9A",indexBuildHeading:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u69CB\u7BC9",indexNgramSize:"N-gram \u30B5\u30A4\u30BA",indexNgramSizeHint:"\u6587\u5B57\u5217\u3092\u4F55\u6587\u5B57\u5358\u4F4D\u3067\u5206\u5272\u3059\u308B\u304B\u3002\u5C0F\u3055\u3044\u307B\u3069\u9AD8\u901F\u3060\u304C\u7CBE\u5EA6\u4F4E\u4E0B",indexMinNgramOverlap:"\u6700\u5C0F N-gram \u4E00\u81F4\u6570",indexMinNgramOverlapHint:"\u4E00\u81F4\u6570\u304C\u3053\u306E\u5024\u3092\u4E0B\u56DE\u308B\u5019\u88DC\u306F\u9664\u5916",indexCandidateHeading:"\u5019\u88DC\u7D5E\u308A\u8FBC\u307F",indexThreshold:"Index \u95BE\u5024",indexThresholdHint:"Jaro-Winkler \u985E\u4F3C\u5EA6\u306E\u4E0B\u9650 (\u7BC4\u56F2: 0.0-1.0)",indexNgramOverlapThreshold:"N-gram \u91CD\u8907\u5EA6\u95BE\u5024",indexNgramOverlapThresholdHint:"N-gram \u306E\u91CD\u306A\u308A\u5177\u5408\u3002\u9AD8\u3044\u307B\u3069\u53B3\u5BC6\u306B\u5019\u88DC\u3092\u7D5E\u308B",indexStrategyHeading:"\u691C\u7D22\u6226\u7565\u3068\u5019\u88DC\u6570",indexStrategy:"\u691C\u7D22\u6226\u7565",indexStrategyFast:"Fast (\u9AD8\u901F)",indexStrategyAccurate:"Accurate (\u6B63\u78BA)",indexStrategyHybrid:"Hybrid (\u52D5\u7684)",indexStrategyHint:"\u51E6\u7406\u8CA0\u8377\u3068\u7CBE\u5EA6\u306E\u30D0\u30E9\u30F3\u30B9\u3092\u9078\u629E",indexMinCandidatesRatio:"\u6700\u5C0F\u5019\u88DC\u6BD4\u7387",indexMinCandidatesRatioHint:"\u6700\u4F4E\u9650\u78BA\u4FDD\u3059\u308B\u5019\u88DC\u5272\u5408",indexMaxCandidatesRatio:"\u6700\u5927\u5019\u88DC\u6BD4\u7387",indexMaxCandidatesRatioHint:"\u5019\u88DC\u6570\u306E\u4E0A\u9650\u3002\u8D85\u3048\u308B\u3068\u52D5\u7684\u306B\u7D5E\u308A\u8FBC\u307F",indexJaroWinklerPrefix:"Jaro-Winkler \u63A5\u982D\u8F9E\u91CD\u307F",indexJaroWinklerPrefixHint:"\u5148\u982D\u4E00\u81F4\u306B\u4ED8\u4E0E\u3059\u308B\u30DC\u30FC\u30CA\u30B9\u5024",indexMaxResultsHint:"\u53D6\u5F97\u3059\u308B\u6700\u5927\u4EF6\u6570\u3002\u5927\u304D\u3044\u307B\u3069\u5305\u62EC\u7684\u3060\u304C\u9045\u5EF6\u304C\u5897\u52A0",indexFieldWeightHint:"\u30DE\u30C3\u30C1\u30D5\u30A3\u30FC\u30EB\u30C9\u6570\u306B\u3069\u308C\u3060\u3051\u91CD\u307F\u4ED8\u3051\u3059\u308B\u304B",indexPerfectMatchBonus:"\u5B8C\u5168\u4E00\u81F4\u30DC\u30FC\u30CA\u30B9",indexPerfectMatchBonusHint:"\u5B8C\u5168\u4E00\u81F4\u6642\u306B\u8FFD\u52A0\u3059\u308B\u30DC\u30FC\u30CA\u30B9\u5024",indexContainmentHeading:"\u548C\u6587\u30FB\u90E8\u5206\u6587\u5B57\u5217\u5305\u542B\u30B9\u30B3\u30A2",indexContainmentBase:"\u5305\u542B \u57FA\u790E\u30B9\u30B3\u30A2 (containmentScoreBase)",indexContainmentBaseHint:"\u30AF\u30A8\u30EA\u304C\u6587\u5B57\u5217\u4E2D\u306B\u5B8C\u5168\u306B\u542B\u307E\u308C\u308B\u5834\u5408\u306E\u6700\u4F4E\u57FA\u790E\u30B9\u30B3\u30A2 (\u548C\u6587 2 \u6587\u5B57\u7B49\u306E\u6551\u6E08)",indexContainmentCoverage:"\u5305\u542B \u88AB\u8986\u7387\u91CD\u307F (containmentCoverageWeight)",indexContainmentCoverageHint:"\u30AF\u30A8\u30EA\u9577 / \u30D5\u30A3\u30FC\u30EB\u30C9\u9577\u306E\u6BD4\u7387\u306B\u5FDC\u3058\u305F\u52A0\u7B97\u30B9\u30B3\u30A2 (\u5408\u8A08 1.0 \u4EE5\u4E0B\u306B\u5236\u9650)",levenshteinSettingsHeading:"Levenshtein Worker \u8A73\u7D30\u8A2D\u5B9A",levenshteinCandidateHeading:"\u5019\u88DC\u30D5\u30A3\u30EB\u30BF",levenshteinThreshold:"Levenshtein \u95BE\u5024",levenshteinThresholdHintRelevance:"\u3053\u306E\u95BE\u5024\u4EE5\u4E0A\u306E\u7D50\u679C\u306E\u307F\u4FDD\u6301 (\u7BC4\u56F2: 0.0-1.5)",levenshteinThresholdHint:"\u3053\u306E\u95BE\u5024\u4EE5\u4E0A\u306E\u7D50\u679C\u306E\u307F\u4FDD\u6301 (\u7BC4\u56F2: 0.0-1.0)",levenshteinLengthSimilarity:"\u9577\u3055\u985E\u4F3C\u5EA6\u95BE\u5024",levenshteinLengthSimilarityHint:"\u9577\u3055\u304C\u5927\u304D\u304F\u7570\u306A\u308B\u5019\u88DC\u3092\u4E8B\u524D\u306B\u9664\u5916\u3057\u3066\u901F\u5EA6\u5411\u4E0A",levenshteinLengthPenalty:"\u9577\u3055\u5DEE\u30DA\u30CA\u30EB\u30C6\u30A3",levenshteinLengthPenaltyHint:"\u9577\u3055\u5DEE\u3092\u3069\u308C\u3060\u3051\u6E1B\u70B9\u3059\u308B\u304B\u3002\u5927\u304D\u3044\u307B\u3069\u9577\u3055\u4E00\u81F4\u3092\u91CD\u8996",levenshteinResultsHeading:"\u7D50\u679C\u6570\u5236\u5FA1",levenshteinMaxResultsHint:"\u8FD4\u5374\u3059\u308B\u6700\u5927\u4EF6\u6570\u3002\u5927\u304D\u3044\u307B\u3069\u7DB2\u7F85\u7684\u3060\u304C\u51E6\u7406\u6642\u9593\u304C\u5897\u52A0",levenshteinFieldWeightHint:"\u4E00\u81F4\u30D5\u30A3\u30FC\u30EB\u30C9\u6570\u306E\u8A55\u4FA1\u91CD\u307F",levenshteinPartialBonus:"\u90E8\u5206\u4E00\u81F4\u30DC\u30FC\u30CA\u30B9",levenshteinPartialBonusHint:"\u90E8\u5206\u4E00\u81F4\u306B\u4ED8\u4E0E\u3059\u308B\u8FFD\u52A0\u30B9\u30B3\u30A2",statsRebuildingTitle:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u518D\u69CB\u7BC9\u4E2D",statsRebuildIndexTabOnlyTitle:"Index \u30BF\u30D6\u3067\u306E\u307F\u4F7F\u7528\u53EF\u80FD",statsRebuildTitle:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u3092\u518D\u69CB\u7BC9",statsRebuilding:"\u518D\u69CB\u7BC9\u4E2D...",statsRebuild:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u518D\u69CB\u7BC9",statsResetTitle:"\u7D71\u8A08\u3092\u30EA\u30BB\u30C3\u30C8",statsOverviewTab:"\u6982\u8981",statsIndexTab:"Index",statsLevenshteinTab:"Levenshtein",statTotalSearches:"\u7DCF\u691C\u7D22\u56DE\u6570",statAverageSearchTime:"\u5E73\u5747\u691C\u7D22\u6642\u9593",statDataCount:"\u30C7\u30FC\u30BF\u4EF6\u6570",statResultCount:"\u691C\u7D22\u7D50\u679C\u4EF6\u6570",statDisplayedCount:"\u8868\u793A\u4EF6\u6570",statsNoData:"\u7D71\u8A08\u30C7\u30FC\u30BF\u306A\u3057",statsBasicHeading:"\u57FA\u672C\u7D71\u8A08",statTotalProcessingTime:"\u7DCF\u51E6\u7406\u6642\u9593",statLastSearchTime:"\u6700\u5F8C\u306E\u691C\u7D22\u6642\u9593",statErrorCount:"\u30A8\u30E9\u30FC\u6570",statUpdatedAt:"\u7D71\u8A08\u66F4\u65B0\u6642\u523B",statsOperationsHeading:"\u64CD\u4F5C\u7D71\u8A08",statTotalOperations:"\u7DCF\u64CD\u4F5C\u6570",statsIndexHeading:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u7D71\u8A08",statIndexBuilds:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u69CB\u7BC9\u56DE\u6570",statDataSize:"\u30C7\u30FC\u30BF\u30B5\u30A4\u30BA",statLastBuildTime:"\u6700\u5F8C\u306E\u69CB\u7BC9\u6642\u9593",statsCacheHeading:"\u30AD\u30E3\u30C3\u30B7\u30E5\u7D71\u8A08",statCacheNgram:"N-gram",statCacheWord:"\u5358\u8A9E",statCachePhonetic:"\u97F3\u97FB",statsIndexMetadataHeading:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u30E1\u30BF\u30C7\u30FC\u30BF",statsCalculationsHeading:"\u8A08\u7B97\u7D71\u8A08",statTotalCalculations:"\u7DCF\u8A08\u7B97\u6570",statDistanceCalculations:"\u8DDD\u96E2\u8A08\u7B97\u6570",statAverageDistance:"\u5E73\u5747\u8DDD\u96E2",statMinDistance:"\u6700\u5C0F\u8DDD\u96E2",statMaxDistance:"\u6700\u5927\u8DDD\u96E2",notAvailable:"N/A",statsMatchesHeading:"\u30DE\u30C3\u30C1\u7D71\u8A08",statPartialMatches:"\u90E8\u5206\u30DE\u30C3\u30C1\u6570",statPerfectMatches:"\u5B8C\u5168\u30DE\u30C3\u30C1\u6570",statEarlyTerminations:"\u65E9\u671F\u7D42\u4E86\u6570",statsSimilarityHeading:"\u985E\u4F3C\u5EA6\u5206\u5E03",statAbove80:"80% \u4EE5\u4E0A",statAbove60:"60% \u4EE5\u4E0A",statAbove40:"40% \u4EE5\u4E0A",statBelow40:"40% \u672A\u6E80",statsDistanceHeading:"\u8DDD\u96E2\u5206\u5E03 (\u4E0A\u4F4D 6)",statDistance:e=>`\u8DDD\u96E2 ${e}`,statsQueryLengthHeading:"\u30AF\u30A8\u30EA\u9577\u7D71\u8A08 (\u4E0A\u4F4D 6)",statQueryLength:e=>`\u9577\u3055 ${e}`,statQueryLengthValue:({count:e,averagePercent:t})=>`${G("ja",e)} \u56DE / \u5E73\u5747 ${t}%`,statsFieldPerformanceHeading:"\u30D5\u30A3\u30FC\u30EB\u30C9\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9 (\u4E0A\u4F4D 6)",statAverageScore:"\u5E73\u5747\u30B9\u30B3\u30A2",statMatchCount:"\u30DE\u30C3\u30C1\u6570",statBestWorstScore:"\u6700\u9AD8 / \u6700\u4F4E\u30B9\u30B3\u30A2",statsInsightsHeading:"\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u6D1E\u5BDF",statBestField:"\u6700\u9AD8\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u30D5\u30A3\u30FC\u30EB\u30C9",statRecentAverageTime:"\u6700\u8FD1\u306E\u5E73\u5747\u51E6\u7406\u6642\u9593",statRecentAverageResults:"\u6700\u8FD1\u306E\u5E73\u5747\u7D50\u679C\u6570",statThroughput:"\u30B9\u30EB\u30FC\u30D7\u30C3\u30C8",statCommonQueryLength:"\u6700\u983B\u51FA\u30AF\u30A8\u30EA\u9577",statHistoryEntries:"\u5C65\u6B74\u30A8\u30F3\u30C8\u30EA\u6570",statHighSimilarity:"\u9AD8\u985E\u4F3C",statMediumSimilarity:"\u4E2D\u985E\u4F3C",statLowSimilarity:"\u4F4E\u985E\u4F3C",statVeryLowSimilarity:"\u6975\u4F4E\u985E\u4F3C",statsRecentHistoryHeading:"\u6700\u8FD1\u306E\u5C65\u6B74 (\u6700\u65B0 3 \u4EF6)",statsHistoryEntry:({processingTimeMs:e,resultCount:t})=>`\u51E6\u7406\u6642\u9593: ${e} ms / \u7D50\u679C: ${G("ja",t)} \u4EF6`,timesUnit:()=>" \u56DE",itemsUnit:()=>" \u4EF6",charactersUnit:()=>" \u6587\u5B57",throughputUnit:" ops/\u79D2"})}),On=Object.freeze(Object.keys(sa.en)),Wt=Object.freeze([...Fa,...On]),Nt=Object.freeze({en:Object.freeze({...En.en,...sa.en}),ja:Object.freeze({...En.ja,...sa.ja})}),Aa=e=>typeof e=="string"?JSON.stringify(e):e===null?"null":typeof e,jr=e=>{let t={},a=!1;for(let s of Fa){let i=Object.hasOwn(e,s)?e[s]:void 0;i!==void 0&&(t[s]=i,a=!0)}return a?t:void 0},Gr=(e,t,a)=>{e[t]=a},za=(e,t)=>{let a=$r(e);if(t===void 0)return Nt[a];if(t===null||typeof t!="object")throw new RangeError(`[contact-map] labels must be an object; got ${Aa(t)}`);let s=Object.getPrototypeOf(t);if(s!==Object.prototype&&s!==null)throw new RangeError(`[contact-map] labels must be a plain object (prototype Object.prototype or null); got ${Array.isArray(t)?"an array":"an object with a non-plain prototype"}`);for(let d of Object.keys(t))if(!Wt.includes(d))throw new RangeError(`[contact-map] labels.${d} is not a known label key; expected one of ${Wt.join(", ")}`);let i=Ur(a,jr(t)),n=sa[a],r={...i,...n};for(let d of On){let l=Object.hasOwn(t,d)?t[d]:void 0;if(l!==void 0){if(typeof n[d]=="function"){if(typeof l!="function")throw new RangeError(`[contact-map] labels.${d} must be a function; got ${Aa(l)}`)}else if(typeof l!="string"||l.trim()==="")throw new RangeError(`[contact-map] labels.${d} must be a non-blank string; got ${Aa(l)}`);Gr(r,d,l)}}return Object.freeze(r)},Ba=e=>{let t={};for(let a of Fa)t[a]=e[a];return Object.freeze(t)},Ua=e=>{let t={};for(let a of Vr)t[a]=e[a];return Object.freeze(t)}});import{DIRECTORY_TREE_LABEL_KEYS as qr}from"@aiquants/directory-tree";import{resolveVirtualScrollLocale as Qr,VIRTUAL_SCROLL_LABEL_KEYS as Yr}from"@aiquants/virtualscroll";import{createContext as Xr,useContext as Hn,useMemo as Dn,useRef as Jr}from"react";import{jsx as es}from"react/jsx-runtime";var Zr,Va,$a,Wn,he,q,oe=Ge(()=>{"use strict";lt();Zr=Object.freeze({locale:"en",labels:Nt.en,treeLabels:Ba(Nt.en),engineLabels:Ua(Nt.en)}),Va=Xr(Zr),$a=(e,t)=>{let a=Jr(null),s=a.current;return s!==null&&t.every(i=>s[i]===e[i])?s:(a.current=e,e)},Wn=({locale:e,labels:t,children:a})=>{let s=Qr(e),i=Dn(()=>za(s,t),[s,t]),n=$a(i,Wt),r=$a(Ba(n),qr),d=$a(Ua(n),Yr),l=Dn(()=>({locale:s,labels:n,treeLabels:r,engineLabels:d}),[s,n,r,d]);return es(Va.Provider,{value:l,children:a})},he=()=>Hn(Va),q=()=>Hn(Va).labels});var ia,oa,In,la,da,_t,ze,An,Te,K,ct=Ge(()=>{"use strict";ia=e=>{if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null},oa=e=>!e||typeof e!="object"?null:"item"in e?e.item??null:"person_id"in e?e:null,In=(e,t)=>{if(!e)return{value:null,fieldKey:null};for(let a of t){let s=ia(e[a]);if(s)return{value:s,fieldKey:a}}return{value:null,fieldKey:null}},la=e=>In(e,["custom_email","email"]),da=e=>In(e,["custom_mobile_phone_number","mobile_phone_number","company_phone_number"]),_t=e=>{let t=ia(e);if(!t)return null;let a=t.replace(/[^0-9+#*]/g,"");return a.length===0?null:`tel:${a}`},ze=(e,t)=>{let a=ia(e);return a?t?`https://mail.google.com/mail/?view=cm&fs=1&to=${encodeURIComponent(a)}`:`mailto:${encodeURIComponent(a)}`:null},An=e=>{if(!e)return"-";let t=typeof e=="string"||typeof e=="number"?new Date(e):e;return!(t instanceof Date)||Number.isNaN(t.getTime())?typeof e=="string"?e:"-":t.toISOString().split("T")[0]},Te=e=>{if(!e)return"-";let t=typeof e=="string"||typeof e=="number"?new Date(e):e;return!(t instanceof Date)||Number.isNaN(t.getTime())?typeof e=="string"?e:"-":t.toISOString()},K=e=>e==null?"-":typeof e=="string"?ia(e)??"-":typeof e=="number"?Number.isFinite(e)?String(e):"-":e instanceof Date?Te(e):String(e)});import ns from"lucide-react/dist/esm/icons/check.js";import rs from"lucide-react/dist/esm/icons/copy.js";import ss from"lucide-react/dist/esm/icons/x.js";import{useCallback as qe,useEffect as Qa,useMemo as It,useRef as Ya,useState as Bn}from"react";import{createPortal as is}from"react-dom";import{jsx as Q,jsxs as Ne}from"react/jsx-runtime";var os,Fn,Ft,Pt,ls,ds,At,Ga,zn,qa,ca,Xa=Ge(()=>{"use strict";ct();oe();os=350,Fn=["dblclick","pointerdown","pointerup","mousedown","mouseup","touchstart","touchend","contextmenu"],Ft=0,Pt=null,ls=()=>{let e=document.body.style;Ft+=1,Ft===1&&(Pt={userSelect:e.userSelect,webkitUserSelect:e.webkitUserSelect}),e.userSelect="none",typeof e.webkitUserSelect<"u"&&(e.webkitUserSelect="none")},ds=()=>{if(Ft=Math.max(0,Ft-1),Ft>0||!Pt)return;let e=document.body.style;e.userSelect=Pt.userSelect,typeof Pt.webkitUserSelect<"u"&&(e.webkitUserSelect=Pt.webkitUserSelect),Pt=null},At=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},Ga=(e,t)=>{let a=new Set;return e.reduce((s,i)=>{let n=typeof i.value=="string"?i.value.trim():"";if(!n)return s;let{normalized:r,key:d,entry:l}=t(n,i);return r&&!a.has(d)&&(a.add(d),s.push(l(r))),s},[])},zn=(e,t)=>e===t,qa=({value:e,ariaLabel:t,size:a="md"})=>{let[s,i]=Bn(!1),n=Ya(null),r=qe(async c=>{if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(c),!0}catch{}if(typeof document>"u")return!1;let o=document.createElement("textarea");o.value=c,o.setAttribute("readonly",""),o.style.position="absolute",o.style.left="-9999px",document.body.appendChild(o),o.select(),o.setSelectionRange(0,o.value.length);let p=document.execCommand("copy");return document.body.removeChild(o),p},[]),d=qe(async c=>{c.preventDefault(),c.stopPropagation(),n.current!==null&&typeof window<"u"&&(window.clearTimeout(n.current),n.current=null);let o=await r(e);i(o),o&&typeof window<"u"&&(n.current=window.setTimeout(()=>{i(!1),n.current=null},1500))},[r,e]);Qa(()=>()=>{n.current!==null&&typeof window<"u"&&(window.clearTimeout(n.current),n.current=null)},[]);let l=a==="sm"?"h-6 w-6":"h-7 w-7",u=a==="sm"?"h-3.5 w-3.5":"h-4 w-4",m=s?ns:rs;return Q("button",{type:"button",className:`inline-flex ${l} shrink-0 items-center justify-center rounded-md border border-gray-200 text-slate-600 transition-colors hover:bg-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-200 dark:text-slate-300`,onClick:d,"aria-label":t,title:t,children:Q(m,{className:u,"aria-hidden":"true"})})},ca=({contactData:e,openEmailsWithGmail:t,openGmailCompose:a,onRequestClose:s})=>{let i=q(),[n,r]=Bn(null);Qa(()=>{r(document.body)},[]);let d=Ya(null),l=Ya(null),u=It(()=>e.contacted_at?An(e.contacted_at):null,[e.contacted_at]),m=e.full_name||"-",c=At(e.company_name),o=At(e.department),p=At(e.title),f=It(()=>Ga([{fieldKey:"company_name",label:i.fieldCompanyName,value:c},{fieldKey:"department",label:i.fieldDepartment,value:o},{fieldKey:"title",label:i.fieldTitle,value:p}],(h,{fieldKey:x,label:O})=>({normalized:h,key:`${x}-${h.toLowerCase()}`,entry:D=>({fieldKey:x,label:O,value:D})})),[c,o,p,i]),v=It(()=>Ga([{fieldKey:"custom_mobile_phone_number",label:i.popupCustomMobilePhone,value:e.custom_mobile_phone_number},{fieldKey:"mobile_phone_number",label:i.popupMobilePhone,value:e.mobile_phone_number},{fieldKey:"custom_company_phone_number",label:i.popupCustomCompanyPhone,value:e.custom_company_phone_number},{fieldKey:"company_phone_number",label:i.popupCompanyPhone,value:e.company_phone_number}],(h,{fieldKey:x,label:O})=>{let D=_t(h);return{normalized:At(h),key:(D??h).toLowerCase(),entry:w=>({fieldKey:x,label:O,value:w,href:D})}}),[e.custom_mobile_phone_number,e.mobile_phone_number,e.custom_company_phone_number,e.company_phone_number,i]),T=It(()=>Ga([{fieldKey:"custom_email",label:i.popupCustomEmail,value:e.custom_email},{fieldKey:"email",label:i.popupEmail,value:e.email}],(h,{fieldKey:x,label:O})=>{let D=At(h),Z=ze(h,t),w=!!Z?.startsWith("https://mail.google.com");return{normalized:D,key:h.toLowerCase(),entry:P=>({fieldKey:x,label:O,value:P,href:Z,isGmailLink:w})}}),[e.custom_email,e.email,t,i]),C=v.length>0||T.length>0,z=It(()=>`contact-methods-${e.person_id}`,[e.person_id]),k=qe(h=>{s(h),l.current=null},[s]),b=qe(h=>{h.stopPropagation(),zn(h.target,h.currentTarget)&&k()},[k]),g=qe(h=>{h.stopPropagation(),zn(h.target,h.currentTarget)&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),k())},[k]),E=qe(h=>{h.stopPropagation(),k()},[k]),V=qe((h,x)=>{x.isGmailLink&&(h.preventDefault(),a(x.value))},[a]),y=qe((h,x)=>{if(!x.isGmailLink){l.current=null;return}let O=Date.now(),D=l.current;if(D&&D.email===x.value&&O-D.timestamp<=os){l.current=null,h.preventDefault(),a(x.value);return}l.current={email:x.value,timestamp:O}},[a]);return Qa(()=>{let h=[];if(typeof window<"u"){let x=O=>{if(O.key==="Escape"){k();return}if(O.key==="Tab"&&d.current){let D=d.current.querySelectorAll('a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])');if(D.length===0)return;let Z=D[0],w=D[D.length-1];O.shiftKey?document.activeElement===Z&&(O.preventDefault(),w.focus()):document.activeElement===w&&(O.preventDefault(),Z.focus())}};window.addEventListener("keydown",x),h.push(()=>window.removeEventListener("keydown",x))}if(typeof document<"u"){let x=d.current;if(x){let w=P=>{P.stopPropagation()};for(let P of Fn)x.addEventListener(P,w);h.push(()=>{for(let P of Fn)x.removeEventListener(P,w)})}let O=w=>{let P=d.current;return P&&w instanceof Node?P.contains(w):!1},D=w=>{O(w.target)||k({suppressLongPress:!0,cancelLongPressTimer:!0})},Z=["pointerdown","wheel","touchmove"];for(let w of Z)document.addEventListener(w,D,!0);h.push(()=>{for(let w of Z)document.removeEventListener(w,D,!0)}),ls(),h.push(ds)}return()=>{for(let x of h)x()}},[k,n]),n?is(Q("div",{"data-contact-popup-root":"true",className:"fixed top-0 right-0 bottom-0 left-0 z-50 flex items-center justify-center bg-black/50 px-4 py-6",style:{right:"var(--aqcm-overlay-right, var(--aiquants-menu-pinned-width, 0px))",transition:"right 0.5s"},role:"dialog","aria-modal":"true","aria-labelledby":z,tabIndex:-1,onClick:b,onKeyDown:g,children:Ne("div",{ref:d,className:"w-full max-w-md rounded-lg border border-slate-200 bg-white p-4 shadow-lg transition-colors dark:border-transparent dark:bg-slate-900 dark:shadow-slate-950/40 dark:ring-1 dark:ring-white/70",children:[Ne("div",{className:"flex items-start justify-between gap-4",children:[Ne("div",{children:[Q("h2",{id:z,className:"font-semibold text-gray-900 text-lg dark:text-slate-100",children:m}),f.length>0?Q("div",{className:"mt-2 space-y-2 text-slate-700 text-sm dark:text-slate-200",children:f.map(h=>Ne("div",{className:"flex items-center gap-3",children:[Q("p",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:h.value}),Q(qa,{value:h.value,ariaLabel:i.copyField(h.label),size:"sm"})]},h.fieldKey))}):null]}),Q("button",{type:"button",className:"rounded-md p-0.5 text-slate-600 transition-colors hover:bg-gray-100 focus:outline-none focus-visible:ring focus-visible:ring-blue-200 dark:text-slate-300 dark:hover:bg-slate-800/70",onClick:E,"aria-label":i.close,children:Q(ss,{className:"h-4 w-4","aria-hidden":"true"})})]}),Ne("div",{className:"mt-4 space-y-4 text-slate-700 dark:text-slate-200",children:[v.length>0?Q("div",{children:Q("ul",{className:"space-y-3 text-sm",children:v.map(h=>Q("li",{className:"flex items-start gap-3",children:Ne("div",{className:"flex-1",children:[Q("span",{className:"text-slate-600 text-xs dark:text-slate-300",children:h.label}),Ne("div",{className:"mt-1 flex items-center gap-3",children:[Q("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:h.href?Q("a",{href:h.href,className:"wrap-break-word text-blue-600 underline-offset-2 transition-colors hover:underline focus:underline focus:outline-none dark:text-blue-300",children:h.value}):Q("span",{className:"wrap-break-word text-slate-800 dark:text-slate-100",children:h.value})}),Q(qa,{value:h.value,ariaLabel:i.copyField(h.label),size:"sm"})]})]})},`${h.fieldKey}-${h.value}`))})}):null,T.length>0?Q("div",{children:Q("ul",{className:"space-y-3 text-sm",children:T.map(h=>Q("li",{className:"flex items-start gap-3",children:Ne("div",{className:"flex-1",children:[Q("span",{className:"text-slate-600 text-xs dark:text-slate-300",children:h.label}),Ne("div",{className:"mt-1 flex items-start gap-3",children:[Ne("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:[h.href?Q("a",{href:h.href,className:"wrap-break-word text-blue-600 underline-offset-2 transition-colors hover:underline focus:underline focus:outline-none dark:text-blue-300",target:h.isGmailLink?"_blank":void 0,rel:h.isGmailLink?"noopener noreferrer":void 0,onDoubleClick:x=>V(x,h),onTouchEnd:x=>y(x,h),children:h.value}):Q("span",{className:"wrap-break-word text-slate-800 dark:text-slate-100",children:h.value}),h.isGmailLink?Q("span",{className:"mt-1 block text-[11px] text-slate-500 dark:text-slate-400",children:i.popupGmailHint}):null]}),Q(qa,{value:h.value,ariaLabel:i.copyField(h.label),size:"sm"})]})]})},`${h.fieldKey}-${h.value}`))})}):null,u?Ne("div",{className:"mt-2 flex items-center gap-2 text-slate-600 text-sm dark:text-slate-300",children:[Q("span",{className:"text-xs",children:i.popupLastContactDate}),Q("span",{children:u})]}):null,C?null:Q("p",{className:"text-slate-600 text-sm dark:text-slate-300",children:i.popupNoContactMethods})]})]})}),n):null}});import{jsx as fe,jsxs as zt}from"react/jsx-runtime";var pa,Ja=Ge(()=>{"use strict";pa=({fullName:e,title:t="-",companyName:a="-",department:s="-",phoneNumber:i="-",email:n="-",updatedAtText:r="-"})=>zt("div",{className:"flex h-full w-full flex-col justify-center gap-0.5 text-slate-800 text-xs leading-tight transition-colors sm:grid sm:grid-cols-3 sm:gap-2 sm:text-sm xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto] dark:text-slate-200",children:[zt("div",{className:"flex items-center gap-1 sm:hidden",children:[fe("div",{className:"flex-1 truncate font-medium text-gray-900 text-sm leading-tight dark:text-slate-100",children:e}),fe("div",{className:"shrink-0 whitespace-nowrap text-[11px] text-slate-600 dark:text-slate-300",children:i})]}),fe("div",{className:"flex items-center gap-1 sm:hidden",children:fe("div",{className:"flex-1 truncate text-slate-700 text-xs leading-tight dark:text-slate-200",children:a})}),fe("div",{className:"block sm:hidden",children:fe("span",{className:"w-full truncate text-left text-[11px] text-slate-700 leading-tight dark:text-slate-200",children:s})}),zt("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[fe("span",{className:"truncate font-medium text-gray-900 dark:text-slate-100",children:e}),fe("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:t})]}),zt("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[fe("span",{className:"truncate text-slate-800 dark:text-slate-100",children:a}),fe("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:s})]}),zt("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[fe("span",{className:"truncate text-slate-700 dark:text-slate-200",children:i}),fe("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:n})]}),fe("div",{className:"hidden items-end justify-end text-[11px] text-slate-600 xl:flex dark:text-slate-300",children:fe("span",{className:"truncate",children:r})})]})});import{getNormalizedVariants as cs,normalizeText as ps,romajiToKatakana as us}from"@aiquants/select-box";var ms,gs,hs,fs,bs,$n,ys,xs,Un,ua,vs,Cs,Za,Vn,en=Ge(()=>{"use strict";ms=/[​]/g,gs=/^[\s  ]+|[\s  ]+$/g,hs=/\s+/,fs=/^[\p{Script=Latin}\s]+$/u,bs=/\p{Script=Latin}/u,$n=Object.freeze({convertWidth:!0,convertKana:!0,convertCase:!0,convertRomaji:!1}),ys=e=>ps(e.replace(ms,"").replace(gs,""),$n),xs=e=>{if(!fs.test(e))return null;let t=us(e);return bs.test(t)?null:t},Un=e=>e.split(hs).filter(Boolean),ua=e=>{let t=ys(e),a=xs(t);return a===null?t:a},vs=e=>{let t=new Set([...Un(e),...Un(ua(e))]),a=new Set;for(let s of t)for(let i of cs(s,$n)){let n=i.trim();n&&a.add(n)}return Array.from(a)},Cs=/[.*+?^${}()|[\]\\]/g,Za=e=>{let t=vs(e);if(t.length===0)return null;let a=t.map(s=>s.replace(Cs,"\\$&")).sort((s,i)=>i.length-s.length);return new RegExp(a.join("|"),"gi")},Vn=(e,t)=>{let a=Za(e);if(a===null)return i=>i;let s=i=>t.some(n=>{let r=i[n];return typeof r=="string"&&r.search(a)!==-1});return i=>{let n=[],r=[];for(let d of i)s(d.item)?n.push(d):r.push(d);return[...n,...r]}}});import{memo as ks}from"react";import{Fragment as tn,jsx as ma}from"react/jsx-runtime";var pe,ga=Ge(()=>{"use strict";en();pe=ks(({text:e,query:t,enabled:a=!0})=>{if(!(a&&t?.trim()&&e))return ma(tn,{children:e});let s=Za(t);if(s===null)return ma(tn,{children:e});let i=[],n=0,r=s.exec(e),d=0;for(;r;){let l=r[0],u=r.index;if(u>n&&i.push(e.substring(n,u)),l.length===0){s.lastIndex++,r=s.exec(e);continue}i.push(ma("mark",{className:"rounded bg-yellow-200 px-1 text-gray-900",children:l},`highlight-${u}-${d}`)),n=u+l.length,d+=1,r=s.exec(e)}return n<e.length&&i.push(e.substring(n)),ma(tn,{children:i})});pe.displayName="HighlightedText"});var jn={};Br(jn,{ContactDetailGrid:()=>Kn,default:()=>Ss});import{useMemo as an}from"react";import{Fragment as Ts,jsx as rn,jsxs as Ns}from"react/jsx-runtime";var nn,Kn,Ss,Gn=Ge(()=>{"use strict";ct();oe();Xa();Ja();ga();nn=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},Kn=({contactData:e,searchTerm:t,enableHighlighting:a,openEmailsWithGmail:s,openGmailCompose:i,isPopupVisible:n,onRequestClose:r})=>{let d=q(),l=an(()=>la(e),[e]),u=an(()=>da(e),[e]),m=l.value??"-",c=u.value??"-",o=an(()=>Te(e.updated_at),[e.updated_at]),p=nn(e.full_name)??d.noName,f=nn(e.company_name),v=nn(e.department),T=(C,z="-")=>rn(pe,{text:C??z,query:t,enabled:a});return Ns(Ts,{children:[rn(pa,{fullName:T(p),title:T(e.title),companyName:T(f),department:T(v),phoneNumber:c,email:T(m),updatedAtText:o}),n?rn(ca,{contactData:e,openEmailsWithGmail:s,openGmailCompose:i,onRequestClose:r}):null]})},Ss=Kn});oe();import{DEFAULT_FUZZY_SEARCH_OPTIONS as wt}from"@aiquants/fuzzy-search";import{memo as ts,useId as _n}from"react";import{jsx as Re,jsxs as Fe}from"react/jsx-runtime";var Ka=ts(({searchOptions:e,setSearchOptions:t})=>{let a=q(),s="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",i="text-xs font-semibold",n=_n(),r=_n(),d=[];return d.push(Fe("div",{className:`${s} border-sky-200 border-l-4 dark:border-sky-400/60`,children:[Fe("div",{className:`${i} text-sky-700 dark:text-sky-300`,children:["\u{1F4D8} ",a.advancedLearningHeading]}),Re("label",{htmlFor:n,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.advancedLearningLabel}),Re("input",{id:n,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.learningWeight||wt.learningWeight,onChange:l=>t(u=>({...u,learningWeight:parseFloat(l.target.value)})),className:"w-full"}),Fe("span",{className:"text-sky-600 text-xs dark:text-sky-300",children:[a.currentValueLabel," ",e.learningWeight||wt.learningWeight]}),Re("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.advancedLearningHint})]},"learning")),d.push(Fe("div",{className:`${s} border-indigo-200 border-l-4 dark:border-indigo-400/60`,children:[Fe("div",{className:`${i} text-indigo-700 dark:text-indigo-300`,children:["\u23F1\uFE0F ",a.advancedDebounceHeading]}),Re("label",{htmlFor:r,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.advancedDebounceLabel}),Re("input",{id:r,type:"range",min:"100",max:"1000",step:"50",value:e.debounceMs||wt.debounceMs,onChange:l=>t(u=>({...u,debounceMs:parseInt(l.target.value,10)})),className:"w-full"}),Fe("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[a.currentValueLabel," ",e.debounceMs||wt.debounceMs]}),Re("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.advancedDebounceHint})]},"debounce")),Fe("section",{className:"space-y-3",children:[Fe("div",{className:"flex items-center justify-between gap-3",children:[Fe("div",{className:"flex items-center gap-2 font-semibold text-gray-700 text-xs transition-colors dark:text-slate-200",children:[Re("span",{children:"\u26A1"}),Re("span",{className:"tracking-wide",children:a.settingsAdvancedTab})]}),Re("button",{type:"button",onClick:()=>t(l=>({...l,learningWeight:wt.learningWeight,debounceMs:wt.debounceMs})),className:"rounded border border-gray-300 bg-gray-100 px-2 py-1 font-medium text-gray-700 text-xs transition-colors hover:bg-gray-200 dark:border-slate-600 dark:bg-slate-800/70 dark:text-slate-200 dark:hover:bg-slate-700/70",title:a.resetToDefaultsTitle,children:a.reset})]}),Re("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:d})]})});Ka.displayName="AdvancedSearchSettings";oe();import{DEFAULT_FUZZY_SEARCH_OPTIONS as dt}from"@aiquants/fuzzy-search";import{memo as as,useId as Me}from"react";import{jsx as X,jsxs as J}from"react/jsx-runtime";var ja=as(({searchOptions:e,setSearchOptions:t,enableHighlighting:a,setEnableHighlighting:s,openEmailsWithGmail:i,setOpenEmailsWithGmail:n})=>{let r=q(),d="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",l="text-xs font-semibold",u=Me(),m=Me(),c=Me(),o=Me(),p=Me(),f=Me(),v=Me(),T=Me(),C=Me(),z=Me(),k=[];return k.push(J("div",{className:`${d} border-blue-200 border-l-4 dark:border-blue-500/50`,children:[J("div",{className:`${l} text-blue-700 dark:text-blue-300`,children:["\u{1F3AF} ",r.basicThresholdHeading]}),X("label",{htmlFor:u,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:r.basicThresholdLabel}),X("input",{id:u,type:"range",min:"0.0",max:e.sortBy==="relevance"?"1.5":"1.0",step:"0.05",value:e.threshold??dt.threshold,onChange:b=>t(g=>({...g,threshold:parseFloat(b.target.value)})),className:"w-full"}),J("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[r.currentValueLabel," ",e.threshold??dt.threshold]}),X("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:e.sortBy==="relevance"?r.basicThresholdRangeRelevance:r.basicThresholdRange})]},"threshold")),k.push(J("div",{className:`${d} border-amber-200 border-l-4 dark:border-amber-400/60`,children:[J("div",{className:`${l} text-amber-700 dark:text-amber-300`,children:["\u{1FA84} ",r.basicDisplayHeading]}),J("label",{htmlFor:m,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[X("input",{id:m,type:"checkbox",checked:e.caseSensitive??dt.caseSensitive,onChange:b=>t(g=>({...g,caseSensitive:b.target.checked})),className:"h-3 w-3"}),r.basicCaseSensitive]}),J("label",{htmlFor:c,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[X("input",{id:c,type:"checkbox",checked:a,onChange:b=>s(b.target.checked),className:"h-3 w-3"}),r.basicHighlight]}),J("label",{htmlFor:o,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[X("input",{id:o,type:"checkbox",checked:i,onChange:b=>n(b.target.checked),className:"h-3 w-3"}),r.basicOpenEmailsWithGmail]}),J("div",{className:"flex flex-col gap-1",children:[X("label",{htmlFor:p,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:r.basicMultiTermOperator}),J("select",{id:p,value:e.multiTermOperator??dt.multiTermOperator,onChange:b=>t(g=>({...g,multiTermOperator:b.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[X("option",{value:"or",children:r.basicOperatorOr}),X("option",{value:"and",children:r.basicOperatorAnd})]}),X("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:r.basicMultiTermHint})]})]},"display")),k.push(J("div",{className:`${d} border-emerald-200 border-l-4 dark:border-emerald-400/60`,children:[J("div",{className:`${l} text-emerald-700 dark:text-emerald-300`,children:["\u{1F4DA} ",r.basicSortHeading]}),J("div",{className:"flex flex-col gap-2",children:[X("label",{htmlFor:f,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:r.basicSortBy}),J("select",{id:f,value:e.sortBy||dt.sortBy,onChange:b=>t(g=>({...g,sortBy:b.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[X("option",{value:"score",children:r.basicSortByScore}),X("option",{value:"relevance",children:r.basicSortByRelevance}),X("option",{value:"original",children:r.basicSortByOriginal})]})]}),J("div",{className:"flex flex-col gap-2",children:[X("label",{htmlFor:v,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:r.basicSortOrder}),J("select",{id:v,value:e.sortOrder||dt.sortOrder,onChange:b=>t(g=>({...g,sortOrder:b.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[X("option",{value:"desc",children:r.basicSortDescending}),X("option",{value:"asc",children:r.basicSortAscending})]})]})]},"sorting")),k.push(J("div",{className:`${d} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[J("div",{className:`${l} text-purple-700 dark:text-purple-300`,children:["\u2699\uFE0F ",r.basicEngineHeading]}),X("label",{htmlFor:T,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:r.basicStrategy}),J("select",{id:T,value:e.parallelSearchStrategy||dt.parallelSearchStrategy,onChange:b=>t(g=>({...g,parallelSearchStrategy:b.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[X("option",{value:"balanced",children:r.basicStrategyBalanced}),X("option",{value:"index-first",children:r.basicStrategyIndexFirst}),X("option",{value:"levenshtein-first",children:r.basicStrategyLevenshteinFirst})]}),J("div",{className:"mt-2 space-y-2",children:[J("label",{htmlFor:C,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[X("input",{id:C,type:"checkbox",checked:e.enableIndexFiltering!==!1,onChange:b=>t(g=>({...g,enableIndexFiltering:b.target.checked})),className:"h-3 w-3"}),r.basicIndexFiltering]}),J("label",{htmlFor:z,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[X("input",{id:z,type:"checkbox",checked:e.enableLevenshtein!==!1,onChange:b=>t(g=>({...g,enableLevenshtein:b.target.checked})),className:"h-3 w-3"}),r.basicLevenshtein]})]})]},"engine")),J("section",{className:"space-y-3",children:[J("div",{className:"flex items-center gap-2 font-semibold text-blue-700 text-xs transition-colors dark:text-sky-400",children:[X("span",{children:"\u{1F527}"}),X("span",{className:"tracking-wide",children:r.settingsBasicTab})]}),X("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:k})]})});ja.displayName="BasicSearchSettings";ct();import Ls from"lucide-react/dist/esm/icons/badge-check.js";import Rs from"lucide-react/dist/esm/icons/building-2.js";import Ms from"lucide-react/dist/esm/icons/calendar-clock.js";import Es from"lucide-react/dist/esm/icons/check.js";import Os from"lucide-react/dist/esm/icons/copy.js";import Ds from"lucide-react/dist/esm/icons/id-card.js";import Hs from"lucide-react/dist/esm/icons/mail.js";import Ws from"lucide-react/dist/esm/icons/phone.js";import _s from"lucide-react/dist/esm/icons/user-round.js";import{useCallback as Is,useEffect as As,useMemo as ba,useRef as Fs,useState as zs}from"react";var Qe={info:(e,...t)=>console.info(`[contact-map] ${e}`,...t),warn:(e,...t)=>console.warn(`[contact-map] ${e}`,...t),error:(e,...t)=>console.error(`[contact-map] ${e}`,...t)};oe();import*as we from"@radix-ui/react-tabs";import*as ha from"react";import{clsx as ws}from"clsx";import{twMerge as Ps}from"tailwind-merge";function pt(...e){return Ps(ws(e))}import{jsx as sn}from"react/jsx-runtime";var fa=we.Root,Bt=ha.forwardRef(({className:e,...t},a)=>sn(we.List,{ref:a,className:pt("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Bt.displayName=we.List.displayName;var ut=ha.forwardRef(({className:e,...t},a)=>sn(we.Trigger,{ref:a,className:pt("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 font-medium text-sm ring-offset-background transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-2xs",e),...t}));ut.displayName=we.Trigger.displayName;var mt=ha.forwardRef(({className:e,...t},a)=>sn(we.Content,{ref:a,className:pt("mt-2 ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=inactive]:hidden",e),...t}));mt.displayName=we.Content.displayName;ga();import{jsx as L,jsxs as le}from"react/jsx-runtime";var qn={height:"var(--contact-panel-height, 100%)",maxHeight:"100%"},Bs=({icon:e,label:t,value:a,fieldKey:s,copyValue:i,onCopy:n,isCopied:r,linkHref:d,searchTerm:l,enableHighlighting:u})=>{let m=q(),c=!!(n&&s&&i),o=d?.startsWith("https://mail.google.com")?"_blank":void 0;return le("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1.5 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[le("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[L("div",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-white text-slate-500 transition-colors dark:bg-slate-800 dark:text-slate-200",children:L(e,{size:14})}),le("div",{className:"min-w-0 flex-1",children:[L("div",{className:"font-medium text-[10px] text-slate-500 dark:text-slate-400",children:t}),L("div",{className:"truncate font-semibold text-slate-900 text-xs dark:text-slate-100",children:d?L("a",{href:d,className:"text-inherit underline-offset-2 hover:underline focus:underline focus:outline-none",target:o,rel:o?"noopener noreferrer":void 0,children:L(pe,{text:a,query:l??"",enabled:u})}):L(pe,{text:a,query:l??"",enabled:u})})]})]}),c?L("button",{type:"button",onClick:()=>n&&s&&i&&n(s,i,t),className:"inline-flex h-6 w-6 items-center justify-center rounded-full border border-slate-200 bg-white text-slate-500 transition-colors hover:border-blue-400 hover:text-blue-500 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:hover:border-blue-400 dark:hover:text-blue-300","aria-label":m.copyField(t),children:r?L(Es,{size:14}):L(Os,{size:14})}):null]})},Qn=({items:e,searchTerm:t,enableHighlighting:a})=>L("dl",{className:"grid grid-cols-1 gap-x-3 gap-y-1.5 sm:grid-cols-2",children:e.map(s=>le("div",{className:"flex flex-col gap-0.5 rounded-md border border-slate-200 bg-white/60 px-2 py-1 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[L("dt",{className:"font-semibold text-[10px] text-slate-500 uppercase tracking-wide dark:text-slate-400",children:s.label}),L("dd",{className:"wrap-break-word text-slate-900 text-xs dark:text-slate-100",children:L(pe,{text:s.value,query:t??"",enabled:a})})]},s.fieldKey))}),on=({title:e})=>L("h3",{className:"font-semibold text-slate-700 text-xs dark:text-slate-200",children:e}),Us=()=>{let e=q();return le("div",{className:"flex h-full min-h-40 w-full flex-1 flex-col items-center justify-center gap-2 rounded-xl border border-slate-300 border-dashed bg-white/60 p-4 text-center transition-colors dark:border-slate-700 dark:bg-slate-900/40",children:[L("p",{className:"font-medium text-slate-600 text-xs dark:text-slate-200",children:e.detailEmptyTitle}),L("p",{className:"text-[11px] text-slate-500 dark:text-slate-400",children:e.detailEmptyHint})]})},Ye=({contact:e,searchTerm:t,enableHighlighting:a,style:s,className:i=""})=>{let n=q(),[r,d]=zs(null),l=Fs(null),u=ba(()=>({...qn,...s}),[s]);As(()=>()=>{l.current!==null&&window.clearTimeout(l.current)},[]);let m=ba(()=>la(e),[e]),c=ba(()=>da(e),[e]),o=ba(()=>Te(e?.contacted_at??null),[e?.contacted_at]),p=Is(async(y,h,x)=>{try{await navigator.clipboard.writeText(h),d(y),l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{d(null)},2e3)}catch(O){Qe.error("Failed to copy contact detail",O)}},[]);if(!e)return L("div",{className:"flex h-full min-h-0 w-full flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-950",style:qn,children:L(Us,{})});let f=[K(e.title),K(e.department)].filter(y=>y!=="-"),v=[f.join(" / "),K(e.company_name)].filter(y=>y&&y!=="-").join(" \u30FB ")||"-",T=K(e.full_name),C=[{fieldKey:"full_name",label:n.fieldFullName,value:T==="-"?n.noName:T},{fieldKey:"full_name_reading",label:n.fieldFullNameReading,value:K(e.full_name_reading)},{fieldKey:"title",label:n.fieldTitle,value:K(e.title)},{fieldKey:"department",label:n.fieldDepartment,value:K(e.department)},{fieldKey:"company_name",label:n.fieldCompanyName,value:K(e.company_name)},{fieldKey:"company_name_reading",label:n.fieldCompanyNameReading,value:K(e.company_name_reading)},{fieldKey:"address",label:n.fieldAddress,value:K(e.address)},{fieldKey:"postal_code",label:n.fieldPostalCode,value:K(e.postal_code)},{fieldKey:"url",label:n.fieldUrl,value:K(e.url)}],z=[{label:n.fieldCustomEmail,value:K(e.custom_email),fieldKey:"custom_email",rawValue:e.custom_email},{label:n.fieldEmail,value:K(e.email),fieldKey:"email",rawValue:e.email}].filter(y=>y.value!=="-"),k=[{label:n.fieldCustomMobilePhone,value:K(e.custom_mobile_phone_number),fieldKey:"custom_mobile_phone_number",rawValue:e.custom_mobile_phone_number},{label:n.fieldMobilePhone,value:K(e.mobile_phone_number),fieldKey:"mobile_phone_number",rawValue:e.mobile_phone_number},{label:n.fieldCompanyPhone,value:K(e.company_phone_number),fieldKey:"company_phone_number",rawValue:e.company_phone_number},{label:n.fieldCompanyFax,value:K(e.company_fax_number),fieldKey:"company_fax_number",rawValue:e.company_fax_number}].filter(y=>y.value!=="-"),b=[{fieldKey:"person_id",label:"person_id",value:K(e.person_id)},{fieldKey:"person_id_redirect_to",label:"person_id_redirect_to",value:K(e.person_id_redirect_to)},{fieldKey:"is_active",label:"is_active",value:K(e.is_active)},{fieldKey:"is_contact_synced",label:"is_contact_synced",value:K(e.is_contact_synced)},{fieldKey:"is_incomplete",label:"is_incomplete",value:K(e.is_incomplete)},{fieldKey:"is_in_eight",label:"is_in_eight",value:K(e.is_in_eight)},{fieldKey:"created_by",label:n.fieldCreatedBy,value:K(e.created_by)},{fieldKey:"created_at",label:n.fieldCreatedAt,value:Te(e.created_at)},{fieldKey:"updated_by",label:n.fieldUpdatedBy,value:K(e.updated_by)},{fieldKey:"updated_at",label:n.fieldUpdatedAt,value:Te(e.updated_at)}],g=[{rowKey:"person_id",icon:Ds,label:"person_id",value:K(e.person_id),fieldKey:"person_id",copyValue:String(e.person_id)},{rowKey:"primary_email",icon:Hs,label:n.summaryEmail,value:m.value??"-",fieldKey:"primary_email",copyValue:m.value,linkHref:ze(m.value,!1)},{rowKey:"primary_phone",icon:Ws,label:n.summaryPhone,value:c.value??"-",fieldKey:"primary_phone",copyValue:c.value,linkHref:_t(c.value)},{rowKey:"contacted_at",icon:Ms,label:n.summaryLastContact,value:o}],E=[{sectionKey:"email",title:n.sectionEmail,emptyText:n.sectionEmailEmpty,entries:z,recommendedKey:m.fieldKey??null,resolveHref:y=>ze(y!=null?String(y):null,!1)},{sectionKey:"phone",title:n.sectionPhone,emptyText:n.sectionPhoneEmpty,entries:k,recommendedKey:c.fieldKey??null,resolveHref:y=>_t(y!=null?String(y):null)}],V=[{value:"summary",label:n.detailTabSummary,content:le("div",{className:"flex flex-col gap-4",children:[le("div",{className:"flex flex-col gap-1",children:[le("div",{className:"flex items-center gap-2 text-slate-600 text-sm dark:text-slate-300",children:[L(Rs,{size:16}),L("span",{children:L(pe,{text:K(e.company_name),query:t??"",enabled:a})})]}),f.length>0?L("div",{className:"text-slate-600 text-sm dark:text-slate-300",children:f.map((y,h)=>le("span",{children:[h>0&&" / ",L(pe,{text:y,query:t??"",enabled:a})]},`header-line-${h}`))}):null]}),L("div",{className:"flex flex-col gap-3",children:g.map(y=>L(Bs,{icon:y.icon,label:y.label,value:y.value,fieldKey:y.fieldKey,copyValue:y.copyValue,onCopy:p,isCopied:y.fieldKey?r===y.fieldKey:!1,linkHref:y.linkHref,searchTerm:t,enableHighlighting:a},y.rowKey))})]})},{value:"basic",label:n.detailTabBasic,content:le("div",{className:"flex flex-col gap-3",children:[L(on,{title:n.detailBasicProfile}),L(Qn,{items:C,searchTerm:t,enableHighlighting:a})]})},{value:"contact",label:n.detailTabContact,content:L("div",{className:"flex flex-col gap-4",children:E.map(({sectionKey:y,title:h,emptyText:x,entries:O,recommendedKey:D,resolveHref:Z})=>le("div",{className:"flex flex-col gap-2",children:[L(on,{title:h}),O.length===0?L("p",{className:"text-slate-500 text-xs dark:text-slate-400",children:x}):L("div",{className:"flex flex-col gap-2",children:O.map(w=>{let P=Z(w.rawValue),H=w.fieldKey===D;return le("div",{className:"flex items-center justify-between rounded-lg border border-slate-200 bg-white px-3 py-2 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[le("div",{children:[L("div",{className:"font-medium text-slate-500 text-xs dark:text-slate-400",children:w.label}),L("div",{className:"text-slate-900 text-sm dark:text-slate-100",children:P?L("a",{href:P,className:"text-inherit underline-offset-2 hover:underline focus:underline focus:outline-none",children:L(pe,{text:w.value,query:t??"",enabled:a})}):L(pe,{text:w.value,query:t??"",enabled:a})})]}),H?le("span",{className:"inline-flex items-center gap-1 rounded-full bg-emerald-100 px-2 py-0.5 font-semibold text-[11px] text-emerald-700 transition-colors dark:bg-emerald-300/20 dark:text-emerald-200",children:[L(Ls,{size:14}),n.preferred]}):null]},w.fieldKey)})})]},y))})},{value:"meta",label:n.detailTabMeta,content:le("div",{className:"flex flex-col gap-3",children:[L(on,{title:n.detailTabMeta}),L(Qn,{items:b,searchTerm:t,enableHighlighting:a})]})}];return le("div",{className:`flex h-full min-h-0 w-full flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-950 ${i}`.trim(),style:u,children:[L("div",{className:"border-slate-200 border-b px-3 py-1.5 transition-colors dark:border-slate-700 dark:bg-slate-900/50",children:le("div",{className:"flex items-center gap-2",children:[L("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-blue-50 text-blue-600 transition-colors dark:bg-sky-900/40 dark:text-sky-300",children:L(_s,{size:16})}),le("div",{className:"min-w-0 flex-1",children:[L("div",{className:"truncate font-semibold text-slate-900 text-sm dark:text-slate-100",children:L(pe,{text:K(e.full_name),query:t??"",enabled:a})}),L("div",{className:"truncate text-[11px] text-slate-600 dark:text-slate-300",children:L(pe,{text:v,query:t??"",enabled:a})})]})]})}),le(fa,{defaultValue:"summary",className:"flex flex-1 flex-col overflow-hidden",children:[L(Bt,{className:"flex gap-1.5 border-slate-200 border-b bg-slate-50 px-2 py-1 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:V.map(y=>L(ut,{value:y.value,className:"rounded-md px-1.5 py-0.5 font-semibold text-[11px] transition-colors data-[state=active]:bg-white data-[state=active]:text-blue-600 dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-sky-300",children:y.label},y.value))}),V.map(y=>L(mt,{value:y.value,className:"scrollbar-thin flex-1 overflow-y-auto px-2.5 py-2 transition-colors dark:text-slate-200",children:y.content},y.value))]})]})};lt();oe();import{memo as $s}from"react";import{jsx as Xe,jsxs as ya}from"react/jsx-runtime";var ln=$s(({recordCount:e,companyCount:t,phase:a,loadedCount:s,totalCount:i,errorMessage:n,onRetry:r})=>{let{locale:d,labels:l}=he(),u=G(d,e),m=G(d,t);return ya("div",{"data-testid":"contact-map-annotation",className:"flex flex-wrap items-center gap-2 leading-1 transition-colors",role:"status",children:[ya("span",{className:"flex items-baseline gap-1",children:[Xe("span",{className:"text-slate-600 dark:text-slate-300",children:l.annotationTotalLabel}),Xe("span",{className:"text-slate-800 dark:text-slate-200","data-testid":"contact-map-record-count",children:u}),Xe("span",{className:"text-slate-600 dark:text-slate-300",children:l.recordUnit(u)})]}),ya("span",{className:"flex items-baseline gap-1",children:[Xe("span",{className:"text-slate-600 dark:text-slate-300",children:l.annotationCompaniesLabel}),Xe("span",{className:"text-slate-800 dark:text-slate-200","data-testid":"contact-map-company-count",children:m}),Xe("span",{className:"text-slate-600 dark:text-slate-300",children:l.companyUnit(m)})]}),a==="streaming"||a==="retrying"||a==="idle"?Xe("span",{"data-testid":"contact-map-stream-badge",className:"ml-2 inline-flex items-center gap-1.5 rounded-full bg-blue-50 px-2 py-0.5 font-medium text-blue-700 text-xs dark:bg-blue-900/30 dark:text-blue-300",children:i!==null&&i>0?l.annotationStreamingProgress({loaded:s,total:i,percent:Math.min(100,Math.round(s/i*100))}):l.annotationStreamingCount(s)}):null,a==="failed"||a==="auth-required"?ya("span",{"data-testid":"contact-map-error-badge",className:"ml-2 inline-flex items-center gap-1.5 rounded-full bg-rose-50 px-2 py-0.5 font-medium text-rose-700 text-xs dark:bg-rose-900/30 dark:text-rose-300",title:n??void 0,children:["\u26D4 ",l.annotationLoadFailed(s),r?Xe("button",{type:"button","data-testid":"contact-map-retry-button",onClick:r,className:"rounded border border-rose-300 bg-white px-1.5 py-0.5 font-semibold text-rose-700 transition-colors hover:bg-rose-100 dark:border-rose-700 dark:bg-rose-950 dark:text-rose-200 dark:hover:bg-rose-900",children:l.annotationRetry}):null]}):null]})});ln.displayName="ContactMapAnnotation";import{useMemo as Nn}from"react";oe();import{createContext as Vs,useContext as Ks,useMemo as js}from"react";import{jsx as Yn}from"react/jsx-runtime";var Xn={streamEndpoint:"/api/contact_map/stream"},Jn=Vs(Xn);function Zn({config:e,children:t}){let a=js(()=>({...Xn,...e}),[e]);return Yn(Jn.Provider,{value:a,children:Yn(Wn,{locale:a.locale,labels:a.labels,children:t})})}function Je(){return Ks(Jn)}import{useEffect as Zs,useMemo as ei,useSyncExternalStore as ti}from"react";var Gs=1e3,qs=3e4,Qs=6,Ys="/api/contact_map/stream",Xs=e=>({...e,contacted_at:e.contacted_at?new Date(e.contacted_at):null,created_at:e.created_at?new Date(e.created_at):void 0,updated_at:e.updated_at?new Date(e.updated_at):void 0}),Js=e=>Array.isArray(e.records),xa=class{constructor(t={}){this.recordMap=new Map;this.listeners=new Set;this.lastCursor=null;this.consecutiveFailures=0;this.started=!1;this.disposed=!1;this.activeController=null;this.wakeRetryWait=null;this.state={records:[],loadedCount:0,totalCount:null,isLoading:!0,isComplete:!1,phase:"idle",error:null};this.handleOnline=()=>{this.wakeRetryWait?.()};this.fetchFn=t.fetchFn??((...a)=>fetch(...a)),this.endpoint=t.endpoint??Ys,this.initialRetryDelayMs=t.initialRetryDelayMs??Gs,this.maxRetryDelayMs=t.maxRetryDelayMs??qs,this.maxConsecutiveFailures=t.maxConsecutiveFailures??Qs,this.logger=t.logger??Qe}getState(){return this.state}getRecordMap(){return this.recordMap}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}start(){this.started||this.disposed||(this.started=!0,typeof window<"u"&&window.addEventListener("online",this.handleOnline),this.runStreamLoop())}retry(){this.disposed||this.state.phase!=="failed"||(this.consecutiveFailures=0,this.setState({error:null,isLoading:this.recordMap.size===0}),this.runStreamLoop())}retryNow(){this.retry()}dispose(){this.disposed=!0,this.activeController?.abort(),this.wakeRetryWait?.(),typeof window<"u"&&window.removeEventListener("online",this.handleOnline)}setState(t){this.state={...this.state,...t};for(let a of this.listeners)a(this.state)}publishRecords(t={}){let a=Array.from(this.recordMap.values());this.setState({records:a,loadedCount:a.length,isLoading:!1,...t})}async runStreamLoop(){for(this.setState({phase:"streaming"});!this.disposed;){let t=await this.streamOnce();if(t==="aborted")return;if(t==="complete"){this.publishRecords({isComplete:!0,phase:"complete",error:null});return}if(t==="auth-required"){this.setState({phase:"auth-required",isLoading:!1,error:new Error("Authentication required")});return}if(this.consecutiveFailures+=1,this.consecutiveFailures>=this.maxConsecutiveFailures){this.setState({phase:"failed",isLoading:!1});return}let a=Math.min(this.initialRetryDelayMs*2**(this.consecutiveFailures-1),this.maxRetryDelayMs);if(this.setState({phase:"retrying",isLoading:this.recordMap.size===0}),this.logger.warn(`[ContactMapStream] retrying in ${a}ms (attempt ${this.consecutiveFailures})`),await this.waitBeforeRetry(a),this.disposed)return;this.setState({phase:"streaming"})}}waitBeforeRetry(t){return new Promise(a=>{let s=setTimeout(()=>{this.wakeRetryWait=null,a()},t);this.wakeRetryWait=()=>{clearTimeout(s),this.wakeRetryWait=null,a()}})}buildStreamUrl(){if(!this.lastCursor)return this.endpoint;let t=this.endpoint.includes("?")?"&":"?",a=new URLSearchParams;return this.lastCursor.contacted_at!==null&&a.set("cursor_contacted_at",this.lastCursor.contacted_at),a.set("cursor_person_id",String(this.lastCursor.person_id)),`${this.endpoint}${t}${a.toString()}`}async streamOnce(){this.activeController=new AbortController;try{let t=await this.fetchFn(this.buildStreamUrl(),{signal:this.activeController.signal,credentials:"same-origin"});if(t.status===401||t.status===403)return"auth-required";if(!(t.ok&&t.body))return this.logger.warn(`[ContactMapStream] unexpected response: ${t.status}`),"retryable";let a=t.body.getReader(),s=new TextDecoder,i="",n=!1,r=!1;for(;;){let{done:d,value:l}=await a.read();if(d)break;let u=s.decode(l,{stream:!0}),m=(i+u).split(`
2
+ `);i=m.pop()??"";let c=!1;for(let o of m){let p=o.trim();if(!p)continue;let f;try{f=JSON.parse(p)}catch(v){this.logger.warn("[ContactMapStream] failed to parse NDJSON line:",v);continue}if("type"in f&&f.type==="METADATA"){typeof f.total=="number"&&Number.isFinite(f.total)&&this.setState({totalCount:f.total});continue}if(!Js(f)){this.logger.warn("[ContactMapStream] server reported error:","error"in f?f.error:""),r=!0;continue}for(let v of f.records)v&&typeof v.person_id=="number"&&(this.recordMap.set(v.person_id,Xs(v)),c=!0);typeof f.total=="number"&&Number.isFinite(f.total)&&this.setState({totalCount:f.total}),f.nextCursor&&(this.lastCursor=f.nextCursor),f.isLast&&(n=!0)}c&&(this.consecutiveFailures=0,this.publishRecords({error:null}))}return r?(this.setState({error:new Error("Stream interrupted by server error")}),"retryable"):n?"complete":(this.setState({error:new Error("Stream ended before completion")}),"retryable")}catch(t){if(t instanceof Error&&t.name==="AbortError")return"aborted";let a=t instanceof Error?t:new Error(String(t));return this.setState({error:a}),"retryable"}finally{this.activeController=null}}};var va=null,er=e=>(va??(va=new xa({endpoint:e})),va),ud=()=>{va?.dispose(),va=null},tr=()=>er().getRecordMap(),ai={records:[],loadedCount:0,totalCount:null,isLoading:!0,isComplete:!1,phase:"idle",error:null};function Ca(e){let t=Je(),a=e??t.streamEndpoint??"/api/contact_map/stream",s=ei(()=>er(a),[a]);return Zs(()=>{s.start(),s.retry()},[s]),{...ti(n=>s.subscribe(n),()=>s.getState(),()=>ai),retryNow:()=>s.retryNow()}}oe();import{DEFAULT_FUZZY_SEARCH_OPTIONS as Sn}from"@aiquants/fuzzy-search";import{useFuzzySearch as No}from"@aiquants/fuzzy-search/react";import wo from"lucide-react/dist/esm/icons/search.js";import{useCallback as Yt,useEffect as Ue,useMemo as at,useRef as _r,useState as He,useTransition as Po}from"react";import{useNavigation as Lo,useSearchParams as Ro}from"react-router";en();import{useCallback as gt,useEffect as ni,useRef as ar}from"react";var Ze=e=>{let t=ar(null),a=ar({isPointerDown:!1,isDragging:!1,startX:0,scrollLeft:0,pointerId:0,hasCapture:!1,didDrag:!1,pointerType:""}),s=e?.dragThreshold??4,i=gt(c=>{let o=c.currentTarget,p=c.deltaY;!o||p===0||(c.preventDefault(),o.scrollBy({left:p,behavior:"smooth"}))},[]),n=gt(c=>{t.current?.removeEventListener("wheel",i),t.current=c,c?.addEventListener("wheel",i,{passive:!1})},[i]);ni(()=>()=>{t.current&&t.current.removeEventListener("wheel",i)},[i]);let r=gt(c=>{if(c.pointerType==="touch")return;let o=a.current;o.isPointerDown=!0,o.isDragging=!1,o.startX=c.clientX,o.scrollLeft=c.currentTarget.scrollLeft,o.pointerId=c.pointerId,o.hasCapture=!1,o.pointerType=c.pointerType},[]),d=gt(c=>{let o=a.current;if(!o.isPointerDown||o.pointerType==="touch")return;let p=c.currentTarget,f=c.clientX-o.startX;!o.isDragging&&Math.abs(f)>s&&(o.isDragging=!0,o.hasCapture||(p.setPointerCapture?.(c.pointerId),o.hasCapture=!0)),o.isDragging&&(c.preventDefault(),p.scrollLeft=o.scrollLeft-f)},[s]),l=gt(c=>{let o=a.current;if(o.pointerType==="touch")return;let p=c.currentTarget;o.isPointerDown&&o.hasCapture&&p.hasPointerCapture?.(c.pointerId)&&p.releasePointerCapture(c.pointerId),o.isDragging&&(o.didDrag=!0,window.setTimeout(()=>{o.didDrag=!1},0)),o.isPointerDown=!1,o.isDragging=!1,o.pointerId=0,o.hasCapture=!1},[]),u=gt(c=>{l(c)},[l]),m=gt(c=>{a.current.didDrag&&(c.preventDefault(),c.stopPropagation(),a.current.didDrag=!1)},[]);return{setScrollableRef:n,onPointerDown:r,onPointerMove:d,onPointerUp:u,onPointerLeave:u,onPointerCancel:u,onClickCapture:m}};lt();oe();import{jsx as nr}from"react/jsx-runtime";function rr({value:e,max:t=100,className:a,indicatorClassName:s,...i}){let n=e===void 0,r=n?0:Math.min(100,Math.max(0,e/t*100));return nr("div",{role:"progressbar","aria-valuenow":n?void 0:r,"aria-valuemin":0,"aria-valuemax":100,"data-slot":"progress",className:pt("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",a),...i,children:nr("div",{"data-slot":"progress-indicator",className:pt("h-full rounded-full bg-primary transition-[width] duration-300 ease-in-out will-change-transform",n&&"w-1/3 animate-progress-indeterminate",s),style:n?void 0:{width:`${r}%`}})})}import{useCallback as uo,useState as mo}from"react";import{useSearchParams as go}from"react-router";oe();ct();import{Panel as pr,PanelGroup as bi,PanelResizeHandle as yi}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as xi,VirtualScroll as vi}from"@aiquants/virtualscroll";import{lazy as Ci,memo as ki,Suspense as Si,useCallback as Be,useEffect as gr,useLayoutEffect as hr,useMemo as Kt,useRef as jt,useState as wa}from"react";var Ut={listPanelMinWidth:320,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35},$t={listPanelMinWidth:280,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35};function ka(e){let t=e.listPanelMinWidth+e.detailPanelMinWidth+e.handleThickness+e.listPaddingAndBorder+e.detailPaddingAndBorder,a=t+e.scrollbarSafetyBuffer,s=a+e.hysteresisSafetyMargin,i=s-a;return{physicalMinWidth:t,collapseThreshold:a,expandThreshold:s,hysteresisWidth:i}}import{useCallback as ri,useEffect as si,useState as ii}from"react";var sr=(e,t)=>{let{enableMutationObserver:a=!1,bottomGap:s=4,minFallbackHeight:i=240}=t??{},[n,r]=ii(600),d=ri(()=>{if(typeof window>"u")return;let l=e.current;if(!l||l.offsetParent===null&&window.getComputedStyle(l).position!=="fixed")return;let u=x=>Number.parseFloat(x)||0,{top:m}=l.getBoundingClientRect(),c=l.parentElement?.getBoundingClientRect(),o=window.getComputedStyle(document.documentElement),p=u(o.getPropertyValue("--footer-height")),f=u(o.getPropertyValue("--header-height")),v=u(o.getPropertyValue("--scrollbar-height")),T=window.getComputedStyle(l),C=u(T.marginBottom),z=u(T.paddingBottom),k=window.innerHeight-p-v-s,b=c?Math.min(c.bottom,k):k,g=c?Math.max(c.top,f):f,E=Math.max(m,g),V=b-E-C-z,y=Number.isFinite(V)?Math.floor(V):0,h=y>0?y:i;h>0&&Number.isFinite(h)&&r(x=>Math.abs(x-h)>1?h:x)},[s,e,i]);return si(()=>{if(typeof window>"u")return;let l=null,u=null,m=null,c=null,o=()=>{l!==null&&window.cancelAnimationFrame(l),l=window.requestAnimationFrame(()=>{d()})};o(),u=window.setTimeout(()=>{o()},150);let p=e.current;return typeof ResizeObserver<"u"&&p&&(m=new ResizeObserver(()=>{o()}),m.observe(p),p.parentElement&&m.observe(p.parentElement)),a&&typeof MutationObserver<"u"&&(c=new MutationObserver(()=>{o()}),c.observe(document.body,{attributes:!0,childList:!0,subtree:!0})),window.addEventListener("resize",o),()=>{l!==null&&window.cancelAnimationFrame(l),u!==null&&window.clearTimeout(u),m&&m.disconnect(),c&&c.disconnect(),window.removeEventListener("resize",o)}},[e,a,d]),{viewportHeight:n,updateViewportHeight:d}};import{useCallback as et,useEffect as ir,useRef as Vt,useState as or}from"react";var oi=600,lr=8,Sa=({ref:e,onSelect:t,resolveItem:a,item:s})=>{let[i,n]=or(!1),[r,d]=or(null),l=Vt(null),u=Vt(!1),m=Vt(!1),c=Vt(null),o=Vt({onSelect:t,resolveItem:a,item:s});ir(()=>{o.current={onSelect:t,resolveItem:a,item:s}},[t,a,s]);let p=et(()=>{typeof window>"u"||l.current!==null&&(window.clearTimeout(l.current),l.current=null)},[]),f=et(()=>{c.current&&(p(),m.current=!1,c.current=null)},[p]),v=et(g=>{typeof window>"u"||g.button!==0&&g.pointerType==="mouse"||(p(),m.current=!1,u.current=!1,c.current={x:g.clientX,y:g.clientY,pointerId:g.pointerId},l.current=window.setTimeout(()=>{let E=o.current,V=null;E.item!==void 0?V=E.item:E.resolveItem&&g.target&&(V=E.resolveItem(g.target)),V!==null&&(u.current=!0,E.onSelect?.(V),d(V),n(!0)),f()},oi))},[p,f]),T=et(g=>{c.current&&g.pointerId===c.current.pointerId&&(p(),c.current=null,m.current=!1)},[p]),C=et(g=>{u.current&&(g.preventDefault(),g.stopPropagation(),u.current=!1)},[]),z=et(g=>{if(!c.current||g.pointerId!==c.current.pointerId)return;let E=Math.abs(g.clientX-c.current.x),V=Math.abs(g.clientY-c.current.y);(E>lr||V>lr)&&(p(),c.current=null)},[p]),k=et(g=>{(i||l.current!==null)&&(g.preventDefault(),g.stopPropagation())},[i]),b=et(g=>{g?.cancelLongPressTimer&&p(),g?.suppressLongPress&&(m.current=!0),n(!1),d(null),u.current=!1,c.current=null},[p]);return ir(()=>{let g=e.current;if(!(g&&typeof window<"u"))return;let E=[["pointerdown",v,void 0],["pointerup",T,void 0],["pointercancel",T,void 0],["pointermove",z,void 0],["pointerleave",T,void 0],["click",C,!0],["contextmenu",k,void 0]],V=[["contextmenu",k,!0],["pointerup",T,!0],["pointercancel",T,!0]];for(let[y,h,x]of E)g.addEventListener(y,h,x);for(let[y,h,x]of V)window.addEventListener(y,h,x);return()=>{for(let[y,h,x]of E)g.removeEventListener(y,h,x);for(let[y,h,x]of V)window.removeEventListener(y,h,x);p()}},[e,v,T,z,C,k,p]),{isPopupVisible:i,popupItem:r,handleClosePopup:b}};import{useCallback as li,useEffect as di,useState as dr,useSyncExternalStore as ci}from"react";function Ta(e,t,a){let s=a?.mediaQuery??"(min-width: 1024px)",i=ci(li(m=>{if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};let c=window.matchMedia(s);return c.addEventListener("change",m),()=>c.removeEventListener("change",m)},[s]),()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(s).matches:!0,()=>!1),[n,r]=dr(!1),[d,l]=dr(0);return di(()=>{if(typeof window>"u"||typeof ResizeObserver>"u")return;let m=e.current;if(!m)return;let c=new ResizeObserver(o=>{for(let p of o){if(p.target!==m)continue;let f=0;p.borderBoxSize&&p.borderBoxSize.length>0?f=p.borderBoxSize[0].inlineSize:f=p.contentRect.width,!(!Number.isFinite(f)||f<=0)&&(l(f),r(v=>v&&f>=t.expandThreshold?!1:!v&&f<t.collapseThreshold?!0:v))}});return c.observe(m),()=>c.disconnect()},[e,t.collapseThreshold,t.expandThreshold]),{isTwoColumn:i&&!n,isContainerNarrow:n,isMediaMatches:i,containerWidth:d}}oe();oe();import{useSwipeToDismissOverlay as pi,useTapClick as ui}from"@aiquants/swipe-overlay";import{useCallback as mi,useEffect as gi,useRef as hi}from"react";import{jsx as cr,jsxs as fi}from"react/jsx-runtime";var Na=({isOpen:e,onClose:t,children:a,className:s="",title:i})=>{let n=q(),r=hi(null),{overlayRef:d,overlayStyle:l,attemptClose:u}=pi({isOpen:e,onClose:t,isCloseBlocked:mi(()=>!1,[]),skipWhenTextSelected:!0}),m=ui(()=>u());return gi(()=>{!e&&r.current?.contains(document.activeElement)&&document.activeElement.blur()},[e]),e?fi("div",{ref:r,"data-testid":"contact-map-mobile-overlay",className:`fixed top-0 bottom-0 left-0 z-50 flex touch-manipulation transition-[visibility] duration-200 ${e?"pointer-events-auto visible":"pointer-events-none invisible"}`,style:{right:"var(--aqcm-overlay-right, var(--aiquants-menu-pinned-width, 0px))",transition:"right 0.5s, visibility 0.2s"},"aria-hidden":!e,children:[cr("button",{type:"button","aria-label":n.overlayBackdrop,className:`absolute inset-0 touch-manipulation bg-slate-900/50 transition-opacity duration-200 focus:outline-none ${e?"opacity-100":"opacity-0"}`,...m}),cr("aside",{role:"dialog","aria-modal":"true","aria-label":i===void 0?n.overlayTitle:i,style:l,ref:d,className:`relative ml-auto flex h-full w-full max-w-lg transform touch-pan-y flex-col bg-white shadow-xl transition-transform duration-200 ease-out dark:bg-slate-900 ${s}`,onKeyDown:c=>{c.key==="Escape"&&(c.stopPropagation(),u())},children:a})]}):null};Ja();import{Fragment as Ii,jsx as W,jsxs as ye}from"react/jsx-runtime";var Ti=Ci(async()=>({default:(await Promise.resolve().then(()=>(Gn(),jn))).default})),fr=64,ur="h-[64px]",mr=240,Ni=4,dn=ka(Ut),wi=Ut.listPanelMinWidth,Pi=Ut.detailPanelMinWidth,Li=Ut.handleThickness,$d=dn.collapseThreshold,Vd=dn.expandThreshold,Ri=({contactData:e})=>{let t=q(),a=e?.full_name??t.noName,s=e?.title??"-",i=e?.company_name??"-",n=e?.department??"-",r=e?.email??"-",d=e?.company_phone_number??e?.mobile_phone_number??"-",l=e?.updated_at?Te(e.updated_at):"-";return W(pa,{fullName:a,title:s,companyName:i,department:n,phoneNumber:d,email:r,updatedAtText:l})},Mi=e=>({"--contact-panel-height":`${e}px`}),Ei=e=>typeof e=="object"&&e!==null&&"item"in e,Oi=(e,t)=>t!==void 0?`${e}:${t.toFixed(3)}`:void 0,Di=(e,t)=>{for(let a of e){let s=oa(a);if(s?.person_id===t)return s}return null},cn=(e,t,a)=>{let{viewportHeight:s}=sr(t,{enableMutationObserver:!0,bottomGap:Ni,minFallbackHeight:mr}),[i,n]=wa(0),r=Be(()=>{let c=a.current,o=t.current;if(!(c&&o))return;let p=c.getBoundingClientRect(),f=o.getBoundingClientRect(),v=Math.ceil(f.top-p.top);Number.isFinite(v)&&v>0&&n(T=>Math.abs(T-v)>1?v:T)},[t,a]);hr(()=>{if(!e)return;r();let c=requestAnimationFrame(r);return window.addEventListener("resize",r),()=>{cancelAnimationFrame(c),window.removeEventListener("resize",r)}},[e,r]);let d=s>0?s:mr,l=i>0?i:0,u=d+l,m=Kt(()=>Mi(u),[u]);return{normalizedViewportHeight:d,normalizedDetailHeight:u,panelSizingStyle:m}},Hi=new Set,Wi=()=>{let[e,t]=wa(Hi),a=Be((s,i)=>{t(n=>{if(n.has(s)===i)return n;let r=new Set(n);return i?r.add(s):r.delete(s),r})},[]);return{isAnyPopupVisible:e.size>0,handlePopupVisibilityChange:a}},_i=(e,t,a)=>{let s=jt(a);hr(()=>{s.current=a},[a]),gr(()=>{if(e!==null)return s.current(e,t),()=>{s.current(e,!1)}},[e,t])},br=ki(({entry:e,index:t,selectedPersonId:a,onSelect:s,searchQuery:i,enableHighlighting:n,openEmailsWithGmail:r,openGmailCompose:d,onPopupVisibilityChange:l})=>{let u=q(),m=jt(null),c=W("div",{className:ur}),o=Ei(e)?e:null,p=oa(e),{isPopupVisible:f,handleClosePopup:v}=Sa({ref:m,onSelect:s,item:p?.person_id});if(_i(p?.person_id??null,f,l),!e||!p)return c;let{person_id:T}=p,C=a===T,z=t%2===0?"bg-white dark:bg-slate-900":"bg-gray-50 dark:bg-slate-900/70",b=C?"border-blue-300 bg-blue-50 ring-1 ring-blue-200 dark:border-blue-500 dark:bg-blue-500/20 dark:ring-blue-500/40":z,g=["B","F"].map(E=>Oi(E,E==="B"?o?.baseScore:o?.score)).filter(Boolean);return ye("div",{ref:m,className:`flex ${ur} w-full items-center overflow-hidden border-gray-200 border-b px-4 py-2 text-left transition-colors hover:bg-blue-50 dark:border-slate-700 dark:hover:bg-blue-500/10 ${b}`,style:{height:fr},role:"button","aria-pressed":C,"data-selected":C?"true":"false",onClick:()=>s(T),children:[ye("div",{className:"hidden w-28 shrink-0 flex-col items-center gap-0.5 text-center sm:flex",children:[W("div",{className:"whitespace-nowrap font-medium text-slate-700 text-xs leading-tight dark:text-slate-200",children:u.listRowNumber(t+1)}),W("div",{className:"truncate text-[11px] text-slate-700 leading-tight dark:text-slate-200",children:T}),W("div",{className:"flex items-center gap-1 whitespace-nowrap font-mono text-[11px] text-slate-600 leading-tight dark:text-slate-300",children:g.length?g.map(E=>W("span",{children:E},E)):W("span",{children:"-"})})]}),W(Si,{fallback:W(Ri,{contactData:p}),children:W(Ti,{contactData:p,searchTerm:i,enableHighlighting:n,openEmailsWithGmail:r,openGmailCompose:d,isPopupVisible:f,onRequestClose:v})})]})});br.displayName="ContactListRow";var yr=({context:e})=>{let{contactMapRecords:t,filteredItems:a,searchQuery:s,hasSearchTerm:i,enableHighlighting:n,openEmailsWithGmail:r,isSearchTabActive:d}=e,{locale:l,labels:u,engineLabels:m}=he(),c=jt(null),o=jt(null),[p,f]=wa(null),{normalizedViewportHeight:v,panelSizingStyle:T}=cn(d,o,c),{isAnyPopupVisible:C,handlePopupVisibilityChange:z}=Wi(),k=Kt(()=>({enablePointerDrag:!C,enableKeyboardNavigation:!C}),[C]),b=Kt(()=>i?a:t,[i,a,t]),g=Be(ie=>{f(ie)},[]),E=Be(ie=>{if(!r)return;let ne=ie.trim();if(!ne||ne==="-"||typeof window>"u")return;let nt=ze(ne,!0);nt&&window.open(nt,"_blank","noopener,noreferrer")},[r]),[V,y]=wa(!1),h=Be(ie=>{g(ie),y(!0)},[g]),x=Be((ie,ne)=>W(br,{entry:ie,index:ne,selectedPersonId:p,onSelect:h,searchQuery:s,enableHighlighting:n,openEmailsWithGmail:r,openGmailCompose:E,onPopupVisibilityChange:z}),[p,h,s,n,r,E,z]),O=Be(ie=>b[ie],[b]),D=Be(ie=>oa(b[ie])?.person_id??`row-${ie}`,[b]),Z=Be(()=>fr,[]),w=b.length,P=Kt(()=>({enabled:!0,renderVisual:xi}),[]),H=Kt(()=>p===null?null:Di(b,p),[p,b]);gr(()=>{p!==null&&!H&&f(null)},[p,H]);let B=jt(null),{isTwoColumn:ae}=Ta(B,dn),ue=ye("div",{ref:c,className:"flex min-h-0 flex-1 flex-col gap-1",children:[W("div",{className:"hidden rounded-t-lg border border-gray-200 bg-gray-50 px-4 py-2 transition-colors sm:block dark:border-slate-700 dark:bg-slate-900/70",children:ye("div",{className:"flex items-center",children:[ye("div",{className:"flex w-28 shrink-0 flex-col items-center gap-0.5 text-center text-[11px] text-slate-700 uppercase tracking-wider dark:text-slate-200",children:[W("span",{className:"font-semibold text-slate-900 text-xs dark:text-slate-100",children:u.columnNo}),W("span",{className:"leading-tight",children:u.columnId}),W("span",{className:"whitespace-nowrap leading-tight",children:u.columnScore})]}),ye("div",{className:"hidden w-full grid-cols-3 gap-2 font-medium text-slate-700 text-xs uppercase tracking-wider transition-colors sm:grid xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto] dark:text-slate-200",children:[ye("div",{className:"flex flex-col gap-0.5",children:[W("span",{children:u.columnName}),W("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:u.columnTitle})]}),ye("div",{className:"flex flex-col gap-0.5",children:[W("span",{children:u.columnCompany}),W("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:u.columnDepartment})]}),ye("div",{className:"flex flex-col gap-0.5",children:[W("span",{children:u.columnPhone}),W("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:u.columnEmail})]}),W("div",{className:"hidden items-end justify-end xl:flex",children:W("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:u.columnUpdatedAt})})]})]})}),W("div",{ref:o,className:"flex-1",children:W(vi,{itemCount:w,getItemKey:D,behaviorOptions:k,getItem:O,getItemHeight:Z,viewportSize:v,overscanCount:10,scrollBarOptions:{width:8,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:P},locale:l,labels:m,className:"w-full rounded-b-lg border border-gray-200 border-t-0 bg-white pr-0.75 transition-colors dark:border-slate-700 dark:bg-slate-950",children:(ie,ne)=>x(ie,ne)})}),a.length===0&&i?W("div",{className:"py-8 text-center",children:W("p",{className:"text-slate-600 dark:text-slate-300",children:u.listNoSearchResults})}):null,w===0&&!i?W("div",{className:"py-8 text-center",children:W("p",{className:"text-slate-600 dark:text-slate-300",children:u.listNoData})}):null]});return W("div",{ref:B,"data-testid":"contact-map-list-root",className:"flex min-h-0 flex-1 flex-col",style:T,children:ae?ye(bi,{id:"contact-map-list-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-list-panel-group",children:[W(pr,{id:"contact-map-list-pane",defaultSize:{value:68,unit:"percentage"},minSize:{value:wi,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:ue}),W(yi,{id:"contact-map-list-handle",thickness:Li,indicator:{visible:!0,thickness:6,length:32,barThickness:2,barLength:16},className:"cursor-col-resize rounded transition-colors hover:bg-slate-200/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-1 dark:hover:bg-slate-700/60","aria-label":u.listResizeHandle}),W(pr,{id:"contact-map-list-detail-pane",defaultSize:{value:32,unit:"percentage"},minSize:{value:Pi,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:W(Ye,{contact:H,searchTerm:s,enableHighlighting:n})})]}):ye(Ii,{children:[ue,W("div",{className:"hidden","aria-hidden":"true",children:W(Ye,{contact:H,searchTerm:s,enableHighlighting:n})}),H?W(Na,{isOpen:V,onClose:()=>y(!1),className:"z-50 bg-white dark:bg-slate-900",children:ye("div",{className:"flex h-full flex-col overflow-hidden p-3 sm:p-4",children:[ye("div",{className:"mb-2 flex items-center justify-between border-b pr-10 pb-2 dark:border-slate-700",children:[W("h3",{className:"font-semibold text-slate-900 text-sm dark:text-slate-100",children:u.detailHeading}),W("button",{type:"button",onClick:()=>y(!1),className:"rounded px-2.5 py-1 font-medium text-slate-600 text-xs hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800",children:u.close})]}),W("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",style:{height:"100%"},children:W(Ye,{contact:H,searchTerm:s,enableHighlighting:n})})]})}):null]})})};ct();import{DirectoryTree as Gi}from"@aiquants/directory-tree";import{Panel as Sr,PanelGroup as qi,PanelResizeHandle as Qi}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as Yi}from"@aiquants/virtualscroll";import Xi from"@heroicons/react/24/solid/FolderMinusIcon.js";import Ji from"@heroicons/react/24/solid/FolderPlusIcon.js";import{useCallback as Ee,useEffect as ht,useMemo as Pe,useRef as Ra,useState as tt}from"react";import{createPortal as Zi}from"react-dom";var pn=(e,t)=>e&&e.trim()||t;import{useEffect as Ai,useRef as Pa,useState as Fi}from"react";var xr=(e,t=250)=>{let[a,s]=Fi(e),i=Pa(null),n=Pa(e),r=Pa(null),d=Pa(!1);return Ai(()=>{if(!d.current){d.current=!0,s(e),n.current=e;return}n.current=a,i.current=null;let l=u=>{i.current??(i.current=u);let m=u-i.current,c=Math.min(1,Math.max(0,m/t)),o=1-(1-c)**3,p=Math.max(0,Math.round(n.current+(e-n.current)*o));s(p),c<1&&(r.current=requestAnimationFrame(l))};return r.current=requestAnimationFrame(l),()=>{r.current!==null&&cancelAnimationFrame(r.current)}},[e,t]),Math.max(0,a)};import{useEffect as zi,useMemo as vr,useSyncExternalStore as Bi}from"react";oe();var Ui=250,$i=4e3,Cr=3,Vi=(e,t)=>e.uncategorizedCompany===t.uncategorizedCompany&&e.unnamedPerson===t.unnamedPerson,La=class{constructor(t){this.worker=null;this.generation=0;this.postedCount=0;this.latestSnapshot=null;this.workerNeedsReset=!1;this.lastSyncedRecords=[];this.postedNaming=null;this.lastSyncedNaming=null;this.consecutiveFailures=0;this.finalizeRequested=!1;this.retryTimer=null;this.listeners=new Set;this.state={snapshot:null,isBuilding:!1};this.getState=()=>this.state;this.subscribe=t=>(this.listeners.add(t),()=>this.listeners.delete(t));this.handleMessage=t=>{let a=t.data;a.type!=="TREE_CHUNK"||a.generation!==this.generation||a.uniquePersonCount===0&&this.postedCount>0&&(this.latestSnapshot?.uniquePersonCount??0)>0||this.latestSnapshot!==null&&a.uniquePersonCount<this.latestSnapshot.uniquePersonCount&&!(a.isIdle&&a.consumedRecords>=this.postedCount)||(a.isIdle&&a.consumedRecords>=this.postedCount&&(this.consecutiveFailures=0),this.latestSnapshot={tree:a.tree,directoryPaths:a.directoryPaths,consumedRecords:a.consumedRecords,uniquePersonCount:a.uniquePersonCount,isIdle:a.isIdle,rebuildEpoch:a.rebuildEpoch},this.updateState())};this.handleFailure=t=>{if(this.worker?.terminate(),this.worker=null,this.postedCount=0,this.workerNeedsReset=!0,this.consecutiveFailures+=1,this.updateState(),this.consecutiveFailures>=Cr)return;let a=Math.min(Ui*2**(this.consecutiveFailures-1),$i);this.retryTimer!==null&&clearTimeout(this.retryTimer),this.retryTimer=setTimeout(()=>{this.retryTimer=null;let s=this.lastSyncedNaming;s!==null&&(this.syncRecords(this.lastSyncedRecords,s),this.finalizeRequested&&this.finalize())},a)};this.workerFactory=t}updateState(){let t=this.postedCount>(this.latestSnapshot?.consumedRecords??0);this.state.snapshot===this.latestSnapshot&&this.state.isBuilding===t||(this.state={snapshot:this.latestSnapshot,isBuilding:t},this.notify())}notify(){for(let t of this.listeners)t()}ensureWorker(){if(this.consecutiveFailures>=Cr)return null;if(!this.worker)try{this.worker=this.workerFactory(),this.worker.onerror=this.handleFailure,this.worker.onmessageerror=this.handleFailure,this.worker.onmessage=this.handleMessage}catch(t){return this.handleFailure(t),null}return this.worker}syncRecords(t,a){this.lastSyncedRecords=t,this.lastSyncedNaming=a;let s=this.ensureWorker();if(!s)return;let i=this.postedNaming===null||!Vi(this.postedNaming,a);if((this.workerNeedsReset||i||t.length<this.postedCount)&&(this.generation+=1,this.postedCount=0,this.workerNeedsReset=!1,this.postedNaming=a,s.postMessage({type:"RESET_TREE",generation:this.generation,epochBase:this.latestSnapshot?.rebuildEpoch??0,naming:a}),this.updateState()),t.length>this.postedCount){let n=t.slice(this.postedCount);this.postedCount=t.length,s.postMessage({type:"APPEND_RECORDS",generation:this.generation,records:n}),this.updateState()}}finalize(){this.finalizeRequested=!0,this.worker&&this.worker.postMessage({type:"FINALIZE_TREE",generation:this.generation})}dispose(){this.retryTimer!==null&&clearTimeout(this.retryTimer),this.worker?.terminate(),this.worker=null,this.listeners.clear(),this.latestSnapshot=null,this.postedCount=0,this.workerNeedsReset=!1,this.lastSyncedRecords=[],this.postedNaming=null,this.lastSyncedNaming=null,this.consecutiveFailures=0,this.finalizeRequested=!1,this.state={snapshot:null,isBuilding:!1}}},Ki=e=>{if(e)return new Worker(e,{type:"module"});let t=typeof import.meta<"u"?import.meta.url:void 0;if(t){let s=t.includes(".ts")?"../workers/treeWorker.ts":"./worker/treeWorker.mjs";return new Worker(new URL(s,t),{type:"module"})}throw new Error("Tree Worker requires workerUrl or ESM import.meta.url")},Gt=null,un=(e,t)=>{if(!Gt){let a=e??(()=>Ki(t));Gt=new La(a)}return Gt},Zd=(e,t)=>{un().syncRecords(e,t)},ec=()=>{un().finalize()},tc=()=>{Gt?.dispose(),Gt=null},ji={snapshot:null,isBuilding:!1};function kr(e,t=!1){let a=Je(),s=a.treeWorkerFactory,i=a.workerUrls?.treeWorker,{labels:n}=he(),r=n.uncategorizedCompany,d=n.noName,l=vr(()=>({uncategorizedCompany:r,unnamedPerson:d}),[r,d]),u=vr(()=>s?new La(s):un(void 0,i),[s,i]);return zi(()=>{u.syncRecords(e,l),t&&u.finalize()},[u,e,t,l]),Bi(u.subscribe,u.getState,()=>ji)}oe();Xa();ga();import{Fragment as po,jsx as _,jsxs as me}from"react/jsx-runtime";var hn=ka($t),eo=$t.listPanelMinWidth,to=$t.detailPanelMinWidth,ao=$t.handleThickness,Nc=hn.collapseThreshold,wc=hn.expandThreshold,no=(e,t)=>{let{searchQuery:a,enableHighlighting:s}=t,i=pn(e.full_name,t.noName),n=pn(e.title,""),r=_(pe,{text:i,query:a,enabled:s});return n?me("span",{className:"flex items-center gap-1.5",children:[_("span",{children:r}),_("span",{className:"text-slate-400 text-xs dark:text-slate-500",children:_(pe,{text:n,query:a,enabled:s})})]}):r},ro="contact-map-tree h-full w-full",so={hoverClassName:"bg-slate-100/70 dark:bg-slate-800/60",directorySelectedClassName:"bg-sky-100/55 dark:bg-sky-900/40 [&_.directory-tree-name]:text-sky-700 dark:[&_.directory-tree-name]:text-sky-300",itemSelectedClassName:"bg-sky-100/70 dark:bg-sky-900/55 [&_.directory-tree-name]:text-sky-700 dark:[&_.directory-tree-name]:text-sky-300"},mn="h-4 w-4 shrink-0 transition-colors duration-150",io=(e,t,a)=>({...e,viewportHeightOverride:t,behaviorOptions:{...e.behaviorOptions,enablePointerDrag:!a,enableKeyboardNavigation:!a}}),Ma=null,Tr=null,qt=new Map,Nr="",wr=null,oo=(e,t,a,s,i)=>{let n=`${a?"icons":"plain"}#${s}#${i.noName}`;(n!==Nr||i.formatDirectoryName!==wr)&&(qt.clear(),Nr=n,wr=i.formatDirectoryName);let r={entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},d=new Set;for(let l of e){d.add(l.absolutePath);let u=`${l.name}\0${l.memberCount}`,m=qt.get(l.absolutePath);(!m||m.signature!==u)&&(m={signature:u,result:Lr([l],t,a,{searchQuery:"",enableHighlighting:!1,noName:i.noName,formatDirectoryName:i.formatDirectoryName})},qt.set(l.absolutePath,m));let c=m.result;c.entries.length>0&&r.entries.push(c.entries[0]);for(let[o,p]of c.personPathMap){let f=r.personPathMap.get(o);if(f)for(let v of p)f.add(v);else r.personPathMap.set(o,new Set(p))}for(let[o,p]of c.contactByPath)r.contactByPath.set(o,p);for(let[o,p]of c.ancestorsByPath)r.ancestorsByPath.set(o,p);r.totalCount+=c.totalCount,!r.firstPerson&&c.firstPerson&&(r.firstPerson=c.firstPerson)}for(let l of qt.keys())d.has(l)||qt.delete(l);return r},gn=e=>e.isSelected||e.isItemSelected?"text-sky-600 dark:text-sky-300":e.isExpanded&&e.isDirectory?"text-slate-600 dark:text-slate-200":"text-slate-500 dark:text-slate-400",Pr=e=>{let t=[];for(let a of e)a.type==="directory"&&(t.push(a.absolutePath),a.children&&t.push(...Pr(a.children)));return t},lo=e=>{if(e.memberCount===void 0)throw new Error(`[contact-map] directory entry ${e.absolutePath} has no memberCount`);return e.memberCount},Lr=(e,t,a,s,i)=>{let n=new Map,r=new Map,d=new Map,l=0,u=null,m=(o,p)=>{let f=[...p,o.absolutePath];d.set(o.absolutePath,f);let v,T,C=o.type==="directory"?s.formatDirectoryName(o.name,lo(o)):o.name,z=_(pe,{text:C,query:s.searchQuery,enabled:s.enableHighlighting});if(o.type==="file"&&o.personId){if(i&&!i.has(o.personId))return null;let k=t.get(o.personId);if(k){r.set(o.absolutePath,k),n.has(o.personId)||n.set(o.personId,new Set);let b=n.get(o.personId);b&&b.add(o.absolutePath),l++,u||(u={personId:o.personId,path:o.absolutePath}),a&&(T=g=>{let E=gn(g);return g.isSelected||g.isItemSelected||o.isPrimary&&(E=o.title?"text-indigo-600 dark:text-indigo-400":"text-orange-500 dark:text-orange-400"),_(a.person,{"aria-hidden":"true",className:`${mn} ${E}`})},o.title&&(z=no(k,s))),z=_("span",{"data-contact-path":o.absolutePath,className:"block w-full",children:z})}}else if(o.children){let k=o.children.map(b=>m(b,f)).filter(b=>b!==null);if(i&&k.length===0)return null;if(v=k,a){let b=o.relativePath.startsWith("company:")?a.company:a.department;T=g=>_(b,{"aria-hidden":"true",className:`${mn} ${gn(g)}`})}}return{name:C,label:z,type:o.type,absolutePath:o.absolutePath,relativePath:o.relativePath,icon:T,children:v}};return{entries:e.map(o=>m(o,[])).filter(o=>o!==null),personPathMap:n,contactByPath:r,ancestorsByPath:d,firstPerson:u,totalCount:l}},co=(e,t,a)=>{let s=new Set,i=new Set,n=new Map;t.forEach((m,c)=>{n.set(m.item.person_id,c)});for(let m of t){let c=m.item.person_id,o=e.personPathMap.get(c);if(o)for(let p of o){s.add(p);let f=e.ancestorsByPath.get(p);if(f){for(let v of f)s.add(v);a&&f.length>0&&i.add(f[0])}}}let r=new Map,d=m=>{let c=r.get(m.absolutePath);if(c!==void 0)return c;let o=1/0;if(m.type==="file"){let p=e.contactByPath.get(m.absolutePath);p&&(o=n.get(p.person_id)??1/0)}else if(m.children)for(let p of m.children)o=Math.min(o,d(p));return r.set(m.absolutePath,o),o},l=(m,c=0)=>m.filter(o=>a&&c===0&&i.has(o.absolutePath)?!0:s.has(o.absolutePath)).map(o=>a&&c===0&&i.has(o.absolutePath)?o:o.type==="directory"&&o.children?{...o,children:l(o.children,c+1)}:o).sort((o,p)=>c===0?d(o)-d(p):0),u=l(e.entries);return{...e,entries:u}},Rr=({context:e,controlsContainer:t})=>{let{contactMapRecords:a,filteredItems:s,hasSearchTerm:i,isSearchInProgress:n,isSearchTabActive:r}=e,{locale:d,labels:l,treeLabels:u}=he(),m=l.noName,c=l.treeDirectoryName,o=Pe(()=>({noName:m,formatDirectoryName:c}),[m,c]),[p,f]=tt(null),[v,T]=tt(!1),{snapshot:C,isBuilding:z}=kr(a),k=C?.tree??null,b=tr(),g=C?.rebuildEpoch??0,E=Pe(()=>k?oo(k,b,p,g,o):null,[k,b,p,g,o]),V=Pe(()=>{if(!k)return null;if(!i)return E;let S;v||(S=new Set(s.map(Y=>Y.item.person_id)));let A=Lr(k,b,p,{...o,searchQuery:e.searchQuery,enableHighlighting:e.enableHighlighting},S);return co(A,s,v)},[k,E,b,p,e.searchQuery,e.enableHighlighting,i,s,v,o]),y=Pe(()=>V||{entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},[V]),h=i&&e.errorMessage!==null,[x,O]=tt(y),D=Ra(!1);ht(()=>{if(!(n||h)){D.current=!!k,O(y);return}!D.current&&k&&y.entries.length>0&&(D.current=!0,O(y))},[y,k,n,h]);let Z=i&&(n||h)?x:y,{entries:w,personPathMap:P,contactByPath:H,totalCount:B}=Z,ae=Pe(()=>Pr(w),[w]),[ue,ie]=tt(()=>Tr??new Set),ne=Ee(S=>!ue.has(S),[ue]),nt=Ee(S=>{ie(A=>{let Y=new Set(A);return Y.has(S)?Y.delete(S):Y.add(S),Y})},[]),ft=Ee(S=>{S.length!==0&&ie(A=>{let Y=new Set(A);for(let Se of S)Y.add(Se);return Y})},[]),bt=Ee(S=>{ie(A=>{if(A.size===0)return A;let Y=!1,Se=new Set(A);for(let Tt of S)Se.delete(Tt)&&(Y=!0);return Y?Se:A})},[]);ht(()=>{Tr=ue},[ue]),ht(()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem("contact-map.tree-expanded")}catch{}},[]);let[Le,Xt]=tt(null),[ce,yt]=tt(null),[Jt,ee]=tt(!1),[Zt,xt]=tt(!1),We=Ra(null),be=Ra(null),{normalizedViewportHeight:Ot,panelSizingStyle:Oa}=cn(r,be,We),ve=Ee(S=>{let A=H.get(S);A&&(Le!==A.person_id&&Xt(A.person_id),S!==ce&&yt(S),ee(!0))},[H,ce,Le]),ea=Ee(S=>{ve(S.entry.absolutePath)},[ve]),vt=Ee(S=>S instanceof Element?S.closest("[data-contact-path]")?.getAttribute("data-contact-path")??null:null,[]),{isPopupVisible:$e,popupItem:_e,handleClosePopup:Ct}=Sa({ref:be,resolveItem:vt,onSelect:ve}),kt=Ee(S=>{if(!e.openEmailsWithGmail)return;let A=S.trim();if(!A||A==="-"||typeof window>"u")return;let Y=ze(A,!0);Y&&window.open(Y,"_blank","noopener,noreferrer")},[e.openEmailsWithGmail]),Ve=_e?H.get(_e):null,rt=$e&&Ve!==null&&Ve!==void 0;ht(()=>{$e&&!Ve&&Ct()},[$e,Ve,Ct]);let Ie=Pe(()=>({overscanCount:16,callbackThrottleMs:16,scrollBarOptions:{width:8,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:{enabled:!0,renderVisual:Yi}},behaviorOptions:{resetOnGetItemHeightChange:!1},preserveScrollAnchor:!0}),[]),Da=Pe(()=>io(Ie,Ot,rt),[Ie,Ot,rt]);ht(()=>{let S=!1;return typeof window>"u"?()=>{S=!0}:Ma?(f(Ma),()=>{S=!0}):((async()=>{try{let[Y,Se,Tt,je]=await Promise.all([import("lucide-react/dist/esm/icons/building-2.js"),import("lucide-react/dist/esm/icons/users-round.js"),import("lucide-react/dist/esm/icons/id-card.js"),import("lucide-react/dist/esm/icons/user-round.js")]);if(S)return;let it=Y.default,Ia=Se.default,Rn=Tt.default,Mn=je.default;it&&Ia&&Rn&&Mn&&(Ma={company:it,department:Ia,title:Rn,person:Mn},f(Ma))}catch(Y){Qe.warn("Failed to load lucide icons",Y)}})(),()=>{S=!0})},[]);let St=Pe(()=>{if(!p)return;let S=je=>it=>_(je,{"aria-hidden":"true",className:`${mn} ${gn(it)}`}),A={company:S(p.company),department:S(p.department),title:S(p.title)},Y=S(p.person),Se=je=>je in A,Tt=je=>{let[it]=je.entry.relativePath.split(":",1);return(Se(it)?A[it]:A.company)(je)};return{directory:Tt,directoryExpanded:Tt,file:Y}},[p]),Ha=Ee(()=>{ie(S=>S.size===0?S:new Set)},[]),ta=Ee(()=>{ae.length>0&&ft(ae)},[ae,ft]);ht(()=>{if(typeof window>"u")return;let S=document.documentElement,A=window.matchMedia("(prefers-color-scheme: dark)"),Y=()=>xt(S.classList.contains("dark")||A.matches);Y(),A.addEventListener("change",Y);let Se=new MutationObserver(Y);return Se.observe(S,{attributes:!0,attributeFilter:["class"]}),()=>{A.removeEventListener("change",Y),Se.disconnect()}},[]),ht(()=>{if(B===0){Le!==null&&Xt(null),ce!==null&&yt(null);return}if(Le!==null){let S=P.get(Le);if(S){if(ce&&S.has(ce))return;let A=S.values().next().value;A&&yt(A);return}}Le!==null&&Xt(null),ce!==null&&yt(null)},[B,Le,ce,P]);let st=ce?H.get(ce)??null:null,Ae=Zt?"#475569":"#94A3B8",Ke=e.isStreamingComplete,Wa=e.isStreamingFailed,Dt=Ke&&a.length===0,aa=(z||!k)&&!Dt,na=xr(B,250),_a=k!==null||Dt,ra=me("div",{className:"flex items-center gap-1.5",children:[me("span",{className:"inline-flex h-5 items-center gap-1 rounded bg-slate-100 px-1.5 font-medium font-mono text-[10px] text-slate-700 dark:bg-slate-800 dark:text-slate-200",title:l.treeNodeCountTitle,children:[_("span",{className:"text-[10px]",children:"\u{1F333}"})," ",l.treeNodeCountLabel," ",_a?l.treeNodeCount(na):"\u2026"]}),Wa&&!Ke?me("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-rose-200 bg-rose-50 px-1.5 font-medium text-[10px] text-rose-700 dark:border-rose-800 dark:bg-rose-950/60 dark:text-rose-300",title:l.treeStreamInterruptedTitle,children:[_("span",{className:"h-1.5 w-1.5 rounded-full bg-rose-500"}),_("span",{className:"text-[10px]",children:"\u26D4"})," ",l.treeStreamInterrupted]}):Ke?aa?me("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-amber-200 bg-amber-50 px-1.5 font-medium text-[10px] text-amber-700 dark:border-amber-800 dark:bg-amber-950/60 dark:text-amber-300",title:l.treeBuildingTitle,children:[me("span",{className:"relative flex h-1.5 w-1.5",children:[_("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),_("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-amber-500"})]}),_("span",{className:"text-[10px]",children:"\u{1F33F}"})," ",l.treeBuilding]}):me("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-emerald-200 bg-emerald-50 px-1.5 font-medium text-[10px] text-emerald-700 dark:border-emerald-800 dark:bg-emerald-950/60 dark:text-emerald-300",title:l.treeCompleteTitle,children:[_("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),_("span",{className:"text-[10px]",children:"\u2705"})," ",l.treeComplete]}):me("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-sky-200 bg-sky-50 px-1.5 font-medium text-[10px] text-sky-700 dark:border-sky-800 dark:bg-sky-950/60 dark:text-sky-300",title:l.treeStreamLoadingTitle,children:[me("span",{className:"relative flex h-1.5 w-1.5",children:[_("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-sky-400 opacity-75"}),_("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-sky-500"})]}),_("span",{className:"text-[10px]",children:"\u23F3"})," ",l.treeStreamLoading]}),i&&me("button",{type:"button",onClick:()=>T(!v),className:`inline-flex h-5 items-center rounded px-1.5 text-[10px] transition-colors ${v?"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300":"text-slate-500 hover:bg-slate-100 dark:text-slate-400 dark:hover:bg-slate-800"}`,title:l.treeShowEntireCompanyTitle,children:[_("span",{className:"text-[10px]",children:"\u{1F3E2}"})," ",l.treeShowEntireCompany]}),ae.length>0?me("div",{className:"flex items-center gap-1",children:[_("button",{type:"button",onClick:Ha,className:"inline-flex h-5 w-5 items-center justify-center rounded border border-slate-300 bg-white text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700 dark:hover:text-slate-100","aria-label":l.treeExpandAll,title:l.treeExpandAllTitle,children:_(Ji,{className:"h-3 w-3"})}),_("button",{type:"button",onClick:ta,className:"inline-flex h-5 w-5 items-center justify-center rounded border border-slate-300 bg-white text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700 dark:hover:text-slate-100","aria-label":l.treeCollapseAll,title:l.treeCollapseAllTitle,children:_(Xi,{className:"h-3 w-3"})})]}):null]}),Ht=Ra(null),{isTwoColumn:wn}=Ta(Ht,hn,{mediaQuery:"(min-width: 768px)"}),Pn=Pe(()=>({toggle:nt,isExpanded:ne,expandMultiple:bt,collapseMultiple:ft,isPending:n}),[ft,bt,ne,nt,n]),Ln=Pe(()=>({onEntryClick:ea,selectedPath:ce}),[ea,ce]),U=Pe(()=>({className:ro,lineColor:Ae,iconOverrides:St,showDirectoryIcons:!!St,showFileIcons:!!St,highlightStyles:so,entryClassName:"rounded-md px-1 py-0.5",nameClassName:"text-xs tracking-tight",directoryNameClassName:"font-normal text-slate-800 dark:text-slate-100",fileNameClassName:"text-slate-700 dark:text-slate-200"}),[Ae,St]),j=_("div",{ref:We,className:"flex min-h-0 flex-1 flex-col rounded-xl border border-slate-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-950",children:_("div",{ref:be,className:"flex min-h-0 flex-1 flex-col overflow-hidden p-2",children:w.length>0?_(Gi,{entries:w,expansion:Pn,selection:Ln,visual:U,virtualScroll:Da,locale:d,labels:u}):_("div",{className:"flex h-full w-full items-center justify-center rounded-lg border border-slate-300 border-dashed bg-white/70 px-6 text-center text-slate-500 text-sm transition-colors dark:border-slate-700 dark:bg-slate-900/50 dark:text-slate-300",children:i?l.treeNoMatches:l.treeEmpty})})});return me("div",{ref:Ht,"data-testid":"contact-map-tree-root",className:"flex min-h-0 flex-1 flex-col",style:Oa,children:[t&&Zi(ra,t),wn?me(qi,{id:"contact-map-tree-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-tree-panel-group",children:[_(Sr,{id:"contact-map-tree-pane",defaultSize:{value:60,unit:"percentage"},minSize:{value:eo,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:j}),_(Qi,{id:"contact-map-tree-handle",thickness:ao,indicator:{visible:!0,thickness:6,length:32,barThickness:2,barLength:16},className:"cursor-col-resize rounded transition-colors hover:bg-slate-200/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-1 dark:hover:bg-slate-700/60","aria-label":l.treeResizeHandle}),_(Sr,{id:"contact-map-tree-detail-pane",defaultSize:{value:40,unit:"percentage"},minSize:{value:to,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:_(Ye,{contact:st??null,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})})]}):me(po,{children:[j,_("div",{className:"hidden","aria-hidden":"true",children:_(Ye,{contact:st,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})}),Jt&&st?_(Na,{isOpen:Jt,onClose:()=>ee(!1),className:"z-50 bg-white dark:bg-slate-900",children:me("div",{className:"flex h-full flex-col overflow-hidden p-3 sm:p-4",children:[me("div",{className:"mb-2 flex items-center justify-between border-b pr-10 pb-2 dark:border-slate-700",children:[_("h3",{className:"font-semibold text-slate-900 text-sm dark:text-slate-100",children:l.detailHeading}),_("button",{type:"button",onClick:()=>ee(!1),className:"rounded px-2.5 py-1 font-medium text-slate-600 text-xs hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800",children:l.close})]}),_("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",style:{height:"100%"},children:_(Ye,{contact:st,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})})]})}):null]}),rt&&Ve&&_(ca,{contactData:Ve,openEmailsWithGmail:e.openEmailsWithGmail,openGmailCompose:kt,onRequestClose:Ct})]})};import{jsx as Qt,jsxs as Lt}from"react/jsx-runtime";var fn="view",ho={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},fo=e=>e==="tree"?"tree":"list",Mr=({context:e})=>{let t=q(),[a,s]=go(),[i,n]=mo(null),r=fo(a.get(fn)),{setScrollableRef:d,onPointerDown:l,onPointerMove:u,onPointerUp:m,onPointerLeave:c,onPointerCancel:o,onClickCapture:p}=Ze(),f=uo(v=>{let T=v==="tree"?"tree":"list";if(T===r)return;let C=new URLSearchParams(typeof window<"u"?window.location.search:"");T==="list"?C.delete(fn):C.set(fn,T),s(C,{replace:!0})},[r,s]);return Lt("div",{"data-testid":"contact-map-search-tab-group",className:"flex h-full flex-1 flex-col",children:[Lt("div",{className:"mt-1 mb-1.5 flex shrink-0 items-center gap-2",children:[Lt("div",{ref:d,className:"flex space-x-1 overflow-x-auto text-nowrap rounded-lg bg-gray-100 p-0.5 transition-colors dark:bg-slate-800/80",style:ho,onPointerDown:l,onPointerMove:u,onPointerUp:m,onPointerLeave:c,onPointerCancel:o,onClickCapture:p,children:[Lt("button",{type:"button","data-testid":"contact-map-tab-list",onClick:()=>f("list"),className:`rounded px-2 py-0.5 text-xs transition-colors ${r==="list"?"bg-blue-500 text-white dark:bg-blue-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4C4} ",t.listViewTab]}),Lt("button",{type:"button","data-testid":"contact-map-tab-tree",onClick:()=>f("tree"),className:`rounded px-2 py-0.5 text-xs transition-colors ${r==="tree"?"bg-green-500 text-white dark:bg-green-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F333} ",t.treeViewTab]})]}),Qt("div",{ref:n,className:"flex items-center gap-1.5"})]}),Lt("div",{className:"flex h-full flex-1 flex-col",children:[Qt("div",{className:`${r==="list"?"flex h-full flex-1 flex-col":"hidden"}`,children:r==="list"?Qt(yr,{context:e}):null}),Qt("div",{className:`${r==="tree"?"flex h-full flex-1 flex-col":"hidden"}`,children:r==="tree"?Qt(Rr,{context:e,controlsContainer:i}):null})]})]})};import{DEFAULT_FUZZY_SEARCH_OPTIONS as xn}from"@aiquants/fuzzy-search";import{memo as xo}from"react";oe();oe();import{DEFAULT_FUZZY_SEARCH_OPTIONS as F}from"@aiquants/fuzzy-search";import{memo as bo,useId as xe}from"react";import{jsx as M,jsxs as I}from"react/jsx-runtime";var bn=bo(({searchOptions:e,setSearchOptions:t})=>{let a=q(),s="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",i="text-xs font-semibold",n=e.sortBy==="relevance",r=xe(),d=xe(),l=xe(),u=xe(),m=xe(),c=xe(),o=xe(),p=xe(),f=xe(),v=xe(),T=xe(),C=[];C.push(I("div",{className:`${s} border-green-200 border-l-4 dark:border-green-400/60`,children:[I("div",{className:`${i} text-green-700 dark:text-green-300`,children:["\u{1F3D7}\uFE0F ",a.indexBuildHeading]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:r,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexNgramSize}),M("input",{id:r,type:"range",min:"1",max:"4",step:"1",value:e.ngramSize||F.ngramSize,onChange:b=>t(g=>({...g,ngramSize:parseInt(b.target.value,10)})),className:"w-full"}),I("span",{className:"text-green-600 text-xs dark:text-green-300",children:[a.currentValueLabel," ",e.ngramSize||F.ngramSize]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexNgramSizeHint})]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:d,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexMinNgramOverlap}),M("input",{id:d,type:"range",min:"1",max:"5",step:"1",value:e.minNgramOverlap||F.minNgramOverlap,onChange:b=>t(g=>({...g,minNgramOverlap:parseInt(b.target.value,10)})),className:"w-full"}),I("span",{className:"text-green-600 text-xs dark:text-green-300",children:[a.currentValueLabel," ",e.minNgramOverlap||F.minNgramOverlap]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexMinNgramOverlapHint})]})]},"index-build")),C.push(I("div",{className:`${s} border-blue-200 border-l-4 dark:border-blue-500/60`,children:[I("div",{className:`${i} text-blue-700 dark:text-blue-300`,children:["\u{1F50D} ",a.indexCandidateHeading]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:l,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexThreshold}),M("input",{id:l,type:"range",min:"0.0",max:"1.0",step:"0.05",value:e.indexWorkerOptions?.threshold??F.indexWorkerOptions?.threshold,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,threshold:parseFloat(b.target.value)}})),className:"w-full"}),I("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.threshold??F.indexWorkerOptions?.threshold]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexThresholdHint})]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:m,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexNgramOverlapThreshold}),M("input",{id:m,type:"range",min:"0.1",max:"0.9",step:"0.1",value:e.indexWorkerOptions?.ngramOverlapThreshold??F.indexWorkerOptions?.ngramOverlapThreshold,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,ngramOverlapThreshold:parseFloat(b.target.value)}})),className:"w-full"}),I("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.ngramOverlapThreshold??F.indexWorkerOptions?.ngramOverlapThreshold]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexNgramOverlapThresholdHint})]})]},"candidate-control")),C.push(I("div",{className:`${s} border-cyan-200 border-l-4 dark:border-cyan-400/60`,children:[I("div",{className:`${i} text-cyan-700 dark:text-cyan-300`,children:["\u{1F9ED} ",a.indexStrategyHeading]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:u,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexStrategy}),I("select",{id:u,value:e.indexWorkerOptions?.strategy??F.indexWorkerOptions?.strategy??"hybrid",onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,strategy:b.target.value}})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[M("option",{value:"fast",children:a.indexStrategyFast}),M("option",{value:"accurate",children:a.indexStrategyAccurate}),M("option",{value:"hybrid",children:a.indexStrategyHybrid})]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexStrategyHint})]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:c,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexMinCandidatesRatio}),M("input",{id:c,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.minCandidatesRatio??F.indexWorkerOptions?.minCandidatesRatio,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,minCandidatesRatio:parseFloat(b.target.value)}})),className:"w-full"}),I("span",{className:"text-cyan-600 text-xs dark:text-cyan-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.minCandidatesRatio??F.indexWorkerOptions?.minCandidatesRatio]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexMinCandidatesRatioHint})]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:o,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexMaxCandidatesRatio}),M("input",{id:o,type:"range",min:"0.3",max:"0.8",step:"0.1",value:e.indexWorkerOptions?.maxCandidatesRatio??F.indexWorkerOptions?.maxCandidatesRatio,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxCandidatesRatio:parseFloat(b.target.value)}})),className:"w-full"}),I("span",{className:"text-cyan-600 text-xs dark:text-cyan-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.maxCandidatesRatio??F.indexWorkerOptions?.maxCandidatesRatio]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexMaxCandidatesRatioHint})]})]},"strategy")),C.push(I("div",{className:`${s} border-indigo-200 border-l-4 dark:border-indigo-500/60`,children:[I("div",{className:`${i} text-indigo-700 dark:text-indigo-300`,children:["\u{1F521} ",a.scoreTuningHeading]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:p,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexJaroWinklerPrefix}),M("input",{id:p,type:"range",min:"0.05",max:"0.25",step:"0.05",value:e.indexWorkerOptions?.jaroWinklerPrefix??F.indexWorkerOptions?.jaroWinklerPrefix,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,jaroWinklerPrefix:parseFloat(b.target.value)}})),className:"w-full"}),I("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.jaroWinklerPrefix??F.indexWorkerOptions?.jaroWinklerPrefix]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexJaroWinklerPrefixHint})]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:f,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.maxResults}),M("input",{id:f,type:"range",min:"1000",max:"10000",step:"1000",value:e.indexWorkerOptions?.maxResults??F.indexWorkerOptions?.maxResults,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxResults:parseInt(b.target.value,10)}})),className:"w-full"}),I("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.maxResults??F.indexWorkerOptions?.maxResults]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexMaxResultsHint})]})]},"jaro")),C.push(I("div",{className:`${s} border-emerald-200 border-l-4 ${n?"":"opacity-50"} dark:border-emerald-400/60`,children:[I("div",{className:`${i} text-emerald-700 dark:text-emerald-300`,children:["\u{1F3AF} ",a.relevanceWeightsHeading]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:v,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.fieldWeight}),M("input",{id:v,type:"range",min:"0",max:"1",step:"0.05",value:e.indexWorkerOptions?.relevanceFieldWeight??F.indexWorkerOptions?.relevanceFieldWeight??.2,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,relevanceFieldWeight:parseFloat(b.target.value)}})),disabled:!n,className:"w-full disabled:cursor-not-allowed"}),I("span",{className:"text-emerald-600 text-xs dark:text-emerald-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.relevanceFieldWeight??F.indexWorkerOptions?.relevanceFieldWeight??.2]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexFieldWeightHint})]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:T,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexPerfectMatchBonus}),M("input",{id:T,type:"range",min:"0",max:"0.3",step:"0.1",value:e.indexWorkerOptions?.relevancePerfectMatchBonus??F.indexWorkerOptions?.relevancePerfectMatchBonus??.1,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,relevancePerfectMatchBonus:parseFloat(b.target.value)}})),disabled:!n,className:"w-full disabled:cursor-not-allowed"}),I("span",{className:"text-emerald-600 text-xs dark:text-emerald-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.relevancePerfectMatchBonus??F.indexWorkerOptions?.relevancePerfectMatchBonus??.1]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexPerfectMatchBonusHint})]}),!n&&M("p",{className:"text-[11px] text-emerald-600 dark:text-emerald-300",children:a.relevanceOnlyNotice})]},"relevance"));let z=xe(),k=xe();return C.push(I("div",{className:`${s} border-teal-200 border-l-4 dark:border-teal-400/60`,children:[I("div",{className:`${i} text-teal-700 dark:text-teal-300`,children:["\u{1F524} ",a.indexContainmentHeading]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:z,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexContainmentBase}),M("input",{id:z,type:"range",min:"0.0",max:"0.7",step:"0.05",value:e.indexWorkerOptions?.containmentScoreBase??F.indexWorkerOptions?.containmentScoreBase??.7,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,containmentScoreBase:parseFloat(b.target.value)}})),className:"w-full"}),I("span",{className:"text-teal-600 text-xs dark:text-teal-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.containmentScoreBase??F.indexWorkerOptions?.containmentScoreBase??.7]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexContainmentBaseHint})]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:k,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexContainmentCoverage}),M("input",{id:k,type:"range",min:"0.0",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.containmentCoverageWeight??F.indexWorkerOptions?.containmentCoverageWeight??.3,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,containmentCoverageWeight:parseFloat(b.target.value)}})),className:"w-full"}),I("span",{className:"text-teal-600 text-xs dark:text-teal-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.containmentCoverageWeight??F.indexWorkerOptions?.containmentCoverageWeight??.3]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexContainmentCoverageHint})]})]},"containment")),I("section",{className:"space-y-3",children:[I("div",{className:"flex items-center justify-between gap-3",children:[I("div",{className:"flex items-center gap-2 font-semibold text-green-700 text-xs transition-colors dark:text-green-300",children:[M("span",{children:"\u{1F4CA}"}),M("span",{className:"tracking-wide",children:a.indexSettingsHeading})]}),M("button",{type:"button",onClick:()=>t(b=>({...b,indexWorkerOptions:{threshold:F.indexWorkerOptions?.threshold||.4,ngramOverlapThreshold:F.indexWorkerOptions?.ngramOverlapThreshold||.3,minCandidatesRatio:F.indexWorkerOptions?.minCandidatesRatio||.1,maxCandidatesRatio:F.indexWorkerOptions?.maxCandidatesRatio||.5,jaroWinklerPrefix:F.indexWorkerOptions?.jaroWinklerPrefix||.1,maxResults:F.indexWorkerOptions?.maxResults||100,relevanceFieldWeight:F.indexWorkerOptions?.relevanceFieldWeight||.2,relevancePerfectMatchBonus:F.indexWorkerOptions?.relevancePerfectMatchBonus||.1,containmentScoreBase:F.indexWorkerOptions?.containmentScoreBase||.7,containmentCoverageWeight:F.indexWorkerOptions?.containmentCoverageWeight||.3,strategy:F.indexWorkerOptions?.strategy},ngramSize:F.ngramSize,minNgramOverlap:F.minNgramOverlap})),className:"rounded border border-green-300 bg-green-100 px-2 py-1 font-medium text-green-700 text-xs transition-colors hover:bg-green-200 dark:border-green-400/60 dark:bg-green-900/20 dark:text-green-200 dark:hover:bg-green-800/30",title:a.resetToDefaultsTitle,children:a.reset})]}),M("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:C})]})});bn.displayName="IndexWorkerSettings";oe();import{DEFAULT_FUZZY_SEARCH_OPTIONS as de}from"@aiquants/fuzzy-search";import{memo as yo,useId as Rt}from"react";import{jsx as te,jsxs as re}from"react/jsx-runtime";var yn=yo(({searchOptions:e,setSearchOptions:t})=>{let a=q(),s="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",i="text-xs font-semibold",n=e.sortBy==="relevance",r=Rt(),d=Rt(),l=Rt(),u=Rt(),m=Rt(),c=Rt(),o=[];return o.push(re("div",{className:`${s} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[re("div",{className:`${i} text-purple-700 dark:text-purple-300`,children:["\u{1F9EE} ",a.levenshteinCandidateHeading]}),re("div",{className:"space-y-2",children:[te("label",{htmlFor:r,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.levenshteinThreshold}),te("input",{id:r,type:"range",min:"0.0",max:n?"1.5":"1.0",step:"0.05",value:e.levenshteinWorkerOptions?.threshold??de.levenshteinWorkerOptions?.threshold,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,threshold:parseFloat(p.target.value)}})),className:"w-full"}),re("span",{className:"text-purple-600 text-xs dark:text-purple-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.threshold??de.levenshteinWorkerOptions?.threshold]}),te("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n?a.levenshteinThresholdHintRelevance:a.levenshteinThresholdHint})]}),re("div",{className:"space-y-2",children:[te("label",{htmlFor:d,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.levenshteinLengthSimilarity}),te("input",{id:d,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.lengthSimilarityThreshold??de.levenshteinWorkerOptions?.lengthSimilarityThreshold,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,lengthSimilarityThreshold:parseFloat(p.target.value)}})),className:"w-full"}),re("span",{className:"text-purple-600 text-xs dark:text-purple-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthSimilarityThreshold??de.levenshteinWorkerOptions?.lengthSimilarityThreshold]}),te("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinLengthSimilarityHint})]})]},"threshold")),o.push(re("div",{className:`${s} border-pink-200 border-l-4 dark:border-pink-400/60`,children:[re("div",{className:`${i} text-pink-700 dark:text-pink-300`,children:["\u{1FA84} ",a.scoreTuningHeading]}),re("div",{className:"space-y-2",children:[te("label",{htmlFor:l,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.levenshteinLengthPenalty}),te("input",{id:l,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.levenshteinWorkerOptions?.lengthDiffPenalty??de.levenshteinWorkerOptions?.lengthDiffPenalty,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,lengthDiffPenalty:parseFloat(p.target.value)}})),className:"w-full"}),re("span",{className:"text-pink-600 text-xs dark:text-pink-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthDiffPenalty??de.levenshteinWorkerOptions?.lengthDiffPenalty]}),te("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinLengthPenaltyHint})]})]},"penalty")),o.push(re("div",{className:`${s} border-violet-200 border-l-4 dark:border-violet-400/60`,children:[re("div",{className:`${i} text-violet-700 dark:text-violet-300`,children:["\u{1F4E6} ",a.levenshteinResultsHeading]}),te("label",{htmlFor:u,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.maxResults}),te("input",{id:u,type:"range",min:"1000",max:"10000",step:"1000",value:e.levenshteinWorkerOptions?.maxResults??de.levenshteinWorkerOptions?.maxResults,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,maxResults:parseInt(p.target.value,10)}})),className:"w-full"}),re("span",{className:"text-violet-600 text-xs dark:text-violet-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.maxResults??de.levenshteinWorkerOptions?.maxResults]}),te("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinMaxResultsHint})]},"max-results")),o.push(re("div",{className:`${s} border-rose-200 border-l-4 ${n?"":"opacity-50"} dark:border-rose-400/60`,children:[re("div",{className:`${i} text-rose-700 dark:text-rose-300`,children:["\u{1F3AF} ",a.relevanceWeightsHeading]}),re("div",{className:"space-y-2",children:[te("label",{htmlFor:m,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.fieldWeight}),te("input",{id:m,type:"range",min:"0",max:"1",step:"0.05",value:e.levenshteinWorkerOptions?.relevanceFieldWeight??de.levenshteinWorkerOptions?.relevanceFieldWeight??.15,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,relevanceFieldWeight:parseFloat(p.target.value)}})),disabled:!n,className:"w-full disabled:cursor-not-allowed"}),re("span",{className:"text-rose-600 text-xs dark:text-rose-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.relevanceFieldWeight??de.levenshteinWorkerOptions?.relevanceFieldWeight??.15]}),te("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinFieldWeightHint})]}),re("div",{className:"space-y-2",children:[te("label",{htmlFor:c,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.levenshteinPartialBonus}),te("input",{id:c,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.partialMatchBonus??de.levenshteinWorkerOptions?.partialMatchBonus,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,partialMatchBonus:parseFloat(p.target.value)}})),disabled:!n,className:"w-full disabled:cursor-not-allowed"}),re("span",{className:"text-rose-600 text-xs dark:text-rose-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.partialMatchBonus??de.levenshteinWorkerOptions?.partialMatchBonus]}),te("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinPartialBonusHint})]}),!n&&te("p",{className:"text-[11px] text-rose-600 dark:text-rose-300",children:a.relevanceOnlyNotice})]},"relevance")),re("section",{className:"space-y-3",children:[re("div",{className:"flex items-center justify-between gap-3",children:[re("div",{className:"flex items-center gap-2 font-semibold text-purple-700 text-xs transition-colors dark:text-purple-300",children:[te("span",{children:"\u{1F4CF}"}),te("span",{className:"tracking-wide",children:a.levenshteinSettingsHeading})]}),te("button",{type:"button",onClick:()=>t(p=>({...p,levenshteinWorkerOptions:{threshold:de.levenshteinWorkerOptions?.threshold||.3,lengthSimilarityThreshold:de.levenshteinWorkerOptions?.lengthSimilarityThreshold||.1,partialMatchBonus:de.levenshteinWorkerOptions?.partialMatchBonus||.1,lengthDiffPenalty:de.levenshteinWorkerOptions?.lengthDiffPenalty||1,maxResults:de.levenshteinWorkerOptions?.maxResults||100,relevanceFieldWeight:de.levenshteinWorkerOptions?.relevanceFieldWeight||.15}})),className:"rounded border border-purple-300 bg-purple-100 px-2 py-1 font-medium text-purple-700 text-xs transition-colors hover:bg-purple-200 dark:border-purple-400/60 dark:bg-purple-900/20 dark:text-purple-200 dark:hover:bg-purple-800/30",title:a.resetToDefaultsTitle,children:a.reset})]}),te("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:o})]})});yn.displayName="LevenshteinWorkerSettings";import{jsx as De,jsxs as Oe}from"react/jsx-runtime";var vo={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},vn=xo(({searchOptions:e,setSearchOptions:t,enableHighlighting:a,setEnableHighlighting:s,openEmailsWithGmail:i,setOpenEmailsWithGmail:n,activeTab:r,onTabChange:d})=>{let l=q(),{setScrollableRef:u,onPointerDown:m,onPointerMove:c,onPointerUp:o,onPointerLeave:p,onPointerCancel:f,onClickCapture:v}=Ze();return Oe("div",{className:"wrap-break-word flex w-full flex-col gap-1.5 rounded-lg border border-blue-300 bg-white p-1.5 shadow-md transition-colors dark:border-blue-500/40 dark:bg-slate-900/80 dark:shadow-blue-900/30",children:[Oe("div",{className:"mb-0.5 flex shrink-0 flex-col gap-1 rounded bg-blue-50 px-1.5 py-0.5 transition-colors sm:flex-row sm:items-center sm:justify-between dark:bg-blue-900/30",children:[Oe("h3",{className:"font-semibold text-gray-700 text-xs transition-colors dark:text-slate-100",children:["\u2699\uFE0F ",l.searchSettings]}),De("div",{className:"flex flex-wrap gap-1.5",children:Oe("button",{type:"button",onClick:()=>t(T=>({...xn,autoSearchOnIndexRebuild:!1,debounceMs:0,workerUrls:T.workerUrls,indexWorkerOptions:{...xn.indexWorkerOptions},levenshteinWorkerOptions:{...xn.levenshteinWorkerOptions}})),className:"rounded bg-red-500 px-1.5 py-0.5 text-[10px] text-white transition-colors hover:bg-red-600 dark:hover:bg-red-700",title:l.settingsResetAllTitle,children:["\u{1F504} ",l.settingsResetAll]})})]}),De("div",{className:"mb-0 shrink-0",children:Oe("div",{ref:u,role:"tablist","aria-label":l.settingsTabsLabel,className:"flex space-x-1 overflow-x-auto text-nowrap rounded-md bg-gray-100 p-0.5 transition-colors dark:bg-slate-800/80",style:vo,onPointerDown:m,onPointerMove:c,onPointerUp:o,onPointerLeave:p,onPointerCancel:f,onClickCapture:v,children:[Oe("button",{type:"button",role:"tab","aria-selected":r==="basic",onClick:()=>d("basic"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${r==="basic"?"bg-blue-500 text-white dark:bg-blue-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F527} ",l.settingsBasicTab]}),Oe("button",{type:"button",role:"tab","aria-selected":r==="advanced",onClick:()=>d("advanced"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${r==="advanced"?"bg-orange-500 text-white dark:bg-orange-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u26A1 ",l.settingsAdvancedTab]}),Oe("button",{type:"button",role:"tab","aria-selected":r==="index",onClick:()=>d("index"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${r==="index"?"bg-green-500 text-white dark:bg-green-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CA} ",l.indexWorkerName]}),Oe("button",{type:"button",role:"tab","aria-selected":r==="levenshtein",onClick:()=>d("levenshtein"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${r==="levenshtein"?"bg-purple-500 text-white dark:bg-purple-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CF} ",l.levenshteinWorkerName]})]})}),Oe("div",{className:"flex flex-col gap-1",children:[De("div",{className:`${r==="basic"?"block":"hidden"}`,children:De(ja,{searchOptions:e,setSearchOptions:t,enableHighlighting:a,setEnableHighlighting:s,openEmailsWithGmail:i,setOpenEmailsWithGmail:n})}),De("div",{className:`${r==="advanced"?"block":"hidden"}`,children:De(Ka,{searchOptions:e,setSearchOptions:t})}),De("div",{className:`${r==="index"?"block":"hidden"}`,children:De(bn,{searchOptions:e,setSearchOptions:t})}),De("div",{className:`${r==="levenshtein"?"block":"hidden"}`,children:De(yn,{searchOptions:e,setSearchOptions:t})})]})]})});vn.displayName="SearchOptionsPanel";import{memo as So}from"react";lt();oe();import{memo as Co}from"react";import{jsxs as Cn}from"react/jsx-runtime";var R=Co(({label:e,value:t,unit:a,color:s="text-gray-600 dark:text-slate-300"})=>Cn("div",{className:"wrap-break-word flex min-w-0 flex-col overflow-hidden text-gray-700 transition-colors sm:flex-row sm:justify-between dark:text-slate-200",children:[Cn("span",{className:"wrap-break-word overflow-hidden text-left",children:[e,":"]}),Cn("span",{className:`font-medium ${s} min-w-0 overflow-hidden break-all transition-colors sm:ml-2`,children:[t,a]})]}));R.displayName="StatItem";ct();lt();oe();import{memo as ko}from"react";import{jsx as N,jsxs as $}from"react/jsx-runtime";var Mt=ko(({kind:e,icon:t,stats:a,color:s})=>{let{locale:i,labels:n}=he(),r=P=>G(i,P);if(!a)return N("section",{className:"rounded-lg border border-gray-200 border-dashed bg-white/40 p-3 text-gray-400 text-xs transition-colors dark:border-slate-700 dark:bg-slate-900/40 dark:text-slate-400",children:n.statsNoData});let d=a.basic||{},l=a.workerSpecific||{},u=a.analysis||{},m=d.totalSearches??0,c=d.totalProcessingTime??0,o=d.averageSearchTime??0,p=d.lastSearchTime??0,f=d.errorCount??0,v=d.timestamp,T=u.fieldPerformance||{},C=u.performanceInsights||{},z=u.recentHistory||[],k=l.specificMetrics||{},b=l.operationCount??0,g=l.operationDistribution||{},E=e==="index",V=e==="levenshtein",y=E?n.indexWorkerName:n.levenshteinWorkerName,h=k,x=k,O="flex flex-col gap-1 rounded-lg border border-gray-200 bg-white/80 p-3 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",D="text-xs font-semibold transition-colors",Z=P=>{if(P)return Te(P)},w=[];if(w.push($("div",{className:`${O} border-blue-200 border-l-4 dark:border-blue-500/60`,children:[$("div",{className:`${D} ${s}`,children:["\u{1F4CA} ",n.statsBasicHeading]}),N(R,{label:n.statTotalSearches,value:r(m),color:s}),N(R,{label:n.statAverageSearchTime,value:o.toFixed(2),unit:"ms",color:s}),N(R,{label:n.statTotalProcessingTime,value:c.toFixed(2),unit:"ms",color:s}),N(R,{label:n.statLastSearchTime,value:p.toFixed(2),unit:"ms",color:s}),N(R,{label:n.statErrorCount,value:f,color:f>0?"text-red-600 dark:text-red-400":s}),Z(v)&&N(R,{label:n.statUpdatedAt,value:Z(v),color:"text-gray-500 dark:text-slate-400"})]},"basic")),b>0||Object.keys(g).length>0){let P=Object.entries(g).sort(([,H],[,B])=>(Number(B)||0)-(Number(H)||0)).slice(0,6);w.push($("div",{className:`${O} border-amber-200 border-l-4 dark:border-amber-400/60`,children:[$("div",{className:`${D} text-amber-600 dark:text-amber-300`,children:["\u{1F527} ",n.statsOperationsHeading]}),N(R,{label:n.statTotalOperations,value:r(b),color:"text-amber-700 dark:text-amber-300"}),P.length>0&&N("div",{className:"mt-1 space-y-1",children:P.map(([H,B])=>N(R,{label:H,value:r(Number(B)),unit:n.timesUnit(r(Number(B))),color:"text-amber-700 dark:text-amber-300"},H))})]},"operations"))}if(E&&(w.push($("div",{className:`${O} border-green-200 border-l-4 dark:border-green-400/60`,children:[$("div",{className:`${D} text-green-700 dark:text-green-300`,children:["\u{1F3D7}\uFE0F ",n.statsIndexHeading]}),N(R,{label:n.statIndexBuilds,value:r(h.totalIndexBuilds??0),color:"text-green-700 dark:text-green-300"}),N(R,{label:n.statDataSize,value:r(h.currentDataSize??0),unit:n.itemsUnit(r(h.currentDataSize??0)),color:"text-green-700 dark:text-green-300"}),N(R,{label:n.statLastBuildTime,value:(h.lastIndexTime??0).toFixed(2),unit:"ms",color:"text-green-700 dark:text-green-300"})]},"index-core")),h.cacheSize&&w.push($("div",{className:`${O} border-emerald-200 border-l-4 dark:border-emerald-400/60`,children:[$("div",{className:`${D} text-emerald-700 dark:text-emerald-300`,children:["\u{1F4BE} ",n.statsCacheHeading]}),N(R,{label:n.statCacheNgram,value:r(h.cacheSize.ngram??0),color:"text-emerald-700 dark:text-emerald-300"}),N(R,{label:n.statCacheWord,value:r(h.cacheSize.word??0),color:"text-emerald-700 dark:text-emerald-300"}),N(R,{label:n.statCachePhonetic,value:r(h.cacheSize.phonetic??0),color:"text-emerald-700 dark:text-emerald-300"})]},"index-cache")),h.indexMetadata)){let P=Object.entries(h.indexMetadata).slice(0,6);P.length>0&&w.push($("div",{className:`${O} border-teal-200 border-l-4 dark:border-teal-400/60`,children:[$("div",{className:`${D} text-teal-700 dark:text-teal-300`,children:["\u{1F4CB} ",n.statsIndexMetadataHeading]}),P.map(([H,B])=>{let ae;if(typeof B=="number"){let ue=H.toLowerCase();ue.includes("time")&&!ue.includes("timestamp")?ae=`${B.toFixed(2)}ms`:ue.includes("timestamp")||ue.includes("at")?ae=Z(B)??B.toString():ae=r(B)}else ae=String(B);return N(R,{label:H,value:ae,color:"text-teal-700 dark:text-teal-300"},H)})]},"index-meta"))}if(V){if(w.push($("div",{className:`${O} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[$("div",{className:`${D} text-purple-700 dark:text-purple-300`,children:["\u{1F522} ",n.statsCalculationsHeading]}),N(R,{label:n.statTotalCalculations,value:r(x.totalCalculations??0),color:"text-purple-700 dark:text-purple-300"}),N(R,{label:n.statDistanceCalculations,value:r(x.totalDistanceCalculations??0),color:"text-purple-700 dark:text-purple-300"}),N(R,{label:n.statAverageDistance,value:typeof x.averageDistance=="number"?x.averageDistance.toFixed(2):"0.00",color:"text-purple-700 dark:text-purple-300"}),N(R,{label:n.statMinDistance,value:x.minDistance??n.notAvailable,color:"text-purple-700 dark:text-purple-300"}),N(R,{label:n.statMaxDistance,value:x.maxDistance??0,color:"text-purple-700 dark:text-purple-300"})]},"lev-basic")),w.push($("div",{className:`${O} border-fuchsia-200 border-l-4 dark:border-fuchsia-400/60`,children:[$("div",{className:`${D} text-fuchsia-700 dark:text-fuchsia-300`,children:["\u{1F3AF} ",n.statsMatchesHeading]}),N(R,{label:n.statPartialMatches,value:r(x.partialMatches??0),color:"text-fuchsia-700 dark:text-fuchsia-300"}),N(R,{label:n.statPerfectMatches,value:r(x.perfectMatches??0),color:"text-fuchsia-700 dark:text-fuchsia-300"}),N(R,{label:n.statEarlyTerminations,value:r(x.earlyTerminations??0),color:"text-fuchsia-700 dark:text-fuchsia-300"})]},"lev-match")),x.similarityThresholds&&w.push($("div",{className:`${O} border-rose-200 border-l-4 dark:border-rose-400/60`,children:[$("div",{className:`${D} text-rose-700 dark:text-rose-300`,children:["\u{1F4C8} ",n.statsSimilarityHeading]}),N(R,{label:n.statAbove80,value:r(x.similarityThresholds.above80??0),color:"text-emerald-700 dark:text-emerald-300"}),N(R,{label:n.statAbove60,value:r(x.similarityThresholds.above60??0),color:"text-lime-700 dark:text-lime-300"}),N(R,{label:n.statAbove40,value:r(x.similarityThresholds.above40??0),color:"text-orange-600 dark:text-orange-300"}),N(R,{label:n.statBelow40,value:r(x.similarityThresholds.below40??0),color:"text-red-600 dark:text-red-400"})]},"lev-similarity")),x.distanceDistribution){let P=Object.entries(x.distanceDistribution).sort(([,H],[,B])=>Number(B)-Number(H)).slice(0,6);P.length>0&&w.push($("div",{className:`${O} border-indigo-200 border-l-4 dark:border-indigo-500/60`,children:[$("div",{className:`${D} text-indigo-700 dark:text-indigo-300`,children:["\u{1F4CA} ",n.statsDistanceHeading]}),P.map(([H,B])=>N(R,{label:n.statDistance(H),value:r(Number(B)),unit:n.timesUnit(r(Number(B))),color:"text-indigo-700 dark:text-indigo-300"},H))]},"lev-distance"))}if(x.queryLengthStats){let P=Object.entries(x.queryLengthStats).sort(([,H],[,B])=>(B.count??0)-(H.count??0)).slice(0,6);P.length>0&&w.push($("div",{className:`${O} border-violet-200 border-l-4 dark:border-violet-400/60`,children:[$("div",{className:`${D} text-violet-700 dark:text-violet-300`,children:["\u{1F4CF} ",n.statsQueryLengthHeading]}),P.map(([H,B])=>{let ae=Number(B.count??0),ue=Number(B.averageScore??0);return N(R,{label:n.statQueryLength(H),value:n.statQueryLengthValue({count:ae,averagePercent:(ue*100).toFixed(1)}),color:"text-violet-700 dark:text-violet-300"},H)})]},"lev-query-length"))}}if(Object.keys(T).length>0){let P=Object.entries(T).sort(([,H],[,B])=>(B.averageScore??0)-(H.averageScore??0)).slice(0,6);w.push($("div",{className:`${O} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[$("div",{className:`${D} text-purple-700 dark:text-purple-300`,children:["\u{1F4CB} ",n.statsFieldPerformanceHeading]}),P.map(([H,B])=>{let ae=B;return $("div",{className:"space-y-1 rounded bg-purple-50/60 p-2 transition-colors dark:bg-slate-900/50",children:[N("div",{className:"font-semibold text-purple-700 text-xs transition-colors dark:text-purple-300",children:H}),N(R,{label:n.statAverageScore,value:`${((ae.averageScore??0)*100).toFixed(1)}%`,color:"text-purple-700 dark:text-purple-300"}),N(R,{label:n.statMatchCount,value:r(ae.matchCount??0),unit:n.itemsUnit(r(ae.matchCount??0)),color:"text-purple-700 dark:text-purple-300"}),N(R,{label:n.statBestWorstScore,value:`${((ae.bestScore??0)*100).toFixed(1)}% / ${((ae.worstScore??0)*100).toFixed(1)}%`,color:"text-purple-700 dark:text-purple-300"})]},H)})]},"field-performance"))}if(C.bestPerformingField||C.totalHistoryEntries||C.similarityDistribution){let P=(C.recentAverageResultCount??0).toFixed(1);w.push($("div",{className:`${O} border-blue-200 border-l-4 dark:border-blue-400/60`,children:[$("div",{className:`${D} text-blue-700 dark:text-blue-300`,children:["\u{1F50D} ",n.statsInsightsHeading]}),C.bestPerformingField&&N(R,{label:n.statBestField,value:C.bestPerformingField,color:"text-blue-700 dark:text-blue-300"}),N(R,{label:n.statRecentAverageTime,value:(C.recentAverageProcessingTime??0).toFixed(2),unit:"ms",color:"text-blue-700 dark:text-blue-300"}),N(R,{label:n.statRecentAverageResults,value:P,unit:n.itemsUnit(P),color:"text-blue-700 dark:text-blue-300"}),N(R,{label:n.statThroughput,value:(C.throughputPerSecond??0).toFixed(2),unit:n.throughputUnit,color:"text-blue-700 dark:text-blue-300"}),N(R,{label:n.statCommonQueryLength,value:r(C.mostCommonQueryLength??0),unit:n.charactersUnit(r(C.mostCommonQueryLength??0)),color:"text-blue-700 dark:text-blue-300"}),N(R,{label:n.statHistoryEntries,value:r(C.totalHistoryEntries??0),color:"text-blue-700 dark:text-blue-300"}),C.similarityDistribution&&$("div",{className:"mt-1 grid grid-cols-2 gap-1",children:[N(R,{label:n.statHighSimilarity,value:r(C.similarityDistribution.highSimilarity??0),color:"text-emerald-700 dark:text-emerald-300"}),N(R,{label:n.statMediumSimilarity,value:r(C.similarityDistribution.mediumSimilarity??0),color:"text-lime-700 dark:text-lime-300"}),N(R,{label:n.statLowSimilarity,value:r(C.similarityDistribution.lowSimilarity??0),color:"text-orange-600 dark:text-orange-300"}),N(R,{label:n.statVeryLowSimilarity,value:r(C.similarityDistribution.veryLowSimilarity??0),color:"text-red-600 dark:text-red-400"})]})]},"performance-insights"))}return z.length>0&&w.push($("div",{className:`${O} border-sky-200 border-l-4 dark:border-sky-400/60`,children:[$("div",{className:`${D} text-sky-700 dark:text-sky-300`,children:["\u{1F4C8} ",n.statsRecentHistoryHeading]}),z.slice(-3).reverse().map((P,H)=>$("div",{className:"rounded bg-sky-50/70 p-2 transition-colors dark:bg-slate-900/50",children:[N("div",{className:"font-medium text-sky-700 transition-colors dark:text-sky-300",children:P.operationType}),N("div",{className:"text-sky-600 text-xs transition-colors dark:text-sky-200",children:n.statsHistoryEntry({processingTimeMs:P.processingTime.toFixed(2),resultCount:P.resultCount??0})}),Z(P.timestamp)&&N("div",{className:"text-[10px] text-sky-500 transition-colors dark:text-sky-200",children:Z(P.timestamp)})]},`${P.operationType}-${P.timestamp??H}`))]},"recent-history")),$("section",{className:"space-y-2",children:[$("div",{className:`flex items-center gap-2 font-semibold text-xs ${s}`,children:[N("span",{children:t}),N("span",{className:"tracking-wide",children:y})]}),N("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:w})]})});Mt.displayName="WorkerStatsSection";import{jsx as ke,jsxs as Ce}from"react/jsx-runtime";var To={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},kn=So(({performanceMetrics:e,searchTerm:t,totalDataCount:a,resultsCount:s,resetStats:i,rebuildIndex:n,isIndexBuilding:r,activeTab:d,onTabChange:l})=>{let{locale:u,labels:m}=he(),c=t.trim(),o=c?s:a,{setScrollableRef:p,onPointerDown:f,onPointerMove:v,onPointerUp:T,onPointerLeave:C,onPointerCancel:z,onClickCapture:k}=Ze(),b=d!=="index"||r,g=r?m.statsRebuildingTitle:d!=="index"?m.statsRebuildIndexTabOnlyTitle:m.statsRebuildTitle,E=b?"cursor-not-allowed bg-gray-300 text-gray-500 dark:bg-slate-700 dark:text-slate-400":"bg-blue-500 text-white hover:bg-blue-600 dark:bg-blue-500 dark:hover:bg-blue-600",V=r?`\u23F3 ${m.statsRebuilding}`:`\u{1F3D7}\uFE0F ${m.statsRebuild}`;return Ce("div",{className:"wrap-break-word flex w-full flex-col gap-1.5 rounded-lg border border-blue-300 bg-white p-1.5 shadow-md transition-colors dark:border-blue-500/40 dark:bg-slate-900/80 dark:shadow-blue-900/30",children:[Ce("div",{className:"mb-0.5 flex shrink-0 flex-col gap-1 rounded bg-blue-50 px-1.5 py-0.5 transition-colors sm:flex-row sm:items-center sm:justify-between dark:bg-blue-900/30",children:[Ce("h3",{className:"font-semibold text-gray-700 text-xs transition-colors dark:text-slate-100",children:["\u{1F4CA} ",m.searchStatistics]}),Ce("div",{className:"flex flex-wrap gap-1.5",children:[ke("button",{type:"button",onClick:()=>n(),disabled:b,className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${E}`,title:g,children:V}),Ce("button",{type:"button",onClick:i,className:"rounded bg-red-500 px-1.5 py-0.5 text-[10px] text-white transition-colors hover:bg-red-600 dark:hover:bg-red-700",title:m.statsResetTitle,children:["\u{1F504} ",m.reset]})]})]}),ke("div",{className:"mb-0 shrink-0",children:Ce("div",{ref:p,className:"flex space-x-1 overflow-x-auto text-nowrap rounded-md bg-gray-100 p-0.5 transition-colors dark:bg-slate-800/80",style:To,onPointerDown:f,onPointerMove:v,onPointerUp:T,onPointerLeave:C,onPointerCancel:z,onClickCapture:k,children:[Ce("button",{type:"button",onClick:()=>l("overview"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${d==="overview"?"bg-blue-500 text-white dark:bg-blue-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CB} ",m.statsOverviewTab]}),Ce("button",{type:"button",onClick:()=>l("index"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${d==="index"?"bg-green-500 text-white dark:bg-green-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CA} ",m.statsIndexTab]}),Ce("button",{type:"button",onClick:()=>l("levenshtein"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${d==="levenshtein"?"bg-purple-500 text-white dark:bg-purple-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CF} ",m.statsLevenshteinTab]})]})}),Ce("div",{className:"flex flex-col gap-1 pb-0.5",children:[Ce("div",{className:`${d==="overview"?"grid":"hidden"} grid-cols-1 gap-2 pr-1 text-gray-600 text-xs transition-colors sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 dark:text-slate-300`,children:[ke(R,{label:m.statTotalSearches,value:G(u,e.totalSearches)}),ke(R,{label:m.statAverageSearchTime,value:e.averageSearchTime.toFixed(1),unit:"ms"}),ke(R,{label:m.statDataCount,value:G(u,e.itemCount)}),ke(R,{label:c?m.statResultCount:m.statDisplayedCount,value:G(u,o)})]}),ke("div",{className:`${d==="index"?"space-y-3":"hidden"} pr-1 text-gray-600 text-xs transition-colors dark:text-slate-300`,children:ke(Mt,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:"text-green-600 dark:text-green-300"})}),ke("div",{className:`${d==="levenshtein"?"space-y-3":"hidden"} pr-1 text-gray-600 text-xs transition-colors dark:text-slate-300`,children:ke(Mt,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:"text-purple-600 dark:text-purple-300"})}),Ce("div",{className:"hidden",children:[ke(Mt,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:"text-green-600 dark:text-green-300"}),ke(Mt,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:"text-purple-600 dark:text-purple-300"})]})]})]})});kn.displayName="StatisticsPanel";import{Fragment as Wr,jsx as se,jsxs as ge}from"react/jsx-runtime";var Mo=/[\u200B\uFEFF]/g,Tn=typeof window<"u",Ir=Tn&&typeof document<"u",Ea=(e,t=[],a=!1)=>{let s=_r(e);s.current=e,Ue(()=>{if(!(!Tn||a&&!Ir))return s.current()},[a,...t])},Er=(e,t,a)=>{let[s,i]=He(()=>{let n=Or(r=>r.getItem(e));return n&&t.includes(n)?n:a});return Ea(()=>{Or(n=>{n.setItem(e,s)})},[e,s]),[s,i]},Or=e=>{if(!Tn)return null;try{return e(window.sessionStorage)}catch{return null}},Dr=(e,t)=>{let[a,s]=He(e);return Ue(()=>{let i=setTimeout(()=>{s(e)},t);return()=>{clearTimeout(i)}},[e,t]),a},Eo="contact-map.settings-tab",Oo="contact-map.statistics-tab",Do=["basic","advanced","index","levenshtein"],Ho=["overview","index","levenshtein"],Hr=["full_name","company_name","department","title","email","company_phone_number","mobile_phone_number"],Wo={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},Ar=({streamState:e,workerUrls:t,onFooterVisibilityChange:a,children:s}={})=>{let i=Je(),{locale:n,labels:r}=he(),d=Ca(),l=at(()=>e||{contactMapRecords:d.records,isStreamingComplete:d.isComplete,isStreamingFailed:d.phase==="failed",streamPhase:d.phase,loadedCount:d.loadedCount,companyCount:0,totalCount:d.totalCount,errorMessage:d.error?.message??null},[e,d]),{contactMapRecords:u,isStreamingComplete:m,isStreamingFailed:c}=l,o=Lo(),[p]=Ro(),f=_r(null),[v,T]=He(!0),[C,z]=He(i.openEmailsWithGmail??!1),[k,b]=He(p.get("q")||""),g=Dr(k,300);Ue(()=>{let U=p.get("q")||"";b(j=>j!==U?U:j)},[p]),Ue(()=>{if(typeof window>"u")return;let U=new URL(window.location.href);(U.searchParams.get("q")||"")!==g&&(g?U.searchParams.set("q",g):U.searchParams.delete("q"),window.history.replaceState(window.history.state,"",U.toString()))},[g]);let[E,V]=Po(),[y,h]=He("search"),[x,O]=Er(Eo,Do,"basic"),[D,Z]=Er(Oo,Ho,"overview"),{setScrollableRef:w,onPointerDown:P,onPointerMove:H,onPointerUp:B,onPointerLeave:ae,onPointerCancel:ue,onClickCapture:ie}=Ze(),ne=Yt(()=>{if(!Ir)return;let U=f.current;!U||document.activeElement===U||window.requestAnimationFrame(()=>{try{U.focus({preventScroll:!0})}catch{}})},[]),nt=Yt(U=>{let j=U;h(j),j==="search"&&ne()},[ne]),ft=at(()=>{let{indexWorkerOptions:U={},levenshteinWorkerOptions:j={},...S}=Sn;return{...S,autoSearchOnIndexRebuild:!1,debounceMs:0,workerUrls:t,indexWorkerOptions:{...U},levenshteinWorkerOptions:{...j}}},[t]),[bt,Le]=He(ft),ce=(bt.multiTermOperator??Sn.multiTermOperator)==="and",yt=ce?r.operatorAndTitle:r.operatorOrTitle,Jt=Dr(u,m?0:800),{searchTerm:ee,setSearchTerm:Zt,filteredItems:xt,isSearching:We,isIndexBuilding:be,clearSearch:Ot,resetStats:Oa,performanceMetrics:ve,rebuildIndex:ea,error:vt}=No(Jt,Hr,bt),$e=ee.trim().length>0,[_e,Ct]=He(""),[kt,Ve]=He(()=>ee),rt=at(()=>ua(k),[k]),Ie=at(()=>ua(g),[g]);Ue(()=>{g===_e&&Ie===ee||V(()=>{Ct(g),Zt(Ie)})},[g,_e,Ie,ee,Zt]);let Da=Yt(U=>{let S=U.target.value.replace(Mo,"");b(S)},[]),St=Yt(()=>{b(""),Ct(""),Ot(),ne()},[Ot,ne]),Ha=Yt(()=>{Le(U=>{let S=(U.multiTermOperator??Sn.multiTermOperator??"and")==="and"?"or":"and";return{...U,multiTermOperator:S}}),ne()},[ne]);Ea(()=>{if(!(y==="search"&&o.state==="idle"&&!E))return;let j=document.activeElement;if(!!!(j?.matches('[role="tab"]')||j?.closest('[role="tablist"]')?.getAttribute("role")==="tablist")&&j&&j!==document.body&&j!==f.current)return;let A=window.requestAnimationFrame(()=>{ne()});return()=>{window.cancelAnimationFrame(A)}},[y,o.state,E,ne],!0),Ea(()=>{if(y!=="search")return;let U=[[document,"visibilitychange",()=>{document.visibilityState==="visible"&&ne()}],[window,"pageshow",()=>{ne()}]];for(let[j,S,A]of U)j.addEventListener(S,A);return()=>{for(let[j,S,A]of U)j.removeEventListener(S,A)}},[y,ne],!0),Ue(()=>(a&&a(y==="search"?"mobile-hidden":"visible"),()=>{a&&a("visible")}),[y,a]),Ea(()=>{let U=document.body,j=U.style.overflow;return y==="search"&&(U.style.overflow="hidden"),()=>{U.style.overflow=j}},[y],!0),Ue(()=>{ve&&Qe.info("\u{1F4CA} [STATE] \u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u6307\u6A19\u304C\u66F4\u65B0\u3055\u308C\u307E\u3057\u305F:",{totalSearches:ve.totalSearches,averageSearchTime:ve.averageSearchTime,itemCount:ve.itemCount,resultsCount:ve.resultsCount,workersAvailable:!!ve.workerStats})},[ve]);let{isAwaitingDebounce:ta,isAwaitingSearchTermSync:st,isSearchInProgress:Ae}=at(()=>{let U=rt!==Ie,j=Ie!==ee,S=ee.trim().length>0||rt.trim().length>0;return{isAwaitingDebounce:U,isAwaitingSearchTermSync:j,isSearchInProgress:E||We||S&&be||U||j||kt!==ee}},[rt,Ie,ee,E,We,be,kt]),[Ke,Wa]=He(ee);Ue(()=>{Ke!==ee&&Wa(ee)},[ee,Ke]),Ue(()=>{ta||st||E||We||be||Ke===ee&&kt!==ee&&Ve(ee)},[ee,kt,ta,st,E,We,be,Ke]);let Dt=at(()=>Vn(_e,Hr),[_e]),aa=at(()=>Dt(xt),[Dt,xt]),na=at(()=>({contactMapRecords:u,filteredItems:aa,searchQuery:_e,searchTerm:ee,isSearching:We,isIndexBuilding:be,isPending:E,hasSearchTerm:$e,enableHighlighting:v,openEmailsWithGmail:C,isSearchInProgress:Ae,isSearchTabActive:y==="search",errorMessage:vt??null,isStreamingComplete:m,isStreamingFailed:c}),[u,aa,_e,ee,We,be,E,$e,v,C,Ae,y,vt,m,c]),_a=$e?xt.length:u.length,ra=G(n,u.length),Ht=G(n,xt.length);return se("div",{className:`scrollbar-hidden bg-slate-50 text-slate-900 dark:bg-slate-900 dark:text-slate-100${y==="search"?" h-full min-h-0":""}`,children:ge(fa,{value:y,onValueChange:nt,className:`flex flex-col${y==="search"?" h-full min-h-0":""}`,children:[ge(Bt,{ref:w,style:Wo,className:"scrollbar-none mt-0 mb-1 flex w-full touch-pan-x flex-nowrap overflow-x-auto overflow-y-hidden rounded-md bg-slate-50 transition-colors dark:bg-slate-900/70 dark:text-slate-200",onPointerDown:P,onPointerMove:H,onPointerUp:B,onPointerLeave:ae,onPointerCancel:ue,onClickCapture:ie,children:[ge(ut,{value:"search",className:"min-w-16 px-2 py-0.5 text-xs transition-colors sm:min-w-24 sm:px-2.5 sm:py-0.5 sm:text-xs dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100",children:["\u{1F50D} ",r.searchTab]}),ge(ut,{value:"settings",className:"min-w-16 px-2 py-0.5 text-xs transition-colors sm:min-w-24 sm:px-2.5 sm:py-0.5 sm:text-xs dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100",children:["\u2699\uFE0F ",r.searchSettings]}),ge(ut,{value:"statistics",className:"min-w-16 px-2 py-0.5 text-xs transition-colors sm:min-w-24 sm:px-2.5 sm:py-0.5 sm:text-xs dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100",children:["\u{1F4CA} ",r.searchStatistics]})]}),se(mt,{value:"search",className:"mt-0 flex h-full min-h-0 flex-col overflow-hidden",children:ge("div",{className:"flex h-full flex-col",children:[se("div",{className:"rounded-md border border-gray-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/80 dark:shadow-none",children:ge("div",{className:"flex flex-col",children:[se("div",{className:"relative",children:ge("div",{className:"flex items-center gap-1 p-1",children:[ge("button",{type:"button",onClick:Ha,"aria-pressed":ce,title:yt,className:`inline-flex min-w-9 items-center justify-center gap-0.5 rounded border px-1.5 py-0.5 font-semibold text-[10px] transition-colors sm:min-w-12 sm:px-2 sm:py-0.5 sm:text-xs ${ce?"border-blue-500 bg-blue-600 text-white hover:bg-blue-700 dark:border-blue-400 dark:bg-blue-500 dark:hover:bg-blue-600":"border-amber-400 bg-amber-100 text-amber-800 hover:bg-amber-200 dark:border-amber-500/70 dark:bg-amber-300/20 dark:text-amber-200 dark:hover:bg-amber-300/30"}`,children:[se("span",{className:"text-[10px] sm:text-xs",children:ce?r.operatorAnd:r.operatorOr}),se("span",{className:"hidden text-[10px] sm:inline",children:ce?r.operatorAndHint:r.operatorOrHint})]}),se("input",{ref:f,type:"text",value:k,onChange:Da,placeholder:r.searchPlaceholder,className:"flex-1 rounded border border-gray-300 border-solid px-2 py-0.5 text-xs shadow-sm transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 sm:px-2 sm:py-0.5 sm:text-xs dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100 dark:shadow-none"}),k&&se("button",{type:"button",onClick:St,className:"flex items-center justify-center gap-1 rounded border border-gray-300 px-1.5 py-0.5 text-[10px] transition-colors hover:text-gray-700 sm:px-2 sm:py-0.5 sm:text-xs dark:border-slate-600 dark:bg-slate-800/70 dark:text-slate-300 dark:hover:text-slate-100",title:Ae?r.searchBusyTitle:r.clearSearch,disabled:Ae,children:Ae?ge(Wr,{children:[se(wo,{"aria-hidden":"true",className:"h-3 w-3 animate-spin sm:h-3.5 sm:w-3.5"}),se("span",{className:"hidden sm:inline",children:r.searching})]}):"\u2715"})]})}),ge("p",{className:"px-1.5 py-0.5 text-[10px] text-slate-700 leading-snug transition-colors sm:text-[11px] dark:text-slate-200",children:[r.registeredCountLabel," ",se("span",{className:"font-semibold text-[11px] text-slate-900 sm:text-xs dark:text-white",children:ra})," ",r.recordUnit(ra),be?ge("span",{className:"ml-1.5 inline-flex items-center rounded bg-blue-50 px-1.5 py-0.2 text-[10px] text-blue-700 sm:text-[11px] dark:bg-blue-900/40 dark:text-blue-200",children:["\u23F3 ",r.rebuildingIndex]}):null,vt?ge("span",{className:"ml-1.5 inline-flex items-center rounded bg-rose-50 px-1.5 py-0.2 text-[10px] text-rose-700 sm:text-[11px] dark:bg-rose-900/40 dark:text-rose-200",children:["\u26A0\uFE0F ",r.errorLabel,se("span",{className:"ml-1 break-all font-semibold",children:vt})]}):null,$e&&ge("span",{className:"ml-1.5 text-[10px] text-blue-600 sm:text-[11px] dark:text-sky-400",children:["| ",r.resultCountLabel,Ae?se("span",{className:"ml-1 font-semibold text-[10px] sm:text-[11px]",children:r.searching}):ge(Wr,{children:[se("span",{className:"ml-1 font-semibold text-[11px] text-slate-900 sm:text-xs dark:text-white",children:Ht}),se("span",{className:"ml-0.5 text-[10px] sm:text-[11px]",children:r.resultUnit(Ht)})]})]})]}),se("div",{className:"h-2.5 px-2 pb-1.5",children:be?se(rr,{className:"h-1 bg-blue-200 dark:bg-blue-800",indicatorClassName:"bg-blue-500 dark:bg-blue-400"}):null})]})}),s?s(na):se(Mr,{context:na})]})}),se(mt,{value:"settings",className:"mt-0",children:se(vn,{searchOptions:bt,setSearchOptions:Le,enableHighlighting:v,setEnableHighlighting:T,openEmailsWithGmail:C,setOpenEmailsWithGmail:z,activeTab:x,onTabChange:O})}),se(mt,{value:"statistics",className:"mt-0",children:se(kn,{performanceMetrics:ve,searchTerm:ee,totalDataCount:u.length,resultsCount:_a,resetStats:Oa,rebuildIndex:ea,isIndexBuilding:be,activeTab:D,onTabChange:Z})})]})})};import{jsx as Et,jsxs as Fr}from"react/jsx-runtime";var _o=({renderHeader:e,title:t,streamEndpoint:a,workerUrls:s,onFooterVisibilityChange:i})=>{let n=q(),r=t===void 0?n.appTitle:t,d=Ca(a),l=d.records,u=Nn(()=>l.reduce((o,{company_name:p})=>(typeof p=="string"&&p.trim().length>0&&o.add(p),o),new Set).size,[l]),m=Et(ln,{recordCount:l.length,companyCount:u,phase:d.phase,loadedCount:d.loadedCount,totalCount:d.totalCount,errorMessage:d.error?.message??null,onRetry:d.retryNow}),c=Nn(()=>({contactMapRecords:l,isStreamingComplete:d.isComplete,isStreamingFailed:d.phase==="failed",streamPhase:d.phase,loadedCount:d.loadedCount,companyCount:u,totalCount:d.totalCount,errorMessage:d.error?.message??null}),[l,d.isComplete,d.phase,d.loadedCount,u,d.totalCount,d.error]);return Fr("div",{"data-testid":"contact-map-app-view",className:"flex h-full w-full flex-col",children:[e?e({title:r,annotation:m}):Fr("div",{"data-testid":"contact-map-default-header",className:"mb-2 flex items-center justify-between",children:[Et("h1",{className:"font-bold text-xl",children:r}),m]}),Et("div",{className:"min-h-0 flex-1",children:Et(Ar,{streamState:c,workerUrls:s,onFooterVisibilityChange:i})})]})},jp=e=>{let t=Je(),a=Nn(()=>({...t,streamEndpoint:e.streamEndpoint??t.streamEndpoint,workerUrls:{...t.workerUrls,...e.workerUrls},locale:e.locale===void 0?t.locale:e.locale,labels:e.labels===void 0?t.labels:e.labels}),[t,e.streamEndpoint,e.workerUrls,e.locale,e.labels]);return Et(Zn,{config:a,children:Et(_o,{...e})})};lt();oe();function Qp(){return!1}export{Ka as AdvancedSearchSettings,ja as BasicSearchSettings,Nt as CONTACT_MAP_LABEL_CATALOGS,Wt as CONTACT_MAP_LABEL_KEYS,Kn as ContactDetailGrid,Ye as ContactDetailPanel,ca as ContactDetailPopup,pa as ContactDetailRowLayout,ln as ContactMapAnnotation,jp as ContactMapAppView,Zn as ContactMapConfigProvider,yr as ContactMapSearchListView,Ar as ContactMapSearchPage,Mr as ContactMapSearchTabGroup,Rr as ContactMapSearchTreeView,xa as ContactMapStreamClient,pe as HighlightedText,bn as IndexWorkerSettings,$d as LIST_COLLAPSE_THRESHOLD,Pi as LIST_DETAIL_PANEL_MIN_WIDTH,Vd as LIST_EXPAND_THRESHOLD,wi as LIST_PANEL_MIN_WIDTH,Li as LIST_RESIZE_HANDLE_THICKNESS,yn as LevenshteinWorkerSettings,rr as Progress,vn as SearchOptionsPanel,R as StatItem,kn as StatisticsPanel,Na as SwipeOverlay,Nc as TREE_COLLAPSE_THRESHOLD,to as TREE_DETAIL_PANEL_MIN_WIDTH,wc as TREE_EXPAND_THRESHOLD,eo as TREE_PANEL_MIN_WIDTH,ao as TREE_RESIZE_HANDLE_THICKNESS,fa as Tabs,mt as TabsContent,Bt as TabsList,ut as TabsTrigger,La as TreeWorkerSession,Mt as WorkerStatsSection,io as composeTreeVirtualScrollOptions,Qp as contactMapShouldRevalidate,Xs as deserializeStreamRecord,ec as finalizeTreeWorker,tr as getContactMapRecordMap,er as getContactMapStreamClient,un as getTreeWorkerSession,ud as resetContactMapStreamClientForTesting,tc as resetTreeWorkerSessionForTesting,za as resolveContactMapLabels,Zd as syncTreeWorkerRecords,xr as useAnimatedNumber,Je as useContactMapConfig,q as useContactMapLabels,Ca as useContactMapStream,cn as useContactPanelSizing,sr as useDynamicViewportHeight,Ze as useHorizontalDragScroll,Sa as useLongPressPopup,_i as useReportPopupVisibility,Ta as useResponsiveTwoColumnLayout,Wi as useRowPopupRegistry,kr as useTreeWorker};