PageSourceSearch

https://app.thena.ai/assets/index-CxLKVlox.js

js thena.ai collected 2026-09-28 06:45:15 UTC 17,476 bytes, 7 lines download raw bytes

1import{d as U,r as x,mC as H,mB as R,j as t,km as g,_ as q,c as _,mT as B,dn as w,l as j,H as P,M as K,bg as $,B as z,a as W,eq as G}from"./index-B79jx0QH.js";import{a as Q,P as Y,b as J,u as E,E as X}from"./index-CGzZfis7.js";import{m as L,C as Z,c as ee,E as te,A as se}from"./EditorHeader-CiZnjA6y.js";import{K as M,d as ne}from"./util-hPl1gVLb.js";import{T as oe,a as re,b as ae,c as ie}from"./tabs-YP6h6g3y.js";import{v as T}from"./v4-z9O0CCJw.js";import{H as le}from"./highcharts-react.min-DAbWAY0J.js";import"./hocuspocus-provider.esm-CiBI0lSK.js";import"./isEqual-DiuqF2Jo.js";import"./_baseIsEqual-Bttsd4ht.js";import"./knowledgeBase-CpxB7tpC.js";import"./TagsPlusSelect-DNK8E-ur.js";import"./InputWithIcon-CbUy2I24.js";import"./useQueryError-BprBq0Eh.js";import"./index-DNi9bZVg.js";import"./get-hvE2u49Z.js";import"./_stringToPath-CT2uNAC1.js";import"./toString-CXzKODmQ.js";import"./_baseToString-BHVwc-td.js";import"./CollectionDetailsContent-Qqbc2YX1.js";import"./dropdown-menu-DOfBs0uf.js";import"./index-DnQZnmdU.js";import"./index-Zo-lXBHX.js";import"./truncate-BRaWn6IV.js";import"./_stringToArray-CLcxpAjc.js";import"./_baseProperty-C_kSdomh.js";import"./toInteger-BWdPTUNd.js";import"./CopyToClipBoard-Bg36D7af.js";import"./index-CDkXi-zx.js";import"./tiptap-extension-emoji.esm-DwryuH0E.js";import"./index-DgEKWqJ-.js";import"./Table-D-jJZWkB.js";import"./index-DUYSd5Jb.js";import"./suggestion-wzYViBsq.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},s=new Error().stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="02218f8f-c9d7-4bcc-83f8-cfa89ad9c504",e._sentryDebugIdIdentifier="sentry-dbid-02218f8f-c9d7-4bcc-83f8-cfa89ad9c504")}catch{}})();function ce(e,s){const r=U(s);return de({filters:{...e,status:"pending"}},r).length}function I(e,s){return e.findAll(s.filters).map(r=>s.select?s.select(r):r.state)}function de(e={},s){const r=U(s).getMutationCache(),a=x.useRef(e),o=x.useRef();return o.current||(o.current=I(r,e)),x.useEffect(()=>{a.current=e}),x.useSyncExternalStore(x.useCallback(d=>r.subscribe(()=>{const n=H(o.current,I(r,a.current));o.current!==n&&(o.current=n,R.schedule(d))}),[r]),()=>o.current,()=>o.current)}const ue=({item:e})=>t.jsx("a",{href:`#${e.id}`,style:{marginLeft:`${1*e.level-1}rem`},className:"block p-1 rounded bg-opacity-10 text-sm truncate w-full",children:e.textContent}),pe=({content:e})=>t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"mb-2 text-xs font-semibold uppercase",children:"Table of contents"}),t.jsx("div",{className:"flex flex-col gap-1",children:e.map(s=>t.jsx(ue,{item:s},s.id))})]}),me=({getId:e,anchorTypes:s=["heading"]})=>new Y({key:new J("tableOfContent"),appendTransaction(r,a,o){const d=o.tr;let n=!1;if(r.some(c=>c.docChanged)){const c=[];o.doc.descendants((i,l)=>{const u=i.attrs["data-toc-id"];if(s.includes(i.type.name)&&i.textContent.length!==0){if(u==null||c.includes(u)){let m="";m=e?e(i.textContent):T(),d.setNodeMarkup(l,void 0,{...i.attrs,"data-toc-id":m,id:m}),n=!0}c.push(u)}})}return n?d:null}}),A=(e,s)=>{let r=1;const a=s.at(-1),o=[...s].reverse().find(n=>n.originalLevel<=e.node.attrs.level),d=(o==null?void 0:o.level)||1;return r=e.node.attrs.level>((a==null?void 0:a.originalLevel)||1)?((a==null?void 0:a.level)||1)+1:e.node.attrs.level<((a==null?void 0:a.originalLevel)||1)?d:(a==null?void 0:a.level)||1,r},V=(e,s)=>{const r=s.at(-1);return r?((r==null?void 0:r.itemIndex)||1)+1:1},D=(e,s,r)=>{var a,o;const d=r||e.node.attrs.level||1;let n=1;const c=s.filter(i=>i.level<=d);return n=((a=c.at(-1))===null||a===void 0?void 0:a.level)===d?(((o=c.at(-1))===null||o===void 0?void 0:o.itemIndex)||1)+1:1,n},F=(e,s)=>{const{editor:r}=s,a=[],o=[];let d=null;if(r.state.doc.descendants((n,c)=>{var i;!((i=s.anchorTypes)===null||i===void 0)&&i.includes(n.type.name)&&a.push({node:n,pos:c})}),a.forEach(n=>{const c=r.view.domAtPos(n.pos+1).node;s.storage.scrollPosition>=c.offsetTop&&(d=n.node.attrs["data-toc-id"],o.push(n.node.attrs["data-toc-id"]))}),e=e.map(n=>({...n,isActive:n.id===d,isScrolledOver:o.includes(n.id)})),s.onUpdate){const n=s.storage.content.length===0;s.onUpdate(e,n)}return e},S=e=>{const{editor:s,onUpdate:r}=e,a=[];let o=[];const d=[];if(s.state.doc.descendants((n,c)=>{var i;
1!((i=e.anchorTypes)===null||i===void 0)&&i.includes(n.type.name)&&a.push({node:n,pos:c})}),a.forEach((n,c)=>{if(n.node.textContent.length===0)return;const i=s.view.domAtPos(n.pos+1).node,l=e.storage.scrollPosition>=i.offsetTop;d.push(i);const u=n.node.attrs.level,m=a[c-1],p=e.getLevelFn(n,o),h=e.getIndexFn(n,o,p);o=m?[...o,{itemIndex:h,id:n.node.attrs["data-toc-id"],originalLevel:u,level:p,textContent:n.node.textContent,pos:n.pos,editor:s,isActive:!1,isScrolledOver:!1,node:n.node,dom:i}]:[...o,{itemIndex:h,id:n.node.attrs["data-toc-id"],originalLevel:u,level:p,textContent:n.node.textContent,pos:n.pos,editor:s,isActive:!1,isScrolledOver:l,node:n.node,dom:i}]}),o=F(o,e),r){const n=e.storage.content.length===0;r(o,n)}e.storage.anchors=d,e.storage.content=o,s.state.tr.setMeta("toc",o),s.view.dispatch(s.state.tr)},k=Q.create({name:"tableOfContents",addStorage:()=>({content:[],anchors:[],scrollHandler:()=>null,scrollPosition:0}),addGlobalAttributes(){return[{types:this.options.anchorTypes||["headline"],attributes:{id:{default:null,renderHTML:e=>({id:e.id}),parseHTML:e=>e.id||null},"data-toc-id":{default:null,renderHTML:e=>({"data-toc-id":e["data-toc-id"]}),parseHTML:e=>e.dataset.tocId||null}}}]},addOptions:()=>({onUpdate:()=>{},getId:e=>T(),scrollParent:typeof window<"u"?()=>window:void 0,anchorTypes:["heading"]}),onUpdate(){var e;S({editor:this.editor,storage:this.storage,onUpdate:(e=this.options.onUpdate)===null||e===void 0?void 0:e.bind(this),getIndexFn:this.options.getIndex||V,getLevelFn:this.options.getLevel||A,anchorTypes:this.options.anchorTypes})},onCreate(){var e;const{tr:s}=this.editor.state,r=[];if(this.options.scrollParent&&typeof this.options.scrollParent!="function"&&console.warn("[Tiptap Table of Contents Deprecation Notice]: The 'scrollParent' option must now be provided as a callback function that returns the 'scrollParent' element. The ability to pass this option directly will be deprecated 
1in future releases."),this.editor.state.doc.descendants((o,d)=>{var n;const c=o.attrs["data-toc-id"];if(!((n=this.options.anchorTypes)===null||n===void 0)&&n.includes(o.type.name)&&o.textContent.length!==0){if(c==null||r.includes(c)){let i="";i=this.options.getId?this.options.getId(o.textContent):T(),s.setNodeMarkup(d,void 0,{...o.attrs,"data-toc-id":i,id:i})}r.push(c)}}),this.editor.view.dispatch(s),S({editor:this.editor,storage:this.storage,onUpdate:(e=this.options.onUpdate)===null||e===void 0?void 0:e.bind(this),getIndexFn:this.options.getIndex||V,getLevelFn:this.options.getLevel||A,anchorTypes:this.options.anchorTypes}),this.storage.scrollHandler=()=>{var o;if(!this.options.scrollParent)return;const d=typeof this.options.scrollParent=="function"?this.options.scrollParent():this.options.scrollParent,n=d instanceof HTMLElement?d.scrollTop:d.scrollY;this.storage.scrollPosition=n||0;const c=F(this.storage.content,{editor:this.editor,anchorTypes:this.options.anchorTypes,storage:this.storage,onUpdate:(o=this.options.onUpdate)===null||o===void 0?void 0:o.bind(this)});this.storage.content=c},!this.options.scrollParent)return;const a=typeof this.options.scrollParent=="function"?this.options.scrollParent():this.options.scrollParent;a&&a.addEventListener("scroll",this.storage.scrollHandler)},onDestroy(){if(!this.options.scrollParent)return;const e=typeof this.options.scrollParent=="function"?this.options.scrollParent():this.options.scrollParent;e&&e.removeEventListener("scroll",this.storage.scrollHandler)},addProseMirrorPlugins(){return[me({getId:this.options.getId,anchorTypes:this.options.anchorTypes})]}}),xe=({article:e,emojis:s,setTocData:r,doc:a,provider:o})=>{var m;const[d,n]=x.useState([]),[c,i]=x.useState(null),l=E({extensions:[...M(s),L,Z.configure({document:a}),k.configure({getIndex:D,onUpdate:p=>{var h;(h=e.publishedVersion)!=null&&h.version||r(p)}}),o?ee.configure({provider:o,onUpdate:p=>{n(p.versions),i(p.currentVersion)}}):void 0].filter(p=>p!==void 0),editable:!1}),u=E({extensions:[...M(s),L,k.configure({getIndex:D,onUpdate:p=>{r(p)}})],editable:!1});return x.useEffect(()=>{var p;if((p=e==null?void 0:e.publishedVersion)!=null&&p.json)try{const h=JSON.parse(e.publishedVersion.json);u==null||u.commands.setContent(h,!0)}catch(h){console.log("Error setting content",{error:h})}},[(m=e==null?void 0:e.publishedVersion)==null?void 0:m.json,u]),{latestEditor:l,publishedEditor:u,versions:d,currentVersion:c}},he=()=>{const[e,s]=x.useState(!1),r=ce({mutationKey:["publish-article-mutation"]});x.useEffect(()=>{r||s(!1)},[r]);const a=()=>{s(!0),window.dispatchEvent(new CustomEvent("PUBLISH_KB_ARTICLE"))},o=e||r;return t.jsxs("div",{className:"flex flex-col items-center mt-10",children:[t.jsx(g,{name:"ChartLine",size:24}),t.jsx("span",{className:"text-lg font-medium mt-2 mb-1",children:"Article hasn't been published yet."}),t.jsx("span",{className:"text-sm text-color-text-muted",children:"Performance metrics will appear here once your article is published."}),t.jsxs(q,{variant:"ghost",className:"h-7 p-0 px-3 shadow-sm border rounded-md gap-2 text-white text-sm bg-color-bg-success-strong mt-8",onClick:a,disabled:!!o,children:[t.jsx(g,{name:o?"LoaderCircle":"Send",className:_(o&&"animate-spin")}),"Publish article"]})]})},fe=()=>t.jsxs("div",{className:"flex flex-col items-center mt-10",children:[t.jsx(g,{name:"ChartLine",size:24}),t.jsx("span",{className:"text-lg font-medium mt-2 mb-1",children:"No performance data yet."}),t.jsx("span",{className:"text-sm text-color-text-muted",children:"Performance metrics will appear here once your article gets views or reactions."})]}),ve=({timeRange:e,pageViews:s})=>{const r=x.useMemo(()=>s.map(l=>({views:l.views,uniqueViews:l.uniqueViews,date:new Date(l.timestamp).getTime()})),[s]),a=x.useMemo(()=>(new Date().getTime(),r.sort((l,u)=>l.date-u.date)),[e]),o=a.map(l=>({x:l.date,y:l.views,uniqueViews:l.uniqueViews})),d={chart:{type:"spline",height:300,marginTop:30,borderRadius:8},title:{text:""},xAxis:{type:"datetime",title:{text:""},labels:{formatter:function(l){return w(new Date(l.value),"MMM d")}}},yAxis:{labels:{enabled:!1},title:{text:null},gridLineWidth:1},plotOptions:{spline:{marker:{enabled:!0}}},credits:{enabled:!1},exporting:{enabled:!1},series:[{data:o,showInLegend:!1}],tooltip:{enabled:!0,useHTML:!0,shadow:!0,formatter:function(){const{y:l,x:u,point:m={}}=this,{uniqueViews:p}=m.options??{};return`<div class="wsa-tooltip  text-left flex gap-[6px] flex-col p-0.5">
2              <div class="x-label">${w(u,"MMM, dd yyyy")}</div>
3              <div class="flex flex-col items-start gap-1">
4                  <div class="font-bold">Views: ${l}</div>
5                  <div class="font-bold">Unique views: ${p}</div>
6              </div>
7          </div>`}}},n=a.reduce((l,u)=>l+u.views,0),c=a.reduce((l,u)=>l+u.uniqueViews,0);let i="Last week";return e==="month"?i="Last month":e==="allTime"&&(i="All time"),t.jsxs("div",{className:"border rounded-lg",children:[t.jsxs("div",{className:"flex border-b px-5",children:[t.jsxs("div",{className:"flex flex-col py-2.5",children:[t.jsx("span",{className:"text-sm font-medium",children:"Article views"}),t.jsx("span",{className:"text-xs text-color-text-muted",children:i})]}),t.jsxs("div",{className:"flex flex-col ml-auto px-4 border-l py-2.5 mr-5",children:[t.jsx("span",{className:"text-[10px] font-medium text-color-text-muted",children:"Total"}),t.jsx("span",{className:"text-base font-semibold",children:n})]}),t.jsxs("div",{className:"flex flex-col px-4 border-l py-2.5",children:[t.jsx("span",{className:"text-[10px] font-medium text-color-text-muted",children:"Unique"}),t.jsx("span",{className:"text-base font-semibold",children:c})]})]}),t.jsx(le,{highcharts:B,options:d})]})},y={one:{emoji:"😀",label:"Positive",className:"text-color-success"},two:{emoji:"😐",label:"Neutral",className:"text-color-text-placeholder"},three:{emoji:"🙁",label:"Negative",className:"text-color-text-error"}},O=[{label:"Last week",value:"week"},{label:"Last month",value:"month"},{label:"All time",value:"all"}],ge=({article:e,articleStats:s,articleFeedbackStats:r})=>{const[a,o]=x.useState(O[0]),d=j.get(s,"ratingDistribution.ONE"),n=j.get(s,"ratingDistribution.TWO"),c=j.get(s,"ratingDistribution.THREE"),i=j.get(s,"pageViews",P),l=d+n+c,u=e.state==="draft",m=j.get(r,"recentFeedbacks",P),p=[u,l===0,m.length===0].every(Boolean),h=[!u,l===0,m.length===0].every(Boolean);return t.jsxs("div",{className:"flex flex-col gap-6 pl-12 mt-6",children:[t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-base font-medium",children:"Article performance"}),t.jsx(K,{options:O,value:a,onChange:f=>{Array.isArray(f)||o(f)},hideClearIndicator:!0,skipSorting:!0})]}),p&&t.jsx(he,{}),h&&t.jsx(fe,{}
7),!p&&!h&&t.jsxs(t.Fragment,{children:[t.jsx(ve,{timeRange:a.value,pageViews:i}),t.jsxs("div",{className:"flex justify-between",children:[t.jsx("span",{className:"text-sm font-medium",children:"Reactions"}),t.jsxs("span",{className:"text-sm font-medium",children:["Total: ",l]})]}),t.jsxs("div",{className:"flex gap-4",children:[t.jsx(N,{ratingType:"one",reactionCount:d,percentage:Math.round(d/l*100)}),t.jsx(N,{ratingType:"two",reactionCount:n,percentage:Math.round(n/l*100)}),t.jsx(N,{ratingType:"three",reactionCount:c,percentage:Math.round(c/l*100)})]}),t.jsxs("div",{className:"flex flex-col gap-5 pb-14",children:[t.jsx("span",{className:"text-sm font-medium",children:"Feedback"}),m.length===0?t.jsx("p",{className:"text-center border rounded-md px-3 py-4 text-color-text-muted text-sm",children:"Your article hasn't received any feedback yet."}):m.map((f,b)=>t.jsx(be,{feedback:f},b))]})]})]})};function N({ratingType:e,reactionCount:s,percentage:r}){return t.jsxs("article",{className:"p-4 border rounded-md grow",children:[t.jsxs("div",{className:"flex items-center",children:[t.jsx("span",{className:"text-sm font-medium",children:y[e].label}),t.jsx("span",{className:"text-xl ml-auto",children:y[e].emoji})]}),t.jsxs("div",{className:"flex flex-col mt-4",children:[t.jsxs("span",{className:_("text-2xl font-semibold",y[e].className),children:[r||0,"%"]}),s===0?t.jsx("span",{className:"text-xs text-color-text-muted",children:"No reactions"}):t.jsxs("span",{className:"text-xs text-color-text-muted",children:[s," ",$("reaction",s)]})]})]})}function be({feedback:e}){const s=z(()=>{if(e.userId)return W().users.get(e.userId)},[e==null?void 0:e.userId]),r=()=>e.score===1?"one":e.score===2?"two":e.score===3?"three":"one";return t.jsxs("div",{className:"border rounded-md py-4 px-3",children:[t.jsxs("div",{className:"flex gap-2 items-center",children:[s?t.jsx("img",{src:"https://picsum.photos/200",className:"w-6 h-6 rounded-full",alt:(s==null?void 0:s.slack_profile_display_name)??(s==null?void 0:s.slack_name)}):t.jsx("span",{className:"rounded-full bg-color-strong border",children:t.jsx(g,{name:"CircleUserRound",className:"size-6 text-color-icon-muted",strokeWidth:1.5})}),t.jsxs("div",{className:"flex flex-col",children:[t.jsx("span",{className:"text-xs font-medium",children:s?(s==null?void 0:s.slack_profile_display_name)??(s==null?void 0:s.slack_name):"Anonymous user"}),t.jsx("span",{className:"text-xs text-color-text-muted",children:w(new Date,"MMMM dd, yyyy")})]}),t.jsx("span",{className:"text-xl ml-auto",children:y[r()].emoji})]}),t.jsx("p",{className:"text-sm mt-2",children:e.feedback})]})}const et=()=>{var C;const[e,s]=x.useState([]),{emojis:r,article:a,provider:o,doc:d,aiToken:n,articleStats:c,articleFeedbackStats:i}=G(),l=a._id,{latestEditor:u,publishedEditor:m,versions:p,currentVersion:h}=xe({article:a,emojis:r,setTocData:s,doc:d,provider:o}),f=x.useMemo(()=>a.state==="published"?m:u,[a.state,m,u]),b=x.useMemo(()=>[{label:t.jsxs(t.Fragment,{children:[t.jsx(g,{name:"Text",className:"mr-1"}),"Content"]}),Component:t.jsx(t.Fragment,{children:t.jsx(ne,{className:"relative flex flex-col flex-1 pb-60",children:t.jsx(X,{editor:f,className:"overflow-y-auto *:outline-none"})})}),value:"content"},{label:t.jsxs(t.Fragment,{children:[t.jsx(g,{name:"ChartLine",className:"mr-1"}),"Performance"]}),Component:t.jsx(ge,{article:a,articleStats:c,articleFeedbackStats:i}),value:"performance"}],[f,a,c,i]);return!f||!a?null:t.jsxs("div",{className:"h-[calc(100%-45px)]",children:[t.jsx(te,{editor:u,provider:o,versions:p,currentVersion:h,aiToken:n,emojis:r,publishedVersion:((C=a.publishedVersion)==null?void 0:C.version)??null,articleId:l,readOnlyMode:!0}),t.jsxs("div",{className:"flex justify-between gap-4 h-[calc(100%-61px)] overflow-y-auto",children:[t.jsxs("div",{className:"grow-0 shrink-0 mx-auto min-w-[640px] w-[808px]",children:[t.jsx(se,{articleId:l,readOnly:!0}),t.jsxs(oe,{defaultValue:b[0].value,className:"mt-8",children:[t.jsx(re,{className:"border-b bg-background rounded-none mx-12 w-[calc(100%-48px)] justify-start pb-0",children:b.map(v=>t.jsx(ae,{value:v.value,className:"!shadow-none data-[state=active]:border-b-2 roun
7ded-none data-[state=active]:border-color-icon",children:v.label},v.value))}),b.map(v=>t.jsx(ie,{value:v.value,children:v.Component},v.value))]})]}),e.length>0&&t.jsx("div",{className:"flex flex-col p-4 pt-6 border-l h-full sticky top-0 w-96 overflow-y-auto",children:t.jsx(pe,{content:e})})]})]})};export{et as default};

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.