next
Version:
The React Framework
38 lines (36 loc) • 1.36 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') {
policy = window.trustedTypes?.createPolicy('nextjs', {
createHTML: (input)=>input,
createScript: (input)=>input,
createScriptURL: (input)=>input
}) || null;
}
return policy;
}
function __unsafeCreateTrustedScriptURL(url) {
return 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