generated from VLADIMIR/template_frontend
10 lines
24 KiB
JavaScript
10 lines
24 KiB
JavaScript
import{A as e,E as t,F as n,H as r,S as i,T as a,V as o,W as s,Z as c,ct as l,k as u,l as d,o as f,rt as p,s as m,v as h,wt as g,x as _,y as v}from"./vue-router-CyfP71JJ.js";function y(e){return{Ping(t){let n=[],r=`api/test/ping`;return n.length>0&&(r+=`?${n.join(`&`)}`),e({path:r,method:`GET`,body:null},{service:`EveningDetectiveServer`,method:`Ping`})},Echo(t){let n=[];t.text&&n.push(`text=${encodeURIComponent(t.text.toString())}`);let r=`api/test/echo`;return n.length>0&&(r+=`?${n.join(`&`)}`),e({path:r,method:`POST`,body:null},{service:`EveningDetectiveServer`,method:`Echo`})},Signup(t){let n=JSON.stringify(t),r=[],i=`api/auth/signup`;return r.length>0&&(i+=`?${r.join(`&`)}`),e({path:i,method:`POST`,body:n},{service:`EveningDetectiveServer`,method:`Signup`})},RefreshPassword(t){let n=JSON.stringify(t),r=[],i=`api/auth/refresh-password`;return r.length>0&&(i+=`?${r.join(`&`)}`),e({path:i,method:`POST`,body:n},{service:`EveningDetectiveServer`,method:`RefreshPassword`})},Login(t){let n=JSON.stringify(t),r=[],i=`api/auth/login`;return r.length>0&&(i+=`?${r.join(`&`)}`),e({path:i,method:`POST`,body:n},{service:`EveningDetectiveServer`,method:`Login`})},Refresh(t){let n=JSON.stringify(t),r=[],i=`api/auth/refresh`;return r.length>0&&(i+=`?${r.join(`&`)}`),e({path:i,method:`POST`,body:n},{service:`EveningDetectiveServer`,method:`Refresh`})},DeleteAccount(t){let n=[],r=`api/auth/delete-account`;return n.length>0&&(r+=`?${n.join(`&`)}`),e({path:r,method:`DELETE`,body:null},{service:`EveningDetectiveServer`,method:`DeleteAccount`})},GetTerms(t){let n=[],r=`api/terms`;return n.length>0&&(r+=`?${n.join(`&`)}`),e({path:r,method:`GET`,body:null},{service:`EveningDetectiveServer`,method:`GetTerms`})},GetPrivacy(t){let n=[],r=`api/privacy`;return n.length>0&&(r+=`?${n.join(`&`)}`),e({path:r,method:`GET`,body:null},{service:`EveningDetectiveServer`,method:`GetPrivacy`})},GetConsent(t){let n=[],r=`api/consent`;return n.length>0&&(r+=`?${n.join(`&`)}`),e({path:r,method:`GET`,body:null},{service:`EveningDetectiveServer`,method:`GetConsent`})},GetUsers(t){let n=[],r=`api/users`;return n.length>0&&(r+=`?${n.join(`&`)}`),e({path:r,method:`GET`,body:null},{service:`EveningDetectiveServer`,method:`GetUsers`})},GetUserById(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/users/${t.id}`,r=[],i=n;return r.length>0&&(i+=`?${r.join(`&`)}`),e({path:i,method:`GET`,body:null},{service:`EveningDetectiveServer`,method:`GetUserById`})},GetMe(t){let n=[],r=`api/users/me`;return n.length>0&&(r+=`?${n.join(`&`)}`),e({path:r,method:`GET`,body:null},{service:`EveningDetectiveServer`,method:`GetMe`})},AddUserRole(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/users/${t.id}/role/add`,r=JSON.stringify(t),i=[],a=n;return i.length>0&&(a+=`?${i.join(`&`)}`),e({path:a,method:`POST`,body:r},{service:`EveningDetectiveServer`,method:`AddUserRole`})},DeleteUserRole(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/users/${t.id}/role/delete`,r=JSON.stringify(t),i=[],a=n;return i.length>0&&(a+=`?${i.join(`&`)}`),e({path:a,method:`POST`,body:r},{service:`EveningDetectiveServer`,method:`DeleteUserRole`})},GetPermissions(t){let n=[],r=`api/ui/permissions`;return n.length>0&&(r+=`?${n.join(`&`)}`),e({path:r,method:`GET`,body:null},{service:`EveningDetectiveServer`,method:`GetPermissions`})},UploadFile(t){let n=JSON.stringify(t),r=[],i=`api/files/upload`;return r.length>0&&(i+=`?${r.join(`&`)}`),e({path:i,method:`POST`,body:n},{service:`EveningDetectiveServer`,method:`UploadFile`})},DownloadFile(t){if(!t.filename)throw Error(`missing required field request.filename`);let n=`api/files/${t.filename}`,r=[],i=n;return r.length>0&&(i+=`?${r.join(`&`)}`),e({path:i,method:`GET`,body:null},{service:`EveningDetectiveServer`,method:`DownloadFile`})},AddScenario(t){let n=JSON.stringify(t),r=[],i=`api/scenario`;return r.length>0&&(i+=`?${r.join(`&`)}`),e({path:i,method:`POST`,body:n},{service:`EveningDetectiveServer`,method:`AddScenario`})},GetMyScenarios(t){let n=[],r=`api/my-scenarios`;return n.length>0&&(r+=`?${n.join(`&`)}`),e({path:r,method:`GET`,body:null},{service:`EveningDetectiveServer`,method:`GetMyScenarios`})},GetScenariosCatalog(t){let n=[],r=`api/catalog`;return n.length>0&&(r+=`?${n.join(`&`)}`),e({path:r,method:`GET`,body:null},{service:`EveningDetectiveServer`,method:`GetScenariosCatalog`})},GetFullScenario(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/scenarios/${t.id}/full`,r=[],i=n;return r.length>0&&(i+=`?${r.join(`&`)}`),e({path:i,method:`GET`,body:null},{service:`EveningDetectiveServer`,method:`GetFullScenario`})},GetScenario(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/scenarios/${t.id}`,r=[],i=n;return r.length>0&&(i+=`?${r.join(`&`)}`),e({path:i,method:`GET`,body:null},{service:`EveningDetectiveServer`,method:`GetScenario`})},UpdateScenario(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/scenarios/${t.id}`,r=JSON.stringify(t),i=[],a=n;return i.length>0&&(a+=`?${i.join(`&`)}`),e({path:a,method:`PUT`,body:r},{service:`EveningDetectiveServer`,method:`UpdateScenario`})},PublicScenario(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/scenarios/${t.id}/public`,r=JSON.stringify(t),i=[],a=n;return i.length>0&&(a+=`?${i.join(`&`)}`),e({path:a,method:`PUT`,body:r},{service:`EveningDetectiveServer`,method:`PublicScenario`})},DraftScenario(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/scenarios/${t.id}/draft`,r=JSON.stringify(t),i=[],a=n;return i.length>0&&(a+=`?${i.join(`&`)}`),e({path:a,method:`PUT`,body:r},{service:`EveningDetectiveServer`,method:`DraftScenario`})},DeleteScenario(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/scenarios/${t.id}`,r=[],i=n;return r.length>0&&(i+=`?${r.join(`&`)}`),e({path:i,method:`DELETE`,body:null},{service:`EveningDetectiveServer`,method:`DeleteScenario`})},AddScenarioPlace(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/scenarios/${t.id}/places`,r=JSON.stringify(t),i=[],a=n;return i.length>0&&(a+=`?${i.join(`&`)}`),e({path:a,method:`POST`,body:r},{service:`EveningDetectiveServer`,method:`AddScenarioPlace`})},UpdateScenarioPlace(t){if(!t.id)throw Error(`missing required field request.id`);if(!t.code)throw Error(`missing required field request.code`);let n=`api/scenarios/${t.id}/places/${t.code}`,r=JSON.stringify(t),i=[],a=n;return i.length>0&&(a+=`?${i.join(`&`)}`),e({path:a,method:`PUT`,body:r},{service:`EveningDetectiveServer`,method:`UpdateScenarioPlace`})},DeleteScenarioPlace(t){if(!t.id)throw Error(`missing required field request.id`);if(!t.code)throw Error(`missing required field request.code`);let n=`api/scenarios/${t.id}/places/${t.code}`,r=[],i=n;return r.length>0&&(i+=`?${r.join(`&`)}`),e({path:i,method:`DELETE`,body:null},{service:`EveningDetectiveServer`,method:`DeleteScenarioPlace`})},AddScenarioQuestion(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/scenarios/${t.id}/questions`,r=JSON.stringify(t),i=[],a=n;return i.length>0&&(a+=`?${i.join(`&`)}`),e({path:a,method:`POST`,body:r},{service:`EveningDetectiveServer`,method:`AddScenarioQuestion`})},UpdateScenarioQuestion(t){if(!t.id)throw Error(`missing required field request.id`);if(!t.code)throw Error(`missing required field request.code`);let n=`api/scenarios/${t.id}/questions/${t.code}`,r=JSON.stringify(t),i=[],a=n;return i.length>0&&(a+=`?${i.join(`&`)}`),e({path:a,method:`PUT`,body:r},{service:`EveningDetectiveServer`,method:`UpdateScenarioQuestion`})},DeleteScenarioQuestion(t){if(!t.id)throw Error(`missing required field request.id`);if(!t.code)throw Error(`missing required field request.code`);let n=`api/scenarios/${t.id}/questions/${t.code}`,r=[],i=n;return r.length>0&&(i+=`?${r.join(`&`)}`),e({path:i,method:`DELETE`,body:null},{service:`EveningDetectiveServer`,method:`DeleteScenarioQuestion`})},UpdateScenarioIntro(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/scenarios/${t.id}/introduction`,r=JSON.stringify(t),i=[],a=n;return i.length>0&&(a+=`?${i.join(`&`)}`),e({path:a,method:`PUT`,body:r},{service:`EveningDetectiveServer`,method:`UpdateScenarioIntro`})},DownloadScenarioArchive(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/scenarios/${t.id}/archive`,r=[],i=n;return r.length>0&&(i+=`?${r.join(`&`)}`),e({path:i,method:`GET`,body:null},{service:`EveningDetectiveServer`,method:`DownloadScenarioArchive`})},UploadScenarioArchive(t){let n=JSON.stringify(t),r=[],i=`api/scenarios/archive`;return r.length>0&&(i+=`?${r.join(`&`)}`),e({path:i,method:`POST`,body:n},{service:`EveningDetectiveServer`,method:`UploadScenarioArchive`})},AddGame(t){let n=JSON.stringify(t),r=[],i=`api/games`;return r.length>0&&(i+=`?${r.join(`&`)}`),e({path:i,method:`POST`,body:n},{service:`EveningDetectiveServer`,method:`AddGame`})},GetGames(t){let n=[],r=`api/games`;return n.length>0&&(r+=`?${n.join(`&`)}`),e({path:r,method:`GET`,body:null},{service:`EveningDetectiveServer`,method:`GetGames`})},GetGame(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/games/${t.id}`,r=[],i=n;return r.length>0&&(i+=`?${r.join(`&`)}`),e({path:i,method:`GET`,body:null},{service:`EveningDetectiveServer`,method:`GetGame`})},GetGameAnswers(t){if(!t.gameId)throw Error(`missing required field request.gameId`);let n=`api/games/${t.gameId}/answers`,r=[],i=n;return r.length>0&&(i+=`?${r.join(`&`)}`),e({path:i,method:`GET`,body:null},{service:`EveningDetectiveServer`,method:`GetGameAnswers`})},UpdateGame(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/games/${t.id}`,r=JSON.stringify(t),i=[],a=n;return i.length>0&&(a+=`?${i.join(`&`)}`),e({path:a,method:`PUT`,body:r},{service:`EveningDetectiveServer`,method:`UpdateGame`})},StartGame(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/games/${t.id}/start`,r=JSON.stringify(t),i=[],a=n;return i.length>0&&(a+=`?${i.join(`&`)}`),e({path:a,method:`PUT`,body:r},{service:`EveningDetectiveServer`,method:`StartGame`})},PauseGame(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/games/${t.id}/pause`,r=JSON.stringify(t),i=[],a=n;return i.length>0&&(a+=`?${i.join(`&`)}`),e({path:a,method:`PUT`,body:r},{service:`EveningDetectiveServer`,method:`PauseGame`})},PlayGame(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/games/${t.id}/play`,r=JSON.stringify(t),i=[],a=n;return i.length>0&&(a+=`?${i.join(`&`)}`),e({path:a,method:`PUT`,body:r},{service:`EveningDetectiveServer`,method:`PlayGame`})},FinishGame(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/games/${t.id}/finish`,r=JSON.stringify(t),i=[],a=n;return i.length>0&&(a+=`?${i.join(`&`)}`),e({path:a,method:`PUT`,body:r},{service:`EveningDetectiveServer`,method:`FinishGame`})},ResetGame(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/games/${t.id}/reset`,r=JSON.stringify(t),i=[],a=n;return i.length>0&&(a+=`?${i.join(`&`)}`),e({path:a,method:`PUT`,body:r},{service:`EveningDetectiveServer`,method:`ResetGame`})},DeleteGame(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/games/${t.id}`,r=[],i=n;return r.length>0&&(i+=`?${r.join(`&`)}`),e({path:i,method:`DELETE`,body:null},{service:`EveningDetectiveServer`,method:`DeleteGame`})},AddTeam(t){let n=JSON.stringify(t),r=[],i=`api/teams`;return r.length>0&&(i+=`?${r.join(`&`)}`),e({path:i,method:`POST`,body:n},{service:`EveningDetectiveServer`,method:`AddTeam`})},UpdateTeam(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/teams/${t.id}`,r=JSON.stringify(t),i=[],a=n;return i.length>0&&(a+=`?${i.join(`&`)}`),e({path:a,method:`PUT`,body:r},{service:`EveningDetectiveServer`,method:`UpdateTeam`})},DeleteTeam(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/teams/${t.id}`,r=[],i=n;return r.length>0&&(i+=`?${r.join(`&`)}`),e({path:i,method:`DELETE`,body:null},{service:`EveningDetectiveServer`,method:`DeleteTeam`})},GiveTeamApplications(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/teams/${t.id}/applications`,r=JSON.stringify(t),i=[],a=n;return i.length>0&&(a+=`?${i.join(`&`)}`),e({path:a,method:`POST`,body:r},{service:`EveningDetectiveServer`,method:`GiveTeamApplications`})},GetTeamStory(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/teams/${t.id}/story`,r=[];t.password&&r.push(`password=${encodeURIComponent(t.password.toString())}`);let i=n;return r.length>0&&(i+=`?${r.join(`&`)}`),e({path:i,method:`GET`,body:null},{service:`EveningDetectiveServer`,method:`GetTeamStory`})},AddTeamAction(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/teams/${t.id}/actions`,r=JSON.stringify(t),i=[],a=n;return i.length>0&&(a+=`?${i.join(`&`)}`),e({path:a,method:`POST`,body:r},{service:`EveningDetectiveServer`,method:`AddTeamAction`})},DeleteLastTeamAction(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/teams/${t.id}/last-actions`,r=[],i=n;return r.length>0&&(i+=`?${r.join(`&`)}`),e({path:i,method:`DELETE`,body:null},{service:`EveningDetectiveServer`,method:`DeleteLastTeamAction`})},GetTeamAnswers(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/teams/${t.id}/answers`,r=[];t.password&&r.push(`password=${encodeURIComponent(t.password.toString())}`);let i=n;return r.length>0&&(i+=`?${r.join(`&`)}`),e({path:i,method:`GET`,body:null},{service:`EveningDetectiveServer`,method:`GetTeamAnswers`})},SubmitTeamAnswers(t){if(!t.id)throw Error(`missing required field request.id`);let n=`api/teams/${t.id}/answers`,r=JSON.stringify(t),i=[],a=n;return i.length>0&&(a+=`?${i.join(`&`)}`),e({path:a,method:`POST`,body:r},{service:`EveningDetectiveServer`,method:`SubmitTeamAnswers`})},SetTeamAnswerScore(t){if(!t.id)throw Error(`missing required field request.id`);if(!t.questionCode)throw Error(`missing required field request.questionCode`);let n=`api/teams/${t.id}/answers/${t.questionCode}/score`,r=JSON.stringify(t),i=[],a=n;return i.length>0&&(a+=`?${i.join(`&`)}`),e({path:a,method:`PUT`,body:r},{service:`EveningDetectiveServer`,method:`SetTeamAnswerScore`})}}}function b(e,t){return y(x(e,t))}function x(e,t){return async n=>{let r=`${S()}/${n.path}`,i={"Content-Type":`application/json`},a=e?.();a&&(i.Authorization=`Bearer ${a}`);let o=t?.();o&&Object.assign(i,o);let s=await fetch(r,{method:n.method,headers:i,body:n.body});if(s.status==401)throw Error(`unauthorized`);return await s.json()}}function S(){return`https://evening-detective.crabs-games.art`}var C=d(`auth`,()=>{let e=p(null),t=p(null),n=p(null),r=p(!1),i=p(null),a=h(()=>!!e.value),o=h(()=>n.value?.username||``),s=h(()=>n.value?.roles||[]);function c(){let n=localStorage.getItem(`accessToken`),r=localStorage.getItem(`refreshToken`);n&&(e.value=n,t.value=r,u())}function l(){return e.value}async function u(){if(e.value)try{let e=await b(l).GetMe({});if(e.error){i.value=e.error;return}e.user&&(n.value=e.user)}catch(e){console.error(`Failed to fetch user:`,e),e instanceof Error&&e.message.includes(`401`)&&await v()}}async function d(n,a){r.value=!0,i.value=null;try{let r=await b(l).Login({email:n,password:a});return r.error?(i.value=r.error,!1):r.accessToken?(e.value=r.accessToken,t.value=r.refreshToken||null,localStorage.setItem(`accessToken`,r.accessToken),r.refreshToken&&localStorage.setItem(`refreshToken`,r.refreshToken),await u(),!0):!1}catch(e){return i.value=e instanceof Error?e.message:`Login failed`,!1}finally{r.value=!1}}async function f(){if(!t.value)return!1;try{let n=await b(l).Refresh({refreshToken:t.value});return n.error||!n.accessToken?!1:(e.value=n.accessToken,t.value=n.refreshToken||null,localStorage.setItem(`accessToken`,n.accessToken),n.refreshToken&&localStorage.setItem(`refreshToken`,n.refreshToken),!0)}catch{return!1}}async function m(e,t,n,a){r.value=!0,i.value=null;try{let r=await b(l).Signup({username:e,email:t,acceptTerms:n,acceptPrivacy:a});return r.error?(i.value=r.error,!1):!0}catch(e){return i.value=e instanceof Error?e.message:`Signup failed`,!1}finally{r.value=!1}}async function g(e){r.value=!0,i.value=null;try{let t=await b(l,()=>({"X-Password":e})).DeleteAccount({});return t.error?(i.value=t.error,!1):(await v(),!0)}catch(e){return i.value=e instanceof Error?e.message:`Account deletion failed`,!1}finally{r.value=!1}}async function _(e){r.value=!0,i.value=null;try{let t=await b(l).RefreshPassword({email:e});return t.error?(i.value=t.error,!1):!0}catch(e){return i.value=e instanceof Error?e.message:`Password reset failed`,!1}finally{r.value=!1}}async function v(){e.value=null,t.value=null,n.value=null,i.value=null,localStorage.removeItem(`accessToken`),localStorage.removeItem(`refreshToken`)}function y(e){return s.value.includes(e)}function x(e){return e.some(e=>s.value.includes(e))}return{accessToken:e,refreshToken:t,user:n,isLoading:r,error:i,isAuthenticated:a,username:o,userRoles:s,initFromStorage:c,getToken:l,login:d,signup:m,deleteAccount:g,refreshPassword:_,logout:v,fetchUser:u,refreshTokenAction:f,hasRole:y,hasAnyRole:x}});function w(){let e=C();return T(e.refreshTokenAction,e.getToken)}function T(e,t){return y(E(e,x(t)))}function E(e,t){return async n=>{try{return await t(n)}catch{return await e(),await t(n)}}}var ee={xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,viewBox:`0 0 24 24`},te=t({name:`MenuOutlined`,render:function(e,t){return o(),i(`svg`,ee,t[0]||=[v(`path`,{d:`M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z`,fill:`currentColor`},null,-1)])}});function ne(e){let t=0;for(let n=0;n<e.length;++n)e[n]===`&`&&++t;return t}var D=/\s*,(?![^(]*\))\s*/g,O=/\s+/g;function re(e,t){let n=[];return t.split(D).forEach(t=>{let r=ne(t);if(!r){e.forEach(e=>{n.push((e&&e+` `)+t)});return}else if(r===1){e.forEach(e=>{n.push(t.replace(`&`,e))});return}let i=[t];for(;r--;){let t=[];i.forEach(n=>{e.forEach(e=>{t.push(n.replace(`&`,e))})}),i=t}i.forEach(e=>n.push(e))}),n}function k(e,t){let n=[];return t.split(D).forEach(t=>{e.forEach(e=>{n.push((e&&e+` `)+t)})}),n}function ie(e){let t=[``];return e.forEach(e=>{e&&=e.trim(),e&&(t=e.includes(`&`)?re(t,e):k(t,e))}),t.join(`, `).replace(O,` `)}var ae=/[A-Z]/g;function A(e){return e.replace(ae,e=>`-`+e.toLowerCase())}function j(e,t=` `){return typeof e==`object`&&e?` {
|
|
`+Object.entries(e).map(e=>t+` ${A(e[0])}: ${e[1]};`).join(`
|
|
`)+`
|
|
`+t+`}`:`: ${e};`}function M(e,t,n){return typeof e==`function`?e({context:t.context,props:n}):e}function N(e,t,n,r){if(!t)return``;let i=M(t,n,r);if(!i)return``;if(typeof i==`string`)return`${e} {\n${i}\n}`;let a=Object.keys(i);if(a.length===0)return n.config.keepEmptyBlock?e+` {
|
|
}`:``;let o=e?[e+` {`]:[];return a.forEach(e=>{let t=i[e];if(e===`raw`){o.push(`
|
|
`+t+`
|
|
`);return}e=A(e),t!=null&&o.push(` ${e}${j(t)}`)}),e&&o.push(`}`),o.join(`
|
|
`)}function P(e,t,n){e&&e.forEach(e=>{if(Array.isArray(e))P(e,t,n);else if(typeof e==`function`){let r=e(t);Array.isArray(r)?P(r,t,n):r&&n(r)}else e&&n(e)})}function F(e,t,n,r,i,a){let o=e.$;!o||typeof o==`string`?t.push(o):typeof o==`function`?t.push(o({context:r.context,props:i})):(o.before&&o.before(r.context),!o.$||typeof o.$==`string`?t.push(o.$):o.$&&t.push(o.$({context:r.context,props:i})));let s=ie(t),c=N(s,e.props,r,i);a&&c&&a.insertRule(c),!a&&c.length&&n.push(c),e.children&&P(e.children,{context:r.context,props:i},e=>{if(typeof e==`string`){let t=N(s,{raw:e},r,i);a?a.insertRule(t):n.push(t)}else F(e,t,n,r,i,a)}),t.pop(),o&&o.after&&o.after(r.context)}function I(e,t,n,r=!1){let i=[];return F(e,[],i,t,n,r?e.instance.__styleSheet:void 0),r?``:i.join(`
|
|
|
|
`)}function L(e){if(!e)return;let t=e.parentElement;t&&t.removeChild(e)}function R(e){return document.querySelector(`style[cssr-id="${e}"]`)}function z(e){let t=document.createElement(`style`);return t.setAttribute(`cssr-id`,e),t}window&&(window.__cssrContext={});function B(e){let t=e.getAttribute(`mount-count`);return t===null?null:Number(t)}function V(e,t){e.setAttribute(`mount-count`,String(t))}function H(e,t,n,r){let{els:i}=t;if(n===void 0)i.forEach(L),t.els=[];else{let e=R(n);if(e&&i.includes(e)){let a=B(e);r?a===null?console.error(`[css-render/unmount]: The style with target='${n}' is mounted in count mode.`):a<=1?(L(e),t.els=i.filter(t=>t!==e)):V(e,a-1):a===null?(L(e),t.els=i.filter(t=>t!==e)):console.error(`[css-render/unmount]: The style with target='${n}' is mounted in no-count mode.`)}}}function U(e,t){e.push(t)}function W(e,t,n,r,i,a,o,s,c){if(o&&!c){if(n===void 0){console.error("[css-render/mount]: `id` is required in `boost` mode.");return}let i=window.__cssrContext;i[n]||(i[n]=!0,I(t,e,r,o));return}let l,{els:u}=t,d;if(n===void 0&&(d=t.render(r),n=m(d)),c){c(n,d??t.render(r));return}let f=R(n);if(s||f===null){if(l=f===null?z(n):f,d===void 0&&(d=t.render(r)),l.textContent=d,f!==null)return;if(i){let e=document.head.getElementsByTagName(`style`)[0]||null;document.head.insertBefore(l,e)}else document.head.appendChild(l);a&&V(l,1),U(u,l)}else{let e=B(f);a?e===null?console.error(`[css-render/mount]: The style with id='${n}' has been mounted in no-count mode.`):V(f,e+1):e!==null&&console.error(`[css-render/mount]: The style with id='${n}' has been mounted in count mode.`)}return f??l}function G(e){return I(this,this.instance,e)}function K(e={}){let{target:t,id:n,ssr:r,props:i,count:a=!1,head:o=!1,boost:s=!1,force:c=!1}=e;return W(this.instance,this,n??t,i,o,a,s,c,r)}function q(e={}){let{id:t,target:n,delay:r=0,count:i=!1}=e;r===0?H(this.instance,this,t??n,i):setTimeout(()=>H(this.instance,this,t??n,i),r)}var J=function(e,t,n,r){return{instance:e,$:t,props:n,children:r,els:[],render:G,mount:K,unmount:q}},oe=function(e,t,n,r){return Array.isArray(t)?J(e,{$:null},null,t):Array.isArray(n)?J(e,t,null,n):Array.isArray(r)?J(e,t,n,r):J(e,t,n,null)};function se(e={}){let t=null,n={c:((...e)=>oe(n,...e)),use:(e,...t)=>e.install(n,...t),find:R,context:{},config:e,get __styleSheet(){if(!t){let e=document.createElement(`style`);return document.head.appendChild(e),t=document.styleSheets[document.styleSheets.length-1],t}return t}};return n}var{c:Y}=se(),ce=Y(`.xicon`,{width:`1em`,height:`1em`,display:`inline-flex`},[Y(`svg`,{width:`1em`,height:`1em`}),Y(`svg:not([fill])`,{fill:`currentColor`})]),le=()=>{ce.mount({id:`xicons-icon`})},X={size:[String,Number],color:String,tag:String},Z=Symbol(`IconConfigInjection`);t({name:`IconConfigProvider`,props:X,setup(e,{slots:t}){return r(Z,e),()=>s(t,`default`)}});var ue=`span`,Q=t({name:`Icon`,props:X,setup(t,{slots:r}){let i=e(Z,null),a=h(()=>{let e=t.size??i?.size;if(e!==void 0)return typeof e==`number`||/^\d+$/.test(e)?`${e}px`:e}),o=h(()=>{let{color:e}=t;return e===void 0?i?i.color:void 0:e}),c=h(()=>{let{tag:e}=t;return e===void 0?i?.tag??ue:e});return n(()=>{le()}),()=>u(c.value,{class:`xicon`,style:{color:o.value,fontSize:a.value}},[s(r,`default`)])}}),de={class:`menu-block`},fe={class:`right-group`},pe=t({__name:`HeaderMenu`,props:{active:{type:String,required:!1}},setup(e){let t=e,n=C();n.initFromStorage();let r=f(),s=w(),u=p([]);async function d(){u.value=[];let e=await s.GetPermissions({});u.value=e.permissions}d();function m(e){return u.value.includes(e)}let h=()=>{r.push(`/login`)},y=()=>{n.logout(),r.push(`/login`)},b=p(!1);return(e,s)=>(o(),i(`div`,de,[v(`div`,{onClick:s[0]||=e=>b.value=!b.value,class:`burger-button`},[a(l(Q),{class:`burger-icon`,size:`28`},{default:c(()=>[a(l(te))]),_:1})]),v(`div`,{class:g([`left-group menu-buttons-block`,b.value?``:`menu-buttons-block-active`])},[v(`div`,{class:g([`menu-item-block`,{active:t.active==`main`}]),onClick:s[1]||=e=>l(r).push(`/`)},` Главная `,2),l(n).hasRole(`user`)?(o(),i(`div`,{key:0,class:g([`menu-item-block`,{active:t.active==`office`}]),onClick:s[2]||=e=>l(r).push(`/office`)},` Кабинет `,2)):_(``,!0),m(`games_page`)?(o(),i(`div`,{key:1,class:g([`menu-item-block`,{active:t.active==`games`}]),onClick:s[3]||=e=>l(r).push(`/games`)},` Игры `,2)):_(``,!0),v(`div`,{class:g([`menu-item-block`,{active:t.active==`catalog`}]),onClick:s[4]||=e=>l(r).push(`/catalog`)},` Каталог `,2),m(`scenarios_page`)?(o(),i(`div`,{key:2,class:g([`menu-item-block`,{active:t.active==`scenarios`}]),onClick:s[5]||=e=>l(r).push(`/scenarios`)},` Мои сценарии `,2)):_(``,!0),m(`users_page`)?(o(),i(`div`,{key:3,class:g([`menu-item-block`,{active:t.active==`users`}]),onClick:s[6]||=e=>l(r).push(`/users`)},` Пользователи `,2)):_(``,!0)],2),v(`div`,fe,[l(n).isAuthenticated?_(``,!0):(o(),i(`div`,{key:0,class:`menu-item-block right`,onClick:h},` Войти `)),l(n).isAuthenticated?(o(),i(`div`,{key:1,class:`menu-item-block right`,onClick:y},` Выйти `)):_(``,!0)])]))}}),$=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},me=$(pe,[[`__scopeId`,`data-v-97c2db91`]]);export{C as a,w as i,$ as n,S as o,Q as r,me as t}; |