lakutata 2.0.79 → 2.0.81
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/com/cacher.cjs +8 -10
- package/com/cacher.d.ts +83 -14
- package/com/cacher.mjs +8 -10
- package/com/database.cjs +11 -11
- package/com/database.mjs +11 -11
- package/com/docker.cjs +17 -19
- package/com/docker.d.ts +3 -141
- package/com/docker.mjs +13 -15
- package/com/entrypoint.cjs +7 -5
- package/com/entrypoint.mjs +7 -5
- package/com/logger.cjs +7 -7
- package/com/logger.mjs +7 -7
- package/com/monitor.cjs +5 -3
- package/com/monitor.mjs +5 -3
- package/decorator/ctrl.cjs +3 -3
- package/decorator/ctrl.mjs +3 -3
- package/decorator/orm.cjs +98 -98
- package/decorator/orm.mjs +142 -56
- package/helper.cjs +9 -11
- package/helper.mjs +5 -7
- package/lakutata.cjs +23 -30
- package/lakutata.mjs +14 -18
- package/orm.cjs +1423 -886
- package/orm.mjs +1474 -724
- package/package.json +1 -1
- package/provider/database.cjs +11 -11
- package/provider/database.mjs +11 -11
- package/provider/passwordHash.cjs +4 -2
- package/provider/passwordHash.mjs +4 -2
- package/src/components/Database.cjs +11 -11
- package/src/components/Database.mjs +11 -11
- package/src/components/Logger.cjs +7 -7
- package/src/components/Logger.mjs +7 -7
- package/src/components/cacher/Cacher.cjs +1178 -264
- package/src/components/cacher/Cacher.mjs +1087 -173
- package/src/components/cacher/adapters/CreateFileCacheAdapter.cjs +479 -2963
- package/src/components/cacher/adapters/CreateFileCacheAdapter.mjs +469 -2947
- package/src/components/docker/ConnectionOptionsBuilder.cjs +15 -17
- package/src/components/docker/ConnectionOptionsBuilder.mjs +13 -15
- package/src/components/docker/Docker.cjs +4884 -4945
- package/src/components/docker/Docker.mjs +4902 -4963
- package/src/components/docker/lib/DockerContainer.cjs +23 -25
- package/src/components/docker/lib/DockerContainer.mjs +17 -19
- package/src/components/docker/lib/DockerContainerTTY.cjs +9 -11
- package/src/components/docker/lib/DockerContainerTTY.mjs +9 -11
- package/src/components/docker/lib/DockerImage.cjs +4 -2
- package/src/components/docker/lib/DockerImage.mjs +4 -2
- package/src/components/entrypoint/Entrypoint.cjs +2170 -1678
- package/src/components/entrypoint/Entrypoint.mjs +2126 -1634
- package/src/components/entrypoint/lib/AccessControl.cjs +4 -2
- package/src/components/entrypoint/lib/AccessControl.mjs +4 -2
- package/src/components/entrypoint/lib/AccessControlRule.cjs +4 -2
- package/src/components/entrypoint/lib/AccessControlRule.mjs +4 -2
- package/src/components/entrypoint/lib/Controller.cjs +4 -2
- package/src/components/entrypoint/lib/Controller.mjs +4 -2
- package/src/components/monitor/AliveMonitor.cjs +4 -2
- package/src/components/monitor/AliveMonitor.mjs +4 -2
- package/src/components/monitor/CpuMonitor.cjs +5 -3
- package/src/components/monitor/CpuMonitor.mjs +5 -3
- package/src/components/monitor/EventLoopMonitor.cjs +4 -2
- package/src/components/monitor/EventLoopMonitor.mjs +4 -2
- package/src/components/monitor/HttpRequestMonitor.cjs +5 -3
- package/src/components/monitor/HttpRequestMonitor.mjs +5 -3
- package/src/components/monitor/MemoryMonitor.cjs +5 -3
- package/src/components/monitor/MemoryMonitor.mjs +5 -3
- package/src/decorators/ctrl/CLIAction.cjs +3 -3
- package/src/decorators/ctrl/CLIAction.mjs +3 -3
- package/src/decorators/ctrl/HTTPAction.cjs +3 -3
- package/src/decorators/ctrl/HTTPAction.mjs +3 -3
- package/src/decorators/ctrl/ServiceAction.cjs +3 -3
- package/src/decorators/ctrl/ServiceAction.mjs +3 -3
- package/src/decorators/ctrl/http/DELETE.cjs +3 -3
- package/src/decorators/ctrl/http/DELETE.mjs +3 -3
- package/src/decorators/ctrl/http/GET.cjs +3 -3
- package/src/decorators/ctrl/http/GET.mjs +3 -3
- package/src/decorators/ctrl/http/HEAD.cjs +3 -3
- package/src/decorators/ctrl/http/HEAD.mjs +3 -3
- package/src/decorators/ctrl/http/OPTIONS.cjs +3 -3
- package/src/decorators/ctrl/http/OPTIONS.mjs +3 -3
- package/src/decorators/ctrl/http/PATCH.cjs +3 -3
- package/src/decorators/ctrl/http/PATCH.mjs +3 -3
- package/src/decorators/ctrl/http/POST.cjs +3 -3
- package/src/decorators/ctrl/http/POST.mjs +3 -3
- package/src/decorators/ctrl/http/PUT.cjs +3 -3
- package/src/decorators/ctrl/http/PUT.mjs +3 -3
- package/src/decorators/orm/AfterInsert.cjs +17 -39
- package/src/decorators/orm/AfterInsert.mjs +18 -38
- package/src/decorators/orm/AfterLoad.cjs +17 -39
- package/src/decorators/orm/AfterLoad.mjs +18 -38
- package/src/decorators/orm/AfterRecover.cjs +17 -39
- package/src/decorators/orm/AfterRecover.mjs +18 -38
- package/src/decorators/orm/AfterRemove.cjs +17 -39
- package/src/decorators/orm/AfterRemove.mjs +18 -38
- package/src/decorators/orm/AfterSoftRemove.cjs +17 -39
- package/src/decorators/orm/AfterSoftRemove.mjs +18 -38
- package/src/decorators/orm/AfterUpdate.cjs +17 -39
- package/src/decorators/orm/AfterUpdate.mjs +18 -38
- package/src/decorators/orm/BeforeInsert.cjs +17 -39
- package/src/decorators/orm/BeforeInsert.mjs +18 -38
- package/src/decorators/orm/BeforeRecover.cjs +17 -39
- package/src/decorators/orm/BeforeRecover.mjs +18 -38
- package/src/decorators/orm/BeforeRemove.cjs +17 -39
- package/src/decorators/orm/BeforeRemove.mjs +18 -38
- package/src/decorators/orm/BeforeSoftRemove.cjs +17 -39
- package/src/decorators/orm/BeforeSoftRemove.mjs +18 -38
- package/src/decorators/orm/BeforeUpdate.cjs +17 -39
- package/src/decorators/orm/BeforeUpdate.mjs +18 -38
- package/src/decorators/orm/Check.cjs +17 -42
- package/src/decorators/orm/Check.mjs +18 -41
- package/src/decorators/orm/ChildEntity.cjs +17 -42
- package/src/decorators/orm/ChildEntity.mjs +18 -41
- package/src/decorators/orm/Column.cjs +17 -74
- package/src/decorators/orm/Column.mjs +19 -74
- package/src/decorators/orm/CreateDateColumn.cjs +17 -38
- package/src/decorators/orm/CreateDateColumn.mjs +18 -37
- package/src/decorators/orm/DeleteDateColumn.cjs +17 -38
- package/src/decorators/orm/DeleteDateColumn.mjs +17 -36
- package/src/decorators/orm/Entity.cjs +17 -48
- package/src/decorators/orm/Entity.mjs +17 -46
- package/src/decorators/orm/EventSubscriber.cjs +17 -35
- package/src/decorators/orm/EventSubscriber.mjs +18 -34
- package/src/decorators/orm/Exclusion.cjs +17 -42
- package/src/decorators/orm/Exclusion.mjs +18 -41
- package/src/decorators/orm/Generated.cjs +17 -37
- package/src/decorators/orm/Generated.mjs +18 -36
- package/src/decorators/orm/Index.cjs +17 -54
- package/src/decorators/orm/Index.mjs +19 -54
- package/src/decorators/orm/JoinColumn.cjs +17 -42
- package/src/decorators/orm/JoinColumn.mjs +18 -41
- package/src/decorators/orm/JoinTable.cjs +17 -43
- package/src/decorators/orm/JoinTable.mjs +17 -41
- package/src/decorators/orm/ManyToMany.cjs +17 -55
- package/src/decorators/orm/ManyToMany.mjs +17 -53
- package/src/decorators/orm/ManyToOne.cjs +17 -55
- package/src/decorators/orm/ManyToOne.mjs +17 -53
- package/src/decorators/orm/ObjectIdColumn.cjs +17 -41
- package/src/decorators/orm/ObjectIdColumn.mjs +18 -40
- package/src/decorators/orm/OneToMany.cjs +17 -47
- package/src/decorators/orm/OneToMany.mjs +19 -47
- package/src/decorators/orm/OneToOne.cjs +17 -55
- package/src/decorators/orm/OneToOne.mjs +17 -53
- package/src/decorators/orm/PrimaryColumn.cjs +17 -62
- package/src/decorators/orm/PrimaryColumn.mjs +19 -62
- package/src/decorators/orm/PrimaryGeneratedColumn.cjs +17 -67
- package/src/decorators/orm/PrimaryGeneratedColumn.mjs +19 -67
- package/src/decorators/orm/RelationId.cjs +17 -39
- package/src/decorators/orm/RelationId.mjs +18 -38
- package/src/decorators/orm/TableInheritance.cjs +17 -39
- package/src/decorators/orm/TableInheritance.mjs +18 -38
- package/src/decorators/orm/Tree.cjs +17 -37
- package/src/decorators/orm/Tree.mjs +18 -36
- package/src/decorators/orm/TreeChildren.cjs +17 -44
- package/src/decorators/orm/TreeChildren.mjs +17 -42
- package/src/decorators/orm/TreeLevelColumn.cjs +17 -38
- package/src/decorators/orm/TreeLevelColumn.mjs +17 -36
- package/src/decorators/orm/TreeParent.cjs +17 -44
- package/src/decorators/orm/TreeParent.mjs +17 -42
- package/src/decorators/orm/Unique.cjs +17 -57
- package/src/decorators/orm/Unique.mjs +19 -57
- package/src/decorators/orm/UpdateDateColumn.cjs +17 -38
- package/src/decorators/orm/UpdateDateColumn.mjs +18 -37
- package/src/decorators/orm/VersionColumn.cjs +17 -38
- package/src/decorators/orm/VersionColumn.mjs +18 -37
- package/src/decorators/orm/ViewColumn.cjs +17 -38
- package/src/decorators/orm/ViewColumn.mjs +18 -37
- package/src/decorators/orm/ViewEntity.cjs +17 -47
- package/src/decorators/orm/ViewEntity.mjs +18 -46
- package/src/decorators/orm/VirtualColumn.cjs +17 -55
- package/src/decorators/orm/VirtualColumn.mjs +17 -53
- package/src/lib/base/BaseObject.cjs +4 -2
- package/src/lib/base/BaseObject.mjs +4 -2
- package/src/lib/base/EventEmitter.cjs +1200 -1193
- package/src/lib/base/EventEmitter.mjs +1201 -1194
- package/src/lib/base/internal/ApplicationConfigLoader.cjs +4 -2
- package/src/lib/base/internal/ApplicationConfigLoader.mjs +4 -2
- package/src/lib/base/internal/ControllerEntrypoint.cjs +3 -3
- package/src/lib/base/internal/ControllerEntrypoint.mjs +3 -3
- package/src/lib/base/internal/DataValidator.cjs +176 -179
- package/src/lib/base/internal/DataValidator.mjs +177 -180
- package/src/lib/base/internal/ModuleConfigLoader.cjs +4 -3
- package/src/lib/base/internal/ModuleConfigLoader.mjs +4 -3
- package/src/lib/base/internal/ObjectType.cjs +4 -2
- package/src/lib/base/internal/ObjectType.mjs +4 -2
- package/src/lib/base/internal/PatternManager.cjs +740 -735
- package/src/lib/base/internal/PatternManager.mjs +745 -740
- package/src/lib/base/internal/StringifyPattern.cjs +1 -1
- package/src/lib/base/internal/StringifyPattern.mjs +1 -1
- package/src/lib/core/Application.cjs +154 -146
- package/src/lib/core/Application.mjs +203 -197
- package/src/lib/core/Component.cjs +4 -2
- package/src/lib/core/Component.mjs +4 -2
- package/src/lib/core/Container.cjs +4 -2
- package/src/lib/core/Container.mjs +4 -2
- package/src/lib/core/Module.cjs +5 -3
- package/src/lib/core/Module.mjs +5 -3
- package/src/lib/core/Provider.cjs +4 -2
- package/src/lib/core/Provider.mjs +4 -2
- package/src/lib/helpers/Glob.cjs +970 -721
- package/src/lib/helpers/Glob.mjs +1036 -787
- package/src/lib/helpers/IsHtml.cjs +7 -13
- package/src/lib/helpers/IsHtml.mjs +7 -13
- package/src/lib/helpers/IsXML.cjs +1158 -1016
- package/src/lib/helpers/IsXML.mjs +871 -729
- package/src/lib/helpers/MD5.cjs +1 -1
- package/src/lib/helpers/MD5.mjs +1 -1
- package/src/lib/helpers/NonceStr.cjs +1 -1
- package/src/lib/helpers/NonceStr.mjs +1 -1
- package/src/lib/helpers/ObjectHash.cjs +379 -372
- package/src/lib/helpers/ObjectHash.mjs +379 -372
- package/src/lib/helpers/RandomString.cjs +168 -147
- package/src/lib/helpers/RandomString.mjs +167 -146
- package/src/lib/helpers/SHA1.cjs +1 -1
- package/src/lib/helpers/SHA1.mjs +1 -1
- package/src/lib/helpers/SHA256.cjs +1 -1
- package/src/lib/helpers/SHA256.mjs +1 -1
- package/src/lib/helpers/SortArray.cjs +1 -1
- package/src/lib/helpers/SortArray.mjs +1 -1
- package/src/lib/helpers/Statistics.cjs +1 -1
- package/src/lib/helpers/Statistics.mjs +1 -1
- package/src/lib/helpers/URLBuilder.cjs +355 -355
- package/src/lib/helpers/URLBuilder.mjs +350 -350
- package/src/lib/helpers/UUID.cjs +1 -1
- package/src/lib/helpers/UUID.mjs +1 -1
- package/src/lib/ioc/DependencyInjectionContainer.cjs +32 -30
- package/src/lib/ioc/DependencyInjectionContainer.mjs +12 -10
- package/src/lib/ioc/ListModules.cjs +5174 -5249
- package/src/lib/ioc/ListModules.mjs +5177 -5252
- package/src/lib/validation/VLD.cjs +4080 -3902
- package/src/lib/validation/VLD.mjs +2970 -2792
- package/src/options/ApplicationOptions.cjs +4 -2
- package/src/options/ApplicationOptions.mjs +4 -2
- package/src/options/LoadAnonymousObjectOptions.cjs +4 -2
- package/src/options/LoadAnonymousObjectOptions.mjs +4 -2
- package/src/options/LoadNamedObjectOptions.cjs +4 -2
- package/src/options/LoadNamedObjectOptions.mjs +4 -2
- package/src/options/LoadObjectOptions.cjs +4 -2
- package/src/options/LoadObjectOptions.mjs +4 -2
- package/src/options/ModuleLoadObjectsOptions.cjs +4 -2
- package/src/options/ModuleLoadObjectsOptions.mjs +4 -2
- package/src/options/ModuleOptions.cjs +4 -4
- package/src/options/ModuleOptions.mjs +4 -4
- package/src/options/OverridableNamedObjectOptions.cjs +4 -2
- package/src/options/OverridableNamedObjectOptions.mjs +4 -2
- package/src/options/OverridableObjectOptions.cjs +4 -2
- package/src/options/OverridableObjectOptions.mjs +4 -2
- package/src/providers/Database.cjs +11 -11
- package/src/providers/Database.mjs +11 -11
- package/src/providers/PasswordHash.cjs +5 -3
- package/src/providers/PasswordHash.mjs +190 -188
- package/src/providers/migration/GenerateMigration.cjs +15 -19
- package/src/providers/migration/GenerateMigration.mjs +15 -19
- package/vendor/Package.10.cjs +2 -8
- package/vendor/Package.10.mjs +2 -8
- package/vendor/Package.11.cjs +5 -83
- package/vendor/Package.11.mjs +5 -77
- package/vendor/Package.112.cjs +48900 -0
- package/vendor/Package.112.mjs +48764 -0
- package/vendor/Package.12.cjs +4 -2
- package/vendor/Package.12.mjs +6 -4
- package/vendor/Package.13.cjs +87 -1
- package/vendor/Package.13.mjs +81 -1
- package/vendor/Package.14.cjs +1 -14057
- package/vendor/Package.14.mjs +1 -14031
- package/vendor/Package.15.cjs +1 -1
- package/vendor/Package.15.mjs +1 -1
- package/vendor/Package.16.cjs +18129 -1935
- package/vendor/Package.16.mjs +18115 -1839
- package/vendor/Package.17.cjs +1922 -47929
- package/vendor/Package.17.mjs +1874 -47948
- package/vendor/Package.18.cjs +35 -1
- package/vendor/Package.18.mjs +35 -1
- package/vendor/Package.19.cjs +37 -0
- package/vendor/Package.19.mjs +35 -0
- package/vendor/Package.2.cjs +5739 -5710
- package/vendor/Package.2.mjs +5733 -5704
- package/vendor/Package.20.cjs +37 -0
- package/vendor/Package.20.mjs +35 -0
- package/vendor/Package.21.cjs +37 -0
- package/vendor/Package.21.mjs +35 -0
- package/vendor/Package.22.cjs +37 -0
- package/vendor/Package.22.mjs +35 -0
- package/vendor/Package.23.cjs +37 -0
- package/vendor/Package.23.mjs +35 -0
- package/vendor/Package.24.cjs +37 -0
- package/vendor/Package.24.mjs +35 -0
- package/vendor/Package.25.cjs +37 -0
- package/vendor/Package.25.mjs +35 -0
- package/vendor/Package.26.cjs +37 -0
- package/vendor/Package.26.mjs +35 -0
- package/vendor/Package.27.cjs +37 -0
- package/vendor/Package.27.mjs +35 -0
- package/vendor/Package.28.cjs +37 -0
- package/vendor/Package.28.mjs +35 -0
- package/vendor/Package.29.cjs +40 -0
- package/vendor/Package.29.mjs +38 -0
- package/vendor/Package.30.cjs +41 -0
- package/vendor/Package.30.mjs +39 -0
- package/vendor/Package.31.cjs +72 -0
- package/vendor/Package.31.mjs +70 -0
- package/vendor/Package.32.cjs +37 -0
- package/vendor/Package.32.mjs +35 -0
- package/vendor/Package.33.cjs +37 -0
- package/vendor/Package.33.mjs +35 -0
- package/vendor/Package.34.cjs +46 -0
- package/vendor/Package.34.mjs +44 -0
- package/vendor/Package.35.cjs +34 -0
- package/vendor/Package.35.mjs +32 -0
- package/vendor/Package.36.cjs +40 -0
- package/vendor/Package.36.mjs +38 -0
- package/vendor/Package.37.cjs +36 -0
- package/vendor/Package.37.mjs +34 -0
- package/vendor/Package.38.cjs +52 -0
- package/vendor/Package.38.mjs +50 -0
- package/vendor/Package.39.cjs +41 -0
- package/vendor/Package.39.mjs +39 -0
- package/vendor/Package.4.cjs +884 -874
- package/vendor/Package.4.mjs +884 -874
- package/vendor/Package.40.cjs +42 -0
- package/vendor/Package.40.mjs +40 -0
- package/vendor/Package.41.cjs +53 -0
- package/vendor/Package.41.mjs +51 -0
- package/vendor/Package.42.cjs +53 -0
- package/vendor/Package.42.mjs +51 -0
- package/vendor/Package.43.cjs +40 -0
- package/vendor/Package.43.mjs +38 -0
- package/vendor/Package.44.cjs +46 -0
- package/vendor/Package.44.mjs +44 -0
- package/vendor/Package.45.cjs +53 -0
- package/vendor/Package.45.mjs +51 -0
- package/vendor/Package.46.cjs +59 -0
- package/vendor/Package.46.mjs +57 -0
- package/vendor/Package.47.cjs +65 -0
- package/vendor/Package.47.mjs +63 -0
- package/vendor/Package.48.cjs +38 -0
- package/vendor/Package.48.mjs +36 -0
- package/vendor/Package.49.cjs +38 -0
- package/vendor/Package.49.mjs +36 -0
- package/vendor/Package.5.cjs +15 -11
- package/vendor/Package.5.mjs +11 -7
- package/vendor/Package.50.cjs +36 -0
- package/vendor/Package.50.mjs +34 -0
- package/vendor/Package.51.cjs +43 -0
- package/vendor/Package.51.mjs +41 -0
- package/vendor/Package.52.cjs +37 -0
- package/vendor/Package.52.mjs +35 -0
- package/vendor/Package.53.cjs +43 -0
- package/vendor/Package.53.mjs +41 -0
- package/vendor/Package.54.cjs +55 -0
- package/vendor/Package.54.mjs +53 -0
- package/vendor/Package.55.cjs +37 -0
- package/vendor/Package.55.mjs +35 -0
- package/vendor/Package.56.cjs +37 -0
- package/vendor/Package.56.mjs +35 -0
- package/vendor/Package.57.cjs +37 -0
- package/vendor/Package.57.mjs +35 -0
- package/vendor/Package.58.cjs +45 -0
- package/vendor/Package.58.mjs +43 -0
- package/vendor/Package.59.cjs +53 -0
- package/vendor/Package.59.mjs +51 -0
- package/vendor/Package.6.cjs +520 -511
- package/vendor/Package.6.mjs +543 -534
- package/vendor/Package.60.cjs +47649 -0
- package/vendor/Package.60.mjs +47606 -0
- package/vendor/Package.610.cjs +11 -11
- package/vendor/Package.610.mjs +11 -11
- package/vendor/Package.611.cjs +33 -23
- package/vendor/Package.611.mjs +19 -9
- package/vendor/Package.612.cjs +42 -36
- package/vendor/Package.612.mjs +35 -29
- package/vendor/Package.613.cjs +5 -4
- package/vendor/Package.613.mjs +5 -4
- package/vendor/Package.62.cjs +92 -89
- package/vendor/Package.62.mjs +185 -182
- package/vendor/Package.63.cjs +509 -166
- package/vendor/Package.63.mjs +490 -165
- package/vendor/Package.64.cjs +139 -511
- package/vendor/Package.64.mjs +139 -491
- package/vendor/Package.65.cjs +4135 -150
- package/vendor/Package.65.mjs +4143 -150
- package/vendor/Package.66.cjs +346 -4150
- package/vendor/Package.66.mjs +346 -4158
- package/vendor/Package.67.cjs +412 -261
- package/vendor/Package.67.mjs +410 -259
- package/vendor/Package.68.cjs +397 -405
- package/vendor/Package.68.mjs +227 -242
- package/vendor/Package.8.cjs +0 -4
- package/vendor/Package.8.mjs +0 -4
- package/vendor/Package.9.cjs +132 -118
- package/vendor/Package.9.mjs +138 -124
- package/vendor/TypeDef.internal.3.d.ts +0 -4
- package/vendor/Package.102.cjs +0 -48773
- package/vendor/Package.102.mjs +0 -48697
- package/vendor/Package.122.cjs +0 -3
- package/vendor/Package.122.mjs +0 -1
|
@@ -4,390 +4,383 @@ Object.defineProperty(exports, Symbol.toStringTag, {
|
|
|
4
4
|
value: "Module"
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const i =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
for (let t = 0; t < r; t++) {
|
|
27
|
-
i.push(s[t]);
|
|
28
|
-
}
|
|
29
|
-
n.push(i);
|
|
30
|
-
s = e.exec(t);
|
|
7
|
+
"use strict";
|
|
8
|
+
|
|
9
|
+
const e = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
|
|
10
|
+
|
|
11
|
+
const t = e + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
|
|
12
|
+
|
|
13
|
+
const i = "[" + e + "][" + t + "]*";
|
|
14
|
+
|
|
15
|
+
const n = new RegExp("^" + i + "$");
|
|
16
|
+
|
|
17
|
+
function s(e, t) {
|
|
18
|
+
const i = [];
|
|
19
|
+
let n = t.exec(e);
|
|
20
|
+
while (n) {
|
|
21
|
+
const s = [];
|
|
22
|
+
s.startIndex = t.lastIndex - n[0].length;
|
|
23
|
+
const r = n.length;
|
|
24
|
+
for (let e = 0; e < r; e++) {
|
|
25
|
+
s.push(n[e]);
|
|
31
26
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
27
|
+
i.push(s);
|
|
28
|
+
n = t.exec(e);
|
|
29
|
+
}
|
|
30
|
+
return i;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const r = function(e) {
|
|
34
|
+
const t = n.exec(e);
|
|
35
|
+
return !(t === null || typeof t === "undefined");
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
function o(e) {
|
|
39
|
+
return typeof e !== "undefined";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function a(e) {
|
|
43
|
+
return Object.keys(e).length === 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function l(e, t, i) {
|
|
47
|
+
if (t) {
|
|
48
|
+
const n = Object.keys(t);
|
|
49
|
+
const s = n.length;
|
|
50
|
+
for (let r = 0; r < s; r++) {
|
|
51
|
+
if (i === "strict") {
|
|
52
|
+
e[n[r]] = [ t[n[r]] ];
|
|
53
|
+
} else {
|
|
54
|
+
e[n[r]] = t[n[r]];
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (t.isExist(e)) {
|
|
59
|
-
return e;
|
|
60
|
-
} else {
|
|
61
|
-
return "";
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
t.isName = o;
|
|
65
|
-
t.getAllMatches = r;
|
|
66
|
-
t.nameRegexp = s;
|
|
67
|
-
})(n);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
68
59
|
|
|
69
|
-
|
|
60
|
+
function u(e) {
|
|
61
|
+
if (exports.isExist(e)) {
|
|
62
|
+
return e;
|
|
63
|
+
} else {
|
|
64
|
+
return "";
|
|
65
|
+
}
|
|
66
|
+
}
|
|
70
67
|
|
|
71
68
|
"use strict";
|
|
72
69
|
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
const r = {
|
|
70
|
+
const f = {
|
|
76
71
|
allowBooleanAttributes: false,
|
|
77
72
|
unpairedTags: []
|
|
78
73
|
};
|
|
79
74
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const
|
|
75
|
+
function d(e, t) {
|
|
76
|
+
t = Object.assign({}, f, t);
|
|
77
|
+
const i = [];
|
|
78
|
+
let n = false;
|
|
83
79
|
let s = false;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
t = t.substr(1);
|
|
80
|
+
if (e[0] === "\ufeff") {
|
|
81
|
+
e = e.substr(1);
|
|
87
82
|
}
|
|
88
|
-
for (let r = 0; r <
|
|
89
|
-
if (
|
|
83
|
+
for (let r = 0; r < e.length; r++) {
|
|
84
|
+
if (e[r] === "<" && e[r + 1] === "?") {
|
|
90
85
|
r += 2;
|
|
91
|
-
r =
|
|
86
|
+
r = c(e, r);
|
|
92
87
|
if (r.err) return r;
|
|
93
|
-
} else if (
|
|
88
|
+
} else if (e[r] === "<") {
|
|
94
89
|
let o = r;
|
|
95
90
|
r++;
|
|
96
|
-
if (
|
|
97
|
-
r =
|
|
91
|
+
if (e[r] === "!") {
|
|
92
|
+
r = p(e, r);
|
|
98
93
|
continue;
|
|
99
94
|
} else {
|
|
100
|
-
let
|
|
101
|
-
if (
|
|
102
|
-
|
|
95
|
+
let a = false;
|
|
96
|
+
if (e[r] === "/") {
|
|
97
|
+
a = true;
|
|
103
98
|
r++;
|
|
104
99
|
}
|
|
105
|
-
let
|
|
106
|
-
for (;r <
|
|
107
|
-
|
|
100
|
+
let l = "";
|
|
101
|
+
for (;r < e.length && e[r] !== ">" && e[r] !== " " && e[r] !== "\t" && e[r] !== "\n" && e[r] !== "\r"; r++) {
|
|
102
|
+
l += e[r];
|
|
108
103
|
}
|
|
109
|
-
|
|
110
|
-
if (
|
|
111
|
-
|
|
104
|
+
l = l.trim();
|
|
105
|
+
if (l[l.length - 1] === "/") {
|
|
106
|
+
l = l.substring(0, l.length - 1);
|
|
112
107
|
r--;
|
|
113
108
|
}
|
|
114
|
-
if (!
|
|
115
|
-
let
|
|
116
|
-
if (
|
|
117
|
-
|
|
109
|
+
if (!I(l)) {
|
|
110
|
+
let t;
|
|
111
|
+
if (l.trim().length === 0) {
|
|
112
|
+
t = "Invalid space after '<'.";
|
|
118
113
|
} else {
|
|
119
|
-
|
|
114
|
+
t = "Tag '" + l + "' is an invalid name.";
|
|
120
115
|
}
|
|
121
|
-
return
|
|
116
|
+
return T("InvalidTag", t, v(e, r));
|
|
122
117
|
}
|
|
123
|
-
const
|
|
124
|
-
if (
|
|
125
|
-
return
|
|
118
|
+
const u = x(e, r);
|
|
119
|
+
if (u === false) {
|
|
120
|
+
return T("InvalidAttr", "Attributes for '" + l + "' have open quote.", v(e, r));
|
|
126
121
|
}
|
|
127
|
-
let
|
|
128
|
-
r =
|
|
129
|
-
if (
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
const
|
|
133
|
-
if (
|
|
134
|
-
|
|
122
|
+
let f = u.value;
|
|
123
|
+
r = u.index;
|
|
124
|
+
if (f[f.length - 1] === "/") {
|
|
125
|
+
const i = r - f.length;
|
|
126
|
+
f = f.substring(0, f.length - 1);
|
|
127
|
+
const s = b(f, t);
|
|
128
|
+
if (s === true) {
|
|
129
|
+
n = true;
|
|
135
130
|
} else {
|
|
136
|
-
return
|
|
131
|
+
return T(s.err.code, s.err.msg, v(e, i + s.err.line));
|
|
137
132
|
}
|
|
138
|
-
} else if (
|
|
139
|
-
if (!
|
|
140
|
-
return
|
|
141
|
-
} else if (
|
|
142
|
-
return
|
|
143
|
-
} else if (
|
|
144
|
-
return
|
|
133
|
+
} else if (a) {
|
|
134
|
+
if (!u.tagClosed) {
|
|
135
|
+
return T("InvalidTag", "Closing tag '" + l + "' doesn't have proper closing.", v(e, r));
|
|
136
|
+
} else if (f.trim().length > 0) {
|
|
137
|
+
return T("InvalidTag", "Closing tag '" + l + "' can't have attributes or invalid starting.", v(e, o));
|
|
138
|
+
} else if (i.length === 0) {
|
|
139
|
+
return T("InvalidTag", "Closing tag '" + l + "' has not been opened.", v(e, o));
|
|
145
140
|
} else {
|
|
146
|
-
const
|
|
147
|
-
if (
|
|
148
|
-
let
|
|
149
|
-
return
|
|
141
|
+
const t = i.pop();
|
|
142
|
+
if (l !== t.tagName) {
|
|
143
|
+
let i = v(e, t.tagStartPos);
|
|
144
|
+
return T("InvalidTag", "Expected closing tag '" + t.tagName + "' (opened in line " + i.line + ", col " + i.col + ") instead of closing tag '" + l + "'.", v(e, o));
|
|
150
145
|
}
|
|
151
|
-
if (
|
|
152
|
-
|
|
146
|
+
if (i.length == 0) {
|
|
147
|
+
s = true;
|
|
153
148
|
}
|
|
154
149
|
}
|
|
155
150
|
} else {
|
|
156
|
-
const a =
|
|
151
|
+
const a = b(f, t);
|
|
157
152
|
if (a !== true) {
|
|
158
|
-
return
|
|
153
|
+
return T(a.err.code, a.err.msg, v(e, r - f.length + a.err.line));
|
|
159
154
|
}
|
|
160
|
-
if (
|
|
161
|
-
return
|
|
162
|
-
} else if (
|
|
163
|
-
|
|
164
|
-
tagName:
|
|
155
|
+
if (s === true) {
|
|
156
|
+
return T("InvalidXml", "Multiple possible root nodes found.", v(e, r));
|
|
157
|
+
} else if (t.unpairedTags.indexOf(l) !== -1) {} else {
|
|
158
|
+
i.push({
|
|
159
|
+
tagName: l,
|
|
165
160
|
tagStartPos: o
|
|
166
161
|
});
|
|
167
162
|
}
|
|
168
|
-
|
|
163
|
+
n = true;
|
|
169
164
|
}
|
|
170
|
-
for (r++; r <
|
|
171
|
-
if (
|
|
172
|
-
if (
|
|
165
|
+
for (r++; r < e.length; r++) {
|
|
166
|
+
if (e[r] === "<") {
|
|
167
|
+
if (e[r + 1] === "!") {
|
|
173
168
|
r++;
|
|
174
|
-
r =
|
|
169
|
+
r = p(e, r);
|
|
175
170
|
continue;
|
|
176
|
-
} else if (
|
|
177
|
-
r =
|
|
171
|
+
} else if (e[r + 1] === "?") {
|
|
172
|
+
r = c(e, ++r);
|
|
178
173
|
if (r.err) return r;
|
|
179
174
|
} else {
|
|
180
175
|
break;
|
|
181
176
|
}
|
|
182
|
-
} else if (
|
|
183
|
-
const
|
|
184
|
-
if (
|
|
185
|
-
r =
|
|
177
|
+
} else if (e[r] === "&") {
|
|
178
|
+
const t = w(e, r);
|
|
179
|
+
if (t == -1) return T("InvalidChar", "char '&' is not expected.", v(e, r));
|
|
180
|
+
r = t;
|
|
186
181
|
} else {
|
|
187
|
-
if (
|
|
188
|
-
return
|
|
182
|
+
if (s === true && !h(e[r])) {
|
|
183
|
+
return T("InvalidXml", "Extra text at the end", v(e, r));
|
|
189
184
|
}
|
|
190
185
|
}
|
|
191
186
|
}
|
|
192
|
-
if (
|
|
187
|
+
if (e[r] === "<") {
|
|
193
188
|
r--;
|
|
194
189
|
}
|
|
195
190
|
}
|
|
196
191
|
} else {
|
|
197
|
-
if (
|
|
192
|
+
if (h(e[r])) {
|
|
198
193
|
continue;
|
|
199
194
|
}
|
|
200
|
-
return
|
|
195
|
+
return T("InvalidChar", "char '" + e[r] + "' is not expected.", v(e, r));
|
|
201
196
|
}
|
|
202
197
|
}
|
|
203
|
-
if (!
|
|
204
|
-
return
|
|
205
|
-
} else if (
|
|
206
|
-
return
|
|
207
|
-
} else if (
|
|
208
|
-
return
|
|
198
|
+
if (!n) {
|
|
199
|
+
return T("InvalidXml", "Start tag expected.", 1);
|
|
200
|
+
} else if (i.length == 1) {
|
|
201
|
+
return T("InvalidTag", "Unclosed tag '" + i[0].tagName + "'.", v(e, i[0].tagStartPos));
|
|
202
|
+
} else if (i.length > 0) {
|
|
203
|
+
return T("InvalidXml", "Invalid '" + JSON.stringify(i.map((e => e.tagName)), null, 4).replace(/\r?\n/g, "") + "' found.", {
|
|
209
204
|
line: 1,
|
|
210
205
|
col: 1
|
|
211
206
|
});
|
|
212
207
|
}
|
|
213
208
|
return true;
|
|
214
|
-
}
|
|
209
|
+
}
|
|
215
210
|
|
|
216
|
-
function
|
|
217
|
-
return
|
|
211
|
+
function h(e) {
|
|
212
|
+
return e === " " || e === "\t" || e === "\n" || e === "\r";
|
|
218
213
|
}
|
|
219
214
|
|
|
220
|
-
function
|
|
221
|
-
const
|
|
222
|
-
for (;
|
|
223
|
-
if (t
|
|
224
|
-
const
|
|
225
|
-
if (
|
|
226
|
-
return
|
|
227
|
-
} else if (t
|
|
228
|
-
|
|
215
|
+
function c(e, t) {
|
|
216
|
+
const i = t;
|
|
217
|
+
for (;t < e.length; t++) {
|
|
218
|
+
if (e[t] == "?" || e[t] == " ") {
|
|
219
|
+
const n = e.substr(i, t - i);
|
|
220
|
+
if (t > 5 && n === "xml") {
|
|
221
|
+
return T("InvalidXml", "XML declaration allowed only at the start of the document.", v(e, t));
|
|
222
|
+
} else if (e[t] == "?" && e[t + 1] == ">") {
|
|
223
|
+
t++;
|
|
229
224
|
break;
|
|
230
225
|
} else {
|
|
231
226
|
continue;
|
|
232
227
|
}
|
|
233
228
|
}
|
|
234
229
|
}
|
|
235
|
-
return
|
|
230
|
+
return t;
|
|
236
231
|
}
|
|
237
232
|
|
|
238
|
-
function
|
|
239
|
-
if (
|
|
240
|
-
for (
|
|
241
|
-
if (t
|
|
242
|
-
|
|
233
|
+
function p(e, t) {
|
|
234
|
+
if (e.length > t + 5 && e[t + 1] === "-" && e[t + 2] === "-") {
|
|
235
|
+
for (t += 3; t < e.length; t++) {
|
|
236
|
+
if (e[t] === "-" && e[t + 1] === "-" && e[t + 2] === ">") {
|
|
237
|
+
t += 2;
|
|
243
238
|
break;
|
|
244
239
|
}
|
|
245
240
|
}
|
|
246
|
-
} else if (
|
|
247
|
-
let
|
|
248
|
-
for (
|
|
249
|
-
if (t
|
|
250
|
-
|
|
251
|
-
} else if (t
|
|
252
|
-
|
|
253
|
-
if (
|
|
241
|
+
} else if (e.length > t + 8 && e[t + 1] === "D" && e[t + 2] === "O" && e[t + 3] === "C" && e[t + 4] === "T" && e[t + 5] === "Y" && e[t + 6] === "P" && e[t + 7] === "E") {
|
|
242
|
+
let i = 1;
|
|
243
|
+
for (t += 8; t < e.length; t++) {
|
|
244
|
+
if (e[t] === "<") {
|
|
245
|
+
i++;
|
|
246
|
+
} else if (e[t] === ">") {
|
|
247
|
+
i--;
|
|
248
|
+
if (i === 0) {
|
|
254
249
|
break;
|
|
255
250
|
}
|
|
256
251
|
}
|
|
257
252
|
}
|
|
258
|
-
} else if (
|
|
259
|
-
for (
|
|
260
|
-
if (t
|
|
261
|
-
|
|
253
|
+
} else if (e.length > t + 9 && e[t + 1] === "[" && e[t + 2] === "C" && e[t + 3] === "D" && e[t + 4] === "A" && e[t + 5] === "T" && e[t + 6] === "A" && e[t + 7] === "[") {
|
|
254
|
+
for (t += 8; t < e.length; t++) {
|
|
255
|
+
if (e[t] === "]" && e[t + 1] === "]" && e[t + 2] === ">") {
|
|
256
|
+
t += 2;
|
|
262
257
|
break;
|
|
263
258
|
}
|
|
264
259
|
}
|
|
265
260
|
}
|
|
266
|
-
return
|
|
261
|
+
return t;
|
|
267
262
|
}
|
|
268
263
|
|
|
269
|
-
const
|
|
264
|
+
const g = '"';
|
|
270
265
|
|
|
271
|
-
const
|
|
266
|
+
const m = "'";
|
|
272
267
|
|
|
273
|
-
function
|
|
268
|
+
function x(e, t) {
|
|
269
|
+
let i = "";
|
|
274
270
|
let n = "";
|
|
275
|
-
let s =
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
s = "";
|
|
271
|
+
let s = false;
|
|
272
|
+
for (;t < e.length; t++) {
|
|
273
|
+
if (e[t] === g || e[t] === m) {
|
|
274
|
+
if (n === "") {
|
|
275
|
+
n = e[t];
|
|
276
|
+
} else if (n !== e[t]) {} else {
|
|
277
|
+
n = "";
|
|
283
278
|
}
|
|
284
|
-
} else if (t
|
|
285
|
-
if (
|
|
286
|
-
|
|
279
|
+
} else if (e[t] === ">") {
|
|
280
|
+
if (n === "") {
|
|
281
|
+
s = true;
|
|
287
282
|
break;
|
|
288
283
|
}
|
|
289
284
|
}
|
|
290
|
-
|
|
285
|
+
i += e[t];
|
|
291
286
|
}
|
|
292
|
-
if (
|
|
287
|
+
if (n !== "") {
|
|
293
288
|
return false;
|
|
294
289
|
}
|
|
295
290
|
return {
|
|
296
|
-
value:
|
|
297
|
-
index:
|
|
298
|
-
tagClosed:
|
|
291
|
+
value: i,
|
|
292
|
+
index: t,
|
|
293
|
+
tagClosed: s
|
|
299
294
|
};
|
|
300
295
|
}
|
|
301
296
|
|
|
302
|
-
const
|
|
297
|
+
const N = new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?", "g");
|
|
303
298
|
|
|
304
|
-
function
|
|
305
|
-
const
|
|
306
|
-
const
|
|
307
|
-
for (let
|
|
308
|
-
if (
|
|
309
|
-
return
|
|
310
|
-
} else if (
|
|
311
|
-
return
|
|
312
|
-
} else if (
|
|
313
|
-
return
|
|
314
|
-
}
|
|
315
|
-
const
|
|
316
|
-
if (!
|
|
317
|
-
return
|
|
318
|
-
}
|
|
319
|
-
if (!
|
|
320
|
-
s
|
|
299
|
+
function b(e, t) {
|
|
300
|
+
const i = s(e, N);
|
|
301
|
+
const n = {};
|
|
302
|
+
for (let e = 0; e < i.length; e++) {
|
|
303
|
+
if (i[e][1].length === 0) {
|
|
304
|
+
return T("InvalidAttr", "Attribute '" + i[e][2] + "' has no space in starting.", O(i[e]));
|
|
305
|
+
} else if (i[e][3] !== undefined && i[e][4] === undefined) {
|
|
306
|
+
return T("InvalidAttr", "Attribute '" + i[e][2] + "' is without value.", O(i[e]));
|
|
307
|
+
} else if (i[e][3] === undefined && !t.allowBooleanAttributes) {
|
|
308
|
+
return T("InvalidAttr", "boolean attribute '" + i[e][2] + "' is not allowed.", O(i[e]));
|
|
309
|
+
}
|
|
310
|
+
const s = i[e][2];
|
|
311
|
+
if (!y(s)) {
|
|
312
|
+
return T("InvalidAttr", "Attribute '" + s + "' is an invalid name.", O(i[e]));
|
|
313
|
+
}
|
|
314
|
+
if (!n.hasOwnProperty(s)) {
|
|
315
|
+
n[s] = 1;
|
|
321
316
|
} else {
|
|
322
|
-
return
|
|
317
|
+
return T("InvalidAttr", "Attribute '" + s + "' is repeated.", O(i[e]));
|
|
323
318
|
}
|
|
324
319
|
}
|
|
325
320
|
return true;
|
|
326
321
|
}
|
|
327
322
|
|
|
328
|
-
function
|
|
329
|
-
let
|
|
330
|
-
if (t
|
|
331
|
-
|
|
332
|
-
|
|
323
|
+
function E(e, t) {
|
|
324
|
+
let i = /\d/;
|
|
325
|
+
if (e[t] === "x") {
|
|
326
|
+
t++;
|
|
327
|
+
i = /[\da-fA-F]/;
|
|
333
328
|
}
|
|
334
|
-
for (;
|
|
335
|
-
if (t
|
|
336
|
-
if (!t
|
|
329
|
+
for (;t < e.length; t++) {
|
|
330
|
+
if (e[t] === ";") return t;
|
|
331
|
+
if (!e[t].match(i)) break;
|
|
337
332
|
}
|
|
338
333
|
return -1;
|
|
339
334
|
}
|
|
340
335
|
|
|
341
|
-
function
|
|
342
|
-
|
|
343
|
-
if (t
|
|
344
|
-
if (t
|
|
345
|
-
|
|
346
|
-
return
|
|
347
|
-
}
|
|
348
|
-
let
|
|
349
|
-
for (;
|
|
350
|
-
if (t
|
|
351
|
-
if (t
|
|
336
|
+
function w(e, t) {
|
|
337
|
+
t++;
|
|
338
|
+
if (e[t] === ";") return -1;
|
|
339
|
+
if (e[t] === "#") {
|
|
340
|
+
t++;
|
|
341
|
+
return E(e, t);
|
|
342
|
+
}
|
|
343
|
+
let i = 0;
|
|
344
|
+
for (;t < e.length; t++, i++) {
|
|
345
|
+
if (e[t].match(/\w/) && i < 20) continue;
|
|
346
|
+
if (e[t] === ";") break;
|
|
352
347
|
return -1;
|
|
353
348
|
}
|
|
354
|
-
return
|
|
349
|
+
return t;
|
|
355
350
|
}
|
|
356
351
|
|
|
357
|
-
function
|
|
352
|
+
function T(e, t, i) {
|
|
358
353
|
return {
|
|
359
354
|
err: {
|
|
360
|
-
code:
|
|
361
|
-
msg:
|
|
362
|
-
line:
|
|
363
|
-
col:
|
|
355
|
+
code: e,
|
|
356
|
+
msg: t,
|
|
357
|
+
line: i.line || i,
|
|
358
|
+
col: i.col
|
|
364
359
|
}
|
|
365
360
|
};
|
|
366
361
|
}
|
|
367
362
|
|
|
368
|
-
function
|
|
369
|
-
return
|
|
363
|
+
function y(e) {
|
|
364
|
+
return r(e);
|
|
370
365
|
}
|
|
371
366
|
|
|
372
|
-
function
|
|
373
|
-
return
|
|
367
|
+
function I(e) {
|
|
368
|
+
return r(e);
|
|
374
369
|
}
|
|
375
370
|
|
|
376
|
-
function
|
|
377
|
-
const
|
|
371
|
+
function v(e, t) {
|
|
372
|
+
const i = e.substring(0, t).split(/\r?\n/);
|
|
378
373
|
return {
|
|
379
|
-
line:
|
|
380
|
-
col:
|
|
374
|
+
line: i.length,
|
|
375
|
+
col: i[i.length - 1].length + 1
|
|
381
376
|
};
|
|
382
377
|
}
|
|
383
378
|
|
|
384
|
-
function
|
|
385
|
-
return
|
|
379
|
+
function O(e) {
|
|
380
|
+
return e.startIndex + e[1].length;
|
|
386
381
|
}
|
|
387
382
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
const T = {
|
|
383
|
+
const P = {
|
|
391
384
|
preserveOrder: false,
|
|
392
385
|
attributeNamePrefix: "@_",
|
|
393
386
|
attributesGroupName: false,
|
|
@@ -404,11 +397,11 @@ const T = {
|
|
|
404
397
|
leadingZeros: true,
|
|
405
398
|
eNotation: true
|
|
406
399
|
},
|
|
407
|
-
tagValueProcessor: function(
|
|
408
|
-
return
|
|
400
|
+
tagValueProcessor: function(e, t) {
|
|
401
|
+
return t;
|
|
409
402
|
},
|
|
410
|
-
attributeValueProcessor: function(
|
|
411
|
-
return
|
|
403
|
+
attributeValueProcessor: function(e, t) {
|
|
404
|
+
return t;
|
|
412
405
|
},
|
|
413
406
|
stopNodes: [],
|
|
414
407
|
alwaysCreateTextNode: false,
|
|
@@ -421,237 +414,421 @@ const T = {
|
|
|
421
414
|
ignorePiTags: false,
|
|
422
415
|
transformTagName: false,
|
|
423
416
|
transformAttributeName: false,
|
|
424
|
-
updateTag: function(
|
|
425
|
-
return
|
|
426
|
-
}
|
|
417
|
+
updateTag: function(e, t, i) {
|
|
418
|
+
return e;
|
|
419
|
+
},
|
|
420
|
+
captureMetaData: false
|
|
427
421
|
};
|
|
428
422
|
|
|
429
|
-
const
|
|
430
|
-
return Object.assign({},
|
|
423
|
+
const A = function(e) {
|
|
424
|
+
return Object.assign({}, P, e);
|
|
431
425
|
};
|
|
432
426
|
|
|
433
|
-
|
|
427
|
+
"use strict";
|
|
434
428
|
|
|
435
|
-
|
|
429
|
+
let S;
|
|
436
430
|
|
|
437
|
-
"
|
|
431
|
+
if (typeof Symbol !== "function") {
|
|
432
|
+
S = "@@xmlMetadata";
|
|
433
|
+
} else {
|
|
434
|
+
S = Symbol("XML Node Metadata");
|
|
435
|
+
}
|
|
438
436
|
|
|
439
437
|
class XmlNode {
|
|
440
|
-
constructor(
|
|
441
|
-
this.tagname =
|
|
438
|
+
constructor(e) {
|
|
439
|
+
this.tagname = e;
|
|
442
440
|
this.child = [];
|
|
443
441
|
this[":@"] = {};
|
|
444
442
|
}
|
|
445
|
-
add(
|
|
446
|
-
if (
|
|
443
|
+
add(e, t) {
|
|
444
|
+
if (e === "__proto__") e = "#__proto__";
|
|
447
445
|
this.child.push({
|
|
448
|
-
[
|
|
446
|
+
[e]: t
|
|
449
447
|
});
|
|
450
448
|
}
|
|
451
|
-
addChild(t) {
|
|
452
|
-
if (
|
|
453
|
-
if (
|
|
449
|
+
addChild(e, t) {
|
|
450
|
+
if (e.tagname === "__proto__") e.tagname = "#__proto__";
|
|
451
|
+
if (e[":@"] && Object.keys(e[":@"]).length > 0) {
|
|
454
452
|
this.child.push({
|
|
455
|
-
[
|
|
456
|
-
[":@"]:
|
|
453
|
+
[e.tagname]: e.child,
|
|
454
|
+
[":@"]: e[":@"]
|
|
457
455
|
});
|
|
458
456
|
} else {
|
|
459
457
|
this.child.push({
|
|
460
|
-
[
|
|
458
|
+
[e.tagname]: e.child
|
|
461
459
|
});
|
|
462
460
|
}
|
|
461
|
+
if (t !== undefined) {
|
|
462
|
+
this.child[this.child.length - 1][S] = {
|
|
463
|
+
startIndex: t
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
static getMetaDataSymbol() {
|
|
468
|
+
return S;
|
|
463
469
|
}
|
|
464
470
|
}
|
|
465
471
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
472
|
+
class DocTypeReader {
|
|
473
|
+
constructor(e) {
|
|
474
|
+
this.suppressValidationErr = !e;
|
|
475
|
+
}
|
|
476
|
+
readDocType(e, t) {
|
|
477
|
+
const i = {};
|
|
478
|
+
if (e[t + 3] === "O" && e[t + 4] === "C" && e[t + 5] === "T" && e[t + 6] === "Y" && e[t + 7] === "P" && e[t + 8] === "E") {
|
|
479
|
+
t = t + 9;
|
|
480
|
+
let n = 1;
|
|
481
|
+
let s = false, r = false;
|
|
482
|
+
let o = "";
|
|
483
|
+
for (;t < e.length; t++) {
|
|
484
|
+
if (e[t] === "<" && !r) {
|
|
485
|
+
if (s && V(e, "!ENTITY", t)) {
|
|
486
|
+
t += 7;
|
|
487
|
+
let n, s;
|
|
488
|
+
[n, s, t] = this.readEntityExp(e, t + 1, this.suppressValidationErr);
|
|
489
|
+
if (s.indexOf("&") === -1) i[n] = {
|
|
490
|
+
regx: RegExp(`&${n};`, "g"),
|
|
491
|
+
val: s
|
|
492
|
+
};
|
|
493
|
+
} else if (s && V(e, "!ELEMENT", t)) {
|
|
494
|
+
t += 8;
|
|
495
|
+
const {index: i} = this.readElementExp(e, t + 1);
|
|
496
|
+
t = i;
|
|
497
|
+
} else if (s && V(e, "!ATTLIST", t)) {
|
|
498
|
+
t += 8;
|
|
499
|
+
} else if (s && V(e, "!NOTATION", t)) {
|
|
500
|
+
t += 9;
|
|
501
|
+
const {index: i} = this.readNotationExp(e, t + 1, this.suppressValidationErr);
|
|
502
|
+
t = i;
|
|
503
|
+
} else if (V(e, "!--", t)) r = true; else throw new Error(`Invalid DOCTYPE`);
|
|
504
|
+
n++;
|
|
505
|
+
o = "";
|
|
506
|
+
} else if (e[t] === ">") {
|
|
507
|
+
if (r) {
|
|
508
|
+
if (e[t - 1] === "-" && e[t - 2] === "-") {
|
|
509
|
+
r = false;
|
|
510
|
+
n--;
|
|
511
|
+
}
|
|
512
|
+
} else {
|
|
513
|
+
n--;
|
|
514
|
+
}
|
|
515
|
+
if (n === 0) {
|
|
516
|
+
break;
|
|
497
517
|
}
|
|
518
|
+
} else if (e[t] === "[") {
|
|
519
|
+
s = true;
|
|
498
520
|
} else {
|
|
499
|
-
|
|
500
|
-
}
|
|
501
|
-
if (s === 0) {
|
|
502
|
-
break;
|
|
521
|
+
o += e[t];
|
|
503
522
|
}
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
523
|
+
}
|
|
524
|
+
if (n !== 0) {
|
|
525
|
+
throw new Error(`Unclosed DOCTYPE`);
|
|
526
|
+
}
|
|
527
|
+
} else {
|
|
528
|
+
throw new Error(`Invalid Tag instead of DOCTYPE`);
|
|
529
|
+
}
|
|
530
|
+
return {
|
|
531
|
+
entities: i,
|
|
532
|
+
i: t
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
readEntityExp(e, t) {
|
|
536
|
+
t = C(e, t);
|
|
537
|
+
let i = "";
|
|
538
|
+
while (t < e.length && !/\s/.test(e[t]) && e[t] !== '"' && e[t] !== "'") {
|
|
539
|
+
i += e[t];
|
|
540
|
+
t++;
|
|
541
|
+
}
|
|
542
|
+
D(i);
|
|
543
|
+
t = C(e, t);
|
|
544
|
+
if (!this.suppressValidationErr) {
|
|
545
|
+
if (e.substring(t, t + 6).toUpperCase() === "SYSTEM") {
|
|
546
|
+
throw new Error("External entities are not supported");
|
|
547
|
+
} else if (e[t] === "%") {
|
|
548
|
+
throw new Error("Parameter entities are not supported");
|
|
508
549
|
}
|
|
509
550
|
}
|
|
510
|
-
|
|
511
|
-
|
|
551
|
+
let n = "";
|
|
552
|
+
[t, n] = this.readIdentifierVal(e, t, "entity");
|
|
553
|
+
t--;
|
|
554
|
+
return [ i, n, t ];
|
|
555
|
+
}
|
|
556
|
+
readNotationExp(e, t) {
|
|
557
|
+
t = C(e, t);
|
|
558
|
+
let i = "";
|
|
559
|
+
while (t < e.length && !/\s/.test(e[t])) {
|
|
560
|
+
i += e[t];
|
|
561
|
+
t++;
|
|
512
562
|
}
|
|
513
|
-
|
|
514
|
-
|
|
563
|
+
!this.suppressValidationErr && D(i);
|
|
564
|
+
t = C(e, t);
|
|
565
|
+
const n = e.substring(t, t + 6).toUpperCase();
|
|
566
|
+
if (!this.suppressValidationErr && n !== "SYSTEM" && n !== "PUBLIC") {
|
|
567
|
+
throw new Error(`Expected SYSTEM or PUBLIC, found "${n}"`);
|
|
568
|
+
}
|
|
569
|
+
t += n.length;
|
|
570
|
+
t = C(e, t);
|
|
571
|
+
let s = null;
|
|
572
|
+
let r = null;
|
|
573
|
+
if (n === "PUBLIC") {
|
|
574
|
+
[t, s] = this.readIdentifierVal(e, t, "publicIdentifier");
|
|
575
|
+
t = C(e, t);
|
|
576
|
+
if (e[t] === '"' || e[t] === "'") {
|
|
577
|
+
[t, r] = this.readIdentifierVal(e, t, "systemIdentifier");
|
|
578
|
+
}
|
|
579
|
+
} else if (n === "SYSTEM") {
|
|
580
|
+
[t, r] = this.readIdentifierVal(e, t, "systemIdentifier");
|
|
581
|
+
if (!this.suppressValidationErr && !r) {
|
|
582
|
+
throw new Error("Missing mandatory system identifier for SYSTEM notation");
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
return {
|
|
586
|
+
notationName: i,
|
|
587
|
+
publicIdentifier: s,
|
|
588
|
+
systemIdentifier: r,
|
|
589
|
+
index: --t
|
|
590
|
+
};
|
|
515
591
|
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
592
|
+
readIdentifierVal(e, t, i) {
|
|
593
|
+
let n = "";
|
|
594
|
+
const s = e[t];
|
|
595
|
+
if (s !== '"' && s !== "'") {
|
|
596
|
+
throw new Error(`Expected quoted string, found "${s}"`);
|
|
597
|
+
}
|
|
598
|
+
t++;
|
|
599
|
+
while (t < e.length && e[t] !== s) {
|
|
600
|
+
n += e[t];
|
|
601
|
+
t++;
|
|
602
|
+
}
|
|
603
|
+
if (e[t] !== s) {
|
|
604
|
+
throw new Error(`Unterminated ${i} value`);
|
|
605
|
+
}
|
|
606
|
+
t++;
|
|
607
|
+
return [ t, n ];
|
|
608
|
+
}
|
|
609
|
+
readElementExp(e, t) {
|
|
610
|
+
t = C(e, t);
|
|
611
|
+
let i = "";
|
|
612
|
+
while (t < e.length && !/\s/.test(e[t])) {
|
|
613
|
+
i += e[t];
|
|
614
|
+
t++;
|
|
615
|
+
}
|
|
616
|
+
if (!this.suppressValidationErr && !r(i)) {
|
|
617
|
+
throw new Error(`Invalid element name: "${i}"`);
|
|
618
|
+
}
|
|
619
|
+
t = C(e, t);
|
|
620
|
+
let n = "";
|
|
621
|
+
if (e[t] === "E" && V(e, "MPTY", t)) t += 4; else if (e[t] === "A" && V(e, "NY", t)) t += 2; else if (e[t] === "(") {
|
|
622
|
+
t++;
|
|
623
|
+
while (t < e.length && e[t] !== ")") {
|
|
624
|
+
n += e[t];
|
|
625
|
+
t++;
|
|
626
|
+
}
|
|
627
|
+
if (e[t] !== ")") {
|
|
628
|
+
throw new Error("Unterminated content model");
|
|
629
|
+
}
|
|
630
|
+
} else if (!this.suppressValidationErr) {
|
|
631
|
+
throw new Error(`Invalid Element Expression, found "${e[t]}"`);
|
|
632
|
+
}
|
|
633
|
+
return {
|
|
634
|
+
elementName: i,
|
|
635
|
+
contentModel: n.trim(),
|
|
636
|
+
index: t
|
|
637
|
+
};
|
|
526
638
|
}
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
639
|
+
readAttlistExp(e, t) {
|
|
640
|
+
t = C(e, t);
|
|
641
|
+
let i = "";
|
|
642
|
+
while (t < e.length && !/\s/.test(e[t])) {
|
|
643
|
+
i += e[t];
|
|
644
|
+
t++;
|
|
645
|
+
}
|
|
646
|
+
D(i);
|
|
647
|
+
t = C(e, t);
|
|
648
|
+
let n = "";
|
|
649
|
+
while (t < e.length && !/\s/.test(e[t])) {
|
|
650
|
+
n += e[t];
|
|
651
|
+
t++;
|
|
652
|
+
}
|
|
653
|
+
if (!D(n)) {
|
|
654
|
+
throw new Error(`Invalid attribute name: "${n}"`);
|
|
655
|
+
}
|
|
656
|
+
t = C(e, t);
|
|
657
|
+
let s = "";
|
|
658
|
+
if (e.substring(t, t + 8).toUpperCase() === "NOTATION") {
|
|
659
|
+
s = "NOTATION";
|
|
660
|
+
t += 8;
|
|
661
|
+
t = C(e, t);
|
|
662
|
+
if (e[t] !== "(") {
|
|
663
|
+
throw new Error(`Expected '(', found "${e[t]}"`);
|
|
664
|
+
}
|
|
665
|
+
t++;
|
|
666
|
+
let i = [];
|
|
667
|
+
while (t < e.length && e[t] !== ")") {
|
|
668
|
+
let n = "";
|
|
669
|
+
while (t < e.length && e[t] !== "|" && e[t] !== ")") {
|
|
670
|
+
n += e[t];
|
|
671
|
+
t++;
|
|
672
|
+
}
|
|
673
|
+
n = n.trim();
|
|
674
|
+
if (!D(n)) {
|
|
675
|
+
throw new Error(`Invalid notation name: "${n}"`);
|
|
676
|
+
}
|
|
677
|
+
i.push(n);
|
|
678
|
+
if (e[t] === "|") {
|
|
679
|
+
t++;
|
|
680
|
+
t = C(e, t);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
if (e[t] !== ")") {
|
|
684
|
+
throw new Error("Unterminated list of notations");
|
|
685
|
+
}
|
|
686
|
+
t++;
|
|
687
|
+
s += " (" + i.join("|") + ")";
|
|
688
|
+
} else {
|
|
689
|
+
while (t < e.length && !/\s/.test(e[t])) {
|
|
690
|
+
s += e[t];
|
|
691
|
+
t++;
|
|
692
|
+
}
|
|
693
|
+
const i = [ "CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS" ];
|
|
694
|
+
if (!this.suppressValidationErr && !i.includes(s.toUpperCase())) {
|
|
695
|
+
throw new Error(`Invalid attribute type: "${s}"`);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
t = C(e, t);
|
|
699
|
+
let r = "";
|
|
700
|
+
if (e.substring(t, t + 8).toUpperCase() === "#REQUIRED") {
|
|
701
|
+
r = "#REQUIRED";
|
|
702
|
+
t += 8;
|
|
703
|
+
} else if (e.substring(t, t + 7).toUpperCase() === "#IMPLIED") {
|
|
704
|
+
r = "#IMPLIED";
|
|
705
|
+
t += 7;
|
|
706
|
+
} else {
|
|
707
|
+
[t, r] = this.readIdentifierVal(e, t, "ATTLIST");
|
|
708
|
+
}
|
|
709
|
+
return {
|
|
710
|
+
elementName: i,
|
|
711
|
+
attributeName: n,
|
|
712
|
+
attributeType: s,
|
|
713
|
+
defaultValue: r,
|
|
714
|
+
index: t
|
|
715
|
+
};
|
|
533
716
|
}
|
|
534
|
-
return [ n, i, e ];
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
function F(t, e) {
|
|
538
|
-
if (t[e + 1] === "!" && t[e + 2] === "-" && t[e + 3] === "-") return true;
|
|
539
|
-
return false;
|
|
540
717
|
}
|
|
541
718
|
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
if (t[e + 1] === "!" && t[e + 2] === "E" && t[e + 3] === "L" && t[e + 4] === "E" && t[e + 5] === "M" && t[e + 6] === "E" && t[e + 7] === "N" && t[e + 8] === "T") return true;
|
|
549
|
-
return false;
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
function k(t, e) {
|
|
553
|
-
if (t[e + 1] === "!" && t[e + 2] === "A" && t[e + 3] === "T" && t[e + 4] === "T" && t[e + 5] === "L" && t[e + 6] === "I" && t[e + 7] === "S" && t[e + 8] === "T") return true;
|
|
554
|
-
return false;
|
|
555
|
-
}
|
|
719
|
+
const C = (e, t) => {
|
|
720
|
+
while (t < e.length && /\s/.test(e[t])) {
|
|
721
|
+
t++;
|
|
722
|
+
}
|
|
723
|
+
return t;
|
|
724
|
+
};
|
|
556
725
|
|
|
557
|
-
function
|
|
558
|
-
|
|
559
|
-
|
|
726
|
+
function V(e, t, i) {
|
|
727
|
+
for (let n = 0; n < t.length; n++) {
|
|
728
|
+
if (t[n] !== e[i + n + 1]) return false;
|
|
729
|
+
}
|
|
730
|
+
return true;
|
|
560
731
|
}
|
|
561
732
|
|
|
562
|
-
function
|
|
563
|
-
if (
|
|
733
|
+
function D(e) {
|
|
734
|
+
if (r(e)) return e; else throw new Error(`Invalid entity name ${e}`);
|
|
564
735
|
}
|
|
565
736
|
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
const M = t.getDefaultExportFromCjs(L);
|
|
569
|
-
|
|
570
|
-
const X = /^[-+]?0x[a-fA-F0-9]+$/;
|
|
737
|
+
const $ = /^[-+]?0x[a-fA-F0-9]+$/;
|
|
571
738
|
|
|
572
|
-
const
|
|
739
|
+
const j = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/;
|
|
573
740
|
|
|
574
|
-
const
|
|
741
|
+
const M = {
|
|
575
742
|
hex: true,
|
|
576
743
|
leadingZeros: true,
|
|
577
744
|
decimalPoint: ".",
|
|
578
745
|
eNotation: true
|
|
579
746
|
};
|
|
580
747
|
|
|
581
|
-
function
|
|
582
|
-
|
|
583
|
-
if (!
|
|
584
|
-
let
|
|
585
|
-
if (
|
|
586
|
-
return
|
|
587
|
-
} else if (
|
|
588
|
-
|
|
589
|
-
if (s) {
|
|
590
|
-
if (e.leadingZeros) {
|
|
591
|
-
n = (s[1] || "") + s[3];
|
|
592
|
-
} else {
|
|
593
|
-
if (s[2] === "0" && s[3][0] === ".") {} else {
|
|
594
|
-
return t;
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
return e.eNotation ? Number(n) : t;
|
|
598
|
-
} else {
|
|
599
|
-
return t;
|
|
600
|
-
}
|
|
748
|
+
function k(e, t = {}) {
|
|
749
|
+
t = Object.assign({}, M, t);
|
|
750
|
+
if (!e || typeof e !== "string") return e;
|
|
751
|
+
let i = e.trim();
|
|
752
|
+
if (t.skipLike !== undefined && t.skipLike.test(i)) return e; else if (e === "0") return 0; else if (t.hex && $.test(i)) {
|
|
753
|
+
return U(i, 16);
|
|
754
|
+
} else if (i.search(/.+[eE].+/) !== -1) {
|
|
755
|
+
return _(e, i, t);
|
|
601
756
|
} else {
|
|
602
|
-
const
|
|
603
|
-
if (
|
|
604
|
-
const
|
|
605
|
-
const r =
|
|
606
|
-
let o =
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
757
|
+
const n = j.exec(i);
|
|
758
|
+
if (n) {
|
|
759
|
+
const s = n[1] || "";
|
|
760
|
+
const r = n[2];
|
|
761
|
+
let o = L(n[3]);
|
|
762
|
+
const a = s ? e[r.length + 1] === "." : e[r.length] === ".";
|
|
763
|
+
if (!t.leadingZeros && (r.length > 1 || r.length === 1 && !a)) {
|
|
764
|
+
return e;
|
|
765
|
+
} else {
|
|
766
|
+
const n = Number(i);
|
|
767
|
+
const a = String(n);
|
|
768
|
+
if (n === 0) return n;
|
|
610
769
|
if (a.search(/[eE]/) !== -1) {
|
|
611
|
-
if (
|
|
612
|
-
} else if (
|
|
613
|
-
if (a === "0"
|
|
770
|
+
if (t.eNotation) return n; else return e;
|
|
771
|
+
} else if (i.indexOf(".") !== -1) {
|
|
772
|
+
if (a === "0") return n; else if (a === o) return n; else if (a === `${s}${o}`) return n; else return e;
|
|
614
773
|
}
|
|
774
|
+
let l = r ? o : i;
|
|
615
775
|
if (r) {
|
|
616
|
-
return
|
|
776
|
+
return l === a || s + l === a ? n : e;
|
|
617
777
|
} else {
|
|
618
|
-
return
|
|
778
|
+
return l === a || l === s + a ? n : e;
|
|
619
779
|
}
|
|
620
780
|
}
|
|
621
781
|
} else {
|
|
622
|
-
return
|
|
782
|
+
return e;
|
|
623
783
|
}
|
|
624
784
|
}
|
|
625
785
|
}
|
|
626
786
|
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
787
|
+
const F = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
|
|
788
|
+
|
|
789
|
+
function _(e, t, i) {
|
|
790
|
+
if (!i.eNotation) return e;
|
|
791
|
+
const n = t.match(F);
|
|
792
|
+
if (n) {
|
|
793
|
+
let s = n[1] || "";
|
|
794
|
+
const r = n[3].indexOf("e") === -1 ? "E" : "e";
|
|
795
|
+
const o = n[2];
|
|
796
|
+
const a = s ? e[o.length + 1] === r : e[o.length] === r;
|
|
797
|
+
if (o.length > 1 && a) return e; else if (o.length === 1 && (n[3].startsWith(`.${r}`) || n[3][0] === r)) {
|
|
798
|
+
return Number(t);
|
|
799
|
+
} else if (i.leadingZeros && !a) {
|
|
800
|
+
t = (n[1] || "") + n[3];
|
|
801
|
+
return Number(t);
|
|
802
|
+
} else return e;
|
|
803
|
+
} else {
|
|
804
|
+
return e;
|
|
632
805
|
}
|
|
633
|
-
return t;
|
|
634
806
|
}
|
|
635
807
|
|
|
636
|
-
function
|
|
637
|
-
if (
|
|
808
|
+
function L(e) {
|
|
809
|
+
if (e && e.indexOf(".") !== -1) {
|
|
810
|
+
e = e.replace(/0+$/, "");
|
|
811
|
+
if (e === ".") e = "0"; else if (e[0] === ".") e = "0" + e; else if (e[e.length - 1] === ".") e = e.substring(0, e.length - 1);
|
|
812
|
+
return e;
|
|
813
|
+
}
|
|
814
|
+
return e;
|
|
638
815
|
}
|
|
639
816
|
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
817
|
+
function U(e, t) {
|
|
818
|
+
if (parseInt) return parseInt(e, t); else if (Number.parseInt) return Number.parseInt(e, t); else if (window && window.parseInt) return window.parseInt(e, t); else throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
|
|
819
|
+
}
|
|
643
820
|
|
|
644
|
-
function
|
|
645
|
-
if (typeof
|
|
646
|
-
return
|
|
821
|
+
function X(e) {
|
|
822
|
+
if (typeof e === "function") {
|
|
823
|
+
return e;
|
|
647
824
|
}
|
|
648
|
-
if (Array.isArray(
|
|
649
|
-
return
|
|
650
|
-
for (const
|
|
651
|
-
if (typeof
|
|
825
|
+
if (Array.isArray(e)) {
|
|
826
|
+
return t => {
|
|
827
|
+
for (const i of e) {
|
|
828
|
+
if (typeof i === "string" && t === i) {
|
|
652
829
|
return true;
|
|
653
830
|
}
|
|
654
|
-
if (
|
|
831
|
+
if (i instanceof RegExp && i.test(t)) {
|
|
655
832
|
return true;
|
|
656
833
|
}
|
|
657
834
|
}
|
|
@@ -660,25 +837,11 @@ function W(t) {
|
|
|
660
837
|
return () => false;
|
|
661
838
|
}
|
|
662
839
|
|
|
663
|
-
var z = W;
|
|
664
|
-
|
|
665
|
-
const J = t.getDefaultExportFromCjs(z);
|
|
666
|
-
|
|
667
840
|
"use strict";
|
|
668
841
|
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
const Q = L;
|
|
674
|
-
|
|
675
|
-
const tt = Y;
|
|
676
|
-
|
|
677
|
-
const et = z;
|
|
678
|
-
|
|
679
|
-
let nt = class OrderedObjParser {
|
|
680
|
-
constructor(t) {
|
|
681
|
-
this.options = t;
|
|
842
|
+
class OrderedObjParser {
|
|
843
|
+
constructor(e) {
|
|
844
|
+
this.options = e;
|
|
682
845
|
this.currentNode = null;
|
|
683
846
|
this.tagsNodeStack = [];
|
|
684
847
|
this.docTypeEntities = {};
|
|
@@ -739,264 +902,279 @@ let nt = class OrderedObjParser {
|
|
|
739
902
|
},
|
|
740
903
|
num_dec: {
|
|
741
904
|
regex: /&#([0-9]{1,7});/g,
|
|
742
|
-
val: (
|
|
905
|
+
val: (e, t) => String.fromCodePoint(Number.parseInt(t, 10))
|
|
743
906
|
},
|
|
744
907
|
num_hex: {
|
|
745
908
|
regex: /&#x([0-9a-fA-F]{1,6});/g,
|
|
746
|
-
val: (
|
|
909
|
+
val: (e, t) => String.fromCodePoint(Number.parseInt(t, 16))
|
|
747
910
|
}
|
|
748
911
|
};
|
|
749
|
-
this.addExternalEntities =
|
|
750
|
-
this.parseXml =
|
|
751
|
-
this.parseTextData =
|
|
752
|
-
this.resolveNameSpace =
|
|
753
|
-
this.buildAttributesMap =
|
|
754
|
-
this.isItStopNode =
|
|
755
|
-
this.replaceEntitiesValue =
|
|
756
|
-
this.readStopNodeData =
|
|
757
|
-
this.saveTextToParentTag =
|
|
758
|
-
this.addChild =
|
|
759
|
-
this.ignoreAttributesFn =
|
|
912
|
+
this.addExternalEntities = R;
|
|
913
|
+
this.parseXml = q;
|
|
914
|
+
this.parseTextData = B;
|
|
915
|
+
this.resolveNameSpace = Y;
|
|
916
|
+
this.buildAttributesMap = W;
|
|
917
|
+
this.isItStopNode = z;
|
|
918
|
+
this.replaceEntitiesValue = K;
|
|
919
|
+
this.readStopNodeData = te;
|
|
920
|
+
this.saveTextToParentTag = Q;
|
|
921
|
+
this.addChild = Z;
|
|
922
|
+
this.ignoreAttributesFn = X(this.options.ignoreAttributes);
|
|
923
|
+
if (this.options.stopNodes && this.options.stopNodes.length > 0) {
|
|
924
|
+
this.stopNodesExact = new Set;
|
|
925
|
+
this.stopNodesWildcard = new Set;
|
|
926
|
+
for (let e = 0; e < this.options.stopNodes.length; e++) {
|
|
927
|
+
const t = this.options.stopNodes[e];
|
|
928
|
+
if (typeof t !== "string") continue;
|
|
929
|
+
if (t.startsWith("*.")) {
|
|
930
|
+
this.stopNodesWildcard.add(t.substring(2));
|
|
931
|
+
} else {
|
|
932
|
+
this.stopNodesExact.add(t);
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
}
|
|
760
936
|
}
|
|
761
|
-
}
|
|
937
|
+
}
|
|
762
938
|
|
|
763
|
-
function
|
|
764
|
-
const
|
|
765
|
-
for (let
|
|
766
|
-
const
|
|
767
|
-
this.lastEntities[
|
|
768
|
-
regex: new RegExp("&" +
|
|
769
|
-
val:
|
|
939
|
+
function R(e) {
|
|
940
|
+
const t = Object.keys(e);
|
|
941
|
+
for (let i = 0; i < t.length; i++) {
|
|
942
|
+
const n = t[i];
|
|
943
|
+
this.lastEntities[n] = {
|
|
944
|
+
regex: new RegExp("&" + n + ";", "g"),
|
|
945
|
+
val: e[n]
|
|
770
946
|
};
|
|
771
947
|
}
|
|
772
948
|
}
|
|
773
949
|
|
|
774
|
-
function
|
|
775
|
-
if (
|
|
776
|
-
if (this.options.trimValues && !
|
|
777
|
-
|
|
778
|
-
}
|
|
779
|
-
if (
|
|
780
|
-
if (!o)
|
|
781
|
-
const
|
|
782
|
-
if (
|
|
783
|
-
return
|
|
784
|
-
} else if (typeof
|
|
785
|
-
return
|
|
950
|
+
function B(e, t, i, n, s, r, o) {
|
|
951
|
+
if (e !== undefined) {
|
|
952
|
+
if (this.options.trimValues && !n) {
|
|
953
|
+
e = e.trim();
|
|
954
|
+
}
|
|
955
|
+
if (e.length > 0) {
|
|
956
|
+
if (!o) e = this.replaceEntitiesValue(e);
|
|
957
|
+
const n = this.options.tagValueProcessor(t, e, i, s, r);
|
|
958
|
+
if (n === null || n === undefined) {
|
|
959
|
+
return e;
|
|
960
|
+
} else if (typeof n !== typeof e || n !== e) {
|
|
961
|
+
return n;
|
|
786
962
|
} else if (this.options.trimValues) {
|
|
787
|
-
return
|
|
963
|
+
return ie(e, this.options.parseTagValue, this.options.numberParseOptions);
|
|
788
964
|
} else {
|
|
789
|
-
const
|
|
790
|
-
if (
|
|
791
|
-
return
|
|
965
|
+
const t = e.trim();
|
|
966
|
+
if (t === e) {
|
|
967
|
+
return ie(e, this.options.parseTagValue, this.options.numberParseOptions);
|
|
792
968
|
} else {
|
|
793
|
-
return
|
|
969
|
+
return e;
|
|
794
970
|
}
|
|
795
971
|
}
|
|
796
972
|
}
|
|
797
973
|
}
|
|
798
974
|
}
|
|
799
975
|
|
|
800
|
-
function
|
|
976
|
+
function Y(e) {
|
|
801
977
|
if (this.options.removeNSPrefix) {
|
|
802
|
-
const
|
|
803
|
-
const
|
|
804
|
-
if (
|
|
978
|
+
const t = e.split(":");
|
|
979
|
+
const i = e.charAt(0) === "/" ? "/" : "";
|
|
980
|
+
if (t[0] === "xmlns") {
|
|
805
981
|
return "";
|
|
806
982
|
}
|
|
807
|
-
if (
|
|
808
|
-
|
|
983
|
+
if (t.length === 2) {
|
|
984
|
+
e = i + t[1];
|
|
809
985
|
}
|
|
810
986
|
}
|
|
811
|
-
return
|
|
987
|
+
return e;
|
|
812
988
|
}
|
|
813
989
|
|
|
814
|
-
const
|
|
990
|
+
const G = new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?", "gm");
|
|
815
991
|
|
|
816
|
-
function
|
|
817
|
-
if (this.options.ignoreAttributes !== true && typeof
|
|
818
|
-
const
|
|
819
|
-
const
|
|
820
|
-
const
|
|
821
|
-
for (let
|
|
822
|
-
const
|
|
823
|
-
if (this.ignoreAttributesFn(
|
|
992
|
+
function W(e, t, i) {
|
|
993
|
+
if (this.options.ignoreAttributes !== true && typeof e === "string") {
|
|
994
|
+
const i = s(e, G);
|
|
995
|
+
const n = i.length;
|
|
996
|
+
const r = {};
|
|
997
|
+
for (let e = 0; e < n; e++) {
|
|
998
|
+
const n = this.resolveNameSpace(i[e][1]);
|
|
999
|
+
if (this.ignoreAttributesFn(n, t)) {
|
|
824
1000
|
continue;
|
|
825
1001
|
}
|
|
826
|
-
let
|
|
827
|
-
let o = this.options.attributeNamePrefix +
|
|
828
|
-
if (
|
|
1002
|
+
let s = i[e][4];
|
|
1003
|
+
let o = this.options.attributeNamePrefix + n;
|
|
1004
|
+
if (n.length) {
|
|
829
1005
|
if (this.options.transformAttributeName) {
|
|
830
1006
|
o = this.options.transformAttributeName(o);
|
|
831
1007
|
}
|
|
832
1008
|
if (o === "__proto__") o = "#__proto__";
|
|
833
|
-
if (
|
|
1009
|
+
if (s !== undefined) {
|
|
834
1010
|
if (this.options.trimValues) {
|
|
835
|
-
|
|
1011
|
+
s = s.trim();
|
|
836
1012
|
}
|
|
837
|
-
|
|
838
|
-
const
|
|
839
|
-
if (
|
|
840
|
-
|
|
841
|
-
} else if (typeof
|
|
842
|
-
|
|
1013
|
+
s = this.replaceEntitiesValue(s);
|
|
1014
|
+
const e = this.options.attributeValueProcessor(n, s, t);
|
|
1015
|
+
if (e === null || e === undefined) {
|
|
1016
|
+
r[o] = s;
|
|
1017
|
+
} else if (typeof e !== typeof s || e !== s) {
|
|
1018
|
+
r[o] = e;
|
|
843
1019
|
} else {
|
|
844
|
-
|
|
1020
|
+
r[o] = ie(s, this.options.parseAttributeValue, this.options.numberParseOptions);
|
|
845
1021
|
}
|
|
846
1022
|
} else if (this.options.allowBooleanAttributes) {
|
|
847
|
-
|
|
1023
|
+
r[o] = true;
|
|
848
1024
|
}
|
|
849
1025
|
}
|
|
850
1026
|
}
|
|
851
|
-
if (!Object.keys(
|
|
1027
|
+
if (!Object.keys(r).length) {
|
|
852
1028
|
return;
|
|
853
1029
|
}
|
|
854
1030
|
if (this.options.attributesGroupName) {
|
|
855
|
-
const
|
|
856
|
-
|
|
857
|
-
return
|
|
1031
|
+
const e = {};
|
|
1032
|
+
e[this.options.attributesGroupName] = r;
|
|
1033
|
+
return e;
|
|
858
1034
|
}
|
|
859
|
-
return
|
|
1035
|
+
return r;
|
|
860
1036
|
}
|
|
861
1037
|
}
|
|
862
1038
|
|
|
863
|
-
const
|
|
864
|
-
|
|
865
|
-
const
|
|
866
|
-
let
|
|
1039
|
+
const q = function(e) {
|
|
1040
|
+
e = e.replace(/\r\n?/g, "\n");
|
|
1041
|
+
const t = new XmlNode("!xml");
|
|
1042
|
+
let i = t;
|
|
1043
|
+
let n = "";
|
|
867
1044
|
let s = "";
|
|
868
|
-
|
|
869
|
-
for (let
|
|
870
|
-
const
|
|
871
|
-
if (
|
|
872
|
-
if (
|
|
873
|
-
const
|
|
874
|
-
let
|
|
1045
|
+
const r = new DocTypeReader(this.options.processEntities);
|
|
1046
|
+
for (let o = 0; o < e.length; o++) {
|
|
1047
|
+
const a = e[o];
|
|
1048
|
+
if (a === "<") {
|
|
1049
|
+
if (e[o + 1] === "/") {
|
|
1050
|
+
const t = H(e, ">", o, "Closing Tag is not closed.");
|
|
1051
|
+
let r = e.substring(o + 2, t).trim();
|
|
875
1052
|
if (this.options.removeNSPrefix) {
|
|
876
|
-
const
|
|
877
|
-
if (
|
|
878
|
-
|
|
1053
|
+
const e = r.indexOf(":");
|
|
1054
|
+
if (e !== -1) {
|
|
1055
|
+
r = r.substr(e + 1);
|
|
879
1056
|
}
|
|
880
1057
|
}
|
|
881
1058
|
if (this.options.transformTagName) {
|
|
882
|
-
|
|
1059
|
+
r = this.options.transformTagName(r);
|
|
883
1060
|
}
|
|
884
|
-
if (
|
|
885
|
-
|
|
1061
|
+
if (i) {
|
|
1062
|
+
n = this.saveTextToParentTag(n, i, s);
|
|
886
1063
|
}
|
|
887
|
-
const a =
|
|
888
|
-
if (
|
|
889
|
-
throw new Error(`Unpaired tag can not be used as closing tag: </${
|
|
1064
|
+
const a = s.substring(s.lastIndexOf(".") + 1);
|
|
1065
|
+
if (r && this.options.unpairedTags.indexOf(r) !== -1) {
|
|
1066
|
+
throw new Error(`Unpaired tag can not be used as closing tag: </${r}>`);
|
|
890
1067
|
}
|
|
891
1068
|
let l = 0;
|
|
892
1069
|
if (a && this.options.unpairedTags.indexOf(a) !== -1) {
|
|
893
|
-
l =
|
|
1070
|
+
l = s.lastIndexOf(".", s.lastIndexOf(".") - 1);
|
|
894
1071
|
this.tagsNodeStack.pop();
|
|
895
1072
|
} else {
|
|
896
|
-
l =
|
|
1073
|
+
l = s.lastIndexOf(".");
|
|
897
1074
|
}
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
} else if (
|
|
903
|
-
let
|
|
904
|
-
if (!
|
|
905
|
-
|
|
906
|
-
if (this.options.ignoreDeclaration &&
|
|
907
|
-
const
|
|
908
|
-
|
|
909
|
-
if (
|
|
910
|
-
|
|
1075
|
+
s = s.substring(0, l);
|
|
1076
|
+
i = this.tagsNodeStack.pop();
|
|
1077
|
+
n = "";
|
|
1078
|
+
o = t;
|
|
1079
|
+
} else if (e[o + 1] === "?") {
|
|
1080
|
+
let t = ee(e, o, false, "?>");
|
|
1081
|
+
if (!t) throw new Error("Pi Tag is not closed.");
|
|
1082
|
+
n = this.saveTextToParentTag(n, i, s);
|
|
1083
|
+
if (this.options.ignoreDeclaration && t.tagName === "?xml" || this.options.ignorePiTags) {} else {
|
|
1084
|
+
const e = new XmlNode(t.tagName);
|
|
1085
|
+
e.add(this.options.textNodeName, "");
|
|
1086
|
+
if (t.tagName !== t.tagExp && t.attrExpPresent) {
|
|
1087
|
+
e[":@"] = this.buildAttributesMap(t.tagExp, s, t.tagName);
|
|
911
1088
|
}
|
|
912
|
-
this.addChild(
|
|
1089
|
+
this.addChild(i, e, s, o);
|
|
913
1090
|
}
|
|
914
|
-
|
|
915
|
-
} else if (
|
|
916
|
-
const
|
|
1091
|
+
o = t.closeIndex + 1;
|
|
1092
|
+
} else if (e.substr(o + 1, 3) === "!--") {
|
|
1093
|
+
const t = H(e, "--\x3e", o + 4, "Comment is not closed.");
|
|
917
1094
|
if (this.options.commentPropName) {
|
|
918
|
-
const
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
[this.options.textNodeName]:
|
|
1095
|
+
const r = e.substring(o + 4, t - 2);
|
|
1096
|
+
n = this.saveTextToParentTag(n, i, s);
|
|
1097
|
+
i.add(this.options.commentPropName, [ {
|
|
1098
|
+
[this.options.textNodeName]: r
|
|
922
1099
|
} ]);
|
|
923
1100
|
}
|
|
924
|
-
|
|
925
|
-
} else if (
|
|
926
|
-
const
|
|
927
|
-
this.docTypeEntities =
|
|
928
|
-
|
|
929
|
-
} else if (
|
|
930
|
-
const
|
|
931
|
-
const
|
|
932
|
-
|
|
933
|
-
let a = this.parseTextData(
|
|
1101
|
+
o = t;
|
|
1102
|
+
} else if (e.substr(o + 1, 2) === "!D") {
|
|
1103
|
+
const t = r.readDocType(e, o);
|
|
1104
|
+
this.docTypeEntities = t.entities;
|
|
1105
|
+
o = t.i;
|
|
1106
|
+
} else if (e.substr(o + 1, 2) === "![") {
|
|
1107
|
+
const t = H(e, "]]>", o, "CDATA is not closed.") - 2;
|
|
1108
|
+
const r = e.substring(o + 9, t);
|
|
1109
|
+
n = this.saveTextToParentTag(n, i, s);
|
|
1110
|
+
let a = this.parseTextData(r, i.tagname, s, true, false, true, true);
|
|
934
1111
|
if (a == undefined) a = "";
|
|
935
1112
|
if (this.options.cdataPropName) {
|
|
936
|
-
|
|
937
|
-
[this.options.textNodeName]:
|
|
1113
|
+
i.add(this.options.cdataPropName, [ {
|
|
1114
|
+
[this.options.textNodeName]: r
|
|
938
1115
|
} ]);
|
|
939
1116
|
} else {
|
|
940
|
-
|
|
1117
|
+
i.add(this.options.textNodeName, a);
|
|
941
1118
|
}
|
|
942
|
-
|
|
1119
|
+
o = t + 2;
|
|
943
1120
|
} else {
|
|
944
|
-
let
|
|
945
|
-
let a =
|
|
946
|
-
const l =
|
|
947
|
-
let u =
|
|
948
|
-
let f =
|
|
949
|
-
let
|
|
1121
|
+
let r = ee(e, o, this.options.removeNSPrefix);
|
|
1122
|
+
let a = r.tagName;
|
|
1123
|
+
const l = r.rawTagName;
|
|
1124
|
+
let u = r.tagExp;
|
|
1125
|
+
let f = r.attrExpPresent;
|
|
1126
|
+
let d = r.closeIndex;
|
|
950
1127
|
if (this.options.transformTagName) {
|
|
951
1128
|
a = this.options.transformTagName(a);
|
|
952
1129
|
}
|
|
953
|
-
if (
|
|
954
|
-
if (
|
|
955
|
-
|
|
1130
|
+
if (i && n) {
|
|
1131
|
+
if (i.tagname !== "!xml") {
|
|
1132
|
+
n = this.saveTextToParentTag(n, i, s, false);
|
|
956
1133
|
}
|
|
957
1134
|
}
|
|
958
|
-
const h =
|
|
1135
|
+
const h = i;
|
|
959
1136
|
if (h && this.options.unpairedTags.indexOf(h.tagname) !== -1) {
|
|
960
|
-
|
|
961
|
-
|
|
1137
|
+
i = this.tagsNodeStack.pop();
|
|
1138
|
+
s = s.substring(0, s.lastIndexOf("."));
|
|
962
1139
|
}
|
|
963
|
-
if (a !==
|
|
964
|
-
|
|
1140
|
+
if (a !== t.tagname) {
|
|
1141
|
+
s += s ? "." + a : a;
|
|
965
1142
|
}
|
|
966
|
-
|
|
967
|
-
|
|
1143
|
+
const c = o;
|
|
1144
|
+
if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, s, a)) {
|
|
1145
|
+
let t = "";
|
|
968
1146
|
if (u.length > 0 && u.lastIndexOf("/") === u.length - 1) {
|
|
969
1147
|
if (a[a.length - 1] === "/") {
|
|
970
1148
|
a = a.substr(0, a.length - 1);
|
|
971
|
-
|
|
1149
|
+
s = s.substr(0, s.length - 1);
|
|
972
1150
|
u = a;
|
|
973
1151
|
} else {
|
|
974
1152
|
u = u.substr(0, u.length - 1);
|
|
975
1153
|
}
|
|
976
|
-
|
|
1154
|
+
o = r.closeIndex;
|
|
977
1155
|
} else if (this.options.unpairedTags.indexOf(a) !== -1) {
|
|
978
|
-
|
|
1156
|
+
o = r.closeIndex;
|
|
979
1157
|
} else {
|
|
980
|
-
const
|
|
981
|
-
if (!
|
|
982
|
-
|
|
983
|
-
|
|
1158
|
+
const i = this.readStopNodeData(e, l, d + 1);
|
|
1159
|
+
if (!i) throw new Error(`Unexpected end of ${l}`);
|
|
1160
|
+
o = i.i;
|
|
1161
|
+
t = i.tagContent;
|
|
984
1162
|
}
|
|
985
|
-
const
|
|
1163
|
+
const n = new XmlNode(a);
|
|
986
1164
|
if (a !== u && f) {
|
|
987
|
-
|
|
1165
|
+
n[":@"] = this.buildAttributesMap(u, s, a);
|
|
988
1166
|
}
|
|
989
|
-
if (
|
|
990
|
-
|
|
1167
|
+
if (t) {
|
|
1168
|
+
t = this.parseTextData(t, a, s, true, f, true, true);
|
|
991
1169
|
}
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
this.addChild(n, s,
|
|
1170
|
+
s = s.substr(0, s.lastIndexOf("."));
|
|
1171
|
+
n.add(this.options.textNodeName, t);
|
|
1172
|
+
this.addChild(i, n, s, c);
|
|
995
1173
|
} else {
|
|
996
1174
|
if (u.length > 0 && u.lastIndexOf("/") === u.length - 1) {
|
|
997
1175
|
if (a[a.length - 1] === "/") {
|
|
998
1176
|
a = a.substr(0, a.length - 1);
|
|
999
|
-
|
|
1177
|
+
s = s.substr(0, s.length - 1);
|
|
1000
1178
|
u = a;
|
|
1001
1179
|
} else {
|
|
1002
1180
|
u = u.substr(0, u.length - 1);
|
|
@@ -1004,126 +1182,124 @@ const lt = function(t) {
|
|
|
1004
1182
|
if (this.options.transformTagName) {
|
|
1005
1183
|
a = this.options.transformTagName(a);
|
|
1006
1184
|
}
|
|
1007
|
-
const
|
|
1185
|
+
const e = new XmlNode(a);
|
|
1008
1186
|
if (a !== u && f) {
|
|
1009
|
-
|
|
1187
|
+
e[":@"] = this.buildAttributesMap(u, s, a);
|
|
1010
1188
|
}
|
|
1011
|
-
this.addChild(
|
|
1012
|
-
|
|
1189
|
+
this.addChild(i, e, s, c);
|
|
1190
|
+
s = s.substr(0, s.lastIndexOf("."));
|
|
1013
1191
|
} else {
|
|
1014
|
-
const
|
|
1015
|
-
this.tagsNodeStack.push(
|
|
1192
|
+
const e = new XmlNode(a);
|
|
1193
|
+
this.tagsNodeStack.push(i);
|
|
1016
1194
|
if (a !== u && f) {
|
|
1017
|
-
|
|
1195
|
+
e[":@"] = this.buildAttributesMap(u, s, a);
|
|
1018
1196
|
}
|
|
1019
|
-
this.addChild(
|
|
1020
|
-
|
|
1197
|
+
this.addChild(i, e, s, c);
|
|
1198
|
+
i = e;
|
|
1021
1199
|
}
|
|
1022
|
-
|
|
1023
|
-
|
|
1200
|
+
n = "";
|
|
1201
|
+
o = d;
|
|
1024
1202
|
}
|
|
1025
1203
|
}
|
|
1026
1204
|
} else {
|
|
1027
|
-
|
|
1205
|
+
n += e[o];
|
|
1028
1206
|
}
|
|
1029
1207
|
}
|
|
1030
|
-
return
|
|
1208
|
+
return t.child;
|
|
1031
1209
|
};
|
|
1032
1210
|
|
|
1033
|
-
function
|
|
1034
|
-
|
|
1211
|
+
function Z(e, t, i, n) {
|
|
1212
|
+
if (!this.options.captureMetaData) n = undefined;
|
|
1213
|
+
const s = this.options.updateTag(t.tagname, i, t[":@"]);
|
|
1035
1214
|
if (s === false) {} else if (typeof s === "string") {
|
|
1036
|
-
|
|
1037
|
-
|
|
1215
|
+
t.tagname = s;
|
|
1216
|
+
e.addChild(t, n);
|
|
1038
1217
|
} else {
|
|
1039
|
-
|
|
1218
|
+
e.addChild(t, n);
|
|
1040
1219
|
}
|
|
1041
1220
|
}
|
|
1042
1221
|
|
|
1043
|
-
const
|
|
1222
|
+
const K = function(e) {
|
|
1044
1223
|
if (this.options.processEntities) {
|
|
1045
|
-
for (let
|
|
1046
|
-
const
|
|
1047
|
-
|
|
1224
|
+
for (let t in this.docTypeEntities) {
|
|
1225
|
+
const i = this.docTypeEntities[t];
|
|
1226
|
+
e = e.replace(i.regx, i.val);
|
|
1048
1227
|
}
|
|
1049
|
-
for (let
|
|
1050
|
-
const
|
|
1051
|
-
|
|
1228
|
+
for (let t in this.lastEntities) {
|
|
1229
|
+
const i = this.lastEntities[t];
|
|
1230
|
+
e = e.replace(i.regex, i.val);
|
|
1052
1231
|
}
|
|
1053
1232
|
if (this.options.htmlEntities) {
|
|
1054
|
-
for (let
|
|
1055
|
-
const
|
|
1056
|
-
|
|
1233
|
+
for (let t in this.htmlEntities) {
|
|
1234
|
+
const i = this.htmlEntities[t];
|
|
1235
|
+
e = e.replace(i.regex, i.val);
|
|
1057
1236
|
}
|
|
1058
1237
|
}
|
|
1059
|
-
|
|
1238
|
+
e = e.replace(this.ampEntity.regex, this.ampEntity.val);
|
|
1060
1239
|
}
|
|
1061
|
-
return
|
|
1240
|
+
return e;
|
|
1062
1241
|
};
|
|
1063
1242
|
|
|
1064
|
-
function
|
|
1065
|
-
if (
|
|
1066
|
-
if (
|
|
1067
|
-
|
|
1068
|
-
if (
|
|
1069
|
-
|
|
1243
|
+
function Q(e, t, i, n) {
|
|
1244
|
+
if (e) {
|
|
1245
|
+
if (n === undefined) n = t.child.length === 0;
|
|
1246
|
+
e = this.parseTextData(e, t.tagname, i, false, t[":@"] ? Object.keys(t[":@"]).length !== 0 : false, n);
|
|
1247
|
+
if (e !== undefined && e !== "") t.add(this.options.textNodeName, e);
|
|
1248
|
+
e = "";
|
|
1070
1249
|
}
|
|
1071
|
-
return
|
|
1250
|
+
return e;
|
|
1072
1251
|
}
|
|
1073
1252
|
|
|
1074
|
-
function
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
const i = t[n];
|
|
1078
|
-
if (s === i || e === i) return true;
|
|
1079
|
-
}
|
|
1253
|
+
function z(e, t, i, n) {
|
|
1254
|
+
if (t && t.has(n)) return true;
|
|
1255
|
+
if (e && e.has(i)) return true;
|
|
1080
1256
|
return false;
|
|
1081
1257
|
}
|
|
1082
1258
|
|
|
1083
|
-
function
|
|
1084
|
-
let
|
|
1085
|
-
let
|
|
1086
|
-
for (let r =
|
|
1087
|
-
let
|
|
1088
|
-
if (
|
|
1089
|
-
if (
|
|
1090
|
-
} else if (
|
|
1091
|
-
|
|
1092
|
-
} else if (
|
|
1093
|
-
if (
|
|
1094
|
-
if (
|
|
1259
|
+
function J(e, t, i = ">") {
|
|
1260
|
+
let n;
|
|
1261
|
+
let s = "";
|
|
1262
|
+
for (let r = t; r < e.length; r++) {
|
|
1263
|
+
let t = e[r];
|
|
1264
|
+
if (n) {
|
|
1265
|
+
if (t === n) n = "";
|
|
1266
|
+
} else if (t === '"' || t === "'") {
|
|
1267
|
+
n = t;
|
|
1268
|
+
} else if (t === i[0]) {
|
|
1269
|
+
if (i[1]) {
|
|
1270
|
+
if (e[r + 1] === i[1]) {
|
|
1095
1271
|
return {
|
|
1096
|
-
data:
|
|
1272
|
+
data: s,
|
|
1097
1273
|
index: r
|
|
1098
1274
|
};
|
|
1099
1275
|
}
|
|
1100
1276
|
} else {
|
|
1101
1277
|
return {
|
|
1102
|
-
data:
|
|
1278
|
+
data: s,
|
|
1103
1279
|
index: r
|
|
1104
1280
|
};
|
|
1105
1281
|
}
|
|
1106
|
-
} else if (
|
|
1107
|
-
|
|
1282
|
+
} else if (t === "\t") {
|
|
1283
|
+
t = " ";
|
|
1108
1284
|
}
|
|
1109
|
-
|
|
1285
|
+
s += t;
|
|
1110
1286
|
}
|
|
1111
1287
|
}
|
|
1112
1288
|
|
|
1113
|
-
function
|
|
1114
|
-
const
|
|
1115
|
-
if (
|
|
1116
|
-
throw new Error(
|
|
1289
|
+
function H(e, t, i, n) {
|
|
1290
|
+
const s = e.indexOf(t, i);
|
|
1291
|
+
if (s === -1) {
|
|
1292
|
+
throw new Error(n);
|
|
1117
1293
|
} else {
|
|
1118
|
-
return
|
|
1294
|
+
return s + t.length - 1;
|
|
1119
1295
|
}
|
|
1120
1296
|
}
|
|
1121
1297
|
|
|
1122
|
-
function
|
|
1123
|
-
const
|
|
1124
|
-
if (!
|
|
1125
|
-
let r =
|
|
1126
|
-
const o =
|
|
1298
|
+
function ee(e, t, i, n = ">") {
|
|
1299
|
+
const s = J(e, t + 1, n);
|
|
1300
|
+
if (!s) return;
|
|
1301
|
+
let r = s.data;
|
|
1302
|
+
const o = s.index;
|
|
1127
1303
|
const a = r.search(/\s/);
|
|
1128
1304
|
let l = r;
|
|
1129
1305
|
let u = true;
|
|
@@ -1132,11 +1308,11 @@ function gt(t, e, n, s = ">") {
|
|
|
1132
1308
|
r = r.substring(a + 1).trimStart();
|
|
1133
1309
|
}
|
|
1134
1310
|
const f = l;
|
|
1135
|
-
if (
|
|
1136
|
-
const
|
|
1137
|
-
if (
|
|
1138
|
-
l = l.substr(
|
|
1139
|
-
u = l !==
|
|
1311
|
+
if (i) {
|
|
1312
|
+
const e = l.indexOf(":");
|
|
1313
|
+
if (e !== -1) {
|
|
1314
|
+
l = l.substr(e + 1);
|
|
1315
|
+
u = l !== s.data.substr(e + 1);
|
|
1140
1316
|
}
|
|
1141
1317
|
}
|
|
1142
1318
|
return {
|
|
@@ -1148,333 +1324,313 @@ function gt(t, e, n, s = ">") {
|
|
|
1148
1324
|
};
|
|
1149
1325
|
}
|
|
1150
1326
|
|
|
1151
|
-
function
|
|
1152
|
-
const
|
|
1153
|
-
let
|
|
1154
|
-
for (;
|
|
1155
|
-
if (
|
|
1156
|
-
if (
|
|
1157
|
-
const r =
|
|
1158
|
-
let o =
|
|
1159
|
-
if (o ===
|
|
1160
|
-
|
|
1161
|
-
if (
|
|
1327
|
+
function te(e, t, i) {
|
|
1328
|
+
const n = i;
|
|
1329
|
+
let s = 1;
|
|
1330
|
+
for (;i < e.length; i++) {
|
|
1331
|
+
if (e[i] === "<") {
|
|
1332
|
+
if (e[i + 1] === "/") {
|
|
1333
|
+
const r = H(e, ">", i, `${t} is not closed`);
|
|
1334
|
+
let o = e.substring(i + 2, r).trim();
|
|
1335
|
+
if (o === t) {
|
|
1336
|
+
s--;
|
|
1337
|
+
if (s === 0) {
|
|
1162
1338
|
return {
|
|
1163
|
-
tagContent:
|
|
1339
|
+
tagContent: e.substring(n, i),
|
|
1164
1340
|
i: r
|
|
1165
1341
|
};
|
|
1166
1342
|
}
|
|
1167
1343
|
}
|
|
1168
|
-
|
|
1169
|
-
} else if (
|
|
1170
|
-
const
|
|
1171
|
-
|
|
1172
|
-
} else if (
|
|
1173
|
-
const
|
|
1174
|
-
|
|
1175
|
-
} else if (
|
|
1176
|
-
const
|
|
1177
|
-
|
|
1344
|
+
i = r;
|
|
1345
|
+
} else if (e[i + 1] === "?") {
|
|
1346
|
+
const t = H(e, "?>", i + 1, "StopNode is not closed.");
|
|
1347
|
+
i = t;
|
|
1348
|
+
} else if (e.substr(i + 1, 3) === "!--") {
|
|
1349
|
+
const t = H(e, "--\x3e", i + 3, "StopNode is not closed.");
|
|
1350
|
+
i = t;
|
|
1351
|
+
} else if (e.substr(i + 1, 2) === "![") {
|
|
1352
|
+
const t = H(e, "]]>", i, "StopNode is not closed.") - 2;
|
|
1353
|
+
i = t;
|
|
1178
1354
|
} else {
|
|
1179
|
-
const
|
|
1180
|
-
if (
|
|
1181
|
-
const
|
|
1182
|
-
if (
|
|
1183
|
-
|
|
1355
|
+
const n = ee(e, i, ">");
|
|
1356
|
+
if (n) {
|
|
1357
|
+
const e = n && n.tagName;
|
|
1358
|
+
if (e === t && n.tagExp[n.tagExp.length - 1] !== "/") {
|
|
1359
|
+
s++;
|
|
1184
1360
|
}
|
|
1185
|
-
|
|
1361
|
+
i = n.closeIndex;
|
|
1186
1362
|
}
|
|
1187
1363
|
}
|
|
1188
1364
|
}
|
|
1189
1365
|
}
|
|
1190
1366
|
}
|
|
1191
1367
|
|
|
1192
|
-
function
|
|
1193
|
-
if (
|
|
1194
|
-
const
|
|
1195
|
-
if (
|
|
1368
|
+
function ie(e, t, i) {
|
|
1369
|
+
if (t && typeof e === "string") {
|
|
1370
|
+
const t = e.trim();
|
|
1371
|
+
if (t === "true") return true; else if (t === "false") return false; else return k(e, i);
|
|
1196
1372
|
} else {
|
|
1197
|
-
if (
|
|
1198
|
-
return
|
|
1373
|
+
if (o(e)) {
|
|
1374
|
+
return e;
|
|
1199
1375
|
} else {
|
|
1200
1376
|
return "";
|
|
1201
1377
|
}
|
|
1202
1378
|
}
|
|
1203
1379
|
}
|
|
1204
1380
|
|
|
1205
|
-
var Nt = nt;
|
|
1206
|
-
|
|
1207
|
-
const bt = t.getDefaultExportFromCjs(Nt);
|
|
1208
|
-
|
|
1209
|
-
var Et = {};
|
|
1210
|
-
|
|
1211
1381
|
"use strict";
|
|
1212
1382
|
|
|
1213
|
-
|
|
1214
|
-
|
|
1383
|
+
const ne = XmlNode.getMetaDataSymbol();
|
|
1384
|
+
|
|
1385
|
+
function se(e, t) {
|
|
1386
|
+
return re(e, t);
|
|
1215
1387
|
}
|
|
1216
1388
|
|
|
1217
|
-
function
|
|
1218
|
-
let
|
|
1219
|
-
const
|
|
1220
|
-
for (let r = 0; r <
|
|
1221
|
-
const o =
|
|
1222
|
-
const a =
|
|
1389
|
+
function re(e, t, i) {
|
|
1390
|
+
let n;
|
|
1391
|
+
const s = {};
|
|
1392
|
+
for (let r = 0; r < e.length; r++) {
|
|
1393
|
+
const o = e[r];
|
|
1394
|
+
const a = oe(o);
|
|
1223
1395
|
let l = "";
|
|
1224
|
-
if (
|
|
1225
|
-
if (a ===
|
|
1226
|
-
if (
|
|
1396
|
+
if (i === undefined) l = a; else l = i + "." + a;
|
|
1397
|
+
if (a === t.textNodeName) {
|
|
1398
|
+
if (n === undefined) n = o[a]; else n += "" + o[a];
|
|
1227
1399
|
} else if (a === undefined) {
|
|
1228
1400
|
continue;
|
|
1229
1401
|
} else if (o[a]) {
|
|
1230
|
-
let
|
|
1231
|
-
const
|
|
1402
|
+
let e = re(o[a], t, l);
|
|
1403
|
+
const i = le(e, t);
|
|
1404
|
+
if (o[ne] !== undefined) {
|
|
1405
|
+
e[ne] = o[ne];
|
|
1406
|
+
}
|
|
1232
1407
|
if (o[":@"]) {
|
|
1233
|
-
|
|
1234
|
-
} else if (Object.keys(
|
|
1235
|
-
|
|
1236
|
-
} else if (Object.keys(
|
|
1237
|
-
if (
|
|
1408
|
+
ae(e, o[":@"], l, t);
|
|
1409
|
+
} else if (Object.keys(e).length === 1 && e[t.textNodeName] !== undefined && !t.alwaysCreateTextNode) {
|
|
1410
|
+
e = e[t.textNodeName];
|
|
1411
|
+
} else if (Object.keys(e).length === 0) {
|
|
1412
|
+
if (t.alwaysCreateTextNode) e[t.textNodeName] = ""; else e = "";
|
|
1238
1413
|
}
|
|
1239
|
-
if (
|
|
1240
|
-
if (!Array.isArray(
|
|
1241
|
-
|
|
1414
|
+
if (s[a] !== undefined && s.hasOwnProperty(a)) {
|
|
1415
|
+
if (!Array.isArray(s[a])) {
|
|
1416
|
+
s[a] = [ s[a] ];
|
|
1242
1417
|
}
|
|
1243
|
-
|
|
1418
|
+
s[a].push(e);
|
|
1244
1419
|
} else {
|
|
1245
|
-
if (
|
|
1246
|
-
|
|
1420
|
+
if (t.isArray(a, l, i)) {
|
|
1421
|
+
s[a] = [ e ];
|
|
1247
1422
|
} else {
|
|
1248
|
-
|
|
1423
|
+
s[a] = e;
|
|
1249
1424
|
}
|
|
1250
1425
|
}
|
|
1251
1426
|
}
|
|
1252
1427
|
}
|
|
1253
|
-
if (typeof
|
|
1254
|
-
if (
|
|
1255
|
-
} else if (
|
|
1256
|
-
return
|
|
1428
|
+
if (typeof n === "string") {
|
|
1429
|
+
if (n.length > 0) s[t.textNodeName] = n;
|
|
1430
|
+
} else if (n !== undefined) s[t.textNodeName] = n;
|
|
1431
|
+
return s;
|
|
1257
1432
|
}
|
|
1258
1433
|
|
|
1259
|
-
function
|
|
1260
|
-
const
|
|
1261
|
-
for (let
|
|
1262
|
-
const
|
|
1263
|
-
if (
|
|
1434
|
+
function oe(e) {
|
|
1435
|
+
const t = Object.keys(e);
|
|
1436
|
+
for (let e = 0; e < t.length; e++) {
|
|
1437
|
+
const i = t[e];
|
|
1438
|
+
if (i !== ":@") return i;
|
|
1264
1439
|
}
|
|
1265
1440
|
}
|
|
1266
1441
|
|
|
1267
|
-
function
|
|
1268
|
-
if (
|
|
1269
|
-
const
|
|
1270
|
-
const r =
|
|
1442
|
+
function ae(e, t, i, n) {
|
|
1443
|
+
if (t) {
|
|
1444
|
+
const s = Object.keys(t);
|
|
1445
|
+
const r = s.length;
|
|
1271
1446
|
for (let o = 0; o < r; o++) {
|
|
1272
|
-
const r =
|
|
1273
|
-
if (
|
|
1274
|
-
|
|
1447
|
+
const r = s[o];
|
|
1448
|
+
if (n.isArray(r, i + "." + r, true, true)) {
|
|
1449
|
+
e[r] = [ t[r] ];
|
|
1275
1450
|
} else {
|
|
1276
|
-
|
|
1451
|
+
e[r] = t[r];
|
|
1277
1452
|
}
|
|
1278
1453
|
}
|
|
1279
1454
|
}
|
|
1280
1455
|
}
|
|
1281
1456
|
|
|
1282
|
-
function
|
|
1283
|
-
const {textNodeName:
|
|
1284
|
-
const
|
|
1285
|
-
if (
|
|
1457
|
+
function le(e, t) {
|
|
1458
|
+
const {textNodeName: i} = t;
|
|
1459
|
+
const n = Object.keys(e).length;
|
|
1460
|
+
if (n === 0) {
|
|
1286
1461
|
return true;
|
|
1287
1462
|
}
|
|
1288
|
-
if (
|
|
1463
|
+
if (n === 1 && (e[i] || typeof e[i] === "boolean" || e[i] === 0)) {
|
|
1289
1464
|
return true;
|
|
1290
1465
|
}
|
|
1291
1466
|
return false;
|
|
1292
1467
|
}
|
|
1293
1468
|
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
const {buildOptions: At} = y;
|
|
1297
|
-
|
|
1298
|
-
const Ct = Nt;
|
|
1299
|
-
|
|
1300
|
-
const {prettify: It} = Et;
|
|
1301
|
-
|
|
1302
|
-
const jt = e;
|
|
1303
|
-
|
|
1304
|
-
let St = class XMLParser {
|
|
1305
|
-
constructor(t) {
|
|
1469
|
+
class XMLParser {
|
|
1470
|
+
constructor(e) {
|
|
1306
1471
|
this.externalEntities = {};
|
|
1307
|
-
this.options =
|
|
1472
|
+
this.options = A(e);
|
|
1308
1473
|
}
|
|
1309
|
-
parse(
|
|
1310
|
-
if (typeof
|
|
1311
|
-
|
|
1312
|
-
} else {
|
|
1474
|
+
parse(e, t) {
|
|
1475
|
+
if (typeof e !== "string" && e.toString) {
|
|
1476
|
+
e = e.toString();
|
|
1477
|
+
} else if (typeof e !== "string") {
|
|
1313
1478
|
throw new Error("XML data is accepted in String or Bytes[] form.");
|
|
1314
1479
|
}
|
|
1315
|
-
if (
|
|
1316
|
-
if (
|
|
1317
|
-
const
|
|
1318
|
-
if (
|
|
1319
|
-
throw Error(`${
|
|
1480
|
+
if (t) {
|
|
1481
|
+
if (t === true) t = {};
|
|
1482
|
+
const i = d(e, t);
|
|
1483
|
+
if (i !== true) {
|
|
1484
|
+
throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`);
|
|
1320
1485
|
}
|
|
1321
1486
|
}
|
|
1322
|
-
const
|
|
1323
|
-
|
|
1324
|
-
const
|
|
1325
|
-
if (this.options.preserveOrder ||
|
|
1487
|
+
const i = new OrderedObjParser(this.options);
|
|
1488
|
+
i.addExternalEntities(this.externalEntities);
|
|
1489
|
+
const n = i.parseXml(e);
|
|
1490
|
+
if (this.options.preserveOrder || n === undefined) return n; else return se(n, this.options);
|
|
1326
1491
|
}
|
|
1327
|
-
addEntity(
|
|
1328
|
-
if (
|
|
1492
|
+
addEntity(e, t) {
|
|
1493
|
+
if (t.indexOf("&") !== -1) {
|
|
1329
1494
|
throw new Error("Entity value can't have '&'");
|
|
1330
|
-
} else if (
|
|
1495
|
+
} else if (e.indexOf("&") !== -1 || e.indexOf(";") !== -1) {
|
|
1331
1496
|
throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");
|
|
1332
|
-
} else if (
|
|
1497
|
+
} else if (t === "&") {
|
|
1333
1498
|
throw new Error("An entity with value '&' is not permitted");
|
|
1334
1499
|
} else {
|
|
1335
|
-
this.externalEntities[
|
|
1500
|
+
this.externalEntities[e] = t;
|
|
1336
1501
|
}
|
|
1337
1502
|
}
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
const Dt = t.getDefaultExportFromCjs(Ft);
|
|
1503
|
+
static getMetaDataSymbol() {
|
|
1504
|
+
return XmlNode.getMetaDataSymbol();
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1343
1507
|
|
|
1344
|
-
const
|
|
1508
|
+
const ue = "\n";
|
|
1345
1509
|
|
|
1346
|
-
function
|
|
1347
|
-
let
|
|
1348
|
-
if (
|
|
1349
|
-
|
|
1510
|
+
function fe(e, t) {
|
|
1511
|
+
let i = "";
|
|
1512
|
+
if (t.format && t.indentBy.length > 0) {
|
|
1513
|
+
i = ue;
|
|
1350
1514
|
}
|
|
1351
|
-
return
|
|
1515
|
+
return de(e, t, "", i);
|
|
1352
1516
|
}
|
|
1353
1517
|
|
|
1354
|
-
function
|
|
1355
|
-
let
|
|
1518
|
+
function de(e, t, i, n) {
|
|
1519
|
+
let s = "";
|
|
1356
1520
|
let r = false;
|
|
1357
|
-
for (let o = 0; o <
|
|
1358
|
-
const a =
|
|
1359
|
-
const l =
|
|
1521
|
+
for (let o = 0; o < e.length; o++) {
|
|
1522
|
+
const a = e[o];
|
|
1523
|
+
const l = he(a);
|
|
1360
1524
|
if (l === undefined) continue;
|
|
1361
1525
|
let u = "";
|
|
1362
|
-
if (
|
|
1363
|
-
if (l ===
|
|
1364
|
-
let
|
|
1365
|
-
if (!
|
|
1366
|
-
|
|
1367
|
-
|
|
1526
|
+
if (i.length === 0) u = l; else u = `${i}.${l}`;
|
|
1527
|
+
if (l === t.textNodeName) {
|
|
1528
|
+
let e = a[l];
|
|
1529
|
+
if (!pe(u, t)) {
|
|
1530
|
+
e = t.tagValueProcessor(l, e);
|
|
1531
|
+
e = ge(e, t);
|
|
1368
1532
|
}
|
|
1369
1533
|
if (r) {
|
|
1370
|
-
|
|
1534
|
+
s += n;
|
|
1371
1535
|
}
|
|
1372
|
-
|
|
1536
|
+
s += e;
|
|
1373
1537
|
r = false;
|
|
1374
1538
|
continue;
|
|
1375
|
-
} else if (l ===
|
|
1539
|
+
} else if (l === t.cdataPropName) {
|
|
1376
1540
|
if (r) {
|
|
1377
|
-
|
|
1541
|
+
s += n;
|
|
1378
1542
|
}
|
|
1379
|
-
|
|
1543
|
+
s += `<![CDATA[${a[l][0][t.textNodeName]}]]>`;
|
|
1380
1544
|
r = false;
|
|
1381
1545
|
continue;
|
|
1382
|
-
} else if (l ===
|
|
1383
|
-
|
|
1546
|
+
} else if (l === t.commentPropName) {
|
|
1547
|
+
s += n + `\x3c!--${a[l][0][t.textNodeName]}--\x3e`;
|
|
1384
1548
|
r = true;
|
|
1385
1549
|
continue;
|
|
1386
1550
|
} else if (l[0] === "?") {
|
|
1387
|
-
const
|
|
1388
|
-
const
|
|
1389
|
-
let o = a[l][0][
|
|
1551
|
+
const e = ce(a[":@"], t);
|
|
1552
|
+
const i = l === "?xml" ? "" : n;
|
|
1553
|
+
let o = a[l][0][t.textNodeName];
|
|
1390
1554
|
o = o.length !== 0 ? " " + o : "";
|
|
1391
|
-
|
|
1555
|
+
s += i + `<${l}${o}${e}?>`;
|
|
1392
1556
|
r = true;
|
|
1393
1557
|
continue;
|
|
1394
1558
|
}
|
|
1395
|
-
let f =
|
|
1559
|
+
let f = n;
|
|
1396
1560
|
if (f !== "") {
|
|
1397
|
-
f +=
|
|
1398
|
-
}
|
|
1399
|
-
const
|
|
1400
|
-
const h =
|
|
1401
|
-
const
|
|
1402
|
-
if (
|
|
1403
|
-
if (
|
|
1404
|
-
} else if ((!
|
|
1405
|
-
|
|
1406
|
-
} else if (
|
|
1407
|
-
|
|
1561
|
+
f += t.indentBy;
|
|
1562
|
+
}
|
|
1563
|
+
const d = ce(a[":@"], t);
|
|
1564
|
+
const h = n + `<${l}${d}`;
|
|
1565
|
+
const c = de(a[l], t, u, f);
|
|
1566
|
+
if (t.unpairedTags.indexOf(l) !== -1) {
|
|
1567
|
+
if (t.suppressUnpairedNode) s += h + ">"; else s += h + "/>";
|
|
1568
|
+
} else if ((!c || c.length === 0) && t.suppressEmptyNode) {
|
|
1569
|
+
s += h + "/>";
|
|
1570
|
+
} else if (c && c.endsWith(">")) {
|
|
1571
|
+
s += h + `>${c}${n}</${l}>`;
|
|
1408
1572
|
} else {
|
|
1409
|
-
|
|
1410
|
-
if (
|
|
1411
|
-
|
|
1573
|
+
s += h + ">";
|
|
1574
|
+
if (c && n !== "" && (c.includes("/>") || c.includes("</"))) {
|
|
1575
|
+
s += n + t.indentBy + c + n;
|
|
1412
1576
|
} else {
|
|
1413
|
-
|
|
1577
|
+
s += c;
|
|
1414
1578
|
}
|
|
1415
|
-
|
|
1579
|
+
s += `</${l}>`;
|
|
1416
1580
|
}
|
|
1417
1581
|
r = true;
|
|
1418
1582
|
}
|
|
1419
|
-
return
|
|
1583
|
+
return s;
|
|
1420
1584
|
}
|
|
1421
1585
|
|
|
1422
|
-
function
|
|
1423
|
-
const
|
|
1424
|
-
for (let
|
|
1425
|
-
const
|
|
1426
|
-
if (!
|
|
1427
|
-
if (
|
|
1586
|
+
function he(e) {
|
|
1587
|
+
const t = Object.keys(e);
|
|
1588
|
+
for (let i = 0; i < t.length; i++) {
|
|
1589
|
+
const n = t[i];
|
|
1590
|
+
if (!e.hasOwnProperty(n)) continue;
|
|
1591
|
+
if (n !== ":@") return n;
|
|
1428
1592
|
}
|
|
1429
1593
|
}
|
|
1430
1594
|
|
|
1431
|
-
function
|
|
1432
|
-
let
|
|
1433
|
-
if (
|
|
1434
|
-
for (let
|
|
1435
|
-
if (!
|
|
1436
|
-
let
|
|
1437
|
-
|
|
1438
|
-
if (
|
|
1439
|
-
|
|
1595
|
+
function ce(e, t) {
|
|
1596
|
+
let i = "";
|
|
1597
|
+
if (e && !t.ignoreAttributes) {
|
|
1598
|
+
for (let n in e) {
|
|
1599
|
+
if (!e.hasOwnProperty(n)) continue;
|
|
1600
|
+
let s = t.attributeValueProcessor(n, e[n]);
|
|
1601
|
+
s = ge(s, t);
|
|
1602
|
+
if (s === true && t.suppressBooleanAttributes) {
|
|
1603
|
+
i += ` ${n.substr(t.attributeNamePrefix.length)}`;
|
|
1440
1604
|
} else {
|
|
1441
|
-
|
|
1605
|
+
i += ` ${n.substr(t.attributeNamePrefix.length)}="${s}"`;
|
|
1442
1606
|
}
|
|
1443
1607
|
}
|
|
1444
1608
|
}
|
|
1445
|
-
return
|
|
1609
|
+
return i;
|
|
1446
1610
|
}
|
|
1447
1611
|
|
|
1448
|
-
function
|
|
1449
|
-
|
|
1450
|
-
let
|
|
1451
|
-
for (let
|
|
1452
|
-
if (
|
|
1612
|
+
function pe(e, t) {
|
|
1613
|
+
e = e.substr(0, e.length - t.textNodeName.length - 1);
|
|
1614
|
+
let i = e.substr(e.lastIndexOf(".") + 1);
|
|
1615
|
+
for (let n in t.stopNodes) {
|
|
1616
|
+
if (t.stopNodes[n] === e || t.stopNodes[n] === "*." + i) return true;
|
|
1453
1617
|
}
|
|
1454
1618
|
return false;
|
|
1455
1619
|
}
|
|
1456
1620
|
|
|
1457
|
-
function
|
|
1458
|
-
if (
|
|
1459
|
-
for (let
|
|
1460
|
-
const
|
|
1461
|
-
|
|
1621
|
+
function ge(e, t) {
|
|
1622
|
+
if (e && e.length > 0 && t.processEntities) {
|
|
1623
|
+
for (let i = 0; i < t.entities.length; i++) {
|
|
1624
|
+
const n = t.entities[i];
|
|
1625
|
+
e = e.replace(n.regex, n.val);
|
|
1462
1626
|
}
|
|
1463
1627
|
}
|
|
1464
|
-
return
|
|
1628
|
+
return e;
|
|
1465
1629
|
}
|
|
1466
1630
|
|
|
1467
|
-
var Bt = kt;
|
|
1468
|
-
|
|
1469
|
-
const Gt = t.getDefaultExportFromCjs(Bt);
|
|
1470
|
-
|
|
1471
1631
|
"use strict";
|
|
1472
1632
|
|
|
1473
|
-
const
|
|
1474
|
-
|
|
1475
|
-
const Ut = z;
|
|
1476
|
-
|
|
1477
|
-
const Zt = {
|
|
1633
|
+
const me = {
|
|
1478
1634
|
attributeNamePrefix: "@_",
|
|
1479
1635
|
attributesGroupName: false,
|
|
1480
1636
|
textNodeName: "#text",
|
|
@@ -1485,11 +1641,11 @@ const Zt = {
|
|
|
1485
1641
|
suppressEmptyNode: false,
|
|
1486
1642
|
suppressUnpairedNode: true,
|
|
1487
1643
|
suppressBooleanAttributes: true,
|
|
1488
|
-
tagValueProcessor: function(
|
|
1489
|
-
return
|
|
1644
|
+
tagValueProcessor: function(e, t) {
|
|
1645
|
+
return t;
|
|
1490
1646
|
},
|
|
1491
|
-
attributeValueProcessor: function(
|
|
1492
|
-
return
|
|
1647
|
+
attributeValueProcessor: function(e, t) {
|
|
1648
|
+
return t;
|
|
1493
1649
|
},
|
|
1494
1650
|
preserveOrder: false,
|
|
1495
1651
|
commentPropName: false,
|
|
@@ -1515,20 +1671,20 @@ const Zt = {
|
|
|
1515
1671
|
oneListGroup: false
|
|
1516
1672
|
};
|
|
1517
1673
|
|
|
1518
|
-
function
|
|
1519
|
-
this.options = Object.assign({},
|
|
1674
|
+
function xe(e) {
|
|
1675
|
+
this.options = Object.assign({}, me, e);
|
|
1520
1676
|
if (this.options.ignoreAttributes === true || this.options.attributesGroupName) {
|
|
1521
1677
|
this.isAttribute = function() {
|
|
1522
1678
|
return false;
|
|
1523
1679
|
};
|
|
1524
1680
|
} else {
|
|
1525
|
-
this.ignoreAttributesFn =
|
|
1681
|
+
this.ignoreAttributesFn = X(this.options.ignoreAttributes);
|
|
1526
1682
|
this.attrPrefixLen = this.options.attributeNamePrefix.length;
|
|
1527
|
-
this.isAttribute =
|
|
1683
|
+
this.isAttribute = we;
|
|
1528
1684
|
}
|
|
1529
|
-
this.processTextOrObjNode =
|
|
1685
|
+
this.processTextOrObjNode = Ne;
|
|
1530
1686
|
if (this.options.format) {
|
|
1531
|
-
this.indentate =
|
|
1687
|
+
this.indentate = Ee;
|
|
1532
1688
|
this.tagEndChar = ">\n";
|
|
1533
1689
|
this.newLine = "\n";
|
|
1534
1690
|
} else {
|
|
@@ -1540,233 +1696,219 @@ function Yt(t) {
|
|
|
1540
1696
|
}
|
|
1541
1697
|
}
|
|
1542
1698
|
|
|
1543
|
-
|
|
1699
|
+
xe.prototype.build = function(e) {
|
|
1544
1700
|
if (this.options.preserveOrder) {
|
|
1545
|
-
return
|
|
1701
|
+
return fe(e, this.options);
|
|
1546
1702
|
} else {
|
|
1547
|
-
if (Array.isArray(
|
|
1548
|
-
|
|
1549
|
-
[this.options.arrayNodeName]:
|
|
1703
|
+
if (Array.isArray(e) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1) {
|
|
1704
|
+
e = {
|
|
1705
|
+
[this.options.arrayNodeName]: e
|
|
1550
1706
|
};
|
|
1551
1707
|
}
|
|
1552
|
-
return this.j2x(
|
|
1708
|
+
return this.j2x(e, 0, []).val;
|
|
1553
1709
|
}
|
|
1554
1710
|
};
|
|
1555
1711
|
|
|
1556
|
-
|
|
1712
|
+
xe.prototype.j2x = function(e, t, i) {
|
|
1713
|
+
let n = "";
|
|
1557
1714
|
let s = "";
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
if (
|
|
1562
|
-
if (typeof t[o] === "undefined") {
|
|
1715
|
+
const r = i.join(".");
|
|
1716
|
+
for (let o in e) {
|
|
1717
|
+
if (!Object.prototype.hasOwnProperty.call(e, o)) continue;
|
|
1718
|
+
if (typeof e[o] === "undefined") {
|
|
1563
1719
|
if (this.isAttribute(o)) {
|
|
1564
|
-
|
|
1720
|
+
s += "";
|
|
1565
1721
|
}
|
|
1566
|
-
} else if (
|
|
1722
|
+
} else if (e[o] === null) {
|
|
1567
1723
|
if (this.isAttribute(o)) {
|
|
1568
|
-
|
|
1724
|
+
s += "";
|
|
1569
1725
|
} else if (o === this.options.cdataPropName) {
|
|
1570
|
-
|
|
1726
|
+
s += "";
|
|
1571
1727
|
} else if (o[0] === "?") {
|
|
1572
|
-
|
|
1728
|
+
s += this.indentate(t) + "<" + o + "?" + this.tagEndChar;
|
|
1573
1729
|
} else {
|
|
1574
|
-
|
|
1730
|
+
s += this.indentate(t) + "<" + o + "/" + this.tagEndChar;
|
|
1575
1731
|
}
|
|
1576
|
-
} else if (
|
|
1577
|
-
|
|
1578
|
-
} else if (typeof
|
|
1579
|
-
const
|
|
1580
|
-
if (
|
|
1581
|
-
|
|
1582
|
-
} else if (!
|
|
1732
|
+
} else if (e[o] instanceof Date) {
|
|
1733
|
+
s += this.buildTextValNode(e[o], o, "", t);
|
|
1734
|
+
} else if (typeof e[o] !== "object") {
|
|
1735
|
+
const i = this.isAttribute(o);
|
|
1736
|
+
if (i && !this.ignoreAttributesFn(i, r)) {
|
|
1737
|
+
n += this.buildAttrPairStr(i, "" + e[o]);
|
|
1738
|
+
} else if (!i) {
|
|
1583
1739
|
if (o === this.options.textNodeName) {
|
|
1584
|
-
let
|
|
1585
|
-
|
|
1740
|
+
let t = this.options.tagValueProcessor(o, "" + e[o]);
|
|
1741
|
+
s += this.replaceEntitiesValue(t);
|
|
1586
1742
|
} else {
|
|
1587
|
-
|
|
1743
|
+
s += this.buildTextValNode(e[o], o, "", t);
|
|
1588
1744
|
}
|
|
1589
1745
|
}
|
|
1590
|
-
} else if (Array.isArray(
|
|
1591
|
-
const
|
|
1746
|
+
} else if (Array.isArray(e[o])) {
|
|
1747
|
+
const n = e[o].length;
|
|
1592
1748
|
let r = "";
|
|
1593
1749
|
let a = "";
|
|
1594
|
-
for (let l = 0; l <
|
|
1595
|
-
const
|
|
1596
|
-
if (typeof
|
|
1597
|
-
if (o[0] === "?")
|
|
1598
|
-
} else if (typeof
|
|
1750
|
+
for (let l = 0; l < n; l++) {
|
|
1751
|
+
const n = e[o][l];
|
|
1752
|
+
if (typeof n === "undefined") {} else if (n === null) {
|
|
1753
|
+
if (o[0] === "?") s += this.indentate(t) + "<" + o + "?" + this.tagEndChar; else s += this.indentate(t) + "<" + o + "/" + this.tagEndChar;
|
|
1754
|
+
} else if (typeof n === "object") {
|
|
1599
1755
|
if (this.options.oneListGroup) {
|
|
1600
|
-
const
|
|
1601
|
-
r +=
|
|
1602
|
-
if (this.options.attributesGroupName &&
|
|
1603
|
-
a +=
|
|
1756
|
+
const e = this.j2x(n, t + 1, i.concat(o));
|
|
1757
|
+
r += e.val;
|
|
1758
|
+
if (this.options.attributesGroupName && n.hasOwnProperty(this.options.attributesGroupName)) {
|
|
1759
|
+
a += e.attrStr;
|
|
1604
1760
|
}
|
|
1605
1761
|
} else {
|
|
1606
|
-
r += this.processTextOrObjNode(
|
|
1762
|
+
r += this.processTextOrObjNode(n, o, t, i);
|
|
1607
1763
|
}
|
|
1608
1764
|
} else {
|
|
1609
1765
|
if (this.options.oneListGroup) {
|
|
1610
|
-
let
|
|
1611
|
-
|
|
1612
|
-
r +=
|
|
1766
|
+
let e = this.options.tagValueProcessor(o, n);
|
|
1767
|
+
e = this.replaceEntitiesValue(e);
|
|
1768
|
+
r += e;
|
|
1613
1769
|
} else {
|
|
1614
|
-
r += this.buildTextValNode(
|
|
1770
|
+
r += this.buildTextValNode(n, o, "", t);
|
|
1615
1771
|
}
|
|
1616
1772
|
}
|
|
1617
1773
|
}
|
|
1618
1774
|
if (this.options.oneListGroup) {
|
|
1619
|
-
r = this.buildObjectNode(r, o, a,
|
|
1775
|
+
r = this.buildObjectNode(r, o, a, t);
|
|
1620
1776
|
}
|
|
1621
|
-
|
|
1777
|
+
s += r;
|
|
1622
1778
|
} else {
|
|
1623
1779
|
if (this.options.attributesGroupName && o === this.options.attributesGroupName) {
|
|
1624
|
-
const
|
|
1625
|
-
const
|
|
1626
|
-
for (let
|
|
1627
|
-
|
|
1780
|
+
const t = Object.keys(e[o]);
|
|
1781
|
+
const i = t.length;
|
|
1782
|
+
for (let s = 0; s < i; s++) {
|
|
1783
|
+
n += this.buildAttrPairStr(t[s], "" + e[o][t[s]]);
|
|
1628
1784
|
}
|
|
1629
1785
|
} else {
|
|
1630
|
-
|
|
1786
|
+
s += this.processTextOrObjNode(e[o], o, t, i);
|
|
1631
1787
|
}
|
|
1632
1788
|
}
|
|
1633
1789
|
}
|
|
1634
1790
|
return {
|
|
1635
|
-
attrStr:
|
|
1636
|
-
val:
|
|
1791
|
+
attrStr: n,
|
|
1792
|
+
val: s
|
|
1637
1793
|
};
|
|
1638
1794
|
};
|
|
1639
1795
|
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
if (this.options.suppressBooleanAttributes &&
|
|
1644
|
-
return " " +
|
|
1645
|
-
} else return " " +
|
|
1796
|
+
xe.prototype.buildAttrPairStr = function(e, t) {
|
|
1797
|
+
t = this.options.attributeValueProcessor(e, "" + t);
|
|
1798
|
+
t = this.replaceEntitiesValue(t);
|
|
1799
|
+
if (this.options.suppressBooleanAttributes && t === "true") {
|
|
1800
|
+
return " " + e;
|
|
1801
|
+
} else return " " + e + '="' + t + '"';
|
|
1646
1802
|
};
|
|
1647
1803
|
|
|
1648
|
-
function
|
|
1649
|
-
const
|
|
1650
|
-
if (
|
|
1651
|
-
return this.buildTextValNode(
|
|
1804
|
+
function Ne(e, t, i, n) {
|
|
1805
|
+
const s = this.j2x(e, i + 1, n.concat(t));
|
|
1806
|
+
if (e[this.options.textNodeName] !== undefined && Object.keys(e).length === 1) {
|
|
1807
|
+
return this.buildTextValNode(e[this.options.textNodeName], t, s.attrStr, i);
|
|
1652
1808
|
} else {
|
|
1653
|
-
return this.buildObjectNode(
|
|
1809
|
+
return this.buildObjectNode(s.val, t, s.attrStr, i);
|
|
1654
1810
|
}
|
|
1655
1811
|
}
|
|
1656
1812
|
|
|
1657
|
-
|
|
1658
|
-
if (
|
|
1659
|
-
if (
|
|
1660
|
-
return this.indentate(
|
|
1813
|
+
xe.prototype.buildObjectNode = function(e, t, i, n) {
|
|
1814
|
+
if (e === "") {
|
|
1815
|
+
if (t[0] === "?") return this.indentate(n) + "<" + t + i + "?" + this.tagEndChar; else {
|
|
1816
|
+
return this.indentate(n) + "<" + t + i + this.closeTag(t) + this.tagEndChar;
|
|
1661
1817
|
}
|
|
1662
1818
|
} else {
|
|
1663
|
-
let
|
|
1819
|
+
let s = "</" + t + this.tagEndChar;
|
|
1664
1820
|
let r = "";
|
|
1665
|
-
if (
|
|
1821
|
+
if (t[0] === "?") {
|
|
1666
1822
|
r = "?";
|
|
1667
|
-
|
|
1823
|
+
s = "";
|
|
1668
1824
|
}
|
|
1669
|
-
if ((
|
|
1670
|
-
return this.indentate(
|
|
1671
|
-
} else if (this.options.commentPropName !== false &&
|
|
1672
|
-
return this.indentate(
|
|
1825
|
+
if ((i || i === "") && e.indexOf("<") === -1) {
|
|
1826
|
+
return this.indentate(n) + "<" + t + i + r + ">" + e + s;
|
|
1827
|
+
} else if (this.options.commentPropName !== false && t === this.options.commentPropName && r.length === 0) {
|
|
1828
|
+
return this.indentate(n) + `\x3c!--${e}--\x3e` + this.newLine;
|
|
1673
1829
|
} else {
|
|
1674
|
-
return this.indentate(
|
|
1830
|
+
return this.indentate(n) + "<" + t + i + r + this.tagEndChar + e + this.indentate(n) + s;
|
|
1675
1831
|
}
|
|
1676
1832
|
}
|
|
1677
1833
|
};
|
|
1678
1834
|
|
|
1679
|
-
|
|
1680
|
-
let
|
|
1681
|
-
if (this.options.unpairedTags.indexOf(
|
|
1682
|
-
if (!this.options.suppressUnpairedNode)
|
|
1835
|
+
xe.prototype.closeTag = function(e) {
|
|
1836
|
+
let t = "";
|
|
1837
|
+
if (this.options.unpairedTags.indexOf(e) !== -1) {
|
|
1838
|
+
if (!this.options.suppressUnpairedNode) t = "/";
|
|
1683
1839
|
} else if (this.options.suppressEmptyNode) {
|
|
1684
|
-
|
|
1840
|
+
t = "/";
|
|
1685
1841
|
} else {
|
|
1686
|
-
|
|
1842
|
+
t = `></${e}`;
|
|
1687
1843
|
}
|
|
1688
|
-
return
|
|
1844
|
+
return t;
|
|
1689
1845
|
};
|
|
1690
1846
|
|
|
1691
|
-
function
|
|
1692
|
-
if (
|
|
1693
|
-
return this.buildObjectNode(t,
|
|
1847
|
+
function be(e, t, i, n) {
|
|
1848
|
+
if (e !== "") {
|
|
1849
|
+
return this.buildObjectNode(e, t, i, n);
|
|
1694
1850
|
} else {
|
|
1695
|
-
if (
|
|
1696
|
-
return this.indentate(
|
|
1851
|
+
if (t[0] === "?") return this.indentate(n) + "<" + t + i + "?" + this.tagEndChar; else {
|
|
1852
|
+
return this.indentate(n) + "<" + t + i + "/" + this.tagEndChar;
|
|
1697
1853
|
}
|
|
1698
1854
|
}
|
|
1699
1855
|
}
|
|
1700
1856
|
|
|
1701
|
-
|
|
1702
|
-
if (this.options.cdataPropName !== false &&
|
|
1703
|
-
return this.indentate(
|
|
1704
|
-
} else if (this.options.commentPropName !== false &&
|
|
1705
|
-
return this.indentate(
|
|
1706
|
-
} else if (
|
|
1707
|
-
return this.indentate(
|
|
1857
|
+
xe.prototype.buildTextValNode = function(e, t, i, n) {
|
|
1858
|
+
if (this.options.cdataPropName !== false && t === this.options.cdataPropName) {
|
|
1859
|
+
return this.indentate(n) + `<![CDATA[${e}]]>` + this.newLine;
|
|
1860
|
+
} else if (this.options.commentPropName !== false && t === this.options.commentPropName) {
|
|
1861
|
+
return this.indentate(n) + `\x3c!--${e}--\x3e` + this.newLine;
|
|
1862
|
+
} else if (t[0] === "?") {
|
|
1863
|
+
return this.indentate(n) + "<" + t + i + "?" + this.tagEndChar;
|
|
1708
1864
|
} else {
|
|
1709
|
-
let
|
|
1710
|
-
|
|
1711
|
-
if (
|
|
1712
|
-
return this.indentate(
|
|
1865
|
+
let s = this.options.tagValueProcessor(t, e);
|
|
1866
|
+
s = this.replaceEntitiesValue(s);
|
|
1867
|
+
if (s === "") {
|
|
1868
|
+
return this.indentate(n) + "<" + t + i + this.closeTag(t) + this.tagEndChar;
|
|
1713
1869
|
} else {
|
|
1714
|
-
return this.indentate(
|
|
1870
|
+
return this.indentate(n) + "<" + t + i + ">" + s + "</" + t + this.tagEndChar;
|
|
1715
1871
|
}
|
|
1716
1872
|
}
|
|
1717
1873
|
};
|
|
1718
1874
|
|
|
1719
|
-
|
|
1720
|
-
if (
|
|
1721
|
-
for (let
|
|
1722
|
-
const
|
|
1723
|
-
|
|
1875
|
+
xe.prototype.replaceEntitiesValue = function(e) {
|
|
1876
|
+
if (e && e.length > 0 && this.options.processEntities) {
|
|
1877
|
+
for (let t = 0; t < this.options.entities.length; t++) {
|
|
1878
|
+
const i = this.options.entities[t];
|
|
1879
|
+
e = e.replace(i.regex, i.val);
|
|
1724
1880
|
}
|
|
1725
1881
|
}
|
|
1726
|
-
return
|
|
1882
|
+
return e;
|
|
1727
1883
|
};
|
|
1728
1884
|
|
|
1729
|
-
function
|
|
1730
|
-
return this.options.indentBy.repeat(
|
|
1885
|
+
function Ee(e) {
|
|
1886
|
+
return this.options.indentBy.repeat(e);
|
|
1731
1887
|
}
|
|
1732
1888
|
|
|
1733
|
-
function
|
|
1734
|
-
if (
|
|
1735
|
-
return
|
|
1889
|
+
function we(e) {
|
|
1890
|
+
if (e.startsWith(this.options.attributeNamePrefix) && e !== this.options.textNodeName) {
|
|
1891
|
+
return e.substr(this.attrPrefixLen);
|
|
1736
1892
|
} else {
|
|
1737
1893
|
return false;
|
|
1738
1894
|
}
|
|
1739
1895
|
}
|
|
1740
1896
|
|
|
1741
|
-
var Ht = Yt;
|
|
1742
|
-
|
|
1743
|
-
const Kt = t.getDefaultExportFromCjs(Ht);
|
|
1744
|
-
|
|
1745
1897
|
"use strict";
|
|
1746
1898
|
|
|
1747
|
-
const
|
|
1748
|
-
|
|
1749
|
-
const te = Ft;
|
|
1750
|
-
|
|
1751
|
-
const ee = Ht;
|
|
1752
|
-
|
|
1753
|
-
var ne = {
|
|
1754
|
-
XMLParser: te,
|
|
1755
|
-
XMLValidator: Qt,
|
|
1756
|
-
XMLBuilder: ee
|
|
1899
|
+
const Te = {
|
|
1900
|
+
validate: d
|
|
1757
1901
|
};
|
|
1758
1902
|
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
function ie(t) {
|
|
1903
|
+
function ye(e) {
|
|
1762
1904
|
try {
|
|
1763
|
-
|
|
1905
|
+
Te.validate(e, {
|
|
1764
1906
|
allowBooleanAttributes: true
|
|
1765
1907
|
});
|
|
1766
1908
|
return true;
|
|
1767
|
-
} catch (
|
|
1909
|
+
} catch (e) {
|
|
1768
1910
|
return false;
|
|
1769
1911
|
}
|
|
1770
1912
|
}
|
|
1771
1913
|
|
|
1772
|
-
exports.IsXML =
|
|
1914
|
+
exports.IsXML = ye;
|