vue-layout-gitcode 1.1.25 → 1.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{GloabarSearch-DpWRqL8Z.js → GloabarSearch-DlBp6deP.js} +2 -2
- package/{ProjectSearch-CUYqxB2e.js → ProjectSearch-BUP8uaCj.js} +1 -1
- package/{SearchHistoryList-CsrGs9P0.js → SearchHistoryList-C2uR-dRD.js} +1 -1
- package/{SearchPrefixTag-BIqUmChj.js → SearchPrefixTag-DGk5Ak40.js} +1 -1
- package/{SearchRecommed-CGDAvddU.js → SearchRecommed-CNJb8ccy.js} +2 -2
- package/{SearchScopeList-BcNBGCAZ.js → SearchScopeList-tBGWHbat.js} +1 -1
- package/{UserSearch-B2JLOkTk.js → UserSearch-JAMg7W9B.js} +1 -1
- package/{index-DrZCkoo8.js → index-BQm-pUeu.js} +1 -1
- package/{index-BcHpCD9I.js → index-C-L6yUgJ.js} +579 -415
- package/{index-Cy6etTg0.js → index-aMICzTxu.js} +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/{notice-CvalmyAG.js → notice-Ikg9Y_ia.js} +1 -1
- package/package.json +1 -1
|
@@ -177,6 +177,14 @@ function asideRequest(request) {
|
|
|
177
177
|
method: "get",
|
|
178
178
|
params
|
|
179
179
|
}), params);
|
|
180
|
+
},
|
|
181
|
+
// 我创建的项目
|
|
182
|
+
getMyCreatedProjects(params) {
|
|
183
|
+
return reqCatch(() => request({
|
|
184
|
+
url: `/api/v2/projects/profile/${params.user_name}/projects`,
|
|
185
|
+
method: "get",
|
|
186
|
+
params
|
|
187
|
+
}), params);
|
|
180
188
|
}
|
|
181
189
|
};
|
|
182
190
|
}
|
|
@@ -436,25 +444,23 @@ const HARMONY_SURVEY_DELAY = "harmony-survey-delay";
|
|
|
436
444
|
const UTM_SOURCE = "utm_source";
|
|
437
445
|
const PASSPORT_PREFIX = "/uc";
|
|
438
446
|
const AUTH_WINDOW = "auth_window";
|
|
439
|
-
/*! @license DOMPurify 2.
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
};
|
|
457
|
-
}
|
|
447
|
+
/*! @license DOMPurify 3.2.5 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.5/LICENSE */
|
|
448
|
+
const {
|
|
449
|
+
entries,
|
|
450
|
+
setPrototypeOf,
|
|
451
|
+
isFrozen,
|
|
452
|
+
getPrototypeOf: getPrototypeOf$1,
|
|
453
|
+
getOwnPropertyDescriptor
|
|
454
|
+
} = Object;
|
|
455
|
+
let {
|
|
456
|
+
freeze,
|
|
457
|
+
seal,
|
|
458
|
+
create: create$1
|
|
459
|
+
} = Object;
|
|
460
|
+
let {
|
|
461
|
+
apply: apply$1,
|
|
462
|
+
construct
|
|
463
|
+
} = typeof Reflect !== "undefined" && Reflect;
|
|
458
464
|
if (!freeze) {
|
|
459
465
|
freeze = function freeze2(x) {
|
|
460
466
|
return x;
|
|
@@ -465,24 +471,36 @@ if (!seal) {
|
|
|
465
471
|
return x;
|
|
466
472
|
};
|
|
467
473
|
}
|
|
474
|
+
if (!apply$1) {
|
|
475
|
+
apply$1 = function apply2(fun, thisValue, args) {
|
|
476
|
+
return fun.apply(thisValue, args);
|
|
477
|
+
};
|
|
478
|
+
}
|
|
468
479
|
if (!construct) {
|
|
469
480
|
construct = function construct2(Func, args) {
|
|
470
|
-
return new
|
|
481
|
+
return new Func(...args);
|
|
471
482
|
};
|
|
472
483
|
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
484
|
+
const arrayForEach = unapply(Array.prototype.forEach);
|
|
485
|
+
const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
|
|
486
|
+
const arrayPop = unapply(Array.prototype.pop);
|
|
487
|
+
const arrayPush$3 = unapply(Array.prototype.push);
|
|
488
|
+
const arraySplice = unapply(Array.prototype.splice);
|
|
489
|
+
const stringToLowerCase = unapply(String.prototype.toLowerCase);
|
|
490
|
+
const stringToString = unapply(String.prototype.toString);
|
|
491
|
+
const stringMatch = unapply(String.prototype.match);
|
|
492
|
+
const stringReplace = unapply(String.prototype.replace);
|
|
493
|
+
const stringIndexOf = unapply(String.prototype.indexOf);
|
|
494
|
+
const stringTrim = unapply(String.prototype.trim);
|
|
495
|
+
const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
|
|
496
|
+
const regExpTest = unapply(RegExp.prototype.test);
|
|
497
|
+
const typeErrorCreate = unconstruct(TypeError);
|
|
483
498
|
function unapply(func) {
|
|
484
499
|
return function(thisArg) {
|
|
485
|
-
|
|
500
|
+
if (thisArg instanceof RegExp) {
|
|
501
|
+
thisArg.lastIndex = 0;
|
|
502
|
+
}
|
|
503
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
486
504
|
args[_key - 1] = arguments[_key];
|
|
487
505
|
}
|
|
488
506
|
return apply$1(func, thisArg, args);
|
|
@@ -490,21 +508,22 @@ function unapply(func) {
|
|
|
490
508
|
}
|
|
491
509
|
function unconstruct(func) {
|
|
492
510
|
return function() {
|
|
493
|
-
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
511
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
494
512
|
args[_key2] = arguments[_key2];
|
|
495
513
|
}
|
|
496
514
|
return construct(func, args);
|
|
497
515
|
};
|
|
498
516
|
}
|
|
499
517
|
function addToSet(set, array) {
|
|
518
|
+
let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
|
|
500
519
|
if (setPrototypeOf) {
|
|
501
520
|
setPrototypeOf(set, null);
|
|
502
521
|
}
|
|
503
|
-
|
|
522
|
+
let l = array.length;
|
|
504
523
|
while (l--) {
|
|
505
|
-
|
|
524
|
+
let element = array[l];
|
|
506
525
|
if (typeof element === "string") {
|
|
507
|
-
|
|
526
|
+
const lcElement = transformCaseFunc(element);
|
|
508
527
|
if (lcElement !== element) {
|
|
509
528
|
if (!isFrozen(array)) {
|
|
510
529
|
array[l] = lcElement;
|
|
@@ -516,19 +535,34 @@ function addToSet(set, array) {
|
|
|
516
535
|
}
|
|
517
536
|
return set;
|
|
518
537
|
}
|
|
538
|
+
function cleanArray(array) {
|
|
539
|
+
for (let index2 = 0; index2 < array.length; index2++) {
|
|
540
|
+
const isPropertyExist = objectHasOwnProperty(array, index2);
|
|
541
|
+
if (!isPropertyExist) {
|
|
542
|
+
array[index2] = null;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
return array;
|
|
546
|
+
}
|
|
519
547
|
function clone(object) {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
if (
|
|
524
|
-
|
|
548
|
+
const newObject = create$1(null);
|
|
549
|
+
for (const [property, value] of entries(object)) {
|
|
550
|
+
const isPropertyExist = objectHasOwnProperty(object, property);
|
|
551
|
+
if (isPropertyExist) {
|
|
552
|
+
if (Array.isArray(value)) {
|
|
553
|
+
newObject[property] = cleanArray(value);
|
|
554
|
+
} else if (value && typeof value === "object" && value.constructor === Object) {
|
|
555
|
+
newObject[property] = clone(value);
|
|
556
|
+
} else {
|
|
557
|
+
newObject[property] = value;
|
|
558
|
+
}
|
|
525
559
|
}
|
|
526
560
|
}
|
|
527
561
|
return newObject;
|
|
528
562
|
}
|
|
529
563
|
function lookupGetter(object, prop) {
|
|
530
564
|
while (object !== null) {
|
|
531
|
-
|
|
565
|
+
const desc = getOwnPropertyDescriptor(object, prop);
|
|
532
566
|
if (desc) {
|
|
533
567
|
if (desc.get) {
|
|
534
568
|
return unapply(desc.get);
|
|
@@ -539,69 +573,79 @@ function lookupGetter(object, prop) {
|
|
|
539
573
|
}
|
|
540
574
|
object = getPrototypeOf$1(object);
|
|
541
575
|
}
|
|
542
|
-
function fallbackValue(
|
|
543
|
-
console.warn("fallback value for", element);
|
|
576
|
+
function fallbackValue() {
|
|
544
577
|
return null;
|
|
545
578
|
}
|
|
546
579
|
return fallbackValue;
|
|
547
580
|
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
581
|
+
const html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]);
|
|
582
|
+
const svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]);
|
|
583
|
+
const svgFilters = freeze(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]);
|
|
584
|
+
const svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]);
|
|
585
|
+
const mathMl$1 = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]);
|
|
586
|
+
const mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
|
|
587
|
+
const text = freeze(["#text"]);
|
|
588
|
+
const html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]);
|
|
589
|
+
const svg = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]);
|
|
590
|
+
const mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]);
|
|
591
|
+
const xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
|
|
592
|
+
const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm);
|
|
593
|
+
const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
|
|
594
|
+
const TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm);
|
|
595
|
+
const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
|
|
596
|
+
const ARIA_ATTR = seal(/^aria-[\-\w]+$/);
|
|
597
|
+
const IS_ALLOWED_URI = seal(
|
|
598
|
+
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
565
599
|
// eslint-disable-line no-useless-escape
|
|
566
600
|
);
|
|
567
|
-
|
|
568
|
-
|
|
601
|
+
const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
|
|
602
|
+
const ATTR_WHITESPACE = seal(
|
|
569
603
|
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
570
604
|
// eslint-disable-line no-control-regex
|
|
571
605
|
);
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
606
|
+
const DOCTYPE_NAME = seal(/^html$/i);
|
|
607
|
+
const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
608
|
+
var EXPRESSIONS = /* @__PURE__ */ Object.freeze({
|
|
609
|
+
__proto__: null,
|
|
610
|
+
ARIA_ATTR,
|
|
611
|
+
ATTR_WHITESPACE,
|
|
612
|
+
CUSTOM_ELEMENT,
|
|
613
|
+
DATA_ATTR,
|
|
614
|
+
DOCTYPE_NAME,
|
|
615
|
+
ERB_EXPR,
|
|
616
|
+
IS_ALLOWED_URI,
|
|
617
|
+
IS_SCRIPT_OR_DATA,
|
|
618
|
+
MUSTACHE_EXPR,
|
|
619
|
+
TMPLIT_EXPR
|
|
620
|
+
});
|
|
621
|
+
const NODE_TYPE = {
|
|
622
|
+
element: 1,
|
|
623
|
+
text: 3,
|
|
624
|
+
// Deprecated
|
|
625
|
+
progressingInstruction: 7,
|
|
626
|
+
comment: 8,
|
|
627
|
+
document: 9
|
|
577
628
|
};
|
|
578
|
-
function
|
|
579
|
-
if (Array.isArray(arr)) {
|
|
580
|
-
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) {
|
|
581
|
-
arr2[i] = arr[i];
|
|
582
|
-
}
|
|
583
|
-
return arr2;
|
|
584
|
-
} else {
|
|
585
|
-
return Array.from(arr);
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
var getGlobal = function getGlobal2() {
|
|
629
|
+
const getGlobal = function getGlobal2() {
|
|
589
630
|
return typeof window === "undefined" ? null : window;
|
|
590
631
|
};
|
|
591
|
-
|
|
592
|
-
if (
|
|
632
|
+
const _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) {
|
|
633
|
+
if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
|
|
593
634
|
return null;
|
|
594
635
|
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
if (
|
|
598
|
-
suffix =
|
|
636
|
+
let suffix = null;
|
|
637
|
+
const ATTR_NAME = "data-tt-policy-suffix";
|
|
638
|
+
if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
|
|
639
|
+
suffix = purifyHostElement.getAttribute(ATTR_NAME);
|
|
599
640
|
}
|
|
600
|
-
|
|
641
|
+
const policyName = "dompurify" + (suffix ? "#" + suffix : "");
|
|
601
642
|
try {
|
|
602
643
|
return trustedTypes.createPolicy(policyName, {
|
|
603
|
-
createHTML
|
|
604
|
-
return
|
|
644
|
+
createHTML(html2) {
|
|
645
|
+
return html2;
|
|
646
|
+
},
|
|
647
|
+
createScriptURL(scriptUrl) {
|
|
648
|
+
return scriptUrl;
|
|
605
649
|
}
|
|
606
650
|
});
|
|
607
651
|
} catch (_) {
|
|
@@ -609,49 +653,87 @@ var _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes
|
|
|
609
653
|
return null;
|
|
610
654
|
}
|
|
611
655
|
};
|
|
612
|
-
function
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
656
|
+
const _createHooksMap = function _createHooksMap2() {
|
|
657
|
+
return {
|
|
658
|
+
afterSanitizeAttributes: [],
|
|
659
|
+
afterSanitizeElements: [],
|
|
660
|
+
afterSanitizeShadowDOM: [],
|
|
661
|
+
beforeSanitizeAttributes: [],
|
|
662
|
+
beforeSanitizeElements: [],
|
|
663
|
+
beforeSanitizeShadowDOM: [],
|
|
664
|
+
uponSanitizeAttribute: [],
|
|
665
|
+
uponSanitizeElement: [],
|
|
666
|
+
uponSanitizeShadowNode: []
|
|
616
667
|
};
|
|
617
|
-
|
|
668
|
+
};
|
|
669
|
+
function createDOMPurify() {
|
|
670
|
+
let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
|
|
671
|
+
const DOMPurify = (root2) => createDOMPurify(root2);
|
|
672
|
+
DOMPurify.version = "3.2.5";
|
|
618
673
|
DOMPurify.removed = [];
|
|
619
|
-
if (!window2 || !window2.document || window2.document.nodeType !==
|
|
674
|
+
if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE.document || !window2.Element) {
|
|
620
675
|
DOMPurify.isSupported = false;
|
|
621
676
|
return DOMPurify;
|
|
622
677
|
}
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
678
|
+
let {
|
|
679
|
+
document: document2
|
|
680
|
+
} = window2;
|
|
681
|
+
const originalDocument = document2;
|
|
682
|
+
const currentScript = originalDocument.currentScript;
|
|
683
|
+
const {
|
|
684
|
+
DocumentFragment,
|
|
685
|
+
HTMLTemplateElement,
|
|
686
|
+
Node,
|
|
687
|
+
Element,
|
|
688
|
+
NodeFilter,
|
|
689
|
+
NamedNodeMap = window2.NamedNodeMap || window2.MozNamedAttrMap,
|
|
690
|
+
HTMLFormElement,
|
|
691
|
+
DOMParser,
|
|
692
|
+
trustedTypes
|
|
693
|
+
} = window2;
|
|
694
|
+
const ElementPrototype = Element.prototype;
|
|
695
|
+
const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
|
|
696
|
+
const remove = lookupGetter(ElementPrototype, "remove");
|
|
697
|
+
const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
|
|
698
|
+
const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
|
|
699
|
+
const getParentNode = lookupGetter(ElementPrototype, "parentNode");
|
|
631
700
|
if (typeof HTMLTemplateElement === "function") {
|
|
632
|
-
|
|
701
|
+
const template = document2.createElement("template");
|
|
633
702
|
if (template.content && template.content.ownerDocument) {
|
|
634
703
|
document2 = template.content.ownerDocument;
|
|
635
704
|
}
|
|
636
705
|
}
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
706
|
+
let trustedTypesPolicy;
|
|
707
|
+
let emptyHTML = "";
|
|
708
|
+
const {
|
|
709
|
+
implementation,
|
|
710
|
+
createNodeIterator,
|
|
711
|
+
createDocumentFragment,
|
|
712
|
+
getElementsByTagName
|
|
713
|
+
} = document2;
|
|
714
|
+
const {
|
|
715
|
+
importNode
|
|
716
|
+
} = originalDocument;
|
|
717
|
+
let hooks = _createHooksMap();
|
|
718
|
+
DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode === "function" && implementation && implementation.createHTMLDocument !== void 0;
|
|
719
|
+
const {
|
|
720
|
+
MUSTACHE_EXPR: MUSTACHE_EXPR2,
|
|
721
|
+
ERB_EXPR: ERB_EXPR2,
|
|
722
|
+
TMPLIT_EXPR: TMPLIT_EXPR2,
|
|
723
|
+
DATA_ATTR: DATA_ATTR2,
|
|
724
|
+
ARIA_ATTR: ARIA_ATTR2,
|
|
725
|
+
IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA2,
|
|
726
|
+
ATTR_WHITESPACE: ATTR_WHITESPACE2,
|
|
727
|
+
CUSTOM_ELEMENT: CUSTOM_ELEMENT2
|
|
728
|
+
} = EXPRESSIONS;
|
|
729
|
+
let {
|
|
730
|
+
IS_ALLOWED_URI: IS_ALLOWED_URI$1
|
|
731
|
+
} = EXPRESSIONS;
|
|
732
|
+
let ALLOWED_TAGS = null;
|
|
733
|
+
const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
|
|
734
|
+
let ALLOWED_ATTR = null;
|
|
735
|
+
const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
|
|
736
|
+
let CUSTOM_ELEMENT_HANDLING = Object.seal(create$1(null, {
|
|
655
737
|
tagNameCheck: {
|
|
656
738
|
writable: true,
|
|
657
739
|
configurable: false,
|
|
@@ -671,72 +753,92 @@ function createDOMPurify() {
|
|
|
671
753
|
value: false
|
|
672
754
|
}
|
|
673
755
|
}));
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
756
|
+
let FORBID_TAGS = null;
|
|
757
|
+
let FORBID_ATTR = null;
|
|
758
|
+
let ALLOW_ARIA_ATTR = true;
|
|
759
|
+
let ALLOW_DATA_ATTR = true;
|
|
760
|
+
let ALLOW_UNKNOWN_PROTOCOLS = false;
|
|
761
|
+
let ALLOW_SELF_CLOSE_IN_ATTR = true;
|
|
762
|
+
let SAFE_FOR_TEMPLATES = false;
|
|
763
|
+
let SAFE_FOR_XML = true;
|
|
764
|
+
let WHOLE_DOCUMENT = false;
|
|
765
|
+
let SET_CONFIG = false;
|
|
766
|
+
let FORCE_BODY = false;
|
|
767
|
+
let RETURN_DOM = false;
|
|
768
|
+
let RETURN_DOM_FRAGMENT = false;
|
|
769
|
+
let RETURN_TRUSTED_TYPE = false;
|
|
770
|
+
let SANITIZE_DOM = true;
|
|
771
|
+
let SANITIZE_NAMED_PROPS = false;
|
|
772
|
+
const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
|
|
773
|
+
let KEEP_CONTENT = true;
|
|
774
|
+
let IN_PLACE = false;
|
|
775
|
+
let USE_PROFILES = {};
|
|
776
|
+
let FORBID_CONTENTS = null;
|
|
777
|
+
const DEFAULT_FORBID_CONTENTS = addToSet({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
|
|
778
|
+
let DATA_URI_TAGS = null;
|
|
779
|
+
const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
|
|
780
|
+
let URI_SAFE_ATTRIBUTES = null;
|
|
781
|
+
const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]);
|
|
782
|
+
const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
|
|
783
|
+
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
784
|
+
const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
|
|
785
|
+
let NAMESPACE = HTML_NAMESPACE;
|
|
786
|
+
let IS_EMPTY_INPUT = false;
|
|
787
|
+
let ALLOWED_NAMESPACES = null;
|
|
788
|
+
const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
|
|
789
|
+
let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
|
|
790
|
+
let HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]);
|
|
791
|
+
const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
|
|
792
|
+
let PARSER_MEDIA_TYPE = null;
|
|
793
|
+
const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
|
|
794
|
+
const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
|
|
795
|
+
let transformCaseFunc = null;
|
|
796
|
+
let CONFIG = null;
|
|
797
|
+
const formElement = document2.createElement("form");
|
|
798
|
+
const isRegexOrFunction = function isRegexOrFunction2(testValue) {
|
|
708
799
|
return testValue instanceof RegExp || testValue instanceof Function;
|
|
709
800
|
};
|
|
710
|
-
|
|
801
|
+
const _parseConfig = function _parseConfig2() {
|
|
802
|
+
let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
711
803
|
if (CONFIG && CONFIG === cfg) {
|
|
712
804
|
return;
|
|
713
805
|
}
|
|
714
|
-
if (!cfg ||
|
|
806
|
+
if (!cfg || typeof cfg !== "object") {
|
|
715
807
|
cfg = {};
|
|
716
808
|
}
|
|
717
809
|
cfg = clone(cfg);
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
810
|
+
PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
|
|
811
|
+
SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
|
|
812
|
+
transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
|
|
813
|
+
ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
|
|
814
|
+
ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
|
|
815
|
+
ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
|
|
816
|
+
URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
|
|
817
|
+
DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
|
|
818
|
+
FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
|
|
819
|
+
FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
|
|
820
|
+
FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
|
|
821
|
+
USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES : false;
|
|
726
822
|
ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
|
|
727
823
|
ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
|
|
728
824
|
ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
|
|
825
|
+
ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
|
|
729
826
|
SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
|
|
827
|
+
SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
|
|
730
828
|
WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
|
|
731
829
|
RETURN_DOM = cfg.RETURN_DOM || false;
|
|
732
830
|
RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
|
|
733
831
|
RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
|
|
734
832
|
FORCE_BODY = cfg.FORCE_BODY || false;
|
|
735
833
|
SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
|
|
834
|
+
SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
|
|
736
835
|
KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
|
|
737
836
|
IN_PLACE = cfg.IN_PLACE || false;
|
|
738
|
-
IS_ALLOWED_URI
|
|
837
|
+
IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
|
|
739
838
|
NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
|
|
839
|
+
MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS;
|
|
840
|
+
HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS;
|
|
841
|
+
CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
|
|
740
842
|
if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
|
|
741
843
|
CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
|
|
742
844
|
}
|
|
@@ -746,11 +848,6 @@ function createDOMPurify() {
|
|
|
746
848
|
if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === "boolean") {
|
|
747
849
|
CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
|
|
748
850
|
}
|
|
749
|
-
PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
|
|
750
|
-
SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE;
|
|
751
|
-
transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? function(x) {
|
|
752
|
-
return x;
|
|
753
|
-
} : stringToLowerCase;
|
|
754
851
|
if (SAFE_FOR_TEMPLATES) {
|
|
755
852
|
ALLOW_DATA_ATTR = false;
|
|
756
853
|
}
|
|
@@ -758,25 +855,25 @@ function createDOMPurify() {
|
|
|
758
855
|
RETURN_DOM = true;
|
|
759
856
|
}
|
|
760
857
|
if (USE_PROFILES) {
|
|
761
|
-
ALLOWED_TAGS = addToSet({},
|
|
858
|
+
ALLOWED_TAGS = addToSet({}, text);
|
|
762
859
|
ALLOWED_ATTR = [];
|
|
763
860
|
if (USE_PROFILES.html === true) {
|
|
764
|
-
addToSet(ALLOWED_TAGS, html);
|
|
765
|
-
addToSet(ALLOWED_ATTR, html
|
|
861
|
+
addToSet(ALLOWED_TAGS, html$1);
|
|
862
|
+
addToSet(ALLOWED_ATTR, html);
|
|
766
863
|
}
|
|
767
864
|
if (USE_PROFILES.svg === true) {
|
|
768
|
-
addToSet(ALLOWED_TAGS, svg);
|
|
769
|
-
addToSet(ALLOWED_ATTR, svg
|
|
865
|
+
addToSet(ALLOWED_TAGS, svg$1);
|
|
866
|
+
addToSet(ALLOWED_ATTR, svg);
|
|
770
867
|
addToSet(ALLOWED_ATTR, xml);
|
|
771
868
|
}
|
|
772
869
|
if (USE_PROFILES.svgFilters === true) {
|
|
773
870
|
addToSet(ALLOWED_TAGS, svgFilters);
|
|
774
|
-
addToSet(ALLOWED_ATTR, svg
|
|
871
|
+
addToSet(ALLOWED_ATTR, svg);
|
|
775
872
|
addToSet(ALLOWED_ATTR, xml);
|
|
776
873
|
}
|
|
777
874
|
if (USE_PROFILES.mathMl === true) {
|
|
778
|
-
addToSet(ALLOWED_TAGS, mathMl);
|
|
779
|
-
addToSet(ALLOWED_ATTR, mathMl
|
|
875
|
+
addToSet(ALLOWED_TAGS, mathMl$1);
|
|
876
|
+
addToSet(ALLOWED_ATTR, mathMl);
|
|
780
877
|
addToSet(ALLOWED_ATTR, xml);
|
|
781
878
|
}
|
|
782
879
|
}
|
|
@@ -784,22 +881,22 @@ function createDOMPurify() {
|
|
|
784
881
|
if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
|
|
785
882
|
ALLOWED_TAGS = clone(ALLOWED_TAGS);
|
|
786
883
|
}
|
|
787
|
-
addToSet(ALLOWED_TAGS, cfg.ADD_TAGS);
|
|
884
|
+
addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
|
|
788
885
|
}
|
|
789
886
|
if (cfg.ADD_ATTR) {
|
|
790
887
|
if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
|
|
791
888
|
ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
|
792
889
|
}
|
|
793
|
-
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR);
|
|
890
|
+
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
|
|
794
891
|
}
|
|
795
892
|
if (cfg.ADD_URI_SAFE_ATTR) {
|
|
796
|
-
addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR);
|
|
893
|
+
addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
|
|
797
894
|
}
|
|
798
895
|
if (cfg.FORBID_CONTENTS) {
|
|
799
896
|
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
|
|
800
897
|
FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
801
898
|
}
|
|
802
|
-
addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS);
|
|
899
|
+
addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
|
|
803
900
|
}
|
|
804
901
|
if (KEEP_CONTENT) {
|
|
805
902
|
ALLOWED_TAGS["#text"] = true;
|
|
@@ -811,28 +908,43 @@ function createDOMPurify() {
|
|
|
811
908
|
addToSet(ALLOWED_TAGS, ["tbody"]);
|
|
812
909
|
delete FORBID_TAGS.tbody;
|
|
813
910
|
}
|
|
911
|
+
if (cfg.TRUSTED_TYPES_POLICY) {
|
|
912
|
+
if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") {
|
|
913
|
+
throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
914
|
+
}
|
|
915
|
+
if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") {
|
|
916
|
+
throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
917
|
+
}
|
|
918
|
+
trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
|
|
919
|
+
emptyHTML = trustedTypesPolicy.createHTML("");
|
|
920
|
+
} else {
|
|
921
|
+
if (trustedTypesPolicy === void 0) {
|
|
922
|
+
trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
|
|
923
|
+
}
|
|
924
|
+
if (trustedTypesPolicy !== null && typeof emptyHTML === "string") {
|
|
925
|
+
emptyHTML = trustedTypesPolicy.createHTML("");
|
|
926
|
+
}
|
|
927
|
+
}
|
|
814
928
|
if (freeze) {
|
|
815
929
|
freeze(cfg);
|
|
816
930
|
}
|
|
817
931
|
CONFIG = cfg;
|
|
818
932
|
};
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
addToSet(ALL_SVG_TAGS, svgDisallowed);
|
|
824
|
-
var ALL_MATHML_TAGS = addToSet({}, mathMl);
|
|
825
|
-
addToSet(ALL_MATHML_TAGS, mathMlDisallowed);
|
|
826
|
-
var _checkValidNamespace = function _checkValidNamespace2(element) {
|
|
827
|
-
var parent = getParentNode(element);
|
|
933
|
+
const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
|
|
934
|
+
const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
|
|
935
|
+
const _checkValidNamespace = function _checkValidNamespace2(element) {
|
|
936
|
+
let parent = getParentNode(element);
|
|
828
937
|
if (!parent || !parent.tagName) {
|
|
829
938
|
parent = {
|
|
830
|
-
namespaceURI:
|
|
939
|
+
namespaceURI: NAMESPACE,
|
|
831
940
|
tagName: "template"
|
|
832
941
|
};
|
|
833
942
|
}
|
|
834
|
-
|
|
835
|
-
|
|
943
|
+
const tagName = stringToLowerCase(element.tagName);
|
|
944
|
+
const parentTagName = stringToLowerCase(parent.tagName);
|
|
945
|
+
if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
|
|
946
|
+
return false;
|
|
947
|
+
}
|
|
836
948
|
if (element.namespaceURI === SVG_NAMESPACE) {
|
|
837
949
|
if (parent.namespaceURI === HTML_NAMESPACE) {
|
|
838
950
|
return tagName === "svg";
|
|
@@ -858,63 +970,63 @@ function createDOMPurify() {
|
|
|
858
970
|
if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
|
|
859
971
|
return false;
|
|
860
972
|
}
|
|
861
|
-
|
|
862
|
-
|
|
973
|
+
return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
|
|
974
|
+
}
|
|
975
|
+
if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) {
|
|
976
|
+
return true;
|
|
863
977
|
}
|
|
864
978
|
return false;
|
|
865
979
|
};
|
|
866
|
-
|
|
867
|
-
arrayPush$3(DOMPurify.removed, {
|
|
980
|
+
const _forceRemove = function _forceRemove2(node) {
|
|
981
|
+
arrayPush$3(DOMPurify.removed, {
|
|
982
|
+
element: node
|
|
983
|
+
});
|
|
868
984
|
try {
|
|
869
|
-
node.
|
|
985
|
+
getParentNode(node).removeChild(node);
|
|
870
986
|
} catch (_) {
|
|
871
|
-
|
|
872
|
-
node.outerHTML = emptyHTML;
|
|
873
|
-
} catch (_2) {
|
|
874
|
-
node.remove();
|
|
875
|
-
}
|
|
987
|
+
remove(node);
|
|
876
988
|
}
|
|
877
989
|
};
|
|
878
|
-
|
|
990
|
+
const _removeAttribute = function _removeAttribute2(name, element) {
|
|
879
991
|
try {
|
|
880
992
|
arrayPush$3(DOMPurify.removed, {
|
|
881
|
-
attribute:
|
|
882
|
-
from:
|
|
993
|
+
attribute: element.getAttributeNode(name),
|
|
994
|
+
from: element
|
|
883
995
|
});
|
|
884
996
|
} catch (_) {
|
|
885
997
|
arrayPush$3(DOMPurify.removed, {
|
|
886
998
|
attribute: null,
|
|
887
|
-
from:
|
|
999
|
+
from: element
|
|
888
1000
|
});
|
|
889
1001
|
}
|
|
890
|
-
|
|
891
|
-
if (name === "is"
|
|
1002
|
+
element.removeAttribute(name);
|
|
1003
|
+
if (name === "is") {
|
|
892
1004
|
if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
|
|
893
1005
|
try {
|
|
894
|
-
_forceRemove(
|
|
1006
|
+
_forceRemove(element);
|
|
895
1007
|
} catch (_) {
|
|
896
1008
|
}
|
|
897
1009
|
} else {
|
|
898
1010
|
try {
|
|
899
|
-
|
|
1011
|
+
element.setAttribute(name, "");
|
|
900
1012
|
} catch (_) {
|
|
901
1013
|
}
|
|
902
1014
|
}
|
|
903
1015
|
}
|
|
904
1016
|
};
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
1017
|
+
const _initDocument = function _initDocument2(dirty) {
|
|
1018
|
+
let doc = null;
|
|
1019
|
+
let leadingWhitespace = null;
|
|
908
1020
|
if (FORCE_BODY) {
|
|
909
1021
|
dirty = "<remove></remove>" + dirty;
|
|
910
1022
|
} else {
|
|
911
|
-
|
|
1023
|
+
const matches = stringMatch(dirty, /^[\r\n\t ]+/);
|
|
912
1024
|
leadingWhitespace = matches && matches[0];
|
|
913
1025
|
}
|
|
914
|
-
if (PARSER_MEDIA_TYPE === "application/xhtml+xml") {
|
|
1026
|
+
if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) {
|
|
915
1027
|
dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
|
|
916
1028
|
}
|
|
917
|
-
|
|
1029
|
+
const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
|
918
1030
|
if (NAMESPACE === HTML_NAMESPACE) {
|
|
919
1031
|
try {
|
|
920
1032
|
doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
|
|
@@ -924,11 +1036,11 @@ function createDOMPurify() {
|
|
|
924
1036
|
if (!doc || !doc.documentElement) {
|
|
925
1037
|
doc = implementation.createDocument(NAMESPACE, "template", null);
|
|
926
1038
|
try {
|
|
927
|
-
doc.documentElement.innerHTML = IS_EMPTY_INPUT ?
|
|
1039
|
+
doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
|
|
928
1040
|
} catch (_) {
|
|
929
1041
|
}
|
|
930
1042
|
}
|
|
931
|
-
|
|
1043
|
+
const body = doc.body || doc.documentElement;
|
|
932
1044
|
if (dirty && leadingWhitespace) {
|
|
933
1045
|
body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null);
|
|
934
1046
|
}
|
|
@@ -937,66 +1049,68 @@ function createDOMPurify() {
|
|
|
937
1049
|
}
|
|
938
1050
|
return WHOLE_DOCUMENT ? doc.documentElement : body;
|
|
939
1051
|
};
|
|
940
|
-
|
|
1052
|
+
const _createNodeIterator = function _createNodeIterator2(root2) {
|
|
941
1053
|
return createNodeIterator.call(
|
|
942
1054
|
root2.ownerDocument || root2,
|
|
943
1055
|
root2,
|
|
944
1056
|
// eslint-disable-next-line no-bitwise
|
|
945
|
-
NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT,
|
|
946
|
-
null
|
|
947
|
-
false
|
|
1057
|
+
NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION,
|
|
1058
|
+
null
|
|
948
1059
|
);
|
|
949
1060
|
};
|
|
950
|
-
|
|
951
|
-
return
|
|
1061
|
+
const _isClobbered = function _isClobbered2(element) {
|
|
1062
|
+
return element instanceof HTMLFormElement && (typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function");
|
|
952
1063
|
};
|
|
953
|
-
|
|
954
|
-
return
|
|
1064
|
+
const _isNode = function _isNode2(value) {
|
|
1065
|
+
return typeof Node === "function" && value instanceof Node;
|
|
955
1066
|
};
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
return;
|
|
959
|
-
}
|
|
960
|
-
arrayForEach(hooks[entryPoint], function(hook) {
|
|
1067
|
+
function _executeHooks(hooks2, currentNode, data) {
|
|
1068
|
+
arrayForEach(hooks2, (hook) => {
|
|
961
1069
|
hook.call(DOMPurify, currentNode, data, CONFIG);
|
|
962
1070
|
});
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
1071
|
+
}
|
|
1072
|
+
const _sanitizeElements = function _sanitizeElements2(currentNode) {
|
|
1073
|
+
let content = null;
|
|
1074
|
+
_executeHooks(hooks.beforeSanitizeElements, currentNode, null);
|
|
967
1075
|
if (_isClobbered(currentNode)) {
|
|
968
1076
|
_forceRemove(currentNode);
|
|
969
1077
|
return true;
|
|
970
1078
|
}
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
return true;
|
|
974
|
-
}
|
|
975
|
-
var tagName = transformCaseFunc(currentNode.nodeName);
|
|
976
|
-
_executeHook("uponSanitizeElement", currentNode, {
|
|
1079
|
+
const tagName = transformCaseFunc(currentNode.nodeName);
|
|
1080
|
+
_executeHooks(hooks.uponSanitizeElement, currentNode, {
|
|
977
1081
|
tagName,
|
|
978
1082
|
allowedTags: ALLOWED_TAGS
|
|
979
1083
|
});
|
|
980
|
-
if (
|
|
1084
|
+
if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
|
|
1085
|
+
_forceRemove(currentNode);
|
|
1086
|
+
return true;
|
|
1087
|
+
}
|
|
1088
|
+
if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
|
|
981
1089
|
_forceRemove(currentNode);
|
|
982
1090
|
return true;
|
|
983
1091
|
}
|
|
984
|
-
if (
|
|
1092
|
+
if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
|
|
985
1093
|
_forceRemove(currentNode);
|
|
986
1094
|
return true;
|
|
987
1095
|
}
|
|
988
1096
|
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
989
|
-
if (!FORBID_TAGS[tagName] &&
|
|
990
|
-
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName))
|
|
991
|
-
|
|
1097
|
+
if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
|
|
1098
|
+
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
|
|
1099
|
+
return false;
|
|
1100
|
+
}
|
|
1101
|
+
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
|
|
1102
|
+
return false;
|
|
1103
|
+
}
|
|
992
1104
|
}
|
|
993
1105
|
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
|
|
994
|
-
|
|
995
|
-
|
|
1106
|
+
const parentNode = getParentNode(currentNode) || currentNode.parentNode;
|
|
1107
|
+
const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
|
|
996
1108
|
if (childNodes && parentNode) {
|
|
997
|
-
|
|
998
|
-
for (
|
|
999
|
-
|
|
1109
|
+
const childCount = childNodes.length;
|
|
1110
|
+
for (let i = childCount - 1; i >= 0; --i) {
|
|
1111
|
+
const childClone = cloneNode(childNodes[i], true);
|
|
1112
|
+
childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
|
|
1113
|
+
parentNode.insertBefore(childClone, getNextSibling(currentNode));
|
|
1000
1114
|
}
|
|
1001
1115
|
}
|
|
1002
1116
|
}
|
|
@@ -1007,34 +1121,37 @@ function createDOMPurify() {
|
|
|
1007
1121
|
_forceRemove(currentNode);
|
|
1008
1122
|
return true;
|
|
1009
1123
|
}
|
|
1010
|
-
if ((tagName === "noscript" || tagName === "noembed") && regExpTest(/<\/no(script|embed)/i, currentNode.innerHTML)) {
|
|
1124
|
+
if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
|
|
1011
1125
|
_forceRemove(currentNode);
|
|
1012
1126
|
return true;
|
|
1013
1127
|
}
|
|
1014
|
-
if (SAFE_FOR_TEMPLATES && currentNode.nodeType ===
|
|
1128
|
+
if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
|
|
1015
1129
|
content = currentNode.textContent;
|
|
1016
|
-
|
|
1017
|
-
|
|
1130
|
+
arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
|
|
1131
|
+
content = stringReplace(content, expr, " ");
|
|
1132
|
+
});
|
|
1018
1133
|
if (currentNode.textContent !== content) {
|
|
1019
|
-
arrayPush$3(DOMPurify.removed, {
|
|
1134
|
+
arrayPush$3(DOMPurify.removed, {
|
|
1135
|
+
element: currentNode.cloneNode()
|
|
1136
|
+
});
|
|
1020
1137
|
currentNode.textContent = content;
|
|
1021
1138
|
}
|
|
1022
1139
|
}
|
|
1023
|
-
|
|
1140
|
+
_executeHooks(hooks.afterSanitizeElements, currentNode, null);
|
|
1024
1141
|
return false;
|
|
1025
1142
|
};
|
|
1026
|
-
|
|
1143
|
+
const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
|
|
1027
1144
|
if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) {
|
|
1028
1145
|
return false;
|
|
1029
1146
|
}
|
|
1030
|
-
if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(
|
|
1031
|
-
else if (ALLOW_ARIA_ATTR && regExpTest(
|
|
1147
|
+
if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName)) ;
|
|
1148
|
+
else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR2, lcName)) ;
|
|
1032
1149
|
else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
|
|
1033
1150
|
if (
|
|
1034
1151
|
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
1035
1152
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
1036
1153
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
1037
|
-
|
|
1154
|
+
_isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
1038
1155
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
1039
1156
|
lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))
|
|
1040
1157
|
) ;
|
|
@@ -1042,46 +1159,56 @@ function createDOMPurify() {
|
|
|
1042
1159
|
return false;
|
|
1043
1160
|
}
|
|
1044
1161
|
} else if (URI_SAFE_ATTRIBUTES[lcName]) ;
|
|
1045
|
-
else if (regExpTest(IS_ALLOWED_URI
|
|
1162
|
+
else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE2, ""))) ;
|
|
1046
1163
|
else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) ;
|
|
1047
|
-
else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(
|
|
1048
|
-
else if (
|
|
1049
|
-
else {
|
|
1164
|
+
else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA2, stringReplace(value, ATTR_WHITESPACE2, ""))) ;
|
|
1165
|
+
else if (value) {
|
|
1050
1166
|
return false;
|
|
1051
|
-
}
|
|
1167
|
+
} else ;
|
|
1052
1168
|
return true;
|
|
1053
1169
|
};
|
|
1054
|
-
|
|
1055
|
-
return tagName
|
|
1170
|
+
const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
|
|
1171
|
+
return tagName !== "annotation-xml" && stringMatch(tagName, CUSTOM_ELEMENT2);
|
|
1056
1172
|
};
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
var attributes = currentNode.attributes;
|
|
1064
|
-
if (!attributes) {
|
|
1173
|
+
const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
|
|
1174
|
+
_executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
|
|
1175
|
+
const {
|
|
1176
|
+
attributes
|
|
1177
|
+
} = currentNode;
|
|
1178
|
+
if (!attributes || _isClobbered(currentNode)) {
|
|
1065
1179
|
return;
|
|
1066
1180
|
}
|
|
1067
|
-
|
|
1181
|
+
const hookEvent = {
|
|
1068
1182
|
attrName: "",
|
|
1069
1183
|
attrValue: "",
|
|
1070
1184
|
keepAttr: true,
|
|
1071
|
-
allowedAttributes: ALLOWED_ATTR
|
|
1185
|
+
allowedAttributes: ALLOWED_ATTR,
|
|
1186
|
+
forceKeepAttr: void 0
|
|
1072
1187
|
};
|
|
1073
|
-
l = attributes.length;
|
|
1188
|
+
let l = attributes.length;
|
|
1074
1189
|
while (l--) {
|
|
1075
|
-
attr = attributes[l];
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1190
|
+
const attr = attributes[l];
|
|
1191
|
+
const {
|
|
1192
|
+
name,
|
|
1193
|
+
namespaceURI,
|
|
1194
|
+
value: attrValue
|
|
1195
|
+
} = attr;
|
|
1196
|
+
const lcName = transformCaseFunc(name);
|
|
1197
|
+
let value = name === "value" ? attrValue : stringTrim(attrValue);
|
|
1079
1198
|
hookEvent.attrName = lcName;
|
|
1080
1199
|
hookEvent.attrValue = value;
|
|
1081
1200
|
hookEvent.keepAttr = true;
|
|
1082
1201
|
hookEvent.forceKeepAttr = void 0;
|
|
1083
|
-
|
|
1202
|
+
_executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
|
|
1084
1203
|
value = hookEvent.attrValue;
|
|
1204
|
+
if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name")) {
|
|
1205
|
+
_removeAttribute(name, currentNode);
|
|
1206
|
+
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
|
1207
|
+
}
|
|
1208
|
+
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
|
|
1209
|
+
_removeAttribute(name, currentNode);
|
|
1210
|
+
continue;
|
|
1211
|
+
}
|
|
1085
1212
|
if (hookEvent.forceKeepAttr) {
|
|
1086
1213
|
continue;
|
|
1087
1214
|
}
|
|
@@ -1089,75 +1216,85 @@ function createDOMPurify() {
|
|
|
1089
1216
|
if (!hookEvent.keepAttr) {
|
|
1090
1217
|
continue;
|
|
1091
1218
|
}
|
|
1092
|
-
if (regExpTest(/\/>/i, value)) {
|
|
1219
|
+
if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
|
|
1093
1220
|
_removeAttribute(name, currentNode);
|
|
1094
1221
|
continue;
|
|
1095
1222
|
}
|
|
1096
1223
|
if (SAFE_FOR_TEMPLATES) {
|
|
1097
|
-
|
|
1098
|
-
|
|
1224
|
+
arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
|
|
1225
|
+
value = stringReplace(value, expr, " ");
|
|
1226
|
+
});
|
|
1099
1227
|
}
|
|
1100
|
-
|
|
1228
|
+
const lcTag = transformCaseFunc(currentNode.nodeName);
|
|
1101
1229
|
if (!_isValidAttribute(lcTag, lcName, value)) {
|
|
1102
1230
|
continue;
|
|
1103
1231
|
}
|
|
1232
|
+
if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") {
|
|
1233
|
+
if (namespaceURI) ;
|
|
1234
|
+
else {
|
|
1235
|
+
switch (trustedTypes.getAttributeType(lcTag, lcName)) {
|
|
1236
|
+
case "TrustedHTML": {
|
|
1237
|
+
value = trustedTypesPolicy.createHTML(value);
|
|
1238
|
+
break;
|
|
1239
|
+
}
|
|
1240
|
+
case "TrustedScriptURL": {
|
|
1241
|
+
value = trustedTypesPolicy.createScriptURL(value);
|
|
1242
|
+
break;
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1104
1247
|
try {
|
|
1105
1248
|
if (namespaceURI) {
|
|
1106
1249
|
currentNode.setAttributeNS(namespaceURI, name, value);
|
|
1107
1250
|
} else {
|
|
1108
1251
|
currentNode.setAttribute(name, value);
|
|
1109
1252
|
}
|
|
1110
|
-
|
|
1253
|
+
if (_isClobbered(currentNode)) {
|
|
1254
|
+
_forceRemove(currentNode);
|
|
1255
|
+
} else {
|
|
1256
|
+
arrayPop(DOMPurify.removed);
|
|
1257
|
+
}
|
|
1111
1258
|
} catch (_) {
|
|
1112
1259
|
}
|
|
1113
1260
|
}
|
|
1114
|
-
|
|
1261
|
+
_executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
|
|
1115
1262
|
};
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1263
|
+
const _sanitizeShadowDOM = function _sanitizeShadowDOM2(fragment) {
|
|
1264
|
+
let shadowNode = null;
|
|
1265
|
+
const shadowIterator = _createNodeIterator(fragment);
|
|
1266
|
+
_executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
|
|
1120
1267
|
while (shadowNode = shadowIterator.nextNode()) {
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
}
|
|
1268
|
+
_executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
|
|
1269
|
+
_sanitizeElements(shadowNode);
|
|
1270
|
+
_sanitizeAttributes(shadowNode);
|
|
1125
1271
|
if (shadowNode.content instanceof DocumentFragment) {
|
|
1126
1272
|
_sanitizeShadowDOM2(shadowNode.content);
|
|
1127
1273
|
}
|
|
1128
|
-
_sanitizeAttributes(shadowNode);
|
|
1129
1274
|
}
|
|
1130
|
-
|
|
1275
|
+
_executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
|
|
1131
1276
|
};
|
|
1132
|
-
DOMPurify.sanitize = function(dirty
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1277
|
+
DOMPurify.sanitize = function(dirty) {
|
|
1278
|
+
let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1279
|
+
let body = null;
|
|
1280
|
+
let importedNode = null;
|
|
1281
|
+
let currentNode = null;
|
|
1282
|
+
let returnNode = null;
|
|
1138
1283
|
IS_EMPTY_INPUT = !dirty;
|
|
1139
1284
|
if (IS_EMPTY_INPUT) {
|
|
1140
1285
|
dirty = "<!-->";
|
|
1141
1286
|
}
|
|
1142
1287
|
if (typeof dirty !== "string" && !_isNode(dirty)) {
|
|
1143
|
-
if (typeof dirty.toString
|
|
1144
|
-
throw typeErrorCreate("toString is not a function");
|
|
1145
|
-
} else {
|
|
1288
|
+
if (typeof dirty.toString === "function") {
|
|
1146
1289
|
dirty = dirty.toString();
|
|
1147
1290
|
if (typeof dirty !== "string") {
|
|
1148
1291
|
throw typeErrorCreate("dirty is not a string, aborting");
|
|
1149
1292
|
}
|
|
1293
|
+
} else {
|
|
1294
|
+
throw typeErrorCreate("toString is not a function");
|
|
1150
1295
|
}
|
|
1151
1296
|
}
|
|
1152
1297
|
if (!DOMPurify.isSupported) {
|
|
1153
|
-
if (_typeof$2(window2.toStaticHTML) === "object" || typeof window2.toStaticHTML === "function") {
|
|
1154
|
-
if (typeof dirty === "string") {
|
|
1155
|
-
return window2.toStaticHTML(dirty);
|
|
1156
|
-
}
|
|
1157
|
-
if (_isNode(dirty)) {
|
|
1158
|
-
return window2.toStaticHTML(dirty.outerHTML);
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
1298
|
return dirty;
|
|
1162
1299
|
}
|
|
1163
1300
|
if (!SET_CONFIG) {
|
|
@@ -1169,7 +1306,7 @@ function createDOMPurify() {
|
|
|
1169
1306
|
}
|
|
1170
1307
|
if (IN_PLACE) {
|
|
1171
1308
|
if (dirty.nodeName) {
|
|
1172
|
-
|
|
1309
|
+
const tagName = transformCaseFunc(dirty.nodeName);
|
|
1173
1310
|
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
1174
1311
|
throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
|
|
1175
1312
|
}
|
|
@@ -1177,7 +1314,7 @@ function createDOMPurify() {
|
|
|
1177
1314
|
} else if (dirty instanceof Node) {
|
|
1178
1315
|
body = _initDocument("<!---->");
|
|
1179
1316
|
importedNode = body.ownerDocument.importNode(dirty, true);
|
|
1180
|
-
if (importedNode.nodeType ===
|
|
1317
|
+
if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") {
|
|
1181
1318
|
body = importedNode;
|
|
1182
1319
|
} else if (importedNode.nodeName === "HTML") {
|
|
1183
1320
|
body = importedNode;
|
|
@@ -1197,21 +1334,14 @@ function createDOMPurify() {
|
|
|
1197
1334
|
if (body && FORCE_BODY) {
|
|
1198
1335
|
_forceRemove(body.firstChild);
|
|
1199
1336
|
}
|
|
1200
|
-
|
|
1337
|
+
const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
|
|
1201
1338
|
while (currentNode = nodeIterator.nextNode()) {
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
}
|
|
1205
|
-
if (_sanitizeElements(currentNode)) {
|
|
1206
|
-
continue;
|
|
1207
|
-
}
|
|
1339
|
+
_sanitizeElements(currentNode);
|
|
1340
|
+
_sanitizeAttributes(currentNode);
|
|
1208
1341
|
if (currentNode.content instanceof DocumentFragment) {
|
|
1209
1342
|
_sanitizeShadowDOM(currentNode.content);
|
|
1210
1343
|
}
|
|
1211
|
-
_sanitizeAttributes(currentNode);
|
|
1212
|
-
oldNode = currentNode;
|
|
1213
1344
|
}
|
|
1214
|
-
oldNode = null;
|
|
1215
1345
|
if (IN_PLACE) {
|
|
1216
1346
|
return dirty;
|
|
1217
1347
|
}
|
|
@@ -1224,22 +1354,24 @@ function createDOMPurify() {
|
|
|
1224
1354
|
} else {
|
|
1225
1355
|
returnNode = body;
|
|
1226
1356
|
}
|
|
1227
|
-
if (ALLOWED_ATTR.shadowroot) {
|
|
1357
|
+
if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
|
|
1228
1358
|
returnNode = importNode.call(originalDocument, returnNode, true);
|
|
1229
1359
|
}
|
|
1230
1360
|
return returnNode;
|
|
1231
1361
|
}
|
|
1232
|
-
|
|
1362
|
+
let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
|
|
1233
1363
|
if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
|
|
1234
1364
|
serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
|
|
1235
1365
|
}
|
|
1236
1366
|
if (SAFE_FOR_TEMPLATES) {
|
|
1237
|
-
|
|
1238
|
-
|
|
1367
|
+
arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
|
|
1368
|
+
serializedHTML = stringReplace(serializedHTML, expr, " ");
|
|
1369
|
+
});
|
|
1239
1370
|
}
|
|
1240
1371
|
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
|
|
1241
1372
|
};
|
|
1242
|
-
DOMPurify.setConfig = function(
|
|
1373
|
+
DOMPurify.setConfig = function() {
|
|
1374
|
+
let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1243
1375
|
_parseConfig(cfg);
|
|
1244
1376
|
SET_CONFIG = true;
|
|
1245
1377
|
};
|
|
@@ -1251,29 +1383,28 @@ function createDOMPurify() {
|
|
|
1251
1383
|
if (!CONFIG) {
|
|
1252
1384
|
_parseConfig({});
|
|
1253
1385
|
}
|
|
1254
|
-
|
|
1255
|
-
|
|
1386
|
+
const lcTag = transformCaseFunc(tag);
|
|
1387
|
+
const lcName = transformCaseFunc(attr);
|
|
1256
1388
|
return _isValidAttribute(lcTag, lcName, value);
|
|
1257
1389
|
};
|
|
1258
1390
|
DOMPurify.addHook = function(entryPoint, hookFunction) {
|
|
1259
1391
|
if (typeof hookFunction !== "function") {
|
|
1260
1392
|
return;
|
|
1261
1393
|
}
|
|
1262
|
-
hooks[entryPoint] = hooks[entryPoint] || [];
|
|
1263
1394
|
arrayPush$3(hooks[entryPoint], hookFunction);
|
|
1264
1395
|
};
|
|
1265
|
-
DOMPurify.removeHook = function(entryPoint) {
|
|
1266
|
-
if (
|
|
1267
|
-
|
|
1396
|
+
DOMPurify.removeHook = function(entryPoint, hookFunction) {
|
|
1397
|
+
if (hookFunction !== void 0) {
|
|
1398
|
+
const index2 = arrayLastIndexOf(hooks[entryPoint], hookFunction);
|
|
1399
|
+
return index2 === -1 ? void 0 : arraySplice(hooks[entryPoint], index2, 1)[0];
|
|
1268
1400
|
}
|
|
1401
|
+
return arrayPop(hooks[entryPoint]);
|
|
1269
1402
|
};
|
|
1270
1403
|
DOMPurify.removeHooks = function(entryPoint) {
|
|
1271
|
-
|
|
1272
|
-
hooks[entryPoint] = [];
|
|
1273
|
-
}
|
|
1404
|
+
hooks[entryPoint] = [];
|
|
1274
1405
|
};
|
|
1275
1406
|
DOMPurify.removeAllHooks = function() {
|
|
1276
|
-
hooks =
|
|
1407
|
+
hooks = _createHooksMap();
|
|
1277
1408
|
};
|
|
1278
1409
|
return DOMPurify;
|
|
1279
1410
|
}
|
|
@@ -5260,7 +5391,7 @@ function createComposer(options = {}, VueI18nLegacy) {
|
|
|
5260
5391
|
const { __root, __injectWithOption } = options;
|
|
5261
5392
|
const _isGlobal = __root === void 0;
|
|
5262
5393
|
const flatJson = options.flatJson;
|
|
5263
|
-
const
|
|
5394
|
+
const _ref = inBrowser ? ref : shallowRef;
|
|
5264
5395
|
const translateExistCompatible = !!options.translateExistCompatible;
|
|
5265
5396
|
if (process.env.NODE_ENV !== "production") {
|
|
5266
5397
|
if (translateExistCompatible && true) {
|
|
@@ -5268,17 +5399,17 @@ function createComposer(options = {}, VueI18nLegacy) {
|
|
|
5268
5399
|
}
|
|
5269
5400
|
}
|
|
5270
5401
|
let _inheritLocale = isBoolean$1(options.inheritLocale) ? options.inheritLocale : true;
|
|
5271
|
-
const _locale =
|
|
5402
|
+
const _locale = _ref(
|
|
5272
5403
|
// prettier-ignore
|
|
5273
5404
|
__root && _inheritLocale ? __root.locale.value : isString$2(options.locale) ? options.locale : DEFAULT_LOCALE
|
|
5274
5405
|
);
|
|
5275
|
-
const _fallbackLocale =
|
|
5406
|
+
const _fallbackLocale = _ref(
|
|
5276
5407
|
// prettier-ignore
|
|
5277
5408
|
__root && _inheritLocale ? __root.fallbackLocale.value : isString$2(options.fallbackLocale) || isArray$5(options.fallbackLocale) || isPlainObject$1(options.fallbackLocale) || options.fallbackLocale === false ? options.fallbackLocale : _locale.value
|
|
5278
5409
|
);
|
|
5279
|
-
const _messages =
|
|
5280
|
-
const _datetimeFormats =
|
|
5281
|
-
const _numberFormats =
|
|
5410
|
+
const _messages = _ref(getLocaleMessages(_locale.value, options));
|
|
5411
|
+
const _datetimeFormats = _ref(isPlainObject$1(options.datetimeFormats) ? options.datetimeFormats : { [_locale.value]: {} });
|
|
5412
|
+
const _numberFormats = _ref(isPlainObject$1(options.numberFormats) ? options.numberFormats : { [_locale.value]: {} });
|
|
5282
5413
|
let _missingWarn = __root ? __root.missingWarn : isBoolean$1(options.missingWarn) || isRegExp$1(options.missingWarn) ? options.missingWarn : true;
|
|
5283
5414
|
let _fallbackWarn = __root ? __root.fallbackWarn : isBoolean$1(options.fallbackWarn) || isRegExp$1(options.fallbackWarn) ? options.fallbackWarn : true;
|
|
5284
5415
|
let _fallbackRoot = __root ? __root.fallbackRoot : isBoolean$1(options.fallbackRoot) ? options.fallbackRoot : true;
|
|
@@ -7503,7 +7634,8 @@ const gitCodeLayout$1 = {
|
|
|
7503
7634
|
readPrivacyPolicy: "请阅读并同意用户协议以及其隐私政策",
|
|
7504
7635
|
welcome: "欢迎来到Gitcode"
|
|
7505
7636
|
},
|
|
7506
|
-
foldup: "收起"
|
|
7637
|
+
foldup: "收起",
|
|
7638
|
+
iCreated: "我创建的"
|
|
7507
7639
|
},
|
|
7508
7640
|
org: {
|
|
7509
7641
|
project: "项目",
|
|
@@ -7778,7 +7910,8 @@ const gitCodeLayout = {
|
|
|
7778
7910
|
readPrivacyPolicy: "Please Read and Agree to the User Agreement and Privacy Policy",
|
|
7779
7911
|
welcome: "Welcome to GitCode"
|
|
7780
7912
|
},
|
|
7781
|
-
foldup: "Collapse"
|
|
7913
|
+
foldup: "Collapse",
|
|
7914
|
+
iCreated: "Yours"
|
|
7782
7915
|
},
|
|
7783
7916
|
org: {
|
|
7784
7917
|
project: "Repositories",
|
|
@@ -10736,7 +10869,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
10736
10869
|
const emits = __emit;
|
|
10737
10870
|
const toggleGrowthCenter = () => {
|
|
10738
10871
|
if (!props.isLogin) {
|
|
10739
|
-
emitEvent("login", {});
|
|
10872
|
+
emitEvent("login", { loginTriggerSource: "toolsFloat_growthCenter" });
|
|
10740
10873
|
return;
|
|
10741
10874
|
}
|
|
10742
10875
|
emits("toggle-growth-center");
|
|
@@ -10814,7 +10947,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
10814
10947
|
};
|
|
10815
10948
|
fetchAdList();
|
|
10816
10949
|
const handleLogin = (type) => {
|
|
10817
|
-
emitEvent("login", { type, triggerType: activeAdItem.value.title });
|
|
10950
|
+
emitEvent("login", { type, triggerType: activeAdItem.value.title, loginTriggerSource: "toolsFloat_ads" });
|
|
10818
10951
|
(window == null ? void 0 : window.location.href) && localStorage$2.setItem("sign_path", window == null ? void 0 : window.location.href);
|
|
10819
10952
|
};
|
|
10820
10953
|
const handleActive = () => {
|
|
@@ -14418,11 +14551,11 @@ function listCacheSet$1(key, value) {
|
|
|
14418
14551
|
}
|
|
14419
14552
|
var _listCacheSet = listCacheSet$1;
|
|
14420
14553
|
var listCacheClear = _listCacheClear, listCacheDelete = _listCacheDelete, listCacheGet = _listCacheGet, listCacheHas = _listCacheHas, listCacheSet = _listCacheSet;
|
|
14421
|
-
function ListCache$4(
|
|
14422
|
-
var index2 = -1, length =
|
|
14554
|
+
function ListCache$4(entries2) {
|
|
14555
|
+
var index2 = -1, length = entries2 == null ? 0 : entries2.length;
|
|
14423
14556
|
this.clear();
|
|
14424
14557
|
while (++index2 < length) {
|
|
14425
|
-
var entry =
|
|
14558
|
+
var entry = entries2[index2];
|
|
14426
14559
|
this.set(entry[0], entry[1]);
|
|
14427
14560
|
}
|
|
14428
14561
|
}
|
|
@@ -14619,11 +14752,11 @@ function hashSet$1(key, value) {
|
|
|
14619
14752
|
}
|
|
14620
14753
|
var _hashSet = hashSet$1;
|
|
14621
14754
|
var hashClear = _hashClear, hashDelete = _hashDelete, hashGet = _hashGet, hashHas = _hashHas, hashSet = _hashSet;
|
|
14622
|
-
function Hash$1(
|
|
14623
|
-
var index2 = -1, length =
|
|
14755
|
+
function Hash$1(entries2) {
|
|
14756
|
+
var index2 = -1, length = entries2 == null ? 0 : entries2.length;
|
|
14624
14757
|
this.clear();
|
|
14625
14758
|
while (++index2 < length) {
|
|
14626
|
-
var entry =
|
|
14759
|
+
var entry = entries2[index2];
|
|
14627
14760
|
this.set(entry[0], entry[1]);
|
|
14628
14761
|
}
|
|
14629
14762
|
}
|
|
@@ -14680,11 +14813,11 @@ function mapCacheSet$1(key, value) {
|
|
|
14680
14813
|
}
|
|
14681
14814
|
var _mapCacheSet = mapCacheSet$1;
|
|
14682
14815
|
var mapCacheClear = _mapCacheClear, mapCacheDelete = _mapCacheDelete, mapCacheGet = _mapCacheGet, mapCacheHas = _mapCacheHas, mapCacheSet = _mapCacheSet;
|
|
14683
|
-
function MapCache$1(
|
|
14684
|
-
var index2 = -1, length =
|
|
14816
|
+
function MapCache$1(entries2) {
|
|
14817
|
+
var index2 = -1, length = entries2 == null ? 0 : entries2.length;
|
|
14685
14818
|
this.clear();
|
|
14686
14819
|
while (++index2 < length) {
|
|
14687
|
-
var entry =
|
|
14820
|
+
var entry = entries2[index2];
|
|
14688
14821
|
this.set(entry[0], entry[1]);
|
|
14689
14822
|
}
|
|
14690
14823
|
}
|
|
@@ -14713,8 +14846,8 @@ function stackSet$1(key, value) {
|
|
|
14713
14846
|
}
|
|
14714
14847
|
var _stackSet = stackSet$1;
|
|
14715
14848
|
var ListCache = _ListCache, stackClear = _stackClear, stackDelete = _stackDelete, stackGet = _stackGet, stackHas = _stackHas, stackSet = _stackSet;
|
|
14716
|
-
function Stack$1(
|
|
14717
|
-
var data = this.__data__ = new ListCache(
|
|
14849
|
+
function Stack$1(entries2) {
|
|
14850
|
+
var data = this.__data__ = new ListCache(entries2);
|
|
14718
14851
|
this.size = data.size;
|
|
14719
14852
|
}
|
|
14720
14853
|
Stack$1.prototype.clear = stackClear;
|
|
@@ -16209,7 +16342,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
|
|
|
16209
16342
|
const handleOrgFollow = (val) => {
|
|
16210
16343
|
if (props.scene !== SceneValue.org) return;
|
|
16211
16344
|
if (!props.isLogin) {
|
|
16212
|
-
emitEvent("login", { triggerType: "关注组织" });
|
|
16345
|
+
emitEvent("login", { triggerType: "关注组织", loginTriggerSource: "toolbar_org_follow" });
|
|
16213
16346
|
return;
|
|
16214
16347
|
}
|
|
16215
16348
|
emits("followDevCommunity", !val);
|
|
@@ -17445,13 +17578,13 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
17445
17578
|
setup(__props) {
|
|
17446
17579
|
var _a;
|
|
17447
17580
|
const { t: $t } = i18n.global;
|
|
17448
|
-
const ProjectSearch = defineAsyncComponent(() => import("./ProjectSearch-
|
|
17449
|
-
const UserSearch = defineAsyncComponent(() => import("./UserSearch-
|
|
17450
|
-
const GloabarSearch = defineAsyncComponent(() => import("./GloabarSearch-
|
|
17451
|
-
const SearchHistoryList = defineAsyncComponent(() => import("./SearchHistoryList-
|
|
17452
|
-
const SearchScopeList = defineAsyncComponent(() => import("./SearchScopeList-
|
|
17453
|
-
const SearchPrefixTag = defineAsyncComponent(() => import("./SearchPrefixTag-
|
|
17454
|
-
const SearchRecommed = defineAsyncComponent(() => import("./SearchRecommed-
|
|
17581
|
+
const ProjectSearch = defineAsyncComponent(() => import("./ProjectSearch-BUP8uaCj.js"));
|
|
17582
|
+
const UserSearch = defineAsyncComponent(() => import("./UserSearch-JAMg7W9B.js"));
|
|
17583
|
+
const GloabarSearch = defineAsyncComponent(() => import("./GloabarSearch-DlBp6deP.js"));
|
|
17584
|
+
const SearchHistoryList = defineAsyncComponent(() => import("./SearchHistoryList-C2uR-dRD.js"));
|
|
17585
|
+
const SearchScopeList = defineAsyncComponent(() => import("./SearchScopeList-tBGWHbat.js"));
|
|
17586
|
+
const SearchPrefixTag = defineAsyncComponent(() => import("./SearchPrefixTag-DGk5Ak40.js"));
|
|
17587
|
+
const SearchRecommed = defineAsyncComponent(() => import("./SearchRecommed-CNJb8ccy.js"));
|
|
17455
17588
|
const props = __props;
|
|
17456
17589
|
const repoInfo = inject("repoInfo");
|
|
17457
17590
|
const orgInfo = inject("orgInfo");
|
|
@@ -17971,7 +18104,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
17971
18104
|
}
|
|
17972
18105
|
});
|
|
17973
18106
|
const Search = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-gitcode-layout-lib"]]);
|
|
17974
|
-
const NoticeModal = defineAsyncComponent(() => import("./notice-
|
|
18107
|
+
const NoticeModal = defineAsyncComponent(() => import("./notice-Ikg9Y_ia.js"));
|
|
17975
18108
|
function clearNotice() {
|
|
17976
18109
|
if (localStorage$2.getItem("validator_email")) {
|
|
17977
18110
|
localStorage$2.removeItem("validator_email");
|
|
@@ -18118,12 +18251,12 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
18118
18251
|
return false;
|
|
18119
18252
|
});
|
|
18120
18253
|
const handleLogin = (type) => {
|
|
18121
|
-
emitEvent("login", { type, triggerType: "主动注册" });
|
|
18254
|
+
emitEvent("login", { type, triggerType: "主动注册", loginTriggerSource: type === "login" ? "toolbar_login" : "" });
|
|
18122
18255
|
localStorage$2.setItem("sign_path", (window == null ? void 0 : window.location.href) || "");
|
|
18123
18256
|
};
|
|
18124
18257
|
const { notice } = useNotification();
|
|
18125
18258
|
const status = ref(false);
|
|
18126
|
-
const { login, isMounted } = useLogin(props.request);
|
|
18259
|
+
const { login, isMounted } = useLogin(props.request, props.globalStore);
|
|
18127
18260
|
const { t: t2 } = i18n.global;
|
|
18128
18261
|
const toNotice = () => {
|
|
18129
18262
|
if (localStorage$2.getItem("validator_email") === "invalid") {
|
|
@@ -18538,20 +18671,21 @@ const _hoisted_9$3 = {
|
|
|
18538
18671
|
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
18539
18672
|
__name: "ProjectMenuList",
|
|
18540
18673
|
props: {
|
|
18541
|
-
type: {},
|
|
18542
|
-
|
|
18543
|
-
|
|
18544
|
-
|
|
18545
|
-
|
|
18546
|
-
|
|
18547
|
-
|
|
18548
|
-
defaultOrg: { default: () => ({}) },
|
|
18549
|
-
color: {},
|
|
18674
|
+
type: { default: "project" },
|
|
18675
|
+
buttonText: { default: "" },
|
|
18676
|
+
subShow: { type: Boolean, default: false },
|
|
18677
|
+
query: { default: {} },
|
|
18678
|
+
defaultData: { default: {} },
|
|
18679
|
+
isLogin: { type: Boolean, default: false },
|
|
18680
|
+
defaultOrg: { default: {} },
|
|
18550
18681
|
username: { default: "" }
|
|
18551
18682
|
},
|
|
18552
18683
|
setup(__props) {
|
|
18553
18684
|
const { t: t2 } = i18n.global;
|
|
18554
|
-
const
|
|
18685
|
+
const request = inject("request");
|
|
18686
|
+
const API = asideRequest(request);
|
|
18687
|
+
const globalStore = inject("globalStore");
|
|
18688
|
+
const { useReport: useReport2 } = useRequestReport(request, globalStore);
|
|
18555
18689
|
const props = __props;
|
|
18556
18690
|
const projectList = ref([]);
|
|
18557
18691
|
const loading = ref(false);
|
|
@@ -18580,7 +18714,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
18580
18714
|
watch(
|
|
18581
18715
|
() => props.defaultData,
|
|
18582
18716
|
() => {
|
|
18583
|
-
firstLoading.value = props.defaultData.loading;
|
|
18717
|
+
firstLoading.value = !!props.defaultData.loading;
|
|
18584
18718
|
if (props.defaultData && props.defaultData.list) {
|
|
18585
18719
|
projectList.value = [...props.defaultData.list];
|
|
18586
18720
|
if (props.defaultData.storeData) {
|
|
@@ -18591,6 +18725,24 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
18591
18725
|
},
|
|
18592
18726
|
{ immediate: true, deep: true }
|
|
18593
18727
|
);
|
|
18728
|
+
const customRequest = (params, type) => {
|
|
18729
|
+
if (type === "project" && params.namespace_id === "my-repo") {
|
|
18730
|
+
const temp = { ...params };
|
|
18731
|
+
delete temp.namespace_id;
|
|
18732
|
+
return {
|
|
18733
|
+
params: {
|
|
18734
|
+
...temp,
|
|
18735
|
+
repo_query_type: "created",
|
|
18736
|
+
repo_type: "0,1,2"
|
|
18737
|
+
},
|
|
18738
|
+
requestFn: (params2) => API.getMyCreatedProjects(params2)
|
|
18739
|
+
};
|
|
18740
|
+
}
|
|
18741
|
+
return {
|
|
18742
|
+
params,
|
|
18743
|
+
requestFn: type === "project" ? (params2) => API.getMyProjects(params2) : (params2) => API.getMyGroups(params2)
|
|
18744
|
+
};
|
|
18745
|
+
};
|
|
18594
18746
|
const loadMoreData = (loadType) => {
|
|
18595
18747
|
const data = [...storeData];
|
|
18596
18748
|
if (totalNum.value > pageQuery.size * pageQuery.page || loadType === "search") {
|
|
@@ -18602,7 +18754,8 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
18602
18754
|
...props.query,
|
|
18603
18755
|
...extendQuery
|
|
18604
18756
|
};
|
|
18605
|
-
|
|
18757
|
+
const { params: newParams, requestFn } = customRequest(params, props.type);
|
|
18758
|
+
loadAsideData(requestFn, newParams, props.type).then(
|
|
18606
18759
|
(res) => {
|
|
18607
18760
|
if (params.search !== searchKey.value && loadType === "search") {
|
|
18608
18761
|
return;
|
|
@@ -18628,14 +18781,15 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
18628
18781
|
size: 10
|
|
18629
18782
|
};
|
|
18630
18783
|
const moreOrgData = ref([]);
|
|
18784
|
+
const DEFAULT_ORG_FILTER_OPTIONS = [{ id: 0, label: t2("gitCodeLayout.common.all") }, { id: "my-repo", label: props.username || t2("gitCodeLayout.common.iCreated") }];
|
|
18631
18785
|
const teamList = computed(() => {
|
|
18632
18786
|
var _a;
|
|
18633
18787
|
if (props.defaultOrg.list) {
|
|
18634
18788
|
loadMoreTotal = props.defaultOrg.totalNum;
|
|
18635
18789
|
const propStoreData = ((_a = props.defaultOrg) == null ? void 0 : _a.storeData) || [];
|
|
18636
|
-
return [
|
|
18790
|
+
return [...DEFAULT_ORG_FILTER_OPTIONS, ...props.defaultOrg.list, ...propStoreData, ...moreOrgData.value];
|
|
18637
18791
|
}
|
|
18638
|
-
return [
|
|
18792
|
+
return [...DEFAULT_ORG_FILTER_OPTIONS, ...moreOrgData.value];
|
|
18639
18793
|
});
|
|
18640
18794
|
const fastToLink = (type) => {
|
|
18641
18795
|
if (type === "project") {
|
|
@@ -18644,9 +18798,9 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
18644
18798
|
router2.push({ name: "settingOrganization" });
|
|
18645
18799
|
}
|
|
18646
18800
|
};
|
|
18647
|
-
const
|
|
18801
|
+
const loadMoreTeams = () => {
|
|
18648
18802
|
loadAsideData(
|
|
18649
|
-
|
|
18803
|
+
(params) => API.getMyProjects(params),
|
|
18650
18804
|
{
|
|
18651
18805
|
page: selectQuery.page,
|
|
18652
18806
|
per_page: selectQuery.size
|
|
@@ -18662,7 +18816,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
18662
18816
|
const loadTeam = () => {
|
|
18663
18817
|
if (loadMoreTotal > selectQuery.size * selectQuery.page) {
|
|
18664
18818
|
selectQuery.page++;
|
|
18665
|
-
|
|
18819
|
+
loadMoreTeams();
|
|
18666
18820
|
}
|
|
18667
18821
|
};
|
|
18668
18822
|
const searchProject = () => {
|
|
@@ -18693,11 +18847,17 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
18693
18847
|
}
|
|
18694
18848
|
}, 200);
|
|
18695
18849
|
};
|
|
18850
|
+
const createRepoOrOrg = () => {
|
|
18851
|
+
if (!props.isLogin) {
|
|
18852
|
+
useReport2("login_exposure", { source: props.type === "project" ? "aside_createRepo" : "aside_createOrg" });
|
|
18853
|
+
}
|
|
18854
|
+
router2.push(props.type === "project" ? projectRoute : teamRoute);
|
|
18855
|
+
};
|
|
18696
18856
|
return (_ctx, _cache) => {
|
|
18697
18857
|
return openBlock(), createElementBlock("ul", _hoisted_1$f, [
|
|
18698
18858
|
_ctx.type === "project" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
18699
18859
|
createElementVNode("div", _hoisted_2$9, [
|
|
18700
|
-
_cache[
|
|
18860
|
+
_cache[13] || (_cache[13] = createElementVNode("span", { class: "devui-menu-icon" }, null, -1)),
|
|
18701
18861
|
createElementVNode("span", _hoisted_3$6, [
|
|
18702
18862
|
createElementVNode("div", {
|
|
18703
18863
|
class: "fast-click-button",
|
|
@@ -18758,7 +18918,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
18758
18918
|
], 64)) : createCommentVNode("", true),
|
|
18759
18919
|
_ctx.type === "team" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
18760
18920
|
createElementVNode("div", _hoisted_4$5, [
|
|
18761
|
-
_cache[
|
|
18921
|
+
_cache[14] || (_cache[14] = createElementVNode("span", { class: "devui-menu-icon" }, null, -1)),
|
|
18762
18922
|
createElementVNode("span", _hoisted_5$3, [
|
|
18763
18923
|
createElementVNode("div", {
|
|
18764
18924
|
class: "fast-click-button",
|
|
@@ -18839,7 +18999,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
18839
18999
|
key: 4,
|
|
18840
19000
|
variant: "text",
|
|
18841
19001
|
class: "more-btn",
|
|
18842
|
-
onClick:
|
|
19002
|
+
onClick: withModifiers(createRepoOrOrg, ["stop"])
|
|
18843
19003
|
}, {
|
|
18844
19004
|
default: withCtx(() => [
|
|
18845
19005
|
createTextVNode(toDisplayString$1(_ctx.buttonText), 1)
|
|
@@ -19126,7 +19286,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
19126
19286
|
if (sizeStore.isMobile.value) {
|
|
19127
19287
|
emits("onMenuClick");
|
|
19128
19288
|
}
|
|
19129
|
-
emitEvent("login");
|
|
19289
|
+
emitEvent("login", { loginTriggerSource: `aside_${routeData.name}` });
|
|
19130
19290
|
return;
|
|
19131
19291
|
}
|
|
19132
19292
|
const needNamespaceRoute = ["userFollowing", "userStars"].includes(routeData.name);
|
|
@@ -20271,7 +20431,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
20271
20431
|
setup(__props) {
|
|
20272
20432
|
const isLogin = ref(false);
|
|
20273
20433
|
const login = () => {
|
|
20274
|
-
emitEvent("login");
|
|
20434
|
+
emitEvent("login", { loginTriggerSource: "toolbar_login" });
|
|
20275
20435
|
};
|
|
20276
20436
|
const loginSuccess = (data) => {
|
|
20277
20437
|
isLogin.value = true;
|
|
@@ -22381,8 +22541,8 @@ function applyInternationalSeparatorStyle(formattedNumber) {
|
|
|
22381
22541
|
return formattedNumber.replace(new RegExp("[".concat(VALID_PUNCTUATION, "]+"), "g"), " ").trim();
|
|
22382
22542
|
}
|
|
22383
22543
|
var FIRST_GROUP_PATTERN = /(\$\d)/;
|
|
22384
|
-
function formatNationalNumberUsingFormat(number2, format2,
|
|
22385
|
-
var useInternationalFormat =
|
|
22544
|
+
function formatNationalNumberUsingFormat(number2, format2, _ref) {
|
|
22545
|
+
var useInternationalFormat = _ref.useInternationalFormat, withNationalPrefix = _ref.withNationalPrefix;
|
|
22386
22546
|
var formattedNumber = number2.replace(new RegExp(format2.pattern()), useInternationalFormat ? format2.internationalFormat() : (
|
|
22387
22547
|
// This library doesn't use `domestic_carrier_code_formatting_rule`,
|
|
22388
22548
|
// because that one is only used when formatting phone numbers
|
|
@@ -22456,8 +22616,8 @@ function isViablePhoneNumber(number2) {
|
|
|
22456
22616
|
function isViablePhoneNumberStart(number2) {
|
|
22457
22617
|
return VALID_PHONE_NUMBER_START_REG_EXP.test(number2);
|
|
22458
22618
|
}
|
|
22459
|
-
function formatRFC3966(
|
|
22460
|
-
var number2 =
|
|
22619
|
+
function formatRFC3966(_ref) {
|
|
22620
|
+
var number2 = _ref.number, ext = _ref.ext;
|
|
22461
22621
|
if (!number2) {
|
|
22462
22622
|
return "";
|
|
22463
22623
|
}
|
|
@@ -23109,8 +23269,8 @@ function _arrayLikeToArray$1(arr, len) {
|
|
|
23109
23269
|
}
|
|
23110
23270
|
return arr2;
|
|
23111
23271
|
}
|
|
23112
|
-
function getCountryByNationalNumber(nationalPhoneNumber,
|
|
23113
|
-
var countries =
|
|
23272
|
+
function getCountryByNationalNumber(nationalPhoneNumber, _ref) {
|
|
23273
|
+
var countries = _ref.countries, metadata2 = _ref.metadata;
|
|
23114
23274
|
metadata2 = new Metadata(metadata2);
|
|
23115
23275
|
for (var _iterator = _createForOfIteratorHelperLoose(countries), _step; !(_step = _iterator()).done; ) {
|
|
23116
23276
|
var country = _step.value;
|
|
@@ -23127,8 +23287,8 @@ function getCountryByNationalNumber(nationalPhoneNumber, _ref2) {
|
|
|
23127
23287
|
}
|
|
23128
23288
|
}
|
|
23129
23289
|
}
|
|
23130
|
-
function getCountryByCallingCode(callingCode,
|
|
23131
|
-
var nationalPhoneNumber =
|
|
23290
|
+
function getCountryByCallingCode(callingCode, _ref) {
|
|
23291
|
+
var nationalPhoneNumber = _ref.nationalNumber, metadata2 = _ref.metadata;
|
|
23132
23292
|
var possibleCountries = metadata2.getCountryCodesForCallingCode(callingCode);
|
|
23133
23293
|
if (!possibleCountries) {
|
|
23134
23294
|
return;
|
|
@@ -23180,8 +23340,8 @@ function isPhoneContextValid(phoneContext) {
|
|
|
23180
23340
|
}
|
|
23181
23341
|
return RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_.test(phoneContext) || RFC3966_DOMAINNAME_PATTERN_.test(phoneContext);
|
|
23182
23342
|
}
|
|
23183
|
-
function extractFormattedPhoneNumberFromPossibleRfc3966NumberUri(numberToParse,
|
|
23184
|
-
var extractFormattedPhoneNumber =
|
|
23343
|
+
function extractFormattedPhoneNumberFromPossibleRfc3966NumberUri(numberToParse, _ref) {
|
|
23344
|
+
var extractFormattedPhoneNumber = _ref.extractFormattedPhoneNumber;
|
|
23185
23345
|
var phoneContext = extractPhoneContext(numberToParse);
|
|
23186
23346
|
if (!isPhoneContextValid(phoneContext)) {
|
|
23187
23347
|
throw new ParseError("NOT_A_NUMBER");
|
|
@@ -24112,7 +24272,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
24112
24272
|
}
|
|
24113
24273
|
});
|
|
24114
24274
|
const MFA = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-gitcode-layout-lib"]]);
|
|
24115
|
-
const SlidCaptcha = defineAsyncComponent(() => import("./index-
|
|
24275
|
+
const SlidCaptcha = defineAsyncComponent(() => import("./index-aMICzTxu.js"));
|
|
24116
24276
|
const useSlidCaptcha = () => {
|
|
24117
24277
|
const { mount, unMount } = usePopup("slid-captcha-popup");
|
|
24118
24278
|
const open = (config) => {
|
|
@@ -25488,16 +25648,20 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
25488
25648
|
});
|
|
25489
25649
|
const LoginModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-gitcode-layout-lib"]]);
|
|
25490
25650
|
const { t } = i18n.global;
|
|
25491
|
-
function useLogin(request) {
|
|
25651
|
+
function useLogin(request, globalStore) {
|
|
25492
25652
|
const successMsg = t("gitCodeLayout.common.tips.welcome");
|
|
25493
25653
|
const { mount, unMount, isMounted, closeModal, refreshModal } = usePopup();
|
|
25494
25654
|
const router2 = useRouter();
|
|
25495
25655
|
const route = useRoute();
|
|
25496
|
-
const
|
|
25497
|
-
|
|
25656
|
+
const { useReport: useReport2 } = useRequestReport(request, globalStore);
|
|
25657
|
+
const login = (options = { Authorization: true, type: "login", triggerType: "", loginTriggerSource: "" }, loginSuccess, openHarmonyGuide) => {
|
|
25658
|
+
const { Authorization = true, type = "login", triggerType = "", loginTriggerSource = "" } = options;
|
|
25498
25659
|
if (isMounted()) {
|
|
25499
25660
|
return;
|
|
25500
25661
|
}
|
|
25662
|
+
if (loginTriggerSource) {
|
|
25663
|
+
useReport2("login_exposure", { source: loginTriggerSource });
|
|
25664
|
+
}
|
|
25501
25665
|
if (isPhone()) {
|
|
25502
25666
|
saveLoginType(triggerType || "");
|
|
25503
25667
|
let url = window.location.href;
|
|
@@ -25583,7 +25747,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
25583
25747
|
setup(__props) {
|
|
25584
25748
|
const props = __props;
|
|
25585
25749
|
const status = ref(false);
|
|
25586
|
-
const { login, isMounted } = useLogin(props.request);
|
|
25750
|
+
const { login, isMounted } = useLogin(props.request, props.globalStore);
|
|
25587
25751
|
const { t: t2 } = i18n.global;
|
|
25588
25752
|
const { notice } = useNotification();
|
|
25589
25753
|
const toNotice = () => {
|