next
Version:
The React Framework
40 lines (38 loc) • 1.53 kB
JavaScript
/**
* Stores the Trusted Types Policy. Starts as undefined and can be set to null
* if Trusted Types is not supported in the browser.
*/ "use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "__unsafeCreateTrustedScriptURL", {
enumerable: true,
get: function() {
return __unsafeCreateTrustedScriptURL;
}
});
let policy;
/**
* Getter for the Trusted Types Policy. If it is undefined, it is instantiated
* here or set to null if Trusted Types is not supported in the browser.
*/ function getPolicy() {
if (typeof policy === 'undefined' && typeof window !== 'undefined') {
var _window_trustedTypes;
policy = ((_window_trustedTypes = window.trustedTypes) == null ? void 0 : _window_trustedTypes.createPolicy('nextjs', {
createHTML: (input)=>input,
createScript: (input)=>input,
createScriptURL: (input)=>input
})) || null;
}
return policy;
}
function __unsafeCreateTrustedScriptURL(url) {
var _getPolicy;
return ((_getPolicy = getPolicy()) == null ? void 0 : _getPolicy.createScriptURL(url)) || url;
}
if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') {
Object.defineProperty(exports.default, '__esModule', { value: true });
Object.assign(exports.default, exports);
module.exports = exports.default;
}
//# sourceMappingURL=trusted-types.js.map