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