[6a3a178] | 1 | /**
|
---|
| 2 | * @license
|
---|
| 3 | * Copyright Google LLC All Rights Reserved.
|
---|
| 4 | *
|
---|
| 5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 6 | * found in the LICENSE file at https://angular.io/license
|
---|
| 7 | */
|
---|
| 8 | (function (factory) {
|
---|
| 9 | if (typeof module === "object" && typeof module.exports === "object") {
|
---|
| 10 | var v = factory(require, exports);
|
---|
| 11 | if (v !== undefined) module.exports = v;
|
---|
| 12 | }
|
---|
| 13 | else if (typeof define === "function" && define.amd) {
|
---|
| 14 | define("@angular/compiler/src/constant_pool", ["require", "exports", "tslib", "@angular/compiler/src/output/output_ast"], factory);
|
---|
| 15 | }
|
---|
| 16 | })(function (require, exports) {
|
---|
| 17 | "use strict";
|
---|
| 18 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
| 19 | exports.ConstantPool = void 0;
|
---|
| 20 | var tslib_1 = require("tslib");
|
---|
| 21 | var o = require("@angular/compiler/src/output/output_ast");
|
---|
| 22 | var CONSTANT_PREFIX = '_c';
|
---|
| 23 | /**
|
---|
| 24 | * `ConstantPool` tries to reuse literal factories when two or more literals are identical.
|
---|
| 25 | * We determine whether literals are identical by creating a key out of their AST using the
|
---|
| 26 | * `KeyVisitor`. This constant is used to replace dynamic expressions which can't be safely
|
---|
| 27 | * converted into a key. E.g. given an expression `{foo: bar()}`, since we don't know what
|
---|
| 28 | * the result of `bar` will be, we create a key that looks like `{foo: <unknown>}`. Note
|
---|
| 29 | * that we use a variable, rather than something like `null` in order to avoid collisions.
|
---|
| 30 | */
|
---|
| 31 | var UNKNOWN_VALUE_KEY = o.variable('<unknown>');
|
---|
| 32 | /**
|
---|
| 33 | * Context to use when producing a key.
|
---|
| 34 | *
|
---|
| 35 | * This ensures we see the constant not the reference variable when producing
|
---|
| 36 | * a key.
|
---|
| 37 | */
|
---|
| 38 | var KEY_CONTEXT = {};
|
---|
| 39 | /**
|
---|
| 40 | * Generally all primitive values are excluded from the `ConstantPool`, but there is an exclusion
|
---|
| 41 | * for strings that reach a certain length threshold. This constant defines the length threshold for
|
---|
| 42 | * strings.
|
---|
| 43 | */
|
---|
| 44 | var POOL_INCLUSION_LENGTH_THRESHOLD_FOR_STRINGS = 50;
|
---|
| 45 | /**
|
---|
| 46 | * A node that is a place-holder that allows the node to be replaced when the actual
|
---|
| 47 | * node is known.
|
---|
| 48 | *
|
---|
| 49 | * This allows the constant pool to change an expression from a direct reference to
|
---|
| 50 | * a constant to a shared constant. It returns a fix-up node that is later allowed to
|
---|
| 51 | * change the referenced expression.
|
---|
| 52 | */
|
---|
| 53 | var FixupExpression = /** @class */ (function (_super) {
|
---|
| 54 | tslib_1.__extends(FixupExpression, _super);
|
---|
| 55 | function FixupExpression(resolved) {
|
---|
| 56 | var _this = _super.call(this, resolved.type) || this;
|
---|
| 57 | _this.resolved = resolved;
|
---|
| 58 | _this.original = resolved;
|
---|
| 59 | return _this;
|
---|
| 60 | }
|
---|
| 61 | FixupExpression.prototype.visitExpression = function (visitor, context) {
|
---|
| 62 | if (context === KEY_CONTEXT) {
|
---|
| 63 | // When producing a key we want to traverse the constant not the
|
---|
| 64 | // variable used to refer to it.
|
---|
| 65 | return this.original.visitExpression(visitor, context);
|
---|
| 66 | }
|
---|
| 67 | else {
|
---|
| 68 | return this.resolved.visitExpression(visitor, context);
|
---|
| 69 | }
|
---|
| 70 | };
|
---|
| 71 | FixupExpression.prototype.isEquivalent = function (e) {
|
---|
| 72 | return e instanceof FixupExpression && this.resolved.isEquivalent(e.resolved);
|
---|
| 73 | };
|
---|
| 74 | FixupExpression.prototype.isConstant = function () {
|
---|
| 75 | return true;
|
---|
| 76 | };
|
---|
| 77 | FixupExpression.prototype.fixup = function (expression) {
|
---|
| 78 | this.resolved = expression;
|
---|
| 79 | this.shared = true;
|
---|
| 80 | };
|
---|
| 81 | return FixupExpression;
|
---|
| 82 | }(o.Expression));
|
---|
| 83 | /**
|
---|
| 84 | * A constant pool allows a code emitter to share constant in an output context.
|
---|
| 85 | *
|
---|
| 86 | * The constant pool also supports sharing access to ivy definitions references.
|
---|
| 87 | */
|
---|
| 88 | var ConstantPool = /** @class */ (function () {
|
---|
| 89 | function ConstantPool(isClosureCompilerEnabled) {
|
---|
| 90 | if (isClosureCompilerEnabled === void 0) { isClosureCompilerEnabled = false; }
|
---|
| 91 | this.isClosureCompilerEnabled = isClosureCompilerEnabled;
|
---|
| 92 | this.statements = [];
|
---|
| 93 | this.literals = new Map();
|
---|
| 94 | this.literalFactories = new Map();
|
---|
| 95 | this.injectorDefinitions = new Map();
|
---|
| 96 | this.directiveDefinitions = new Map();
|
---|
| 97 | this.componentDefinitions = new Map();
|
---|
| 98 | this.pipeDefinitions = new Map();
|
---|
| 99 | this.nextNameIndex = 0;
|
---|
| 100 | }
|
---|
| 101 | ConstantPool.prototype.getConstLiteral = function (literal, forceShared) {
|
---|
| 102 | if ((literal instanceof o.LiteralExpr && !isLongStringLiteral(literal)) ||
|
---|
| 103 | literal instanceof FixupExpression) {
|
---|
| 104 | // Do no put simple literals into the constant pool or try to produce a constant for a
|
---|
| 105 | // reference to a constant.
|
---|
| 106 | return literal;
|
---|
| 107 | }
|
---|
| 108 | var key = this.keyOf(literal);
|
---|
| 109 | var fixup = this.literals.get(key);
|
---|
| 110 | var newValue = false;
|
---|
| 111 | if (!fixup) {
|
---|
| 112 | fixup = new FixupExpression(literal);
|
---|
| 113 | this.literals.set(key, fixup);
|
---|
| 114 | newValue = true;
|
---|
| 115 | }
|
---|
| 116 | if ((!newValue && !fixup.shared) || (newValue && forceShared)) {
|
---|
| 117 | // Replace the expression with a variable
|
---|
| 118 | var name_1 = this.freshName();
|
---|
| 119 | var definition = void 0;
|
---|
| 120 | var usage = void 0;
|
---|
| 121 | if (this.isClosureCompilerEnabled && isLongStringLiteral(literal)) {
|
---|
| 122 | // For string literals, Closure will **always** inline the string at
|
---|
| 123 | // **all** usages, duplicating it each time. For large strings, this
|
---|
| 124 | // unnecessarily bloats bundle size. To work around this restriction, we
|
---|
| 125 | // wrap the string in a function, and call that function for each usage.
|
---|
| 126 | // This tricks Closure into using inline logic for functions instead of
|
---|
| 127 | // string literals. Function calls are only inlined if the body is small
|
---|
| 128 | // enough to be worth it. By doing this, very large strings will be
|
---|
| 129 | // shared across multiple usages, rather than duplicating the string at
|
---|
| 130 | // each usage site.
|
---|
| 131 | //
|
---|
| 132 | // const myStr = function() { return "very very very long string"; };
|
---|
| 133 | // const usage1 = myStr();
|
---|
| 134 | // const usage2 = myStr();
|
---|
| 135 | definition = o.variable(name_1).set(new o.FunctionExpr([], // Params.
|
---|
| 136 | [
|
---|
| 137 | // Statements.
|
---|
| 138 | new o.ReturnStatement(literal),
|
---|
| 139 | ]));
|
---|
| 140 | usage = o.variable(name_1).callFn([]);
|
---|
| 141 | }
|
---|
| 142 | else {
|
---|
| 143 | // Just declare and use the variable directly, without a function call
|
---|
| 144 | // indirection. This saves a few bytes and avoids an unncessary call.
|
---|
| 145 | definition = o.variable(name_1).set(literal);
|
---|
| 146 | usage = o.variable(name_1);
|
---|
| 147 | }
|
---|
| 148 | this.statements.push(definition.toDeclStmt(o.INFERRED_TYPE, [o.StmtModifier.Final]));
|
---|
| 149 | fixup.fixup(usage);
|
---|
| 150 | }
|
---|
| 151 | return fixup;
|
---|
| 152 | };
|
---|
| 153 | ConstantPool.prototype.getDefinition = function (type, kind, ctx, forceShared) {
|
---|
| 154 | if (forceShared === void 0) { forceShared = false; }
|
---|
| 155 | var definitions = this.definitionsOf(kind);
|
---|
| 156 | var fixup = definitions.get(type);
|
---|
| 157 | var newValue = false;
|
---|
| 158 | if (!fixup) {
|
---|
| 159 | var property = this.propertyNameOf(kind);
|
---|
| 160 | fixup = new FixupExpression(ctx.importExpr(type).prop(property));
|
---|
| 161 | definitions.set(type, fixup);
|
---|
| 162 | newValue = true;
|
---|
| 163 | }
|
---|
| 164 | if ((!newValue && !fixup.shared) || (newValue && forceShared)) {
|
---|
| 165 | var name_2 = this.freshName();
|
---|
| 166 | this.statements.push(o.variable(name_2).set(fixup.resolved).toDeclStmt(o.INFERRED_TYPE, [o.StmtModifier.Final]));
|
---|
| 167 | fixup.fixup(o.variable(name_2));
|
---|
| 168 | }
|
---|
| 169 | return fixup;
|
---|
| 170 | };
|
---|
| 171 | ConstantPool.prototype.getLiteralFactory = function (literal) {
|
---|
| 172 | // Create a pure function that builds an array of a mix of constant and variable expressions
|
---|
| 173 | if (literal instanceof o.LiteralArrayExpr) {
|
---|
| 174 | var argumentsForKey = literal.entries.map(function (e) { return e.isConstant() ? e : UNKNOWN_VALUE_KEY; });
|
---|
| 175 | var key = this.keyOf(o.literalArr(argumentsForKey));
|
---|
| 176 | return this._getLiteralFactory(key, literal.entries, function (entries) { return o.literalArr(entries); });
|
---|
| 177 | }
|
---|
| 178 | else {
|
---|
| 179 | var expressionForKey = o.literalMap(literal.entries.map(function (e) { return ({
|
---|
| 180 | key: e.key,
|
---|
| 181 | value: e.value.isConstant() ? e.value : UNKNOWN_VALUE_KEY,
|
---|
| 182 | quoted: e.quoted
|
---|
| 183 | }); }));
|
---|
| 184 | var key = this.keyOf(expressionForKey);
|
---|
| 185 | return this._getLiteralFactory(key, literal.entries.map(function (e) { return e.value; }), function (entries) { return o.literalMap(entries.map(function (value, index) { return ({
|
---|
| 186 | key: literal.entries[index].key,
|
---|
| 187 | value: value,
|
---|
| 188 | quoted: literal.entries[index].quoted
|
---|
| 189 | }); })); });
|
---|
| 190 | }
|
---|
| 191 | };
|
---|
| 192 | ConstantPool.prototype._getLiteralFactory = function (key, values, resultMap) {
|
---|
| 193 | var _this = this;
|
---|
| 194 | var literalFactory = this.literalFactories.get(key);
|
---|
| 195 | var literalFactoryArguments = values.filter((function (e) { return !e.isConstant(); }));
|
---|
| 196 | if (!literalFactory) {
|
---|
| 197 | var resultExpressions = values.map(function (e, index) { return e.isConstant() ? _this.getConstLiteral(e, true) : o.variable("a" + index); });
|
---|
| 198 | var parameters = resultExpressions.filter(isVariable).map(function (e) { return new o.FnParam(e.name, o.DYNAMIC_TYPE); });
|
---|
| 199 | var pureFunctionDeclaration = o.fn(parameters, [new o.ReturnStatement(resultMap(resultExpressions))], o.INFERRED_TYPE);
|
---|
| 200 | var name_3 = this.freshName();
|
---|
| 201 | this.statements.push(o.variable(name_3).set(pureFunctionDeclaration).toDeclStmt(o.INFERRED_TYPE, [
|
---|
| 202 | o.StmtModifier.Final
|
---|
| 203 | ]));
|
---|
| 204 | literalFactory = o.variable(name_3);
|
---|
| 205 | this.literalFactories.set(key, literalFactory);
|
---|
| 206 | }
|
---|
| 207 | return { literalFactory: literalFactory, literalFactoryArguments: literalFactoryArguments };
|
---|
| 208 | };
|
---|
| 209 | /**
|
---|
| 210 | * Produce a unique name.
|
---|
| 211 | *
|
---|
| 212 | * The name might be unique among different prefixes if any of the prefixes end in
|
---|
| 213 | * a digit so the prefix should be a constant string (not based on user input) and
|
---|
| 214 | * must not end in a digit.
|
---|
| 215 | */
|
---|
| 216 | ConstantPool.prototype.uniqueName = function (prefix) {
|
---|
| 217 | return "" + prefix + this.nextNameIndex++;
|
---|
| 218 | };
|
---|
| 219 | ConstantPool.prototype.definitionsOf = function (kind) {
|
---|
| 220 | switch (kind) {
|
---|
| 221 | case 2 /* Component */:
|
---|
| 222 | return this.componentDefinitions;
|
---|
| 223 | case 1 /* Directive */:
|
---|
| 224 | return this.directiveDefinitions;
|
---|
| 225 | case 0 /* Injector */:
|
---|
| 226 | return this.injectorDefinitions;
|
---|
| 227 | case 3 /* Pipe */:
|
---|
| 228 | return this.pipeDefinitions;
|
---|
| 229 | }
|
---|
| 230 | };
|
---|
| 231 | ConstantPool.prototype.propertyNameOf = function (kind) {
|
---|
| 232 | switch (kind) {
|
---|
| 233 | case 2 /* Component */:
|
---|
| 234 | return 'ɵcmp';
|
---|
| 235 | case 1 /* Directive */:
|
---|
| 236 | return 'ɵdir';
|
---|
| 237 | case 0 /* Injector */:
|
---|
| 238 | return 'ɵinj';
|
---|
| 239 | case 3 /* Pipe */:
|
---|
| 240 | return 'ɵpipe';
|
---|
| 241 | }
|
---|
| 242 | };
|
---|
| 243 | ConstantPool.prototype.freshName = function () {
|
---|
| 244 | return this.uniqueName(CONSTANT_PREFIX);
|
---|
| 245 | };
|
---|
| 246 | ConstantPool.prototype.keyOf = function (expression) {
|
---|
| 247 | return expression.visitExpression(new KeyVisitor(), KEY_CONTEXT);
|
---|
| 248 | };
|
---|
| 249 | return ConstantPool;
|
---|
| 250 | }());
|
---|
| 251 | exports.ConstantPool = ConstantPool;
|
---|
| 252 | /**
|
---|
| 253 | * Visitor used to determine if 2 expressions are equivalent and can be shared in the
|
---|
| 254 | * `ConstantPool`.
|
---|
| 255 | *
|
---|
| 256 | * When the id (string) generated by the visitor is equal, expressions are considered equivalent.
|
---|
| 257 | */
|
---|
| 258 | var KeyVisitor = /** @class */ (function () {
|
---|
| 259 | function KeyVisitor() {
|
---|
| 260 | this.visitWrappedNodeExpr = invalid;
|
---|
| 261 | this.visitWriteVarExpr = invalid;
|
---|
| 262 | this.visitWriteKeyExpr = invalid;
|
---|
| 263 | this.visitWritePropExpr = invalid;
|
---|
| 264 | this.visitInvokeMethodExpr = invalid;
|
---|
| 265 | this.visitInvokeFunctionExpr = invalid;
|
---|
| 266 | this.visitTaggedTemplateExpr = invalid;
|
---|
| 267 | this.visitInstantiateExpr = invalid;
|
---|
| 268 | this.visitConditionalExpr = invalid;
|
---|
| 269 | this.visitNotExpr = invalid;
|
---|
| 270 | this.visitAssertNotNullExpr = invalid;
|
---|
| 271 | this.visitCastExpr = invalid;
|
---|
| 272 | this.visitFunctionExpr = invalid;
|
---|
| 273 | this.visitUnaryOperatorExpr = invalid;
|
---|
| 274 | this.visitBinaryOperatorExpr = invalid;
|
---|
| 275 | this.visitReadPropExpr = invalid;
|
---|
| 276 | this.visitReadKeyExpr = invalid;
|
---|
| 277 | this.visitCommaExpr = invalid;
|
---|
| 278 | this.visitLocalizedString = invalid;
|
---|
| 279 | }
|
---|
| 280 | KeyVisitor.prototype.visitLiteralExpr = function (ast) {
|
---|
| 281 | return "" + (typeof ast.value === 'string' ? '"' + ast.value + '"' : ast.value);
|
---|
| 282 | };
|
---|
| 283 | KeyVisitor.prototype.visitLiteralArrayExpr = function (ast, context) {
|
---|
| 284 | var _this = this;
|
---|
| 285 | return "[" + ast.entries.map(function (entry) { return entry.visitExpression(_this, context); }).join(',') + "]";
|
---|
| 286 | };
|
---|
| 287 | KeyVisitor.prototype.visitLiteralMapExpr = function (ast, context) {
|
---|
| 288 | var _this = this;
|
---|
| 289 | var mapKey = function (entry) {
|
---|
| 290 | var quote = entry.quoted ? '"' : '';
|
---|
| 291 | return "" + quote + entry.key + quote;
|
---|
| 292 | };
|
---|
| 293 | var mapEntry = function (entry) {
|
---|
| 294 | return mapKey(entry) + ":" + entry.value.visitExpression(_this, context);
|
---|
| 295 | };
|
---|
| 296 | return "{" + ast.entries.map(mapEntry).join(',');
|
---|
| 297 | };
|
---|
| 298 | KeyVisitor.prototype.visitExternalExpr = function (ast) {
|
---|
| 299 | return ast.value.moduleName ? "EX:" + ast.value.moduleName + ":" + ast.value.name :
|
---|
| 300 | "EX:" + ast.value.runtime.name;
|
---|
| 301 | };
|
---|
| 302 | KeyVisitor.prototype.visitReadVarExpr = function (node) {
|
---|
| 303 | return "VAR:" + node.name;
|
---|
| 304 | };
|
---|
| 305 | KeyVisitor.prototype.visitTypeofExpr = function (node, context) {
|
---|
| 306 | return "TYPEOF:" + node.expr.visitExpression(this, context);
|
---|
| 307 | };
|
---|
| 308 | return KeyVisitor;
|
---|
| 309 | }());
|
---|
| 310 | function invalid(arg) {
|
---|
| 311 | throw new Error("Invalid state: Visitor " + this.constructor.name + " doesn't handle " + arg.constructor.name);
|
---|
| 312 | }
|
---|
| 313 | function isVariable(e) {
|
---|
| 314 | return e instanceof o.ReadVarExpr;
|
---|
| 315 | }
|
---|
| 316 | function isLongStringLiteral(expr) {
|
---|
| 317 | return expr instanceof o.LiteralExpr && typeof expr.value === 'string' &&
|
---|
| 318 | expr.value.length >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0tFWSk7XG4gICAgICBjb25zdCBrZXkgPSB0aGlzLmtleU9mKG8ubGl0ZXJhbEFycihhcmd1bWVudHNGb3JLZXkpKTtcbiAgICAgIHJldHVybiB0aGlzLl9nZXRMaXRlcmFsRmFjdG9yeShrZXksIGxpdGVyYWwuZW50cmllcywgZW50cmllcyA9PiBvLmxpdGVyYWxBcnIoZW50cmllcykpO1xuICAgIH0gZWxzZSB7XG4gICAgICBjb25zdCBleHByZXNzaW9uRm9yS2V5ID0gby5saXRlcmFsTWFwKFxuICAgICAgICAgIGxpdGVyYWwuZW50cmllcy5tYXAoZSA9PiAoe1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6IGUua2V5LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YWx1ZTogZS52YWx1ZS5pc0NvbnN0YW50KCkgPyBlLnZhbHVlIDogVU5LTk9XTl9WQUxVRV9LRVksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHF1b3RlZDogZS5xdW90ZWRcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKSk7XG4gICAgICBjb25zdCBrZXkgPSB0aGlzLmtleU9mKGV4cHJlc3Npb25Gb3JLZXkpO1xuICAgICAgcmV0dXJuIHRoaXMuX2dldExpdGVyYWxGYWN0b3J5KFxuICAgICAgICAgIGtleSwgbGl0ZXJhbC5lbnRyaWVzLm1hcChlID0+IGUudmFsdWUpLFxuICAgICAgICAgIGVudHJpZXMgPT4gby5saXRlcmFsTWFwKGVudHJpZXMubWFwKCh2YWx1ZSwgaW5kZXgpID0+ICh7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrZXk6IGxpdGVyYWwuZW50cmllc1tpbmRleF0ua2V5LFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBx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VmaW5pdGlvbktpbmQpOiBNYXA8YW55LCBGaXh1cEV4cHJlc3Npb24+IHtcbiAgICBzd2l0Y2ggKGtpbmQpIHtcbiAgICAgIGNhc2UgRGVmaW5pdGlvbktpbmQuQ29tcG9uZW50OlxuICAgICAgICByZXR1cm4gdGhpcy5jb21wb25lbnREZWZpbml0aW9ucztcbiAgICAgIGNhc2UgRGVmaW5pdGlvbktpbmQuRGlyZWN0aXZlOlxuICAgICAgICByZXR1cm4gdGhpcy5kaXJlY3RpdmVEZWZpbml0aW9ucztcbiAgICAgIGNhc2UgRGVmaW5pdGlvbktpbmQuSW5qZWN0b3I6XG4gICAgICAgIHJldHVybiB0aGlzLmluamVjdG9yRGVmaW5pdGlvbnM7XG4gICAgICBjYXNlIERlZmluaXRpb25LaW5kLlBpcGU6XG4gICAgICAgIHJldHVybiB0aGlzLnBpcGVEZWZpbml0aW9ucztcbiAgICB9XG4gIH1cblxuICBwdWJsaWMgcHJvcGVydHlOYW1lT2Yoa2luZDogRGVmaW5pdGlvbktpbmQpOiBzdHJpbmcge1xuICAgIHN3aXRjaCAoa2luZCkge1xuICAgICAgY2FzZSBEZWZpbml0aW9uS2luZC5Db21wb25lbnQ6XG4gICAgICAgIHJldHVybiAnybVjbXAnO1xuICAgICAgY2FzZSBEZWZpbml0aW9uS2luZC5EaXJlY3RpdmU6XG4gICAgICAgIHJldHVybiAnybVkaXInO1xuICAgICAgY2FzZSBEZWZpbml0aW9uS2luZC5JbmplY3RvcjpcbiAgICAgICAgcmV0dXJuICfJtWluaic7XG4gICAgICBjYXNlIERlZmluaXRpb25LaW5kLlBpcGU6XG4gICAgICAgIHJldHVybiAnybVwaXBlJztcbiAgICB9XG4gIH1cblxuICBwcml2YXRlIGZyZXNoTmFtZSgpOiBzdHJpbmcge1xuICAgIHJldHVybiB0aGlzLnVuaXF1ZU5hbWUoQ09OU1RBTlRfUFJFRklYKTtcbiAgfVxuXG4gIHByaXZhdGUga2V5T2YoZXhwcmVzc2lvbjogby5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