function DeezerMenuBuilder(e){function o(){u()}function u(){n=e,r="",i=""}function a(e,t){r=t.message.body.navigate.attributess.source,i=t.message.body.navigate.attributess.sourceAccount;var o,u,a,c,h,p,d,v,m,g,y=0,b,w=!1;m=objFactory.getObj("sections");for(o in DeezerWorker.TopLevelForMenuUriMappings){if(!DeezerWorker.TopLevelForMenuUriMappings.hasOwnProperty(o))continue;c=Object.keys(DeezerWorker.TopLevelForMenuUriMappings).indexOf(o),DeezerWorker.TopLevelForMenuUriMappings[o]&&(a=e[c].responseJSON.data),g=a.length>5?5:a.length,v=objFactory.getObj("section"),d=objFactory.getObj("items");switch(o){case"recommendations":case"charts":o==="recommendations"?(v.setTitle("##TRANS_Deezer_MenuItems_picks##"),p="recommendation"):(v.setTitle("##TRANS_Deezer_MenuItems_charts##"),p="chart");for(b=1;b<=a.length;b++){dataObject={name:a[b].name,containerType:p,type:"genre",logo:a[b].picture_big,token:a[b].id.toString(),containerToken:a[b].id.toString()},b>g&&(dataObject={name:"##TRANS_General_SeeAll##",type:"seeAll:"+o,logo:"./images/see_all.svg"}),item=f(dataObject),d.addChild(item);if(b>g)break}break;case"radioStations":v.setTitle("##TRANS_MenuItems_radioChannels##");var E=Object.keys(DeezerWorker.TopLevelForMenuUriMappings).indexOf("recommendations"),S=e[E].responseJSON.data,x=a.slice();x.unshift({title:"All",id:0,radios:["All"]});var T,N;for(T=1;T<=x.length;T++){if(x[T].radios.length===0)continue;for(E=0;E<S.length;E++)if(x[T].id===S[E].id){N=S[E].picture_big;break}dataObject={name:x[T].title,containerType:"radio",type:"genre",logo:N,token:x[T].id.toString(),containerToken:x[T].id.toString()},T>g&&(dataObject={name:"##TRANS_General_SeeAll##",type:"seeAll:"+o,logo:"./images/see_all.svg"}),item=f(dataObject),d.addChild(item);if(T>g)break}break;case"flow":v.setTitle("##TRANS_flow##");var C=Object.keys(DeezerWorker.TopLevelForMenuUriMappings).indexOf("flow"),k=e[C].responseJSON.data;if(k.length<1)break;dataObject={name:"##TRANS_flowDescription##",containerType:"radio",type:"tracklistRadio",playbackType:"tracklistRadio",logo:k[0].album.cover_big,location:s+"/user/me/flow"},item=l(dataObject),d.addChild(item);break;case"mylibrary":v.setTitle("##TRANS_Deezer_MenuItems_myLibrary##");var L,A=[{name:"##TRANS_Deezer_MenuItems_tracksYouLove##",type:"favTracks",logo:"images/sources/deezer/black/Deezer_Favorite_Tracks.svg"},{name:"##TRANS_Deezer_MenuItems_myPlaylists##",type:"favPlaylists",logo:"images/sources/deezer/black/Deezer_Playlist.svg"},{name:"##TRANS_Deezer_MenuItems_myAlbums##",type:"favAlbums",logo:"images/sources/deezer/black/Deezer_Albums.svg"},{name:"##TRANS_Deezer_MenuItems_myFavoriteArtists##",type:"favArtists",logo:"images/sources/deezer/black/Deezer_Artist.svg"}];for(L in A)dataObject=A[L],item=f(dataObject),d.addChild(item)}y++,v.setItems(d),m.addChild(v)}var O=objFactory.getObj("navigateresponse").setSource(r).setSourceAccount(i).setSections(m).setTotalItems(y),M=n.formatResponseToXML(t,O);return M}function f(e){var t;return t=objFactory.getObj("item"),t.setName(e.name).setType(e.type).setLogo(e.logo).setToken(e.token).setContainerType(e.containerType).setContainerToken(e.containerToken),t}function l(e){var t;return t=objFactory.getObj("item"),t.setType(e.type).setName(e.name).setLogo(e.logo).setArtistName(e.artistName).setContentItem(objFactory.getObj("contentItem").setSource(r).setSourceAccount(i).setType(e.type).setItemName(e.name).setLocation(e.location).setIsPresetable("true")).setPlaybackRequest(objFactory.getObj("playbackrequest").setSource(r).setSourceAccount(i).setContainer(objFactory.getObj("container").setSource(r).setSourceAccount(i).setLocation(e.location).setType(e.playbackType).setIsPresetable("true").setItemName(e.name))),t}function c(t,n,s,o){var u=e.formatResponseToXML(s,objFactory.getObj("navigateresponse").setSource(r).setSourceAccount(i).setTotalItems(n).setItems(t).setSections(o));return u}var t=this;this.buildMenuForTopLevelPage=a;var n,r,i,s="https://api.deezer.com";o()};