@aiquants/contact-map 0.12.0 → 0.14.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/README.md +129 -17
- package/dist/client.d.mts +18 -18
- package/dist/client.d.ts +18 -18
- package/dist/client.js +2 -2
- package/dist/client.mjs +2 -2
- package/dist/styles/contact-map.standalone.css +1 -1
- package/package.json +13 -10
package/dist/client.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var ko=Object.defineProperty;var we=(e,t)=>()=>(e&&(t=e(e=0)),t);var So=(e,t)=>{for(var n in t)ko(e,n,{get:t[n],enumerable:!0})};var Re,kn,Ja,Rt,Lt,Yt,qe,Ne,Sn,ra,oa,Ie,q,ft=we(()=>{"use strict";Re=e=>{if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null},kn=e=>!e||typeof e!="object"?null:"item"in e?e.item??null:"person_id"in e?e:null,Ja=(e,t)=>{if(!e)return{value:null,fieldKey:null};for(let n of t){let r=Re(e[n]);if(r)return{value:r,fieldKey:n}}return{value:null,fieldKey:null}},Rt=e=>Ja(e,["custom_email","email"]),Lt=e=>Ja(e,["custom_mobile_phone_number","mobile_phone_number","company_phone_number"]),Yt=e=>{let t=Re(e);if(!t)return null;let n=t.replace(/[^0-9+#*]/g,"");return n.length===0?null:`tel:${n}`},qe=(e,t)=>{let n=Re(e);return n?t?`https://mail.google.com/mail/?view=cm&fs=1&to=${encodeURIComponent(n)}`:`mailto:${encodeURIComponent(n)}`:null},Ne=(e,t)=>String(e).padStart(t,"0"),Sn=e=>`${Ne(e.getUTCFullYear(),4)}-${Ne(e.getUTCMonth()+1,2)}-${Ne(e.getUTCDate(),2)}`,ra=e=>`${Sn(e)} ${Ne(e.getUTCHours(),2)}:${Ne(e.getUTCMinutes(),2)}:${Ne(e.getUTCSeconds(),2)}`,oa=e=>`${Ne(e.getFullYear(),4)}-${Ne(e.getMonth()+1,2)}-${Ne(e.getDate(),2)} ${Ne(e.getHours(),2)}:${Ne(e.getMinutes(),2)}:${Ne(e.getSeconds(),2)}`,Ie=(e,t)=>{if(e==null||e==="")return"-";let n=typeof e=="string"?new Date(e):e;return Number.isNaN(n.getTime())?typeof e=="string"?e:"-":t(n)},q=e=>e==null?"-":typeof e=="string"?Re(e)??"-":typeof e=="number"?Number.isFinite(e)?String(e):"-":String(e)});var oe,Za,Et=we(()=>{"use strict";oe=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":Za(e);case"function":return Za(e);case"number":return Object.is(e,-0)?"-0":String(e);default:return String(e)}},Za=e=>{try{return Object.prototype.toString.call(e)}catch{return"[object ?]"}}});var Ot,fe,Dt=we(()=>{"use strict";Ot=e=>{if(typeof e!="object"||e===null)return!1;try{let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}catch{return!1}},fe=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0});var To,Tn,sa=we(()=>{"use strict";To=(e,t)=>{let n=Array.from({length:t.length+1},(r,s)=>s);for(let r=1;r<=e.length;r+=1){let s=[r];for(let a=1;a<=t.length;a+=1){let o=n[a-1]+(e[r-1]===t[a-1]?0:1);s.push(Math.min(n[a]+1,s[a-1]+1,o))}n=s}return n[t.length]},Tn=(e,t)=>{let n=e.toLowerCase();if(n.length>=3){let s=t.find(a=>a.toLowerCase().startsWith(n));if(s!==void 0)return s}let r;for(let s of t){let a=To(n,s.toLowerCase());a<=Math.max(1,Math.floor(s.length/4))&&(r===void 0||a<r.distance)&&(r={key:s,distance:a})}return r?.key}});import{DIRECTORY_TREE_LABEL_CATALOGS as er,DIRECTORY_TREE_LABEL_KEYS as ia,resolveDirectoryTreeLabels as wo}from"@aiquants/directory-tree";import{resolveVirtualScrollLocale as No,VIRTUAL_SCROLL_LABEL_KEYS as Mo}from"@aiquants/virtualscroll";var Po,j,yt,wn,nr,Xt,Ge,Ro,tr,ar,Lo,la,Eo,Oo,Do,da,ca,ua,bt=we(()=>{"use strict";ft();Et();Dt();sa();Po=Object.freeze({en:"en-US",ja:"ja-JP"}),j=(e,t)=>t.toLocaleString(Po[e]),yt=(e,t,n)=>e==="1"?t:n,wn=Object.freeze({en:Object.freeze({appTitle:"Contact Map",annotationTotalLabel:"Total:",annotationCompaniesLabel:"Companies:",annotationStreamingProgress:({loaded:e,total:t,percent:n})=>`Streaming (${j("en",e)} / ${j("en",t)} \xB7 ${n}%)`,annotationStreamingCount:e=>`Streaming (${j("en",e)} loaded)`,annotationLoadFailed:e=>`Failed to load (${j("en",e)} received)`,annotationReconnecting:e=>`Reconnecting (${j("en",e)} received)`,annotationAuthRequired:"Session expired: sign in again, then retry",annotationRetry:"Retry",recordUnit:e=>yt(e,"record","records"),companyUnit:e=>yt(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=>yt(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",recordDateTime:ra,recordDate:Sn,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",noLimit:"No limit",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:"Operator for words inside quotes",basicOperatorOr:"OR (any word matches)",basicOperatorAnd:"AND (all words match)",basicMultiTermHint:'How words between quotation marks ("tanaka taro") are combined (default: AND). Words outside quotation marks are separate keywords combined by the AND / OR button',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",statsTimestamp:oa,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 n=j("en",e);return`${n} ${yt(n,"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=>yt(e," time"," times"),itemsUnit:e=>yt(e," item"," items"),charactersUnit:e=>yt(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:n})=>`\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u8AAD\u307F\u8FBC\u307F\u4E2D (${j("ja",e)} / ${j("ja",t)} \u4EF6\u30FB${n}%)`,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)`,annotationReconnecting:e=>`\u518D\u63A5\u7D9A\u4E2D (${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",recordDateTime:ra,recordDate:Sn,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",noLimit:"\u4E0A\u9650\u306A\u3057",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:"\u5F15\u7528\u7B26\u306E\u4E2D\u306E\u8A9E\u306E\u6F14\u7B97\u5B50",basicOperatorOr:"OR (\u3044\u305A\u308C\u304B\u4E00\u81F4)",basicOperatorAnd:"AND (\u3059\u3079\u3066\u4E00\u81F4)",basicMultiTermHint:'\u5F15\u7528\u7B26\u3067\u56F2\u3093\u3060\u8A9E ("\u7530\u4E2D \u592A\u90CE") \u306E\u7D50\u5408\u65B9\u6CD5 (\u65E2\u5B9A\u306F AND)\u3002\u5F15\u7528\u7B26\u306E\u5916\u306E\u8A9E\u306F\u305D\u308C\u305E\u308C\u5225\u306E\u30AD\u30FC\u30EF\u30FC\u30C9\u3067\u3001AND / OR \u30DC\u30BF\u30F3\u3067\u7D50\u5408\u3059\u308B',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",statsTimestamp:oa,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"})}),nr=Object.freeze(Object.keys(wn.en)),Xt=Object.freeze([...ia,...nr]),Ge=Object.freeze({en:Object.freeze({...er.en,...wn.en}),ja:Object.freeze({...er.ja,...wn.ja})}),Ro=new Set(Xt),tr=Object.keys(Ge).map(e=>JSON.stringify(e)).join(" or "),ar=Object.freeze({locale:"locale",labels:"labels"}),Lo=(e,t,n)=>{e[t]=n},la=(e,t=ar.locale)=>{if(e!==void 0&&typeof e!="string")throw new TypeError(`[contact-map] ${t} must be ${tr} or left out; got ${oe(e)}`);if(e!==void 0&&!Object.hasOwn(Ge,e))throw new RangeError(`[contact-map] ${t} must be ${tr} or left out; got ${oe(e)}`);return No(e)},Eo=(e,t,n,r)=>{if(typeof r=="function"){if(typeof n!="function")throw new TypeError(`[contact-map] ${e}.${t} must be a function; got ${oe(n)}`);return}if(typeof n!="string")throw new TypeError(`[contact-map] ${e}.${t} must be a string; got ${oe(n)}`);if(n.trim()==="")throw new RangeError(`[contact-map] ${e}.${t} must not be empty or blank; got ${oe(n)}`)},Oo=(e,t,n)=>{let r=Object.create(null);for(let s of Object.getOwnPropertyNames(e)){if(!Ro.has(s)){let o=Tn(s,Xt);throw new RangeError(`[contact-map] ${n} 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 ${oe(s)}`)}let a=e[s];a!==void 0&&(Eo(n,s,a,t[s]),r[s]=a)}return r},Do=e=>{let t={},n=!1;for(let r of ia){let s=e[r];s!==void 0&&(t[r]=s,n=!0)}return n?t:void 0},da=(e,t,n=ar)=>{let r=la(e,n.locale);if(t===void 0)return Ge[r];if(!Ot(t))throw new TypeError(`[contact-map] ${n.labels} must be a plain object or left out; got ${oe(t)}`);let s=Oo(t,Ge[r],n.labels),o={...wo(r,Do(s)),...wn[r]};for(let d of nr){let l=s[d];l!==void 0&&Lo(o,d,l)}return Object.freeze(o)},ca=e=>{let t={};for(let n of ia)t[n]=e[n];return Object.freeze(t)},ua=e=>{let t={};for(let n of Mo)t[n]=e[n];return Object.freeze(t)}});import{DIRECTORY_TREE_LABEL_KEYS as Wo}from"@aiquants/directory-tree";import{VIRTUAL_SCROLL_LABEL_KEYS as Ho}from"@aiquants/virtualscroll";import{createContext as _o,useContext as or,useMemo as rr,useRef as Ao}from"react";import{jsx as Fo}from"react/jsx-runtime";var Io,ma,pa,sr,ye,G,ie=we(()=>{"use strict";bt();Io=Object.freeze({locale:"en",labels:Ge.en,treeLabels:ca(Ge.en),engineLabels:ua(Ge.en)}),ma=_o(Io),pa=(e,t)=>{let n=Ao(null),r=n.current;return r!==null&&t.every(s=>r[s]===e[s])?r:(n.current=e,e)},sr=({locale:e,labels:t,surface:n,children:r})=>{let s=la(e,n.locale),a=rr(()=>da(s,t,n),[s,t,n]),o=pa(a,Xt),d=pa(ca(o),Wo),l=pa(ua(o),Ho),c=rr(()=>({locale:s,labels:o,treeLabels:d,engineLabels:l}),[s,o,d,l]);return Fo(ma.Provider,{value:c,children:r})},ye=()=>or(ma),G=()=>or(ma).labels});var Nn,fa=we(()=>{"use strict";Nn=e=>e.isComposing||e.keyCode===229});import Uo from"lucide-react/dist/esm/icons/check.js";import $o from"lucide-react/dist/esm/icons/copy.js";import Vo from"lucide-react/dist/esm/icons/x.js";import{useCallback as it,useEffect as xa,useMemo as Jt,useRef as va,useState as cr}from"react";import{createPortal as Ko}from"react-dom";import{jsx as Q,jsxs as Le}from"react/jsx-runtime";var jo,lr,Zt,_t,qo,Go,Ht,ya,dr,ba,Mn,Ca=we(()=>{"use strict";ft();ie();fa();jo=350,lr=["dblclick","pointerdown","pointerup","mousedown","mouseup","touchstart","touchend","contextmenu"],Zt=0,_t=null,qo=()=>{let e=document.body.style;Zt+=1,Zt===1&&(_t={userSelect:e.userSelect,webkitUserSelect:e.webkitUserSelect}),e.userSelect="none",typeof e.webkitUserSelect<"u"&&(e.webkitUserSelect="none")},Go=()=>{if(Zt=Math.max(0,Zt-1),Zt>0||!_t)return;let e=document.body.style;e.userSelect=_t.userSelect,typeof _t.webkitUserSelect<"u"&&(e.webkitUserSelect=_t.webkitUserSelect),_t=null},Ht=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},ya=(e,t)=>{let n=new Set;return e.reduce((r,s)=>{let a=typeof s.value=="string"?s.value.trim():"";if(!a)return r;let{normalized:o,key:d,entry:l}=t(a,s);return o&&!n.has(d)&&(n.add(d),r.push(l(o))),r},[])},dr=(e,t)=>e===t,ba=({value:e,ariaLabel:t,size:n="md"})=>{let[r,s]=cr(!1),a=va(null),o=it(async u=>{if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(u),!0}catch{}if(typeof document>"u")return!1;let i=document.createElement("textarea");i.value=u,i.setAttribute("readonly",""),i.style.position="absolute",i.style.left="-9999px",document.body.appendChild(i),i.select(),i.setSelectionRange(0,i.value.length);let p=document.execCommand("copy");return document.body.removeChild(i),p},[]),d=it(async u=>{u.preventDefault(),u.stopPropagation(),a.current!==null&&typeof window<"u"&&(window.clearTimeout(a.current),a.current=null);let i=await o(e);s(i),i&&typeof window<"u"&&(a.current=window.setTimeout(()=>{s(!1),a.current=null},1500))},[o,e]);xa(()=>()=>{a.current!==null&&typeof window<"u"&&(window.clearTimeout(a.current),a.current=null)},[]);let l=n==="sm"?"h-6 w-6":"h-7 w-7",c=n==="sm"?"h-3.5 w-3.5":"h-4 w-4",m=r?Uo:$o;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:c,"aria-hidden":"true"})})},Mn=({contactData:e,openEmailsWithGmail:t,openGmailCompose:n,onRequestClose:r})=>{let s=G(),[a,o]=cr(null);xa(()=>{o(document.body)},[]);let d=va(null),l=va(null),c=Jt(()=>e.contacted_at?Ie(e.contacted_at,s.recordDate):null,[e.contacted_at,s.recordDate]),m=Ht(e.full_name)??s.noName,u=Ht(e.company_name),i=Ht(e.department),p=Ht(e.title),f=Jt(()=>ya([{fieldKey:"company_name",label:s.fieldCompanyName,value:u},{fieldKey:"department",label:s.fieldDepartment,value:i},{fieldKey:"title",label:s.fieldTitle,value:p}],(h,{fieldKey:b,label:D})=>({normalized:h,key:`${b}-${h.toLowerCase()}`,entry:S=>({fieldKey:b,label:D,value:S})})),[u,i,p,s]),C=Jt(()=>ya([{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}],(h,{fieldKey:b,label:D})=>{let S=Yt(h);return{normalized:Ht(h),key:(S??h).toLowerCase(),entry:w=>({fieldKey:b,label:D,value:w,href:S})}}),[e.custom_mobile_phone_number,e.mobile_phone_number,e.custom_company_phone_number,e.company_phone_number,s]),v=Jt(()=>ya([{fieldKey:"custom_email",label:s.popupCustomEmail,value:e.custom_email},{fieldKey:"email",label:s.popupEmail,value:e.email}],(h,{fieldKey:b,label:D})=>{let S=Ht(h),te=qe(h,t),w=!!te?.startsWith("https://mail.google.com");return{normalized:S,key:h.toLowerCase(),entry:N=>({fieldKey:b,label:D,value:N,href:te,isGmailLink:w})}}),[e.custom_email,e.email,t,s]),k=C.length>0||v.length>0,I=Jt(()=>`contact-methods-${e.person_id}`,[e.person_id]),E=it(h=>{r(h),l.current=null},[r]),y=it(h=>{h.stopPropagation(),dr(h.target,h.currentTarget)&&E()},[E]),g=it(h=>{h.stopPropagation(),dr(h.target,h.currentTarget)&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),E())},[E]),A=it(h=>{h.stopPropagation(),E()},[E]),B=it((h,b)=>{b.isGmailLink&&(h.preventDefault(),n(b.value))},[n]),x=it((h,b)=>{if(!b.isGmailLink){l.current=null;return}let D=Date.now(),S=l.current;if(S&&S.email===b.value&&D-S.timestamp<=jo){l.current=null,h.preventDefault(),n(b.value);return}l.current={email:b.value,timestamp:D}},[n]);return xa(()=>{let h=[];if(typeof window<"u"){let b=D=>{if(D.key==="Escape"&&!Nn(D)){E();return}if(D.key==="Tab"&&d.current){let S=d.current.querySelectorAll('a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])');if(S.length===0)return;let te=S[0],w=S[S.length-1];D.shiftKey?document.activeElement===te&&(D.preventDefault(),w.focus()):document.activeElement===w&&(D.preventDefault(),te.focus())}};window.addEventListener("keydown",b),h.push(()=>window.removeEventListener("keydown",b))}if(typeof document<"u"){let b=d.current;if(b){let w=N=>{N.stopPropagation()};for(let N of lr)b.addEventListener(N,w);h.push(()=>{for(let N of lr)b.removeEventListener(N,w)})}let D=w=>{let N=d.current;return N&&w instanceof Node?N.contains(w):!1},S=w=>{D(w.target)||E({suppressLongPress:!0,cancelLongPressTimer:!0})},te=["pointerdown","wheel","touchmove"];for(let w of te)document.addEventListener(w,S,!0);h.push(()=>{for(let w of te)document.removeEventListener(w,S,!0)}),qo(),h.push(Go)}return()=>{for(let b of h)b()}},[E,a]),a?Ko(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, 0px)",transition:"right 0.5s"},role:"dialog","aria-modal":"true","aria-labelledby":I,tabIndex:-1,onClick:y,onKeyDown:g,children:Le("div",{ref:d,className:"w-full max-w-md rounded-lg border border-slate-200 bg-white p-4 shadow-lg transition-colors dark:border-transparent dark:bg-slate-900 dark:shadow-slate-950/40 dark:ring-1 dark:ring-white/70",children:[Le("div",{className:"flex items-start justify-between gap-4",children:[Le("div",{children:[Q("h2",{id:I,className:"font-semibold text-gray-900 text-lg dark:text-slate-100",children:m}),f.length>0?Q("div",{className:"mt-2 space-y-2 text-slate-700 text-sm dark:text-slate-200",children:f.map(h=>Le("div",{className:"flex items-center gap-3",children:[Q("p",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:h.value}),Q(ba,{value:h.value,ariaLabel:s.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:A,"aria-label":s.close,children:Q(Vo,{className:"h-4 w-4","aria-hidden":"true"})})]}),Le("div",{className:"mt-4 space-y-4 text-slate-700 dark:text-slate-200",children:[C.length>0?Q("div",{children:Q("ul",{className:"space-y-3 text-sm",children:C.map(h=>Q("li",{className:"flex items-start gap-3",children:Le("div",{className:"flex-1",children:[Q("span",{className:"text-slate-600 text-xs dark:text-slate-300",children:h.label}),Le("div",{className:"mt-1 flex items-center gap-3",children:[Q("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:h.href?Q("a",{href:h.href,className:"wrap-break-word text-blue-600 underline-offset-2 transition-colors hover:underline focus:underline focus:outline-none dark:text-blue-300",children:h.value}):Q("span",{className:"wrap-break-word text-slate-800 dark:text-slate-100",children:h.value})}),Q(ba,{value:h.value,ariaLabel:s.copyField(h.label),size:"sm"})]})]})},`${h.fieldKey}-${h.value}`))})}):null,v.length>0?Q("div",{children:Q("ul",{className:"space-y-3 text-sm",children:v.map(h=>Q("li",{className:"flex items-start gap-3",children:Le("div",{className:"flex-1",children:[Q("span",{className:"text-slate-600 text-xs dark:text-slate-300",children:h.label}),Le("div",{className:"mt-1 flex items-start gap-3",children:[Le("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:[h.href?Q("a",{href:h.href,className:"wrap-break-word text-blue-600 underline-offset-2 transition-colors hover:underline focus:underline focus:outline-none dark:text-blue-300",target:h.isGmailLink?"_blank":void 0,rel:h.isGmailLink?"noopener noreferrer":void 0,onDoubleClick:b=>B(b,h),onTouchEnd:b=>x(b,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:s.popupGmailHint}):null]}),Q(ba,{value:h.value,ariaLabel:s.copyField(h.label),size:"sm"})]})]})},`${h.fieldKey}-${h.value}`))})}):null,c?Le("div",{className:"mt-2 flex items-center gap-2 text-slate-600 text-sm dark:text-slate-300",children:[Q("span",{className:"text-xs",children:s.popupLastContactDate}),Q("span",{children:c})]}):null,k?null:Q("p",{className:"text-slate-600 text-sm dark:text-slate-300",children:s.popupNoContactMethods})]})]})}),a):null}});import{jsx as be,jsxs as en}from"react/jsx-runtime";var Pn,ka=we(()=>{"use strict";Pn=({fullName:e,title:t="-",companyName:n="-",department:r="-",phoneNumber:s="-",email:a="-",updatedAtText:o="-"})=>en("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:[en("div",{className:"flex items-center gap-1 sm:hidden",children:[be("div",{className:"flex-1 truncate font-medium text-gray-900 text-sm leading-tight dark:text-slate-100",children:e}),be("div",{className:"shrink-0 whitespace-nowrap text-[11px] text-slate-600 dark:text-slate-300",children:s})]}),be("div",{className:"flex items-center gap-1 sm:hidden",children:be("div",{className:"flex-1 truncate text-slate-700 text-xs leading-tight dark:text-slate-200",children:n})}),be("div",{className:"block sm:hidden",children:be("span",{className:"w-full truncate text-left text-[11px] text-slate-700 leading-tight dark:text-slate-200",children:r})}),en("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[be("span",{className:"truncate font-medium text-gray-900 dark:text-slate-100",children:e}),be("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:t})]}),en("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[be("span",{className:"truncate text-slate-800 dark:text-slate-100",children:n}),be("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:r})]}),en("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[be("span",{className:"truncate text-slate-700 dark:text-slate-200",children:s}),be("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:a})]}),be("div",{className:"hidden items-end justify-end text-[11px] text-slate-600 xl:flex dark:text-slate-300",children:be("span",{className:"truncate",children:o})})]})});import{formatQuerySets as Qo,parseQuerySets as Yo}from"@aiquants/fuzzy-search";import{getNormalizedVariants as Xo,normalizeText as Jo,romajiToKatakana as Zo}from"@aiquants/select-box";var mr,es,ts,ns,as,gr,hr,rs,os,ss,is,ls,ds,cs,us,fr,yr,ur,pr,Rn,ps,ms,Sa,br,Ta=we(()=>{"use strict";mr=/[]/g,es=/^[\s ]+|[\s ]+$/g,ts=/\s+/,ns=/^[\p{Script=Latin}\s]+$/u,as=/\p{Script=Latin}/u,gr=Object.freeze({convertWidth:!0,convertKana:!0,convertCase:!0,convertRomaji:!1,normalizeVariants:!1,ignoreSpaces:!1,ignoreSymbols:!1,ignoreLongVowels:!1}),hr="union",rs=65377,os=65439,ss=["\uFF9E","\uFF9F"],is=(()=>{let e=new Map;for(let t=rs;t<=os;t+=1){let n=String.fromCharCode(t);e.set(n.normalize("NFKC"),n);for(let r of ss){let s=(n+r).normalize("NFKC");s.length===1&&e.set(s,n+r)}}return e})(),ls=/[-ヿ]/u,ds=e=>{let t=Array.from(e,n=>is.get(n)??n).join("");return ls.test(t)?null:t},cs=e=>Jo(e.replace(mr,"").replace(es,""),gr),us=e=>{if(!ns.test(e))return null;let t=Zo(e);return as.test(t)?null:t},fr=e=>e.split(ts).filter(Boolean),yr=e=>Yo(e,hr).sets.map(({query:t})=>t),ur=e=>yr(e).flatMap(t=>fr(t)),pr=e=>Qo({combine:hr,sets:Array.from(new Set(e),t=>({query:t}))}),Rn=e=>{let t=yr(e.replace(mr,"")).map(r=>fr(cs(r)).join(" ")).filter(r=>r!==""),n=[];for(let r of t){let s=us(r);if(s===null)return pr(t);n.push(s)}return pr(n)},ps=e=>{let t=new Set([...ur(e),...ur(Rn(e))]),n=new Set;for(let r of t)for(let s of Xo(r,gr)){let a=s.trim();if(!a)continue;n.add(a);let o=ds(a);o!==null&&n.add(o)}return Array.from(n)},ms=/[.*+?^${}()|[\]\\]/g,Sa=e=>{let t=ps(e);if(t.length===0)return null;let n=t.map(r=>r.replace(ms,"\\$&")).sort((r,s)=>s.length-r.length);return new RegExp(n.join("|"),"gi")},br=(e,t)=>{let n=Sa(e);if(n===null)return s=>s;let r=s=>t.some(a=>{let o=s[a];return typeof o=="string"&&o.search(n)!==-1});return s=>{let a=[],o=[];for(let d of s)r(d.item)?a.push(d):o.push(d);return[...a,...o]}}});import{memo as gs}from"react";import{Fragment as wa,jsx as Ln}from"react/jsx-runtime";var hs,ue,En=we(()=>{"use strict";Ta();hs="rounded bg-yellow-200 px-1 text-gray-900 dark:bg-yellow-900 dark:text-yellow-100",ue=gs(({text:e,query:t,enabled:n=!0})=>{if(!(n&&t?.trim()&&e))return Ln(wa,{children:e});let r=Sa(t);if(r===null)return Ln(wa,{children:e});let s=[],a=0,o=r.exec(e),d=0;for(;o;){let l=o[0],c=o.index;if(c>a&&s.push(e.substring(a,c)),l.length===0){r.lastIndex++,o=r.exec(e);continue}s.push(Ln("mark",{className:hs,children:l},`highlight-${c}-${d}`)),a=c+l.length,d+=1,o=r.exec(e)}return a<e.length&&s.push(e.substring(a)),Ln(wa,{children:s})});ue.displayName="HighlightedText"});var vr={};So(vr,{ContactDetailGrid:()=>xr,default:()=>fs});import{useMemo as Na}from"react";import{Fragment as ys,jsx as Ma,jsxs as bs}from"react/jsx-runtime";var On,xr,fs,Cr=we(()=>{"use strict";ft();ie();Ca();ka();En();On=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},xr=({contactData:e,searchTerm:t,enableHighlighting:n,openEmailsWithGmail:r,openGmailCompose:s,isPopupVisible:a,onRequestClose:o})=>{let d=G(),l=Na(()=>Rt(e),[e]),c=Na(()=>Lt(e),[e]),m=l.value??"-",u=c.value??"-",i=Na(()=>Ie(e.updated_at,d.recordDateTime),[e.updated_at,d.recordDateTime]),p=On(e.full_name)??d.noName,f=On(e.company_name),C=On(e.department),v=(k,I="-")=>Ma(ue,{text:k??I,query:t,enabled:n});return bs(ys,{children:[Ma(Pn,{fullName:v(p),title:v(On(e.title)),companyName:v(f),department:v(C),phoneNumber:u,email:v(m),updatedAtText:i}),a?Ma(Mn,{contactData:e,openEmailsWithGmail:r,openGmailCompose:s,onRequestClose:o}):null]})},fs=xr});ie();import{DEFAULT_FUZZY_SEARCH_OPTIONS as Wt}from"@aiquants/fuzzy-search";import{memo as zo,useId as ir}from"react";import{jsx as Fe,jsxs as Qe}from"react/jsx-runtime";var ga=zo(({searchOptions:e,setSearchOptions:t})=>{let n=G(),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",a=ir(),o=ir(),d=[];return d.push(Qe("div",{className:`${r} border-sky-200 border-l-4 dark:border-sky-400/60`,children:[Qe("div",{className:`${s} text-sky-700 dark:text-sky-300`,children:["\u{1F4D8} ",n.advancedLearningHeading]}),Fe("label",{htmlFor:a,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.advancedLearningLabel}),Fe("input",{id:a,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.learningWeight||Wt.learningWeight,onChange:l=>t(c=>({...c,learningWeight:parseFloat(l.target.value)})),className:"w-full"}),Qe("span",{className:"text-sky-600 text-xs dark:text-sky-300",children:[n.currentValueLabel," ",e.learningWeight||Wt.learningWeight]}),Fe("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.advancedLearningHint})]},"learning")),d.push(Qe("div",{className:`${r} border-indigo-200 border-l-4 dark:border-indigo-400/60`,children:[Qe("div",{className:`${s} text-indigo-700 dark:text-indigo-300`,children:["\u23F1\uFE0F ",n.advancedDebounceHeading]}),Fe("label",{htmlFor:o,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.advancedDebounceLabel}),Fe("input",{id:o,type:"range",min:"100",max:"1000",step:"50",value:e.debounceMs??Wt.debounceMs,onChange:l=>t(c=>({...c,debounceMs:parseInt(l.target.value,10)})),className:"w-full"}),Qe("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[n.currentValueLabel," ",e.debounceMs??Wt.debounceMs]}),Fe("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.advancedDebounceHint})]},"debounce")),Qe("section",{className:"space-y-3",children:[Qe("div",{className:"flex items-center justify-between gap-3",children:[Qe("div",{className:"flex items-center gap-2 font-semibold text-gray-700 text-xs transition-colors dark:text-slate-200",children:[Fe("span",{children:"\u26A1"}),Fe("span",{className:"tracking-wide",children:n.settingsAdvancedTab})]}),Fe("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:n.resetToDefaultsTitle,children:n.reset})]}),Fe("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:d})]})});ga.displayName="AdvancedSearchSettings";ie();import{DEFAULT_FUZZY_SEARCH_OPTIONS as xt}from"@aiquants/fuzzy-search";import{memo as Bo,useId as ze}from"react";import{jsx as X,jsxs as Z}from"react/jsx-runtime";var ha=Bo(({searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:r,openEmailsWithGmail:s,setOpenEmailsWithGmail:a})=>{let o=G(),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",c=ze(),m=ze(),u=ze(),i=ze(),p=ze(),f=ze(),C=ze(),v=ze(),k=ze(),I=ze(),E=[];return E.push(Z("div",{className:`${d} border-blue-200 border-l-4 dark:border-blue-500/50`,children:[Z("div",{className:`${l} text-blue-700 dark:text-blue-300`,children:["\u{1F3AF} ",o.basicThresholdHeading]}),X("label",{htmlFor:c,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicThresholdLabel}),X("input",{id:c,type:"range",min:"0.0",max:e.sortBy==="relevance"?"1.5":"1.0",step:"0.05",value:e.threshold??xt.threshold,onChange:y=>t(g=>({...g,threshold:parseFloat(y.target.value)})),className:"w-full"}),Z("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[o.currentValueLabel," ",e.threshold??xt.threshold]}),X("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:e.sortBy==="relevance"?o.basicThresholdRangeRelevance:o.basicThresholdRange})]},"threshold")),E.push(Z("div",{className:`${d} border-amber-200 border-l-4 dark:border-amber-400/60`,children:[Z("div",{className:`${l} text-amber-700 dark:text-amber-300`,children:["\u{1FA84} ",o.basicDisplayHeading]}),Z("label",{htmlFor:m,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[X("input",{id:m,type:"checkbox",checked:e.caseSensitive??xt.caseSensitive,onChange:y=>t(g=>({...g,caseSensitive:y.target.checked})),className:"h-3 w-3"}),o.basicCaseSensitive]}),Z("label",{htmlFor:u,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[X("input",{id:u,type:"checkbox",checked:n,onChange:y=>r(y.target.checked),className:"h-3 w-3"}),o.basicHighlight]}),Z("label",{htmlFor:i,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[X("input",{id:i,type:"checkbox",checked:s,onChange:y=>a(y.target.checked),className:"h-3 w-3"}),o.basicOpenEmailsWithGmail]}),Z("div",{className:"flex flex-col gap-1",children:[X("label",{htmlFor:p,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicMultiTermOperator}),Z("select",{id:p,value:e.multiTermOperator??xt.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:[X("option",{value:"or",children:o.basicOperatorOr}),X("option",{value:"and",children:o.basicOperatorAnd})]}),X("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:o.basicMultiTermHint})]})]},"display")),E.push(Z("div",{className:`${d} border-emerald-200 border-l-4 dark:border-emerald-400/60`,children:[Z("div",{className:`${l} text-emerald-700 dark:text-emerald-300`,children:["\u{1F4DA} ",o.basicSortHeading]}),Z("div",{className:"flex flex-col gap-2",children:[X("label",{htmlFor:f,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicSortBy}),Z("select",{id:f,value:e.sortBy||xt.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:[X("option",{value:"score",children:o.basicSortByScore}),X("option",{value:"relevance",children:o.basicSortByRelevance}),X("option",{value:"original",children:o.basicSortByOriginal})]})]}),Z("div",{className:"flex flex-col gap-2",children:[X("label",{htmlFor:C,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicSortOrder}),Z("select",{id:C,value:e.sortOrder||xt.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:[X("option",{value:"desc",children:o.basicSortDescending}),X("option",{value:"asc",children:o.basicSortAscending})]})]})]},"sorting")),E.push(Z("div",{className:`${d} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[Z("div",{className:`${l} text-purple-700 dark:text-purple-300`,children:["\u2699\uFE0F ",o.basicEngineHeading]}),X("label",{htmlFor:v,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicStrategy}),Z("select",{id:v,value:e.parallelSearchStrategy||xt.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:[X("option",{value:"balanced",children:o.basicStrategyBalanced}),X("option",{value:"index-first",children:o.basicStrategyIndexFirst}),X("option",{value:"levenshtein-first",children:o.basicStrategyLevenshteinFirst})]}),Z("div",{className:"mt-2 space-y-2",children:[Z("label",{htmlFor:k,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[X("input",{id:k,type:"checkbox",checked:e.enableIndexFiltering!==!1,onChange:y=>t(g=>({...g,enableIndexFiltering:y.target.checked})),className:"h-3 w-3"}),o.basicIndexFiltering]}),Z("label",{htmlFor:I,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[X("input",{id:I,type:"checkbox",checked:e.enableLevenshtein!==!1,onChange:y=>t(g=>({...g,enableLevenshtein:y.target.checked})),className:"h-3 w-3"}),o.basicLevenshtein]})]})]},"engine")),Z("section",{className:"space-y-3",children:[Z("div",{className:"flex items-center gap-2 font-semibold text-blue-700 text-xs transition-colors dark:text-sky-400",children:[X("span",{children:"\u{1F527}"}),X("span",{className:"tracking-wide",children:o.settingsBasicTab})]}),X("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:E})]})});ha.displayName="BasicSearchSettings";ft();import Cs from"lucide-react/dist/esm/icons/badge-check.js";import ks from"lucide-react/dist/esm/icons/building-2.js";import Ss from"lucide-react/dist/esm/icons/calendar-clock.js";import Ts from"lucide-react/dist/esm/icons/check.js";import ws from"lucide-react/dist/esm/icons/copy.js";import Ns from"lucide-react/dist/esm/icons/id-card.js";import Ms from"lucide-react/dist/esm/icons/mail.js";import Ps from"lucide-react/dist/esm/icons/phone.js";import Rs from"lucide-react/dist/esm/icons/user-round.js";import{useCallback as Ls,useEffect as Es,useMemo as Hn,useRef as Os,useState as Ds}from"react";var Be={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)};ie();import*as Ee from"@radix-ui/react-tabs";import*as Dn from"react";import{clsx as xs}from"clsx";import{twMerge as vs}from"tailwind-merge";function vt(...e){return vs(xs(e))}import{jsx as Pa}from"react/jsx-runtime";var Wn=Ee.Root,tn=Dn.forwardRef(({className:e,...t},n)=>Pa(Ee.List,{ref:n,className:vt("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));tn.displayName=Ee.List.displayName;var Ct=Dn.forwardRef(({className:e,...t},n)=>Pa(Ee.Trigger,{ref:n,className:vt("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}));Ct.displayName=Ee.Trigger.displayName;var kt=Dn.forwardRef(({className:e,...t},n)=>Pa(Ee.Content,{ref:n,className:vt("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}));kt.displayName=Ee.Content.displayName;En();import{jsx as M,jsxs as de}from"react/jsx-runtime";var kr={height:"var(--contact-panel-height, 100%)",maxHeight:"100%"},Ws=({icon:e,label:t,value:n,fieldKey:r,copyValue:s,onCopy:a,isCopied:o,linkHref:d,searchTerm:l,enableHighlighting:c})=>{let m=G(),u=!!(a&&r&&s),i=d?.startsWith("https://mail.google.com")?"_blank":void 0;return de("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1.5 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[de("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[M("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:M(e,{size:14})}),de("div",{className:"min-w-0 flex-1",children:[M("div",{className:"font-medium text-[10px] text-slate-500 dark:text-slate-400",children:t}),M("div",{className:"truncate font-semibold text-slate-900 text-xs dark:text-slate-100",children:d?M("a",{href:d,className:"text-inherit underline-offset-2 hover:underline focus:underline focus:outline-none",target:i,rel:i?"noopener noreferrer":void 0,children:M(ue,{text:n,query:l??"",enabled:c})}):M(ue,{text:n,query:l??"",enabled:c})})]})]}),u?M("button",{type:"button",onClick:()=>a&&r&&s&&a(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?M(Ts,{size:14}):M(ws,{size:14})}):null]})},Sr=({items:e,searchTerm:t,enableHighlighting:n})=>M("dl",{className:"grid grid-cols-1 gap-x-3 gap-y-1.5 sm:grid-cols-2",children:e.map(r=>de("div",{className:"flex flex-col gap-0.5 rounded-md border border-slate-200 bg-white/60 px-2 py-1 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[M("dt",{className:"font-semibold text-[10px] text-slate-500 uppercase tracking-wide dark:text-slate-400",children:r.label}),M("dd",{className:"wrap-break-word text-slate-900 text-xs dark:text-slate-100",children:M(ue,{text:r.value,query:t??"",enabled:n})})]},r.fieldKey))}),Ra=({title:e})=>M("h3",{className:"font-semibold text-slate-700 text-xs dark:text-slate-200",children:e}),Hs=()=>{let e=G();return de("div",{className:"flex h-full min-h-40 w-full flex-1 flex-col items-center justify-center gap-2 rounded-xl border border-slate-300 border-dashed bg-white/60 p-4 text-center transition-colors dark:border-slate-700 dark:bg-slate-900/40",children:[M("p",{className:"font-medium text-slate-600 text-xs dark:text-slate-200",children:e.detailEmptyTitle}),M("p",{className:"text-[11px] text-slate-500 dark:text-slate-400",children:e.detailEmptyHint})]})},lt=({contact:e,searchTerm:t,enableHighlighting:n,style:r,className:s=""})=>{let a=G(),[o,d]=Ds(null),l=Os(null),c=Hn(()=>({...kr,...r}),[r]);Es(()=>()=>{l.current!==null&&window.clearTimeout(l.current)},[]);let m=Hn(()=>Rt(e),[e]),u=Hn(()=>Lt(e),[e]),i=Hn(()=>Ie(e?.contacted_at,a.recordDateTime),[e?.contacted_at,a.recordDateTime]),p=Ls(async(x,h,b)=>{try{await navigator.clipboard.writeText(h),d(x),l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{d(null)},2e3)}catch(D){Be.error("Failed to copy contact detail",D)}},[]);if(!e)return M("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:kr,children:M(Hs,{})});let f=[q(e.title),q(e.department)].filter(x=>x!=="-"),C=[f.join(" / "),q(e.company_name)].filter(x=>x&&x!=="-").join(" \u30FB ")||"-",v=Re(e.full_name)??a.noName,k=[{fieldKey:"full_name",label:a.fieldFullName,value:v},{fieldKey:"full_name_reading",label:a.fieldFullNameReading,value:q(e.full_name_reading)},{fieldKey:"title",label:a.fieldTitle,value:q(e.title)},{fieldKey:"department",label:a.fieldDepartment,value:q(e.department)},{fieldKey:"company_name",label:a.fieldCompanyName,value:q(e.company_name)},{fieldKey:"company_name_reading",label:a.fieldCompanyNameReading,value:q(e.company_name_reading)},{fieldKey:"address",label:a.fieldAddress,value:q(e.address)},{fieldKey:"postal_code",label:a.fieldPostalCode,value:q(e.postal_code)},{fieldKey:"url",label:a.fieldUrl,value:q(e.url)}],I=[{label:a.fieldCustomEmail,value:q(e.custom_email),fieldKey:"custom_email",rawValue:e.custom_email},{label:a.fieldEmail,value:q(e.email),fieldKey:"email",rawValue:e.email}].filter(x=>x.value!=="-"),E=[{label:a.fieldCustomMobilePhone,value:q(e.custom_mobile_phone_number),fieldKey:"custom_mobile_phone_number",rawValue:e.custom_mobile_phone_number},{label:a.fieldMobilePhone,value:q(e.mobile_phone_number),fieldKey:"mobile_phone_number",rawValue:e.mobile_phone_number},{label:a.fieldCompanyPhone,value:q(e.company_phone_number),fieldKey:"company_phone_number",rawValue:e.company_phone_number},{label:a.fieldCompanyFax,value:q(e.company_fax_number),fieldKey:"company_fax_number",rawValue:e.company_fax_number}].filter(x=>x.value!=="-"),y=[{fieldKey:"person_id",label:"person_id",value:q(e.person_id)},{fieldKey:"person_id_redirect_to",label:"person_id_redirect_to",value:q(e.person_id_redirect_to)},{fieldKey:"is_active",label:"is_active",value:q(e.is_active)},{fieldKey:"is_contact_synced",label:"is_contact_synced",value:q(e.is_contact_synced)},{fieldKey:"is_incomplete",label:"is_incomplete",value:q(e.is_incomplete)},{fieldKey:"is_in_eight",label:"is_in_eight",value:q(e.is_in_eight)},{fieldKey:"created_by",label:a.fieldCreatedBy,value:q(e.created_by)},{fieldKey:"created_at",label:a.fieldCreatedAt,value:Ie(e.created_at,a.recordDateTime)},{fieldKey:"updated_by",label:a.fieldUpdatedBy,value:q(e.updated_by)},{fieldKey:"updated_at",label:a.fieldUpdatedAt,value:Ie(e.updated_at,a.recordDateTime)}],g=[{rowKey:"person_id",icon:Ns,label:"person_id",value:q(e.person_id),fieldKey:"person_id",copyValue:String(e.person_id)},{rowKey:"primary_email",icon:Ms,label:a.summaryEmail,value:m.value??"-",fieldKey:"primary_email",copyValue:m.value,linkHref:qe(m.value,!1)},{rowKey:"primary_phone",icon:Ps,label:a.summaryPhone,value:u.value??"-",fieldKey:"primary_phone",copyValue:u.value,linkHref:Yt(u.value)},{rowKey:"contacted_at",icon:Ss,label:a.summaryLastContact,value:i}],A=[{sectionKey:"email",title:a.sectionEmail,emptyText:a.sectionEmailEmpty,entries:I,recommendedKey:m.fieldKey??null,resolveHref:x=>qe(x!=null?String(x):null,!1)},{sectionKey:"phone",title:a.sectionPhone,emptyText:a.sectionPhoneEmpty,entries:E,recommendedKey:u.fieldKey??null,resolveHref:x=>Yt(x!=null?String(x):null)}],B=[{value:"summary",label:a.detailTabSummary,content:de("div",{className:"flex flex-col gap-4",children:[de("div",{className:"flex flex-col gap-1",children:[de("div",{className:"flex items-center gap-2 text-slate-600 text-sm dark:text-slate-300",children:[M(ks,{size:16}),M("span",{children:M(ue,{text:q(e.company_name),query:t??"",enabled:n})})]}),f.length>0?M("div",{className:"text-slate-600 text-sm dark:text-slate-300",children:f.map((x,h)=>de("span",{children:[h>0&&" / ",M(ue,{text:x,query:t??"",enabled:n})]},`header-line-${h}`))}):null]}),M("div",{className:"flex flex-col gap-3",children:g.map(x=>M(Ws,{icon:x.icon,label:x.label,value:x.value,fieldKey:x.fieldKey,copyValue:x.copyValue,onCopy:p,isCopied:x.fieldKey?o===x.fieldKey:!1,linkHref:x.linkHref,searchTerm:t,enableHighlighting:n},x.rowKey))})]})},{value:"basic",label:a.detailTabBasic,content:de("div",{className:"flex flex-col gap-3",children:[M(Ra,{title:a.detailBasicProfile}),M(Sr,{items:k,searchTerm:t,enableHighlighting:n})]})},{value:"contact",label:a.detailTabContact,content:M("div",{className:"flex flex-col gap-4",children:A.map(({sectionKey:x,title:h,emptyText:b,entries:D,recommendedKey:S,resolveHref:te})=>de("div",{className:"flex flex-col gap-2",children:[M(Ra,{title:h}),D.length===0?M("p",{className:"text-slate-500 text-xs dark:text-slate-400",children:b}):M("div",{className:"flex flex-col gap-2",children:D.map(w=>{let N=te(w.rawValue),O=w.fieldKey===S;return de("div",{className:"flex items-center justify-between rounded-lg border border-slate-200 bg-white px-3 py-2 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[de("div",{children:[M("div",{className:"font-medium text-slate-500 text-xs dark:text-slate-400",children:w.label}),M("div",{className:"text-slate-900 text-sm dark:text-slate-100",children:N?M("a",{href:N,className:"text-inherit underline-offset-2 hover:underline focus:underline focus:outline-none",children:M(ue,{text:w.value,query:t??"",enabled:n})}):M(ue,{text:w.value,query:t??"",enabled:n})})]}),O?de("span",{className:"inline-flex items-center gap-1 rounded-full bg-emerald-100 px-2 py-0.5 font-semibold text-[11px] text-emerald-700 transition-colors dark:bg-emerald-300/20 dark:text-emerald-200",children:[M(Cs,{size:14}),a.preferred]}):null]},w.fieldKey)})})]},x))})},{value:"meta",label:a.detailTabMeta,content:de("div",{className:"flex flex-col gap-3",children:[M(Ra,{title:a.detailTabMeta}),M(Sr,{items:y,searchTerm:t,enableHighlighting:n})]})}];return de("div",{className:`flex h-full min-h-0 w-full flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-950 ${s}`.trim(),style:c,children:[M("div",{className:"border-slate-200 border-b px-3 py-1.5 transition-colors dark:border-slate-700 dark:bg-slate-900/50",children:de("div",{className:"flex items-center gap-2",children:[M("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:M(Rs,{size:16})}),de("div",{className:"min-w-0 flex-1",children:[M("div",{className:"truncate font-semibold text-slate-900 text-sm dark:text-slate-100",children:M(ue,{text:v,query:t??"",enabled:n})}),M("div",{className:"truncate text-[11px] text-slate-600 dark:text-slate-300",children:M(ue,{text:C,query:t??"",enabled:n})})]})]})}),de(Wn,{defaultValue:"summary",className:"flex flex-1 flex-col overflow-hidden",children:[M(tn,{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:B.map(x=>M(Ct,{value:x.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:x.label},x.value))}),B.map(x=>M(kt,{value:x.value,className:"scrollbar-thin flex-1 overflow-y-auto px-2.5 py-2 transition-colors dark:text-slate-200",children:x.content},x.value))]})]})};bt();ie();import{memo as _s}from"react";import{jsx as Ye,jsxs as _n}from"react/jsx-runtime";var La=_s(({recordCount:e,companyCount:t,phase:n,loadedCount:r,totalCount:s,errorMessage:a,onRetry:o})=>{let{locale:d,labels:l}=ye(),c=j(d,e),m=j(d,t);return _n("div",{"data-testid":"contact-map-annotation",className:"flex flex-wrap items-center gap-2 leading-1 transition-colors",role:"status",children:[_n("span",{className:"flex items-baseline gap-1",children:[Ye("span",{className:"text-slate-600 dark:text-slate-300",children:l.annotationTotalLabel}),Ye("span",{className:"text-slate-800 dark:text-slate-200","data-testid":"contact-map-record-count",children:c}),Ye("span",{className:"text-slate-600 dark:text-slate-300",children:l.recordUnit(c)})]}),_n("span",{className:"flex items-baseline gap-1",children:[Ye("span",{className:"text-slate-600 dark:text-slate-300",children:l.annotationCompaniesLabel}),Ye("span",{className:"text-slate-800 dark:text-slate-200","data-testid":"contact-map-company-count",children:m}),Ye("span",{className:"text-slate-600 dark:text-slate-300",children:l.companyUnit(m)})]}),n==="streaming"||n==="idle"?Ye("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,n==="retrying"?Ye("span",{"data-testid":"contact-map-reconnecting-badge",className:"ml-2 inline-flex items-center gap-1.5 rounded-full bg-amber-50 px-2 py-0.5 font-medium text-amber-900 text-xs dark:bg-amber-900/30 dark:text-amber-200",children:l.annotationReconnecting(r)}):null,n==="failed"||n==="auth-required"?_n("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==="failed"?a??void 0:void 0,children:["\u26D4 ",n==="auth-required"?l.annotationAuthRequired:l.annotationLoadFailed(r),o?Ye("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]})});La.displayName="ContactMapAnnotation";Dt();import{useMemo as vo}from"react";Et();Dt();ie();import{createContext as Is,useContext as Fs,useMemo as zs}from"react";Et();Dt();sa();var As=["indexWorker","levenshteinWorker","treeWorker"];function Tr(e,t,n){if(n!==void 0){if(typeof n!="string")throw new TypeError(`[contact-map] ${e}.${t} must be a string or left out (pass url.href for a URL object); got ${oe(n)}`);if(n.trim()==="")throw new RangeError(`[contact-map] ${e}.${t} must not be empty or blank; got ${oe(n)}`)}}var wr={setting:"workerUrls"},Nr=(e,t)=>{if(e===void 0)return;let{setting:n,keys:r=As,hints:s={}}=t;if(!Ot(e))throw new TypeError(`[contact-map] ${n} must be a plain object or left out; got ${oe(e)}`);let a=Object.getOwnPropertyNames(e).map(l=>({key:l,url:e[l]})),o=a.find(({key:l,url:c})=>c!==void 0&&!r.includes(l));if(o!==void 0){let l=Object.hasOwn(s,o.key)?s[o.key]:void 0,c=l===void 0?Tn(o.key,r):void 0;throw new RangeError(`[contact-map] ${n} has a key it does not take (it takes ${r.join(", ")}${l===void 0?"":`; ${l}`}${c===void 0?"":`; did you mean ${JSON.stringify(c)}?`}); got ${oe(o.key)}`)}let d=Object.create(null);for(let{key:l,url:c}of a){let m=l;Tr(n,m,c),c!==void 0&&(d[m]=c)}return d};function Cc(e,t=wr){Nr(e,t)}function Mr(e){Tr("workerUrls","treeWorker",e)}var At=(e,t,n=wr)=>{let r=Nr(t,n);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 Ea}from"react/jsx-runtime";var Pr=e=>{if(!Ot(e))throw new TypeError(`[contact-map] config must be a plain object; got ${oe(e)}`);let t=e;return{streamEndpoint:fe(t,"streamEndpoint"),openEmailsWithGmail:fe(t,"openEmailsWithGmail"),treeWorkerFactory:fe(t,"treeWorkerFactory"),workerUrls:At(void 0,fe(t,"workerUrls")),locale:fe(t,"locale"),labels:fe(t,"labels")}},Rr=({workerUrls:e,...t})=>{let{indexWorker:n,levenshteinWorker:r,treeWorker:s}=e;return Object.freeze(Object.assign(Object.create(null),t,{workerUrls:Object.freeze({indexWorker:n,levenshteinWorker:r,treeWorker:s})}))},Bs=Rr(Pr({})),Lr=Is(Bs),Us=Object.freeze({locale:"locale",labels:"labels"});function Oa({config:e,chromeSurface:t,children:n}){let{streamEndpoint:r,openEmailsWithGmail:s,treeWorkerFactory:a,workerUrls:o,locale:d,labels:l}=Pr(e),{indexWorker:c,levenshteinWorker:m,treeWorker:u}=o,i=zs(()=>Rr({streamEndpoint:r,openEmailsWithGmail:s,treeWorkerFactory:a,workerUrls:{indexWorker:c,levenshteinWorker:m,treeWorker:u},locale:d,labels:l}),[r,s,a,c,m,u,d,l]);return Ea(Lr.Provider,{value:i,children:Ea(sr,{locale:d,labels:l,surface:t,children:n})})}function $s({config:e,children:t}){return Ea(Oa,{config:e,chromeSurface:Us,children:t})}function Xe(){return Fs(Lr)}import{useCallback as Da,useEffect as Qs,useMemo as Fn,useSyncExternalStore as Er}from"react";Et();var Vs=1e3,Ks=3e4,js=6;function In(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 ${oe(e)}`);if(/[\s\p{Cc}#]/u.test(e))throw new RangeError(`[contact-map] streamEndpoint must not contain whitespace, control characters or "#"; got ${oe(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 ${oe(e)}`)}var qs=e=>({...e,contacted_at:e.contacted_at?new Date(e.contacted_at):null,created_at:e.created_at?new Date(e.created_at):void 0,updated_at:e.updated_at?new Date(e.updated_at):void 0}),Gs=e=>Array.isArray(e.records),An=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?.()};In(t.endpoint),this.fetchFn=t.fetchFn??((...n)=>fetch(...n)),this.endpoint=t.endpoint,this.initialRetryDelayMs=t.initialRetryDelayMs??Vs,this.maxRetryDelayMs=t.maxRetryDelayMs??Ks,this.maxConsecutiveFailures=t.maxConsecutiveFailures??js,this.logger=t.logger??Be}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 n of this.listeners)n(this.state)}publishRecords(t={}){let n=Array.from(this.recordMap.values());this.setState({records:n,loadedCount:n.length,isLoading:!1,...t})}async runStreamLoop(){this.setState({phase:"streaming"});let t=!1;for(;!this.disposed;){let n=this.lastCursor!==null,r=await this.streamOnce();if(r==="aborted")return;if(r==="complete"){this.publishRecords({isComplete:!0,phase:"complete",error:null});return}if(r==="auth-required"){this.setState({phase:"auth-required",isLoading:!1,error:new Error("Authentication required")});return}if(r==="rejected"){if(n&&!t){t=!0,this.lastCursor=null,this.logger.warn("[ContactMapStream] the server rejected the resume cursor (400); restarting from the beginning");continue}this.setState({phase:"failed",isLoading:!1,error:new Error("[contact-map] the server rejected the stream request (400); reload the page")});return}if(this.consecutiveFailures+=1,this.consecutiveFailures>=this.maxConsecutiveFailures){this.setState({phase:"failed",isLoading:!1});return}let s=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 ${s}ms (attempt ${this.consecutiveFailures})`),await this.waitBeforeRetry(s),this.disposed)return;this.setState({phase:"streaming"})}}waitBeforeRetry(t){return new Promise(n=>{let r=setTimeout(()=>{this.wakeRetryWait=null,n()},t);this.wakeRetryWait=()=>{clearTimeout(r),this.wakeRetryWait=null,n()}})}buildStreamUrl(){if(!this.lastCursor)return this.endpoint;let t=this.endpoint.includes("?")?"&":"?",n=new URLSearchParams;return this.lastCursor.contacted_at!==null&&n.set("cursor_contacted_at",this.lastCursor.contacted_at),n.set("cursor_person_id",String(this.lastCursor.person_id)),`${this.endpoint}${t}${n.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.status===400)return"rejected";if(!(t.ok&&t.body))return this.logger.warn(`[ContactMapStream] unexpected response: ${t.status}`),this.setState({error:new Error(`[contact-map] the stream request failed (status ${t.status})`)}),"retryable";let n=t.body.getReader(),r=new TextDecoder,s="",a=!1,o=!1;for(;;){let{done:d,value:l}=await n.read();if(d)break;let c=r.decode(l,{stream:!0}),m=(s+c).split(`
|
|
2
|
-
`);s=m.pop()??"";let u=!1;for(let i of m){let p=i.trim();if(!p)continue;let f;try{f=JSON.parse(p)}catch(C){this.logger.warn("[ContactMapStream] failed to parse NDJSON line:",C);continue}if("type"in f&&f.type==="METADATA"){Number.isSafeInteger(f.total)&&f.total>=0&&this.setState({totalCount:f.total});continue}if(!Gs(f)){this.logger.warn("[ContactMapStream] server reported error:","error"in f?f.error:""),o=!0;continue}for(let C of f.records)C&&typeof C.person_id=="number"&&(this.recordMap.set(C.person_id,qs(C)),u=!0);f.nextCursor&&(this.lastCursor=f.nextCursor),f.isLast&&(a=!0)}u&&(this.consecutiveFailures=0,this.publishRecords({error:null}))}return o?(this.setState({error:new Error("Stream interrupted by server error")}),"retryable"):a?"complete":(this.setState({error:new Error("Stream ended before completion")}),"retryable")}catch(t){if(t instanceof Error&&t.name==="AbortError")return"aborted";let n=t instanceof Error?t:new Error(String(t));return this.setState({error:n}),"retryable"}finally{this.activeController=null}}};var Oe=null,Ys=e=>{if(Oe!==null&&Oe.endpoint===e)return Oe;if(In(e),Oe===null)return Oe=new An({endpoint:e}),Oe;if(Oe.endpoint!==e)throw new Error(`[contact-map] the stream client already streams from ${JSON.stringify(Oe.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 Oe},_c=()=>{Oe?.dispose(),Oe=null},Xs=new Map,Js={records:[],loadedCount:0,totalCount:null,isLoading:!0,isComplete:!1,phase:"idle",error:null},Zs=()=>{let{streamEndpoint:e}=Xe();return Fn(()=>(In(e),e),[e])};function ei(){let e=Zs(),t=Da(()=>Ys(e),[e]);Qs(()=>{let o=t();o.start(),o.retryNow()},[t]);let n=Da(o=>t().subscribe(o),[t]),r=Er(n,()=>t().getState(),()=>Js),s=Er(n,()=>t().getRecordMap(),()=>Xs),a=Da(()=>t().retryNow(),[t]);return Fn(()=>({...r,recordMap:s,retryNow:a}),[r,s,a])}var ti=e=>{let t=new Set;for(let{company_name:n}of e)typeof n=="string"&&n.trim().length>0&&t.add(n);return t.size};function zn(){let{records:e,recordMap:t,isComplete:n,phase:r,loadedCount:s,totalCount:a,error:o,retryNow:d}=ei(),l=Fn(()=>ti(e),[e]);return{context:Fn(()=>({contactMapRecords:e,contactMapRecordMap:t,isStreamingComplete:n,isStreamingFailed:r==="failed",streamPhase:r,loadedCount:s,companyCount:l,totalCount:a,errorMessage:o?.message??null}),[e,t,n,r,s,l,a,o]),retryNow:d}}ie();import{DEFAULT_FUZZY_SEARCH_OPTIONS as Nl,parseQuerySets as Ml}from"@aiquants/fuzzy-search";import{useFuzzySearch as Pl}from"@aiquants/fuzzy-search/react";import Rl from"lucide-react/dist/esm/icons/search.js";import{useCallback as Bt,useEffect as Ze,useMemo as pt,useRef as fo,useState as We,useTransition as Ll}from"react";import{useNavigation as El,useSearchParams as Ol}from"react-router";Ta();Dt();import{useCallback as St,useEffect as ni,useRef as Or}from"react";var dt=e=>{let t=Or(null),n=Or({isPointerDown:!1,isDragging:!1,startX:0,scrollLeft:0,pointerId:0,hasCapture:!1,didDrag:!1,pointerType:""}),r=e?.dragThreshold??4,s=St(u=>{let i=u.currentTarget,p=u.deltaY;!i||p===0||(u.preventDefault(),i.scrollBy({left:p,behavior:"smooth"}))},[]),a=St(u=>{t.current?.removeEventListener("wheel",s),t.current=u,u?.addEventListener("wheel",s,{passive:!1})},[s]);ni(()=>()=>{t.current&&t.current.removeEventListener("wheel",s)},[s]);let o=St(u=>{if(u.pointerType==="touch")return;let i=n.current;i.isPointerDown=!0,i.isDragging=!1,i.startX=u.clientX,i.scrollLeft=u.currentTarget.scrollLeft,i.pointerId=u.pointerId,i.hasCapture=!1,i.pointerType=u.pointerType},[]),d=St(u=>{let i=n.current;if(!i.isPointerDown||i.pointerType==="touch")return;let p=u.currentTarget,f=u.clientX-i.startX;!i.isDragging&&Math.abs(f)>r&&(i.isDragging=!0,i.hasCapture||(p.setPointerCapture?.(u.pointerId),i.hasCapture=!0)),i.isDragging&&(u.preventDefault(),p.scrollLeft=i.scrollLeft-f)},[r]),l=St(u=>{let i=n.current;if(i.pointerType==="touch")return;let p=u.currentTarget;i.isPointerDown&&i.hasCapture&&p.hasPointerCapture?.(u.pointerId)&&p.releasePointerCapture(u.pointerId),i.isDragging&&(i.didDrag=!0,window.setTimeout(()=>{i.didDrag=!1},0)),i.isPointerDown=!1,i.isDragging=!1,i.pointerId=0,i.hasCapture=!1},[]),c=St(u=>{l(u)},[l]),m=St(u=>{n.current.didDrag&&(u.preventDefault(),u.stopPropagation(),n.current.didDrag=!1)},[]);return{setScrollableRef:a,onPointerDown:o,onPointerMove:d,onPointerUp:c,onPointerLeave:c,onPointerCancel:c,onClickCapture:m}};bt();ie();import{DEFAULT_FUZZY_SEARCH_OPTIONS as ai}from"@aiquants/fuzzy-search";var Bn=e=>{let{indexWorkerOptions:t,levenshteinWorkerOptions:n,...r}=ai;return{...r,autoSearchOnIndexRebuild:!1,multiTermOperator:"and",workerUrls:e,indexWorkerOptions:{...t},levenshteinWorkerOptions:{...n}}};import{jsx as Dr}from"react/jsx-runtime";function Wr({value:e,max:t=100,className:n,indicatorClassName:r,...s}){let a=e===void 0,o=a?0:Math.min(100,Math.max(0,e/t*100));return Dr("div",{role:"progressbar","aria-valuenow":a?void 0:o,"aria-valuemin":0,"aria-valuemax":100,"data-slot":"progress",className:vt("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",n),...s,children:Dr("div",{"data-slot":"progress-indicator",className:vt("h-full rounded-full bg-primary transition-[width] duration-300 ease-in-out will-change-transform",a&&"w-1/3 animate-progress-indeterminate",r),style:a?void 0:{width:`${o}%`}})})}import{useCallback as pl,useState as ml}from"react";import{useSearchParams as gl}from"react-router";ie();ft();import{Panel as Br,PanelGroup as yi,PanelResizeHandle as bi}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 Je,useEffect as Vr,useLayoutEffect as Kr,useMemo as on,useRef as sn,useState as jn}from"react";var nn={listPanelMinWidth:320,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35},an={listPanelMinWidth:280,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35};function Un(e){let t=e.listPanelMinWidth+e.detailPanelMinWidth+e.handleThickness+e.listPaddingAndBorder+e.detailPaddingAndBorder,n=t+e.scrollbarSafetyBuffer,r=n+e.hysteresisSafetyMargin,s=r-n;return{physicalMinWidth:t,collapseThreshold:n,expandThreshold:r,hysteresisWidth:s}}import{useCallback as ri,useEffect as oi,useState as si}from"react";var Hr=(e,t)=>{let{enableMutationObserver:n=!1,bottomGap:r=4,minFallbackHeight:s=240}=t??{},[a,o]=si(600),d=ri(()=>{if(typeof window>"u")return;let l=e.current;if(!l||l.offsetParent===null&&window.getComputedStyle(l).position!=="fixed")return;let c=b=>Number.parseFloat(b)||0,{top:m}=l.getBoundingClientRect(),u=l.parentElement?.getBoundingClientRect(),i=window.getComputedStyle(document.documentElement),p=c(i.getPropertyValue("--footer-height")),f=c(i.getPropertyValue("--header-height")),C=c(i.getPropertyValue("--scrollbar-height")),v=window.getComputedStyle(l),k=c(v.marginBottom),I=c(v.paddingBottom),E=window.innerHeight-p-C-r,y=u?Math.min(u.bottom,E):E,g=u?Math.max(u.top,f):f,A=Math.max(m,g),B=y-A-k-I,x=Number.isFinite(B)?Math.floor(B):0,h=x>0?x:s;h>0&&Number.isFinite(h)&&o(b=>Math.abs(b-h)>1?h:b)},[r,e,s]);return oi(()=>{if(typeof window>"u")return;let l=null,c=null,m=null,u=null,i=()=>{l!==null&&window.cancelAnimationFrame(l),l=window.requestAnimationFrame(()=>{d()})};i(),c=window.setTimeout(()=>{i()},150);let p=e.current;return typeof ResizeObserver<"u"&&p&&(m=new ResizeObserver(()=>{i()}),m.observe(p),p.parentElement&&m.observe(p.parentElement)),n&&typeof MutationObserver<"u"&&(u=new MutationObserver(()=>{i()}),u.observe(document.body,{attributes:!0,childList:!0,subtree:!0})),window.addEventListener("resize",i),()=>{l!==null&&window.cancelAnimationFrame(l),c!==null&&window.clearTimeout(c),m&&m.disconnect(),u&&u.disconnect(),window.removeEventListener("resize",i)}},[e,n,d]),{viewportHeight:a,updateViewportHeight:d}};import{useCallback as ct,useEffect as _r,useRef as rn,useState as Ar}from"react";var ii=600,Ir=8,$n=({ref:e,onSelect:t,resolveItem:n,item:r})=>{let[s,a]=Ar(!1),[o,d]=Ar(null),l=rn(null),c=rn(!1),m=rn(!1),u=rn(null),i=rn({onSelect:t,resolveItem:n,item:r});_r(()=>{i.current={onSelect:t,resolveItem:n,item:r}},[t,n,r]);let p=ct(()=>{typeof window>"u"||l.current!==null&&(window.clearTimeout(l.current),l.current=null)},[]),f=ct(()=>{u.current&&(p(),m.current=!1,u.current=null)},[p]),C=ct(g=>{typeof window>"u"||g.button!==0&&g.pointerType==="mouse"||(p(),m.current=!1,c.current=!1,u.current={x:g.clientX,y:g.clientY,pointerId:g.pointerId},l.current=window.setTimeout(()=>{let A=i.current,B=null;A.item!==void 0?B=A.item:A.resolveItem&&g.target&&(B=A.resolveItem(g.target)),B!==null&&(c.current=!0,A.onSelect?.(B),d(B),a(!0)),f()},ii))},[p,f]),v=ct(g=>{u.current&&g.pointerId===u.current.pointerId&&(p(),u.current=null,m.current=!1)},[p]),k=ct(g=>{c.current&&(g.preventDefault(),g.stopPropagation(),c.current=!1)},[]),I=ct(g=>{if(!u.current||g.pointerId!==u.current.pointerId)return;let A=Math.abs(g.clientX-u.current.x),B=Math.abs(g.clientY-u.current.y);(A>Ir||B>Ir)&&(p(),u.current=null)},[p]),E=ct(g=>{(s||l.current!==null)&&(g.preventDefault(),g.stopPropagation())},[s]),y=ct(g=>{g?.cancelLongPressTimer&&p(),g?.suppressLongPress&&(m.current=!0),a(!1),d(null),c.current=!1,u.current=null},[p]);return _r(()=>{let g=e.current;if(!(g&&typeof window<"u"))return;let A=[["pointerdown",C,void 0],["pointerup",v,void 0],["pointercancel",v,void 0],["pointermove",I,void 0],["pointerleave",v,void 0],["click",k,!0],["contextmenu",E,void 0]],B=[["contextmenu",E,!0],["pointerup",v,!0],["pointercancel",v,!0]];for(let[x,h,b]of A)g.addEventListener(x,h,b);for(let[x,h,b]of B)window.addEventListener(x,h,b);return()=>{for(let[x,h,b]of A)g.removeEventListener(x,h,b);for(let[x,h,b]of B)window.removeEventListener(x,h,b);p()}},[e,C,v,I,k,E,p]),{isPopupVisible:s,popupItem:o,handleClosePopup:y}};import{useCallback as li,useEffect as di,useState as Fr,useSyncExternalStore as ci}from"react";function Vn(e,t,n){let r=n?.mediaQuery??"(min-width: 1024px)",s=ci(li(m=>{if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};let u=window.matchMedia(r);return u.addEventListener("change",m),()=>u.removeEventListener("change",m)},[r]),()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(r).matches:!0,()=>!1),[a,o]=Fr(!1),[d,l]=Fr(0);return di(()=>{if(typeof window>"u"||typeof ResizeObserver>"u")return;let m=e.current;if(!m)return;let u=new ResizeObserver(i=>{for(let p of i){if(p.target!==m)continue;let f=0;p.borderBoxSize&&p.borderBoxSize.length>0?f=p.borderBoxSize[0].inlineSize:f=p.contentRect.width,!(!Number.isFinite(f)||f<=0)&&(l(f),o(C=>C&&f>=t.expandThreshold?!1:!C&&f<t.collapseThreshold?!0:C))}});return u.observe(m),()=>u.disconnect()},[e,t.collapseThreshold,t.expandThreshold]),{isTwoColumn:s&&!a,isContainerNarrow:a,isMediaMatches:s,containerWidth:d}}ie();ie();fa();import{useSwipeToDismissOverlay as ui,useTapClick as pi}from"@aiquants/swipe-overlay";import{useCallback as mi,useEffect as gi,useRef as hi}from"react";import{jsx as zr,jsxs as fi}from"react/jsx-runtime";var Kn=({isOpen:e,onClose:t,children:n,className:r="",title:s})=>{let a=G(),o=hi(null),{overlayRef:d,overlayStyle:l,attemptClose:c}=ui({isOpen:e,onClose:t,isCloseBlocked:mi(()=>!1,[]),skipWhenTextSelected:!0}),m=pi(()=>c());return gi(()=>{!e&&o.current?.contains(document.activeElement)&&document.activeElement.blur()},[e]),e?fi("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, 0px)",transition:"right 0.5s, visibility 0.2s"},"aria-hidden":!e,children:[zr("button",{type:"button","aria-label":a.overlayBackdrop,className:`absolute inset-0 touch-manipulation bg-slate-900/50 transition-opacity duration-200 focus:outline-none ${e?"opacity-100":"opacity-0"}`,...m}),zr("aside",{role:"dialog","aria-modal":"true","aria-label":s===void 0?a.overlayTitle:s,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 ${r}`,onKeyDown:u=>{u.key==="Escape"&&!Nn(u.nativeEvent)&&(u.stopPropagation(),c())},children:n})]}):null};ka();import{Fragment as Ai,jsx as H,jsxs as Ce}from"react/jsx-runtime";var Ti=Ci(async()=>({default:(await Promise.resolve().then(()=>(Cr(),vr))).default})),jr=64,Ur="h-[64px]",$r=240,wi=4,Wa=Un(nn),Ni=nn.listPanelMinWidth,Mi=nn.detailPanelMinWidth,Pi=nn.handleThickness,fu=Wa.collapseThreshold,yu=Wa.expandThreshold,Ri=({contactData:e})=>{let t=G(),n=Re(e?.full_name)??t.noName,r=Re(e?.title)??"-",s=Re(e?.company_name)??"-",a=Re(e?.department)??"-",o=Rt(e).value??"-",d=Lt(e).value??"-",l=Ie(e?.updated_at,t.recordDateTime);return H(Pn,{fullName:n,title:r,companyName:s,department:a,phoneNumber:d,email:o,updatedAtText:l})},Li=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 n of e){let r=kn(n);if(r?.person_id===t)return r}return null},Ha=(e,t,n)=>{let{viewportHeight:r}=Hr(t,{enableMutationObserver:!0,bottomGap:wi,minFallbackHeight:$r}),[s,a]=jn(0),o=Je(()=>{let u=n.current,i=t.current;if(!(u&&i))return;let p=u.getBoundingClientRect(),f=i.getBoundingClientRect(),C=Math.ceil(f.top-p.top);Number.isFinite(C)&&C>0&&a(v=>Math.abs(v-C)>1?C:v)},[t,n]);Kr(()=>{if(!e)return;o();let u=requestAnimationFrame(o);return window.addEventListener("resize",o),()=>{cancelAnimationFrame(u),window.removeEventListener("resize",o)}},[e,o]);let d=r>0?r:$r,l=s>0?s:0,c=d+l,m=on(()=>Li(c),[c]);return{normalizedViewportHeight:d,normalizedDetailHeight:c,panelSizingStyle:m}},Wi=new Set,Hi=()=>{let[e,t]=jn(Wi),n=Je((r,s)=>{t(a=>{if(a.has(r)===s)return a;let o=new Set(a);return s?o.add(r):o.delete(r),o})},[]);return{isAnyPopupVisible:e.size>0,handlePopupVisibilityChange:n}},_i=(e,t,n)=>{let r=sn(n);Kr(()=>{r.current=n},[n]),Vr(()=>{if(e!==null)return r.current(e,t),()=>{r.current(e,!1)}},[e,t])},qr=ki(({entry:e,index:t,selectedPersonId:n,onSelect:r,searchQuery:s,enableHighlighting:a,openEmailsWithGmail:o,openGmailCompose:d,onPopupVisibilityChange:l})=>{let c=G(),m=sn(null),u=H("div",{className:Ur}),i=Ei(e)?e:null,p=kn(e),{isPopupVisible:f,handleClosePopup:C}=$n({ref:m,onSelect:r,item:p?.person_id});if(_i(p?.person_id??null,f,l),!e||!p)return u;let{person_id:v}=p,k=n===v,I=t%2===0?"bg-white dark:bg-slate-900":"bg-gray-50 dark:bg-slate-900/70",y=k?"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":I,g=["B","F"].map(A=>Oi(A,A==="B"?i?.baseScore:i?.score)).filter(Boolean);return Ce("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 ${y}`,style:{height:jr},role:"button","aria-pressed":k,"data-selected":k?"true":"false",onClick:()=>r(v),children:[Ce("div",{className:"hidden w-28 shrink-0 flex-col items-center gap-0.5 text-center sm:flex",children:[H("div",{className:"whitespace-nowrap font-medium text-slate-700 text-xs leading-tight dark:text-slate-200",children:c.listRowNumber(t+1)}),H("div",{className:"truncate text-[11px] text-slate-700 leading-tight dark:text-slate-200",children:v}),H("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(A=>H("span",{children:A},A)):H("span",{children:"-"})})]}),H(Si,{fallback:H(Ri,{contactData:p}),children:H(Ti,{contactData:p,searchTerm:s,enableHighlighting:a,openEmailsWithGmail:o,openGmailCompose:d,isPopupVisible:f,onRequestClose:C})})]})});qr.displayName="ContactListRow";var Gr=({context:e})=>{let{contactMapRecords:t,filteredItems:n,searchQuery:r,hasSearchTerm:s,enableHighlighting:a,openEmailsWithGmail:o,isSearchTabActive:d}=e,{locale:l,labels:c,engineLabels:m}=ye(),u=sn(null),i=sn(null),[p,f]=jn(null),{normalizedViewportHeight:C,panelSizingStyle:v}=Ha(d,i,u),{isAnyPopupVisible:k,handlePopupVisibilityChange:I}=Hi(),E=on(()=>({enablePointerDrag:!k,enableKeyboardNavigation:!k}),[k]),y=on(()=>s?n:t,[s,n,t]),g=Je(se=>{f(se)},[]),A=Je(se=>{if(!o)return;let Se=se.trim();if(!Se||Se==="-"||typeof window>"u")return;let mt=qe(Se,!0);mt&&window.open(mt,"_blank","noopener,noreferrer")},[o]),[B,x]=jn(!1),h=Je(se=>{g(se),x(!0)},[g]),b=Je((se,Se)=>H(qr,{entry:se,index:Se,selectedPersonId:p,onSelect:h,searchQuery:r,enableHighlighting:a,openEmailsWithGmail:o,openGmailCompose:A,onPopupVisibilityChange:I}),[p,h,r,a,o,A,I]),D=Je(se=>y[se],[y]),S=Je(se=>kn(y[se])?.person_id??`row-${se}`,[y]),te=Je(()=>jr,[]),w=y.length,N=on(()=>({enabled:!0,renderVisual:xi}),[]),O=on(()=>p===null?null:Di(y,p),[p,y]);Vr(()=>{p!==null&&!O&&f(null)},[p,O]);let U=sn(null),{isTwoColumn:re}=Vn(U,Wa),pe=Ce("div",{ref:u,className:"flex min-h-0 flex-1 flex-col gap-1",children:[H("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:Ce("div",{className:"flex items-center",children:[Ce("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:[H("span",{className:"font-semibold text-slate-900 text-xs dark:text-slate-100",children:c.columnNo}),H("span",{className:"leading-tight",children:c.columnId}),H("span",{className:"whitespace-nowrap leading-tight",children:c.columnScore})]}),Ce("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:[Ce("div",{className:"flex flex-col gap-0.5",children:[H("span",{children:c.columnName}),H("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:c.columnTitle})]}),Ce("div",{className:"flex flex-col gap-0.5",children:[H("span",{children:c.columnCompany}),H("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:c.columnDepartment})]}),Ce("div",{className:"flex flex-col gap-0.5",children:[H("span",{children:c.columnPhone}),H("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:c.columnEmail})]}),H("div",{className:"hidden items-end justify-end xl:flex",children:H("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:c.columnUpdatedAt})})]})]})}),H("div",{ref:i,className:"flex-1",children:H(vi,{itemCount:w,getItemKey:S,behaviorOptions:E,getItem:D,getItemHeight:te,viewportSize:C,overscanCount:10,scrollBarOptions:{width:8,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:N},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:(se,Se)=>b(se,Se)})}),n.length===0&&s?H("div",{className:"py-8 text-center",children:H("p",{className:"text-slate-600 dark:text-slate-300",children:c.listNoSearchResults})}):null,w===0&&!s?H("div",{className:"py-8 text-center",children:H("p",{className:"text-slate-600 dark:text-slate-300",children:c.listNoData})}):null]});return H("div",{ref:U,"data-testid":"contact-map-list-root",className:"flex min-h-0 flex-1 flex-col",style:v,children:re?Ce(yi,{id:"contact-map-list-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-list-panel-group",children:[H(Br,{id:"contact-map-list-pane",defaultSize:{value:68,unit:"percentage"},minSize:{value:Ni,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:pe}),H(bi,{id:"contact-map-list-handle",thickness:Pi,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":c.listResizeHandle}),H(Br,{id:"contact-map-list-detail-pane",defaultSize:{value:32,unit:"percentage"},minSize:{value:Mi,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:H(lt,{contact:O,searchTerm:r,enableHighlighting:a})})]}):Ce(Ai,{children:[pe,H("div",{className:"hidden","aria-hidden":"true",children:H(lt,{contact:O,searchTerm:r,enableHighlighting:a})}),O?H(Kn,{isOpen:B,onClose:()=>x(!1),className:"z-50 bg-white dark:bg-slate-900",children:Ce("div",{className:"flex h-full flex-col overflow-hidden p-3 sm:p-4",children:[Ce("div",{className:"mb-2 flex items-center justify-between border-b pr-10 pb-2 dark:border-slate-700",children:[H("h3",{className:"font-semibold text-slate-900 text-sm dark:text-slate-100",children:c.detailHeading}),H("button",{type:"button",onClick:()=>x(!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:c.close})]}),H("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",style:{height:"100%"},children:H(lt,{contact:O,searchTerm:r,enableHighlighting:a})})]})}):null]})})};ft();import{DirectoryTree as Gi}from"@aiquants/directory-tree";import{Panel as to,PanelGroup as Qi,PanelResizeHandle as Yi}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as Xi}from"@aiquants/virtualscroll";import Ji from"@heroicons/react/24/solid/FolderMinusIcon.js";import Zi from"@heroicons/react/24/solid/FolderPlusIcon.js";import{useCallback as Ue,useEffect as wt,useMemo as De,useRef as Yn,useState as ut}from"react";import{createPortal as el}from"react-dom";var _a=(e,t)=>e&&e.trim()||t;import{useEffect as Ii,useRef as qn,useState as Fi}from"react";var Qr=(e,t=250)=>{let[n,r]=Fi(e),s=qn(null),a=qn(e),o=qn(null),d=qn(!1);return Ii(()=>{if(!d.current){d.current=!0,r(e),a.current=e;return}a.current=n,s.current=null;let l=c=>{s.current??(s.current=c);let m=c-s.current,u=Math.min(1,Math.max(0,m/t)),i=1-(1-u)**3,p=Math.max(0,Math.round(a.current+(e-a.current)*i));r(p),u<1&&(o.current=requestAnimationFrame(l))};return o.current=requestAnimationFrame(l),()=>{o.current!==null&&cancelAnimationFrame(o.current)}},[e,t]),Math.max(0,n)};Et();import{useCallback as Aa,useEffect as Ia,useMemo as Yr,useRef as zi,useSyncExternalStore as Bi}from"react";ie();var Ui=250,$i=4e3,Gn=3,Xr={treeWorkerFactory:"the view remounts","workerUrls.treeWorker":"the page reloads"},Jr=(e,t)=>e.uncategorizedCompany===t.uncategorizedCompany&&e.unnamedPerson===t.unnamedPerson,Qn=class{constructor(t,{workerSource:n,logger:r=Be}){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 n=t.data;n.type!=="TREE_CHUNK"||n.generation!==this.generation||n.uniquePersonCount===0&&this.postedCount>0&&(this.latestSnapshot?.uniquePersonCount??0)>0||this.latestSnapshot!==null&&n.uniquePersonCount<this.latestSnapshot.uniquePersonCount&&!(n.isIdle&&n.consumedRecords>=this.postedCount)||(n.isIdle&&n.consumedRecords>=this.postedCount&&(this.consecutiveFailures=0),this.latestSnapshot={tree:n.tree,directoryPaths:n.directoryPaths,consumedRecords:n.consumedRecords,uniquePersonCount:n.uniquePersonCount,isIdle:n.isIdle,rebuildEpoch:n.rebuildEpoch},this.updateState())};this.handleFailure=t=>{if(this.worker?.terminate(),this.worker=null,this.postedCount=0,this.consecutiveFailures+=1,this.updateState(),this.consecutiveFailures>=Gn){this.logger.error(`[TreeWorker] the tree Worker failed ${Gn} times in a row; the tree stops updating until ${Xr[this.workerSource]} (check ${this.workerSource})`,t);return}let n=Math.min(Ui*2**(this.consecutiveFailures-1),$i);this.logger.warn(`[TreeWorker] the tree Worker failed; retrying in ${n}ms (failure ${this.consecutiveFailures} of ${Gn})`,t),this.retryTimer!==null&&clearTimeout(this.retryTimer),this.retryTimer=setTimeout(()=>{this.retryTimer=null;let r=this.lastSyncedNaming;r!==null&&this.syncRecords(this.lastSyncedRecords,r)},n)};if(typeof n!="string")throw new TypeError(`[contact-map] TreeWorkerSession workerSource must be a string; got ${oe(n)}`);if(!Object.hasOwn(Xr,n))throw new RangeError(`[contact-map] TreeWorkerSession workerSource must be "treeWorkerFactory" or "workerUrls.treeWorker"; got ${oe(n)}`);this.workerFactory=t,this.workerSource=n,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>=Gn||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,n){this.finalizeRequest!==null&&(t.length<this.finalizeRequest.recordCount||this.finalizeRequest.naming===null||!Jr(this.finalizeRequest.naming,n))&&(this.finalizeRequest=null),this.lastSyncedRecords=t,this.lastSyncedNaming=n;let r=this.ensureWorker();if(!r)return;let s=this.workerNeedsReset,a=this.postedNaming===null||!Jr(this.postedNaming,n);if((this.workerNeedsReset||a||t.length<this.postedCount)&&(this.generation+=1,this.postedCount=0,this.finalizedPostedCount=null,this.workerNeedsReset=!1,this.postedNaming=n,r.postMessage({type:"RESET_TREE",generation:this.generation,epochBase:this.latestSnapshot?.rebuildEpoch??0,naming:n}),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}}},Vi=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)")},Tt=null,Zr=e=>e===void 0?"the bundled Worker file (workerUrls.treeWorker unset)":JSON.stringify(e),Ki=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},ji=e=>{if(Mr(e),Tt===null){let t=new Qn(()=>Vi(e),{workerSource:"workerUrls.treeWorker"});return Tt={session:t,workerUrl:e},t}if(Tt.workerUrl!==e)throw new Error(`[contact-map] the tree session already loads its Worker from ${Zr(Tt.workerUrl)} and cannot also load it from ${Zr(e)}; give every contact-map view in the browser tab the same workerUrls.treeWorker, on every route (after changing it, reload the page)`);return Tt.session},Ru=()=>{Tt?.session.reset(),Tt=null},qi={snapshot:null,isBuilding:!1};function eo(e,t=!1){let n=Xe(),r=n.treeWorkerFactory,s=n.workerUrls?.treeWorker,{labels:a}=ye(),o=a.uncategorizedCompany,d=a.noName,l=Yr(()=>({uncategorizedCompany:o,unnamedPerson:d}),[o,d]),c=zi(r);Ia(()=>{c.current=r},[r]);let m=r!==void 0,u=m?void 0:s,i=Yr(()=>m?new Qn(()=>Ki(c.current)(),{workerSource:"treeWorkerFactory"}):null,[m]),p=Aa(()=>i===null?ji(u):i,[i,u]),f=Aa(v=>p().subscribe(v),[p]),C=Aa(()=>p().getState(),[p]);return Ia(()=>{let v=p();v.syncRecords(e,l),t&&v.finalize()},[p,e,t,l]),Ia(()=>{if(i!==null)return()=>i.stop()},[i]),Bi(f,C,()=>qi)}ie();Ca();En();import{Fragment as ul,jsx as _,jsxs as me}from"react/jsx-runtime";var Ba=Un(an),tl=an.listPanelMinWidth,nl=an.detailPanelMinWidth,al=an.handleThickness,Ju=Ba.collapseThreshold,Zu=Ba.expandThreshold,rl=(e,t)=>{let{searchQuery:n,enableHighlighting:r}=t,s=_a(e.full_name,t.noName),a=_a(e.title,""),o=_(ue,{text:s,query:n,enabled:r});return a?me("span",{className:"flex items-center gap-1.5",children:[_("span",{children:o}),_("span",{className:"text-slate-400 text-xs dark:text-slate-500",children:_(ue,{text:a,query:n,enabled:r})})]}):o},ol="contact-map-tree h-full w-full",sl={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"},Fa="h-4 w-4 shrink-0 transition-colors duration-150",il=(e,t,n)=>({...e,viewportHeightOverride:t,behaviorOptions:{...e.behaviorOptions,enablePointerDrag:!n}}),Xn=null,no=null,ln=new Map,ao="",ro=null,oo=null,ll=(e,t,n,r,s)=>{let a=`${n?"icons":"plain"}#${r}#${s.noName}`;(a!==ao||s.formatDirectoryName!==ro||t!==oo)&&(ln.clear(),ao=a,ro=s.formatDirectoryName,oo=t);let o={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 c=`${l.name}\0${l.memberCount}`,m=ln.get(l.absolutePath);(!m||m.signature!==c)&&(m={signature:c,result:io([l],t,n,{searchQuery:"",enableHighlighting:!1,noName:s.noName,formatDirectoryName:s.formatDirectoryName})},ln.set(l.absolutePath,m));let u=m.result;u.entries.length>0&&o.entries.push(u.entries[0]);for(let[i,p]of u.personPathMap){let f=o.personPathMap.get(i);if(f)for(let C of p)f.add(C);else o.personPathMap.set(i,new Set(p))}for(let[i,p]of u.contactByPath)o.contactByPath.set(i,p);for(let[i,p]of u.ancestorsByPath)o.ancestorsByPath.set(i,p);o.totalCount+=u.totalCount,!o.firstPerson&&u.firstPerson&&(o.firstPerson=u.firstPerson)}for(let l of ln.keys())d.has(l)||ln.delete(l);return o},za=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",so=e=>{let t=[];for(let n of e)n.type==="directory"&&(t.push(n.absolutePath),n.children&&t.push(...so(n.children)));return t},dl=e=>{if(e.memberCount===void 0)throw new Error(`[contact-map] directory entry ${e.absolutePath} has no memberCount`);return e.memberCount},io=(e,t,n,r,s)=>{let a=new Map,o=new Map,d=new Map,l=0,c=null,m=(i,p)=>{let f=[...p,i.absolutePath];d.set(i.absolutePath,f);let C,v,k=i.type==="directory"?r.formatDirectoryName(i.name,dl(i)):i.name,I=_(ue,{text:k,query:r.searchQuery,enabled:r.enableHighlighting});if(i.type==="file"&&i.personId){if(s&&!s.has(i.personId))return null;let E=t.get(i.personId);if(E){o.set(i.absolutePath,E),a.has(i.personId)||a.set(i.personId,new Set);let y=a.get(i.personId);y&&y.add(i.absolutePath),l++,c||(c={personId:i.personId,path:i.absolutePath}),n&&(v=g=>{let A=za(g);return g.isSelected||g.isItemSelected||i.isPrimary&&(A=i.title?"text-indigo-600 dark:text-indigo-400":"text-orange-500 dark:text-orange-400"),_(n.person,{"aria-hidden":"true",className:`${Fa} ${A}`})},i.title&&(I=rl(E,r))),I=_("span",{"data-contact-path":i.absolutePath,className:"block w-full",children:I})}}else if(i.children){let E=i.children.map(y=>m(y,f)).filter(y=>y!==null);if(s&&E.length===0)return null;if(C=E,n){let y=i.relativePath.startsWith("company:")?n.company:n.department;v=g=>_(y,{"aria-hidden":"true",className:`${Fa} ${za(g)}`})}}return{name:k,label:I,type:i.type,absolutePath:i.absolutePath,relativePath:i.relativePath,icon:v,children:C}};return{entries:e.map(i=>m(i,[])).filter(i=>i!==null),personPathMap:a,contactByPath:o,ancestorsByPath:d,firstPerson:c,totalCount:l}},cl=(e,t,n)=>{let r=new Set,s=new Set,a=new Map;t.forEach((m,u)=>{a.set(m.item.person_id,u)});for(let m of t){let u=m.item.person_id,i=e.personPathMap.get(u);if(i)for(let p of i){r.add(p);let f=e.ancestorsByPath.get(p);if(f){for(let C of f)r.add(C);n&&f.length>0&&s.add(f[0])}}}let o=new Map,d=m=>{let u=o.get(m.absolutePath);if(u!==void 0)return u;let i=1/0;if(m.type==="file"){let p=e.contactByPath.get(m.absolutePath);p&&(i=a.get(p.person_id)??1/0)}else if(m.children)for(let p of m.children)i=Math.min(i,d(p));return o.set(m.absolutePath,i),i},l=(m,u=0)=>m.filter(i=>n&&u===0&&s.has(i.absolutePath)?!0:r.has(i.absolutePath)).map(i=>n&&u===0&&s.has(i.absolutePath)?i:i.type==="directory"&&i.children?{...i,children:l(i.children,u+1)}:i).sort((i,p)=>u===0?d(i)-d(p):0),c=l(e.entries);return{...e,entries:c}},lo=({context:e,controlsContainer:t})=>{let{contactMapRecords:n,contactMapRecordMap:r,filteredItems:s,hasSearchTerm:a,isSearchInProgress:o,isSearchTabActive:d}=e,{locale:l,labels:c,treeLabels:m}=ye(),u=c.noName,i=c.treeDirectoryName,p=De(()=>({noName:u,formatDirectoryName:i}),[u,i]),[f,C]=ut(null),[v,k]=ut(!1),{snapshot:I,isBuilding:E}=eo(n,e.isStreamingComplete),y=I?.tree??null,g=I?.rebuildEpoch??0,A=De(()=>y?ll(y,r,f,g,p):null,[y,r,f,g,p]),B=De(()=>{if(!y)return null;if(!a)return A;let R;v||(R=new Set(s.map(Y=>Y.item.person_id)));let $=io(y,r,f,{...p,searchQuery:e.searchQuery,enableHighlighting:e.enableHighlighting},R);return cl($,s,v)},[y,A,r,f,e.searchQuery,e.enableHighlighting,a,s,v,p]),x=De(()=>B||{entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},[B]),h=a&&e.errorMessage!==null,[b,D]=ut(x),S=Yn(!1);wt(()=>{if(!(o||h)){S.current=!!y,D(x);return}!S.current&&y&&x.entries.length>0&&(S.current=!0,D(x))},[x,y,o,h]);let te=a&&(o||h)?b:x,{entries:w,personPathMap:N,contactByPath:O,totalCount:U}=te,re=De(()=>so(w),[w]),[pe,se]=ut(()=>no??new Set),Se=Ue(R=>!pe.has(R),[pe]),mt=Ue(R=>{se($=>{let Y=new Set($);return Y.has(R)?Y.delete(R):Y.add(R),Y})},[]),Nt=Ue(R=>{R.length!==0&&se($=>{let Y=new Set($);for(let Te of R)Y.add(Te);return Y})},[]),cn=Ue(R=>{se($=>{if($.size===0)return $;let Y=!1,Te=new Set($);for(let F of R)Te.delete(F)&&(Y=!0);return Y?Te:$})},[]);wt(()=>{no=pe},[pe]),wt(()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem("contact-map.tree-expanded")}catch{}},[]);let[le,$t]=ut(null),[xe,et]=ut(null),[un,Ke]=ut(!1),[Zn,pn]=ut(!1),mn=Yn(null),Vt=Yn(null),{normalizedViewportHeight:ne,panelSizingStyle:gn}=Ha(d,Vt,mn),tt=Ue(R=>{let $=O.get(R);$&&(le!==$.person_id&&$t($.person_id),R!==xe&&et(R),Ke(!0))},[O,xe,le]),Kt=Ue(R=>{tt(R.entry.absolutePath)},[tt]),nt=Ue(R=>R instanceof Element?R.closest("[data-contact-path]")?.getAttribute("data-contact-path")??null:null,[]),{isPopupVisible:ve,popupItem:jt,handleClosePopup:qt}=$n({ref:Vt,resolveItem:nt,onSelect:tt}),He=Ue(R=>{if(!e.openEmailsWithGmail)return;let $=R.trim();if(!$||$==="-"||typeof window>"u")return;let Y=qe($,!0);Y&&window.open(Y,"_blank","noopener,noreferrer")},[e.openEmailsWithGmail]),at=jt?O.get(jt):null,_e=ve&&at!==null&&at!==void 0;wt(()=>{ve&&!at&&qt()},[ve,at,qt]);let gt=De(()=>({overscanCount:16,callbackThrottleMs:16,scrollBarOptions:{width:8,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:{enabled:!0,renderVisual:Xi}},behaviorOptions:{resetOnGetItemHeightChange:!1},preserveScrollAnchor:!0}),[]),rt=De(()=>il(gt,ne,_e),[gt,ne,_e]);wt(()=>{let R=!1;return typeof window>"u"?()=>{R=!0}:Xn?(C(Xn),()=>{R=!0}):((async()=>{try{let[Y,Te,F,V]=await Promise.all([import("lucide-react/dist/esm/icons/building-2.js"),import("lucide-react/dist/esm/icons/users-round.js"),import("lucide-react/dist/esm/icons/id-card.js"),import("lucide-react/dist/esm/icons/user-round.js")]);if(R)return;let ce=Y.default,Ae=Te.default,aa=F.default,Xa=V.default;ce&&Ae&&aa&&Xa&&(Xn={company:ce,department:Ae,title:aa,person:Xa},C(Xn))}catch(Y){Be.warn("Failed to load lucide icons",Y)}})(),()=>{R=!0})},[]);let ht=De(()=>{if(!f)return;let R=V=>ce=>_(V,{"aria-hidden":"true",className:`${Fa} ${za(ce)}`}),$={company:R(f.company),department:R(f.department),title:R(f.title)},Y=R(f.person),Te=V=>V in $,F=V=>{let[ce]=V.entry.relativePath.split(":",1);return(Te(ce)?$[ce]:$.company)(V)};return{directory:F,directoryExpanded:F,file:Y}},[f]),Mt=Ue(()=>{se(R=>R.size===0?R:new Set)},[]),ea=Ue(()=>{re.length>0&&Nt(re)},[re,Nt]);wt(()=>{if(typeof window>"u")return;let R=document.documentElement,$=window.matchMedia("(prefers-color-scheme: dark)"),Y=()=>pn(R.classList.contains("dark")||$.matches);Y(),$.addEventListener("change",Y);let Te=new MutationObserver(Y);return Te.observe(R,{attributes:!0,attributeFilter:["class"]}),()=>{$.removeEventListener("change",Y),Te.disconnect()}},[]),wt(()=>{if(U===0){le!==null&&$t(null),xe!==null&&et(null);return}if(le!==null){let R=N.get(le);if(R){if(xe&&R.has(xe))return;let $=R.values().next().value;$&&et($);return}}le!==null&&$t(null),xe!==null&&et(null)},[U,le,xe,N]);let ot=xe?O.get(xe)??null:null,je=Zn?"#475569":"#94A3B8",Gt=e.isStreamingComplete,ta=e.isStreamingFailed,hn=Gt&&n.length===0,fn=(E||!y)&&!hn,yn=Qr(U,250),st=y!==null||hn,Pt=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:c.treeNodeCountTitle,children:[_("span",{className:"text-[10px]",children:"\u{1F333}"})," ",c.treeNodeCountLabel," ",st?c.treeNodeCount(yn):"\u2026"]}),ta&&!Gt?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:c.treeStreamInterruptedTitle,children:[_("span",{className:"h-1.5 w-1.5 rounded-full bg-rose-500"}),_("span",{className:"text-[10px]",children:"\u26D4"})," ",c.treeStreamInterrupted]}):Gt?fn?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:c.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}"})," ",c.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:c.treeCompleteTitle,children:[_("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),_("span",{className:"text-[10px]",children:"\u2705"})," ",c.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:c.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"})," ",c.treeStreamLoading]}),a&&me("button",{type:"button",onClick:()=>k(!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:c.treeShowEntireCompanyTitle,children:[_("span",{className:"text-[10px]",children:"\u{1F3E2}"})," ",c.treeShowEntireCompany]}),re.length>0?me("div",{className:"flex items-center gap-1",children:[_("button",{type:"button",onClick:Mt,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":c.treeExpandAll,title:c.treeExpandAllTitle,children:_(Zi,{className:"h-3 w-3"})}),_("button",{type:"button",onClick:ea,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":c.treeCollapseAll,title:c.treeCollapseAllTitle,children:_(Ji,{className:"h-3 w-3"})})]}):null]}),bn=Yn(null),{isTwoColumn:xn}=Vn(bn,Ba,{mediaQuery:"(min-width: 768px)"}),vn=De(()=>({toggle:mt,isExpanded:Se,expandMultiple:cn,collapseMultiple:Nt,isPending:o}),[Nt,cn,Se,mt,o]),Cn=De(()=>({onEntryClick:Kt,selectedPath:xe}),[Kt,xe]),na=De(()=>({className:ol,lineColor:je,iconOverrides:ht,showDirectoryIcons:!!ht,showFileIcons:!!ht,highlightStyles:sl,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"}),[je,ht]),Qt=_("div",{ref:mn,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:Vt,className:"flex min-h-0 flex-1 flex-col overflow-hidden p-2",children:w.length>0?_(Gi,{entries:w,expansion:vn,selection:Cn,visual:na,virtualScroll:rt,locale:l,labels:m}):_("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:a?c.treeNoMatches:c.treeEmpty})})});return me("div",{ref:bn,"data-testid":"contact-map-tree-root",className:"flex min-h-0 flex-1 flex-col",style:gn,children:[t&&el(Pt,t),xn?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:[_(to,{id:"contact-map-tree-pane",defaultSize:{value:60,unit:"percentage"},minSize:{value:tl,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:Qt}),_(Yi,{id:"contact-map-tree-handle",thickness:al,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":c.treeResizeHandle}),_(to,{id:"contact-map-tree-detail-pane",defaultSize:{value:40,unit:"percentage"},minSize:{value:nl,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:_(lt,{contact:ot??null,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})})]}):me(ul,{children:[Qt,_("div",{className:"hidden","aria-hidden":"true",children:_(lt,{contact:ot,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})}),un&&ot?_(Kn,{isOpen:un,onClose:()=>Ke(!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:c.detailHeading}),_("button",{type:"button",onClick:()=>Ke(!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:c.close})]}),_("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",style:{height:"100%"},children:_(lt,{contact:ot,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})})]})}):null]}),_e&&at&&_(Mn,{contactData:at,openEmailsWithGmail:e.openEmailsWithGmail,openGmailCompose:He,onRequestClose:qt})]})};import{jsx as dn,jsxs as It}from"react/jsx-runtime";var Ua="view",hl={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},fl=e=>e==="tree"?"tree":"list",co=({context:e})=>{let t=G(),[n,r]=gl(),[s,a]=ml(null),o=fl(n.get(Ua)),{setScrollableRef:d,onPointerDown:l,onPointerMove:c,onPointerUp:m,onPointerLeave:u,onPointerCancel:i,onClickCapture:p}=dt(),f=pl(C=>{let v=C==="tree"?"tree":"list";if(v===o)return;let k=new URLSearchParams(typeof window<"u"?window.location.search:"");v==="list"?k.delete(Ua):k.set(Ua,v),r(k,{replace:!0})},[o,r]);return It("div",{"data-testid":"contact-map-search-tab-group",className:"flex h-full flex-1 flex-col",children:[It("div",{className:"mt-1 mb-1.5 flex shrink-0 items-center gap-2",children:[It("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:hl,onPointerDown:l,onPointerMove:c,onPointerUp:m,onPointerLeave:u,onPointerCancel:i,onClickCapture:p,children:[It("button",{type:"button","data-testid":"contact-map-tab-list",onClick:()=>f("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]}),It("button",{type:"button","data-testid":"contact-map-tab-tree",onClick:()=>f("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]})]}),dn("div",{ref:a,className:"flex items-center gap-1.5"})]}),It("div",{className:"flex h-full flex-1 flex-col",children:[dn("div",{className:`${o==="list"?"flex h-full flex-1 flex-col":"hidden"}`,children:o==="list"?dn(Gr,{context:e}):null}),dn("div",{className:`${o==="tree"?"flex h-full flex-1 flex-col":"hidden"}`,children:o==="tree"?dn(lo,{context:e,controlsContainer:s}):null})]})]})};import{memo as xl}from"react";ie();ie();import{DEFAULT_FUZZY_SEARCH_OPTIONS as z}from"@aiquants/fuzzy-search";import{memo as yl,useId as ke}from"react";import{jsx as L,jsxs as W}from"react/jsx-runtime";var $a=1e3,Va=yl(({searchOptions:e,setSearchOptions:t})=>{let n=G(),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",a=e.sortBy==="relevance",o=ke(),d=ke(),l=ke(),c=ke(),m=ke(),u=ke(),i=ke(),p=ke(),f=ke(),C=ke(),v=ke(),k=[];k.push(W("div",{className:`${r} border-green-200 border-l-4 dark:border-green-400/60`,children:[W("div",{className:`${s} text-green-700 dark:text-green-300`,children:["\u{1F3D7}\uFE0F ",n.indexBuildHeading]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:o,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexNgramSize}),L("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"}),W("span",{className:"text-green-600 text-xs dark:text-green-300",children:[n.currentValueLabel," ",e.ngramSize||z.ngramSize]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexNgramSizeHint})]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:d,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexMinNgramOverlap}),L("input",{id:d,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"}),W("span",{className:"text-green-600 text-xs dark:text-green-300",children:[n.currentValueLabel," ",e.minNgramOverlap||z.minNgramOverlap]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexMinNgramOverlapHint})]})]},"index-build")),k.push(W("div",{className:`${r} border-blue-200 border-l-4 dark:border-blue-500/60`,children:[W("div",{className:`${s} text-blue-700 dark:text-blue-300`,children:["\u{1F50D} ",n.indexCandidateHeading]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:l,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexThreshold}),L("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"}),W("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.threshold??z.indexWorkerOptions?.threshold]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexThresholdHint})]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:m,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexNgramOverlapThreshold}),L("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"}),W("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.ngramOverlapThreshold??z.indexWorkerOptions?.ngramOverlapThreshold]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexNgramOverlapThresholdHint})]})]},"candidate-control")),k.push(W("div",{className:`${r} border-cyan-200 border-l-4 dark:border-cyan-400/60`,children:[W("div",{className:`${s} text-cyan-700 dark:text-cyan-300`,children:["\u{1F9ED} ",n.indexStrategyHeading]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:c,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexStrategy}),W("select",{id:c,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:[L("option",{value:"fast",children:n.indexStrategyFast}),L("option",{value:"accurate",children:n.indexStrategyAccurate}),L("option",{value:"hybrid",children:n.indexStrategyHybrid})]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexStrategyHint})]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:u,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexMinCandidatesRatio}),L("input",{id:u,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"}),W("span",{className:"text-cyan-600 text-xs dark:text-cyan-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.minCandidatesRatio??z.indexWorkerOptions?.minCandidatesRatio]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexMinCandidatesRatioHint})]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:i,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexMaxCandidatesRatio}),L("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"}),W("span",{className:"text-cyan-600 text-xs dark:text-cyan-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.maxCandidatesRatio??z.indexWorkerOptions?.maxCandidatesRatio]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexMaxCandidatesRatioHint})]})]},"strategy")),k.push(W("div",{className:`${r} border-indigo-200 border-l-4 dark:border-indigo-500/60`,children:[W("div",{className:`${s} text-indigo-700 dark:text-indigo-300`,children:["\u{1F521} ",n.scoreTuningHeading]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:p,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexJaroWinklerPrefix}),L("input",{id:p,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"}),W("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.jaroWinklerPrefix??z.indexWorkerOptions?.jaroWinklerPrefix]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexJaroWinklerPrefixHint})]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:f,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.maxResults}),W("label",{className:"flex items-center gap-2 text-[11px] text-gray-600 dark:text-slate-300",children:[L("input",{type:"checkbox",checked:e.indexWorkerOptions?.maxResults===void 0,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxResults:y.target.checked?void 0:$a}}))}),n.noLimit]}),L("input",{id:f,type:"range",min:$a,max:"10000",step:"1000",disabled:e.indexWorkerOptions?.maxResults===void 0,value:e.indexWorkerOptions?.maxResults===void 0?$a:e.indexWorkerOptions.maxResults,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxResults:parseInt(y.target.value,10)}})),className:"w-full disabled:cursor-not-allowed"}),W("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.maxResults===void 0?n.noLimit:e.indexWorkerOptions.maxResults]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexMaxResultsHint})]})]},"jaro")),k.push(W("div",{className:`${r} border-emerald-200 border-l-4 ${a?"":"opacity-50"} dark:border-emerald-400/60`,children:[W("div",{className:`${s} text-emerald-700 dark:text-emerald-300`,children:["\u{1F3AF} ",n.relevanceWeightsHeading]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:C,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.fieldWeight}),L("input",{id:C,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:!a,className:"w-full disabled:cursor-not-allowed"}),W("span",{className:"text-emerald-600 text-xs dark:text-emerald-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.relevanceFieldWeight??z.indexWorkerOptions?.relevanceFieldWeight??.2]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexFieldWeightHint})]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:v,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexPerfectMatchBonus}),L("input",{id:v,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:!a,className:"w-full disabled:cursor-not-allowed"}),W("span",{className:"text-emerald-600 text-xs dark:text-emerald-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.relevancePerfectMatchBonus??z.indexWorkerOptions?.relevancePerfectMatchBonus??.1]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexPerfectMatchBonusHint})]}),!a&&L("p",{className:"text-[11px] text-emerald-600 dark:text-emerald-300",children:n.relevanceOnlyNotice})]},"relevance"));let I=ke(),E=ke();return k.push(W("div",{className:`${r} border-teal-200 border-l-4 dark:border-teal-400/60`,children:[W("div",{className:`${s} text-teal-700 dark:text-teal-300`,children:["\u{1F524} ",n.indexContainmentHeading]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:I,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexContainmentBase}),L("input",{id:I,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"}),W("span",{className:"text-teal-600 text-xs dark:text-teal-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.containmentScoreBase??z.indexWorkerOptions?.containmentScoreBase??.7]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexContainmentBaseHint})]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:E,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexContainmentCoverage}),L("input",{id:E,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"}),W("span",{className:"text-teal-600 text-xs dark:text-teal-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.containmentCoverageWeight??z.indexWorkerOptions?.containmentCoverageWeight??.3]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexContainmentCoverageHint})]})]},"containment")),W("section",{className:"space-y-3",children:[W("div",{className:"flex items-center justify-between gap-3",children:[W("div",{className:"flex items-center gap-2 font-semibold text-green-700 text-xs transition-colors dark:text-green-300",children:[L("span",{children:"\u{1F4CA}"}),L("span",{className:"tracking-wide",children:n.indexSettingsHeading})]}),L("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:void 0,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:n.resetToDefaultsTitle,children:n.reset})]}),L("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:k})]})});Va.displayName="IndexWorkerSettings";ie();import{DEFAULT_FUZZY_SEARCH_OPTIONS as ge}from"@aiquants/fuzzy-search";import{memo as bl,useId as Ft}from"react";import{jsx as ee,jsxs as ae}from"react/jsx-runtime";var Ka=1e3,ja=bl(({searchOptions:e,setSearchOptions:t})=>{let n=G(),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",a=e.sortBy==="relevance",o=Ft(),d=Ft(),l=Ft(),c=Ft(),m=Ft(),u=Ft(),i=[];return i.push(ae("div",{className:`${r} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[ae("div",{className:`${s} text-purple-700 dark:text-purple-300`,children:["\u{1F9EE} ",n.levenshteinCandidateHeading]}),ae("div",{className:"space-y-2",children:[ee("label",{htmlFor:o,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.levenshteinThreshold}),ee("input",{id:o,type:"range",min:"0.0",max:a?"1.5":"1.0",step:"0.05",value:e.levenshteinWorkerOptions?.threshold??ge.levenshteinWorkerOptions?.threshold,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,threshold:parseFloat(p.target.value)}})),className:"w-full"}),ae("span",{className:"text-purple-600 text-xs dark:text-purple-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.threshold??ge.levenshteinWorkerOptions?.threshold]}),ee("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a?n.levenshteinThresholdHintRelevance:n.levenshteinThresholdHint})]}),ae("div",{className:"space-y-2",children:[ee("label",{htmlFor:d,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.levenshteinLengthSimilarity}),ee("input",{id:d,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.lengthSimilarityThreshold??ge.levenshteinWorkerOptions?.lengthSimilarityThreshold,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,lengthSimilarityThreshold:parseFloat(p.target.value)}})),className:"w-full"}),ae("span",{className:"text-purple-600 text-xs dark:text-purple-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthSimilarityThreshold??ge.levenshteinWorkerOptions?.lengthSimilarityThreshold]}),ee("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinLengthSimilarityHint})]})]},"threshold")),i.push(ae("div",{className:`${r} border-pink-200 border-l-4 dark:border-pink-400/60`,children:[ae("div",{className:`${s} text-pink-700 dark:text-pink-300`,children:["\u{1FA84} ",n.scoreTuningHeading]}),ae("div",{className:"space-y-2",children:[ee("label",{htmlFor:l,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.levenshteinLengthPenalty}),ee("input",{id:l,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.levenshteinWorkerOptions?.lengthDiffPenalty??ge.levenshteinWorkerOptions?.lengthDiffPenalty,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,lengthDiffPenalty:parseFloat(p.target.value)}})),className:"w-full"}),ae("span",{className:"text-pink-600 text-xs dark:text-pink-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthDiffPenalty??ge.levenshteinWorkerOptions?.lengthDiffPenalty]}),ee("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinLengthPenaltyHint})]})]},"penalty")),i.push(ae("div",{className:`${r} border-violet-200 border-l-4 dark:border-violet-400/60`,children:[ae("div",{className:`${s} text-violet-700 dark:text-violet-300`,children:["\u{1F4E6} ",n.levenshteinResultsHeading]}),ee("label",{htmlFor:c,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.maxResults}),ae("label",{className:"flex items-center gap-2 text-[11px] text-gray-600 dark:text-slate-300",children:[ee("input",{type:"checkbox",checked:e.levenshteinWorkerOptions?.maxResults===void 0,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,maxResults:p.target.checked?void 0:Ka}}))}),n.noLimit]}),ee("input",{id:c,type:"range",min:Ka,max:"10000",step:"1000",disabled:e.levenshteinWorkerOptions?.maxResults===void 0,value:e.levenshteinWorkerOptions?.maxResults===void 0?Ka:e.levenshteinWorkerOptions.maxResults,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,maxResults:parseInt(p.target.value,10)}})),className:"w-full disabled:cursor-not-allowed"}),ae("span",{className:"text-violet-600 text-xs dark:text-violet-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.maxResults===void 0?n.noLimit:e.levenshteinWorkerOptions.maxResults]}),ee("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinMaxResultsHint})]},"max-results")),i.push(ae("div",{className:`${r} border-rose-200 border-l-4 ${a?"":"opacity-50"} dark:border-rose-400/60`,children:[ae("div",{className:`${s} text-rose-700 dark:text-rose-300`,children:["\u{1F3AF} ",n.relevanceWeightsHeading]}),ae("div",{className:"space-y-2",children:[ee("label",{htmlFor:m,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.fieldWeight}),ee("input",{id:m,type:"range",min:"0",max:"1",step:"0.05",value:e.levenshteinWorkerOptions?.relevanceFieldWeight??ge.levenshteinWorkerOptions?.relevanceFieldWeight??.15,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,relevanceFieldWeight:parseFloat(p.target.value)}})),disabled:!a,className:"w-full disabled:cursor-not-allowed"}),ae("span",{className:"text-rose-600 text-xs dark:text-rose-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.relevanceFieldWeight??ge.levenshteinWorkerOptions?.relevanceFieldWeight??.15]}),ee("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinFieldWeightHint})]}),ae("div",{className:"space-y-2",children:[ee("label",{htmlFor:u,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.levenshteinPartialBonus}),ee("input",{id:u,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.partialMatchBonus??ge.levenshteinWorkerOptions?.partialMatchBonus,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,partialMatchBonus:parseFloat(p.target.value)}})),disabled:!a,className:"w-full disabled:cursor-not-allowed"}),ae("span",{className:"text-rose-600 text-xs dark:text-rose-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.partialMatchBonus??ge.levenshteinWorkerOptions?.partialMatchBonus]}),ee("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinPartialBonusHint})]}),!a&&ee("p",{className:"text-[11px] text-rose-600 dark:text-rose-300",children:n.relevanceOnlyNotice})]},"relevance")),ae("section",{className:"space-y-3",children:[ae("div",{className:"flex items-center justify-between gap-3",children:[ae("div",{className:"flex items-center gap-2 font-semibold text-purple-700 text-xs transition-colors dark:text-purple-300",children:[ee("span",{children:"\u{1F4CF}"}),ee("span",{className:"tracking-wide",children:n.levenshteinSettingsHeading})]}),ee("button",{type:"button",onClick:()=>t(p=>({...p,levenshteinWorkerOptions:{threshold:ge.levenshteinWorkerOptions?.threshold||.3,lengthSimilarityThreshold:ge.levenshteinWorkerOptions?.lengthSimilarityThreshold||.1,partialMatchBonus:ge.levenshteinWorkerOptions?.partialMatchBonus||.1,lengthDiffPenalty:ge.levenshteinWorkerOptions?.lengthDiffPenalty||1,maxResults:void 0,relevanceFieldWeight:ge.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:n.resetToDefaultsTitle,children:n.reset})]}),ee("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:i})]})});ja.displayName="LevenshteinWorkerSettings";import{jsx as Ve,jsxs as $e}from"react/jsx-runtime";var vl={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},qa=xl(({searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:r,openEmailsWithGmail:s,setOpenEmailsWithGmail:a,activeTab:o,onTabChange:d})=>{let l=G(),{setScrollableRef:c,onPointerDown:m,onPointerMove:u,onPointerUp:i,onPointerLeave:p,onPointerCancel:f,onClickCapture:C}=dt();return $e("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:[$e("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:[$e("h3",{className:"font-semibold text-gray-700 text-xs transition-colors dark:text-slate-100",children:["\u2699\uFE0F ",l.searchSettings]}),Ve("div",{className:"flex flex-wrap gap-1.5",children:$e("button",{type:"button",onClick:()=>t(v=>Bn(v.workerUrls)),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]})})]}),Ve("div",{className:"mb-0 shrink-0",children:$e("div",{ref:c,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:vl,onPointerDown:m,onPointerMove:u,onPointerUp:i,onPointerLeave:p,onPointerCancel:f,onClickCapture:C,children:[$e("button",{type:"button",role:"tab","aria-selected":o==="basic",onClick:()=>d("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]}),$e("button",{type:"button",role:"tab","aria-selected":o==="advanced",onClick:()=>d("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]}),$e("button",{type:"button",role:"tab","aria-selected":o==="index",onClick:()=>d("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]}),$e("button",{type:"button",role:"tab","aria-selected":o==="levenshtein",onClick:()=>d("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]})]})}),$e("div",{className:"flex flex-col gap-1",children:[Ve("div",{className:`${o==="basic"?"block":"hidden"}`,children:Ve(ha,{searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:r,openEmailsWithGmail:s,setOpenEmailsWithGmail:a})}),Ve("div",{className:`${o==="advanced"?"block":"hidden"}`,children:Ve(ga,{searchOptions:e,setSearchOptions:t})}),Ve("div",{className:`${o==="index"?"block":"hidden"}`,children:Ve(Va,{searchOptions:e,setSearchOptions:t})}),Ve("div",{className:`${o==="levenshtein"?"block":"hidden"}`,children:Ve(ja,{searchOptions:e,setSearchOptions:t})})]})]})});qa.displayName="SearchOptionsPanel";import{memo as Sl,useCallback as Tl}from"react";bt();ie();import{memo as Cl}from"react";import{jsxs as Ga}from"react/jsx-runtime";var P=Cl(({label:e,value:t,unit:n,color:r="text-gray-600 dark:text-slate-300"})=>Ga("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:[Ga("span",{className:"wrap-break-word overflow-hidden text-left",children:[e,":"]}),Ga("span",{className:`font-medium ${r} min-w-0 overflow-hidden break-all transition-colors sm:ml-2`,children:[t,n]})]}));P.displayName="StatItem";bt();ie();import{memo as kl}from"react";import{jsx as T,jsxs as K}from"react/jsx-runtime";var zt=kl(({kind:e,icon:t,stats:n,color:r})=>{let{locale:s,labels:a}=ye(),o=N=>j(s,N);if(!n)return T("section",{className:"rounded-lg border border-gray-200 border-dashed bg-white/40 p-3 text-gray-400 text-xs transition-colors dark:border-slate-700 dark:bg-slate-900/40 dark:text-slate-400",children:a.statsNoData});let d=n.basic||{},l=n.workerSpecific||{},c=n.analysis||{},m=d.totalSearches??0,u=d.totalProcessingTime??0,i=d.averageSearchTime??0,p=d.lastSearchTime??0,f=d.errorCount??0,C=d.timestamp,v=c.fieldPerformance||{},k=c.performanceInsights||{},I=c.recentHistory||[],E=l.specificMetrics||{},y=l.operationCount??0,g=l.operationDistribution||{},A=e==="index",B=e==="levenshtein",x=A?a.indexWorkerName:a.levenshteinWorkerName,h=E,b=E,D="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",S="text-xs font-semibold transition-colors",te=N=>{if(!N)return;let O=new Date(N);return Number.isNaN(O.getTime())?void 0:a.statsTimestamp(O)},w=[];if(w.push(K("div",{className:`${D} border-blue-200 border-l-4 dark:border-blue-500/60`,children:[K("div",{className:`${S} ${r}`,children:["\u{1F4CA} ",a.statsBasicHeading]}),T(P,{label:a.statTotalSearches,value:o(m),color:r}),T(P,{label:a.statAverageSearchTime,value:i.toFixed(2),unit:"ms",color:r}),T(P,{label:a.statTotalProcessingTime,value:u.toFixed(2),unit:"ms",color:r}),T(P,{label:a.statLastSearchTime,value:p.toFixed(2),unit:"ms",color:r}),T(P,{label:a.statErrorCount,value:f,color:f>0?"text-red-600 dark:text-red-400":r}),te(C)&&T(P,{label:a.statUpdatedAt,value:te(C),color:"text-gray-500 dark:text-slate-400"})]},"basic")),y>0||Object.keys(g).length>0){let N=Object.entries(g).sort(([,O],[,U])=>(Number(U)||0)-(Number(O)||0)).slice(0,6);w.push(K("div",{className:`${D} border-amber-200 border-l-4 dark:border-amber-400/60`,children:[K("div",{className:`${S} text-amber-600 dark:text-amber-300`,children:["\u{1F527} ",a.statsOperationsHeading]}),T(P,{label:a.statTotalOperations,value:o(y),color:"text-amber-700 dark:text-amber-300"}),N.length>0&&T("div",{className:"mt-1 space-y-1",children:N.map(([O,U])=>T(P,{label:O,value:o(Number(U)),unit:a.timesUnit(o(Number(U))),color:"text-amber-700 dark:text-amber-300"},O))})]},"operations"))}if(A&&(w.push(K("div",{className:`${D} border-green-200 border-l-4 dark:border-green-400/60`,children:[K("div",{className:`${S} text-green-700 dark:text-green-300`,children:["\u{1F3D7}\uFE0F ",a.statsIndexHeading]}),T(P,{label:a.statIndexBuilds,value:o(h.totalIndexBuilds??0),color:"text-green-700 dark:text-green-300"}),T(P,{label:a.statDataSize,value:o(h.currentDataSize??0),unit:a.itemsUnit(o(h.currentDataSize??0)),color:"text-green-700 dark:text-green-300"}),T(P,{label:a.statLastBuildTime,value:(h.lastIndexTime??0).toFixed(2),unit:"ms",color:"text-green-700 dark:text-green-300"})]},"index-core")),h.cacheSize&&w.push(K("div",{className:`${D} border-emerald-200 border-l-4 dark:border-emerald-400/60`,children:[K("div",{className:`${S} text-emerald-700 dark:text-emerald-300`,children:["\u{1F4BE} ",a.statsCacheHeading]}),T(P,{label:a.statCacheNgram,value:o(h.cacheSize.ngram??0),color:"text-emerald-700 dark:text-emerald-300"}),T(P,{label:a.statCacheWord,value:o(h.cacheSize.word??0),color:"text-emerald-700 dark:text-emerald-300"}),T(P,{label:a.statCachePhonetic,value:o(h.cacheSize.phonetic??0),color:"text-emerald-700 dark:text-emerald-300"})]},"index-cache")),h.indexMetadata)){let N=Object.entries(h.indexMetadata).slice(0,6);N.length>0&&w.push(K("div",{className:`${D} border-teal-200 border-l-4 dark:border-teal-400/60`,children:[K("div",{className:`${S} text-teal-700 dark:text-teal-300`,children:["\u{1F4CB} ",a.statsIndexMetadataHeading]}),N.map(([O,U])=>{let re;if(typeof U=="number"){let pe=O.toLowerCase();pe.includes("time")&&!pe.includes("timestamp")?re=`${U.toFixed(2)}ms`:pe.includes("timestamp")||pe.includes("at")?re=te(U)??U.toString():re=o(U)}else re=String(U);return T(P,{label:O,value:re,color:"text-teal-700 dark:text-teal-300"},O)})]},"index-meta"))}if(B){if(w.push(K("div",{className:`${D} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[K("div",{className:`${S} text-purple-700 dark:text-purple-300`,children:["\u{1F522} ",a.statsCalculationsHeading]}),T(P,{label:a.statTotalCalculations,value:o(b.totalCalculations??0),color:"text-purple-700 dark:text-purple-300"}),T(P,{label:a.statDistanceCalculations,value:o(b.totalDistanceCalculations??0),color:"text-purple-700 dark:text-purple-300"}),T(P,{label:a.statAverageDistance,value:typeof b.averageDistance=="number"?b.averageDistance.toFixed(2):"0.00",color:"text-purple-700 dark:text-purple-300"}),T(P,{label:a.statMinDistance,value:b.minDistance??a.notAvailable,color:"text-purple-700 dark:text-purple-300"}),T(P,{label:a.statMaxDistance,value:b.maxDistance??0,color:"text-purple-700 dark:text-purple-300"})]},"lev-basic")),w.push(K("div",{className:`${D} border-fuchsia-200 border-l-4 dark:border-fuchsia-400/60`,children:[K("div",{className:`${S} text-fuchsia-700 dark:text-fuchsia-300`,children:["\u{1F3AF} ",a.statsMatchesHeading]}),T(P,{label:a.statPartialMatches,value:o(b.partialMatches??0),color:"text-fuchsia-700 dark:text-fuchsia-300"}),T(P,{label:a.statPerfectMatches,value:o(b.perfectMatches??0),color:"text-fuchsia-700 dark:text-fuchsia-300"}),T(P,{label:a.statEarlyTerminations,value:o(b.earlyTerminations??0),color:"text-fuchsia-700 dark:text-fuchsia-300"})]},"lev-match")),b.similarityThresholds&&w.push(K("div",{className:`${D} border-rose-200 border-l-4 dark:border-rose-400/60`,children:[K("div",{className:`${S} text-rose-700 dark:text-rose-300`,children:["\u{1F4C8} ",a.statsSimilarityHeading]}),T(P,{label:a.statAbove80,value:o(b.similarityThresholds.above80??0),color:"text-emerald-700 dark:text-emerald-300"}),T(P,{label:a.statAbove60,value:o(b.similarityThresholds.above60??0),color:"text-lime-700 dark:text-lime-300"}),T(P,{label:a.statAbove40,value:o(b.similarityThresholds.above40??0),color:"text-orange-600 dark:text-orange-300"}),T(P,{label:a.statBelow40,value:o(b.similarityThresholds.below40??0),color:"text-red-600 dark:text-red-400"})]},"lev-similarity")),b.distanceDistribution){let N=Object.entries(b.distanceDistribution).sort(([,O],[,U])=>Number(U)-Number(O)).slice(0,6);N.length>0&&w.push(K("div",{className:`${D} border-indigo-200 border-l-4 dark:border-indigo-500/60`,children:[K("div",{className:`${S} text-indigo-700 dark:text-indigo-300`,children:["\u{1F4CA} ",a.statsDistanceHeading]}),N.map(([O,U])=>T(P,{label:a.statDistance(O),value:o(Number(U)),unit:a.timesUnit(o(Number(U))),color:"text-indigo-700 dark:text-indigo-300"},O))]},"lev-distance"))}if(b.queryLengthStats){let N=Object.entries(b.queryLengthStats).sort(([,O],[,U])=>(U.count??0)-(O.count??0)).slice(0,6);N.length>0&&w.push(K("div",{className:`${D} border-violet-200 border-l-4 dark:border-violet-400/60`,children:[K("div",{className:`${S} text-violet-700 dark:text-violet-300`,children:["\u{1F4CF} ",a.statsQueryLengthHeading]}),N.map(([O,U])=>{let re=Number(U.count??0),pe=Number(U.averageScore??0);return T(P,{label:a.statQueryLength(O),value:a.statQueryLengthValue({count:re,averagePercent:(pe*100).toFixed(1)}),color:"text-violet-700 dark:text-violet-300"},O)})]},"lev-query-length"))}}if(Object.keys(v).length>0){let N=Object.entries(v).sort(([,O],[,U])=>(U.averageScore??0)-(O.averageScore??0)).slice(0,6);w.push(K("div",{className:`${D} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[K("div",{className:`${S} text-purple-700 dark:text-purple-300`,children:["\u{1F4CB} ",a.statsFieldPerformanceHeading]}),N.map(([O,U])=>{let re=U;return K("div",{className:"space-y-1 rounded bg-purple-50/60 p-2 transition-colors dark:bg-slate-900/50",children:[T("div",{className:"font-semibold text-purple-700 text-xs transition-colors dark:text-purple-300",children:O}),T(P,{label:a.statAverageScore,value:`${((re.averageScore??0)*100).toFixed(1)}%`,color:"text-purple-700 dark:text-purple-300"}),T(P,{label:a.statMatchCount,value:o(re.matchCount??0),unit:a.itemsUnit(o(re.matchCount??0)),color:"text-purple-700 dark:text-purple-300"}),T(P,{label:a.statBestWorstScore,value:`${((re.bestScore??0)*100).toFixed(1)}% / ${((re.worstScore??0)*100).toFixed(1)}%`,color:"text-purple-700 dark:text-purple-300"})]},O)})]},"field-performance"))}if(k.bestPerformingField||k.totalHistoryEntries||k.similarityDistribution){let N=(k.recentAverageResultCount??0).toFixed(1);w.push(K("div",{className:`${D} border-blue-200 border-l-4 dark:border-blue-400/60`,children:[K("div",{className:`${S} text-blue-700 dark:text-blue-300`,children:["\u{1F50D} ",a.statsInsightsHeading]}),k.bestPerformingField&&T(P,{label:a.statBestField,value:k.bestPerformingField,color:"text-blue-700 dark:text-blue-300"}),T(P,{label:a.statRecentAverageTime,value:(k.recentAverageProcessingTime??0).toFixed(2),unit:"ms",color:"text-blue-700 dark:text-blue-300"}),T(P,{label:a.statRecentAverageResults,value:N,unit:a.itemsUnit(N),color:"text-blue-700 dark:text-blue-300"}),T(P,{label:a.statThroughput,value:(k.throughputPerSecond??0).toFixed(2),unit:a.throughputUnit,color:"text-blue-700 dark:text-blue-300"}),T(P,{label:a.statCommonQueryLength,value:o(k.mostCommonQueryLength??0),unit:a.charactersUnit(o(k.mostCommonQueryLength??0)),color:"text-blue-700 dark:text-blue-300"}),T(P,{label:a.statHistoryEntries,value:o(k.totalHistoryEntries??0),color:"text-blue-700 dark:text-blue-300"}),k.similarityDistribution&&K("div",{className:"mt-1 grid grid-cols-2 gap-1",children:[T(P,{label:a.statHighSimilarity,value:o(k.similarityDistribution.highSimilarity??0),color:"text-emerald-700 dark:text-emerald-300"}),T(P,{label:a.statMediumSimilarity,value:o(k.similarityDistribution.mediumSimilarity??0),color:"text-lime-700 dark:text-lime-300"}),T(P,{label:a.statLowSimilarity,value:o(k.similarityDistribution.lowSimilarity??0),color:"text-orange-600 dark:text-orange-300"}),T(P,{label:a.statVeryLowSimilarity,value:o(k.similarityDistribution.veryLowSimilarity??0),color:"text-red-600 dark:text-red-400"})]})]},"performance-insights"))}return I.length>0&&w.push(K("div",{className:`${D} border-sky-200 border-l-4 dark:border-sky-400/60`,children:[K("div",{className:`${S} text-sky-700 dark:text-sky-300`,children:["\u{1F4C8} ",a.statsRecentHistoryHeading]}),I.slice(-3).reverse().map((N,O)=>K("div",{className:"rounded bg-sky-50/70 p-2 transition-colors dark:bg-slate-900/50",children:[T("div",{className:"font-medium text-sky-700 transition-colors dark:text-sky-300",children:N.operationType}),T("div",{className:"text-sky-600 text-xs transition-colors dark:text-sky-200",children:a.statsHistoryEntry({processingTimeMs:N.processingTime.toFixed(2),resultCount:N.resultCount??0})}),te(N.timestamp)&&T("div",{className:"text-[10px] text-sky-500 transition-colors dark:text-sky-200",children:te(N.timestamp)})]},`${N.operationType}-${N.timestamp??O}`))]},"recent-history")),K("section",{className:"space-y-2",children:[K("div",{className:`flex items-center gap-2 font-semibold text-xs ${r}`,children:[T("span",{children:t}),T("span",{className:"tracking-wide",children:x})]}),T("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:w})]})});zt.displayName="WorkerStatsSection";import{jsx as Pe,jsxs as Me}from"react/jsx-runtime";var wl={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},Qa=Sl(({performanceMetrics:e,searchTerm:t,totalDataCount:n,resultsCount:r,resetStats:s,rebuildIndex:a,isIndexBuilding:o,activeTab:d,onTabChange:l})=>{let{locale:c,labels:m}=ye(),u=t.trim(),i=u?r:n,{setScrollableRef:p,onPointerDown:f,onPointerMove:C,onPointerUp:v,onPointerLeave:k,onPointerCancel:I,onClickCapture:E}=dt(),y=d!=="index"||o,g=o?m.statsRebuildingTitle:d!=="index"?m.statsRebuildIndexTabOnlyTitle:m.statsRebuildTitle,A=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",B=o?`\u23F3 ${m.statsRebuilding}`:`\u{1F3D7}\uFE0F ${m.statsRebuild}`,x=Tl(()=>{a().catch(()=>{})},[a]);return Me("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:[Me("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:[Me("h3",{className:"font-semibold text-gray-700 text-xs transition-colors dark:text-slate-100",children:["\u{1F4CA} ",m.searchStatistics]}),Me("div",{className:"flex flex-wrap gap-1.5",children:[Pe("button",{type:"button",onClick:x,disabled:y,className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${A}`,title:g,children:B}),Me("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]})]})]}),Pe("div",{className:"mb-0 shrink-0",children:Me("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:wl,onPointerDown:f,onPointerMove:C,onPointerUp:v,onPointerLeave:k,onPointerCancel:I,onClickCapture:E,children:[Me("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]}),Me("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]}),Me("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]})]})}),Me("div",{className:"flex flex-col gap-1 pb-0.5",children:[Me("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:[Pe(P,{label:m.statTotalSearches,value:j(c,e.totalSearches)}),Pe(P,{label:m.statAverageSearchTime,value:e.averageSearchTime.toFixed(1),unit:"ms"}),Pe(P,{label:m.statDataCount,value:j(c,e.itemCount)}),Pe(P,{label:u?m.statResultCount:m.statDisplayedCount,value:j(c,i)})]}),Pe("div",{className:`${d==="index"?"space-y-3":"hidden"} pr-1 text-gray-600 text-xs transition-colors dark:text-slate-300`,children:Pe(zt,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:"text-green-600 dark:text-green-300"})}),Pe("div",{className:`${d==="levenshtein"?"space-y-3":"hidden"} pr-1 text-gray-600 text-xs transition-colors dark:text-slate-300`,children:Pe(zt,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:"text-purple-600 dark:text-purple-300"})}),Me("div",{className:"hidden",children:[Pe(zt,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:"text-green-600 dark:text-green-300"}),Pe(zt,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:"text-purple-600 dark:text-purple-300"})]})]})]})});Qa.displayName="StatisticsPanel";import{Fragment as ho,jsx as J,jsxs as he}from"react/jsx-runtime";var Dl=/[\u200B\uFEFF]/g,Ya=typeof window<"u",yo=Ya&&typeof document<"u",Jn=(e,t=[],n=!1)=>{let r=fo(e);r.current=e,Ze(()=>{if(!(!Ya||n&&!yo))return r.current()},[n,...t])},uo=(e,t,n)=>{let[r,s]=We(()=>{let a=po(o=>o.getItem(e));return a&&t.includes(a)?a:n});return Jn(()=>{po(a=>{a.setItem(e,r)})},[e,r]),[r,s]},po=e=>{if(!Ya)return null;try{return e(window.sessionStorage)}catch{return null}},mo=(e,t)=>{let[n,r]=We(e);return Ze(()=>{let s=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(s)}},[e,t]),n},Wl="contact-map.settings-tab",Hl="contact-map.statistics-tab",_l=["basic","advanced","index","levenshtein"],Al=["overview","index","levenshtein"],go=["full_name","company_name","department","title","email","company_phone_number","mobile_phone_number"],Il={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},bo=({streamState:e,...t}={})=>e===void 0?J(Fl,{...t}):J(xo,{...t,streamState:e}),Fl=e=>{let{context:t}=zn();return J(xo,{...e,streamState:t})},zl={setting:"ContactMapSearchPage workerUrls",keys:["indexWorker","levenshteinWorker"],hints:{treeWorker:"set treeWorker on ContactMapConfigProvider or ContactMapAppView"}},xo=e=>{let{streamState:t,onFooterVisibilityChange:n,children:r}=e,s=fe(e,"workerUrls"),a=Xe(),{locale:o,labels:d}=ye(),{contactMapRecords:l,contactMapRecordMap:c,isStreamingComplete:m,isStreamingFailed:u}=t,i=El(),[p]=Ol(),f=fo(null),[C,v]=We(!0),[k,I]=We(a.openEmailsWithGmail??!1),{indexWorker:E,levenshteinWorker:y}=At(a.workerUrls,s,zl),[g,A]=We(()=>Bn({indexWorker:E,levenshteinWorker:y})),[B,x]=We(p.get("q")||""),h=mo(B,g.debounceMs??Nl.debounceMs);Ze(()=>{let F=p.get("q")||"";x(V=>V!==F?F:V)},[p]),Ze(()=>{if(typeof window>"u")return;let F=new URL(window.location.href);(F.searchParams.get("q")||"")!==h&&(h?F.searchParams.set("q",h):F.searchParams.delete("q"),window.history.replaceState(window.history.state,"",F.toString()))},[h]);let[b,D]=Ll(),[S,te]=We("search"),[w,N]=uo(Wl,_l,"basic"),[O,U]=uo(Hl,Al,"overview"),{setScrollableRef:re,onPointerDown:pe,onPointerMove:se,onPointerUp:Se,onPointerLeave:mt,onPointerCancel:Nt,onClickCapture:cn}=dt(),le=Bt(()=>{if(!yo)return;let F=f.current;!F||document.activeElement===F||window.requestAnimationFrame(()=>{try{F.focus({preventScroll:!0})}catch{}})},[]),$t=Bt(F=>{let V=F;te(V),V==="search"&&le()},[le]),xe=pt(()=>({...g,debounceMs:0}),[g]),[et,un]=We("union"),Ke=et==="intersection",Zn=Ke?d.operatorAndTitle:d.operatorOrTitle,pn=Bt(F=>Ml(F,et),[et]),mn=pt(()=>({querySetsOf:pn}),[pn]),Vt=mo(l,m?0:800),{searchTerm:ne,setSearchTerm:gn,filteredItems:tt,resultTerm:Kt,isSearching:nt,isIndexBuilding:ve,clearSearch:jt,resetStats:qt,performanceMetrics:He,rebuildIndex:at,error:_e}=Pl(Vt,go,xe,mn),gt=ne.trim().length>0,[rt,ht]=We(""),[Mt,ea]=We(()=>ne),ot=pt(()=>Rn(B),[B]),je=pt(()=>Rn(h),[h]);Ze(()=>{h===rt&&je===ne||D(()=>{ht(h),gn(je)})},[h,rt,je,ne,gn]);let Gt=Bt(F=>{let ce=F.target.value.replace(Dl,"");x(ce)},[]),ta=Bt(()=>{x(""),ht(""),jt(),le()},[jt,le]),hn=Bt(()=>{un(F=>F==="intersection"?"union":"intersection"),le()},[le]);Jn(()=>{if(!(S==="search"&&i.state==="idle"&&!b))return;let V=document.activeElement;if(!!!(V?.matches('[role="tab"]')||V?.closest('[role="tablist"]')?.getAttribute("role")==="tablist")&&V&&V!==document.body&&V!==f.current)return;let Ae=window.requestAnimationFrame(()=>{le()});return()=>{window.cancelAnimationFrame(Ae)}},[S,i.state,b,le],!0),Jn(()=>{if(S!=="search")return;let F=[[document,"visibilitychange",()=>{document.visibilityState==="visible"&&le()}],[window,"pageshow",()=>{le()}]];for(let[V,ce,Ae]of F)V.addEventListener(ce,Ae);return()=>{for(let[V,ce,Ae]of F)V.removeEventListener(ce,Ae)}},[S,le],!0),Ze(()=>(n&&n(S==="search"?"mobile-hidden":"visible"),()=>{n&&n("visible")}),[S,n]),Jn(()=>{let F=document.body,V=F.style.overflow;return S==="search"&&(F.style.overflow="hidden"),()=>{F.style.overflow=V}},[S],!0),Ze(()=>{He&&Be.info("\u{1F4CA} [STATE] \u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u6307\u6A19\u304C\u66F4\u65B0\u3055\u308C\u307E\u3057\u305F:",{totalSearches:He.totalSearches,averageSearchTime:He.averageSearchTime,itemCount:He.itemCount,resultsCount:He.resultsCount,workersAvailable:!!He.workerStats})},[He]);let{isAwaitingDebounce:fn,isAwaitingSearchTermSync:yn,isSearchInProgress:st}=pt(()=>{let F=ot!==je,V=je!==ne,ce=ne.trim().length>0||ot.trim().length>0;return{isAwaitingDebounce:F,isAwaitingSearchTermSync:V,isSearchInProgress:b||nt||Kt!==ne&&_e===null||ce&&ve||F||V||Mt!==ne}},[ot,je,ne,Kt,_e,b,nt,ve,Mt]),[Pt,bn]=We(ne);Ze(()=>{Pt!==ne&&bn(ne)},[ne,Pt]),Ze(()=>{fn||yn||b||nt||ve||Pt===ne&&Mt!==ne&&ea(ne)},[ne,Mt,fn,yn,b,nt,ve,Pt]);let xn=pt(()=>br(rt,go),[rt]),vn=pt(()=>xn(tt),[xn,tt]),Cn=pt(()=>({contactMapRecords:l,contactMapRecordMap:c,filteredItems:vn,searchQuery:rt,searchTerm:ne,isSearching:nt,isIndexBuilding:ve,isPending:b,hasSearchTerm:gt,enableHighlighting:C,openEmailsWithGmail:k,isSearchInProgress:st,isSearchTabActive:S==="search",errorMessage:_e??null,isStreamingComplete:m,isStreamingFailed:u}),[l,c,vn,rt,ne,nt,ve,b,gt,C,k,st,S,_e,m,u]),na=gt?tt.length:l.length,Qt=j(o,l.length),R=j(o,tt.length);return J("div",{className:`scrollbar-hidden bg-slate-50 text-slate-900 dark:bg-slate-900 dark:text-slate-100${S==="search"?" h-full min-h-0":""}`,children:he(Wn,{value:S,onValueChange:$t,className:`flex flex-col${S==="search"?" h-full min-h-0":""}`,children:[he(tn,{ref:re,style:Il,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:pe,onPointerMove:se,onPointerUp:Se,onPointerLeave:mt,onPointerCancel:Nt,onClickCapture:cn,children:[he(Ct,{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} ",d.searchTab]}),he(Ct,{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 ",d.searchSettings]}),he(Ct,{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} ",d.searchStatistics]})]}),J(kt,{value:"search",className:"mt-0 flex h-full min-h-0 flex-col overflow-hidden",children:he("div",{className:"flex h-full flex-col",children:[J("div",{className:"rounded-md border border-gray-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/80 dark:shadow-none",children:he("div",{className:"flex flex-col",children:[J("div",{className:"relative",children:he("div",{className:"flex items-center gap-1 p-1",children:[he("button",{type:"button",onClick:hn,"aria-pressed":Ke,title:Zn,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 ${Ke?"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:[J("span",{className:"text-[10px] sm:text-xs",children:Ke?d.operatorAnd:d.operatorOr}),J("span",{className:"hidden text-[10px] sm:inline",children:Ke?d.operatorAndHint:d.operatorOrHint})]}),J("input",{ref:f,type:"text",value:B,onChange:Gt,placeholder:d.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"}),B&&J("button",{type:"button",onClick:ta,className:"flex items-center justify-center gap-1 rounded border border-gray-300 px-1.5 py-0.5 text-[10px] transition-colors hover:text-gray-700 sm:px-2 sm:py-0.5 sm:text-xs dark:border-slate-600 dark:bg-slate-800/70 dark:text-slate-300 dark:hover:text-slate-100",title:st?d.searchBusyTitle:d.clearSearch,disabled:st,children:st?he(ho,{children:[J(Rl,{"aria-hidden":"true",className:"h-3 w-3 animate-spin sm:h-3.5 sm:w-3.5"}),J("span",{className:"hidden sm:inline",children:d.searching})]}):"\u2715"})]})}),he("p",{className:"px-1.5 py-0.5 text-[10px] text-slate-700 leading-snug transition-colors sm:text-[11px] dark:text-slate-200",children:[d.registeredCountLabel," ",J("span",{className:"font-semibold text-[11px] text-slate-900 sm:text-xs dark:text-white",children:Qt})," ",d.recordUnit(Qt),ve?he("span",{className:"ml-1.5 inline-flex items-center rounded bg-blue-50 px-1.5 py-0.2 text-[10px] text-blue-700 sm:text-[11px] dark:bg-blue-900/40 dark:text-blue-200",children:["\u23F3 ",d.rebuildingIndex]}):null,_e?he("span",{className:"ml-1.5 inline-flex items-center rounded bg-rose-50 px-1.5 py-0.2 text-[10px] text-rose-700 sm:text-[11px] dark:bg-rose-900/40 dark:text-rose-200",children:["\u26A0\uFE0F ",d.errorLabel,J("span",{className:"ml-1 break-all font-semibold",children:_e})]}):null,gt&&he("span",{className:"ml-1.5 text-[10px] text-blue-600 sm:text-[11px] dark:text-sky-400",children:["| ",d.resultCountLabel,st?J("span",{className:"ml-1 font-semibold text-[10px] sm:text-[11px]",children:d.searching}):he(ho,{children:[J("span",{className:"ml-1 font-semibold text-[11px] text-slate-900 sm:text-xs dark:text-white",children:R}),J("span",{className:"ml-0.5 text-[10px] sm:text-[11px]",children:d.resultUnit(R)})]})]})]}),J("div",{className:"h-2.5 px-2 pb-1.5",children:ve?J(Wr,{className:"h-1 bg-blue-200 dark:bg-blue-800",indicatorClassName:"bg-blue-500 dark:bg-blue-400"}):null})]})}),r?r(Cn):J(co,{context:Cn})]})}),J(kt,{value:"settings",className:"mt-0",children:J(qa,{searchOptions:g,setSearchOptions:A,enableHighlighting:C,setEnableHighlighting:v,openEmailsWithGmail:k,setOpenEmailsWithGmail:I,activeTab:w,onTabChange:N})}),J(kt,{value:"statistics",className:"mt-0",children:J(Qa,{performanceMetrics:He,searchTerm:ne,totalDataCount:l.length,resultsCount:na,resetStats:qt,rebuildIndex:at,isIndexBuilding:ve,activeTab:O,onTabChange:U})})]})})};import{jsx as Ut,jsxs as Co}from"react/jsx-runtime";var Bl=({renderHeader:e,title:t,onFooterVisibilityChange:n})=>{let r=G(),s=t===void 0?r.appTitle:t,{context:a,retryNow:o}=zn(),d=Ut(La,{recordCount:a.contactMapRecords.length,companyCount:a.companyCount,phase:a.streamPhase,loadedCount:a.loadedCount,totalCount:a.totalCount,errorMessage:a.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:d}):Co("div",{"data-testid":"contact-map-default-header",className:"mb-2 flex items-center justify-between",children:[Ut("h1",{className:"font-bold text-xl",children:s}),d]}),Ut("div",{className:"min-h-0 flex-1",children:Ut(bo,{streamState:a,onFooterVisibilityChange:n})})]})},Sm=e=>{let t=Xe(),n=fe(e,"streamEndpoint"),r=fe(e,"workerUrls"),s=fe(e,"locale"),a=fe(e,"labels"),o=vo(()=>({...t,streamEndpoint:n===void 0?t.streamEndpoint:n,workerUrls:At(t.workerUrls,r,{setting:"ContactMapAppView workerUrls"}),locale:s===void 0?t.locale:s,labels:a===void 0?t.labels:a}),[t,n,r,s,a]),d=s!==void 0,l=a!==void 0,c=vo(()=>({locale:d?"ContactMapAppView locale":"locale",labels:l?"ContactMapAppView labels":"labels"}),[d,l]);return Ut(Oa,{config:o,chromeSurface:c,children:Ut(Bl,{...e})})};bt();ie();function Nm(){return!1}export{ga as AdvancedSearchSettings,ha as BasicSearchSettings,Ge as CONTACT_MAP_LABEL_CATALOGS,Xt as CONTACT_MAP_LABEL_KEYS,xr as ContactDetailGrid,lt as ContactDetailPanel,Mn as ContactDetailPopup,Pn as ContactDetailRowLayout,La as ContactMapAnnotation,Sm as ContactMapAppView,$s as ContactMapConfigProvider,Gr as ContactMapSearchListView,bo as ContactMapSearchPage,co as ContactMapSearchTabGroup,lo as ContactMapSearchTreeView,An as ContactMapStreamClient,ue as HighlightedText,Va as IndexWorkerSettings,fu as LIST_COLLAPSE_THRESHOLD,Mi as LIST_DETAIL_PANEL_MIN_WIDTH,yu as LIST_EXPAND_THRESHOLD,Ni as LIST_PANEL_MIN_WIDTH,Pi as LIST_RESIZE_HANDLE_THICKNESS,ja as LevenshteinWorkerSettings,Wr as Progress,qa as SearchOptionsPanel,P as StatItem,Qa as StatisticsPanel,Kn as SwipeOverlay,Ju as TREE_COLLAPSE_THRESHOLD,nl as TREE_DETAIL_PANEL_MIN_WIDTH,Zu as TREE_EXPAND_THRESHOLD,tl as TREE_PANEL_MIN_WIDTH,al as TREE_RESIZE_HANDLE_THICKNESS,Wn as Tabs,kt as TabsContent,tn as TabsList,Ct as TabsTrigger,Qn as TreeWorkerSession,zt as WorkerStatsSection,In as assertContactMapStreamEndpoint,Mr as assertContactMapTreeWorkerUrl,Cc as assertContactMapWorkerUrls,il as composeTreeVirtualScrollOptions,Nm as contactMapShouldRevalidate,ti as countContactMapCompanies,qs as deserializeStreamRecord,Ys as getContactMapStreamClient,ji as getTreeWorkerSession,At as layerContactMapWorkerUrls,_c as resetContactMapStreamClientForTesting,Ru as resetTreeWorkerSessionForTesting,da as resolveContactMapLabels,Qr as useAnimatedNumber,Xe as useContactMapConfig,G as useContactMapLabels,ei as useContactMapStream,Ha as useContactPanelSizing,Hr as useDynamicViewportHeight,dt as useHorizontalDragScroll,$n as useLongPressPopup,_i as useReportPopupVisibility,Vn as useResponsiveTwoColumnLayout,Hi as useRowPopupRegistry,zn as useStreamedContactMapContext,eo as useTreeWorker};
|
|
1
|
+
var Uo=Object.defineProperty;var he=(e,t)=>()=>(e&&(t=e(e=0)),t);var Bo=(e,t)=>{for(var n in t)Uo(e,n,{get:t[n],enumerable:!0})};var We,bt,pr,Ut,Bt,un,Ze,Ne,On,fa,ba,$e,j,yt=he(()=>{"use strict";We=e=>{if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null},bt=e=>!e||typeof e!="object"?null:"item"in e?e.item??null:"person_id"in e?e:null,pr=(e,t)=>{if(!e)return{value:null,fieldKey:null};for(let n of t){let a=We(e[n]);if(a)return{value:a,fieldKey:n}}return{value:null,fieldKey:null}},Ut=e=>pr(e,["custom_email","email"]),Bt=e=>pr(e,["custom_mobile_phone_number","mobile_phone_number","company_phone_number"]),un=e=>{let t=We(e);if(!t)return null;let n=t.replace(/[^0-9+#*]/g,"");return n.length===0?null:`tel:${n}`},Ze=(e,t)=>{let n=We(e);return n?t?`https://mail.google.com/mail/?view=cm&fs=1&to=${encodeURIComponent(n)}`:`mailto:${encodeURIComponent(n)}`:null},Ne=(e,t)=>String(e).padStart(t,"0"),On=e=>`${Ne(e.getUTCFullYear(),4)}-${Ne(e.getUTCMonth()+1,2)}-${Ne(e.getUTCDate(),2)}`,fa=e=>`${On(e)} ${Ne(e.getUTCHours(),2)}:${Ne(e.getUTCMinutes(),2)}:${Ne(e.getUTCSeconds(),2)}`,ba=e=>`${Ne(e.getFullYear(),4)}-${Ne(e.getMonth()+1,2)}-${Ne(e.getDate(),2)} ${Ne(e.getHours(),2)}:${Ne(e.getMinutes(),2)}:${Ne(e.getSeconds(),2)}`,$e=(e,t)=>{if(e==null||e==="")return"-";let n=typeof e=="string"?new Date(e):e;return Number.isNaN(n.getTime())?typeof e=="string"?e:"-":t(n)},j=e=>e==null?"-":typeof e=="string"?We(e)??"-":typeof e=="number"?Number.isFinite(e)?String(e):"-":String(e)});var X,ur,xt=he(()=>{"use strict";X=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":ur(e);case"function":return ur(e);case"number":return Object.is(e,-0)?"-0":String(e);default:return String(e)}},ur=e=>{try{return Object.prototype.toString.call(e)}catch{return"[object ?]"}}});var $t,fe,Vt=he(()=>{"use strict";$t=e=>{if(typeof e!="object"||e===null)return!1;try{let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}catch{return!1}},fe=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0});var $o,Dn,ya=he(()=>{"use strict";$o=(e,t)=>{let n=Array.from({length:t.length+1},(a,s)=>s);for(let a=1;a<=e.length;a+=1){let s=[a];for(let o=1;o<=t.length;o+=1){let r=n[o-1]+(e[a-1]===t[o-1]?0:1);s.push(Math.min(n[o]+1,s[o-1]+1,r))}n=s}return n[t.length]},Dn=(e,t)=>{let n=e.toLowerCase();if(n.length>=3){let s=t.find(o=>o.toLowerCase().startsWith(n));if(s!==void 0)return s}let a;for(let s of t){let o=$o(n,s.toLowerCase());o<=Math.max(1,Math.floor(s.length/4))&&(a===void 0||o<a.distance)&&(a={key:s,distance:o})}return a?.key}});import{DIRECTORY_TREE_LABEL_CATALOGS as mr,DIRECTORY_TREE_LABEL_KEYS as xa,resolveDirectoryTreeLabels as Vo}from"@aiquants/directory-tree";import{resolveVirtualScrollLocale as Ko,VIRTUAL_SCROLL_LABEL_KEYS as jo}from"@aiquants/virtualscroll";var Go,K,vt,_n,hr,mn,et,qo,gr,fr,Yo,va,Qo,Xo,Jo,Ca,ka,Sa,Ct=he(()=>{"use strict";yt();xt();Vt();ya();Go=Object.freeze({en:"en-US",ja:"ja-JP"}),K=(e,t)=>t.toLocaleString(Go[e]),vt=(e,t,n)=>e==="1"?t:n,_n=Object.freeze({en:Object.freeze({appTitle:"Contact Map",annotationTotalLabel:"Total:",annotationCompaniesLabel:"Companies:",annotationStreamingProgress:({loaded:e,total:t,percent:n})=>`Streaming (${K("en",e)} / ${K("en",t)} \xB7 ${n}%)`,annotationStreamingCount:e=>`Streaming (${K("en",e)} loaded)`,annotationLoadFailed:e=>`Failed to load (${K("en",e)} received)`,annotationReconnecting:e=>`Reconnecting (${K("en",e)} received)`,annotationAuthRequired:"Session expired: sign in again, then retry",annotationRetry:"Retry",recordUnit:e=>vt(e,"record","records"),companyUnit:e=>vt(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=>vt(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",listboxLabel:"Contact list",listKeyboardHelp:"Up and down arrows move between contacts, Page Up and Page Down move by a screen, Home and End go to the first and the last; Enter or Space opens the contact's details.",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=>K("en",e),uncategorizedCompany:"Uncategorized",treeDirectoryName:(e,t)=>`${e} (${K("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",recordDateTime:fa,recordDate:On,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",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",noLimit:"No limit",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:"Operator for words inside quotes",basicOperatorOr:"OR (any word matches)",basicOperatorAnd:"AND (all words match)",basicMultiTermHint:'How words between quotation marks ("tanaka taro") are combined (default: AND). Words outside quotation marks are separate keywords combined by the AND / OR button',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",statsTimestamp:ba,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 n=K("en",e);return`${n} ${vt(n,"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: ${K("en",t)}`,timesUnit:e=>vt(e," time"," times"),itemsUnit:e=>vt(e," item"," items"),charactersUnit:e=>vt(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:n})=>`\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u8AAD\u307F\u8FBC\u307F\u4E2D (${K("ja",e)} / ${K("ja",t)} \u4EF6\u30FB${n}%)`,annotationStreamingCount:e=>`\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u8AAD\u307F\u8FBC\u307F\u4E2D (${K("ja",e)} \u4EF6)`,annotationLoadFailed:e=>`\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F (${K("ja",e)} \u4EF6\u53D7\u4FE1\u6E08)`,annotationReconnecting:e=>`\u518D\u63A5\u7D9A\u4E2D (${K("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",listboxLabel:"\u9023\u7D61\u5148\u4E00\u89A7",listKeyboardHelp:"\u4E0A\u4E0B\u306E\u77E2\u5370\u30AD\u30FC\u3067\u9023\u7D61\u5148\u3092\u79FB\u308A\u3001Page Up \u3068 Page Down \u3067 1 \u753B\u9762\u305A\u3064\u3001Home \u3068 End \u3067\u5148\u982D\u3068\u672B\u5C3E\u3078\u79FB\u308A\u307E\u3059\u3002Enter \u304B Space \u3067\u9023\u7D61\u5148\u306E\u8A73\u7D30\u3092\u958B\u304D\u307E\u3059\u3002",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=>`${K("ja",e)} \u500B`,uncategorizedCompany:"\u672A\u5206\u985E",treeDirectoryName:(e,t)=>`${e} (${K("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",recordDateTime:fa,recordDate:On,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",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",noLimit:"\u4E0A\u9650\u306A\u3057",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:"\u5F15\u7528\u7B26\u306E\u4E2D\u306E\u8A9E\u306E\u6F14\u7B97\u5B50",basicOperatorOr:"OR (\u3044\u305A\u308C\u304B\u4E00\u81F4)",basicOperatorAnd:"AND (\u3059\u3079\u3066\u4E00\u81F4)",basicMultiTermHint:'\u5F15\u7528\u7B26\u3067\u56F2\u3093\u3060\u8A9E ("\u7530\u4E2D \u592A\u90CE") \u306E\u7D50\u5408\u65B9\u6CD5 (\u65E2\u5B9A\u306F AND)\u3002\u5F15\u7528\u7B26\u306E\u5916\u306E\u8A9E\u306F\u305D\u308C\u305E\u308C\u5225\u306E\u30AD\u30FC\u30EF\u30FC\u30C9\u3067\u3001AND / OR \u30DC\u30BF\u30F3\u3067\u7D50\u5408\u3059\u308B',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",statsTimestamp:ba,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})=>`${K("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: ${K("ja",t)} \u4EF6`,timesUnit:()=>" \u56DE",itemsUnit:()=>" \u4EF6",charactersUnit:()=>" \u6587\u5B57",throughputUnit:" ops/\u79D2"})}),hr=Object.freeze(Object.keys(_n.en)),mn=Object.freeze([...xa,...hr]),et=Object.freeze({en:Object.freeze({...mr.en,..._n.en}),ja:Object.freeze({...mr.ja,..._n.ja})}),qo=new Set(mn),gr=Object.keys(et).map(e=>JSON.stringify(e)).join(" or "),fr=Object.freeze({locale:"locale",labels:"labels"}),Yo=(e,t,n)=>{e[t]=n},va=(e,t=fr.locale)=>{if(e!==void 0&&typeof e!="string")throw new TypeError(`[contact-map] ${t} must be ${gr} or left out; got ${X(e)}`);if(e!==void 0&&!Object.hasOwn(et,e))throw new RangeError(`[contact-map] ${t} must be ${gr} or left out; got ${X(e)}`);return Ko(e)},Qo=(e,t,n,a)=>{if(typeof a=="function"){if(typeof n!="function")throw new TypeError(`[contact-map] ${e}.${t} must be a function; got ${X(n)}`);return}if(typeof n!="string")throw new TypeError(`[contact-map] ${e}.${t} must be a string; got ${X(n)}`);if(n.trim()==="")throw new RangeError(`[contact-map] ${e}.${t} must not be empty or blank; got ${X(n)}`)},Xo=(e,t,n)=>{let a=Object.create(null);for(let s of Object.getOwnPropertyNames(e)){if(!qo.has(s)){let r=Dn(s,mn);throw new RangeError(`[contact-map] ${n} has a key that is not a label key (${r===void 0?"":`did you mean ${JSON.stringify(r)}? `}CONTACT_MAP_LABEL_KEYS lists every key); got ${X(s)}`)}let o=e[s];o!==void 0&&(Qo(n,s,o,t[s]),a[s]=o)}return a},Jo=e=>{let t={},n=!1;for(let a of xa){let s=e[a];s!==void 0&&(t[a]=s,n=!0)}return n?t:void 0},Ca=(e,t,n=fr)=>{let a=va(e,n.locale);if(t===void 0)return et[a];if(!$t(t))throw new TypeError(`[contact-map] ${n.labels} must be a plain object or left out; got ${X(t)}`);let s=Xo(t,et[a],n.labels),r={...Vo(a,Jo(s)),..._n[a]};for(let c of hr){let d=s[c];d!==void 0&&Yo(r,c,d)}return Object.freeze(r)},ka=e=>{let t={};for(let n of xa)t[n]=e[n];return Object.freeze(t)},Sa=e=>{let t={};for(let n of jo)t[n]=e[n];return Object.freeze(t)}});import{DIRECTORY_TREE_LABEL_KEYS as Zo}from"@aiquants/directory-tree";import{VIRTUAL_SCROLL_LABEL_KEYS as es}from"@aiquants/virtualscroll";import{createContext as ts,useContext as yr,useMemo as br,useRef as ns}from"react";import{jsx as rs}from"react/jsx-runtime";var as,wa,Ta,xr,be,G,se=he(()=>{"use strict";Ct();as=Object.freeze({locale:"en",labels:et.en,treeLabels:ka(et.en),engineLabels:Sa(et.en)}),wa=ts(as),Ta=(e,t)=>{let n=ns(null),a=n.current;return a!==null&&t.every(s=>a[s]===e[s])?a:(n.current=e,e)},xr=({locale:e,labels:t,surface:n,children:a})=>{let s=va(e,n.locale),o=br(()=>Ca(s,t,n),[s,t,n]),r=Ta(o,mn),c=Ta(ka(r),Zo),d=Ta(Sa(r),es),l=br(()=>({locale:s,labels:r,treeLabels:c,engineLabels:d}),[s,r,c,d]);return rs(wa.Provider,{value:l,children:a})},be=()=>yr(wa),G=()=>yr(wa).labels});var Wn,An,Hn,In,Pa=he(()=>{"use strict";Wn="fixed inset-y-0 left-0 m-0 h-auto max-h-none w-auto max-w-none border-0 bg-transparent p-0 text-inherit outline-none backdrop:bg-transparent motion-safe:transition-[right] motion-safe:duration-500 motion-safe:ease-[ease]",An=Object.freeze({right:"var(--aqcm-overlay-right, 0px)"}),Hn="absolute inset-0 bg-slate-900/50",In=()=>!1});var is,ct,Cr,jt,gn=he(()=>{"use strict";is="pointer-coarse:min-w-11 pointer-coarse:py-[max(0px,calc((2.75rem_-_1lh)_/_2))]",ct="focus-visible:outline-2 focus-visible:outline-blue-700 focus-visible:outline-offset-2 dark:focus-visible:outline-sky-300",Cr="in-focus-visible:data-[contact-map-row-active]:outline-2 in-focus-visible:data-[contact-map-row-active]:-outline-offset-2 in-focus-visible:data-[contact-map-row-active]:outline-blue-700 dark:in-focus-visible:data-[contact-map-row-active]:outline-sky-300",jt=`underline-offset-2 hover:underline focus-visible:underline ${ct} ${is}`});import{clsx as ls}from"clsx";import{twMerge as ds}from"tailwind-merge";function ue(...e){return ds(ls(e))}var hn=he(()=>{"use strict"});import{useOverlayDialog as cs}from"@aiquants/swipe-overlay";import ps from"lucide-react/dist/esm/icons/check.js";import us from"lucide-react/dist/esm/icons/copy.js";import ms from"lucide-react/dist/esm/icons/x.js";import{useCallback as Yt,useEffect as kr,useId as gs,useMemo as Fn,useRef as Sr,useState as hs}from"react";import{createPortal as fs}from"react-dom";import{jsx as q,jsxs as Ae}from"react/jsx-runtime";var bs,ke,ys,xs,vs,fn,qt,Cs,ks,Gt,Ra,La,zn,Ea=he(()=>{"use strict";yt();se();Pa();gn();hn();bs=350,ke=e=>e.stopPropagation(),ys=Object.freeze({onClick:ke,onDoubleClick:ke,onContextMenu:ke,onPointerDown:ke,onPointerUp:ke,onMouseDown:ke,onMouseUp:ke,onTouchStart:ke,onTouchEnd:ke,onKeyDown:ke,onKeyUp:ke,onFocus:ke,onBlur:ke}),xs=ue(Wn,"flex items-center justify-center px-4 py-6"),vs="relative max-h-full w-full max-w-md overflow-y-auto overscroll-contain 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",fn=0,qt=null,Cs=()=>{let e=document.body.style;fn+=1,fn===1&&(qt={userSelect:e.userSelect,webkitUserSelect:e.webkitUserSelect}),e.userSelect="none",typeof e.webkitUserSelect<"u"&&(e.webkitUserSelect="none")},ks=()=>{if(fn=Math.max(0,fn-1),fn>0||!qt)return;let e=document.body.style;e.userSelect=qt.userSelect,typeof qt.webkitUserSelect<"u"&&(e.webkitUserSelect=qt.webkitUserSelect),qt=null},Gt=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},Ra=(e,t)=>{let n=new Set;return e.reduce((a,s)=>{let o=typeof s.value=="string"?s.value.trim():"";if(!o)return a;let{normalized:r,key:c,entry:d}=t(o,s);return r&&!n.has(c)&&(n.add(c),a.push(d(r))),a},[])},La=({value:e,ariaLabel:t})=>{let[n,a]=hs(!1),s=Sr(null),o=Yt(async d=>{if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(d),!0}catch{}if(typeof document>"u")return!1;let l=document.createElement("textarea");l.value=d,l.setAttribute("readonly",""),l.style.position="absolute",l.style.left="-9999px",document.body.appendChild(l),l.select(),l.setSelectionRange(0,l.value.length);let u=document.execCommand("copy");return document.body.removeChild(l),u},[]),r=Yt(async d=>{d.preventDefault(),d.stopPropagation(),s.current!==null&&typeof window<"u"&&(window.clearTimeout(s.current),s.current=null);let l=await o(e);a(l),l&&typeof window<"u"&&(s.current=window.setTimeout(()=>{a(!1),s.current=null},1500))},[o,e]);kr(()=>()=>{s.current!==null&&typeof window<"u"&&(window.clearTimeout(s.current),s.current=null)},[]);let c=n?ps:us;return q("button",{type:"button",className:`inline-flex h-6 pointer-coarse:h-11 pointer-coarse:w-11 w-6 shrink-0 items-center justify-center rounded-md border border-gray-200 text-slate-600 transition-colors hover:bg-gray-100 dark:text-slate-300 ${ct}`,onClick:r,"aria-label":t,title:t,children:q(c,{className:"h-3.5 w-3.5","aria-hidden":"true"})})},zn=({contactData:e,openEmailsWithGmail:t,openGmailCompose:n,onRequestClose:a})=>{let s=G(),o=Sr(null),r=Fn(()=>e.contacted_at?$e(e.contacted_at,s.recordDate):null,[e.contacted_at,s.recordDate]),c=Gt(e.full_name)??s.noName,d=Gt(e.company_name),l=Gt(e.department),u=Gt(e.title),p=Fn(()=>Ra([{fieldKey:"company_name",label:s.fieldCompanyName,value:d},{fieldKey:"department",label:s.fieldDepartment,value:l},{fieldKey:"title",label:s.fieldTitle,value:u}],(y,{fieldKey:T,label:D})=>({normalized:y,key:`${T}-${y.toLowerCase()}`,entry:b=>({fieldKey:T,label:D,value:b})})),[d,l,u,s]),i=Fn(()=>Ra([{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}],(y,{fieldKey:T,label:D})=>{let b=un(y);return{normalized:Gt(y),key:(b??y).toLowerCase(),entry:Y=>({fieldKey:T,label:D,value:Y,href:b})}}),[e.custom_mobile_phone_number,e.mobile_phone_number,e.custom_company_phone_number,e.company_phone_number,s]),m=Fn(()=>Ra([{fieldKey:"custom_email",label:s.popupCustomEmail,value:e.custom_email},{fieldKey:"email",label:s.popupEmail,value:e.email}],(y,{fieldKey:T,label:D})=>{let b=Gt(y),S=Ze(y,t),Y=!!S?.startsWith("https://mail.google.com");return{normalized:b,key:y.toLowerCase(),entry:_=>({fieldKey:T,label:D,value:_,href:S,isGmailLink:Y})}}),[e.custom_email,e.email,t,s]),h=i.length>0||m.length>0,x=gs(),C=Yt(()=>{a(),o.current=null},[a]),v=Yt(y=>y.ownerDocument.getElementById(x),[x]),{dialogProps:H,backdropProps:A}=cs({isOpen:!0,onClose:C,isCloseBlocked:In,initialFocus:v}),f=Yt((y,T)=>{T.isGmailLink&&(y.preventDefault(),n(T.value))},[n]),g=Yt((y,T)=>{if(!T.isGmailLink){o.current=null;return}let D=Date.now(),b=o.current;if(b&&b.email===T.value&&D-b.timestamp<=bs){o.current=null,y.preventDefault(),n(T.value);return}o.current={email:T.value,timestamp:D}},[n]);return kr(()=>(Cs(),ks),[]),fs(Ae("dialog",{...H,...ys,"data-contact-popup-root":"true","aria-labelledby":x,className:xs,style:An,children:[q("div",{...A,"data-contact-popup-backdrop":"",className:Hn}),Ae("div",{"data-contact-popup-card":"",className:vs,children:[Ae("div",{className:"flex items-center justify-between gap-4",children:[q("h2",{id:x,tabIndex:-1,className:"wrap-break-word min-w-0 font-semibold text-gray-900 text-lg outline-none dark:text-slate-100",children:c}),q("button",{type:"button",className:`inline-flex shrink-0 items-center justify-center rounded-md p-1 pointer-coarse:p-3.5 text-slate-600 transition-colors hover:bg-gray-100 dark:text-slate-300 dark:hover:bg-slate-800/70 ${ct}`,onClick:C,"aria-label":s.close,children:q(ms,{className:"h-4 w-4","aria-hidden":"true"})})]}),p.length>0?q("div",{className:"mt-2 space-y-2 text-slate-700 text-sm dark:text-slate-200",children:p.map(y=>Ae("div",{className:"flex items-center gap-3",children:[q("p",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:y.value}),q(La,{value:y.value,ariaLabel:s.copyField(y.label)})]},y.fieldKey))}):null,Ae("div",{className:"mt-4 space-y-4 text-slate-700 dark:text-slate-200",children:[i.length>0?q("div",{children:q("ul",{className:"space-y-3 text-sm",children:i.map(y=>q("li",{className:"flex items-start gap-3",children:Ae("div",{className:"flex-1",children:[q("span",{className:"text-slate-600 text-xs dark:text-slate-300",children:y.label}),Ae("div",{className:"mt-1 flex items-center gap-3",children:[q("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:y.href?q("a",{href:y.href,className:`wrap-break-word pointer-coarse:inline-block text-blue-800 dark:text-blue-300 ${jt}`,children:y.value}):q("span",{className:"wrap-break-word text-slate-800 dark:text-slate-100",children:y.value})}),q(La,{value:y.value,ariaLabel:s.copyField(y.label)})]})]})},`${y.fieldKey}-${y.value}`))})}):null,m.length>0?q("div",{children:q("ul",{className:"space-y-3 text-sm",children:m.map(y=>q("li",{className:"flex items-start gap-3",children:Ae("div",{className:"flex-1",children:[q("span",{className:"text-slate-600 text-xs dark:text-slate-300",children:y.label}),Ae("div",{className:"mt-1 flex items-start gap-3",children:[Ae("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:[y.href?q("a",{href:y.href,className:`wrap-break-word pointer-coarse:inline-block text-blue-800 dark:text-blue-300 ${jt}`,target:y.isGmailLink?"_blank":void 0,rel:y.isGmailLink?"noopener noreferrer":void 0,onDoubleClick:T=>f(T,y),onTouchEnd:T=>g(T,y),children:y.value}):q("span",{className:"wrap-break-word text-slate-800 dark:text-slate-100",children:y.value}),y.isGmailLink?q("span",{className:"mt-1 block text-[11px] text-slate-600 dark:text-slate-300",children:s.popupGmailHint}):null]}),q(La,{value:y.value,ariaLabel:s.copyField(y.label)})]})]})},`${y.fieldKey}-${y.value}`))})}):null,r?Ae("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:s.popupLastContactDate}),q("span",{children:r})]}):null,h?null:q("p",{className:"text-slate-600 text-sm dark:text-slate-300",children:s.popupNoContactMethods})]})]})]}),document.body)}});import{jsx as ye,jsxs as bn}from"react/jsx-runtime";var Un,Oa=he(()=>{"use strict";Un=({fullName:e,title:t="-",companyName:n="-",department:a="-",phoneNumber:s="-",email:o="-",updatedAtText:r="-"})=>bn("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:[bn("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:n})}),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:a})}),bn("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})]}),bn("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[ye("span",{className:"truncate text-slate-800 dark:text-slate-100",children:n}),ye("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:a})]}),bn("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:o})]}),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:r})})]})});import{formatQuerySets as Ss,parseQuerySets as Ts}from"@aiquants/fuzzy-search";import{getNormalizedVariants as ws,normalizeText as Ns,romajiToKatakana as Ms}from"@aiquants/select-box";var Nr,Ps,Rs,Ls,Es,Mr,Pr,Os,Ds,_s,Ws,As,Hs,Is,Fs,Rr,Lr,Tr,wr,Bn,zs,Us,Da,Er,_a=he(()=>{"use strict";Nr=/[]/g,Ps=/^[\s ]+|[\s ]+$/g,Rs=/\s+/,Ls=/^[\p{Script=Latin}\s]+$/u,Es=/\p{Script=Latin}/u,Mr=Object.freeze({convertWidth:!0,convertKana:!0,convertCase:!0,convertRomaji:!1,normalizeVariants:!1,ignoreSpaces:!1,ignoreSymbols:!1,ignoreLongVowels:!1}),Pr="union",Os=65377,Ds=65439,_s=["\uFF9E","\uFF9F"],Ws=(()=>{let e=new Map;for(let t=Os;t<=Ds;t+=1){let n=String.fromCharCode(t);e.set(n.normalize("NFKC"),n);for(let a of _s){let s=(n+a).normalize("NFKC");s.length===1&&e.set(s,n+a)}}return e})(),As=/[-ヿ]/u,Hs=e=>{let t=Array.from(e,n=>Ws.get(n)??n).join("");return As.test(t)?null:t},Is=e=>Ns(e.replace(Nr,"").replace(Ps,""),Mr),Fs=e=>{if(!Ls.test(e))return null;let t=Ms(e);return Es.test(t)?null:t},Rr=e=>e.split(Rs).filter(Boolean),Lr=e=>Ts(e,Pr).sets.map(({query:t})=>t),Tr=e=>Lr(e).flatMap(t=>Rr(t)),wr=e=>Ss({combine:Pr,sets:Array.from(new Set(e),t=>({query:t}))}),Bn=e=>{let t=Lr(e.replace(Nr,"")).map(a=>Rr(Is(a)).join(" ")).filter(a=>a!==""),n=[];for(let a of t){let s=Fs(a);if(s===null)return wr(t);n.push(s)}return wr(n)},zs=e=>{let t=new Set([...Tr(e),...Tr(Bn(e))]),n=new Set;for(let a of t)for(let s of ws(a,Mr)){let o=s.trim();if(!o)continue;n.add(o);let r=Hs(o);r!==null&&n.add(r)}return Array.from(n)},Us=/[.*+?^${}()|[\]\\]/g,Da=e=>{let t=zs(e);if(t.length===0)return null;let n=t.map(a=>a.replace(Us,"\\$&")).sort((a,s)=>s.length-a.length);return new RegExp(n.join("|"),"gi")},Er=(e,t)=>{let n=Da(e);if(n===null)return s=>s;let a=s=>t.some(o=>{let r=s[o];return typeof r=="string"&&r.search(n)!==-1});return s=>{let o=[],r=[];for(let c of s)a(c.item)?o.push(c):r.push(c);return[...o,...r]}}});import{memo as Bs}from"react";import{Fragment as Wa,jsx as $n}from"react/jsx-runtime";var $s,pe,Vn=he(()=>{"use strict";_a();$s="rounded bg-yellow-200 px-1 text-gray-900 dark:bg-yellow-900 dark:text-yellow-100",pe=Bs(({text:e,query:t,enabled:n=!0})=>{if(!(n&&t?.trim()&&e))return $n(Wa,{children:e});let a=Da(t);if(a===null)return $n(Wa,{children:e});let s=[],o=0,r=a.exec(e),c=0;for(;r;){let d=r[0],l=r.index;if(l>o&&s.push(e.substring(o,l)),d.length===0){a.lastIndex++,r=a.exec(e);continue}s.push($n("mark",{className:$s,children:d},`highlight-${l}-${c}`)),o=l+d.length,c+=1,r=a.exec(e)}return o<e.length&&s.push(e.substring(o)),$n(Wa,{children:s})});pe.displayName="HighlightedText"});var Dr={};Bo(Dr,{ContactDetailGrid:()=>Or,default:()=>Vs});import{useMemo as Aa}from"react";import{Fragment as Ks,jsx as Ha,jsxs as js}from"react/jsx-runtime";var Kn,Or,Vs,_r=he(()=>{"use strict";yt();se();Ea();Oa();Vn();Kn=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},Or=({contactData:e,searchTerm:t,enableHighlighting:n,openEmailsWithGmail:a,openGmailCompose:s,isPopupVisible:o,onRequestClose:r})=>{let c=G(),d=Aa(()=>Ut(e),[e]),l=Aa(()=>Bt(e),[e]),u=d.value??"-",p=l.value??"-",i=Aa(()=>$e(e.updated_at,c.recordDateTime),[e.updated_at,c.recordDateTime]),m=Kn(e.full_name)??c.noName,h=Kn(e.company_name),x=Kn(e.department),C=(v,H="-")=>Ha(pe,{text:v??H,query:t,enabled:n});return js(Ks,{children:[Ha(Un,{fullName:C(m),title:C(Kn(e.title)),companyName:C(h),department:C(x),phoneNumber:p,email:C(u),updatedAtText:i}),o?Ha(zn,{contactData:e,openEmailsWithGmail:a,openGmailCompose:s,onRequestClose:r}):null]})},Vs=Or});se();import{DEFAULT_FUZZY_SEARCH_OPTIONS as Kt}from"@aiquants/fuzzy-search";import{memo as os,useId as vr}from"react";import{jsx as Ve,jsxs as tt}from"react/jsx-runtime";var Na=os(({searchOptions:e,setSearchOptions:t})=>{let n=G(),a="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",o=vr(),r=vr(),c=[];return c.push(tt("div",{className:`${a} border-sky-200 border-l-4 dark:border-sky-400/60`,children:[tt("div",{className:`${s} text-sky-700 dark:text-sky-300`,children:["\u{1F4D8} ",n.advancedLearningHeading]}),Ve("label",{htmlFor:o,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.advancedLearningLabel}),Ve("input",{id:o,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.learningWeight||Kt.learningWeight,onChange:d=>t(l=>({...l,learningWeight:parseFloat(d.target.value)})),className:"w-full"}),tt("span",{className:"text-sky-600 text-xs dark:text-sky-300",children:[n.currentValueLabel," ",e.learningWeight||Kt.learningWeight]}),Ve("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.advancedLearningHint})]},"learning")),c.push(tt("div",{className:`${a} border-indigo-200 border-l-4 dark:border-indigo-400/60`,children:[tt("div",{className:`${s} text-indigo-700 dark:text-indigo-300`,children:["\u23F1\uFE0F ",n.advancedDebounceHeading]}),Ve("label",{htmlFor:r,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.advancedDebounceLabel}),Ve("input",{id:r,type:"range",min:"100",max:"1000",step:"50",value:e.debounceMs??Kt.debounceMs,onChange:d=>t(l=>({...l,debounceMs:parseInt(d.target.value,10)})),className:"w-full"}),tt("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[n.currentValueLabel," ",e.debounceMs??Kt.debounceMs]}),Ve("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.advancedDebounceHint})]},"debounce")),tt("section",{className:"space-y-3",children:[tt("div",{className:"flex items-center justify-between gap-3",children:[tt("div",{className:"flex items-center gap-2 font-semibold text-gray-700 text-xs transition-colors dark:text-slate-200",children:[Ve("span",{children:"\u26A1"}),Ve("span",{className:"tracking-wide",children:n.settingsAdvancedTab})]}),Ve("button",{type:"button",onClick:()=>t(d=>({...d,learningWeight:Kt.learningWeight,debounceMs:Kt.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:n.resetToDefaultsTitle,children:n.reset})]}),Ve("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:c})]})});Na.displayName="AdvancedSearchSettings";se();import{DEFAULT_FUZZY_SEARCH_OPTIONS as kt}from"@aiquants/fuzzy-search";import{memo as ss,useId as Ke}from"react";import{jsx as J,jsxs as ee}from"react/jsx-runtime";var Ma=ss(({searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:a,openEmailsWithGmail:s,setOpenEmailsWithGmail:o})=>{let r=G(),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",d="text-xs font-semibold",l=Ke(),u=Ke(),p=Ke(),i=Ke(),m=Ke(),h=Ke(),x=Ke(),C=Ke(),v=Ke(),H=Ke(),A=[];return A.push(ee("div",{className:`${c} border-blue-200 border-l-4 dark:border-blue-500/50`,children:[ee("div",{className:`${d} text-blue-700 dark:text-blue-300`,children:["\u{1F3AF} ",r.basicThresholdHeading]}),J("label",{htmlFor:l,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:r.basicThresholdLabel}),J("input",{id:l,type:"range",min:"0.0",max:e.sortBy==="relevance"?"1.5":"1.0",step:"0.05",value:e.threshold??kt.threshold,onChange:f=>t(g=>({...g,threshold:parseFloat(f.target.value)})),className:"w-full"}),ee("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[r.currentValueLabel," ",e.threshold??kt.threshold]}),J("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:e.sortBy==="relevance"?r.basicThresholdRangeRelevance:r.basicThresholdRange})]},"threshold")),A.push(ee("div",{className:`${c} border-amber-200 border-l-4 dark:border-amber-400/60`,children:[ee("div",{className:`${d} text-amber-700 dark:text-amber-300`,children:["\u{1FA84} ",r.basicDisplayHeading]}),ee("label",{htmlFor:u,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[J("input",{id:u,type:"checkbox",checked:e.caseSensitive??kt.caseSensitive,onChange:f=>t(g=>({...g,caseSensitive:f.target.checked})),className:"h-3 w-3"}),r.basicCaseSensitive]}),ee("label",{htmlFor:p,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[J("input",{id:p,type:"checkbox",checked:n,onChange:f=>a(f.target.checked),className:"h-3 w-3"}),r.basicHighlight]}),ee("label",{htmlFor:i,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[J("input",{id:i,type:"checkbox",checked:s,onChange:f=>o(f.target.checked),className:"h-3 w-3"}),r.basicOpenEmailsWithGmail]}),ee("div",{className:"flex flex-col gap-1",children:[J("label",{htmlFor:m,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:r.basicMultiTermOperator}),ee("select",{id:m,value:e.multiTermOperator??kt.multiTermOperator,onChange:f=>t(g=>({...g,multiTermOperator:f.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:[J("option",{value:"or",children:r.basicOperatorOr}),J("option",{value:"and",children:r.basicOperatorAnd})]}),J("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:r.basicMultiTermHint})]})]},"display")),A.push(ee("div",{className:`${c} border-emerald-200 border-l-4 dark:border-emerald-400/60`,children:[ee("div",{className:`${d} text-emerald-700 dark:text-emerald-300`,children:["\u{1F4DA} ",r.basicSortHeading]}),ee("div",{className:"flex flex-col gap-2",children:[J("label",{htmlFor:h,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:r.basicSortBy}),ee("select",{id:h,value:e.sortBy||kt.sortBy,onChange:f=>t(g=>({...g,sortBy:f.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:[J("option",{value:"score",children:r.basicSortByScore}),J("option",{value:"relevance",children:r.basicSortByRelevance}),J("option",{value:"original",children:r.basicSortByOriginal})]})]}),ee("div",{className:"flex flex-col gap-2",children:[J("label",{htmlFor:x,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:r.basicSortOrder}),ee("select",{id:x,value:e.sortOrder||kt.sortOrder,onChange:f=>t(g=>({...g,sortOrder:f.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:[J("option",{value:"desc",children:r.basicSortDescending}),J("option",{value:"asc",children:r.basicSortAscending})]})]})]},"sorting")),A.push(ee("div",{className:`${c} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[ee("div",{className:`${d} text-purple-700 dark:text-purple-300`,children:["\u2699\uFE0F ",r.basicEngineHeading]}),J("label",{htmlFor:C,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:r.basicStrategy}),ee("select",{id:C,value:e.parallelSearchStrategy||kt.parallelSearchStrategy,onChange:f=>t(g=>({...g,parallelSearchStrategy:f.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:[J("option",{value:"balanced",children:r.basicStrategyBalanced}),J("option",{value:"index-first",children:r.basicStrategyIndexFirst}),J("option",{value:"levenshtein-first",children:r.basicStrategyLevenshteinFirst})]}),ee("div",{className:"mt-2 space-y-2",children:[ee("label",{htmlFor:v,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[J("input",{id:v,type:"checkbox",checked:e.enableIndexFiltering!==!1,onChange:f=>t(g=>({...g,enableIndexFiltering:f.target.checked})),className:"h-3 w-3"}),r.basicIndexFiltering]}),ee("label",{htmlFor:H,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[J("input",{id:H,type:"checkbox",checked:e.enableLevenshtein!==!1,onChange:f=>t(g=>({...g,enableLevenshtein:f.target.checked})),className:"h-3 w-3"}),r.basicLevenshtein]})]})]},"engine")),ee("section",{className:"space-y-3",children:[ee("div",{className:"flex items-center gap-2 font-semibold text-blue-700 text-xs transition-colors dark:text-sky-400",children:[J("span",{children:"\u{1F527}"}),J("span",{className:"tracking-wide",children:r.settingsBasicTab})]}),J("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:A})]})});Ma.displayName="BasicSearchSettings";yt();import{SWIPE_OVERLAY_SCROLL_AREA_STYLE as Gs}from"@aiquants/swipe-overlay";import qs from"lucide-react/dist/esm/icons/badge-check.js";import Ys from"lucide-react/dist/esm/icons/building-2.js";import Qs from"lucide-react/dist/esm/icons/calendar-clock.js";import Xs from"lucide-react/dist/esm/icons/check.js";import Js from"lucide-react/dist/esm/icons/copy.js";import Zs from"lucide-react/dist/esm/icons/id-card.js";import ei from"lucide-react/dist/esm/icons/mail.js";import ti from"lucide-react/dist/esm/icons/phone.js";import ni from"lucide-react/dist/esm/icons/user-round.js";import{useCallback as ai,useEffect as ri,useMemo as qn,useRef as oi,useState as si}from"react";var je={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();hn();import*as He from"@radix-ui/react-tabs";import*as jn from"react";import{jsx as Ia}from"react/jsx-runtime";var Gn=He.Root,yn=jn.forwardRef(({className:e,...t},n)=>Ia(He.List,{ref:n,className:ue("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));yn.displayName=He.List.displayName;var St=jn.forwardRef(({className:e,...t},n)=>Ia(He.Trigger,{ref:n,className:ue("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}));St.displayName=He.Trigger.displayName;var Tt=jn.forwardRef(({className:e,...t},n)=>Ia(He.Content,{ref:n,className:ue("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}));Tt.displayName=He.Content.displayName;gn();Vn();import{jsx as w,jsxs as ce}from"react/jsx-runtime";var Wr="truncate font-semibold text-slate-900 text-xs dark:text-slate-100",Ar={height:"var(--contact-panel-height, 100%)",maxHeight:"100%"},ii=({icon:e,label:t,value:n,fieldKey:a,copyValue:s,onCopy:o,isCopied:r,linkHref:c,searchTerm:d,enableHighlighting:l})=>{let u=G(),p=!!(o&&a&&s),i=c?.startsWith("https://mail.google.com")?"_blank":void 0;return ce("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:[ce("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[w("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:w(e,{size:14})}),ce("div",{className:"min-w-0 flex-1",children:[w("div",{className:"font-medium text-[10px] text-slate-600 dark:text-slate-300",children:t}),c?w("a",{href:c,className:`inline-block max-w-full align-top ${Wr} ${jt}`,target:i,rel:i?"noopener noreferrer":void 0,children:w(pe,{text:n,query:d??"",enabled:l})}):w("div",{className:Wr,children:w(pe,{text:n,query:d??"",enabled:l})})]})]}),p?w("button",{type:"button",onClick:()=>o&&a&&s&&o(a,s,t),className:`inline-flex h-6 pointer-coarse:h-11 pointer-coarse:w-11 w-6 shrink-0 touch-manipulation 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 ${ct}`,"aria-label":u.copyField(t),children:r?w(Xs,{size:14}):w(Js,{size:14})}):null]})},Hr=({items:e,searchTerm:t,enableHighlighting:n})=>w("dl",{className:"grid grid-cols-1 gap-x-3 gap-y-1.5 sm:grid-cols-2",children:e.map(a=>ce("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:[w("dt",{className:"font-semibold text-[10px] text-slate-600 uppercase tracking-wide dark:text-slate-300",children:a.label}),w("dd",{className:"wrap-break-word text-slate-900 text-xs dark:text-slate-100",children:w(pe,{text:a.value,query:t??"",enabled:n})})]},a.fieldKey))}),Fa=({title:e})=>w("h3",{className:"font-semibold text-slate-700 text-xs dark:text-slate-200",children:e}),li=()=>{let e=G();return ce("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:[w("p",{className:"font-medium text-slate-600 text-xs dark:text-slate-200",children:e.detailEmptyTitle}),w("p",{className:"text-[11px] text-slate-600 dark:text-slate-300",children:e.detailEmptyHint})]})},di=Object.freeze({overlay:Gs,pane:void 0}),Qt=({contact:e,placement:t,searchTerm:n,enableHighlighting:a,style:s,className:o=""})=>{let r=G(),[c,d]=si(null),l=oi(null),u=qn(()=>({...Ar,...s}),[s]);ri(()=>()=>{l.current!==null&&window.clearTimeout(l.current)},[]);let p=qn(()=>Ut(e),[e]),i=qn(()=>Bt(e),[e]),m=qn(()=>$e(e?.contacted_at,r.recordDateTime),[e?.contacted_at,r.recordDateTime]),h=ai(async(b,S,Y)=>{try{await navigator.clipboard.writeText(S),d(b),l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{d(null)},2e3)}catch(_){je.error("Failed to copy contact detail",_)}},[]);if(!e)return w("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:Ar,children:w(li,{})});let x=[j(e.title),j(e.department)].filter(b=>b!=="-"),C=[x.join(" / "),j(e.company_name)].filter(b=>b&&b!=="-").join(" \u30FB ")||"-",v=We(e.full_name)??r.noName,H=[{fieldKey:"full_name",label:r.fieldFullName,value:v},{fieldKey:"full_name_reading",label:r.fieldFullNameReading,value:j(e.full_name_reading)},{fieldKey:"title",label:r.fieldTitle,value:j(e.title)},{fieldKey:"department",label:r.fieldDepartment,value:j(e.department)},{fieldKey:"company_name",label:r.fieldCompanyName,value:j(e.company_name)},{fieldKey:"company_name_reading",label:r.fieldCompanyNameReading,value:j(e.company_name_reading)},{fieldKey:"address",label:r.fieldAddress,value:j(e.address)},{fieldKey:"postal_code",label:r.fieldPostalCode,value:j(e.postal_code)},{fieldKey:"url",label:r.fieldUrl,value:j(e.url)}],A=[{label:r.fieldCustomEmail,value:j(e.custom_email),fieldKey:"custom_email",rawValue:e.custom_email},{label:r.fieldEmail,value:j(e.email),fieldKey:"email",rawValue:e.email}].filter(b=>b.value!=="-"),f=[{label:r.fieldCustomMobilePhone,value:j(e.custom_mobile_phone_number),fieldKey:"custom_mobile_phone_number",rawValue:e.custom_mobile_phone_number},{label:r.fieldMobilePhone,value:j(e.mobile_phone_number),fieldKey:"mobile_phone_number",rawValue:e.mobile_phone_number},{label:r.fieldCompanyPhone,value:j(e.company_phone_number),fieldKey:"company_phone_number",rawValue:e.company_phone_number},{label:r.fieldCompanyFax,value:j(e.company_fax_number),fieldKey:"company_fax_number",rawValue:e.company_fax_number}].filter(b=>b.value!=="-"),g=[{fieldKey:"person_id",label:"person_id",value:j(e.person_id)},{fieldKey:"person_id_redirect_to",label:"person_id_redirect_to",value:j(e.person_id_redirect_to)},{fieldKey:"is_active",label:"is_active",value:j(e.is_active)},{fieldKey:"is_contact_synced",label:"is_contact_synced",value:j(e.is_contact_synced)},{fieldKey:"is_incomplete",label:"is_incomplete",value:j(e.is_incomplete)},{fieldKey:"is_in_eight",label:"is_in_eight",value:j(e.is_in_eight)},{fieldKey:"created_by",label:r.fieldCreatedBy,value:j(e.created_by)},{fieldKey:"created_at",label:r.fieldCreatedAt,value:$e(e.created_at,r.recordDateTime)},{fieldKey:"updated_by",label:r.fieldUpdatedBy,value:j(e.updated_by)},{fieldKey:"updated_at",label:r.fieldUpdatedAt,value:$e(e.updated_at,r.recordDateTime)}],y=[{rowKey:"person_id",icon:Zs,label:"person_id",value:j(e.person_id),fieldKey:"person_id",copyValue:String(e.person_id)},{rowKey:"primary_email",icon:ei,label:r.summaryEmail,value:p.value??"-",fieldKey:"primary_email",copyValue:p.value,linkHref:Ze(p.value,!1)},{rowKey:"primary_phone",icon:ti,label:r.summaryPhone,value:i.value??"-",fieldKey:"primary_phone",copyValue:i.value,linkHref:un(i.value)},{rowKey:"contacted_at",icon:Qs,label:r.summaryLastContact,value:m}],T=[{sectionKey:"email",title:r.sectionEmail,emptyText:r.sectionEmailEmpty,entries:A,recommendedKey:p.fieldKey??null,resolveHref:b=>Ze(b!=null?String(b):null,!1)},{sectionKey:"phone",title:r.sectionPhone,emptyText:r.sectionPhoneEmpty,entries:f,recommendedKey:i.fieldKey??null,resolveHref:b=>un(b!=null?String(b):null)}],D=[{value:"summary",label:r.detailTabSummary,content:ce("div",{className:"flex flex-col gap-4",children:[ce("div",{className:"flex flex-col gap-1",children:[ce("div",{className:"flex items-center gap-2 text-slate-600 text-sm dark:text-slate-300",children:[w(Ys,{size:16}),w("span",{children:w(pe,{text:j(e.company_name),query:n??"",enabled:a})})]}),x.length>0?w("div",{className:"text-slate-600 text-sm dark:text-slate-300",children:x.map((b,S)=>ce("span",{children:[S>0&&" / ",w(pe,{text:b,query:n??"",enabled:a})]},`header-line-${S}`))}):null]}),w("div",{className:"flex flex-col gap-3",children:y.map(b=>w(ii,{icon:b.icon,label:b.label,value:b.value,fieldKey:b.fieldKey,copyValue:b.copyValue,onCopy:h,isCopied:b.fieldKey?c===b.fieldKey:!1,linkHref:b.linkHref,searchTerm:n,enableHighlighting:a},b.rowKey))})]})},{value:"basic",label:r.detailTabBasic,content:ce("div",{className:"flex flex-col gap-3",children:[w(Fa,{title:r.detailBasicProfile}),w(Hr,{items:H,searchTerm:n,enableHighlighting:a})]})},{value:"contact",label:r.detailTabContact,content:w("div",{className:"flex flex-col gap-4",children:T.map(({sectionKey:b,title:S,emptyText:Y,entries:_,recommendedKey:ie,resolveHref:Q})=>ce("div",{className:"flex flex-col gap-2",children:[w(Fa,{title:S}),_.length===0?w("p",{className:"text-slate-600 text-xs dark:text-slate-300",children:Y}):w("div",{className:"flex flex-col gap-2",children:_.map(O=>{let E=Q(O.rawValue),U=O.fieldKey===ie;return ce("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-slate-200 bg-white px-3 py-2 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[ce("div",{className:"min-w-0 flex-1",children:[w("div",{className:"font-medium text-slate-600 text-xs dark:text-slate-300",children:O.label}),w("div",{className:"wrap-break-word text-slate-900 text-sm dark:text-slate-100",children:E?w("a",{href:E,className:`pointer-coarse:inline-block text-inherit ${jt}`,children:w(pe,{text:O.value,query:n??"",enabled:a})}):w(pe,{text:O.value,query:n??"",enabled:a})})]}),U?ce("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-emerald-100 px-2 py-0.5 font-semibold text-[11px] text-emerald-900 transition-colors dark:bg-emerald-300/20 dark:text-emerald-200",children:[w(qs,{size:14}),r.preferred]}):null]},O.fieldKey)})})]},b))})},{value:"meta",label:r.detailTabMeta,content:ce("div",{className:"flex flex-col gap-3",children:[w(Fa,{title:r.detailTabMeta}),w(Hr,{items:g,searchTerm:n,enableHighlighting:a})]})}];return ce("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 ${o}`.trim(),style:u,children:[w("div",{className:"border-slate-200 border-b px-3 py-1.5 transition-colors dark:border-slate-700 dark:bg-slate-900/50",children:ce("div",{className:"flex items-center gap-2",children:[w("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:w(ni,{size:16})}),ce("div",{className:"min-w-0 flex-1",children:[w("div",{className:"truncate font-semibold text-slate-900 text-sm dark:text-slate-100",children:w(pe,{text:v,query:n??"",enabled:a})}),w("div",{className:"truncate text-[11px] text-slate-600 dark:text-slate-300",children:w(pe,{text:C,query:n??"",enabled:a})})]})]})}),ce(Gn,{defaultValue:"summary",className:"flex flex-1 flex-col overflow-hidden",children:[w(yn,{className:"grid h-auto grid-cols-4 gap-1 rounded-none border-slate-200 border-b bg-slate-50 px-2 py-1 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:D.map(b=>w(St,{value:b.value,className:"flex min-h-6 pointer-coarse:min-h-11 min-w-0 touch-manipulation rounded-md px-1 py-1 font-semibold text-slate-700 text-xs transition-colors data-[state=active]:bg-white data-[state=active]:text-blue-800 dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-sky-300",children:w("span",{className:"min-w-0 truncate",children:b.label})},b.value))}),D.map(b=>w(Tt,{value:b.value,className:"scrollbar-thin flex-1 overflow-y-auto px-2.5 py-2 transition-colors dark:text-slate-200",style:di[t],children:b.content},b.value))]})]})};Ct();se();import{memo as ci}from"react";import{jsx as nt,jsxs as Yn}from"react/jsx-runtime";var za=ci(({recordCount:e,companyCount:t,phase:n,loadedCount:a,totalCount:s,errorMessage:o,onRetry:r})=>{let{locale:c,labels:d}=be(),l=K(c,e),u=K(c,t);return Yn("div",{"data-testid":"contact-map-annotation",className:"flex flex-wrap items-center gap-2 leading-1 transition-colors",role:"status",children:[Yn("span",{className:"flex items-baseline gap-1",children:[nt("span",{className:"text-slate-600 dark:text-slate-300",children:d.annotationTotalLabel}),nt("span",{className:"text-slate-800 dark:text-slate-200","data-testid":"contact-map-record-count",children:l}),nt("span",{className:"text-slate-600 dark:text-slate-300",children:d.recordUnit(l)})]}),Yn("span",{className:"flex items-baseline gap-1",children:[nt("span",{className:"text-slate-600 dark:text-slate-300",children:d.annotationCompaniesLabel}),nt("span",{className:"text-slate-800 dark:text-slate-200","data-testid":"contact-map-company-count",children:u}),nt("span",{className:"text-slate-600 dark:text-slate-300",children:d.companyUnit(u)})]}),n==="streaming"||n==="idle"?nt("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?d.annotationStreamingProgress({loaded:a,total:s,percent:Math.min(100,Math.round(a/s*100))}):d.annotationStreamingCount(a)}):null,n==="retrying"?nt("span",{"data-testid":"contact-map-reconnecting-badge",className:"ml-2 inline-flex items-center gap-1.5 rounded-full bg-amber-50 px-2 py-0.5 font-medium text-amber-900 text-xs dark:bg-amber-900/30 dark:text-amber-200",children:d.annotationReconnecting(a)}):null,n==="failed"||n==="auth-required"?Yn("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==="failed"?o??void 0:void 0,children:["\u26D4 ",n==="auth-required"?d.annotationAuthRequired:d.annotationLoadFailed(a),r?nt("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:d.annotationRetry}):null]}):null]})});za.displayName="ContactMapAnnotation";Vt();import{useMemo as Fo}from"react";xt();Vt();se();import{createContext as ui,useContext as mi,useMemo as gi}from"react";xt();Vt();ya();var pi=["indexWorker","levenshteinWorker","treeWorker"];function Ir(e,t,n){if(n!==void 0){if(typeof n!="string")throw new TypeError(`[contact-map] ${e}.${t} must be a string or left out (pass url.href for a URL object); got ${X(n)}`);if(n.trim()==="")throw new RangeError(`[contact-map] ${e}.${t} must not be empty or blank; got ${X(n)}`)}}var Fr={setting:"workerUrls"},zr=(e,t)=>{if(e===void 0)return;let{setting:n,keys:a=pi,hints:s={}}=t;if(!$t(e))throw new TypeError(`[contact-map] ${n} must be a plain object or left out; got ${X(e)}`);let o=Object.getOwnPropertyNames(e).map(d=>({key:d,url:e[d]})),r=o.find(({key:d,url:l})=>l!==void 0&&!a.includes(d));if(r!==void 0){let d=Object.hasOwn(s,r.key)?s[r.key]:void 0,l=d===void 0?Dn(r.key,a):void 0;throw new RangeError(`[contact-map] ${n} has a key it does not take (it takes ${a.join(", ")}${d===void 0?"":`; ${d}`}${l===void 0?"":`; did you mean ${JSON.stringify(l)}?`}); got ${X(r.key)}`)}let c=Object.create(null);for(let{key:d,url:l}of o){let u=d;Ir(n,u,l),l!==void 0&&(c[u]=l)}return c};function mp(e,t=Fr){zr(e,t)}function Ur(e){Ir("workerUrls","treeWorker",e)}var Xt=(e,t,n=Fr)=>{let a=zr(t,n);return{indexWorker:a?.indexWorker===void 0?e?.indexWorker:a.indexWorker,levenshteinWorker:a?.levenshteinWorker===void 0?e?.levenshteinWorker:a.levenshteinWorker,treeWorker:a?.treeWorker===void 0?e?.treeWorker:a.treeWorker}};import{jsx as Ua}from"react/jsx-runtime";var Br=e=>{if(!$t(e))throw new TypeError(`[contact-map] config must be a plain object; got ${X(e)}`);let t=e;return{streamEndpoint:fe(t,"streamEndpoint"),openEmailsWithGmail:fe(t,"openEmailsWithGmail"),treeWorkerFactory:fe(t,"treeWorkerFactory"),workerUrls:Xt(void 0,fe(t,"workerUrls")),locale:fe(t,"locale"),labels:fe(t,"labels")}},$r=({workerUrls:e,...t})=>{let{indexWorker:n,levenshteinWorker:a,treeWorker:s}=e;return Object.freeze(Object.assign(Object.create(null),t,{workerUrls:Object.freeze({indexWorker:n,levenshteinWorker:a,treeWorker:s})}))},hi=$r(Br({})),Vr=ui(hi),fi=Object.freeze({locale:"locale",labels:"labels"});function Ba({config:e,chromeSurface:t,children:n}){let{streamEndpoint:a,openEmailsWithGmail:s,treeWorkerFactory:o,workerUrls:r,locale:c,labels:d}=Br(e),{indexWorker:l,levenshteinWorker:u,treeWorker:p}=r,i=gi(()=>$r({streamEndpoint:a,openEmailsWithGmail:s,treeWorkerFactory:o,workerUrls:{indexWorker:l,levenshteinWorker:u,treeWorker:p},locale:c,labels:d}),[a,s,o,l,u,p,c,d]);return Ua(Vr.Provider,{value:i,children:Ua(xr,{locale:c,labels:d,surface:t,children:n})})}function bi({config:e,children:t}){return Ua(Ba,{config:e,chromeSurface:fi,children:t})}function at(){return mi(Vr)}import{useCallback as $a,useEffect as Si,useMemo as Jn,useSyncExternalStore as Kr}from"react";xt();var yi=1e3,xi=3e4,vi=6;function Xn(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 ${X(e)}`);if(/[\s\p{Cc}#]/u.test(e))throw new RangeError(`[contact-map] streamEndpoint must not contain whitespace, control characters or "#"; got ${X(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 ${X(e)}`)}var Ci=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}),ki=e=>Array.isArray(e.records),Qn=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?.()};Xn(t.endpoint),this.fetchFn=t.fetchFn??((...n)=>fetch(...n)),this.endpoint=t.endpoint,this.initialRetryDelayMs=t.initialRetryDelayMs??yi,this.maxRetryDelayMs=t.maxRetryDelayMs??xi,this.maxConsecutiveFailures=t.maxConsecutiveFailures??vi,this.logger=t.logger??je}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 n of this.listeners)n(this.state)}publishRecords(t={}){let n=Array.from(this.recordMap.values());this.setState({records:n,loadedCount:n.length,isLoading:!1,...t})}async runStreamLoop(){this.setState({phase:"streaming"});let t=!1;for(;!this.disposed;){let n=this.lastCursor!==null,a=await this.streamOnce();if(a==="aborted")return;if(a==="complete"){this.publishRecords({isComplete:!0,phase:"complete",error:null});return}if(a==="auth-required"){this.setState({phase:"auth-required",isLoading:!1,error:new Error("Authentication required")});return}if(a==="rejected"){if(n&&!t){t=!0,this.lastCursor=null,this.logger.warn("[ContactMapStream] the server rejected the resume cursor (400); restarting from the beginning");continue}this.setState({phase:"failed",isLoading:!1,error:new Error("[contact-map] the server rejected the stream request (400); reload the page")});return}if(this.consecutiveFailures+=1,this.consecutiveFailures>=this.maxConsecutiveFailures){this.setState({phase:"failed",isLoading:!1});return}let s=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 ${s}ms (attempt ${this.consecutiveFailures})`),await this.waitBeforeRetry(s),this.disposed)return;this.setState({phase:"streaming"})}}waitBeforeRetry(t){return new Promise(n=>{let a=setTimeout(()=>{this.wakeRetryWait=null,n()},t);this.wakeRetryWait=()=>{clearTimeout(a),this.wakeRetryWait=null,n()}})}buildStreamUrl(){if(!this.lastCursor)return this.endpoint;let t=this.endpoint.includes("?")?"&":"?",n=new URLSearchParams;return this.lastCursor.contacted_at!==null&&n.set("cursor_contacted_at",this.lastCursor.contacted_at),n.set("cursor_person_id",String(this.lastCursor.person_id)),`${this.endpoint}${t}${n.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.status===400)return"rejected";if(!(t.ok&&t.body))return this.logger.warn(`[ContactMapStream] unexpected response: ${t.status}`),this.setState({error:new Error(`[contact-map] the stream request failed (status ${t.status})`)}),"retryable";let n=t.body.getReader(),a=new TextDecoder,s="",o=!1,r=!1;for(;;){let{done:c,value:d}=await n.read();if(c)break;let l=a.decode(d,{stream:!0}),u=(s+l).split(`
|
|
2
|
+
`);s=u.pop()??"";let p=!1;for(let i of u){let m=i.trim();if(!m)continue;let h;try{h=JSON.parse(m)}catch(x){this.logger.warn("[ContactMapStream] failed to parse NDJSON line:",x);continue}if("type"in h&&h.type==="METADATA"){Number.isSafeInteger(h.total)&&h.total>=0&&this.setState({totalCount:h.total});continue}if(!ki(h)){this.logger.warn("[ContactMapStream] server reported error:","error"in h?h.error:""),r=!0;continue}for(let x of h.records)x&&typeof x.person_id=="number"&&(this.recordMap.set(x.person_id,Ci(x)),p=!0);h.nextCursor&&(this.lastCursor=h.nextCursor),h.isLast&&(o=!0)}p&&(this.consecutiveFailures=0,this.publishRecords({error:null}))}return r?(this.setState({error:new Error("Stream interrupted by server error")}),"retryable"):o?"complete":(this.setState({error:new Error("Stream ended before completion")}),"retryable")}catch(t){if(t instanceof Error&&t.name==="AbortError")return"aborted";let n=t instanceof Error?t:new Error(String(t));return this.setState({error:n}),"retryable"}finally{this.activeController=null}}};var Ie=null,Ti=e=>{if(Ie!==null&&Ie.endpoint===e)return Ie;if(Xn(e),Ie===null)return Ie=new Qn({endpoint:e}),Ie;if(Ie.endpoint!==e)throw new Error(`[contact-map] the stream client already streams from ${JSON.stringify(Ie.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 Ie},Pp=()=>{Ie?.dispose(),Ie=null},wi=new Map,Ni={records:[],loadedCount:0,totalCount:null,isLoading:!0,isComplete:!1,phase:"idle",error:null},Mi=()=>{let{streamEndpoint:e}=at();return Jn(()=>(Xn(e),e),[e])};function Pi(){let e=Mi(),t=$a(()=>Ti(e),[e]);Si(()=>{let r=t();r.start(),r.retryNow()},[t]);let n=$a(r=>t().subscribe(r),[t]),a=Kr(n,()=>t().getState(),()=>Ni),s=Kr(n,()=>t().getRecordMap(),()=>wi),o=$a(()=>t().retryNow(),[t]);return Jn(()=>({...a,recordMap:s,retryNow:o}),[a,s,o])}var Ri=e=>{let t=new Set;for(let{company_name:n}of e)typeof n=="string"&&n.trim().length>0&&t.add(n);return t.size};function Zn(){let{records:e,recordMap:t,isComplete:n,phase:a,loadedCount:s,totalCount:o,error:r,retryNow:c}=Pi(),d=Jn(()=>Ri(e),[e]);return{context:Jn(()=>({contactMapRecords:e,contactMapRecordMap:t,isStreamingComplete:n,isStreamingFailed:a==="failed",streamPhase:a,loadedCount:s,companyCount:d,totalCount:o,errorMessage:r?.message??null}),[e,t,n,a,s,d,o,r]),retryNow:c}}se();import{DEFAULT_FUZZY_SEARCH_OPTIONS as pd,parseQuerySets as ud}from"@aiquants/fuzzy-search";import{useFuzzySearch as md}from"@aiquants/fuzzy-search/react";import gd from"lucide-react/dist/esm/icons/search.js";import{useCallback as an,useEffect as ot,useMemo as mt,useRef as Wo,useState as Ue,useTransition as hd}from"react";import{useNavigation as fd,useSearchParams as bd}from"react-router";_a();Vt();import{useCallback as wt,useEffect as Li,useRef as jr}from"react";var pt=e=>{let t=jr(null),n=jr({isPointerDown:!1,isDragging:!1,startX:0,scrollLeft:0,pointerId:0,hasCapture:!1,didDrag:!1,pointerType:""}),a=e?.dragThreshold??4,s=wt(p=>{let i=p.currentTarget,m=p.deltaY;!i||m===0||(p.preventDefault(),i.scrollBy({left:m,behavior:"smooth"}))},[]),o=wt(p=>{t.current?.removeEventListener("wheel",s),t.current=p,p?.addEventListener("wheel",s,{passive:!1})},[s]);Li(()=>()=>{t.current&&t.current.removeEventListener("wheel",s)},[s]);let r=wt(p=>{if(p.pointerType==="touch")return;let i=n.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=wt(p=>{let i=n.current;if(!i.isPointerDown||i.pointerType==="touch")return;let m=p.currentTarget,h=p.clientX-i.startX;!i.isDragging&&Math.abs(h)>a&&(i.isDragging=!0,i.hasCapture||(m.setPointerCapture?.(p.pointerId),i.hasCapture=!0)),i.isDragging&&(p.preventDefault(),m.scrollLeft=i.scrollLeft-h)},[a]),d=wt(p=>{let i=n.current;if(i.pointerType==="touch")return;let m=p.currentTarget;i.isPointerDown&&i.hasCapture&&m.hasPointerCapture?.(p.pointerId)&&m.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},[]),l=wt(p=>{d(p)},[d]),u=wt(p=>{n.current.didDrag&&(p.preventDefault(),p.stopPropagation(),n.current.didDrag=!1)},[]);return{setScrollableRef:o,onPointerDown:r,onPointerMove:c,onPointerUp:l,onPointerLeave:l,onPointerCancel:l,onClickCapture:u}};Ct();se();import{DEFAULT_FUZZY_SEARCH_OPTIONS as Ei}from"@aiquants/fuzzy-search";var ea=e=>{let{indexWorkerOptions:t,levenshteinWorkerOptions:n,...a}=Ei;return{...a,autoSearchOnIndexRebuild:!1,multiTermOperator:"and",workerUrls:e,indexWorkerOptions:{...t},levenshteinWorkerOptions:{...n}}};hn();import{jsx as Gr}from"react/jsx-runtime";function qr({value:e,max:t=100,className:n,indicatorClassName:a,...s}){let o=e===void 0,r=o?0:Math.min(100,Math.max(0,e/t*100));return Gr("div",{role:"progressbar","aria-valuenow":o?void 0:r,"aria-valuemin":0,"aria-valuemax":100,"data-slot":"progress",className:ue("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",n),...s,children:Gr("div",{"data-slot":"progress-indicator",className:ue("h-full rounded-full bg-primary transition-[width] duration-300 ease-in-out will-change-transform",o&&"w-1/3 animate-progress-indeterminate",a),style:o?void 0:{width:`${r}%`}})})}var Jt="view";import{useCallback as Xl,useState as Jl}from"react";import{useSearchParams as Zl}from"react-router";se();yt();import{Panel as no,PanelGroup as tl,PanelResizeHandle as nl}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as al,VirtualScroll as rl,virtualScrollItemElementId as ol}from"@aiquants/virtualscroll";import{lazy as sl,memo as il,Suspense as ll,useCallback as Me,useEffect as co,useId as ao,useLayoutEffect as po,useMemo as Nt,useRef as Zt,useState as Cn}from"react";var xn={listPanelMinWidth:320,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35},vn={listPanelMinWidth:280,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35};function ta(e){let t=e.listPanelMinWidth+e.detailPanelMinWidth+e.handleThickness+e.listPaddingAndBorder+e.detailPaddingAndBorder,n=t+e.scrollbarSafetyBuffer,a=n+e.hysteresisSafetyMargin,s=a-n;return{physicalMinWidth:t,collapseThreshold:n,expandThreshold:a,hysteresisWidth:s}}import{useCallback as Oi,useEffect as Di,useState as _i}from"react";var Yr=(e,t)=>{let{enableMutationObserver:n=!1,bottomGap:a=4,minFallbackHeight:s=240}=t??{},[o,r]=_i(600),c=Oi(()=>{if(typeof window>"u")return;let d=e.current;if(!d||d.offsetParent===null&&window.getComputedStyle(d).position!=="fixed")return;let l=S=>Number.parseFloat(S)||0,{top:u}=d.getBoundingClientRect(),p=d.parentElement?.getBoundingClientRect(),i=window.getComputedStyle(document.documentElement),m=l(i.getPropertyValue("--footer-height")),h=l(i.getPropertyValue("--header-height")),x=l(i.getPropertyValue("--scrollbar-height")),C=window.getComputedStyle(d),v=l(C.marginBottom),H=l(C.paddingBottom),A=window.innerHeight-m-x-a,f=p?Math.min(p.bottom,A):A,g=p?Math.max(p.top,h):h,y=Math.max(u,g),T=f-y-v-H,D=Number.isFinite(T)?Math.floor(T):0,b=D>0?D:s;b>0&&Number.isFinite(b)&&r(S=>Math.abs(S-b)>1?b:S)},[a,e,s]);return Di(()=>{if(typeof window>"u")return;let d=null,l=null,u=null,p=null,i=()=>{d!==null&&window.cancelAnimationFrame(d),d=window.requestAnimationFrame(()=>{c()})};i(),l=window.setTimeout(()=>{i()},150);let m=e.current;return typeof ResizeObserver<"u"&&m&&(u=new ResizeObserver(()=>{i()}),u.observe(m),m.parentElement&&u.observe(m.parentElement)),n&&typeof MutationObserver<"u"&&(p=new MutationObserver(()=>{i()}),p.observe(document.body,{attributes:!0,childList:!0,subtree:!0})),window.addEventListener("resize",i),()=>{d!==null&&window.cancelAnimationFrame(d),l!==null&&window.clearTimeout(l),u&&u.disconnect(),p&&p.disconnect(),window.removeEventListener("resize",i)}},[e,n,c]),{viewportHeight:o,updateViewportHeight:c}};import{useCallback as rt,useEffect as Qr,useRef as na,useState as Xr}from"react";var Wi=600,Jr=8,aa=({ref:e,onSelect:t,resolveItem:n,item:a})=>{let[s,o]=Xr(!1),[r,c]=Xr(null),d=na(null),l=na(!1),u=na(null),p=na({onSelect:t,resolveItem:n,item:a});Qr(()=>{p.current={onSelect:t,resolveItem:n,item:a}},[t,n,a]);let i=rt(()=>{typeof window>"u"||d.current!==null&&(window.clearTimeout(d.current),d.current=null)},[]),m=rt(()=>{u.current&&(i(),u.current=null)},[i]),h=rt(g=>{typeof window>"u"||g.button!==0&&g.pointerType==="mouse"||(i(),l.current=!1,u.current={x:g.clientX,y:g.clientY,pointerId:g.pointerId},d.current=window.setTimeout(()=>{let y=p.current,T=null;y.item!==void 0?T=y.item:y.resolveItem&&g.target&&(T=y.resolveItem(g.target)),T!==null&&(l.current=!0,y.onSelect?.(T),c(T),o(!0)),m()},Wi))},[i,m]),x=rt(g=>{u.current&&g.pointerId===u.current.pointerId&&(i(),u.current=null)},[i]),C=rt(g=>{l.current&&(g.preventDefault(),g.stopPropagation(),g.type==="click"&&(l.current=!1))},[]),v=rt(()=>{l.current=!1},[]),H=rt(g=>{if(!u.current||g.pointerId!==u.current.pointerId)return;let y=Math.abs(g.clientX-u.current.x),T=Math.abs(g.clientY-u.current.y);(y>Jr||T>Jr)&&(i(),u.current=null)},[i]),A=rt(g=>{(s||d.current!==null)&&(g.preventDefault(),g.stopPropagation())},[s]),f=rt(()=>{o(!1),c(null),l.current=!1,u.current=null},[]);return Qr(()=>{let g=e.current;if(!(g&&typeof window<"u"))return;let y=[["pointerdown",h,void 0],["pointerup",x,void 0],["pointercancel",x,void 0],["pointermove",H,void 0],["pointerleave",x,void 0],["contextmenu",A,void 0]],T=[["mousedown",C,!0],["mouseup",C,!0],["click",C,!0],["pointerdown",v,!0],["keydown",v,!0],["contextmenu",A,!0],["pointerup",x,!0],["pointercancel",x,!0]];for(let[D,b,S]of y)g.addEventListener(D,b,S);for(let[D,b,S]of T)window.addEventListener(D,b,S);return()=>{for(let[D,b,S]of y)g.removeEventListener(D,b,S);for(let[D,b,S]of T)window.removeEventListener(D,b,S);i()}},[e,h,x,H,C,v,A,i]),{isPopupVisible:s,popupItem:r,handleClosePopup:f}};import{useCallback as Ai,useEffect as Hi,useState as Zr,useSyncExternalStore as Ii}from"react";function ra(e,t,n){let a=n?.mediaQuery??"(min-width: 1024px)",s=Ii(Ai(u=>{if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};let p=window.matchMedia(a);return p.addEventListener("change",u),()=>p.removeEventListener("change",u)},[a]),()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(a).matches:!0,()=>!1),[o,r]=Zr(!1),[c,d]=Zr(0);return Hi(()=>{if(typeof window>"u"||typeof ResizeObserver>"u")return;let u=e.current;if(!u)return;let p=new ResizeObserver(i=>{for(let m of i){if(m.target!==u)continue;let h=0;m.borderBoxSize&&m.borderBoxSize.length>0?h=m.borderBoxSize[0].inlineSize:h=m.contentRect.width,!(!Number.isFinite(h)||h<=0)&&(d(h),r(x=>x&&h>=t.expandThreshold?!1:!x&&h<t.collapseThreshold?!0:x))}});return p.observe(u),()=>p.disconnect()},[e,t.collapseThreshold,t.expandThreshold]),{isTwoColumn:s&&!o,isContainerNarrow:o,isMediaMatches:s,containerWidth:c}}se();xt();var eo=e=>e.isComposing||e.keyCode===229;var to=(e,t)=>{if(Ui(t),e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||eo(e)||t.itemCount===0)return null;if(e.key==="Enter"||e.key===" ")return{kind:"activate"};let n=t.itemCount-1;if(t.activeIndex===null)return zi(e.key)?{kind:"move",index:t.startIndex,direction:1}:null;let a=t.activeIndex;switch(e.key){case"ArrowDown":return{kind:"move",index:Math.min(a+1,n),direction:1};case"ArrowUp":return{kind:"move",index:Math.max(a-1,0),direction:-1};case"PageDown":return{kind:"move",index:Math.min(a+t.pageSize,n),direction:1};case"PageUp":return{kind:"move",index:Math.max(a-t.pageSize,0),direction:-1};case"Home":return{kind:"move",index:0,direction:1};case"End":return{kind:"move",index:n,direction:-1};default:return null}},Fi=new Set(["ArrowDown","ArrowUp","PageDown","PageUp","Home","End"]),zi=e=>Fi.has(e),Ui=e=>{let{activeIndex:t,startIndex:n,itemCount:a,pageSize:s}=e;if(!Number.isInteger(a)||a<0)throw new RangeError(`[contact-map] listbox itemCount must be a non-negative integer; got ${X(a)}`);if(!Number.isInteger(s)||s<1)throw new RangeError(`[contact-map] listbox pageSize must be an integer of at least 1; got ${X(s)}`);let o=r=>Number.isInteger(r)&&r>=0&&r<a;if(a>0&&!o(n))throw new RangeError(`[contact-map] listbox startIndex must be an index below ${a}; got ${X(n)}`);if(t!==null&&!o(t))throw new RangeError(`[contact-map] listbox activeIndex must be null or an index below ${a}; got ${X(t)}`)};se();Pa();gn();hn();import{SWIPE_OVERLAY_SCROLL_AREA_STYLE as Bi,useOverlayPresence as $i,useSwipeOverlayDialog as Vi}from"@aiquants/swipe-overlay";import{useCallback as Ki,useId as ji}from"react";import{jsx as oa,jsxs as Va}from"react/jsx-runtime";var Gi=ue(Wn,"flex overflow-hidden"),qi=ue(Hn,"motion-safe:transition-opacity motion-safe:duration-200"),Yi="relative ml-auto flex h-full w-full max-w-lg flex-col bg-white shadow-xl motion-safe:transition-[transform] motion-safe:duration-200 motion-safe:ease-out dark:bg-slate-900",Qi="flex shrink-0 items-center justify-between gap-3 border-slate-200 border-b px-3 py-2 dark:border-slate-700",Xi="min-w-0 truncate font-semibold text-base text-slate-900 outline-none dark:text-slate-100",Ji=`inline-flex min-h-11 min-w-11 shrink-0 touch-manipulation items-center justify-center rounded-full border border-slate-300 px-4 font-medium text-slate-700 text-sm hover:bg-slate-100 dark:border-slate-600 dark:text-slate-200 dark:hover:bg-slate-800 ${ct}`,Zi="flex min-h-0 flex-1 flex-col overflow-y-auto p-3",sa=({isOpen:e,onClose:t,children:n,className:a,title:s})=>{let o=G(),r=ji(),c=$i(e),d=Ki(h=>h.ownerDocument.getElementById(r),[r]),{dialogProps:l,backdropProps:u,panelProps:p,attemptClose:i,isSwiping:m}=Vi({isOpen:e,onClose:t,isCloseBlocked:In,skipWhenTextSelected:!0,initialFocus:d});return c?Va("dialog",{...l,"data-testid":"contact-map-mobile-overlay","aria-labelledby":r,className:ue(Gi,e&&!m?"pointer-events-auto":"pointer-events-none"),style:An,children:[oa("div",{...u,"data-contact-map-overlay-backdrop":"",className:ue(qi,e?"opacity-100":"opacity-0")}),Va("div",{...p,"data-contact-map-overlay-panel":"",className:ue(Yi,e?"pointer-events-auto":"pointer-events-none",a),children:[Va("div",{className:Qi,children:[oa("h2",{id:r,tabIndex:-1,className:Xi,children:s===void 0?o.overlayTitle:s}),oa("button",{type:"button",className:Ji,onClick:()=>i(),children:o.close})]}),oa("div",{"data-contact-map-overlay-body":"",className:Zi,style:Bi,children:n})]})]}):null};gn();Oa();import{Fragment as kl,jsx as I,jsxs as Fe}from"react/jsx-runtime";var dl=sl(async()=>({default:(await Promise.resolve().then(()=>(_r(),Dr))).default})),Ka=64,ro="h-[64px]",oo=240,cl=4,ja=ta(xn),pl=xn.listPanelMinWidth,ul=xn.detailPanelMinWidth,ml=xn.handleThickness,bu=ja.collapseThreshold,yu=ja.expandThreshold,gl=({contactData:e})=>{let t=G(),n=We(e?.full_name)??t.noName,a=We(e?.title)??"-",s=We(e?.company_name)??"-",o=We(e?.department)??"-",r=Ut(e).value??"-",c=Bt(e).value??"-",d=$e(e?.updated_at,t.recordDateTime);return I(Un,{fullName:n,title:a,companyName:s,department:o,phoneNumber:c,email:r,updatedAtText:d})},hl=e=>({"--contact-panel-height":`${e}px`}),fl=e=>typeof e=="object"&&e!==null&&"item"in e,bl=(e,t)=>t!==void 0?`${e}:${t.toFixed(3)}`:void 0,yl=(e,t)=>{for(let n of e){let a=bt(n);if(a?.person_id===t)return a}return null},so=(e,t)=>t!==null&&bt(e)?.person_id===t,io=(e,t,n)=>{for(let a=t;a>=0&&a<e.length;a+=n){let s=bt(e[a]);if(s!==null)return{index:a,personId:s.person_id}}return null},lo=(e,t,n)=>{let a=io(e,t,n);return a!==null?a:io(e,t-n,n===1?-1:1)},Ga=(e,t,n)=>{let{viewportHeight:a}=Yr(t,{enableMutationObserver:!0,bottomGap:cl,minFallbackHeight:oo}),[s,o]=Cn(0),r=Me(()=>{let p=n.current,i=t.current;if(!(p&&i))return;let m=p.getBoundingClientRect(),h=i.getBoundingClientRect(),x=Math.ceil(h.top-m.top);Number.isFinite(x)&&x>0&&o(C=>Math.abs(C-x)>1?x:C)},[t,n]);po(()=>{if(!e)return;r();let p=requestAnimationFrame(r);return window.addEventListener("resize",r),()=>{cancelAnimationFrame(p),window.removeEventListener("resize",r)}},[e,r]);let c=a>0?a:oo,d=s>0?s:0,l=c+d,u=Nt(()=>hl(l),[l]);return{normalizedViewportHeight:c,normalizedDetailHeight:l,panelSizingStyle:u}},xl=new Set,vl=()=>{let[e,t]=Cn(xl),n=Me((a,s)=>{t(o=>{if(o.has(a)===s)return o;let r=new Set(o);return s?r.add(a):r.delete(a),r})},[]);return{isAnyPopupVisible:e.size>0,handlePopupVisibilityChange:n}},Cl=(e,t,n)=>{let a=Zt(n);po(()=>{a.current=n},[n]),co(()=>{if(e!==null)return a.current(e,t),()=>{a.current(e,!1)}},[e,t])},uo=il(({entry:e,index:t,itemCount:n,listboxId:a,isSelected:s,isActive:o,onSelect:r,onLongPressSelect:c,searchQuery:d,enableHighlighting:l,openEmailsWithGmail:u,openGmailCompose:p,onPopupVisibilityChange:i})=>{let m=G(),h=Zt(null),x=I("div",{className:ro}),C=fl(e)?e:null,v=bt(e),{isPopupVisible:H,handleClosePopup:A}=aa({ref:h,onSelect:c,item:v?.person_id});if(Cl(v?.person_id??null,H,i),!e||!v)return x;let{person_id:f}=v,g=t%2===0?"bg-white dark:bg-slate-900":"bg-gray-50 dark:bg-slate-900/70",T=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":g,D=["B","F"].map(b=>bl(b,b==="B"?C?.baseScore:C?.score)).filter(Boolean);return Fe("div",{ref:h,id:ol(a,f),className:`flex ${ro} 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 ${T} ${Cr}`,style:{height:Ka},role:"option","aria-selected":s,"aria-posinset":t+1,"aria-setsize":n,"data-selected":s?"true":"false","data-contact-map-row-active":o?"":void 0,onClick:()=>r(f),children:[Fe("div",{className:"hidden w-28 shrink-0 flex-col items-center gap-0.5 text-center sm:flex",children:[I("div",{className:"whitespace-nowrap font-medium text-slate-700 text-xs leading-tight dark:text-slate-200",children:m.listRowNumber(t+1)}),I("div",{className:"truncate text-[11px] text-slate-700 leading-tight dark:text-slate-200",children:f}),I("div",{className:"flex items-center gap-1 whitespace-nowrap font-mono text-[11px] text-slate-600 leading-tight dark:text-slate-300",children:D.length?D.map(b=>I("span",{children:b},b)):I("span",{children:"-"})})]}),I(ll,{fallback:I(gl,{contactData:v}),children:I(dl,{contactData:v,searchTerm:d,enableHighlighting:l,openEmailsWithGmail:u,openGmailCompose:p,isPopupVisible:H,onRequestClose:A})})]})});uo.displayName="ContactListRow";var mo=({context:e})=>{let{contactMapRecords:t,filteredItems:n,searchQuery:a,hasSearchTerm:s,enableHighlighting:o,openEmailsWithGmail:r,isSearchTabActive:c}=e,{locale:d,labels:l,engineLabels:u}=be(),p=Zt(null),i=Zt(null),[m,h]=Cn(null),{normalizedViewportHeight:x,panelSizingStyle:C}=Ga(c,i,p),{isAnyPopupVisible:v,handlePopupVisibilityChange:H}=vl(),A=Nt(()=>({enablePointerDrag:!v,enableKeyboardNavigation:!1}),[v]),f=Nt(()=>s?n:t,[s,n,t]),[g,y]=Cn(null),T=Me($=>{h($),y($)},[]),D=Me($=>{if(!r)return;let re=$.trim();if(!re||re==="-"||typeof window>"u")return;let B=Ze(re,!0);B&&window.open(B,"_blank","noopener,noreferrer")},[r]),[b,S]=Cn(!1),Y=Me(()=>S(!1),[]),_=Me($=>{T($),S(!0)},[T]),ie=ao(),Q=ao(),O=Zt(null),E=f.length,U=Me(($,re)=>I(uo,{entry:$,index:re,itemCount:E,listboxId:ie,isSelected:so($,m),isActive:so($,g),onSelect:_,onLongPressSelect:T,searchQuery:a,enableHighlighting:o,openEmailsWithGmail:r,openGmailCompose:D,onPopupVisibilityChange:H}),[E,ie,m,g,_,T,a,o,r,D,H]),ne=Nt(()=>{let $=new Map;return f.forEach((re,B)=>{let it=bt(re);it!==null&&$.set(it.person_id,B)}),$},[f]),le=g===null?null:ne.get(g)??null,ve=m===null?null:ne.get(m)??null,gt=Math.max(1,Math.floor(x/Ka)),Rt=Me($=>{if($.target.id!==ie)return;let re=to($.nativeEvent,{activeIndex:le,startIndex:ve===null?0:ve,itemCount:E,pageSize:gt});if(re===null)return;if($.preventDefault(),re.kind==="activate"){le!==null&&g!==null&&_(g);return}let B=lo(f,re.index,re.direction);B!==null&&(y(B.personId),O.current?.scrollToIndex(B.index,{align:"nearest"}))},[ie,le,ve,E,gt,g,_,f]),st=Me($=>{if($.target.id!==ie||le!==null||!$.target.matches(":focus-visible"))return;let re=lo(f,ve===null?0:ve,1);re!==null&&y(re.personId)},[ie,le,ve,f]),Lt=Nt(()=>({id:ie,role:"listbox",tabIndex:0,"aria-label":l.listboxLabel,"aria-describedby":Q}),[ie,l.listboxLabel,Q]),de=Me($=>f[$],[f]),Et=Me($=>bt(f[$])?.person_id??`row-${$}`,[f]),Ee=Me(()=>Ka,[]),Ye=Nt(()=>({enabled:!0,renderVisual:al}),[]),Oe=Nt(()=>m===null?null:yl(f,m),[m,f]);co(()=>{m!==null&&!Oe&&h(null)},[m,Oe]);let Te=Zt(null),{isTwoColumn:Ot}=ra(Te,ja);b&&(Ot||Oe===null)&&S(!1);let ht=Fe("div",{ref:p,className:"flex min-h-0 flex-1 flex-col gap-1",children:[I("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:Fe("div",{className:"flex items-center",children:[Fe("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:[I("span",{className:"font-semibold text-slate-900 text-xs dark:text-slate-100",children:l.columnNo}),I("span",{className:"leading-tight",children:l.columnId}),I("span",{className:"whitespace-nowrap leading-tight",children:l.columnScore})]}),Fe("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:[Fe("div",{className:"flex flex-col gap-0.5",children:[I("span",{children:l.columnName}),I("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:l.columnTitle})]}),Fe("div",{className:"flex flex-col gap-0.5",children:[I("span",{children:l.columnCompany}),I("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:l.columnDepartment})]}),Fe("div",{className:"flex flex-col gap-0.5",children:[I("span",{children:l.columnPhone}),I("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:l.columnEmail})]}),I("div",{className:"hidden items-end justify-end xl:flex",children:I("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:l.columnUpdatedAt})})]})]})}),I("p",{id:Q,hidden:!0,children:l.listKeyboardHelp}),I("div",{ref:i,className:"flex-1",onKeyDown:Rt,onFocus:st,children:I(rl,{ref:O,contentProps:Lt,activeItemIndex:E===0?void 0:le,activeItemVisibleInset:2,itemCount:E,getItemKey:Et,behaviorOptions:A,getItem:de,getItemHeight:Ee,viewportSize:x,overscanCount:10,scrollBarOptions:{width:8,enableArrowButtonTabStops:!1,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:Ye},locale:d,labels:u,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)=>U($,re)})}),n.length===0&&s?I("div",{className:"py-8 text-center",children:I("p",{className:"text-slate-600 dark:text-slate-300",children:l.listNoSearchResults})}):null,E===0&&!s?I("div",{className:"py-8 text-center",children:I("p",{className:"text-slate-600 dark:text-slate-300",children:l.listNoData})}):null]});return I("div",{ref:Te,"data-testid":"contact-map-list-root",className:"flex min-h-0 flex-1 flex-col",style:C,children:Ot?Fe(tl,{id:"contact-map-list-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-list-panel-group",children:[I(no,{id:"contact-map-list-pane",defaultSize:{value:68,unit:"percentage"},minSize:{value:pl,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:ht}),I(nl,{id:"contact-map-list-handle",thickness:ml,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.listResizeHandle}),I(no,{id:"contact-map-list-detail-pane",defaultSize:{value:32,unit:"percentage"},minSize:{value:ul,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:I(Qt,{placement:"pane",contact:Oe,searchTerm:a,enableHighlighting:o})})]}):Fe(kl,{children:[ht,Oe?I(sa,{isOpen:b,onClose:Y,title:l.detailHeading,children:I(Qt,{placement:"overlay",contact:Oe,searchTerm:a,enableHighlighting:o})}):null]})})};yt();import{DirectoryTree as Dl}from"@aiquants/directory-tree";import{Panel as vo,PanelGroup as _l,PanelResizeHandle as Wl}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as Al}from"@aiquants/virtualscroll";import Hl from"@heroicons/react/24/solid/FolderMinusIcon.js";import Il from"@heroicons/react/24/solid/FolderPlusIcon.js";import{useCallback as Pe,useEffect as Pt,useMemo as ze,useRef as ca,useState as ut}from"react";import{createPortal as Fl}from"react-dom";var qa=(e,t)=>e&&e.trim()||t;import{useEffect as Sl,useRef as ia,useState as Tl}from"react";var go=(e,t=250)=>{let[n,a]=Tl(e),s=ia(null),o=ia(e),r=ia(null),c=ia(!1);return Sl(()=>{if(!c.current){c.current=!0,a(e),o.current=e;return}o.current=n,s.current=null;let d=l=>{s.current??(s.current=l);let u=l-s.current,p=Math.min(1,Math.max(0,u/t)),i=1-(1-p)**3,m=Math.max(0,Math.round(o.current+(e-o.current)*i));a(m),p<1&&(r.current=requestAnimationFrame(d))};return r.current=requestAnimationFrame(d),()=>{r.current!==null&&cancelAnimationFrame(r.current)}},[e,t]),Math.max(0,n)};xt();import{useCallback as Ya,useEffect as Qa,useMemo as ho,useRef as wl,useSyncExternalStore as Nl}from"react";se();var Ml=250,Pl=4e3,la=3,fo={treeWorkerFactory:"the view remounts","workerUrls.treeWorker":"the page reloads"},bo=(e,t)=>e.uncategorizedCompany===t.uncategorizedCompany&&e.unnamedPerson===t.unnamedPerson,da=class{constructor(t,{workerSource:n,logger:a=je}){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 n=t.data;n.type!=="TREE_CHUNK"||n.generation!==this.generation||n.uniquePersonCount===0&&this.postedCount>0&&(this.latestSnapshot?.uniquePersonCount??0)>0||this.latestSnapshot!==null&&n.uniquePersonCount<this.latestSnapshot.uniquePersonCount&&!(n.isIdle&&n.consumedRecords>=this.postedCount)||(n.isIdle&&n.consumedRecords>=this.postedCount&&(this.consecutiveFailures=0),this.latestSnapshot={tree:n.tree,directoryPaths:n.directoryPaths,consumedRecords:n.consumedRecords,uniquePersonCount:n.uniquePersonCount,isIdle:n.isIdle,rebuildEpoch:n.rebuildEpoch},this.updateState())};this.handleFailure=t=>{if(this.worker?.terminate(),this.worker=null,this.postedCount=0,this.consecutiveFailures+=1,this.updateState(),this.consecutiveFailures>=la){this.logger.error(`[TreeWorker] the tree Worker failed ${la} times in a row; the tree stops updating until ${fo[this.workerSource]} (check ${this.workerSource})`,t);return}let n=Math.min(Ml*2**(this.consecutiveFailures-1),Pl);this.logger.warn(`[TreeWorker] the tree Worker failed; retrying in ${n}ms (failure ${this.consecutiveFailures} of ${la})`,t),this.retryTimer!==null&&clearTimeout(this.retryTimer),this.retryTimer=setTimeout(()=>{this.retryTimer=null;let a=this.lastSyncedNaming;a!==null&&this.syncRecords(this.lastSyncedRecords,a)},n)};if(typeof n!="string")throw new TypeError(`[contact-map] TreeWorkerSession workerSource must be a string; got ${X(n)}`);if(!Object.hasOwn(fo,n))throw new RangeError(`[contact-map] TreeWorkerSession workerSource must be "treeWorkerFactory" or "workerUrls.treeWorker"; got ${X(n)}`);this.workerFactory=t,this.workerSource=n,this.logger=a}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>=la||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,n){this.finalizeRequest!==null&&(t.length<this.finalizeRequest.recordCount||this.finalizeRequest.naming===null||!bo(this.finalizeRequest.naming,n))&&(this.finalizeRequest=null),this.lastSyncedRecords=t,this.lastSyncedNaming=n;let a=this.ensureWorker();if(!a)return;let s=this.workerNeedsReset,o=this.postedNaming===null||!bo(this.postedNaming,n);if((this.workerNeedsReset||o||t.length<this.postedCount)&&(this.generation+=1,this.postedCount=0,this.finalizedPostedCount=null,this.workerNeedsReset=!1,this.postedNaming=n,a.postMessage({type:"RESET_TREE",generation:this.generation,epochBase:this.latestSnapshot?.rebuildEpoch??0,naming:n}),this.updateState()),t.length>this.postedCount){let r=t.slice(this.postedCount);this.postedCount=t.length,a.postMessage({type:"APPEND_RECORDS",generation:this.generation,records:r}),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}}},Rl=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 a=t.includes(".ts")?"../workers/treeWorker.ts":"./worker/treeWorker.mjs";return new Worker(new URL(a,t),{type:"module"})}throw new Error("[contact-map] the tree Worker needs workerUrls.treeWorker in a build without import.meta.url (CommonJS)")},Mt=null,yo=e=>e===void 0?"the bundled Worker file (workerUrls.treeWorker unset)":JSON.stringify(e),Ll=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},El=e=>{if(Ur(e),Mt===null){let t=new da(()=>Rl(e),{workerSource:"workerUrls.treeWorker"});return Mt={session:t,workerUrl:e},t}if(Mt.workerUrl!==e)throw new Error(`[contact-map] the tree session already loads its Worker from ${yo(Mt.workerUrl)} and cannot also load it from ${yo(e)}; give every contact-map view in the browser tab the same workerUrls.treeWorker, on every route (after changing it, reload the page)`);return Mt.session},Lu=()=>{Mt?.session.reset(),Mt=null},Ol={snapshot:null,isBuilding:!1};function xo(e,t=!1){let n=at(),a=n.treeWorkerFactory,s=n.workerUrls?.treeWorker,{labels:o}=be(),r=o.uncategorizedCompany,c=o.noName,d=ho(()=>({uncategorizedCompany:r,unnamedPerson:c}),[r,c]),l=wl(a);Qa(()=>{l.current=a},[a]);let u=a!==void 0,p=u?void 0:s,i=ho(()=>u?new da(()=>Ll(l.current)(),{workerSource:"treeWorkerFactory"}):null,[u]),m=Ya(()=>i===null?El(p):i,[i,p]),h=Ya(C=>m().subscribe(C),[m]),x=Ya(()=>m().getState(),[m]);return Qa(()=>{let C=m();C.syncRecords(e,d),t&&C.finalize()},[m,e,t,d]),Qa(()=>{if(i!==null)return()=>i.stop()},[i]),Nl(h,x,()=>Ol)}se();Ea();Vn();import{Fragment as Ql,jsx as F,jsxs as xe}from"react/jsx-runtime";var Za=ta(vn),zl=vn.listPanelMinWidth,Ul=vn.detailPanelMinWidth,Bl=vn.handleThickness,Zu=Za.collapseThreshold,em=Za.expandThreshold,$l=(e,t)=>{let{searchQuery:n,enableHighlighting:a}=t,s=qa(e.full_name,t.noName),o=qa(e.title,""),r=F(pe,{text:s,query:n,enabled:a});return o?xe("span",{className:"flex items-center gap-1.5",children:[F("span",{children:r}),F("span",{className:"text-slate-400 text-xs dark:text-slate-500",children:F(pe,{text:o,query:n,enabled:a})})]}):r},Vl="contact-map-tree h-full w-full",Kl={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"},Xa="h-4 w-4 shrink-0 transition-colors duration-150",jl=(e,t,n)=>({...e,viewportHeightOverride:t,behaviorOptions:{...e.behaviorOptions,enablePointerDrag:!n}}),pa=null,Co=null,kn=new Map,ko="",So=null,To=null,Gl=(e,t,n,a,s)=>{let o=`${n?"icons":"plain"}#${a}#${s.noName}`;(o!==ko||s.formatDirectoryName!==So||t!==To)&&(kn.clear(),ko=o,So=s.formatDirectoryName,To=t);let r={entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},c=new Set;for(let d of e){c.add(d.absolutePath);let l=`${d.name}\0${d.memberCount}`,u=kn.get(d.absolutePath);(!u||u.signature!==l)&&(u={signature:l,result:Mo([d],t,n,{searchQuery:"",enableHighlighting:!1,noName:s.noName,formatDirectoryName:s.formatDirectoryName})},kn.set(d.absolutePath,u));let p=u.result;p.entries.length>0&&r.entries.push(p.entries[0]);for(let[i,m]of p.personPathMap){let h=r.personPathMap.get(i);if(h)for(let x of m)h.add(x);else r.personPathMap.set(i,new Set(m))}for(let[i,m]of p.contactByPath)r.contactByPath.set(i,m);for(let[i,m]of p.ancestorsByPath)r.ancestorsByPath.set(i,m);r.totalCount+=p.totalCount,!r.firstPerson&&p.firstPerson&&(r.firstPerson=p.firstPerson)}for(let d of kn.keys())c.has(d)||kn.delete(d);return r},Ja=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",No=e=>{let t=[];for(let n of e)n.type==="directory"&&(t.push(n.absolutePath),n.children&&t.push(...No(n.children)));return t},ql=e=>{if(e.memberCount===void 0)throw new Error(`[contact-map] directory entry ${e.absolutePath} has no memberCount`);return e.memberCount},Mo=(e,t,n,a,s)=>{let o=new Map,r=new Map,c=new Map,d=0,l=null,u=(i,m)=>{let h=[...m,i.absolutePath];c.set(i.absolutePath,h);let x,C,v=i.type==="directory"?a.formatDirectoryName(i.name,ql(i)):i.name,H=F(pe,{text:v,query:a.searchQuery,enabled:a.enableHighlighting});if(i.type==="file"&&i.personId){if(s&&!s.has(i.personId))return null;let A=t.get(i.personId);if(A){r.set(i.absolutePath,A),o.has(i.personId)||o.set(i.personId,new Set);let f=o.get(i.personId);f&&f.add(i.absolutePath),d++,l||(l={personId:i.personId,path:i.absolutePath}),n&&(C=g=>{let y=Ja(g);return g.isSelected||g.isItemSelected||i.isPrimary&&(y=i.title?"text-indigo-600 dark:text-indigo-400":"text-orange-500 dark:text-orange-400"),F(n.person,{"aria-hidden":"true",className:`${Xa} ${y}`})},i.title&&(H=$l(A,a))),H=F("span",{"data-contact-path":i.absolutePath,className:"block w-full",children:H})}}else if(i.children){let A=i.children.map(f=>u(f,h)).filter(f=>f!==null);if(s&&A.length===0)return null;if(x=A,n){let f=i.relativePath.startsWith("company:")?n.company:n.department;C=g=>F(f,{"aria-hidden":"true",className:`${Xa} ${Ja(g)}`})}}return{name:v,label:H,type:i.type,absolutePath:i.absolutePath,relativePath:i.relativePath,icon:C,children:x}};return{entries:e.map(i=>u(i,[])).filter(i=>i!==null),personPathMap:o,contactByPath:r,ancestorsByPath:c,firstPerson:l,totalCount:d}},Yl=(e,t,n)=>{let a=new Set,s=new Set,o=new Map;t.forEach((u,p)=>{o.set(u.item.person_id,p)});for(let u of t){let p=u.item.person_id,i=e.personPathMap.get(p);if(i)for(let m of i){a.add(m);let h=e.ancestorsByPath.get(m);if(h){for(let x of h)a.add(x);n&&h.length>0&&s.add(h[0])}}}let r=new Map,c=u=>{let p=r.get(u.absolutePath);if(p!==void 0)return p;let i=1/0;if(u.type==="file"){let m=e.contactByPath.get(u.absolutePath);m&&(i=o.get(m.person_id)??1/0)}else if(u.children)for(let m of u.children)i=Math.min(i,c(m));return r.set(u.absolutePath,i),i},d=(u,p=0)=>u.filter(i=>n&&p===0&&s.has(i.absolutePath)?!0:a.has(i.absolutePath)).map(i=>n&&p===0&&s.has(i.absolutePath)?i:i.type==="directory"&&i.children?{...i,children:d(i.children,p+1)}:i).sort((i,m)=>p===0?c(i)-c(m):0),l=d(e.entries);return{...e,entries:l}},wo=(e,t,n)=>{if(e===null)return null;let a=n.get(e);if(a===void 0)return null;if(t!==null&&a.has(t))return t;let s=a.values().next();return s.done?null:s.value},Po=({context:e,controlsContainer:t})=>{let{contactMapRecords:n,contactMapRecordMap:a,filteredItems:s,hasSearchTerm:o,isSearchInProgress:r,isSearchTabActive:c}=e,{locale:d,labels:l,treeLabels:u}=be(),p=l.noName,i=l.treeDirectoryName,m=ze(()=>({noName:p,formatDirectoryName:i}),[p,i]),[h,x]=ut(null),[C,v]=ut(!1),{snapshot:H,isBuilding:A}=xo(n,e.isStreamingComplete),f=H?.tree??null,g=H?.rebuildEpoch??0,y=ze(()=>f?Gl(f,a,h,g,m):null,[f,a,h,g,m]),T=ze(()=>{if(!f)return null;if(!o)return y;let R;C||(R=new Set(s.map(M=>M.item.person_id)));let k=Mo(f,a,h,{...m,searchQuery:e.searchQuery,enableHighlighting:e.enableHighlighting},R);return Yl(k,s,C)},[f,y,a,h,e.searchQuery,e.enableHighlighting,o,s,C,m]),D=ze(()=>T||{entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},[T]),b=o&&e.errorMessage!==null,[S,Y]=ut(D),_=ca(!1);Pt(()=>{if(!(r||b)){_.current=!!f,Y(D);return}!_.current&&f&&D.entries.length>0&&(_.current=!0,Y(D))},[D,f,r,b]);let ie=o&&(r||b)?S:D,{entries:Q,personPathMap:O,contactByPath:E,totalCount:U}=ie,ne=ze(()=>No(Q),[Q]),[le,ve]=ut(()=>Co??new Set),gt=Pe(R=>!le.has(R),[le]),Rt=Pe(R=>{ve(k=>{let M=new Set(k);return M.has(R)?M.delete(R):M.add(R),M})},[]),st=Pe(R=>{R.length!==0&&ve(k=>{let M=new Set(k);for(let oe of R)M.add(oe);return M})},[]),Lt=Pe(R=>{ve(k=>{if(k.size===0)return k;let M=!1,oe=new Set(k);for(let Ce of R)oe.delete(Ce)&&(M=!0);return M?oe:k})},[]);Pt(()=>{Co=le},[le]),Pt(()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem("contact-map.tree-expanded")}catch{}},[]);let[de,Et]=ut(null),[Ee,Ye]=ut(null),[Oe,Te]=ut(!1),Ot=Pe(()=>Te(!1),[]),[ht,$]=ut(!1),re=ca(null),B=ca(null),{normalizedViewportHeight:it,panelSizingStyle:Dt}=Ga(c,B,re),_t=Pe(R=>{let k=E.get(R);return k?(de!==k.person_id&&Et(k.person_id),R!==Ee&&Ye(R),!0):!1},[E,Ee,de]),Qe=Pe(R=>{_t(R)&&Te(!0)},[_t]),we=Pe(R=>{Qe(R.entry.absolutePath)},[Qe]),Tn=Pe(R=>R instanceof Element?R.closest("[data-contact-path]")?.getAttribute("data-contact-path")??null:null,[]),{isPopupVisible:sn,popupItem:De,handleClosePopup:ln}=aa({ref:B,resolveItem:Tn,onSelect:_t}),lt=Pe(R=>{if(!e.openEmailsWithGmail)return;let k=R.trim();if(!k||k==="-"||typeof window>"u")return;let M=Ze(k,!0);M&&window.open(M,"_blank","noopener,noreferrer")},[e.openEmailsWithGmail]),_e=De?E.get(De):null,Be=sn&&_e!==null&&_e!==void 0;Pt(()=>{sn&&!_e&&ln()},[sn,_e,ln]);let dn=ze(()=>({overscanCount:16,callbackThrottleMs:16,scrollBarOptions:{width:8,enableArrowButtonTabStops:!1,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:{enabled:!0,renderVisual:Al}},behaviorOptions:{resetOnGetItemHeightChange:!1},preserveScrollAnchor:!0}),[]),Wt=ze(()=>jl(dn,it,Be),[dn,it,Be]);Pt(()=>{let R=!1;return typeof window>"u"?()=>{R=!0}:pa?(x(pa),()=>{R=!0}):((async()=>{try{let[M,oe,Ce,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(R)return;let ft=M.default,ha=oe.default,dr=Ce.default,cr=Je.default;ft&&ha&&dr&&cr&&(pa={company:ft,department:ha,title:dr,person:cr},x(pa))}catch(M){je.warn("Failed to load lucide icons",M)}})(),()=>{R=!0})},[]);let At=ze(()=>{if(!h)return;let R=Je=>ft=>F(Je,{"aria-hidden":"true",className:`${Xa} ${Ja(ft)}`}),k={company:R(h.company),department:R(h.department),title:R(h.title)},M=R(h.person),oe=Je=>Je in k,Ce=Je=>{let[ft]=Je.entry.relativePath.split(":",1);return(oe(ft)?k[ft]:k.company)(Je)};return{directory:Ce,directoryExpanded:Ce,file:M}},[h]),cn=Pe(()=>{ve(R=>R.size===0?R:new Set)},[]),dt=Pe(()=>{ne.length>0&&st(ne)},[ne,st]);Pt(()=>{if(typeof window>"u")return;let R=document.documentElement,k=window.matchMedia("(prefers-color-scheme: dark)"),M=()=>$(R.classList.contains("dark")||k.matches);M(),k.addEventListener("change",M);let oe=new MutationObserver(M);return oe.observe(R,{attributes:!0,attributeFilter:["class"]}),()=>{k.removeEventListener("change",M),oe.disconnect()}},[]);let Ht=wo(de,Ee,O);Pt(()=>{let R=wo(de,Ee,O);if(R===null){de!==null&&Et(null),Ee!==null&&Ye(null);return}R!==Ee&&Ye(R)},[de,Ee,O]);let It=Ht===null?null:E.get(Ht)??null,wn=ht?"#475569":"#94A3B8",Ft=e.isStreamingComplete,Nn=e.isStreamingFailed,Xe=Ft&&n.length===0,zt=(A||!f)&&!Xe,ma=go(U,250),Mn=f!==null||Xe,Pn=xe("div",{className:"flex items-center gap-1.5",children:[xe("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:[F("span",{className:"text-[10px]",children:"\u{1F333}"})," ",l.treeNodeCountLabel," ",Mn?l.treeNodeCount(ma):"\u2026"]}),Nn&&!Ft?xe("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:[F("span",{className:"h-1.5 w-1.5 rounded-full bg-rose-500"}),F("span",{className:"text-[10px]",children:"\u26D4"})," ",l.treeStreamInterrupted]}):Ft?zt?xe("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:[xe("span",{className:"relative flex h-1.5 w-1.5",children:[F("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),F("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-amber-500"})]}),F("span",{className:"text-[10px]",children:"\u{1F33F}"})," ",l.treeBuilding]}):xe("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:[F("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),F("span",{className:"text-[10px]",children:"\u2705"})," ",l.treeComplete]}):xe("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:[xe("span",{className:"relative flex h-1.5 w-1.5",children:[F("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-sky-400 opacity-75"}),F("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-sky-500"})]}),F("span",{className:"text-[10px]",children:"\u23F3"})," ",l.treeStreamLoading]}),o&&xe("button",{type:"button",onClick:()=>v(!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:l.treeShowEntireCompanyTitle,children:[F("span",{className:"text-[10px]",children:"\u{1F3E2}"})," ",l.treeShowEntireCompany]}),ne.length>0?xe("div",{className:"flex items-center gap-1",children:[F("button",{type:"button",onClick:cn,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:F(Il,{className:"h-3 w-3"})}),F("button",{type:"button",onClick:dt,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:F(Hl,{className:"h-3 w-3"})})]}):null]}),pn=ca(null),{isTwoColumn:Rn}=ra(pn,Za,{mediaQuery:"(min-width: 768px)"});Oe&&(Rn||It===null)&&Te(!1);let Ln=ze(()=>({toggle:Rt,isExpanded:gt,expandMultiple:Lt,collapseMultiple:st,isPending:r}),[st,Lt,gt,Rt,r]),En=ze(()=>({onEntryClick:we,selectedPath:Ht}),[we,Ht]),lr=ze(()=>({className:Vl,lineColor:wn,iconOverrides:At,showDirectoryIcons:!!At,showFileIcons:!!At,highlightStyles:Kl,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"}),[wn,At]),ga=F("div",{ref:re,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:F("div",{ref:B,className:"flex min-h-0 flex-1 flex-col overflow-hidden p-2",children:Q.length>0?F(Dl,{entries:Q,expansion:Ln,selection:En,visual:lr,virtualScroll:Wt,locale:d,labels:u}):F("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:o?l.treeNoMatches:l.treeEmpty})})});return xe("div",{ref:pn,"data-testid":"contact-map-tree-root",className:"flex min-h-0 flex-1 flex-col",style:Dt,children:[t&&Fl(Pn,t),Rn?xe(_l,{id:"contact-map-tree-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-tree-panel-group",children:[F(vo,{id:"contact-map-tree-pane",defaultSize:{value:60,unit:"percentage"},minSize:{value:zl,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:ga}),F(Wl,{id:"contact-map-tree-handle",thickness:Bl,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}),F(vo,{id:"contact-map-tree-detail-pane",defaultSize:{value:40,unit:"percentage"},minSize:{value:Ul,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:F(Qt,{placement:"pane",contact:It,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})})]}):xe(Ql,{children:[ga,It?F(sa,{isOpen:Oe,onClose:Ot,title:l.detailHeading,children:F(Qt,{placement:"overlay",contact:It,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})}):null]}),Be&&_e&&F(zn,{contactData:_e,openEmailsWithGmail:e.openEmailsWithGmail,openGmailCompose:lt,onRequestClose:ln})]})};import{jsx as Sn,jsxs as en}from"react/jsx-runtime";var ed={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},td=e=>e==="tree"?"tree":"list",Ro=({context:e})=>{let t=G(),[n,a]=Zl(),[s,o]=Jl(null),r=td(n.get(Jt)),{setScrollableRef:c,onPointerDown:d,onPointerMove:l,onPointerUp:u,onPointerLeave:p,onPointerCancel:i,onClickCapture:m}=pt(),h=Xl(x=>{let C=x==="tree"?"tree":"list";if(C===r)return;let v=new URLSearchParams(typeof window<"u"?window.location.search:"");C==="list"?v.delete(Jt):v.set(Jt,C),a(v,{replace:!0})},[r,a]);return en("div",{"data-testid":"contact-map-search-tab-group",className:"flex h-full flex-1 flex-col",children:[en("div",{className:"mt-1 mb-1.5 flex shrink-0 items-center gap-2",children:[en("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:ed,onPointerDown:d,onPointerMove:l,onPointerUp:u,onPointerLeave:p,onPointerCancel:i,onClickCapture:m,children:[en("button",{type:"button","data-testid":"contact-map-tab-list",onClick:()=>h("list"),className:`rounded px-2 py-0.5 text-xs transition-colors ${r==="list"?"bg-blue-500 text-white dark:bg-blue-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4C4} ",t.listViewTab]}),en("button",{type:"button","data-testid":"contact-map-tab-tree",onClick:()=>h("tree"),className:`rounded px-2 py-0.5 text-xs transition-colors ${r==="tree"?"bg-green-500 text-white dark:bg-green-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F333} ",t.treeViewTab]})]}),Sn("div",{ref:o,className:"flex items-center gap-1.5"})]}),en("div",{className:"flex h-full flex-1 flex-col",children:[Sn("div",{className:`${r==="list"?"flex h-full flex-1 flex-col":"hidden"}`,children:r==="list"?Sn(mo,{context:e}):null}),Sn("div",{className:`${r==="tree"?"flex h-full flex-1 flex-col":"hidden"}`,children:r==="tree"?Sn(Po,{context:e,controlsContainer:s}):null})]})]})};import{memo as rd}from"react";se();se();import{DEFAULT_FUZZY_SEARCH_OPTIONS as z}from"@aiquants/fuzzy-search";import{memo as nd,useId as Se}from"react";import{jsx as L,jsxs as W}from"react/jsx-runtime";var er=1e3,tr=nd(({searchOptions:e,setSearchOptions:t})=>{let n=G(),a="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",o=e.sortBy==="relevance",r=Se(),c=Se(),d=Se(),l=Se(),u=Se(),p=Se(),i=Se(),m=Se(),h=Se(),x=Se(),C=Se(),v=[];v.push(W("div",{className:`${a} border-green-200 border-l-4 dark:border-green-400/60`,children:[W("div",{className:`${s} text-green-700 dark:text-green-300`,children:["\u{1F3D7}\uFE0F ",n.indexBuildHeading]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:r,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexNgramSize}),L("input",{id:r,type:"range",min:"1",max:"4",step:"1",value:e.ngramSize||z.ngramSize,onChange:f=>t(g=>({...g,ngramSize:parseInt(f.target.value,10)})),className:"w-full"}),W("span",{className:"text-green-600 text-xs dark:text-green-300",children:[n.currentValueLabel," ",e.ngramSize||z.ngramSize]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexNgramSizeHint})]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:c,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexMinNgramOverlap}),L("input",{id:c,type:"range",min:"1",max:"5",step:"1",value:e.minNgramOverlap||z.minNgramOverlap,onChange:f=>t(g=>({...g,minNgramOverlap:parseInt(f.target.value,10)})),className:"w-full"}),W("span",{className:"text-green-600 text-xs dark:text-green-300",children:[n.currentValueLabel," ",e.minNgramOverlap||z.minNgramOverlap]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexMinNgramOverlapHint})]})]},"index-build")),v.push(W("div",{className:`${a} border-blue-200 border-l-4 dark:border-blue-500/60`,children:[W("div",{className:`${s} text-blue-700 dark:text-blue-300`,children:["\u{1F50D} ",n.indexCandidateHeading]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:d,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexThreshold}),L("input",{id:d,type:"range",min:"0.0",max:"1.0",step:"0.05",value:e.indexWorkerOptions?.threshold??z.indexWorkerOptions?.threshold,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,threshold:parseFloat(f.target.value)}})),className:"w-full"}),W("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.threshold??z.indexWorkerOptions?.threshold]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexThresholdHint})]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:u,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexNgramOverlapThreshold}),L("input",{id:u,type:"range",min:"0.1",max:"0.9",step:"0.1",value:e.indexWorkerOptions?.ngramOverlapThreshold??z.indexWorkerOptions?.ngramOverlapThreshold,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,ngramOverlapThreshold:parseFloat(f.target.value)}})),className:"w-full"}),W("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.ngramOverlapThreshold??z.indexWorkerOptions?.ngramOverlapThreshold]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexNgramOverlapThresholdHint})]})]},"candidate-control")),v.push(W("div",{className:`${a} border-cyan-200 border-l-4 dark:border-cyan-400/60`,children:[W("div",{className:`${s} text-cyan-700 dark:text-cyan-300`,children:["\u{1F9ED} ",n.indexStrategyHeading]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:l,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexStrategy}),W("select",{id:l,value:e.indexWorkerOptions?.strategy??z.indexWorkerOptions?.strategy??"hybrid",onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,strategy:f.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:[L("option",{value:"fast",children:n.indexStrategyFast}),L("option",{value:"accurate",children:n.indexStrategyAccurate}),L("option",{value:"hybrid",children:n.indexStrategyHybrid})]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexStrategyHint})]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:p,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexMinCandidatesRatio}),L("input",{id:p,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.minCandidatesRatio??z.indexWorkerOptions?.minCandidatesRatio,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,minCandidatesRatio:parseFloat(f.target.value)}})),className:"w-full"}),W("span",{className:"text-cyan-600 text-xs dark:text-cyan-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.minCandidatesRatio??z.indexWorkerOptions?.minCandidatesRatio]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexMinCandidatesRatioHint})]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:i,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexMaxCandidatesRatio}),L("input",{id:i,type:"range",min:"0.3",max:"0.8",step:"0.1",value:e.indexWorkerOptions?.maxCandidatesRatio??z.indexWorkerOptions?.maxCandidatesRatio,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxCandidatesRatio:parseFloat(f.target.value)}})),className:"w-full"}),W("span",{className:"text-cyan-600 text-xs dark:text-cyan-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.maxCandidatesRatio??z.indexWorkerOptions?.maxCandidatesRatio]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexMaxCandidatesRatioHint})]})]},"strategy")),v.push(W("div",{className:`${a} border-indigo-200 border-l-4 dark:border-indigo-500/60`,children:[W("div",{className:`${s} text-indigo-700 dark:text-indigo-300`,children:["\u{1F521} ",n.scoreTuningHeading]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:m,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexJaroWinklerPrefix}),L("input",{id:m,type:"range",min:"0.05",max:"0.25",step:"0.05",value:e.indexWorkerOptions?.jaroWinklerPrefix??z.indexWorkerOptions?.jaroWinklerPrefix,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,jaroWinklerPrefix:parseFloat(f.target.value)}})),className:"w-full"}),W("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.jaroWinklerPrefix??z.indexWorkerOptions?.jaroWinklerPrefix]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexJaroWinklerPrefixHint})]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:h,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.maxResults}),W("label",{className:"flex items-center gap-2 text-[11px] text-gray-600 dark:text-slate-300",children:[L("input",{type:"checkbox",checked:e.indexWorkerOptions?.maxResults===void 0,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxResults:f.target.checked?void 0:er}}))}),n.noLimit]}),L("input",{id:h,type:"range",min:er,max:"10000",step:"1000",disabled:e.indexWorkerOptions?.maxResults===void 0,value:e.indexWorkerOptions?.maxResults===void 0?er:e.indexWorkerOptions.maxResults,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxResults:parseInt(f.target.value,10)}})),className:"w-full disabled:cursor-not-allowed"}),W("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.maxResults===void 0?n.noLimit:e.indexWorkerOptions.maxResults]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexMaxResultsHint})]})]},"jaro")),v.push(W("div",{className:`${a} border-emerald-200 border-l-4 ${o?"":"opacity-50"} dark:border-emerald-400/60`,children:[W("div",{className:`${s} text-emerald-700 dark:text-emerald-300`,children:["\u{1F3AF} ",n.relevanceWeightsHeading]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:x,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.fieldWeight}),L("input",{id:x,type:"range",min:"0",max:"1",step:"0.05",value:e.indexWorkerOptions?.relevanceFieldWeight??z.indexWorkerOptions?.relevanceFieldWeight??.2,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,relevanceFieldWeight:parseFloat(f.target.value)}})),disabled:!o,className:"w-full disabled:cursor-not-allowed"}),W("span",{className:"text-emerald-600 text-xs dark:text-emerald-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.relevanceFieldWeight??z.indexWorkerOptions?.relevanceFieldWeight??.2]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexFieldWeightHint})]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:C,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexPerfectMatchBonus}),L("input",{id:C,type:"range",min:"0",max:"0.3",step:"0.1",value:e.indexWorkerOptions?.relevancePerfectMatchBonus??z.indexWorkerOptions?.relevancePerfectMatchBonus??.1,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,relevancePerfectMatchBonus:parseFloat(f.target.value)}})),disabled:!o,className:"w-full disabled:cursor-not-allowed"}),W("span",{className:"text-emerald-600 text-xs dark:text-emerald-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.relevancePerfectMatchBonus??z.indexWorkerOptions?.relevancePerfectMatchBonus??.1]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexPerfectMatchBonusHint})]}),!o&&L("p",{className:"text-[11px] text-emerald-600 dark:text-emerald-300",children:n.relevanceOnlyNotice})]},"relevance"));let H=Se(),A=Se();return v.push(W("div",{className:`${a} border-teal-200 border-l-4 dark:border-teal-400/60`,children:[W("div",{className:`${s} text-teal-700 dark:text-teal-300`,children:["\u{1F524} ",n.indexContainmentHeading]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:H,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexContainmentBase}),L("input",{id:H,type:"range",min:"0.0",max:"0.7",step:"0.05",value:e.indexWorkerOptions?.containmentScoreBase??z.indexWorkerOptions?.containmentScoreBase??.7,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,containmentScoreBase:parseFloat(f.target.value)}})),className:"w-full"}),W("span",{className:"text-teal-600 text-xs dark:text-teal-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.containmentScoreBase??z.indexWorkerOptions?.containmentScoreBase??.7]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexContainmentBaseHint})]}),W("div",{className:"space-y-2",children:[L("label",{htmlFor:A,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexContainmentCoverage}),L("input",{id:A,type:"range",min:"0.0",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.containmentCoverageWeight??z.indexWorkerOptions?.containmentCoverageWeight??.3,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,containmentCoverageWeight:parseFloat(f.target.value)}})),className:"w-full"}),W("span",{className:"text-teal-600 text-xs dark:text-teal-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.containmentCoverageWeight??z.indexWorkerOptions?.containmentCoverageWeight??.3]}),L("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexContainmentCoverageHint})]})]},"containment")),W("section",{className:"space-y-3",children:[W("div",{className:"flex items-center justify-between gap-3",children:[W("div",{className:"flex items-center gap-2 font-semibold text-green-700 text-xs transition-colors dark:text-green-300",children:[L("span",{children:"\u{1F4CA}"}),L("span",{className:"tracking-wide",children:n.indexSettingsHeading})]}),L("button",{type:"button",onClick:()=>t(f=>({...f,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:void 0,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:n.resetToDefaultsTitle,children:n.reset})]}),L("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:v})]})});tr.displayName="IndexWorkerSettings";se();import{DEFAULT_FUZZY_SEARCH_OPTIONS as me}from"@aiquants/fuzzy-search";import{memo as ad,useId as tn}from"react";import{jsx as te,jsxs as ae}from"react/jsx-runtime";var nr=1e3,ar=ad(({searchOptions:e,setSearchOptions:t})=>{let n=G(),a="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",o=e.sortBy==="relevance",r=tn(),c=tn(),d=tn(),l=tn(),u=tn(),p=tn(),i=[];return i.push(ae("div",{className:`${a} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[ae("div",{className:`${s} text-purple-700 dark:text-purple-300`,children:["\u{1F9EE} ",n.levenshteinCandidateHeading]}),ae("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:n.levenshteinThreshold}),te("input",{id:r,type:"range",min:"0.0",max:o?"1.5":"1.0",step:"0.05",value:e.levenshteinWorkerOptions?.threshold??me.levenshteinWorkerOptions?.threshold,onChange:m=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,threshold:parseFloat(m.target.value)}})),className:"w-full"}),ae("span",{className:"text-purple-600 text-xs dark:text-purple-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.threshold??me.levenshteinWorkerOptions?.threshold]}),te("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:o?n.levenshteinThresholdHintRelevance:n.levenshteinThresholdHint})]}),ae("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:n.levenshteinLengthSimilarity}),te("input",{id:c,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.lengthSimilarityThreshold??me.levenshteinWorkerOptions?.lengthSimilarityThreshold,onChange:m=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,lengthSimilarityThreshold:parseFloat(m.target.value)}})),className:"w-full"}),ae("span",{className:"text-purple-600 text-xs dark:text-purple-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthSimilarityThreshold??me.levenshteinWorkerOptions?.lengthSimilarityThreshold]}),te("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinLengthSimilarityHint})]})]},"threshold")),i.push(ae("div",{className:`${a} border-pink-200 border-l-4 dark:border-pink-400/60`,children:[ae("div",{className:`${s} text-pink-700 dark:text-pink-300`,children:["\u{1FA84} ",n.scoreTuningHeading]}),ae("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:n.levenshteinLengthPenalty}),te("input",{id:d,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.levenshteinWorkerOptions?.lengthDiffPenalty??me.levenshteinWorkerOptions?.lengthDiffPenalty,onChange:m=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,lengthDiffPenalty:parseFloat(m.target.value)}})),className:"w-full"}),ae("span",{className:"text-pink-600 text-xs dark:text-pink-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthDiffPenalty??me.levenshteinWorkerOptions?.lengthDiffPenalty]}),te("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinLengthPenaltyHint})]})]},"penalty")),i.push(ae("div",{className:`${a} border-violet-200 border-l-4 dark:border-violet-400/60`,children:[ae("div",{className:`${s} text-violet-700 dark:text-violet-300`,children:["\u{1F4E6} ",n.levenshteinResultsHeading]}),te("label",{htmlFor:l,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.maxResults}),ae("label",{className:"flex items-center gap-2 text-[11px] text-gray-600 dark:text-slate-300",children:[te("input",{type:"checkbox",checked:e.levenshteinWorkerOptions?.maxResults===void 0,onChange:m=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,maxResults:m.target.checked?void 0:nr}}))}),n.noLimit]}),te("input",{id:l,type:"range",min:nr,max:"10000",step:"1000",disabled:e.levenshteinWorkerOptions?.maxResults===void 0,value:e.levenshteinWorkerOptions?.maxResults===void 0?nr:e.levenshteinWorkerOptions.maxResults,onChange:m=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,maxResults:parseInt(m.target.value,10)}})),className:"w-full disabled:cursor-not-allowed"}),ae("span",{className:"text-violet-600 text-xs dark:text-violet-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.maxResults===void 0?n.noLimit:e.levenshteinWorkerOptions.maxResults]}),te("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinMaxResultsHint})]},"max-results")),i.push(ae("div",{className:`${a} border-rose-200 border-l-4 ${o?"":"opacity-50"} dark:border-rose-400/60`,children:[ae("div",{className:`${s} text-rose-700 dark:text-rose-300`,children:["\u{1F3AF} ",n.relevanceWeightsHeading]}),ae("div",{className:"space-y-2",children:[te("label",{htmlFor:u,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.fieldWeight}),te("input",{id:u,type:"range",min:"0",max:"1",step:"0.05",value:e.levenshteinWorkerOptions?.relevanceFieldWeight??me.levenshteinWorkerOptions?.relevanceFieldWeight??.15,onChange:m=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,relevanceFieldWeight:parseFloat(m.target.value)}})),disabled:!o,className:"w-full disabled:cursor-not-allowed"}),ae("span",{className:"text-rose-600 text-xs dark:text-rose-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.relevanceFieldWeight??me.levenshteinWorkerOptions?.relevanceFieldWeight??.15]}),te("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinFieldWeightHint})]}),ae("div",{className:"space-y-2",children:[te("label",{htmlFor:p,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.levenshteinPartialBonus}),te("input",{id:p,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.partialMatchBonus??me.levenshteinWorkerOptions?.partialMatchBonus,onChange:m=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,partialMatchBonus:parseFloat(m.target.value)}})),disabled:!o,className:"w-full disabled:cursor-not-allowed"}),ae("span",{className:"text-rose-600 text-xs dark:text-rose-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.partialMatchBonus??me.levenshteinWorkerOptions?.partialMatchBonus]}),te("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinPartialBonusHint})]}),!o&&te("p",{className:"text-[11px] text-rose-600 dark:text-rose-300",children:n.relevanceOnlyNotice})]},"relevance")),ae("section",{className:"space-y-3",children:[ae("div",{className:"flex items-center justify-between gap-3",children:[ae("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:n.levenshteinSettingsHeading})]}),te("button",{type:"button",onClick:()=>t(m=>({...m,levenshteinWorkerOptions:{threshold:me.levenshteinWorkerOptions?.threshold||.3,lengthSimilarityThreshold:me.levenshteinWorkerOptions?.lengthSimilarityThreshold||.1,partialMatchBonus:me.levenshteinWorkerOptions?.partialMatchBonus||.1,lengthDiffPenalty:me.levenshteinWorkerOptions?.lengthDiffPenalty||1,maxResults:void 0,relevanceFieldWeight:me.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:n.resetToDefaultsTitle,children:n.reset})]}),te("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:i})]})});ar.displayName="LevenshteinWorkerSettings";import{jsx as qe,jsxs as Ge}from"react/jsx-runtime";var od={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},rr=rd(({searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:a,openEmailsWithGmail:s,setOpenEmailsWithGmail:o,activeTab:r,onTabChange:c})=>{let d=G(),{setScrollableRef:l,onPointerDown:u,onPointerMove:p,onPointerUp:i,onPointerLeave:m,onPointerCancel:h,onClickCapture:x}=pt();return Ge("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:[Ge("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:[Ge("h3",{className:"font-semibold text-gray-700 text-xs transition-colors dark:text-slate-100",children:["\u2699\uFE0F ",d.searchSettings]}),qe("div",{className:"flex flex-wrap gap-1.5",children:Ge("button",{type:"button",onClick:()=>t(C=>ea(C.workerUrls)),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:d.settingsResetAllTitle,children:["\u{1F504} ",d.settingsResetAll]})})]}),qe("div",{className:"mb-0 shrink-0",children:Ge("div",{ref:l,role:"tablist","aria-label":d.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:od,onPointerDown:u,onPointerMove:p,onPointerUp:i,onPointerLeave:m,onPointerCancel:h,onClickCapture:x,children:[Ge("button",{type:"button",role:"tab","aria-selected":r==="basic",onClick:()=>c("basic"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${r==="basic"?"bg-blue-500 text-white dark:bg-blue-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F527} ",d.settingsBasicTab]}),Ge("button",{type:"button",role:"tab","aria-selected":r==="advanced",onClick:()=>c("advanced"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${r==="advanced"?"bg-orange-500 text-white dark:bg-orange-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u26A1 ",d.settingsAdvancedTab]}),Ge("button",{type:"button",role:"tab","aria-selected":r==="index",onClick:()=>c("index"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${r==="index"?"bg-green-500 text-white dark:bg-green-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CA} ",d.indexWorkerName]}),Ge("button",{type:"button",role:"tab","aria-selected":r==="levenshtein",onClick:()=>c("levenshtein"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${r==="levenshtein"?"bg-purple-500 text-white dark:bg-purple-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CF} ",d.levenshteinWorkerName]})]})}),Ge("div",{className:"flex flex-col gap-1",children:[qe("div",{className:`${r==="basic"?"block":"hidden"}`,children:qe(Ma,{searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:a,openEmailsWithGmail:s,setOpenEmailsWithGmail:o})}),qe("div",{className:`${r==="advanced"?"block":"hidden"}`,children:qe(Na,{searchOptions:e,setSearchOptions:t})}),qe("div",{className:`${r==="index"?"block":"hidden"}`,children:qe(tr,{searchOptions:e,setSearchOptions:t})}),qe("div",{className:`${r==="levenshtein"?"block":"hidden"}`,children:qe(ar,{searchOptions:e,setSearchOptions:t})})]})]})});rr.displayName="SearchOptionsPanel";import{memo as ld,useCallback as dd}from"react";Ct();se();import{memo as sd}from"react";import{jsxs as or}from"react/jsx-runtime";var P=sd(({label:e,value:t,unit:n,color:a="text-gray-600 dark:text-slate-300"})=>or("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:[or("span",{className:"wrap-break-word overflow-hidden text-left",children:[e,":"]}),or("span",{className:`font-medium ${a} min-w-0 overflow-hidden break-all transition-colors sm:ml-2`,children:[t,n]})]}));P.displayName="StatItem";Ct();se();import{memo as id}from"react";import{jsx as N,jsxs as V}from"react/jsx-runtime";var nn=id(({kind:e,icon:t,stats:n,color:a})=>{let{locale:s,labels:o}=be(),r=O=>K(s,O);if(!n)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:o.statsNoData});let c=n.basic||{},d=n.workerSpecific||{},l=n.analysis||{},u=c.totalSearches??0,p=c.totalProcessingTime??0,i=c.averageSearchTime??0,m=c.lastSearchTime??0,h=c.errorCount??0,x=c.timestamp,C=l.fieldPerformance||{},v=l.performanceInsights||{},H=l.recentHistory||[],A=d.specificMetrics||{},f=d.operationCount??0,g=d.operationDistribution||{},y=e==="index",T=e==="levenshtein",D=y?o.indexWorkerName:o.levenshteinWorkerName,b=A,S=A,Y="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",_="text-xs font-semibold transition-colors",ie=O=>{if(!O)return;let E=new Date(O);return Number.isNaN(E.getTime())?void 0:o.statsTimestamp(E)},Q=[];if(Q.push(V("div",{className:`${Y} border-blue-200 border-l-4 dark:border-blue-500/60`,children:[V("div",{className:`${_} ${a}`,children:["\u{1F4CA} ",o.statsBasicHeading]}),N(P,{label:o.statTotalSearches,value:r(u),color:a}),N(P,{label:o.statAverageSearchTime,value:i.toFixed(2),unit:"ms",color:a}),N(P,{label:o.statTotalProcessingTime,value:p.toFixed(2),unit:"ms",color:a}),N(P,{label:o.statLastSearchTime,value:m.toFixed(2),unit:"ms",color:a}),N(P,{label:o.statErrorCount,value:h,color:h>0?"text-red-600 dark:text-red-400":a}),ie(x)&&N(P,{label:o.statUpdatedAt,value:ie(x),color:"text-gray-500 dark:text-slate-400"})]},"basic")),f>0||Object.keys(g).length>0){let O=Object.entries(g).sort(([,E],[,U])=>(Number(U)||0)-(Number(E)||0)).slice(0,6);Q.push(V("div",{className:`${Y} border-amber-200 border-l-4 dark:border-amber-400/60`,children:[V("div",{className:`${_} text-amber-600 dark:text-amber-300`,children:["\u{1F527} ",o.statsOperationsHeading]}),N(P,{label:o.statTotalOperations,value:r(f),color:"text-amber-700 dark:text-amber-300"}),O.length>0&&N("div",{className:"mt-1 space-y-1",children:O.map(([E,U])=>N(P,{label:E,value:r(Number(U)),unit:o.timesUnit(r(Number(U))),color:"text-amber-700 dark:text-amber-300"},E))})]},"operations"))}if(y&&(Q.push(V("div",{className:`${Y} border-green-200 border-l-4 dark:border-green-400/60`,children:[V("div",{className:`${_} text-green-700 dark:text-green-300`,children:["\u{1F3D7}\uFE0F ",o.statsIndexHeading]}),N(P,{label:o.statIndexBuilds,value:r(b.totalIndexBuilds??0),color:"text-green-700 dark:text-green-300"}),N(P,{label:o.statDataSize,value:r(b.currentDataSize??0),unit:o.itemsUnit(r(b.currentDataSize??0)),color:"text-green-700 dark:text-green-300"}),N(P,{label:o.statLastBuildTime,value:(b.lastIndexTime??0).toFixed(2),unit:"ms",color:"text-green-700 dark:text-green-300"})]},"index-core")),b.cacheSize&&Q.push(V("div",{className:`${Y} border-emerald-200 border-l-4 dark:border-emerald-400/60`,children:[V("div",{className:`${_} text-emerald-700 dark:text-emerald-300`,children:["\u{1F4BE} ",o.statsCacheHeading]}),N(P,{label:o.statCacheNgram,value:r(b.cacheSize.ngram??0),color:"text-emerald-700 dark:text-emerald-300"}),N(P,{label:o.statCacheWord,value:r(b.cacheSize.word??0),color:"text-emerald-700 dark:text-emerald-300"}),N(P,{label:o.statCachePhonetic,value:r(b.cacheSize.phonetic??0),color:"text-emerald-700 dark:text-emerald-300"})]},"index-cache")),b.indexMetadata)){let O=Object.entries(b.indexMetadata).slice(0,6);O.length>0&&Q.push(V("div",{className:`${Y} border-teal-200 border-l-4 dark:border-teal-400/60`,children:[V("div",{className:`${_} text-teal-700 dark:text-teal-300`,children:["\u{1F4CB} ",o.statsIndexMetadataHeading]}),O.map(([E,U])=>{let ne;if(typeof U=="number"){let le=E.toLowerCase();le.includes("time")&&!le.includes("timestamp")?ne=`${U.toFixed(2)}ms`:le.includes("timestamp")||le.includes("at")?ne=ie(U)??U.toString():ne=r(U)}else ne=String(U);return N(P,{label:E,value:ne,color:"text-teal-700 dark:text-teal-300"},E)})]},"index-meta"))}if(T){if(Q.push(V("div",{className:`${Y} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[V("div",{className:`${_} text-purple-700 dark:text-purple-300`,children:["\u{1F522} ",o.statsCalculationsHeading]}),N(P,{label:o.statTotalCalculations,value:r(S.totalCalculations??0),color:"text-purple-700 dark:text-purple-300"}),N(P,{label:o.statDistanceCalculations,value:r(S.totalDistanceCalculations??0),color:"text-purple-700 dark:text-purple-300"}),N(P,{label:o.statAverageDistance,value:typeof S.averageDistance=="number"?S.averageDistance.toFixed(2):"0.00",color:"text-purple-700 dark:text-purple-300"}),N(P,{label:o.statMinDistance,value:S.minDistance??o.notAvailable,color:"text-purple-700 dark:text-purple-300"}),N(P,{label:o.statMaxDistance,value:S.maxDistance??0,color:"text-purple-700 dark:text-purple-300"})]},"lev-basic")),Q.push(V("div",{className:`${Y} border-fuchsia-200 border-l-4 dark:border-fuchsia-400/60`,children:[V("div",{className:`${_} text-fuchsia-700 dark:text-fuchsia-300`,children:["\u{1F3AF} ",o.statsMatchesHeading]}),N(P,{label:o.statPartialMatches,value:r(S.partialMatches??0),color:"text-fuchsia-700 dark:text-fuchsia-300"}),N(P,{label:o.statPerfectMatches,value:r(S.perfectMatches??0),color:"text-fuchsia-700 dark:text-fuchsia-300"}),N(P,{label:o.statEarlyTerminations,value:r(S.earlyTerminations??0),color:"text-fuchsia-700 dark:text-fuchsia-300"})]},"lev-match")),S.similarityThresholds&&Q.push(V("div",{className:`${Y} border-rose-200 border-l-4 dark:border-rose-400/60`,children:[V("div",{className:`${_} text-rose-700 dark:text-rose-300`,children:["\u{1F4C8} ",o.statsSimilarityHeading]}),N(P,{label:o.statAbove80,value:r(S.similarityThresholds.above80??0),color:"text-emerald-700 dark:text-emerald-300"}),N(P,{label:o.statAbove60,value:r(S.similarityThresholds.above60??0),color:"text-lime-700 dark:text-lime-300"}),N(P,{label:o.statAbove40,value:r(S.similarityThresholds.above40??0),color:"text-orange-600 dark:text-orange-300"}),N(P,{label:o.statBelow40,value:r(S.similarityThresholds.below40??0),color:"text-red-600 dark:text-red-400"})]},"lev-similarity")),S.distanceDistribution){let O=Object.entries(S.distanceDistribution).sort(([,E],[,U])=>Number(U)-Number(E)).slice(0,6);O.length>0&&Q.push(V("div",{className:`${Y} border-indigo-200 border-l-4 dark:border-indigo-500/60`,children:[V("div",{className:`${_} text-indigo-700 dark:text-indigo-300`,children:["\u{1F4CA} ",o.statsDistanceHeading]}),O.map(([E,U])=>N(P,{label:o.statDistance(E),value:r(Number(U)),unit:o.timesUnit(r(Number(U))),color:"text-indigo-700 dark:text-indigo-300"},E))]},"lev-distance"))}if(S.queryLengthStats){let O=Object.entries(S.queryLengthStats).sort(([,E],[,U])=>(U.count??0)-(E.count??0)).slice(0,6);O.length>0&&Q.push(V("div",{className:`${Y} border-violet-200 border-l-4 dark:border-violet-400/60`,children:[V("div",{className:`${_} text-violet-700 dark:text-violet-300`,children:["\u{1F4CF} ",o.statsQueryLengthHeading]}),O.map(([E,U])=>{let ne=Number(U.count??0),le=Number(U.averageScore??0);return N(P,{label:o.statQueryLength(E),value:o.statQueryLengthValue({count:ne,averagePercent:(le*100).toFixed(1)}),color:"text-violet-700 dark:text-violet-300"},E)})]},"lev-query-length"))}}if(Object.keys(C).length>0){let O=Object.entries(C).sort(([,E],[,U])=>(U.averageScore??0)-(E.averageScore??0)).slice(0,6);Q.push(V("div",{className:`${Y} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[V("div",{className:`${_} text-purple-700 dark:text-purple-300`,children:["\u{1F4CB} ",o.statsFieldPerformanceHeading]}),O.map(([E,U])=>{let ne=U;return V("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:E}),N(P,{label:o.statAverageScore,value:`${((ne.averageScore??0)*100).toFixed(1)}%`,color:"text-purple-700 dark:text-purple-300"}),N(P,{label:o.statMatchCount,value:r(ne.matchCount??0),unit:o.itemsUnit(r(ne.matchCount??0)),color:"text-purple-700 dark:text-purple-300"}),N(P,{label:o.statBestWorstScore,value:`${((ne.bestScore??0)*100).toFixed(1)}% / ${((ne.worstScore??0)*100).toFixed(1)}%`,color:"text-purple-700 dark:text-purple-300"})]},E)})]},"field-performance"))}if(v.bestPerformingField||v.totalHistoryEntries||v.similarityDistribution){let O=(v.recentAverageResultCount??0).toFixed(1);Q.push(V("div",{className:`${Y} border-blue-200 border-l-4 dark:border-blue-400/60`,children:[V("div",{className:`${_} text-blue-700 dark:text-blue-300`,children:["\u{1F50D} ",o.statsInsightsHeading]}),v.bestPerformingField&&N(P,{label:o.statBestField,value:v.bestPerformingField,color:"text-blue-700 dark:text-blue-300"}),N(P,{label:o.statRecentAverageTime,value:(v.recentAverageProcessingTime??0).toFixed(2),unit:"ms",color:"text-blue-700 dark:text-blue-300"}),N(P,{label:o.statRecentAverageResults,value:O,unit:o.itemsUnit(O),color:"text-blue-700 dark:text-blue-300"}),N(P,{label:o.statThroughput,value:(v.throughputPerSecond??0).toFixed(2),unit:o.throughputUnit,color:"text-blue-700 dark:text-blue-300"}),N(P,{label:o.statCommonQueryLength,value:r(v.mostCommonQueryLength??0),unit:o.charactersUnit(r(v.mostCommonQueryLength??0)),color:"text-blue-700 dark:text-blue-300"}),N(P,{label:o.statHistoryEntries,value:r(v.totalHistoryEntries??0),color:"text-blue-700 dark:text-blue-300"}),v.similarityDistribution&&V("div",{className:"mt-1 grid grid-cols-2 gap-1",children:[N(P,{label:o.statHighSimilarity,value:r(v.similarityDistribution.highSimilarity??0),color:"text-emerald-700 dark:text-emerald-300"}),N(P,{label:o.statMediumSimilarity,value:r(v.similarityDistribution.mediumSimilarity??0),color:"text-lime-700 dark:text-lime-300"}),N(P,{label:o.statLowSimilarity,value:r(v.similarityDistribution.lowSimilarity??0),color:"text-orange-600 dark:text-orange-300"}),N(P,{label:o.statVeryLowSimilarity,value:r(v.similarityDistribution.veryLowSimilarity??0),color:"text-red-600 dark:text-red-400"})]})]},"performance-insights"))}return H.length>0&&Q.push(V("div",{className:`${Y} border-sky-200 border-l-4 dark:border-sky-400/60`,children:[V("div",{className:`${_} text-sky-700 dark:text-sky-300`,children:["\u{1F4C8} ",o.statsRecentHistoryHeading]}),H.slice(-3).reverse().map((O,E)=>V("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:O.operationType}),N("div",{className:"text-sky-600 text-xs transition-colors dark:text-sky-200",children:o.statsHistoryEntry({processingTimeMs:O.processingTime.toFixed(2),resultCount:O.resultCount??0})}),ie(O.timestamp)&&N("div",{className:"text-[10px] text-sky-500 transition-colors dark:text-sky-200",children:ie(O.timestamp)})]},`${O.operationType}-${O.timestamp??E}`))]},"recent-history")),V("section",{className:"space-y-2",children:[V("div",{className:`flex items-center gap-2 font-semibold text-xs ${a}`,children:[N("span",{children:t}),N("span",{className:"tracking-wide",children:D})]}),N("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:Q})]})});nn.displayName="WorkerStatsSection";import{jsx as Le,jsxs as Re}from"react/jsx-runtime";var cd={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},sr=ld(({performanceMetrics:e,searchTerm:t,totalDataCount:n,resultsCount:a,resetStats:s,rebuildIndex:o,isIndexBuilding:r,activeTab:c,onTabChange:d})=>{let{locale:l,labels:u}=be(),p=t.trim(),i=p?a:n,{setScrollableRef:m,onPointerDown:h,onPointerMove:x,onPointerUp:C,onPointerLeave:v,onPointerCancel:H,onClickCapture:A}=pt(),f=c!=="index"||r,g=r?u.statsRebuildingTitle:c!=="index"?u.statsRebuildIndexTabOnlyTitle:u.statsRebuildTitle,y=f?"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",T=r?`\u23F3 ${u.statsRebuilding}`:`\u{1F3D7}\uFE0F ${u.statsRebuild}`,D=dd(()=>{o().catch(()=>{})},[o]);return Re("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:[Re("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:[Re("h3",{className:"font-semibold text-gray-700 text-xs transition-colors dark:text-slate-100",children:["\u{1F4CA} ",u.searchStatistics]}),Re("div",{className:"flex flex-wrap gap-1.5",children:[Le("button",{type:"button",onClick:D,disabled:f,className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${y}`,title:g,children:T}),Re("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:u.statsResetTitle,children:["\u{1F504} ",u.reset]})]})]}),Le("div",{className:"mb-0 shrink-0",children:Re("div",{ref:m,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:cd,onPointerDown:h,onPointerMove:x,onPointerUp:C,onPointerLeave:v,onPointerCancel:H,onClickCapture:A,children:[Re("button",{type:"button",onClick:()=>d("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} ",u.statsOverviewTab]}),Re("button",{type:"button",onClick:()=>d("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} ",u.statsIndexTab]}),Re("button",{type:"button",onClick:()=>d("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} ",u.statsLevenshteinTab]})]})}),Re("div",{className:"flex flex-col gap-1 pb-0.5",children:[Re("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:[Le(P,{label:u.statTotalSearches,value:K(l,e.totalSearches)}),Le(P,{label:u.statAverageSearchTime,value:e.averageSearchTime.toFixed(1),unit:"ms"}),Le(P,{label:u.statDataCount,value:K(l,e.itemCount)}),Le(P,{label:p?u.statResultCount:u.statDisplayedCount,value:K(l,i)})]}),Le("div",{className:`${c==="index"?"space-y-3":"hidden"} pr-1 text-gray-600 text-xs transition-colors dark:text-slate-300`,children:Le(nn,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:"text-green-600 dark:text-green-300"})}),Le("div",{className:`${c==="levenshtein"?"space-y-3":"hidden"} pr-1 text-gray-600 text-xs transition-colors dark:text-slate-300`,children:Le(nn,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:"text-purple-600 dark:text-purple-300"})}),Re("div",{className:"hidden",children:[Le(nn,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:"text-green-600 dark:text-green-300"}),Le(nn,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:"text-purple-600 dark:text-purple-300"})]})]})]})});sr.displayName="StatisticsPanel";import{Fragment as _o,jsx as Z,jsxs as ge}from"react/jsx-runtime";var yd=/[\u200B\uFEFF]/g,ir=typeof window<"u",Ao=ir&&typeof document<"u",ua=(e,t=[],n=!1)=>{let a=Wo(e);a.current=e,ot(()=>{if(!(!ir||n&&!Ao))return a.current()},[n,...t])},Lo=(e,t,n)=>{let[a,s]=Ue(()=>{let o=Eo(r=>r.getItem(e));return o&&t.includes(o)?o:n});return ua(()=>{Eo(o=>{o.setItem(e,a)})},[e,a]),[a,s]},Eo=e=>{if(!ir)return null;try{return e(window.sessionStorage)}catch{return null}},Oo=(e,t)=>{let[n,a]=Ue(e);return ot(()=>{let s=setTimeout(()=>{a(e)},t);return()=>{clearTimeout(s)}},[e,t]),n},xd="contact-map.settings-tab",vd="contact-map.statistics-tab",Cd=["basic","advanced","index","levenshtein"],kd=["overview","index","levenshtein"],Do=["full_name","company_name","department","title","email","company_phone_number","mobile_phone_number"],Sd={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},Ho=({streamState:e,...t}={})=>e===void 0?Z(Td,{...t}):Z(Io,{...t,streamState:e}),Td=e=>{let{context:t}=Zn();return Z(Io,{...e,streamState:t})},wd={setting:"ContactMapSearchPage workerUrls",keys:["indexWorker","levenshteinWorker"],hints:{treeWorker:"set treeWorker on ContactMapConfigProvider or ContactMapAppView"}},Io=e=>{let{streamState:t,onFooterVisibilityChange:n,children:a}=e,s=fe(e,"workerUrls"),o=at(),{locale:r,labels:c}=be(),{contactMapRecords:d,contactMapRecordMap:l,isStreamingComplete:u,isStreamingFailed:p}=t,i=fd(),[m]=bd(),h=Wo(null),[x,C]=Ue(!0),[v,H]=Ue(o.openEmailsWithGmail??!1),{indexWorker:A,levenshteinWorker:f}=Xt(o.workerUrls,s,wd),[g,y]=Ue(()=>ea({indexWorker:A,levenshteinWorker:f})),[T,D]=Ue(m.get("q")||""),b=Oo(T,g.debounceMs??pd.debounceMs);ot(()=>{let k=m.get("q")||"";D(M=>M!==k?k:M)},[m]),ot(()=>{if(typeof window>"u")return;let k=new URL(window.location.href);(k.searchParams.get("q")||"")!==b&&(b?k.searchParams.set("q",b):k.searchParams.delete("q"),window.history.replaceState(window.history.state,"",k.toString()))},[b]);let[S,Y]=hd(),[_,ie]=Ue("search"),[Q,O]=Lo(xd,Cd,"basic"),[E,U]=Lo(vd,kd,"overview"),{setScrollableRef:ne,onPointerDown:le,onPointerMove:ve,onPointerUp:gt,onPointerLeave:Rt,onPointerCancel:st,onClickCapture:Lt}=pt(),de=an(()=>{if(!Ao)return;let k=h.current;!k||document.activeElement===k||window.requestAnimationFrame(()=>{try{k.focus({preventScroll:!0})}catch{}})},[]),Et=an(k=>{let M=k;ie(M),M==="search"&&de()},[de]),Ee=mt(()=>({...g,debounceMs:0}),[g]),[Ye,Oe]=Ue("union"),Te=Ye==="intersection",Ot=Te?c.operatorAndTitle:c.operatorOrTitle,ht=an(k=>ud(k,Ye),[Ye]),$=mt(()=>({querySetsOf:ht}),[ht]),re=Oo(d,u?0:800),{searchTerm:B,setSearchTerm:it,filteredItems:Dt,resultTerm:_t,isSearching:Qe,isIndexBuilding:we,clearSearch:Tn,resetStats:sn,performanceMetrics:De,rebuildIndex:ln,error:lt}=md(re,Do,Ee,$),_e=B.trim().length>0,[Be,dn]=Ue(""),[Wt,At]=Ue(()=>B),cn=mt(()=>Bn(T),[T]),dt=mt(()=>Bn(b),[b]);ot(()=>{b===Be&&dt===B||Y(()=>{dn(b),it(dt)})},[b,Be,dt,B,it]);let Ht=an(k=>{let oe=k.target.value.replace(yd,"");D(oe)},[]),It=an(()=>{D(""),dn(""),Tn(),de()},[Tn,de]),wn=an(()=>{Oe(k=>k==="intersection"?"union":"intersection"),de()},[de]);ua(()=>{if(!(_==="search"&&i.state==="idle"&&!S))return;let M=document.activeElement;if(!!!(M?.matches('[role="tab"]')||M?.closest('[role="tablist"]')?.getAttribute("role")==="tablist")&&M&&M!==document.body&&M!==h.current)return;let Ce=window.requestAnimationFrame(()=>{de()});return()=>{window.cancelAnimationFrame(Ce)}},[_,i.state,S,de],!0),ua(()=>{if(_!=="search")return;let k=[[document,"visibilitychange",()=>{document.visibilityState==="visible"&&de()}],[window,"pageshow",()=>{de()}]];for(let[M,oe,Ce]of k)M.addEventListener(oe,Ce);return()=>{for(let[M,oe,Ce]of k)M.removeEventListener(oe,Ce)}},[_,de],!0),ot(()=>(n&&n(_==="search"?"mobile-hidden":"visible"),()=>{n&&n("visible")}),[_,n]),ua(()=>{let k=document.body,M=k.style.overflow;return _==="search"&&(k.style.overflow="hidden"),()=>{k.style.overflow=M}},[_],!0),ot(()=>{De&&je.info("\u{1F4CA} [STATE] \u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u6307\u6A19\u304C\u66F4\u65B0\u3055\u308C\u307E\u3057\u305F:",{totalSearches:De.totalSearches,averageSearchTime:De.averageSearchTime,itemCount:De.itemCount,resultsCount:De.resultsCount,workersAvailable:!!De.workerStats})},[De]);let{isAwaitingDebounce:Ft,isAwaitingSearchTermSync:Nn,isSearchInProgress:Xe}=mt(()=>{let k=cn!==dt,M=dt!==B,oe=B.trim().length>0||cn.trim().length>0;return{isAwaitingDebounce:k,isAwaitingSearchTermSync:M,isSearchInProgress:S||Qe||_t!==B&<===null||oe&&we||k||M||Wt!==B}},[cn,dt,B,_t,lt,S,Qe,we,Wt]),[zt,ma]=Ue(B);ot(()=>{zt!==B&&ma(B)},[B,zt]),ot(()=>{Ft||Nn||S||Qe||we||zt===B&&Wt!==B&&At(B)},[B,Wt,Ft,Nn,S,Qe,we,zt]);let Mn=mt(()=>Er(Be,Do),[Be]),Pn=mt(()=>Mn(Dt),[Mn,Dt]),pn=mt(()=>({contactMapRecords:d,contactMapRecordMap:l,filteredItems:Pn,searchQuery:Be,searchTerm:B,isSearching:Qe,isIndexBuilding:we,isPending:S,hasSearchTerm:_e,enableHighlighting:x,openEmailsWithGmail:v,isSearchInProgress:Xe,isSearchTabActive:_==="search",errorMessage:lt??null,isStreamingComplete:u,isStreamingFailed:p}),[d,l,Pn,Be,B,Qe,we,S,_e,x,v,Xe,_,lt,u,p]),Rn=_e?Dt.length:d.length,Ln=K(r,d.length),En=K(r,Dt.length);return Z("div",{className:`scrollbar-hidden bg-slate-50 text-slate-900 dark:bg-slate-900 dark:text-slate-100${_==="search"?" h-full min-h-0":""}`,children:ge(Gn,{value:_,onValueChange:Et,className:`flex flex-col${_==="search"?" h-full min-h-0":""}`,children:[ge(yn,{ref:ne,style:Sd,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:le,onPointerMove:ve,onPointerUp:gt,onPointerLeave:Rt,onPointerCancel:st,onClickCapture:Lt,children:[ge(St,{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(St,{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(St,{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]})]}),Z(Tt,{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:[Z("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:[Z("div",{className:"relative",children:ge("div",{className:"flex items-center gap-1 p-1",children:[ge("button",{type:"button",onClick:wn,"aria-pressed":Te,title:Ot,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 ${Te?"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:[Z("span",{className:"text-[10px] sm:text-xs",children:Te?c.operatorAnd:c.operatorOr}),Z("span",{className:"hidden text-[10px] sm:inline",children:Te?c.operatorAndHint:c.operatorOrHint})]}),Z("input",{ref:h,type:"text",value:T,onChange:Ht,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"}),T&&Z("button",{type:"button",onClick:It,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(_o,{children:[Z(gd,{"aria-hidden":"true",className:"h-3 w-3 animate-spin sm:h-3.5 sm:w-3.5"}),Z("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," ",Z("span",{className:"font-semibold text-[11px] text-slate-900 sm:text-xs dark:text-white",children:Ln})," ",c.recordUnit(Ln),we?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,lt?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,Z("span",{className:"ml-1 break-all font-semibold",children:lt})]}):null,_e&&ge("span",{className:"ml-1.5 text-[10px] text-blue-600 sm:text-[11px] dark:text-sky-400",children:["| ",c.resultCountLabel,Xe?Z("span",{className:"ml-1 font-semibold text-[10px] sm:text-[11px]",children:c.searching}):ge(_o,{children:[Z("span",{className:"ml-1 font-semibold text-[11px] text-slate-900 sm:text-xs dark:text-white",children:En}),Z("span",{className:"ml-0.5 text-[10px] sm:text-[11px]",children:c.resultUnit(En)})]})]})]}),Z("div",{className:"h-2.5 px-2 pb-1.5",children:we?Z(qr,{className:"h-1 bg-blue-200 dark:bg-blue-800",indicatorClassName:"bg-blue-500 dark:bg-blue-400"}):null})]})}),a?a(pn):Z(Ro,{context:pn})]})}),Z(Tt,{value:"settings",className:"mt-0",children:Z(rr,{searchOptions:g,setSearchOptions:y,enableHighlighting:x,setEnableHighlighting:C,openEmailsWithGmail:v,setOpenEmailsWithGmail:H,activeTab:Q,onTabChange:O})}),Z(Tt,{value:"statistics",className:"mt-0",children:Z(sr,{performanceMetrics:De,searchTerm:B,totalDataCount:d.length,resultsCount:Rn,resetStats:sn,rebuildIndex:ln,isIndexBuilding:we,activeTab:E,onTabChange:U})})]})})};import{jsx as on,jsxs as zo}from"react/jsx-runtime";var Nd=({renderHeader:e,title:t,onFooterVisibilityChange:n})=>{let a=G(),s=t===void 0?a.appTitle:t,{context:o,retryNow:r}=Zn(),c=on(za,{recordCount:o.contactMapRecords.length,companyCount:o.companyCount,phase:o.streamPhase,loadedCount:o.loadedCount,totalCount:o.totalCount,errorMessage:o.errorMessage,onRetry:r});return zo("div",{"data-testid":"contact-map-app-view",className:"flex h-full w-full flex-col",children:[e?e({title:s,annotation:c}):zo("div",{"data-testid":"contact-map-default-header",className:"mb-2 flex items-center justify-between",children:[on("h1",{className:"font-bold text-xl",children:s}),c]}),on("div",{className:"min-h-0 flex-1",children:on(Ho,{streamState:o,onFooterVisibilityChange:n})})]})},wg=e=>{let t=at(),n=fe(e,"streamEndpoint"),a=fe(e,"workerUrls"),s=fe(e,"locale"),o=fe(e,"labels"),r=Fo(()=>({...t,streamEndpoint:n===void 0?t.streamEndpoint:n,workerUrls:Xt(t.workerUrls,a,{setting:"ContactMapAppView workerUrls"}),locale:s===void 0?t.locale:s,labels:o===void 0?t.labels:o}),[t,n,a,s,o]),c=s!==void 0,d=o!==void 0,l=Fo(()=>({locale:c?"ContactMapAppView locale":"locale",labels:d?"ContactMapAppView labels":"labels"}),[c,d]);return on(Ba,{config:r,chromeSurface:l,children:on(Nd,{...e})})};Ct();se();import{createShouldRevalidate as Md}from"@aiquants/route-revalidation";var Lg=Md({submissions:"url",query:{ignore:[Jt,"q"]}});export{Na as AdvancedSearchSettings,Ma as BasicSearchSettings,et as CONTACT_MAP_LABEL_CATALOGS,mn as CONTACT_MAP_LABEL_KEYS,Or as ContactDetailGrid,Qt as ContactDetailPanel,zn as ContactDetailPopup,Un as ContactDetailRowLayout,za as ContactMapAnnotation,wg as ContactMapAppView,bi as ContactMapConfigProvider,mo as ContactMapSearchListView,Ho as ContactMapSearchPage,Ro as ContactMapSearchTabGroup,Po as ContactMapSearchTreeView,Qn as ContactMapStreamClient,pe as HighlightedText,tr as IndexWorkerSettings,bu as LIST_COLLAPSE_THRESHOLD,ul as LIST_DETAIL_PANEL_MIN_WIDTH,yu as LIST_EXPAND_THRESHOLD,pl as LIST_PANEL_MIN_WIDTH,ml as LIST_RESIZE_HANDLE_THICKNESS,ar as LevenshteinWorkerSettings,qr as Progress,rr as SearchOptionsPanel,P as StatItem,sr as StatisticsPanel,sa as SwipeOverlay,Zu as TREE_COLLAPSE_THRESHOLD,Ul as TREE_DETAIL_PANEL_MIN_WIDTH,em as TREE_EXPAND_THRESHOLD,zl as TREE_PANEL_MIN_WIDTH,Bl as TREE_RESIZE_HANDLE_THICKNESS,Gn as Tabs,Tt as TabsContent,yn as TabsList,St as TabsTrigger,da as TreeWorkerSession,nn as WorkerStatsSection,Xn as assertContactMapStreamEndpoint,Ur as assertContactMapTreeWorkerUrl,mp as assertContactMapWorkerUrls,jl as composeTreeVirtualScrollOptions,Lg as contactMapShouldRevalidate,Ri as countContactMapCompanies,Ci as deserializeStreamRecord,Ti as getContactMapStreamClient,El as getTreeWorkerSession,Xt as layerContactMapWorkerUrls,Pp as resetContactMapStreamClientForTesting,Lu as resetTreeWorkerSessionForTesting,Ca as resolveContactMapLabels,go as useAnimatedNumber,at as useContactMapConfig,G as useContactMapLabels,Pi as useContactMapStream,Ga as useContactPanelSizing,Yr as useDynamicViewportHeight,pt as useHorizontalDragScroll,aa as useLongPressPopup,Cl as useReportPopupVisibility,ra as useResponsiveTwoColumnLayout,vl as useRowPopupRegistry,Zn as useStreamedContactMapContext,xo as useTreeWorker};
|