frontexpress/frontexpress.min.js.map

1 line
34 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{"version":3,"file":null,"sources":["lib/methods.js","lib/requester.js","lib/settings.js","lib/middleware.js","lib/router.js","lib/application.js","lib/frontexpress.js"],"sourcesContent":["/**\n * HTTP method list\n * @private\n */\n\n export default ['GET', 'POST', 'PUT', 'DELETE'];\n // not supported yet\n // HEAD', 'CONNECT', 'OPTIONS', 'TRACE', 'PATCH';\n","/**\n * Module dependencies.\n * @private\n */\n\nexport default class Requester {\n\n /**\n * Make an ajax request.\n *\n * @param {Object} request\n * @param {Function} success callback\n * @param {Function} failure callback\n * @private\n */\n\n fetch(request, resolve, reject) {\n const {method, uri, headers, data} = request;\n\n const success = (responseText) => {\n resolve(\n request,\n {\n status: 200,\n statusText: 'OK',\n responseText\n }\n );\n };\n\n const fail = ({status, statusText, errorThrown}) => {\n // Removed for reducing size of frontexpress\n // const errors = this._analyzeErrors({status, statusText, errorThrown});\n reject(\n request,\n {\n status,\n statusText,\n errorThrown,\n errors: `HTTP ${status} ${statusText?statusText:''}`\n }\n );\n };\n\n const xmlhttp = new XMLHttpRequest();\n xmlhttp.onreadystatechange = () => {\n if (xmlhttp.readyState === 4) {\n if (xmlhttp.status === 200) {\n success(xmlhttp.responseText);\n } else {\n fail({status: xmlhttp.status, statusText: xmlhttp.statusText});\n }\n }\n };\n try {\n xmlhttp.open(method, uri, true);\n if (headers) {\n for (const header of Object.keys(headers)) {\n xmlhttp.setRequestHeader(header, headers[header]);\n }\n }\n if (data) {\n xmlhttp.send(data);\n } else {\n xmlhttp.send();\n }\n } catch (errorThrown) {\n fail({errorThrown});\n }\n }\n\n // Removed for reducing size of frontexpress\n // /**\n // * Analyse response errors.\n // *\n // * @private\n // */\n\n // _analyzeErrors(response) {\n // // manage exceptions\n // if (response.errorThrown) {\n // if (response.errorThrown.name === 'SyntaxError') {\n // return 'Problem during data decoding [JSON]';\n // }\n // if (response.errorThrown.name === 'TimeoutError') {\n // return 'Server is taking too long to reply';\n // }\n // if (response.errorThrown.name === 'AbortError') {\n // return 'Request cancelled on server';\n // }\n // if (response.errorThrown.name === 'NetworkError') {\n // return 'A network error occurred';\n // }\n // throw response.errorThrown;\n // }\n\n // // manage status\n // if (response.status === 0) {\n // return 'Server access problem. Check your network connection';\n // }\n // if (response.status === 401) {\n // return 'Your session has expired, Please reconnect. [code: 401]';\n // }\n // if (response.status === 404) {\n // return 'Page not found on server. [code: 404]';\n // }\n // if (response.status === 500) {\n // return 'Internal server error. [code: 500]';\n // }\n // return `Unknown error. ${response.statusText?response.statusText:''}`;\n // }\n}\n","/**\n * Module dependencies.\n * @private\n */\n\nimport Requester from './requester';\n\n\n/**\n * Settings object.\n * @private\n */\n\nexport default class Settings {\n\n\n /**\n * Initialize the settings.\n *\n * - setup default configuration\n *\n * @private\n */\n\n constructor() {\n // default settings\n this.settings = {\n 'http requester': new Requester(),\n\n 'http GET transformer': {\n uri({uri, headers, data}) {\n if (!data) {\n return uri;\n }\n let [uriWithoutAnchor, anchor] = [uri, ''];\n const match = /^(.*)(#.*)$/.exec(uri);\n if (match) {\n [,uriWithoutAnchor, anchor] = /^(.*)(#.*)$/.exec(uri);\n }\n uriWithoutAnchor = Object.keys(data).reduce((gUri, d, index) => {\n gUri += `${(index === 0 && gUri.indexOf('?') === -1)?'?':'&'}${d}=${data[d]}`;\n return gUri;\n }, uriWithoutAnchor);\n return uriWithoutAnchor + anchor;\n }\n }\n };\n\n this.rules = {\n 'http requester': (requester) => {\n if(typeof requester.fetch !== 'function') {\n throw new TypeError('setting http requester has no fetch method');\n }\n }\n };\n }\n\n\n /**\n * Assign `setting` to `val`\n *\n * @param {String} setting\n * @param {*} [val]\n * @private\n */\n\n set(name, value) {\n const checkRules = this.rules[name];\n if (checkRules) {\n checkRules(value);\n }\n this.settings[name] = value;\n }\n\n\n /**\n * Return `setting`'s value.\n *\n * @param {String} setting\n * @private\n */\n\n get(name) {\n return this.settings[name];\n }\n};\n","/**\n * Middleware object.\n * @public\n */\n\nexport default class Middleware {\n\n\n /**\n * Middleware initialization\n *\n * @param {String} middleware name\n */\n\n constructor(name='') {\n this.name = name;\n }\n\n /**\n * Invoked by the app before an ajax request is sent or\n * during the DOM loading (document.readyState === 'loading').\n * See Application#_callMiddlewareEntered documentation for details.\n *\n * Override this method to add your custom behaviour\n *\n * @param {Object} request\n * @public\n */\n\n // entered(request) { }\n\n\n /**\n * Invoked by the app before a new ajax request is sent or before the DOM is unloaded.\n * See Application#_callMiddlewareExited documentation for details.\n *\n * Override this method to add your custom behaviour\n *\n * @param {Object} request\n * @public\n */\n\n // exited(request) { }\n\n\n /**\n * Invoked by the app after an ajax request has responded or on DOM ready\n * (document.readyState === 'interactive').\n * See Application#_callMiddlewareUpdated documentation for details.\n *\n * Override this method to add your custom behaviour\n *\n * @param {Object} request\n * @param {Object} response\n * @public\n */\n\n // updated(request, response) { }\n\n\n /**\n * Invoked by the app when an ajax request has failed.\n *\n * Override this method to add your custom behaviour\n *\n * @param {Object} request\n * @param {Object} response\n * @public\n */\n // failed(request, response) { }\n\n\n /**\n * Allow the hand over to the next middleware object or function.\n *\n * Override this method and return `false` to break execution of\n * middleware chain.\n *\n * @return {Boolean} `true` by default\n *\n * @public\n */\n\n next() {\n return true;\n }\n}\n","/**\n * Module dependencies.\n * @private\n */\n\nimport HTTP_METHODS from './methods';\nimport Middleware from './middleware';\n\n\n/**\n * Route object.\n * @private\n */\n\nexport class Route {\n\n\n /**\n * Initialize the route.\n *\n * @private\n */\n\n constructor(router, uriPart, method, middleware) {\n this.router = router;\n this.uriPart = uriPart;\n this.method = method;\n this.middleware = middleware;\n this.visited = false;\n }\n\n\n /**\n * Return route's uri.\n *\n * @private\n */\n\n get uri() {\n if (!this.uriPart && !this.method) {\n return undefined;\n }\n\n if (this.uriPart instanceof RegExp) {\n return this.uriPart;\n }\n\n if (this.router.baseUri instanceof RegExp) {\n return this.router.baseUri;\n }\n\n if (this.router.baseUri && this.uriPart) {\n return (this.router.baseUri.trim() + this.uriPart.trim()).replace(/\\/{2,}/, '/');\n }\n\n if (this.router.baseUri) {\n return this.router.baseUri.trim();\n }\n\n return this.uriPart;\n }\n}\n\n\n/**\n * Router object.\n * @public\n */\n\nexport default class Router {\n\n\n /**\n * Initialize the router.\n *\n * @private\n */\n\n constructor(uri) {\n if (uri) {\n this._baseUri = uri;\n }\n this._routes = [];\n }\n\n\n /**\n * Do some checks and set _baseUri.\n *\n * @private\n */\n\n set baseUri(uri) {\n if (!uri) {\n return;\n }\n\n if (!this._baseUri) {\n this._baseUri = uri;\n return;\n }\n\n if (this._baseUri instanceof RegExp) {\n throw new TypeError(`the router already contains a regexp uri ${this._baseUri.toString()} It cannot be mixed with ${uri.toString()}`);\n }\n\n if (uri instanceof RegExp) {\n throw new TypeError(`the router already contains an uri ${this._baseUri.toString()} It cannot be mixed with regexp ${uri.toString()}`);\n }\n }\n\n\n /**\n * Return router's _baseUri.\n *\n * @private\n */\n\n get baseUri() {\n return this._baseUri;\n }\n\n\n /**\n * Add a route to the router.\n *\n * @private\n */\n\n _add(route) {\n this._routes.push(route);\n return this;\n }\n\n\n /**\n * Gather routes from routers filtered by _uri_ and HTTP _method_.\n *\n * @private\n */\n\n routes(uri, method) {\n return this._routes.filter((route) => {\n if (!route.uri && !route.method) {\n return true;\n }\n if (route.method !== method) {\n return false;\n }\n\n if (!route.uri) {\n return true;\n }\n\n let uriToCheck = uri;\n\n //remove query string from uri to test\n const questionMarkIndex = uriToCheck.indexOf('?');\n if (questionMarkIndex >= 0) {\n uriToCheck = uriToCheck.slice(0, questionMarkIndex);\n }\n\n //remove anchor from uri to test\n const hashIndex = uriToCheck.indexOf('#');\n if (hashIndex >= 0) {\n uriToCheck = uriToCheck.slice(0, hashIndex);\n }\n\n if (route.uri instanceof RegExp) {\n return uriToCheck.match(route.uri);\n }\n\n return route.uri === uriToCheck;\n });\n }\n\n\n /**\n * Gather visited routes from routers.\n *\n * @private\n */\n\n visited() {\n return this._routes.filter((route) => {\n return route.visited;\n });\n }\n\n\n /**\n * Use the given middleware function or object on this router.\n *\n * // middleware function\n * router.use((req, res, next) => {console.log('Hello')});\n *\n * // middleware object\n * router.use(new Middleware());\n *\n * @param {Middleware|Function} middleware object or function\n * @return {Router} for chaining\n *\n * @public\n */\n\n use(middleware) {\n if (!(middleware instanceof Middleware) && (typeof middleware !== 'function') ) {\n throw new TypeError('use method takes at least a middleware');\n }\n\n this._add(new Route(this, undefined, undefined, middleware));\n\n return this;\n }\n\n\n /**\n * Use the given middleware function or object on this router for\n * all HTTP methods.\n *\n * // middleware function\n * router.all((req, res, next) => {console.log('Hello')});\n *\n * // middleware object\n * router.all(new Middleware());\n *\n * @param {Middleware|Function} middleware object or function\n * @return {Router} for chaining\n *\n * @public\n */\n\n all(...args) {\n if (args.length === 0) {\n throw new TypeError('use all method takes at least a middleware');\n }\n let middleware;\n\n if (args.length === 1) {\n [middleware,] = args;\n } else {\n [, middleware,] = args;\n }\n\n if (!(middleware instanceof Middleware) && (typeof middleware !== 'function') ) {\n throw new TypeError('use all method takes at least a middleware');\n }\n\n for (const method of HTTP_METHODS) {\n this[method.toLowerCase()](...args);\n }\n return this;\n }\n}\n\nfor (const method of HTTP_METHODS) {\n\n\n /**\n * Use the given middleware function or object, with optional _uri_ on\n * HTTP methods: get, post, put, delete...\n * Default _uri_ is \"/\".\n *\n * // middleware function will be applied on path \"/\"\n * router.get((req, res, next) => {console.log('Hello')});\n *\n * // middleware object will be applied on path \"/\" and\n * router.get(new Middleware());\n *\n * // middleware function will be applied on path \"/user\"\n * router.post('/user', (req, res, next) => {console.log('Hello')});\n *\n * // middleware object will be applied on path \"/user\" and\n * router.post('/user', new Middleware());\n *\n * @param {String} uri\n * @param {Middleware|Function} middleware object or function\n * @return {Router} for chaining\n * @public\n */\n\n const methodName = method.toLowerCase();\n Router.prototype[methodName] = function(...args) {\n if (args.length === 0) {\n throw new TypeError(`use ${methodName} method takes at least a middleware`);\n }\n let uri, middleware;\n\n if (args.length === 1) {\n [middleware,] = args;\n } else {\n [uri, middleware,] = args;\n }\n\n if (!(middleware instanceof Middleware) && (typeof middleware !== 'function') ) {\n throw new TypeError(`use ${methodName} method takes at least a middleware`);\n }\n\n if (uri && this._baseUri && this._baseUri instanceof RegExp) {\n throw new TypeError('router contains a regexp cannot mix with route uri/regexp');\n }\n\n this._add(new Route(this, uri, method, middleware));\n\n return this;\n };\n}\n","/**\n * Module dependencies.\n * @private\n */\n\nimport HTTP_METHODS from './methods';\nimport Settings from './settings';\nimport Router, {Route} from './router';\nimport Middleware from './middleware';\n\n\n/**\n * Application class.\n */\n\nexport default class Application {\n\n\n /**\n * Initialize the application.\n *\n * - setup default configuration\n *\n * @private\n */\n\n constructor() {\n this.routers = [];\n this.isDOMLoaded = false;\n this.isDOMReady = false;\n this.settings = new Settings();\n }\n\n\n /**\n * Assign `setting` to `val`, or return `setting`'s value.\n *\n * app.set('foo', 'bar');\n * app.set('foo');\n * // => \"bar\"\n *\n * @param {String} setting\n * @param {*} [val]\n * @return {app} for chaining\n * @public\n */\n\n set(...args) {\n // get behaviour\n if (args.length === 1) {\n return this.settings.get([args]);\n }\n\n // set behaviour\n const [name, value] = args;\n this.settings.set(name, value);\n\n return this;\n }\n\n\n /**\n * Listen for DOM initialization and history state changes.\n *\n * The callback function is called once the DOM has\n * the `document.readyState` equals to 'interactive'.\n *\n * app.listen(()=> {\n * console.log('App is listening requests');\n * console.log('DOM is ready!');\n * });\n *\n *\n * @param {Function} callback\n * @public\n */\n\n listen(callback) {\n window.onbeforeunload = () => {\n this._callMiddlewareMethod('exited');\n };\n\n window.onpopstate = (event) => {\n if (event.state) {\n const {request, response} = event.state;\n const currentRoutes = this._routes(request.uri, request.method);\n\n this._callMiddlewareMethod('entered', currentRoutes, request);\n this._callMiddlewareMethod('updated', currentRoutes, request, response);\n }\n };\n\n document.onreadystatechange = () => {\n const request = {method: 'GET', uri: window.location.pathname + window.location.search};\n const response = {status: 200, statusText: 'OK'};\n const currentRoutes = this._routes();\n // DOM state\n if (document.readyState === 'loading' && !this.isDOMLoaded) {\n this.isDOMLoaded = true;\n this._callMiddlewareMethod('entered', currentRoutes, request);\n } else if (document.readyState === 'interactive' && !this.isDOMReady) {\n if (!this.isDOMLoaded) {\n this.isDOMLoaded = true;\n this._callMiddlewareMethod('entered', currentRoutes, request);\n }\n this.isDOMReady = true;\n this._callMiddlewareMethod('updated', currentRoutes, request, response);\n if (callback) {\n callback(request, response);\n }\n }\n };\n }\n\n\n /**\n * Returns a new `Router` instance for the _uri_.\n * See the Router api docs for details.\n *\n * app.route('/');\n * // => new Router instance\n *\n * @param {String} uri\n * @return {Router} for chaining\n *\n * @public\n */\n\n route(uri) {\n const router = new Router(uri);\n this.routers.push(router);\n return router;\n }\n\n\n /**\n * Use the given middleware function or object, with optional _uri_.\n * Default _uri_ is \"/\".\n *\n * // middleware function will be applied on path \"/\"\n * app.use((req, res, next) => {console.log('Hello')});\n *\n * // middleware object will be applied on path \"/\"\n * app.use(new Middleware());\n *\n * @param {String} uri\n * @param {Middleware|Function} middleware object or function\n * @return {app} for chaining\n *\n * @public\n */\n\n use(...args) {\n const errorMsg = 'use method takes at least a middleware or a router';\n let baseUri, middleware, router, which;\n if (!args || args.length === 0) {\n throw new TypeError(errorMsg);\n } else if (args.length === 1) {\n [which,] = args;\n } else {\n [baseUri, which,] = args;\n }\n\n if (which instanceof Router) {\n router = which;\n router.baseUri = baseUri;\n } else if ((which instanceof Middleware) || (typeof which === 'function')) {\n middleware = which;\n router = new Router(baseUri);\n for (const method of HTTP_METHODS) {\n router[method.toLowerCase()](middleware);\n }\n } else {\n throw new TypeError(errorMsg);\n }\n this.routers.push(router);\n\n return this;\n }\n\n\n /**\n * Gather routes from all routers filtered by _uri_ and HTTP _method_.\n * See Router#routes() documentation for details.\n *\n * @private\n */\n\n _routes(uri=window.location.pathname + window.location.search, method='GET') {\n const currentRoutes = [];\n for (const router of this.routers) {\n currentRoutes.push(...router.routes(uri, method));\n }\n\n return currentRoutes;\n }\n\n\n /**\n * Call `Middleware` method or middleware function on _currentRoutes_.\n *\n * @private\n */\n\n _callMiddlewareMethod(meth, currentRoutes, request, response) {\n if (meth === 'exited') {\n // currentRoutes, request, response params not needed\n for (const router of this.routers) {\n for (const route of router.visited()) {\n if (route.middleware.exited) {\n route.middleware.exited(route.visited);\n route.visited = null;\n }\n }\n }\n return;\n }\n\n for (const route of currentRoutes) {\n if (meth === 'updated') {\n route.visited = request;\n }\n\n if (route.middleware[meth]) {\n route.middleware[meth](request, response);\n if (route.middleware.next && !route.middleware.next()) {\n break;\n }\n } else if (meth !== 'entered') {\n // calls middleware method\n let breakMiddlewareLoop = true;\n const next = () => {\n breakMiddlewareLoop = false;\n };\n route.middleware(request, response, next);\n if (breakMiddlewareLoop) {\n break;\n }\n }\n }\n }\n\n\n /**\n * Make an ajax request. Manage History#pushState if history object set.\n *\n * @private\n */\n\n _fetch(request, resolve, reject) {\n let {method, uri, headers, data, history} = request;\n\n const httpMethodTransformer = this.get(`http ${method} transformer`);\n if (httpMethodTransformer) {\n uri = httpMethodTransformer.uri ? httpMethodTransformer.uri({uri, headers, data}) : uri;\n headers = httpMethodTransformer.headers ? httpMethodTransformer.headers({uri, headers, data}) : headers;\n data = httpMethodTransformer.data ? httpMethodTransformer.data({uri, headers, data}) : data;\n }\n\n // calls middleware exited method\n this._callMiddlewareMethod('exited');\n\n // gathers all routes impacted by the uri\n const currentRoutes = this._routes(uri, method);\n\n // calls middleware entered method\n this._callMiddlewareMethod('entered', currentRoutes, request);\n\n // invokes http request\n this.settings.get('http requester').fetch(request,\n (req, res) => {\n if (history) {\n window.history.pushState({request: req, response: res}, history.title, history.uri);\n }\n this._callMiddlewareMethod('updated', currentRoutes, req, res);\n if (resolve) {\n resolve(req, res);\n }\n },\n (req, res) => {\n this._callMiddlewareMethod('failed', currentRoutes, req, res);\n if (reject) {\n reject(req, res);\n }\n });\n }\n}\n\nHTTP_METHODS.reduce((reqProto, method) => {\n\n\n /**\n * Use the given middleware function or object, with optional _uri_ on\n * HTTP methods: get, post, put, delete...\n * Default _uri_ is \"/\".\n *\n * // middleware function will be applied on path \"/\"\n * app.get((req, res, next) => {console.log('Hello')});\n *\n * // middleware object will be applied on path \"/\" and\n * app.get(new Middleware());\n *\n * // get a setting value\n * app.set('foo', 'bar');\n * app.get('foo');\n * // => \"bar\"\n *\n * @param {String} uri or setting\n * @param {Middleware|Function} middleware object or function\n * @return {app} for chaining\n * @public\n */\n\n const middlewareMethodName = method.toLowerCase();\n reqProto[middlewareMethodName] = function(...args) {\n let baseUri, middleware, which;\n if (!args || args.length === 0) {\n throw new TypeError(`${middlewareMethodName} method takes at least a middleware ${middlewareMethodName === 'get' ? 'or a string' : ''}`);\n } else if (args.length === 1) {\n [which] = args;\n if (middlewareMethodName === 'get' && typeof which === 'string') {\n return this.settings.get(which);\n }\n } else {\n [baseUri, which,] = args;\n }\n\n if (!(which instanceof Middleware) && (typeof which !== 'function')) {\n throw new TypeError(`${middlewareMethodName} method takes at least a middleware`);\n }\n\n middleware = which;\n const router = new Router();\n router[middlewareMethodName](baseUri, middleware);\n\n this.routers.push(router);\n\n return this;\n };\n\n /**\n * Ajax request (get, post, put, delete...).\n *\n * // HTTP GET method\n * httpGet('/route1');\n *\n * // HTTP GET method\n * httpGet({uri: '/route1', data: {'p1': 'val1'});\n * // uri invoked => /route1?p1=val1\n *\n * // HTTP GET method with browser history management\n * httpGet({uri: '/api/users', history: {state: {foo: \"bar\"}, title: 'users page', uri: '/view/users'});\n *\n * Samples above can be applied on other HTTP methods.\n *\n * @param {String|Object} uri or object containing uri, http headers, data, history\n * @param {Function} success callback\n * @param {Function} failure callback\n * @public\n */\n const httpMethodName = 'http'+method.charAt(0).toUpperCase() + method.slice(1).toLowerCase();\n reqProto[httpMethodName] = function(request, resolve, reject) {\n let {uri, headers, data, history} = request;\n if (!uri) {\n uri = request;\n }\n return this._fetch({\n uri,\n method,\n headers,\n data,\n history\n }, resolve, reject);\n };\n\n return reqProto;\n}, Application.prototype);\n","/**\n * Module dependencies.\n */\n\nimport Application from './application';\nimport Router from './router';\nimport Middleware from './middleware';\n\n\n/**\n * Create a frontexpress application.\n *\n * @return {Function}\n * @api public\n */\n\nconst frontexpress = () => new Application();\n\n/**\n * Expose Router, Middleware constructors.\n */\nfrontexpress.Router = (baseUri) => new Router(baseUri);\nfrontexpress.Middleware = Middleware;\n\nexport default frontexpress;\n"],"names":["Requester","request","resolve","reject","method","uri","headers","data","success","responseText","fail","status","statusText","errorThrown","xmlhttp","XMLHttpRequest","onreadystatechange","readyState","open","Object","keys","header","setRequestHeader","send","Settings","settings","uriWithoutAnchor","anchor","match","exec","reduce","gUri","d","index","indexOf","rules","requester","fetch","TypeError","name","value","checkRules","this","Middleware","Route","router","uriPart","middleware","visited","RegExp","baseUri","trim","replace","Router","_baseUri","_routes","route","push","filter","uriToCheck","questionMarkIndex","slice","hashIndex","_add","undefined","args","length","HTTP_METHODS","toLowerCase","toString","methodName","prototype","Application","routers","isDOMLoaded","isDOMReady","get","set","callback","onbeforeunload","_callMiddlewareMethod","onpopstate","event","state","response","currentRoutes","_this","window","location","pathname","search","document","errorMsg","which","routes","meth","next","breakMiddlewareLoop","exited","history","httpMethodTransformer","req","res","pushState","title","reqProto","middlewareMethodName","httpMethodName","charAt","toUpperCase","_fetch","frontexpress"],"mappings":"wCAKC,QAAgB,MAAO,OAAQ,MAAO,63BCAlBA,4EAWXC,EAASC,EAASC,MACbC,GAA8BH,EAA9BG,OAAQC,EAAsBJ,EAAtBI,IAAKC,EAAiBL,EAAjBK,QAASC,EAAQN,EAARM,KAEvBC,EAAU,SAACC,KAETR,UAEY,eACI,uBAMlBS,EAAO,eAAEC,KAAAA,OAAQC,IAAAA,WAAYC,IAAAA,cAI3BZ,sDAKoBU,OAAUC,EAAWA,EAAW,OAKtDE,EAAU,GAAIC,kBACZC,mBAAqB,WACE,IAAvB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