@aiquants/contact-map 0.4.0 → 0.6.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 zr=Object.defineProperty;var Ge=(e,t)=>()=>(e&&(t=e(e=0)),t);var Br=(e,t)=>{for(var a in t)zr(e,a,{get:t[a],enumerable:!0})};import{DIRECTORY_TREE_LABEL_CATALOGS as En,DIRECTORY_TREE_LABEL_KEYS as Fa,resolveDirectoryTreeLabels as Ur}from"@aiquants/directory-tree";import{resolveVirtualScrollLocale as $r,VIRTUAL_SCROLL_LABEL_KEYS as Vr}from"@aiquants/virtualscroll";var Kr,G,ot,sa,On,Wt,Nt,Aa,jr,Gr,za,Ba,Ua,lt=Ge(()=>{"use strict";Kr=Object.freeze({en:"en-US",ja:"ja-JP"}),G=(e,t)=>t.toLocaleString(Kr[e]),ot=(e,t,a)=>e==="1"?t:a,sa=Object.freeze({en:Object.freeze({appTitle:"Contact Map",annotationTotalLabel:"Total:",annotationCompaniesLabel:"Companies:",annotationStreamingProgress:({loaded:e,total:t,percent:a})=>`Streaming (${G("en",e)} / ${G("en",t)} \xB7 ${a}%)`,annotationStreamingCount:e=>`Streaming (${G("en",e)} loaded)`,annotationLoadFailed:e=>`Failed to load (${G("en",e)} received)`,annotationRetry:"Retry",recordUnit:e=>ot(e,"record","records"),companyUnit:e=>ot(e,"company","companies"),searchTab:"Fuzzy search",searchSettings:"Search settings",searchStatistics:"Search statistics",operatorAndTitle:"AND search (all terms match)",operatorOrTitle:"OR search (any term matches)",operatorAnd:"AND",operatorOr:"OR",operatorAndHint:"All terms",operatorOrHint:"Any term",searchPlaceholder:"Fuzzy search...",searchBusyTitle:"Searching",clearSearch:"Clear search",searching:"Searching...",registeredCountLabel:"Registered:",rebuildingIndex:"Rebuilding index...",errorLabel:"Error:",resultCountLabel:"Results:",resultUnit:e=>ot(e,"match","matches"),listViewTab:"List",treeViewTab:"Tree",columnNo:"No",columnId:"ID",columnScore:"Score",columnName:"Name",columnTitle:"Title",columnCompany:"Company",columnDepartment:"Department",columnPhone:"Phone",columnEmail:"Email",columnUpdatedAt:"Updated",listRowNumber:e=>`No. ${e}`,listNoSearchResults:"No search results found",listNoData:"No data",listResizeHandle:"Resize the border between the contact list and the detail pane",detailHeading:"Contact details",close:"Close",noName:"(No Name)",treeNodeCountTitle:"Number of nodes built in the tree view",treeNodeCountLabel:"Nodes:",treeNodeCount:e=>G("en",e),uncategorizedCompany:"Uncategorized",treeDirectoryName:(e,t)=>`${e} (${G("en",t)})`,treeStreamInterruptedTitle:"Streaming was interrupted. Only the data received so far is shown",treeStreamInterrupted:"Interrupted",treeStreamLoadingTitle:"Receiving data streamed from the network",treeStreamLoading:"Loading...",treeBuildingTitle:"Building and expanding the directory tree from the received data",treeBuilding:"Treeing...",treeCompleteTitle:"Every tree node has been built",treeComplete:"Complete",treeShowEntireCompanyTitle:"Show the whole company of every search hit",treeShowEntireCompany:"Whole company",treeExpandAll:"Expand all directories",treeExpandAllTitle:"Expand all",treeCollapseAll:"Collapse all directories",treeCollapseAllTitle:"Collapse all",treeNoMatches:"No contacts match the criteria",treeEmpty:"No contacts to display",treeResizeHandle:"Resize the border between the directory tree and the detail pane",copyField:e=>`Copy ${e}`,detailEmptyTitle:"Select a contact to see its details",detailEmptyHint:"Choose a person from the list",detailTabSummary:"Summary",detailTabBasic:"Basic info",detailBasicProfile:"Profile",detailTabContact:"Contact",detailTabMeta:"Metadata",preferred:"Preferred",summaryEmail:"Email",summaryPhone:"Phone",summaryLastContact:"Last contact",sectionEmail:"Email",sectionEmailEmpty:"No email addresses registered",sectionPhone:"Phone / Fax",sectionPhoneEmpty:"No phone numbers registered",fieldFullName:"Name",fieldFullNameReading:"Name (reading)",fieldTitle:"Title",fieldDepartment:"Department",fieldCompanyName:"Company",fieldCompanyNameReading:"Company (reading)",fieldAddress:"Address",fieldPostalCode:"Postal code",fieldUrl:"URL",fieldCustomEmail:"Custom email",fieldEmail:"Email",fieldCustomMobilePhone:"Custom mobile",fieldMobilePhone:"Mobile",fieldCompanyPhone:"Company phone",fieldCompanyFax:"Company fax",fieldCreatedBy:"Created by",fieldCreatedAt:"Created at",fieldUpdatedBy:"Updated by",fieldUpdatedAt:"Updated at",popupCustomMobilePhone:"Mobile (custom)",popupMobilePhone:"Mobile",popupCustomCompanyPhone:"Company phone (custom)",popupCompanyPhone:"Company phone",popupCustomEmail:"Email (custom)",popupEmail:"Email",popupGmailHint:"Double-click or double-tap to open Gmail",popupLastContactDate:"Last contact:",popupNoContactMethods:"No contact information to display",overlayTitle:"Details",overlayBackdrop:"Tap the background to close",settingsResetAllTitle:"Reset all settings",settingsResetAll:"Reset all",settingsTabsLabel:"Search option tabs",settingsBasicTab:"Basic settings",settingsAdvancedTab:"Advanced settings",indexWorkerName:"Index Worker",levenshteinWorkerName:"Levenshtein Worker",currentValueLabel:"Current:",resetToDefaultsTitle:"Reset to defaults",reset:"Reset",relevanceOnlyNotice:"Editable only when sorting by relevance",relevanceWeightsHeading:"Relevance score weights",fieldWeight:"Field weight",scoreTuningHeading:"Score tuning",maxResults:"Maximum results",basicThresholdHeading:"Final similarity threshold",basicThresholdLabel:"Adjust the minimum score",basicThresholdRangeRelevance:"In relevance mode a score can exceed 1.0 (range: 0.0-1.5)",basicThresholdRange:"Range: 0.0-1.0",basicDisplayHeading:"Display options",basicCaseSensitive:"Case-sensitive",basicHighlight:"Highlight matches",basicOpenEmailsWithGmail:"Open email addresses in Gmail compose",basicMultiTermOperator:"Multi-term query operator",basicOperatorOr:"OR (any term matches)",basicOperatorAnd:"AND (all terms match)",basicMultiTermHint:"How space-separated terms are combined (default: OR)",basicSortHeading:"Sorting",basicSortBy:"Sort by",basicSortByScore:"Score",basicSortByRelevance:"Relevance",basicSortByOriginal:"Original order",basicSortOrder:"Sort order",basicSortDescending:"Descending",basicSortAscending:"Ascending",basicEngineHeading:"Search engine",basicStrategy:"Parallel search strategy",basicStrategyBalanced:"Balanced",basicStrategyIndexFirst:"Index first",basicStrategyLevenshteinFirst:"Levenshtein first",basicIndexFiltering:"Index filtering",basicLevenshtein:"Levenshtein distance",advancedLearningHeading:"Learning weight",advancedLearningLabel:"Weight factor",advancedLearningHint:"Weight applied when re-learning (higher favors past search results)",advancedDebounceHeading:"Debounce time",advancedDebounceLabel:"Input delay (ms)",advancedDebounceHint:"How long input is awaited. Shorter is more real-time, longer reduces load",indexSettingsHeading:"Index Worker settings",indexBuildHeading:"Index build",indexNgramSize:"N-gram size",indexNgramSizeHint:"How many characters each chunk holds. Smaller is faster but less accurate",indexMinNgramOverlap:"Minimum N-gram matches",indexMinNgramOverlapHint:"Candidates with fewer matches are excluded",indexCandidateHeading:"Candidate filtering",indexThreshold:"Index threshold",indexThresholdHint:"Lower bound of the Jaro-Winkler similarity (range: 0.0-1.0)",indexNgramOverlapThreshold:"N-gram overlap threshold",indexNgramOverlapThresholdHint:"How much N-grams must overlap. Higher narrows candidates more strictly",indexStrategyHeading:"Search strategy and candidates",indexStrategy:"Search strategy",indexStrategyFast:"Fast",indexStrategyAccurate:"Accurate",indexStrategyHybrid:"Hybrid (adaptive)",indexStrategyHint:"Balance processing load against accuracy",indexMinCandidatesRatio:"Minimum candidate ratio",indexMinCandidatesRatioHint:"Share of candidates always kept",indexMaxCandidatesRatio:"Maximum candidate ratio",indexMaxCandidatesRatioHint:"Upper bound on candidates; narrowed dynamically when exceeded",indexJaroWinklerPrefix:"Jaro-Winkler prefix weight",indexJaroWinklerPrefixHint:"Bonus given to a matching prefix",indexMaxResultsHint:"Maximum number of results to fetch. Larger is more thorough but slower",indexFieldWeightHint:"How much the number of matched fields counts",indexPerfectMatchBonus:"Exact match bonus",indexPerfectMatchBonusHint:"Bonus added on an exact match",indexContainmentHeading:"Containment score (Japanese / substrings)",indexContainmentBase:"Containment base score (containmentScoreBase)",indexContainmentBaseHint:"Minimum base score when the query is fully contained in the string (rescues short Japanese queries such as 2 characters)",indexContainmentCoverage:"Containment coverage weight (containmentCoverageWeight)",indexContainmentCoverageHint:"Extra score by the query length / field length ratio (total capped at 1.0)",levenshteinSettingsHeading:"Levenshtein Worker settings",levenshteinCandidateHeading:"Candidate filter",levenshteinThreshold:"Levenshtein threshold",levenshteinThresholdHintRelevance:"Keep only results at or above this threshold (range: 0.0-1.5)",levenshteinThresholdHint:"Keep only results at or above this threshold (range: 0.0-1.0)",levenshteinLengthSimilarity:"Length similarity threshold",levenshteinLengthSimilarityHint:"Exclude candidates whose length differs greatly, for speed",levenshteinLengthPenalty:"Length difference penalty",levenshteinLengthPenaltyHint:"How much a length difference is penalized. Larger favors equal lengths",levenshteinResultsHeading:"Result count",levenshteinMaxResultsHint:"Maximum number of results to return. Larger is more thorough but slower",levenshteinFieldWeightHint:"Weight of the number of matched fields",levenshteinPartialBonus:"Partial match bonus",levenshteinPartialBonusHint:"Extra score for a partial match",statsRebuildingTitle:"Rebuilding the index",statsRebuildIndexTabOnlyTitle:"Available on the Index tab only",statsRebuildTitle:"Rebuild the index",statsRebuilding:"Rebuilding...",statsRebuild:"Rebuild Index",statsResetTitle:"Reset statistics",statsOverviewTab:"Overview",statsIndexTab:"Index",statsLevenshteinTab:"Levenshtein",statTotalSearches:"Total searches",statAverageSearchTime:"Average search time",statDataCount:"Data items",statResultCount:"Search results",statDisplayedCount:"Displayed items",statsNoData:"No statistics yet",statsBasicHeading:"Basic statistics",statTotalProcessingTime:"Total processing time",statLastSearchTime:"Last search time",statErrorCount:"Errors",statUpdatedAt:"Statistics updated at",statsOperationsHeading:"Operations",statTotalOperations:"Total operations",statsIndexHeading:"Index statistics",statIndexBuilds:"Index builds",statDataSize:"Data size",statLastBuildTime:"Last build time",statsCacheHeading:"Cache statistics",statCacheNgram:"N-gram",statCacheWord:"Words",statCachePhonetic:"Phonetic",statsIndexMetadataHeading:"Index metadata",statsCalculationsHeading:"Calculations",statTotalCalculations:"Total calculations",statDistanceCalculations:"Distance calculations",statAverageDistance:"Average distance",statMinDistance:"Minimum distance",statMaxDistance:"Maximum distance",notAvailable:"N/A",statsMatchesHeading:"Matches",statPartialMatches:"Partial matches",statPerfectMatches:"Exact matches",statEarlyTerminations:"Early terminations",statsSimilarityHeading:"Similarity distribution",statAbove80:"80% or more",statAbove60:"60% or more",statAbove40:"40% or more",statBelow40:"Below 40%",statsDistanceHeading:"Distance distribution (top 6)",statDistance:e=>`Distance ${e}`,statsQueryLengthHeading:"Query lengths (top 6)",statQueryLength:e=>`Length ${e}`,statQueryLengthValue:({count:e,averagePercent:t})=>{let a=G("en",e);return`${a} ${ot(a,"time","times")} / average ${t}%`},statsFieldPerformanceHeading:"Field performance (top 6)",statAverageScore:"Average score",statMatchCount:"Matches",statBestWorstScore:"Best / worst score",statsInsightsHeading:"Performance insights",statBestField:"Best-performing field",statRecentAverageTime:"Recent average processing time",statRecentAverageResults:"Recent average results",statThroughput:"Throughput",statCommonQueryLength:"Most common query length",statHistoryEntries:"History entries",statHighSimilarity:"High similarity",statMediumSimilarity:"Medium similarity",statLowSimilarity:"Low similarity",statVeryLowSimilarity:"Very low similarity",statsRecentHistoryHeading:"Recent history (latest 3)",statsHistoryEntry:({processingTimeMs:e,resultCount:t})=>`Processing time: ${e} ms / results: ${G("en",t)}`,timesUnit:e=>ot(e," time"," times"),itemsUnit:e=>ot(e," item"," items"),charactersUnit:e=>ot(e," character"," characters"),throughputUnit:" ops/s"}),ja:Object.freeze({appTitle:"Contact Map",annotationTotalLabel:"\u7DCF\u4EF6\u6570:",annotationCompaniesLabel:"\u4F01\u696D\u6570:",annotationStreamingProgress:({loaded:e,total:t,percent:a})=>`\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u8AAD\u307F\u8FBC\u307F\u4E2D (${G("ja",e)} / ${G("ja",t)} \u4EF6\u30FB${a}%)`,annotationStreamingCount:e=>`\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u8AAD\u307F\u8FBC\u307F\u4E2D (${G("ja",e)} \u4EF6)`,annotationLoadFailed:e=>`\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F (${G("ja",e)} \u4EF6\u53D7\u4FE1\u6E08)`,annotationRetry:"\u518D\u8A66\u884C",recordUnit:()=>"\u4EF6",companyUnit:()=>"\u793E",searchTab:"\u3042\u3044\u307E\u3044\u691C\u7D22",searchSettings:"\u691C\u7D22\u8A2D\u5B9A",searchStatistics:"\u691C\u7D22\u7D71\u8A08",operatorAndTitle:"AND \u691C\u7D22 (\u3059\u3079\u3066\u4E00\u81F4)",operatorOrTitle:"OR \u691C\u7D22 (\u3044\u305A\u308C\u304B\u4E00\u81F4)",operatorAnd:"AND",operatorOr:"OR",operatorAndHint:"\u5168\u8A9E\u4E00\u81F4",operatorOrHint:"\u3044\u305A\u308C\u304B\u4E00\u81F4",searchPlaceholder:"\u3042\u3044\u307E\u3044\u691C\u7D22...",searchBusyTitle:"\u691C\u7D22\u51E6\u7406\u4E2D",clearSearch:"\u691C\u7D22\u3092\u30AF\u30EA\u30A2",searching:"\u691C\u7D22\u4E2D...",registeredCountLabel:"\u767B\u9332\u4EF6\u6570:",rebuildingIndex:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u518D\u69CB\u7BC9\u4E2D...",errorLabel:"\u30A8\u30E9\u30FC:",resultCountLabel:"\u691C\u7D22\u7D50\u679C:",resultUnit:()=>"\u4EF6",listViewTab:"\u4E00\u89A7",treeViewTab:"\u30C4\u30EA\u30FC",columnNo:"No",columnId:"ID",columnScore:"\u30B9\u30B3\u30A2",columnName:"\u6C0F\u540D",columnTitle:"\u5F79\u8077",columnCompany:"\u4F1A\u793E\u540D",columnDepartment:"\u90E8\u7F72",columnPhone:"\u96FB\u8A71\u756A\u53F7",columnEmail:"\u30E1\u30FC\u30EB",columnUpdatedAt:"\u66F4\u65B0\u65E5\u6642",listRowNumber:e=>`No. ${e}`,listNoSearchResults:"\u691C\u7D22\u7D50\u679C\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",listNoData:"\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093",listResizeHandle:"\u9023\u7D61\u5148\u4E00\u89A7\u3068\u8A73\u7D30\u30DA\u30A4\u30F3\u306E\u5883\u754C\u306E\u30B5\u30A4\u30BA\u5909\u66F4\u30CF\u30F3\u30C9\u30EB",detailHeading:"\u9023\u7D61\u5148\u8A73\u7D30",close:"\u9589\u3058\u308B",noName:"\u540D\u524D\u672A\u8A2D\u5B9A",treeNodeCountTitle:"\u30C4\u30EA\u30FC\u30D3\u30E5\u30FC\u3067\u69CB\u7BC9\u3055\u308C\u305F\u5168\u30CE\u30FC\u30C9\u6570",treeNodeCountLabel:"\u30CE\u30FC\u30C9:",treeNodeCount:e=>`${G("ja",e)} \u500B`,uncategorizedCompany:"\u672A\u5206\u985E",treeDirectoryName:(e,t)=>`${e} (${G("ja",t)})`,treeStreamInterruptedTitle:"\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u304C\u4E2D\u65AD\u3055\u308C\u307E\u3057\u305F\u3002\u53D7\u4FE1\u6E08\u307F\u30C7\u30FC\u30BF\u306E\u307F\u8868\u793A\u3057\u3066\u3044\u307E\u3059",treeStreamInterrupted:"\u4E2D\u65AD",treeStreamLoadingTitle:"\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u304B\u3089\u306E\u30C7\u30FC\u30BF\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u3092\u53D7\u4FE1\u4E2D",treeStreamLoading:"\u8AAD\u307F\u8FBC\u307F\u4E2D...",treeBuildingTitle:"\u53D7\u53D6\u30C7\u30FC\u30BF\u3092\u57FA\u306B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u30C4\u30EA\u30FC\u69CB\u9020\u3092\u6700\u7D42\u69CB\u7BC9\u30FB\u5C55\u958B\u4E2D",treeBuilding:"\u30C4\u30EA\u30FC\u69CB\u7BC9\u4E2D...",treeCompleteTitle:"\u30C4\u30EA\u30FC\u30CE\u30FC\u30C9\u306E\u5168\u4EF6\u69CB\u7BC9\u304C\u5B8C\u4E86\u3057\u307E\u3057\u305F",treeComplete:"\u5B8C\u4E86",treeShowEntireCompanyTitle:"\u691C\u7D22\u30D2\u30C3\u30C8\u3057\u305F\u4F1A\u793E\u5168\u4F53\u3092\u8868\u793A",treeShowEntireCompany:"\u5168\u4F53\u8868\u793A",treeExpandAll:"\u5168\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u5C55\u958B",treeExpandAllTitle:"\u3059\u3079\u3066\u5C55\u958B",treeCollapseAll:"\u5168\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u6298\u308A\u305F\u305F\u307F",treeCollapseAllTitle:"\u3059\u3079\u3066\u6298\u308A\u305F\u305F\u307F",treeNoMatches:"\u6761\u4EF6\u306B\u4E00\u81F4\u3059\u308B\u9023\u7D61\u5148\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",treeEmpty:"\u8868\u793A\u3059\u308B\u9023\u7D61\u5148\u304C\u3042\u308A\u307E\u305B\u3093",treeResizeHandle:"\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u30C4\u30EA\u30FC\u3068\u8A73\u7D30\u30DA\u30A4\u30F3\u306E\u5883\u754C\u306E\u30B5\u30A4\u30BA\u5909\u66F4\u30CF\u30F3\u30C9\u30EB",copyField:e=>`\u300C${e}\u300D\u3092\u30B3\u30D4\u30FC`,detailEmptyTitle:"\u9023\u7D61\u5148\u3092\u9078\u629E\u3059\u308B\u3068\u8A73\u7D30\u304C\u8868\u793A\u3055\u308C\u307E\u3059",detailEmptyHint:"\u4E00\u89A7\u304B\u3089\u5BFE\u8C61\u306E\u4EBA\u7269\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",detailTabSummary:"\u30B5\u30DE\u30EA\u30FC",detailTabBasic:"\u57FA\u672C\u60C5\u5831",detailBasicProfile:"\u57FA\u672C\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB",detailTabContact:"\u9023\u7D61\u5148",detailTabMeta:"\u30E1\u30BF\u60C5\u5831",preferred:"\u512A\u5148",summaryEmail:"\u30E1\u30FC\u30EB",summaryPhone:"\u96FB\u8A71",summaryLastContact:"\u6700\u7D42\u63A5\u89E6",sectionEmail:"\u30E1\u30FC\u30EB",sectionEmailEmpty:"\u767B\u9332\u3055\u308C\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u306F\u3042\u308A\u307E\u305B\u3093",sectionPhone:"\u96FB\u8A71\u30FBFAX",sectionPhoneEmpty:"\u767B\u9332\u3055\u308C\u305F\u96FB\u8A71\u756A\u53F7\u306F\u3042\u308A\u307E\u305B\u3093",fieldFullName:"\u6C0F\u540D",fieldFullNameReading:"\u6C0F\u540D (\u304B\u306A)",fieldTitle:"\u5F79\u8077",fieldDepartment:"\u90E8\u7F72",fieldCompanyName:"\u4F1A\u793E\u540D",fieldCompanyNameReading:"\u4F1A\u793E\u540D (\u304B\u306A)",fieldAddress:"\u4F4F\u6240",fieldPostalCode:"\u90F5\u4FBF\u756A\u53F7",fieldUrl:"URL",fieldCustomEmail:"\u30AB\u30B9\u30BF\u30E0\u30E1\u30FC\u30EB",fieldEmail:"\u30E1\u30FC\u30EB",fieldCustomMobilePhone:"\u30AB\u30B9\u30BF\u30E0\u643A\u5E2F\u756A\u53F7",fieldMobilePhone:"\u643A\u5E2F\u756A\u53F7",fieldCompanyPhone:"\u4F1A\u793E\u96FB\u8A71\u756A\u53F7",fieldCompanyFax:"\u4F1A\u793E FAX \u756A\u53F7",fieldCreatedBy:"\u4F5C\u6210\u8005",fieldCreatedAt:"\u4F5C\u6210\u65E5\u6642",fieldUpdatedBy:"\u66F4\u65B0\u8005",fieldUpdatedAt:"\u66F4\u65B0\u65E5\u6642",popupCustomMobilePhone:"\u643A\u5E2F\u96FB\u8A71 (\u30AB\u30B9\u30BF\u30E0)",popupMobilePhone:"\u643A\u5E2F\u96FB\u8A71",popupCustomCompanyPhone:"\u4F1A\u793E\u96FB\u8A71 (\u30AB\u30B9\u30BF\u30E0)",popupCompanyPhone:"\u4F1A\u793E\u96FB\u8A71",popupCustomEmail:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9 (\u30AB\u30B9\u30BF\u30E0)",popupEmail:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",popupGmailHint:"\u30C0\u30D6\u30EB\u30AF\u30EA\u30C3\u30AF\u307E\u305F\u306F\u4E8C\u5EA6\u30BF\u30C3\u30D7\u3067 Gmail \u3092\u958B\u304D\u307E\u3059",popupLastContactDate:"\u6700\u7D42\u30B3\u30F3\u30BF\u30AF\u30C8\u65E5:",popupNoContactMethods:"\u8868\u793A\u3067\u304D\u308B\u9023\u7D61\u5148\u60C5\u5831\u304C\u3042\u308A\u307E\u305B\u3093",overlayTitle:"\u8A73\u7D30",overlayBackdrop:"\u80CC\u666F\u3092\u30BF\u30C3\u30D7\u3057\u3066\u9589\u3058\u308B",settingsResetAllTitle:"\u3059\u3079\u3066\u306E\u8A2D\u5B9A\u3092\u30EA\u30BB\u30C3\u30C8",settingsResetAll:"\u3059\u3079\u3066\u30EA\u30BB\u30C3\u30C8",settingsTabsLabel:"\u691C\u7D22\u30AA\u30D7\u30B7\u30E7\u30F3\u8A2D\u5B9A\u30BF\u30D6",settingsBasicTab:"\u57FA\u672C\u8A2D\u5B9A",settingsAdvancedTab:"\u8A73\u7D30\u8A2D\u5B9A",indexWorkerName:"Index Worker",levenshteinWorkerName:"Levenshtein Worker",currentValueLabel:"\u73FE\u5728\u5024:",resetToDefaultsTitle:"\u30C7\u30D5\u30A9\u30EB\u30C8\u5024\u306B\u30EA\u30BB\u30C3\u30C8",reset:"\u30EA\u30BB\u30C3\u30C8",relevanceOnlyNotice:"Relevance \u30BD\u30FC\u30C8\u6642\u306E\u307F\u5909\u66F4\u53EF\u80FD",relevanceWeightsHeading:"Relevance \u30B9\u30B3\u30A2\u91CD\u307F",fieldWeight:"\u30D5\u30A3\u30FC\u30EB\u30C9\u91CD\u307F",scoreTuningHeading:"\u30B9\u30B3\u30A2\u8ABF\u6574",maxResults:"\u6700\u5927\u7D50\u679C\u6570",basicThresholdHeading:"\u6700\u7D42\u985E\u4F3C\u5EA6\u95BE\u5024",basicThresholdLabel:"\u30B9\u30B3\u30A2\u306E\u4E0B\u9650\u3092\u8ABF\u6574",basicThresholdRangeRelevance:"Relevance \u30E2\u30FC\u30C9\u3067\u306F\u30B9\u30B3\u30A2\u304C 1.0 \u3092\u8D85\u3048\u308B\u5834\u5408\u304C\u3042\u308A\u307E\u3059 (\u7BC4\u56F2: 0.0-1.5)",basicThresholdRange:"\u7BC4\u56F2: 0.0-1.0",basicDisplayHeading:"\u8868\u793A\u30AA\u30D7\u30B7\u30E7\u30F3",basicCaseSensitive:"\u5927\u6587\u5B57\u5C0F\u6587\u5B57\u3092\u533A\u5225",basicHighlight:"\u30CF\u30A4\u30E9\u30A4\u30C8\u8868\u793A",basicOpenEmailsWithGmail:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092 Gmail \u306E\u4F5C\u6210\u753B\u9762\u3067\u958B\u304F",basicMultiTermOperator:"\u8907\u6570\u8A9E\u30AF\u30A8\u30EA\u306E\u6F14\u7B97\u5B50",basicOperatorOr:"OR (\u3044\u305A\u308C\u304B\u4E00\u81F4)",basicOperatorAnd:"AND (\u3059\u3079\u3066\u4E00\u81F4)",basicMultiTermHint:"\u8907\u6570\u8A9E\u3092\u30B9\u30DA\u30FC\u30B9\u3067\u5165\u529B\u3057\u305F\u3068\u304D\u306E\u7D50\u5408\u65B9\u6CD5 (\u65E2\u5B9A\u306F OR)",basicSortHeading:"\u30BD\u30FC\u30C8\u8A2D\u5B9A",basicSortBy:"\u30BD\u30FC\u30C8\u57FA\u6E96",basicSortByScore:"\u30B9\u30B3\u30A2",basicSortByRelevance:"\u95A2\u9023\u6027",basicSortByOriginal:"\u5143\u306E\u9806\u5E8F",basicSortOrder:"\u30BD\u30FC\u30C8\u9806\u5E8F",basicSortDescending:"\u964D\u9806",basicSortAscending:"\u6607\u9806",basicEngineHeading:"\u691C\u7D22\u30A8\u30F3\u30B8\u30F3\u8A2D\u5B9A",basicStrategy:"\u4E26\u5217\u691C\u7D22\u6226\u7565",basicStrategyBalanced:"\u30D0\u30E9\u30F3\u30B9",basicStrategyIndexFirst:"Index \u512A\u5148",basicStrategyLevenshteinFirst:"Levenshtein \u512A\u5148",basicIndexFiltering:"Index \u30D5\u30A3\u30EB\u30BF\u30EA\u30F3\u30B0",basicLevenshtein:"Levenshtein \u8DDD\u96E2\u8A08\u7B97",advancedLearningHeading:"\u5B66\u7FD2\u91CD\u307F",advancedLearningLabel:"\u91CD\u307F\u4FC2\u6570",advancedLearningHint:"\u518D\u5B66\u7FD2\u6642\u306E\u91CD\u307F\u4ED8\u3051 (\u5927\u304D\u3044\u307B\u3069\u904E\u53BB\u306E\u691C\u7D22\u7D50\u679C\u3092\u512A\u5148)",advancedDebounceHeading:"\u30C7\u30D0\u30A6\u30F3\u30B9\u6642\u9593",advancedDebounceLabel:"\u5165\u529B\u9045\u5EF6 (ms)",advancedDebounceHint:"\u5165\u529B\u306E\u5F85\u3061\u6642\u9593\u3002\u77ED\u3044\u307B\u3069\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u3001\u9577\u3044\u307B\u3069\u8CA0\u8377\u8EFD\u6E1B",indexSettingsHeading:"Index Worker \u8A2D\u5B9A",indexBuildHeading:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u69CB\u7BC9",indexNgramSize:"N-gram \u30B5\u30A4\u30BA",indexNgramSizeHint:"\u6587\u5B57\u5217\u3092\u4F55\u6587\u5B57\u5358\u4F4D\u3067\u5206\u5272\u3059\u308B\u304B\u3002\u5C0F\u3055\u3044\u307B\u3069\u9AD8\u901F\u3060\u304C\u7CBE\u5EA6\u4F4E\u4E0B",indexMinNgramOverlap:"\u6700\u5C0F N-gram \u4E00\u81F4\u6570",indexMinNgramOverlapHint:"\u4E00\u81F4\u6570\u304C\u3053\u306E\u5024\u3092\u4E0B\u56DE\u308B\u5019\u88DC\u306F\u9664\u5916",indexCandidateHeading:"\u5019\u88DC\u7D5E\u308A\u8FBC\u307F",indexThreshold:"Index \u95BE\u5024",indexThresholdHint:"Jaro-Winkler \u985E\u4F3C\u5EA6\u306E\u4E0B\u9650 (\u7BC4\u56F2: 0.0-1.0)",indexNgramOverlapThreshold:"N-gram \u91CD\u8907\u5EA6\u95BE\u5024",indexNgramOverlapThresholdHint:"N-gram \u306E\u91CD\u306A\u308A\u5177\u5408\u3002\u9AD8\u3044\u307B\u3069\u53B3\u5BC6\u306B\u5019\u88DC\u3092\u7D5E\u308B",indexStrategyHeading:"\u691C\u7D22\u6226\u7565\u3068\u5019\u88DC\u6570",indexStrategy:"\u691C\u7D22\u6226\u7565",indexStrategyFast:"Fast (\u9AD8\u901F)",indexStrategyAccurate:"Accurate (\u6B63\u78BA)",indexStrategyHybrid:"Hybrid (\u52D5\u7684)",indexStrategyHint:"\u51E6\u7406\u8CA0\u8377\u3068\u7CBE\u5EA6\u306E\u30D0\u30E9\u30F3\u30B9\u3092\u9078\u629E",indexMinCandidatesRatio:"\u6700\u5C0F\u5019\u88DC\u6BD4\u7387",indexMinCandidatesRatioHint:"\u6700\u4F4E\u9650\u78BA\u4FDD\u3059\u308B\u5019\u88DC\u5272\u5408",indexMaxCandidatesRatio:"\u6700\u5927\u5019\u88DC\u6BD4\u7387",indexMaxCandidatesRatioHint:"\u5019\u88DC\u6570\u306E\u4E0A\u9650\u3002\u8D85\u3048\u308B\u3068\u52D5\u7684\u306B\u7D5E\u308A\u8FBC\u307F",indexJaroWinklerPrefix:"Jaro-Winkler \u63A5\u982D\u8F9E\u91CD\u307F",indexJaroWinklerPrefixHint:"\u5148\u982D\u4E00\u81F4\u306B\u4ED8\u4E0E\u3059\u308B\u30DC\u30FC\u30CA\u30B9\u5024",indexMaxResultsHint:"\u53D6\u5F97\u3059\u308B\u6700\u5927\u4EF6\u6570\u3002\u5927\u304D\u3044\u307B\u3069\u5305\u62EC\u7684\u3060\u304C\u9045\u5EF6\u304C\u5897\u52A0",indexFieldWeightHint:"\u30DE\u30C3\u30C1\u30D5\u30A3\u30FC\u30EB\u30C9\u6570\u306B\u3069\u308C\u3060\u3051\u91CD\u307F\u4ED8\u3051\u3059\u308B\u304B",indexPerfectMatchBonus:"\u5B8C\u5168\u4E00\u81F4\u30DC\u30FC\u30CA\u30B9",indexPerfectMatchBonusHint:"\u5B8C\u5168\u4E00\u81F4\u6642\u306B\u8FFD\u52A0\u3059\u308B\u30DC\u30FC\u30CA\u30B9\u5024",indexContainmentHeading:"\u548C\u6587\u30FB\u90E8\u5206\u6587\u5B57\u5217\u5305\u542B\u30B9\u30B3\u30A2",indexContainmentBase:"\u5305\u542B \u57FA\u790E\u30B9\u30B3\u30A2 (containmentScoreBase)",indexContainmentBaseHint:"\u30AF\u30A8\u30EA\u304C\u6587\u5B57\u5217\u4E2D\u306B\u5B8C\u5168\u306B\u542B\u307E\u308C\u308B\u5834\u5408\u306E\u6700\u4F4E\u57FA\u790E\u30B9\u30B3\u30A2 (\u548C\u6587 2 \u6587\u5B57\u7B49\u306E\u6551\u6E08)",indexContainmentCoverage:"\u5305\u542B \u88AB\u8986\u7387\u91CD\u307F (containmentCoverageWeight)",indexContainmentCoverageHint:"\u30AF\u30A8\u30EA\u9577 / \u30D5\u30A3\u30FC\u30EB\u30C9\u9577\u306E\u6BD4\u7387\u306B\u5FDC\u3058\u305F\u52A0\u7B97\u30B9\u30B3\u30A2 (\u5408\u8A08 1.0 \u4EE5\u4E0B\u306B\u5236\u9650)",levenshteinSettingsHeading:"Levenshtein Worker \u8A73\u7D30\u8A2D\u5B9A",levenshteinCandidateHeading:"\u5019\u88DC\u30D5\u30A3\u30EB\u30BF",levenshteinThreshold:"Levenshtein \u95BE\u5024",levenshteinThresholdHintRelevance:"\u3053\u306E\u95BE\u5024\u4EE5\u4E0A\u306E\u7D50\u679C\u306E\u307F\u4FDD\u6301 (\u7BC4\u56F2: 0.0-1.5)",levenshteinThresholdHint:"\u3053\u306E\u95BE\u5024\u4EE5\u4E0A\u306E\u7D50\u679C\u306E\u307F\u4FDD\u6301 (\u7BC4\u56F2: 0.0-1.0)",levenshteinLengthSimilarity:"\u9577\u3055\u985E\u4F3C\u5EA6\u95BE\u5024",levenshteinLengthSimilarityHint:"\u9577\u3055\u304C\u5927\u304D\u304F\u7570\u306A\u308B\u5019\u88DC\u3092\u4E8B\u524D\u306B\u9664\u5916\u3057\u3066\u901F\u5EA6\u5411\u4E0A",levenshteinLengthPenalty:"\u9577\u3055\u5DEE\u30DA\u30CA\u30EB\u30C6\u30A3",levenshteinLengthPenaltyHint:"\u9577\u3055\u5DEE\u3092\u3069\u308C\u3060\u3051\u6E1B\u70B9\u3059\u308B\u304B\u3002\u5927\u304D\u3044\u307B\u3069\u9577\u3055\u4E00\u81F4\u3092\u91CD\u8996",levenshteinResultsHeading:"\u7D50\u679C\u6570\u5236\u5FA1",levenshteinMaxResultsHint:"\u8FD4\u5374\u3059\u308B\u6700\u5927\u4EF6\u6570\u3002\u5927\u304D\u3044\u307B\u3069\u7DB2\u7F85\u7684\u3060\u304C\u51E6\u7406\u6642\u9593\u304C\u5897\u52A0",levenshteinFieldWeightHint:"\u4E00\u81F4\u30D5\u30A3\u30FC\u30EB\u30C9\u6570\u306E\u8A55\u4FA1\u91CD\u307F",levenshteinPartialBonus:"\u90E8\u5206\u4E00\u81F4\u30DC\u30FC\u30CA\u30B9",levenshteinPartialBonusHint:"\u90E8\u5206\u4E00\u81F4\u306B\u4ED8\u4E0E\u3059\u308B\u8FFD\u52A0\u30B9\u30B3\u30A2",statsRebuildingTitle:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u518D\u69CB\u7BC9\u4E2D",statsRebuildIndexTabOnlyTitle:"Index \u30BF\u30D6\u3067\u306E\u307F\u4F7F\u7528\u53EF\u80FD",statsRebuildTitle:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u3092\u518D\u69CB\u7BC9",statsRebuilding:"\u518D\u69CB\u7BC9\u4E2D...",statsRebuild:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u518D\u69CB\u7BC9",statsResetTitle:"\u7D71\u8A08\u3092\u30EA\u30BB\u30C3\u30C8",statsOverviewTab:"\u6982\u8981",statsIndexTab:"Index",statsLevenshteinTab:"Levenshtein",statTotalSearches:"\u7DCF\u691C\u7D22\u56DE\u6570",statAverageSearchTime:"\u5E73\u5747\u691C\u7D22\u6642\u9593",statDataCount:"\u30C7\u30FC\u30BF\u4EF6\u6570",statResultCount:"\u691C\u7D22\u7D50\u679C\u4EF6\u6570",statDisplayedCount:"\u8868\u793A\u4EF6\u6570",statsNoData:"\u7D71\u8A08\u30C7\u30FC\u30BF\u306A\u3057",statsBasicHeading:"\u57FA\u672C\u7D71\u8A08",statTotalProcessingTime:"\u7DCF\u51E6\u7406\u6642\u9593",statLastSearchTime:"\u6700\u5F8C\u306E\u691C\u7D22\u6642\u9593",statErrorCount:"\u30A8\u30E9\u30FC\u6570",statUpdatedAt:"\u7D71\u8A08\u66F4\u65B0\u6642\u523B",statsOperationsHeading:"\u64CD\u4F5C\u7D71\u8A08",statTotalOperations:"\u7DCF\u64CD\u4F5C\u6570",statsIndexHeading:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u7D71\u8A08",statIndexBuilds:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u69CB\u7BC9\u56DE\u6570",statDataSize:"\u30C7\u30FC\u30BF\u30B5\u30A4\u30BA",statLastBuildTime:"\u6700\u5F8C\u306E\u69CB\u7BC9\u6642\u9593",statsCacheHeading:"\u30AD\u30E3\u30C3\u30B7\u30E5\u7D71\u8A08",statCacheNgram:"N-gram",statCacheWord:"\u5358\u8A9E",statCachePhonetic:"\u97F3\u97FB",statsIndexMetadataHeading:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u30E1\u30BF\u30C7\u30FC\u30BF",statsCalculationsHeading:"\u8A08\u7B97\u7D71\u8A08",statTotalCalculations:"\u7DCF\u8A08\u7B97\u6570",statDistanceCalculations:"\u8DDD\u96E2\u8A08\u7B97\u6570",statAverageDistance:"\u5E73\u5747\u8DDD\u96E2",statMinDistance:"\u6700\u5C0F\u8DDD\u96E2",statMaxDistance:"\u6700\u5927\u8DDD\u96E2",notAvailable:"N/A",statsMatchesHeading:"\u30DE\u30C3\u30C1\u7D71\u8A08",statPartialMatches:"\u90E8\u5206\u30DE\u30C3\u30C1\u6570",statPerfectMatches:"\u5B8C\u5168\u30DE\u30C3\u30C1\u6570",statEarlyTerminations:"\u65E9\u671F\u7D42\u4E86\u6570",statsSimilarityHeading:"\u985E\u4F3C\u5EA6\u5206\u5E03",statAbove80:"80% \u4EE5\u4E0A",statAbove60:"60% \u4EE5\u4E0A",statAbove40:"40% \u4EE5\u4E0A",statBelow40:"40% \u672A\u6E80",statsDistanceHeading:"\u8DDD\u96E2\u5206\u5E03 (\u4E0A\u4F4D 6)",statDistance:e=>`\u8DDD\u96E2 ${e}`,statsQueryLengthHeading:"\u30AF\u30A8\u30EA\u9577\u7D71\u8A08 (\u4E0A\u4F4D 6)",statQueryLength:e=>`\u9577\u3055 ${e}`,statQueryLengthValue:({count:e,averagePercent:t})=>`${G("ja",e)} \u56DE / \u5E73\u5747 ${t}%`,statsFieldPerformanceHeading:"\u30D5\u30A3\u30FC\u30EB\u30C9\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9 (\u4E0A\u4F4D 6)",statAverageScore:"\u5E73\u5747\u30B9\u30B3\u30A2",statMatchCount:"\u30DE\u30C3\u30C1\u6570",statBestWorstScore:"\u6700\u9AD8 / \u6700\u4F4E\u30B9\u30B3\u30A2",statsInsightsHeading:"\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u6D1E\u5BDF",statBestField:"\u6700\u9AD8\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u30D5\u30A3\u30FC\u30EB\u30C9",statRecentAverageTime:"\u6700\u8FD1\u306E\u5E73\u5747\u51E6\u7406\u6642\u9593",statRecentAverageResults:"\u6700\u8FD1\u306E\u5E73\u5747\u7D50\u679C\u6570",statThroughput:"\u30B9\u30EB\u30FC\u30D7\u30C3\u30C8",statCommonQueryLength:"\u6700\u983B\u51FA\u30AF\u30A8\u30EA\u9577",statHistoryEntries:"\u5C65\u6B74\u30A8\u30F3\u30C8\u30EA\u6570",statHighSimilarity:"\u9AD8\u985E\u4F3C",statMediumSimilarity:"\u4E2D\u985E\u4F3C",statLowSimilarity:"\u4F4E\u985E\u4F3C",statVeryLowSimilarity:"\u6975\u4F4E\u985E\u4F3C",statsRecentHistoryHeading:"\u6700\u8FD1\u306E\u5C65\u6B74 (\u6700\u65B0 3 \u4EF6)",statsHistoryEntry:({processingTimeMs:e,resultCount:t})=>`\u51E6\u7406\u6642\u9593: ${e} ms / \u7D50\u679C: ${G("ja",t)} \u4EF6`,timesUnit:()=>" \u56DE",itemsUnit:()=>" \u4EF6",charactersUnit:()=>" \u6587\u5B57",throughputUnit:" ops/\u79D2"})}),On=Object.freeze(Object.keys(sa.en)),Wt=Object.freeze([...Fa,...On]),Nt=Object.freeze({en:Object.freeze({...En.en,...sa.en}),ja:Object.freeze({...En.ja,...sa.ja})}),Aa=e=>typeof e=="string"?JSON.stringify(e):e===null?"null":typeof e,jr=e=>{let t={},a=!1;for(let s of Fa){let i=Object.hasOwn(e,s)?e[s]:void 0;i!==void 0&&(t[s]=i,a=!0)}return a?t:void 0},Gr=(e,t,a)=>{e[t]=a},za=(e,t)=>{let a=$r(e);if(t===void 0)return Nt[a];if(t===null||typeof t!="object")throw new RangeError(`[contact-map] labels must be an object; got ${Aa(t)}`);let s=Object.getPrototypeOf(t);if(s!==Object.prototype&&s!==null)throw new RangeError(`[contact-map] labels must be a plain object (prototype Object.prototype or null); got ${Array.isArray(t)?"an array":"an object with a non-plain prototype"}`);for(let d of Object.keys(t))if(!Wt.includes(d))throw new RangeError(`[contact-map] labels.${d} is not a known label key; expected one of ${Wt.join(", ")}`);let i=Ur(a,jr(t)),n=sa[a],r={...i,...n};for(let d of On){let l=Object.hasOwn(t,d)?t[d]:void 0;if(l!==void 0){if(typeof n[d]=="function"){if(typeof l!="function")throw new RangeError(`[contact-map] labels.${d} must be a function; got ${Aa(l)}`)}else if(typeof l!="string"||l.trim()==="")throw new RangeError(`[contact-map] labels.${d} must be a non-blank string; got ${Aa(l)}`);Gr(r,d,l)}}return Object.freeze(r)},Ba=e=>{let t={};for(let a of Fa)t[a]=e[a];return Object.freeze(t)},Ua=e=>{let t={};for(let a of Vr)t[a]=e[a];return Object.freeze(t)}});import{DIRECTORY_TREE_LABEL_KEYS as qr}from"@aiquants/directory-tree";import{resolveVirtualScrollLocale as Qr,VIRTUAL_SCROLL_LABEL_KEYS as Yr}from"@aiquants/virtualscroll";import{createContext as Xr,useContext as Hn,useMemo as Dn,useRef as Jr}from"react";import{jsx as es}from"react/jsx-runtime";var Zr,Va,$a,Wn,he,q,oe=Ge(()=>{"use strict";lt();Zr=Object.freeze({locale:"en",labels:Nt.en,treeLabels:Ba(Nt.en),engineLabels:Ua(Nt.en)}),Va=Xr(Zr),$a=(e,t)=>{let a=Jr(null),s=a.current;return s!==null&&t.every(i=>s[i]===e[i])?s:(a.current=e,e)},Wn=({locale:e,labels:t,children:a})=>{let s=Qr(e),i=Dn(()=>za(s,t),[s,t]),n=$a(i,Wt),r=$a(Ba(n),qr),d=$a(Ua(n),Yr),l=Dn(()=>({locale:s,labels:n,treeLabels:r,engineLabels:d}),[s,n,r,d]);return es(Va.Provider,{value:l,children:a})},he=()=>Hn(Va),q=()=>Hn(Va).labels});var ia,oa,In,la,da,_t,ze,An,Te,K,ct=Ge(()=>{"use strict";ia=e=>{if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null},oa=e=>!e||typeof e!="object"?null:"item"in e?e.item??null:"person_id"in e?e:null,In=(e,t)=>{if(!e)return{value:null,fieldKey:null};for(let a of t){let s=ia(e[a]);if(s)return{value:s,fieldKey:a}}return{value:null,fieldKey:null}},la=e=>In(e,["custom_email","email"]),da=e=>In(e,["custom_mobile_phone_number","mobile_phone_number","company_phone_number"]),_t=e=>{let t=ia(e);if(!t)return null;let a=t.replace(/[^0-9+#*]/g,"");return a.length===0?null:`tel:${a}`},ze=(e,t)=>{let a=ia(e);return a?t?`https://mail.google.com/mail/?view=cm&fs=1&to=${encodeURIComponent(a)}`:`mailto:${encodeURIComponent(a)}`:null},An=e=>{if(!e)return"-";let t=typeof e=="string"||typeof e=="number"?new Date(e):e;return!(t instanceof Date)||Number.isNaN(t.getTime())?typeof e=="string"?e:"-":t.toISOString().split("T")[0]},Te=e=>{if(!e)return"-";let t=typeof e=="string"||typeof e=="number"?new Date(e):e;return!(t instanceof Date)||Number.isNaN(t.getTime())?typeof e=="string"?e:"-":t.toISOString()},K=e=>e==null?"-":typeof e=="string"?ia(e)??"-":typeof e=="number"?Number.isFinite(e)?String(e):"-":e instanceof Date?Te(e):String(e)});import ns from"lucide-react/dist/esm/icons/check.js";import rs from"lucide-react/dist/esm/icons/copy.js";import ss from"lucide-react/dist/esm/icons/x.js";import{useCallback as qe,useEffect as Qa,useMemo as It,useRef as Ya,useState as Bn}from"react";import{createPortal as is}from"react-dom";import{jsx as Q,jsxs as Ne}from"react/jsx-runtime";var os,Fn,Ft,Pt,ls,ds,At,Ga,zn,qa,ca,Xa=Ge(()=>{"use strict";ct();oe();os=350,Fn=["dblclick","pointerdown","pointerup","mousedown","mouseup","touchstart","touchend","contextmenu"],Ft=0,Pt=null,ls=()=>{let e=document.body.style;Ft+=1,Ft===1&&(Pt={userSelect:e.userSelect,webkitUserSelect:e.webkitUserSelect}),e.userSelect="none",typeof e.webkitUserSelect<"u"&&(e.webkitUserSelect="none")},ds=()=>{if(Ft=Math.max(0,Ft-1),Ft>0||!Pt)return;let e=document.body.style;e.userSelect=Pt.userSelect,typeof Pt.webkitUserSelect<"u"&&(e.webkitUserSelect=Pt.webkitUserSelect),Pt=null},At=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},Ga=(e,t)=>{let a=new Set;return e.reduce((s,i)=>{let n=typeof i.value=="string"?i.value.trim():"";if(!n)return s;let{normalized:r,key:d,entry:l}=t(n,i);return r&&!a.has(d)&&(a.add(d),s.push(l(r))),s},[])},zn=(e,t)=>e===t,qa=({value:e,ariaLabel:t,size:a="md"})=>{let[s,i]=Bn(!1),n=Ya(null),r=qe(async c=>{if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(c),!0}catch{}if(typeof document>"u")return!1;let o=document.createElement("textarea");o.value=c,o.setAttribute("readonly",""),o.style.position="absolute",o.style.left="-9999px",document.body.appendChild(o),o.select(),o.setSelectionRange(0,o.value.length);let p=document.execCommand("copy");return document.body.removeChild(o),p},[]),d=qe(async c=>{c.preventDefault(),c.stopPropagation(),n.current!==null&&typeof window<"u"&&(window.clearTimeout(n.current),n.current=null);let o=await r(e);i(o),o&&typeof window<"u"&&(n.current=window.setTimeout(()=>{i(!1),n.current=null},1500))},[r,e]);Qa(()=>()=>{n.current!==null&&typeof window<"u"&&(window.clearTimeout(n.current),n.current=null)},[]);let l=a==="sm"?"h-6 w-6":"h-7 w-7",u=a==="sm"?"h-3.5 w-3.5":"h-4 w-4",m=s?ns:rs;return Q("button",{type:"button",className:`inline-flex ${l} shrink-0 items-center justify-center rounded-md border border-gray-200 text-slate-600 transition-colors hover:bg-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-200 dark:text-slate-300`,onClick:d,"aria-label":t,title:t,children:Q(m,{className:u,"aria-hidden":"true"})})},ca=({contactData:e,openEmailsWithGmail:t,openGmailCompose:a,onRequestClose:s})=>{let i=q(),[n,r]=Bn(null);Qa(()=>{r(document.body)},[]);let d=Ya(null),l=Ya(null),u=It(()=>e.contacted_at?An(e.contacted_at):null,[e.contacted_at]),m=e.full_name||"-",c=At(e.company_name),o=At(e.department),p=At(e.title),f=It(()=>Ga([{fieldKey:"company_name",label:i.fieldCompanyName,value:c},{fieldKey:"department",label:i.fieldDepartment,value:o},{fieldKey:"title",label:i.fieldTitle,value:p}],(h,{fieldKey:x,label:O})=>({normalized:h,key:`${x}-${h.toLowerCase()}`,entry:D=>({fieldKey:x,label:O,value:D})})),[c,o,p,i]),v=It(()=>Ga([{fieldKey:"custom_mobile_phone_number",label:i.popupCustomMobilePhone,value:e.custom_mobile_phone_number},{fieldKey:"mobile_phone_number",label:i.popupMobilePhone,value:e.mobile_phone_number},{fieldKey:"custom_company_phone_number",label:i.popupCustomCompanyPhone,value:e.custom_company_phone_number},{fieldKey:"company_phone_number",label:i.popupCompanyPhone,value:e.company_phone_number}],(h,{fieldKey:x,label:O})=>{let D=_t(h);return{normalized:At(h),key:(D??h).toLowerCase(),entry:w=>({fieldKey:x,label:O,value:w,href:D})}}),[e.custom_mobile_phone_number,e.mobile_phone_number,e.custom_company_phone_number,e.company_phone_number,i]),T=It(()=>Ga([{fieldKey:"custom_email",label:i.popupCustomEmail,value:e.custom_email},{fieldKey:"email",label:i.popupEmail,value:e.email}],(h,{fieldKey:x,label:O})=>{let D=At(h),Z=ze(h,t),w=!!Z?.startsWith("https://mail.google.com");return{normalized:D,key:h.toLowerCase(),entry:P=>({fieldKey:x,label:O,value:P,href:Z,isGmailLink:w})}}),[e.custom_email,e.email,t,i]),C=v.length>0||T.length>0,z=It(()=>`contact-methods-${e.person_id}`,[e.person_id]),k=qe(h=>{s(h),l.current=null},[s]),b=qe(h=>{h.stopPropagation(),zn(h.target,h.currentTarget)&&k()},[k]),g=qe(h=>{h.stopPropagation(),zn(h.target,h.currentTarget)&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),k())},[k]),E=qe(h=>{h.stopPropagation(),k()},[k]),V=qe((h,x)=>{x.isGmailLink&&(h.preventDefault(),a(x.value))},[a]),y=qe((h,x)=>{if(!x.isGmailLink){l.current=null;return}let O=Date.now(),D=l.current;if(D&&D.email===x.value&&O-D.timestamp<=os){l.current=null,h.preventDefault(),a(x.value);return}l.current={email:x.value,timestamp:O}},[a]);return Qa(()=>{let h=[];if(typeof window<"u"){let x=O=>{if(O.key==="Escape"){k();return}if(O.key==="Tab"&&d.current){let D=d.current.querySelectorAll('a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])');if(D.length===0)return;let Z=D[0],w=D[D.length-1];O.shiftKey?document.activeElement===Z&&(O.preventDefault(),w.focus()):document.activeElement===w&&(O.preventDefault(),Z.focus())}};window.addEventListener("keydown",x),h.push(()=>window.removeEventListener("keydown",x))}if(typeof document<"u"){let x=d.current;if(x){let w=P=>{P.stopPropagation()};for(let P of Fn)x.addEventListener(P,w);h.push(()=>{for(let P of Fn)x.removeEventListener(P,w)})}let O=w=>{let P=d.current;return P&&w instanceof Node?P.contains(w):!1},D=w=>{O(w.target)||k({suppressLongPress:!0,cancelLongPressTimer:!0})},Z=["pointerdown","wheel","touchmove"];for(let w of Z)document.addEventListener(w,D,!0);h.push(()=>{for(let w of Z)document.removeEventListener(w,D,!0)}),ls(),h.push(ds)}return()=>{for(let x of h)x()}},[k,n]),n?is(Q("div",{"data-contact-popup-root":"true",className:"fixed top-0 right-0 bottom-0 left-0 z-50 flex items-center justify-center bg-black/50 px-4 py-6",style:{right:"var(--aqcm-overlay-right, var(--aiquants-menu-pinned-width, 0px))",transition:"right 0.5s"},role:"dialog","aria-modal":"true","aria-labelledby":z,tabIndex:-1,onClick:b,onKeyDown:g,children:Ne("div",{ref:d,className:"w-full max-w-md rounded-lg border border-slate-200 bg-white p-4 shadow-lg transition-colors dark:border-transparent dark:bg-slate-900 dark:shadow-slate-950/40 dark:ring-1 dark:ring-white/70",children:[Ne("div",{className:"flex items-start justify-between gap-4",children:[Ne("div",{children:[Q("h2",{id:z,className:"font-semibold text-gray-900 text-lg dark:text-slate-100",children:m}),f.length>0?Q("div",{className:"mt-2 space-y-2 text-slate-700 text-sm dark:text-slate-200",children:f.map(h=>Ne("div",{className:"flex items-center gap-3",children:[Q("p",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:h.value}),Q(qa,{value:h.value,ariaLabel:i.copyField(h.label),size:"sm"})]},h.fieldKey))}):null]}),Q("button",{type:"button",className:"rounded-md p-0.5 text-slate-600 transition-colors hover:bg-gray-100 focus:outline-none focus-visible:ring focus-visible:ring-blue-200 dark:text-slate-300 dark:hover:bg-slate-800/70",onClick:E,"aria-label":i.close,children:Q(ss,{className:"h-4 w-4","aria-hidden":"true"})})]}),Ne("div",{className:"mt-4 space-y-4 text-slate-700 dark:text-slate-200",children:[v.length>0?Q("div",{children:Q("ul",{className:"space-y-3 text-sm",children:v.map(h=>Q("li",{className:"flex items-start gap-3",children:Ne("div",{className:"flex-1",children:[Q("span",{className:"text-slate-600 text-xs dark:text-slate-300",children:h.label}),Ne("div",{className:"mt-1 flex items-center gap-3",children:[Q("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:h.href?Q("a",{href:h.href,className:"wrap-break-word text-blue-600 underline-offset-2 transition-colors hover:underline focus:underline focus:outline-none dark:text-blue-300",children:h.value}):Q("span",{className:"wrap-break-word text-slate-800 dark:text-slate-100",children:h.value})}),Q(qa,{value:h.value,ariaLabel:i.copyField(h.label),size:"sm"})]})]})},`${h.fieldKey}-${h.value}`))})}):null,T.length>0?Q("div",{children:Q("ul",{className:"space-y-3 text-sm",children:T.map(h=>Q("li",{className:"flex items-start gap-3",children:Ne("div",{className:"flex-1",children:[Q("span",{className:"text-slate-600 text-xs dark:text-slate-300",children:h.label}),Ne("div",{className:"mt-1 flex items-start gap-3",children:[Ne("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:[h.href?Q("a",{href:h.href,className:"wrap-break-word text-blue-600 underline-offset-2 transition-colors hover:underline focus:underline focus:outline-none dark:text-blue-300",target:h.isGmailLink?"_blank":void 0,rel:h.isGmailLink?"noopener noreferrer":void 0,onDoubleClick:x=>V(x,h),onTouchEnd:x=>y(x,h),children:h.value}):Q("span",{className:"wrap-break-word text-slate-800 dark:text-slate-100",children:h.value}),h.isGmailLink?Q("span",{className:"mt-1 block text-[11px] text-slate-500 dark:text-slate-400",children:i.popupGmailHint}):null]}),Q(qa,{value:h.value,ariaLabel:i.copyField(h.label),size:"sm"})]})]})},`${h.fieldKey}-${h.value}`))})}):null,u?Ne("div",{className:"mt-2 flex items-center gap-2 text-slate-600 text-sm dark:text-slate-300",children:[Q("span",{className:"text-xs",children:i.popupLastContactDate}),Q("span",{children:u})]}):null,C?null:Q("p",{className:"text-slate-600 text-sm dark:text-slate-300",children:i.popupNoContactMethods})]})]})}),n):null}});import{jsx as fe,jsxs as zt}from"react/jsx-runtime";var pa,Ja=Ge(()=>{"use strict";pa=({fullName:e,title:t="-",companyName:a="-",department:s="-",phoneNumber:i="-",email:n="-",updatedAtText:r="-"})=>zt("div",{className:"flex h-full w-full flex-col justify-center gap-0.5 text-slate-800 text-xs leading-tight transition-colors sm:grid sm:grid-cols-3 sm:gap-2 sm:text-sm xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto] dark:text-slate-200",children:[zt("div",{className:"flex items-center gap-1 sm:hidden",children:[fe("div",{className:"flex-1 truncate font-medium text-gray-900 text-sm leading-tight dark:text-slate-100",children:e}),fe("div",{className:"shrink-0 whitespace-nowrap text-[11px] text-slate-600 dark:text-slate-300",children:i})]}),fe("div",{className:"flex items-center gap-1 sm:hidden",children:fe("div",{className:"flex-1 truncate text-slate-700 text-xs leading-tight dark:text-slate-200",children:a})}),fe("div",{className:"block sm:hidden",children:fe("span",{className:"w-full truncate text-left text-[11px] text-slate-700 leading-tight dark:text-slate-200",children:s})}),zt("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[fe("span",{className:"truncate font-medium text-gray-900 dark:text-slate-100",children:e}),fe("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:t})]}),zt("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[fe("span",{className:"truncate text-slate-800 dark:text-slate-100",children:a}),fe("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:s})]}),zt("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[fe("span",{className:"truncate text-slate-700 dark:text-slate-200",children:i}),fe("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:n})]}),fe("div",{className:"hidden items-end justify-end text-[11px] text-slate-600 xl:flex dark:text-slate-300",children:fe("span",{className:"truncate",children:r})})]})});import{getNormalizedVariants as cs,normalizeText as ps,romajiToKatakana as us}from"@aiquants/select-box";var ms,gs,hs,fs,bs,$n,ys,xs,Un,ua,vs,Cs,Za,Vn,en=Ge(()=>{"use strict";ms=/[​]/g,gs=/^[\s  ]+|[\s  ]+$/g,hs=/\s+/,fs=/^[\p{Script=Latin}\s]+$/u,bs=/\p{Script=Latin}/u,$n=Object.freeze({convertWidth:!0,convertKana:!0,convertCase:!0,convertRomaji:!1}),ys=e=>ps(e.replace(ms,"").replace(gs,""),$n),xs=e=>{if(!fs.test(e))return null;let t=us(e);return bs.test(t)?null:t},Un=e=>e.split(hs).filter(Boolean),ua=e=>{let t=ys(e),a=xs(t);return a===null?t:a},vs=e=>{let t=new Set([...Un(e),...Un(ua(e))]),a=new Set;for(let s of t)for(let i of cs(s,$n)){let n=i.trim();n&&a.add(n)}return Array.from(a)},Cs=/[.*+?^${}()|[\]\\]/g,Za=e=>{let t=vs(e);if(t.length===0)return null;let a=t.map(s=>s.replace(Cs,"\\$&")).sort((s,i)=>i.length-s.length);return new RegExp(a.join("|"),"gi")},Vn=(e,t)=>{let a=Za(e);if(a===null)return i=>i;let s=i=>t.some(n=>{let r=i[n];return typeof r=="string"&&r.search(a)!==-1});return i=>{let n=[],r=[];for(let d of i)s(d.item)?n.push(d):r.push(d);return[...n,...r]}}});import{memo as ks}from"react";import{Fragment as tn,jsx as ma}from"react/jsx-runtime";var pe,ga=Ge(()=>{"use strict";en();pe=ks(({text:e,query:t,enabled:a=!0})=>{if(!(a&&t?.trim()&&e))return ma(tn,{children:e});let s=Za(t);if(s===null)return ma(tn,{children:e});let i=[],n=0,r=s.exec(e),d=0;for(;r;){let l=r[0],u=r.index;if(u>n&&i.push(e.substring(n,u)),l.length===0){s.lastIndex++,r=s.exec(e);continue}i.push(ma("mark",{className:"rounded bg-yellow-200 px-1 text-gray-900",children:l},`highlight-${u}-${d}`)),n=u+l.length,d+=1,r=s.exec(e)}return n<e.length&&i.push(e.substring(n)),ma(tn,{children:i})});pe.displayName="HighlightedText"});var jn={};Br(jn,{ContactDetailGrid:()=>Kn,default:()=>Ss});import{useMemo as an}from"react";import{Fragment as Ts,jsx as rn,jsxs as Ns}from"react/jsx-runtime";var nn,Kn,Ss,Gn=Ge(()=>{"use strict";ct();oe();Xa();Ja();ga();nn=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},Kn=({contactData:e,searchTerm:t,enableHighlighting:a,openEmailsWithGmail:s,openGmailCompose:i,isPopupVisible:n,onRequestClose:r})=>{let d=q(),l=an(()=>la(e),[e]),u=an(()=>da(e),[e]),m=l.value??"-",c=u.value??"-",o=an(()=>Te(e.updated_at),[e.updated_at]),p=nn(e.full_name)??d.noName,f=nn(e.company_name),v=nn(e.department),T=(C,z="-")=>rn(pe,{text:C??z,query:t,enabled:a});return Ns(Ts,{children:[rn(pa,{fullName:T(p),title:T(e.title),companyName:T(f),department:T(v),phoneNumber:c,email:T(m),updatedAtText:o}),n?rn(ca,{contactData:e,openEmailsWithGmail:s,openGmailCompose:i,onRequestClose:r}):null]})},Ss=Kn});oe();import{DEFAULT_FUZZY_SEARCH_OPTIONS as wt}from"@aiquants/fuzzy-search";import{memo as ts,useId as _n}from"react";import{jsx as Re,jsxs as Fe}from"react/jsx-runtime";var Ka=ts(({searchOptions:e,setSearchOptions:t})=>{let a=q(),s="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",i="text-xs font-semibold",n=_n(),r=_n(),d=[];return d.push(Fe("div",{className:`${s} border-sky-200 border-l-4 dark:border-sky-400/60`,children:[Fe("div",{className:`${i} text-sky-700 dark:text-sky-300`,children:["\u{1F4D8} ",a.advancedLearningHeading]}),Re("label",{htmlFor:n,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.advancedLearningLabel}),Re("input",{id:n,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.learningWeight||wt.learningWeight,onChange:l=>t(u=>({...u,learningWeight:parseFloat(l.target.value)})),className:"w-full"}),Fe("span",{className:"text-sky-600 text-xs dark:text-sky-300",children:[a.currentValueLabel," ",e.learningWeight||wt.learningWeight]}),Re("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.advancedLearningHint})]},"learning")),d.push(Fe("div",{className:`${s} border-indigo-200 border-l-4 dark:border-indigo-400/60`,children:[Fe("div",{className:`${i} text-indigo-700 dark:text-indigo-300`,children:["\u23F1\uFE0F ",a.advancedDebounceHeading]}),Re("label",{htmlFor:r,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.advancedDebounceLabel}),Re("input",{id:r,type:"range",min:"100",max:"1000",step:"50",value:e.debounceMs||wt.debounceMs,onChange:l=>t(u=>({...u,debounceMs:parseInt(l.target.value,10)})),className:"w-full"}),Fe("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[a.currentValueLabel," ",e.debounceMs||wt.debounceMs]}),Re("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.advancedDebounceHint})]},"debounce")),Fe("section",{className:"space-y-3",children:[Fe("div",{className:"flex items-center justify-between gap-3",children:[Fe("div",{className:"flex items-center gap-2 font-semibold text-gray-700 text-xs transition-colors dark:text-slate-200",children:[Re("span",{children:"\u26A1"}),Re("span",{className:"tracking-wide",children:a.settingsAdvancedTab})]}),Re("button",{type:"button",onClick:()=>t(l=>({...l,learningWeight:wt.learningWeight,debounceMs:wt.debounceMs})),className:"rounded border border-gray-300 bg-gray-100 px-2 py-1 font-medium text-gray-700 text-xs transition-colors hover:bg-gray-200 dark:border-slate-600 dark:bg-slate-800/70 dark:text-slate-200 dark:hover:bg-slate-700/70",title:a.resetToDefaultsTitle,children:a.reset})]}),Re("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:d})]})});Ka.displayName="AdvancedSearchSettings";oe();import{DEFAULT_FUZZY_SEARCH_OPTIONS as dt}from"@aiquants/fuzzy-search";import{memo as as,useId as Me}from"react";import{jsx as X,jsxs as J}from"react/jsx-runtime";var ja=as(({searchOptions:e,setSearchOptions:t,enableHighlighting:a,setEnableHighlighting:s,openEmailsWithGmail:i,setOpenEmailsWithGmail:n})=>{let r=q(),d="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",l="text-xs font-semibold",u=Me(),m=Me(),c=Me(),o=Me(),p=Me(),f=Me(),v=Me(),T=Me(),C=Me(),z=Me(),k=[];return k.push(J("div",{className:`${d} border-blue-200 border-l-4 dark:border-blue-500/50`,children:[J("div",{className:`${l} text-blue-700 dark:text-blue-300`,children:["\u{1F3AF} ",r.basicThresholdHeading]}),X("label",{htmlFor:u,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:r.basicThresholdLabel}),X("input",{id:u,type:"range",min:"0.0",max:e.sortBy==="relevance"?"1.5":"1.0",step:"0.05",value:e.threshold??dt.threshold,onChange:b=>t(g=>({...g,threshold:parseFloat(b.target.value)})),className:"w-full"}),J("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[r.currentValueLabel," ",e.threshold??dt.threshold]}),X("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:e.sortBy==="relevance"?r.basicThresholdRangeRelevance:r.basicThresholdRange})]},"threshold")),k.push(J("div",{className:`${d} border-amber-200 border-l-4 dark:border-amber-400/60`,children:[J("div",{className:`${l} text-amber-700 dark:text-amber-300`,children:["\u{1FA84} ",r.basicDisplayHeading]}),J("label",{htmlFor:m,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[X("input",{id:m,type:"checkbox",checked:e.caseSensitive??dt.caseSensitive,onChange:b=>t(g=>({...g,caseSensitive:b.target.checked})),className:"h-3 w-3"}),r.basicCaseSensitive]}),J("label",{htmlFor:c,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[X("input",{id:c,type:"checkbox",checked:a,onChange:b=>s(b.target.checked),className:"h-3 w-3"}),r.basicHighlight]}),J("label",{htmlFor:o,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[X("input",{id:o,type:"checkbox",checked:i,onChange:b=>n(b.target.checked),className:"h-3 w-3"}),r.basicOpenEmailsWithGmail]}),J("div",{className:"flex flex-col gap-1",children:[X("label",{htmlFor:p,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:r.basicMultiTermOperator}),J("select",{id:p,value:e.multiTermOperator??dt.multiTermOperator,onChange:b=>t(g=>({...g,multiTermOperator:b.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[X("option",{value:"or",children:r.basicOperatorOr}),X("option",{value:"and",children:r.basicOperatorAnd})]}),X("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:r.basicMultiTermHint})]})]},"display")),k.push(J("div",{className:`${d} border-emerald-200 border-l-4 dark:border-emerald-400/60`,children:[J("div",{className:`${l} text-emerald-700 dark:text-emerald-300`,children:["\u{1F4DA} ",r.basicSortHeading]}),J("div",{className:"flex flex-col gap-2",children:[X("label",{htmlFor:f,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:r.basicSortBy}),J("select",{id:f,value:e.sortBy||dt.sortBy,onChange:b=>t(g=>({...g,sortBy:b.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[X("option",{value:"score",children:r.basicSortByScore}),X("option",{value:"relevance",children:r.basicSortByRelevance}),X("option",{value:"original",children:r.basicSortByOriginal})]})]}),J("div",{className:"flex flex-col gap-2",children:[X("label",{htmlFor:v,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:r.basicSortOrder}),J("select",{id:v,value:e.sortOrder||dt.sortOrder,onChange:b=>t(g=>({...g,sortOrder:b.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[X("option",{value:"desc",children:r.basicSortDescending}),X("option",{value:"asc",children:r.basicSortAscending})]})]})]},"sorting")),k.push(J("div",{className:`${d} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[J("div",{className:`${l} text-purple-700 dark:text-purple-300`,children:["\u2699\uFE0F ",r.basicEngineHeading]}),X("label",{htmlFor:T,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:r.basicStrategy}),J("select",{id:T,value:e.parallelSearchStrategy||dt.parallelSearchStrategy,onChange:b=>t(g=>({...g,parallelSearchStrategy:b.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[X("option",{value:"balanced",children:r.basicStrategyBalanced}),X("option",{value:"index-first",children:r.basicStrategyIndexFirst}),X("option",{value:"levenshtein-first",children:r.basicStrategyLevenshteinFirst})]}),J("div",{className:"mt-2 space-y-2",children:[J("label",{htmlFor:C,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[X("input",{id:C,type:"checkbox",checked:e.enableIndexFiltering!==!1,onChange:b=>t(g=>({...g,enableIndexFiltering:b.target.checked})),className:"h-3 w-3"}),r.basicIndexFiltering]}),J("label",{htmlFor:z,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[X("input",{id:z,type:"checkbox",checked:e.enableLevenshtein!==!1,onChange:b=>t(g=>({...g,enableLevenshtein:b.target.checked})),className:"h-3 w-3"}),r.basicLevenshtein]})]})]},"engine")),J("section",{className:"space-y-3",children:[J("div",{className:"flex items-center gap-2 font-semibold text-blue-700 text-xs transition-colors dark:text-sky-400",children:[X("span",{children:"\u{1F527}"}),X("span",{className:"tracking-wide",children:r.settingsBasicTab})]}),X("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:k})]})});ja.displayName="BasicSearchSettings";ct();import Ls from"lucide-react/dist/esm/icons/badge-check.js";import Rs from"lucide-react/dist/esm/icons/building-2.js";import Ms from"lucide-react/dist/esm/icons/calendar-clock.js";import Es from"lucide-react/dist/esm/icons/check.js";import Os from"lucide-react/dist/esm/icons/copy.js";import Ds from"lucide-react/dist/esm/icons/id-card.js";import Hs from"lucide-react/dist/esm/icons/mail.js";import Ws from"lucide-react/dist/esm/icons/phone.js";import _s from"lucide-react/dist/esm/icons/user-round.js";import{useCallback as Is,useEffect as As,useMemo as ba,useRef as Fs,useState as zs}from"react";var Qe={info:(e,...t)=>console.info(`[contact-map] ${e}`,...t),warn:(e,...t)=>console.warn(`[contact-map] ${e}`,...t),error:(e,...t)=>console.error(`[contact-map] ${e}`,...t)};oe();import*as we from"@radix-ui/react-tabs";import*as ha from"react";import{clsx as ws}from"clsx";import{twMerge as Ps}from"tailwind-merge";function pt(...e){return Ps(ws(e))}import{jsx as sn}from"react/jsx-runtime";var fa=we.Root,Bt=ha.forwardRef(({className:e,...t},a)=>sn(we.List,{ref:a,className:pt("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Bt.displayName=we.List.displayName;var ut=ha.forwardRef(({className:e,...t},a)=>sn(we.Trigger,{ref:a,className:pt("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 font-medium text-sm ring-offset-background transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-2xs",e),...t}));ut.displayName=we.Trigger.displayName;var mt=ha.forwardRef(({className:e,...t},a)=>sn(we.Content,{ref:a,className:pt("mt-2 ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=inactive]:hidden",e),...t}));mt.displayName=we.Content.displayName;ga();import{jsx as L,jsxs as le}from"react/jsx-runtime";var qn={height:"var(--contact-panel-height, 100%)",maxHeight:"100%"},Bs=({icon:e,label:t,value:a,fieldKey:s,copyValue:i,onCopy:n,isCopied:r,linkHref:d,searchTerm:l,enableHighlighting:u})=>{let m=q(),c=!!(n&&s&&i),o=d?.startsWith("https://mail.google.com")?"_blank":void 0;return le("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1.5 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[le("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[L("div",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-white text-slate-500 transition-colors dark:bg-slate-800 dark:text-slate-200",children:L(e,{size:14})}),le("div",{className:"min-w-0 flex-1",children:[L("div",{className:"font-medium text-[10px] text-slate-500 dark:text-slate-400",children:t}),L("div",{className:"truncate font-semibold text-slate-900 text-xs dark:text-slate-100",children:d?L("a",{href:d,className:"text-inherit underline-offset-2 hover:underline focus:underline focus:outline-none",target:o,rel:o?"noopener noreferrer":void 0,children:L(pe,{text:a,query:l??"",enabled:u})}):L(pe,{text:a,query:l??"",enabled:u})})]})]}),c?L("button",{type:"button",onClick:()=>n&&s&&i&&n(s,i,t),className:"inline-flex h-6 w-6 items-center justify-center rounded-full border border-slate-200 bg-white text-slate-500 transition-colors hover:border-blue-400 hover:text-blue-500 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:hover:border-blue-400 dark:hover:text-blue-300","aria-label":m.copyField(t),children:r?L(Es,{size:14}):L(Os,{size:14})}):null]})},Qn=({items:e,searchTerm:t,enableHighlighting:a})=>L("dl",{className:"grid grid-cols-1 gap-x-3 gap-y-1.5 sm:grid-cols-2",children:e.map(s=>le("div",{className:"flex flex-col gap-0.5 rounded-md border border-slate-200 bg-white/60 px-2 py-1 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[L("dt",{className:"font-semibold text-[10px] text-slate-500 uppercase tracking-wide dark:text-slate-400",children:s.label}),L("dd",{className:"wrap-break-word text-slate-900 text-xs dark:text-slate-100",children:L(pe,{text:s.value,query:t??"",enabled:a})})]},s.fieldKey))}),on=({title:e})=>L("h3",{className:"font-semibold text-slate-700 text-xs dark:text-slate-200",children:e}),Us=()=>{let e=q();return le("div",{className:"flex h-full min-h-40 w-full flex-1 flex-col items-center justify-center gap-2 rounded-xl border border-slate-300 border-dashed bg-white/60 p-4 text-center transition-colors dark:border-slate-700 dark:bg-slate-900/40",children:[L("p",{className:"font-medium text-slate-600 text-xs dark:text-slate-200",children:e.detailEmptyTitle}),L("p",{className:"text-[11px] text-slate-500 dark:text-slate-400",children:e.detailEmptyHint})]})},Ye=({contact:e,searchTerm:t,enableHighlighting:a,style:s,className:i=""})=>{let n=q(),[r,d]=zs(null),l=Fs(null),u=ba(()=>({...qn,...s}),[s]);As(()=>()=>{l.current!==null&&window.clearTimeout(l.current)},[]);let m=ba(()=>la(e),[e]),c=ba(()=>da(e),[e]),o=ba(()=>Te(e?.contacted_at??null),[e?.contacted_at]),p=Is(async(y,h,x)=>{try{await navigator.clipboard.writeText(h),d(y),l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{d(null)},2e3)}catch(O){Qe.error("Failed to copy contact detail",O)}},[]);if(!e)return L("div",{className:"flex h-full min-h-0 w-full flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-950",style:qn,children:L(Us,{})});let f=[K(e.title),K(e.department)].filter(y=>y!=="-"),v=[f.join(" / "),K(e.company_name)].filter(y=>y&&y!=="-").join(" \u30FB ")||"-",T=K(e.full_name),C=[{fieldKey:"full_name",label:n.fieldFullName,value:T==="-"?n.noName:T},{fieldKey:"full_name_reading",label:n.fieldFullNameReading,value:K(e.full_name_reading)},{fieldKey:"title",label:n.fieldTitle,value:K(e.title)},{fieldKey:"department",label:n.fieldDepartment,value:K(e.department)},{fieldKey:"company_name",label:n.fieldCompanyName,value:K(e.company_name)},{fieldKey:"company_name_reading",label:n.fieldCompanyNameReading,value:K(e.company_name_reading)},{fieldKey:"address",label:n.fieldAddress,value:K(e.address)},{fieldKey:"postal_code",label:n.fieldPostalCode,value:K(e.postal_code)},{fieldKey:"url",label:n.fieldUrl,value:K(e.url)}],z=[{label:n.fieldCustomEmail,value:K(e.custom_email),fieldKey:"custom_email",rawValue:e.custom_email},{label:n.fieldEmail,value:K(e.email),fieldKey:"email",rawValue:e.email}].filter(y=>y.value!=="-"),k=[{label:n.fieldCustomMobilePhone,value:K(e.custom_mobile_phone_number),fieldKey:"custom_mobile_phone_number",rawValue:e.custom_mobile_phone_number},{label:n.fieldMobilePhone,value:K(e.mobile_phone_number),fieldKey:"mobile_phone_number",rawValue:e.mobile_phone_number},{label:n.fieldCompanyPhone,value:K(e.company_phone_number),fieldKey:"company_phone_number",rawValue:e.company_phone_number},{label:n.fieldCompanyFax,value:K(e.company_fax_number),fieldKey:"company_fax_number",rawValue:e.company_fax_number}].filter(y=>y.value!=="-"),b=[{fieldKey:"person_id",label:"person_id",value:K(e.person_id)},{fieldKey:"person_id_redirect_to",label:"person_id_redirect_to",value:K(e.person_id_redirect_to)},{fieldKey:"is_active",label:"is_active",value:K(e.is_active)},{fieldKey:"is_contact_synced",label:"is_contact_synced",value:K(e.is_contact_synced)},{fieldKey:"is_incomplete",label:"is_incomplete",value:K(e.is_incomplete)},{fieldKey:"is_in_eight",label:"is_in_eight",value:K(e.is_in_eight)},{fieldKey:"created_by",label:n.fieldCreatedBy,value:K(e.created_by)},{fieldKey:"created_at",label:n.fieldCreatedAt,value:Te(e.created_at)},{fieldKey:"updated_by",label:n.fieldUpdatedBy,value:K(e.updated_by)},{fieldKey:"updated_at",label:n.fieldUpdatedAt,value:Te(e.updated_at)}],g=[{rowKey:"person_id",icon:Ds,label:"person_id",value:K(e.person_id),fieldKey:"person_id",copyValue:String(e.person_id)},{rowKey:"primary_email",icon:Hs,label:n.summaryEmail,value:m.value??"-",fieldKey:"primary_email",copyValue:m.value,linkHref:ze(m.value,!1)},{rowKey:"primary_phone",icon:Ws,label:n.summaryPhone,value:c.value??"-",fieldKey:"primary_phone",copyValue:c.value,linkHref:_t(c.value)},{rowKey:"contacted_at",icon:Ms,label:n.summaryLastContact,value:o}],E=[{sectionKey:"email",title:n.sectionEmail,emptyText:n.sectionEmailEmpty,entries:z,recommendedKey:m.fieldKey??null,resolveHref:y=>ze(y!=null?String(y):null,!1)},{sectionKey:"phone",title:n.sectionPhone,emptyText:n.sectionPhoneEmpty,entries:k,recommendedKey:c.fieldKey??null,resolveHref:y=>_t(y!=null?String(y):null)}],V=[{value:"summary",label:n.detailTabSummary,content:le("div",{className:"flex flex-col gap-4",children:[le("div",{className:"flex flex-col gap-1",children:[le("div",{className:"flex items-center gap-2 text-slate-600 text-sm dark:text-slate-300",children:[L(Rs,{size:16}),L("span",{children:L(pe,{text:K(e.company_name),query:t??"",enabled:a})})]}),f.length>0?L("div",{className:"text-slate-600 text-sm dark:text-slate-300",children:f.map((y,h)=>le("span",{children:[h>0&&" / ",L(pe,{text:y,query:t??"",enabled:a})]},`header-line-${h}`))}):null]}),L("div",{className:"flex flex-col gap-3",children:g.map(y=>L(Bs,{icon:y.icon,label:y.label,value:y.value,fieldKey:y.fieldKey,copyValue:y.copyValue,onCopy:p,isCopied:y.fieldKey?r===y.fieldKey:!1,linkHref:y.linkHref,searchTerm:t,enableHighlighting:a},y.rowKey))})]})},{value:"basic",label:n.detailTabBasic,content:le("div",{className:"flex flex-col gap-3",children:[L(on,{title:n.detailBasicProfile}),L(Qn,{items:C,searchTerm:t,enableHighlighting:a})]})},{value:"contact",label:n.detailTabContact,content:L("div",{className:"flex flex-col gap-4",children:E.map(({sectionKey:y,title:h,emptyText:x,entries:O,recommendedKey:D,resolveHref:Z})=>le("div",{className:"flex flex-col gap-2",children:[L(on,{title:h}),O.length===0?L("p",{className:"text-slate-500 text-xs dark:text-slate-400",children:x}):L("div",{className:"flex flex-col gap-2",children:O.map(w=>{let P=Z(w.rawValue),H=w.fieldKey===D;return le("div",{className:"flex items-center justify-between rounded-lg border border-slate-200 bg-white px-3 py-2 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[le("div",{children:[L("div",{className:"font-medium text-slate-500 text-xs dark:text-slate-400",children:w.label}),L("div",{className:"text-slate-900 text-sm dark:text-slate-100",children:P?L("a",{href:P,className:"text-inherit underline-offset-2 hover:underline focus:underline focus:outline-none",children:L(pe,{text:w.value,query:t??"",enabled:a})}):L(pe,{text:w.value,query:t??"",enabled:a})})]}),H?le("span",{className:"inline-flex items-center gap-1 rounded-full bg-emerald-100 px-2 py-0.5 font-semibold text-[11px] text-emerald-700 transition-colors dark:bg-emerald-300/20 dark:text-emerald-200",children:[L(Ls,{size:14}),n.preferred]}):null]},w.fieldKey)})})]},y))})},{value:"meta",label:n.detailTabMeta,content:le("div",{className:"flex flex-col gap-3",children:[L(on,{title:n.detailTabMeta}),L(Qn,{items:b,searchTerm:t,enableHighlighting:a})]})}];return le("div",{className:`flex h-full min-h-0 w-full flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-950 ${i}`.trim(),style:u,children:[L("div",{className:"border-slate-200 border-b px-3 py-1.5 transition-colors dark:border-slate-700 dark:bg-slate-900/50",children:le("div",{className:"flex items-center gap-2",children:[L("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-blue-50 text-blue-600 transition-colors dark:bg-sky-900/40 dark:text-sky-300",children:L(_s,{size:16})}),le("div",{className:"min-w-0 flex-1",children:[L("div",{className:"truncate font-semibold text-slate-900 text-sm dark:text-slate-100",children:L(pe,{text:K(e.full_name),query:t??"",enabled:a})}),L("div",{className:"truncate text-[11px] text-slate-600 dark:text-slate-300",children:L(pe,{text:v,query:t??"",enabled:a})})]})]})}),le(fa,{defaultValue:"summary",className:"flex flex-1 flex-col overflow-hidden",children:[L(Bt,{className:"flex gap-1.5 border-slate-200 border-b bg-slate-50 px-2 py-1 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:V.map(y=>L(ut,{value:y.value,className:"rounded-md px-1.5 py-0.5 font-semibold text-[11px] transition-colors data-[state=active]:bg-white data-[state=active]:text-blue-600 dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-sky-300",children:y.label},y.value))}),V.map(y=>L(mt,{value:y.value,className:"scrollbar-thin flex-1 overflow-y-auto px-2.5 py-2 transition-colors dark:text-slate-200",children:y.content},y.value))]})]})};lt();oe();import{memo as $s}from"react";import{jsx as Xe,jsxs as ya}from"react/jsx-runtime";var ln=$s(({recordCount:e,companyCount:t,phase:a,loadedCount:s,totalCount:i,errorMessage:n,onRetry:r})=>{let{locale:d,labels:l}=he(),u=G(d,e),m=G(d,t);return ya("div",{"data-testid":"contact-map-annotation",className:"flex flex-wrap items-center gap-2 leading-1 transition-colors",role:"status",children:[ya("span",{className:"flex items-baseline gap-1",children:[Xe("span",{className:"text-slate-600 dark:text-slate-300",children:l.annotationTotalLabel}),Xe("span",{className:"text-slate-800 dark:text-slate-200","data-testid":"contact-map-record-count",children:u}),Xe("span",{className:"text-slate-600 dark:text-slate-300",children:l.recordUnit(u)})]}),ya("span",{className:"flex items-baseline gap-1",children:[Xe("span",{className:"text-slate-600 dark:text-slate-300",children:l.annotationCompaniesLabel}),Xe("span",{className:"text-slate-800 dark:text-slate-200","data-testid":"contact-map-company-count",children:m}),Xe("span",{className:"text-slate-600 dark:text-slate-300",children:l.companyUnit(m)})]}),a==="streaming"||a==="retrying"||a==="idle"?Xe("span",{"data-testid":"contact-map-stream-badge",className:"ml-2 inline-flex items-center gap-1.5 rounded-full bg-blue-50 px-2 py-0.5 font-medium text-blue-700 text-xs dark:bg-blue-900/30 dark:text-blue-300",children:i!==null&&i>0?l.annotationStreamingProgress({loaded:s,total:i,percent:Math.min(100,Math.round(s/i*100))}):l.annotationStreamingCount(s)}):null,a==="failed"||a==="auth-required"?ya("span",{"data-testid":"contact-map-error-badge",className:"ml-2 inline-flex items-center gap-1.5 rounded-full bg-rose-50 px-2 py-0.5 font-medium text-rose-700 text-xs dark:bg-rose-900/30 dark:text-rose-300",title:n??void 0,children:["\u26D4 ",l.annotationLoadFailed(s),r?Xe("button",{type:"button","data-testid":"contact-map-retry-button",onClick:r,className:"rounded border border-rose-300 bg-white px-1.5 py-0.5 font-semibold text-rose-700 transition-colors hover:bg-rose-100 dark:border-rose-700 dark:bg-rose-950 dark:text-rose-200 dark:hover:bg-rose-900",children:l.annotationRetry}):null]}):null]})});ln.displayName="ContactMapAnnotation";import{useMemo as Nn}from"react";oe();import{createContext as Vs,useContext as Ks,useMemo as js}from"react";import{jsx as Yn}from"react/jsx-runtime";var Xn={streamEndpoint:"/api/contact_map/stream"},Jn=Vs(Xn);function Zn({config:e,children:t}){let a=js(()=>({...Xn,...e}),[e]);return Yn(Jn.Provider,{value:a,children:Yn(Wn,{locale:a.locale,labels:a.labels,children:t})})}function Je(){return Ks(Jn)}import{useEffect as Zs,useMemo as ei,useSyncExternalStore as ti}from"react";var Gs=1e3,qs=3e4,Qs=6,Ys="/api/contact_map/stream",Xs=e=>({...e,contacted_at:e.contacted_at?new Date(e.contacted_at):null,created_at:e.created_at?new Date(e.created_at):void 0,updated_at:e.updated_at?new Date(e.updated_at):void 0}),Js=e=>Array.isArray(e.records),xa=class{constructor(t={}){this.recordMap=new Map;this.listeners=new Set;this.lastCursor=null;this.consecutiveFailures=0;this.started=!1;this.disposed=!1;this.activeController=null;this.wakeRetryWait=null;this.state={records:[],loadedCount:0,totalCount:null,isLoading:!0,isComplete:!1,phase:"idle",error:null};this.handleOnline=()=>{this.wakeRetryWait?.()};this.fetchFn=t.fetchFn??((...a)=>fetch(...a)),this.endpoint=t.endpoint??Ys,this.initialRetryDelayMs=t.initialRetryDelayMs??Gs,this.maxRetryDelayMs=t.maxRetryDelayMs??qs,this.maxConsecutiveFailures=t.maxConsecutiveFailures??Qs,this.logger=t.logger??Qe}getState(){return this.state}getRecordMap(){return this.recordMap}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}start(){this.started||this.disposed||(this.started=!0,typeof window<"u"&&window.addEventListener("online",this.handleOnline),this.runStreamLoop())}retry(){this.disposed||this.state.phase!=="failed"||(this.consecutiveFailures=0,this.setState({error:null,isLoading:this.recordMap.size===0}),this.runStreamLoop())}retryNow(){this.retry()}dispose(){this.disposed=!0,this.activeController?.abort(),this.wakeRetryWait?.(),typeof window<"u"&&window.removeEventListener("online",this.handleOnline)}setState(t){this.state={...this.state,...t};for(let a of this.listeners)a(this.state)}publishRecords(t={}){let a=Array.from(this.recordMap.values());this.setState({records:a,loadedCount:a.length,isLoading:!1,...t})}async runStreamLoop(){for(this.setState({phase:"streaming"});!this.disposed;){let t=await this.streamOnce();if(t==="aborted")return;if(t==="complete"){this.publishRecords({isComplete:!0,phase:"complete",error:null});return}if(t==="auth-required"){this.setState({phase:"auth-required",isLoading:!1,error:new Error("Authentication required")});return}if(this.consecutiveFailures+=1,this.consecutiveFailures>=this.maxConsecutiveFailures){this.setState({phase:"failed",isLoading:!1});return}let a=Math.min(this.initialRetryDelayMs*2**(this.consecutiveFailures-1),this.maxRetryDelayMs);if(this.setState({phase:"retrying",isLoading:this.recordMap.size===0}),this.logger.warn(`[ContactMapStream] retrying in ${a}ms (attempt ${this.consecutiveFailures})`),await this.waitBeforeRetry(a),this.disposed)return;this.setState({phase:"streaming"})}}waitBeforeRetry(t){return new Promise(a=>{let s=setTimeout(()=>{this.wakeRetryWait=null,a()},t);this.wakeRetryWait=()=>{clearTimeout(s),this.wakeRetryWait=null,a()}})}buildStreamUrl(){if(!this.lastCursor)return this.endpoint;let t=this.endpoint.includes("?")?"&":"?",a=new URLSearchParams;return this.lastCursor.contacted_at!==null&&a.set("cursor_contacted_at",this.lastCursor.contacted_at),a.set("cursor_person_id",String(this.lastCursor.person_id)),`${this.endpoint}${t}${a.toString()}`}async streamOnce(){this.activeController=new AbortController;try{let t=await this.fetchFn(this.buildStreamUrl(),{signal:this.activeController.signal,credentials:"same-origin"});if(t.status===401||t.status===403)return"auth-required";if(!(t.ok&&t.body))return this.logger.warn(`[ContactMapStream] unexpected response: ${t.status}`),"retryable";let a=t.body.getReader(),s=new TextDecoder,i="",n=!1,r=!1;for(;;){let{done:d,value:l}=await a.read();if(d)break;let u=s.decode(l,{stream:!0}),m=(i+u).split(`
2
- `);i=m.pop()??"";let c=!1;for(let o of m){let p=o.trim();if(!p)continue;let f;try{f=JSON.parse(p)}catch(v){this.logger.warn("[ContactMapStream] failed to parse NDJSON line:",v);continue}if("type"in f&&f.type==="METADATA"){typeof f.total=="number"&&Number.isFinite(f.total)&&this.setState({totalCount:f.total});continue}if(!Js(f)){this.logger.warn("[ContactMapStream] server reported error:","error"in f?f.error:""),r=!0;continue}for(let v of f.records)v&&typeof v.person_id=="number"&&(this.recordMap.set(v.person_id,Xs(v)),c=!0);typeof f.total=="number"&&Number.isFinite(f.total)&&this.setState({totalCount:f.total}),f.nextCursor&&(this.lastCursor=f.nextCursor),f.isLast&&(n=!0)}c&&(this.consecutiveFailures=0,this.publishRecords({error:null}))}return r?(this.setState({error:new Error("Stream interrupted by server error")}),"retryable"):n?"complete":(this.setState({error:new Error("Stream ended before completion")}),"retryable")}catch(t){if(t instanceof Error&&t.name==="AbortError")return"aborted";let a=t instanceof Error?t:new Error(String(t));return this.setState({error:a}),"retryable"}finally{this.activeController=null}}};var va=null,er=e=>(va??(va=new xa({endpoint:e})),va),ud=()=>{va?.dispose(),va=null},tr=()=>er().getRecordMap(),ai={records:[],loadedCount:0,totalCount:null,isLoading:!0,isComplete:!1,phase:"idle",error:null};function Ca(e){let t=Je(),a=e??t.streamEndpoint??"/api/contact_map/stream",s=ei(()=>er(a),[a]);return Zs(()=>{s.start(),s.retry()},[s]),{...ti(n=>s.subscribe(n),()=>s.getState(),()=>ai),retryNow:()=>s.retryNow()}}oe();import{DEFAULT_FUZZY_SEARCH_OPTIONS as Sn}from"@aiquants/fuzzy-search";import{useFuzzySearch as No}from"@aiquants/fuzzy-search/react";import wo from"lucide-react/dist/esm/icons/search.js";import{useCallback as Yt,useEffect as Ue,useMemo as at,useRef as _r,useState as He,useTransition as Po}from"react";import{useNavigation as Lo,useSearchParams as Ro}from"react-router";en();import{useCallback as gt,useEffect as ni,useRef as ar}from"react";var Ze=e=>{let t=ar(null),a=ar({isPointerDown:!1,isDragging:!1,startX:0,scrollLeft:0,pointerId:0,hasCapture:!1,didDrag:!1,pointerType:""}),s=e?.dragThreshold??4,i=gt(c=>{let o=c.currentTarget,p=c.deltaY;!o||p===0||(c.preventDefault(),o.scrollBy({left:p,behavior:"smooth"}))},[]),n=gt(c=>{t.current?.removeEventListener("wheel",i),t.current=c,c?.addEventListener("wheel",i,{passive:!1})},[i]);ni(()=>()=>{t.current&&t.current.removeEventListener("wheel",i)},[i]);let r=gt(c=>{if(c.pointerType==="touch")return;let o=a.current;o.isPointerDown=!0,o.isDragging=!1,o.startX=c.clientX,o.scrollLeft=c.currentTarget.scrollLeft,o.pointerId=c.pointerId,o.hasCapture=!1,o.pointerType=c.pointerType},[]),d=gt(c=>{let o=a.current;if(!o.isPointerDown||o.pointerType==="touch")return;let p=c.currentTarget,f=c.clientX-o.startX;!o.isDragging&&Math.abs(f)>s&&(o.isDragging=!0,o.hasCapture||(p.setPointerCapture?.(c.pointerId),o.hasCapture=!0)),o.isDragging&&(c.preventDefault(),p.scrollLeft=o.scrollLeft-f)},[s]),l=gt(c=>{let o=a.current;if(o.pointerType==="touch")return;let p=c.currentTarget;o.isPointerDown&&o.hasCapture&&p.hasPointerCapture?.(c.pointerId)&&p.releasePointerCapture(c.pointerId),o.isDragging&&(o.didDrag=!0,window.setTimeout(()=>{o.didDrag=!1},0)),o.isPointerDown=!1,o.isDragging=!1,o.pointerId=0,o.hasCapture=!1},[]),u=gt(c=>{l(c)},[l]),m=gt(c=>{a.current.didDrag&&(c.preventDefault(),c.stopPropagation(),a.current.didDrag=!1)},[]);return{setScrollableRef:n,onPointerDown:r,onPointerMove:d,onPointerUp:u,onPointerLeave:u,onPointerCancel:u,onClickCapture:m}};lt();oe();import{jsx as nr}from"react/jsx-runtime";function rr({value:e,max:t=100,className:a,indicatorClassName:s,...i}){let n=e===void 0,r=n?0:Math.min(100,Math.max(0,e/t*100));return nr("div",{role:"progressbar","aria-valuenow":n?void 0:r,"aria-valuemin":0,"aria-valuemax":100,"data-slot":"progress",className:pt("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",a),...i,children:nr("div",{"data-slot":"progress-indicator",className:pt("h-full rounded-full bg-primary transition-[width] duration-300 ease-in-out will-change-transform",n&&"w-1/3 animate-progress-indeterminate",s),style:n?void 0:{width:`${r}%`}})})}import{useCallback as uo,useState as mo}from"react";import{useSearchParams as go}from"react-router";oe();ct();import{Panel as pr,PanelGroup as bi,PanelResizeHandle as yi}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as xi,VirtualScroll as vi}from"@aiquants/virtualscroll";import{lazy as Ci,memo as ki,Suspense as Si,useCallback as Be,useEffect as gr,useLayoutEffect as hr,useMemo as Kt,useRef as jt,useState as wa}from"react";var Ut={listPanelMinWidth:320,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35},$t={listPanelMinWidth:280,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35};function ka(e){let t=e.listPanelMinWidth+e.detailPanelMinWidth+e.handleThickness+e.listPaddingAndBorder+e.detailPaddingAndBorder,a=t+e.scrollbarSafetyBuffer,s=a+e.hysteresisSafetyMargin,i=s-a;return{physicalMinWidth:t,collapseThreshold:a,expandThreshold:s,hysteresisWidth:i}}import{useCallback as ri,useEffect as si,useState as ii}from"react";var sr=(e,t)=>{let{enableMutationObserver:a=!1,bottomGap:s=4,minFallbackHeight:i=240}=t??{},[n,r]=ii(600),d=ri(()=>{if(typeof window>"u")return;let l=e.current;if(!l||l.offsetParent===null&&window.getComputedStyle(l).position!=="fixed")return;let u=x=>Number.parseFloat(x)||0,{top:m}=l.getBoundingClientRect(),c=l.parentElement?.getBoundingClientRect(),o=window.getComputedStyle(document.documentElement),p=u(o.getPropertyValue("--footer-height")),f=u(o.getPropertyValue("--header-height")),v=u(o.getPropertyValue("--scrollbar-height")),T=window.getComputedStyle(l),C=u(T.marginBottom),z=u(T.paddingBottom),k=window.innerHeight-p-v-s,b=c?Math.min(c.bottom,k):k,g=c?Math.max(c.top,f):f,E=Math.max(m,g),V=b-E-C-z,y=Number.isFinite(V)?Math.floor(V):0,h=y>0?y:i;h>0&&Number.isFinite(h)&&r(x=>Math.abs(x-h)>1?h:x)},[s,e,i]);return si(()=>{if(typeof window>"u")return;let l=null,u=null,m=null,c=null,o=()=>{l!==null&&window.cancelAnimationFrame(l),l=window.requestAnimationFrame(()=>{d()})};o(),u=window.setTimeout(()=>{o()},150);let p=e.current;return typeof ResizeObserver<"u"&&p&&(m=new ResizeObserver(()=>{o()}),m.observe(p),p.parentElement&&m.observe(p.parentElement)),a&&typeof MutationObserver<"u"&&(c=new MutationObserver(()=>{o()}),c.observe(document.body,{attributes:!0,childList:!0,subtree:!0})),window.addEventListener("resize",o),()=>{l!==null&&window.cancelAnimationFrame(l),u!==null&&window.clearTimeout(u),m&&m.disconnect(),c&&c.disconnect(),window.removeEventListener("resize",o)}},[e,a,d]),{viewportHeight:n,updateViewportHeight:d}};import{useCallback as et,useEffect as ir,useRef as Vt,useState as or}from"react";var oi=600,lr=8,Sa=({ref:e,onSelect:t,resolveItem:a,item:s})=>{let[i,n]=or(!1),[r,d]=or(null),l=Vt(null),u=Vt(!1),m=Vt(!1),c=Vt(null),o=Vt({onSelect:t,resolveItem:a,item:s});ir(()=>{o.current={onSelect:t,resolveItem:a,item:s}},[t,a,s]);let p=et(()=>{typeof window>"u"||l.current!==null&&(window.clearTimeout(l.current),l.current=null)},[]),f=et(()=>{c.current&&(p(),m.current=!1,c.current=null)},[p]),v=et(g=>{typeof window>"u"||g.button!==0&&g.pointerType==="mouse"||(p(),m.current=!1,u.current=!1,c.current={x:g.clientX,y:g.clientY,pointerId:g.pointerId},l.current=window.setTimeout(()=>{let E=o.current,V=null;E.item!==void 0?V=E.item:E.resolveItem&&g.target&&(V=E.resolveItem(g.target)),V!==null&&(u.current=!0,E.onSelect?.(V),d(V),n(!0)),f()},oi))},[p,f]),T=et(g=>{c.current&&g.pointerId===c.current.pointerId&&(p(),c.current=null,m.current=!1)},[p]),C=et(g=>{u.current&&(g.preventDefault(),g.stopPropagation(),u.current=!1)},[]),z=et(g=>{if(!c.current||g.pointerId!==c.current.pointerId)return;let E=Math.abs(g.clientX-c.current.x),V=Math.abs(g.clientY-c.current.y);(E>lr||V>lr)&&(p(),c.current=null)},[p]),k=et(g=>{(i||l.current!==null)&&(g.preventDefault(),g.stopPropagation())},[i]),b=et(g=>{g?.cancelLongPressTimer&&p(),g?.suppressLongPress&&(m.current=!0),n(!1),d(null),u.current=!1,c.current=null},[p]);return ir(()=>{let g=e.current;if(!(g&&typeof window<"u"))return;let E=[["pointerdown",v,void 0],["pointerup",T,void 0],["pointercancel",T,void 0],["pointermove",z,void 0],["pointerleave",T,void 0],["click",C,!0],["contextmenu",k,void 0]],V=[["contextmenu",k,!0],["pointerup",T,!0],["pointercancel",T,!0]];for(let[y,h,x]of E)g.addEventListener(y,h,x);for(let[y,h,x]of V)window.addEventListener(y,h,x);return()=>{for(let[y,h,x]of E)g.removeEventListener(y,h,x);for(let[y,h,x]of V)window.removeEventListener(y,h,x);p()}},[e,v,T,z,C,k,p]),{isPopupVisible:i,popupItem:r,handleClosePopup:b}};import{useCallback as li,useEffect as di,useState as dr,useSyncExternalStore as ci}from"react";function Ta(e,t,a){let s=a?.mediaQuery??"(min-width: 1024px)",i=ci(li(m=>{if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};let c=window.matchMedia(s);return c.addEventListener("change",m),()=>c.removeEventListener("change",m)},[s]),()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(s).matches:!0,()=>!1),[n,r]=dr(!1),[d,l]=dr(0);return di(()=>{if(typeof window>"u"||typeof ResizeObserver>"u")return;let m=e.current;if(!m)return;let c=new ResizeObserver(o=>{for(let p of o){if(p.target!==m)continue;let f=0;p.borderBoxSize&&p.borderBoxSize.length>0?f=p.borderBoxSize[0].inlineSize:f=p.contentRect.width,!(!Number.isFinite(f)||f<=0)&&(l(f),r(v=>v&&f>=t.expandThreshold?!1:!v&&f<t.collapseThreshold?!0:v))}});return c.observe(m),()=>c.disconnect()},[e,t.collapseThreshold,t.expandThreshold]),{isTwoColumn:i&&!n,isContainerNarrow:n,isMediaMatches:i,containerWidth:d}}oe();oe();import{useSwipeToDismissOverlay as pi,useTapClick as ui}from"@aiquants/swipe-overlay";import{useCallback as mi,useEffect as gi,useRef as hi}from"react";import{jsx as cr,jsxs as fi}from"react/jsx-runtime";var Na=({isOpen:e,onClose:t,children:a,className:s="",title:i})=>{let n=q(),r=hi(null),{overlayRef:d,overlayStyle:l,attemptClose:u}=pi({isOpen:e,onClose:t,isCloseBlocked:mi(()=>!1,[]),skipWhenTextSelected:!0}),m=ui(()=>u());return gi(()=>{!e&&r.current?.contains(document.activeElement)&&document.activeElement.blur()},[e]),e?fi("div",{ref:r,"data-testid":"contact-map-mobile-overlay",className:`fixed top-0 bottom-0 left-0 z-50 flex touch-manipulation transition-[visibility] duration-200 ${e?"pointer-events-auto visible":"pointer-events-none invisible"}`,style:{right:"var(--aqcm-overlay-right, var(--aiquants-menu-pinned-width, 0px))",transition:"right 0.5s, visibility 0.2s"},"aria-hidden":!e,children:[cr("button",{type:"button","aria-label":n.overlayBackdrop,className:`absolute inset-0 touch-manipulation bg-slate-900/50 transition-opacity duration-200 focus:outline-none ${e?"opacity-100":"opacity-0"}`,...m}),cr("aside",{role:"dialog","aria-modal":"true","aria-label":i===void 0?n.overlayTitle:i,style:l,ref:d,className:`relative ml-auto flex h-full w-full max-w-lg transform touch-pan-y flex-col bg-white shadow-xl transition-transform duration-200 ease-out dark:bg-slate-900 ${s}`,onKeyDown:c=>{c.key==="Escape"&&(c.stopPropagation(),u())},children:a})]}):null};Ja();import{Fragment as Ii,jsx as W,jsxs as ye}from"react/jsx-runtime";var Ti=Ci(async()=>({default:(await Promise.resolve().then(()=>(Gn(),jn))).default})),fr=64,ur="h-[64px]",mr=240,Ni=4,dn=ka(Ut),wi=Ut.listPanelMinWidth,Pi=Ut.detailPanelMinWidth,Li=Ut.handleThickness,$d=dn.collapseThreshold,Vd=dn.expandThreshold,Ri=({contactData:e})=>{let t=q(),a=e?.full_name??t.noName,s=e?.title??"-",i=e?.company_name??"-",n=e?.department??"-",r=e?.email??"-",d=e?.company_phone_number??e?.mobile_phone_number??"-",l=e?.updated_at?Te(e.updated_at):"-";return W(pa,{fullName:a,title:s,companyName:i,department:n,phoneNumber:d,email:r,updatedAtText:l})},Mi=e=>({"--contact-panel-height":`${e}px`}),Ei=e=>typeof e=="object"&&e!==null&&"item"in e,Oi=(e,t)=>t!==void 0?`${e}:${t.toFixed(3)}`:void 0,Di=(e,t)=>{for(let a of e){let s=oa(a);if(s?.person_id===t)return s}return null},cn=(e,t,a)=>{let{viewportHeight:s}=sr(t,{enableMutationObserver:!0,bottomGap:Ni,minFallbackHeight:mr}),[i,n]=wa(0),r=Be(()=>{let c=a.current,o=t.current;if(!(c&&o))return;let p=c.getBoundingClientRect(),f=o.getBoundingClientRect(),v=Math.ceil(f.top-p.top);Number.isFinite(v)&&v>0&&n(T=>Math.abs(T-v)>1?v:T)},[t,a]);hr(()=>{if(!e)return;r();let c=requestAnimationFrame(r);return window.addEventListener("resize",r),()=>{cancelAnimationFrame(c),window.removeEventListener("resize",r)}},[e,r]);let d=s>0?s:mr,l=i>0?i:0,u=d+l,m=Kt(()=>Mi(u),[u]);return{normalizedViewportHeight:d,normalizedDetailHeight:u,panelSizingStyle:m}},Hi=new Set,Wi=()=>{let[e,t]=wa(Hi),a=Be((s,i)=>{t(n=>{if(n.has(s)===i)return n;let r=new Set(n);return i?r.add(s):r.delete(s),r})},[]);return{isAnyPopupVisible:e.size>0,handlePopupVisibilityChange:a}},_i=(e,t,a)=>{let s=jt(a);hr(()=>{s.current=a},[a]),gr(()=>{if(e!==null)return s.current(e,t),()=>{s.current(e,!1)}},[e,t])},br=ki(({entry:e,index:t,selectedPersonId:a,onSelect:s,searchQuery:i,enableHighlighting:n,openEmailsWithGmail:r,openGmailCompose:d,onPopupVisibilityChange:l})=>{let u=q(),m=jt(null),c=W("div",{className:ur}),o=Ei(e)?e:null,p=oa(e),{isPopupVisible:f,handleClosePopup:v}=Sa({ref:m,onSelect:s,item:p?.person_id});if(_i(p?.person_id??null,f,l),!e||!p)return c;let{person_id:T}=p,C=a===T,z=t%2===0?"bg-white dark:bg-slate-900":"bg-gray-50 dark:bg-slate-900/70",b=C?"border-blue-300 bg-blue-50 ring-1 ring-blue-200 dark:border-blue-500 dark:bg-blue-500/20 dark:ring-blue-500/40":z,g=["B","F"].map(E=>Oi(E,E==="B"?o?.baseScore:o?.score)).filter(Boolean);return ye("div",{ref:m,className:`flex ${ur} w-full items-center overflow-hidden border-gray-200 border-b px-4 py-2 text-left transition-colors hover:bg-blue-50 dark:border-slate-700 dark:hover:bg-blue-500/10 ${b}`,style:{height:fr},role:"button","aria-pressed":C,"data-selected":C?"true":"false",onClick:()=>s(T),children:[ye("div",{className:"hidden w-28 shrink-0 flex-col items-center gap-0.5 text-center sm:flex",children:[W("div",{className:"whitespace-nowrap font-medium text-slate-700 text-xs leading-tight dark:text-slate-200",children:u.listRowNumber(t+1)}),W("div",{className:"truncate text-[11px] text-slate-700 leading-tight dark:text-slate-200",children:T}),W("div",{className:"flex items-center gap-1 whitespace-nowrap font-mono text-[11px] text-slate-600 leading-tight dark:text-slate-300",children:g.length?g.map(E=>W("span",{children:E},E)):W("span",{children:"-"})})]}),W(Si,{fallback:W(Ri,{contactData:p}),children:W(Ti,{contactData:p,searchTerm:i,enableHighlighting:n,openEmailsWithGmail:r,openGmailCompose:d,isPopupVisible:f,onRequestClose:v})})]})});br.displayName="ContactListRow";var yr=({context:e})=>{let{contactMapRecords:t,filteredItems:a,searchQuery:s,hasSearchTerm:i,enableHighlighting:n,openEmailsWithGmail:r,isSearchTabActive:d}=e,{locale:l,labels:u,engineLabels:m}=he(),c=jt(null),o=jt(null),[p,f]=wa(null),{normalizedViewportHeight:v,panelSizingStyle:T}=cn(d,o,c),{isAnyPopupVisible:C,handlePopupVisibilityChange:z}=Wi(),k=Kt(()=>({enablePointerDrag:!C,enableKeyboardNavigation:!C}),[C]),b=Kt(()=>i?a:t,[i,a,t]),g=Be(ie=>{f(ie)},[]),E=Be(ie=>{if(!r)return;let ne=ie.trim();if(!ne||ne==="-"||typeof window>"u")return;let nt=ze(ne,!0);nt&&window.open(nt,"_blank","noopener,noreferrer")},[r]),[V,y]=wa(!1),h=Be(ie=>{g(ie),y(!0)},[g]),x=Be((ie,ne)=>W(br,{entry:ie,index:ne,selectedPersonId:p,onSelect:h,searchQuery:s,enableHighlighting:n,openEmailsWithGmail:r,openGmailCompose:E,onPopupVisibilityChange:z}),[p,h,s,n,r,E,z]),O=Be(ie=>b[ie],[b]),D=Be(ie=>oa(b[ie])?.person_id??`row-${ie}`,[b]),Z=Be(()=>fr,[]),w=b.length,P=Kt(()=>({enabled:!0,renderVisual:xi}),[]),H=Kt(()=>p===null?null:Di(b,p),[p,b]);gr(()=>{p!==null&&!H&&f(null)},[p,H]);let B=jt(null),{isTwoColumn:ae}=Ta(B,dn),ue=ye("div",{ref:c,className:"flex min-h-0 flex-1 flex-col gap-1",children:[W("div",{className:"hidden rounded-t-lg border border-gray-200 bg-gray-50 px-4 py-2 transition-colors sm:block dark:border-slate-700 dark:bg-slate-900/70",children:ye("div",{className:"flex items-center",children:[ye("div",{className:"flex w-28 shrink-0 flex-col items-center gap-0.5 text-center text-[11px] text-slate-700 uppercase tracking-wider dark:text-slate-200",children:[W("span",{className:"font-semibold text-slate-900 text-xs dark:text-slate-100",children:u.columnNo}),W("span",{className:"leading-tight",children:u.columnId}),W("span",{className:"whitespace-nowrap leading-tight",children:u.columnScore})]}),ye("div",{className:"hidden w-full grid-cols-3 gap-2 font-medium text-slate-700 text-xs uppercase tracking-wider transition-colors sm:grid xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto] dark:text-slate-200",children:[ye("div",{className:"flex flex-col gap-0.5",children:[W("span",{children:u.columnName}),W("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:u.columnTitle})]}),ye("div",{className:"flex flex-col gap-0.5",children:[W("span",{children:u.columnCompany}),W("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:u.columnDepartment})]}),ye("div",{className:"flex flex-col gap-0.5",children:[W("span",{children:u.columnPhone}),W("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:u.columnEmail})]}),W("div",{className:"hidden items-end justify-end xl:flex",children:W("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:u.columnUpdatedAt})})]})]})}),W("div",{ref:o,className:"flex-1",children:W(vi,{itemCount:w,getItemKey:D,behaviorOptions:k,getItem:O,getItemHeight:Z,viewportSize:v,overscanCount:10,scrollBarOptions:{width:8,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:P},locale:l,labels:m,className:"w-full rounded-b-lg border border-gray-200 border-t-0 bg-white pr-0.75 transition-colors dark:border-slate-700 dark:bg-slate-950",children:(ie,ne)=>x(ie,ne)})}),a.length===0&&i?W("div",{className:"py-8 text-center",children:W("p",{className:"text-slate-600 dark:text-slate-300",children:u.listNoSearchResults})}):null,w===0&&!i?W("div",{className:"py-8 text-center",children:W("p",{className:"text-slate-600 dark:text-slate-300",children:u.listNoData})}):null]});return W("div",{ref:B,"data-testid":"contact-map-list-root",className:"flex min-h-0 flex-1 flex-col",style:T,children:ae?ye(bi,{id:"contact-map-list-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-list-panel-group",children:[W(pr,{id:"contact-map-list-pane",defaultSize:{value:68,unit:"percentage"},minSize:{value:wi,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:ue}),W(yi,{id:"contact-map-list-handle",thickness:Li,indicator:{visible:!0,thickness:6,length:32,barThickness:2,barLength:16},className:"cursor-col-resize rounded transition-colors hover:bg-slate-200/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-1 dark:hover:bg-slate-700/60","aria-label":u.listResizeHandle}),W(pr,{id:"contact-map-list-detail-pane",defaultSize:{value:32,unit:"percentage"},minSize:{value:Pi,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:W(Ye,{contact:H,searchTerm:s,enableHighlighting:n})})]}):ye(Ii,{children:[ue,W("div",{className:"hidden","aria-hidden":"true",children:W(Ye,{contact:H,searchTerm:s,enableHighlighting:n})}),H?W(Na,{isOpen:V,onClose:()=>y(!1),className:"z-50 bg-white dark:bg-slate-900",children:ye("div",{className:"flex h-full flex-col overflow-hidden p-3 sm:p-4",children:[ye("div",{className:"mb-2 flex items-center justify-between border-b pr-10 pb-2 dark:border-slate-700",children:[W("h3",{className:"font-semibold text-slate-900 text-sm dark:text-slate-100",children:u.detailHeading}),W("button",{type:"button",onClick:()=>y(!1),className:"rounded px-2.5 py-1 font-medium text-slate-600 text-xs hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800",children:u.close})]}),W("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",style:{height:"100%"},children:W(Ye,{contact:H,searchTerm:s,enableHighlighting:n})})]})}):null]})})};ct();import{DirectoryTree as Gi}from"@aiquants/directory-tree";import{Panel as Sr,PanelGroup as qi,PanelResizeHandle as Qi}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as Yi}from"@aiquants/virtualscroll";import Xi from"@heroicons/react/24/solid/FolderMinusIcon.js";import Ji from"@heroicons/react/24/solid/FolderPlusIcon.js";import{useCallback as Ee,useEffect as ht,useMemo as Pe,useRef as Ra,useState as tt}from"react";import{createPortal as Zi}from"react-dom";var pn=(e,t)=>e&&e.trim()||t;import{useEffect as Ai,useRef as Pa,useState as Fi}from"react";var xr=(e,t=250)=>{let[a,s]=Fi(e),i=Pa(null),n=Pa(e),r=Pa(null),d=Pa(!1);return Ai(()=>{if(!d.current){d.current=!0,s(e),n.current=e;return}n.current=a,i.current=null;let l=u=>{i.current??(i.current=u);let m=u-i.current,c=Math.min(1,Math.max(0,m/t)),o=1-(1-c)**3,p=Math.max(0,Math.round(n.current+(e-n.current)*o));s(p),c<1&&(r.current=requestAnimationFrame(l))};return r.current=requestAnimationFrame(l),()=>{r.current!==null&&cancelAnimationFrame(r.current)}},[e,t]),Math.max(0,a)};import{useEffect as zi,useMemo as vr,useSyncExternalStore as Bi}from"react";oe();var Ui=250,$i=4e3,Cr=3,Vi=(e,t)=>e.uncategorizedCompany===t.uncategorizedCompany&&e.unnamedPerson===t.unnamedPerson,La=class{constructor(t){this.worker=null;this.generation=0;this.postedCount=0;this.latestSnapshot=null;this.workerNeedsReset=!1;this.lastSyncedRecords=[];this.postedNaming=null;this.lastSyncedNaming=null;this.consecutiveFailures=0;this.finalizeRequested=!1;this.retryTimer=null;this.listeners=new Set;this.state={snapshot:null,isBuilding:!1};this.getState=()=>this.state;this.subscribe=t=>(this.listeners.add(t),()=>this.listeners.delete(t));this.handleMessage=t=>{let a=t.data;a.type!=="TREE_CHUNK"||a.generation!==this.generation||a.uniquePersonCount===0&&this.postedCount>0&&(this.latestSnapshot?.uniquePersonCount??0)>0||this.latestSnapshot!==null&&a.uniquePersonCount<this.latestSnapshot.uniquePersonCount&&!(a.isIdle&&a.consumedRecords>=this.postedCount)||(a.isIdle&&a.consumedRecords>=this.postedCount&&(this.consecutiveFailures=0),this.latestSnapshot={tree:a.tree,directoryPaths:a.directoryPaths,consumedRecords:a.consumedRecords,uniquePersonCount:a.uniquePersonCount,isIdle:a.isIdle,rebuildEpoch:a.rebuildEpoch},this.updateState())};this.handleFailure=t=>{if(this.worker?.terminate(),this.worker=null,this.postedCount=0,this.workerNeedsReset=!0,this.consecutiveFailures+=1,this.updateState(),this.consecutiveFailures>=Cr)return;let a=Math.min(Ui*2**(this.consecutiveFailures-1),$i);this.retryTimer!==null&&clearTimeout(this.retryTimer),this.retryTimer=setTimeout(()=>{this.retryTimer=null;let s=this.lastSyncedNaming;s!==null&&(this.syncRecords(this.lastSyncedRecords,s),this.finalizeRequested&&this.finalize())},a)};this.workerFactory=t}updateState(){let t=this.postedCount>(this.latestSnapshot?.consumedRecords??0);this.state.snapshot===this.latestSnapshot&&this.state.isBuilding===t||(this.state={snapshot:this.latestSnapshot,isBuilding:t},this.notify())}notify(){for(let t of this.listeners)t()}ensureWorker(){if(this.consecutiveFailures>=Cr)return null;if(!this.worker)try{this.worker=this.workerFactory(),this.worker.onerror=this.handleFailure,this.worker.onmessageerror=this.handleFailure,this.worker.onmessage=this.handleMessage}catch(t){return this.handleFailure(t),null}return this.worker}syncRecords(t,a){this.lastSyncedRecords=t,this.lastSyncedNaming=a;let s=this.ensureWorker();if(!s)return;let i=this.postedNaming===null||!Vi(this.postedNaming,a);if((this.workerNeedsReset||i||t.length<this.postedCount)&&(this.generation+=1,this.postedCount=0,this.workerNeedsReset=!1,this.postedNaming=a,s.postMessage({type:"RESET_TREE",generation:this.generation,epochBase:this.latestSnapshot?.rebuildEpoch??0,naming:a}),this.updateState()),t.length>this.postedCount){let n=t.slice(this.postedCount);this.postedCount=t.length,s.postMessage({type:"APPEND_RECORDS",generation:this.generation,records:n}),this.updateState()}}finalize(){this.finalizeRequested=!0,this.worker&&this.worker.postMessage({type:"FINALIZE_TREE",generation:this.generation})}dispose(){this.retryTimer!==null&&clearTimeout(this.retryTimer),this.worker?.terminate(),this.worker=null,this.listeners.clear(),this.latestSnapshot=null,this.postedCount=0,this.workerNeedsReset=!1,this.lastSyncedRecords=[],this.postedNaming=null,this.lastSyncedNaming=null,this.consecutiveFailures=0,this.finalizeRequested=!1,this.state={snapshot:null,isBuilding:!1}}},Ki=e=>{if(e)return new Worker(e,{type:"module"});let t=typeof import.meta<"u"?import.meta.url:void 0;if(t){let s=t.includes(".ts")?"../workers/treeWorker.ts":"./worker/treeWorker.mjs";return new Worker(new URL(s,t),{type:"module"})}throw new Error("Tree Worker requires workerUrl or ESM import.meta.url")},Gt=null,un=(e,t)=>{if(!Gt){let a=e??(()=>Ki(t));Gt=new La(a)}return Gt},Zd=(e,t)=>{un().syncRecords(e,t)},ec=()=>{un().finalize()},tc=()=>{Gt?.dispose(),Gt=null},ji={snapshot:null,isBuilding:!1};function kr(e,t=!1){let a=Je(),s=a.treeWorkerFactory,i=a.workerUrls?.treeWorker,{labels:n}=he(),r=n.uncategorizedCompany,d=n.noName,l=vr(()=>({uncategorizedCompany:r,unnamedPerson:d}),[r,d]),u=vr(()=>s?new La(s):un(void 0,i),[s,i]);return zi(()=>{u.syncRecords(e,l),t&&u.finalize()},[u,e,t,l]),Bi(u.subscribe,u.getState,()=>ji)}oe();Xa();ga();import{Fragment as po,jsx as _,jsxs as me}from"react/jsx-runtime";var hn=ka($t),eo=$t.listPanelMinWidth,to=$t.detailPanelMinWidth,ao=$t.handleThickness,Nc=hn.collapseThreshold,wc=hn.expandThreshold,no=(e,t)=>{let{searchQuery:a,enableHighlighting:s}=t,i=pn(e.full_name,t.noName),n=pn(e.title,""),r=_(pe,{text:i,query:a,enabled:s});return n?me("span",{className:"flex items-center gap-1.5",children:[_("span",{children:r}),_("span",{className:"text-slate-400 text-xs dark:text-slate-500",children:_(pe,{text:n,query:a,enabled:s})})]}):r},ro="contact-map-tree h-full w-full",so={hoverClassName:"bg-slate-100/70 dark:bg-slate-800/60",directorySelectedClassName:"bg-sky-100/55 dark:bg-sky-900/40 [&_.directory-tree-name]:text-sky-700 dark:[&_.directory-tree-name]:text-sky-300",itemSelectedClassName:"bg-sky-100/70 dark:bg-sky-900/55 [&_.directory-tree-name]:text-sky-700 dark:[&_.directory-tree-name]:text-sky-300"},mn="h-4 w-4 shrink-0 transition-colors duration-150",io=(e,t,a)=>({...e,viewportHeightOverride:t,behaviorOptions:{...e.behaviorOptions,enablePointerDrag:!a,enableKeyboardNavigation:!a}}),Ma=null,Tr=null,qt=new Map,Nr="",wr=null,oo=(e,t,a,s,i)=>{let n=`${a?"icons":"plain"}#${s}#${i.noName}`;(n!==Nr||i.formatDirectoryName!==wr)&&(qt.clear(),Nr=n,wr=i.formatDirectoryName);let r={entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},d=new Set;for(let l of e){d.add(l.absolutePath);let u=`${l.name}\0${l.memberCount}`,m=qt.get(l.absolutePath);(!m||m.signature!==u)&&(m={signature:u,result:Lr([l],t,a,{searchQuery:"",enableHighlighting:!1,noName:i.noName,formatDirectoryName:i.formatDirectoryName})},qt.set(l.absolutePath,m));let c=m.result;c.entries.length>0&&r.entries.push(c.entries[0]);for(let[o,p]of c.personPathMap){let f=r.personPathMap.get(o);if(f)for(let v of p)f.add(v);else r.personPathMap.set(o,new Set(p))}for(let[o,p]of c.contactByPath)r.contactByPath.set(o,p);for(let[o,p]of c.ancestorsByPath)r.ancestorsByPath.set(o,p);r.totalCount+=c.totalCount,!r.firstPerson&&c.firstPerson&&(r.firstPerson=c.firstPerson)}for(let l of qt.keys())d.has(l)||qt.delete(l);return r},gn=e=>e.isSelected||e.isItemSelected?"text-sky-600 dark:text-sky-300":e.isExpanded&&e.isDirectory?"text-slate-600 dark:text-slate-200":"text-slate-500 dark:text-slate-400",Pr=e=>{let t=[];for(let a of e)a.type==="directory"&&(t.push(a.absolutePath),a.children&&t.push(...Pr(a.children)));return t},lo=e=>{if(e.memberCount===void 0)throw new Error(`[contact-map] directory entry ${e.absolutePath} has no memberCount`);return e.memberCount},Lr=(e,t,a,s,i)=>{let n=new Map,r=new Map,d=new Map,l=0,u=null,m=(o,p)=>{let f=[...p,o.absolutePath];d.set(o.absolutePath,f);let v,T,C=o.type==="directory"?s.formatDirectoryName(o.name,lo(o)):o.name,z=_(pe,{text:C,query:s.searchQuery,enabled:s.enableHighlighting});if(o.type==="file"&&o.personId){if(i&&!i.has(o.personId))return null;let k=t.get(o.personId);if(k){r.set(o.absolutePath,k),n.has(o.personId)||n.set(o.personId,new Set);let b=n.get(o.personId);b&&b.add(o.absolutePath),l++,u||(u={personId:o.personId,path:o.absolutePath}),a&&(T=g=>{let E=gn(g);return g.isSelected||g.isItemSelected||o.isPrimary&&(E=o.title?"text-indigo-600 dark:text-indigo-400":"text-orange-500 dark:text-orange-400"),_(a.person,{"aria-hidden":"true",className:`${mn} ${E}`})},o.title&&(z=no(k,s))),z=_("span",{"data-contact-path":o.absolutePath,className:"block w-full",children:z})}}else if(o.children){let k=o.children.map(b=>m(b,f)).filter(b=>b!==null);if(i&&k.length===0)return null;if(v=k,a){let b=o.relativePath.startsWith("company:")?a.company:a.department;T=g=>_(b,{"aria-hidden":"true",className:`${mn} ${gn(g)}`})}}return{name:C,label:z,type:o.type,absolutePath:o.absolutePath,relativePath:o.relativePath,icon:T,children:v}};return{entries:e.map(o=>m(o,[])).filter(o=>o!==null),personPathMap:n,contactByPath:r,ancestorsByPath:d,firstPerson:u,totalCount:l}},co=(e,t,a)=>{let s=new Set,i=new Set,n=new Map;t.forEach((m,c)=>{n.set(m.item.person_id,c)});for(let m of t){let c=m.item.person_id,o=e.personPathMap.get(c);if(o)for(let p of o){s.add(p);let f=e.ancestorsByPath.get(p);if(f){for(let v of f)s.add(v);a&&f.length>0&&i.add(f[0])}}}let r=new Map,d=m=>{let c=r.get(m.absolutePath);if(c!==void 0)return c;let o=1/0;if(m.type==="file"){let p=e.contactByPath.get(m.absolutePath);p&&(o=n.get(p.person_id)??1/0)}else if(m.children)for(let p of m.children)o=Math.min(o,d(p));return r.set(m.absolutePath,o),o},l=(m,c=0)=>m.filter(o=>a&&c===0&&i.has(o.absolutePath)?!0:s.has(o.absolutePath)).map(o=>a&&c===0&&i.has(o.absolutePath)?o:o.type==="directory"&&o.children?{...o,children:l(o.children,c+1)}:o).sort((o,p)=>c===0?d(o)-d(p):0),u=l(e.entries);return{...e,entries:u}},Rr=({context:e,controlsContainer:t})=>{let{contactMapRecords:a,filteredItems:s,hasSearchTerm:i,isSearchInProgress:n,isSearchTabActive:r}=e,{locale:d,labels:l,treeLabels:u}=he(),m=l.noName,c=l.treeDirectoryName,o=Pe(()=>({noName:m,formatDirectoryName:c}),[m,c]),[p,f]=tt(null),[v,T]=tt(!1),{snapshot:C,isBuilding:z}=kr(a),k=C?.tree??null,b=tr(),g=C?.rebuildEpoch??0,E=Pe(()=>k?oo(k,b,p,g,o):null,[k,b,p,g,o]),V=Pe(()=>{if(!k)return null;if(!i)return E;let S;v||(S=new Set(s.map(Y=>Y.item.person_id)));let A=Lr(k,b,p,{...o,searchQuery:e.searchQuery,enableHighlighting:e.enableHighlighting},S);return co(A,s,v)},[k,E,b,p,e.searchQuery,e.enableHighlighting,i,s,v,o]),y=Pe(()=>V||{entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},[V]),h=i&&e.errorMessage!==null,[x,O]=tt(y),D=Ra(!1);ht(()=>{if(!(n||h)){D.current=!!k,O(y);return}!D.current&&k&&y.entries.length>0&&(D.current=!0,O(y))},[y,k,n,h]);let Z=i&&(n||h)?x:y,{entries:w,personPathMap:P,contactByPath:H,totalCount:B}=Z,ae=Pe(()=>Pr(w),[w]),[ue,ie]=tt(()=>Tr??new Set),ne=Ee(S=>!ue.has(S),[ue]),nt=Ee(S=>{ie(A=>{let Y=new Set(A);return Y.has(S)?Y.delete(S):Y.add(S),Y})},[]),ft=Ee(S=>{S.length!==0&&ie(A=>{let Y=new Set(A);for(let Se of S)Y.add(Se);return Y})},[]),bt=Ee(S=>{ie(A=>{if(A.size===0)return A;let Y=!1,Se=new Set(A);for(let Tt of S)Se.delete(Tt)&&(Y=!0);return Y?Se:A})},[]);ht(()=>{Tr=ue},[ue]),ht(()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem("contact-map.tree-expanded")}catch{}},[]);let[Le,Xt]=tt(null),[ce,yt]=tt(null),[Jt,ee]=tt(!1),[Zt,xt]=tt(!1),We=Ra(null),be=Ra(null),{normalizedViewportHeight:Ot,panelSizingStyle:Oa}=cn(r,be,We),ve=Ee(S=>{let A=H.get(S);A&&(Le!==A.person_id&&Xt(A.person_id),S!==ce&&yt(S),ee(!0))},[H,ce,Le]),ea=Ee(S=>{ve(S.entry.absolutePath)},[ve]),vt=Ee(S=>S instanceof Element?S.closest("[data-contact-path]")?.getAttribute("data-contact-path")??null:null,[]),{isPopupVisible:$e,popupItem:_e,handleClosePopup:Ct}=Sa({ref:be,resolveItem:vt,onSelect:ve}),kt=Ee(S=>{if(!e.openEmailsWithGmail)return;let A=S.trim();if(!A||A==="-"||typeof window>"u")return;let Y=ze(A,!0);Y&&window.open(Y,"_blank","noopener,noreferrer")},[e.openEmailsWithGmail]),Ve=_e?H.get(_e):null,rt=$e&&Ve!==null&&Ve!==void 0;ht(()=>{$e&&!Ve&&Ct()},[$e,Ve,Ct]);let Ie=Pe(()=>({overscanCount:16,callbackThrottleMs:16,scrollBarOptions:{width:8,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:{enabled:!0,renderVisual:Yi}},behaviorOptions:{resetOnGetItemHeightChange:!1},preserveScrollAnchor:!0}),[]),Da=Pe(()=>io(Ie,Ot,rt),[Ie,Ot,rt]);ht(()=>{let S=!1;return typeof window>"u"?()=>{S=!0}:Ma?(f(Ma),()=>{S=!0}):((async()=>{try{let[Y,Se,Tt,je]=await Promise.all([import("lucide-react/dist/esm/icons/building-2.js"),import("lucide-react/dist/esm/icons/users-round.js"),import("lucide-react/dist/esm/icons/id-card.js"),import("lucide-react/dist/esm/icons/user-round.js")]);if(S)return;let it=Y.default,Ia=Se.default,Rn=Tt.default,Mn=je.default;it&&Ia&&Rn&&Mn&&(Ma={company:it,department:Ia,title:Rn,person:Mn},f(Ma))}catch(Y){Qe.warn("Failed to load lucide icons",Y)}})(),()=>{S=!0})},[]);let St=Pe(()=>{if(!p)return;let S=je=>it=>_(je,{"aria-hidden":"true",className:`${mn} ${gn(it)}`}),A={company:S(p.company),department:S(p.department),title:S(p.title)},Y=S(p.person),Se=je=>je in A,Tt=je=>{let[it]=je.entry.relativePath.split(":",1);return(Se(it)?A[it]:A.company)(je)};return{directory:Tt,directoryExpanded:Tt,file:Y}},[p]),Ha=Ee(()=>{ie(S=>S.size===0?S:new Set)},[]),ta=Ee(()=>{ae.length>0&&ft(ae)},[ae,ft]);ht(()=>{if(typeof window>"u")return;let S=document.documentElement,A=window.matchMedia("(prefers-color-scheme: dark)"),Y=()=>xt(S.classList.contains("dark")||A.matches);Y(),A.addEventListener("change",Y);let Se=new MutationObserver(Y);return Se.observe(S,{attributes:!0,attributeFilter:["class"]}),()=>{A.removeEventListener("change",Y),Se.disconnect()}},[]),ht(()=>{if(B===0){Le!==null&&Xt(null),ce!==null&&yt(null);return}if(Le!==null){let S=P.get(Le);if(S){if(ce&&S.has(ce))return;let A=S.values().next().value;A&&yt(A);return}}Le!==null&&Xt(null),ce!==null&&yt(null)},[B,Le,ce,P]);let st=ce?H.get(ce)??null:null,Ae=Zt?"#475569":"#94A3B8",Ke=e.isStreamingComplete,Wa=e.isStreamingFailed,Dt=Ke&&a.length===0,aa=(z||!k)&&!Dt,na=xr(B,250),_a=k!==null||Dt,ra=me("div",{className:"flex items-center gap-1.5",children:[me("span",{className:"inline-flex h-5 items-center gap-1 rounded bg-slate-100 px-1.5 font-medium font-mono text-[10px] text-slate-700 dark:bg-slate-800 dark:text-slate-200",title:l.treeNodeCountTitle,children:[_("span",{className:"text-[10px]",children:"\u{1F333}"})," ",l.treeNodeCountLabel," ",_a?l.treeNodeCount(na):"\u2026"]}),Wa&&!Ke?me("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-rose-200 bg-rose-50 px-1.5 font-medium text-[10px] text-rose-700 dark:border-rose-800 dark:bg-rose-950/60 dark:text-rose-300",title:l.treeStreamInterruptedTitle,children:[_("span",{className:"h-1.5 w-1.5 rounded-full bg-rose-500"}),_("span",{className:"text-[10px]",children:"\u26D4"})," ",l.treeStreamInterrupted]}):Ke?aa?me("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-amber-200 bg-amber-50 px-1.5 font-medium text-[10px] text-amber-700 dark:border-amber-800 dark:bg-amber-950/60 dark:text-amber-300",title:l.treeBuildingTitle,children:[me("span",{className:"relative flex h-1.5 w-1.5",children:[_("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),_("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-amber-500"})]}),_("span",{className:"text-[10px]",children:"\u{1F33F}"})," ",l.treeBuilding]}):me("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-emerald-200 bg-emerald-50 px-1.5 font-medium text-[10px] text-emerald-700 dark:border-emerald-800 dark:bg-emerald-950/60 dark:text-emerald-300",title:l.treeCompleteTitle,children:[_("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),_("span",{className:"text-[10px]",children:"\u2705"})," ",l.treeComplete]}):me("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-sky-200 bg-sky-50 px-1.5 font-medium text-[10px] text-sky-700 dark:border-sky-800 dark:bg-sky-950/60 dark:text-sky-300",title:l.treeStreamLoadingTitle,children:[me("span",{className:"relative flex h-1.5 w-1.5",children:[_("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-sky-400 opacity-75"}),_("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-sky-500"})]}),_("span",{className:"text-[10px]",children:"\u23F3"})," ",l.treeStreamLoading]}),i&&me("button",{type:"button",onClick:()=>T(!v),className:`inline-flex h-5 items-center rounded px-1.5 text-[10px] transition-colors ${v?"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300":"text-slate-500 hover:bg-slate-100 dark:text-slate-400 dark:hover:bg-slate-800"}`,title:l.treeShowEntireCompanyTitle,children:[_("span",{className:"text-[10px]",children:"\u{1F3E2}"})," ",l.treeShowEntireCompany]}),ae.length>0?me("div",{className:"flex items-center gap-1",children:[_("button",{type:"button",onClick:Ha,className:"inline-flex h-5 w-5 items-center justify-center rounded border border-slate-300 bg-white text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700 dark:hover:text-slate-100","aria-label":l.treeExpandAll,title:l.treeExpandAllTitle,children:_(Ji,{className:"h-3 w-3"})}),_("button",{type:"button",onClick:ta,className:"inline-flex h-5 w-5 items-center justify-center rounded border border-slate-300 bg-white text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700 dark:hover:text-slate-100","aria-label":l.treeCollapseAll,title:l.treeCollapseAllTitle,children:_(Xi,{className:"h-3 w-3"})})]}):null]}),Ht=Ra(null),{isTwoColumn:wn}=Ta(Ht,hn,{mediaQuery:"(min-width: 768px)"}),Pn=Pe(()=>({toggle:nt,isExpanded:ne,expandMultiple:bt,collapseMultiple:ft,isPending:n}),[ft,bt,ne,nt,n]),Ln=Pe(()=>({onEntryClick:ea,selectedPath:ce}),[ea,ce]),U=Pe(()=>({className:ro,lineColor:Ae,iconOverrides:St,showDirectoryIcons:!!St,showFileIcons:!!St,highlightStyles:so,entryClassName:"rounded-md px-1 py-0.5",nameClassName:"text-xs tracking-tight",directoryNameClassName:"font-normal text-slate-800 dark:text-slate-100",fileNameClassName:"text-slate-700 dark:text-slate-200"}),[Ae,St]),j=_("div",{ref:We,className:"flex min-h-0 flex-1 flex-col rounded-xl border border-slate-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-950",children:_("div",{ref:be,className:"flex min-h-0 flex-1 flex-col overflow-hidden p-2",children:w.length>0?_(Gi,{entries:w,expansion:Pn,selection:Ln,visual:U,virtualScroll:Da,locale:d,labels:u}):_("div",{className:"flex h-full w-full items-center justify-center rounded-lg border border-slate-300 border-dashed bg-white/70 px-6 text-center text-slate-500 text-sm transition-colors dark:border-slate-700 dark:bg-slate-900/50 dark:text-slate-300",children:i?l.treeNoMatches:l.treeEmpty})})});return me("div",{ref:Ht,"data-testid":"contact-map-tree-root",className:"flex min-h-0 flex-1 flex-col",style:Oa,children:[t&&Zi(ra,t),wn?me(qi,{id:"contact-map-tree-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-tree-panel-group",children:[_(Sr,{id:"contact-map-tree-pane",defaultSize:{value:60,unit:"percentage"},minSize:{value:eo,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:j}),_(Qi,{id:"contact-map-tree-handle",thickness:ao,indicator:{visible:!0,thickness:6,length:32,barThickness:2,barLength:16},className:"cursor-col-resize rounded transition-colors hover:bg-slate-200/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-1 dark:hover:bg-slate-700/60","aria-label":l.treeResizeHandle}),_(Sr,{id:"contact-map-tree-detail-pane",defaultSize:{value:40,unit:"percentage"},minSize:{value:to,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:_(Ye,{contact:st??null,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})})]}):me(po,{children:[j,_("div",{className:"hidden","aria-hidden":"true",children:_(Ye,{contact:st,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})}),Jt&&st?_(Na,{isOpen:Jt,onClose:()=>ee(!1),className:"z-50 bg-white dark:bg-slate-900",children:me("div",{className:"flex h-full flex-col overflow-hidden p-3 sm:p-4",children:[me("div",{className:"mb-2 flex items-center justify-between border-b pr-10 pb-2 dark:border-slate-700",children:[_("h3",{className:"font-semibold text-slate-900 text-sm dark:text-slate-100",children:l.detailHeading}),_("button",{type:"button",onClick:()=>ee(!1),className:"rounded px-2.5 py-1 font-medium text-slate-600 text-xs hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800",children:l.close})]}),_("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",style:{height:"100%"},children:_(Ye,{contact:st,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})})]})}):null]}),rt&&Ve&&_(ca,{contactData:Ve,openEmailsWithGmail:e.openEmailsWithGmail,openGmailCompose:kt,onRequestClose:Ct})]})};import{jsx as Qt,jsxs as Lt}from"react/jsx-runtime";var fn="view",ho={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},fo=e=>e==="tree"?"tree":"list",Mr=({context:e})=>{let t=q(),[a,s]=go(),[i,n]=mo(null),r=fo(a.get(fn)),{setScrollableRef:d,onPointerDown:l,onPointerMove:u,onPointerUp:m,onPointerLeave:c,onPointerCancel:o,onClickCapture:p}=Ze(),f=uo(v=>{let T=v==="tree"?"tree":"list";if(T===r)return;let C=new URLSearchParams(typeof window<"u"?window.location.search:"");T==="list"?C.delete(fn):C.set(fn,T),s(C,{replace:!0})},[r,s]);return Lt("div",{"data-testid":"contact-map-search-tab-group",className:"flex h-full flex-1 flex-col",children:[Lt("div",{className:"mt-1 mb-1.5 flex shrink-0 items-center gap-2",children:[Lt("div",{ref:d,className:"flex space-x-1 overflow-x-auto text-nowrap rounded-lg bg-gray-100 p-0.5 transition-colors dark:bg-slate-800/80",style:ho,onPointerDown:l,onPointerMove:u,onPointerUp:m,onPointerLeave:c,onPointerCancel:o,onClickCapture:p,children:[Lt("button",{type:"button","data-testid":"contact-map-tab-list",onClick:()=>f("list"),className:`rounded px-2 py-0.5 text-xs transition-colors ${r==="list"?"bg-blue-500 text-white dark:bg-blue-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4C4} ",t.listViewTab]}),Lt("button",{type:"button","data-testid":"contact-map-tab-tree",onClick:()=>f("tree"),className:`rounded px-2 py-0.5 text-xs transition-colors ${r==="tree"?"bg-green-500 text-white dark:bg-green-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F333} ",t.treeViewTab]})]}),Qt("div",{ref:n,className:"flex items-center gap-1.5"})]}),Lt("div",{className:"flex h-full flex-1 flex-col",children:[Qt("div",{className:`${r==="list"?"flex h-full flex-1 flex-col":"hidden"}`,children:r==="list"?Qt(yr,{context:e}):null}),Qt("div",{className:`${r==="tree"?"flex h-full flex-1 flex-col":"hidden"}`,children:r==="tree"?Qt(Rr,{context:e,controlsContainer:i}):null})]})]})};import{DEFAULT_FUZZY_SEARCH_OPTIONS as xn}from"@aiquants/fuzzy-search";import{memo as xo}from"react";oe();oe();import{DEFAULT_FUZZY_SEARCH_OPTIONS as F}from"@aiquants/fuzzy-search";import{memo as bo,useId as xe}from"react";import{jsx as M,jsxs as I}from"react/jsx-runtime";var bn=bo(({searchOptions:e,setSearchOptions:t})=>{let a=q(),s="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",i="text-xs font-semibold",n=e.sortBy==="relevance",r=xe(),d=xe(),l=xe(),u=xe(),m=xe(),c=xe(),o=xe(),p=xe(),f=xe(),v=xe(),T=xe(),C=[];C.push(I("div",{className:`${s} border-green-200 border-l-4 dark:border-green-400/60`,children:[I("div",{className:`${i} text-green-700 dark:text-green-300`,children:["\u{1F3D7}\uFE0F ",a.indexBuildHeading]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:r,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexNgramSize}),M("input",{id:r,type:"range",min:"1",max:"4",step:"1",value:e.ngramSize||F.ngramSize,onChange:b=>t(g=>({...g,ngramSize:parseInt(b.target.value,10)})),className:"w-full"}),I("span",{className:"text-green-600 text-xs dark:text-green-300",children:[a.currentValueLabel," ",e.ngramSize||F.ngramSize]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexNgramSizeHint})]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:d,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexMinNgramOverlap}),M("input",{id:d,type:"range",min:"1",max:"5",step:"1",value:e.minNgramOverlap||F.minNgramOverlap,onChange:b=>t(g=>({...g,minNgramOverlap:parseInt(b.target.value,10)})),className:"w-full"}),I("span",{className:"text-green-600 text-xs dark:text-green-300",children:[a.currentValueLabel," ",e.minNgramOverlap||F.minNgramOverlap]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexMinNgramOverlapHint})]})]},"index-build")),C.push(I("div",{className:`${s} border-blue-200 border-l-4 dark:border-blue-500/60`,children:[I("div",{className:`${i} text-blue-700 dark:text-blue-300`,children:["\u{1F50D} ",a.indexCandidateHeading]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:l,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexThreshold}),M("input",{id:l,type:"range",min:"0.0",max:"1.0",step:"0.05",value:e.indexWorkerOptions?.threshold??F.indexWorkerOptions?.threshold,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,threshold:parseFloat(b.target.value)}})),className:"w-full"}),I("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.threshold??F.indexWorkerOptions?.threshold]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexThresholdHint})]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:m,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexNgramOverlapThreshold}),M("input",{id:m,type:"range",min:"0.1",max:"0.9",step:"0.1",value:e.indexWorkerOptions?.ngramOverlapThreshold??F.indexWorkerOptions?.ngramOverlapThreshold,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,ngramOverlapThreshold:parseFloat(b.target.value)}})),className:"w-full"}),I("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.ngramOverlapThreshold??F.indexWorkerOptions?.ngramOverlapThreshold]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexNgramOverlapThresholdHint})]})]},"candidate-control")),C.push(I("div",{className:`${s} border-cyan-200 border-l-4 dark:border-cyan-400/60`,children:[I("div",{className:`${i} text-cyan-700 dark:text-cyan-300`,children:["\u{1F9ED} ",a.indexStrategyHeading]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:u,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexStrategy}),I("select",{id:u,value:e.indexWorkerOptions?.strategy??F.indexWorkerOptions?.strategy??"hybrid",onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,strategy:b.target.value}})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[M("option",{value:"fast",children:a.indexStrategyFast}),M("option",{value:"accurate",children:a.indexStrategyAccurate}),M("option",{value:"hybrid",children:a.indexStrategyHybrid})]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexStrategyHint})]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:c,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexMinCandidatesRatio}),M("input",{id:c,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.minCandidatesRatio??F.indexWorkerOptions?.minCandidatesRatio,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,minCandidatesRatio:parseFloat(b.target.value)}})),className:"w-full"}),I("span",{className:"text-cyan-600 text-xs dark:text-cyan-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.minCandidatesRatio??F.indexWorkerOptions?.minCandidatesRatio]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexMinCandidatesRatioHint})]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:o,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexMaxCandidatesRatio}),M("input",{id:o,type:"range",min:"0.3",max:"0.8",step:"0.1",value:e.indexWorkerOptions?.maxCandidatesRatio??F.indexWorkerOptions?.maxCandidatesRatio,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxCandidatesRatio:parseFloat(b.target.value)}})),className:"w-full"}),I("span",{className:"text-cyan-600 text-xs dark:text-cyan-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.maxCandidatesRatio??F.indexWorkerOptions?.maxCandidatesRatio]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexMaxCandidatesRatioHint})]})]},"strategy")),C.push(I("div",{className:`${s} border-indigo-200 border-l-4 dark:border-indigo-500/60`,children:[I("div",{className:`${i} text-indigo-700 dark:text-indigo-300`,children:["\u{1F521} ",a.scoreTuningHeading]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:p,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexJaroWinklerPrefix}),M("input",{id:p,type:"range",min:"0.05",max:"0.25",step:"0.05",value:e.indexWorkerOptions?.jaroWinklerPrefix??F.indexWorkerOptions?.jaroWinklerPrefix,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,jaroWinklerPrefix:parseFloat(b.target.value)}})),className:"w-full"}),I("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.jaroWinklerPrefix??F.indexWorkerOptions?.jaroWinklerPrefix]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexJaroWinklerPrefixHint})]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:f,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.maxResults}),M("input",{id:f,type:"range",min:"1000",max:"10000",step:"1000",value:e.indexWorkerOptions?.maxResults??F.indexWorkerOptions?.maxResults,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxResults:parseInt(b.target.value,10)}})),className:"w-full"}),I("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.maxResults??F.indexWorkerOptions?.maxResults]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexMaxResultsHint})]})]},"jaro")),C.push(I("div",{className:`${s} border-emerald-200 border-l-4 ${n?"":"opacity-50"} dark:border-emerald-400/60`,children:[I("div",{className:`${i} text-emerald-700 dark:text-emerald-300`,children:["\u{1F3AF} ",a.relevanceWeightsHeading]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:v,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.fieldWeight}),M("input",{id:v,type:"range",min:"0",max:"1",step:"0.05",value:e.indexWorkerOptions?.relevanceFieldWeight??F.indexWorkerOptions?.relevanceFieldWeight??.2,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,relevanceFieldWeight:parseFloat(b.target.value)}})),disabled:!n,className:"w-full disabled:cursor-not-allowed"}),I("span",{className:"text-emerald-600 text-xs dark:text-emerald-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.relevanceFieldWeight??F.indexWorkerOptions?.relevanceFieldWeight??.2]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexFieldWeightHint})]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:T,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexPerfectMatchBonus}),M("input",{id:T,type:"range",min:"0",max:"0.3",step:"0.1",value:e.indexWorkerOptions?.relevancePerfectMatchBonus??F.indexWorkerOptions?.relevancePerfectMatchBonus??.1,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,relevancePerfectMatchBonus:parseFloat(b.target.value)}})),disabled:!n,className:"w-full disabled:cursor-not-allowed"}),I("span",{className:"text-emerald-600 text-xs dark:text-emerald-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.relevancePerfectMatchBonus??F.indexWorkerOptions?.relevancePerfectMatchBonus??.1]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexPerfectMatchBonusHint})]}),!n&&M("p",{className:"text-[11px] text-emerald-600 dark:text-emerald-300",children:a.relevanceOnlyNotice})]},"relevance"));let z=xe(),k=xe();return C.push(I("div",{className:`${s} border-teal-200 border-l-4 dark:border-teal-400/60`,children:[I("div",{className:`${i} text-teal-700 dark:text-teal-300`,children:["\u{1F524} ",a.indexContainmentHeading]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:z,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexContainmentBase}),M("input",{id:z,type:"range",min:"0.0",max:"0.7",step:"0.05",value:e.indexWorkerOptions?.containmentScoreBase??F.indexWorkerOptions?.containmentScoreBase??.7,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,containmentScoreBase:parseFloat(b.target.value)}})),className:"w-full"}),I("span",{className:"text-teal-600 text-xs dark:text-teal-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.containmentScoreBase??F.indexWorkerOptions?.containmentScoreBase??.7]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexContainmentBaseHint})]}),I("div",{className:"space-y-2",children:[M("label",{htmlFor:k,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexContainmentCoverage}),M("input",{id:k,type:"range",min:"0.0",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.containmentCoverageWeight??F.indexWorkerOptions?.containmentCoverageWeight??.3,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,containmentCoverageWeight:parseFloat(b.target.value)}})),className:"w-full"}),I("span",{className:"text-teal-600 text-xs dark:text-teal-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.containmentCoverageWeight??F.indexWorkerOptions?.containmentCoverageWeight??.3]}),M("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexContainmentCoverageHint})]})]},"containment")),I("section",{className:"space-y-3",children:[I("div",{className:"flex items-center justify-between gap-3",children:[I("div",{className:"flex items-center gap-2 font-semibold text-green-700 text-xs transition-colors dark:text-green-300",children:[M("span",{children:"\u{1F4CA}"}),M("span",{className:"tracking-wide",children:a.indexSettingsHeading})]}),M("button",{type:"button",onClick:()=>t(b=>({...b,indexWorkerOptions:{threshold:F.indexWorkerOptions?.threshold||.4,ngramOverlapThreshold:F.indexWorkerOptions?.ngramOverlapThreshold||.3,minCandidatesRatio:F.indexWorkerOptions?.minCandidatesRatio||.1,maxCandidatesRatio:F.indexWorkerOptions?.maxCandidatesRatio||.5,jaroWinklerPrefix:F.indexWorkerOptions?.jaroWinklerPrefix||.1,maxResults:F.indexWorkerOptions?.maxResults||100,relevanceFieldWeight:F.indexWorkerOptions?.relevanceFieldWeight||.2,relevancePerfectMatchBonus:F.indexWorkerOptions?.relevancePerfectMatchBonus||.1,containmentScoreBase:F.indexWorkerOptions?.containmentScoreBase||.7,containmentCoverageWeight:F.indexWorkerOptions?.containmentCoverageWeight||.3,strategy:F.indexWorkerOptions?.strategy},ngramSize:F.ngramSize,minNgramOverlap:F.minNgramOverlap})),className:"rounded border border-green-300 bg-green-100 px-2 py-1 font-medium text-green-700 text-xs transition-colors hover:bg-green-200 dark:border-green-400/60 dark:bg-green-900/20 dark:text-green-200 dark:hover:bg-green-800/30",title:a.resetToDefaultsTitle,children:a.reset})]}),M("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:C})]})});bn.displayName="IndexWorkerSettings";oe();import{DEFAULT_FUZZY_SEARCH_OPTIONS as de}from"@aiquants/fuzzy-search";import{memo as yo,useId as Rt}from"react";import{jsx as te,jsxs as re}from"react/jsx-runtime";var yn=yo(({searchOptions:e,setSearchOptions:t})=>{let a=q(),s="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",i="text-xs font-semibold",n=e.sortBy==="relevance",r=Rt(),d=Rt(),l=Rt(),u=Rt(),m=Rt(),c=Rt(),o=[];return o.push(re("div",{className:`${s} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[re("div",{className:`${i} text-purple-700 dark:text-purple-300`,children:["\u{1F9EE} ",a.levenshteinCandidateHeading]}),re("div",{className:"space-y-2",children:[te("label",{htmlFor:r,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.levenshteinThreshold}),te("input",{id:r,type:"range",min:"0.0",max:n?"1.5":"1.0",step:"0.05",value:e.levenshteinWorkerOptions?.threshold??de.levenshteinWorkerOptions?.threshold,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,threshold:parseFloat(p.target.value)}})),className:"w-full"}),re("span",{className:"text-purple-600 text-xs dark:text-purple-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.threshold??de.levenshteinWorkerOptions?.threshold]}),te("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n?a.levenshteinThresholdHintRelevance:a.levenshteinThresholdHint})]}),re("div",{className:"space-y-2",children:[te("label",{htmlFor:d,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.levenshteinLengthSimilarity}),te("input",{id:d,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.lengthSimilarityThreshold??de.levenshteinWorkerOptions?.lengthSimilarityThreshold,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,lengthSimilarityThreshold:parseFloat(p.target.value)}})),className:"w-full"}),re("span",{className:"text-purple-600 text-xs dark:text-purple-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthSimilarityThreshold??de.levenshteinWorkerOptions?.lengthSimilarityThreshold]}),te("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinLengthSimilarityHint})]})]},"threshold")),o.push(re("div",{className:`${s} border-pink-200 border-l-4 dark:border-pink-400/60`,children:[re("div",{className:`${i} text-pink-700 dark:text-pink-300`,children:["\u{1FA84} ",a.scoreTuningHeading]}),re("div",{className:"space-y-2",children:[te("label",{htmlFor:l,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.levenshteinLengthPenalty}),te("input",{id:l,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.levenshteinWorkerOptions?.lengthDiffPenalty??de.levenshteinWorkerOptions?.lengthDiffPenalty,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,lengthDiffPenalty:parseFloat(p.target.value)}})),className:"w-full"}),re("span",{className:"text-pink-600 text-xs dark:text-pink-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthDiffPenalty??de.levenshteinWorkerOptions?.lengthDiffPenalty]}),te("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinLengthPenaltyHint})]})]},"penalty")),o.push(re("div",{className:`${s} border-violet-200 border-l-4 dark:border-violet-400/60`,children:[re("div",{className:`${i} text-violet-700 dark:text-violet-300`,children:["\u{1F4E6} ",a.levenshteinResultsHeading]}),te("label",{htmlFor:u,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.maxResults}),te("input",{id:u,type:"range",min:"1000",max:"10000",step:"1000",value:e.levenshteinWorkerOptions?.maxResults??de.levenshteinWorkerOptions?.maxResults,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,maxResults:parseInt(p.target.value,10)}})),className:"w-full"}),re("span",{className:"text-violet-600 text-xs dark:text-violet-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.maxResults??de.levenshteinWorkerOptions?.maxResults]}),te("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinMaxResultsHint})]},"max-results")),o.push(re("div",{className:`${s} border-rose-200 border-l-4 ${n?"":"opacity-50"} dark:border-rose-400/60`,children:[re("div",{className:`${i} text-rose-700 dark:text-rose-300`,children:["\u{1F3AF} ",a.relevanceWeightsHeading]}),re("div",{className:"space-y-2",children:[te("label",{htmlFor:m,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.fieldWeight}),te("input",{id:m,type:"range",min:"0",max:"1",step:"0.05",value:e.levenshteinWorkerOptions?.relevanceFieldWeight??de.levenshteinWorkerOptions?.relevanceFieldWeight??.15,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,relevanceFieldWeight:parseFloat(p.target.value)}})),disabled:!n,className:"w-full disabled:cursor-not-allowed"}),re("span",{className:"text-rose-600 text-xs dark:text-rose-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.relevanceFieldWeight??de.levenshteinWorkerOptions?.relevanceFieldWeight??.15]}),te("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinFieldWeightHint})]}),re("div",{className:"space-y-2",children:[te("label",{htmlFor:c,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.levenshteinPartialBonus}),te("input",{id:c,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.partialMatchBonus??de.levenshteinWorkerOptions?.partialMatchBonus,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,partialMatchBonus:parseFloat(p.target.value)}})),disabled:!n,className:"w-full disabled:cursor-not-allowed"}),re("span",{className:"text-rose-600 text-xs dark:text-rose-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.partialMatchBonus??de.levenshteinWorkerOptions?.partialMatchBonus]}),te("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinPartialBonusHint})]}),!n&&te("p",{className:"text-[11px] text-rose-600 dark:text-rose-300",children:a.relevanceOnlyNotice})]},"relevance")),re("section",{className:"space-y-3",children:[re("div",{className:"flex items-center justify-between gap-3",children:[re("div",{className:"flex items-center gap-2 font-semibold text-purple-700 text-xs transition-colors dark:text-purple-300",children:[te("span",{children:"\u{1F4CF}"}),te("span",{className:"tracking-wide",children:a.levenshteinSettingsHeading})]}),te("button",{type:"button",onClick:()=>t(p=>({...p,levenshteinWorkerOptions:{threshold:de.levenshteinWorkerOptions?.threshold||.3,lengthSimilarityThreshold:de.levenshteinWorkerOptions?.lengthSimilarityThreshold||.1,partialMatchBonus:de.levenshteinWorkerOptions?.partialMatchBonus||.1,lengthDiffPenalty:de.levenshteinWorkerOptions?.lengthDiffPenalty||1,maxResults:de.levenshteinWorkerOptions?.maxResults||100,relevanceFieldWeight:de.levenshteinWorkerOptions?.relevanceFieldWeight||.15}})),className:"rounded border border-purple-300 bg-purple-100 px-2 py-1 font-medium text-purple-700 text-xs transition-colors hover:bg-purple-200 dark:border-purple-400/60 dark:bg-purple-900/20 dark:text-purple-200 dark:hover:bg-purple-800/30",title:a.resetToDefaultsTitle,children:a.reset})]}),te("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:o})]})});yn.displayName="LevenshteinWorkerSettings";import{jsx as De,jsxs as Oe}from"react/jsx-runtime";var vo={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},vn=xo(({searchOptions:e,setSearchOptions:t,enableHighlighting:a,setEnableHighlighting:s,openEmailsWithGmail:i,setOpenEmailsWithGmail:n,activeTab:r,onTabChange:d})=>{let l=q(),{setScrollableRef:u,onPointerDown:m,onPointerMove:c,onPointerUp:o,onPointerLeave:p,onPointerCancel:f,onClickCapture:v}=Ze();return Oe("div",{className:"wrap-break-word flex w-full flex-col gap-1.5 rounded-lg border border-blue-300 bg-white p-1.5 shadow-md transition-colors dark:border-blue-500/40 dark:bg-slate-900/80 dark:shadow-blue-900/30",children:[Oe("div",{className:"mb-0.5 flex shrink-0 flex-col gap-1 rounded bg-blue-50 px-1.5 py-0.5 transition-colors sm:flex-row sm:items-center sm:justify-between dark:bg-blue-900/30",children:[Oe("h3",{className:"font-semibold text-gray-700 text-xs transition-colors dark:text-slate-100",children:["\u2699\uFE0F ",l.searchSettings]}),De("div",{className:"flex flex-wrap gap-1.5",children:Oe("button",{type:"button",onClick:()=>t(T=>({...xn,autoSearchOnIndexRebuild:!1,debounceMs:0,workerUrls:T.workerUrls,indexWorkerOptions:{...xn.indexWorkerOptions},levenshteinWorkerOptions:{...xn.levenshteinWorkerOptions}})),className:"rounded bg-red-500 px-1.5 py-0.5 text-[10px] text-white transition-colors hover:bg-red-600 dark:hover:bg-red-700",title:l.settingsResetAllTitle,children:["\u{1F504} ",l.settingsResetAll]})})]}),De("div",{className:"mb-0 shrink-0",children:Oe("div",{ref:u,role:"tablist","aria-label":l.settingsTabsLabel,className:"flex space-x-1 overflow-x-auto text-nowrap rounded-md bg-gray-100 p-0.5 transition-colors dark:bg-slate-800/80",style:vo,onPointerDown:m,onPointerMove:c,onPointerUp:o,onPointerLeave:p,onPointerCancel:f,onClickCapture:v,children:[Oe("button",{type:"button",role:"tab","aria-selected":r==="basic",onClick:()=>d("basic"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${r==="basic"?"bg-blue-500 text-white dark:bg-blue-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F527} ",l.settingsBasicTab]}),Oe("button",{type:"button",role:"tab","aria-selected":r==="advanced",onClick:()=>d("advanced"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${r==="advanced"?"bg-orange-500 text-white dark:bg-orange-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u26A1 ",l.settingsAdvancedTab]}),Oe("button",{type:"button",role:"tab","aria-selected":r==="index",onClick:()=>d("index"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${r==="index"?"bg-green-500 text-white dark:bg-green-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CA} ",l.indexWorkerName]}),Oe("button",{type:"button",role:"tab","aria-selected":r==="levenshtein",onClick:()=>d("levenshtein"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${r==="levenshtein"?"bg-purple-500 text-white dark:bg-purple-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CF} ",l.levenshteinWorkerName]})]})}),Oe("div",{className:"flex flex-col gap-1",children:[De("div",{className:`${r==="basic"?"block":"hidden"}`,children:De(ja,{searchOptions:e,setSearchOptions:t,enableHighlighting:a,setEnableHighlighting:s,openEmailsWithGmail:i,setOpenEmailsWithGmail:n})}),De("div",{className:`${r==="advanced"?"block":"hidden"}`,children:De(Ka,{searchOptions:e,setSearchOptions:t})}),De("div",{className:`${r==="index"?"block":"hidden"}`,children:De(bn,{searchOptions:e,setSearchOptions:t})}),De("div",{className:`${r==="levenshtein"?"block":"hidden"}`,children:De(yn,{searchOptions:e,setSearchOptions:t})})]})]})});vn.displayName="SearchOptionsPanel";import{memo as So}from"react";lt();oe();import{memo as Co}from"react";import{jsxs as Cn}from"react/jsx-runtime";var R=Co(({label:e,value:t,unit:a,color:s="text-gray-600 dark:text-slate-300"})=>Cn("div",{className:"wrap-break-word flex min-w-0 flex-col overflow-hidden text-gray-700 transition-colors sm:flex-row sm:justify-between dark:text-slate-200",children:[Cn("span",{className:"wrap-break-word overflow-hidden text-left",children:[e,":"]}),Cn("span",{className:`font-medium ${s} min-w-0 overflow-hidden break-all transition-colors sm:ml-2`,children:[t,a]})]}));R.displayName="StatItem";ct();lt();oe();import{memo as ko}from"react";import{jsx as N,jsxs as $}from"react/jsx-runtime";var Mt=ko(({kind:e,icon:t,stats:a,color:s})=>{let{locale:i,labels:n}=he(),r=P=>G(i,P);if(!a)return N("section",{className:"rounded-lg border border-gray-200 border-dashed bg-white/40 p-3 text-gray-400 text-xs transition-colors dark:border-slate-700 dark:bg-slate-900/40 dark:text-slate-400",children:n.statsNoData});let d=a.basic||{},l=a.workerSpecific||{},u=a.analysis||{},m=d.totalSearches??0,c=d.totalProcessingTime??0,o=d.averageSearchTime??0,p=d.lastSearchTime??0,f=d.errorCount??0,v=d.timestamp,T=u.fieldPerformance||{},C=u.performanceInsights||{},z=u.recentHistory||[],k=l.specificMetrics||{},b=l.operationCount??0,g=l.operationDistribution||{},E=e==="index",V=e==="levenshtein",y=E?n.indexWorkerName:n.levenshteinWorkerName,h=k,x=k,O="flex flex-col gap-1 rounded-lg border border-gray-200 bg-white/80 p-3 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",D="text-xs font-semibold transition-colors",Z=P=>{if(P)return Te(P)},w=[];if(w.push($("div",{className:`${O} border-blue-200 border-l-4 dark:border-blue-500/60`,children:[$("div",{className:`${D} ${s}`,children:["\u{1F4CA} ",n.statsBasicHeading]}),N(R,{label:n.statTotalSearches,value:r(m),color:s}),N(R,{label:n.statAverageSearchTime,value:o.toFixed(2),unit:"ms",color:s}),N(R,{label:n.statTotalProcessingTime,value:c.toFixed(2),unit:"ms",color:s}),N(R,{label:n.statLastSearchTime,value:p.toFixed(2),unit:"ms",color:s}),N(R,{label:n.statErrorCount,value:f,color:f>0?"text-red-600 dark:text-red-400":s}),Z(v)&&N(R,{label:n.statUpdatedAt,value:Z(v),color:"text-gray-500 dark:text-slate-400"})]},"basic")),b>0||Object.keys(g).length>0){let P=Object.entries(g).sort(([,H],[,B])=>(Number(B)||0)-(Number(H)||0)).slice(0,6);w.push($("div",{className:`${O} border-amber-200 border-l-4 dark:border-amber-400/60`,children:[$("div",{className:`${D} text-amber-600 dark:text-amber-300`,children:["\u{1F527} ",n.statsOperationsHeading]}),N(R,{label:n.statTotalOperations,value:r(b),color:"text-amber-700 dark:text-amber-300"}),P.length>0&&N("div",{className:"mt-1 space-y-1",children:P.map(([H,B])=>N(R,{label:H,value:r(Number(B)),unit:n.timesUnit(r(Number(B))),color:"text-amber-700 dark:text-amber-300"},H))})]},"operations"))}if(E&&(w.push($("div",{className:`${O} border-green-200 border-l-4 dark:border-green-400/60`,children:[$("div",{className:`${D} text-green-700 dark:text-green-300`,children:["\u{1F3D7}\uFE0F ",n.statsIndexHeading]}),N(R,{label:n.statIndexBuilds,value:r(h.totalIndexBuilds??0),color:"text-green-700 dark:text-green-300"}),N(R,{label:n.statDataSize,value:r(h.currentDataSize??0),unit:n.itemsUnit(r(h.currentDataSize??0)),color:"text-green-700 dark:text-green-300"}),N(R,{label:n.statLastBuildTime,value:(h.lastIndexTime??0).toFixed(2),unit:"ms",color:"text-green-700 dark:text-green-300"})]},"index-core")),h.cacheSize&&w.push($("div",{className:`${O} border-emerald-200 border-l-4 dark:border-emerald-400/60`,children:[$("div",{className:`${D} text-emerald-700 dark:text-emerald-300`,children:["\u{1F4BE} ",n.statsCacheHeading]}),N(R,{label:n.statCacheNgram,value:r(h.cacheSize.ngram??0),color:"text-emerald-700 dark:text-emerald-300"}),N(R,{label:n.statCacheWord,value:r(h.cacheSize.word??0),color:"text-emerald-700 dark:text-emerald-300"}),N(R,{label:n.statCachePhonetic,value:r(h.cacheSize.phonetic??0),color:"text-emerald-700 dark:text-emerald-300"})]},"index-cache")),h.indexMetadata)){let P=Object.entries(h.indexMetadata).slice(0,6);P.length>0&&w.push($("div",{className:`${O} border-teal-200 border-l-4 dark:border-teal-400/60`,children:[$("div",{className:`${D} text-teal-700 dark:text-teal-300`,children:["\u{1F4CB} ",n.statsIndexMetadataHeading]}),P.map(([H,B])=>{let ae;if(typeof B=="number"){let ue=H.toLowerCase();ue.includes("time")&&!ue.includes("timestamp")?ae=`${B.toFixed(2)}ms`:ue.includes("timestamp")||ue.includes("at")?ae=Z(B)??B.toString():ae=r(B)}else ae=String(B);return N(R,{label:H,value:ae,color:"text-teal-700 dark:text-teal-300"},H)})]},"index-meta"))}if(V){if(w.push($("div",{className:`${O} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[$("div",{className:`${D} text-purple-700 dark:text-purple-300`,children:["\u{1F522} ",n.statsCalculationsHeading]}),N(R,{label:n.statTotalCalculations,value:r(x.totalCalculations??0),color:"text-purple-700 dark:text-purple-300"}),N(R,{label:n.statDistanceCalculations,value:r(x.totalDistanceCalculations??0),color:"text-purple-700 dark:text-purple-300"}),N(R,{label:n.statAverageDistance,value:typeof x.averageDistance=="number"?x.averageDistance.toFixed(2):"0.00",color:"text-purple-700 dark:text-purple-300"}),N(R,{label:n.statMinDistance,value:x.minDistance??n.notAvailable,color:"text-purple-700 dark:text-purple-300"}),N(R,{label:n.statMaxDistance,value:x.maxDistance??0,color:"text-purple-700 dark:text-purple-300"})]},"lev-basic")),w.push($("div",{className:`${O} border-fuchsia-200 border-l-4 dark:border-fuchsia-400/60`,children:[$("div",{className:`${D} text-fuchsia-700 dark:text-fuchsia-300`,children:["\u{1F3AF} ",n.statsMatchesHeading]}),N(R,{label:n.statPartialMatches,value:r(x.partialMatches??0),color:"text-fuchsia-700 dark:text-fuchsia-300"}),N(R,{label:n.statPerfectMatches,value:r(x.perfectMatches??0),color:"text-fuchsia-700 dark:text-fuchsia-300"}),N(R,{label:n.statEarlyTerminations,value:r(x.earlyTerminations??0),color:"text-fuchsia-700 dark:text-fuchsia-300"})]},"lev-match")),x.similarityThresholds&&w.push($("div",{className:`${O} border-rose-200 border-l-4 dark:border-rose-400/60`,children:[$("div",{className:`${D} text-rose-700 dark:text-rose-300`,children:["\u{1F4C8} ",n.statsSimilarityHeading]}),N(R,{label:n.statAbove80,value:r(x.similarityThresholds.above80??0),color:"text-emerald-700 dark:text-emerald-300"}),N(R,{label:n.statAbove60,value:r(x.similarityThresholds.above60??0),color:"text-lime-700 dark:text-lime-300"}),N(R,{label:n.statAbove40,value:r(x.similarityThresholds.above40??0),color:"text-orange-600 dark:text-orange-300"}),N(R,{label:n.statBelow40,value:r(x.similarityThresholds.below40??0),color:"text-red-600 dark:text-red-400"})]},"lev-similarity")),x.distanceDistribution){let P=Object.entries(x.distanceDistribution).sort(([,H],[,B])=>Number(B)-Number(H)).slice(0,6);P.length>0&&w.push($("div",{className:`${O} border-indigo-200 border-l-4 dark:border-indigo-500/60`,children:[$("div",{className:`${D} text-indigo-700 dark:text-indigo-300`,children:["\u{1F4CA} ",n.statsDistanceHeading]}),P.map(([H,B])=>N(R,{label:n.statDistance(H),value:r(Number(B)),unit:n.timesUnit(r(Number(B))),color:"text-indigo-700 dark:text-indigo-300"},H))]},"lev-distance"))}if(x.queryLengthStats){let P=Object.entries(x.queryLengthStats).sort(([,H],[,B])=>(B.count??0)-(H.count??0)).slice(0,6);P.length>0&&w.push($("div",{className:`${O} border-violet-200 border-l-4 dark:border-violet-400/60`,children:[$("div",{className:`${D} text-violet-700 dark:text-violet-300`,children:["\u{1F4CF} ",n.statsQueryLengthHeading]}),P.map(([H,B])=>{let ae=Number(B.count??0),ue=Number(B.averageScore??0);return N(R,{label:n.statQueryLength(H),value:n.statQueryLengthValue({count:ae,averagePercent:(ue*100).toFixed(1)}),color:"text-violet-700 dark:text-violet-300"},H)})]},"lev-query-length"))}}if(Object.keys(T).length>0){let P=Object.entries(T).sort(([,H],[,B])=>(B.averageScore??0)-(H.averageScore??0)).slice(0,6);w.push($("div",{className:`${O} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[$("div",{className:`${D} text-purple-700 dark:text-purple-300`,children:["\u{1F4CB} ",n.statsFieldPerformanceHeading]}),P.map(([H,B])=>{let ae=B;return $("div",{className:"space-y-1 rounded bg-purple-50/60 p-2 transition-colors dark:bg-slate-900/50",children:[N("div",{className:"font-semibold text-purple-700 text-xs transition-colors dark:text-purple-300",children:H}),N(R,{label:n.statAverageScore,value:`${((ae.averageScore??0)*100).toFixed(1)}%`,color:"text-purple-700 dark:text-purple-300"}),N(R,{label:n.statMatchCount,value:r(ae.matchCount??0),unit:n.itemsUnit(r(ae.matchCount??0)),color:"text-purple-700 dark:text-purple-300"}),N(R,{label:n.statBestWorstScore,value:`${((ae.bestScore??0)*100).toFixed(1)}% / ${((ae.worstScore??0)*100).toFixed(1)}%`,color:"text-purple-700 dark:text-purple-300"})]},H)})]},"field-performance"))}if(C.bestPerformingField||C.totalHistoryEntries||C.similarityDistribution){let P=(C.recentAverageResultCount??0).toFixed(1);w.push($("div",{className:`${O} border-blue-200 border-l-4 dark:border-blue-400/60`,children:[$("div",{className:`${D} text-blue-700 dark:text-blue-300`,children:["\u{1F50D} ",n.statsInsightsHeading]}),C.bestPerformingField&&N(R,{label:n.statBestField,value:C.bestPerformingField,color:"text-blue-700 dark:text-blue-300"}),N(R,{label:n.statRecentAverageTime,value:(C.recentAverageProcessingTime??0).toFixed(2),unit:"ms",color:"text-blue-700 dark:text-blue-300"}),N(R,{label:n.statRecentAverageResults,value:P,unit:n.itemsUnit(P),color:"text-blue-700 dark:text-blue-300"}),N(R,{label:n.statThroughput,value:(C.throughputPerSecond??0).toFixed(2),unit:n.throughputUnit,color:"text-blue-700 dark:text-blue-300"}),N(R,{label:n.statCommonQueryLength,value:r(C.mostCommonQueryLength??0),unit:n.charactersUnit(r(C.mostCommonQueryLength??0)),color:"text-blue-700 dark:text-blue-300"}),N(R,{label:n.statHistoryEntries,value:r(C.totalHistoryEntries??0),color:"text-blue-700 dark:text-blue-300"}),C.similarityDistribution&&$("div",{className:"mt-1 grid grid-cols-2 gap-1",children:[N(R,{label:n.statHighSimilarity,value:r(C.similarityDistribution.highSimilarity??0),color:"text-emerald-700 dark:text-emerald-300"}),N(R,{label:n.statMediumSimilarity,value:r(C.similarityDistribution.mediumSimilarity??0),color:"text-lime-700 dark:text-lime-300"}),N(R,{label:n.statLowSimilarity,value:r(C.similarityDistribution.lowSimilarity??0),color:"text-orange-600 dark:text-orange-300"}),N(R,{label:n.statVeryLowSimilarity,value:r(C.similarityDistribution.veryLowSimilarity??0),color:"text-red-600 dark:text-red-400"})]})]},"performance-insights"))}return z.length>0&&w.push($("div",{className:`${O} border-sky-200 border-l-4 dark:border-sky-400/60`,children:[$("div",{className:`${D} text-sky-700 dark:text-sky-300`,children:["\u{1F4C8} ",n.statsRecentHistoryHeading]}),z.slice(-3).reverse().map((P,H)=>$("div",{className:"rounded bg-sky-50/70 p-2 transition-colors dark:bg-slate-900/50",children:[N("div",{className:"font-medium text-sky-700 transition-colors dark:text-sky-300",children:P.operationType}),N("div",{className:"text-sky-600 text-xs transition-colors dark:text-sky-200",children:n.statsHistoryEntry({processingTimeMs:P.processingTime.toFixed(2),resultCount:P.resultCount??0})}),Z(P.timestamp)&&N("div",{className:"text-[10px] text-sky-500 transition-colors dark:text-sky-200",children:Z(P.timestamp)})]},`${P.operationType}-${P.timestamp??H}`))]},"recent-history")),$("section",{className:"space-y-2",children:[$("div",{className:`flex items-center gap-2 font-semibold text-xs ${s}`,children:[N("span",{children:t}),N("span",{className:"tracking-wide",children:y})]}),N("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:w})]})});Mt.displayName="WorkerStatsSection";import{jsx as ke,jsxs as Ce}from"react/jsx-runtime";var To={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},kn=So(({performanceMetrics:e,searchTerm:t,totalDataCount:a,resultsCount:s,resetStats:i,rebuildIndex:n,isIndexBuilding:r,activeTab:d,onTabChange:l})=>{let{locale:u,labels:m}=he(),c=t.trim(),o=c?s:a,{setScrollableRef:p,onPointerDown:f,onPointerMove:v,onPointerUp:T,onPointerLeave:C,onPointerCancel:z,onClickCapture:k}=Ze(),b=d!=="index"||r,g=r?m.statsRebuildingTitle:d!=="index"?m.statsRebuildIndexTabOnlyTitle:m.statsRebuildTitle,E=b?"cursor-not-allowed bg-gray-300 text-gray-500 dark:bg-slate-700 dark:text-slate-400":"bg-blue-500 text-white hover:bg-blue-600 dark:bg-blue-500 dark:hover:bg-blue-600",V=r?`\u23F3 ${m.statsRebuilding}`:`\u{1F3D7}\uFE0F ${m.statsRebuild}`;return Ce("div",{className:"wrap-break-word flex w-full flex-col gap-1.5 rounded-lg border border-blue-300 bg-white p-1.5 shadow-md transition-colors dark:border-blue-500/40 dark:bg-slate-900/80 dark:shadow-blue-900/30",children:[Ce("div",{className:"mb-0.5 flex shrink-0 flex-col gap-1 rounded bg-blue-50 px-1.5 py-0.5 transition-colors sm:flex-row sm:items-center sm:justify-between dark:bg-blue-900/30",children:[Ce("h3",{className:"font-semibold text-gray-700 text-xs transition-colors dark:text-slate-100",children:["\u{1F4CA} ",m.searchStatistics]}),Ce("div",{className:"flex flex-wrap gap-1.5",children:[ke("button",{type:"button",onClick:()=>n(),disabled:b,className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${E}`,title:g,children:V}),Ce("button",{type:"button",onClick:i,className:"rounded bg-red-500 px-1.5 py-0.5 text-[10px] text-white transition-colors hover:bg-red-600 dark:hover:bg-red-700",title:m.statsResetTitle,children:["\u{1F504} ",m.reset]})]})]}),ke("div",{className:"mb-0 shrink-0",children:Ce("div",{ref:p,className:"flex space-x-1 overflow-x-auto text-nowrap rounded-md bg-gray-100 p-0.5 transition-colors dark:bg-slate-800/80",style:To,onPointerDown:f,onPointerMove:v,onPointerUp:T,onPointerLeave:C,onPointerCancel:z,onClickCapture:k,children:[Ce("button",{type:"button",onClick:()=>l("overview"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${d==="overview"?"bg-blue-500 text-white dark:bg-blue-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CB} ",m.statsOverviewTab]}),Ce("button",{type:"button",onClick:()=>l("index"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${d==="index"?"bg-green-500 text-white dark:bg-green-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CA} ",m.statsIndexTab]}),Ce("button",{type:"button",onClick:()=>l("levenshtein"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${d==="levenshtein"?"bg-purple-500 text-white dark:bg-purple-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CF} ",m.statsLevenshteinTab]})]})}),Ce("div",{className:"flex flex-col gap-1 pb-0.5",children:[Ce("div",{className:`${d==="overview"?"grid":"hidden"} grid-cols-1 gap-2 pr-1 text-gray-600 text-xs transition-colors sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 dark:text-slate-300`,children:[ke(R,{label:m.statTotalSearches,value:G(u,e.totalSearches)}),ke(R,{label:m.statAverageSearchTime,value:e.averageSearchTime.toFixed(1),unit:"ms"}),ke(R,{label:m.statDataCount,value:G(u,e.itemCount)}),ke(R,{label:c?m.statResultCount:m.statDisplayedCount,value:G(u,o)})]}),ke("div",{className:`${d==="index"?"space-y-3":"hidden"} pr-1 text-gray-600 text-xs transition-colors dark:text-slate-300`,children:ke(Mt,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:"text-green-600 dark:text-green-300"})}),ke("div",{className:`${d==="levenshtein"?"space-y-3":"hidden"} pr-1 text-gray-600 text-xs transition-colors dark:text-slate-300`,children:ke(Mt,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:"text-purple-600 dark:text-purple-300"})}),Ce("div",{className:"hidden",children:[ke(Mt,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:"text-green-600 dark:text-green-300"}),ke(Mt,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:"text-purple-600 dark:text-purple-300"})]})]})]})});kn.displayName="StatisticsPanel";import{Fragment as Wr,jsx as se,jsxs as ge}from"react/jsx-runtime";var Mo=/[\u200B\uFEFF]/g,Tn=typeof window<"u",Ir=Tn&&typeof document<"u",Ea=(e,t=[],a=!1)=>{let s=_r(e);s.current=e,Ue(()=>{if(!(!Tn||a&&!Ir))return s.current()},[a,...t])},Er=(e,t,a)=>{let[s,i]=He(()=>{let n=Or(r=>r.getItem(e));return n&&t.includes(n)?n:a});return Ea(()=>{Or(n=>{n.setItem(e,s)})},[e,s]),[s,i]},Or=e=>{if(!Tn)return null;try{return e(window.sessionStorage)}catch{return null}},Dr=(e,t)=>{let[a,s]=He(e);return Ue(()=>{let i=setTimeout(()=>{s(e)},t);return()=>{clearTimeout(i)}},[e,t]),a},Eo="contact-map.settings-tab",Oo="contact-map.statistics-tab",Do=["basic","advanced","index","levenshtein"],Ho=["overview","index","levenshtein"],Hr=["full_name","company_name","department","title","email","company_phone_number","mobile_phone_number"],Wo={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},Ar=({streamState:e,workerUrls:t,onFooterVisibilityChange:a,children:s}={})=>{let i=Je(),{locale:n,labels:r}=he(),d=Ca(),l=at(()=>e||{contactMapRecords:d.records,isStreamingComplete:d.isComplete,isStreamingFailed:d.phase==="failed",streamPhase:d.phase,loadedCount:d.loadedCount,companyCount:0,totalCount:d.totalCount,errorMessage:d.error?.message??null},[e,d]),{contactMapRecords:u,isStreamingComplete:m,isStreamingFailed:c}=l,o=Lo(),[p]=Ro(),f=_r(null),[v,T]=He(!0),[C,z]=He(i.openEmailsWithGmail??!1),[k,b]=He(p.get("q")||""),g=Dr(k,300);Ue(()=>{let U=p.get("q")||"";b(j=>j!==U?U:j)},[p]),Ue(()=>{if(typeof window>"u")return;let U=new URL(window.location.href);(U.searchParams.get("q")||"")!==g&&(g?U.searchParams.set("q",g):U.searchParams.delete("q"),window.history.replaceState(window.history.state,"",U.toString()))},[g]);let[E,V]=Po(),[y,h]=He("search"),[x,O]=Er(Eo,Do,"basic"),[D,Z]=Er(Oo,Ho,"overview"),{setScrollableRef:w,onPointerDown:P,onPointerMove:H,onPointerUp:B,onPointerLeave:ae,onPointerCancel:ue,onClickCapture:ie}=Ze(),ne=Yt(()=>{if(!Ir)return;let U=f.current;!U||document.activeElement===U||window.requestAnimationFrame(()=>{try{U.focus({preventScroll:!0})}catch{}})},[]),nt=Yt(U=>{let j=U;h(j),j==="search"&&ne()},[ne]),ft=at(()=>{let{indexWorkerOptions:U={},levenshteinWorkerOptions:j={},...S}=Sn;return{...S,autoSearchOnIndexRebuild:!1,debounceMs:0,workerUrls:t,indexWorkerOptions:{...U},levenshteinWorkerOptions:{...j}}},[t]),[bt,Le]=He(ft),ce=(bt.multiTermOperator??Sn.multiTermOperator)==="and",yt=ce?r.operatorAndTitle:r.operatorOrTitle,Jt=Dr(u,m?0:800),{searchTerm:ee,setSearchTerm:Zt,filteredItems:xt,isSearching:We,isIndexBuilding:be,clearSearch:Ot,resetStats:Oa,performanceMetrics:ve,rebuildIndex:ea,error:vt}=No(Jt,Hr,bt),$e=ee.trim().length>0,[_e,Ct]=He(""),[kt,Ve]=He(()=>ee),rt=at(()=>ua(k),[k]),Ie=at(()=>ua(g),[g]);Ue(()=>{g===_e&&Ie===ee||V(()=>{Ct(g),Zt(Ie)})},[g,_e,Ie,ee,Zt]);let Da=Yt(U=>{let S=U.target.value.replace(Mo,"");b(S)},[]),St=Yt(()=>{b(""),Ct(""),Ot(),ne()},[Ot,ne]),Ha=Yt(()=>{Le(U=>{let S=(U.multiTermOperator??Sn.multiTermOperator??"and")==="and"?"or":"and";return{...U,multiTermOperator:S}}),ne()},[ne]);Ea(()=>{if(!(y==="search"&&o.state==="idle"&&!E))return;let j=document.activeElement;if(!!!(j?.matches('[role="tab"]')||j?.closest('[role="tablist"]')?.getAttribute("role")==="tablist")&&j&&j!==document.body&&j!==f.current)return;let A=window.requestAnimationFrame(()=>{ne()});return()=>{window.cancelAnimationFrame(A)}},[y,o.state,E,ne],!0),Ea(()=>{if(y!=="search")return;let U=[[document,"visibilitychange",()=>{document.visibilityState==="visible"&&ne()}],[window,"pageshow",()=>{ne()}]];for(let[j,S,A]of U)j.addEventListener(S,A);return()=>{for(let[j,S,A]of U)j.removeEventListener(S,A)}},[y,ne],!0),Ue(()=>(a&&a(y==="search"?"mobile-hidden":"visible"),()=>{a&&a("visible")}),[y,a]),Ea(()=>{let U=document.body,j=U.style.overflow;return y==="search"&&(U.style.overflow="hidden"),()=>{U.style.overflow=j}},[y],!0),Ue(()=>{ve&&Qe.info("\u{1F4CA} [STATE] \u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u6307\u6A19\u304C\u66F4\u65B0\u3055\u308C\u307E\u3057\u305F:",{totalSearches:ve.totalSearches,averageSearchTime:ve.averageSearchTime,itemCount:ve.itemCount,resultsCount:ve.resultsCount,workersAvailable:!!ve.workerStats})},[ve]);let{isAwaitingDebounce:ta,isAwaitingSearchTermSync:st,isSearchInProgress:Ae}=at(()=>{let U=rt!==Ie,j=Ie!==ee,S=ee.trim().length>0||rt.trim().length>0;return{isAwaitingDebounce:U,isAwaitingSearchTermSync:j,isSearchInProgress:E||We||S&&be||U||j||kt!==ee}},[rt,Ie,ee,E,We,be,kt]),[Ke,Wa]=He(ee);Ue(()=>{Ke!==ee&&Wa(ee)},[ee,Ke]),Ue(()=>{ta||st||E||We||be||Ke===ee&&kt!==ee&&Ve(ee)},[ee,kt,ta,st,E,We,be,Ke]);let Dt=at(()=>Vn(_e,Hr),[_e]),aa=at(()=>Dt(xt),[Dt,xt]),na=at(()=>({contactMapRecords:u,filteredItems:aa,searchQuery:_e,searchTerm:ee,isSearching:We,isIndexBuilding:be,isPending:E,hasSearchTerm:$e,enableHighlighting:v,openEmailsWithGmail:C,isSearchInProgress:Ae,isSearchTabActive:y==="search",errorMessage:vt??null,isStreamingComplete:m,isStreamingFailed:c}),[u,aa,_e,ee,We,be,E,$e,v,C,Ae,y,vt,m,c]),_a=$e?xt.length:u.length,ra=G(n,u.length),Ht=G(n,xt.length);return se("div",{className:`scrollbar-hidden bg-slate-50 text-slate-900 dark:bg-slate-900 dark:text-slate-100${y==="search"?" h-full min-h-0":""}`,children:ge(fa,{value:y,onValueChange:nt,className:`flex flex-col${y==="search"?" h-full min-h-0":""}`,children:[ge(Bt,{ref:w,style:Wo,className:"scrollbar-none mt-0 mb-1 flex w-full touch-pan-x flex-nowrap overflow-x-auto overflow-y-hidden rounded-md bg-slate-50 transition-colors dark:bg-slate-900/70 dark:text-slate-200",onPointerDown:P,onPointerMove:H,onPointerUp:B,onPointerLeave:ae,onPointerCancel:ue,onClickCapture:ie,children:[ge(ut,{value:"search",className:"min-w-16 px-2 py-0.5 text-xs transition-colors sm:min-w-24 sm:px-2.5 sm:py-0.5 sm:text-xs dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100",children:["\u{1F50D} ",r.searchTab]}),ge(ut,{value:"settings",className:"min-w-16 px-2 py-0.5 text-xs transition-colors sm:min-w-24 sm:px-2.5 sm:py-0.5 sm:text-xs dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100",children:["\u2699\uFE0F ",r.searchSettings]}),ge(ut,{value:"statistics",className:"min-w-16 px-2 py-0.5 text-xs transition-colors sm:min-w-24 sm:px-2.5 sm:py-0.5 sm:text-xs dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100",children:["\u{1F4CA} ",r.searchStatistics]})]}),se(mt,{value:"search",className:"mt-0 flex h-full min-h-0 flex-col overflow-hidden",children:ge("div",{className:"flex h-full flex-col",children:[se("div",{className:"rounded-md border border-gray-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/80 dark:shadow-none",children:ge("div",{className:"flex flex-col",children:[se("div",{className:"relative",children:ge("div",{className:"flex items-center gap-1 p-1",children:[ge("button",{type:"button",onClick:Ha,"aria-pressed":ce,title:yt,className:`inline-flex min-w-9 items-center justify-center gap-0.5 rounded border px-1.5 py-0.5 font-semibold text-[10px] transition-colors sm:min-w-12 sm:px-2 sm:py-0.5 sm:text-xs ${ce?"border-blue-500 bg-blue-600 text-white hover:bg-blue-700 dark:border-blue-400 dark:bg-blue-500 dark:hover:bg-blue-600":"border-amber-400 bg-amber-100 text-amber-800 hover:bg-amber-200 dark:border-amber-500/70 dark:bg-amber-300/20 dark:text-amber-200 dark:hover:bg-amber-300/30"}`,children:[se("span",{className:"text-[10px] sm:text-xs",children:ce?r.operatorAnd:r.operatorOr}),se("span",{className:"hidden text-[10px] sm:inline",children:ce?r.operatorAndHint:r.operatorOrHint})]}),se("input",{ref:f,type:"text",value:k,onChange:Da,placeholder:r.searchPlaceholder,className:"flex-1 rounded border border-gray-300 border-solid px-2 py-0.5 text-xs shadow-sm transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 sm:px-2 sm:py-0.5 sm:text-xs dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100 dark:shadow-none"}),k&&se("button",{type:"button",onClick:St,className:"flex items-center justify-center gap-1 rounded border border-gray-300 px-1.5 py-0.5 text-[10px] transition-colors hover:text-gray-700 sm:px-2 sm:py-0.5 sm:text-xs dark:border-slate-600 dark:bg-slate-800/70 dark:text-slate-300 dark:hover:text-slate-100",title:Ae?r.searchBusyTitle:r.clearSearch,disabled:Ae,children:Ae?ge(Wr,{children:[se(wo,{"aria-hidden":"true",className:"h-3 w-3 animate-spin sm:h-3.5 sm:w-3.5"}),se("span",{className:"hidden sm:inline",children:r.searching})]}):"\u2715"})]})}),ge("p",{className:"px-1.5 py-0.5 text-[10px] text-slate-700 leading-snug transition-colors sm:text-[11px] dark:text-slate-200",children:[r.registeredCountLabel," ",se("span",{className:"font-semibold text-[11px] text-slate-900 sm:text-xs dark:text-white",children:ra})," ",r.recordUnit(ra),be?ge("span",{className:"ml-1.5 inline-flex items-center rounded bg-blue-50 px-1.5 py-0.2 text-[10px] text-blue-700 sm:text-[11px] dark:bg-blue-900/40 dark:text-blue-200",children:["\u23F3 ",r.rebuildingIndex]}):null,vt?ge("span",{className:"ml-1.5 inline-flex items-center rounded bg-rose-50 px-1.5 py-0.2 text-[10px] text-rose-700 sm:text-[11px] dark:bg-rose-900/40 dark:text-rose-200",children:["\u26A0\uFE0F ",r.errorLabel,se("span",{className:"ml-1 break-all font-semibold",children:vt})]}):null,$e&&ge("span",{className:"ml-1.5 text-[10px] text-blue-600 sm:text-[11px] dark:text-sky-400",children:["| ",r.resultCountLabel,Ae?se("span",{className:"ml-1 font-semibold text-[10px] sm:text-[11px]",children:r.searching}):ge(Wr,{children:[se("span",{className:"ml-1 font-semibold text-[11px] text-slate-900 sm:text-xs dark:text-white",children:Ht}),se("span",{className:"ml-0.5 text-[10px] sm:text-[11px]",children:r.resultUnit(Ht)})]})]})]}),se("div",{className:"h-2.5 px-2 pb-1.5",children:be?se(rr,{className:"h-1 bg-blue-200 dark:bg-blue-800",indicatorClassName:"bg-blue-500 dark:bg-blue-400"}):null})]})}),s?s(na):se(Mr,{context:na})]})}),se(mt,{value:"settings",className:"mt-0",children:se(vn,{searchOptions:bt,setSearchOptions:Le,enableHighlighting:v,setEnableHighlighting:T,openEmailsWithGmail:C,setOpenEmailsWithGmail:z,activeTab:x,onTabChange:O})}),se(mt,{value:"statistics",className:"mt-0",children:se(kn,{performanceMetrics:ve,searchTerm:ee,totalDataCount:u.length,resultsCount:_a,resetStats:Oa,rebuildIndex:ea,isIndexBuilding:be,activeTab:D,onTabChange:Z})})]})})};import{jsx as Et,jsxs as Fr}from"react/jsx-runtime";var _o=({renderHeader:e,title:t,streamEndpoint:a,workerUrls:s,onFooterVisibilityChange:i})=>{let n=q(),r=t===void 0?n.appTitle:t,d=Ca(a),l=d.records,u=Nn(()=>l.reduce((o,{company_name:p})=>(typeof p=="string"&&p.trim().length>0&&o.add(p),o),new Set).size,[l]),m=Et(ln,{recordCount:l.length,companyCount:u,phase:d.phase,loadedCount:d.loadedCount,totalCount:d.totalCount,errorMessage:d.error?.message??null,onRetry:d.retryNow}),c=Nn(()=>({contactMapRecords:l,isStreamingComplete:d.isComplete,isStreamingFailed:d.phase==="failed",streamPhase:d.phase,loadedCount:d.loadedCount,companyCount:u,totalCount:d.totalCount,errorMessage:d.error?.message??null}),[l,d.isComplete,d.phase,d.loadedCount,u,d.totalCount,d.error]);return Fr("div",{"data-testid":"contact-map-app-view",className:"flex h-full w-full flex-col",children:[e?e({title:r,annotation:m}):Fr("div",{"data-testid":"contact-map-default-header",className:"mb-2 flex items-center justify-between",children:[Et("h1",{className:"font-bold text-xl",children:r}),m]}),Et("div",{className:"min-h-0 flex-1",children:Et(Ar,{streamState:c,workerUrls:s,onFooterVisibilityChange:i})})]})},jp=e=>{let t=Je(),a=Nn(()=>({...t,streamEndpoint:e.streamEndpoint??t.streamEndpoint,workerUrls:{...t.workerUrls,...e.workerUrls},locale:e.locale===void 0?t.locale:e.locale,labels:e.labels===void 0?t.labels:e.labels}),[t,e.streamEndpoint,e.workerUrls,e.locale,e.labels]);return Et(Zn,{config:a,children:Et(_o,{...e})})};lt();oe();function Qp(){return!1}export{Ka as AdvancedSearchSettings,ja as BasicSearchSettings,Nt as CONTACT_MAP_LABEL_CATALOGS,Wt as CONTACT_MAP_LABEL_KEYS,Kn as ContactDetailGrid,Ye as ContactDetailPanel,ca as ContactDetailPopup,pa as ContactDetailRowLayout,ln as ContactMapAnnotation,jp as ContactMapAppView,Zn as ContactMapConfigProvider,yr as ContactMapSearchListView,Ar as ContactMapSearchPage,Mr as ContactMapSearchTabGroup,Rr as ContactMapSearchTreeView,xa as ContactMapStreamClient,pe as HighlightedText,bn as IndexWorkerSettings,$d as LIST_COLLAPSE_THRESHOLD,Pi as LIST_DETAIL_PANEL_MIN_WIDTH,Vd as LIST_EXPAND_THRESHOLD,wi as LIST_PANEL_MIN_WIDTH,Li as LIST_RESIZE_HANDLE_THICKNESS,yn as LevenshteinWorkerSettings,rr as Progress,vn as SearchOptionsPanel,R as StatItem,kn as StatisticsPanel,Na as SwipeOverlay,Nc as TREE_COLLAPSE_THRESHOLD,to as TREE_DETAIL_PANEL_MIN_WIDTH,wc as TREE_EXPAND_THRESHOLD,eo as TREE_PANEL_MIN_WIDTH,ao as TREE_RESIZE_HANDLE_THICKNESS,fa as Tabs,mt as TabsContent,Bt as TabsList,ut as TabsTrigger,La as TreeWorkerSession,Mt as WorkerStatsSection,io as composeTreeVirtualScrollOptions,Qp as contactMapShouldRevalidate,Xs as deserializeStreamRecord,ec as finalizeTreeWorker,tr as getContactMapRecordMap,er as getContactMapStreamClient,un as getTreeWorkerSession,ud as resetContactMapStreamClientForTesting,tc as resetTreeWorkerSessionForTesting,za as resolveContactMapLabels,Zd as syncTreeWorkerRecords,xr as useAnimatedNumber,Je as useContactMapConfig,q as useContactMapLabels,Ca as useContactMapStream,cn as useContactPanelSizing,sr as useDynamicViewportHeight,Ze as useHorizontalDragScroll,Sa as useLongPressPopup,_i as useReportPopupVisibility,Ta as useResponsiveTwoColumnLayout,Wi as useRowPopupRegistry,kr as useTreeWorker};
1
+ var po=Object.defineProperty;var Te=(e,t)=>()=>(e&&(t=e(e=0)),t);var uo=(e,t)=>{for(var a in t)po(e,a,{get:t[a],enumerable:!0})};var ae,Kn,Pt=Te(()=>{"use strict";ae=e=>{switch(typeof e){case"string":return JSON.stringify(e);case"bigint":return`${e}n`;case"symbol":return e.toString();case"object":return e===null?"null":Kn(e);case"function":return Kn(e);case"number":return Object.is(e,-0)?"-0":String(e);default:return String(e)}},Kn=e=>{try{return Object.prototype.toString.call(e)}catch{return"[object ?]"}}});var Mt,me,Rt=Te(()=>{"use strict";Mt=e=>{if(typeof e!="object"||e===null)return!1;try{let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}catch{return!1}},me=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0});var mo,ma,Qa=Te(()=>{"use strict";mo=(e,t)=>{let a=Array.from({length:t.length+1},(r,s)=>s);for(let r=1;r<=e.length;r+=1){let s=[r];for(let n=1;n<=t.length;n+=1){let o=a[n-1]+(e[r-1]===t[n-1]?0:1);s.push(Math.min(a[n]+1,s[n-1]+1,o))}a=s}return a[t.length]},ma=(e,t)=>{let a=e.toLowerCase();if(a.length>=3){let s=t.find(n=>n.toLowerCase().startsWith(a));if(s!==void 0)return s}let r;for(let s of t){let n=mo(a,s.toLowerCase());n<=Math.max(1,Math.floor(s.length/4))&&(r===void 0||n<r.distance)&&(r={key:s,distance:n})}return r?.key}});import{DIRECTORY_TREE_LABEL_CATALOGS as jn,DIRECTORY_TREE_LABEL_KEYS as Ya,resolveDirectoryTreeLabels as go}from"@aiquants/directory-tree";import{resolveVirtualScrollLocale as ho,VIRTUAL_SCROLL_LABEL_KEYS as fo}from"@aiquants/virtualscroll";var yo,j,ut,ga,Gn,Vt,Be,bo,qn,Qn,xo,Ja,vo,Co,ko,Xa,Za,en,mt=Te(()=>{"use strict";Pt();Rt();Qa();yo=Object.freeze({en:"en-US",ja:"ja-JP"}),j=(e,t)=>t.toLocaleString(yo[e]),ut=(e,t,a)=>e==="1"?t:a,ga=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)`,annotationAuthRequired:"Session expired: sign in again, then retry",annotationRetry:"Retry",recordUnit:e=>ut(e,"record","records"),companyUnit:e=>ut(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=>ut(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} ${ut(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=>ut(e," time"," times"),itemsUnit:e=>ut(e," item"," items"),charactersUnit:e=>ut(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)`,annotationAuthRequired:"\u30BB\u30C3\u30B7\u30E7\u30F3\u304C\u5207\u308C\u307E\u3057\u305F\u3002\u30B5\u30A4\u30F3\u30A4\u30F3\u3057\u76F4\u3057\u3066\u304B\u3089\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044",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"})}),Gn=Object.freeze(Object.keys(ga.en)),Vt=Object.freeze([...Ya,...Gn]),Be=Object.freeze({en:Object.freeze({...jn.en,...ga.en}),ja:Object.freeze({...jn.ja,...ga.ja})}),bo=new Set(Vt),qn=Object.keys(Be).map(e=>JSON.stringify(e)).join(" or "),Qn=Object.freeze({locale:"locale",labels:"labels"}),xo=(e,t,a)=>{e[t]=a},Ja=(e,t=Qn.locale)=>{if(e!==void 0&&typeof e!="string")throw new TypeError(`[contact-map] ${t} must be ${qn} or left out; got ${ae(e)}`);if(e!==void 0&&!Object.hasOwn(Be,e))throw new RangeError(`[contact-map] ${t} must be ${qn} or left out; got ${ae(e)}`);return ho(e)},vo=(e,t,a,r)=>{if(typeof r=="function"){if(typeof a!="function")throw new TypeError(`[contact-map] ${e}.${t} must be a function; got ${ae(a)}`);return}if(typeof a!="string")throw new TypeError(`[contact-map] ${e}.${t} must be a string; got ${ae(a)}`);if(a.trim()==="")throw new RangeError(`[contact-map] ${e}.${t} must not be empty or blank; got ${ae(a)}`)},Co=(e,t,a)=>{let r=Object.create(null);for(let s of Object.getOwnPropertyNames(e)){if(!bo.has(s)){let o=ma(s,Vt);throw new RangeError(`[contact-map] ${a} has a key that is not a label key (${o===void 0?"":`did you mean ${JSON.stringify(o)}? `}CONTACT_MAP_LABEL_KEYS lists every key); got ${ae(s)}`)}let n=e[s];n!==void 0&&(vo(a,s,n,t[s]),r[s]=n)}return r},ko=e=>{let t={},a=!1;for(let r of Ya){let s=e[r];s!==void 0&&(t[r]=s,a=!0)}return a?t:void 0},Xa=(e,t,a=Qn)=>{let r=Ja(e,a.locale);if(t===void 0)return Be[r];if(!Mt(t))throw new TypeError(`[contact-map] ${a.labels} must be a plain object or left out; got ${ae(t)}`);let s=Co(t,Be[r],a.labels),o={...go(r,ko(s)),...ga[r]};for(let c of Gn){let l=s[c];l!==void 0&&xo(o,c,l)}return Object.freeze(o)},Za=e=>{let t={};for(let a of Ya)t[a]=e[a];return Object.freeze(t)},en=e=>{let t={};for(let a of fo)t[a]=e[a];return Object.freeze(t)}});import{DIRECTORY_TREE_LABEL_KEYS as So}from"@aiquants/directory-tree";import{VIRTUAL_SCROLL_LABEL_KEYS as To}from"@aiquants/virtualscroll";import{createContext as wo,useContext as Jn,useMemo as Yn,useRef as No}from"react";import{jsx as Mo}from"react/jsx-runtime";var Po,an,tn,Xn,fe,q,se=Te(()=>{"use strict";mt();Po=Object.freeze({locale:"en",labels:Be.en,treeLabels:Za(Be.en),engineLabels:en(Be.en)}),an=wo(Po),tn=(e,t)=>{let a=No(null),r=a.current;return r!==null&&t.every(s=>r[s]===e[s])?r:(a.current=e,e)},Xn=({locale:e,labels:t,surface:a,children:r})=>{let s=Ja(e,a.locale),n=Yn(()=>Xa(s,t,a),[s,t,a]),o=tn(n,Vt),c=tn(Za(o),So),l=tn(en(o),To),d=Yn(()=>({locale:s,labels:o,treeLabels:c,engineLabels:l}),[s,o,c,l]);return Mo(an.Provider,{value:d,children:r})},fe=()=>Jn(an),q=()=>Jn(an).labels});var ha,fa,er,ya,ba,Kt,$e,tr,we,K,ht=Te(()=>{"use strict";ha=e=>{if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null},fa=e=>!e||typeof e!="object"?null:"item"in e?e.item??null:"person_id"in e?e:null,er=(e,t)=>{if(!e)return{value:null,fieldKey:null};for(let a of t){let r=ha(e[a]);if(r)return{value:r,fieldKey:a}}return{value:null,fieldKey:null}},ya=e=>er(e,["custom_email","email"]),ba=e=>er(e,["custom_mobile_phone_number","mobile_phone_number","company_phone_number"]),Kt=e=>{let t=ha(e);if(!t)return null;let a=t.replace(/[^0-9+#*]/g,"");return a.length===0?null:`tel:${a}`},$e=(e,t)=>{let a=ha(e);return a?t?`https://mail.google.com/mail/?view=cm&fs=1&to=${encodeURIComponent(a)}`:`mailto:${encodeURIComponent(a)}`:null},tr=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]},we=e=>{if(!e)return"-";let t=typeof e=="string"||typeof e=="number"?new Date(e):e;return!(t instanceof Date)||Number.isNaN(t.getTime())?typeof e=="string"?e:"-":t.toISOString()},K=e=>e==null?"-":typeof e=="string"?ha(e)??"-":typeof e=="number"?Number.isFinite(e)?String(e):"-":e instanceof Date?we(e):String(e)});import Eo from"lucide-react/dist/esm/icons/check.js";import Oo from"lucide-react/dist/esm/icons/copy.js";import Wo from"lucide-react/dist/esm/icons/x.js";import{useCallback as et,useEffect as ln,useMemo as jt,useRef as dn,useState as rr}from"react";import{createPortal as Do}from"react-dom";import{jsx as G,jsxs as Ne}from"react/jsx-runtime";var Ho,ar,Gt,Et,_o,Ao,qt,on,nr,sn,xa,cn=Te(()=>{"use strict";ht();se();Ho=350,ar=["dblclick","pointerdown","pointerup","mousedown","mouseup","touchstart","touchend","contextmenu"],Gt=0,Et=null,_o=()=>{let e=document.body.style;Gt+=1,Gt===1&&(Et={userSelect:e.userSelect,webkitUserSelect:e.webkitUserSelect}),e.userSelect="none",typeof e.webkitUserSelect<"u"&&(e.webkitUserSelect="none")},Ao=()=>{if(Gt=Math.max(0,Gt-1),Gt>0||!Et)return;let e=document.body.style;e.userSelect=Et.userSelect,typeof Et.webkitUserSelect<"u"&&(e.webkitUserSelect=Et.webkitUserSelect),Et=null},qt=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},on=(e,t)=>{let a=new Set;return e.reduce((r,s)=>{let n=typeof s.value=="string"?s.value.trim():"";if(!n)return r;let{normalized:o,key:c,entry:l}=t(n,s);return o&&!a.has(c)&&(a.add(c),r.push(l(o))),r},[])},nr=(e,t)=>e===t,sn=({value:e,ariaLabel:t,size:a="md"})=>{let[r,s]=rr(!1),n=dn(null),o=et(async p=>{if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(p),!0}catch{}if(typeof document>"u")return!1;let i=document.createElement("textarea");i.value=p,i.setAttribute("readonly",""),i.style.position="absolute",i.style.left="-9999px",document.body.appendChild(i),i.select(),i.setSelectionRange(0,i.value.length);let u=document.execCommand("copy");return document.body.removeChild(i),u},[]),c=et(async p=>{p.preventDefault(),p.stopPropagation(),n.current!==null&&typeof window<"u"&&(window.clearTimeout(n.current),n.current=null);let i=await o(e);s(i),i&&typeof window<"u"&&(n.current=window.setTimeout(()=>{s(!1),n.current=null},1500))},[o,e]);ln(()=>()=>{n.current!==null&&typeof window<"u"&&(window.clearTimeout(n.current),n.current=null)},[]);let l=a==="sm"?"h-6 w-6":"h-7 w-7",d=a==="sm"?"h-3.5 w-3.5":"h-4 w-4",m=r?Eo:Oo;return G("button",{type:"button",className:`inline-flex ${l} shrink-0 items-center justify-center rounded-md border border-gray-200 text-slate-600 transition-colors hover:bg-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-200 dark:text-slate-300`,onClick:c,"aria-label":t,title:t,children:G(m,{className:d,"aria-hidden":"true"})})},xa=({contactData:e,openEmailsWithGmail:t,openGmailCompose:a,onRequestClose:r})=>{let s=q(),[n,o]=rr(null);ln(()=>{o(document.body)},[]);let c=dn(null),l=dn(null),d=jt(()=>e.contacted_at?tr(e.contacted_at):null,[e.contacted_at]),m=e.full_name||"-",p=qt(e.company_name),i=qt(e.department),u=qt(e.title),h=jt(()=>on([{fieldKey:"company_name",label:s.fieldCompanyName,value:p},{fieldKey:"department",label:s.fieldDepartment,value:i},{fieldKey:"title",label:s.fieldTitle,value:u}],(f,{fieldKey:v,label:W})=>({normalized:f,key:`${v}-${f.toLowerCase()}`,entry:D=>({fieldKey:v,label:W,value:D})})),[p,i,u,s]),k=jt(()=>on([{fieldKey:"custom_mobile_phone_number",label:s.popupCustomMobilePhone,value:e.custom_mobile_phone_number},{fieldKey:"mobile_phone_number",label:s.popupMobilePhone,value:e.mobile_phone_number},{fieldKey:"custom_company_phone_number",label:s.popupCustomCompanyPhone,value:e.custom_company_phone_number},{fieldKey:"company_phone_number",label:s.popupCompanyPhone,value:e.company_phone_number}],(f,{fieldKey:v,label:W})=>{let D=Kt(f);return{normalized:qt(f),key:(D??f).toLowerCase(),entry:P=>({fieldKey:v,label:W,value:P,href:D})}}),[e.custom_mobile_phone_number,e.mobile_phone_number,e.custom_company_phone_number,e.company_phone_number,s]),C=jt(()=>on([{fieldKey:"custom_email",label:s.popupCustomEmail,value:e.custom_email},{fieldKey:"email",label:s.popupEmail,value:e.email}],(f,{fieldKey:v,label:W})=>{let D=qt(f),X=$e(f,t),P=!!X?.startsWith("https://mail.google.com");return{normalized:D,key:f.toLowerCase(),entry:M=>({fieldKey:v,label:W,value:M,href:X,isGmailLink:P})}}),[e.custom_email,e.email,t,s]),S=k.length>0||C.length>0,B=jt(()=>`contact-methods-${e.person_id}`,[e.person_id]),N=et(f=>{r(f),l.current=null},[r]),y=et(f=>{f.stopPropagation(),nr(f.target,f.currentTarget)&&N()},[N]),g=et(f=>{f.stopPropagation(),nr(f.target,f.currentTarget)&&(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),N())},[N]),O=et(f=>{f.stopPropagation(),N()},[N]),V=et((f,v)=>{v.isGmailLink&&(f.preventDefault(),a(v.value))},[a]),b=et((f,v)=>{if(!v.isGmailLink){l.current=null;return}let W=Date.now(),D=l.current;if(D&&D.email===v.value&&W-D.timestamp<=Ho){l.current=null,f.preventDefault(),a(v.value);return}l.current={email:v.value,timestamp:W}},[a]);return ln(()=>{let f=[];if(typeof window<"u"){let v=W=>{if(W.key==="Escape"){N();return}if(W.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 X=D[0],P=D[D.length-1];W.shiftKey?document.activeElement===X&&(W.preventDefault(),P.focus()):document.activeElement===P&&(W.preventDefault(),X.focus())}};window.addEventListener("keydown",v),f.push(()=>window.removeEventListener("keydown",v))}if(typeof document<"u"){let v=c.current;if(v){let P=M=>{M.stopPropagation()};for(let M of ar)v.addEventListener(M,P);f.push(()=>{for(let M of ar)v.removeEventListener(M,P)})}let W=P=>{let M=c.current;return M&&P instanceof Node?M.contains(P):!1},D=P=>{W(P.target)||N({suppressLongPress:!0,cancelLongPressTimer:!0})},X=["pointerdown","wheel","touchmove"];for(let P of X)document.addEventListener(P,D,!0);f.push(()=>{for(let P of X)document.removeEventListener(P,D,!0)}),_o(),f.push(Ao)}return()=>{for(let v of f)v()}},[N,n]),n?Do(G("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":B,tabIndex:-1,onClick:y,onKeyDown:g,children:Ne("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:[Ne("div",{className:"flex items-start justify-between gap-4",children:[Ne("div",{children:[G("h2",{id:B,className:"font-semibold text-gray-900 text-lg dark:text-slate-100",children:m}),h.length>0?G("div",{className:"mt-2 space-y-2 text-slate-700 text-sm dark:text-slate-200",children:h.map(f=>Ne("div",{className:"flex items-center gap-3",children:[G("p",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:f.value}),G(sn,{value:f.value,ariaLabel:s.copyField(f.label),size:"sm"})]},f.fieldKey))}):null]}),G("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:O,"aria-label":s.close,children:G(Wo,{className:"h-4 w-4","aria-hidden":"true"})})]}),Ne("div",{className:"mt-4 space-y-4 text-slate-700 dark:text-slate-200",children:[k.length>0?G("div",{children:G("ul",{className:"space-y-3 text-sm",children:k.map(f=>G("li",{className:"flex items-start gap-3",children:Ne("div",{className:"flex-1",children:[G("span",{className:"text-slate-600 text-xs dark:text-slate-300",children:f.label}),Ne("div",{className:"mt-1 flex items-center gap-3",children:[G("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:f.href?G("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}):G("span",{className:"wrap-break-word text-slate-800 dark:text-slate-100",children:f.value})}),G(sn,{value:f.value,ariaLabel:s.copyField(f.label),size:"sm"})]})]})},`${f.fieldKey}-${f.value}`))})}):null,C.length>0?G("div",{children:G("ul",{className:"space-y-3 text-sm",children:C.map(f=>G("li",{className:"flex items-start gap-3",children:Ne("div",{className:"flex-1",children:[G("span",{className:"text-slate-600 text-xs dark:text-slate-300",children:f.label}),Ne("div",{className:"mt-1 flex items-start gap-3",children:[Ne("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:[f.href?G("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:v=>V(v,f),onTouchEnd:v=>b(v,f),children:f.value}):G("span",{className:"wrap-break-word text-slate-800 dark:text-slate-100",children:f.value}),f.isGmailLink?G("span",{className:"mt-1 block text-[11px] text-slate-500 dark:text-slate-400",children:s.popupGmailHint}):null]}),G(sn,{value:f.value,ariaLabel:s.copyField(f.label),size:"sm"})]})]})},`${f.fieldKey}-${f.value}`))})}):null,d?Ne("div",{className:"mt-2 flex items-center gap-2 text-slate-600 text-sm dark:text-slate-300",children:[G("span",{className:"text-xs",children:s.popupLastContactDate}),G("span",{children:d})]}):null,S?null:G("p",{className:"text-slate-600 text-sm dark:text-slate-300",children:s.popupNoContactMethods})]})]})}),n):null}});import{jsx as ye,jsxs as Qt}from"react/jsx-runtime";var va,pn=Te(()=>{"use strict";va=({fullName:e,title:t="-",companyName:a="-",department:r="-",phoneNumber:s="-",email:n="-",updatedAtText:o="-"})=>Qt("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:[Qt("div",{className:"flex items-center gap-1 sm:hidden",children:[ye("div",{className:"flex-1 truncate font-medium text-gray-900 text-sm leading-tight dark:text-slate-100",children:e}),ye("div",{className:"shrink-0 whitespace-nowrap text-[11px] text-slate-600 dark:text-slate-300",children:s})]}),ye("div",{className:"flex items-center gap-1 sm:hidden",children:ye("div",{className:"flex-1 truncate text-slate-700 text-xs leading-tight dark:text-slate-200",children:a})}),ye("div",{className:"block sm:hidden",children:ye("span",{className:"w-full truncate text-left text-[11px] text-slate-700 leading-tight dark:text-slate-200",children:r})}),Qt("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[ye("span",{className:"truncate font-medium text-gray-900 dark:text-slate-100",children:e}),ye("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:t})]}),Qt("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[ye("span",{className:"truncate text-slate-800 dark:text-slate-100",children:a}),ye("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:r})]}),Qt("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[ye("span",{className:"truncate text-slate-700 dark:text-slate-200",children:s}),ye("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:n})]}),ye("div",{className:"hidden items-end justify-end text-[11px] text-slate-600 xl:flex dark:text-slate-300",children:ye("span",{className:"truncate",children:o})})]})});import{getNormalizedVariants as Io,normalizeText as Fo,romajiToKatakana as zo}from"@aiquants/select-box";var Bo,Uo,$o,Vo,Ko,sr,jo,qo,or,Ca,Go,Qo,un,ir,mn=Te(()=>{"use strict";Bo=/[​]/g,Uo=/^[\s  ]+|[\s  ]+$/g,$o=/\s+/,Vo=/^[\p{Script=Latin}\s]+$/u,Ko=/\p{Script=Latin}/u,sr=Object.freeze({convertWidth:!0,convertKana:!0,convertCase:!0,convertRomaji:!1}),jo=e=>Fo(e.replace(Bo,"").replace(Uo,""),sr),qo=e=>{if(!Vo.test(e))return null;let t=zo(e);return Ko.test(t)?null:t},or=e=>e.split($o).filter(Boolean),Ca=e=>{let t=jo(e),a=qo(t);return a===null?t:a},Go=e=>{let t=new Set([...or(e),...or(Ca(e))]),a=new Set;for(let r of t)for(let s of Io(r,sr)){let n=s.trim();n&&a.add(n)}return Array.from(a)},Qo=/[.*+?^${}()|[\]\\]/g,un=e=>{let t=Go(e);if(t.length===0)return null;let a=t.map(r=>r.replace(Qo,"\\$&")).sort((r,s)=>s.length-r.length);return new RegExp(a.join("|"),"gi")},ir=(e,t)=>{let a=un(e);if(a===null)return s=>s;let r=s=>t.some(n=>{let o=s[n];return typeof o=="string"&&o.search(a)!==-1});return s=>{let n=[],o=[];for(let c of s)r(c.item)?n.push(c):o.push(c);return[...n,...o]}}});import{memo as Yo}from"react";import{Fragment as gn,jsx as ka}from"react/jsx-runtime";var ce,Sa=Te(()=>{"use strict";mn();ce=Yo(({text:e,query:t,enabled:a=!0})=>{if(!(a&&t?.trim()&&e))return ka(gn,{children:e});let r=un(t);if(r===null)return ka(gn,{children:e});let s=[],n=0,o=r.exec(e),c=0;for(;o;){let l=o[0],d=o.index;if(d>n&&s.push(e.substring(n,d)),l.length===0){r.lastIndex++,o=r.exec(e);continue}s.push(ka("mark",{className:"rounded bg-yellow-200 px-1 text-gray-900",children:l},`highlight-${d}-${c}`)),n=d+l.length,c+=1,o=r.exec(e)}return n<e.length&&s.push(e.substring(n)),ka(gn,{children:s})});ce.displayName="HighlightedText"});var dr={};uo(dr,{ContactDetailGrid:()=>lr,default:()=>Jo});import{useMemo as hn}from"react";import{Fragment as Xo,jsx as yn,jsxs as Zo}from"react/jsx-runtime";var fn,lr,Jo,cr=Te(()=>{"use strict";ht();se();cn();pn();Sa();fn=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},lr=({contactData:e,searchTerm:t,enableHighlighting:a,openEmailsWithGmail:r,openGmailCompose:s,isPopupVisible:n,onRequestClose:o})=>{let c=q(),l=hn(()=>ya(e),[e]),d=hn(()=>ba(e),[e]),m=l.value??"-",p=d.value??"-",i=hn(()=>we(e.updated_at),[e.updated_at]),u=fn(e.full_name)??c.noName,h=fn(e.company_name),k=fn(e.department),C=(S,B="-")=>yn(ce,{text:S??B,query:t,enabled:a});return Zo(Xo,{children:[yn(va,{fullName:C(u),title:C(e.title),companyName:C(h),department:C(k),phoneNumber:p,email:C(m),updatedAtText:i}),n?yn(xa,{contactData:e,openEmailsWithGmail:r,openGmailCompose:s,onRequestClose:o}):null]})},Jo=lr});se();import{DEFAULT_FUZZY_SEARCH_OPTIONS as Lt}from"@aiquants/fuzzy-search";import{memo as Ro,useId as Zn}from"react";import{jsx as Ee,jsxs as Ue}from"react/jsx-runtime";var nn=Ro(({searchOptions:e,setSearchOptions:t})=>{let a=q(),r="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",s="text-xs font-semibold",n=Zn(),o=Zn(),c=[];return c.push(Ue("div",{className:`${r} border-sky-200 border-l-4 dark:border-sky-400/60`,children:[Ue("div",{className:`${s} text-sky-700 dark:text-sky-300`,children:["\u{1F4D8} ",a.advancedLearningHeading]}),Ee("label",{htmlFor:n,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.advancedLearningLabel}),Ee("input",{id:n,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.learningWeight||Lt.learningWeight,onChange:l=>t(d=>({...d,learningWeight:parseFloat(l.target.value)})),className:"w-full"}),Ue("span",{className:"text-sky-600 text-xs dark:text-sky-300",children:[a.currentValueLabel," ",e.learningWeight||Lt.learningWeight]}),Ee("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.advancedLearningHint})]},"learning")),c.push(Ue("div",{className:`${r} border-indigo-200 border-l-4 dark:border-indigo-400/60`,children:[Ue("div",{className:`${s} text-indigo-700 dark:text-indigo-300`,children:["\u23F1\uFE0F ",a.advancedDebounceHeading]}),Ee("label",{htmlFor:o,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.advancedDebounceLabel}),Ee("input",{id:o,type:"range",min:"100",max:"1000",step:"50",value:e.debounceMs||Lt.debounceMs,onChange:l=>t(d=>({...d,debounceMs:parseInt(l.target.value,10)})),className:"w-full"}),Ue("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[a.currentValueLabel," ",e.debounceMs||Lt.debounceMs]}),Ee("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.advancedDebounceHint})]},"debounce")),Ue("section",{className:"space-y-3",children:[Ue("div",{className:"flex items-center justify-between gap-3",children:[Ue("div",{className:"flex items-center gap-2 font-semibold text-gray-700 text-xs transition-colors dark:text-slate-200",children:[Ee("span",{children:"\u26A1"}),Ee("span",{className:"tracking-wide",children:a.settingsAdvancedTab})]}),Ee("button",{type:"button",onClick:()=>t(l=>({...l,learningWeight:Lt.learningWeight,debounceMs:Lt.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})]}),Ee("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:c})]})});nn.displayName="AdvancedSearchSettings";se();import{DEFAULT_FUZZY_SEARCH_OPTIONS as gt}from"@aiquants/fuzzy-search";import{memo as Lo,useId as Oe}from"react";import{jsx as Q,jsxs as J}from"react/jsx-runtime";var rn=Lo(({searchOptions:e,setSearchOptions:t,enableHighlighting:a,setEnableHighlighting:r,openEmailsWithGmail:s,setOpenEmailsWithGmail:n})=>{let o=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",l="text-xs font-semibold",d=Oe(),m=Oe(),p=Oe(),i=Oe(),u=Oe(),h=Oe(),k=Oe(),C=Oe(),S=Oe(),B=Oe(),N=[];return N.push(J("div",{className:`${c} border-blue-200 border-l-4 dark:border-blue-500/50`,children:[J("div",{className:`${l} text-blue-700 dark:text-blue-300`,children:["\u{1F3AF} ",o.basicThresholdHeading]}),Q("label",{htmlFor:d,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicThresholdLabel}),Q("input",{id:d,type:"range",min:"0.0",max:e.sortBy==="relevance"?"1.5":"1.0",step:"0.05",value:e.threshold??gt.threshold,onChange:y=>t(g=>({...g,threshold:parseFloat(y.target.value)})),className:"w-full"}),J("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[o.currentValueLabel," ",e.threshold??gt.threshold]}),Q("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:e.sortBy==="relevance"?o.basicThresholdRangeRelevance:o.basicThresholdRange})]},"threshold")),N.push(J("div",{className:`${c} border-amber-200 border-l-4 dark:border-amber-400/60`,children:[J("div",{className:`${l} text-amber-700 dark:text-amber-300`,children:["\u{1FA84} ",o.basicDisplayHeading]}),J("label",{htmlFor:m,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[Q("input",{id:m,type:"checkbox",checked:e.caseSensitive??gt.caseSensitive,onChange:y=>t(g=>({...g,caseSensitive:y.target.checked})),className:"h-3 w-3"}),o.basicCaseSensitive]}),J("label",{htmlFor:p,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[Q("input",{id:p,type:"checkbox",checked:a,onChange:y=>r(y.target.checked),className:"h-3 w-3"}),o.basicHighlight]}),J("label",{htmlFor:i,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[Q("input",{id:i,type:"checkbox",checked:s,onChange:y=>n(y.target.checked),className:"h-3 w-3"}),o.basicOpenEmailsWithGmail]}),J("div",{className:"flex flex-col gap-1",children:[Q("label",{htmlFor:u,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicMultiTermOperator}),J("select",{id:u,value:e.multiTermOperator??gt.multiTermOperator,onChange:y=>t(g=>({...g,multiTermOperator:y.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:[Q("option",{value:"or",children:o.basicOperatorOr}),Q("option",{value:"and",children:o.basicOperatorAnd})]}),Q("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:o.basicMultiTermHint})]})]},"display")),N.push(J("div",{className:`${c} border-emerald-200 border-l-4 dark:border-emerald-400/60`,children:[J("div",{className:`${l} text-emerald-700 dark:text-emerald-300`,children:["\u{1F4DA} ",o.basicSortHeading]}),J("div",{className:"flex flex-col gap-2",children:[Q("label",{htmlFor:h,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicSortBy}),J("select",{id:h,value:e.sortBy||gt.sortBy,onChange:y=>t(g=>({...g,sortBy:y.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:[Q("option",{value:"score",children:o.basicSortByScore}),Q("option",{value:"relevance",children:o.basicSortByRelevance}),Q("option",{value:"original",children:o.basicSortByOriginal})]})]}),J("div",{className:"flex flex-col gap-2",children:[Q("label",{htmlFor:k,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicSortOrder}),J("select",{id:k,value:e.sortOrder||gt.sortOrder,onChange:y=>t(g=>({...g,sortOrder:y.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:[Q("option",{value:"desc",children:o.basicSortDescending}),Q("option",{value:"asc",children:o.basicSortAscending})]})]})]},"sorting")),N.push(J("div",{className:`${c} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[J("div",{className:`${l} text-purple-700 dark:text-purple-300`,children:["\u2699\uFE0F ",o.basicEngineHeading]}),Q("label",{htmlFor:C,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicStrategy}),J("select",{id:C,value:e.parallelSearchStrategy||gt.parallelSearchStrategy,onChange:y=>t(g=>({...g,parallelSearchStrategy:y.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:[Q("option",{value:"balanced",children:o.basicStrategyBalanced}),Q("option",{value:"index-first",children:o.basicStrategyIndexFirst}),Q("option",{value:"levenshtein-first",children:o.basicStrategyLevenshteinFirst})]}),J("div",{className:"mt-2 space-y-2",children:[J("label",{htmlFor:S,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[Q("input",{id:S,type:"checkbox",checked:e.enableIndexFiltering!==!1,onChange:y=>t(g=>({...g,enableIndexFiltering:y.target.checked})),className:"h-3 w-3"}),o.basicIndexFiltering]}),J("label",{htmlFor:B,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[Q("input",{id:B,type:"checkbox",checked:e.enableLevenshtein!==!1,onChange:y=>t(g=>({...g,enableLevenshtein:y.target.checked})),className:"h-3 w-3"}),o.basicLevenshtein]})]})]},"engine")),J("section",{className:"space-y-3",children:[J("div",{className:"flex items-center gap-2 font-semibold text-blue-700 text-xs transition-colors dark:text-sky-400",children:[Q("span",{children:"\u{1F527}"}),Q("span",{className:"tracking-wide",children:o.settingsBasicTab})]}),Q("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:N})]})});rn.displayName="BasicSearchSettings";ht();import as from"lucide-react/dist/esm/icons/badge-check.js";import ns from"lucide-react/dist/esm/icons/building-2.js";import rs from"lucide-react/dist/esm/icons/calendar-clock.js";import os from"lucide-react/dist/esm/icons/check.js";import ss from"lucide-react/dist/esm/icons/copy.js";import is from"lucide-react/dist/esm/icons/id-card.js";import ls from"lucide-react/dist/esm/icons/mail.js";import ds from"lucide-react/dist/esm/icons/phone.js";import cs from"lucide-react/dist/esm/icons/user-round.js";import{useCallback as ps,useEffect as us,useMemo as Na,useRef as ms,useState as gs}from"react";var We={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)};se();import*as Pe from"@radix-ui/react-tabs";import*as Ta from"react";import{clsx as es}from"clsx";import{twMerge as ts}from"tailwind-merge";function ft(...e){return ts(es(e))}import{jsx as bn}from"react/jsx-runtime";var wa=Pe.Root,Yt=Ta.forwardRef(({className:e,...t},a)=>bn(Pe.List,{ref:a,className:ft("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Yt.displayName=Pe.List.displayName;var yt=Ta.forwardRef(({className:e,...t},a)=>bn(Pe.Trigger,{ref:a,className:ft("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}));yt.displayName=Pe.Trigger.displayName;var bt=Ta.forwardRef(({className:e,...t},a)=>bn(Pe.Content,{ref:a,className:ft("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}));bt.displayName=Pe.Content.displayName;Sa();import{jsx as R,jsxs as ie}from"react/jsx-runtime";var pr={height:"var(--contact-panel-height, 100%)",maxHeight:"100%"},hs=({icon:e,label:t,value:a,fieldKey:r,copyValue:s,onCopy:n,isCopied:o,linkHref:c,searchTerm:l,enableHighlighting:d})=>{let m=q(),p=!!(n&&r&&s),i=c?.startsWith("https://mail.google.com")?"_blank":void 0;return ie("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:[ie("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[R("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:R(e,{size:14})}),ie("div",{className:"min-w-0 flex-1",children:[R("div",{className:"font-medium text-[10px] text-slate-500 dark:text-slate-400",children:t}),R("div",{className:"truncate font-semibold text-slate-900 text-xs dark:text-slate-100",children:c?R("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:R(ce,{text:a,query:l??"",enabled:d})}):R(ce,{text:a,query:l??"",enabled:d})})]})]}),p?R("button",{type:"button",onClick:()=>n&&r&&s&&n(r,s,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:o?R(os,{size:14}):R(ss,{size:14})}):null]})},ur=({items:e,searchTerm:t,enableHighlighting:a})=>R("dl",{className:"grid grid-cols-1 gap-x-3 gap-y-1.5 sm:grid-cols-2",children:e.map(r=>ie("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:[R("dt",{className:"font-semibold text-[10px] text-slate-500 uppercase tracking-wide dark:text-slate-400",children:r.label}),R("dd",{className:"wrap-break-word text-slate-900 text-xs dark:text-slate-100",children:R(ce,{text:r.value,query:t??"",enabled:a})})]},r.fieldKey))}),xn=({title:e})=>R("h3",{className:"font-semibold text-slate-700 text-xs dark:text-slate-200",children:e}),fs=()=>{let e=q();return ie("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:[R("p",{className:"font-medium text-slate-600 text-xs dark:text-slate-200",children:e.detailEmptyTitle}),R("p",{className:"text-[11px] text-slate-500 dark:text-slate-400",children:e.detailEmptyHint})]})},tt=({contact:e,searchTerm:t,enableHighlighting:a,style:r,className:s=""})=>{let n=q(),[o,c]=gs(null),l=ms(null),d=Na(()=>({...pr,...r}),[r]);us(()=>()=>{l.current!==null&&window.clearTimeout(l.current)},[]);let m=Na(()=>ya(e),[e]),p=Na(()=>ba(e),[e]),i=Na(()=>we(e?.contacted_at??null),[e?.contacted_at]),u=ps(async(b,f,v)=>{try{await navigator.clipboard.writeText(f),c(b),l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{c(null)},2e3)}catch(W){We.error("Failed to copy contact detail",W)}},[]);if(!e)return R("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:pr,children:R(fs,{})});let h=[K(e.title),K(e.department)].filter(b=>b!=="-"),k=[h.join(" / "),K(e.company_name)].filter(b=>b&&b!=="-").join(" \u30FB ")||"-",C=K(e.full_name),S=[{fieldKey:"full_name",label:n.fieldFullName,value:C==="-"?n.noName:C},{fieldKey:"full_name_reading",label:n.fieldFullNameReading,value:K(e.full_name_reading)},{fieldKey:"title",label:n.fieldTitle,value:K(e.title)},{fieldKey:"department",label:n.fieldDepartment,value:K(e.department)},{fieldKey:"company_name",label:n.fieldCompanyName,value:K(e.company_name)},{fieldKey:"company_name_reading",label:n.fieldCompanyNameReading,value:K(e.company_name_reading)},{fieldKey:"address",label:n.fieldAddress,value:K(e.address)},{fieldKey:"postal_code",label:n.fieldPostalCode,value:K(e.postal_code)},{fieldKey:"url",label:n.fieldUrl,value:K(e.url)}],B=[{label:n.fieldCustomEmail,value:K(e.custom_email),fieldKey:"custom_email",rawValue:e.custom_email},{label:n.fieldEmail,value:K(e.email),fieldKey:"email",rawValue:e.email}].filter(b=>b.value!=="-"),N=[{label:n.fieldCustomMobilePhone,value:K(e.custom_mobile_phone_number),fieldKey:"custom_mobile_phone_number",rawValue:e.custom_mobile_phone_number},{label:n.fieldMobilePhone,value:K(e.mobile_phone_number),fieldKey:"mobile_phone_number",rawValue:e.mobile_phone_number},{label:n.fieldCompanyPhone,value:K(e.company_phone_number),fieldKey:"company_phone_number",rawValue:e.company_phone_number},{label:n.fieldCompanyFax,value:K(e.company_fax_number),fieldKey:"company_fax_number",rawValue:e.company_fax_number}].filter(b=>b.value!=="-"),y=[{fieldKey:"person_id",label:"person_id",value:K(e.person_id)},{fieldKey:"person_id_redirect_to",label:"person_id_redirect_to",value:K(e.person_id_redirect_to)},{fieldKey:"is_active",label:"is_active",value:K(e.is_active)},{fieldKey:"is_contact_synced",label:"is_contact_synced",value:K(e.is_contact_synced)},{fieldKey:"is_incomplete",label:"is_incomplete",value:K(e.is_incomplete)},{fieldKey:"is_in_eight",label:"is_in_eight",value:K(e.is_in_eight)},{fieldKey:"created_by",label:n.fieldCreatedBy,value:K(e.created_by)},{fieldKey:"created_at",label:n.fieldCreatedAt,value:we(e.created_at)},{fieldKey:"updated_by",label:n.fieldUpdatedBy,value:K(e.updated_by)},{fieldKey:"updated_at",label:n.fieldUpdatedAt,value:we(e.updated_at)}],g=[{rowKey:"person_id",icon:is,label:"person_id",value:K(e.person_id),fieldKey:"person_id",copyValue:String(e.person_id)},{rowKey:"primary_email",icon:ls,label:n.summaryEmail,value:m.value??"-",fieldKey:"primary_email",copyValue:m.value,linkHref:$e(m.value,!1)},{rowKey:"primary_phone",icon:ds,label:n.summaryPhone,value:p.value??"-",fieldKey:"primary_phone",copyValue:p.value,linkHref:Kt(p.value)},{rowKey:"contacted_at",icon:rs,label:n.summaryLastContact,value:i}],O=[{sectionKey:"email",title:n.sectionEmail,emptyText:n.sectionEmailEmpty,entries:B,recommendedKey:m.fieldKey??null,resolveHref:b=>$e(b!=null?String(b):null,!1)},{sectionKey:"phone",title:n.sectionPhone,emptyText:n.sectionPhoneEmpty,entries:N,recommendedKey:p.fieldKey??null,resolveHref:b=>Kt(b!=null?String(b):null)}],V=[{value:"summary",label:n.detailTabSummary,content:ie("div",{className:"flex flex-col gap-4",children:[ie("div",{className:"flex flex-col gap-1",children:[ie("div",{className:"flex items-center gap-2 text-slate-600 text-sm dark:text-slate-300",children:[R(ns,{size:16}),R("span",{children:R(ce,{text:K(e.company_name),query:t??"",enabled:a})})]}),h.length>0?R("div",{className:"text-slate-600 text-sm dark:text-slate-300",children:h.map((b,f)=>ie("span",{children:[f>0&&" / ",R(ce,{text:b,query:t??"",enabled:a})]},`header-line-${f}`))}):null]}),R("div",{className:"flex flex-col gap-3",children:g.map(b=>R(hs,{icon:b.icon,label:b.label,value:b.value,fieldKey:b.fieldKey,copyValue:b.copyValue,onCopy:u,isCopied:b.fieldKey?o===b.fieldKey:!1,linkHref:b.linkHref,searchTerm:t,enableHighlighting:a},b.rowKey))})]})},{value:"basic",label:n.detailTabBasic,content:ie("div",{className:"flex flex-col gap-3",children:[R(xn,{title:n.detailBasicProfile}),R(ur,{items:S,searchTerm:t,enableHighlighting:a})]})},{value:"contact",label:n.detailTabContact,content:R("div",{className:"flex flex-col gap-4",children:O.map(({sectionKey:b,title:f,emptyText:v,entries:W,recommendedKey:D,resolveHref:X})=>ie("div",{className:"flex flex-col gap-2",children:[R(xn,{title:f}),W.length===0?R("p",{className:"text-slate-500 text-xs dark:text-slate-400",children:v}):R("div",{className:"flex flex-col gap-2",children:W.map(P=>{let M=X(P.rawValue),H=P.fieldKey===D;return ie("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:[ie("div",{children:[R("div",{className:"font-medium text-slate-500 text-xs dark:text-slate-400",children:P.label}),R("div",{className:"text-slate-900 text-sm dark:text-slate-100",children:M?R("a",{href:M,className:"text-inherit underline-offset-2 hover:underline focus:underline focus:outline-none",children:R(ce,{text:P.value,query:t??"",enabled:a})}):R(ce,{text:P.value,query:t??"",enabled:a})})]}),H?ie("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:[R(as,{size:14}),n.preferred]}):null]},P.fieldKey)})})]},b))})},{value:"meta",label:n.detailTabMeta,content:ie("div",{className:"flex flex-col gap-3",children:[R(xn,{title:n.detailTabMeta}),R(ur,{items:y,searchTerm:t,enableHighlighting:a})]})}];return ie("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 ${s}`.trim(),style:d,children:[R("div",{className:"border-slate-200 border-b px-3 py-1.5 transition-colors dark:border-slate-700 dark:bg-slate-900/50",children:ie("div",{className:"flex items-center gap-2",children:[R("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:R(cs,{size:16})}),ie("div",{className:"min-w-0 flex-1",children:[R("div",{className:"truncate font-semibold text-slate-900 text-sm dark:text-slate-100",children:R(ce,{text:K(e.full_name),query:t??"",enabled:a})}),R("div",{className:"truncate text-[11px] text-slate-600 dark:text-slate-300",children:R(ce,{text:k,query:t??"",enabled:a})})]})]})}),ie(wa,{defaultValue:"summary",className:"flex flex-1 flex-col overflow-hidden",children:[R(Yt,{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(b=>R(yt,{value:b.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:b.label},b.value))}),V.map(b=>R(bt,{value:b.value,className:"scrollbar-thin flex-1 overflow-y-auto px-2.5 py-2 transition-colors dark:text-slate-200",children:b.content},b.value))]})]})};mt();se();import{memo as ys}from"react";import{jsx as at,jsxs as Pa}from"react/jsx-runtime";var vn=ys(({recordCount:e,companyCount:t,phase:a,loadedCount:r,totalCount:s,errorMessage:n,onRetry:o})=>{let{locale:c,labels:l}=fe(),d=j(c,e),m=j(c,t);return Pa("div",{"data-testid":"contact-map-annotation",className:"flex flex-wrap items-center gap-2 leading-1 transition-colors",role:"status",children:[Pa("span",{className:"flex items-baseline gap-1",children:[at("span",{className:"text-slate-600 dark:text-slate-300",children:l.annotationTotalLabel}),at("span",{className:"text-slate-800 dark:text-slate-200","data-testid":"contact-map-record-count",children:d}),at("span",{className:"text-slate-600 dark:text-slate-300",children:l.recordUnit(d)})]}),Pa("span",{className:"flex items-baseline gap-1",children:[at("span",{className:"text-slate-600 dark:text-slate-300",children:l.annotationCompaniesLabel}),at("span",{className:"text-slate-800 dark:text-slate-200","data-testid":"contact-map-company-count",children:m}),at("span",{className:"text-slate-600 dark:text-slate-300",children:l.companyUnit(m)})]}),a==="streaming"||a==="retrying"||a==="idle"?at("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:s!==null&&s>0?l.annotationStreamingProgress({loaded:r,total:s,percent:Math.min(100,Math.round(r/s*100))}):l.annotationStreamingCount(r)}):null,a==="failed"||a==="auth-required"?Pa("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:a==="failed"?n??void 0:void 0,children:["\u26D4 ",a==="auth-required"?l.annotationAuthRequired:l.annotationLoadFailed(r),o?at("button",{type:"button","data-testid":"contact-map-retry-button",onClick:o,className:"rounded border border-rose-300 bg-white px-1.5 py-0.5 font-semibold text-rose-700 transition-colors hover:bg-rose-100 dark:border-rose-700 dark:bg-rose-950 dark:text-rose-200 dark:hover:bg-rose-900",children:l.annotationRetry}):null]}):null]})});vn.displayName="ContactMapAnnotation";Rt();import{useMemo as lo}from"react";Pt();Rt();se();import{createContext as xs,useContext as vs,useMemo as Cs}from"react";Pt();Rt();Qa();var bs=["indexWorker","levenshteinWorker","treeWorker"];function mr(e,t,a){if(a!==void 0){if(typeof a!="string")throw new TypeError(`[contact-map] ${e}.${t} must be a string or left out (pass url.href for a URL object); got ${ae(a)}`);if(a.trim()==="")throw new RangeError(`[contact-map] ${e}.${t} must not be empty or blank; got ${ae(a)}`)}}var gr={setting:"workerUrls"},hr=(e,t)=>{if(e===void 0)return;let{setting:a,keys:r=bs,hints:s={}}=t;if(!Mt(e))throw new TypeError(`[contact-map] ${a} must be a plain object or left out; got ${ae(e)}`);let n=Object.getOwnPropertyNames(e).map(l=>({key:l,url:e[l]})),o=n.find(({key:l,url:d})=>d!==void 0&&!r.includes(l));if(o!==void 0){let l=Object.hasOwn(s,o.key)?s[o.key]:void 0,d=l===void 0?ma(o.key,r):void 0;throw new RangeError(`[contact-map] ${a} has a key it does not take (it takes ${r.join(", ")}${l===void 0?"":`; ${l}`}${d===void 0?"":`; did you mean ${JSON.stringify(d)}?`}); got ${ae(o.key)}`)}let c=Object.create(null);for(let{key:l,url:d}of n){let m=l;mr(a,m,d),d!==void 0&&(c[m]=d)}return c};function Gd(e,t=gr){hr(e,t)}function fr(e){mr("workerUrls","treeWorker",e)}var Ot=(e,t,a=gr)=>{let r=hr(t,a);return{indexWorker:r?.indexWorker===void 0?e?.indexWorker:r.indexWorker,levenshteinWorker:r?.levenshteinWorker===void 0?e?.levenshteinWorker:r.levenshteinWorker,treeWorker:r?.treeWorker===void 0?e?.treeWorker:r.treeWorker}};import{jsx as Cn}from"react/jsx-runtime";var yr=e=>{if(!Mt(e))throw new TypeError(`[contact-map] config must be a plain object; got ${ae(e)}`);let t=e;return{streamEndpoint:me(t,"streamEndpoint"),openEmailsWithGmail:me(t,"openEmailsWithGmail"),treeWorkerFactory:me(t,"treeWorkerFactory"),workerUrls:Ot(void 0,me(t,"workerUrls")),layoutSpec:me(t,"layoutSpec"),locale:me(t,"locale"),labels:me(t,"labels")}},br=({workerUrls:e,...t})=>{let{indexWorker:a,levenshteinWorker:r,treeWorker:s}=e;return Object.freeze(Object.assign(Object.create(null),t,{workerUrls:Object.freeze({indexWorker:a,levenshteinWorker:r,treeWorker:s})}))},ks=br(yr({})),xr=xs(ks),Ss=Object.freeze({locale:"locale",labels:"labels"});function kn({config:e,chromeSurface:t,children:a}){let{streamEndpoint:r,openEmailsWithGmail:s,treeWorkerFactory:n,workerUrls:o,layoutSpec:c,locale:l,labels:d}=yr(e),{indexWorker:m,levenshteinWorker:p,treeWorker:i}=o,u=Cs(()=>br({streamEndpoint:r,openEmailsWithGmail:s,treeWorkerFactory:n,workerUrls:{indexWorker:m,levenshteinWorker:p,treeWorker:i},layoutSpec:c,locale:l,labels:d}),[r,s,n,m,p,i,c,l,d]);return Cn(xr.Provider,{value:u,children:Cn(Xn,{locale:l,labels:d,surface:t,children:a})})}function Ts({config:e,children:t}){return Cn(kn,{config:e,chromeSurface:Ss,children:t})}function Ve(){return vs(xr)}import{useCallback as Sn,useEffect as Ls,useMemo as La,useSyncExternalStore as vr}from"react";Pt();var ws=1e3,Ns=3e4,Ps=6;function Ra(e){if(typeof e!="string")throw new TypeError(`[contact-map] streamEndpoint must be a same-origin absolute path such as "/api/contact_map/stream", set on ContactMapConfigProvider or ContactMapAppView; got ${ae(e)}`);if(/[\s\p{Cc}#]/u.test(e))throw new RangeError(`[contact-map] streamEndpoint must not contain whitespace, control characters or "#"; got ${ae(e)}`);if(!e.startsWith("/")||e.startsWith("//")||e.startsWith("/\\"))throw new RangeError(`[contact-map] streamEndpoint must be a same-origin absolute path such as "/api/contact_map/stream"; got ${ae(e)}`)}var Ms=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}),Rs=e=>Array.isArray(e.records),Ma=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?.()};Ra(t.endpoint),this.fetchFn=t.fetchFn??((...a)=>fetch(...a)),this.endpoint=t.endpoint,this.initialRetryDelayMs=t.initialRetryDelayMs??ws,this.maxRetryDelayMs=t.maxRetryDelayMs??Ns,this.maxConsecutiveFailures=t.maxConsecutiveFailures??Ps,this.logger=t.logger??We}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())}retryNow(){if(!this.disposed)switch(this.state.phase){case"retrying":this.wakeRetryWait?.();return;case"failed":case"auth-required":this.consecutiveFailures=0,this.setState({error:null,isLoading:this.recordMap.size===0}),this.runStreamLoop();return;case"idle":case"streaming":case"complete":return}}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 r=setTimeout(()=>{this.wakeRetryWait=null,a()},t);this.wakeRetryWait=()=>{clearTimeout(r),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(),r=new TextDecoder,s="",n=!1,o=!1;for(;;){let{done:c,value:l}=await a.read();if(c)break;let d=r.decode(l,{stream:!0}),m=(s+d).split(`
2
+ `);s=m.pop()??"";let p=!1;for(let i of m){let u=i.trim();if(!u)continue;let h;try{h=JSON.parse(u)}catch(k){this.logger.warn("[ContactMapStream] failed to parse NDJSON line:",k);continue}if("type"in h&&h.type==="METADATA"){Number.isSafeInteger(h.total)&&h.total>=0&&this.setState({totalCount:h.total});continue}if(!Rs(h)){this.logger.warn("[ContactMapStream] server reported error:","error"in h?h.error:""),o=!0;continue}for(let k of h.records)k&&typeof k.person_id=="number"&&(this.recordMap.set(k.person_id,Ms(k)),p=!0);h.nextCursor&&(this.lastCursor=h.nextCursor),h.isLast&&(n=!0)}p&&(this.consecutiveFailures=0,this.publishRecords({error:null}))}return o?(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 Me=null,Es=e=>{if(Me!==null&&Me.endpoint===e)return Me;if(Ra(e),Me===null)return Me=new Ma({endpoint:e}),Me;if(Me.endpoint!==e)throw new Error(`[contact-map] the stream client already streams from ${JSON.stringify(Me.endpoint)} and cannot also stream from ${JSON.stringify(e)}; give every contact-map view in the browser tab the same streamEndpoint, on every route (after changing it, reload the page)`);return Me},dc=()=>{Me?.dispose(),Me=null},Os=new Map,Ws={records:[],loadedCount:0,totalCount:null,isLoading:!0,isComplete:!1,phase:"idle",error:null},Ds=()=>{let{streamEndpoint:e}=Ve();return La(()=>(Ra(e),e),[e])};function Hs(){let e=Ds(),t=Sn(()=>Es(e),[e]);Ls(()=>{let o=t();o.start(),o.retryNow()},[t]);let a=Sn(o=>t().subscribe(o),[t]),r=vr(a,()=>t().getState(),()=>Ws),s=vr(a,()=>t().getRecordMap(),()=>Os),n=Sn(()=>t().retryNow(),[t]);return La(()=>({...r,recordMap:s,retryNow:n}),[r,s,n])}var _s=e=>{let t=new Set;for(let{company_name:a}of e)typeof a=="string"&&a.trim().length>0&&t.add(a);return t.size};function Ea(){let{records:e,recordMap:t,isComplete:a,phase:r,loadedCount:s,totalCount:n,error:o,retryNow:c}=Hs(),l=La(()=>_s(e),[e]);return{context:La(()=>({contactMapRecords:e,contactMapRecordMap:t,isStreamingComplete:a,isStreamingFailed:r==="failed",streamPhase:r,loadedCount:s,companyCount:l,totalCount:n,errorMessage:o?.message??null}),[e,t,a,r,s,l,n,o]),retryNow:c}}se();import{DEFAULT_FUZZY_SEARCH_OPTIONS as Fn}from"@aiquants/fuzzy-search";import{useFuzzySearch as ol}from"@aiquants/fuzzy-search/react";import sl from"lucide-react/dist/esm/icons/search.js";import{useCallback as ra,useEffect as je,useMemo as kt,useRef as ro,useState as Ae,useTransition as il}from"react";import{useNavigation as ll,useSearchParams as dl}from"react-router";mn();Rt();import{useCallback as xt,useEffect as As,useRef as Cr}from"react";var nt=e=>{let t=Cr(null),a=Cr({isPointerDown:!1,isDragging:!1,startX:0,scrollLeft:0,pointerId:0,hasCapture:!1,didDrag:!1,pointerType:""}),r=e?.dragThreshold??4,s=xt(p=>{let i=p.currentTarget,u=p.deltaY;!i||u===0||(p.preventDefault(),i.scrollBy({left:u,behavior:"smooth"}))},[]),n=xt(p=>{t.current?.removeEventListener("wheel",s),t.current=p,p?.addEventListener("wheel",s,{passive:!1})},[s]);As(()=>()=>{t.current&&t.current.removeEventListener("wheel",s)},[s]);let o=xt(p=>{if(p.pointerType==="touch")return;let i=a.current;i.isPointerDown=!0,i.isDragging=!1,i.startX=p.clientX,i.scrollLeft=p.currentTarget.scrollLeft,i.pointerId=p.pointerId,i.hasCapture=!1,i.pointerType=p.pointerType},[]),c=xt(p=>{let i=a.current;if(!i.isPointerDown||i.pointerType==="touch")return;let u=p.currentTarget,h=p.clientX-i.startX;!i.isDragging&&Math.abs(h)>r&&(i.isDragging=!0,i.hasCapture||(u.setPointerCapture?.(p.pointerId),i.hasCapture=!0)),i.isDragging&&(p.preventDefault(),u.scrollLeft=i.scrollLeft-h)},[r]),l=xt(p=>{let i=a.current;if(i.pointerType==="touch")return;let u=p.currentTarget;i.isPointerDown&&i.hasCapture&&u.hasPointerCapture?.(p.pointerId)&&u.releasePointerCapture(p.pointerId),i.isDragging&&(i.didDrag=!0,window.setTimeout(()=>{i.didDrag=!1},0)),i.isPointerDown=!1,i.isDragging=!1,i.pointerId=0,i.hasCapture=!1},[]),d=xt(p=>{l(p)},[l]),m=xt(p=>{a.current.didDrag&&(p.preventDefault(),p.stopPropagation(),a.current.didDrag=!1)},[]);return{setScrollableRef:n,onPointerDown:o,onPointerMove:c,onPointerUp:d,onPointerLeave:d,onPointerCancel:d,onClickCapture:m}};mt();se();import{jsx as kr}from"react/jsx-runtime";function Sr({value:e,max:t=100,className:a,indicatorClassName:r,...s}){let n=e===void 0,o=n?0:Math.min(100,Math.max(0,e/t*100));return kr("div",{role:"progressbar","aria-valuenow":n?void 0:o,"aria-valuemin":0,"aria-valuemax":100,"data-slot":"progress",className:ft("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",a),...s,children:kr("div",{"data-slot":"progress-indicator",className:ft("h-full rounded-full bg-primary transition-[width] duration-300 ease-in-out will-change-transform",n&&"w-1/3 animate-progress-indeterminate",r),style:n?void 0:{width:`${o}%`}})})}import{useCallback as ji,useState as qi}from"react";import{useSearchParams as Gi}from"react-router";se();ht();import{Panel as Lr,PanelGroup as Js,PanelResizeHandle as Xs}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as Zs,VirtualScroll as ei}from"@aiquants/virtualscroll";import{lazy as ti,memo as ai,Suspense as ni,useCallback as Ke,useEffect as Wr,useLayoutEffect as Dr,useMemo as ea,useRef as ta,useState as _a}from"react";var Jt={listPanelMinWidth:320,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35},Xt={listPanelMinWidth:280,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35};function Oa(e){let t=e.listPanelMinWidth+e.detailPanelMinWidth+e.handleThickness+e.listPaddingAndBorder+e.detailPaddingAndBorder,a=t+e.scrollbarSafetyBuffer,r=a+e.hysteresisSafetyMargin,s=r-a;return{physicalMinWidth:t,collapseThreshold:a,expandThreshold:r,hysteresisWidth:s}}import{useCallback as Is,useEffect as Fs,useState as zs}from"react";var Tr=(e,t)=>{let{enableMutationObserver:a=!1,bottomGap:r=4,minFallbackHeight:s=240}=t??{},[n,o]=zs(600),c=Is(()=>{if(typeof window>"u")return;let l=e.current;if(!l||l.offsetParent===null&&window.getComputedStyle(l).position!=="fixed")return;let d=v=>Number.parseFloat(v)||0,{top:m}=l.getBoundingClientRect(),p=l.parentElement?.getBoundingClientRect(),i=window.getComputedStyle(document.documentElement),u=d(i.getPropertyValue("--footer-height")),h=d(i.getPropertyValue("--header-height")),k=d(i.getPropertyValue("--scrollbar-height")),C=window.getComputedStyle(l),S=d(C.marginBottom),B=d(C.paddingBottom),N=window.innerHeight-u-k-r,y=p?Math.min(p.bottom,N):N,g=p?Math.max(p.top,h):h,O=Math.max(m,g),V=y-O-S-B,b=Number.isFinite(V)?Math.floor(V):0,f=b>0?b:s;f>0&&Number.isFinite(f)&&o(v=>Math.abs(v-f)>1?f:v)},[r,e,s]);return Fs(()=>{if(typeof window>"u")return;let l=null,d=null,m=null,p=null,i=()=>{l!==null&&window.cancelAnimationFrame(l),l=window.requestAnimationFrame(()=>{c()})};i(),d=window.setTimeout(()=>{i()},150);let u=e.current;return typeof ResizeObserver<"u"&&u&&(m=new ResizeObserver(()=>{i()}),m.observe(u),u.parentElement&&m.observe(u.parentElement)),a&&typeof MutationObserver<"u"&&(p=new MutationObserver(()=>{i()}),p.observe(document.body,{attributes:!0,childList:!0,subtree:!0})),window.addEventListener("resize",i),()=>{l!==null&&window.cancelAnimationFrame(l),d!==null&&window.clearTimeout(d),m&&m.disconnect(),p&&p.disconnect(),window.removeEventListener("resize",i)}},[e,a,c]),{viewportHeight:n,updateViewportHeight:c}};import{useCallback as rt,useEffect as wr,useRef as Zt,useState as Nr}from"react";var Bs=600,Pr=8,Wa=({ref:e,onSelect:t,resolveItem:a,item:r})=>{let[s,n]=Nr(!1),[o,c]=Nr(null),l=Zt(null),d=Zt(!1),m=Zt(!1),p=Zt(null),i=Zt({onSelect:t,resolveItem:a,item:r});wr(()=>{i.current={onSelect:t,resolveItem:a,item:r}},[t,a,r]);let u=rt(()=>{typeof window>"u"||l.current!==null&&(window.clearTimeout(l.current),l.current=null)},[]),h=rt(()=>{p.current&&(u(),m.current=!1,p.current=null)},[u]),k=rt(g=>{typeof window>"u"||g.button!==0&&g.pointerType==="mouse"||(u(),m.current=!1,d.current=!1,p.current={x:g.clientX,y:g.clientY,pointerId:g.pointerId},l.current=window.setTimeout(()=>{let O=i.current,V=null;O.item!==void 0?V=O.item:O.resolveItem&&g.target&&(V=O.resolveItem(g.target)),V!==null&&(d.current=!0,O.onSelect?.(V),c(V),n(!0)),h()},Bs))},[u,h]),C=rt(g=>{p.current&&g.pointerId===p.current.pointerId&&(u(),p.current=null,m.current=!1)},[u]),S=rt(g=>{d.current&&(g.preventDefault(),g.stopPropagation(),d.current=!1)},[]),B=rt(g=>{if(!p.current||g.pointerId!==p.current.pointerId)return;let O=Math.abs(g.clientX-p.current.x),V=Math.abs(g.clientY-p.current.y);(O>Pr||V>Pr)&&(u(),p.current=null)},[u]),N=rt(g=>{(s||l.current!==null)&&(g.preventDefault(),g.stopPropagation())},[s]),y=rt(g=>{g?.cancelLongPressTimer&&u(),g?.suppressLongPress&&(m.current=!0),n(!1),c(null),d.current=!1,p.current=null},[u]);return wr(()=>{let g=e.current;if(!(g&&typeof window<"u"))return;let O=[["pointerdown",k,void 0],["pointerup",C,void 0],["pointercancel",C,void 0],["pointermove",B,void 0],["pointerleave",C,void 0],["click",S,!0],["contextmenu",N,void 0]],V=[["contextmenu",N,!0],["pointerup",C,!0],["pointercancel",C,!0]];for(let[b,f,v]of O)g.addEventListener(b,f,v);for(let[b,f,v]of V)window.addEventListener(b,f,v);return()=>{for(let[b,f,v]of O)g.removeEventListener(b,f,v);for(let[b,f,v]of V)window.removeEventListener(b,f,v);u()}},[e,k,C,B,S,N,u]),{isPopupVisible:s,popupItem:o,handleClosePopup:y}};import{useCallback as Us,useEffect as $s,useState as Mr,useSyncExternalStore as Vs}from"react";function Da(e,t,a){let r=a?.mediaQuery??"(min-width: 1024px)",s=Vs(Us(m=>{if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};let p=window.matchMedia(r);return p.addEventListener("change",m),()=>p.removeEventListener("change",m)},[r]),()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(r).matches:!0,()=>!1),[n,o]=Mr(!1),[c,l]=Mr(0);return $s(()=>{if(typeof window>"u"||typeof ResizeObserver>"u")return;let m=e.current;if(!m)return;let p=new ResizeObserver(i=>{for(let u of i){if(u.target!==m)continue;let h=0;u.borderBoxSize&&u.borderBoxSize.length>0?h=u.borderBoxSize[0].inlineSize:h=u.contentRect.width,!(!Number.isFinite(h)||h<=0)&&(l(h),o(k=>k&&h>=t.expandThreshold?!1:!k&&h<t.collapseThreshold?!0:k))}});return p.observe(m),()=>p.disconnect()},[e,t.collapseThreshold,t.expandThreshold]),{isTwoColumn:s&&!n,isContainerNarrow:n,isMediaMatches:s,containerWidth:c}}se();se();import{useSwipeToDismissOverlay as Ks,useTapClick as js}from"@aiquants/swipe-overlay";import{useCallback as qs,useEffect as Gs,useRef as Qs}from"react";import{jsx as Rr,jsxs as Ys}from"react/jsx-runtime";var Ha=({isOpen:e,onClose:t,children:a,className:r="",title:s})=>{let n=q(),o=Qs(null),{overlayRef:c,overlayStyle:l,attemptClose:d}=Ks({isOpen:e,onClose:t,isCloseBlocked:qs(()=>!1,[]),skipWhenTextSelected:!0}),m=js(()=>d());return Gs(()=>{!e&&o.current?.contains(document.activeElement)&&document.activeElement.blur()},[e]),e?Ys("div",{ref:o,"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:[Rr("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}),Rr("aside",{role:"dialog","aria-modal":"true","aria-label":s===void 0?n.overlayTitle:s,style:l,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 ${r}`,onKeyDown:p=>{p.key==="Escape"&&(p.stopPropagation(),d())},children:a})]}):null};pn();import{Fragment as yi,jsx as _,jsxs as be}from"react/jsx-runtime";var ri=ti(async()=>({default:(await Promise.resolve().then(()=>(cr(),dr))).default})),Hr=64,Er="h-[64px]",Or=240,oi=4,Tn=Oa(Jt),si=Jt.listPanelMinWidth,ii=Jt.detailPanelMinWidth,li=Jt.handleThickness,zc=Tn.collapseThreshold,Bc=Tn.expandThreshold,di=({contactData:e})=>{let t=q(),a=e?.full_name??t.noName,r=e?.title??"-",s=e?.company_name??"-",n=e?.department??"-",o=e?.email??"-",c=e?.company_phone_number??e?.mobile_phone_number??"-",l=e?.updated_at?we(e.updated_at):"-";return _(va,{fullName:a,title:r,companyName:s,department:n,phoneNumber:c,email:o,updatedAtText:l})},ci=e=>({"--contact-panel-height":`${e}px`}),pi=e=>typeof e=="object"&&e!==null&&"item"in e,ui=(e,t)=>t!==void 0?`${e}:${t.toFixed(3)}`:void 0,mi=(e,t)=>{for(let a of e){let r=fa(a);if(r?.person_id===t)return r}return null},wn=(e,t,a)=>{let{viewportHeight:r}=Tr(t,{enableMutationObserver:!0,bottomGap:oi,minFallbackHeight:Or}),[s,n]=_a(0),o=Ke(()=>{let p=a.current,i=t.current;if(!(p&&i))return;let u=p.getBoundingClientRect(),h=i.getBoundingClientRect(),k=Math.ceil(h.top-u.top);Number.isFinite(k)&&k>0&&n(C=>Math.abs(C-k)>1?k:C)},[t,a]);Dr(()=>{if(!e)return;o();let p=requestAnimationFrame(o);return window.addEventListener("resize",o),()=>{cancelAnimationFrame(p),window.removeEventListener("resize",o)}},[e,o]);let c=r>0?r:Or,l=s>0?s:0,d=c+l,m=ea(()=>ci(d),[d]);return{normalizedViewportHeight:c,normalizedDetailHeight:d,panelSizingStyle:m}},gi=new Set,hi=()=>{let[e,t]=_a(gi),a=Ke((r,s)=>{t(n=>{if(n.has(r)===s)return n;let o=new Set(n);return s?o.add(r):o.delete(r),o})},[]);return{isAnyPopupVisible:e.size>0,handlePopupVisibilityChange:a}},fi=(e,t,a)=>{let r=ta(a);Dr(()=>{r.current=a},[a]),Wr(()=>{if(e!==null)return r.current(e,t),()=>{r.current(e,!1)}},[e,t])},_r=ai(({entry:e,index:t,selectedPersonId:a,onSelect:r,searchQuery:s,enableHighlighting:n,openEmailsWithGmail:o,openGmailCompose:c,onPopupVisibilityChange:l})=>{let d=q(),m=ta(null),p=_("div",{className:Er}),i=pi(e)?e:null,u=fa(e),{isPopupVisible:h,handleClosePopup:k}=Wa({ref:m,onSelect:r,item:u?.person_id});if(fi(u?.person_id??null,h,l),!e||!u)return p;let{person_id:C}=u,S=a===C,B=t%2===0?"bg-white dark:bg-slate-900":"bg-gray-50 dark:bg-slate-900/70",y=S?"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":B,g=["B","F"].map(O=>ui(O,O==="B"?i?.baseScore:i?.score)).filter(Boolean);return be("div",{ref:m,className:`flex ${Er} 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 ${y}`,style:{height:Hr},role:"button","aria-pressed":S,"data-selected":S?"true":"false",onClick:()=>r(C),children:[be("div",{className:"hidden w-28 shrink-0 flex-col items-center gap-0.5 text-center sm:flex",children:[_("div",{className:"whitespace-nowrap font-medium text-slate-700 text-xs leading-tight dark:text-slate-200",children:d.listRowNumber(t+1)}),_("div",{className:"truncate text-[11px] text-slate-700 leading-tight dark:text-slate-200",children:C}),_("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(O=>_("span",{children:O},O)):_("span",{children:"-"})})]}),_(ni,{fallback:_(di,{contactData:u}),children:_(ri,{contactData:u,searchTerm:s,enableHighlighting:n,openEmailsWithGmail:o,openGmailCompose:c,isPopupVisible:h,onRequestClose:k})})]})});_r.displayName="ContactListRow";var Ar=({context:e})=>{let{contactMapRecords:t,filteredItems:a,searchQuery:r,hasSearchTerm:s,enableHighlighting:n,openEmailsWithGmail:o,isSearchTabActive:c}=e,{locale:l,labels:d,engineLabels:m}=fe(),p=ta(null),i=ta(null),[u,h]=_a(null),{normalizedViewportHeight:k,panelSizingStyle:C}=wn(c,i,p),{isAnyPopupVisible:S,handlePopupVisibilityChange:B}=hi(),N=ea(()=>({enablePointerDrag:!S,enableKeyboardNavigation:!S}),[S]),y=ea(()=>s?a:t,[s,a,t]),g=Ke(re=>{h(re)},[]),O=Ke(re=>{if(!o)return;let te=re.trim();if(!te||te==="-"||typeof window>"u")return;let st=$e(te,!0);st&&window.open(st,"_blank","noopener,noreferrer")},[o]),[V,b]=_a(!1),f=Ke(re=>{g(re),b(!0)},[g]),v=Ke((re,te)=>_(_r,{entry:re,index:te,selectedPersonId:u,onSelect:f,searchQuery:r,enableHighlighting:n,openEmailsWithGmail:o,openGmailCompose:O,onPopupVisibilityChange:B}),[u,f,r,n,o,O,B]),W=Ke(re=>y[re],[y]),D=Ke(re=>fa(y[re])?.person_id??`row-${re}`,[y]),X=Ke(()=>Hr,[]),P=y.length,M=ea(()=>({enabled:!0,renderVisual:Zs}),[]),H=ea(()=>u===null?null:mi(y,u),[u,y]);Wr(()=>{u!==null&&!H&&h(null)},[u,H]);let U=ta(null),{isTwoColumn:ee}=Da(U,Tn),pe=be("div",{ref:p,className:"flex min-h-0 flex-1 flex-col gap-1",children:[_("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:be("div",{className:"flex items-center",children:[be("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:[_("span",{className:"font-semibold text-slate-900 text-xs dark:text-slate-100",children:d.columnNo}),_("span",{className:"leading-tight",children:d.columnId}),_("span",{className:"whitespace-nowrap leading-tight",children:d.columnScore})]}),be("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:[be("div",{className:"flex flex-col gap-0.5",children:[_("span",{children:d.columnName}),_("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:d.columnTitle})]}),be("div",{className:"flex flex-col gap-0.5",children:[_("span",{children:d.columnCompany}),_("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:d.columnDepartment})]}),be("div",{className:"flex flex-col gap-0.5",children:[_("span",{children:d.columnPhone}),_("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:d.columnEmail})]}),_("div",{className:"hidden items-end justify-end xl:flex",children:_("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:d.columnUpdatedAt})})]})]})}),_("div",{ref:i,className:"flex-1",children:_(ei,{itemCount:P,getItemKey:D,behaviorOptions:N,getItem:W,getItemHeight:X,viewportSize:k,overscanCount:10,scrollBarOptions:{width:8,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:M},locale:l,labels:m,className:"w-full rounded-b-lg border border-gray-200 border-t-0 bg-white pr-0.75 transition-colors dark:border-slate-700 dark:bg-slate-950",children:(re,te)=>v(re,te)})}),a.length===0&&s?_("div",{className:"py-8 text-center",children:_("p",{className:"text-slate-600 dark:text-slate-300",children:d.listNoSearchResults})}):null,P===0&&!s?_("div",{className:"py-8 text-center",children:_("p",{className:"text-slate-600 dark:text-slate-300",children:d.listNoData})}):null]});return _("div",{ref:U,"data-testid":"contact-map-list-root",className:"flex min-h-0 flex-1 flex-col",style:C,children:ee?be(Js,{id:"contact-map-list-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-list-panel-group",children:[_(Lr,{id:"contact-map-list-pane",defaultSize:{value:68,unit:"percentage"},minSize:{value:si,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:pe}),_(Xs,{id:"contact-map-list-handle",thickness:li,indicator:{visible:!0,thickness:6,length:32,barThickness:2,barLength:16},className:"cursor-col-resize rounded transition-colors hover:bg-slate-200/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-1 dark:hover:bg-slate-700/60","aria-label":d.listResizeHandle}),_(Lr,{id:"contact-map-list-detail-pane",defaultSize:{value:32,unit:"percentage"},minSize:{value:ii,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:_(tt,{contact:H,searchTerm:r,enableHighlighting:n})})]}):be(yi,{children:[pe,_("div",{className:"hidden","aria-hidden":"true",children:_(tt,{contact:H,searchTerm:r,enableHighlighting:n})}),H?_(Ha,{isOpen:V,onClose:()=>b(!1),className:"z-50 bg-white dark:bg-slate-900",children:be("div",{className:"flex h-full flex-col overflow-hidden p-3 sm:p-4",children:[be("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:d.detailHeading}),_("button",{type:"button",onClick:()=>b(!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:d.close})]}),_("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",style:{height:"100%"},children:_(tt,{contact:H,searchTerm:r,enableHighlighting:n})})]})}):null]})})};ht();import{DirectoryTree as Mi}from"@aiquants/directory-tree";import{Panel as Vr,PanelGroup as Ri,PanelResizeHandle as Li}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as Ei}from"@aiquants/virtualscroll";import Oi from"@heroicons/react/24/solid/FolderMinusIcon.js";import Wi from"@heroicons/react/24/solid/FolderPlusIcon.js";import{useCallback as De,useEffect as Ct,useMemo as Re,useRef as za,useState as ot}from"react";import{createPortal as Di}from"react-dom";var Nn=(e,t)=>e&&e.trim()||t;import{useEffect as bi,useRef as Aa,useState as xi}from"react";var Ir=(e,t=250)=>{let[a,r]=xi(e),s=Aa(null),n=Aa(e),o=Aa(null),c=Aa(!1);return bi(()=>{if(!c.current){c.current=!0,r(e),n.current=e;return}n.current=a,s.current=null;let l=d=>{s.current??(s.current=d);let m=d-s.current,p=Math.min(1,Math.max(0,m/t)),i=1-(1-p)**3,u=Math.max(0,Math.round(n.current+(e-n.current)*i));r(u),p<1&&(o.current=requestAnimationFrame(l))};return o.current=requestAnimationFrame(l),()=>{o.current!==null&&cancelAnimationFrame(o.current)}},[e,t]),Math.max(0,a)};Pt();import{useCallback as Pn,useEffect as Mn,useMemo as Fr,useRef as vi,useSyncExternalStore as Ci}from"react";se();var ki=250,Si=4e3,Ia=3,zr={treeWorkerFactory:"the view remounts","workerUrls.treeWorker":"the page reloads"},Br=(e,t)=>e.uncategorizedCompany===t.uncategorizedCompany&&e.unnamedPerson===t.unnamedPerson,Fa=class{constructor(t,{workerSource:a,logger:r=We}){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.finalizeRequest=null;this.finalizedPostedCount=null;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.consecutiveFailures+=1,this.updateState(),this.consecutiveFailures>=Ia){this.logger.error(`[TreeWorker] the tree Worker failed ${Ia} times in a row; the tree stops updating until ${zr[this.workerSource]} (check ${this.workerSource})`,t);return}let a=Math.min(ki*2**(this.consecutiveFailures-1),Si);this.logger.warn(`[TreeWorker] the tree Worker failed; retrying in ${a}ms (failure ${this.consecutiveFailures} of ${Ia})`,t),this.retryTimer!==null&&clearTimeout(this.retryTimer),this.retryTimer=setTimeout(()=>{this.retryTimer=null;let r=this.lastSyncedNaming;r!==null&&this.syncRecords(this.lastSyncedRecords,r)},a)};if(typeof a!="string")throw new TypeError(`[contact-map] TreeWorkerSession workerSource must be a string; got ${ae(a)}`);if(!Object.hasOwn(zr,a))throw new RangeError(`[contact-map] TreeWorkerSession workerSource must be "treeWorkerFactory" or "workerUrls.treeWorker"; got ${ae(a)}`);this.workerFactory=t,this.workerSource=a,this.logger=r}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>=Ia||this.retryTimer!==null)return null;if(!this.worker)try{this.worker=this.workerFactory(),this.workerNeedsReset=!0,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.finalizeRequest!==null&&(t.length<this.finalizeRequest.recordCount||this.finalizeRequest.naming===null||!Br(this.finalizeRequest.naming,a))&&(this.finalizeRequest=null),this.lastSyncedRecords=t,this.lastSyncedNaming=a;let r=this.ensureWorker();if(!r)return;let s=this.workerNeedsReset,n=this.postedNaming===null||!Br(this.postedNaming,a);if((this.workerNeedsReset||n||t.length<this.postedCount)&&(this.generation+=1,this.postedCount=0,this.finalizedPostedCount=null,this.workerNeedsReset=!1,this.postedNaming=a,r.postMessage({type:"RESET_TREE",generation:this.generation,epochBase:this.latestSnapshot?.rebuildEpoch??0,naming:a}),this.updateState()),t.length>this.postedCount){let o=t.slice(this.postedCount);this.postedCount=t.length,r.postMessage({type:"APPEND_RECORDS",generation:this.generation,records:o}),this.updateState()}s&&this.finalizeRequest!==null&&this.finalize()}finalize(){this.finalizeRequest={recordCount:this.lastSyncedRecords.length,naming:this.lastSyncedNaming},!(this.worker===null||this.finalizedPostedCount===this.postedCount)&&(this.finalizedPostedCount=this.postedCount,this.worker.postMessage({type:"FINALIZE_TREE",generation:this.generation}))}cancelWorker(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null),this.worker?.terminate(),this.worker=null,this.postedCount=0,this.postedNaming=null,this.finalizedPostedCount=null}stop(){this.cancelWorker(),this.consecutiveFailures=0,this.updateState()}reset(){this.cancelWorker(),this.listeners.clear(),this.latestSnapshot=null,this.lastSyncedRecords=[],this.lastSyncedNaming=null,this.consecutiveFailures=0,this.finalizeRequest=null,this.state={snapshot:null,isBuilding:!1}}},Ti=e=>{if(e!==void 0)return new Worker(e,{type:"module"});let t=typeof import.meta<"u"?import.meta.url:void 0;if(t){let r=t.includes(".ts")?"../workers/treeWorker.ts":"./worker/treeWorker.mjs";return new Worker(new URL(r,t),{type:"module"})}throw new Error("[contact-map] the tree Worker needs workerUrls.treeWorker in a build without import.meta.url (CommonJS)")},vt=null,Ur=e=>e===void 0?"the bundled Worker file (workerUrls.treeWorker unset)":JSON.stringify(e),wi=e=>{if(e===void 0)throw new Error("[contact-map] treeWorkerFactory was removed from the config while its tree session was still in use");return e},Ni=e=>{if(fr(e),vt===null){let t=new Fa(()=>Ti(e),{workerSource:"workerUrls.treeWorker"});return vt={session:t,workerUrl:e},t}if(vt.workerUrl!==e)throw new Error(`[contact-map] the tree session already loads its Worker from ${Ur(vt.workerUrl)} and cannot also load it from ${Ur(e)}; give every contact-map view in the browser tab the same workerUrls.treeWorker, on every route (after changing it, reload the page)`);return vt.session},Zc=()=>{vt?.session.reset(),vt=null},Pi={snapshot:null,isBuilding:!1};function $r(e,t=!1){let a=Ve(),r=a.treeWorkerFactory,s=a.workerUrls?.treeWorker,{labels:n}=fe(),o=n.uncategorizedCompany,c=n.noName,l=Fr(()=>({uncategorizedCompany:o,unnamedPerson:c}),[o,c]),d=vi(r);Mn(()=>{d.current=r},[r]);let m=r!==void 0,p=m?void 0:s,i=Fr(()=>m?new Fa(()=>wi(d.current)(),{workerSource:"treeWorkerFactory"}):null,[m]),u=Pn(()=>i===null?Ni(p):i,[i,p]),h=Pn(C=>u().subscribe(C),[u]),k=Pn(()=>u().getState(),[u]);return Mn(()=>{let C=u();C.syncRecords(e,l),t&&C.finalize()},[u,e,t,l]),Mn(()=>{if(i!==null)return()=>i.stop()},[i]),Ci(h,k,()=>Pi)}se();cn();Sa();import{Fragment as Ki,jsx as A,jsxs as ue}from"react/jsx-runtime";var En=Oa(Xt),Hi=Xt.listPanelMinWidth,_i=Xt.detailPanelMinWidth,Ai=Xt.handleThickness,kp=En.collapseThreshold,Sp=En.expandThreshold,Ii=(e,t)=>{let{searchQuery:a,enableHighlighting:r}=t,s=Nn(e.full_name,t.noName),n=Nn(e.title,""),o=A(ce,{text:s,query:a,enabled:r});return n?ue("span",{className:"flex items-center gap-1.5",children:[A("span",{children:o}),A("span",{className:"text-slate-400 text-xs dark:text-slate-500",children:A(ce,{text:n,query:a,enabled:r})})]}):o},Fi="contact-map-tree h-full w-full",zi={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"},Rn="h-4 w-4 shrink-0 transition-colors duration-150",Bi=(e,t,a)=>({...e,viewportHeightOverride:t,behaviorOptions:{...e.behaviorOptions,enablePointerDrag:!a,enableKeyboardNavigation:!a}}),Ba=null,Kr=null,aa=new Map,jr="",qr=null,Gr=null,Ui=(e,t,a,r,s)=>{let n=`${a?"icons":"plain"}#${r}#${s.noName}`;(n!==jr||s.formatDirectoryName!==qr||t!==Gr)&&(aa.clear(),jr=n,qr=s.formatDirectoryName,Gr=t);let o={entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},c=new Set;for(let l of e){c.add(l.absolutePath);let d=`${l.name}\0${l.memberCount}`,m=aa.get(l.absolutePath);(!m||m.signature!==d)&&(m={signature:d,result:Yr([l],t,a,{searchQuery:"",enableHighlighting:!1,noName:s.noName,formatDirectoryName:s.formatDirectoryName})},aa.set(l.absolutePath,m));let p=m.result;p.entries.length>0&&o.entries.push(p.entries[0]);for(let[i,u]of p.personPathMap){let h=o.personPathMap.get(i);if(h)for(let k of u)h.add(k);else o.personPathMap.set(i,new Set(u))}for(let[i,u]of p.contactByPath)o.contactByPath.set(i,u);for(let[i,u]of p.ancestorsByPath)o.ancestorsByPath.set(i,u);o.totalCount+=p.totalCount,!o.firstPerson&&p.firstPerson&&(o.firstPerson=p.firstPerson)}for(let l of aa.keys())c.has(l)||aa.delete(l);return o},Ln=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",Qr=e=>{let t=[];for(let a of e)a.type==="directory"&&(t.push(a.absolutePath),a.children&&t.push(...Qr(a.children)));return t},$i=e=>{if(e.memberCount===void 0)throw new Error(`[contact-map] directory entry ${e.absolutePath} has no memberCount`);return e.memberCount},Yr=(e,t,a,r,s)=>{let n=new Map,o=new Map,c=new Map,l=0,d=null,m=(i,u)=>{let h=[...u,i.absolutePath];c.set(i.absolutePath,h);let k,C,S=i.type==="directory"?r.formatDirectoryName(i.name,$i(i)):i.name,B=A(ce,{text:S,query:r.searchQuery,enabled:r.enableHighlighting});if(i.type==="file"&&i.personId){if(s&&!s.has(i.personId))return null;let N=t.get(i.personId);if(N){o.set(i.absolutePath,N),n.has(i.personId)||n.set(i.personId,new Set);let y=n.get(i.personId);y&&y.add(i.absolutePath),l++,d||(d={personId:i.personId,path:i.absolutePath}),a&&(C=g=>{let O=Ln(g);return g.isSelected||g.isItemSelected||i.isPrimary&&(O=i.title?"text-indigo-600 dark:text-indigo-400":"text-orange-500 dark:text-orange-400"),A(a.person,{"aria-hidden":"true",className:`${Rn} ${O}`})},i.title&&(B=Ii(N,r))),B=A("span",{"data-contact-path":i.absolutePath,className:"block w-full",children:B})}}else if(i.children){let N=i.children.map(y=>m(y,h)).filter(y=>y!==null);if(s&&N.length===0)return null;if(k=N,a){let y=i.relativePath.startsWith("company:")?a.company:a.department;C=g=>A(y,{"aria-hidden":"true",className:`${Rn} ${Ln(g)}`})}}return{name:S,label:B,type:i.type,absolutePath:i.absolutePath,relativePath:i.relativePath,icon:C,children:k}};return{entries:e.map(i=>m(i,[])).filter(i=>i!==null),personPathMap:n,contactByPath:o,ancestorsByPath:c,firstPerson:d,totalCount:l}},Vi=(e,t,a)=>{let r=new Set,s=new Set,n=new Map;t.forEach((m,p)=>{n.set(m.item.person_id,p)});for(let m of t){let p=m.item.person_id,i=e.personPathMap.get(p);if(i)for(let u of i){r.add(u);let h=e.ancestorsByPath.get(u);if(h){for(let k of h)r.add(k);a&&h.length>0&&s.add(h[0])}}}let o=new Map,c=m=>{let p=o.get(m.absolutePath);if(p!==void 0)return p;let i=1/0;if(m.type==="file"){let u=e.contactByPath.get(m.absolutePath);u&&(i=n.get(u.person_id)??1/0)}else if(m.children)for(let u of m.children)i=Math.min(i,c(u));return o.set(m.absolutePath,i),i},l=(m,p=0)=>m.filter(i=>a&&p===0&&s.has(i.absolutePath)?!0:r.has(i.absolutePath)).map(i=>a&&p===0&&s.has(i.absolutePath)?i:i.type==="directory"&&i.children?{...i,children:l(i.children,p+1)}:i).sort((i,u)=>p===0?c(i)-c(u):0),d=l(e.entries);return{...e,entries:d}},Jr=({context:e,controlsContainer:t})=>{let{contactMapRecords:a,contactMapRecordMap:r,filteredItems:s,hasSearchTerm:n,isSearchInProgress:o,isSearchTabActive:c}=e,{locale:l,labels:d,treeLabels:m}=fe(),p=d.noName,i=d.treeDirectoryName,u=Re(()=>({noName:p,formatDirectoryName:i}),[p,i]),[h,k]=ot(null),[C,S]=ot(!1),{snapshot:B,isBuilding:N}=$r(a,e.isStreamingComplete),y=B?.tree??null,g=B?.rebuildEpoch??0,O=Re(()=>y?Ui(y,r,h,g,u):null,[y,r,h,g,u]),V=Re(()=>{if(!y)return null;if(!n)return O;let x;C||(x=new Set(s.map(F=>F.item.person_id)));let T=Yr(y,r,h,{...u,searchQuery:e.searchQuery,enableHighlighting:e.enableHighlighting},x);return Vi(T,s,C)},[y,O,r,h,e.searchQuery,e.enableHighlighting,n,s,C,u]),b=Re(()=>V||{entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},[V]),f=n&&e.errorMessage!==null,[v,W]=ot(b),D=za(!1);Ct(()=>{if(!(o||f)){D.current=!!y,W(b);return}!D.current&&y&&b.entries.length>0&&(D.current=!0,W(b))},[b,y,o,f]);let X=n&&(o||f)?v:b,{entries:P,personPathMap:M,contactByPath:H,totalCount:U}=X,ee=Re(()=>Qr(P),[P]),[pe,re]=ot(()=>Kr??new Set),te=De(x=>!pe.has(x),[pe]),st=De(x=>{re(T=>{let F=new Set(T);return F.has(x)?F.delete(x):F.add(x),F})},[]),it=De(x=>{x.length!==0&&re(T=>{let F=new Set(T);for(let le of x)F.add(le);return F})},[]),At=De(x=>{re(T=>{if(T.size===0)return T;let F=!1,le=new Set(T);for(let Nt of x)le.delete(Nt)&&(F=!0);return F?le:T})},[]);Ct(()=>{Kr=pe},[pe]),Ct(()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem("contact-map.tree-expanded")}catch{}},[]);let[Ie,lt]=ot(null),[he,It]=ot(null),[qe,Ft]=ot(!1),[$a,oe]=ot(!1),zt=za(null),Ge=za(null),{normalizedViewportHeight:Fe,panelSizingStyle:ke}=wn(c,Ge,zt),St=De(x=>{let T=H.get(x);T&&(Ie!==T.person_id&&lt(T.person_id),x!==he&&It(x),Ft(!0))},[H,he,Ie]),oa=De(x=>{St(x.entry.absolutePath)},[St]),Le=De(x=>x instanceof Element?x.closest("[data-contact-path]")?.getAttribute("data-contact-path")??null:null,[]),{isPopupVisible:Bt,popupItem:dt,handleClosePopup:Qe}=Wa({ref:Ge,resolveItem:Le,onSelect:St}),Ye=De(x=>{if(!e.openEmailsWithGmail)return;let T=x.trim();if(!T||T==="-"||typeof window>"u")return;let F=$e(T,!0);F&&window.open(F,"_blank","noopener,noreferrer")},[e.openEmailsWithGmail]),ze=dt?H.get(dt):null,Je=Bt&&ze!==null&&ze!==void 0;Ct(()=>{Bt&&!ze&&Qe()},[Bt,ze,Qe]);let sa=Re(()=>({overscanCount:16,callbackThrottleMs:16,scrollBarOptions:{width:8,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:{enabled:!0,renderVisual:Ei}},behaviorOptions:{resetOnGetItemHeightChange:!1},preserveScrollAnchor:!0}),[]),Ut=Re(()=>Bi(sa,Fe,Je),[sa,Fe,Je]);Ct(()=>{let x=!1;return typeof window>"u"?()=>{x=!0}:Ba?(k(Ba),()=>{x=!0}):((async()=>{try{let[F,le,Nt,Ze]=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(x)return;let pt=F.default,Ga=le.default,$n=Nt.default,Vn=Ze.default;pt&&Ga&&$n&&Vn&&(Ba={company:pt,department:Ga,title:$n,person:Vn},k(Ba))}catch(F){We.warn("Failed to load lucide icons",F)}})(),()=>{x=!0})},[]);let Se=Re(()=>{if(!h)return;let x=Ze=>pt=>A(Ze,{"aria-hidden":"true",className:`${Rn} ${Ln(pt)}`}),T={company:x(h.company),department:x(h.department),title:x(h.title)},F=x(h.person),le=Ze=>Ze in T,Nt=Ze=>{let[pt]=Ze.entry.relativePath.split(":",1);return(le(pt)?T[pt]:T.company)(Ze)};return{directory:Nt,directoryExpanded:Nt,file:F}},[h]),Va=De(()=>{re(x=>x.size===0?x:new Set)},[]),Ka=De(()=>{ee.length>0&&it(ee)},[ee,it]);Ct(()=>{if(typeof window>"u")return;let x=document.documentElement,T=window.matchMedia("(prefers-color-scheme: dark)"),F=()=>oe(x.classList.contains("dark")||T.matches);F(),T.addEventListener("change",F);let le=new MutationObserver(F);return le.observe(x,{attributes:!0,attributeFilter:["class"]}),()=>{T.removeEventListener("change",F),le.disconnect()}},[]),Ct(()=>{if(U===0){Ie!==null&&lt(null),he!==null&&It(null);return}if(Ie!==null){let x=M.get(Ie);if(x){if(he&&x.has(he))return;let T=x.values().next().value;T&&It(T);return}}Ie!==null&&lt(null),he!==null&&It(null)},[U,Ie,he,M]);let Tt=he?H.get(he)??null:null,$t=$a?"#475569":"#94A3B8",wt=e.isStreamingComplete,Xe=e.isStreamingFailed,ct=wt&&a.length===0,ja=(N||!y)&&!ct,ia=Ir(U,250),la=y!==null||ct,da=ue("div",{className:"flex items-center gap-1.5",children:[ue("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:d.treeNodeCountTitle,children:[A("span",{className:"text-[10px]",children:"\u{1F333}"})," ",d.treeNodeCountLabel," ",la?d.treeNodeCount(ia):"\u2026"]}),Xe&&!wt?ue("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:d.treeStreamInterruptedTitle,children:[A("span",{className:"h-1.5 w-1.5 rounded-full bg-rose-500"}),A("span",{className:"text-[10px]",children:"\u26D4"})," ",d.treeStreamInterrupted]}):wt?ja?ue("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:d.treeBuildingTitle,children:[ue("span",{className:"relative flex h-1.5 w-1.5",children:[A("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),A("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-amber-500"})]}),A("span",{className:"text-[10px]",children:"\u{1F33F}"})," ",d.treeBuilding]}):ue("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:d.treeCompleteTitle,children:[A("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),A("span",{className:"text-[10px]",children:"\u2705"})," ",d.treeComplete]}):ue("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:d.treeStreamLoadingTitle,children:[ue("span",{className:"relative flex h-1.5 w-1.5",children:[A("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-sky-400 opacity-75"}),A("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-sky-500"})]}),A("span",{className:"text-[10px]",children:"\u23F3"})," ",d.treeStreamLoading]}),n&&ue("button",{type:"button",onClick:()=>S(!C),className:`inline-flex h-5 items-center rounded px-1.5 text-[10px] transition-colors ${C?"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:d.treeShowEntireCompanyTitle,children:[A("span",{className:"text-[10px]",children:"\u{1F3E2}"})," ",d.treeShowEntireCompany]}),ee.length>0?ue("div",{className:"flex items-center gap-1",children:[A("button",{type:"button",onClick:Va,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":d.treeExpandAll,title:d.treeExpandAllTitle,children:A(Wi,{className:"h-3 w-3"})}),A("button",{type:"button",onClick:Ka,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":d.treeCollapseAll,title:d.treeCollapseAllTitle,children:A(Oi,{className:"h-3 w-3"})})]}):null]}),ca=za(null),{isTwoColumn:pa}=Da(ca,En,{mediaQuery:"(min-width: 768px)"}),ua=Re(()=>({toggle:st,isExpanded:te,expandMultiple:At,collapseMultiple:it,isPending:o}),[it,At,te,st,o]),Bn=Re(()=>({onEntryClick:oa,selectedPath:he}),[oa,he]),Un=Re(()=>({className:Fi,lineColor:$t,iconOverrides:Se,showDirectoryIcons:!!Se,showFileIcons:!!Se,highlightStyles:zi,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"}),[$t,Se]),qa=A("div",{ref:zt,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:A("div",{ref:Ge,className:"flex min-h-0 flex-1 flex-col overflow-hidden p-2",children:P.length>0?A(Mi,{entries:P,expansion:ua,selection:Bn,visual:Un,virtualScroll:Ut,locale:l,labels:m}):A("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:n?d.treeNoMatches:d.treeEmpty})})});return ue("div",{ref:ca,"data-testid":"contact-map-tree-root",className:"flex min-h-0 flex-1 flex-col",style:ke,children:[t&&Di(da,t),pa?ue(Ri,{id:"contact-map-tree-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-tree-panel-group",children:[A(Vr,{id:"contact-map-tree-pane",defaultSize:{value:60,unit:"percentage"},minSize:{value:Hi,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:qa}),A(Li,{id:"contact-map-tree-handle",thickness:Ai,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":d.treeResizeHandle}),A(Vr,{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:A(tt,{contact:Tt??null,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})})]}):ue(Ki,{children:[qa,A("div",{className:"hidden","aria-hidden":"true",children:A(tt,{contact:Tt,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})}),qe&&Tt?A(Ha,{isOpen:qe,onClose:()=>Ft(!1),className:"z-50 bg-white dark:bg-slate-900",children:ue("div",{className:"flex h-full flex-col overflow-hidden p-3 sm:p-4",children:[ue("div",{className:"mb-2 flex items-center justify-between border-b pr-10 pb-2 dark:border-slate-700",children:[A("h3",{className:"font-semibold text-slate-900 text-sm dark:text-slate-100",children:d.detailHeading}),A("button",{type:"button",onClick:()=>Ft(!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:d.close})]}),A("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",style:{height:"100%"},children:A(tt,{contact:Tt,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})})]})}):null]}),Je&&ze&&A(xa,{contactData:ze,openEmailsWithGmail:e.openEmailsWithGmail,openGmailCompose:Ye,onRequestClose:Qe})]})};import{jsx as na,jsxs as Wt}from"react/jsx-runtime";var On="view",Qi={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},Yi=e=>e==="tree"?"tree":"list",Xr=({context:e})=>{let t=q(),[a,r]=Gi(),[s,n]=qi(null),o=Yi(a.get(On)),{setScrollableRef:c,onPointerDown:l,onPointerMove:d,onPointerUp:m,onPointerLeave:p,onPointerCancel:i,onClickCapture:u}=nt(),h=ji(k=>{let C=k==="tree"?"tree":"list";if(C===o)return;let S=new URLSearchParams(typeof window<"u"?window.location.search:"");C==="list"?S.delete(On):S.set(On,C),r(S,{replace:!0})},[o,r]);return Wt("div",{"data-testid":"contact-map-search-tab-group",className:"flex h-full flex-1 flex-col",children:[Wt("div",{className:"mt-1 mb-1.5 flex shrink-0 items-center gap-2",children:[Wt("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:Qi,onPointerDown:l,onPointerMove:d,onPointerUp:m,onPointerLeave:p,onPointerCancel:i,onClickCapture:u,children:[Wt("button",{type:"button","data-testid":"contact-map-tab-list",onClick:()=>h("list"),className:`rounded px-2 py-0.5 text-xs transition-colors ${o==="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]}),Wt("button",{type:"button","data-testid":"contact-map-tab-tree",onClick:()=>h("tree"),className:`rounded px-2 py-0.5 text-xs transition-colors ${o==="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]})]}),na("div",{ref:n,className:"flex items-center gap-1.5"})]}),Wt("div",{className:"flex h-full flex-1 flex-col",children:[na("div",{className:`${o==="list"?"flex h-full flex-1 flex-col":"hidden"}`,children:o==="list"?na(Ar,{context:e}):null}),na("div",{className:`${o==="tree"?"flex h-full flex-1 flex-col":"hidden"}`,children:o==="tree"?na(Jr,{context:e,controlsContainer:s}):null})]})]})};import{DEFAULT_FUZZY_SEARCH_OPTIONS as Hn}from"@aiquants/fuzzy-search";import{memo as Zi}from"react";se();se();import{DEFAULT_FUZZY_SEARCH_OPTIONS as z}from"@aiquants/fuzzy-search";import{memo as Ji,useId as xe}from"react";import{jsx as E,jsxs as I}from"react/jsx-runtime";var Wn=Ji(({searchOptions:e,setSearchOptions:t})=>{let a=q(),r="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",s="text-xs font-semibold",n=e.sortBy==="relevance",o=xe(),c=xe(),l=xe(),d=xe(),m=xe(),p=xe(),i=xe(),u=xe(),h=xe(),k=xe(),C=xe(),S=[];S.push(I("div",{className:`${r} border-green-200 border-l-4 dark:border-green-400/60`,children:[I("div",{className:`${s} text-green-700 dark:text-green-300`,children:["\u{1F3D7}\uFE0F ",a.indexBuildHeading]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:o,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexNgramSize}),E("input",{id:o,type:"range",min:"1",max:"4",step:"1",value:e.ngramSize||z.ngramSize,onChange:y=>t(g=>({...g,ngramSize:parseInt(y.target.value,10)})),className:"w-full"}),I("span",{className:"text-green-600 text-xs dark:text-green-300",children:[a.currentValueLabel," ",e.ngramSize||z.ngramSize]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexNgramSizeHint})]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:c,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexMinNgramOverlap}),E("input",{id:c,type:"range",min:"1",max:"5",step:"1",value:e.minNgramOverlap||z.minNgramOverlap,onChange:y=>t(g=>({...g,minNgramOverlap:parseInt(y.target.value,10)})),className:"w-full"}),I("span",{className:"text-green-600 text-xs dark:text-green-300",children:[a.currentValueLabel," ",e.minNgramOverlap||z.minNgramOverlap]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexMinNgramOverlapHint})]})]},"index-build")),S.push(I("div",{className:`${r} border-blue-200 border-l-4 dark:border-blue-500/60`,children:[I("div",{className:`${s} text-blue-700 dark:text-blue-300`,children:["\u{1F50D} ",a.indexCandidateHeading]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:l,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexThreshold}),E("input",{id:l,type:"range",min:"0.0",max:"1.0",step:"0.05",value:e.indexWorkerOptions?.threshold??z.indexWorkerOptions?.threshold,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,threshold:parseFloat(y.target.value)}})),className:"w-full"}),I("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.threshold??z.indexWorkerOptions?.threshold]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexThresholdHint})]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:m,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexNgramOverlapThreshold}),E("input",{id:m,type:"range",min:"0.1",max:"0.9",step:"0.1",value:e.indexWorkerOptions?.ngramOverlapThreshold??z.indexWorkerOptions?.ngramOverlapThreshold,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,ngramOverlapThreshold:parseFloat(y.target.value)}})),className:"w-full"}),I("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.ngramOverlapThreshold??z.indexWorkerOptions?.ngramOverlapThreshold]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexNgramOverlapThresholdHint})]})]},"candidate-control")),S.push(I("div",{className:`${r} border-cyan-200 border-l-4 dark:border-cyan-400/60`,children:[I("div",{className:`${s} text-cyan-700 dark:text-cyan-300`,children:["\u{1F9ED} ",a.indexStrategyHeading]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:d,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexStrategy}),I("select",{id:d,value:e.indexWorkerOptions?.strategy??z.indexWorkerOptions?.strategy??"hybrid",onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,strategy:y.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:[E("option",{value:"fast",children:a.indexStrategyFast}),E("option",{value:"accurate",children:a.indexStrategyAccurate}),E("option",{value:"hybrid",children:a.indexStrategyHybrid})]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexStrategyHint})]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:p,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexMinCandidatesRatio}),E("input",{id:p,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.minCandidatesRatio??z.indexWorkerOptions?.minCandidatesRatio,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,minCandidatesRatio:parseFloat(y.target.value)}})),className:"w-full"}),I("span",{className:"text-cyan-600 text-xs dark:text-cyan-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.minCandidatesRatio??z.indexWorkerOptions?.minCandidatesRatio]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexMinCandidatesRatioHint})]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:i,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexMaxCandidatesRatio}),E("input",{id:i,type:"range",min:"0.3",max:"0.8",step:"0.1",value:e.indexWorkerOptions?.maxCandidatesRatio??z.indexWorkerOptions?.maxCandidatesRatio,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxCandidatesRatio:parseFloat(y.target.value)}})),className:"w-full"}),I("span",{className:"text-cyan-600 text-xs dark:text-cyan-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.maxCandidatesRatio??z.indexWorkerOptions?.maxCandidatesRatio]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexMaxCandidatesRatioHint})]})]},"strategy")),S.push(I("div",{className:`${r} border-indigo-200 border-l-4 dark:border-indigo-500/60`,children:[I("div",{className:`${s} text-indigo-700 dark:text-indigo-300`,children:["\u{1F521} ",a.scoreTuningHeading]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:u,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexJaroWinklerPrefix}),E("input",{id:u,type:"range",min:"0.05",max:"0.25",step:"0.05",value:e.indexWorkerOptions?.jaroWinklerPrefix??z.indexWorkerOptions?.jaroWinklerPrefix,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,jaroWinklerPrefix:parseFloat(y.target.value)}})),className:"w-full"}),I("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.jaroWinklerPrefix??z.indexWorkerOptions?.jaroWinklerPrefix]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexJaroWinklerPrefixHint})]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:h,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.maxResults}),E("input",{id:h,type:"range",min:"1000",max:"10000",step:"1000",value:e.indexWorkerOptions?.maxResults??z.indexWorkerOptions?.maxResults,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxResults:parseInt(y.target.value,10)}})),className:"w-full"}),I("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.maxResults??z.indexWorkerOptions?.maxResults]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexMaxResultsHint})]})]},"jaro")),S.push(I("div",{className:`${r} border-emerald-200 border-l-4 ${n?"":"opacity-50"} dark:border-emerald-400/60`,children:[I("div",{className:`${s} text-emerald-700 dark:text-emerald-300`,children:["\u{1F3AF} ",a.relevanceWeightsHeading]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:k,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.fieldWeight}),E("input",{id:k,type:"range",min:"0",max:"1",step:"0.05",value:e.indexWorkerOptions?.relevanceFieldWeight??z.indexWorkerOptions?.relevanceFieldWeight??.2,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,relevanceFieldWeight:parseFloat(y.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??z.indexWorkerOptions?.relevanceFieldWeight??.2]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexFieldWeightHint})]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:C,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexPerfectMatchBonus}),E("input",{id:C,type:"range",min:"0",max:"0.3",step:"0.1",value:e.indexWorkerOptions?.relevancePerfectMatchBonus??z.indexWorkerOptions?.relevancePerfectMatchBonus??.1,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,relevancePerfectMatchBonus:parseFloat(y.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??z.indexWorkerOptions?.relevancePerfectMatchBonus??.1]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexPerfectMatchBonusHint})]}),!n&&E("p",{className:"text-[11px] text-emerald-600 dark:text-emerald-300",children:a.relevanceOnlyNotice})]},"relevance"));let B=xe(),N=xe();return S.push(I("div",{className:`${r} border-teal-200 border-l-4 dark:border-teal-400/60`,children:[I("div",{className:`${s} text-teal-700 dark:text-teal-300`,children:["\u{1F524} ",a.indexContainmentHeading]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:B,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexContainmentBase}),E("input",{id:B,type:"range",min:"0.0",max:"0.7",step:"0.05",value:e.indexWorkerOptions?.containmentScoreBase??z.indexWorkerOptions?.containmentScoreBase??.7,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,containmentScoreBase:parseFloat(y.target.value)}})),className:"w-full"}),I("span",{className:"text-teal-600 text-xs dark:text-teal-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.containmentScoreBase??z.indexWorkerOptions?.containmentScoreBase??.7]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexContainmentBaseHint})]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:N,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexContainmentCoverage}),E("input",{id:N,type:"range",min:"0.0",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.containmentCoverageWeight??z.indexWorkerOptions?.containmentCoverageWeight??.3,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,containmentCoverageWeight:parseFloat(y.target.value)}})),className:"w-full"}),I("span",{className:"text-teal-600 text-xs dark:text-teal-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.containmentCoverageWeight??z.indexWorkerOptions?.containmentCoverageWeight??.3]}),E("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:[E("span",{children:"\u{1F4CA}"}),E("span",{className:"tracking-wide",children:a.indexSettingsHeading})]}),E("button",{type:"button",onClick:()=>t(y=>({...y,indexWorkerOptions:{threshold:z.indexWorkerOptions?.threshold||.4,ngramOverlapThreshold:z.indexWorkerOptions?.ngramOverlapThreshold||.3,minCandidatesRatio:z.indexWorkerOptions?.minCandidatesRatio||.1,maxCandidatesRatio:z.indexWorkerOptions?.maxCandidatesRatio||.5,jaroWinklerPrefix:z.indexWorkerOptions?.jaroWinklerPrefix||.1,maxResults:z.indexWorkerOptions?.maxResults||100,relevanceFieldWeight:z.indexWorkerOptions?.relevanceFieldWeight||.2,relevancePerfectMatchBonus:z.indexWorkerOptions?.relevancePerfectMatchBonus||.1,containmentScoreBase:z.indexWorkerOptions?.containmentScoreBase||.7,containmentCoverageWeight:z.indexWorkerOptions?.containmentCoverageWeight||.3,strategy:z.indexWorkerOptions?.strategy},ngramSize:z.ngramSize,minNgramOverlap:z.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})]}),E("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:S})]})});Wn.displayName="IndexWorkerSettings";se();import{DEFAULT_FUZZY_SEARCH_OPTIONS as de}from"@aiquants/fuzzy-search";import{memo as Xi,useId as Dt}from"react";import{jsx as Z,jsxs as ne}from"react/jsx-runtime";var Dn=Xi(({searchOptions:e,setSearchOptions:t})=>{let a=q(),r="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",s="text-xs font-semibold",n=e.sortBy==="relevance",o=Dt(),c=Dt(),l=Dt(),d=Dt(),m=Dt(),p=Dt(),i=[];return i.push(ne("div",{className:`${r} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[ne("div",{className:`${s} text-purple-700 dark:text-purple-300`,children:["\u{1F9EE} ",a.levenshteinCandidateHeading]}),ne("div",{className:"space-y-2",children:[Z("label",{htmlFor:o,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.levenshteinThreshold}),Z("input",{id:o,type:"range",min:"0.0",max:n?"1.5":"1.0",step:"0.05",value:e.levenshteinWorkerOptions?.threshold??de.levenshteinWorkerOptions?.threshold,onChange:u=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,threshold:parseFloat(u.target.value)}})),className:"w-full"}),ne("span",{className:"text-purple-600 text-xs dark:text-purple-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.threshold??de.levenshteinWorkerOptions?.threshold]}),Z("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n?a.levenshteinThresholdHintRelevance:a.levenshteinThresholdHint})]}),ne("div",{className:"space-y-2",children:[Z("label",{htmlFor:c,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.levenshteinLengthSimilarity}),Z("input",{id:c,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.lengthSimilarityThreshold??de.levenshteinWorkerOptions?.lengthSimilarityThreshold,onChange:u=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,lengthSimilarityThreshold:parseFloat(u.target.value)}})),className:"w-full"}),ne("span",{className:"text-purple-600 text-xs dark:text-purple-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthSimilarityThreshold??de.levenshteinWorkerOptions?.lengthSimilarityThreshold]}),Z("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinLengthSimilarityHint})]})]},"threshold")),i.push(ne("div",{className:`${r} border-pink-200 border-l-4 dark:border-pink-400/60`,children:[ne("div",{className:`${s} text-pink-700 dark:text-pink-300`,children:["\u{1FA84} ",a.scoreTuningHeading]}),ne("div",{className:"space-y-2",children:[Z("label",{htmlFor:l,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.levenshteinLengthPenalty}),Z("input",{id:l,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.levenshteinWorkerOptions?.lengthDiffPenalty??de.levenshteinWorkerOptions?.lengthDiffPenalty,onChange:u=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,lengthDiffPenalty:parseFloat(u.target.value)}})),className:"w-full"}),ne("span",{className:"text-pink-600 text-xs dark:text-pink-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthDiffPenalty??de.levenshteinWorkerOptions?.lengthDiffPenalty]}),Z("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinLengthPenaltyHint})]})]},"penalty")),i.push(ne("div",{className:`${r} border-violet-200 border-l-4 dark:border-violet-400/60`,children:[ne("div",{className:`${s} text-violet-700 dark:text-violet-300`,children:["\u{1F4E6} ",a.levenshteinResultsHeading]}),Z("label",{htmlFor:d,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.maxResults}),Z("input",{id:d,type:"range",min:"1000",max:"10000",step:"1000",value:e.levenshteinWorkerOptions?.maxResults??de.levenshteinWorkerOptions?.maxResults,onChange:u=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,maxResults:parseInt(u.target.value,10)}})),className:"w-full"}),ne("span",{className:"text-violet-600 text-xs dark:text-violet-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.maxResults??de.levenshteinWorkerOptions?.maxResults]}),Z("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinMaxResultsHint})]},"max-results")),i.push(ne("div",{className:`${r} border-rose-200 border-l-4 ${n?"":"opacity-50"} dark:border-rose-400/60`,children:[ne("div",{className:`${s} text-rose-700 dark:text-rose-300`,children:["\u{1F3AF} ",a.relevanceWeightsHeading]}),ne("div",{className:"space-y-2",children:[Z("label",{htmlFor:m,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.fieldWeight}),Z("input",{id:m,type:"range",min:"0",max:"1",step:"0.05",value:e.levenshteinWorkerOptions?.relevanceFieldWeight??de.levenshteinWorkerOptions?.relevanceFieldWeight??.15,onChange:u=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,relevanceFieldWeight:parseFloat(u.target.value)}})),disabled:!n,className:"w-full disabled:cursor-not-allowed"}),ne("span",{className:"text-rose-600 text-xs dark:text-rose-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.relevanceFieldWeight??de.levenshteinWorkerOptions?.relevanceFieldWeight??.15]}),Z("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinFieldWeightHint})]}),ne("div",{className:"space-y-2",children:[Z("label",{htmlFor:p,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.levenshteinPartialBonus}),Z("input",{id:p,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.partialMatchBonus??de.levenshteinWorkerOptions?.partialMatchBonus,onChange:u=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,partialMatchBonus:parseFloat(u.target.value)}})),disabled:!n,className:"w-full disabled:cursor-not-allowed"}),ne("span",{className:"text-rose-600 text-xs dark:text-rose-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.partialMatchBonus??de.levenshteinWorkerOptions?.partialMatchBonus]}),Z("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinPartialBonusHint})]}),!n&&Z("p",{className:"text-[11px] text-rose-600 dark:text-rose-300",children:a.relevanceOnlyNotice})]},"relevance")),ne("section",{className:"space-y-3",children:[ne("div",{className:"flex items-center justify-between gap-3",children:[ne("div",{className:"flex items-center gap-2 font-semibold text-purple-700 text-xs transition-colors dark:text-purple-300",children:[Z("span",{children:"\u{1F4CF}"}),Z("span",{className:"tracking-wide",children:a.levenshteinSettingsHeading})]}),Z("button",{type:"button",onClick:()=>t(u=>({...u,levenshteinWorkerOptions:{threshold:de.levenshteinWorkerOptions?.threshold||.3,lengthSimilarityThreshold:de.levenshteinWorkerOptions?.lengthSimilarityThreshold||.1,partialMatchBonus:de.levenshteinWorkerOptions?.partialMatchBonus||.1,lengthDiffPenalty:de.levenshteinWorkerOptions?.lengthDiffPenalty||1,maxResults:de.levenshteinWorkerOptions?.maxResults||100,relevanceFieldWeight:de.levenshteinWorkerOptions?.relevanceFieldWeight||.15}})),className:"rounded border border-purple-300 bg-purple-100 px-2 py-1 font-medium text-purple-700 text-xs transition-colors hover:bg-purple-200 dark:border-purple-400/60 dark:bg-purple-900/20 dark:text-purple-200 dark:hover:bg-purple-800/30",title:a.resetToDefaultsTitle,children:a.reset})]}),Z("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:i})]})});Dn.displayName="LevenshteinWorkerSettings";import{jsx as _e,jsxs as He}from"react/jsx-runtime";var el={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},_n=Zi(({searchOptions:e,setSearchOptions:t,enableHighlighting:a,setEnableHighlighting:r,openEmailsWithGmail:s,setOpenEmailsWithGmail:n,activeTab:o,onTabChange:c})=>{let l=q(),{setScrollableRef:d,onPointerDown:m,onPointerMove:p,onPointerUp:i,onPointerLeave:u,onPointerCancel:h,onClickCapture:k}=nt();return He("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:[He("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:[He("h3",{className:"font-semibold text-gray-700 text-xs transition-colors dark:text-slate-100",children:["\u2699\uFE0F ",l.searchSettings]}),_e("div",{className:"flex flex-wrap gap-1.5",children:He("button",{type:"button",onClick:()=>t(C=>({...Hn,autoSearchOnIndexRebuild:!1,debounceMs:0,workerUrls:C.workerUrls,indexWorkerOptions:{...Hn.indexWorkerOptions},levenshteinWorkerOptions:{...Hn.levenshteinWorkerOptions}})),className:"rounded bg-red-500 px-1.5 py-0.5 text-[10px] text-white transition-colors hover:bg-red-600 dark:hover:bg-red-700",title:l.settingsResetAllTitle,children:["\u{1F504} ",l.settingsResetAll]})})]}),_e("div",{className:"mb-0 shrink-0",children:He("div",{ref:d,role:"tablist","aria-label":l.settingsTabsLabel,className:"flex space-x-1 overflow-x-auto text-nowrap rounded-md bg-gray-100 p-0.5 transition-colors dark:bg-slate-800/80",style:el,onPointerDown:m,onPointerMove:p,onPointerUp:i,onPointerLeave:u,onPointerCancel:h,onClickCapture:k,children:[He("button",{type:"button",role:"tab","aria-selected":o==="basic",onClick:()=>c("basic"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${o==="basic"?"bg-blue-500 text-white dark:bg-blue-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F527} ",l.settingsBasicTab]}),He("button",{type:"button",role:"tab","aria-selected":o==="advanced",onClick:()=>c("advanced"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${o==="advanced"?"bg-orange-500 text-white dark:bg-orange-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u26A1 ",l.settingsAdvancedTab]}),He("button",{type:"button",role:"tab","aria-selected":o==="index",onClick:()=>c("index"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${o==="index"?"bg-green-500 text-white dark:bg-green-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CA} ",l.indexWorkerName]}),He("button",{type:"button",role:"tab","aria-selected":o==="levenshtein",onClick:()=>c("levenshtein"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${o==="levenshtein"?"bg-purple-500 text-white dark:bg-purple-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CF} ",l.levenshteinWorkerName]})]})}),He("div",{className:"flex flex-col gap-1",children:[_e("div",{className:`${o==="basic"?"block":"hidden"}`,children:_e(rn,{searchOptions:e,setSearchOptions:t,enableHighlighting:a,setEnableHighlighting:r,openEmailsWithGmail:s,setOpenEmailsWithGmail:n})}),_e("div",{className:`${o==="advanced"?"block":"hidden"}`,children:_e(nn,{searchOptions:e,setSearchOptions:t})}),_e("div",{className:`${o==="index"?"block":"hidden"}`,children:_e(Wn,{searchOptions:e,setSearchOptions:t})}),_e("div",{className:`${o==="levenshtein"?"block":"hidden"}`,children:_e(Dn,{searchOptions:e,setSearchOptions:t})})]})]})});_n.displayName="SearchOptionsPanel";import{memo as nl}from"react";mt();se();import{memo as tl}from"react";import{jsxs as An}from"react/jsx-runtime";var L=tl(({label:e,value:t,unit:a,color:r="text-gray-600 dark:text-slate-300"})=>An("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:[An("span",{className:"wrap-break-word overflow-hidden text-left",children:[e,":"]}),An("span",{className:`font-medium ${r} min-w-0 overflow-hidden break-all transition-colors sm:ml-2`,children:[t,a]})]}));L.displayName="StatItem";ht();mt();se();import{memo as al}from"react";import{jsx as w,jsxs as $}from"react/jsx-runtime";var Ht=al(({kind:e,icon:t,stats:a,color:r})=>{let{locale:s,labels:n}=fe(),o=M=>j(s,M);if(!a)return w("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||{},l=a.workerSpecific||{},d=a.analysis||{},m=c.totalSearches??0,p=c.totalProcessingTime??0,i=c.averageSearchTime??0,u=c.lastSearchTime??0,h=c.errorCount??0,k=c.timestamp,C=d.fieldPerformance||{},S=d.performanceInsights||{},B=d.recentHistory||[],N=l.specificMetrics||{},y=l.operationCount??0,g=l.operationDistribution||{},O=e==="index",V=e==="levenshtein",b=O?n.indexWorkerName:n.levenshteinWorkerName,f=N,v=N,W="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",X=M=>{if(M)return we(M)},P=[];if(P.push($("div",{className:`${W} border-blue-200 border-l-4 dark:border-blue-500/60`,children:[$("div",{className:`${D} ${r}`,children:["\u{1F4CA} ",n.statsBasicHeading]}),w(L,{label:n.statTotalSearches,value:o(m),color:r}),w(L,{label:n.statAverageSearchTime,value:i.toFixed(2),unit:"ms",color:r}),w(L,{label:n.statTotalProcessingTime,value:p.toFixed(2),unit:"ms",color:r}),w(L,{label:n.statLastSearchTime,value:u.toFixed(2),unit:"ms",color:r}),w(L,{label:n.statErrorCount,value:h,color:h>0?"text-red-600 dark:text-red-400":r}),X(k)&&w(L,{label:n.statUpdatedAt,value:X(k),color:"text-gray-500 dark:text-slate-400"})]},"basic")),y>0||Object.keys(g).length>0){let M=Object.entries(g).sort(([,H],[,U])=>(Number(U)||0)-(Number(H)||0)).slice(0,6);P.push($("div",{className:`${W} 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]}),w(L,{label:n.statTotalOperations,value:o(y),color:"text-amber-700 dark:text-amber-300"}),M.length>0&&w("div",{className:"mt-1 space-y-1",children:M.map(([H,U])=>w(L,{label:H,value:o(Number(U)),unit:n.timesUnit(o(Number(U))),color:"text-amber-700 dark:text-amber-300"},H))})]},"operations"))}if(O&&(P.push($("div",{className:`${W} 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]}),w(L,{label:n.statIndexBuilds,value:o(f.totalIndexBuilds??0),color:"text-green-700 dark:text-green-300"}),w(L,{label:n.statDataSize,value:o(f.currentDataSize??0),unit:n.itemsUnit(o(f.currentDataSize??0)),color:"text-green-700 dark:text-green-300"}),w(L,{label:n.statLastBuildTime,value:(f.lastIndexTime??0).toFixed(2),unit:"ms",color:"text-green-700 dark:text-green-300"})]},"index-core")),f.cacheSize&&P.push($("div",{className:`${W} 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]}),w(L,{label:n.statCacheNgram,value:o(f.cacheSize.ngram??0),color:"text-emerald-700 dark:text-emerald-300"}),w(L,{label:n.statCacheWord,value:o(f.cacheSize.word??0),color:"text-emerald-700 dark:text-emerald-300"}),w(L,{label:n.statCachePhonetic,value:o(f.cacheSize.phonetic??0),color:"text-emerald-700 dark:text-emerald-300"})]},"index-cache")),f.indexMetadata)){let M=Object.entries(f.indexMetadata).slice(0,6);M.length>0&&P.push($("div",{className:`${W} 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]}),M.map(([H,U])=>{let ee;if(typeof U=="number"){let pe=H.toLowerCase();pe.includes("time")&&!pe.includes("timestamp")?ee=`${U.toFixed(2)}ms`:pe.includes("timestamp")||pe.includes("at")?ee=X(U)??U.toString():ee=o(U)}else ee=String(U);return w(L,{label:H,value:ee,color:"text-teal-700 dark:text-teal-300"},H)})]},"index-meta"))}if(V){if(P.push($("div",{className:`${W} 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]}),w(L,{label:n.statTotalCalculations,value:o(v.totalCalculations??0),color:"text-purple-700 dark:text-purple-300"}),w(L,{label:n.statDistanceCalculations,value:o(v.totalDistanceCalculations??0),color:"text-purple-700 dark:text-purple-300"}),w(L,{label:n.statAverageDistance,value:typeof v.averageDistance=="number"?v.averageDistance.toFixed(2):"0.00",color:"text-purple-700 dark:text-purple-300"}),w(L,{label:n.statMinDistance,value:v.minDistance??n.notAvailable,color:"text-purple-700 dark:text-purple-300"}),w(L,{label:n.statMaxDistance,value:v.maxDistance??0,color:"text-purple-700 dark:text-purple-300"})]},"lev-basic")),P.push($("div",{className:`${W} 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]}),w(L,{label:n.statPartialMatches,value:o(v.partialMatches??0),color:"text-fuchsia-700 dark:text-fuchsia-300"}),w(L,{label:n.statPerfectMatches,value:o(v.perfectMatches??0),color:"text-fuchsia-700 dark:text-fuchsia-300"}),w(L,{label:n.statEarlyTerminations,value:o(v.earlyTerminations??0),color:"text-fuchsia-700 dark:text-fuchsia-300"})]},"lev-match")),v.similarityThresholds&&P.push($("div",{className:`${W} 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]}),w(L,{label:n.statAbove80,value:o(v.similarityThresholds.above80??0),color:"text-emerald-700 dark:text-emerald-300"}),w(L,{label:n.statAbove60,value:o(v.similarityThresholds.above60??0),color:"text-lime-700 dark:text-lime-300"}),w(L,{label:n.statAbove40,value:o(v.similarityThresholds.above40??0),color:"text-orange-600 dark:text-orange-300"}),w(L,{label:n.statBelow40,value:o(v.similarityThresholds.below40??0),color:"text-red-600 dark:text-red-400"})]},"lev-similarity")),v.distanceDistribution){let M=Object.entries(v.distanceDistribution).sort(([,H],[,U])=>Number(U)-Number(H)).slice(0,6);M.length>0&&P.push($("div",{className:`${W} 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]}),M.map(([H,U])=>w(L,{label:n.statDistance(H),value:o(Number(U)),unit:n.timesUnit(o(Number(U))),color:"text-indigo-700 dark:text-indigo-300"},H))]},"lev-distance"))}if(v.queryLengthStats){let M=Object.entries(v.queryLengthStats).sort(([,H],[,U])=>(U.count??0)-(H.count??0)).slice(0,6);M.length>0&&P.push($("div",{className:`${W} 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]}),M.map(([H,U])=>{let ee=Number(U.count??0),pe=Number(U.averageScore??0);return w(L,{label:n.statQueryLength(H),value:n.statQueryLengthValue({count:ee,averagePercent:(pe*100).toFixed(1)}),color:"text-violet-700 dark:text-violet-300"},H)})]},"lev-query-length"))}}if(Object.keys(C).length>0){let M=Object.entries(C).sort(([,H],[,U])=>(U.averageScore??0)-(H.averageScore??0)).slice(0,6);P.push($("div",{className:`${W} 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]}),M.map(([H,U])=>{let ee=U;return $("div",{className:"space-y-1 rounded bg-purple-50/60 p-2 transition-colors dark:bg-slate-900/50",children:[w("div",{className:"font-semibold text-purple-700 text-xs transition-colors dark:text-purple-300",children:H}),w(L,{label:n.statAverageScore,value:`${((ee.averageScore??0)*100).toFixed(1)}%`,color:"text-purple-700 dark:text-purple-300"}),w(L,{label:n.statMatchCount,value:o(ee.matchCount??0),unit:n.itemsUnit(o(ee.matchCount??0)),color:"text-purple-700 dark:text-purple-300"}),w(L,{label:n.statBestWorstScore,value:`${((ee.bestScore??0)*100).toFixed(1)}% / ${((ee.worstScore??0)*100).toFixed(1)}%`,color:"text-purple-700 dark:text-purple-300"})]},H)})]},"field-performance"))}if(S.bestPerformingField||S.totalHistoryEntries||S.similarityDistribution){let M=(S.recentAverageResultCount??0).toFixed(1);P.push($("div",{className:`${W} 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]}),S.bestPerformingField&&w(L,{label:n.statBestField,value:S.bestPerformingField,color:"text-blue-700 dark:text-blue-300"}),w(L,{label:n.statRecentAverageTime,value:(S.recentAverageProcessingTime??0).toFixed(2),unit:"ms",color:"text-blue-700 dark:text-blue-300"}),w(L,{label:n.statRecentAverageResults,value:M,unit:n.itemsUnit(M),color:"text-blue-700 dark:text-blue-300"}),w(L,{label:n.statThroughput,value:(S.throughputPerSecond??0).toFixed(2),unit:n.throughputUnit,color:"text-blue-700 dark:text-blue-300"}),w(L,{label:n.statCommonQueryLength,value:o(S.mostCommonQueryLength??0),unit:n.charactersUnit(o(S.mostCommonQueryLength??0)),color:"text-blue-700 dark:text-blue-300"}),w(L,{label:n.statHistoryEntries,value:o(S.totalHistoryEntries??0),color:"text-blue-700 dark:text-blue-300"}),S.similarityDistribution&&$("div",{className:"mt-1 grid grid-cols-2 gap-1",children:[w(L,{label:n.statHighSimilarity,value:o(S.similarityDistribution.highSimilarity??0),color:"text-emerald-700 dark:text-emerald-300"}),w(L,{label:n.statMediumSimilarity,value:o(S.similarityDistribution.mediumSimilarity??0),color:"text-lime-700 dark:text-lime-300"}),w(L,{label:n.statLowSimilarity,value:o(S.similarityDistribution.lowSimilarity??0),color:"text-orange-600 dark:text-orange-300"}),w(L,{label:n.statVeryLowSimilarity,value:o(S.similarityDistribution.veryLowSimilarity??0),color:"text-red-600 dark:text-red-400"})]})]},"performance-insights"))}return B.length>0&&P.push($("div",{className:`${W} 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]}),B.slice(-3).reverse().map((M,H)=>$("div",{className:"rounded bg-sky-50/70 p-2 transition-colors dark:bg-slate-900/50",children:[w("div",{className:"font-medium text-sky-700 transition-colors dark:text-sky-300",children:M.operationType}),w("div",{className:"text-sky-600 text-xs transition-colors dark:text-sky-200",children:n.statsHistoryEntry({processingTimeMs:M.processingTime.toFixed(2),resultCount:M.resultCount??0})}),X(M.timestamp)&&w("div",{className:"text-[10px] text-sky-500 transition-colors dark:text-sky-200",children:X(M.timestamp)})]},`${M.operationType}-${M.timestamp??H}`))]},"recent-history")),$("section",{className:"space-y-2",children:[$("div",{className:`flex items-center gap-2 font-semibold text-xs ${r}`,children:[w("span",{children:t}),w("span",{className:"tracking-wide",children:b})]}),w("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:P})]})});Ht.displayName="WorkerStatsSection";import{jsx as Ce,jsxs as ve}from"react/jsx-runtime";var rl={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},In=nl(({performanceMetrics:e,searchTerm:t,totalDataCount:a,resultsCount:r,resetStats:s,rebuildIndex:n,isIndexBuilding:o,activeTab:c,onTabChange:l})=>{let{locale:d,labels:m}=fe(),p=t.trim(),i=p?r:a,{setScrollableRef:u,onPointerDown:h,onPointerMove:k,onPointerUp:C,onPointerLeave:S,onPointerCancel:B,onClickCapture:N}=nt(),y=c!=="index"||o,g=o?m.statsRebuildingTitle:c!=="index"?m.statsRebuildIndexTabOnlyTitle:m.statsRebuildTitle,O=y?"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=o?`\u23F3 ${m.statsRebuilding}`:`\u{1F3D7}\uFE0F ${m.statsRebuild}`;return ve("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:[ve("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:[ve("h3",{className:"font-semibold text-gray-700 text-xs transition-colors dark:text-slate-100",children:["\u{1F4CA} ",m.searchStatistics]}),ve("div",{className:"flex flex-wrap gap-1.5",children:[Ce("button",{type:"button",onClick:()=>n(),disabled:y,className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${O}`,title:g,children:V}),ve("button",{type:"button",onClick:s,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]})]})]}),Ce("div",{className:"mb-0 shrink-0",children:ve("div",{ref:u,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:rl,onPointerDown:h,onPointerMove:k,onPointerUp:C,onPointerLeave:S,onPointerCancel:B,onClickCapture:N,children:[ve("button",{type:"button",onClick:()=>l("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]}),ve("button",{type:"button",onClick:()=>l("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]}),ve("button",{type:"button",onClick:()=>l("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]})]})}),ve("div",{className:"flex flex-col gap-1 pb-0.5",children:[ve("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:[Ce(L,{label:m.statTotalSearches,value:j(d,e.totalSearches)}),Ce(L,{label:m.statAverageSearchTime,value:e.averageSearchTime.toFixed(1),unit:"ms"}),Ce(L,{label:m.statDataCount,value:j(d,e.itemCount)}),Ce(L,{label:p?m.statResultCount:m.statDisplayedCount,value:j(d,i)})]}),Ce("div",{className:`${c==="index"?"space-y-3":"hidden"} pr-1 text-gray-600 text-xs transition-colors dark:text-slate-300`,children:Ce(Ht,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:"text-green-600 dark:text-green-300"})}),Ce("div",{className:`${c==="levenshtein"?"space-y-3":"hidden"} pr-1 text-gray-600 text-xs transition-colors dark:text-slate-300`,children:Ce(Ht,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:"text-purple-600 dark:text-purple-300"})}),ve("div",{className:"hidden",children:[Ce(Ht,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:"text-green-600 dark:text-green-300"}),Ce(Ht,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:"text-purple-600 dark:text-purple-300"})]})]})]})});In.displayName="StatisticsPanel";import{Fragment as no,jsx as Y,jsxs as ge}from"react/jsx-runtime";var cl=/[\u200B\uFEFF]/g,zn=typeof window<"u",oo=zn&&typeof document<"u",Ua=(e,t=[],a=!1)=>{let r=ro(e);r.current=e,je(()=>{if(!(!zn||a&&!oo))return r.current()},[a,...t])},Zr=(e,t,a)=>{let[r,s]=Ae(()=>{let n=eo(o=>o.getItem(e));return n&&t.includes(n)?n:a});return Ua(()=>{eo(n=>{n.setItem(e,r)})},[e,r]),[r,s]},eo=e=>{if(!zn)return null;try{return e(window.sessionStorage)}catch{return null}},to=(e,t)=>{let[a,r]=Ae(e);return je(()=>{let s=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(s)}},[e,t]),a},pl="contact-map.settings-tab",ul="contact-map.statistics-tab",ml=["basic","advanced","index","levenshtein"],gl=["overview","index","levenshtein"],ao=["full_name","company_name","department","title","email","company_phone_number","mobile_phone_number"],hl={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},so=({streamState:e,...t}={})=>e===void 0?Y(fl,{...t}):Y(io,{...t,streamState:e}),fl=e=>{let{context:t}=Ea();return Y(io,{...e,streamState:t})},yl={setting:"ContactMapSearchPage workerUrls",keys:["indexWorker","levenshteinWorker"],hints:{treeWorker:"set treeWorker on ContactMapConfigProvider or ContactMapAppView"}},io=e=>{let{streamState:t,onFooterVisibilityChange:a,children:r}=e,s=me(e,"workerUrls"),n=Ve(),{locale:o,labels:c}=fe(),{contactMapRecords:l,contactMapRecordMap:d,isStreamingComplete:m,isStreamingFailed:p}=t,i=ll(),[u]=dl(),h=ro(null),[k,C]=Ae(!0),[S,B]=Ae(n.openEmailsWithGmail??!1),[N,y]=Ae(u.get("q")||""),g=to(N,300);je(()=>{let x=u.get("q")||"";y(T=>T!==x?x:T)},[u]),je(()=>{if(typeof window>"u")return;let x=new URL(window.location.href);(x.searchParams.get("q")||"")!==g&&(g?x.searchParams.set("q",g):x.searchParams.delete("q"),window.history.replaceState(window.history.state,"",x.toString()))},[g]);let[O,V]=il(),[b,f]=Ae("search"),[v,W]=Zr(pl,ml,"basic"),[D,X]=Zr(ul,gl,"overview"),{setScrollableRef:P,onPointerDown:M,onPointerMove:H,onPointerUp:U,onPointerLeave:ee,onPointerCancel:pe,onClickCapture:re}=nt(),te=ra(()=>{if(!oo)return;let x=h.current;!x||document.activeElement===x||window.requestAnimationFrame(()=>{try{x.focus({preventScroll:!0})}catch{}})},[]),st=ra(x=>{let T=x;f(T),T==="search"&&te()},[te]),{indexWorker:it,levenshteinWorker:At}=Ot(n.workerUrls,s,yl),Ie=kt(()=>{let{indexWorkerOptions:x={},levenshteinWorkerOptions:T={},...F}=Fn;return{...F,autoSearchOnIndexRebuild:!1,debounceMs:0,workerUrls:{indexWorker:it,levenshteinWorker:At},indexWorkerOptions:{...x},levenshteinWorkerOptions:{...T}}},[it,At]),[lt,he]=Ae(Ie),qe=(lt.multiTermOperator??Fn.multiTermOperator)==="and",Ft=qe?c.operatorAndTitle:c.operatorOrTitle,$a=to(l,m?0:800),{searchTerm:oe,setSearchTerm:zt,filteredItems:Ge,isSearching:Fe,isIndexBuilding:ke,clearSearch:St,resetStats:oa,performanceMetrics:Le,rebuildIndex:Bt,error:dt}=ol($a,ao,lt),Qe=oe.trim().length>0,[Ye,ze]=Ae(""),[Je,sa]=Ae(()=>oe),Ut=kt(()=>Ca(N),[N]),Se=kt(()=>Ca(g),[g]);je(()=>{g===Ye&&Se===oe||V(()=>{ze(g),zt(Se)})},[g,Ye,Se,oe,zt]);let Va=ra(x=>{let F=x.target.value.replace(cl,"");y(F)},[]),Ka=ra(()=>{y(""),ze(""),St(),te()},[St,te]),Tt=ra(()=>{he(x=>{let F=(x.multiTermOperator??Fn.multiTermOperator??"and")==="and"?"or":"and";return{...x,multiTermOperator:F}}),te()},[te]);Ua(()=>{if(!(b==="search"&&i.state==="idle"&&!O))return;let T=document.activeElement;if(!!!(T?.matches('[role="tab"]')||T?.closest('[role="tablist"]')?.getAttribute("role")==="tablist")&&T&&T!==document.body&&T!==h.current)return;let le=window.requestAnimationFrame(()=>{te()});return()=>{window.cancelAnimationFrame(le)}},[b,i.state,O,te],!0),Ua(()=>{if(b!=="search")return;let x=[[document,"visibilitychange",()=>{document.visibilityState==="visible"&&te()}],[window,"pageshow",()=>{te()}]];for(let[T,F,le]of x)T.addEventListener(F,le);return()=>{for(let[T,F,le]of x)T.removeEventListener(F,le)}},[b,te],!0),je(()=>(a&&a(b==="search"?"mobile-hidden":"visible"),()=>{a&&a("visible")}),[b,a]),Ua(()=>{let x=document.body,T=x.style.overflow;return b==="search"&&(x.style.overflow="hidden"),()=>{x.style.overflow=T}},[b],!0),je(()=>{Le&&We.info("\u{1F4CA} [STATE] \u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u6307\u6A19\u304C\u66F4\u65B0\u3055\u308C\u307E\u3057\u305F:",{totalSearches:Le.totalSearches,averageSearchTime:Le.averageSearchTime,itemCount:Le.itemCount,resultsCount:Le.resultsCount,workersAvailable:!!Le.workerStats})},[Le]);let{isAwaitingDebounce:$t,isAwaitingSearchTermSync:wt,isSearchInProgress:Xe}=kt(()=>{let x=Ut!==Se,T=Se!==oe,F=oe.trim().length>0||Ut.trim().length>0;return{isAwaitingDebounce:x,isAwaitingSearchTermSync:T,isSearchInProgress:O||Fe||F&&ke||x||T||Je!==oe}},[Ut,Se,oe,O,Fe,ke,Je]),[ct,ja]=Ae(oe);je(()=>{ct!==oe&&ja(oe)},[oe,ct]),je(()=>{$t||wt||O||Fe||ke||ct===oe&&Je!==oe&&sa(oe)},[oe,Je,$t,wt,O,Fe,ke,ct]);let ia=kt(()=>ir(Ye,ao),[Ye]),la=kt(()=>ia(Ge),[ia,Ge]),da=kt(()=>({contactMapRecords:l,contactMapRecordMap:d,filteredItems:la,searchQuery:Ye,searchTerm:oe,isSearching:Fe,isIndexBuilding:ke,isPending:O,hasSearchTerm:Qe,enableHighlighting:k,openEmailsWithGmail:S,isSearchInProgress:Xe,isSearchTabActive:b==="search",errorMessage:dt??null,isStreamingComplete:m,isStreamingFailed:p}),[l,d,la,Ye,oe,Fe,ke,O,Qe,k,S,Xe,b,dt,m,p]),ca=Qe?Ge.length:l.length,pa=j(o,l.length),ua=j(o,Ge.length);return Y("div",{className:`scrollbar-hidden bg-slate-50 text-slate-900 dark:bg-slate-900 dark:text-slate-100${b==="search"?" h-full min-h-0":""}`,children:ge(wa,{value:b,onValueChange:st,className:`flex flex-col${b==="search"?" h-full min-h-0":""}`,children:[ge(Yt,{ref:P,style:hl,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:M,onPointerMove:H,onPointerUp:U,onPointerLeave:ee,onPointerCancel:pe,onClickCapture:re,children:[ge(yt,{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} ",c.searchTab]}),ge(yt,{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 ",c.searchSettings]}),ge(yt,{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} ",c.searchStatistics]})]}),Y(bt,{value:"search",className:"mt-0 flex h-full min-h-0 flex-col overflow-hidden",children:ge("div",{className:"flex h-full flex-col",children:[Y("div",{className:"rounded-md border border-gray-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/80 dark:shadow-none",children:ge("div",{className:"flex flex-col",children:[Y("div",{className:"relative",children:ge("div",{className:"flex items-center gap-1 p-1",children:[ge("button",{type:"button",onClick:Tt,"aria-pressed":qe,title:Ft,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 ${qe?"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:[Y("span",{className:"text-[10px] sm:text-xs",children:qe?c.operatorAnd:c.operatorOr}),Y("span",{className:"hidden text-[10px] sm:inline",children:qe?c.operatorAndHint:c.operatorOrHint})]}),Y("input",{ref:h,type:"text",value:N,onChange:Va,placeholder:c.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"}),N&&Y("button",{type:"button",onClick:Ka,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:Xe?c.searchBusyTitle:c.clearSearch,disabled:Xe,children:Xe?ge(no,{children:[Y(sl,{"aria-hidden":"true",className:"h-3 w-3 animate-spin sm:h-3.5 sm:w-3.5"}),Y("span",{className:"hidden sm:inline",children:c.searching})]}):"\u2715"})]})}),ge("p",{className:"px-1.5 py-0.5 text-[10px] text-slate-700 leading-snug transition-colors sm:text-[11px] dark:text-slate-200",children:[c.registeredCountLabel," ",Y("span",{className:"font-semibold text-[11px] text-slate-900 sm:text-xs dark:text-white",children:pa})," ",c.recordUnit(pa),ke?ge("span",{className:"ml-1.5 inline-flex items-center rounded bg-blue-50 px-1.5 py-0.2 text-[10px] text-blue-700 sm:text-[11px] dark:bg-blue-900/40 dark:text-blue-200",children:["\u23F3 ",c.rebuildingIndex]}):null,dt?ge("span",{className:"ml-1.5 inline-flex items-center rounded bg-rose-50 px-1.5 py-0.2 text-[10px] text-rose-700 sm:text-[11px] dark:bg-rose-900/40 dark:text-rose-200",children:["\u26A0\uFE0F ",c.errorLabel,Y("span",{className:"ml-1 break-all font-semibold",children:dt})]}):null,Qe&&ge("span",{className:"ml-1.5 text-[10px] text-blue-600 sm:text-[11px] dark:text-sky-400",children:["| ",c.resultCountLabel,Xe?Y("span",{className:"ml-1 font-semibold text-[10px] sm:text-[11px]",children:c.searching}):ge(no,{children:[Y("span",{className:"ml-1 font-semibold text-[11px] text-slate-900 sm:text-xs dark:text-white",children:ua}),Y("span",{className:"ml-0.5 text-[10px] sm:text-[11px]",children:c.resultUnit(ua)})]})]})]}),Y("div",{className:"h-2.5 px-2 pb-1.5",children:ke?Y(Sr,{className:"h-1 bg-blue-200 dark:bg-blue-800",indicatorClassName:"bg-blue-500 dark:bg-blue-400"}):null})]})}),r?r(da):Y(Xr,{context:da})]})}),Y(bt,{value:"settings",className:"mt-0",children:Y(_n,{searchOptions:lt,setSearchOptions:he,enableHighlighting:k,setEnableHighlighting:C,openEmailsWithGmail:S,setOpenEmailsWithGmail:B,activeTab:v,onTabChange:W})}),Y(bt,{value:"statistics",className:"mt-0",children:Y(In,{performanceMetrics:Le,searchTerm:oe,totalDataCount:l.length,resultsCount:ca,resetStats:oa,rebuildIndex:Bt,isIndexBuilding:ke,activeTab:D,onTabChange:X})})]})})};import{jsx as _t,jsxs as co}from"react/jsx-runtime";var bl=({renderHeader:e,title:t,onFooterVisibilityChange:a})=>{let r=q(),s=t===void 0?r.appTitle:t,{context:n,retryNow:o}=Ea(),c=_t(vn,{recordCount:n.contactMapRecords.length,companyCount:n.companyCount,phase:n.streamPhase,loadedCount:n.loadedCount,totalCount:n.totalCount,errorMessage:n.errorMessage,onRetry:o});return co("div",{"data-testid":"contact-map-app-view",className:"flex h-full w-full flex-col",children:[e?e({title:s,annotation:c}):co("div",{"data-testid":"contact-map-default-header",className:"mb-2 flex items-center justify-between",children:[_t("h1",{className:"font-bold text-xl",children:s}),c]}),_t("div",{className:"min-h-0 flex-1",children:_t(so,{streamState:n,onFooterVisibilityChange:a})})]})},qu=e=>{let t=Ve(),a=me(e,"streamEndpoint"),r=me(e,"workerUrls"),s=me(e,"locale"),n=me(e,"labels"),o=lo(()=>({...t,streamEndpoint:a===void 0?t.streamEndpoint:a,workerUrls:Ot(t.workerUrls,r,{setting:"ContactMapAppView workerUrls"}),locale:s===void 0?t.locale:s,labels:n===void 0?t.labels:n}),[t,a,r,s,n]),c=s!==void 0,l=n!==void 0,d=lo(()=>({locale:c?"ContactMapAppView locale":"locale",labels:l?"ContactMapAppView labels":"labels"}),[c,l]);return _t(kn,{config:o,chromeSurface:d,children:_t(bl,{...e})})};mt();se();function Yu(){return!1}export{nn as AdvancedSearchSettings,rn as BasicSearchSettings,Be as CONTACT_MAP_LABEL_CATALOGS,Vt as CONTACT_MAP_LABEL_KEYS,lr as ContactDetailGrid,tt as ContactDetailPanel,xa as ContactDetailPopup,va as ContactDetailRowLayout,vn as ContactMapAnnotation,qu as ContactMapAppView,Ts as ContactMapConfigProvider,Ar as ContactMapSearchListView,so as ContactMapSearchPage,Xr as ContactMapSearchTabGroup,Jr as ContactMapSearchTreeView,Ma as ContactMapStreamClient,ce as HighlightedText,Wn as IndexWorkerSettings,zc as LIST_COLLAPSE_THRESHOLD,ii as LIST_DETAIL_PANEL_MIN_WIDTH,Bc as LIST_EXPAND_THRESHOLD,si as LIST_PANEL_MIN_WIDTH,li as LIST_RESIZE_HANDLE_THICKNESS,Dn as LevenshteinWorkerSettings,Sr as Progress,_n as SearchOptionsPanel,L as StatItem,In as StatisticsPanel,Ha as SwipeOverlay,kp as TREE_COLLAPSE_THRESHOLD,_i as TREE_DETAIL_PANEL_MIN_WIDTH,Sp as TREE_EXPAND_THRESHOLD,Hi as TREE_PANEL_MIN_WIDTH,Ai as TREE_RESIZE_HANDLE_THICKNESS,wa as Tabs,bt as TabsContent,Yt as TabsList,yt as TabsTrigger,Fa as TreeWorkerSession,Ht as WorkerStatsSection,Ra as assertContactMapStreamEndpoint,fr as assertContactMapTreeWorkerUrl,Gd as assertContactMapWorkerUrls,Bi as composeTreeVirtualScrollOptions,Yu as contactMapShouldRevalidate,_s as countContactMapCompanies,Ms as deserializeStreamRecord,Es as getContactMapStreamClient,Ni as getTreeWorkerSession,Ot as layerContactMapWorkerUrls,dc as resetContactMapStreamClientForTesting,Zc as resetTreeWorkerSessionForTesting,Xa as resolveContactMapLabels,Ir as useAnimatedNumber,Ve as useContactMapConfig,q as useContactMapLabels,Hs as useContactMapStream,wn as useContactPanelSizing,Tr as useDynamicViewportHeight,nt as useHorizontalDragScroll,Wa as useLongPressPopup,fi as useReportPopupVisibility,Da as useResponsiveTwoColumnLayout,hi as useRowPopupRegistry,Ea as useStreamedContactMapContext,$r as useTreeWorker};