/* Copyright © 2024 Melbet - All Rights Reserved */ import{useRouter as O,useRoute as y,useLogger as v,useGlobalStore as w,trimChar as p}from"./entry-Bl6dkD65.js";import{unref as g}from"../../../../shared-assets/__shared_vue_deps_SRT2KB67.js";import{useBettingChangeRouteMethods as P}from"./BMeLkXmUL-Ra.js";import{equalComputed as b}from"./CZcj_cIfF7j7.js";var B=Object.defineProperty,i=Object.getOwnPropertySymbols,j=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable,m=(t,e,r)=>e in t?B(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,C=(t,e)=>{for(var r in e||(e={}))j.call(e,r)&&m(t,r,e[r]);if(i)for(var r of i(e))S.call(e,r)&&m(t,r,e[r]);return t};const G=()=>{const t=O(),e=y(),r=v(),f=w(),{getBettingRoute:s,getBettingRouteUrl:E,changeBettingRoute:I}=P(),h=b(()=>g(e).path),R=n=>{const o=s(C({lng:f.language},n)),_=[...t.getRoutes().find(({name:a})=>a===o.name).path.matchAll(/:(\w+)/g)].map(([,a])=>a),d=Object.entries(o.params).filter(([a])=>_.includes(a));return{name:o.name,params:Object.fromEntries(d)}},u=n=>{const{href:o=""}=t.resolve(s(n));return o};return{getRoute:R,getRouteUrl:u,changeRoute:async n=>{const o=u(n);if(p(g(h),"/")===p(o,"/"))return;const c=n.routerReplace?()=>t.replace(o):()=>t.push(o);try{await c()}catch(l){r.warn("changeBettingRoute: ",l)}}}};export{G as useBettingRoute};