1import{setIsSubscribedToChannel as e,setGroupCreatorSubscribe as n}from"./channel-subscriptions.d972076b.js";import{setEmoteAuthHeader as t}from"./comments.7cce866c.js";import{closeSidebarIfMobile as o,toggleChannelLinks as i}from"./sidebar.24496460.js";import{getBasePath as r,matchWwwPrefix as s}from"./url.utils.dcda8a2c.js";export let isLoggedInUser=!1;export let studioLink;export let myChannelLink;window.HUMIX=window.HUMIX||{};const l=_(),d=`https://app.open.video/open-video-viewer-register?b=${l}`,a="https://open.video/join",c="https://login.open.video";window.HUMIX.currentUserCB=2;export const PENDING_CHANNEL_ACTION_KEY="humixPendingChannelAction";export const PENDING_CHANNEL_ACTION_TTL_MS=9e5;const u=2e3,g=9e4;export const PENDING_NAV_INTENT_KEY="humixPendingNavIntent";export const PENDING_NAV_INTENT_TTL_MS=9e5;const m=["https://app.open.video","https://app-local.open.video:8766"],f=6e3;let h=0,p=null,w=!1,I=null,y=null,N=!1;const L=1e4,E=3e3,U=1;let v=!1,M=0,x=null,b=!1;function _(){if(!window.HUMIX.loginModalBrandingString)return"";return"open.video"===window.location.host?"":window.HUMIX.loginModalBrandingString}export function openLoginModal(e={type:"login",data:{}}){const n=document.getElementById("humix-login-modal");if(!n)return;C();const t=h+=1;w=!1;const i=H();p=i,i?(T(),X(!1),i.src=$(e),y=t,I=setTimeout(function(){I=null,h===t&&(y=null,X(!0))},f),n.style.display="",P(),e&&"subscribe"===e.type&&e.data&&e.data.channelSlug&&B(e.data.channelSlug),(e&&"subscribe"===e.type||V())&&startModalDetailsPoll(),o()):window.location.href=c}function S(){const e=document.getElementById("humix-login-modal");e&&(e.style.display="none"),Y(),O(),h+=1,C(),w=!1,k(),p=null,X(!1),T()}function H(){const e=document.getElementById("humix-login-modal-content");if(!e)return null;k();const n=document.createElement("iframe");return n.crossOrigin=!0,n.setAttribute("style","height: 100% !important; width: 100% !important"),n.setAttribute("id","humix-login-frame"),e.appendChild(n),n}function k(){const e=document.getElementById("humix-login-frame");e&&e.parentNode&&e.parentNode.removeChild(e)}function C(){I&&(clearTimeout(I),I=null),y=null}function T(){const e=document.getElementById("humix-login-fallback");e&&(e.style.display="")}function A(){const e=document.getElementById("humix-login-fallback");e&&(e.style.display="none")}function X(e){const n=document.getElementById("humix-login-modal-content"),t=document.getElementById("humix-login-frame");e?(n&&(n.setAttribute("data-login-frame","degraded"),n.classList.add("humix-login-frame-degraded")),t&&(t.style.display="none")):(n&&(n.removeAttribute("data-login-frame"),n.classList.remove("humix-login-frame-degraded")),t&&(t.style.display=""))}function D(e){"Escape"!==e.key&&"Esc"!==e.key||S()}function P(){O(),document.addEventListener("keydown",D),N=!0}function O(){N&&(document.removeEventListener("keydown",D),N=!1)}function B(e){if(e)try{sessionStorage.setItem(PENDING_CHANNEL_ACTION_KEY,JSON.stringify({action:"subscribe",slug:e,ts:Date.now()}))}catch(e){}}window.HUMIX.openLoginModal=openLoginModal,window.HUMIX.closeLoginModal=S,document.addEventListener("click",function(e){e.target&&"humix-login-modal"===e.target.id&&S()}),window.addEventListener("message",function(e){-1!==m.indexOf(e.origin)&&e.data&&"resize"===e.data.type&&("number"!=typeof e.data.height||e.data.height<=0||p&&e.source===p.contentWindow&&null!==y&&y===h&&(w=!0,C(),A(),X(!1)))});export function setPendingNavIntent(e){if(e)try{sessionStorage.setItem(PENDING_NAV_INTENT_KEY,JSON.stringify({action:e,ts:Date.now()}))}catch(e){}}function V(){try{return!!sessionStorage.getItem(PENDING_NAV_INTENT_KEY)}catch(e){return!1}}function G(){if(isLoggedInUser&&!b){b=!0;try{let e,n=null;try{n=sessionStorage.getItem(PENDING_NAV_INTENT_KEY),sessionStorage.removeItem(PENDING_NAV_INTENT_KEY)}catch(e){return}if(!n)return;try{e=JSON.parse(n)}catch(e){return}if(!e||!e.action||"number"!=typeof e.ts)return;if(Date.now()-e.ts>PENDING_NAV_INTENT_TTL_MS)return;if("studio"===e.action)return void("string"==typeof studioLink&&studioLink&&(window.location.href=studioLink));if("myChannel"===e.action){const e=Object.keys(myChannelLink||{}).filter(function(e){return"login"!==e});if(1===e.length)window.location.href=myChannelLink[e[0]];else if(e.length>1){!document.body.classList.contains("slide-open")&&window.HUMIX&&"function"==typeof window.HUMIX.toggleSidebar&&window.HUMIX.toggleSidebar(),i()}}}finally{b=!1}}}let j=null,K=0;
1export function startModalDetailsPoll(){Y(),j=setInterval(function(){K+=u;const e=document.getElementById("humix-login-modal");!(e&&"none"!==e.style.display)||isLoggedInUser||K>=g?Y():refreshUserDetails()},u)}function Y(){j&&(clearInterval(j),j=null),K=0}function J(e,n){const t=e.includes("?")?"&":"?";return e+t+"redirect_url="+encodeURIComponent(n)}window.addEventListener("HumVLoaded",function(e){S(),refreshUserDetails()}),window.addEventListener("emote:productSyncAuth",function(e){isLoggedInUser||openLoginModal({type:"comment",data:{channelName:window.HUMIX.channelName}})});let R="https://open.video/join";const q=window.location.href;function W(){const e=document.querySelectorAll(".nav-logged-in-user"),n=document.querySelectorAll(".nav-logged-out-user"),t=document.querySelectorAll(".register-link"),o=document.body;e.forEach(e=>{e.style.display=isLoggedInUser?"flex":"none"}),n.forEach(e=>{e.style.display=isLoggedInUser?"none":"flex"});const i=window.location.href;t.forEach(e=>{if("https://open.video/"!==i){const n=e.getAttribute("href");if(!n)return;e.href=J(n,i)}}),o.classList.toggle("logged-in",isLoggedInUser),o.classList.toggle("logged-out",!isLoggedInUser)}function z(){let e=location.host,n=r();const t=e;return"www-test.open.video"!==e&&"open.video"!==e||(e="open.video",n="/openvideo"),"https://"+e+n+"/loginRedirect?domain="+t}function $(e={type:"login",data:{}}){e&&e.type||(e={type:"login",data:{}});let n=d+"&redirect_url="+encodeURIComponent(z())+"&action="+e.type;const t=F(e.data);return n+="&action_data="+encodeURIComponent(t)}function F(e){const n=JSON.stringify(e||{});try{const t=(new TextEncoder).encode(n);let o="";for(let e=0;e<t.length;e++)o+=String.fromCharCode(t[e]);return btoa(o)}catch(n){try{const n=Object.assign({},e);return delete n.channelName,btoa(JSON.stringify(n))}catch(e){return btoa("{}")}}}function Q(e){let n=document.getElementsByClassName("my-channel-links");for(let t of n){t.innerHTML="";for(let n in e){let o=document.createElement("a");o.href=e[n],o.className="channel-link",o.textContent=n,o.onclick=function(t){t.preventDefault(),window.location.href=e[n]},t.appendChild(o)}}}function Z(o){if(!o)throw new Error("empty /details response");const i=JSON.parse(o),r=isLoggedInUser;isLoggedInUser=i.isLoggedInUser,studioLink=i.studioLink,i.isLoggedInUser&&"number"==typeof i.humixViewerAccountId&&i.humixViewerAccountId>0?(window.HUMIX=window.HUMIX||{},window.HUMIX.humixViewerAccountId=i.humixViewerAccountId):window.HUMIX&&delete window.HUMIX.humixViewerAccountId,isLoggedInUser&&i.myChannelLink&&(myChannelLink=i.myChannelLink),isLoggedInUser&&i.token&&t(i.token),e(i.isSubscribedToChannel),n(i.isSubscribedToGroup,i.groupCreatorSubscribed),M=0,!r&&isLoggedInUser&&"function"==typeof window.dispatchEvent&&window.dispatchEvent(new Event("ov-viewer-login"))}function ee(e){W(),e&&(Object.keys(myChannelLink).length>1&&Q(myChannelLink),G())}function ne(){M>=U||(M+=1,x=setTimeout(function(){x=null,te()},E))}function te(){if(v)return;v=!0;const e=new XMLHttpRequest;let n=!1;function t(e,t){if(n)return;n=!0,v=!1;let o=!1;if("function"==typeof e)try{e(),o=!0}catch(e){o=!1}!o&&t&&ne(),ee(o)}e.open("GET",oe(),!0),e.timeout=L,e.onreadystatechange=function(){4===e.readyState&&(200===e.status?t(function(){Z(e.response)},!1):0!==e.status&&t(void 0,!1))},e.onerror=function(){t(void 0,!0)},e.ontimeout=function(){t(void 0,!0)},e.onabort=function(){t(void 0,!0)},e.send()}"https://open.video/"!==q&&(R=J(R,q)),myChannelLink={login:c},studioLink=R,te();export function refreshUserDetails(){te()}function oe(){if(window.HUMIX&&window.HUMIX.channelUrl&&""!==window.HUMIX.channelUrl){const e=window.HUMIX.channelUrl+"/details";return s(e)}const e=new URL(window.location.href.split("?")[0]),n=window.HUMIX&&window.HUMIX.channelSlug?window.HUMIX.channelSlug:"",t=window.HUMIX&&window.HUMIX.groupCreatorSlug?window.HUMIX.groupCreatorSlug:"";return e.pathname.startsWith("/humix")||e.pathname.startsWith("/openvideo")||e.pathname.startsWith("/videos")?e.pathname=r()+"/details":e.pathname=n&&""!==n?"/@"+n+"/details":t&&""!==t?"/network/@"+t+"/details":"/details",s(e.toString())}window.HUMIX.refreshUserDetails=refreshUserDetails;
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.