| 1 |
"use strict"; |
| 2 |
var wp; |
| 3 |
(wp ||= {}).escapeHtml = (() => { |
| 4 |
var __defProp = Object.defineProperty; |
| 5 |
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; |
| 6 |
var __getOwnPropNames = Object.getOwnPropertyNames; |
| 7 |
var __hasOwnProp = Object.prototype.hasOwnProperty; |
| 8 |
var __export = (target, all) => { |
| 9 |
for (var name in all) |
| 10 |
__defProp(target, name, { get: all[name], enumerable: true }); |
| 11 |
}; |
| 12 |
var __copyProps = (to, from, except, desc) => { |
| 13 |
if (from && typeof from === "object" || typeof from === "function") { |
| 14 |
for (let key of __getOwnPropNames(from)) |
| 15 |
if (!__hasOwnProp.call(to, key) && key !== except) |
| 16 |
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); |
| 17 |
} |
| 18 |
return to; |
| 19 |
}; |
| 20 |
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); |
| 21 |
|
| 22 |
// packages/escape-html/build-module/index.mjs |
| 23 |
var index_exports = {}; |
| 24 |
__export(index_exports, { |
| 25 |
escapeAmpersand: () => escapeAmpersand, |
| 26 |
escapeAttribute: () => escapeAttribute, |
| 27 |
escapeEditableHTML: () => escapeEditableHTML, |
| 28 |
escapeHTML: () => escapeHTML, |
| 29 |
escapeLessThan: () => escapeLessThan, |
| 30 |
escapeQuotationMark: () => escapeQuotationMark, |
| 31 |
isValidAttributeName: () => isValidAttributeName |
| 32 |
}); |
| 33 |
|
| 34 |
// packages/escape-html/build-module/escape-greater.mjs |
| 35 |
function __unstableEscapeGreaterThan(value) { |
| 36 |
return value.replace(/>/g, ">"); |
| 37 |
} |
| 38 |
|
| 39 |
// packages/escape-html/build-module/index.mjs |
| 40 |
var REGEXP_INVALID_ATTRIBUTE_NAME = /[\u007F-\u009F "'>/="\uFDD0-\uFDEF]/; |
| 41 |
function escapeAmpersand(value) { |
| 42 |
return value.replace(/&(?!([a-z0-9]+|#[0-9]+|#x[a-f0-9]+);)/gi, "&"); |
| 43 |
} |
| 44 |
function escapeQuotationMark(value) { |
| 45 |
return value.replace(/"/g, """); |
| 46 |
} |
| 47 |
function escapeLessThan(value) { |
| 48 |
return value.replace(/</g, "<"); |
| 49 |
} |
| 50 |
function escapeAttribute(value) { |
| 51 |
return __unstableEscapeGreaterThan( |
| 52 |
escapeLessThan(escapeQuotationMark(escapeAmpersand(value))) |
| 53 |
); |
| 54 |
} |
| 55 |
function escapeHTML(value) { |
| 56 |
return escapeLessThan(escapeAmpersand(value)); |
| 57 |
} |
| 58 |
function escapeEditableHTML(value) { |
| 59 |
return escapeLessThan(value.replace(/&/g, "&")); |
| 60 |
} |
| 61 |
function isValidAttributeName(name) { |
| 62 |
return !REGEXP_INVALID_ATTRIBUTE_NAME.test(name); |
| 63 |
} |
| 64 |
return __toCommonJS(index_exports); |
| 65 |
})(); |
| 66 |
//# sourceMappingURL=index.js.map |
| 67 |
|