create project

This commit is contained in:
ismailsosic
2022-12-27 12:05:56 +01:00
parent 2a33a2d3de
commit cd2143287c
16035 changed files with 2489703 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
import React from 'react';
export const AmpStateContext = React.createContext({});
if (process.env.NODE_ENV !== 'production') {
AmpStateContext.displayName = 'AmpStateContext';
}
//# sourceMappingURL=amp-context.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../shared/lib/amp-context.ts"],"names":["React","AmpStateContext","createContext","process","env","NODE_ENV","displayName"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,MAAMC,eAAe,GAAuBD,KAAK,CAACE,aAAa,CAAC,EAAE,CAAC,CAAA;AAE1E,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzCJ,eAAe,CAACK,WAAW,GAAG,iBAAiB;CAChD"}

View File

@@ -0,0 +1,5 @@
export function isInAmpMode({ ampFirst =false , hybrid =false , hasQuery =false , } = {}) {
return ampFirst || hybrid && hasQuery;
}
//# sourceMappingURL=amp-mode.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../shared/lib/amp-mode.ts"],"names":["isInAmpMode","ampFirst","hybrid","hasQuery"],"mappings":"AAAA,OAAO,SAASA,WAAW,CAAC,EAC1BC,QAAQ,EAAG,KAAK,CAAA,EAChBC,MAAM,EAAG,KAAK,CAAA,EACdC,QAAQ,EAAG,KAAK,CAAA,IACjB,GAAG,EAAE,EAAW;IACf,OAAOF,QAAQ,IAAKC,MAAM,IAAIC,QAAQ,AAAC,CAAA;CACxC"}

View File

@@ -0,0 +1,9 @@
import React from 'react';
import { AmpStateContext } from './amp-context';
import { isInAmpMode } from './amp-mode';
export function useAmp() {
// Don't assign the context value to a variable to save bytes
return isInAmpMode(React.useContext(AmpStateContext));
}
//# sourceMappingURL=amp.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../shared/lib/amp.ts"],"names":["React","AmpStateContext","isInAmpMode","useAmp","useContext"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO,CAAA;AACzB,SAASC,eAAe,QAAQ,eAAe,CAAA;AAC/C,SAASC,WAAW,QAAQ,YAAY,CAAA;AAExC,OAAO,SAASC,MAAM,GAAY;IAChC,6DAA6D;IAC7D,OAAOD,WAAW,CAACF,KAAK,CAACI,UAAU,CAACH,eAAe,CAAC,CAAC,CAAA;CACtD"}

View File

@@ -0,0 +1,21 @@
"use client";
import React from 'react';
export var CacheStates;
(function(CacheStates) {
CacheStates["LAZY_INITIALIZED"] = 'LAZYINITIALIZED';
CacheStates["DATA_FETCH"] = 'DATAFETCH';
CacheStates["READY"] = "READY";
})(CacheStates || (CacheStates = {}));
export const AppRouterContext = React.createContext(null);
export const LayoutRouterContext = React.createContext(null);
export const GlobalLayoutRouterContext = React.createContext(null);
export const TemplateContext = React.createContext(null);
if (process.env.NODE_ENV !== 'production') {
AppRouterContext.displayName = 'AppRouterContext';
LayoutRouterContext.displayName = 'LayoutRouterContext';
GlobalLayoutRouterContext.displayName = 'GlobalLayoutRouterContext';
TemplateContext.displayName = 'TemplateContext';
}
//# sourceMappingURL=app-router-context.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../shared/lib/app-router-context.ts"],"names":["React","CacheStates","LAZY_INITIALIZED","DATA_FETCH","READY","AppRouterContext","createContext","LayoutRouterContext","GlobalLayoutRouterContext","TemplateContext","process","env","NODE_ENV","displayName"],"mappings":"AAEA,OAAOA,KAAK,MAAM,OAAO,CAAA;AAFzB,YAAY;WASL,WAIN;UAJWC,WAAW;IAAXA,WAAW,CACrBC,kBAAgB,IAAG,iBAAiB;IAD1BD,WAAW,CAErBE,YAAU,IAAG,WAAW;IAFdF,WAAW,CAGrBG,OAAK,IAALA,OAAK;GAHKH,WAAW,KAAXA,WAAW;AAuFvB,OAAO,MAAMI,gBAAgB,GAAGL,KAAK,CAACM,aAAa,CACjD,IAAI,CACL,CAAA;AACD,OAAO,MAAMC,mBAAmB,GAAGP,KAAK,CAACM,aAAa,CAInD,IAAI,CAAQ,CAAA;AACf,OAAO,MAAME,yBAAyB,GAAGR,KAAK,CAACM,aAAa,CAQzD,IAAI,CAAQ,CAAA;AAEf,OAAO,MAAMG,eAAe,GAAGT,KAAK,CAACM,aAAa,CAAkB,IAAI,CAAQ,CAAA;AAEhF,IAAII,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzCP,gBAAgB,CAACQ,WAAW,GAAG,kBAAkB;IACjDN,mBAAmB,CAACM,WAAW,GAAG,qBAAqB;IACvDL,yBAAyB,CAACK,WAAW,GAAG,2BAA2B;IACnEJ,eAAe,CAACI,WAAW,GAAG,iBAAiB;CAChD"}

View File

@@ -0,0 +1,147 @@
export const COMPILER_NAMES = {
client: 'client',
server: 'server',
edgeServer: 'edge-server'
};
export const COMPILER_INDEXES = {
[COMPILER_NAMES.client]: 0,
[COMPILER_NAMES.server]: 1,
[COMPILER_NAMES.edgeServer]: 2
};
export const PHASE_EXPORT = 'phase-export';
export const PHASE_PRODUCTION_BUILD = 'phase-production-build';
export const PHASE_PRODUCTION_SERVER = 'phase-production-server';
export const PHASE_DEVELOPMENT_SERVER = 'phase-development-server';
export const PHASE_TEST = 'phase-test';
export const PAGES_MANIFEST = 'pages-manifest.json';
export const APP_PATHS_MANIFEST = 'app-paths-manifest.json';
export const APP_PATH_ROUTES_MANIFEST = 'app-path-routes-manifest.json';
export const BUILD_MANIFEST = 'build-manifest.json';
export const APP_BUILD_MANIFEST = 'app-build-manifest.json';
export const SUBRESOURCE_INTEGRITY_MANIFEST = 'subresource-integrity-manifest';
export const FONT_LOADER_MANIFEST = 'font-loader-manifest';
export const EXPORT_MARKER = 'export-marker.json';
export const EXPORT_DETAIL = 'export-detail.json';
export const PRERENDER_MANIFEST = 'prerender-manifest.json';
export const ROUTES_MANIFEST = 'routes-manifest.json';
export const IMAGES_MANIFEST = 'images-manifest.json';
export const SERVER_FILES_MANIFEST = 'required-server-files.json';
export const DEV_CLIENT_PAGES_MANIFEST = '_devPagesManifest.json';
export const MIDDLEWARE_MANIFEST = 'middleware-manifest.json';
export const DEV_MIDDLEWARE_MANIFEST = '_devMiddlewareManifest.json';
export const REACT_LOADABLE_MANIFEST = 'react-loadable-manifest.json';
export const FONT_MANIFEST = 'font-manifest.json';
export const SERVER_DIRECTORY = 'server';
export const CONFIG_FILES = [
'next.config.js',
'next.config.mjs'
];
export const BUILD_ID_FILE = 'BUILD_ID';
export const BLOCKED_PAGES = [
'/_document',
'/_app',
'/_error'
];
export const CLIENT_PUBLIC_FILES_PATH = 'public';
export const CLIENT_STATIC_FILES_PATH = 'static';
export const CLIENT_STATIC_FILES_RUNTIME = 'runtime';
export const STRING_LITERAL_DROP_BUNDLE = '__NEXT_DROP_CLIENT_FILE__';
/**
* These are the browser versions that support all of the following:
* static import: https://caniuse.com/es6-module
* dynamic import: https://caniuse.com/es6-module-dynamic-import
* import.meta: https://caniuse.com/mdn-javascript_operators_import_meta
*/ export const MODERN_BROWSERSLIST_TARGET = [
'chrome 64',
'edge 79',
'firefox 67',
'opera 51',
'safari 12',
];
export const NEXT_BUILTIN_DOCUMENT = '__NEXT_BUILTIN_DOCUMENT__';
export const NEXT_CLIENT_SSR_ENTRY_SUFFIX = '.__sc_client__';
// server/flight-manifest.js
export const FLIGHT_MANIFEST = 'flight-manifest';
// server/flight-server-css-manifest.json
export const FLIGHT_SERVER_CSS_MANIFEST = 'flight-server-css-manifest';
// server/middleware-build-manifest.js
export const MIDDLEWARE_BUILD_MANIFEST = 'middleware-build-manifest';
// server/middleware-react-loadable-manifest.js
export const MIDDLEWARE_REACT_LOADABLE_MANIFEST = 'middleware-react-loadable-manifest';
// static/runtime/main.js
export const CLIENT_STATIC_FILES_RUNTIME_MAIN = `main`;
export const CLIENT_STATIC_FILES_RUNTIME_MAIN_APP = `${CLIENT_STATIC_FILES_RUNTIME_MAIN}-app`;
// next internal client components chunk for layouts
export const APP_CLIENT_INTERNALS = 'app-client-internals';
// static/runtime/react-refresh.js
export const CLIENT_STATIC_FILES_RUNTIME_REACT_REFRESH = `react-refresh`;
// static/runtime/amp.js
export const CLIENT_STATIC_FILES_RUNTIME_AMP = `amp`;
// static/runtime/webpack.js
export const CLIENT_STATIC_FILES_RUNTIME_WEBPACK = `webpack`;
// static/runtime/polyfills.js
export const CLIENT_STATIC_FILES_RUNTIME_POLYFILLS = 'polyfills';
export const CLIENT_STATIC_FILES_RUNTIME_POLYFILLS_SYMBOL = Symbol(CLIENT_STATIC_FILES_RUNTIME_POLYFILLS);
export const EDGE_RUNTIME_WEBPACK = 'edge-runtime-webpack';
export const TEMPORARY_REDIRECT_STATUS = 307;
export const PERMANENT_REDIRECT_STATUS = 308;
export const STATIC_PROPS_ID = '__N_SSG';
export const SERVER_PROPS_ID = '__N_SSP';
export const GOOGLE_FONT_PROVIDER = 'https://fonts.googleapis.com/';
export const OPTIMIZED_FONT_PROVIDERS = [
{
url: GOOGLE_FONT_PROVIDER,
preconnect: 'https://fonts.gstatic.com'
},
{
url: 'https://use.typekit.net',
preconnect: 'https://use.typekit.net'
},
];
export const DEFAULT_SERIF_FONT = {
name: 'Times New Roman',
xAvgCharWidth: 821,
azAvgWidth: 854.3953488372093,
unitsPerEm: 2048
};
export const DEFAULT_SANS_SERIF_FONT = {
name: 'Arial',
xAvgCharWidth: 904,
azAvgWidth: 934.5116279069767,
unitsPerEm: 2048
};
export const STATIC_STATUS_PAGES = [
'/500'
];
export const TRACE_OUTPUT_VERSION = 1;
export const RSC_MODULE_TYPES = {
client: 'client',
server: 'server'
};
// comparing
// https://nextjs.org/docs/api-reference/edge-runtime
// with
// https://nodejs.org/docs/latest/api/globals.html
export const EDGE_UNSUPPORTED_NODE_APIS = [
'clearImmediate',
'setImmediate',
'BroadcastChannel',
'Buffer',
'ByteLengthQueuingStrategy',
'CompressionStream',
'CountQueuingStrategy',
'DecompressionStream',
'DomException',
'MessageChannel',
'MessageEvent',
'MessagePort',
'ReadableByteStreamController',
'ReadableStreamBYOBRequest',
'ReadableStreamDefaultController',
'TextDecoderStream',
'TextEncoderStream',
'TransformStreamDefaultController',
'WritableStreamDefaultController',
];
//# sourceMappingURL=constants.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,17 @@
"use client";
import React from 'react';
import { NEXT_DYNAMIC_NO_SSR_CODE } from './no-ssr-error';
export function suspense() {
const error = new Error(NEXT_DYNAMIC_NO_SSR_CODE);
error.digest = NEXT_DYNAMIC_NO_SSR_CODE;
throw error;
}
export default function NoSSR({ children }) {
if (typeof window === 'undefined') {
suspense();
}
return children;
};
//# sourceMappingURL=dynamic-no-ssr.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../shared/lib/dynamic-no-ssr.ts"],"names":["React","NEXT_DYNAMIC_NO_SSR_CODE","suspense","error","Error","digest","NoSSR","children","window"],"mappings":"AAEA,OAAOA,KAAK,MAAM,OAAO,CAAA;AACzB,SAASC,wBAAwB,QAAQ,gBAAgB,CAAA;AAHzD,YAAY;AAKZ,OAAO,SAASC,QAAQ,GAAG;IACzB,MAAMC,KAAK,GAAG,IAAIC,KAAK,CAACH,wBAAwB,CAAC,AAChD;IAAA,AAACE,KAAK,CAASE,MAAM,GAAGJ,wBAAwB;IACjD,MAAME,KAAK,CAAA;CACZ;AAID,eAAe,SAASG,KAAK,CAAC,EAAEC,QAAQ,CAAA,EAAuB,EAAS;IACtE,IAAI,OAAOC,MAAM,KAAK,WAAW,EAAE;QACjCN,QAAQ,EAAE;KACX;IAED,OAAOK,QAAQ,CAAA;CAChB,CAAA"}

View File

@@ -0,0 +1,81 @@
import _extends from "@swc/helpers/src/_extends.mjs";
import React, { lazy, Suspense } from 'react';
import Loadable from './loadable';
import NoSSR from './dynamic-no-ssr';
// Normalize loader to return the module as form { default: Component } for `React.lazy`.
// Also for backward compatible since next/dynamic allows to resolve a component directly with loader
// Client component reference proxy need to be converted to a module.
function convertModule(mod) {
return {
default: mod.default || mod
};
}
export function noSSR(LoadableInitializer, loadableOptions) {
// Removing webpack and modules means react-loadable won't try preloading
delete loadableOptions.webpack;
delete loadableOptions.modules;
const NoSSRComponent = /*#__PURE__*/ lazy(LoadableInitializer);
const Loading = loadableOptions.loading;
const fallback = /*#__PURE__*/ React.createElement(Loading, {
error: null,
isLoading: true,
pastDelay: false,
timedOut: false
});
return (props)=>/*#__PURE__*/ React.createElement(Suspense, {
fallback: fallback
}, /*#__PURE__*/ React.createElement(NoSSR, null, /*#__PURE__*/ React.createElement(NoSSRComponent, Object.assign({}, props))));
}
export default function dynamic(dynamicOptions, options) {
let loadableFn = Loadable;
let loadableOptions = {
// A loading component is not required, so we default it
loading: ({ error , isLoading , pastDelay })=>{
if (!pastDelay) return null;
if (process.env.NODE_ENV !== 'production') {
if (isLoading) {
return null;
}
if (error) {
return /*#__PURE__*/ React.createElement("p", null, error.message, /*#__PURE__*/ React.createElement("br", null), error.stack);
}
}
return null;
}
};
// Support for direct import(), eg: dynamic(import('../hello-world'))
// Note that this is only kept for the edge case where someone is passing in a promise as first argument
// The react-loadable babel plugin will turn dynamic(import('../hello-world')) into dynamic(() => import('../hello-world'))
// To make sure we don't execute the import without rendering first
if (dynamicOptions instanceof Promise) {
loadableOptions.loader = ()=>dynamicOptions;
// Support for having import as a function, eg: dynamic(() => import('../hello-world'))
} else if (typeof dynamicOptions === 'function') {
loadableOptions.loader = dynamicOptions;
// Support for having first argument being options, eg: dynamic({loader: import('../hello-world')})
} else if (typeof dynamicOptions === 'object') {
loadableOptions = _extends({}, loadableOptions, dynamicOptions);
}
// Support for passing options, eg: dynamic(import('../hello-world'), {loading: () => <p>Loading something</p>})
loadableOptions = _extends({}, loadableOptions, options);
const loaderFn = loadableOptions.loader;
const loader = ()=>loaderFn().then(convertModule);
// coming from build/babel/plugins/react-loadable-plugin.js
if (loadableOptions.loadableGenerated) {
loadableOptions = _extends({}, loadableOptions, loadableOptions.loadableGenerated, {
loader
});
delete loadableOptions.loadableGenerated;
}
// support for disabling server side rendering, eg: dynamic(() => import('../hello-world'), {ssr: false}).
if (typeof loadableOptions.ssr === 'boolean') {
if (!loadableOptions.ssr) {
delete loadableOptions.ssr;
return noSSR(loader, loadableOptions);
}
delete loadableOptions.ssr;
}
return loadableFn(loadableOptions);
};
//# sourceMappingURL=dynamic.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../shared/lib/dynamic.tsx"],"names":["React","lazy","Suspense","Loadable","NoSSR","convertModule","mod","default","noSSR","LoadableInitializer","loadableOptions","webpack","modules","NoSSRComponent","Loading","loading","fallback","error","isLoading","pastDelay","timedOut","props","dynamic","dynamicOptions","options","loadableFn","process","env","NODE_ENV","p","message","br","stack","Promise","loader","loaderFn","then","loadableGenerated","ssr"],"mappings":"AAAA;AAAA,OAAOA,KAAK,IAAIC,IAAI,EAAEC,QAAQ,QAAQ,OAAO,CAAA;AAC7C,OAAOC,QAAQ,MAAM,YAAY,CAAA;AACjC,OAAOC,KAAK,MAAM,kBAAkB,CAAA;AA+BpC,yFAAyF;AACzF,qGAAqG;AACrG,qEAAqE;AACrE,SAASC,aAAa,CAAIC,GAAgD,EAAE;IAC1E,OAAO;QAAEC,OAAO,EAAE,AAACD,GAAG,CAAwBC,OAAO,IAAID,GAAG;KAAE,CAAA;CAC/D;AAqBD,OAAO,SAASE,KAAK,CACnBC,mBAAwC,EACxCC,eAAkC,EACV;IACxB,yEAAyE;IACzE,OAAOA,eAAe,CAACC,OAAO;IAC9B,OAAOD,eAAe,CAACE,OAAO;IAE9B,MAAMC,cAAc,iBAAGZ,IAAI,CAACQ,mBAAmB,CAAC;IAEhD,MAAMK,OAAO,GAAGJ,eAAe,CAACK,OAAO,AAAC;IACxC,MAAMC,QAAQ,iBACZ,oBAACF,OAAO;QAACG,KAAK,EAAE,IAAI;QAAEC,SAAS,EAATA,IAAS;QAACC,SAAS,EAAE,KAAK;QAAEC,QAAQ,EAAE,KAAK;MAAI,AACtE;IAED,OAAO,CAACC,KAAU,iBAChB,oBAACnB,QAAQ;YAACc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,EAAE,CAACC,IAAI,CAAC/B,aAAa,CAAC;IAEnD,2DAA2D;IAC3D,IAAIK,eAAe,CAAC2B,iBAAiB,EAAE;QACrC3B,eAAe,GAAG,aACbA,eAAe,EACfA,eAAe,CAAC2B,iBAAiB;YACpCH,MAAM;UACP;QACD,OAAOxB,eAAe,CAAC2B,iBAAiB;KACzC;IAED,0GAA0G;IAC1G,IAAI,OAAO3B,eAAe,CAAC4B,GAAG,KAAK,SAAS,EAAE;QAC5C,IAAI,CAAC5B,eAAe,CAAC4B,GAAG,EAAE;YACxB,OAAO5B,eAAe,CAAC4B,GAAG;YAC1B,OAAO9B,KAAK,CAAC0B,MAAM,EAAExB,eAAe,CAAC,CAAA;SACtC;QACD,OAAOA,eAAe,CAAC4B,GAAG;KAC3B;IAED,OAAOb,UAAU,CAACf,eAAe,CAAC,CAAA;CACnC,CAAA"}

View File

@@ -0,0 +1,12 @@
// regexp is based on https://github.com/sindresorhus/escape-string-regexp
const reHasRegExp = /[|\\{}()[\]^$+*?.-]/;
const reReplaceRegExp = /[|\\{}()[\]^$+*?.-]/g;
export function escapeStringRegexp(str) {
// see also: https://github.com/lodash/lodash/blob/2da024c3b4f9947a48517639de7560457cd4ec6c/escapeRegExp.js#L23
if (reHasRegExp.test(str)) {
return str.replace(reReplaceRegExp, '\\$&');
}
return str;
}
//# sourceMappingURL=escape-regexp.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../shared/lib/escape-regexp.ts"],"names":["reHasRegExp","reReplaceRegExp","escapeStringRegexp","str","test","replace"],"mappings":"AAAA,0EAA0E;AAC1E,MAAMA,WAAW,wBAAwB;AACzC,MAAMC,eAAe,yBAAyB;AAE9C,OAAO,SAASC,kBAAkB,CAACC,GAAW,EAAE;IAC9C,+GAA+G;IAC/G,IAAIH,WAAW,CAACI,IAAI,CAACD,GAAG,CAAC,EAAE;QACzB,OAAOA,GAAG,CAACE,OAAO,CAACJ,eAAe,EAAE,MAAM,CAAC,CAAA;KAC5C;IACD,OAAOE,GAAG,CAAA;CACX"}

View File

@@ -0,0 +1,23 @@
/**
* Returns a new list by pulling every item out of it (and all its sub-arrays)
* and putting them in a new array, depth-first. Stolen from Ramda.
*/ export function flatten(list) {
let jlen, j, value, idx = 0, result = [];
while(idx < list.length){
if (Array.isArray(list[idx])) {
value = flatten(list[idx]);
j = 0;
jlen = value.length;
while(j < jlen){
result[result.length] = value[j];
j += 1;
}
} else {
result[result.length] = list[idx];
}
idx += 1;
}
return result;
}
//# sourceMappingURL=flatten.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../shared/lib/flatten.ts"],"names":["flatten","list","jlen","j","value","idx","result","length","Array","isArray"],"mappings":"AAEA;;;GAGG,CACH,OAAO,SAASA,OAAO,CAA2BC,IAAO,EAAkB;IACzE,IAAIC,IAAI,AAAQ,EACdC,CAAC,AAAQ,EACTC,KAAK,EACLC,GAAG,GAAG,CAAC,EACPC,MAAM,GAAG,EAAE;IAEb,MAAOD,GAAG,GAAGJ,IAAI,CAACM,MAAM,CAAE;QACxB,IAAIC,KAAK,CAACC,OAAO,CAACR,IAAI,CAACI,GAAG,CAAC,CAAC,EAAE;YAC5BD,KAAK,GAAGJ,OAAO,CAACC,IAAI,CAACI,GAAG,CAAC,CAAC;YAC1BF,CAAC,GAAG,CAAC;YACLD,IAAI,GAAGE,KAAK,CAACG,MAAM;YACnB,MAAOJ,CAAC,GAAGD,IAAI,CAAE;gBACfI,MAAM,CAACA,MAAM,CAACC,MAAM,CAAC,GAAGH,KAAK,CAACD,CAAC,CAAC;gBAChCA,CAAC,IAAI,CAAC;aACP;SACF,MAAM;YACLG,MAAM,CAACA,MAAM,CAACC,MAAM,CAAC,GAAGN,IAAI,CAACI,GAAG,CAAC;SAClC;QACDA,GAAG,IAAI,CAAC;KACT;IAED,OAAOC,MAAM,CAAkB;CAChC"}

View File

@@ -0,0 +1,11 @@
/**
* Takes an object with a hostname property (like a parsed URL) and some
* headers that may contain Host and returns the preferred hostname.
* @param parsed An object containing a hostname property.
* @param headers A dictionary with headers containing a `host`.
*/ export function getHostname(parsed, headers) {
var ref;
return (ref = !Array.isArray(headers == null ? void 0 : headers.host) && (headers == null ? void 0 : headers.host) || parsed.hostname) == null ? void 0 : ref.split(':')[0].toLowerCase();
}
//# sourceMappingURL=get-hostname.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../shared/lib/get-hostname.ts"],"names":["getHostname","parsed","headers","Array","isArray","host","hostname","split","toLowerCase"],"mappings":"AAAA;;;;;GAKG,CACH,OAAO,SAASA,WAAW,CACzBC,MAAoC,EACpCC,OAA0D,EAC1D;QACO,GAAqE;IAA5E,OAAO,CAAA,GAAqE,GAApE,AAAC,CAACC,KAAK,CAACC,OAAO,CAACF,OAAO,QAAM,GAAbA,KAAAA,CAAa,GAAbA,OAAO,CAAEG,IAAI,CAAC,IAAIH,CAAAA,OAAO,QAAM,GAAbA,KAAAA,CAAa,GAAbA,OAAO,CAAEG,IAAI,CAAA,IAAKJ,MAAM,CAACK,QAAQ,SAClE,GADF,KAAA,CACE,GADF,GAAqE,CACxEC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CACdC,WAAW,EAAE,CAAA;CACjB"}

View File

@@ -0,0 +1,7 @@
import React from 'react';
export const HeadManagerContext = React.createContext({});
if (process.env.NODE_ENV !== 'production') {
HeadManagerContext.displayName = 'HeadManagerContext';
}
//# sourceMappingURL=head-manager-context.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../shared/lib/head-manager-context.ts"],"names":["React","HeadManagerContext","createContext","process","env","NODE_ENV","displayName"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,MAAMC,kBAAkB,GAU1BD,KAAK,CAACE,aAAa,CAAC,EAAE,CAAC,CAAA;AAE5B,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzCJ,kBAAkB,CAACK,WAAW,GAAG,oBAAoB;CACtD"}

View File

@@ -0,0 +1,152 @@
"use client";
import _extends from "@swc/helpers/src/_extends.mjs";
import React, { useContext } from 'react';
import Effect from './side-effect';
import { AmpStateContext } from './amp-context';
import { HeadManagerContext } from './head-manager-context';
import { isInAmpMode } from './amp-mode';
import { warnOnce } from './utils/warn-once';
export function defaultHead(inAmpMode = false) {
const head = [
/*#__PURE__*/ React.createElement("meta", {
charSet: "utf-8"
})
];
if (!inAmpMode) {
head.push(/*#__PURE__*/ React.createElement("meta", {
name: "viewport",
content: "width=device-width"
}));
}
return head;
}
function onlyReactElement(list, child) {
// React children can be "string" or "number" in this case we ignore them for backwards compat
if (typeof child === 'string' || typeof child === 'number') {
return list;
}
// Adds support for React.Fragment
if (child.type === React.Fragment) {
return list.concat(React.Children.toArray(child.props.children).reduce((fragmentList, fragmentChild)=>{
if (typeof fragmentChild === 'string' || typeof fragmentChild === 'number') {
return fragmentList;
}
return fragmentList.concat(fragmentChild);
}, []));
}
return list.concat(child);
}
const METATYPES = [
'name',
'httpEquiv',
'charSet',
'itemProp'
];
/*
returns a function for filtering head child elements
which shouldn't be duplicated, like <title/>
Also adds support for deduplicated `key` properties
*/ function unique() {
const keys = new Set();
const tags = new Set();
const metaTypes = new Set();
const metaCategories = {};
return (h)=>{
let isUnique = true;
let hasKey = false;
if (h.key && typeof h.key !== 'number' && h.key.indexOf('$') > 0) {
hasKey = true;
const key = h.key.slice(h.key.indexOf('$') + 1);
if (keys.has(key)) {
isUnique = false;
} else {
keys.add(key);
}
}
// eslint-disable-next-line default-case
switch(h.type){
case 'title':
case 'base':
if (tags.has(h.type)) {
isUnique = false;
} else {
tags.add(h.type);
}
break;
case 'meta':
for(let i = 0, len = METATYPES.length; i < len; i++){
const metatype = METATYPES[i];
if (!h.props.hasOwnProperty(metatype)) continue;
if (metatype === 'charSet') {
if (metaTypes.has(metatype)) {
isUnique = false;
} else {
metaTypes.add(metatype);
}
} else {
const category = h.props[metatype];
const categories = metaCategories[metatype] || new Set();
if ((metatype !== 'name' || !hasKey) && categories.has(category)) {
isUnique = false;
} else {
categories.add(category);
metaCategories[metatype] = categories;
}
}
}
break;
}
return isUnique;
};
}
/**
*
* @param headChildrenElements List of children of <Head>
*/ function reduceComponents(headChildrenElements, props) {
const { inAmpMode } = props;
return headChildrenElements.reduce(onlyReactElement, []).reverse().concat(defaultHead(inAmpMode).reverse()).filter(unique()).reverse().map((c, i)=>{
const key = c.key || i;
if (process.env.NODE_ENV !== 'development' && process.env.__NEXT_OPTIMIZE_FONTS && !inAmpMode) {
if (c.type === 'link' && c.props['href'] && // TODO(prateekbh@): Replace this with const from `constants` when the tree shaking works.
[
'https://fonts.googleapis.com/css',
'https://use.typekit.net/'
].some((url)=>c.props['href'].startsWith(url))) {
const newProps = _extends({}, c.props || {});
newProps['data-href'] = newProps['href'];
newProps['href'] = undefined;
// Add this attribute to make it easy to identify optimized tags
newProps['data-optimized-fonts'] = true;
return /*#__PURE__*/ React.cloneElement(c, newProps);
}
}
if (process.env.NODE_ENV === 'development') {
// omit JSON-LD structured data snippets from the warning
if (c.type === 'script' && c.props['type'] !== 'application/ld+json') {
const srcMessage = c.props['src'] ? `<script> tag with src="${c.props['src']}"` : `inline <script>`;
warnOnce(`Do not add <script> tags using next/head (see ${srcMessage}). Use next/script instead. \nSee more info here: https://nextjs.org/docs/messages/no-script-tags-in-head-component`);
} else if (c.type === 'link' && c.props['rel'] === 'stylesheet') {
warnOnce(`Do not add stylesheets using next/head (see <link rel="stylesheet"> tag with href="${c.props['href']}"). Use Document instead. \nSee more info here: https://nextjs.org/docs/messages/no-stylesheets-in-head-component`);
}
}
return /*#__PURE__*/ React.cloneElement(c, {
key
});
});
}
/**
* This component injects elements to `<head>` of your page.
* To avoid duplicated `tags` in `<head>` you can use the `key` property, which will make sure every tag is only rendered once.
*/ function Head({ children }) {
const ampState = useContext(AmpStateContext);
const headManager = useContext(HeadManagerContext);
return /*#__PURE__*/ React.createElement(Effect, {
reduceComponentsToState: reduceComponents,
headManager: headManager,
inAmpMode: isInAmpMode(ampState)
}, children);
}
export default Head;
//# sourceMappingURL=head.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,15 @@
"use client";
import { createContext } from 'react';
export const SearchParamsContext = createContext(null);
export const PathnameContext = createContext(null);
export const ParamsContext = createContext(null);
export const LayoutSegmentsContext = createContext(null);
if (process.env.NODE_ENV !== 'production') {
SearchParamsContext.displayName = 'SearchParamsContext';
PathnameContext.displayName = 'PathnameContext';
ParamsContext.displayName = 'ParamsContext';
LayoutSegmentsContext.displayName = 'LayoutSegmentsContext';
}
//# sourceMappingURL=hooks-client-context.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../shared/lib/hooks-client-context.ts"],"names":["createContext","SearchParamsContext","PathnameContext","ParamsContext","LayoutSegmentsContext","process","env","NODE_ENV","displayName"],"mappings":"AAEA,SAASA,aAAa,QAAQ,OAAO,CAAA;AAFrC,YAAY;AAIZ,OAAO,MAAMC,mBAAmB,GAAGD,aAAa,CAAyB,IAAI,CAAC,CAAA;AAC9E,OAAO,MAAME,eAAe,GAAGF,aAAa,CAAgB,IAAI,CAAC,CAAA;AACjE,OAAO,MAAMG,aAAa,GAAGH,aAAa,CAAC,IAAI,CAAQ,CAAA;AACvD,OAAO,MAAMI,qBAAqB,GAAGJ,aAAa,CAAC,IAAI,CAAQ,CAAA;AAE/D,IAAIK,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzCN,mBAAmB,CAACO,WAAW,GAAG,qBAAqB;IACvDN,eAAe,CAACM,WAAW,GAAG,iBAAiB;IAC/CL,aAAa,CAACK,WAAW,GAAG,eAAe;IAC3CJ,qBAAqB,CAACI,WAAW,GAAG,uBAAuB;CAC5D"}

View File

@@ -0,0 +1,7 @@
import { createContext } from 'react';
export const HtmlContext = createContext(null);
if (process.env.NODE_ENV !== 'production') {
HtmlContext.displayName = 'HtmlContext';
}
//# sourceMappingURL=html-context.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../shared/lib/html-context.ts"],"names":["createContext","HtmlContext","process","env","NODE_ENV","displayName"],"mappings":"AAMA,SAASA,aAAa,QAAQ,OAAO,CAAA;AA0CrC,OAAO,MAAMC,WAAW,GAAGD,aAAa,CAAY,IAAI,CAAQ,CAAA;AAChE,IAAIE,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzCH,WAAW,CAACI,WAAW,GAAG,aAAa;CACxC"}

View File

@@ -0,0 +1,20 @@
export function detectDomainLocale(domainItems, hostname, detectedLocale) {
let domainItem;
if (domainItems) {
if (detectedLocale) {
detectedLocale = detectedLocale.toLowerCase();
}
for (const item of domainItems){
var ref, ref1;
// remove port if present
const domainHostname = (ref = item.domain) == null ? void 0 : ref.split(':')[0].toLowerCase();
if (hostname === domainHostname || detectedLocale === item.defaultLocale.toLowerCase() || ((ref1 = item.locales) == null ? void 0 : ref1.some((locale)=>locale.toLowerCase() === detectedLocale))) {
domainItem = item;
break;
}
}
}
return domainItem;
}
//# sourceMappingURL=detect-domain-locale.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../shared/lib/i18n/detect-domain-locale.ts"],"names":["detectDomainLocale","domainItems","hostname","detectedLocale","domainItem","toLowerCase","item","domainHostname","domain","split","defaultLocale","locales","some","locale"],"mappings":"AAEA,OAAO,SAASA,kBAAkB,CAChCC,WAA4B,EAC5BC,QAAiB,EACjBC,cAAuB,EACvB;IACA,IAAIC,UAAU,AAA0B;IAExC,IAAIH,WAAW,EAAE;QACf,IAAIE,cAAc,EAAE;YAClBA,cAAc,GAAGA,cAAc,CAACE,WAAW,EAAE;SAC9C;QAED,KAAK,MAAMC,IAAI,IAAIL,WAAW,CAAE;gBAEPK,GAAW,EAIhCA,IAAY;YALd,yBAAyB;YACzB,MAAMC,cAAc,GAAGD,CAAAA,GAAW,GAAXA,IAAI,CAACE,MAAM,SAAO,GAAlBF,KAAAA,CAAkB,GAAlBA,GAAW,CAAEG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAACJ,WAAW,EAAE;YAC/D,IACEH,QAAQ,KAAKK,cAAc,IAC3BJ,cAAc,KAAKG,IAAI,CAACI,aAAa,CAACL,WAAW,EAAE,KACnDC,CAAAA,IAAY,GAAZA,IAAI,CAACK,OAAO,SAAM,GAAlBL,KAAAA,CAAkB,GAAlBA,IAAY,CAAEM,IAAI,CAAC,CAACC,MAAM,GAAKA,MAAM,CAACR,WAAW,EAAE,KAAKF,cAAc,CAAC,CAAA,EACvE;gBACAC,UAAU,GAAGE,IAAI;gBACjB,MAAK;aACN;SACF;KACF;IAED,OAAOF,UAAU,CAAA;CAClB"}

View File

@@ -0,0 +1,6 @@
export function detectLocaleCookie(req, locales) {
const { NEXT_LOCALE } = req.cookies || {};
return NEXT_LOCALE ? locales.find((locale)=>NEXT_LOCALE.toLowerCase() === locale.toLowerCase()) : undefined;
}
//# sourceMappingURL=detect-locale-cookie.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../shared/lib/i18n/detect-locale-cookie.ts"],"names":["detectLocaleCookie","req","locales","NEXT_LOCALE","cookies","find","locale","toLowerCase","undefined"],"mappings":"AAEA,OAAO,SAASA,kBAAkB,CAACC,GAAoB,EAAEC,OAAiB,EAAE;IAC1E,MAAM,EAAEC,WAAW,CAAA,EAAE,GAAG,AAACF,GAAG,CAASG,OAAO,IAAI,EAAE;IAClD,OAAOD,WAAW,GACdD,OAAO,CAACG,IAAI,CACV,CAACC,MAAc,GAAKH,WAAW,CAACI,WAAW,EAAE,KAAKD,MAAM,CAACC,WAAW,EAAE,CACvE,GACDC,SAAS,CAAA;CACd"}

View File

@@ -0,0 +1,50 @@
import _extends from "@swc/helpers/src/_extends.mjs";
import { acceptLanguage } from '../../../server/accept-header';
import { denormalizePagePath } from '../page-path/denormalize-page-path';
import { detectDomainLocale } from './detect-domain-locale';
import { formatUrl } from '../router/utils/format-url';
import { getCookieParser } from '../../../server/api-utils';
function getLocaleFromCookie(i18n, headers = {}) {
var ref, ref1;
const nextLocale = (ref = getCookieParser(headers || {})()) == null ? void 0 : (ref1 = ref.NEXT_LOCALE) == null ? void 0 : ref1.toLowerCase();
return nextLocale ? i18n.locales.find((locale)=>nextLocale === locale.toLowerCase()) : undefined;
}
function detectLocale({ i18n , headers , domainLocale , preferredLocale , pathLocale }) {
return pathLocale || (domainLocale == null ? void 0 : domainLocale.defaultLocale) || getLocaleFromCookie(i18n, headers) || preferredLocale || i18n.defaultLocale;
}
function getAcceptPreferredLocale(i18n, headers) {
if ((headers == null ? void 0 : headers['accept-language']) && !Array.isArray(headers['accept-language'])) {
try {
return acceptLanguage(headers['accept-language'], i18n.locales);
} catch (err) {}
}
}
export function getLocaleRedirect({ defaultLocale , domainLocale , pathLocale , headers , nextConfig , urlParsed }) {
if (nextConfig.i18n && nextConfig.i18n.localeDetection !== false && denormalizePagePath(urlParsed.pathname) === '/') {
const preferredLocale = getAcceptPreferredLocale(nextConfig.i18n, headers);
const detectedLocale = detectLocale({
i18n: nextConfig.i18n,
preferredLocale,
headers,
pathLocale,
domainLocale
});
const preferredDomain = detectDomainLocale(nextConfig.i18n.domains, undefined, preferredLocale);
if (domainLocale && preferredDomain) {
const isPDomain = preferredDomain.domain === domainLocale.domain;
const isPLocale = preferredDomain.defaultLocale === preferredLocale;
if (!isPDomain || !isPLocale) {
const scheme = `http${preferredDomain.http ? '' : 's'}`;
const rlocale = isPLocale ? '' : preferredLocale;
return `${scheme}://${preferredDomain.domain}/${rlocale}`;
}
}
if (detectedLocale.toLowerCase() !== defaultLocale.toLowerCase()) {
return formatUrl(_extends({}, urlParsed, {
pathname: `${nextConfig.basePath || ''}/${detectedLocale}`
}));
}
}
}
//# sourceMappingURL=get-locale-redirect.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../shared/lib/i18n/get-locale-redirect.ts"],"names":["acceptLanguage","denormalizePagePath","detectDomainLocale","formatUrl","getCookieParser","getLocaleFromCookie","i18n","headers","nextLocale","NEXT_LOCALE","toLowerCase","locales","find","locale","undefined","detectLocale","domainLocale","preferredLocale","pathLocale","defaultLocale","getAcceptPreferredLocale","Array","isArray","err","getLocaleRedirect","nextConfig","urlParsed","localeDetection","pathname","detectedLocale","preferredDomain","domains","isPDomain","domain","isPLocale","scheme","http","rlocale","basePath"],"mappings":"AAAA;AAEA,SAASA,cAAc,QAAQ,+BAA+B,CAAA;AAC9D,SAASC,mBAAmB,QAAQ,oCAAoC,CAAA;AACxE,SAASC,kBAAkB,QAAQ,wBAAwB,CAAA;AAC3D,SAASC,SAAS,QAAQ,4BAA4B,CAAA;AACtD,SAASC,eAAe,QAAQ,2BAA2B,CAAA;AAe3D,SAASC,mBAAmB,CAC1BC,IAAgB,EAChBC,OAAyD,GAAG,EAAE,EAC9D;QACmBH,GAEhB;IAFH,MAAMI,UAAU,GAAGJ,CAAAA,GAEhB,GAFgBA,eAAe,CAChCG,OAAO,IAAI,EAAE,CACd,EAAE,SAAa,GAFGH,KAAAA,CAEH,GAFGA,QAAAA,GAEhB,CAAEK,WAAW,SAAA,GAFGL,KAAAA,CAEH,GAFGA,KAEDM,WAAW,EAAE;IAC/B,OAAOF,UAAU,GACbF,IAAI,CAACK,OAAO,CAACC,IAAI,CAAC,CAACC,MAAM,GAAKL,UAAU,KAAKK,MAAM,CAACH,WAAW,EAAE,CAAC,GAClEI,SAAS,CAAA;CACd;AAED,SAASC,YAAY,CAAC,EACpBT,IAAI,CAAA,EACJC,OAAO,CAAA,EACPS,YAAY,CAAA,EACZC,eAAe,CAAA,EACfC,UAAU,CAAA,EAOX,EAAE;IACD,OACEA,UAAU,IACVF,CAAAA,YAAY,QAAe,GAA3BA,KAAAA,CAA2B,GAA3BA,YAAY,CAAEG,aAAa,CAAA,IAC3Bd,mBAAmB,CAACC,IAAI,EAAEC,OAAO,CAAC,IAClCU,eAAe,IACfX,IAAI,CAACa,aAAa,CACnB;CACF;AAED,SAASC,wBAAwB,CAC/Bd,IAAgB,EAChBC,OAA0D,EAC1D;IACA,IACEA,CAAAA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AG,GAAG,CAAC,CAAC;gBACvD,MAAMC,OAAO,GAAGH,SAAS,GAAG,EAAE,GAAGjB,eAAe;gBAChD,OAAO,CAAC,EAAEkB,MAAM,CAAC,GAAG,EAAEL,eAAe,CAACG,MAAM,CAAC,CAAC,EAAEI,OAAO,CAAC,CAAC,CAAA;aAC1D;SACF;QAED,IAAIR,cAAc,CAACnB,WAAW,EAAE,KAAKS,aAAa,CAACT,WAAW,EAAE,EAAE;YAChE,OAAOP,SAAS,CAAC,aACZuB,SAAS;gBACZE,QAAQ,EAAE,CAAC,EAAEH,UAAU,CAACa,QAAQ,IAAI,EAAE,CAAC,CAAC,EAAET,cAAc,CAAC,CAAC;cAC3D,CAAC,CAAA;SACH;KACF;CACF"}

View File

@@ -0,0 +1,28 @@
/**
* For a pathname that may include a locale from a list of locales, it
* removes the locale from the pathname returning it alongside with the
* detected locale.
*
* @param pathname A pathname that may include a locale.
* @param locales A list of locales.
* @returns The detected locale and pathname without locale
*/ export function normalizeLocalePath(pathname, locales) {
let detectedLocale;
// first item will be empty string from splitting at first char
const pathnameParts = pathname.split('/');
(locales || []).some((locale)=>{
if (pathnameParts[1] && pathnameParts[1].toLowerCase() === locale.toLowerCase()) {
detectedLocale = locale;
pathnameParts.splice(1, 1);
pathname = pathnameParts.join('/') || '/';
return true;
}
return false;
});
return {
pathname,
detectedLocale
};
}
//# sourceMappingURL=normalize-locale-path.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../shared/lib/i18n/normalize-locale-path.ts"],"names":["normalizeLocalePath","pathname","locales","detectedLocale","pathnameParts","split","some","locale","toLowerCase","splice","join"],"mappings":"AAKA;;;;;;;;GAQG,CACH,OAAO,SAASA,mBAAmB,CACjCC,QAAgB,EAChBC,OAAkB,EACN;IACZ,IAAIC,cAAc,AAAoB;IACtC,+DAA+D;IAC/D,MAAMC,aAAa,GAAGH,QAAQ,CAACI,KAAK,CAAC,GAAG,CAAC,AAExC;IAAA,CAACH,OAAO,IAAI,EAAE,CAAC,CAACI,IAAI,CAAC,CAACC,MAAM,GAAK;QAChC,IACEH,aAAa,CAAC,CAAC,CAAC,IAChBA,aAAa,CAAC,CAAC,CAAC,CAACI,WAAW,EAAE,KAAKD,MAAM,CAACC,WAAW,EAAE,EACvD;YACAL,cAAc,GAAGI,MAAM;YACvBH,aAAa,CAACK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;YAC1BR,QAAQ,GAAGG,aAAa,CAACM,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG;YACzC,OAAO,IAAI,CAAA;SACZ;QACD,OAAO,KAAK,CAAA;KACb,CAAC;IAEF,OAAO;QACLT,QAAQ;QACRE,cAAc;KACf,CAAA;CACF"}

View File

@@ -0,0 +1,14 @@
/**
* A shared function, used on both client and server, to generate a SVG blur placeholder.
*/ export function getImageBlurSvg({ widthInt , heightInt , blurWidth , blurHeight , blurDataURL }) {
const std = blurWidth && blurHeight ? '1' : '20';
const svgWidth = blurWidth || widthInt;
const svgHeight = blurHeight || heightInt;
const feComponentTransfer = blurDataURL.startsWith('data:image/jpeg') ? `%3CfeComponentTransfer%3E%3CfeFuncA type='discrete' tableValues='1 1'/%3E%3C/feComponentTransfer%3E%` : '';
if (svgWidth && svgHeight) {
return `%3Csvg xmlns='http%3A//www.w3.org/2000/svg' viewBox='0 0 ${svgWidth} ${svgHeight}'%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='${std}'/%3E${feComponentTransfer}%3C/filter%3E%3Cimage preserveAspectRatio='none' filter='url(%23b)' x='0' y='0' height='100%25' width='100%25' href='${blurDataURL}'/%3E%3C/svg%3E`;
}
return `%3Csvg xmlns='http%3A//www.w3.org/2000/svg'%3E%3Cimage style='filter:blur(20px)' x='0' y='0' height='100%25' width='100%25' href='${blurDataURL}'/%3E%3C/svg%3E`;
}
//# sourceMappingURL=image-blur-svg.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../shared/lib/image-blur-svg.ts"],"names":["getImageBlurSvg","widthInt","heightInt","blurWidth","blurHeight","blurDataURL","std","svgWidth","svgHeight","feComponentTransfer","startsWith"],"mappings":"AAAA;;GAEG,CACH,OAAO,SAASA,eAAe,CAAC,EAC9BC,QAAQ,CAAA,EACRC,SAAS,CAAA,EACTC,SAAS,CAAA,EACTC,UAAU,CAAA,EACVC,WAAW,CAAA,EAOZ,EAAU;IACT,MAAMC,GAAG,GAAGH,SAAS,IAAIC,UAAU,GAAG,GAAG,GAAG,IAAI;IAChD,MAAMG,QAAQ,GAAGJ,SAAS,IAAIF,QAAQ;IACtC,MAAMO,SAAS,GAAGJ,UAAU,IAAIF,SAAS;IACzC,MAAMO,mBAAmB,GAAGJ,WAAW,CAACK,UAAU,CAAC,iBAAiB,CAAC,GACjE,CAAC,oGAAoG,CAAC,GACtG,EAAE;IACN,IAAIH,QAAQ,IAAIC,SAAS,EAAE;QACzB,OAAO,CAAC,yDAAyD,EAAED,QAAQ,CAAC,CAAC,EAAEC,SAAS,CAAC,0FAA0F,EAAEF,GAAG,CAAC,KAAK,EAAEG,mBAAmB,CAAC,qHAAqH,EAAEJ,WAAW,CAAC,eAAe,CAAC,CAAA;KACxW;IACD,OAAO,CAAC,kIAAkI,EAAEA,WAAW,CAAC,eAAe,CAAC,CAAA;CACzK"}

View File

@@ -0,0 +1,8 @@
import React from 'react';
import { imageConfigDefault } from './image-config';
export const ImageConfigContext = React.createContext(imageConfigDefault);
if (process.env.NODE_ENV !== 'production') {
ImageConfigContext.displayName = 'ImageConfigContext';
}
//# sourceMappingURL=image-config-context.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../shared/lib/image-config-context.ts"],"names":["React","imageConfigDefault","ImageConfigContext","createContext","process","env","NODE_ENV","displayName"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO,CAAA;AACzB,SAA8BC,kBAAkB,QAAQ,gBAAgB,CAAA;AAExE,OAAO,MAAMC,kBAAkB,GAC7BF,KAAK,CAACG,aAAa,CAAsBF,kBAAkB,CAAC,CAAA;AAE9D,IAAIG,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzCJ,kBAAkB,CAACK,WAAW,GAAG,oBAAoB;CACtD"}

View File

@@ -0,0 +1,44 @@
export const VALID_LOADERS = [
'default',
'imgix',
'cloudinary',
'akamai',
'custom',
];
export const imageConfigDefault = {
deviceSizes: [
640,
750,
828,
1080,
1200,
1920,
2048,
3840
],
imageSizes: [
16,
32,
48,
64,
96,
128,
256,
384
],
path: '/_next/image',
loader: 'default',
loaderFile: '',
domains: [],
disableStaticImages: false,
minimumCacheTTL: 60,
formats: [
'image/webp'
],
dangerouslyAllowSVG: false,
contentSecurityPolicy: `script-src 'none'; frame-src 'none'; sandbox;`,
remotePatterns: [],
unoptimized: false
};
//# sourceMappingURL=image-config.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../shared/lib/image-config.ts"],"names":["VALID_LOADERS","imageConfigDefault","deviceSizes","imageSizes","path","loader","loaderFile","domains","disableStaticImages","minimumCacheTTL","formats","dangerouslyAllowSVG","contentSecurityPolicy","remotePatterns","unoptimized"],"mappings":"AAAA,OAAO,MAAMA,aAAa,GAAG;IAC3B,SAAS;IACT,OAAO;IACP,YAAY;IACZ,QAAQ;IACR,QAAQ;CACT,AAAS,CAAA;AA6FV,OAAO,MAAMC,kBAAkB,GAAwB;IACrDC,WAAW,EAAE;AAAC,WAAG;AAAE,WAAG;AAAE,WAAG;AAAE,YAAI;AAAE,YAAI;AAAE,YAAI;AAAE,YAAI;AAAE,YAAI;KAAC;IAC1DC,UAAU,EAAE;AAAC,UAAE;AAAE,UAAE;AAAE,UAAE;AAAE,UAAE;AAAE,UAAE;AAAE,WAAG;AAAE,WAAG;AAAE,WAAG;KAAC;IAC/CC,IAAI,EAAE,cAAc;IACpBC,MAAM,EAAE,SAAS;IACjBC,UAAU,EAAE,EAAE;IACdC,OAAO,EAAE,EAAE;IACXC,mBAAmB,EAAE,KAAK;IAC1BC,eAAe,EAAE,EAAE;IACnBC,OAAO,EAAE;QAAC,YAAY;KAAC;IACvBC,mBAAmB,EAAE,KAAK;IAC1BC,qBAAqB,EAAE,CAAC,6CAA6C,CAAC;IACtEC,cAAc,EAAE,EAAE;IAClBC,WAAW,EAAE,KAAK;CACnB,CAAA"}

View File

@@ -0,0 +1,41 @@
function defaultLoader({ config , src , width , quality }) {
if (process.env.NODE_ENV !== 'production') {
const missingValues = [];
// these should always be provided but make sure they are
if (!src) missingValues.push('src');
if (!width) missingValues.push('width');
if (missingValues.length > 0) {
throw new Error(`Next Image Optimization requires ${missingValues.join(', ')} to be provided. Make sure you pass them as props to the \`next/image\` component. Received: ${JSON.stringify({
src,
width,
quality
})}`);
}
if (src.startsWith('//')) {
throw new Error(`Failed to parse src "${src}" on \`next/image\`, protocol-relative URL (//) must be changed to an absolute URL (http:// or https://)`);
}
if (!src.startsWith('/') && (config.domains || config.remotePatterns)) {
let parsedSrc;
try {
parsedSrc = new URL(src);
} catch (err) {
console.error(err);
throw new Error(`Failed to parse src "${src}" on \`next/image\`, if using relative image it must start with a leading slash "/" or be an absolute URL (http:// or https://)`);
}
if (process.env.NODE_ENV !== 'test') {
// We use dynamic require because this should only error in development
const { hasMatch } = require('./match-remote-pattern');
if (!hasMatch(config.domains, config.remotePatterns, parsedSrc)) {
throw new Error(`Invalid src prop (${src}) on \`next/image\`, hostname "${parsedSrc.hostname}" is not configured under images in your \`next.config.js\`\n` + `See more info: https://nextjs.org/docs/messages/next-image-unconfigured-host`);
}
}
}
}
return `${config.path}?url=${encodeURIComponent(src)}&w=${width}&q=${quality || 75}`;
}
// We use this to determine if the import is the default loader
// or a custom loader defined by the user in next.config.js
defaultLoader.__next_img_default = true;
export default defaultLoader;
//# sourceMappingURL=image-loader.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../shared/lib/image-loader.ts"],"names":["defaultLoader","config","src","width","quality","process","env","NODE_ENV","missingValues","push","length","Error","join","JSON","stringify","startsWith","domains","remotePatterns","parsedSrc","URL","err","console","error","hasMatch","require","hostname","path","encodeURIComponent","__next_img_default"],"mappings":"AAEA,SAASA,aAAa,CAAC,EACrBC,MAAM,CAAA,EACNC,GAAG,CAAA,EACHC,KAAK,CAAA,EACLC,OAAO,CAAA,EACoB,EAAU;IACrC,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;QACzC,MAAMC,aAAa,GAAG,EAAE;QAExB,yDAAyD;QACzD,IAAI,CAACN,GAAG,EAAEM,aAAa,CAACC,IAAI,CAAC,KAAK,CAAC;QACnC,IAAI,CAACN,KAAK,EAAEK,aAAa,CAACC,IAAI,CAAC,OAAO,CAAC;QAEvC,IAAID,aAAa,CAACE,MAAM,GAAG,CAAC,EAAE;YAC5B,MAAM,IAAIC,KAAK,CACb,CAAC,iCAAiC,EAAEH,aAAa,CAACI,IAAI,CACpD,IAAI,CACL,CAAC,6FAA6F,EAAEC,IAAI,CAACC,SAAS,CAC7G;gBAAEZ,GAAG;gBAAEC,KAAK;gBAAEC,OAAO;aAAE,CACxB,CAAC,CAAC,CACJ,CAAA;SACF;QAED,IAAIF,GAAG,CAACa,UAAU,CAAC,IAAI,CAAC,EAAE;YACxB,MAAM,IAAIJ,KAAK,CACb,CAAC,qBAAqB,EAAET,GAAG,CAAC,wGAAwG,CAAC,CACtI,CAAA;SACF;QAED,IAAI,CAACA,GAAG,CAACa,UAAU,CAAC,GAAG,CAAC,IAAI,CAACd,MAAM,CAACe,OAAO,IAAIf,MAAM,CAACgB,cAAc,CAAC,EAAE;YACrE,IAAIC,SAAS,AAAK;YAClB,IAAI;gBACFA,SAAS,GAAG,IAAIC,GAAG,CAACjB,GAAG,CAAC;aACzB,CAAC,OAAOkB,GAAG,EAAE;gBACZC,OAAO,CAACC,KAAK,CAACF,GAAG,CAAC;gBAClB,MAAM,IAAIT,KAAK,CACb,CAAC,qBAAqB,EAAET,GAAG,CAAC,+HAA+H,CAAC,CAC7J,CAAA;aACF;YAED,IAAIG,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,MAAM,EAAE;gBACnC,uEAAuE;gBACvE,MAAM,EAAEgB,QAAQ,CAAA,EAAE,GAAGC,OAAO,CAAC,wBAAwB,CAAC;gBACtD,IAAI,CAACD,QAAQ,CAACtB,MAAM,CAACe,OAAO,EAAEf,MAAM,CAACgB,cAAc,EAAEC,SAAS,CAAC,EAAE;oBAC/D,MAAM,IAAIP,KAAK,CACb,CAAC,kBAAkB,EAAET,GAAG,CAAC,+BAA+B,EAAEgB,SAAS,CAACO,QAAQ,CAAC,6DAA6D,CAAC,GACzI,CAAC,4EAA4E,CAAC,CACjF,CAAA;iBACF;aACF;SACF;KACF;IAED,OAAO,CAAC,EAAExB,MAAM,CAACyB,IAAI,CAAC,KAAK,EAAEC,kBAAkB,CAACzB,GAAG,CAAC,CAAC,GAAG,EAAEC,KAAK,CAAC,GAAG,EACjEC,OAAO,IAAI,EAAE,CACd,CAAC,CAAA;CACH;AAED,+DAA+D;AAC/D,2DAA2D;AAC3DJ,aAAa,CAAC4B,kBAAkB,GAAG,IAAI;AAEvC,eAAe5B,aAAa,CAAA"}

View File

@@ -0,0 +1,20 @@
export function getObjectClassLabel(value) {
return Object.prototype.toString.call(value);
}
export function isPlainObject(value) {
if (getObjectClassLabel(value) !== '[object Object]') {
return false;
}
const prototype = Object.getPrototypeOf(value);
/**
* this used to be previously:
*
* `return prototype === null || prototype === Object.prototype`
*
* but Edge Runtime expose Object from vm, being that kind of type-checking wrongly fail.
*
* It was changed to the current implementation since it's resilient to serialization.
*/ return prototype === null || prototype.hasOwnProperty('isPrototypeOf');
}
//# sourceMappingURL=is-plain-object.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../shared/lib/is-plain-object.ts"],"names":["getObjectClassLabel","value","Object","prototype","toString","call","isPlainObject","getPrototypeOf","hasOwnProperty"],"mappings":"AAAA,OAAO,SAASA,mBAAmB,CAACC,KAAU,EAAU;IACtD,OAAOC,MAAM,CAACC,SAAS,CAACC,QAAQ,CAACC,IAAI,CAACJ,KAAK,CAAC,CAAA;CAC7C;AAED,OAAO,SAASK,aAAa,CAACL,KAAU,EAAW;IACjD,IAAID,mBAAmB,CAACC,KAAK,CAAC,KAAK,iBAAiB,EAAE;QACpD,OAAO,KAAK,CAAA;KACb;IAED,MAAME,SAAS,GAAGD,MAAM,CAACK,cAAc,CAACN,KAAK,CAAC;IAE9C;;;;;;;;KAQG,CACH,OAAOE,SAAS,KAAK,IAAI,IAAIA,SAAS,CAACK,cAAc,CAAC,eAAe,CAAC,CAAA;CACvE"}

View File

@@ -0,0 +1,3 @@
import m from 'path'
export = m

View File

@@ -0,0 +1,8 @@
/**
* This module is for next.js server internal usage of path module.
* It will use native path module for nodejs runtime.
* It will use path-browserify polyfill for edge runtime.
*/ const path = process.env.NEXT_RUNTIME === 'edge' ? require('next/dist/compiled/path-browserify') : require('path');
module.exports = path;
//# sourceMappingURL=path.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../shared/lib/isomorphic/path.js"],"names":["path","process","env","NEXT_RUNTIME","require","module","exports"],"mappings":"AAAA;;;;GAIG,CAEH,MAAMA,IAAI,GACRC,OAAO,CAACC,GAAG,CAACC,YAAY,KAAK,MAAM,GAC/BC,OAAO,CAAC,oCAAoC,CAAC,GAC7CA,OAAO,CAAC,MAAM,CAAC;AAErBC,MAAM,CAACC,OAAO,GAAGN,IAAI"}

View File

@@ -0,0 +1,9 @@
"use client";
import React from 'react';
export const LoadableContext = React.createContext(null);
if (process.env.NODE_ENV !== 'production') {
LoadableContext.displayName = 'LoadableContext';
}
//# sourceMappingURL=loadable-context.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../shared/lib/loadable-context.ts"],"names":["React","LoadableContext","createContext","process","env","NODE_ENV","displayName"],"mappings":"AAEA,OAAOA,KAAK,MAAM,OAAO,CAAA;AAFzB,YAAY;AAMZ,OAAO,MAAMC,eAAe,GAAGD,KAAK,CAACE,aAAa,CAAmB,IAAI,CAAC,CAAA;AAE1E,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzCJ,eAAe,CAACK,WAAW,GAAG,iBAAiB;CAChD"}

View File

@@ -0,0 +1,15 @@
/* tslint:disable */
import React from 'react'
declare namespace LoadableExport {
interface ILoadable {
<P = {}>(opts: any): React.ComponentClass<P>
Map<P = {}>(opts: any): React.ComponentType<P>
preloadAll(): Promise<any>
}
}
// eslint-disable-next-line @typescript-eslint/no-redeclare
declare const LoadableExport: LoadableExport.ILoadable
export = LoadableExport

View File

@@ -0,0 +1,217 @@
import _extends from "@swc/helpers/src/_extends.mjs";
/**
@copyright (c) 2017-present James Kyle <me@thejameskyle.com>
MIT License
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
*/ // https://github.com/jamiebuilds/react-loadable/blob/v5.5.0/src/index.js
// Modified to be compatible with webpack 4 / Next.js
import React from 'react';
import { LoadableContext } from './loadable-context';
const ALL_INITIALIZERS = [];
const READY_INITIALIZERS = [];
let initialized = false;
function load(loader) {
let promise = loader();
let state = {
loading: true,
loaded: null,
error: null
};
state.promise = promise.then((loaded)=>{
state.loading = false;
state.loaded = loaded;
return loaded;
}).catch((err)=>{
state.loading = false;
state.error = err;
throw err;
});
return state;
}
function createLoadableComponent(loadFn, options) {
let opts = Object.assign({
loader: null,
loading: null,
delay: 200,
timeout: null,
webpack: null,
modules: null
}, options);
opts.lazy = React.lazy(opts.loader);
/** @type LoadableSubscription */ let subscription = null;
function init() {
if (!subscription) {
const sub = new LoadableSubscription(loadFn, opts);
subscription = {
getCurrentValue: sub.getCurrentValue.bind(sub),
subscribe: sub.subscribe.bind(sub),
retry: sub.retry.bind(sub),
promise: sub.promise.bind(sub)
};
}
return subscription.promise();
}
// Server only
if (typeof window === 'undefined') {
ALL_INITIALIZERS.push(init);
}
// Client only
if (!initialized && typeof window !== 'undefined') {
// require.resolveWeak check is needed for environments that don't have it available like Jest
const moduleIds = opts.webpack && typeof require.resolveWeak === 'function' ? opts.webpack() : opts.modules;
if (moduleIds) {
READY_INITIALIZERS.push((ids)=>{
for (const moduleId of moduleIds){
if (ids.indexOf(moduleId) !== -1) {
return init();
}
}
});
}
}
function useLoadableModule() {
init();
const context = React.useContext(LoadableContext);
if (context && Array.isArray(opts.modules)) {
opts.modules.forEach((moduleName)=>{
context(moduleName);
});
}
}
function LoadableComponent(props) {
useLoadableModule();
const fallbackElement = React.createElement(opts.loading, {
isLoading: true,
pastDelay: true,
error: null
});
return React.createElement(React.Suspense, {
fallback: fallbackElement
}, React.createElement(opts.lazy, props));
}
LoadableComponent.preload = ()=>init();
LoadableComponent.displayName = 'LoadableComponent';
return LoadableComponent;
}
class LoadableSubscription {
promise() {
return this._res.promise;
}
retry() {
this._clearTimeouts();
this._res = this._loadFn(this._opts.loader);
this._state = {
pastDelay: false,
timedOut: false
};
const { _res: res , _opts: opts } = this;
if (res.loading) {
if (typeof opts.delay === 'number') {
if (opts.delay === 0) {
this._state.pastDelay = true;
} else {
this._delay = setTimeout(()=>{
this._update({
pastDelay: true
});
}, opts.delay);
}
}
if (typeof opts.timeout === 'number') {
this._timeout = setTimeout(()=>{
this._update({
timedOut: true
});
}, opts.timeout);
}
}
this._res.promise.then(()=>{
this._update({});
this._clearTimeouts();
}).catch((_err)=>{
this._update({});
this._clearTimeouts();
});
this._update({});
}
_update(partial) {
this._state = _extends({}, this._state, {
error: this._res.error,
loaded: this._res.loaded,
loading: this._res.loading
}, partial);
this._callbacks.forEach((callback)=>callback());
}
_clearTimeouts() {
clearTimeout(this._delay);
clearTimeout(this._timeout);
}
getCurrentValue() {
return this._state;
}
subscribe(callback) {
this._callbacks.add(callback);
return ()=>{
this._callbacks.delete(callback);
};
}
constructor(loadFn, opts){
this._loadFn = loadFn;
this._opts = opts;
this._callbacks = new Set();
this._delay = null;
this._timeout = null;
this.retry();
}
}
function Loadable(opts) {
return createLoadableComponent(load, opts);
}
function flushInitializers(initializers, ids) {
let promises = [];
while(initializers.length){
let init = initializers.pop();
promises.push(init(ids));
}
return Promise.all(promises).then(()=>{
if (initializers.length) {
return flushInitializers(initializers, ids);
}
});
}
Loadable.preloadAll = ()=>{
return new Promise((resolveInitializers, reject)=>{
flushInitializers(ALL_INITIALIZERS).then(resolveInitializers, reject);
});
};
Loadable.preloadReady = (ids = [])=>{
return new Promise((resolvePreload)=>{
const res = ()=>{
initialized = true;
return resolvePreload();
};
// We always will resolve, errors should be handled within loading UIs.
flushInitializers(READY_INITIALIZERS, ids).then(res, res);
});
};
if (typeof window !== 'undefined') {
window.__NEXT_PRELOADREADY = Loadable.preloadReady;
}
export default Loadable;
//# sourceMappingURL=loadable.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,31 @@
import { makeRe } from 'next/dist/compiled/micromatch';
export function matchRemotePattern(pattern, url) {
if (pattern.protocol !== undefined) {
const actualProto = url.protocol.slice(0, -1);
if (pattern.protocol !== actualProto) {
return false;
}
}
if (pattern.port !== undefined) {
if (pattern.port !== url.port) {
return false;
}
}
if (pattern.hostname === undefined) {
throw new Error(`Pattern should define hostname but found\n${JSON.stringify(pattern)}`);
} else {
if (!makeRe(pattern.hostname).test(url.hostname)) {
return false;
}
}
var _pathname;
if (!makeRe((_pathname = pattern.pathname) != null ? _pathname : '**').test(url.pathname)) {
return false;
}
return true;
}
export function hasMatch(domains, remotePatterns, url) {
return domains.some((domain)=>url.hostname === domain) || remotePatterns.some((p)=>matchRemotePattern(p, url));
}
//# sourceMappingURL=match-remote-pattern.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../shared/lib/match-remote-pattern.ts"],"names":["makeRe","matchRemotePattern","pattern","url","protocol","undefined","actualProto","slice","port","hostname","Error","JSON","stringify","test","pathname","hasMatch","domains","remotePatterns","some","domain","p"],"mappings":"AACA,SAASA,MAAM,QAAQ,+BAA+B,CAAA;AAEtD,OAAO,SAASC,kBAAkB,CAACC,OAAsB,EAAEC,GAAQ,EAAW;IAC5E,IAAID,OAAO,CAACE,QAAQ,KAAKC,SAAS,EAAE;QAClC,MAAMC,WAAW,GAAGH,GAAG,CAACC,QAAQ,CAACG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC7C,IAAIL,OAAO,CAACE,QAAQ,KAAKE,WAAW,EAAE;YACpC,OAAO,KAAK,CAAA;SACb;KACF;IACD,IAAIJ,OAAO,CAACM,IAAI,KAAKH,SAAS,EAAE;QAC9B,IAAIH,OAAO,CAACM,IAAI,KAAKL,GAAG,CAACK,IAAI,EAAE;YAC7B,OAAO,KAAK,CAAA;SACb;KACF;IAED,IAAIN,OAAO,CAACO,QAAQ,KAAKJ,SAAS,EAAE;QAClC,MAAM,IAAIK,KAAK,CACb,CAAC,0CAA0C,EAAEC,IAAI,CAACC,SAAS,CAACV,OAAO,CAAC,CAAC,CAAC,CACvE,CAAA;KACF,MAAM;QACL,IAAI,CAACF,MAAM,CAACE,OAAO,CAACO,QAAQ,CAAC,CAACI,IAAI,CAACV,GAAG,CAACM,QAAQ,CAAC,EAAE;YAChD,OAAO,KAAK,CAAA;SACb;KACF;QAEWP,SAAgB;IAA5B,IAAI,CAACF,MAAM,CAACE,CAAAA,SAAgB,GAAhBA,OAAO,CAACY,QAAQ,YAAhBZ,SAAgB,GAAI,IAAI,CAAC,CAACW,IAAI,CAACV,GAAG,CAACW,QAAQ,CAAC,EAAE;QACxD,OAAO,KAAK,CAAA;KACb;IAED,OAAO,IAAI,CAAA;CACZ;AAED,OAAO,SAASC,QAAQ,CACtBC,OAAiB,EACjBC,cAA+B,EAC/Bd,GAAQ,EACC;IACT,OACEa,OAAO,CAACE,IAAI,CAAC,CAACC,MAAM,GAAKhB,GAAG,CAACM,QAAQ,KAAKU,MAAM,CAAC,IACjDF,cAAc,CAACC,IAAI,CAAC,CAACE,CAAC,GAAKnB,kBAAkB,CAACmB,CAAC,EAAEjB,GAAG,CAAC,CAAC,CACvD;CACF"}

View File

@@ -0,0 +1,20 @@
export default function mitt() {
const all = Object.create(null);
return {
on (type, handler) {
(all[type] || (all[type] = [])).push(handler);
},
off (type, handler) {
if (all[type]) {
all[type].splice(all[type].indexOf(handler) >>> 0, 1);
}
},
emit (type, ...evts) {
(all[type] || []).slice().map((handler)=>{
handler(...evts);
});
}
};
};
//# sourceMappingURL=mitt.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../shared/lib/mitt.ts"],"names":["mitt","all","Object","create","on","type","handler","push","off","splice","indexOf","emit","evts","slice","map"],"mappings":"AAwBA,eAAe,SAASA,IAAI,GAAwB;IAClD,MAAMC,GAAG,GAA+BC,MAAM,CAACC,MAAM,CAAC,IAAI,CAAC;IAE3D,OAAO;QACLC,EAAE,EAACC,IAAY,EAAEC,OAAgB,EAAE;YAChC,CAACL,GAAG,CAACI,IAAI,CAAC,IAAI,CAACJ,GAAG,CAACI,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAACE,IAAI,CAACD,OAAO,CAAC;SAC/C;QAEDE,GAAG,EAACH,IAAY,EAAEC,OAAgB,EAAE;YAClC,IAAIL,GAAG,CAACI,IAAI,CAAC,EAAE;gBACbJ,GAAG,CAACI,IAAI,CAAC,CAACI,MAAM,CAACR,GAAG,CAACI,IAAI,CAAC,CAACK,OAAO,CAACJ,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;aACtD;SACF;QAEDK,IAAI,EAACN,IAAY,EAAE,GAAGO,IAAI,AAAO,EAAE;YAEhC,CAACX,GAAG,CAACI,IAAI,CAAC,IAAI,EAAE,CAAC,CAACQ,KAAK,EAAE,CAACC,GAAG,CAAC,CAACR,OAAgB,GAAK;gBACnDA,OAAO,IAAIM,IAAI,CAAC;aACjB,CAAC;SACH;KACF,CAAA;CACF,CAAA"}

View File

@@ -0,0 +1,4 @@
// This has to be a shared module which is shared between client component error boundary and dynamic component
export const NEXT_DYNAMIC_NO_SSR_CODE = 'DYNAMIC_SERVER_USAGE';
//# sourceMappingURL=no-ssr-error.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../shared/lib/no-ssr-error.ts"],"names":["NEXT_DYNAMIC_NO_SSR_CODE"],"mappings":"AAAA,+GAA+G;AAE/G,OAAO,MAAMA,wBAAwB,GAAG,sBAAsB,CAAA"}

View File

@@ -0,0 +1,22 @@
import { ensureLeadingSlash } from './ensure-leading-slash';
import { normalizePathSep } from './normalize-path-sep';
import { relative } from '../isomorphic/path';
import { removePagePathTail } from './remove-page-path-tail';
/**
* Given the absolute path to the pages folder, an absolute file path for a
* page and the page extensions, this function will return the page path
* relative to the pages folder. It doesn't consider index tail. Example:
* - `/Users/rick/my-project/pages/foo/bar/baz.js` -> `/foo/bar/baz`
*
* @param filepath Absolute path to the page.
* @param opts.pagesDir Absolute path to the pages folder.
* @param opts.extensions Extensions allowed for the page.
* @param opts.keepIndex When true the trailing `index` kept in the path.
*/ export function absolutePathToPage(pagePath, options) {
return removePagePathTail(normalizePathSep(ensureLeadingSlash(relative(options.pagesDir, pagePath))), {
extensions: options.extensions,
keepIndex: options.keepIndex
});
}
//# sourceMappingURL=absolute-path-to-page.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../shared/lib/page-path/absolute-path-to-page.ts"],"names":["ensureLeadingSlash","normalizePathSep","relative","removePagePathTail","absolutePathToPage","pagePath","options","pagesDir","extensions","keepIndex"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,wBAAwB,CAAA;AAC3D,SAASC,gBAAgB,QAAQ,sBAAsB,CAAA;AACvD,SAASC,QAAQ,QAAQ,oBAAoB,CAAA;AAC7C,SAASC,kBAAkB,QAAQ,yBAAyB,CAAA;AAE5D;;;;;;;;;;GAUG,CACH,OAAO,SAASC,kBAAkB,CAChCC,QAAgB,EAChBC,OAIC,EACD;IACA,OAAOH,kBAAkB,CACvBF,gBAAgB,CAACD,kBAAkB,CAACE,QAAQ,CAACI,OAAO,CAACC,QAAQ,EAAEF,QAAQ,CAAC,CAAC,CAAC,EAC1E;QACEG,UAAU,EAAEF,OAAO,CAACE,UAAU;QAC9BC,SAAS,EAAEH,OAAO,CAACG,SAAS;KAC7B,CACF,CAAA;CACF"}

View File

@@ -0,0 +1,15 @@
import { isDynamicRoute } from '../router/utils';
import { normalizePathSep } from './normalize-path-sep';
/**
* Performs the opposite transformation of `normalizePagePath`. Note that
* this function is not idempotent either in cases where there are multiple
* leading `/index` for the page. Examples:
* - `/index` -> `/`
* - `/index/foo` -> `/foo`
* - `/index/index` -> `/index`
*/ export function denormalizePagePath(page) {
let _page = normalizePathSep(page);
return _page.startsWith('/index/') && !isDynamicRoute(_page) ? _page.slice(6) : _page !== '/index' ? _page : '/';
}
//# sourceMappingURL=denormalize-page-path.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../shared/lib/page-path/denormalize-page-path.ts"],"names":["isDynamicRoute","normalizePathSep","denormalizePagePath","page","_page","startsWith","slice"],"mappings":"AAAA,SAASA,cAAc,QAAQ,iBAAiB,CAAA;AAChD,SAASC,gBAAgB,QAAQ,sBAAsB,CAAA;AAEvD;;;;;;;GAOG,CACH,OAAO,SAASC,mBAAmB,CAACC,IAAY,EAAE;IAChD,IAAIC,KAAK,GAAGH,gBAAgB,CAACE,IAAI,CAAC;IAClC,OAAOC,KAAK,CAACC,UAAU,CAAC,SAAS,CAAC,IAAI,CAACL,cAAc,CAACI,KAAK,CAAC,GACxDA,KAAK,CAACE,KAAK,CAAC,CAAC,CAAC,GACdF,KAAK,KAAK,QAAQ,GAClBA,KAAK,GACL,GAAG,CAAA;CACR"}

View File

@@ -0,0 +1,8 @@
/**
* For a given page path, this function ensures that there is a leading slash.
* If there is not a leading slash, one is added, otherwise it is noop.
*/ export function ensureLeadingSlash(path) {
return path.startsWith('/') ? path : `/${path}`;
}
//# sourceMappingURL=ensure-leading-slash.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../shared/lib/page-path/ensure-leading-slash.ts"],"names":["ensureLeadingSlash","path","startsWith"],"mappings":"AAAA;;;GAGG,CACH,OAAO,SAASA,kBAAkB,CAACC,IAAY,EAAE;IAC/C,OAAOA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC,GAAGD,IAAI,GAAG,CAAC,CAAC,EAAEA,IAAI,CAAC,CAAC,CAAA;CAChD"}

View File

@@ -0,0 +1,33 @@
import { denormalizePagePath } from './denormalize-page-path';
import { flatten } from '../flatten';
import { join } from '../isomorphic/path';
/**
* Calculate all possible pagePaths for a given normalized pagePath along with
* allowed extensions. This can be used to check which one of the files exists
* and to debug inspected locations.
*
* For pages, map `/route` to [`/route.[ext]`, `/route/index.[ext]`]
* For app paths, map `/route/page` to [`/route/page.[ext]`]
*
* @param normalizedPagePath Normalized page path (it will denormalize).
* @param extensions Allowed extensions.
*/ export function getPagePaths(normalizedPagePath, extensions, isAppDir) {
const page = denormalizePagePath(normalizedPagePath);
return flatten(extensions.map((extension)=>{
const appPage = `${page}.${extension}`;
const folderIndexPage = join(page, `index.${extension}`);
if (!normalizedPagePath.endsWith('/index')) {
return isAppDir ? [
appPage
] : [
`${page}.${extension}`,
folderIndexPage
];
}
return [
isAppDir ? appPage : folderIndexPage
];
}));
}
//# sourceMappingURL=get-page-paths.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../shared/lib/page-path/get-page-paths.ts"],"names":["denormalizePagePath","flatten","join","getPagePaths","normalizedPagePath","extensions","isAppDir","page","map","extension","appPage","folderIndexPage","endsWith"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,yBAAyB,CAAA;AAC7D,SAASC,OAAO,QAAQ,YAAY,CAAA;AACpC,SAASC,IAAI,QAAQ,oBAAoB,CAAA;AAEzC;;;;;;;;;;GAUG,CACH,OAAO,SAASC,YAAY,CAC1BC,kBAA0B,EAC1BC,UAAoB,EACpBC,QAAiB,EACjB;IACA,MAAMC,IAAI,GAAGP,mBAAmB,CAACI,kBAAkB,CAAC;IAEpD,OAAOH,OAAO,CACZI,UAAU,CAACG,GAAG,CAAC,CAACC,SAAS,GAAK;QAC5B,MAAMC,OAAO,GAAG,CAAC,EAAEH,IAAI,CAAC,CAAC,EAAEE,SAAS,CAAC,CAAC;QACtC,MAAME,eAAe,GAAGT,IAAI,CAACK,IAAI,EAAE,CAAC,MAAM,EAAEE,SAAS,CAAC,CAAC,CAAC;QAExD,IAAI,CAACL,kBAAkB,CAACQ,QAAQ,CAAC,QAAQ,CAAC,EAAE;YAC1C,OAAON,QAAQ,GAAG;gBAACI,OAAO;aAAC,GAAG;gBAAC,CAAC,EAAEH,IAAI,CAAC,CAAC,EAAEE,SAAS,CAAC,CAAC;gBAAEE,eAAe;aAAC,CAAA;SACxE;QACD,OAAO;YAACL,QAAQ,GAAGI,OAAO,GAAGC,eAAe;SAAC,CAAA;KAC9C,CAAC,CACH,CAAA;CACF"}

View File

@@ -0,0 +1,24 @@
import { ensureLeadingSlash } from './ensure-leading-slash';
import { isDynamicRoute } from '../router/utils';
import { NormalizeError } from '../utils';
/**
* Takes a page and transforms it into its file counterpart ensuring that the
* output is normalized. Note this function is not idempotent because a page
* `/index` can be referencing `/index/index.js` and `/index/index` could be
* referencing `/index/index/index.js`. Examples:
* - `/` -> `/index`
* - `/index/foo` -> `/index/index/foo`
* - `/index` -> `/index/index`
*/ export function normalizePagePath(page) {
const normalized = ensureLeadingSlash(/^\/index(\/|$)/.test(page) && !isDynamicRoute(page) ? `/index${page}` : page === '/' ? '/index' : page);
if (process.env.NEXT_RUNTIME !== 'edge') {
const { posix } = require('path');
const resolvedPage = posix.normalize(normalized);
if (resolvedPage !== normalized) {
throw new NormalizeError(`Requested and resolved page mismatch: ${normalized} ${resolvedPage}`);
}
}
return normalized;
}
//# sourceMappingURL=normalize-page-path.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../shared/lib/page-path/normalize-page-path.ts"],"names":["ensureLeadingSlash","isDynamicRoute","NormalizeError","normalizePagePath","page","normalized","test","process","env","NEXT_RUNTIME","posix","require","resolvedPage","normalize"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,wBAAwB,CAAA;AAC3D,SAASC,cAAc,QAAQ,iBAAiB,CAAA;AAChD,SAASC,cAAc,QAAQ,UAAU,CAAA;AAEzC;;;;;;;;GAQG,CACH,OAAO,SAASC,iBAAiB,CAACC,IAAY,EAAU;IACtD,MAAMC,UAAU,GAAGL,kBAAkB,CACnC,iBAAiBM,IAAI,CAACF,IAAI,CAAC,IAAI,CAACH,cAAc,CAACG,IAAI,CAAC,GAChD,CAAC,MAAM,EAAEA,IAAI,CAAC,CAAC,GACfA,IAAI,KAAK,GAAG,GACZ,QAAQ,GACRA,IAAI,CACT;IAED,IAAIG,OAAO,CAACC,GAAG,CAACC,YAAY,KAAK,MAAM,EAAE;QACvC,MAAM,EAAEC,KAAK,CAAA,EAAE,GAAGC,OAAO,CAAC,MAAM,CAAC;QACjC,MAAMC,YAAY,GAAGF,KAAK,CAACG,SAAS,CAACR,UAAU,CAAC;QAChD,IAAIO,YAAY,KAAKP,UAAU,EAAE;YAC/B,MAAM,IAAIH,cAAc,CACtB,CAAC,sCAAsC,EAAEG,UAAU,CAAC,CAAC,EAAEO,YAAY,CAAC,CAAC,CACtE,CAAA;SACF;KACF;IAED,OAAOP,UAAU,CAAA;CAClB"}

View File

@@ -0,0 +1,9 @@
/**
* For a given page path, this function ensures that there is no backslash
* escaping slashes in the path. Example:
* - `foo\/bar\/baz` -> `foo/bar/baz`
*/ export function normalizePathSep(path) {
return path.replace(/\\/g, '/');
}
//# sourceMappingURL=normalize-path-sep.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../shared/lib/page-path/normalize-path-sep.ts"],"names":["normalizePathSep","path","replace"],"mappings":"AAAA;;;;GAIG,CACH,OAAO,SAASA,gBAAgB,CAACC,IAAY,EAAU;IACrD,OAAOA,IAAI,CAACC,OAAO,QAAQ,GAAG,CAAC,CAAA;CAChC"}

View File

@@ -0,0 +1,20 @@
import { normalizePathSep } from './normalize-path-sep';
/**
* Removes the file extension for a page and the trailing `index` if it exists
* making sure to not return an empty string. The page head is not touched
* and returned as it is passed. Examples:
* - `/foo/bar/baz/index.js` -> `/foo/bar/baz`
* - `/foo/bar/baz.js` -> `/foo/bar/baz`
*
* @param pagePath A page to a page file (absolute or relative)
* @param options.extensions Extensions allowed for the page.
* @param options.keepIndex When true the trailing `index` is _not_ removed.
*/ export function removePagePathTail(pagePath, options) {
pagePath = normalizePathSep(pagePath).replace(new RegExp(`\\.+(?:${options.extensions.join('|')})$`), '');
if (options.keepIndex !== true) {
pagePath = pagePath.replace(/\/index$/, '') || '/';
}
return pagePath;
}
//# sourceMappingURL=remove-page-path-tail.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../shared/lib/page-path/remove-page-path-tail.ts"],"names":["normalizePathSep","removePagePathTail","pagePath","options","replace","RegExp","extensions","join","keepIndex"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,sBAAsB,CAAA;AAEvD;;;;;;;;;;GAUG,CACH,OAAO,SAASC,kBAAkB,CAChCC,QAAgB,EAChBC,OAGC,EACD;IACAD,QAAQ,GAAGF,gBAAgB,CAACE,QAAQ,CAAC,CAACE,OAAO,CAC3C,IAAIC,MAAM,CAAC,CAAC,OAAO,EAAEF,OAAO,CAACG,UAAU,CAACC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EACtD,EAAE,CACH;IAED,IAAIJ,OAAO,CAACK,SAAS,KAAK,IAAI,EAAE;QAC9BN,QAAQ,GAAGA,QAAQ,CAACE,OAAO,aAAa,EAAE,CAAC,IAAI,GAAG;KACnD;IAED,OAAOF,QAAQ,CAAA;CAChB"}

View File

@@ -0,0 +1,7 @@
import React from 'react';
export const RouterContext = React.createContext(null);
if (process.env.NODE_ENV !== 'production') {
RouterContext.displayName = 'RouterContext';
}
//# sourceMappingURL=router-context.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../shared/lib/router-context.ts"],"names":["React","RouterContext","createContext","process","env","NODE_ENV","displayName"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,MAAMC,aAAa,GAAGD,KAAK,CAACE,aAAa,CAAoB,IAAI,CAAC,CAAA;AAEzE,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzCJ,aAAa,CAACK,WAAW,GAAG,eAAe;CAC5C"}

View File

@@ -0,0 +1,117 @@
import _object_without_properties_loose from "@swc/helpers/src/_object_without_properties_loose.mjs";
import React, { useMemo, useRef } from 'react';
import { PathnameContext } from '../hooks-client-context';
import { isDynamicRoute } from './utils';
/**
* adaptForAppRouterInstance implements the AppRouterInstance with a NextRouter.
*
* @param router the NextRouter to adapt
* @returns an AppRouterInstance
*/ export function adaptForAppRouterInstance(router) {
return {
back () {
router.back();
},
forward () {
router.forward();
},
refresh () {
router.reload();
},
push (href) {
void router.push(href);
},
replace (href) {
void router.replace(href);
},
prefetch (href) {
void router.prefetch(href);
}
};
}
/**
* transforms the ParsedUrlQuery into a URLSearchParams.
*
* @param query the query to transform
* @returns URLSearchParams
*/ function transformQuery(query) {
const params = new URLSearchParams();
for (const [name, value] of Object.entries(query)){
if (Array.isArray(value)) {
for (const val of value){
params.append(name, val);
}
} else if (typeof value !== 'undefined') {
params.append(name, value);
}
}
return params;
}
/**
* adaptForSearchParams transforms the ParsedURLQuery into URLSearchParams.
*
* @param router the router that contains the query.
* @returns the search params in the URLSearchParams format
*/ export function adaptForSearchParams(router) {
if (!router.isReady || !router.query) {
return new URLSearchParams();
}
return transformQuery(router.query);
}
export function PathnameContextProviderAdapter(_param) {
var { children , router } = _param, props = _object_without_properties_loose(_param, [
"children",
"router"
]);
const ref = useRef(props.isAutoExport);
const value = useMemo(()=>{
// isAutoExport is only ever `true` on the first render from the server,
// so reset it to `false` after we read it for the first time as `true`. If
// we don't use the value, then we don't need it.
const isAutoExport = ref.current;
if (isAutoExport) {
ref.current = false;
}
// When the route is a dynamic route, we need to do more processing to
// determine if we need to stop showing the pathname.
if (isDynamicRoute(router.pathname)) {
// When the router is rendering the fallback page, it can't possibly know
// the path, so return `null` here. Read more about fallback pages over
// at:
// https://nextjs.org/docs/api-reference/data-fetching/get-static-paths#fallback-pages
if (router.isFallback) {
return null;
}
// When `isAutoExport` is true, meaning this is a page page has been
// automatically statically optimized, and the router is not ready, then
// we can't know the pathname yet. Read more about automatic static
// optimization at:
// https://nextjs.org/docs/advanced-features/automatic-static-optimization
if (isAutoExport && !router.isReady) {
return null;
}
}
// The `router.asPath` contains the pathname seen by the browser (including
// any query strings), so it should have that stripped. Read more about the
// `asPath` option over at:
// https://nextjs.org/docs/api-reference/next/router#router-object
let url;
try {
url = new URL(router.asPath, 'http://f');
} catch (_) {
// fallback to / for invalid asPath values e.g. //
return '/';
}
return url.pathname;
}, [
router.asPath,
router.isFallback,
router.isReady,
router.pathname
]);
return /*#__PURE__*/ React.createElement(PathnameContext.Provider, {
value: value
}, children);
}
//# sourceMappingURL=adapters.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../shared/lib/router/adapters.tsx"],"names":["React","useMemo","useRef","PathnameContext","isDynamicRoute","adaptForAppRouterInstance","router","back","forward","refresh","reload","push","href","replace","prefetch","transformQuery","query","params","URLSearchParams","name","value","Object","entries","Array","isArray","val","append","adaptForSearchParams","isReady","PathnameContextProviderAdapter","children","props","ref","isAutoExport","current","pathname","isFallback","url","URL","asPath","_","Provider"],"mappings":"AAAA;AACA,OAAOA,KAAK,IAAIC,OAAO,EAAEC,MAAM,QAAQ,OAAO,CAAA;AAE9C,SAASC,eAAe,QAAQ,yBAAyB,CAAA;AAEzD,SAASC,cAAc,QAAQ,SAAS,CAAA;AAExC;;;;;GAKG,CACH,OAAO,SAASC,yBAAyB,CACvCC,MAAkB,EACC;IACnB,OAAO;QACLC,IAAI,IAAS;YACXD,MAAM,CAACC,IAAI,EAAE;SACd;QACDC,OAAO,IAAS;YACdF,MAAM,CAACE,OAAO,EAAE;SACjB;QACDC,OAAO,IAAS;YACdH,MAAM,CAACI,MAAM,EAAE;SAChB;QACDC,IAAI,EAACC,IAAY,EAAQ;YACvB,KAAKN,MAAM,CAACK,IAAI,CAACC,IAAI,CAAC;SACvB;QACDC,OAAO,EAACD,IAAY,EAAQ;YAC1B,KAAKN,MAAM,CAACO,OAAO,CAACD,IAAI,CAAC;SAC1B;QACDE,QAAQ,EAACF,IAAY,EAAQ;YAC3B,KAAKN,MAAM,CAACQ,QAAQ,CAACF,IAAI,CAAC;SAC3B;KACF,CAAA;CACF;AAED;;;;;GAKG,CACH,SAASG,cAAc,CAACC,KAAqB,EAAmB;IAC9D,MAAMC,MAAM,GAAG,IAAIC,eAAe,EAAE;IAEpC,KAAK,MAAM,CAACC,IAAI,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACN,KAAK,CAAC,CAAE;QACjD,IAAIO,KAAK,CAACC,OAAO,CAACJ,KAAK,CAAC,EAAE;YACxB,KAAK,MAAMK,GAAG,IAAIL,KAAK,CAAE;gBACvBH,MAAM,CAACS,MAAM,CAACP,IAAI,EAAEM,GAAG,CAAC;aACzB;SACF,MAAM,IAAI,OAAOL,KAAK,KAAK,WAAW,EAAE;YACvCH,MAAM,CAAC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;QACZ,IAAI;YACFA,GAAG,GAAG,IAAIC,GAAG,CAAChC,MAAM,CAACiC,MAAM,EAAE,UAAU,CAAC;SACzC,CAAC,OAAOC,CAAC,EAAE;YACV,kDAAkD;YAClD,OAAO,GAAG,CAAA;SACX;QAED,OAAOH,GAAG,CAACF,QAAQ,CAAA;KACpB,EAAE;QAAC7B,MAAM,CAACiC,MAAM;QAAEjC,MAAM,CAAC8B,UAAU;QAAE9B,MAAM,CAACsB,OAAO;QAAEtB,MAAM,CAAC6B,QAAQ;KAAC,CAAC;IAEvE,qBACE,oBAAChC,eAAe,CAACsC,QAAQ;QAACrB,KAAK,EAAEA,KAAK;OACnCU,QAAQ,CACgB,CAC5B;CACF"}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,14 @@
import { addPathPrefix } from './add-path-prefix';
import { pathHasPrefix } from './path-has-prefix';
/**
* For a given path and a locale, if the locale is given, it will prefix the
* locale. The path shouldn't be an API path. If a default locale is given the
* prefix will be omitted if the locale is already the default locale.
*/ export function addLocale(path, locale, defaultLocale, ignorePrefix) {
if (locale && locale !== defaultLocale && (ignorePrefix || !pathHasPrefix(path.toLowerCase(), `/${locale.toLowerCase()}`) && !pathHasPrefix(path.toLowerCase(), '/api'))) {
return addPathPrefix(path, `/${locale}`);
}
return path;
}
//# sourceMappingURL=add-locale.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../shared/lib/router/utils/add-locale.ts"],"names":["addPathPrefix","pathHasPrefix","addLocale","path","locale","defaultLocale","ignorePrefix","toLowerCase"],"mappings":"AAAA,SAASA,aAAa,QAAQ,mBAAmB,CAAA;AACjD,SAASC,aAAa,QAAQ,mBAAmB,CAAA;AAEjD;;;;GAIG,CACH,OAAO,SAASC,SAAS,CACvBC,IAAY,EACZC,MAAuB,EACvBC,aAAsB,EACtBC,YAAsB,EACtB;IACA,IACEF,MAAM,IACNA,MAAM,KAAKC,aAAa,IACxB,CAACC,YAAY,IACV,CAACL,aAAa,CAACE,IAAI,CAACI,WAAW,EAAE,EAAE,CAAC,CAAC,EAAEH,MAAM,CAACG,WAAW,EAAE,CAAC,CAAC,CAAC,IAC7D,CAACN,aAAa,CAACE,IAAI,CAACI,WAAW,EAAE,EAAE,MAAM,CAAC,AAAC,CAAC,EAChD;QACA,OAAOP,aAAa,CAACG,IAAI,EAAE,CAAC,CAAC,EAAEC,MAAM,CAAC,CAAC,CAAC,CAAA;KACzC;IAED,OAAOD,IAAI,CAAA;CACZ"}

View File

@@ -0,0 +1,13 @@
import { parsePath } from './parse-path';
/**
* Adds the provided prefix to the given path. It first ensures that the path
* is indeed starting with a slash.
*/ export function addPathPrefix(path, prefix) {
if (!path.startsWith('/') || !prefix) {
return path;
}
const { pathname , query , hash } = parsePath(path);
return `${prefix}${pathname}${query}${hash}`;
}
//# sourceMappingURL=add-path-prefix.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../shared/lib/router/utils/add-path-prefix.ts"],"names":["parsePath","addPathPrefix","path","prefix","startsWith","pathname","query","hash"],"mappings":"AAAA,SAASA,SAAS,QAAQ,cAAc,CAAA;AAExC;;;GAGG,CACH,OAAO,SAASC,aAAa,CAACC,IAAY,EAAEC,MAAe,EAAE;IAC3D,IAAI,CAACD,IAAI,CAACE,UAAU,CAAC,GAAG,CAAC,IAAI,CAACD,MAAM,EAAE;QACpC,OAAOD,IAAI,CAAA;KACZ;IAED,MAAM,EAAEG,QAAQ,CAAA,EAAEC,KAAK,CAAA,EAAEC,IAAI,CAAA,EAAE,GAAGP,SAAS,CAACE,IAAI,CAAC;IACjD,OAAO,CAAC,EAAEC,MAAM,CAAC,EAAEE,QAAQ,CAAC,EAAEC,KAAK,CAAC,EAAEC,IAAI,CAAC,CAAC,CAAA;CAC7C"}

View File

@@ -0,0 +1,14 @@
import { parsePath } from './parse-path';
/**
* Similarly to `addPathPrefix`, this function adds a suffix at the end on the
* provided path. It also works only for paths ensuring the argument starts
* with a slash.
*/ export function addPathSuffix(path, suffix) {
if (!path.startsWith('/') || !suffix) {
return path;
}
const { pathname , query , hash } = parsePath(path);
return `${pathname}${suffix}${query}${hash}`;
}
//# sourceMappingURL=add-path-suffix.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../shared/lib/router/utils/add-path-suffix.ts"],"names":["parsePath","addPathSuffix","path","suffix","startsWith","pathname","query","hash"],"mappings":"AAAA,SAASA,SAAS,QAAQ,cAAc,CAAA;AAExC;;;;GAIG,CACH,OAAO,SAASC,aAAa,CAACC,IAAY,EAAEC,MAAe,EAAE;IAC3D,IAAI,CAACD,IAAI,CAACE,UAAU,CAAC,GAAG,CAAC,IAAI,CAACD,MAAM,EAAE;QACpC,OAAOD,IAAI,CAAA;KACZ;IAED,MAAM,EAAEG,QAAQ,CAAA,EAAEC,KAAK,CAAA,EAAEC,IAAI,CAAA,EAAE,GAAGP,SAAS,CAACE,IAAI,CAAC;IACjD,OAAO,CAAC,EAAEG,QAAQ,CAAC,EAAEF,MAAM,CAAC,EAAEG,KAAK,CAAC,EAAEC,IAAI,CAAC,CAAC,CAAA;CAC7C"}

View File

@@ -0,0 +1,24 @@
// remove (name) from pathname as it's not considered for routing
export function normalizeAppPath(pathname) {
return pathname.split('/').reduce((acc, segment, index, segments)=>{
// Empty segments are ignored.
if (!segment) {
return acc;
}
if (segment.startsWith('(') && segment.endsWith(')')) {
return acc;
}
if (segment.startsWith('@')) {
return acc;
}
if (segment === 'page' && index === segments.length - 1) {
return acc;
}
return acc + `/${segment}`;
}, '');
}
export function normalizeRscPath(pathname, enabled) {
return enabled ? pathname.replace(/\.rsc($|\?)/, '') : pathname;
}
//# sourceMappingURL=app-paths.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../shared/lib/router/utils/app-paths.ts"],"names":["normalizeAppPath","pathname","split","reduce","acc","segment","index","segments","startsWith","endsWith","length","normalizeRscPath","enabled","replace"],"mappings":"AAAA,iEAAiE;AACjE,OAAO,SAASA,gBAAgB,CAACC,QAAgB,EAAE;IACjD,OAAOA,QAAQ,CAACC,KAAK,CAAC,GAAG,CAAC,CAACC,MAAM,CAAC,CAACC,GAAG,EAAEC,OAAO,EAAEC,KAAK,EAAEC,QAAQ,GAAK;QACnE,8BAA8B;QAC9B,IAAI,CAACF,OAAO,EAAE;YACZ,OAAOD,GAAG,CAAA;SACX;QAED,IAAIC,OAAO,CAACG,UAAU,CAAC,GAAG,CAAC,IAAIH,OAAO,CAACI,QAAQ,CAAC,GAAG,CAAC,EAAE;YACpD,OAAOL,GAAG,CAAA;SACX;QAED,IAAIC,OAAO,CAACG,UAAU,CAAC,GAAG,CAAC,EAAE;YAC3B,OAAOJ,GAAG,CAAA;SACX;QAED,IAAIC,OAAO,KAAK,MAAM,IAAIC,KAAK,KAAKC,QAAQ,CAACG,MAAM,GAAG,CAAC,EAAE;YACvD,OAAON,GAAG,CAAA;SACX;QAED,OAAOA,GAAG,GAAG,CAAC,CAAC,EAAEC,OAAO,CAAC,CAAC,CAAA;KAC3B,EAAE,EAAE,CAAC,CAAA;CACP;AAED,OAAO,SAASM,gBAAgB,CAACV,QAAgB,EAAEW,OAAiB,EAAE;IACpE,OAAOA,OAAO,GAAGX,QAAQ,CAACY,OAAO,gBAAgB,EAAE,CAAC,GAAGZ,QAAQ,CAAA;CAChE"}

View File

@@ -0,0 +1,24 @@
export function compareRouterStates(a, b) {
const stateKeys = Object.keys(a);
if (stateKeys.length !== Object.keys(b).length) return false;
for(let i = stateKeys.length; i--;){
const key = stateKeys[i];
if (key === 'query') {
const queryKeys = Object.keys(a.query);
if (queryKeys.length !== Object.keys(b.query).length) {
return false;
}
for(let j = queryKeys.length; j--;){
const queryKey = queryKeys[j];
if (!b.query.hasOwnProperty(queryKey) || a.query[queryKey] !== b.query[queryKey]) {
return false;
}
}
} else if (!b.hasOwnProperty(key) || a[key] !== b[key]) {
return false;
}
}
return true;
}
//# sourceMappingURL=compare-states.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../shared/lib/router/utils/compare-states.ts"],"names":["compareRouterStates","a","b","stateKeys","Object","keys","length","i","key","queryKeys","query","j","queryKey","hasOwnProperty"],"mappings":"AAEA,OAAO,SAASA,mBAAmB,CAACC,CAAkB,EAAEC,CAAkB,EAAE;IAC1E,MAAMC,SAAS,GAAGC,MAAM,CAACC,IAAI,CAACJ,CAAC,CAAC;IAChC,IAAIE,SAAS,CAACG,MAAM,KAAKF,MAAM,CAACC,IAAI,CAACH,CAAC,CAAC,CAACI,MAAM,EAAE,OAAO,KAAK,CAAA;IAE5D,IAAK,IAAIC,CAAC,GAAGJ,SAAS,CAACG,MAAM,EAAEC,CAAC,EAAE,EAAI;QACpC,MAAMC,GAAG,GAAGL,SAAS,CAACI,CAAC,CAAC;QACxB,IAAIC,GAAG,KAAK,OAAO,EAAE;YACnB,MAAMC,SAAS,GAAGL,MAAM,CAACC,IAAI,CAACJ,CAAC,CAACS,KAAK,CAAC;YACtC,IAAID,SAAS,CAACH,MAAM,KAAKF,MAAM,CAACC,IAAI,CAACH,CAAC,CAACQ,KAAK,CAAC,CAACJ,MAAM,EAAE;gBACpD,OAAO,KAAK,CAAA;aACb;YACD,IAAK,IAAIK,CAAC,GAAGF,SAAS,CAACH,MAAM,EAAEK,CAAC,EAAE,EAAI;gBACpC,MAAMC,QAAQ,GAAGH,SAAS,CAACE,CAAC,CAAC;gBAC7B,IACE,CAACT,CAAC,CAACQ,KAAK,CAACG,cAAc,CAACD,QAAQ,CAAC,IACjCX,CAAC,CAACS,KAAK,CAACE,QAAQ,CAAC,KAAKV,CAAC,CAACQ,KAAK,CAACE,QAAQ,CAAC,EACvC;oBACA,OAAO,KAAK,CAAA;iBACb;aACF;SACF,MAAM,IACL,CAACV,CAAC,CAACW,cAAc,CAACL,GAAG,CAAC,IACtBP,CAAC,CAACO,GAAG,CAA0B,KAAKN,CAAC,CAACM,GAAG,CAA0B,EACnE;YACA,OAAO,KAAK,CAAA;SACb;KACF;IAED,OAAO,IAAI,CAAA;CACZ"}

View File

@@ -0,0 +1,6 @@
// escape delimiters used by path-to-regexp
export default function escapePathDelimiters(segment, escapeEncoded) {
return segment.replace(new RegExp(`([/#?]${escapeEncoded ? '|%(2f|23|3f)' : ''})`, 'gi'), (char)=>encodeURIComponent(char));
};
//# sourceMappingURL=escape-path-delimiters.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../shared/lib/router/utils/escape-path-delimiters.ts"],"names":["escapePathDelimiters","segment","escapeEncoded","replace","RegExp","char","encodeURIComponent"],"mappings":"AAAA,2CAA2C;AAC3C,eAAe,SAASA,oBAAoB,CAC1CC,OAAe,EACfC,aAAuB,EACf;IACR,OAAOD,OAAO,CAACE,OAAO,CACpB,IAAIC,MAAM,CAAC,CAAC,MAAM,EAAEF,aAAa,GAAG,cAAc,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,EACjE,CAACG,IAAY,GAAKC,kBAAkB,CAACD,IAAI,CAAC,CAC3C,CAAA;CACF,CAAA"}

View File

@@ -0,0 +1,17 @@
import { removeTrailingSlash } from './remove-trailing-slash';
import { addPathPrefix } from './add-path-prefix';
import { addPathSuffix } from './add-path-suffix';
import { addLocale } from './add-locale';
export function formatNextPathnameInfo(info) {
let pathname = addLocale(info.pathname, info.locale, info.buildId ? undefined : info.defaultLocale, info.ignorePrefix);
if (info.buildId || !info.trailingSlash) {
pathname = removeTrailingSlash(pathname);
}
if (info.buildId) {
pathname = addPathSuffix(addPathPrefix(pathname, `/_next/data/${info.buildId}`), info.pathname === '/' ? 'index.json' : '.json');
}
pathname = addPathPrefix(pathname, info.basePath);
return !info.buildId && info.trailingSlash ? !pathname.endsWith('/') ? addPathSuffix(pathname, '/') : pathname : removeTrailingSlash(pathname);
}
//# sourceMappingURL=format-next-pathname-info.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../shared/lib/router/utils/format-next-pathname-info.ts"],"names":["removeTrailingSlash","addPathPrefix","addPathSuffix","addLocale","formatNextPathnameInfo","info","pathname","locale","buildId","undefined","defaultLocale","ignorePrefix","trailingSlash","basePath","endsWith"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,yBAAyB,CAAA;AAC7D,SAASC,aAAa,QAAQ,mBAAmB,CAAA;AACjD,SAASC,aAAa,QAAQ,mBAAmB,CAAA;AACjD,SAASC,SAAS,QAAQ,cAAc,CAAA;AAOxC,OAAO,SAASC,sBAAsB,CAACC,IAAkB,EAAE;IACzD,IAAIC,QAAQ,GAAGH,SAAS,CACtBE,IAAI,CAACC,QAAQ,EACbD,IAAI,CAACE,MAAM,EACXF,IAAI,CAACG,OAAO,GAAGC,SAAS,GAAGJ,IAAI,CAACK,aAAa,EAC7CL,IAAI,CAACM,YAAY,CAClB;IAED,IAAIN,IAAI,CAACG,OAAO,IAAI,CAACH,IAAI,CAACO,aAAa,EAAE;QACvCN,QAAQ,GAAGN,mBAAmB,CAACM,QAAQ,CAAC;KACzC;IAED,IAAID,IAAI,CAACG,OAAO,EAAE;QAChBF,QAAQ,GAAGJ,aAAa,CACtBD,aAAa,CAACK,QAAQ,EAAE,CAAC,YAAY,EAAED,IAAI,CAACG,OAAO,CAAC,CAAC,CAAC,EACtDH,IAAI,CAACC,QAAQ,KAAK,GAAG,GAAG,YAAY,GAAG,OAAO,CAC/C;KACF;IAEDA,QAAQ,GAAGL,aAAa,CAACK,QAAQ,EAAED,IAAI,CAACQ,QAAQ,CAAC;IACjD,OAAO,CAACR,IAAI,CAACG,OAAO,IAAIH,IAAI,CAACO,aAAa,GACtC,CAACN,QAAQ,CAACQ,QAAQ,CAAC,GAAG,CAAC,GACrBZ,aAAa,CAACI,QAAQ,EAAE,GAAG,CAAC,GAC5BA,QAAQ,GACVN,mBAAmB,CAACM,QAAQ,CAAC,CAAA;CAClC"}

View File

@@ -0,0 +1,63 @@
import * as querystring from './querystring';
const slashedProtocols = /https?|ftp|gopher|file/;
export function formatUrl(urlObj) {
let { auth , hostname } = urlObj;
let protocol = urlObj.protocol || '';
let pathname = urlObj.pathname || '';
let hash = urlObj.hash || '';
let query = urlObj.query || '';
let host = false;
auth = auth ? encodeURIComponent(auth).replace(/%3A/i, ':') + '@' : '';
if (urlObj.host) {
host = auth + urlObj.host;
} else if (hostname) {
host = auth + (~hostname.indexOf(':') ? `[${hostname}]` : hostname);
if (urlObj.port) {
host += ':' + urlObj.port;
}
}
if (query && typeof query === 'object') {
query = String(querystring.urlQueryToSearchParams(query));
}
let search = urlObj.search || query && `?${query}` || '';
if (protocol && !protocol.endsWith(':')) protocol += ':';
if (urlObj.slashes || (!protocol || slashedProtocols.test(protocol)) && host !== false) {
host = '//' + (host || '');
if (pathname && pathname[0] !== '/') pathname = '/' + pathname;
} else if (!host) {
host = '';
}
if (hash && hash[0] !== '#') hash = '#' + hash;
if (search && search[0] !== '?') search = '?' + search;
pathname = pathname.replace(/[?#]/g, encodeURIComponent);
search = search.replace('#', '%23');
return `${protocol}${host}${pathname}${search}${hash}`;
}
export const urlObjectKeys = [
'auth',
'hash',
'host',
'hostname',
'href',
'path',
'pathname',
'port',
'protocol',
'query',
'search',
'slashes',
];
export function formatWithValidation(url) {
if (process.env.NODE_ENV === 'development') {
if (url !== null && typeof url === 'object') {
Object.keys(url).forEach((key)=>{
if (urlObjectKeys.indexOf(key) === -1) {
console.warn(`Unknown key passed via urlObject into url.format: ${key}`);
}
});
}
}
return formatUrl(url);
}
//# sourceMappingURL=format-url.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../shared/lib/router/utils/format-url.ts"],"names":["querystring","slashedProtocols","formatUrl","urlObj","auth","hostname","protocol","pathname","hash","query","host","encodeURIComponent","replace","indexOf","port","String","urlQueryToSearchParams","search","endsWith","slashes","test","urlObjectKeys","formatWithValidation","url","process","env","NODE_ENV","Object","keys","forEach","key","console","warn"],"mappings":"AAwBA,YAAYA,WAAW,MAAM,eAAe,CAAA;AAE5C,MAAMC,gBAAgB,2BAA2B;AAEjD,OAAO,SAASC,SAAS,CAACC,MAAiB,EAAE;IAC3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K;gBAChC,IAAIT,aAAa,CAACR,OAAO,CAACiB,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE;oBACrCC,OAAO,CAACC,IAAI,CACV,CAAC,kDAAkD,EAAEF,GAAG,CAAC,CAAC,CAC3D;iBACF;aACF,CAAC;SACH;KACF;IAED,OAAO5B,SAAS,CAACqB,GAAG,CAAC,CAAA;CACtB"}

View File

@@ -0,0 +1,8 @@
// Translates a logical route into its pages asset path (relative from a common prefix)
// "asset path" being its javascript file, data file, prerendered html,...
export default function getAssetPathFromRoute(route, ext = '') {
const path = route === '/' ? '/index' : /^\/index(\/|$)/.test(route) ? `/index${route}` : `${route}`;
return path + ext;
};
//# sourceMappingURL=get-asset-path-from-route.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../shared/lib/router/utils/get-asset-path-from-route.ts"],"names":["getAssetPathFromRoute","route","ext","path","test"],"mappings":"AAAA,uFAAuF;AACvF,0EAA0E;AAC1E,eAAe,SAASA,qBAAqB,CAC3CC,KAAa,EACbC,GAAW,GAAG,EAAE,EACR;IACR,MAAMC,IAAI,GACRF,KAAK,KAAK,GAAG,GACT,QAAQ,GACR,iBAAiBG,IAAI,CAACH,KAAK,CAAC,GAC5B,CAAC,MAAM,EAAEA,KAAK,CAAC,CAAC,GAChB,CAAC,EAAEA,KAAK,CAAC,CAAC;IAChB,OAAOE,IAAI,GAAGD,GAAG,CAAA;CAClB,CAAA"}

View File

@@ -0,0 +1,29 @@
import { normalizeLocalePath } from '../../i18n/normalize-locale-path';
import { removePathPrefix } from './remove-path-prefix';
import { pathHasPrefix } from './path-has-prefix';
export function getNextPathnameInfo(pathname, options) {
var _nextConfig;
const { basePath , i18n , trailingSlash } = (_nextConfig = options.nextConfig) != null ? _nextConfig : {};
const info = {
pathname: pathname,
trailingSlash: pathname !== '/' ? pathname.endsWith('/') : trailingSlash
};
if (basePath && pathHasPrefix(info.pathname, basePath)) {
info.pathname = removePathPrefix(info.pathname, basePath);
info.basePath = basePath;
}
if (options.parseData === true && info.pathname.startsWith('/_next/data/') && info.pathname.endsWith('.json')) {
const paths = info.pathname.replace(/^\/_next\/data\//, '').replace(/\.json$/, '').split('/');
const buildId = paths[0];
info.pathname = paths[1] !== 'index' ? `/${paths.slice(1).join('/')}` : '/';
info.buildId = buildId;
}
if (i18n) {
const pathLocale = normalizeLocalePath(info.pathname, i18n.locales);
info.locale = pathLocale == null ? void 0 : pathLocale.detectedLocale;
info.pathname = (pathLocale == null ? void 0 : pathLocale.pathname) || info.pathname;
}
return info;
}
//# sourceMappingURL=get-next-pathname-info.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../../shared/lib/router/utils/get-next-pathname-info.ts"],"names":["normalizeLocalePath","removePathPrefix","pathHasPrefix","getNextPathnameInfo","pathname","options","basePath","i18n","trailingSlash","nextConfig","info","endsWith","parseData","startsWith","paths","replace","split","buildId","slice","join","pathLocale","locales","locale","detectedLocale"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,kCAAkC,CAAA;AACtE,SAASC,gBAAgB,QAAQ,sBAAsB,CAAA;AACvD,SAASC,aAAa,QAAQ,mBAAmB,CAAA;AA2CjD,OAAO,SAASC,mBAAmB,CAACC,QAAgB,EAAEC,OAAgB,EAAE;QAC5BA,WAAkB;IAA5D,MAAM,EAAEC,QAAQ,CAAA,EAAEC,IAAI,CAAA,EAAEC,aAAa,CAAA,EAAE,GAAGH,CAAAA,WAAkB,GAAlBA,OAAO,CAACI,UAAU,YAAlBJ,WAAkB,GAAI,EAAE;IAClE,MAAMK,IAAI,GAAqB;QAC7BN,QAAQ,EAAEA,QAAQ;QAClBI,aAAa,EAAEJ,QAAQ,KAAK,GAAG,GAAGA,QAAQ,CAACO,QAAQ,CAAC,GAAG,CAAC,GAAGH,aAAa;KACzE;IAED,IAAIF,QAAQ,IAAIJ,aAAa,CAACQ,IAAI,CAACN,QAAQ,EAAEE,QAAQ,CAAC,EAAE;QACtDI,IAAI,CAACN,QAAQ,GAAGH,gBAAgB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