const queryString=window.location.search,parameters=new URLSearchParams(queryString),short_id_query=parameters.get("short"),GetRequest=t=>new Promise(((e,n)=>{fetch(t,{method:"GET",mode:"cors"}).then((t=>{t.status>=200&&t.status<=299?t.text().then((t=>{e(t)})):n(new Error)})).catch((t=>n(t)))})),GetRequestParseJSON=async t=>new Promise(((e,n)=>{GetRequest(t).then((t=>{e(JSON.parse(t))})).catch(n)})),JSONPostRequest=(t,e)=>new Promise(((n,s)=>{fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:e,mode:"cors"}).then((t=>{t.status>=200&&t.status<=299?t.json().then((t=>{n(t)})):s(new Error)})).catch((t=>s(t)))}));class Action{_subs=[];constructor(...t){this._subs=t}AddCallback(t){if("function"!=typeof t)throw new Error("Invalid parameter type for 'callback': "+typeof t+". Expected 'function'.");this._subs.push(t)}RemoveCallback(t){this._subs.splice(this._subs.findIndex((e=>e==t)))}Invoke(t){for(let e=0;enew Promise(((e,n)=>{GetRequest(`https://dapp.isotopic.io/api/v1/store/details/${t}`).then((t=>{e(JSON.parse(t))})).catch((t=>{n(t)}))})),GetGameImageSrcURL:t=>`https://dapp.isotopic.io/api/v1/store/files/${app_id}/page_images/?index=${t}`,GetGameMainImageSrcURL:()=>`https://dapp.isotopic.io/api/v1/store/files/${app_id}/page_main_image`,GetAppCategories:()=>new Promise(((t,e)=>{GetRequest("https://dapp.isotopic.io/api/v1/store/categories").then((e=>{t(JSON.parse(e))})).catch((t=>e(t)))})),GetShortsFeed:()=>GetRequestParseJSON("https://dapp.isotopic.io/api/v1/shorts/feed/get_feed"),GetShortByID:t=>GetRequestParseJSON(`https://dapp.isotopic.io/api/v1/shorts/${t}/details`),GetComments:t=>new Promise(((e,n)=>{GetRequest(`https://dapp.isotopic.io/api/v1/shorts/comments/${t}`).then((t=>{e(JSON.parse(t))})).catch((t=>{n(t)}))})),AddNewComment:(t,e,n=null)=>JSONPostRequest(`https://dapp.isotopic.io/api/v1/store/comments/${t}/post`,JSON.stringify({session_id:User.GetSessionID(),content:e,parent_id:n}))},OpenAndWaitForLogin=()=>new Promise(((t,e)=>{$("body").addClass("edgtf-right-side-menu-opened"),$(".edgtf-side-menu-button-opener, .edgtf-icon-has-hover, .edgtf-side-menu-button-opener-svg-path").addClass("opened");const n=e=>{t(e),MyAccount.OnAccountSet.RemoveCallback(n)};MyAccount.OnAccountSet.AddCallback(n)}));let storesidebarRes=GetRequest("https://dapp.isotopic.io/games-page/sidebar").catch((t=>{throw t}));const getAppCategoriesPromise=API.GetAppCategories();$("head").append(''),$(document).ready((async()=>{const t=$("#store-sidebar");storesidebarRes.then((e=>{t.html(e)}));const e=import("https://dapp.isotopic.io/modules/video.min.js"),n=$("#shorts-container");let s;n.append(`
\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
${"Loading Shorts..."}
\n `);try{s=await API.GetShortsFeed(),$("#page-loading-parent").remove()}catch{let t=()=>{ShowPopupModal("An error occured. Could not retrieve shorts feed.",t)};t()}(async()=>{n.append('\n

\n Isotopic Shorts\n

\n \n \n
\n \x3c!--MAIN DISCRIPTION--\x3e\n
\n
\n \n \n \n
\n
\n \n \n \n
\n
\n \n \n \n \n
\n
\n PLAY SHORT\n
\n
\n
\n
\n NEXT SHORT\n
\n
\n \n
\n
\n \n\n
\n
\n
\n Loading\n
\n
\n\n\n
\n
\n
\n \n
\n\n
\n
\n
\n Loading\n
\n
\n\n\n
\n
\n\n

> Expand full game description.

\n
\n
\n
\n
\n
\n
\n BECOME AN ISOTOPIC SHORTS CREATOR\n
\n
\n\n\n
\n

Are you a Game Developer working on a cool game project? Register your account at Isotopic, create a page for your game within minutes, and start uploading video content to the Isotopic shorts platform.

\n
\n \n \n
\n
\n
\n\n
\n\n '),$("#upload-short-button").click((()=>{window.location.hash="#publish-game"})),await e;const t=videojs("shorts-player-1"),a=videojs("shorts-player-2");let i,o,r=new Promise(((t,e)=>{i=t})),d=new Promise(((t,e)=>{o=t}));t.ready(i),a.ready(o),await Promise.all([r,d]),t.on("volumechange",(()=>{a.volume(t.volume()),a.muted(t.muted())})),a.on("volumechange",(()=>{t.volume(a.volume()),t.muted(a.muted())}));const l=$("#short-1-parent"),c=$("#short-2-parent"),p=$("#short-description"),h=$("#short-title"),g=$("#game-description"),u=$("#game-title");let m=s.shorts,w=s.session_id,x=!1;function f(t){let e=JSON.parse(t.metadata).extension;return{src:`https://dapp.isotopic.io/api/v1/shorts/${t.short_id}${e}?session_id=${w}`,mime:`video/${e.substr(1)}`}}let v=0;async function y(){if(v"+e.details_html),g.text(e.short_description),u.text(e.title);try{const e=new URL(window.location);e.searchParams.set("short",t.short_id),history.pushState({},"",e)}catch{}}if($("#expand-game-desc").click((async()=>{$("#expand-game-desc").css("display","none"),$("#expanded-details").css("display","unset")})),null!=short_id_query){let e=await API.GetShortByID(short_id_query);"fail"!=e.result?(t.src(f(e.short)),await b(e.short),v=-1):(t.src(f(m[0])),await b(m[v]))}else t.src(f(m[0])),await b(m[v]);let S=await new Promise(((t,e)=>{$("#pause-short-button").click((()=>{t(!1),$("#pause-button-text").text("PAUSE"),$("#next-short-button").off("click"),$("#pause-short-button").off("click"),l.off("click")})),l.click((()=>{t(!1),$("#pause-button-text").text("PAUSE"),$("#next-short-button").off("click"),$("#pause-short-button").off("click"),l.off("click")})),$("#next-short-button").click((async()=>{t(!0),$("#next-short-button").off("click"),$("#pause-short-button").off("click"),l.off("click"),$("#pause-button-text").text("PAUSE")}))}));await t.play();let P=1;a.src(f(await y())),t.on("ended",(async()=>{t.hide(),a.show(),await b(m[v]),await a.play(),P=2,t.src(f(await y())),x||(a.on("ended",(async()=>{a.hide(),t.show(),await b(m[v]),await t.play(),P=1,a.src(f(await y()))})),x=!0)}));let A=e=>1==e?t:a,k=!1;function O(){k?(A(P).play(),$("#pause-button-text").text("PAUSE")):(A(P).pause(),$("#pause-button-text").text("PLAY")),k=!k}$("#pause-short-button").click((()=>{O()})),l.click(O),c.click(O);let _=!1;$("#next-short-button").click((async()=>{if(_)return;_=!0;let t=A(P),e=A(1==P?2:1);t.pause(),t.hide(),e.show(),await b(m[v]),await e.play(),P=1==P?2:1,t.src(f(await y())),_=!1,k=!1,$("#pause-button-text").text("PAUSE")})),S&&$("#next-short-button").click()})()}));