PageSourceSearch

https://www.fieldgulls.com/_next/static/chunks/3bsjlrbbe1sxg.js

js fieldgulls.com collected 2026-09-24 08:55:36 UTC 49,315 bytes, 95 lines download raw bytes

1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="1907618c-2c22-0992-0c86-e9d631bb6953")}catch(e){}}();
2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,497625,e=>{"use strict";var t=e.i(478902),s="_1yo5rlx2";let i=()=>(0,t.jsxs)("div",{className:"_1yo5rlx1","aria-hidden":"true",children:[(0,t.jsx)("span",{className:s}),(0,t.jsx)("span",{className:`${s} _1yo5rlx3`}),(0,t.jsx)("span",{className:`${s} _1yo5rlx4`})]});e.s(["CommentsLoading",0,()=>(0,t.jsx)("div",{className:"_1yo5rlx5",role:"status","aria-label":"Loading comments",children:(0,t.jsx)(i,{})})],497625)},221381,427920,e=>{"use strict";var t=e.i(478902),s=e.i(389959),i=e.i(563281),r=e.i(197649),n=e.i(662983);let o=e=>{let{className:i,fullWidth:o,children:a,disabled:l,afterWrapper:c=(0,t.jsx)(n.default,{}),...d}=e,{onFocus:u,onBlur:h,keyboardFocus:p}=(({onFocus:e,onBlur:t,mouseDownThresholdMs:i=750}={})=>{let[r,n]=s.default.useState(!1),o=s.default.useRef(0);return s.default.useEffect(()=>{let e=()=>{o.current=Date.now()};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]),{onFocus:s.default.useCallback(t=>{e?.(t),Date.now()-o.current>i&&n(!0)},[e,i]),onBlur:s.default.useCallback(e=>{t?.(e),n(!1)},[t]),keyboardFocus:r}})(),y=(0,r.default)("zrsklt0",i,{zrsklt6:o}),m=(0,r.default)("zrsklt5","zrsklt2","zrsklt4",p&&"zrsklt3"),f=(0,r.default)("zrsklt1",{zrsklt7:l});return(0,t.jsxs)("span",{className:y,children:[(0,t.jsx)("select",{className:(0,r.default)(m,"coral-selectField"),disabled:l,onFocus:u,onBlur:h,...d,children:a}),(0,t.jsx)("span",{className:f,"aria-hidden":!0,children:c})]})},a=e=>(0,t.jsx)("option",{...e});var l=e.i(210982),c=e.i(798240),d=e.i(396902),u=e.i(623690),h=e.i(465149),p=e.i(385799),y=e.i(593296),m=e.i(722010);e.s(["RepliesSortSelect",0,function(e){let{className:r}=e,{cycloneConfig:{serverURL:n}}=(0,d.useConfigContext)(),{repliesStore:f}=(0,y.useStore)(),{viewer:b}=(0,u.useCyclone)(),g=(0,l.useAnalytics)(),{context:{location:v}}=(0,h.useContentLocationContext)(),{cycloneCommunityId:R}=(0,c.useCurrentCycloneCommunity)();(0,s.useEffect)(()=>{if(b&&b.settings?.replySort)try{let e=b.settings.replySort;f.setSort(e)}catch(e){console.warn("unable to load/parse user replySort preferences",e)}},[f,b?.settings?.replySort]);let S=(0,s.useCallback)(e=>{let t=!f.topLevelSocketPermitted,s=e===m.ReplySort.NewestFirst||e===m.ReplySort.OldestFirst;f.setSort(e),t&&s&&f.insertAllWebsocketReplies(),v===h.ContentLocation.ArticleBody&&g?.emit({event:"coral_comment",coral_comment:{action:"set_sort_order"}}),b&&(0,p.updateUserSettings)(R,b.id,{replySort:e},n,b.token)},[g,R,v,f,n,b]);return v===h.ContentLocation.ArticleBody?(0,t.jsxs)(o,{className:r,value:f.currentSort,onChange:e=>S(e.target.value),children:[(0,t.jsx)(a,{value:m.ReplySort.NewestFirst,children:"Newest"}),(0,t.jsx)(a,{value:m.ReplySort.OldestFirst,children:"Oldest"}),(0,t.jsx)(a,{value:m.ReplySort.MostReplies,children:"Most replies"}),(0,t.jsx)(a,{value:m.ReplySort.MostRecs,children:"Most Rec'd"})]}):(0,t.jsx)(i.Select,{className:r,value:f.currentSort,onChange:e=>S(e.value),options:[{value:m.ReplySort.NewestFirst,display:"Newest first"},{value:m.ReplySort.OldestFirst,display:"Oldest first"},{value:m.ReplySort.MostRecs,display:"Most recs"},{value:m.ReplySort.MostReplies,display:"Most replies"}]})}],221381);var f=e.i(467272),b=e.i(497625);let g=(0,f.default)(()=>e.A(451891),{loadableGenerated:{modules:[19951]},ssr:!1,loading:()=>(0,t.jsx)(b.CommentsLoading,{})});e.s(["default",0,({virtuosoRef:e})=>(0,t.jsx)(g,{virtuosoRef:e})],427920)},563281,e=>{"use strict";var t=e.i(478902),s=e.i(262653),i=e.i(197649),r=e.i(389959);e.i(807738);var n=e.i(738886),o=e.i(662983),a=e.i(970060);e.s(["Select",0,e=>{let{options:l,onChange:c,className:d}=e,[u,h]=(0,r.useState)(e.value),p=(0,r.useRef)(null),y=(0,r.useRef)(null),[m,f]=(0,r.useState)(!1),b=(0,r.useCallback)(e=>{h(e.value),p.current?.click(),c&&c(e)},[c,h]);(0,r.useEffect)(()=>{h(e.value)},[e.value,c,l]),(0,r.useEffect)(()=>{let e=y.current;if(!e)return;let t=()=>{f(e.hasAttribute("data-popup-open"))},s=new MutationObserver(t);return s.observe(e,{attributes:!0,attributeFilter:["data-popup-open"]}),t(),()=>{s.disconnect()}},[y]);let g=(0,r.useMemo)(()=>{for(let e of l)if(e.value===u)return e.display;return""},[l,u]);return(0,t.jsx)("div",{className:(0,i.default)("_1385n2o0",d),children:(0,t.jsxs)(s.Popover.Root,{children:[(0,t.jsx)(s.Popover.Trigger,{onClick:e=>{e.stopPropagation()},ref:y,children:(0,t.jsxs)("div",{className:"_1385n2o1",children:[(0,t.jsx)("span",{className:"_1385n2o2",children:g}),(0,t.jsx)(o.default,{height:12,width:12,className:(0,i.default)("_1385n2o5",m&&"_1385n2o6")})]})}),(0,t.jsx)(s.Popover.Portal,{children:(0,t.jsx)(s.Popover.Positioner,{sideOffset:8,className:"_1385n2oa",children:(0,t.jsx)(s.Popover.Popup,{className:"_1385n2o9",children:(0,t.jsx)("div",{className:"_1385n2o4",children:l.map(e=>(0,t.jsx)(n.default,{className:(0,i.default)("_1385n2o3",u===e.value&&"_1385n2o7"),text:e.display,displayType:"cycloneSecondary",onClick:()=>b(e)},e.value))})})})}),(0,t.jsx)(s.Popover.Close,{children:(0,t.jsx)("div",{ref:p,className:a.sharedStyles.layout.hide})})]})})}],563281)},225803,e=>{"use strict";var t=e.i(389959);e.s(["useCycloneThreadLoad",0,function({rootStore:e,load:s,authPending:i,viewerToken:r}){let n=(0,t.useRef)(null),o=(0,t.useRef)(void 0);(0,t.useEffect)(()=>{i||n.current===e||(n.current=e,r&&(e.setToken(r),o.current=r),s())},[i,s,e,r]),(0,t.useEffect)(()=>{r&&o.current!==r&&(e.setToken(r),o.current=r)},[e,r])},"useRunWhenAuthSettles",0,function(e,s,i){let r=(0,t.useRef)(null);(0,t.useEffect)(()=>{e||r.current===i||(r.current=i,s())},[e,s,i])}])}
2,844441,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"LoadableContext",{enumerable:!0,get:function(){return i}});let i=e.r(2879)._(e.r(389959)).default.createContext(null)},612666,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"default",{enumerable:!0,get:function(){return h}});let i=e.r(2879)._(e.r(389959)),r=e.r(844441),n=[],o=[],a=!1;function l(e){let t=e(),s={loading:!0,loaded:null,error:null};return s.promise=t.then(e=>(s.loading=!1,s.loaded=e,e)).catch(e=>{throw s.loading=!1,s.error=e,e}),s}class c{constructor(e,t){this._loadFn=e,this._opts=t,this._callbacks=new Set,this._delay=null,this._timeout=null,this.retry()}promise(){return this._res.promise}retry(){this._clearTimeouts(),this._res=this._loadFn(this._opts.loader),this._state={pastDelay:!1,timedOut:!1};let{_res:e,_opts:t}=this;e.loading&&("number"==typeof t.delay&&(0===t.delay?this._state.pastDelay=!0:this._delay=setTimeout(()=>{this._update({pastDelay:!0})},t.delay)),"number"==typeof t.timeout&&(this._timeout=setTimeout(()=>{this._update({timedOut:!0})},t.timeout))),this._res.promise.then(()=>{this._update({}),this._clearTimeouts()}).catch(e=>{this._update({}),this._clearTimeouts()}),this._update({})}_update(e){this._state={...this._state,error:this._res.error,loaded:this._res.loaded,loading:this._res.loading,...e},this._callbacks.forEach(e=>e())}_clearTimeouts(){clearTimeout(this._delay),clearTimeout(this._timeout)}getCurrentValue(){return this._state}subscribe(e){return this._callbacks.add(e),()=>{this._callbacks.delete(e)}}}function d(t){return function(t,s){let l=Object.assign({loader:null,loading:null,delay:200,timeout:null,webpack:null,modules:null},s),d=null;function u(){if(!d){let e=new c(t,l);d={getCurrentValue:e.getCurrentValue.bind(e),subscribe:e.subscribe.bind(e),retry:e.retry.bind(e),promise:e.promise.bind(e)}}return d.promise()}if("u"<typeof window&&n.push(u),!a&&"u">typeof window){let t=l.webpack&&"function"==typeof e.t.resolveWeak?l.webpack():l.modules;t&&o.push(e=>{for(let s of t)if(e.includes(s))return u()})}function h(e,t){let s;u(),(s=i.default.useContext(r.LoadableContext))&&Array.isArray(l.modules)&&l.modules.forEach(e=>{s(e)});let n=i.default.useSyncExternalStore(d.subscribe,d.getCurrentValue,d.getCurrentValue);return i.default.useImperativeHandle(t,()=>({retry:d.retry}),[]),i.default.useMemo(()=>{var t;return n.loading||n.error?i.default.createElement(l.loading,{isLoading:n.loading,pastDelay:n.pastDelay,timedOut:n.timedOut,error:n.error,retry:d.retry}):n.loaded?i.default.createElement((t=n.loaded)&&t.default?t.default:t,e):null},[e,n])}return h.preload=()=>u(),h.displayName="LoadableComponent",i.default.forwardRef(h)}(l,t)}function u(e,t){let s=[];for(;e.length;){let i=e.pop();s.push(i(t))}return Promise.all(s).then(()=>{if(e.length)return u(e,t)})}d.preloadAll=()=>new Promise((e,t)=>{u(n).then(e,t)}),d.preloadReady=(e=[])=>new Promise(t=>{let s=()=>(a=!0,t());u(o,e).then(s,s)}),"u">typeof window&&(window.__NEXT_PRELOADREADY=d.preloadReady);let h=d},759062,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0});var i={default:function(){return u},noSSR:function(){return d}};for(var r in i)Object.defineProperty(s,r,{enumerable:!0,get:i[r]});let n=e.r(2879),o=e.r(478902);e.r(389959);let a=n._(e.r(612666)),l="u"<typeof window;function c(e){return{default:e?.default||e}}function d(e,t){if(delete t.webpack,delete t.modules,!l)return e(t);let s=t.loading;return()=>(0,o.jsx)(s,{error:null,isLoading:!0,pastDelay:!1,timedOut:!1})}function u(e,t){let s=a.default,i={loading:({error:e,isLoading:t,pastDelay:s})=>null};e instanceof Promise?i.loader=()=>e:"function"==typeof e?i.loader=e:"object"==typeof e&&(i={...i,...e});let r=(i={...i,...t}).loader;return(i.loadableGenerated&&(i={...i,...i.loadableGenerated},delete i.loadableGenerated),"boolean"!=typeof i.ssr||i.ssr)?s({...i,loader:()=>null!=r?r().then(c):Promise.resolve(c(()=>null))}):(delete i.webpack,delete i.modules,d(s,i))}("function"==typeof s.default||"object"==typeof s.default&&null!==s.default)&&void 0===s.default.__esModule&&(Object.defineProperty(s.default,"__esMo
2dule",{value:!0}),Object.assign(s.default,s),t.exports=s.default)},467272,(e,t,s)=>{t.exports=e.r(759062)},228837,e=>{"use strict";var t=e.i(389959),s=e.i(623690);e.i(807738);var i=e.i(738886);e.i(379067);var r=e.i(533329),n=e.i(970060),o="ka6at88",a="ka6at89",l="ka6at8a",c="ka6at8b",d=e.i(478902);e.s(["default",0,()=>{let{viewer:e,acknowledgeUserMessage:u}=(0,s.useCyclone)(),[h,p]=(0,t.useState)([]),y=e?.activeWarning,m=e?.activeMessages??[],f=(0,t.useCallback)(async e=>{p(t=>[...t,e]);try{await u(e)}finally{p(t=>t.filter(t=>t!==e))}},[u]);return y||m.length?(0,d.jsx)("section",{className:"ka6at82","aria-label":"Moderation messages",children:(0,d.jsx)("div",{className:n.sharedStyles.layout.mainColumn,children:(0,d.jsxs)("div",{className:"ka6at83",children:[y&&(0,d.jsxs)("article",{className:"ka6at84 ka6at80",role:"alert",children:[(0,d.jsx)("span",{className:"ka6at86 ka6at81",children:"Warning"}),(0,d.jsx)("p",{className:o,children:y.message}),(0,d.jsxs)("div",{className:a,children:[(0,d.jsx)(r.default,{timestamp:y.createdAt,format:"notifications",className:l}),(0,d.jsx)(i.default,{className:c,text:h.includes(y.id)?"Dismissing...":"Dismiss",displayType:"secondary",disabled:h.includes(y.id),onClick:()=>void f(y.id)})]})]}),m.map(e=>{let t=h.includes(e.id);return(0,d.jsxs)("article",{className:"ka6at85 ka6at80 _1upudxk11",children:[(0,d.jsx)("span",{className:"ka6at87 ka6at81",children:"Message"}),(0,d.jsx)("p",{className:o,children:e.message}),(0,d.jsxs)("div",{className:a,children:[(0,d.jsx)(r.default,{timestamp:e.createdAt,format:"notifications",className:l}),(0,d.jsx)(i.default,{className:c,text:t?"Dismissing...":"Dismiss",displayType:"secondary",disabled:t,onClick:()=>void f(e.id)})]})]},e.id)})]})})}):null}],228837)},624334,925677,e=>{"use strict";var t=e.i(509727),s=e.i(645904);let i=async(e,i,r,n)=>{if(!n)return null;let o=new URL("/api",r),a=await (0,s.makeRequest)(o.toString(),t.CloseRepliesMutation,{communityID:e,contentID:i},n);return a.errors||!a.data?null:a.data.closeReplies??null};e.s(["closeReplies",0,i],624334);let r=async(e,i,r,n)=>{if(!n)return null;let o=new URL("/api",r),a=await (0,s.makeRequest)(o.toString(),t.OpenRepliesMutation,{communityID:e,contentID:i},n);return a.errors||!a.data?null:a.data.openReplies??null};e.s(["openReplies",0,r],925677)},860047,e=>{"use strict";var t,s=e.i(579490),i=e.i(645904);let r=`
3  query FanPostsQuery($communityID: String!, $cursor: DateTime!, $count: Int!, $mode: FanPostsMode) {
4    fanPosts(communityID: $communityID, cursor: $cursor, count: $count, mode: $mode) {
5      items {
6        id
7        ... on FanPost {
8          ${s.FanPostFragment}
9        }
10      }
11      hasNext
12      endCursor
13    }
14  }
15`,n=((t={}).NEWEST="NEWEST",t.MOST_RECS="MOST_RECS",t.MOST_REPLIES="MOST_REPLIES",t),o=async(e,t,s,n,o,a)=>{let l=`${t}`,c=new URL("/api",e).toString(),d=await (0,i.makeRequest)(c,r,{communityID:l,cursor:s,count:n,mode:a},o);return d.data?.fanPosts?{fanPosts:d.data.fanPosts}:{fanPosts:{items:[],hasNext:!1}}};e.s(["FanPostsMode",0,n,"fetchFanPosts",0,o])},736636,e=>{"use strict";var t=e.i(591370),s=e.i(509727),i=e.i(645904);let r=async(e,r,n,o,a={})=>{let l;if(n&&e.community&&"isRecced"in e&&!e.isRecced){a.optimisticResponse&&o?.insert({...e,isRecced:!0,recs:(e.recs||0)+1});try{let t=new URL("/api",r);l=await (0,i.makeRequest)(t.toString(),s.recContentMutation,{communityID:e.community.id,objectID:e.id},n)}catch(s){(0,t.captureException)(s,{extra:{message:"Error making recContent request"}}),a.optimisticResponse&&o?.insert({...e,isRecced:!1,recs:e.recs-1});return}if(l.errors||!l.data){a.optimisticResponse&&o?.insert({...e,isRecced:!1,recs:e.recs-1});return}o?.insert(l.data.recContent)}},n=async(e,r,n,o,a={})=>{let l;if(n&&e.community&&"isRecced"in e&&e.isRecced&&void 0!==e.recs){a.optimisticResponse&&o?.insert({...e,isRecced:!1,recs:Math.max(0,e.recs-1)});try{let t=new URL("/api",r);l=await (0,i.makeRequest)(t.toString(),s.unrecContentMutation,{communityID:e.community.id,objectID:e.id},n)}catch(s){(0,t.captureException)(s,{extra:{message:"Error making unrecContent request"}}),a.optimisticResponse&&o?.insert({...e,isRecced:!0,recs:e.recs+1});return}if(l.errors||!l.data){a.optimisticResponse&&o?.insert({...e,isRecced:!0,recs:e.recs+1});return}o?.insert(l.data.unrecContent)}};e.s(["recContent",0,r,"unrecContent",0,n])},385799,e=>{"use strict";var t=e.i(509727),s=e.i(645904);let i=async(e,i,r,n,o)=>{let a=`${e}`;if(!o)return;let l=new URL("/api",n),c=await (0,s.makeRequest)(l.toString(),t.updateUserSettingsMutation,{communityID:a,userID:i,settings:r},o);if(!c.errors&&c.data)return c.data.updateUserSettings};e.s(["updateUserSettings",0,i])},323157,e=>{"use strict";var t=e.i(310282),s=e.i(579490),i=e.i(645904);
15class r{constructor(e,s,i,r,n){this.repliesStore=r,this.serverURL=e,this.communityID=s,this.token=n,this.contentStore=i,this.externalRootID="",this.friendlyID="",this.parentIDs=t.observable.map(new Map),this.hasLoaded=!1,this.hasErrors=!1,(0,t.makeObservable)(this,{hasErrors:t.observable,hasLoaded:t.observable,parentIDs:t.observable,externalRootID:t.observable,friendlyID:t.observable,setExternalRoot:t.action,externalRoot:t.computed,setToken:t.action,getPost:t.action})}setToken(e){this.token=e,this.repliesStore.setToken(e)}getPost(e){return this.contentStore.lookupById.get(e)??null}async loadExternalRoot(e,t,r){let n,o=`
16      query GetExternalRootQuery($communityID: String!, $friendlyID: String!, $url: String!, $title: String) {
17        comments(friendlyID: $friendlyID, communityID: $communityID, url: $url, title: $title) {
18          ${s.ExternalRootFragment}
19        }
20      }`;try{n=await (0,i.makeRequest)(`${this.serverURL}/api`,o,{communityID:e,friendlyID:t,url:r},this.token)}catch{return this.hasErrors=!0,null}return n.data?.comments?(this.setExternalRoot(n.data.comments),this.hasLoaded=!0,this.externalRoot):(this.hasErrors=!0,null)}setExternalRoot(e){this.externalRootID=e.id,this.friendlyID=e.friendlyID||"",this.repliesStore.setRoot(e),this.repliesStore.insert(e)}get externalRoot(){return this.contentStore.lookupById.get(this.externalRootID)}}var n=e.i(722010);let o=e=>{let s={justPostedByViewer:!1,...e,title:e.title?e.title:"",sortDate:new Date(e.createdAt),collapsed:!1,visible:e.visible??!0,recs:"recs"in e?e.recs??0:0,replyCount:e.replyCount??0,showHidden:e.showHidden??!1};return t.observable.object(s)},a=(e,s)=>{(0,t.runInAction)(()=>{let{id:t,parentID:i,title:r,body:o,createdAt:a,recs:l,replyCount:c,directReplyCount:d,collapsed:u,visible:h,deletedAt:p,isRecced:y,isReported:m,isEdited:f,modStatus:b,author:g,repliesAreClosed:v,premod:R,attachments:S,poll:k,seen:I,showHidden:D}=s;e.id=t??e.id,e.body=o??e.body,e.parentID=i??e.parentID,e.createdAt=a??e.createdAt,e.recs=l??e.recs,e.replyCount=c??e.replyCount,e.directReplyCount=d??e.directReplyCount,e.deletedAt=p??e.deletedAt,e.isRecced=y??e.isRecced,e.isReported=m??e.isReported,e.isEdited=f??e.isEdited,e.modStatus=b??e.modStatus,e.author=g??e.author,e.repliesAreClosed=v??e.repliesAreClosed,void 0!==R&&(e.premod=!0===R),e.attachments=void 0!==S?S:e.attachments,e.poll=void 0!==k?k:e.poll,e.collapsed=u??e.collapsed,e.visible=h??e.visible,e.showHidden=D??e.showHidden,e.type===n.ContentObjectType.FanPost&&(e.title=r??e.title),e.type===n.ContentObjectType.QuickPost&&(e.seen=I??!!e.seen),e.sortDate=a?new Date(a):e.sortDate})},l=(e,s)=>{(0,t.runInAction)(()=>{Object.assign(e,s),e.sortDate=new Date(s.createdAt)})};var c=n;let d=(e,t)=>t.sortDate.getTime()-e.sortDate.getTime(),u=(e,t)=>e.sortDate.getTime()-t.sortDate.getTime(),h=(e,t)=>t.recs-e.recs,p=(e,t)=>t.replyCount-e.replyCount,y=(e=c.ReplySort.NewestFirst)=>e===c.ReplySort.OldestFirst?u:e===c.ReplySort.MostRecs?h:e===c.ReplySort.MostReplies?p:d,m=[c.ReplySort.NewestFirst,c.ReplySort.OldestFirst],f=[c.ReplySort.NewestFirst,c.ReplySort.OldestFirst];class b{appliedReplyUpdatedAtMsByID=new Map;pendingReloadUpdates=[];constructor(e,s,i,r,n=c.ReplySort.NewestFirst){this.serverURL=e,this.communityID=s,this.token=r,this.contentStore=i,this.root=null,this.focusedReply=null,this.expandedAncestors=!0,this.traversalFocusContentID=null,this.replyFeeds=t.observable.map(new Map),this.parentIDs=t.observable.map(new Map),this.websocketReplyFeeds=t.observable.map(new Map),this.items=t.observable.array([]),this.currentSort=n,this.userHasInteractedWithPage=!1,this.containerWidth=null,this.hasLoaded=!1,this.loadedWithToken=null,this.hasErrors=!1,this.isReloading=!1,this.lastLoadedReplyCreatedAtMs=null,this.lastSyncOk=null,this.pendingReloadUpdates=[],(0,t.makeObservable)(this,{hasErrors:t.observable,hasLoaded:t.observable,loadedWithToken:t.observable,isReloading:t.observable,items:t.observable,currentSort:t.observable,replyFeeds:t.observable,websocketReplyFeeds:t.observable,parentIDs:t.observable,expandedAncestors:t.observable,ingestLiveReply:t.action,getToken:t.action,insertWebsocketReplies:t.action,insertAllWebsocketReplies:t.action,addToWebsocketReplies:t.action,setContainerWidth:t.action,root:t.observable,reload:t.action,loadReplies:t.action,setRoot:t.action,setSort:t.action,getAndSortChildren:t.action,insert:t.action,applyReplyUpdates:t.action,togglePost:t.action,recursivelyIncrementCounts:t.action,delete:t.action,topLevelReplies:t.computed,bufferedReplyCount:t.computed,bufferedTopLevelReplyCount:t.computed,bufferedTopLevelReplies:t.computed,setToken:t.action,focusedReply:t.observable,setFocusedReply:t.action,focusedTopLevelReply:t.computed,focusedAncestors:t.computed,userHasInteractedWithPage:t.observable,setUserHasInteractedWithPage:t.action,getPost:t.action,containerWidth:t.observable,getWebsocketRepliesSorted:t.action,traversalFocusContentID:t.observable,showHidden:t.action,lastLoadedReplyCreatedAtMs:t.observable,lastSyncOk:t.observable,setLastSyncOk:t.action})}setRoot(e){this.root=e}setLastSyncOk(e){this.lastSyncOk=e}setToken(e){this.token=e}getToken(){return this.token}isInVisibleThread(e,t){if(!t)return!1;let s=this.replyFeeds.get(t);return s?.some(t=>t.id===e)??!1}isInWebsocketFeed(e,t){if(!t)return!1;let s=this.websocketReplyFeeds.get(t);return s?.some(t=>t.id===e)??!1}ingestLiveReply(e,t,s={}){let i=e.updatedAt,r="string"==typeof i?i:"createdAt"in e&&"string"==typeof e.createdAt?e.createdAt:null;null!==r&&s.markEventSeen?.(r),this.isReloading&&this.pendingReloadUpdates.push({type:"reply",obj:e,viewerID:t}),this.applyLiveReply(e,t)}applyLiveReply(e,t){let s=e.parentID;if(s&&this.isInVisibleThread(e.id,s)||s&&this.isInWebsocketFeed(e.id,s)){let t=this.contentStore.lookupById.get(e.id);t&&a(t,e);return}let i="author"in e&&e.author?.id?e.author.id:"authorID"in e&&"string"==typeof e.authorID?e.authorID:void 0;t&&i&&i===t?this.insert(e):this.addToWebsocketReplies(e)}setContainerWidth(e){this.containerWidth=e}setFocusedReply(e){if(!e){this.focusedReply=null;return}let t=this.insert(e);this.focusedReply=t}setUserHasInteractedWithPage(e){this.userHasInteractedWithPage=e}getPost(e){return this.contentStore.lookupById.get(e)??null}get topLevelReplies(){if(!this.root)return[];let e=this.replyFeeds.get(this.root.id);return e?.slice().sort(y(this.currentSort))}get focusedAncestors(){let e=[];
20if(!this.focusedReply)return e;let t=this.focusedReply;for(;t.parentID;){let s=this.contentStore.lookupById.get(t.parentID);if(!s)break;e.splice(0,0,s),t=s}return e}get focusedTopLevelReply(){if(!this.focusedReply)return[];let e=this.parentIDs.get(this.focusedReply.id);if(e===this.focusedReply.rootAncestorID)return[this.focusedReply];if(!e)return[];let t=e;for(;t!==this.focusedReply.rootAncestorID;){let e=this.parentIDs.get(t);if(!e||e===this.focusedReply.rootAncestorID)break;t=e}let s=this.contentStore.lookupById.get(t);return s?[s]:[]}setSort(e,s=!1){if(this.currentSort!==e||s){this.currentSort=e;let s=this.computeSort(e);this.items=t.observable.array(s)}this.currentSort=e}get topLevelSocketPermitted(){return m.includes(this.currentSort)}get nestedSocketPermitted(){return f.includes(this.currentSort)}get bufferedTopLevelReplyCount(){return this.bufferedTopLevelReplies.length}get bufferedReplyCount(){return new Set(Array.from(this.websocketReplyFeeds.values()).flatMap(e=>e.map(e=>e.id))).size}get bufferedTopLevelReplies(){if(!this.root?.id)return[];let e=this.websocketReplyFeeds.get(this.root.id);return e?e.filter(e=>!this.isInVisibleThread(e.id,this.root?.id)):[]}removeFromWebsocketReplies(e,s){let i=this.websocketReplyFeeds.get(s);if(!i||!i.some(t=>t.id===e))return;let r=t.observable.array(i.filter(t=>t.id!==e));this.websocketReplyFeeds.set(s,r)}computeSort(e){if(!this.root)return[];switch(e){case c.ReplySort.NewestFirst:return this.getAndSortChildren(this.root.id,d,u);case c.ReplySort.OldestFirst:return this.getAndSortChildren(this.root.id,u,u);case c.ReplySort.MostRecs:return this.getAndSortChildren(this.root.id,h,u);case c.ReplySort.MostReplies:return this.getAndSortChildren(this.root.id,p,u);default:return this.getAndSortChildren(this.root.id,d,u)}}async reload(){if(!this.hasLoaded||this.isReloading)return"skipped";let e=Date.now();this.pendingReloadUpdates=[],this.isReloading=!0,this.hasErrors=!1,this.lastSyncOk=null;try{return await this.loadReplies()?"reloaded":"failed"}finally{let t=1e3-(Date.now()-e);t>0&&await new Promise(e=>setTimeout(e,t)),this.isReloading=!1,this.pendingReloadUpdates=[]}}async loadReplies(){let e,r=this.root;if(!r)return!1;let n=`query RepliesQuery($communityID: String!, $parentID: String!) {
21        allReplies(communityID: $communityID, id: $parentID) {
22          ${s.QuickPostFragment}
23        }
24      }
25    `,o={communityID:this.communityID,parentID:r.id},l=this.token??null;try{if(e=await (0,i.makeRequest)(`${this.serverURL}/api`,n,o,l),!e.data?.allReplies)return this.hasErrors=!0,!1}catch{return this.hasErrors=!0,!1}let c=e.data.allReplies,d=this.focusedReply?.id;return(0,t.runInAction)(()=>{for(let e of new Set([...this.parentIDs.keys(),...Array.from(this.replyFeeds.values()).flatMap(e=>e.map(e=>e.id)),...Array.from(this.websocketReplyFeeds.values()).flatMap(e=>e.map(e=>e.id))]))this.contentStore.lookupById.delete(e);for(let e of(this.replyFeeds.clear(),this.websocketReplyFeeds.clear(),this.parentIDs.clear(),this.items.clear(),this.appliedReplyUpdatedAtMsByID.clear(),c)){if(!e.parentID)continue;this.replyFeeds.has(e.parentID)||this.replyFeeds.set(e.parentID,t.observable.array([]));let s=this.contentStore.insert(e);if(e.parentID){this.parentIDs.set(e.id,e.parentID);let t=this.replyFeeds.get(e.parentID);!t?.find(t=>t.id===e.id)&&s&&t?.push(s)}}let e=c.find(e=>e.id===r.id);if(e){let t="number"==typeof e.replyCount?e.replyCount:void 0,s="number"==typeof e.directReplyCount?e.directReplyCount:void 0,i=this.contentStore.lookupById.get(r.id);i&&a(i,{replyCount:t,directReplyCount:s}),void 0!==t&&(r.replyCount=t),void 0!==s&&(r.directReplyCount=s)}for(let e of(this.focusedReply=d?this.contentStore.lookupById.get(d)??null:null,this.traversalFocusContentID&&!this.contentStore.lookupById.has(this.traversalFocusContentID)&&(this.traversalFocusContentID=null),this.setSort(this.currentSort,!0),this.pendingReloadUpdates.splice(0)))"reply"===e.type?this.applyLiveReply(e.obj,e.viewerID):this.applyDelete(e.id,e.deletedAt);let s=c.map(e=>"createdAt"in e&&"string"==typeof e.createdAt?Date.parse(e.createdAt):NaN).filter(e=>!Number.isNaN(e));this.lastLoadedReplyCreatedAtMs=s.length>0?Math.max(...s):null,this.loadedWithToken=l,this.hasLoaded=!0}),!0}togglePost(e){let t=this.contentStore.lookupById.get(e);if(!t)return;let s=t.collapsed;a(t,{collapsed:!s})}
25showHidden(e){let t=this.contentStore.lookupById.get(e);t&&!t.showHidden&&a(t,{showHidden:!0})}getAndSortChildren(e,t,s,i=0){let r=this.replyFeeds.get(e);if(!r)return[];let n=r.slice().sort((e,r)=>0===i?t(e,r):s(e,r)),o=[];for(let[e,r]of n.entries())for(let a of(o.push({id:r.id,depth:i,obj:r,isLastOfItsDepth:0===i||e===n.length-1,ancestorIDs:[]}),this.getAndSortChildren(r.id,t,s,i+1)))o.push(a);return o}recursivelyIncrementCounts(e,t){if(!e.parentID)return;let s=this.contentStore.lookupById.get(e.parentID);if(!s)return;let i={replyCount:s.replyCount+1};t&&(i={...i,...{directReplyCount:(s.directReplyCount??0)+1}}),a(s,i),s.parentID&&this.recursivelyIncrementCounts(s,!1)}recursivelyDecrementCounts(e,t){if(!e.parentID)return;let s=this.contentStore.lookupById.get(e.parentID);if(!s)return;let i={replyCount:Math.max(s.replyCount-1,0)};t&&(i.directReplyCount=Math.max((s.directReplyCount??0)-1,0)),a(s,i),s.parentID&&this.recursivelyDecrementCounts(s,!1)}applyReplyUpdates(e,t){let s=this.root?.id,i=[],r=new Map(this.appliedReplyUpdatedAtMsByID),n=[];for(let t of e){let e=Date.parse(t.updatedAt);if(!t.id||Number.isNaN(e))throw Error("Invalid Cyclone reply update");let i=r.get(t.id);if(void 0!==i&&i>=e)continue;if(t.id===s)throw Error("Cyclone reply update cannot target the thread root");let o=this.contentStore.lookupById.get(t.id);if(o&&o.type!==c.ContentObjectType.QuickPost)throw Error("Cyclone reply update cannot replace root content");if(t.reply&&(t.reply.id!==t.id||t.reply.type!==c.ContentObjectType.QuickPost||!t.reply.parentID))throw Error("Invalid Cyclone reply snapshot");if(o&&t.reply&&o.parentID!==t.reply.parentID)throw Error("Cyclone reply updates cannot change parents");r.set(t.id,e),n.push(t)}for(let e of n){if(!e.reply){this.removeReplyUpdate(e.id),i.push(e.id);continue}let s=e.reply,r=this.contentStore.lookupById.get(s.id);if(r){l(r,s);continue}let n=s.author?.id??("authorID"in s&&"string"==typeof s.authorID?s.authorID:void 0);t&&n===t?this.insert(s,{deferSort:!0}):this.addToWebsocketReplies(s)}for(let e of i)this.contentStore.lookupById.has(e)||this.removeReplyDescendants(e);return this.setSort(this.currentSort,!0),this.appliedReplyUpdatedAtMsByID=r,n.length}insert(e,s={}){let i=o({...e,justPostedByViewer:!!s.justPostedByViewer,rootAncestorID:"rootAncestorID"in e?e.rootAncestorID:this.root?.id,rootAncestor:"rootAncestor"in e?e.rootAncestor:this.root});i.parentID&&!this.replyFeeds.has(i.parentID)&&this.replyFeeds.set(i.parentID,t.observable.array([]));let r=this.contentStore.lookupById.get(i.id);r?a(r,e):this.contentStore.lookupById.set(i.id,i);let n=r??i;if(this.root?.id===n.id&&(this.root=n),i.parentID){let e=this.replyFeeds.get(i.parentID),t=e?.some(e=>e.id===i.id),s=r??i;t||(e?.push(s),this.parentIDs.set(i.id,i.parentID),this.recursivelyIncrementCounts(s,!0)),this.removeFromWebsocketReplies(i.id,i.parentID)}return s.deferSort||this.setSort(this.currentSort,!0),r??i}removeReplyFromFeed(e,t,s){let i=e.get(t),r=i?.findIndex(e=>e.id===s)??-1;i&&r>=0&&i.splice(r,1)}removeReplyDescendants(e,t=new Set){if(!t.has(e)){for(let s of(t.add(e),new Set([...this.replyFeeds.get(e)?.map(e=>e.id)??[],...this.websocketReplyFeeds.get(e)?.map(e=>e.id)??[]])))this.removeReplyDescendants(s,t),this.removeReplyUpdate(s);this.replyFeeds.delete(e),this.websocketReplyFeeds.delete(e)}}removeReplyUpdate(e){let t=this.contentStore.lookupById.get(e);if(!t||t.type!==c.ContentObjectType.QuickPost)return;let s=t.parentID,i=!!s&&this.isInVisibleThread(t.id,s);s&&(this.removeReplyFromFeed(this.replyFeeds,s,e),this.removeReplyFromFeed(this.websocketReplyFeeds,s,e)),i&&this.recursivelyDecrementCounts(t,!0),this.parentIDs.delete(e),this.contentStore.lookupById.delete(e),this.focusedReply?.id===e&&(this.focusedReply=null)}insertWebsocketReplies(e){if(!e)return;let t=e.slice();for(let s of(e.clear(),t)){let e=this.insert(s),t=this.websocketReplyFeeds.get(e.id);this.insertWebsocketReplies(t)}}insertAllWebsocketReplies(){let e=new Map(Array.from(this.websocketReplyFeeds.values()).flatMap(e=>e.slice()).map(e=>[e.id,e])),t=0,s=!0;for(;e.size>0&&s;)for(let[i,r]of(s=!1,e)){let n=r.parentID?this.contentStore.lookupById.get(r.parentID):null;(r.parentID===this.root?.id||n&&n.parentID&&this.isInVisibleThread(n.id,n.parentID))&&(this.insert(r,{deferSort:!0}),e.delete(i),t+=1,s=!0)}t>0&&this.setSort(this.currentSort,!0)}addToWebsocketReplies(e){let s=o(e);s.parentID&&!this.websocketReplyFeeds.has(s.parentID)&&this.websocketReplyFeeds.set(s.parentID,t.observable.array([]));let i=this.contentStore.lookupById.get(s.id);if(i)return void a(i,e);if(!(s.parentID&&this.isInWebsocketFeed(s.id,s.parentID))&&(this.contentStore.lookupById.set(s.id,s),s.parentID)){let e=this.websocketReplyFeeds.get(s.parentID);e?.push(s)}}getWebsocketRepliesSorted(e){let t=this.websocketReplyFeeds.get(e);return t?t.slice().sort(y(this.currentSort)):[]}delete({id:e,deletedAt:t}){this.isReloading&&this.pendingReloadUpdates.push({type:"delete",id:e,deletedAt:t}),this.applyDelete(e,t)}applyDelete(e,t){let s=this.contentStore.lookupById.get(e);s&&a(s,{deletedAt:t})}}var g=e.i(781333);class v{constructor(e,s,i){this.serverURL=e,this.networkID=s,this.token=i,this.ongoingDiscussions=t.observable.object({hasErrors:!1,hasLoaded:!1,items:[]}),(0,t.makeObservable)(this,{networkID:t.observable,ongoingDiscussions:t.observable,loadOngoingDiscussions:t.action,setToken:t.action})}setToken(e){this.token=e}async loadOngoingDiscussions(){let e,r=`query OngoingDiscussionsQuery($communityIDs: [String!]!) {
26        viewer {
27          ongoingDiscussions(communityIDs: $communityIDs) {
28            ... on QuickPost {
29              ${s.QuickPostFragment}
30              id
31              createdAt
32              community {
33                id
34                name
35              }
36              rootAncestor {
37                ... on ExternalRoot {
38                  title
39                  urls
40                  replyCount
41                  community {
42                    id
43                  }
44                }
45              }
46            }
47          }
48        }
49      }
50    `,n={communityIDs:(0,g.getNetworkCycloneCommunityIds)(this.networkID)};try{if(e=await (0,i.makeRequest)(`${this.serverURL}/api`,r,n,this.token),!e.data?.viewer?.ongoingDiscussions){this.ongoingDiscussions.hasErrors=!0;return}}catch{this.ongoingDiscussions.hasErrors=!0;return}this.ongoingDiscussions.hasLoaded=!0,this.ongoingDiscussions.items=t.observable.array(e.data.viewer.ongoingDiscussions)}}let R=`
51  query CommunityQuery($id: String!) {
52    community(id: $id) {
53      settings {
54        userIsTooNewThresholdMs
55      }
56      pinnedContentObject {
57        ... on FanPost {
58            ${s.FanPostFragment}
59        }
60      }
61    }
62  }
63`;class S{constructor(e,s,i){this.contentStore=i,this.communityID=e,this.serverURL=s,this.pinnedContentID=null,this.community=null,this.loadCommunity(),(0,t.makeObservable)(this,{loadCommunity:t.action,pinnedContentID:t.observable,setPinnedContentID:t.action,pinnedContent:t.computed,community:t.observable})}setPinnedContentID(e){this.pinnedContentID=e}get pinnedContent(){return this.pinnedContentID?this.contentStore.get(this.pinnedContentID):null}async loadCommunity(){let e=new URL("/api",this.serverURL),t=await (0,i.makeRequest)(e.toString(),R,{id:this.communityID});if(!t.data||!t.data.community||t.errors)return;let s=t.data.community??null;this.community=s,s.pinnedContentObject&&(this.pinnedContentID=s.pinnedContentObject.id,this.contentStore.insert(s.pinnedContentObject))}}class k{constructor(){this.lookupById=t.observable.map(new Map),this.unfurlMediaEmbeds=t.observable.array([]),(0,t.makeObservable)(this,{lookupById:t.observable,unfurlMediaEmbeds:t.observable,updateUnfurlMediaEmbeds:t.action})}updateUnfurlMediaEmbeds(e){let t=this.unfurlMediaEmbeds.indexOf(e);-1===t?this.unfurlMediaEmbeds.push(e):this.unfurlMediaEmbeds.splice(t,1)}get(e){return this.lookupById.get(e)}insert(e){let t=o({...e}),s=this.lookupById.get(t.id);return s?a(s,e):this.lookupById.set(t.id,t),this.lookupById.get(e.id)}}var I=e.i(649784);let D=`
64  query GetFanPostByShortID($communityID: String!, $shortID: String!) {
65    fanPost: fanPostByShortID(shortID: $shortID, communityID: $communityID) {
66      ${s.FanPostFragment}
67    }
68  }
69`,C=async(e,t,s,r)=>{let n=`${t}`,o=new URL("/api",e).toString(),a=await (0,i.makeRequest)(o,D,{communityID:n,shortID:s},r);return{fanPost:a.data?.fanPost}};var w=e.i(860047);class A{constructor(e,s,i,r,n,o){this.items=t.observable.array([]),this.hasNext=null,this.endCursor=null,this.contentStore=e,this.serverURL=s,this.communityID=i,this.communityStore=r,this.token=n,this.ignoredUsers=o,this.filterMode=w.FanPostsMode.NEWEST,this.loadingMore=!1,(0,t.makeObservable)(this,{visibleItems:t.computed,visibleItemsWithNativeAds:t.computed,hasNext:t.observable,endCursor:t.observable,insert:t.action,items:t.observable,setItems:t.action,setEndCursor:t.action,setHasNext:t.action,delete:t.action,loadMore:t.action,reload:t.action,setToken:t.action,setIgnoredUsers:t.action,setFilterMode:t.action,filterMode:t.observable,loadingMore:t.observable,setLoadingMore:t.action,ignoredUsers:t.observable})}setToken(e){this.token=e}setIgnoredUsers(e){this.ignoredUsers=e}setFilterMode(e){this.filterMode=e}setLoadingMore(e){this.loadingMore=e}get visibleItems(){let e=this.ignoredUsers??[];return this.filterMode===w.FanPostsMode.NEWEST?this.items.filter(t=>"string"==typeof t||!t.deletedAt&&t.id!==this.communityStore.pinnedContent?.id&&!e.some(e=>e.id===t.author?.id)):this.items.filter(t=>"string"==typeof t||!t.deletedAt||!e.some(e=>e.id===t.author?.id))}get visibleItemsWithNativeAds(){let e=this.visibleItems,t=e=>3===e||e>3&&(e-3)%8==0,s=[];for(let i=0;i<e.length;i++)t(i)&&e[i]!==I.NATIVE_AD_PLACEHOLDER&&s.push(I.NATIVE_AD_PLACEHOLDER),s.push(e[i]);return s}setHasNext(e){this.hasNext=e}setEndCursor(e){this.endCursor=e}async reload(e,t=10,s=!1){e&&(this.token=e);let{fanPosts:i}=await (0,w.fetchFanPosts)(`${this.serverURL}
69/api`,this.communityID,new Date().toISOString(),t,this.token,this.filterMode);for(let e of i.items){let t=this.contentStore.lookupById.get(e.id);t&&a(t,e)}if(s&&(this.setHasNext(!!i.hasNext),this.setEndCursor(i.endCursor??null),this.setItems([...i.items])),this.communityStore.pinnedContent?.shortID&&this.filterMode===w.FanPostsMode.NEWEST){let{fanPost:e}=await C(this.serverURL,this.communityID,this.communityStore.pinnedContent.shortID,this.token);e&&this.insert(e)}}async loadMore(){if(!this.hasNext||!this.endCursor)return;this.setLoadingMore(!0);let{fanPosts:e}=await (0,w.fetchFanPosts)(`${this.serverURL}/api`,this.communityID,this.endCursor,10,this.token);this.setHasNext(!!e.hasNext),this.setEndCursor(e.endCursor??null),this.setItems([...this.items,...e.items]),this.setLoadingMore(!1)}insert(e){let t=o({...e}),s=this.contentStore.lookupById.get(t.id);return s?a(s,e):this.contentStore.lookupById.set(t.id,t),s??t}setItems(e){let t=[];for(let s of e){if(s===I.NATIVE_AD_PLACEHOLDER)continue;let e=this.insert(s);t.push(e)}this.items.replace(t)}delete({id:e,deletedAt:t}){let s=this.contentStore.lookupById.get(e);s&&(a(s,{deletedAt:t}),this.communityStore.pinnedContentID===e&&this.communityStore.setPinnedContentID(null))}}class T{constructor(e,s,i,r,n){this.serverURL=e,this.communityID=s,this.token=n,this.contentStore=i,this.repliesStore=r,this.fanPostID="",this.parentIDs=t.observable.map(new Map),(0,t.makeObservable)(this,{parentIDs:t.observable,fanPostID:t.observable,setFanPost:t.action,fanPost:t.computed,setToken:t.action,getPost:t.action})}setToken(e){this.token=e,this.repliesStore.setToken(e)}getPost(e){return this.contentStore.lookupById.get(e)??null}async loadFanPost(e,t){let r=`
70      query GetFanPostQuery($communityID: String!, $id: String!) {
71        fanPost(id: $id, communityID: $communityID) {
72          ${s.FanPostFragment}
73        }
74      }`,n=await (0,i.makeRequest)(`${this.serverURL}/api`,r,{communityID:e,id:t},this.token);return n.data?.fanPost?(this.setFanPost(n.data.fanPost),this.fanPost):null}setFanPost(e){this.fanPostID=e.id,this.repliesStore.setRoot(e),this.repliesStore.insert(e)}get fanPost(){return this.contentStore.lookupById.get(this.fanPostID)}}e.s(["RootStore",0,class{constructor(e,t,s,i,n){this.token=i,this.ignoredUsers=n,this.contentStore=new k,this.communityStore=new S(s,e,this.contentStore),this.repliesStore=new b(e,s,this.contentStore,i),this.externalRootStore=new r(e,s,this.contentStore,this.repliesStore,i),this.fanPostStore=new T(e,s,this.contentStore,this.repliesStore,i),this.fanPostIndexStore=new A(this.contentStore,e,s,this.communityStore,i,n),this.viewerStore=new v(e,t,i)}setToken(e){this.token=e,this.fanPostStore.setToken(e),this.fanPostIndexStore.setToken(e),this.repliesStore.setToken(e),this.externalRootStore.setToken(e),this.viewerStore.setToken(e)}setIgnoredUsers(e){this.ignoredUsers=e,this.fanPostIndexStore.setIgnoredUsers(e)}}],323157)},334441,e=>{"use strict";var t=e.i(389959),s=e.i(579490),i=e.i(645904);async function r(e,t,r,n,o){let a=`
75    query RepliesUpdatedSince(
76      $communityID: String!
77      $id: String!
78      $since: DateTime!
79    ) {
80      repliesUpdatedSince(
81        communityID: $communityID
82        id: $id
83        since: $since
84      ) {
85        id
86        updatedAt
87        reply {
88          ${s.QuickPostFragment}
89        }
90      }
91    }
92  `,l=await (0,i.makeRequest)(`${e}/api`,a,{communityID:t,id:r,since:new Date(n).toISOString()},o);if(!l.data?.repliesUpdatedSince||l.errors)throw Error("Unable to fetch updated Cyclone replies");return l.data.repliesUpdatedSince}let n=new WeakMap;async function o(e,t,s,i,n){let o=t.root?.id;if(!o)return{ok:!1,fetched:0,applied:0};try{let a=await r(s,t.communityID,o,i,t.getToken()),l=t.applyReplyUpdates(a,n);if(a.length>0){let t=Math.max(...a.map(({updatedAt:e})=>Date.parse(e)));e.markEventSeen(t)}return t.setLastSyncOk(!0),{ok:!0,fetched:a.length,applied:l}}catch{return t.setLastSyncOk(!1),{ok:!1,fetched:0,applied:0}}}var a=e.i(310282);function l(e){return`${e.serverURL}:${e.communityID}:${e.queueID}`}class c{hasBeenLive=!1;refreshOnNextAck=!1;connectionState="offline";lastEventAt=0;lastAckAt=0;socket=null;scope=null;messageHandler=null;enabled=!1;isDisposing=!1;reconnectAttempt=0;lastHeartbeatSentAt=0;onReconnect=null;visibilityListener=null;constructor(){(0,a.makeAutoObservable)(this,{registerScope:!1,setEnabled:!1,setOnReconnect:!1,dispose:!1})}setOnReconnect(e){this.onReconnect=e}setEnabled(e){this.enabled=e,e&&this.scope?this.connect():e||(this.clearReconnectTimer(),this.teardownSocket(),this.setConnectionState("offline"))}registerScope(e,t){let s=this.scope,i=(s?l(s):null)!==l(e),r=s?.viewerID!==e.viewerID;return s&&i&&(this.lastEventAt=0),this.scope=e,this.messageHandler=t,this.enabled&&(i?this.connect():r&&this.socket&&this.socket.readyState===WebSocket.OPEN&&this.sendScope(this.socket)),()=>{this.messageHandler===t&&(this.messageHandler=null)}}markEventSeen(e){let t=e instanceof Date?e.getTime():"string"==typeof e?new Date(e).getTime():e;!Number.isNaN(t)&&t>this.lastEventAt&&(this.lastEventAt=t)}dispose(){this.isDisposing=!0,this.enabled=!1,this.scope=null,this.messageHandler=null,this.onReconnect=null,this.removeVisibilityListener(),this.clearTimers(),this.teardownSocket(),this.setConnectionState("offline")}setConnectionState(e){(0,a.runInAction)(()=>{this.connectionState=e})}connect(){let e;if(!this.enabled||!this.scope||this.isDisposing)return;this.hasBeenLive&&(this.refreshOnNextAck=!0),this.clearReconnectTimer(),this.teardownSocket(),this.isDisposing=!1;let{serverURL:t}=this.scope;if(t){try{e=new URL("/messages",t).toString()}catch{this.scheduleReconnect();return}this.setConnectionState("reconnecting");try{let t=new WebSocket(e);this.socket=t,t.onopen=()=>{t.readyState===WebSocket.OPEN&&this.socket===t&&(this.reconnectAttempt=0,this.setConnectionState("reconnecting"),this.sendScope(t),this.sendHeartbeat())},t.onmessage=e=>{this.handleMessage(e)},t.onerror=()=>{this.isDisposing||this.socket!==t||this.scheduleReconnect()},t.onclose=()=>{this.isDisposing||this.socket!==t||this.scheduleReconnect()}}catch{this.scheduleReconnect()}this.ensureVisibilityListener()}}sendScope(e){if(!this.scope||e.readyState!==WebSocket.OPEN)return;let t=JSON.stringify({type:"SCOPE",protocolVersion:1,queueID:this.scope.queueID,communityID:this.scope.communityID,viewerID:this.scope.viewerID});try{e.send(t)}catch{this.scheduleReconnect()}}handleMessage(e){try{let t="string"==typeof e.data?e.data:String(e.data??""),s=JSON.parse(t);if(!s?.type)return;if("HEARTBEAT_ACK"===s.type)return void this.handleHeartbeatAck(s.time);try{this.messageHandler?.(s)}catch(e){}}catch{}}handleHeartbeatAck(e){"number"==typeof e&&e===this.lastHeartbeatSentAt&&(this.clearAckWatchdog(),(0,a.runInAction)(()=>{this.lastAckAt=Date.now()}),this.refreshOnNextAck&&(this.refreshOnNextAck=!1,this.onReconnect?.()),this.hasBeenLive=!0,this.setConnectionState("live"))}scheduleHeartbeat(){this.clearHeartbeatTimer();let e=Date.now();this.heartbeatTimer=setTimeout(()=>{Date.now()-e-15e3>1e4&&this.setConnectionState("reconnecting"),this.sendHeartbeat()},15e3)}sendHeartbeat(){if(this.isDisposing||!this.enabled)return;let e=this.socket;if(!e||e.readyState!==WebSocket.OPEN)return void this.scheduleReconnect();let t=Date.now();try{e.send(JSON.stringify({type:"HEARTBEAT",time:t}))}catch{this.scheduleReconnect();return}this.lastHeartbeatSentAt=t,this.scheduleHeartbeat(),this.resetAckWatchdog()}
92resetAckWatchdog(){this.clearAckWatchdog(),this.ackWatchdogTimer=setTimeout(()=>{this.lastAckAt>=this.lastHeartbeatSentAt||this.scheduleReconnect()},1e4)}scheduleReconnect(){var e;if(this.isDisposing||!this.enabled)return;this.teardownSocket(),this.setConnectionState("reconnecting");let t=(e=Math.min(1e3*2**this.reconnectAttempt,3e4))+Math.floor(Math.random()*e*.25);this.reconnectAttempt+=1,this.clearReconnectTimer(),this.reconnectTimer=setTimeout(()=>{this.connect()},t)}teardownSocket(){this.clearHeartbeatTimer(),this.clearAckWatchdog();let e=this.socket;if(this.socket=null,e&&e.readyState!==WebSocket.CLOSING&&e.readyState!==WebSocket.CLOSED)try{e.close()}catch{}}ensureVisibilityListener(){!this.visibilityListener&&"u">typeof document&&(this.visibilityListener=()=>{if("visible"===document.visibilityState&&this.enabled&&this.scope){let e=this.socket,t="live"!==this.connectionState||Date.now()-this.lastAckAt>=25e3;if(!e||e.readyState!==WebSocket.OPEN){this.reconnectAttempt=0,this.connect();return}t&&(this.setConnectionState("reconnecting"),this.sendHeartbeat())}},document.addEventListener("visibilitychange",this.visibilityListener))}removeVisibilityListener(){this.visibilityListener&&"u">typeof document&&(document.removeEventListener("visibilitychange",this.visibilityListener),this.visibilityListener=null)}clearTimers(){this.clearReconnectTimer(),this.clearHeartbeatTimer(),this.clearAckWatchdog()}clearReconnectTimer(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0)}clearHeartbeatTimer(){this.heartbeatTimer&&(clearTimeout(this.heartbeatTimer),this.heartbeatTimer=void 0)}clearAckWatchdog(){this.ackWatchdogTimer&&(clearTimeout(this.ackWatchdogTimer),this.ackWatchdogTimer=void 0)}}var d=e.i(722010);let u=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),h=new Set(["type","queueID","payload"]);var p=e.i(210982),y=e.i(478902);let m=(0,t.createContext)(null);e.s(["CycloneWebsocketProvider",0,({serverURL:e,repliesStore:s,viewerID:i,enabled:r,ignoreLiveReplies:a=!1,children:l})=>{let f=(0,t.useRef)(null),b=(0,t.useRef)(null),g=(0,t.useRef)(a);g.current=a,f.current||(f.current=new c);let v=f.current,R=(0,p.useAnalytics)(),S=(0,t.useRef)(R);S.current=R,(0,t.useEffect)(()=>{let t=function({manager:e,repliesStore:t,serverURL:s,viewerID:i,debounceMs:r=250,onComplete:a}){let l,c=null,d=!1,u=!1,h=!1,p=e=>{c=null===c?e:Math.min(c,e)},y=()=>{l=setTimeout(()=>{l=void 0,m()},r)},m=async()=>{if(h||d||null===c)return;let r=c;c=null,d=!0;let l=await function(e,t,s,i,r){let a=n.get(t);if(a)return a;let l=o(e,t,s,i,r).finally(()=>{n.get(t)===l&&n.delete(t)});return n.set(t,l),l}(e,t,s,r,i);d=!1,a?.(l,r),l.ok||p(r),u&&(u=!1,y())},f=()=>{c=null,u=!1,l&&(clearTimeout(l),l=void 0)};return{schedule(e){if(!h){if(p(e),d){u=!0;return}l&&clearTimeout(l),y()}},reset:f,dispose(){h=!0,f()}}}({manager:v,repliesStore:s,serverURL:e,viewerID:i,onComplete:(e,t)=>{!function(e,t){if(!e)return;let s={event:"cyclone_reconnect",cyclone_reconnect:{last_event_age_ms:t.lastEventAgeMs,has_updates:t.hasUpdates,updates_check_failed:t.updatesCheckFailed}};e.emit(s)}(S.current,{lastEventAgeMs:Date.now()-t,hasUpdates:e.ok?e.applied>0:null,updatesCheckFailed:!e.ok})}});return b.current=t,v.setOnReconnect(()=>{s.root?.id&&t.schedule(v.lastEventAt)}),()=>{v.setOnReconnect(null),t.dispose(),b.current===t&&(b.current=null)}},[v,s,e,i]),(0,t.useEffect)(()=>{let e=[s.root?.createdAt?Date.parse(s.root.createdAt):NaN,s.lastLoadedReplyCreatedAtMs].filter(e=>null!==e&&!Number.isNaN(e));e.length>0&&v.markEventSeen(Math.max(...e))},[v,s.lastLoadedReplyCreatedAtMs,s.root?.createdAt]),(0,t.useEffect)(()=>{v.setEnabled(r)},[v,r]),(0,t.useEffect)(()=>{if(!r)return;let t=s.root?.id;if(t)return v.registerScope({serverURL:e,communityID:s.communityID,queueID:t,viewerID:i},e=>{g.current||function(e,t,s,i){let r,n,o,a,l="QuickPostDeleted"!==e.type?null:u(e.payload)?e.payload:"string"==typeof e.id?{id:e.id,deletedAt:"string"==typeof e.deletedAt?e.deletedAt:null}:null;if(l?.id)return t.delete({id:l.id,deletedAt:l.deletedAt??new Date().toISOString()});let c=function(e){if(e.type!==d.ContentObjectType.QuickPost)return null;if(u(e.payload))return e.payload;if("string"==typeof e.payload)try{let t=JSON.parse(e.payload);if(u(t))return t}catch{}let t={};for(let s of Object.keys(e))h.has(s)||(t[s]=e[s]);return"string"==typeof t.id&&"string"==typeof t.parentID?t:null}(e);if(!c)return;let p=(r=c.author,n=r?.id??("string"==typeof c.authorID?c.authorID:void 0),o=c.community,a="string"==typeof c.communityID?c.communityID:o?.id??"",{...c,replyCount:"number"==typeof c.replyCount?c.replyCount:0,recs:"number"==typeof c.recs?c.recs:0,seen:!!i&&!!n&&i===n||!!c.seen,community:{id:a,type:d.CommunityType.General}});t.ingestLiveReply(p,i,{markEventSeen:e=>s.markEventSeen(e)})}(e,s,v,i)})},[r,v,s,s.communityID,s.root?.id,e,i]),(0,t.useEffect)(()=>()=>{v.dispose(),f.current=null},[v]);let k=(0,t.useMemo)(()=>({manager:v,resetReplyUpdateRefresh:()=>b.current?.reset()}),[v]);return(0,y.jsx)(m.Provider,{value:k,children:l})},"useOptionalCycloneWebsocketContext",0,function(){return(0,t.useContext)(m)}],334441)},613329,e=>{"use strict";let t=()=>({children:new Map});e.s(["wait",0,e=>{var t,s,i,r;return t=void 0,s=void 0,i=void 0,r=function*(){return new Promise(t=>setTimeout(t,e))}
92,new(i||(i=Promise))(function(e,n){function o(e){try{l(r.next(e))}catch(e){n(e)}}function a(e){try{l(r.throw(e))}catch(e){n(e)}}function l(t){var s;t.done?e(t.value):((s=t.value)instanceof i?s:new i(function(e){e(s)})).then(o,a)}l((r=r.apply(t,s||[])).next())})},"withCoalescing",0,e=>{let s=t();return(...i)=>{let r=s,n=[];for(let e of i){let s=r.children.get(e);s||(s=t(),r.children.set(e,s)),n.push({parent:r,key:e}),r=s}if(r.inFlight)return r.inFlight;let o=Promise.resolve().then(()=>e(...i)).finally(()=>{r.inFlight=void 0;for(let e=n.length-1;e>=0;e--){let t=n[e];if(!t)continue;let{parent:s,key:i}=t,r=s.children.get(i);if(r){if(r.inFlight||r.children.size>0)break;s.children.delete(i)}}});return r.inFlight=o,o}}])},678460,e=>{"use strict";var t=e.i(389959),s=e.i(613329);e.s(["useCoalescedCallback",0,function(e,i=[]){return(0,t.useCallback)((0,s.withCoalescing)(e),i)}])}]);
93
94//# debugId=1907618c-2c22-0992-0c86-e9d631bb6953
95//# sourceMappingURL=067no1gngsu4g.js.map

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.