var __makeTemplateObject=this&&this.__makeTemplateObject||function(e,r){if(Object.defineProperty){Object.defineProperty(e,"raw",{value:r})}else{e.raw=r}return e};import{r as registerInstance,h as h$1}from"./index-38ad4957.js";import{i as intl}from"./global-96c14d63.js";import{n as h}from"./dom-context-hooks.module-50442785.js";import{d as dist,H,J,w as wn,i as isDemo}from"./index.module-b23fdad8.js";import{c as cjs}from"./cjs-bdfb4486.js";import{L as LeaderboardRankView}from"./sqm-leaderboard-rank-view-7a682cc3.js";var GET_RANK=dist.gql(templateObject_1||(templateObject_1=__makeTemplateObject(["\n  query ($type: String!, $filter: UserLeaderboardFilterInput) {\n    viewer {\n      ... on User {\n        leaderboardRank(type: $type, filter: $filter) {\n          rowNumber\n          rank\n          denseRank\n        }\n      }\n    }\n  }\n"],["\n  query ($type: String!, $filter: UserLeaderboardFilterInput) {\n    viewer {\n      ... on User {\n        leaderboardRank(type: $type, filter: $filter) {\n          rowNumber\n          rank\n          denseRank\n        }\n      }\n    }\n  }\n"])));function useLeaderboardRank(e){var r,a,n,t;var o=H();var d=(r=e.programId)!==null&&r!==void 0?r:o;var i=J();var s=d?{type:e.leaderboardType,filter:{programId_eq:d}}:{type:e.leaderboardType,filter:{}};if(e.interval){s.filter["interval"]=e.interval}var l=wn(GET_RANK,s,!(i===null||i===void 0?void 0:i.jwt)).data;var m=((a=l===null||l===void 0?void 0:l.viewer)===null||a===void 0?void 0:a.leaderboardRank)?intl.formatMessage({id:"rankText",defaultMessage:e.rankText},{rank:(t=(n=l===null||l===void 0?void 0:l.viewer)===null||n===void 0?void 0:n.leaderboardRank)===null||t===void 0?void 0:t[e.rankType]}):e.unrankedText||"unranked";return{data:{rank:m}}}var sqmLeaderboardRankCss="p,.P{font-size:var(--sl-font-size-small);color:var(--sqm-text);margin-top:0px}p.Subtitle,.P.Subtitle{color:var(--sqm-text-subdued);margin:0px}";var LeaderboardRank=function(){function e(e){registerInstance(this,e);this.rankText="You are currently in {rank, selectordinal, one {#st} two {#nd} few {#rd} other {#th} } place!";h(this)}e.prototype.disconnectedCallback=function(){};e.prototype.render=function(){var e=isDemo()?useLeaderboardRankDemo(this):useLeaderboardRank(this);return h$1(LeaderboardRankView,Object.assign({},e))};return e}();function useLeaderboardRankDemo(e){var r=intl.formatMessage({id:"rankText",defaultMessage:e.rankText},{rank:1})||"1st";return cjs({data:{rank:r}},e.demoData||{},{arrayMerge:function(e,r){return r}})}LeaderboardRank.style=sqmLeaderboardRankCss;export{LeaderboardRank as sqm_leaderboard_rank};var templateObject_1;