vue-i18n-routing
Advanced tools
Comparing version 0.0.0-f8bb9c4 to 0.0.0-fc77992
@@ -1,2 +0,4 @@ | ||
import { Composer } from '@intlify/vue-i18n-bridge'; | ||
import type { Composer } from '@intlify/vue-i18n-bridge'; | ||
import { EffectScope } from 'vue-demi'; | ||
import type { ExportedGlobalComposer } from '@intlify/vue-i18n-bridge'; | ||
import type { I18n } from '@intlify/vue-i18n-bridge'; | ||
@@ -6,7 +8,7 @@ import type { Locale } from '@intlify/vue-i18n-bridge'; | ||
import type { Ref } from 'vue-demi'; | ||
import type { Route as Route_2 } from '@intlify/vue-router-bridge'; | ||
import { Route } from '@intlify/vue-router-bridge'; | ||
import type { RouteConfig } from '@intlify/vue-router-bridge'; | ||
import type { RouteLocation } from '@intlify/vue-router-bridge'; | ||
import type { RouteLocationNormalized } from '@intlify/vue-router-bridge'; | ||
import type { RouteLocationNormalizedLoaded } from '@intlify/vue-router-bridge'; | ||
import { RouteLocationNormalized } from '@intlify/vue-router-bridge'; | ||
import { RouteLocationNormalizedLoaded } from '@intlify/vue-router-bridge'; | ||
import type { RouteLocationRaw } from '@intlify/vue-router-bridge'; | ||
@@ -72,3 +74,3 @@ import type { Router } from '@intlify/vue-router-bridge'; | ||
export declare function createLocaleFromRouteGetter(localeCodes: string[], routesNameSeparator: string, defaultLocaleRouteNameSuffix: string): (route: Route_2 | RouteLocationNormalizedLoaded | RouteLocationNormalized | string) => string; | ||
export declare function createLocaleFromRouteGetter(localeCodes: string[], routesNameSeparator: string, defaultLocaleRouteNameSuffix: string): (route: Route | RouteLocationNormalizedLoaded | RouteLocationNormalized | string) => string; | ||
@@ -94,2 +96,16 @@ /** | ||
export declare const DEFAULT_BASE_URL = ""; | ||
export declare const DEFAULT_DETECTION_DIRECTION = "ltr"; | ||
export declare const DEFAULT_LOCALE = ""; | ||
export declare const DEFAULT_LOCALE_ROUTE_NAME_SUFFIX = "default"; | ||
export declare const DEFAULT_ROUTES_NAME_SEPARATOR = "___"; | ||
export declare const DEFAULT_STRATEGY: "prefix_except_default"; | ||
export declare const DEFAULT_TRAILING_SLASH = false; | ||
/** | ||
@@ -100,2 +116,20 @@ * Direction | ||
export declare type ExtendComposerHook = (compser: Composer) => void; | ||
export declare type ExtendExportedGlobalHook = (global: Composer) => ExtendProperyDescripters; | ||
export declare interface ExtendHooks { | ||
onExtendComposer?: ExtendComposerHook; | ||
onExtendExportedGlobal?: ExtendExportedGlobalHook; | ||
onExtendVueI18n?: ExtendVueI18nHook; | ||
} | ||
export declare function extendI18n<TI18n extends I18n>(i18n: TI18n, { locales, localeCodes, baseUrl, hooks }?: VueI18nExtendOptions): EffectScope; | ||
export declare type ExtendProperyDescripters = { | ||
[key: string]: Pick<PropertyDescriptor, 'get'>; | ||
}; | ||
export declare type ExtendVueI18nHook = (composer: Composer) => ExtendProperyDescripters; | ||
/** | ||
@@ -121,2 +155,11 @@ * Find the browser locale | ||
/** | ||
* Get global i18n routing options | ||
* | ||
* @param router - A router instance, about router type | ||
* | ||
* @returns - {@link I18nRoutingGlobalOptions | global options} from i18n routing options registory, if registered, return it, else empty object | ||
*/ | ||
export declare function getGlobalOptions(router: Router | VueRouter): I18nRoutingGlobalOptions; | ||
/** | ||
* Get a locale | ||
@@ -130,9 +173,14 @@ * | ||
export declare function getRouteBaseName(this: RoutingProxy, givenRoute?: Route_2 | RouteLocationNormalizedLoaded): string | undefined; | ||
export declare function getLocaleCodes(i18n: I18n | VueI18n | Composer): string[]; | ||
/** | ||
* Options for vue-i18n-routing common | ||
*/ | ||
export declare type I18nCommonRoutingOptions = Pick<I18nRoutingOptions, 'defaultLocale' | 'strategy' | 'defaultLocaleRouteNameSuffix' | 'trailingSlash' | 'locales' | 'routesNameSeparator'> & ComposableOptions; | ||
export declare function getLocales(i18n: I18n | VueI18n | Composer): string[] | LocaleObject[]; | ||
export declare function getLocalesRegex(localeCodes: string[]): RegExp; | ||
export declare function getRouteBaseName(this: RoutingProxy, givenRoute?: Route | RouteLocationNormalizedLoaded): string | undefined; | ||
export declare type I18nCommonRoutingOptions = Pick<I18nRoutingOptions, 'defaultLocale' | 'strategy' | 'defaultLocaleRouteNameSuffix' | 'trailingSlash' | 'locales' | 'routesNameSeparator'>; | ||
export declare type I18nCommonRoutingOptionsWithComposable = I18nCommonRoutingOptions & ComposableOptions; | ||
/** | ||
@@ -168,3 +216,3 @@ * I18n header meta info | ||
*/ | ||
export declare type I18nRoute = Route & RouteLegacy & { | ||
export declare type I18nRoute = Route_2 & RouteLegacy & { | ||
redirect?: string; | ||
@@ -174,2 +222,9 @@ }; | ||
/** | ||
* Global options for i18n routing | ||
*/ | ||
export declare type I18nRoutingGlobalOptions<BaseUrl extends BaseUrlResolveHandler = BaseUrlResolveHandler> = Pick<I18nRoutingOptions<BaseUrl>, 'defaultLocale' | 'defaultDirection' | 'defaultLocaleRouteNameSuffix' | 'trailingSlash' | 'routesNameSeparator' | 'strategy'> & { | ||
localeCodes?: string[]; | ||
}; | ||
/** | ||
* Options to initialize a VueRouter instance | ||
@@ -274,2 +329,12 @@ * | ||
export declare function isComposer(target: any): target is Composer; | ||
export declare function isExportedGlobalComposer(target: any): target is ExportedGlobalComposer; | ||
export declare function isI18nInstance(i18n: any): i18n is I18n; | ||
export declare function isLegacyVueI18n(target: any): target is Pick<VueI18n, 'locale'>; | ||
export declare function isVueI18n(target: any): target is VueI18n; | ||
export declare function localeHead(this: RoutingProxy, { addDirAttribute, addSeoAttributes }?: I18nHeadOptions): I18nHeadMetaInfo; | ||
@@ -318,3 +383,3 @@ | ||
export declare function localeRoute(this: RoutingProxy, route: RawLocation | RouteLocationRaw, locale?: Locale): Route_2 | ReturnType<Router['resolve']> | undefined; | ||
export declare function localeRoute(this: RoutingProxy, route: RawLocation | RouteLocationRaw, locale?: Locale): Route | ReturnType<Router['resolve']> | undefined; | ||
@@ -331,3 +396,3 @@ /** | ||
*/ | ||
export declare type LocaleRouteFunction = (route: RawLocation | RouteLocationRaw, locale?: Locale) => Route_2 | ReturnType<Router['resolve']> | undefined; | ||
export declare type LocaleRouteFunction = (route: RawLocation | RouteLocationRaw, locale?: Locale) => Route | ReturnType<Router['resolve']> | undefined; | ||
@@ -351,3 +416,13 @@ /** | ||
export declare function proxyVueInstance(target: Function): Function; | ||
/** | ||
* Register global i18n routing option registory | ||
* | ||
* @param router - A router instance, about router type | ||
* @param options - A global options, about options type, see {@link I18nRoutingGlobalOptions} | ||
*/ | ||
export declare function registerGlobalOptions<BaseUrl extends BaseUrlResolveHandler = BaseUrlResolveHandler>(router: Router | VueRouter, options: I18nRoutingGlobalOptions<BaseUrl>): void; | ||
/** | ||
* Resolve base url | ||
@@ -364,14 +439,16 @@ * | ||
export { Route } | ||
declare type _Route = UnionToIntersection<RouteConfig>; | ||
/** | ||
* Route config for vue-router v4 | ||
*/ | ||
export declare interface Route { | ||
declare interface Route_2 { | ||
name?: string; | ||
path: string; | ||
file?: string; | ||
children?: Route[]; | ||
children?: Route_2[]; | ||
} | ||
declare type _Route = UnionToIntersection<RouteConfig>; | ||
/** | ||
@@ -387,6 +464,10 @@ * Route config for lagacy vue-router v3 | ||
export { RouteLocationNormalized } | ||
export { RouteLocationNormalizedLoaded } | ||
/** | ||
* Resolver for route localizing options | ||
*/ | ||
export declare type RouteOptionsResolver = (route: I18nRoute, allowedLocaleCodes: string[]) => ComputedRouteOptions | null; | ||
export declare type RouteOptionsResolver = (route: I18nRoute, localeCodes: string[]) => ComputedRouteOptions | null; | ||
@@ -405,9 +486,11 @@ /** | ||
localeHead: any; | ||
route: Route_2 | RouteLocationNormalizedLoaded; | ||
route: Route | RouteLocationNormalizedLoaded; | ||
router: Router | VueRouter; | ||
__defaultLocale: string; | ||
__strategy: Strategies; | ||
__defaultLocaleRouteNameSuffix: string; | ||
__trailingSlash: boolean; | ||
__routesNameSeparator: string; | ||
defaultLocale?: string; | ||
localeCodes?: string[]; | ||
strategy?: Strategies; | ||
defaultDirection?: Directions; | ||
defaultLocaleRouteNameSuffix?: string; | ||
trailingSlash?: boolean; | ||
routesNameSeparator?: string; | ||
}; | ||
@@ -435,3 +518,3 @@ | ||
declare const STRATEGIES: { | ||
export declare const STRATEGIES: { | ||
readonly PREFIX: "prefix"; | ||
@@ -478,3 +561,3 @@ readonly PREFIX_EXCEPT_DEFAULT: "prefix_except_default"; | ||
*/ | ||
export declare function useLocaleHead({ addDirAttribute, addSeoAttributes, strategy, defaultLocale, route, router, i18n }?: Pick<I18nCommonRoutingOptions, 'strategy' | 'defaultLocale'> & ComposableOptions & I18nHeadOptions): Ref<I18nHeadMetaInfo>; | ||
export declare function useLocaleHead({ addDirAttribute, addSeoAttributes, strategy, defaultLocale, route, router, i18n }?: Pick<I18nCommonRoutingOptionsWithComposable, 'strategy' | 'defaultLocale' | 'route' | 'router' | 'i18n'> & I18nHeadOptions): Ref<I18nHeadMetaInfo>; | ||
@@ -488,3 +571,3 @@ /** | ||
*/ | ||
export declare function useLocaleLocation({ router, route, i18n, defaultLocale, defaultLocaleRouteNameSuffix, routesNameSeparator, strategy, trailingSlash }?: I18nCommonRoutingOptions): LocaleLocationFunction; | ||
export declare function useLocaleLocation({ router, route, i18n, defaultLocale, defaultLocaleRouteNameSuffix, routesNameSeparator, strategy, trailingSlash }?: I18nCommonRoutingOptionsWithComposable): LocaleLocationFunction; | ||
@@ -498,3 +581,3 @@ /** | ||
*/ | ||
export declare function useLocalePath({ router, route, i18n, defaultLocale, defaultLocaleRouteNameSuffix, routesNameSeparator, strategy, trailingSlash }?: I18nCommonRoutingOptions): LocalePathFunction; | ||
export declare function useLocalePath({ router, route, i18n, defaultLocale, defaultLocaleRouteNameSuffix, routesNameSeparator, strategy, trailingSlash }?: I18nCommonRoutingOptionsWithComposable): LocalePathFunction; | ||
@@ -508,3 +591,3 @@ /** | ||
*/ | ||
export declare function useLocaleRoute({ router, route, i18n, defaultLocale, defaultLocaleRouteNameSuffix, routesNameSeparator, strategy, trailingSlash }?: I18nCommonRoutingOptions): LocaleRouteFunction; | ||
export declare function useLocaleRoute({ router, route, i18n, defaultLocale, defaultLocaleRouteNameSuffix, routesNameSeparator, strategy, trailingSlash }?: I18nCommonRoutingOptionsWithComposable): LocaleRouteFunction; | ||
@@ -519,3 +602,3 @@ /** | ||
*/ | ||
export declare function useRouteBaseName(givenRoute?: Route_2 | RouteLocationNormalizedLoaded, { router, routesNameSeparator }?: I18nCommonRoutingOptions): string | undefined; | ||
export declare function useRouteBaseName(givenRoute?: Route | RouteLocationNormalizedLoaded, { router, routesNameSeparator }?: I18nCommonRoutingOptionsWithComposable): string | undefined; | ||
@@ -529,3 +612,3 @@ /** | ||
*/ | ||
export declare function useSwitchLocalePath({ router, route, i18n, defaultLocale, defaultLocaleRouteNameSuffix, routesNameSeparator, strategy, trailingSlash }?: I18nCommonRoutingOptions): SwitchLocalePathFunction; | ||
export declare function useSwitchLocalePath({ router, route, i18n, defaultLocale, defaultLocaleRouteNameSuffix, routesNameSeparator, strategy, trailingSlash }?: I18nCommonRoutingOptionsWithComposable): SwitchLocalePathFunction; | ||
@@ -540,67 +623,49 @@ /** | ||
export { } | ||
import type { ComputedRef } from 'vue-demi' | ||
export declare type VueI18nExtendOptions = Pick<I18nRoutingOptions, 'baseUrl'> & { | ||
locales?: string[] | LocaleObject[]; | ||
localeCodes?: string[]; | ||
hooks?: ExtendHooks; | ||
}; | ||
// declare module 'vue-i18n' { | ||
// export interface ComposerCustom { | ||
// /** | ||
// * List of locales | ||
// * | ||
// * @defaultValue `undefined` | ||
// */ | ||
// locales?: ComputedRef<string[] | LocaleObject[]> | ||
// /** | ||
// * List of locale codes | ||
// * | ||
// * @defaultValue `undefined` | ||
// */ | ||
// localeCodes?: ComputedRef<string[]> | ||
// __baseUrl?: string | ||
// } | ||
// } | ||
declare module 'vue-i18n-bridge' { | ||
export interface VueI18n { | ||
locales: string[] | LocaleObject[] | ||
localeCodes: string[] | ||
__baseUrl: string | ||
} | ||
export interface ComposerCustom { | ||
/** | ||
* An options of Vue I18n Routing Plugin | ||
*/ | ||
export declare interface VueI18nRoutingPluginOptions { | ||
/** | ||
* List of locales | ||
* Whether to inject some option APIs style methods into Vue instance | ||
* | ||
* @defaultValue `undefined` | ||
* @defaultValue `true` | ||
*/ | ||
locales?: ComputedRef<string[] | LocaleObject[]> | ||
/** | ||
* List of locale codes | ||
* | ||
* @defaultValue `undefined` | ||
*/ | ||
localeCodes?: ComputedRef<string[]> | ||
__baseUrl?: string | ||
} | ||
inject?: boolean; | ||
} | ||
declare module '@intlify/vue-i18n-bridge' { | ||
export interface VueI18n { | ||
locales: string[] | LocaleObject[] | ||
localeCodes: string[] | ||
__baseUrl: string | ||
} | ||
export { } | ||
import type { ComputedRef } from 'vue-demi' | ||
export interface ComposerCustom { | ||
/** | ||
* List of locales | ||
* | ||
* @defaultValue `[]` | ||
*/ | ||
locales: ComputedRef<string[] | LocaleObject[]> | ||
/** | ||
* List of locale codes | ||
* | ||
* @defaultValue `[]` | ||
*/ | ||
localeCodes: ComputedRef<string[]> | ||
__baseUrl: string | ||
} | ||
export interface ComposerCustomProperties { | ||
/** | ||
* List of locales | ||
* | ||
* @remarks | ||
* Can either be an array of string codes (e.g. `['en', 'fr']`) or an array of {@link LocaleObject} for more complex configurations | ||
*/ | ||
locales: ComputedRef<string[] | LocaleObject[]> | ||
/** | ||
* List of locale codes | ||
*/ | ||
localeCodes: ComputedRef<string[]> | ||
__baseUrl: string | ||
} | ||
declare module 'vue-i18n' { | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface ComposerCustom extends ComposerCustomProperties {} | ||
} | ||
declare module 'vue-i18n-bridge' { | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface ComposerCustom extends ComposerCustomProperties {} | ||
} | ||
declare module '@intlify/vue-i18n-bridge' { | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface ComposerCustom extends ComposerCustomProperties {} | ||
} |
@@ -1,5 +0,5 @@ | ||
var nt=Object.defineProperty,ct=Object.defineProperties;var rt=Object.getOwnPropertyDescriptors;var W=Object.getOwnPropertySymbols;var Re=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable;var ge=(i,u,d)=>u in i?nt(i,u,{enumerable:!0,configurable:!0,writable:!0,value:d}):i[u]=d,U=(i,u)=>{for(var d in u||(u={}))Re.call(u,d)&&ge(i,d,u[d]);if(W)for(var d of W(u))pe.call(u,d)&&ge(i,d,u[d]);return i},Q=(i,u)=>ct(i,rt(u));var Se=(i,u)=>{var d={};for(var m in i)Re.call(i,m)&&u.indexOf(m)<0&&(d[m]=i[m]);if(i!=null&&W)for(var m of W(i))u.indexOf(m)<0&&pe.call(i,m)&&(d[m]=i[m]);return d};var VueI18nRouting=function(i,u,d,m){"use strict";function Ee(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var Pe=Ee(d);/*! | ||
* shared v9.2.0-beta.34 | ||
const VueI18nRouting=function(f,h,g,w){"use strict";const ye=(e=>e&&typeof e=="object"&&"default"in e?e:{default:e})(g),Q={PREFIX:"prefix",PREFIX_EXCEPT_DEFAULT:"prefix_except_default",PREFIX_AND_DEFAULT:"prefix_and_default",NO_PREFIX:"no_prefix"},G="",B=Q.PREFIX_EXCEPT_DEFAULT,M=!1,k="___",D="default",Y="ltr",J="";/*! | ||
* shared v9.2.2 | ||
* (c) 2022 kazuya kawaguchi | ||
* Released under the MIT License. | ||
*/const te=Object.assign,ye=Array.isArray,Ne=e=>typeof e=="function",w=e=>typeof e=="string",Ae=e=>typeof e=="symbol",oe=e=>e!==null&&typeof e=="object",Ie=/\/$|\/\?/;function v(e="",t=!1){return t?Ie.test(e):e.endsWith("/")}function we(e="",t=!1){if(!t)return(v(e)?e.slice(0,-1):e)||"/";if(!v(e,!0))return e||"/";const[o,...a]=e.split("?");return(o.slice(0,-1)||"/")+(a.length?`?${a.join("?")}`:"")}function Ce(e="",t=!1){if(!t)return e.endsWith("/")?e:e+"/";if(v(e,!0))return e||"/";const[o,...a]=e.split("?");return o+"/"+(a.length?`?${a.join("?")}`:"")}const Fe=typeof window!="undefined";function Te(e,t){typeof console!="undefined"&&(console.warn("[vue-i18n-routing] "+e),t&&console.warn(t.stack))}function ae(e){e=e||[];const t=[];for(const o of e)w(o)?t.push({code:o}):t.push(o);return t}function k(e){return e!=null&&"global"in e&&"mode"in e}function z(e){return e!=null&&!("__composer"in e)&&u.isRef(e.locale)}function x(e){return e!=null&&"__composer"in e}function Y(e){return e!=null&&!("__composer"in e)&&!u.isRef(e.locale)}function $(e){return e!=null&&("__VUE_I18N_BRIDGE__"in e||"_sync"in e)}function le(e){return k(e)?z(e.global)?e.global:e.global.__composer:x(e)?e.__composer:e}function H(e){const t=k(e)?e.global:e;return z(t)?u.isVue2&&$(e)?e.locale:t.locale.value:(Y(t)||x(t)||$(t),t.locale)}function Ue(e){const t=k(e)?e.global:e;return z(t)?u.isVue2&&$(e)?e.locales:t.locales.value:(Y(t)||x(t)||$(t),t.locales)}function ne(e,t){const o=k(e)?e.global:e;if(z(o))u.isVue2&&$(e)?e.locale=t:o.locale.value=t;else if(Y(o)||x(o)||$(o))o.locale=t;else throw new Error("TODO:")}function $e(e,t,o){return e.replace(/\/+$/,"")+(t?"/":"")||(o?"":"/")}function ce(e){return d.isVueRouter4,u.isRef(e)?e.value:e}function re(e){return w(e)?e:Ae(e)?e.toString():"(null)"}function se(e,t,{defaultLocale:o,strategy:a,routesNameSeparator:l,defaultLocaleRouteNameSuffix:n}){let c=re(e)+(a==="no_prefix"?"":l+t);return t===o&&a==="prefix_and_default"&&(c+=l+n),c}function ue(e,t){return Ne(e)?e(t):e}function be(e,t){const o=[];for(const[a,l]of t.entries()){const n=e.find(c=>c.iso.toLowerCase()===l.toLowerCase());if(n){o.push({code:n.code,score:1-a/t.length});break}}for(const[a,l]of t.entries()){const n=l.split("-")[0].toLowerCase(),c=e.find(r=>r.iso.split("-")[0].toLowerCase()===n);if(c){o.push({code:c.code,score:.999-a/t.length});break}}return o}const Oe=be;function xe(e,t){return e.score===t.score?t.code.length-e.code.length:t.score-e.score}const je=xe;function Ve(e,t,{matcher:o=Oe,comparer:a=je}={}){const l=[];for(const c of e){const{code:r}=c,s=c.iso||r;l.push({code:r,iso:s})}const n=o(l,t);return n.length>1&&n.sort(a),n.length?n[0].code:""}const j={PREFIX:"prefix",PREFIX_EXCEPT_DEFAULT:"prefix_except_default",PREFIX_AND_DEFAULT:"prefix_and_default",NO_PREFIX:"no_prefix"},A="",I=j.PREFIX_EXCEPT_DEFAULT,ie=!1,y="___",C="default",Be="ltr",fe="",Xe=new Set([j.PREFIX_AND_DEFAULT,j.PREFIX_EXCEPT_DEFAULT]);function b(e){const o=this.router.__routesNameSeparator||this.__routesNameSeparator||y,a=e!=null?u.isRef(e)?u.unref(e):e:this.route;return a.name?re(a.name).split(o)[0]:void 0}function G(e,t){const o=V.call(this,e,t);return o==null?"":u.isVue3?o.redirectedFrom||o.fullPath:o.route.redirectedFrom||o.route.fullPath}function q(e,t){const o=V.call(this,e,t);return o==null?void 0:u.isVue3?o:o.route}function J(e,t){const o=V.call(this,e,t);return o==null?void 0:u.isVue3?o:o.location}function V(e,t){const o=this.router,a=this.i18n,l=t||H(a),n=this.__defaultLocale||A,c=o.__defaultLocale||n,r=o.__defaultLocaleRouteNameSuffix||this.__defaultLocaleRouteNameSuffix||C,s=o.__routesNameSeparator||this.__routesNameSeparator||y,f=o.__strategy||this.__strategy||I,_=o.__trailingSlash||this.__trailingSlash||!1;let h=e;w(e)&&(h[0]==="/"?h={path:e}:h={name:e});let L=te({},h);if(L.path&&!L.name){const g=o.resolve(L),N=u.isVue3?g:g.route,X=b.call(this,N);w(X)?L={name:se(X,l,{defaultLocale:c,strategy:f,routesNameSeparator:s,defaultLocaleRouteNameSuffix:r}),params:N.params,query:N.query,hash:N.hash}:(!(l===n&&Xe.has(f))&&f!==j.NO_PREFIX&&(L.path=`/${l}${L.path}`),L.path=_?Ce(L.path,!0):we(L.path,!0))}else{L.name=se(L.name,l,{defaultLocale:c,strategy:f,routesNameSeparator:s,defaultLocaleRouteNameSuffix:r});const{params:g}=L;g&&g["0"]===void 0&&g.pathMatch&&(g["0"]=g.pathMatch)}const p=o.resolve(L);return(u.isVue3?p.name:p.route.name)?p:o.resolve(e)}function B(e){const t=this.route,o=b.call(this,t);if(!o)return"";const s=!u.isVue3&&u.isRef(t)?t.value:t,{params:a}=s,l=Se(s,["params"]),n={},c=te({},l,{name:o,params:Q(U(U({},a),n),{0:a.pathMatch})});return G.call(this,c,e)}function K({addDirAttribute:e=!1,addSeoAttributes:t=!1}={}){const o=this.router,a=this.i18n,l={htmlAttrs:{},link:[],meta:[]};if(a.locales==null||a.__baseUrl==null)return l;const n=H(a),c=Ue(a),r=ae(c).find(_=>_.code===n)||{code:n},s=r.iso,f=r.dir||o.__defaultDirection;return e&&(l.htmlAttrs.dir=f),t&&n&&a.locales&&(s&&(l.htmlAttrs.lang=s),Me.call(this,c,a.__baseUrl,l.link),ke.call(this,a.__baseUrl,l.link,t),ze(r,s,l.meta),He(c,s,l.meta)),l}function Me(e,t,o){const a=this.router,l=a.__defaultLocale||this.__defaultLocale;if((a.__strategy||this.__strategy)===j.NO_PREFIX)return;const c=new Map;for(const r of e){const s=r.iso;if(!s){Te("Locale ISO code is required to generate alternate link");continue}const[f,_]=s.split("-");f&&_&&(r.isCatchallLocale||!c.has(f))&&c.set(f,r),c.set(s,r)}for(const[r,s]of c.entries()){const f=B.call(this,s.code);f&&o.push({hid:`i18n-alt-${r}`,rel:"alternate",href:Z(f,t),hreflang:r})}if(l){const r=B.call(this,l);r&&o.push({hid:"i18n-xd",rel:"alternate",href:Z(r,t),hreflang:"x-default"})}}function ke(e,t,o){const a=this.route,l=q.call(this,Q(U({},a),{name:b.call(this,a)}));if(l){let n=Z(l.path,e);const c=oe(o)&&o.canonicalQueries||[];if(c.length){const r=l.query,s=new URLSearchParams;for(const _ of c)if(_ in r){const h=r[_];ye(h)?h.forEach(L=>s.append(_,L||"")):s.append(_,h||"")}const f=s.toString();f&&(n=`${n}?${f}`)}t.push({hid:"i18n-can",rel:"canonical",href:n})}}function ze(e,t,o){!(e&&t)||o.push({hid:"i18n-og",property:"og:locale",content:he(t)})}function He(e,t,o){const a=e.filter(l=>{const n=l.iso;return n&&n!==t});if(a.length){const l=a.map(n=>({hid:`i18n-og-alt-${n.iso}`,property:"og:locale:alternate",content:he(n.iso)}));o.push(...l)}}function he(e){return(e||"").replace(/-/g,"_")}function Z(e,t){return e.match(/^https?:\/\//)?e:t+e}function D(e,t){const{router:o,route:a,i18n:l,defaultLocale:n,strategy:c,defaultLocaleRouteNameSuffix:r,trailingSlash:s,routesNameSeparator:f}=e;return function(..._){return Reflect.apply(t,{router:o,route:a,i18n:l,__defaultLocale:n,__strategy:c,__defaultLocaleRouteNameSuffix:r,__trailingSlash:s,__routesNameSeparator:f},_)}}function Ge(e=d.useRoute(),{router:t=d.useRouter(),routesNameSeparator:o=y}={}){const a={router:t,route:e,__routesNameSeparator:o};return b.call(a,e)}function qe({router:e=d.useRouter(),route:t=d.useRoute(),i18n:o=m.useI18n(),defaultLocale:a=A,defaultLocaleRouteNameSuffix:l=C,routesNameSeparator:n=y,strategy:c=I,trailingSlash:r=!1}={}){return D({router:e,route:t,i18n:o,defaultLocale:a,defaultLocaleRouteNameSuffix:l,routesNameSeparator:n,strategy:c,trailingSlash:r},G)}function De({router:e=d.useRouter(),route:t=d.useRoute(),i18n:o=m.useI18n(),defaultLocale:a=A,defaultLocaleRouteNameSuffix:l=C,routesNameSeparator:n=y,strategy:c=I,trailingSlash:r=!1}={}){return D({router:e,route:t,i18n:o,defaultLocale:a,defaultLocaleRouteNameSuffix:l,routesNameSeparator:n,strategy:c,trailingSlash:r},q)}function We({router:e=d.useRouter(),route:t=d.useRoute(),i18n:o=m.useI18n(),defaultLocale:a=A,defaultLocaleRouteNameSuffix:l=C,routesNameSeparator:n=y,strategy:c=I,trailingSlash:r=!1}={}){return D({router:e,route:t,i18n:o,defaultLocale:a,defaultLocaleRouteNameSuffix:l,routesNameSeparator:n,strategy:c,trailingSlash:r},J)}function Qe({router:e=d.useRouter(),route:t=d.useRoute(),i18n:o=m.useI18n(),defaultLocale:a=A,defaultLocaleRouteNameSuffix:l=C,routesNameSeparator:n=y,strategy:c=I,trailingSlash:r=!1}={}){return D({router:e,route:t,i18n:o,defaultLocale:a,defaultLocaleRouteNameSuffix:l,routesNameSeparator:n,strategy:c,trailingSlash:r},B)}function ve({addDirAttribute:e=!1,addSeoAttributes:t=!1,strategy:o=I,defaultLocale:a=A,route:l=d.useRoute(),router:n=d.useRouter(),i18n:c=m.useI18n()}={}){const r=n,s=u.ref({htmlAttrs:{},link:[],meta:[]});function f(){s.value={htmlAttrs:{},link:[],meta:[]}}function _(h){s.value=Reflect.apply(K,{router:n,route:h,i18n:c,__defaultLocale:a,__strategy:o},[{addDirAttribute:e,addSeoAttributes:t}])}if(Fe)if(u.isVue3){const h=u.watchEffect(()=>{f(),_(ce(r.currentRoute))});u.onUnmounted(()=>h())}else{const h=r.afterEach((L,p)=>{f(),_(L)});u.onUnmounted(()=>h()),_(l)}else _(ce(r.currentRoute));return s}function de(e,{defaultLocale:t=A,strategy:o=I,trailingSlash:a=ie,routesNameSeparator:l=y,defaultLocaleRouteNameSuffix:n=C,includeUprefixedFallback:c=!1,optionsResolver:r=void 0,locales:s=[]}={}){if(o==="no_prefix")return e;const f=s.map(h=>w(h)?h:h.code);function _(h,L,p=!1,g=!1){if(h.redirect&&(!h.component||!h.file))return[h];let N=null;return r!=null&&(N=r(h,L),N==null)?[h]:L.reduce((R,S)=>{const{name:M}=h;let{path:E}=h;const P=U({},h);M&&(P.name=`${M}${l}${S}`),h.children&&(P.children=h.children.reduce((T,ee)=>[...T,..._(ee,[S],!0,g)],[]));const O=S===t;if(O&&o==="prefix_and_default")if(p)p&&g&&M&&(P.name+=`${l}${n}`);else{const T=Q(U({},P),{path:E});if(M&&(T.name=`${P.name}${l}${n}`),h.children){T.children=[];for(const ee of h.children)T.children=T.children.concat(_(ee,[S],!0,!0))}R.push(T)}const Le=p&&!E.startsWith("/"),me=!Le&&!(O&&o==="prefix_except_default");return me&&(E=`/${S}${E}`),E&&(E=$e(E,a,Le)),me&&O&&o==="prefix"&&c&&R.push(U({},h)),P.path=E,R.push(P),R},[])}return e.reduce((h,L)=>[...h,..._(L,f||[])],[])}function F(e){return function(){return Reflect.apply(e,{getRouteBaseName:this.getRouteBaseName,localePath:this.localePath,localeRoute:this.localeRoute,localeLocation:this.localeLocation,resolveRoute:this.resolveRoute,switchLocalePath:this.switchLocalePath,localeHead:this.localeHead,i18n:this.$i18n,route:this.$route,router:this.$router},arguments)}}function Ye(e,{locales:t=[],localeCodes:o=[],baseUrl:a=fe}={}){const l=e.install;e.install=(n,...c)=>{Reflect.apply(l,e,[n,...c]);const r=le(e);Je(r,{locales:t,localeCodes:o,baseUrl:a}),x(e.global)&&Ze(e.global);const s=n,f=e.mode==="composition"?u.isVue3?s.config.globalProperties.$i18n:e:u.isVue2?e:null;f&&Ke(f,r),n.mixin({methods:{resolveRoute:F(V),localePath:F(G),localeRoute:F(q),localeLocation:F(J),switchLocalePath:F(B),getRouteBaseName:F(b),localeHead:F(K)}})}}function Je(e,t){const{locales:o,localeCodes:a,baseUrl:l}=t,n=u.ref(o),c=u.ref(a);e.locales=u.computed(()=>n.value),e.localeCodes=u.computed(()=>c.value),e.__baseUrl=ue(l,{})}function Ke(e,t){Object.defineProperty(e,"locales",{get(){return t.locales.value}}),Object.defineProperty(e,"localeCodes",{get(){return t.localeCodes.value}}),Object.defineProperty(e,"__baseUrl",{get(){return t.__baseUrl}})}function Ze(e){const t=le(e);Object.defineProperty(e,"locales",{get(){return t.locales.value}}),Object.defineProperty(e,"localeCodes",{get(){return t.localeCodes.value}}),Object.defineProperty(e,"__baseUrl",{get(){return t.__baseUrl}})}function et(e,t={}){const{version:o,defaultLocale:a,locales:l,strategy:n,trailingSlash:c,routesNameSeparator:r,defaultLocaleRouteNameSuffix:s,defaultDirection:f,baseUrl:_,routes:h,routeOptionsResolver:L}=at(t),p=ae(l),g=p.map(S=>S.code),N=_e(g,r,s);Ye(e,{locales:p,baseUrl:_,localeCodes:g});const X=de(h,{locales:l,defaultLocale:a,strategy:n,trailingSlash:c,routesNameSeparator:r,defaultLocaleRouteNameSuffix:s,optionsResolver:L});t.routes=X;const R=tt(t,o);return R.__defaultLocale=a,R.__localeCodes=g,R.__strategy=n,R.__trailingSlash=c,R.__routesNameSeparator=r,R.__defaultLocaleRouteNameSuffix=s,R.__defaultDirection=f,R.beforeEach((S,M,E)=>{const P=H(e),O=N(S)||P||a||"";P!==O&&ne(e,O),E()}),R}function tt(e,t){if(u.isVue3&&t===4)return d.createRouter(e);if(u.isVue2&&t===3)return new Pe.default(e);throw new Error("TODO:")}function ot(e){return new RegExp(`^/(${e.join("|")})(?:/|$)`,"i")}function _e(e,t,o){const a=`(${e.join("|")})`,l=`(?:${t}${o})?`,n=new RegExp(`${t}${a}${l}$`,"i"),c=ot(e);return s=>{if(oe(s)){if(s.name){const _=(w(s.name)?s.name:s.name.toString()).match(n);if(_&&_.length>1)return _[1]}else if(s.path){const f=s.path.match(c);if(f&&f.length>1)return f[1]}}else if(w(s)){const f=s.match(c);if(f&&f.length>1)return f[1]}return""}}function at(e){var t,o,a,l,n,c,r,s,f,_;return e.version=(t=e.version)!=null?t:4,e.defaultLocale=(o=e.defaultLocale)!=null?o:A,e.strategy=(a=e.strategy)!=null?a:I,e.trailingSlash=(l=e.trailingSlash)!=null?l:ie,e.routesNameSeparator=(n=e.routesNameSeparator)!=null?n:y,e.defaultLocaleRouteNameSuffix=(c=e.defaultLocaleRouteNameSuffix)!=null?c:C,e.locales=(r=e.locales)!=null?r:[],e.defaultDirection=(s=e.defaultDirection)!=null?s:Be,e.baseUrl=(f=e.baseUrl)!=null?f:fe,e.routes=(_=e.routes)!=null?_:[],e}const lt="0.0.0";return i.VERSION=lt,i.createLocaleFromRouteGetter=_e,i.createRouter=et,i.findBrowserLocale=Ve,i.getLocale=H,i.getRouteBaseName=b,i.localeHead=K,i.localeLocation=J,i.localePath=G,i.localeRoute=q,i.localizeRoutes=de,i.resolveBaseUrl=ue,i.resolveRoute=V,i.setLocale=ne,i.switchLocalePath=B,i.useLocaleHead=ve,i.useLocaleLocation=We,i.useLocalePath=qe,i.useLocaleRoute=De,i.useRouteBaseName=Ge,i.useSwitchLocalePath=Qe,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),i}({},VueDemi,VueRouter,VueI18n); | ||
*/process.env.NODE_ENV;const Ie=typeof Symbol=="function"&&typeof Symbol.toStringTag=="symbol",Ce=e=>Ie?Symbol(e):e,z=Object.assign,Te=Array.isArray,Oe=e=>typeof e=="function",T=e=>typeof e=="string",Pe=e=>typeof e=="boolean",be=e=>typeof e=="symbol",K=e=>e!==null&&typeof e=="object",Ue=/\/$|\/\?/;function Z(e="",t=!1){return t?Ue.test(e):e.endsWith("/")}function Ne(e="",t=!1){if(!t)return(Z(e)?e.slice(0,-1):e)||"/";if(!Z(e,!0))return e||"/";const[o,...n]=e.split("?");return(o.slice(0,-1)||"/")+(n.length?`?${n.join("?")}`:"")}function Fe(e="",t=!1){if(!t)return e.endsWith("/")?e:e+"/";if(Z(e,!0))return e||"/";const[o,...n]=e.split("?");return o+"/"+(n.length?`?${n.join("?")}`:"")}const we=typeof window<"u";function ae(e,t){typeof console<"u"&&(console.warn("[vue-i18n-routing] "+e),t&&console.warn(t.stack))}function ce(e){e=e||[];const t=[];for(const o of e)T(o)?t.push({code:o}):t.push(o);return t}function U(e){return e!=null&&"global"in e&&"mode"in e}function N(e){return e!=null&&!("__composer"in e)&&h.isRef(e.locale)}function O(e){return e!=null&&"__composer"in e}function $(e){return e!=null&&!("__composer"in e)&&!h.isRef(e.locale)}function y(e){return e!=null&&("__VUE_I18N_BRIDGE__"in e||"_sync"in e)}function se(e){return U(e)?N(e.global)?e.global:e.global.__composer:O(e)?e.__composer:e}function H(e){const t=U(e)?e.global:e;return N(t)?h.isVue2&&y(e)?e.locale:t.locale.value:($(t)||O(t)||y(t),t.locale)}function re(e){const t=U(e)?e.global:e;return N(t)?h.isVue2&&y(e)?e.locales:t.locales.value:($(t)||O(t)||y(t),t.locales)}function $e(e){const t=U(e)?e.global:e;return N(t)?h.isVue2&&y(e)?e.localeCodes:t.localeCodes.value:($(t)||O(t)||y(t),t.localeCodes)}function ie(e,t){const o=U(e)?e.global:e;if(N(o))h.isVue2&&y(e)?e.locale=t:o.locale.value=t;else if($(o)||O(o)||y(o))o.locale=t;else throw new Error("TODO:")}function Ve(e,t,o){return e.replace(/\/+$/,"")+(t?"/":"")||(o?"":"/")}function ue(e){return g.isVueRouter4,h.isRef(e)?e.value:e}function fe(e){return T(e)?e:be(e)?e.toString():"(null)"}function de(e,t,{defaultLocale:o,strategy:n,routesNameSeparator:a,defaultLocaleRouteNameSuffix:l}){let c=fe(e)+(n==="no_prefix"?"":a+t);return t===o&&n==="prefix_and_default"&&(c+=a+l),c}function he(e,t){return Oe(e)?e(t):e}function ve(e,t){const o=[];for(const[n,a]of t.entries()){const l=e.find(c=>c.iso.toLowerCase()===a.toLowerCase());if(l){o.push({code:l.code,score:1-n/t.length});break}}for(const[n,a]of t.entries()){const l=a.split("-")[0].toLowerCase(),c=e.find(s=>s.iso.split("-")[0].toLowerCase()===l);if(c){o.push({code:c.code,score:.999-n/t.length});break}}return o}const je=ve;function Ge(e,t){return e.score===t.score?t.code.length-e.code.length:t.score-e.score}const Be=Ge;function Me(e,t,{matcher:o=je,comparer:n=Be}={}){const a=[];for(const c of e){const{code:s}=c,i=c.iso||s;a.push({code:s,iso:i})}const l=o(a,t);return l.length>1&&l.sort(n),l.length?l[0].code:""}function C(e){return function(){return Reflect.apply(e,{getRouteBaseName:this.getRouteBaseName,localePath:this.localePath,localeRoute:this.localeRoute,localeLocation:this.localeLocation,resolveRoute:this.resolveRoute,switchLocalePath:this.switchLocalePath,localeHead:this.localeHead,i18n:this.$i18n,route:this.$route,router:this.$router},arguments)}}function Le(e,{locales:t=[],localeCodes:o=[],baseUrl:n=J,hooks:a={}}={}){const l=h.effectScope(),c=e.install;return e.install=(s,...i)=>{Reflect.apply(c,e,[s,...i]);const u=se(e);l.run(()=>ke(u,{locales:t,localeCodes:o,baseUrl:n,hooks:a})),O(e.global)&&ze(e.global,a.onExtendVueI18n);const d=s,r=e.mode==="composition"?h.isVue3?d.config.globalProperties.$i18n:e:h.isVue2?e:null;if(r&&De(r,u,a.onExtendExportedGlobal),(He(i[0])?i[0]:{inject:!0}).inject&&s.mixin({methods:{resolveRoute:C(V),localePath:C(q),localeRoute:C(x),localeLocation:C(te),switchLocalePath:C(v),getRouteBaseName:C(P),localeHead:C(oe)}}),d.unmount){const _=d.unmount;d.unmount=()=>{l.stop(),_()}}},l}function ke(e,t){const{locales:o,localeCodes:n,baseUrl:a}=t,l=h.ref(o),c=h.ref(n);e.locales=h.computed(()=>l.value),e.localeCodes=h.computed(()=>c.value),e.__baseUrl=he(a,{}),t.hooks&&t.hooks.onExtendComposer&&t.hooks.onExtendComposer(e)}function De(e,t,o){const n=[{locales:{get(){return t.locales.value}},localeCodes:{get(){return t.localeCodes.value}},__baseUrl:{get(){return t.__baseUrl}}}];o&&n.push(o(t));for(const a of n)for(const[l,c]of Object.entries(a))Object.defineProperty(e,l,c)}function ze(e,t){const o=se(e),n=[{locales:{get(){return o.locales.value}},localeCodes:{get(){return o.localeCodes.value}},__baseUrl:{get(){return o.__baseUrl}}}];t&&n.push(t(o));for(const a of n)for(const[l,c]of Object.entries(a))Object.defineProperty(e,l,c)}function He(e){return K(e)&&"inject"in e&&Pe(e.inject)}function ge(e,{defaultLocale:t=G,strategy:o=B,trailingSlash:n=M,routesNameSeparator:a=k,defaultLocaleRouteNameSuffix:l=D,includeUprefixedFallback:c=!1,optionsResolver:s=void 0,locales:i=[]}={}){if(o==="no_prefix")return e;const u=i.map(r=>T(r)?r:r.code);function d(r,L,_=!1,I=!1){if(r.redirect&&(!r.component||!r.file))return[r];let p=null;if(s!=null&&(p=s(r,L),p==null))return[r];const R={locales:u,paths:{}};if(p!=null&&z(R,p),z(R,{locales:L}),R.locales.length>0&&p&&p.locales!=null&&p.locales.length>0){const E=[];for(const m of R.locales)p.locales.includes(m)&&E.push(m);R.locales=E}return R.locales.reduce((E,m)=>{const{name:j}=r;let{path:S}=r;const A={...r};j&&(A.name=`${j}${a}${m}`),r.children&&(A.children=r.children.reduce((b,le)=>[...b,...d(le,[m],!0,I)],[])),R.paths&&R.paths[m]&&(S=R.paths[m]);const F=m===t;if(F&&o==="prefix_and_default")if(_)_&&I&&j&&(A.name+=`${a}${l}`);else{const b={...A,path:S};if(j&&(b.name=`${A.name}${a}${l}`),r.children){b.children=[];for(const le of r.children)b.children=b.children.concat(d(le,[m],!0,!0))}E.push(b)}const Se=_&&!S.startsWith("/"),Ae=!Se&&!(F&&o==="prefix_except_default");return Ae&&(S=`/${m}${S}`),S&&(S=Ve(S,n,Se)),Ae&&F&&o==="prefix"&&c&&E.push({...r}),A.path=S,E.push(A),E},[])}return e.reduce((r,L)=>[...r,...d(L,u||[])],[])}const ee=Ce("vue-i18n-routing-gor");function _e(e,t){e[ee]?ae("already registered global options"):e[ee]=t}function me(e){var t;return(t=e[ee])!=null?t:{}}function Xe(e,t={}){const{version:o,defaultLocale:n,locales:a,strategy:l,trailingSlash:c,routesNameSeparator:s,defaultLocaleRouteNameSuffix:i,defaultDirection:u,baseUrl:d,routes:r,routeOptionsResolver:L}=xe(t),_=ce(a),I=_.map(m=>m.code),p=pe(I,s,i);Le(e,{locales:_,baseUrl:d,localeCodes:I});const R=ge(r,{locales:a,defaultLocale:n,strategy:l,trailingSlash:c,routesNameSeparator:s,defaultLocaleRouteNameSuffix:i,optionsResolver:L});t.routes=R;const E=qe(t,o);return _e(E,{defaultLocale:n,localeCodes:I,strategy:l,trailingSlash:c,routesNameSeparator:s,defaultLocaleRouteNameSuffix:i,defaultDirection:u}),E.beforeEach((m,j,S)=>{const A=H(e),F=p(m)||A||n||"";A!==F&&ie(e,F),S()}),E}function qe(e,t){if(h.isVue3&&t===4)return g.createRouter(e);if(h.isVue2&&t===3)return new ye.default(e);throw new Error("TODO:")}function Re(e){return new RegExp(`^/(${e.join("|")})(?:/|$)`,"i")}function pe(e,t,o){const n=`(${e.join("|")})`,a=`(?:${t}${o})?`,l=new RegExp(`${t}${n}${a}$`,"i"),c=Re(e);return i=>{if(K(i)){if(i.name){const d=(T(i.name)?i.name:i.name.toString()).match(l);if(d&&d.length>1)return d[1]}else if(i.path){const u=i.path.match(c);if(u&&u.length>1)return u[1]}}else if(T(i)){const u=i.match(c);if(u&&u.length>1)return u[1]}return""}}function xe(e){var t,o,n,a,l,c,s,i,u,d;return e.version=(t=e.version)!=null?t:4,e.defaultLocale=(o=e.defaultLocale)!=null?o:G,e.strategy=(n=e.strategy)!=null?n:B,e.trailingSlash=(a=e.trailingSlash)!=null?a:M,e.routesNameSeparator=(l=e.routesNameSeparator)!=null?l:k,e.defaultLocaleRouteNameSuffix=(c=e.defaultLocaleRouteNameSuffix)!=null?c:D,e.locales=(s=e.locales)!=null?s:[],e.defaultDirection=(i=e.defaultDirection)!=null?i:Y,e.baseUrl=(u=e.baseUrl)!=null?u:J,e.routes=(d=e.routes)!=null?d:[],e}function X(e,t,{defaultLocale:o=G,defaultDirection:n=Y,defaultLocaleRouteNameSuffix:a=D,routesNameSeparator:l=k,strategy:c=B,trailingSlash:s=M,localeCodes:i=[]}={}){const u=me(e);return{defaultLocale:t.defaultLocale||u.defaultLocale||o,defaultDirection:t.defaultDirection||u.defaultDirection||n,defaultLocaleRouteNameSuffix:t.defaultLocaleRouteNameSuffix||u.defaultLocaleRouteNameSuffix||a,routesNameSeparator:t.routesNameSeparator||u.routesNameSeparator||l,strategy:t.strategy||u.strategy||c,trailingSlash:t.trailingSlash||u.trailingSlash||s,localeCodes:t.localeCodes||u.localeCodes||i}}const We=new Set(["prefix_and_default","prefix_except_default"]);function P(e){const t=this.router,{routesNameSeparator:o}=X(t,this),n=e!=null?h.isRef(e)?h.unref(e):e:this.route;return n==null||!n.name?void 0:fe(n.name).split(o)[0]}function q(e,t){const o=V.call(this,e,t);return o==null?"":h.isVue3?o.redirectedFrom||o.fullPath:o.route.redirectedFrom||o.route.fullPath}function x(e,t){const o=V.call(this,e,t);return o==null?void 0:h.isVue3?o:o.route}function te(e,t){const o=V.call(this,e,t);return o==null?void 0:h.isVue3?o:o.location}function V(e,t){const o=this.router,n=this.i18n,a=t||H(n),{routesNameSeparator:l,defaultLocale:c,defaultLocaleRouteNameSuffix:s,strategy:i,trailingSlash:u}=X(o,this);let d=e;T(e)&&(d[0]==="/"?d={path:e}:d={name:e});let r=z({},d);if(r.path&&!r.name){let L=null;try{L=o.resolve(r)}catch{}const _=h.isVue3?L:L.route,I=P.call(this,_);T(I)?r={name:de(I,a,{defaultLocale:c,strategy:i,routesNameSeparator:l,defaultLocaleRouteNameSuffix:s}),params:_.params,query:_.query,hash:_.hash}:(!(a===c&&We.has(i))&&i!=="no_prefix"&&(r.path=`/${a}${r.path}`),r.path=u?Fe(r.path,!0):Ne(r.path,!0))}else{!r.name&&!r.path&&(r.name=P.call(this,this.route)),r.name=de(r.name,a,{defaultLocale:c,strategy:i,routesNameSeparator:l,defaultLocaleRouteNameSuffix:s});const{params:L}=r;L&&L[0]===void 0&&L.pathMatch&&(L[0]=L.pathMatch)}try{const L=o.resolve(r);return(h.isVue3?L.name:L.route.name)?L:o.resolve(e)}catch(L){if(h.isVue3&&L.type===1)return null;if(h.isVue2)return null}}function v(e){const t=this.route,o=P.call(this,t);if(!o)return"";const{params:n,...a}=!h.isVue3&&h.isRef(t)?t.value:t,c=z({},a,{name:o,params:{...n,...{},0:n.pathMatch}});return q.call(this,c,e)}function oe({addDirAttribute:e=!1,addSeoAttributes:t=!1}={}){const o=this.router,n=this.i18n,{defaultDirection:a}=X(o,this),l={htmlAttrs:{},link:[],meta:[]};if(n.locales==null||n.__baseUrl==null)return l;const c=H(n),s=re(n),i=ce(s).find(r=>r.code===c)||{code:c},u=i.iso,d=i.dir||a;return e&&(l.htmlAttrs.dir=d),t&&c&&n.locales&&(u&&(l.htmlAttrs.lang=u),Qe.call(this,s,n.__baseUrl,l.link),Ye.call(this,n.__baseUrl,l.link,t),Je(i,u,l.meta),Ke(s,u,l.meta)),l}function Qe(e,t,o){const n=this.router,{defaultLocale:a,strategy:l}=X(n,this);if(l===Q.NO_PREFIX)return;const c=new Map;for(const s of e){const i=s.iso;if(!i){ae("Locale ISO code is required to generate alternate link");continue}const[u,d]=i.split("-");u&&d&&(s.isCatchallLocale||!c.has(u))&&c.set(u,s),c.set(i,s)}for(const[s,i]of c.entries()){const u=v.call(this,i.code);u&&o.push({hid:`i18n-alt-${s}`,rel:"alternate",href:ne(u,t),hreflang:s})}if(a){const s=v.call(this,a);s&&o.push({hid:"i18n-xd",rel:"alternate",href:ne(s,t),hreflang:"x-default"})}}function Ye(e,t,o){const n=this.route,a=x.call(this,{...n,name:P.call(this,n)});if(a){let l=ne(a.path,e);const c=K(o)&&o.canonicalQueries||[];if(c.length){const s=a.query,i=new URLSearchParams;for(const d of c)if(d in s){const r=s[d];Te(r)?r.forEach(L=>i.append(d,L||"")):i.append(d,r||"")}const u=i.toString();u&&(l=`${l}?${u}`)}t.push({hid:"i18n-can",rel:"canonical",href:l})}}function Je(e,t,o){!(e&&t)||o.push({hid:"i18n-og",property:"og:locale",content:Ee(t)})}function Ke(e,t,o){const n=e.filter(a=>{const l=a.iso;return l&&l!==t});if(n.length){const a=n.map(l=>({hid:`i18n-og-alt-${l.iso}`,property:"og:locale:alternate",content:Ee(l.iso)}));o.push(...a)}}function Ee(e){return(e||"").replace(/-/g,"_")}function ne(e,t){return e.match(/^https?:\/\//)?e:t+e}function W(e,t){const{router:o,route:n,i18n:a,defaultLocale:l,strategy:c,defaultLocaleRouteNameSuffix:s,trailingSlash:i,routesNameSeparator:u}=e;return function(...d){return Reflect.apply(t,{router:o,route:n,i18n:a,defaultLocale:l,strategy:c,defaultLocaleRouteNameSuffix:s,trailingSlash:i,routesNameSeparator:u},d)}}function Ze(e=g.useRoute(),{router:t=g.useRouter(),routesNameSeparator:o=void 0}={}){const n={router:t,route:e,routesNameSeparator:o};return P.call(n,e)}function et({router:e=g.useRouter(),route:t=g.useRoute(),i18n:o=w.useI18n(),defaultLocale:n=void 0,defaultLocaleRouteNameSuffix:a=void 0,routesNameSeparator:l=void 0,strategy:c=void 0,trailingSlash:s=void 0}={}){return W({router:e,route:t,i18n:o,defaultLocale:n,defaultLocaleRouteNameSuffix:a,routesNameSeparator:l,strategy:c,trailingSlash:s},q)}function tt({router:e=g.useRouter(),route:t=g.useRoute(),i18n:o=w.useI18n(),defaultLocale:n=void 0,defaultLocaleRouteNameSuffix:a=void 0,routesNameSeparator:l=void 0,strategy:c=void 0,trailingSlash:s=void 0}={}){return W({router:e,route:t,i18n:o,defaultLocale:n,defaultLocaleRouteNameSuffix:a,routesNameSeparator:l,strategy:c,trailingSlash:s},x)}function ot({router:e=g.useRouter(),route:t=g.useRoute(),i18n:o=w.useI18n(),defaultLocale:n=void 0,defaultLocaleRouteNameSuffix:a=void 0,routesNameSeparator:l=void 0,strategy:c=void 0,trailingSlash:s=void 0}={}){return W({router:e,route:t,i18n:o,defaultLocale:n,defaultLocaleRouteNameSuffix:a,routesNameSeparator:l,strategy:c,trailingSlash:s},te)}function nt({router:e=g.useRouter(),route:t=g.useRoute(),i18n:o=w.useI18n(),defaultLocale:n=void 0,defaultLocaleRouteNameSuffix:a=void 0,routesNameSeparator:l=void 0,strategy:c=void 0,trailingSlash:s=void 0}={}){return W({router:e,route:t,i18n:o,defaultLocale:n,defaultLocaleRouteNameSuffix:a,routesNameSeparator:l,strategy:c,trailingSlash:s},v)}function lt({addDirAttribute:e=!1,addSeoAttributes:t=!1,strategy:o=void 0,defaultLocale:n=void 0,route:a=g.useRoute(),router:l=g.useRouter(),i18n:c=w.useI18n()}={}){const s=l,i=h.ref({htmlAttrs:{},link:[],meta:[]});function u(){i.value={htmlAttrs:{},link:[],meta:[]}}function d(r){i.value=Reflect.apply(oe,{router:l,route:r,i18n:c,defaultLocale:n,strategy:o},[{addDirAttribute:e,addSeoAttributes:t}])}if(we)if(h.isVue3){const r=h.watchEffect(()=>{u(),d(ue(s.currentRoute))});h.onUnmounted(()=>r())}else{const r=s.afterEach((L,_)=>{u(),d(L)});h.onUnmounted(()=>r()),d(a)}else d(ue(s.currentRoute));return i}const at="0.0.0";return f.DEFAULT_BASE_URL=J,f.DEFAULT_DETECTION_DIRECTION=Y,f.DEFAULT_LOCALE=G,f.DEFAULT_LOCALE_ROUTE_NAME_SUFFIX=D,f.DEFAULT_ROUTES_NAME_SEPARATOR=k,f.DEFAULT_STRATEGY=B,f.DEFAULT_TRAILING_SLASH=M,f.STRATEGIES=Q,f.VERSION=at,f.createLocaleFromRouteGetter=pe,f.createRouter=Xe,f.extendI18n=Le,f.findBrowserLocale=Me,f.getGlobalOptions=me,f.getLocale=H,f.getLocaleCodes=$e,f.getLocales=re,f.getLocalesRegex=Re,f.getRouteBaseName=P,f.isComposer=N,f.isExportedGlobalComposer=$,f.isI18nInstance=U,f.isLegacyVueI18n=y,f.isVueI18n=O,f.localeHead=oe,f.localeLocation=te,f.localePath=q,f.localeRoute=x,f.localizeRoutes=ge,f.proxyVueInstance=C,f.registerGlobalOptions=_e,f.resolveBaseUrl=he,f.resolveRoute=V,f.setLocale=ie,f.switchLocalePath=v,f.useLocaleHead=lt,f.useLocaleLocation=ot,f.useLocalePath=et,f.useLocaleRoute=tt,f.useRouteBaseName=Ze,f.useSwitchLocalePath=nt,Object.defineProperties(f,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),f}({},VueDemi,VueRouter,VueI18n); |
{ | ||
"name": "vue-i18n-routing", | ||
"description": "The i18n routing with using vue-i18n", | ||
"version": "0.0.0-f8bb9c4", | ||
"version": "0.0.0-fc77992", | ||
"dependencies": { | ||
"@intlify/shared": "next", | ||
"@intlify/vue-i18n-bridge": "^0.3.5", | ||
"@intlify/vue-router-bridge": "^0.3.5", | ||
"ufo": "^0.7.9", | ||
"vue-demi": "^0.12.1" | ||
"@intlify/shared": "latest", | ||
"@intlify/vue-i18n-bridge": "0.3.6", | ||
"@intlify/vue-router-bridge": "0.3.6", | ||
"ufo": "^0.8.5", | ||
"vue-demi": "0.13.5" | ||
}, | ||
"devDependencies": { | ||
"@microsoft/api-extractor": "^7.18.20", | ||
"@vue/test-utils": "^1.3.0", | ||
"@microsoft/api-extractor": "^7.28.4", | ||
"api-docs-gen": "^0.4.0", | ||
"rimraf": "^3.0.2", | ||
"typescript": "^4.5.4", | ||
"vite": "latest", | ||
"typescript": "^4.7.4", | ||
"vite": "^3.0.0", | ||
"vite-plugin-dts": "^0.9.6", | ||
"vitest": "^0.2.8", | ||
"vue": "^3.2.23", | ||
"vue-i18n": "npm:vue-i18n@next", | ||
"vue-i18n-bridge": "next", | ||
"vitest": "^0.19.0", | ||
"vue": "^3.2.27", | ||
"vue-i18n": "npm:vue-i18n@latest", | ||
"vue-i18n-bridge": "latest", | ||
"vue-i18n-legacy": "npm:vue-i18n@8", | ||
"vue-router": "^4.0.12", | ||
"vue-router": "^4.0.15", | ||
"vue-router3": "npm:vue-router@3", | ||
@@ -33,4 +32,4 @@ "vue-template-compiler": "^2.6.14", | ||
"vue": "^2.6.14 || ^3.2.0", | ||
"vue-i18n": "^8.26.1 || ^9.2.0-beta.34", | ||
"vue-i18n-bridge": "^9.2.0-beta.34", | ||
"vue-i18n": "^8.26.1 || ^9.2.0", | ||
"vue-i18n-bridge": "^9.2.0", | ||
"vue-router": "^3.5.3 || ^4.0.0" | ||
@@ -41,2 +40,14 @@ }, | ||
"optional": true | ||
}, | ||
"vue": { | ||
"optional": true | ||
}, | ||
"vue-i18n": { | ||
"optional": true | ||
}, | ||
"vue-i18n-bridge": { | ||
"optional": true | ||
}, | ||
"vue-router": { | ||
"optional": true | ||
} | ||
@@ -53,7 +64,8 @@ }, | ||
"index.mjs", | ||
"types.d.ts", | ||
"LICENSE", | ||
"README.md" | ||
], | ||
"main": "./dist/vue-i18n-routing.cjs.js", | ||
"module": "./dist/vue-i18n-routing.es.js", | ||
"main": "./dist/vue-i18n-routing.js", | ||
"module": "./dist/vue-i18n-routing.mjs", | ||
"unpkg": "dist/vue-i18n-routing.iife.js", | ||
@@ -66,9 +78,9 @@ "jsdelivr": "dist/vue-i18n-routing.iife.js", | ||
"node": "./index.mjs", | ||
"default": "./dist/vue-i18n-routing.es.js" | ||
"default": "./dist/vue-i18n-routing.mjs" | ||
}, | ||
"require": "./dist/vue-i18n-routing.cjs.js", | ||
"require": "./dist/vue-i18n-routing.js", | ||
"types": "./dist/vue-i18n-routing.d.ts" | ||
}, | ||
"./mixins": { | ||
"types": "./dist/mixins.d.ts" | ||
"./types": { | ||
"types": "./types.d.ts" | ||
}, | ||
@@ -93,3 +105,3 @@ "./package.json": "./package.json", | ||
"engines": { | ||
"node": ">= 12" | ||
"node": ">= 14.6" | ||
}, | ||
@@ -96,0 +108,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
15
11
84371
1565
2
+ Added@intlify/shared@11.0.1(transitive)
+ Addedufo@0.8.6(transitive)
+ Addedvue-demi@0.13.5(transitive)
- Removed@intlify/shared@11.0.0-rc.1(transitive)
- Removedufo@0.7.11(transitive)
- Removedvue-demi@0.12.5(transitive)
Updated@intlify/shared@latest
Updatedufo@^0.8.5
Updatedvue-demi@0.13.5