window.__kol_captureList={"/api/recommend/item_list/":"foryouVideoList","/api/post/item_list":"userVideoList","/api/repost/item_list":"userRepostList","/api/favorite/item_list":"userLikeList","/api/collection/item_list":"userFavoriteList","/api/search/general/full":"searchGeneralList","/api/search/item/full/":"searchVideoList","/api/explore/item_list/":"exploreVideoList","/api/challenge/item_list/":"tagVideoList","/api/following/item_list/":"followingVideoList","/api/friends/item_list/":"friendsVideoList","/api/item/detail":"userVideoDetail","/api/shop":"shopList"};function m(){let a=!0;const d=window.fetch;window.fetch=async function(...t){var o;try{const[e]=t;if(((o=t[0])==null?void 0:o.credentials)==="omit")return d(e);let i;typeof e=="string"?i=e:e!=null&&e.url?i=e.url:i="";const p=d(e),n=Object.keys(window.__kol_captureList).find(s=>i==null?void 0:i.includes(s));if(n){const s=await p,l=await s.clone().json();setTimeout(async()=>{var u;const _=new URLSearchParams(e.url);if(s.ok&&((u=s.headers.get("Content-Type"))!=null&&u.includes("application/json"))){if(_.get("post_item_list_request_type")){const r=_.get("post_item_list_request_type");!r||r==="0"?l.tkOrder="Latest":l.tkOrder=r==="1"?"Popular":"Oldest"}}else console.error("Response is not JSON or not ok:",s);const w=new CustomEvent(window.__kol_captureList[n],{detail:l});a&&(a=!1),console.log(`send ${window.__kol_captureList[n]} event`),window.dispatchEvent(w),n==="/api/post/item_list"&&window.dispatchEvent(new CustomEvent("urlRefererGet",{detail:i}))},a?4e3:1500)}return p}catch(e){console.error("fetch error",e)}};const c=window.localStorage.getItem("fyp-feed-cache");if(c){const t=new CustomEvent("foryouVideoList",{detail:JSON.parse(c)});setTimeout(()=>{window.dispatchEvent(t)},2500)}console.log("is injected"),setTimeout(()=>{const t=new CustomEvent("refreshUserProfile");window.dispatchEvent(t)},2500),window.addEventListener("getAnalysisData",t=>{window.fetch(t.detail.url,{credentials:"omit"}).then(o=>{o.json().then(e=>{const i=new CustomEvent("analysisDataList",{detail:{data:e,requestId:t.detail.requestId}});window.dispatchEvent(i)})})})}window.__load_kol_ss=!0,setTimeout(()=>{if(console.log(window.__load_kol_main),window.__load_kol_main==!0){document.documentElement.dataset.__load_kol_main="true";return}else m()},1);
