Subida del módulo y tema de PrestaShop

This commit is contained in:
Kaloyan
2026-04-09 18:31:51 +02:00
parent 12c253296f
commit 16b3ff9424
39262 changed files with 7418797 additions and 0 deletions

View File

@@ -0,0 +1,283 @@
(function (root, factory) {
var routing = factory();
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], routing.Routing);
} else if (typeof module === 'object' && module.exports) {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = routing.Routing;
} else {
// Browser globals (root is window)
root.Routing = routing.Routing;
root.fos = {
Router: routing.Router
};
}
}(this, function () {
var exports = {};
"use strict";
exports.__esModule = true;
exports.Routing = exports.Router = void 0;
var Router = /** @class */ (function () {
function Router(context, routes) {
this.context_ = context || { base_url: '', prefix: '', host: '', port: '', scheme: '', locale: '' };
this.setRoutes(routes || {});
}
Router.getInstance = function () {
return exports.Routing;
};
Router.setData = function (data) {
var router = Router.getInstance();
router.setRoutingData(data);
};
Router.prototype.setRoutingData = function (data) {
this.setBaseUrl(data['base_url']);
this.setRoutes(data['routes']);
if (typeof data.prefix !== 'undefined') {
this.setPrefix(data['prefix']);
}
if (typeof data.port !== 'undefined') {
this.setPort(data['port']);
}
if (typeof data.locale !== 'undefined') {
this.setLocale(data['locale']);
}
this.setHost(data['host']);
if (typeof data.scheme !== 'undefined') {
this.setScheme(data['scheme']);
}
};
Router.prototype.setRoutes = function (routes) {
this.routes_ = Object.freeze(routes);
};
Router.prototype.getRoutes = function () {
return this.routes_;
};
Router.prototype.setBaseUrl = function (baseUrl) {
this.context_.base_url = baseUrl;
};
Router.prototype.getBaseUrl = function () {
return this.context_.base_url;
};
Router.prototype.setPrefix = function (prefix) {
this.context_.prefix = prefix;
};
Router.prototype.setScheme = function (scheme) {
this.context_.scheme = scheme;
};
Router.prototype.getScheme = function () {
return this.context_.scheme;
};
Router.prototype.setHost = function (host) {
this.context_.host = host;
};
Router.prototype.getHost = function () {
return this.context_.host;
};
Router.prototype.setPort = function (port) {
this.context_.port = port;
};
Router.prototype.getPort = function () {
return this.context_.port;
};
;
Router.prototype.setLocale = function (locale) {
this.context_.locale = locale;
};
Router.prototype.getLocale = function () {
return this.context_.locale;
};
;
/**
* Builds query string params added to a URL.
* Port of jQuery's $.param() function, so credit is due there.
*/
Router.prototype.buildQueryParams = function (prefix, params, add) {
var _this = this;
var name;
var rbracket = new RegExp(/\[\]$/);
if (params instanceof Array) {
params.forEach(function (val, i) {
if (rbracket.test(prefix)) {
add(prefix, val);
}
else {
_this.buildQueryParams(prefix + '[' + (typeof val === 'object' ? i : '') + ']', val, add);
}
});
}
else if (typeof params === 'object') {
for (name in params) {
this.buildQueryParams(prefix + '[' + name + ']', params[name], add);
}
}
else {
add(prefix, params);
}
};
/**
* Returns a raw route object.
*/
Router.prototype.getRoute = function (name) {
var prefixedName = this.context_.prefix + name;
var sf41i18nName = name + '.' + this.context_.locale;
var prefixedSf41i18nName = this.context_.prefix + name + '.' + this.context_.locale;
var variants = [prefixedName, sf41i18nName, prefixedSf41i18nName, name];
for (var i in variants) {
if (variants[i] in this.routes_) {
return this.routes_[variants[i]];
}
}
throw new Error('The route "' + name + '" does not exist.');
};
/**
* Generates the URL for a route.
*/
Router.prototype.generate = function (name, opt_params, absolute) {
var route = (this.getRoute(name));
var params = opt_params || {};
var unusedParams = Object.assign({}, params);
var url = '';
var optional = true;
var host = '';
var port = (typeof this.getPort() == 'undefined' || this.getPort() === null) ? '' : this.getPort();
route.tokens.forEach(function (token) {
if ('text' === token[0] && typeof token[1] === 'string') {
url = Router.encodePathComponent(token[1]) + url;
optional = false;
return;
}
if ('variable' === token[0]) {
if (token.length === 6 && token[5] === true) { // Sixth part of the token array indicates if it should be included in case of defaults
optional = false;
}
var hasDefault = route.defaults && !Array.isArray(route.defaults) && typeof token[3] === 'string' && (token[3] in route.defaults);
if (false === optional || !hasDefault || ((typeof token[3] === 'string' && token[3] in params) && !Array.isArray(route.defaults) && params[token[3]] != route.defaults[token[3]])) {
var value = void 0;
if (typeof token[3] === 'string' && token[3] in params) {
value = params[token[3]];
delete unusedParams[token[3]];
}
else if (typeof token[3] === 'string' && hasDefault && !Array.isArray(route.defaults)) {
value = route.defaults[token[3]];
}
else if (optional) {
return;
}
else {
throw new Error('The route "' + name + '" requires the parameter "' + token[3] + '".');
}
var empty = true === value || false === value || '' === value;
if (!empty || !optional) {
var encodedValue = Router.encodePathComponent(value);
if ('null' === encodedValue && null === value) {
encodedValue = '';
}
url = token[1] + encodedValue + url;
}
optional = false;
}
else if (hasDefault && (typeof token[3] === 'string' && token[3] in unusedParams)) {
delete unusedParams[token[3]];
}
return;
}
throw new Error('The token type "' + token[0] + '" is not supported.');
});
if (url === '') {
url = '/';
}
route.hosttokens.forEach(function (token) {
var value;
if ('text' === token[0]) {
host = token[1] + host;
return;
}
if ('variable' === token[0]) {
if (token[3] in params) {
value = params[token[3]];
delete unusedParams[token[3]];
}
else if (route.defaults && !Array.isArray(route.defaults) && (token[3] in route.defaults)) {
value = route.defaults[token[3]];
}
host = token[1] + value + host;
}
});
url = this.context_.base_url + url;
if (route.requirements && ('_scheme' in route.requirements) && this.getScheme() != route.requirements['_scheme']) {
var currentHost = host || this.getHost();
url = route.requirements['_scheme'] + '://' + currentHost + (currentHost.indexOf(':' + port) > -1 || '' === port ? '' : ':' + port) + url;
}
else if ('undefined' !== typeof route.schemes && 'undefined' !== typeof route.schemes[0] && this.getScheme() !== route.schemes[0]) {
var currentHost = host || this.getHost();
url = route.schemes[0] + '://' + currentHost + (currentHost.indexOf(':' + port) > -1 || '' === port ? '' : ':' + port) + url;
}
else if (host && this.getHost() !== host + (host.indexOf(':' + port) > -1 || '' === port ? '' : ':' + port)) {
url = this.getScheme() + '://' + host + (host.indexOf(':' + port) > -1 || '' === port ? '' : ':' + port) + url;
}
else if (absolute === true) {
url = this.getScheme() + '://' + this.getHost() + (this.getHost().indexOf(':' + port) > -1 || '' === port ? '' : ':' + port) + url;
}
if (Object.keys(unusedParams).length > 0) {
var queryParams_1 = [];
var add = function (key, value) {
// if value is a function then call it and assign it's return value as value
value = (typeof value === 'function') ? value() : value;
// change null to empty string
value = (value === null) ? '' : value;
queryParams_1.push(Router.encodeQueryComponent(key) + '=' + Router.encodeQueryComponent(value));
};
for (var prefix in unusedParams) {
if (unusedParams.hasOwnProperty(prefix)) {
this.buildQueryParams(prefix, unusedParams[prefix], add);
}
}
url = url + '?' + queryParams_1.join('&');
}
return url;
};
/**
* Returns the given string encoded to mimic Symfony URL generator.
*/
Router.customEncodeURIComponent = function (value) {
return encodeURIComponent(value)
.replace(/%2F/g, '/')
.replace(/%40/g, '@')
.replace(/%3A/g, ':')
.replace(/%21/g, '!')
.replace(/%3B/g, ';')
.replace(/%2C/g, ',')
.replace(/%2A/g, '*')
.replace(/\(/g, '%28')
.replace(/\)/g, '%29')
.replace(/'/g, '%27');
};
/**
* Returns the given path properly encoded to mimic Symfony URL generator.
*/
Router.encodePathComponent = function (value) {
return Router.customEncodeURIComponent(value)
.replace(/%3D/g, '=')
.replace(/%2B/g, '+')
.replace(/%21/g, '!')
.replace(/%7C/g, '|');
};
/**
* Returns the given query parameter or value properly encoded to mimic Symfony URL generator.
*/
Router.encodeQueryComponent = function (value) {
return Router.customEncodeURIComponent(value)
.replace(/%3F/g, '?');
};
return Router;
}());
exports.Router = Router;
exports.Routing = new Router();
exports["default"] = exports.Routing;
return { Router: exports.Router, Routing: exports.Routing };
}));

View File

@@ -0,0 +1 @@
!function(e){(t={}).__esModule=!0,t.Routing=t.Router=void 0,o=function(){function l(e,t){this.context_=e||{base_url:"",prefix:"",host:"",port:"",scheme:"",locale:""},this.setRoutes(t||{})}return l.getInstance=function(){return t.Routing},l.setData=function(e){l.getInstance().setRoutingData(e)},l.prototype.setRoutingData=function(e){this.setBaseUrl(e.base_url),this.setRoutes(e.routes),void 0!==e.prefix&&this.setPrefix(e.prefix),void 0!==e.port&&this.setPort(e.port),void 0!==e.locale&&this.setLocale(e.locale),this.setHost(e.host),void 0!==e.scheme&&this.setScheme(e.scheme)},l.prototype.setRoutes=function(e){this.routes_=Object.freeze(e)},l.prototype.getRoutes=function(){return this.routes_},l.prototype.setBaseUrl=function(e){this.context_.base_url=e},l.prototype.getBaseUrl=function(){return this.context_.base_url},l.prototype.setPrefix=function(e){this.context_.prefix=e},l.prototype.setScheme=function(e){this.context_.scheme=e},l.prototype.getScheme=function(){return this.context_.scheme},l.prototype.setHost=function(e){this.context_.host=e},l.prototype.getHost=function(){return this.context_.host},l.prototype.setPort=function(e){this.context_.port=e},l.prototype.getPort=function(){return this.context_.port},l.prototype.setLocale=function(e){this.context_.locale=e},l.prototype.getLocale=function(){return this.context_.locale},l.prototype.buildQueryParams=function(o,e,n){var t,r=this,s=new RegExp(/\[\]$/);if(e instanceof Array)e.forEach(function(e,t){s.test(o)?n(o,e):r.buildQueryParams(o+"["+("object"==typeof e?t:"")+"]",e,n)});else if("object"==typeof e)for(t in e)this.buildQueryParams(o+"["+t+"]",e[t],n);else n(o,e)},l.prototype.getRoute=function(e){var t,o=[this.context_.prefix+e,e+"."+this.context_.locale,this.context_.prefix+e+"."+this.context_.locale,e];for(t in o)if(o[t]in this.routes_)return this.routes_[o[t]];throw new Error('The route "'+e+'" does not exist.')},l.prototype.generate=function(r,e,p){var t,s=this.getRoute(r),i=e||{},u=Object.assign({},i),c="",a=!0,o="",e=void 0===this.getPort()||null===this.getPort()?"":this.getPort();if(s.tokens.forEach(function(e){if("text"===e[0]&&"string"==typeof e[1])return c=l.encodePathComponent(e[1])+c,void(a=!1);if("variable"!==e[0])throw new Error('The token type "'+e[0]+'" is not supported.');6===e.length&&!0===e[5]&&(a=!1);var t=s.defaults&&!Array.isArray(s.defaults)&&"string"==typeof e[3]&&e[3]in s.defaults;if(!1===a||!t||"string"==typeof e[3]&&e[3]in i&&!Array.isArray(s.defaults)&&i[e[3]]!=s.defaults[e[3]]){var o,n=void 0;if("string"==typeof e[3]&&e[3]in i)n=i[e[3]],delete u[e[3]];else{if("string"!=typeof e[3]||!t||Array.isArray(s.defaults)){if(a)return;throw new Error('The route "'+r+'" requires the parameter "'+e[3]+'".')}n=s.defaults[e[3]]}(!0===n||!1===n||""===n)&&a||(o=l.encodePathComponent(n),c=e[1]+(o="null"===o&&null===n?"":o)+c),a=!1}else t&&"string"==typeof e[3]&&e[3]in u&&delete u[e[3]]}),""===c&&(c="/"),s.hosttokens.forEach(function(e){var t;"text"!==e[0]?"variable"===e[0]&&(e[3]in i?(t=i[e[3]],delete u[e[3]]):s.defaults&&!Array.isArray(s.defaults)&&e[3]in s.defaults&&(t=s.defaults[e[3]]),o=e[1]+t+o):o=e[1]+o}),c=this.context_.base_url+c,s.requirements&&"_scheme"in s.requirements&&this.getScheme()!=s.requirements._scheme?(t=o||this.getHost(),c=s.requirements._scheme+"://"+t+(-1<t.indexOf(":"+e)||""===e?"":":"+e)+c):void 0!==s.schemes&&void 0!==s.schemes[0]&&this.getScheme()!==s.schemes[0]?(t=o||this.getHost(),c=s.schemes[0]+"://"+t+(-1<t.indexOf(":"+e)||""===e?"":":"+e)+c):o&&this.getHost()!==o+(-1<o.indexOf(":"+e)||""===e?"":":"+e)?c=this.getScheme()+"://"+o+(-1<o.indexOf(":"+e)||""===e?"":":"+e)+c:!0===p&&(c=this.getScheme()+"://"+this.getHost()+(-1<this.getHost().indexOf(":"+e)||""===e?"":":"+e)+c),0<Object.keys(u).length){function f(e,t){t=null===(t="function"==typeof t?t():t)?"":t,h.push(l.encodeQueryComponent(e)+"="+l.encodeQueryComponent(t))}var n,h=[];for(n in u)u.hasOwnProperty(n)&&this.buildQueryParams(n,u[n],f);c=c+"?"+h.join("&")}return c},l.customEncodeURIComponent=function(e){return encodeURIComponent(e).replace(/%2F/g,"/").replace(/%40/g,"@").replace(/%3A/g,":").replace(/%21/g,"!").replace(/%3B/g,";").replace(/%2C/g,",").replace(/%2A/g,"*").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/'/g,"%27")},l.encodePathComponent=function(e){return l.customEncodeURIComponent(e).replace(/%3D/g,"=").replace(/%2B/g,"+").replace(/%21/g,"!").replace(/%7C/g,"|")},l.encodeQueryComponent=function(e){return l.customEncodeURIComponent(e).replace(/%3F/g,"?")},l}(),t.Router=o,t.Routing=new o,t.default=t.Routing;var t,o={Router:t.Router,Routing:t.Routing};"function"==typeof define&&define.amd?define([],o.Routing):"object"==typeof module&&module.exports?module.exports=o.Routing:(e.Routing=o.Routing,e.fos={Router:o.Router})}(this);