1 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="3720cd37-a419-55e7-a803-11f3c6f5b535")}catch(e){}}(); 3import{a as T}from"/build/_shared/chunk-45H5KRS4.js";import{a as x,b as C}from"/build/_shared/chunk-UIX34OVT.js";import"/build/_shared/chunk-L4IMTPKG.js";import{a as F}from"/build/_shared/chunk-LBXDCQPQ.js";import"/build/_shared/chunk-VO57OUMV.js";import"/build/_shared/chunk-IBVIZH72.js";import{G as _,V as I,l as v}from"/build/_shared/chunk-ESBXDQK4.js";import{K as A,j as b}from"/build/_shared/chunk-MOPZ44CF.js";import"/build/_shared/chunk-RU3AJG5W.js";import"/build/_shared/chunk-TAFHSCUC.js";import"/build/_shared/chunk-POF5DMZC.js";import"/build/_shared/chunk-UCICWG5U.js";import"/build/_shared/chunk-7MTUREWS.js";import"/build/_shared/chunk-7JAJ2GJX.js";import"/build/_shared/chunk-HXUES3U2.js";import{N as g,n as w}from"/build/_shared/chunk-ILP2J7HY.js";import{b as k}from"/build/_shared/chunk-KYLIBDJZ.js";import"/build/_shared/chunk-NPNBV2ZW.js";import{d as U,w as y}from"/build/_shared/chunk-BMGOODB7.js";import{b as M}from"/build/_shared/chunk-NQADK2YD.js";import{b as j,d as f}from"/build/_shared/chunk-2LOM2E4Y.js";var L=j(p=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});p.jaroWinkler=p.jaro=void 0;function S(r,e,l){if(r.length===0||e.length===0)return 0;if(l&&!l.caseSensitive&&(r=r.toUpperCase(),e=e.toUpperCase()),r===e)return 1;for(var n=0,o=r.length,s=e.length,i=Math.floor(Math.max(o,s)/2)-1,c=new Array(o),d=new Array(s),a=0;a<o;a++)for(var u=Math.max(0,a-i);u<=Math.min(s,a+i+1);u++)if(!c[a]&&!d[u]&&r[a]===e[u]){++n,c[a]=d[u]=!0;break}if(n===0)return 0;for(var m=0,h=0,a=0;a<o;a++)if(c[a]){for(;!d[h];)h++;r.charAt(a)!==e.charAt(h++)&&m++}return m/=2,(n/o+n/s+(n-m)/n)/3}p.jaro=S;function q(r,e,l){var n=S(r,e,l),o=0;if(n>.7){for(var s=Math.min(r.length,e.length),i=0;r[i]===e[i]&&i<4&&i<s;)++o,i++;n+=.1*o*(1-n)}return n}p.jaroWinkler=q});var N=f(L());var R=f(x()),V=f(C());var W=f(F()),t=f(M()),z=I(k.object({userMapping:T.repeatableOfType(k.object({slackId:k.string(),notionId:k.string()}))}));function D(){let r=y(),e=r.slackUsers.filter(c=>!c.is_bot&&c.name!=="slackbot").sort((c,d)=>-c.name.localeCompare(d.name)),l=r.notionUsers.filter(c=>c.type==="person"),n=Math.max(e.length,l.length),o=[...new Array(n)],s=E(l,e),i=U();return(0,t.jsx)(A,{title:"Link Users",onClose:()=>i("..",{relative:"path"}),children:(0,t.jsxs)(_,{method:"post",validator:z,children:[(0,t.jsxs)(b,{style:{borderRadius:"0.5rem"},children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{children:[(0,t.jsx)(v,{icon:"slack-line",name:"Slack User"}),(0,t.jsx)(v,{name:"Notion User"})]})}),(0,t.jsx)("tbody",{children:o.map((c,d)=>{var a,u;return(0,t.jsxs)("tr",{children:[(0,t.jsx)("td",{children:(0,t.jsxs)("select",{defaultValue:(a=e[d])==null?void 0:a.id,name:`userMapping[${d}].slackId`,children:[(0,t.jsx)("option",{value:"",children:"No one"}),e.map(m=>(0,t.jsx)("option",{value:m.id,children:m.name},m.id))]})}),(0,t.jsx)("td",{children:(0,t.jsxs)("select",{defaultValue:s[(u=e[d])==null?void 0:u.id],name:`userMapping[${d}].notionId`,children:[(0,t.jsx)("option",{value:"",children:"No one"}),l.map(m=>(0,t.jsx)("option",{value:m.id,children:m.name},m.id))]})})]},d)})})]}),(0,t.jsxs)(g,{type:"brand",size:"sm",margin:"0 0.5rem 0.5rem",children:[(0,t.jsx)(w,{type:"save-line"}),"Save"]})]})})}function E(r,e){let l={};for(let o of e){l[o.id]=[];for(let s of r)l[o.id].push({notionUser:s,distance:(0,N.jaroWinkler)(s.name||"Unnamed",o.name,{caseSensitive:!1})});l[o.id].sort((s,i)=>i.distance-s.distance)}let n={};for(let o of e){let s=l[o.id],i=null;for(let c of s){let d=!1;for(let a of e){if(a.id===o.id)continue;let m=l[a.id].find(h=>h.notionUser.id===c.notionUser.id);if(m&&m.distance>c.distance){d=!0;break}}d||(i=c)}i&&(n[o.id]=i.notionUser.id)}return n}export{D as default}; 4 5//# debugId=3720cd37-a419-55e7-a803-11f3c6f5b535
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.