angular-render-html-once
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":4,"metadata":{"RenderHtmlOnceComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":2,"character":1},"arguments":[{"selector":"render-html-once","template":""}]}],"members":{"id":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":10,"character":5}}]}],"htmlContent":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":11,"character":5}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"ElementRef","module":"@angular/core","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":13,"character":55,"context":{"typeName":"Element"},"module":"./lib/render-html-once.component"}]}]}],"ngOnInit":[{"__symbolic":"method"}]},"statics":{"alreadyRendered":{},"enabled":true}},"RenderHtmlOnceModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":3,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"RenderHtmlOnceComponent"}],"exports":[{"__symbolic":"reference","name":"RenderHtmlOnceComponent"}],"imports":[]}]}],"members":{}}},"origins":{"RenderHtmlOnceComponent":"./lib/render-html-once.component","RenderHtmlOnceModule":"./lib/render-html-once.module"},"importAs":"angular-render-html-once"} | ||
{"__symbolic":"module","version":4,"metadata":{"RenderHtmlOnceComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":2,"character":1},"arguments":[{"selector":"render-html-once","template":""}]}],"members":{"id":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":10,"character":5}}]}],"htmlContent":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":11,"character":5}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"ElementRef","module":"@angular/core","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":13,"character":55,"context":{"typeName":"Element"},"module":"./lib/render-html-once.component"}]}]}],"ngOnInit":[{"__symbolic":"method"}],"renderFromString":[{"__symbolic":"method"}],"renderFromCacheHit":[{"__symbolic":"method"}]},"statics":{"alreadyRendered":{},"enabled":true}},"RenderHtmlOnceModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":3,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"RenderHtmlOnceComponent"}],"exports":[{"__symbolic":"reference","name":"RenderHtmlOnceComponent"}],"imports":[]}]}],"members":{}}},"origins":{"RenderHtmlOnceComponent":"./lib/render-html-once.component","RenderHtmlOnceModule":"./lib/render-html-once.module"},"importAs":"angular-render-html-once"} |
@@ -24,2 +24,3 @@ (function (global, factory) { | ||
if (!RenderHtmlOnceComponent.enabled) { | ||
this.renderFromString(); | ||
return; | ||
@@ -30,8 +31,6 @@ } | ||
if (cacheHit) { | ||
while (cacheHit.childNodes.length) { | ||
this.hostElement.nativeElement.appendChild(cacheHit.firstChild); | ||
} | ||
this.renderFromCacheHit(cacheHit); | ||
} | ||
else { | ||
this.hostElement.nativeElement.innerHTML = this.htmlContent; | ||
this.renderFromString(); | ||
} | ||
@@ -87,2 +86,28 @@ RenderHtmlOnceComponent.alreadyRendered[this.id] = this.hostElement.nativeElement; | ||
}; | ||
/** | ||
* @private | ||
* @return {?} | ||
*/ | ||
RenderHtmlOnceComponent.prototype.renderFromString = /** | ||
* @private | ||
* @return {?} | ||
*/ | ||
function () { | ||
this.hostElement.nativeElement.innerHTML = this.htmlContent; | ||
}; | ||
/** | ||
* @private | ||
* @param {?} cacheHit | ||
* @return {?} | ||
*/ | ||
RenderHtmlOnceComponent.prototype.renderFromCacheHit = /** | ||
* @private | ||
* @param {?} cacheHit | ||
* @return {?} | ||
*/ | ||
function (cacheHit) { | ||
while (cacheHit.childNodes.length) { | ||
this.hostElement.nativeElement.appendChild(cacheHit.firstChild); | ||
} | ||
}; | ||
RenderHtmlOnceComponent.alreadyRendered = {}; | ||
@@ -89,0 +114,0 @@ RenderHtmlOnceComponent.enabled = true; |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@angular/core")):"function"==typeof define&&define.amd?define("angular-render-html-once",["exports","@angular/core"],n):n((e=e||self)["angular-render-html-once"]={},e.ng.core)}(this,(function(e,n){"use strict";var t=function(){function e(e){this.hostElement=e}return e.prototype.ngOnInit=function(){if(e.enabled){var n=e.alreadyRendered[this.id];if(n)for(;n.childNodes.length;)this.hostElement.nativeElement.appendChild(n.firstChild);else this.hostElement.nativeElement.innerHTML=this.htmlContent;e.alreadyRendered[this.id]=this.hostElement.nativeElement}},e.registerServerSideRenderedComponents=function(){if(e.enabled&&window&&window.document&&window.document.getElementsByTagName)for(var n=window.document.getElementsByTagName("render-html-once"),t=0;t<n.length;++t){var r=n[t];e.alreadyRendered[r.id]=r}},e.clearCache=function(){e.alreadyRendered={}},e.enable=function(){e.enabled=!0},e.disable=function(){e.enabled=!1},e.alreadyRendered={},e.enabled=!0,e.decorators=[{type:n.Component,args:[{selector:"render-html-once",template:""}]}],e.ctorParameters=function(){return[{type:n.ElementRef}]},e.propDecorators={id:[{type:n.Input}],htmlContent:[{type:n.Input}]},e}();var r=function(){function e(){}return e.decorators=[{type:n.NgModule,args:[{declarations:[t],exports:[t],imports:[]}]}],e}();e.RenderHtmlOnceComponent=t,e.RenderHtmlOnceModule=r,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@angular/core")):"function"==typeof define&&define.amd?define("angular-render-html-once",["exports","@angular/core"],n):n((e=e||self)["angular-render-html-once"]={},e.ng.core)}(this,(function(e,n){"use strict";var t=function(){function e(e){this.hostElement=e}return e.prototype.ngOnInit=function(){if(e.enabled){var n=e.alreadyRendered[this.id];n?this.renderFromCacheHit(n):this.renderFromString(),e.alreadyRendered[this.id]=this.hostElement.nativeElement}else this.renderFromString()},e.registerServerSideRenderedComponents=function(){if(e.enabled&&window&&window.document&&window.document.getElementsByTagName)for(var n=window.document.getElementsByTagName("render-html-once"),t=0;t<n.length;++t){var r=n[t];e.alreadyRendered[r.id]=r}},e.clearCache=function(){e.alreadyRendered={}},e.enable=function(){e.enabled=!0},e.disable=function(){e.enabled=!1},e.prototype.renderFromString=function(){this.hostElement.nativeElement.innerHTML=this.htmlContent},e.prototype.renderFromCacheHit=function(e){for(;e.childNodes.length;)this.hostElement.nativeElement.appendChild(e.firstChild)},e.alreadyRendered={},e.enabled=!0,e.decorators=[{type:n.Component,args:[{selector:"render-html-once",template:""}]}],e.ctorParameters=function(){return[{type:n.ElementRef}]},e.propDecorators={id:[{type:n.Input}],htmlContent:[{type:n.Input}]},e}();var r=function(){function e(){}return e.decorators=[{type:n.NgModule,args:[{declarations:[t],exports:[t],imports:[]}]}],e}();e.RenderHtmlOnceComponent=t,e.RenderHtmlOnceModule=r,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=angular-render-html-once.umd.min.js.map |
@@ -19,2 +19,3 @@ /** | ||
if (!RenderHtmlOnceComponent.enabled) { | ||
this.renderFromString(); | ||
return; | ||
@@ -25,8 +26,6 @@ } | ||
if (cacheHit) { | ||
while (cacheHit.childNodes.length) { | ||
this.hostElement.nativeElement.appendChild(cacheHit.firstChild); | ||
} | ||
this.renderFromCacheHit(cacheHit); | ||
} | ||
else { | ||
this.hostElement.nativeElement.innerHTML = this.htmlContent; | ||
this.renderFromString(); | ||
} | ||
@@ -70,2 +69,19 @@ RenderHtmlOnceComponent.alreadyRendered[this.id] = this.hostElement.nativeElement; | ||
} | ||
/** | ||
* @private | ||
* @return {?} | ||
*/ | ||
renderFromString() { | ||
this.hostElement.nativeElement.innerHTML = this.htmlContent; | ||
} | ||
/** | ||
* @private | ||
* @param {?} cacheHit | ||
* @return {?} | ||
*/ | ||
renderFromCacheHit(cacheHit) { | ||
while (cacheHit.childNodes.length) { | ||
this.hostElement.nativeElement.appendChild(cacheHit.firstChild); | ||
} | ||
} | ||
} | ||
@@ -109,2 +125,2 @@ RenderHtmlOnceComponent.alreadyRendered = {}; | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVuZGVyLWh0bWwtb25jZS5jb21wb25lbnQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9hbmd1bGFyLXJlbmRlci1odG1sLW9uY2UvIiwic291cmNlcyI6WyJsaWIvcmVuZGVyLWh0bWwtb25jZS5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSxPQUFPLEVBQUMsU0FBUyxFQUFFLFVBQVUsRUFBRSxLQUFLLEVBQVMsTUFBTSxlQUFlLENBQUM7QUFNbkUsTUFBTSxPQUFPLHVCQUF1Qjs7OztJQU9oQyxZQUEyQixXQUFnQztRQUFoQyxnQkFBVyxHQUFYLFdBQVcsQ0FBcUI7SUFBRyxDQUFDOzs7O0lBRXhELFFBQVE7UUFDWCxJQUFJLENBQUMsdUJBQXVCLENBQUMsT0FBTyxFQUFFO1lBQ2xDLE9BQU87U0FDVjs7Y0FDSyxRQUFRLEdBQUcsdUJBQXVCLENBQUMsZUFBZSxDQUFDLElBQUksQ0FBQyxFQUFFLENBQUM7UUFDakUsSUFBSSxRQUFRLEVBQUU7WUFDVixPQUFPLFFBQVEsQ0FBQyxVQUFVLENBQUMsTUFBTSxFQUFFO2dCQUMvQixJQUFJLENBQUMsV0FBVyxDQUFDLGFBQWEsQ0FBQyxXQUFXLENBQUMsUUFBUSxDQUFDLFVBQVUsQ0FBQyxDQUFDO2FBQ25FO1NBQ0o7YUFBTTtZQUNILElBQUksQ0F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ge1xuICAgICAgICAgICAgICAgIGNvbnN0IGVsZW1lbnQgPSBlbGVtZW50c1tpXTtcbiAgICAgICAgICAgICAgICBSZW5kZXJIdG1sT25jZUNvbXBvbmVudC5hbHJlYWR5UmVuZGVyZWRbZWxlbWVudC5pZF0gPSBlbGVtZW50O1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuXG4gICAgcHVibGljIHN0YXRpYyBjbGVhckNhY2hlKCk6IHZvaWQge1xuICAgICAgICBSZW5kZXJIdG1sT25jZUNvbXBvbmVudC5hbHJlYWR5UmVuZGVyZWQgPSB7fTtcbiAgICB9XG5cbiAgICBwdWJsaWMgc3RhdGljIGVuYWJsZSgpOiB2b2lkIHtcbiAgICAgICAgUmVuZGVySHRtbE9uY2VDb21wb25lbnQuZW5hYmxlZCA9IHRydWU7XG4gICAgfVxuXG4gICAgcHVibGljIHN0YXRpYyBkaXNhYmxlKCk6IHZvaWQge1xuICAgICAgICBSZW5kZXJIdG1sT25jZUNvbXBvbmVudC5lbmFibGVkID0gZmFsc2U7XG4gICAgfVxufVxuIl19 | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVuZGVyLWh0bWwtb25jZS5jb21wb25lbnQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9hbmd1bGFyLXJlbmRlci1odG1sLW9uY2UvIiwic291cmNlcyI6WyJsaWIvcmVuZGVyLWh0bWwtb25jZS5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSxPQUFPLEVBQUMsU0FBUyxFQUFFLFVBQVUsRUFBRSxLQUFLLEVBQVMsTUFBTSxlQUFlLENBQUM7QUFNbkUsTUFBTSxPQUFPLHVCQUF1Qjs7OztJQU9oQyxZQUEyQixXQUFnQztRQUFoQyxnQkFBVyxHQUFYLFdBQVcsQ0FBcUI7SUFBRyxDQUFDOzs7O0lBRXhELFFBQVE7UUFDWCxJQUFJLENBQU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2YXRlIHJlbmRlckZyb21TdHJpbmcoKTogdm9pZCB7XG4gICAgICAgIHRoaXMuaG9zdEVsZW1lbnQubmF0aXZlRWxlbWVudC5pbm5lckhUTUwgPSB0aGlzLmh0bWxDb250ZW50O1xuICAgIH1cblxuICAgIHByaXZhdGUgcmVuZGVyRnJvbUNhY2hlSGl0KGNhY2hlSGl0OiBFbGVtZW50KTogdm9pZCB7XG4gICAgICAgIHdoaWxlIChjYWNoZUhpdC5jaGlsZE5vZGVzLmxlbmd0aCkge1xuICAgICAgICAgICAgdGhpcy5ob3N0RWxlbWVudC5uYXRpdmVFbGVtZW50LmFwcGVuZENoaWxkKGNhY2hlSGl0LmZpcnN0Q2hpbGQpO1xuICAgICAgICB9XG4gICAgfVxufVxuIl19 |
@@ -19,2 +19,3 @@ /** | ||
if (!RenderHtmlOnceComponent.enabled) { | ||
this.renderFromString(); | ||
return; | ||
@@ -25,8 +26,6 @@ } | ||
if (cacheHit) { | ||
while (cacheHit.childNodes.length) { | ||
this.hostElement.nativeElement.appendChild(cacheHit.firstChild); | ||
} | ||
this.renderFromCacheHit(cacheHit); | ||
} | ||
else { | ||
this.hostElement.nativeElement.innerHTML = this.htmlContent; | ||
this.renderFromString(); | ||
} | ||
@@ -82,2 +81,28 @@ RenderHtmlOnceComponent.alreadyRendered[this.id] = this.hostElement.nativeElement; | ||
}; | ||
/** | ||
* @private | ||
* @return {?} | ||
*/ | ||
RenderHtmlOnceComponent.prototype.renderFromString = /** | ||
* @private | ||
* @return {?} | ||
*/ | ||
function () { | ||
this.hostElement.nativeElement.innerHTML = this.htmlContent; | ||
}; | ||
/** | ||
* @private | ||
* @param {?} cacheHit | ||
* @return {?} | ||
*/ | ||
RenderHtmlOnceComponent.prototype.renderFromCacheHit = /** | ||
* @private | ||
* @param {?} cacheHit | ||
* @return {?} | ||
*/ | ||
function (cacheHit) { | ||
while (cacheHit.childNodes.length) { | ||
this.hostElement.nativeElement.appendChild(cacheHit.firstChild); | ||
} | ||
}; | ||
RenderHtmlOnceComponent.alreadyRendered = {}; | ||
@@ -123,2 +148,2 @@ RenderHtmlOnceComponent.enabled = true; | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVuZGVyLWh0bWwtb25jZS5jb21wb25lbnQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9hbmd1bGFyLXJlbmRlci1odG1sLW9uY2UvIiwic291cmNlcyI6WyJsaWIvcmVuZGVyLWh0bWwtb25jZS5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSxPQUFPLEVBQUMsU0FBUyxFQUFFLFVBQVUsRUFBRSxLQUFLLEVBQVMsTUFBTSxlQUFlLENBQUM7QUFFbkU7SUFXSSxpQ0FBMkIsV0FBZ0M7UUFBaEMsZ0JBQVcsR0FBWCxXQUFXLENBQXFCO0lBQUcsQ0FBQzs7OztJQUV4RCwwQ0FBUTs7O0lBQWY7UUFDSSxJQUFJLENBQUMsdUJBQXVCLENBQUMsT0FBTyxFQUFFO1lBQ2xDLE9BQU87U0FDVjs7WUFDSyxRQUFRLEdBQUcsdUJBQXVCLENBQUMsZUFBZSxDQUFDLElBQUksQ0FBQyxFQUFFLENBQUM7UUFDakUsSUFBSSxRQUFRLEVBQUU7WUFDVixPQUFPLFFBQVEsQ0FBQyxVQUFVLENBQUMsTUFBTSxFQUFFO2dCQUMvQixJQUFJLENBQUMsV0FBVyxDQUFDLGFBQWEsQ0FBQyxXQUFXLENBQUMsUUFBUSxDQUFDLFVBQVUsQ0FBQyxDQUFDO2FBQ25FO1NBQ0o7YUFBTTtZQUNILElBQUksQ0FBQyxXQUFXLENBQUMsYUFBYSxDQUFDLFNBQVMsR0FBRyxJQUFJLENBQUMsV0FBVyxDQUFDO1NBQy9EO1FBQ0QsdUJBQXVCLENBQUMsZUFBZSxDQUFDLElBQUksQ0FBQyxFQUFFLENBQUMsR0FBRyxJQUFJLENBQUMsV0FBVy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ZvaWQge1xuICAgICAgICB0aGlzLmhvc3RFbGVtZW50Lm5hdGl2ZUVsZW1lbnQuaW5uZXJIVE1MID0gdGhpcy5odG1sQ29udGVudDtcbiAgICB9XG5cbiAgICBwcml2YXRlIHJlbmRlckZyb21DYWNoZUhpdChjYWNoZUhpdDogRWxlbWVudCk6IHZvaWQge1xuICAgICAgICB3aGlsZSAoY2FjaGVIaXQuY2hpbGROb2Rlcy5sZW5ndGgpIHtcbiAgICAgICAgICAgIHRoaXMuaG9zdEVsZW1lbnQubmF0aXZlRWxlbWVudC5hcHBlbmRDaGlsZChjYWNoZUhpdC5maXJzdENoaWxkKTtcbiAgICAgICAgfVxuICAgIH1cbn1cbiJdfQ== |
@@ -20,2 +20,3 @@ import { Component, ElementRef, Input, NgModule } from '@angular/core'; | ||
if (!RenderHtmlOnceComponent.enabled) { | ||
this.renderFromString(); | ||
return; | ||
@@ -26,8 +27,6 @@ } | ||
if (cacheHit) { | ||
while (cacheHit.childNodes.length) { | ||
this.hostElement.nativeElement.appendChild(cacheHit.firstChild); | ||
} | ||
this.renderFromCacheHit(cacheHit); | ||
} | ||
else { | ||
this.hostElement.nativeElement.innerHTML = this.htmlContent; | ||
this.renderFromString(); | ||
} | ||
@@ -71,2 +70,19 @@ RenderHtmlOnceComponent.alreadyRendered[this.id] = this.hostElement.nativeElement; | ||
} | ||
/** | ||
* @private | ||
* @return {?} | ||
*/ | ||
renderFromString() { | ||
this.hostElement.nativeElement.innerHTML = this.htmlContent; | ||
} | ||
/** | ||
* @private | ||
* @param {?} cacheHit | ||
* @return {?} | ||
*/ | ||
renderFromCacheHit(cacheHit) { | ||
while (cacheHit.childNodes.length) { | ||
this.hostElement.nativeElement.appendChild(cacheHit.firstChild); | ||
} | ||
} | ||
} | ||
@@ -73,0 +89,0 @@ RenderHtmlOnceComponent.alreadyRendered = {}; |
@@ -20,2 +20,3 @@ import { Component, ElementRef, Input, NgModule } from '@angular/core'; | ||
if (!RenderHtmlOnceComponent.enabled) { | ||
this.renderFromString(); | ||
return; | ||
@@ -26,8 +27,6 @@ } | ||
if (cacheHit) { | ||
while (cacheHit.childNodes.length) { | ||
this.hostElement.nativeElement.appendChild(cacheHit.firstChild); | ||
} | ||
this.renderFromCacheHit(cacheHit); | ||
} | ||
else { | ||
this.hostElement.nativeElement.innerHTML = this.htmlContent; | ||
this.renderFromString(); | ||
} | ||
@@ -83,2 +82,28 @@ RenderHtmlOnceComponent.alreadyRendered[this.id] = this.hostElement.nativeElement; | ||
}; | ||
/** | ||
* @private | ||
* @return {?} | ||
*/ | ||
RenderHtmlOnceComponent.prototype.renderFromString = /** | ||
* @private | ||
* @return {?} | ||
*/ | ||
function () { | ||
this.hostElement.nativeElement.innerHTML = this.htmlContent; | ||
}; | ||
/** | ||
* @private | ||
* @param {?} cacheHit | ||
* @return {?} | ||
*/ | ||
RenderHtmlOnceComponent.prototype.renderFromCacheHit = /** | ||
* @private | ||
* @param {?} cacheHit | ||
* @return {?} | ||
*/ | ||
function (cacheHit) { | ||
while (cacheHit.childNodes.length) { | ||
this.hostElement.nativeElement.appendChild(cacheHit.firstChild); | ||
} | ||
}; | ||
RenderHtmlOnceComponent.alreadyRendered = {}; | ||
@@ -85,0 +110,0 @@ RenderHtmlOnceComponent.enabled = true; |
@@ -14,2 +14,4 @@ import { ElementRef, OnInit } from '@angular/core'; | ||
static disable(): void; | ||
private renderFromString; | ||
private renderFromCacheHit; | ||
} |
{ | ||
"name": "angular-render-html-once", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Anuglar helper component for HTML string that should be rendered once and maintaned later", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/bushee/angular-render-html-once", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
63461
858