next
Version:
The React Framework
35 lines (33 loc) • 1.36 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.__unsafeCreateTrustedScriptURL = __unsafeCreateTrustedScriptURL;
/**
* Stores the Trusted Types Policy. Starts as undefined and can be set to null
* if Trusted Types is not supported in the browser.
*/ 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 ref;
policy = ((ref = window.trustedTypes) == null ? void 0 : ref.createPolicy('nextjs', {
createHTML: (input)=>input,
createScript: (input)=>input,
createScriptURL: (input)=>input
})) || null;
}
return policy;
}
function __unsafeCreateTrustedScriptURL(url) {
var ref;
return ((ref = getPolicy()) == null ? void 0 : ref.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
;