@aiquants/contact-map 0.2.0 → 0.3.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 Wr=Object.defineProperty;var ot=(e,t)=>()=>(e&&(t=e(e=0)),t);var _r=(e,t)=>{for(var a in t)Wr(e,a,{get:t[a],enumerable:!0})};import{DIRECTORY_TREE_LABEL_CATALOGS as Rn,DIRECTORY_TREE_LABEL_KEYS as za,resolveDirectoryTreeLabels as Ir}from"@aiquants/directory-tree";import{resolveVirtualScrollLocale as Ar,VIRTUAL_SCROLL_LABEL_KEYS as Fr}from"@aiquants/virtualscroll";var zr,j,lt,da,Mn,Wt,Tt,Fa,Br,Ur,Ba,Ua,$a,dt=ot(()=>{"use strict";zr=Object.freeze({en:"en-US",ja:"ja-JP"}),j=(e,t)=>t.toLocaleString(zr[e]),lt=(e,t,a)=>e==="1"?t:a,da=Object.freeze({en:Object.freeze({appTitle:"Contact Map",annotationTotalLabel:"Total:",annotationCompaniesLabel:"Companies:",annotationStreamingProgress:({loaded:e,total:t,percent:a})=>`Streaming (${j("en",e)} / ${j("en",t)} \xB7 ${a}%)`,annotationStreamingCount:e=>`Streaming (${j("en",e)} loaded)`,annotationLoadFailed:e=>`Failed to load (${j("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=>j("en",e),uncategorizedCompany:"Uncategorized",treeDirectoryName:(e,t)=>`${e} (${j("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=j("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: ${j("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 (${j("ja",e)} / ${j("ja",t)} \u4EF6\u30FB${a}%)`,annotationStreamingCount:e=>`\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u8AAD\u307F\u8FBC\u307F\u4E2D (${j("ja",e)} \u4EF6)`,annotationLoadFailed:e=>`\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F (${j("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=>`${j("ja",e)} \u500B`,uncategorizedCompany:"\u672A\u5206\u985E",treeDirectoryName:(e,t)=>`${e} (${j("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})=>`${j("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: ${j("ja",t)} \u4EF6`,timesUnit:()=>" \u56DE",itemsUnit:()=>" \u4EF6",charactersUnit:()=>" \u6587\u5B57",throughputUnit:" ops/\u79D2"})}),Mn=Object.freeze(Object.keys(da.en)),Wt=Object.freeze([...za,...Mn]),Tt=Object.freeze({en:Object.freeze({...Rn.en,...da.en}),ja:Object.freeze({...Rn.ja,...da.ja})}),Fa=e=>typeof e=="string"?JSON.stringify(e):e===null?"null":typeof e,Br=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},Ur=(e,t,a)=>{e[t]=a},Ba=(e,t)=>{let a=Ar(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 c of Object.keys(t))if(!Wt.includes(c))throw new RangeError(`[contact-map] labels.${c} is not a known label key; expected one of ${Wt.join(", ")}`);let l=Ir(a,Br(t)),n=da[a],r={...l,...n};for(let c of Mn){let o=Object.hasOwn(t,c)?t[c]:void 0;if(o!==void 0){if(typeof n[c]=="function"){if(typeof o!="function")throw new RangeError(`[contact-map] labels.${c} must be a function; got ${Fa(o)}`)}else if(typeof o!="string"||o.trim()==="")throw new RangeError(`[contact-map] labels.${c} must be a non-blank string; got ${Fa(o)}`);Ur(r,c,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 Fr)t[a]=e[a];return Object.freeze(t)}});import{DIRECTORY_TREE_LABEL_KEYS as $r}from"@aiquants/directory-tree";import{resolveVirtualScrollLocale as Vr,VIRTUAL_SCROLL_LABEL_KEYS as Kr}from"@aiquants/virtualscroll";import{createContext as Gr,useContext as On,useMemo as En,useRef as jr}from"react";import{jsx as Qr}from"react/jsx-runtime";var qr,Ka,Va,Dn,fe,q,oe=ot(()=>{"use strict";dt();qr=Object.freeze({locale:"en",labels:Tt.en,treeLabels:Ua(Tt.en),engineLabels:$a(Tt.en)}),Ka=Gr(qr),Va=(e,t)=>{let a=jr(null),s=a.current;return s!==null&&t.every(l=>s[l]===e[l])?s:(a.current=e,e)},Dn=({locale:e,labels:t,children:a})=>{let s=Vr(e),l=En(()=>Ba(s,t),[s,t]),n=Va(l,Wt),r=Va(Ua(n),$r),c=Va($a(n),Kr),o=En(()=>({locale:s,labels:n,treeLabels:r,engineLabels:c}),[s,n,r,c]);return Qr(Ka.Provider,{value:o,children:a})},fe=()=>On(Ka),q=()=>On(Ka).labels});var ca,pa,Wn,ua,ma,_t,Be,_n,Pe,G,pt=ot(()=>{"use strict";ca=e=>{if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null},pa=e=>!e||typeof e!="object"?null:"item"in e?e.item??null:"person_id"in e?e:null,Wn=(e,t)=>{if(!e)return{value:null,fieldKey:null};for(let a of t){let s=ca(e[a]);if(s)return{value:s,fieldKey:a}}return{value:null,fieldKey:null}},ua=e=>Wn(e,["custom_email","email"]),ma=e=>Wn(e,["custom_mobile_phone_number","mobile_phone_number","company_phone_number"]),_t=e=>{let t=ca(e);if(!t)return null;let a=t.replace(/[^0-9+#*]/g,"");return a.length===0?null:`tel:${a}`},Be=(e,t)=>{let a=ca(e);return a?t?`https://mail.google.com/mail/?view=cm&fs=1&to=${encodeURIComponent(a)}`:`mailto:${encodeURIComponent(a)}`:null},_n=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()},G=e=>e==null?"-":typeof e=="string"?ca(e)??"-":typeof e=="number"?Number.isFinite(e)?String(e):"-":e instanceof Date?Pe(e):String(e)});import Jr from"lucide-react/dist/esm/icons/check.js";import Zr from"lucide-react/dist/esm/icons/copy.js";import es from"lucide-react/dist/esm/icons/x.js";import{useCallback as Qe,useEffect as Ya,useMemo as It,useRef as Xa,useState as Fn}from"react";import{createPortal as ts}from"react-dom";import{jsx as Q,jsxs as Le}from"react/jsx-runtime";var as,In,Ft,wt,ns,rs,At,qa,An,Qa,ga,Ja=ot(()=>{"use strict";pt();oe();as=350,In=["dblclick","pointerdown","pointerup","mousedown","mouseup","touchstart","touchend","contextmenu"],Ft=0,wt=null,ns=()=>{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")},rs=()=>{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:c,entry:o}=t(n,l);return r&&!a.has(c)&&(a.add(c),s.push(o(r))),s},[])},An=(e,t)=>e===t,Qa=({value:e,ariaLabel:t,size:a="md"})=>{let[s,l]=Fn(!1),n=Xa(null),r=Qe(async d=>{if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(d),!0}catch{}if(typeof document>"u")return!1;let i=document.createElement("textarea");i.value=d,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},[]),c=Qe(async d=>{d.preventDefault(),d.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?Jr:Zr;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:c,"aria-label":t,title:t,children:Q(m,{className:u,"aria-hidden":"true"})})},ga=({contactData:e,openEmailsWithGmail:t,openGmailCompose:a,onRequestClose:s})=>{let l=q(),[n,r]=Fn(null);Ya(()=>{r(document.body)},[]);let c=Xa(null),o=Xa(null),u=It(()=>e.contacted_at?_n(e.contacted_at):null,[e.contacted_at]),m=e.full_name||"-",d=At(e.company_name),i=At(e.department),p=At(e.title),h=It(()=>qa([{fieldKey:"company_name",label:l.fieldCompanyName,value:d},{fieldKey:"department",label:l.fieldDepartment,value:i},{fieldKey:"title",label:l.fieldTitle,value:p}],(f,{fieldKey:x,label:O})=>({normalized:f,key:`${x}-${f.toLowerCase()}`,entry:D=>({fieldKey:x,label:O,value:D})})),[d,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}],(f,{fieldKey:x,label:O})=>{let D=_t(f);return{normalized:At(f),key:(D??f).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}],(f,{fieldKey:x,label:O})=>{let D=At(f),ee=Be(f,t),N=!!ee?.startsWith("https://mail.google.com");return{normalized:D,key:f.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=Qe(f=>{s(f),o.current=null},[s]),b=Qe(f=>{f.stopPropagation(),An(f.target,f.currentTarget)&&k()},[k]),g=Qe(f=>{f.stopPropagation(),An(f.target,f.currentTarget)&&(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),k())},[k]),E=Qe(f=>{f.stopPropagation(),k()},[k]),V=Qe((f,x)=>{x.isGmailLink&&(f.preventDefault(),a(x.value))},[a]),y=Qe((f,x)=>{if(!x.isGmailLink){o.current=null;return}let O=Date.now(),D=o.current;if(D&&D.email===x.value&&O-D.timestamp<=as){o.current=null,f.preventDefault(),a(x.value);return}o.current={email:x.value,timestamp:O}},[a]);return Ya(()=>{let f=[];if(typeof window<"u"){let x=O=>{if(O.key==="Escape"){k();return}if(O.key==="Tab"&&c.current){let D=c.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),f.push(()=>window.removeEventListener("keydown",x))}if(typeof document<"u"){let x=c.current;if(x){let N=w=>{w.stopPropagation()};for(let w of In)x.addEventListener(w,N);f.push(()=>{for(let w of In)x.removeEventListener(w,N)})}let O=N=>{let w=c.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);f.push(()=>{for(let N of ee)document.removeEventListener(N,D,!0)}),ns(),f.push(rs)}return()=>{for(let x of f)x()}},[k,n]),n?ts(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:c,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}),h.length>0?Q("div",{className:"mt-2 space-y-2 text-slate-700 text-sm dark:text-slate-200",children:h.map(f=>Le("div",{className:"flex items-center gap-3",children:[Q("p",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:f.value}),Q(Qa,{value:f.value,ariaLabel:l.copyField(f.label),size:"sm"})]},f.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(es,{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(f=>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:f.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:f.href?Q("a",{href:f.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:f.value}):Q("span",{className:"wrap-break-word text-slate-800 dark:text-slate-100",children:f.value})}),Q(Qa,{value:f.value,ariaLabel:l.copyField(f.label),size:"sm"})]})]})},`${f.fieldKey}-${f.value}`))})}):null,S.length>0?Q("div",{children:Q("ul",{className:"space-y-3 text-sm",children:S.map(f=>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:f.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:[f.href?Q("a",{href:f.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:f.isGmailLink?"_blank":void 0,rel:f.isGmailLink?"noopener noreferrer":void 0,onDoubleClick:x=>V(x,f),onTouchEnd:x=>y(x,f),children:f.value}):Q("span",{className:"wrap-break-word text-slate-800 dark:text-slate-100",children:f.value}),f.isGmailLink?Q("span",{className:"mt-1 block text-[11px] text-slate-500 dark:text-slate-400",children:l.popupGmailHint}):null]}),Q(Qa,{value:f.value,ariaLabel:l.copyField(f.label),size:"sm"})]})]})},`${f.fieldKey}-${f.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 ha,Za=ot(()=>{"use strict";ha=({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 ss}from"@aiquants/select-box";import{memo as is}from"react";import{Fragment as fa,jsx as Bt}from"react/jsx-runtime";var os,ue,ba=ot(()=>{"use strict";os=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),ue=is(({text:e,query:t,enabled:a=!0})=>{if(!(a&&t?.trim()&&e))return Bt(fa,{children:e});let l=t.trim().split(/\s+/).filter(Boolean);if(l.length===0)return Bt(fa,{children:e});let n=new Set;for(let p of l){let h=ss(p,{convertWidth:!0,convertKana:!0,convertCase:!0,convertRomaji:!0});for(let v of h)v.trim()&&n.add(os(v.trim()))}if(n.size===0)return Bt(fa,{children:e});let c=`(${Array.from(n).sort((p,h)=>h.length-p.length).join("|")})`,o=new RegExp(c,"gi"),u=[],m=0,d=o.exec(e),i=0;for(;d;){let p=d[0],h=d.index;if(h>m&&u.push(e.substring(m,h)),p.length===0){o.lastIndex++,d=o.exec(e);continue}u.push(Bt("mark",{className:"rounded bg-yellow-200 px-1 text-gray-900",children:p},`highlight-${h}-${i}`)),m=h+p.length,i+=1,d=o.exec(e)}return m<e.length&&u.push(e.substring(m)),Bt(fa,{children:u})});ue.displayName="HighlightedText"});var Bn={};_r(Bn,{ContactDetailGrid:()=>zn,default:()=>ls});import{useMemo as en}from"react";import{Fragment as ds,jsx as an,jsxs as cs}from"react/jsx-runtime";var tn,zn,ls,Un=ot(()=>{"use strict";pt();oe();Ja();Za();ba();tn=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},zn=({contactData:e,searchTerm:t,enableHighlighting:a,openEmailsWithGmail:s,openGmailCompose:l,isPopupVisible:n,onRequestClose:r})=>{let c=q(),o=en(()=>ua(e),[e]),u=en(()=>ma(e),[e]),m=o.value??"-",d=u.value??"-",i=en(()=>Pe(e.updated_at),[e.updated_at]),p=tn(e.full_name)??c.noName,h=tn(e.company_name),v=tn(e.department),S=(C,F="-")=>an(ue,{text:C??F,query:t,enabled:a});return cs(ds,{children:[an(ha,{fullName:S(p),title:S(e.title),companyName:S(h),department:S(v),phoneNumber:d,email:S(m),updatedAtText:i}),n?an(ga,{contactData:e,openEmailsWithGmail:s,openGmailCompose:l,onRequestClose:r}):null]})},ls=zn});oe();import{DEFAULT_FUZZY_SEARCH_OPTIONS as Nt}from"@aiquants/fuzzy-search";import{memo as Yr,useId as Hn}from"react";import{jsx as Oe,jsxs as ze}from"react/jsx-runtime";var Ga=Yr(({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=Hn(),r=Hn(),c=[];return c.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")),c.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:c})]})});Ga.displayName="AdvancedSearchSettings";oe();import{DEFAULT_FUZZY_SEARCH_OPTIONS as ct}from"@aiquants/fuzzy-search";import{memo as Xr,useId as De}from"react";import{jsx as X,jsxs as Z}from"react/jsx-runtime";var ja=Xr(({searchOptions:e,setSearchOptions:t,enableHighlighting:a,setEnableHighlighting:s,openEmailsWithGmail:l,setOpenEmailsWithGmail:n})=>{let r=q(),c="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(),d=De(),i=De(),p=De(),h=De(),v=De(),S=De(),C=De(),F=De(),k=[];return k.push(Z("div",{className:`${c} 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:`${c} 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:d,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[X("input",{id:d,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:`${c} 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:h,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:r.basicSortBy}),Z("select",{id:h,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:`${c} 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})]})});ja.displayName="BasicSearchSettings";pt();import ms from"lucide-react/dist/esm/icons/badge-check.js";import gs from"lucide-react/dist/esm/icons/building-2.js";import hs from"lucide-react/dist/esm/icons/calendar-clock.js";import fs from"lucide-react/dist/esm/icons/check.js";import bs from"lucide-react/dist/esm/icons/copy.js";import ys from"lucide-react/dist/esm/icons/id-card.js";import xs from"lucide-react/dist/esm/icons/mail.js";import vs from"lucide-react/dist/esm/icons/phone.js";import Cs from"lucide-react/dist/esm/icons/user-round.js";import{useCallback as ks,useEffect as Ss,useMemo as va,useRef as Ts,useState as Ns}from"react";var Ye={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 ps}from"clsx";import{twMerge as us}from"tailwind-merge";function ut(...e){return us(ps(e))}import{jsx as nn}from"react/jsx-runtime";var xa=Re.Root,Ut=ya.forwardRef(({className:e,...t},a)=>nn(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}));Ut.displayName=Re.List.displayName;var mt=ya.forwardRef(({className:e,...t},a)=>nn(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)=>nn(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 $n={height:"var(--contact-panel-height, 100%)",maxHeight:"100%"},ws=({icon:e,label:t,value:a,fieldKey:s,copyValue:l,onCopy:n,isCopied:r,linkHref:c,searchTerm:o,enableHighlighting:u})=>{let m=q(),d=!!(n&&s&&l),i=c?.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:c?P("a",{href:c,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})})]})]}),d?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(fs,{size:14}):P(bs,{size:14})}):null]})},Vn=({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))}),rn=({title:e})=>P("h3",{className:"font-semibold text-slate-700 text-xs dark:text-slate-200",children:e}),Ps=()=>{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})]})},Xe=({contact:e,searchTerm:t,enableHighlighting:a,style:s,className:l=""})=>{let n=q(),[r,c]=Ns(null),o=Ts(null),u=va(()=>({...$n,...s}),[s]);Ss(()=>()=>{o.current!==null&&window.clearTimeout(o.current)},[]);let m=va(()=>ua(e),[e]),d=va(()=>ma(e),[e]),i=va(()=>Pe(e?.contacted_at??null),[e?.contacted_at]),p=ks(async(y,f,x)=>{try{await navigator.clipboard.writeText(f),c(y),o.current!==null&&window.clearTimeout(o.current),o.current=window.setTimeout(()=>{c(null)},2e3)}catch(O){Ye.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:$n,children:P(Ps,{})});let h=[G(e.title),G(e.department)].filter(y=>y!=="-"),v=[h.join(" / "),G(e.company_name)].filter(y=>y&&y!=="-").join(" \u30FB ")||"-",S=G(e.full_name),C=[{fieldKey:"full_name",label:n.fieldFullName,value:S==="-"?n.noName:S},{fieldKey:"full_name_reading",label:n.fieldFullNameReading,value:G(e.full_name_reading)},{fieldKey:"title",label:n.fieldTitle,value:G(e.title)},{fieldKey:"department",label:n.fieldDepartment,value:G(e.department)},{fieldKey:"company_name",label:n.fieldCompanyName,value:G(e.company_name)},{fieldKey:"company_name_reading",label:n.fieldCompanyNameReading,value:G(e.company_name_reading)},{fieldKey:"address",label:n.fieldAddress,value:G(e.address)},{fieldKey:"postal_code",label:n.fieldPostalCode,value:G(e.postal_code)},{fieldKey:"url",label:n.fieldUrl,value:G(e.url)}],F=[{label:n.fieldCustomEmail,value:G(e.custom_email),fieldKey:"custom_email",rawValue:e.custom_email},{label:n.fieldEmail,value:G(e.email),fieldKey:"email",rawValue:e.email}].filter(y=>y.value!=="-"),k=[{label:n.fieldCustomMobilePhone,value:G(e.custom_mobile_phone_number),fieldKey:"custom_mobile_phone_number",rawValue:e.custom_mobile_phone_number},{label:n.fieldMobilePhone,value:G(e.mobile_phone_number),fieldKey:"mobile_phone_number",rawValue:e.mobile_phone_number},{label:n.fieldCompanyPhone,value:G(e.company_phone_number),fieldKey:"company_phone_number",rawValue:e.company_phone_number},{label:n.fieldCompanyFax,value:G(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:G(e.person_id)},{fieldKey:"person_id_redirect_to",label:"person_id_redirect_to",value:G(e.person_id_redirect_to)},{fieldKey:"is_active",label:"is_active",value:G(e.is_active)},{fieldKey:"is_contact_synced",label:"is_contact_synced",value:G(e.is_contact_synced)},{fieldKey:"is_incomplete",label:"is_incomplete",value:G(e.is_incomplete)},{fieldKey:"is_in_eight",label:"is_in_eight",value:G(e.is_in_eight)},{fieldKey:"created_by",label:n.fieldCreatedBy,value:G(e.created_by)},{fieldKey:"created_at",label:n.fieldCreatedAt,value:Pe(e.created_at)},{fieldKey:"updated_by",label:n.fieldUpdatedBy,value:G(e.updated_by)},{fieldKey:"updated_at",label:n.fieldUpdatedAt,value:Pe(e.updated_at)}],g=[{rowKey:"person_id",icon:ys,label:"person_id",value:G(e.person_id),fieldKey:"person_id",copyValue:String(e.person_id)},{rowKey:"primary_email",icon:xs,label:n.summaryEmail,value:m.value??"-",fieldKey:"primary_email",copyValue:m.value,linkHref:Be(m.value,!1)},{rowKey:"primary_phone",icon:vs,label:n.summaryPhone,value:d.value??"-",fieldKey:"primary_phone",copyValue:d.value,linkHref:_t(d.value)},{rowKey:"contacted_at",icon:hs,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:d.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(gs,{size:16}),P("span",{children:P(ue,{text:G(e.company_name),query:t??"",enabled:a})})]}),h.length>0?P("div",{className:"text-slate-600 text-sm dark:text-slate-300",children:h.map((y,f)=>de("span",{children:[f>0&&" / ",P(ue,{text:y,query:t??"",enabled:a})]},`header-line-${f}`))}):null]}),P("div",{className:"flex flex-col gap-3",children:g.map(y=>P(ws,{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(rn,{title:n.detailBasicProfile}),P(Vn,{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:f,emptyText:x,entries:O,recommendedKey:D,resolveHref:ee})=>de("div",{className:"flex flex-col gap-2",children:[P(rn,{title:f}),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(ms,{size:14}),n.preferred]}):null]},N.fieldKey)})})]},y))})},{value:"meta",label:n.detailTabMeta,content:de("div",{className:"flex flex-col gap-3",children:[P(rn,{title:n.detailTabMeta}),P(Vn,{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(Cs,{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:G(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(Ut,{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 Ls}from"react";import{jsx as Je,jsxs as Ca}from"react/jsx-runtime";var sn=Ls(({recordCount:e,companyCount:t,phase:a,loadedCount:s,totalCount:l,errorMessage:n,onRetry:r})=>{let{locale:c,labels:o}=fe(),u=j(c,e),m=j(c,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:[Je("span",{className:"text-slate-600 dark:text-slate-300",children:o.annotationTotalLabel}),Je("span",{className:"text-slate-800 dark:text-slate-200","data-testid":"contact-map-record-count",children:u}),Je("span",{className:"text-slate-600 dark:text-slate-300",children:o.recordUnit(u)})]}),Ca("span",{className:"flex items-baseline gap-1",children:[Je("span",{className:"text-slate-600 dark:text-slate-300",children:o.annotationCompaniesLabel}),Je("span",{className:"text-slate-800 dark:text-slate-200","data-testid":"contact-map-company-count",children:m}),Je("span",{className:"text-slate-600 dark:text-slate-300",children:o.companyUnit(m)})]}),a==="streaming"||a==="retrying"||a==="idle"?Je("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?Je("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]})});sn.displayName="ContactMapAnnotation";import{useMemo as Tn}from"react";oe();import{createContext as Rs,useContext as Ms,useMemo as Es}from"react";import{jsx as Kn}from"react/jsx-runtime";var Gn={streamEndpoint:"/api/contact_map/stream"},jn=Rs(Gn);function qn({config:e,children:t}){let a=Es(()=>({...Gn,...e}),[e]);return Kn(jn.Provider,{value:a,children:Kn(Dn,{locale:a.locale,labels:a.labels,children:t})})}function Ze(){return Ms(jn)}import{useEffect as As,useMemo as Fs,useSyncExternalStore as zs}from"react";var Os=1e3,Ds=3e4,Hs=6,Ws="/api/contact_map/stream",_s=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}),Is=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??Ws,this.initialRetryDelayMs=t.initialRetryDelayMs??Os,this.maxRetryDelayMs=t.maxRetryDelayMs??Ds,this.maxConsecutiveFailures=t.maxConsecutiveFailures??Hs,this.logger=t.logger??Ye}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:c,value:o}=await a.read();if(c)break;let u=s.decode(o,{stream:!0}),m=(l+u).split(`
2
- `);l=m.pop()??"";let d=!1;for(let i of m){let p=i.trim();if(!p)continue;let h;try{h=JSON.parse(p)}catch(v){this.logger.warn("[ContactMapStream] failed to parse NDJSON line:",v);continue}if("type"in h&&h.type==="METADATA"){typeof h.total=="number"&&Number.isFinite(h.total)&&this.setState({totalCount:h.total});continue}if(!Is(h)){this.logger.warn("[ContactMapStream] server reported error:","error"in h?h.error:""),r=!0;continue}for(let v of h.records)v&&typeof v.person_id=="number"&&(this.recordMap.set(v.person_id,_s(v)),d=!0);typeof h.total=="number"&&Number.isFinite(h.total)&&this.setState({totalCount:h.total}),h.nextCursor&&(this.lastCursor=h.nextCursor),h.isLast&&(n=!0)}d&&(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,Qn=e=>(Sa??(Sa=new ka({endpoint:e})),Sa),Jl=()=>{Sa?.dispose(),Sa=null},Yn=()=>Qn().getRecordMap(),Bs={records:[],loadedCount:0,totalCount:null,isLoading:!0,isComplete:!1,phase:"idle",error:null};function Ta(e){let t=Ze(),a=e??t.streamEndpoint??"/api/contact_map/stream",s=Fs(()=>Qn(a),[a]);return As(()=>{s.start(),s.retry()},[s]),{...zs(n=>s.subscribe(n),()=>s.getState(),()=>Bs),retryNow:()=>s.retryNow()}}oe();import{DEFAULT_FUZZY_SEARCH_OPTIONS as kn}from"@aiquants/fuzzy-search";import{useFuzzySearch as mo}from"@aiquants/fuzzy-search/react";import go from"lucide-react/dist/esm/icons/search.js";import{useCallback as Xt,useEffect as $e,useMemo as bt,useRef as Er,useState as Ve,useTransition as ho}from"react";import{useNavigation as fo,useSearchParams as bo}from"react-router";import{normalizeText as Us}from"@aiquants/select-box";var $s=/[\u200B\uFEFF]/g,Vs=/^[\s\u3000\u00A0]+|[\s\u3000\u00A0]+$/g,on=e=>{let t=e.replace($s,"").replace(Vs,"");return Us(t,{convertWidth:!0,convertKana:!0,convertCase:!0,convertRomaji:!0})};import{useCallback as ht,useEffect as Ks,useRef as Xn}from"react";var et=e=>{let t=Xn(null),a=Xn({isPointerDown:!1,isDragging:!1,startX:0,scrollLeft:0,pointerId:0,hasCapture:!1,didDrag:!1,pointerType:""}),s=e?.dragThreshold??4,l=ht(d=>{let i=d.currentTarget,p=d.deltaY;!i||p===0||(d.preventDefault(),i.scrollBy({left:p,behavior:"smooth"}))},[]),n=ht(d=>{t.current?.removeEventListener("wheel",l),t.current=d,d?.addEventListener("wheel",l,{passive:!1})},[l]);Ks(()=>()=>{t.current&&t.current.removeEventListener("wheel",l)},[l]);let r=ht(d=>{if(d.pointerType==="touch")return;let i=a.current;i.isPointerDown=!0,i.isDragging=!1,i.startX=d.clientX,i.scrollLeft=d.currentTarget.scrollLeft,i.pointerId=d.pointerId,i.hasCapture=!1,i.pointerType=d.pointerType},[]),c=ht(d=>{let i=a.current;if(!i.isPointerDown||i.pointerType==="touch")return;let p=d.currentTarget,h=d.clientX-i.startX;!i.isDragging&&Math.abs(h)>s&&(i.isDragging=!0,i.hasCapture||(p.setPointerCapture?.(d.pointerId),i.hasCapture=!0)),i.isDragging&&(d.preventDefault(),p.scrollLeft=i.scrollLeft-h)},[s]),o=ht(d=>{let i=a.current;if(i.pointerType==="touch")return;let p=d.currentTarget;i.isPointerDown&&i.hasCapture&&p.hasPointerCapture?.(d.pointerId)&&p.releasePointerCapture(d.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(d=>{o(d)},[o]),m=ht(d=>{a.current.didDrag&&(d.preventDefault(),d.stopPropagation(),a.current.didDrag=!1)},[]);return{setScrollableRef:n,onPointerDown:r,onPointerMove:c,onPointerUp:u,onPointerLeave:u,onPointerCancel:u,onClickCapture:m}};dt();oe();import{jsx as Jn}from"react/jsx-runtime";function Zn({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 Jn("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:Jn("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 Zi,useState as eo}from"react";import{useSearchParams as to}from"react-router";oe();pt();import{Panel as ir,PanelGroup as si,PanelResizeHandle as ii}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as oi,VirtualScroll as li}from"@aiquants/virtualscroll";import{lazy as di,memo as ci,Suspense as pi,useCallback as Ue,useEffect as dr,useLayoutEffect as cr,useMemo as Gt,useRef as jt,useState as Ra}from"react";var $t={listPanelMinWidth:320,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35},Vt={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 Gs,useEffect as js,useState as qs}from"react";var er=(e,t)=>{let{enableMutationObserver:a=!1,bottomGap:s=4,minFallbackHeight:l=240}=t??{},[n,r]=qs(600),c=Gs(()=>{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(),d=o.parentElement?.getBoundingClientRect(),i=window.getComputedStyle(document.documentElement),p=u(i.getPropertyValue("--footer-height")),h=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=d?Math.min(d.bottom,k):k,g=d?Math.max(d.top,h):h,E=Math.max(m,g),V=b-E-C-F,y=Number.isFinite(V)?Math.floor(V):0,f=y>0?y:l;f>0&&Number.isFinite(f)&&r(x=>Math.abs(x-f)>1?f:x)},[s,e,l]);return js(()=>{if(typeof window>"u")return;let o=null,u=null,m=null,d=null,i=()=>{o!==null&&window.cancelAnimationFrame(o),o=window.requestAnimationFrame(()=>{c()})};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"&&(d=new MutationObserver(()=>{i()}),d.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(),d&&d.disconnect(),window.removeEventListener("resize",i)}},[e,a,c]),{viewportHeight:n,updateViewportHeight:c}};import{useCallback as tt,useEffect as tr,useRef as Kt,useState as ar}from"react";var Qs=600,nr=8,wa=({ref:e,onSelect:t,resolveItem:a,item:s})=>{let[l,n]=ar(!1),[r,c]=ar(null),o=Kt(null),u=Kt(!1),m=Kt(!1),d=Kt(null),i=Kt({onSelect:t,resolveItem:a,item:s});tr(()=>{i.current={onSelect:t,resolveItem:a,item:s}},[t,a,s]);let p=tt(()=>{typeof window>"u"||o.current!==null&&(window.clearTimeout(o.current),o.current=null)},[]),h=tt(()=>{d.current&&(p(),m.current=!1,d.current=null)},[p]),v=tt(g=>{typeof window>"u"||g.button!==0&&g.pointerType==="mouse"||(p(),m.current=!1,u.current=!1,d.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),c(V),n(!0)),h()},Qs))},[p,h]),S=tt(g=>{d.current&&g.pointerId===d.current.pointerId&&(p(),d.current=null,m.current=!1)},[p]),C=tt(g=>{u.current&&(g.preventDefault(),g.stopPropagation(),u.current=!1)},[]),F=tt(g=>{if(!d.current||g.pointerId!==d.current.pointerId)return;let E=Math.abs(g.clientX-d.current.x),V=Math.abs(g.clientY-d.current.y);(E>nr||V>nr)&&(p(),d.current=null)},[p]),k=tt(g=>{(l||o.current!==null)&&(g.preventDefault(),g.stopPropagation())},[l]),b=tt(g=>{g?.cancelLongPressTimer&&p(),g?.suppressLongPress&&(m.current=!0),n(!1),c(null),u.current=!1,d.current=null},[p]);return tr(()=>{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,f,x]of E)g.addEventListener(y,f,x);for(let[y,f,x]of V)window.addEventListener(y,f,x);return()=>{for(let[y,f,x]of E)g.removeEventListener(y,f,x);for(let[y,f,x]of V)window.removeEventListener(y,f,x);p()}},[e,v,S,F,C,k,p]),{isPopupVisible:l,popupItem:r,handleClosePopup:b}};import{useCallback as Ys,useEffect as Xs,useState as rr,useSyncExternalStore as Js}from"react";function Pa(e,t,a){let s=a?.mediaQuery??"(min-width: 1024px)",l=Js(Ys(m=>{if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};let d=window.matchMedia(s);return d.addEventListener("change",m),()=>d.removeEventListener("change",m)},[s]),()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(s).matches:!0,()=>!1),[n,r]=rr(!1),[c,o]=rr(0);return Xs(()=>{if(typeof window>"u"||typeof ResizeObserver>"u")return;let m=e.current;if(!m)return;let d=new ResizeObserver(i=>{for(let p of i){if(p.target!==m)continue;let h=0;p.borderBoxSize&&p.borderBoxSize.length>0?h=p.borderBoxSize[0].inlineSize:h=p.contentRect.width,!(!Number.isFinite(h)||h<=0)&&(o(h),r(v=>v&&h>=t.expandThreshold?!1:!v&&h<t.collapseThreshold?!0:v))}});return d.observe(m),()=>d.disconnect()},[e,t.collapseThreshold,t.expandThreshold]),{isTwoColumn:l&&!n,isContainerNarrow:n,isMediaMatches:l,containerWidth:c}}oe();oe();import{useSwipeToDismissOverlay as Zs,useTapClick as ei}from"@aiquants/swipe-overlay";import{useCallback as ti,useEffect as ai,useRef as ni}from"react";import{jsx as sr,jsxs as ri}from"react/jsx-runtime";var La=({isOpen:e,onClose:t,children:a,className:s="",title:l})=>{let n=q(),r=ni(null),{overlayRef:c,overlayStyle:o,attemptClose:u}=Zs({isOpen:e,onClose:t,isCloseBlocked:ti(()=>!1,[]),skipWhenTextSelected:!0}),m=ei(()=>u());return ai(()=>{!e&&r.current?.contains(document.activeElement)&&document.activeElement.blur()},[e]),e?ri("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:[sr("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}),sr("aside",{role:"dialog","aria-modal":"true","aria-label":l===void 0?n.overlayTitle:l,style:o,ref:c,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:d=>{d.key==="Escape"&&(d.stopPropagation(),u())},children:a})]}):null};Za();import{Fragment as Ni,jsx as W,jsxs as ve}from"react/jsx-runtime";var ui=di(async()=>({default:(await Promise.resolve().then(()=>(Un(),Bn))).default})),pr=64,or="h-[64px]",lr=240,mi=4,ln=Na($t),gi=$t.listPanelMinWidth,hi=$t.detailPanelMinWidth,fi=$t.handleThickness,Ed=ln.collapseThreshold,Od=ln.expandThreshold,bi=({contactData:e})=>{let t=q(),a=e?.full_name??t.noName,s=e?.title??"-",l=e?.company_name??"-",n=e?.department??"-",r=e?.email??"-",c=e?.company_phone_number??e?.mobile_phone_number??"-",o=e?.updated_at?Pe(e.updated_at):"-";return W(ha,{fullName:a,title:s,companyName:l,department:n,phoneNumber:c,email:r,updatedAtText:o})},yi=e=>({"--contact-panel-height":`${e}px`}),xi=e=>typeof e=="object"&&e!==null&&"item"in e,vi=(e,t)=>t!==void 0?`${e}:${t.toFixed(3)}`:void 0,Ci=(e,t)=>{for(let a of e){let s=pa(a);if(s?.person_id===t)return s}return null},dn=(e,t,a)=>{let{viewportHeight:s}=er(t,{enableMutationObserver:!0,bottomGap:mi,minFallbackHeight:lr}),[l,n]=Ra(0),r=Ue(()=>{let d=a.current,i=t.current;if(!(d&&i))return;let p=d.getBoundingClientRect(),h=i.getBoundingClientRect(),v=Math.ceil(h.top-p.top);Number.isFinite(v)&&v>0&&n(S=>Math.abs(S-v)>1?v:S)},[t,a]);cr(()=>{if(!e)return;r();let d=requestAnimationFrame(r);return window.addEventListener("resize",r),()=>{cancelAnimationFrame(d),window.removeEventListener("resize",r)}},[e,r]);let c=s>0?s:lr,o=l>0?l:0,u=c+o,m=Gt(()=>yi(u),[u]);return{normalizedViewportHeight:c,normalizedDetailHeight:u,panelSizingStyle:m}},ki=new Set,Si=()=>{let[e,t]=Ra(ki),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}},Ti=(e,t,a)=>{let s=jt(a);cr(()=>{s.current=a},[a]),dr(()=>{if(e!==null)return s.current(e,t),()=>{s.current(e,!1)}},[e,t])},ur=ci(({entry:e,index:t,selectedPersonId:a,onSelect:s,searchTerm:l,enableHighlighting:n,openEmailsWithGmail:r,openGmailCompose:c,onPopupVisibilityChange:o})=>{let u=q(),m=jt(null),d=W("div",{className:or}),i=xi(e)?e:null,p=pa(e),{isPopupVisible:h,handleClosePopup:v}=wa({ref:m,onSelect:s,item:p?.person_id});if(Ti(p?.person_id??null,h,o),!e||!p)return d;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=>vi(E,E==="B"?i?.baseScore:i?.score)).filter(Boolean);return ve("div",{ref:m,className:`flex ${or} 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:pr},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(pi,{fallback:W(bi,{contactData:p}),children:W(ui,{contactData:p,searchTerm:l,enableHighlighting:n,openEmailsWithGmail:r,openGmailCompose:c,isPopupVisible:h,onRequestClose:v})})]})});ur.displayName="ContactListRow";var mr=({context:e})=>{let{contactMapRecords:t,filteredItems:a,searchTerm:s,hasSearchTerm:l,enableHighlighting:n,openEmailsWithGmail:r,isSearchTabActive:c}=e,{locale:o,labels:u,engineLabels:m}=fe(),d=jt(null),i=jt(null),[p,h]=Ra(null),{normalizedViewportHeight:v,panelSizingStyle:S}=dn(c,i,d),{isAnyPopupVisible:C,handlePopupVisibilityChange:F}=Si(),k=Gt(()=>({enablePointerDrag:!C,enableKeyboardNavigation:!C}),[C]),b=Gt(()=>l?a:t,[l,a,t]),g=Ue(ie=>{h(ie)},[]),E=Ue(ie=>{if(!r)return;let ne=ie.trim();if(!ne||ne==="-"||typeof window>"u")return;let nt=Be(ne,!0);nt&&window.open(nt,"_blank","noopener,noreferrer")},[r]),[V,y]=Ra(!1),f=Ue(ie=>{g(ie),y(!0)},[g]),x=Ue((ie,ne)=>W(ur,{entry:ie,index:ne,selectedPersonId:p,onSelect:f,searchTerm:s,enableHighlighting:n,openEmailsWithGmail:r,openGmailCompose:E,onPopupVisibilityChange:F}),[p,f,s,n,r,E,F]),O=Ue(ie=>b[ie],[b]),D=Ue(ie=>pa(b[ie])?.person_id??`row-${ie}`,[b]),ee=Ue(()=>pr,[]),N=b.length,w=Gt(()=>({enabled:!0,renderVisual:oi}),[]),H=Gt(()=>p===null?null:Ci(b,p),[p,b]);dr(()=>{p!==null&&!H&&h(null)},[p,H]);let B=jt(null),{isTwoColumn:ae}=Pa(B,ln),me=ve("div",{ref:d,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(li,{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(si,{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(ir,{id:"contact-map-list-pane",defaultSize:{value:68,unit:"percentage"},minSize:{value:gi,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:me}),W(ii,{id:"contact-map-list-handle",thickness:fi,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(ir,{id:"contact-map-list-detail-pane",defaultSize:{value:32,unit:"percentage"},minSize:{value:hi,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:W(Xe,{contact:H,searchTerm:s,enableHighlighting:n})})]}):ve(Ni,{children:[me,W("div",{className:"hidden","aria-hidden":"true",children:W(Xe,{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(Xe,{contact:H,searchTerm:s,enableHighlighting:n})})]})}):null]})})};pt();import{DirectoryTree as Wi}from"@aiquants/directory-tree";import{Panel as yr,PanelGroup as _i,PanelResizeHandle as Ii}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as Ai}from"@aiquants/virtualscroll";import Fi from"@heroicons/react/24/solid/FolderMinusIcon.js";import zi from"@heroicons/react/24/solid/FolderPlusIcon.js";import{useCallback as He,useEffect as ft,useMemo as Me,useRef as Oa,useState as at}from"react";import{createPortal as Bi}from"react-dom";var cn=(e,t)=>e&&e.trim()||t;import{useEffect as wi,useRef as Ma,useState as Pi}from"react";var gr=(e,t=250)=>{let[a,s]=Pi(e),l=Ma(null),n=Ma(e),r=Ma(null),c=Ma(!1);return wi(()=>{if(!c.current){c.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,d=Math.min(1,Math.max(0,m/t)),i=1-(1-d)**3,p=Math.max(0,Math.round(n.current+(e-n.current)*i));s(p),d<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 Li,useMemo as hr,useSyncExternalStore as Ri}from"react";oe();var Mi=250,Ei=4e3,fr=3,Oi=(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>=fr)return;let a=Math.min(Mi*2**(this.consecutiveFailures-1),Ei);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>=fr)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||!Oi(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}}},Di=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")},qt=null,pn=(e,t)=>{if(!qt){let a=e??(()=>Di(t));qt=new Ea(a)}return qt},Bd=(e,t)=>{pn().syncRecords(e,t)},Ud=()=>{pn().finalize()},$d=()=>{qt?.dispose(),qt=null},Hi={snapshot:null,isBuilding:!1};function br(e,t=!1){let a=Ze(),s=a.treeWorkerFactory,l=a.workerUrls?.treeWorker,{labels:n}=fe(),r=n.uncategorizedCompany,c=n.noName,o=hr(()=>({uncategorizedCompany:r,unnamedPerson:c}),[r,c]),u=hr(()=>s?new Ea(s):pn(void 0,l),[s,l]);return Li(()=>{u.syncRecords(e,o),t&&u.finalize()},[u,e,t,o]),Ri(u.subscribe,u.getState,()=>Hi)}oe();Ja();ba();import{Fragment as Ji,jsx as _,jsxs as ge}from"react/jsx-runtime";var gn=Na(Vt),Ui=Vt.listPanelMinWidth,$i=Vt.detailPanelMinWidth,Vi=Vt.handleThickness,mc=gn.collapseThreshold,gc=gn.expandThreshold,Ki=(e,t)=>{let{searchTerm:a,enableHighlighting:s}=t,l=cn(e.full_name,t.noName),n=cn(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},Gi="contact-map-tree h-full w-full",ji={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"},un="h-4 w-4 shrink-0 transition-colors duration-150",qi=(e,t,a)=>({...e,viewportHeightOverride:t,behaviorOptions:{...e.behaviorOptions,enablePointerDrag:!a,enableKeyboardNavigation:!a}}),Da=null,xr=null,Qt=new Map,vr="",Cr=null,Qi=(e,t,a,s,l)=>{let n=`${a?"icons":"plain"}#${s}#${l.noName}`;(n!==vr||l.formatDirectoryName!==Cr)&&(Qt.clear(),vr=n,Cr=l.formatDirectoryName);let r={entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},c=new Set;for(let o of e){c.add(o.absolutePath);let u=`${o.name}\0${o.memberCount}`,m=Qt.get(o.absolutePath);(!m||m.signature!==u)&&(m={signature:u,result:Sr([o],t,a,{searchTerm:"",enableHighlighting:!1,noName:l.noName,formatDirectoryName:l.formatDirectoryName})},Qt.set(o.absolutePath,m));let d=m.result;d.entries.length>0&&r.entries.push(d.entries[0]);for(let[i,p]of d.personPathMap){let h=r.personPathMap.get(i);if(h)for(let v of p)h.add(v);else r.personPathMap.set(i,new Set(p))}for(let[i,p]of d.contactByPath)r.contactByPath.set(i,p);for(let[i,p]of d.ancestorsByPath)r.ancestorsByPath.set(i,p);r.totalCount+=d.totalCount,!r.firstPerson&&d.firstPerson&&(r.firstPerson=d.firstPerson)}for(let o of Qt.keys())c.has(o)||Qt.delete(o);return r},mn=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",kr=e=>{let t=[];for(let a of e)a.type==="directory"&&(t.push(a.absolutePath),a.children&&t.push(...kr(a.children)));return t},Yi=e=>{if(e.memberCount===void 0)throw new Error(`[contact-map] directory entry ${e.absolutePath} has no memberCount`);return e.memberCount},Sr=(e,t,a,s,l)=>{let n=new Map,r=new Map,c=new Map,o=0,u=null,m=(i,p)=>{let h=[...p,i.absolutePath];c.set(i.absolutePath,h);let v,S,C=i.type==="directory"?s.formatDirectoryName(i.name,Yi(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=mn(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:`${un} ${E}`})},i.title&&(F=Ki(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,h)).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:`${un} ${mn(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:c,firstPerson:u,totalCount:o}},Xi=(e,t,a)=>{let s=new Set,l=new Set,n=new Map;t.forEach((m,d)=>{n.set(m.item.person_id,d)});for(let m of t){let d=m.item.person_id,i=e.personPathMap.get(d);if(i)for(let p of i){s.add(p);let h=e.ancestorsByPath.get(p);if(h){for(let v of h)s.add(v);a&&h.length>0&&l.add(h[0])}}}let r=new Map,c=m=>{let d=r.get(m.absolutePath);if(d!==void 0)return d;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,c(p));return r.set(m.absolutePath,i),i},o=(m,d=0)=>m.filter(i=>a&&d===0&&l.has(i.absolutePath)?!0:s.has(i.absolutePath)).map(i=>a&&d===0&&l.has(i.absolutePath)?i:i.type==="directory"&&i.children?{...i,children:o(i.children,d+1)}:i).sort((i,p)=>d===0?c(i)-c(p):0),u=o(e.entries);return{...e,entries:u}},Tr=({context:e,controlsContainer:t})=>{let{contactMapRecords:a,filteredItems:s,hasSearchTerm:l,isSearchInProgress:n,isSearchTabActive:r}=e,{locale:c,labels:o,treeLabels:u}=fe(),m=o.noName,d=o.treeDirectoryName,i=Me(()=>({noName:m,formatDirectoryName:d}),[m,d]),[p,h]=at(null),[v,S]=at(!1),{snapshot:C,isBuilding:F}=br(a),k=C?.tree??null,b=Yn(),g=C?.rebuildEpoch??0,E=Me(()=>k?Qi(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=Sr(k,b,p,{...i,searchTerm:e.searchTerm,enableHighlighting:e.enableHighlighting},R);return Xi(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]),f=l&&e.errorMessage!==null,[x,O]=at(y),D=Oa(!1);ft(()=>{if(!(n||f)){D.current=!!k,O(y);return}!D.current&&k&&y.entries.length>0&&(D.current=!0,O(y))},[y,k,n,f]);let ee=l&&(n||f)?x:y,{entries:N,personPathMap:w,contactByPath:H,totalCount:B}=ee,ae=Me(()=>kr(N),[N]),[me,ie]=at(()=>xr??new Set),ne=He(R=>!me.has(R),[me]),nt=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(()=>{xr=me},[me]),ft(()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem("contact-map.tree-expanded")}catch{}},[]);let[Ee,Jt]=at(null),[pe,vt]=at(null),[Zt,J]=at(!1),[ea,Ie]=at(!1),Ae=Oa(null),ye=Oa(null),{normalizedViewportHeight:Et,panelSizingStyle:Wa}=dn(r,ye,Ae),ke=He(R=>{let U=H.get(R);U&&(Ee!==U.person_id&&Jt(U.person_id),R!==pe&&vt(R),J(!0))},[H,pe,Ee]),ta=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:rt,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=rt?H.get(rt):null,Ht=Ke&&xe!==null&&xe!==void 0;ft(()=>{Ke&&!xe&&Ot()},[Ke,xe,Ot]);let aa=Me(()=>({overscanCount:16,callbackThrottleMs:16,scrollBarOptions:{width:8,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:{enabled:!0,renderVisual:Ai}},behaviorOptions:{resetOnGetItemHeightChange:!1},preserveScrollAnchor:!0}),[]),_a=Me(()=>qi(aa,Et,Ht),[aa,Et,Ht]);ft(()=>{let R=!1;return typeof window>"u"?()=>{R=!0}:Da?(h(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 it=Y.default,Aa=we.default,Pn=St.default,Ln=qe.default;it&&Aa&&Pn&&Ln&&(Da={company:it,department:Aa,title:Pn,person:Ln},h(Da))}catch(Y){Ye.warn("Failed to load lucide icons",Y)}})(),()=>{R=!0})},[]);let st=Me(()=>{if(!p)return;let R=qe=>it=>_(qe,{"aria-hidden":"true",className:`${un} ${mn(it)}`}),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[it]=qe.entry.relativePath.split(":",1);return(we(it)?U[it]:U.company)(qe)};return{directory:St,directoryExpanded:St,file:Y}},[p]),na=He(()=>{ie(R=>R.size===0?R:new Set)},[]),Ge=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&&Jt(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&&Jt(null),pe!==null&&vt(null)},[B,Ee,pe,w]);let Fe=pe?H.get(pe)??null:null,ra=ea?"#475569":"#94A3B8",kt=e.isStreamingComplete,sa=e.isStreamingFailed,ia=kt&&a.length===0,oa=(F||!k)&&!ia,la=gr(B,250),Nn=k!==null||ia,wn=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," ",Nn?o.treeNodeCount(la):"\u2026"]}),sa&&!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?oa?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:na,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:_(zi,{className:"h-3 w-3"})}),_("button",{type:"button",onClick:Ge,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:_(Fi,{className:"h-3 w-3"})})]}):null]}),Ia=Oa(null),{isTwoColumn:z}=Pa(Ia,gn,{mediaQuery:"(min-width: 768px)"}),K=Me(()=>({toggle:nt,isExpanded:ne,expandMultiple:xt,collapseMultiple:yt,isPending:n}),[yt,xt,ne,nt,n]),le=Me(()=>({onEntryClick:ta,selectedPath:pe}),[ta,pe]),Se=Me(()=>({className:Gi,lineColor:ra,iconOverrides:st,showDirectoryIcons:!!st,showFileIcons:!!st,highlightStyles:ji,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"}),[ra,st]),je=_("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?_(Wi,{entries:N,expansion:K,selection:le,visual:Se,virtualScroll:_a,locale:c,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&&Bi(wn,t),z?ge(_i,{id:"contact-map-tree-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-tree-panel-group",children:[_(yr,{id:"contact-map-tree-pane",defaultSize:{value:60,unit:"percentage"},minSize:{value:Ui,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:je}),_(Ii,{id:"contact-map-tree-handle",thickness:Vi,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}),_(yr,{id:"contact-map-tree-detail-pane",defaultSize:{value:40,unit:"percentage"},minSize:{value:$i,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:_(Xe,{contact:Fe??null,searchTerm:e.searchTerm,enableHighlighting:e.enableHighlighting})})]}):ge(Ji,{children:[je,_("div",{className:"hidden","aria-hidden":"true",children:_(Xe,{contact:Fe,searchTerm:e.searchTerm,enableHighlighting:e.enableHighlighting})}),Zt&&Fe?_(La,{isOpen:Zt,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:_(Xe,{contact:Fe,searchTerm:e.searchTerm,enableHighlighting:e.enableHighlighting})})]})}):null]}),Ht&&xe&&_(ga,{contactData:xe,openEmailsWithGmail:e.openEmailsWithGmail,openGmailCompose:Dt,onRequestClose:Ot})]})};import{jsx as Yt,jsxs as Pt}from"react/jsx-runtime";var hn="view",ao={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},no=e=>e==="tree"?"tree":"list",Nr=({context:e})=>{let t=q(),[a,s]=to(),[l,n]=eo(null),r=no(a.get(hn)),{setScrollableRef:c,onPointerDown:o,onPointerMove:u,onPointerUp:m,onPointerLeave:d,onPointerCancel:i,onClickCapture:p}=et(),h=Zi(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(hn):C.set(hn,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:c,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:ao,onPointerDown:o,onPointerMove:u,onPointerUp:m,onPointerLeave:d,onPointerCancel:i,onClickCapture:p,children:[Pt("button",{type:"button","data-testid":"contact-map-tab-list",onClick:()=>h("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:()=>h("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]})]}),Yt("div",{ref:n,className:"flex items-center gap-1.5"})]}),Pt("div",{className:"flex h-full flex-1 flex-col",children:[Yt("div",{className:`${r==="list"?"flex h-full flex-1 flex-col":"hidden"}`,children:r==="list"?Yt(mr,{context:e}):null}),Yt("div",{className:`${r==="tree"?"flex h-full flex-1 flex-col":"hidden"}`,children:r==="tree"?Yt(Tr,{context:e,controlsContainer:l}):null})]})]})};import{DEFAULT_FUZZY_SEARCH_OPTIONS as yn}from"@aiquants/fuzzy-search";import{memo as io}from"react";oe();oe();import{DEFAULT_FUZZY_SEARCH_OPTIONS as A}from"@aiquants/fuzzy-search";import{memo as ro,useId as Ce}from"react";import{jsx as M,jsxs as I}from"react/jsx-runtime";var fn=ro(({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(),c=Ce(),o=Ce(),u=Ce(),m=Ce(),d=Ce(),i=Ce(),p=Ce(),h=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:c,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexMinNgramOverlap}),M("input",{id:c,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:d,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexMinCandidatesRatio}),M("input",{id:d,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:h,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.maxResults}),M("input",{id:h,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})]})});fn.displayName="IndexWorkerSettings";oe();import{DEFAULT_FUZZY_SEARCH_OPTIONS as ce}from"@aiquants/fuzzy-search";import{memo as so,useId as Lt}from"react";import{jsx as te,jsxs as re}from"react/jsx-runtime";var bn=so(({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(),c=Lt(),o=Lt(),u=Lt(),m=Lt(),d=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(h=>({...h,levenshteinWorkerOptions:{...h.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:c,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.levenshteinLengthSimilarity}),te("input",{id:c,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.lengthSimilarityThreshold??ce.levenshteinWorkerOptions?.lengthSimilarityThreshold,onChange:p=>t(h=>({...h,levenshteinWorkerOptions:{...h.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(h=>({...h,levenshteinWorkerOptions:{...h.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(h=>({...h,levenshteinWorkerOptions:{...h.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(h=>({...h,levenshteinWorkerOptions:{...h.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:d,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.levenshteinPartialBonus}),te("input",{id:d,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.partialMatchBonus??ce.levenshteinWorkerOptions?.partialMatchBonus,onChange:p=>t(h=>({...h,levenshteinWorkerOptions:{...h.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})]})});bn.displayName="LevenshteinWorkerSettings";import{jsx as _e,jsxs as We}from"react/jsx-runtime";var oo={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},xn=io(({searchOptions:e,setSearchOptions:t,enableHighlighting:a,setEnableHighlighting:s,openEmailsWithGmail:l,setOpenEmailsWithGmail:n,activeTab:r,onTabChange:c})=>{let o=q(),{setScrollableRef:u,onPointerDown:m,onPointerMove:d,onPointerUp:i,onPointerLeave:p,onPointerCancel:h,onClickCapture:v}=et();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=>({...yn,autoSearchOnIndexRebuild:!1,debounceMs:0,workerUrls:S.workerUrls,indexWorkerOptions:{...yn.indexWorkerOptions},levenshteinWorkerOptions:{...yn.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:oo,onPointerDown:m,onPointerMove:d,onPointerUp:i,onPointerLeave:p,onPointerCancel:h,onClickCapture:v,children:[We("button",{type:"button",role:"tab","aria-selected":r==="basic",onClick:()=>c("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:()=>c("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:()=>c("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:()=>c("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(ja,{searchOptions:e,setSearchOptions:t,enableHighlighting:a,setEnableHighlighting:s,openEmailsWithGmail:l,setOpenEmailsWithGmail:n})}),_e("div",{className:`${r==="advanced"?"block":"hidden"}`,children:_e(Ga,{searchOptions:e,setSearchOptions:t})}),_e("div",{className:`${r==="index"?"block":"hidden"}`,children:_e(fn,{searchOptions:e,setSearchOptions:t})}),_e("div",{className:`${r==="levenshtein"?"block":"hidden"}`,children:_e(bn,{searchOptions:e,setSearchOptions:t})})]})]})});xn.displayName="SearchOptionsPanel";import{memo as po}from"react";dt();oe();import{memo as lo}from"react";import{jsxs as vn}from"react/jsx-runtime";var L=lo(({label:e,value:t,unit:a,color:s="text-gray-600 dark:text-slate-300"})=>vn("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:[vn("span",{className:"wrap-break-word overflow-hidden text-left",children:[e,":"]}),vn("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 co}from"react";import{jsx as T,jsxs as $}from"react/jsx-runtime";var Rt=co(({kind:e,icon:t,stats:a,color:s})=>{let{locale:l,labels:n}=fe(),r=w=>j(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 c=a.basic||{},o=a.workerSpecific||{},u=a.analysis||{},m=c.totalSearches??0,d=c.totalProcessingTime??0,i=c.averageSearchTime??0,p=c.lastSearchTime??0,h=c.errorCount??0,v=c.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,f=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:d.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:h,color:h>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(f.totalIndexBuilds??0),color:"text-green-700 dark:text-green-300"}),T(L,{label:n.statDataSize,value:r(f.currentDataSize??0),unit:n.itemsUnit(r(f.currentDataSize??0)),color:"text-green-700 dark:text-green-300"}),T(L,{label:n.statLastBuildTime,value:(f.lastIndexTime??0).toFixed(2),unit:"ms",color:"text-green-700 dark:text-green-300"})]},"index-core")),f.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(f.cacheSize.ngram??0),color:"text-emerald-700 dark:text-emerald-300"}),T(L,{label:n.statCacheWord,value:r(f.cacheSize.word??0),color:"text-emerald-700 dark:text-emerald-300"}),T(L,{label:n.statCachePhonetic,value:r(f.cacheSize.phonetic??0),color:"text-emerald-700 dark:text-emerald-300"})]},"index-cache")),f.indexMetadata)){let w=Object.entries(f.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 uo={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},Cn=po(({performanceMetrics:e,searchTerm:t,totalDataCount:a,resultsCount:s,resetStats:l,rebuildIndex:n,isIndexBuilding:r,activeTab:c,onTabChange:o})=>{let{locale:u,labels:m}=fe(),d=t.trim(),i=d?s:a,{setScrollableRef:p,onPointerDown:h,onPointerMove:v,onPointerUp:S,onPointerLeave:C,onPointerCancel:F,onClickCapture:k}=et(),b=c!=="index"||r,g=r?m.statsRebuildingTitle:c!=="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:uo,onPointerDown:h,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 ${c==="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 ${c==="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 ${c==="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:`${c==="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:j(u,e.totalSearches)}),Ne(L,{label:m.statAverageSearchTime,value:e.averageSearchTime.toFixed(1),unit:"ms"}),Ne(L,{label:m.statDataCount,value:j(u,e.itemCount)}),Ne(L,{label:d?m.statResultCount:m.statDisplayedCount,value:j(u,i)})]}),Ne("div",{className:`${c==="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:`${c==="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"})]})]})]})});Cn.displayName="StatisticsPanel";import{Fragment as Mr,jsx as se,jsxs as he}from"react/jsx-runtime";var yo=/[\u200B\uFEFF]/g,Sn=typeof window<"u",Or=Sn&&typeof document<"u",Ha=(e,t=[],a=!1)=>{let s=Er(e);s.current=e,$e(()=>{if(!(!Sn||a&&!Or))return s.current()},[a,...t])},wr=(e,t,a)=>{let[s,l]=Ve(()=>{let n=Pr(r=>r.getItem(e));return n&&t.includes(n)?n:a});return Ha(()=>{Pr(n=>{n.setItem(e,s)})},[e,s]),[s,l]},Pr=e=>{if(!Sn)return null;try{return e(window.sessionStorage)}catch{return null}},Lr=(e,t)=>{let[a,s]=Ve(e);return $e(()=>{let l=setTimeout(()=>{s(e)},t);return()=>{clearTimeout(l)}},[e,t]),a},xo="contact-map.settings-tab",vo="contact-map.statistics-tab",Co=["basic","advanced","index","levenshtein"],ko=["overview","index","levenshtein"],Rr=["full_name","company_name","department","title","email","company_phone_number","mobile_phone_number"],So={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},Dr=({streamState:e,workerUrls:t,onFooterVisibilityChange:a,children:s}={})=>{let l=Ze(),{locale:n,labels:r}=fe(),c=Ta(),o=bt(()=>e||{contactMapRecords:c.records,isStreamingComplete:c.isComplete,isStreamingFailed:c.phase==="failed",streamPhase:c.phase,loadedCount:c.loadedCount,companyCount:0,totalCount:c.totalCount,errorMessage:c.error?.message??null},[e,c]),{contactMapRecords:u,isStreamingComplete:m,isStreamingFailed:d}=o,i=fo(),[p]=bo(),h=Er(null),[v,S]=Ve(!0),[C,F]=Ve(l.openEmailsWithGmail??!1),[k,b]=Ve(p.get("q")||""),g=Lr(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]=ho(),[y,f]=Ve("search"),[x,O]=wr(xo,Co,"basic"),[D,ee]=wr(vo,ko,"overview"),{setScrollableRef:N,onPointerDown:w,onPointerMove:H,onPointerUp:B,onPointerLeave:ae,onPointerCancel:me,onClickCapture:ie}=et(),ne=Xt(()=>{if(!Or)return;let z=h.current;!z||document.activeElement===z||window.requestAnimationFrame(()=>{try{z.focus({preventScroll:!0})}catch{}})},[]),nt=Xt(z=>{let K=z;f(K),K==="search"&&ne()},[ne]),yt=bt(()=>{let{indexWorkerOptions:z={},levenshteinWorkerOptions:K={},...le}=kn;return{...le,autoSearchOnIndexRebuild:!1,debounceMs:0,workerUrls:t,indexWorkerOptions:{...z},levenshteinWorkerOptions:{...K}}},[t]),[xt,Ee]=Ve(yt),pe=(xt.multiTermOperator??kn.multiTermOperator)==="and",vt=pe?r.operatorAndTitle:r.operatorOrTitle,Zt=Lr(u,m?0:800),{searchTerm:J,setSearchTerm:ea,filteredItems:Ie,isSearching:Ae,isIndexBuilding:ye,clearSearch:Et,resetStats:Wa,performanceMetrics:ke,rebuildIndex:ta,error:Ct}=mo(Zt,Rr,xt),Ke=J.trim().length>0,[rt,Ot]=Ve(()=>J),Dt=bt(()=>on(k),[k]),xe=bt(()=>on(g),[g]);$e(()=>{xe!==J&&V(()=>{ea(xe)})},[xe,J,ea]);let Ht=Xt(z=>{let le=z.target.value.replace(yo,"");b(le)},[]),aa=Xt(()=>{b(""),Et(),ne()},[Et,ne]),_a=Xt(()=>{Ee(z=>{let le=(z.multiTermOperator??kn.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!==h.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&&Ye.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:st,isAwaitingSearchTermSync:na,isSearchInProgress:Ge}=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||rt!==J}},[Dt,xe,J,E,Ae,ye,rt]),[Fe,ra]=Ve(J);$e(()=>{Fe!==J&&ra(J)},[J,Fe]),$e(()=>{st||na||E||Ae||ye||Fe===J&&rt!==J&&Ot(J)},[J,rt,st,na,E,Ae,ye,Fe]);let kt=bt(()=>{if(!Ie.length)return Ie;let z=J.toLowerCase();if(!z)return Ie;let K=le=>Rr.some(Se=>{let je=le[Se];return typeof je=="string"?je.toLowerCase().includes(z):!1});return[...Ie].sort((le,Se)=>{let je=K(le.item),R=K(Se.item);return je&&!R?-1:!je&&R?1:0})},[Ie,J]),sa=bt(()=>({contactMapRecords:u,filteredItems:kt,searchTerm:J,isSearching:Ae,isIndexBuilding:ye,isPending:E,hasSearchTerm:Ke,enableHighlighting:v,openEmailsWithGmail:C,isSearchInProgress:Ge,isSearchTabActive:y==="search",errorMessage:Ct??null,isStreamingComplete:m,isStreamingFailed:d}),[u,kt,J,Ae,ye,E,Ke,v,C,Ge,y,Ct,m,d]),ia=Ke?Ie.length:u.length,oa=j(n,u.length),la=j(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:nt,className:`flex flex-col${y==="search"?" h-full min-h-0":""}`,children:[he(Ut,{ref:N,style:So,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:h,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:aa,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:Ge?r.searchBusyTitle:r.clearSearch,disabled:Ge,children:Ge?he(Mr,{children:[se(go,{"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:oa})," ",r.recordUnit(oa),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,Ge?se("span",{className:"ml-1 font-semibold text-[10px] sm:text-[11px]",children:r.searching}):he(Mr,{children:[se("span",{className:"ml-1 font-semibold text-[11px] text-slate-900 sm:text-xs dark:text-white",children:la}),se("span",{className:"ml-0.5 text-[10px] sm:text-[11px]",children:r.resultUnit(la)})]})]})]}),se("div",{className:"h-2.5 px-2 pb-1.5",children:ye?se(Zn,{className:"h-1 bg-blue-200 dark:bg-blue-800",indicatorClassName:"bg-blue-500 dark:bg-blue-400"}):null})]})}),s?s(sa):se(Nr,{context:sa})]})}),se(gt,{value:"settings",className:"mt-0",children:se(xn,{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(Cn,{performanceMetrics:ke,searchTerm:J,totalDataCount:u.length,resultsCount:ia,resetStats:Wa,rebuildIndex:ta,isIndexBuilding:ye,activeTab:D,onTabChange:ee})})]})})};import{jsx as Mt,jsxs as Hr}from"react/jsx-runtime";var To=({renderHeader:e,title:t,streamEndpoint:a,workerUrls:s,onFooterVisibilityChange:l})=>{let n=q(),r=t===void 0?n.appTitle:t,c=Ta(a),o=c.records,u=Tn(()=>o.reduce((i,{company_name:p})=>(typeof p=="string"&&p.trim().length>0&&i.add(p),i),new Set).size,[o]),m=Mt(sn,{recordCount:o.length,companyCount:u,phase:c.phase,loadedCount:c.loadedCount,totalCount:c.totalCount,errorMessage:c.error?.message??null,onRetry:c.retryNow}),d=Tn(()=>({contactMapRecords:o,isStreamingComplete:c.isComplete,isStreamingFailed:c.phase==="failed",streamPhase:c.phase,loadedCount:c.loadedCount,companyCount:u,totalCount:c.totalCount,errorMessage:c.error?.message??null}),[o,c.isComplete,c.phase,c.loadedCount,u,c.totalCount,c.error]);return Hr("div",{"data-testid":"contact-map-app-view",className:"flex h-full w-full flex-col",children:[e?e({title:r,annotation:m}):Hr("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(Dr,{streamState:d,workerUrls:s,onFooterVisibilityChange:l})})]})},Hp=e=>{let t=Ze(),a=Tn(()=>({...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(qn,{config:a,children:Mt(To,{...e})})};dt();oe();function Ip(){return!1}export{Ga as AdvancedSearchSettings,ja as BasicSearchSettings,Tt as CONTACT_MAP_LABEL_CATALOGS,Wt as CONTACT_MAP_LABEL_KEYS,zn as ContactDetailGrid,Xe as ContactDetailPanel,ga as ContactDetailPopup,ha as ContactDetailRowLayout,sn as ContactMapAnnotation,Hp as ContactMapAppView,qn as ContactMapConfigProvider,mr as ContactMapSearchListView,Dr as ContactMapSearchPage,Nr as ContactMapSearchTabGroup,Tr as ContactMapSearchTreeView,ka as ContactMapStreamClient,ue as HighlightedText,fn as IndexWorkerSettings,Ed as LIST_COLLAPSE_THRESHOLD,hi as LIST_DETAIL_PANEL_MIN_WIDTH,Od as LIST_EXPAND_THRESHOLD,gi as LIST_PANEL_MIN_WIDTH,fi as LIST_RESIZE_HANDLE_THICKNESS,bn as LevenshteinWorkerSettings,Zn as Progress,xn as SearchOptionsPanel,L as StatItem,Cn as StatisticsPanel,La as SwipeOverlay,mc as TREE_COLLAPSE_THRESHOLD,$i as TREE_DETAIL_PANEL_MIN_WIDTH,gc as TREE_EXPAND_THRESHOLD,Ui as TREE_PANEL_MIN_WIDTH,Vi as TREE_RESIZE_HANDLE_THICKNESS,xa as Tabs,gt as TabsContent,Ut as TabsList,mt as TabsTrigger,Ea as TreeWorkerSession,Rt as WorkerStatsSection,qi as composeTreeVirtualScrollOptions,Ip as contactMapShouldRevalidate,_s as deserializeStreamRecord,Ud as finalizeTreeWorker,Yn as getContactMapRecordMap,Qn as getContactMapStreamClient,pn as getTreeWorkerSession,Jl as resetContactMapStreamClientForTesting,$d as resetTreeWorkerSessionForTesting,Ba as resolveContactMapLabels,Bd as syncTreeWorkerRecords,gr as useAnimatedNumber,Ze as useContactMapConfig,q as useContactMapLabels,Ta as useContactMapStream,dn as useContactPanelSizing,er as useDynamicViewportHeight,et as useHorizontalDragScroll,wa as useLongPressPopup,Ti as useReportPopupVisibility,Pa as useResponsiveTwoColumnLayout,Si as useRowPopupRegistry,br as useTreeWorker};
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};