@hirokisakabe/pom 0.3.0 → 1.1.0
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/dist/buildPptx.d.ts +2 -2
- package/dist/buildPptx.d.ts.map +1 -1
- package/dist/buildPptx.js +4 -66
- package/dist/calcYogaLayout/calcYogaLayout.d.ts.map +1 -1
- package/dist/calcYogaLayout/calcYogaLayout.js +59 -2
- package/dist/calcYogaLayout/measureCompositeNodes.d.ts +49 -0
- package/dist/calcYogaLayout/measureCompositeNodes.d.ts.map +1 -0
- package/dist/calcYogaLayout/measureCompositeNodes.js +143 -0
- package/dist/inputSchema.d.ts +347 -11
- package/dist/inputSchema.d.ts.map +1 -1
- package/dist/inputSchema.js +117 -15
- package/dist/renderPptx/nodes/index.d.ts +1 -0
- package/dist/renderPptx/nodes/index.d.ts.map +1 -1
- package/dist/renderPptx/nodes/index.js +1 -0
- package/dist/renderPptx/nodes/line.d.ts +8 -0
- package/dist/renderPptx/nodes/line.d.ts.map +1 -0
- package/dist/renderPptx/nodes/line.js +45 -0
- package/dist/renderPptx/renderPptx.d.ts +3 -2
- package/dist/renderPptx/renderPptx.d.ts.map +1 -1
- package/dist/renderPptx/renderPptx.js +197 -7
- package/dist/schema.d.ts +2 -2
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +2 -2
- package/dist/toPositioned/toPositioned.d.ts.map +1 -1
- package/dist/toPositioned/toPositioned.js +60 -0
- package/dist/types.d.ts +375 -18
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +118 -15
- package/package.json +1 -1
package/dist/inputSchema.d.ts
CHANGED
|
@@ -761,6 +761,73 @@ export declare const inputProcessArrowNodeSchema: z.ZodObject<{
|
|
|
761
761
|
fontPx: z.ZodOptional<z.ZodNumber>;
|
|
762
762
|
bold: z.ZodOptional<z.ZodBoolean>;
|
|
763
763
|
}, z.core.$strip>;
|
|
764
|
+
export declare const inputLineNodeSchema: z.ZodObject<{
|
|
765
|
+
w: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
766
|
+
h: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"max">, z.ZodString]>>;
|
|
767
|
+
minW: z.ZodOptional<z.ZodNumber>;
|
|
768
|
+
maxW: z.ZodOptional<z.ZodNumber>;
|
|
769
|
+
minH: z.ZodOptional<z.ZodNumber>;
|
|
770
|
+
maxH: z.ZodOptional<z.ZodNumber>;
|
|
771
|
+
padding: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
772
|
+
top: z.ZodOptional<z.ZodNumber>;
|
|
773
|
+
right: z.ZodOptional<z.ZodNumber>;
|
|
774
|
+
bottom: z.ZodOptional<z.ZodNumber>;
|
|
775
|
+
left: z.ZodOptional<z.ZodNumber>;
|
|
776
|
+
}, z.core.$strip>]>>;
|
|
777
|
+
backgroundColor: z.ZodOptional<z.ZodString>;
|
|
778
|
+
border: z.ZodOptional<z.ZodObject<{
|
|
779
|
+
color: z.ZodOptional<z.ZodString>;
|
|
780
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
781
|
+
dashType: z.ZodOptional<z.ZodEnum<{
|
|
782
|
+
solid: "solid";
|
|
783
|
+
dash: "dash";
|
|
784
|
+
dashDot: "dashDot";
|
|
785
|
+
lgDash: "lgDash";
|
|
786
|
+
lgDashDot: "lgDashDot";
|
|
787
|
+
lgDashDotDot: "lgDashDotDot";
|
|
788
|
+
sysDash: "sysDash";
|
|
789
|
+
sysDot: "sysDot";
|
|
790
|
+
}>>;
|
|
791
|
+
}, z.core.$strip>>;
|
|
792
|
+
borderRadius: z.ZodOptional<z.ZodNumber>;
|
|
793
|
+
type: z.ZodLiteral<"line">;
|
|
794
|
+
x1: z.ZodNumber;
|
|
795
|
+
y1: z.ZodNumber;
|
|
796
|
+
x2: z.ZodNumber;
|
|
797
|
+
y2: z.ZodNumber;
|
|
798
|
+
color: z.ZodOptional<z.ZodString>;
|
|
799
|
+
lineWidth: z.ZodOptional<z.ZodNumber>;
|
|
800
|
+
dashType: z.ZodOptional<z.ZodEnum<{
|
|
801
|
+
solid: "solid";
|
|
802
|
+
dash: "dash";
|
|
803
|
+
dashDot: "dashDot";
|
|
804
|
+
lgDash: "lgDash";
|
|
805
|
+
lgDashDot: "lgDashDot";
|
|
806
|
+
lgDashDotDot: "lgDashDotDot";
|
|
807
|
+
sysDash: "sysDash";
|
|
808
|
+
sysDot: "sysDot";
|
|
809
|
+
}>>;
|
|
810
|
+
beginArrow: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
811
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
812
|
+
diamond: "diamond";
|
|
813
|
+
triangle: "triangle";
|
|
814
|
+
none: "none";
|
|
815
|
+
arrow: "arrow";
|
|
816
|
+
oval: "oval";
|
|
817
|
+
stealth: "stealth";
|
|
818
|
+
}>>;
|
|
819
|
+
}, z.core.$strip>]>>;
|
|
820
|
+
endArrow: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
|
|
821
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
822
|
+
diamond: "diamond";
|
|
823
|
+
triangle: "triangle";
|
|
824
|
+
none: "none";
|
|
825
|
+
arrow: "arrow";
|
|
826
|
+
oval: "oval";
|
|
827
|
+
stealth: "stealth";
|
|
828
|
+
}>>;
|
|
829
|
+
}, z.core.$strip>]>>;
|
|
830
|
+
}, z.core.$strip>;
|
|
764
831
|
export type InputTextNode = z.infer<typeof inputTextNodeSchema>;
|
|
765
832
|
export type InputImageNode = z.infer<typeof inputImageNodeSchema>;
|
|
766
833
|
export type InputTableNode = z.infer<typeof inputTableNodeSchema>;
|
|
@@ -771,6 +838,7 @@ export type InputMatrixNode = z.infer<typeof inputMatrixNodeSchema>;
|
|
|
771
838
|
export type InputTreeNode = z.infer<typeof inputTreeNodeSchema>;
|
|
772
839
|
export type InputFlowNode = z.infer<typeof inputFlowNodeSchema>;
|
|
773
840
|
export type InputProcessArrowNode = z.infer<typeof inputProcessArrowNodeSchema>;
|
|
841
|
+
export type InputLineNode = z.infer<typeof inputLineNodeSchema>;
|
|
774
842
|
export type InputBoxNode = InputBaseNode & {
|
|
775
843
|
type: "box";
|
|
776
844
|
children: InputPOMNode;
|
|
@@ -789,10 +857,19 @@ export type InputHStackNode = InputBaseNode & {
|
|
|
789
857
|
alignItems?: AlignItems;
|
|
790
858
|
justifyContent?: JustifyContent;
|
|
791
859
|
};
|
|
792
|
-
export type
|
|
860
|
+
export type InputLayerChild = InputPOMNode & {
|
|
861
|
+
x: number;
|
|
862
|
+
y: number;
|
|
863
|
+
};
|
|
864
|
+
export type InputLayerNode = InputBaseNode & {
|
|
865
|
+
type: "layer";
|
|
866
|
+
children: InputLayerChild[];
|
|
867
|
+
};
|
|
868
|
+
export type InputPOMNode = InputTextNode | InputImageNode | InputTableNode | InputBoxNode | InputVStackNode | InputHStackNode | InputShapeNode | InputChartNode | InputTimelineNode | InputMatrixNode | InputTreeNode | InputFlowNode | InputProcessArrowNode | InputLineNode | InputLayerNode;
|
|
793
869
|
export declare const inputBoxNodeSchema: z.ZodType<InputBoxNode>;
|
|
794
870
|
export declare const inputVStackNodeSchema: z.ZodType<InputVStackNode>;
|
|
795
871
|
export declare const inputHStackNodeSchema: z.ZodType<InputHStackNode>;
|
|
872
|
+
export declare const inputLayerNodeSchema: z.ZodType<InputLayerNode>;
|
|
796
873
|
/**
|
|
797
874
|
* Input schema for POM nodes (for LLM/external input validation)
|
|
798
875
|
*
|
|
@@ -812,20 +889,279 @@ export declare const inputHStackNodeSchema: z.ZodType<InputHStackNode>;
|
|
|
812
889
|
* ```
|
|
813
890
|
*/
|
|
814
891
|
export declare const inputPomNodeSchema: z.ZodType<InputPOMNode>;
|
|
815
|
-
export declare const
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
892
|
+
export declare const inputMasterTextObjectSchema: z.ZodObject<{
|
|
893
|
+
type: z.ZodLiteral<"text">;
|
|
894
|
+
text: z.ZodString;
|
|
895
|
+
x: z.ZodNumber;
|
|
896
|
+
y: z.ZodNumber;
|
|
897
|
+
w: z.ZodNumber;
|
|
898
|
+
h: z.ZodNumber;
|
|
899
|
+
fontPx: z.ZodOptional<z.ZodNumber>;
|
|
900
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
901
|
+
color: z.ZodOptional<z.ZodString>;
|
|
902
|
+
bold: z.ZodOptional<z.ZodBoolean>;
|
|
903
|
+
alignText: z.ZodOptional<z.ZodEnum<{
|
|
904
|
+
right: "right";
|
|
905
|
+
left: "left";
|
|
906
|
+
center: "center";
|
|
907
|
+
}>>;
|
|
908
|
+
}, z.core.$strip>;
|
|
909
|
+
export declare const inputMasterImageObjectSchema: z.ZodObject<{
|
|
910
|
+
type: z.ZodLiteral<"image">;
|
|
911
|
+
src: z.ZodString;
|
|
912
|
+
x: z.ZodNumber;
|
|
913
|
+
y: z.ZodNumber;
|
|
914
|
+
w: z.ZodNumber;
|
|
915
|
+
h: z.ZodNumber;
|
|
916
|
+
}, z.core.$strip>;
|
|
917
|
+
export declare const inputMasterRectObjectSchema: z.ZodObject<{
|
|
918
|
+
type: z.ZodLiteral<"rect">;
|
|
919
|
+
x: z.ZodNumber;
|
|
920
|
+
y: z.ZodNumber;
|
|
921
|
+
w: z.ZodNumber;
|
|
922
|
+
h: z.ZodNumber;
|
|
923
|
+
fill: z.ZodOptional<z.ZodObject<{
|
|
924
|
+
color: z.ZodOptional<z.ZodString>;
|
|
925
|
+
transparency: z.ZodOptional<z.ZodNumber>;
|
|
926
|
+
}, z.core.$strip>>;
|
|
927
|
+
border: z.ZodOptional<z.ZodObject<{
|
|
928
|
+
color: z.ZodOptional<z.ZodString>;
|
|
929
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
930
|
+
dashType: z.ZodOptional<z.ZodEnum<{
|
|
931
|
+
solid: "solid";
|
|
932
|
+
dash: "dash";
|
|
933
|
+
dashDot: "dashDot";
|
|
934
|
+
lgDash: "lgDash";
|
|
935
|
+
lgDashDot: "lgDashDot";
|
|
936
|
+
lgDashDotDot: "lgDashDotDot";
|
|
937
|
+
sysDash: "sysDash";
|
|
938
|
+
sysDot: "sysDot";
|
|
939
|
+
}>>;
|
|
940
|
+
}, z.core.$strip>>;
|
|
941
|
+
}, z.core.$strip>;
|
|
942
|
+
export declare const inputMasterLineObjectSchema: z.ZodObject<{
|
|
943
|
+
type: z.ZodLiteral<"line">;
|
|
944
|
+
x: z.ZodNumber;
|
|
945
|
+
y: z.ZodNumber;
|
|
946
|
+
w: z.ZodNumber;
|
|
947
|
+
h: z.ZodNumber;
|
|
948
|
+
line: z.ZodOptional<z.ZodObject<{
|
|
949
|
+
color: z.ZodOptional<z.ZodString>;
|
|
950
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
951
|
+
dashType: z.ZodOptional<z.ZodEnum<{
|
|
952
|
+
solid: "solid";
|
|
953
|
+
dash: "dash";
|
|
954
|
+
dashDot: "dashDot";
|
|
955
|
+
lgDash: "lgDash";
|
|
956
|
+
lgDashDot: "lgDashDot";
|
|
957
|
+
lgDashDotDot: "lgDashDotDot";
|
|
958
|
+
sysDash: "sysDash";
|
|
959
|
+
sysDot: "sysDot";
|
|
960
|
+
}>>;
|
|
961
|
+
}, z.core.$strip>>;
|
|
962
|
+
}, z.core.$strip>;
|
|
963
|
+
export declare const inputMasterObjectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
964
|
+
type: z.ZodLiteral<"text">;
|
|
965
|
+
text: z.ZodString;
|
|
966
|
+
x: z.ZodNumber;
|
|
967
|
+
y: z.ZodNumber;
|
|
968
|
+
w: z.ZodNumber;
|
|
969
|
+
h: z.ZodNumber;
|
|
970
|
+
fontPx: z.ZodOptional<z.ZodNumber>;
|
|
971
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
972
|
+
color: z.ZodOptional<z.ZodString>;
|
|
973
|
+
bold: z.ZodOptional<z.ZodBoolean>;
|
|
974
|
+
alignText: z.ZodOptional<z.ZodEnum<{
|
|
975
|
+
right: "right";
|
|
976
|
+
left: "left";
|
|
977
|
+
center: "center";
|
|
978
|
+
}>>;
|
|
979
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
980
|
+
type: z.ZodLiteral<"image">;
|
|
981
|
+
src: z.ZodString;
|
|
982
|
+
x: z.ZodNumber;
|
|
983
|
+
y: z.ZodNumber;
|
|
984
|
+
w: z.ZodNumber;
|
|
985
|
+
h: z.ZodNumber;
|
|
986
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
987
|
+
type: z.ZodLiteral<"rect">;
|
|
988
|
+
x: z.ZodNumber;
|
|
989
|
+
y: z.ZodNumber;
|
|
990
|
+
w: z.ZodNumber;
|
|
991
|
+
h: z.ZodNumber;
|
|
992
|
+
fill: z.ZodOptional<z.ZodObject<{
|
|
993
|
+
color: z.ZodOptional<z.ZodString>;
|
|
994
|
+
transparency: z.ZodOptional<z.ZodNumber>;
|
|
995
|
+
}, z.core.$strip>>;
|
|
996
|
+
border: z.ZodOptional<z.ZodObject<{
|
|
997
|
+
color: z.ZodOptional<z.ZodString>;
|
|
998
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
999
|
+
dashType: z.ZodOptional<z.ZodEnum<{
|
|
1000
|
+
solid: "solid";
|
|
1001
|
+
dash: "dash";
|
|
1002
|
+
dashDot: "dashDot";
|
|
1003
|
+
lgDash: "lgDash";
|
|
1004
|
+
lgDashDot: "lgDashDot";
|
|
1005
|
+
lgDashDotDot: "lgDashDotDot";
|
|
1006
|
+
sysDash: "sysDash";
|
|
1007
|
+
sysDot: "sysDot";
|
|
1008
|
+
}>>;
|
|
1009
|
+
}, z.core.$strip>>;
|
|
1010
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1011
|
+
type: z.ZodLiteral<"line">;
|
|
1012
|
+
x: z.ZodNumber;
|
|
1013
|
+
y: z.ZodNumber;
|
|
1014
|
+
w: z.ZodNumber;
|
|
1015
|
+
h: z.ZodNumber;
|
|
1016
|
+
line: z.ZodOptional<z.ZodObject<{
|
|
1017
|
+
color: z.ZodOptional<z.ZodString>;
|
|
1018
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
1019
|
+
dashType: z.ZodOptional<z.ZodEnum<{
|
|
1020
|
+
solid: "solid";
|
|
1021
|
+
dash: "dash";
|
|
1022
|
+
dashDot: "dashDot";
|
|
1023
|
+
lgDash: "lgDash";
|
|
1024
|
+
lgDashDot: "lgDashDot";
|
|
1025
|
+
lgDashDotDot: "lgDashDotDot";
|
|
1026
|
+
sysDash: "sysDash";
|
|
1027
|
+
sysDot: "sysDot";
|
|
1028
|
+
}>>;
|
|
1029
|
+
}, z.core.$strip>>;
|
|
1030
|
+
}, z.core.$strip>], "type">;
|
|
1031
|
+
export declare const inputSlideNumberOptionsSchema: z.ZodObject<{
|
|
1032
|
+
x: z.ZodNumber;
|
|
1033
|
+
y: z.ZodNumber;
|
|
1034
|
+
w: z.ZodOptional<z.ZodNumber>;
|
|
1035
|
+
h: z.ZodOptional<z.ZodNumber>;
|
|
1036
|
+
fontPx: z.ZodOptional<z.ZodNumber>;
|
|
1037
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
1038
|
+
color: z.ZodOptional<z.ZodString>;
|
|
1039
|
+
}, z.core.$strip>;
|
|
1040
|
+
export declare const inputSlideMasterBackgroundSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
1041
|
+
color: z.ZodString;
|
|
1042
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1043
|
+
path: z.ZodString;
|
|
1044
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1045
|
+
data: z.ZodString;
|
|
1046
|
+
}, z.core.$strip>]>;
|
|
1047
|
+
export declare const inputSlideMasterMarginSchema: z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
1048
|
+
top: z.ZodOptional<z.ZodNumber>;
|
|
1049
|
+
right: z.ZodOptional<z.ZodNumber>;
|
|
1050
|
+
bottom: z.ZodOptional<z.ZodNumber>;
|
|
1051
|
+
left: z.ZodOptional<z.ZodNumber>;
|
|
1052
|
+
}, z.core.$strip>]>;
|
|
1053
|
+
/**
|
|
1054
|
+
* Input schema for slide master options (for LLM/external input validation)
|
|
1055
|
+
*
|
|
1056
|
+
* @example
|
|
1057
|
+
* ```typescript
|
|
1058
|
+
* import { inputSlideMasterOptionsSchema, buildPptx } from "@hirokisakabe/pom";
|
|
1059
|
+
*
|
|
1060
|
+
* const masterOptions = inputSlideMasterOptionsSchema.parse({
|
|
1061
|
+
* title: "MY_MASTER",
|
|
1062
|
+
* background: { color: "F0F0F0" },
|
|
1063
|
+
* objects: [
|
|
1064
|
+
* { type: "text", text: "Header", x: 48, y: 12, w: 200, h: 28, fontPx: 14 },
|
|
1065
|
+
* ],
|
|
1066
|
+
* slideNumber: { x: 1100, y: 680, fontPx: 10 },
|
|
1067
|
+
* });
|
|
1068
|
+
*
|
|
1069
|
+
* const pptx = await buildPptx([page], { w: 1280, h: 720 }, { master: masterOptions });
|
|
1070
|
+
* ```
|
|
1071
|
+
*/
|
|
1072
|
+
export declare const inputSlideMasterOptionsSchema: z.ZodObject<{
|
|
1073
|
+
title: z.ZodOptional<z.ZodString>;
|
|
1074
|
+
background: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1075
|
+
color: z.ZodString;
|
|
1076
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1077
|
+
path: z.ZodString;
|
|
1078
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1079
|
+
data: z.ZodString;
|
|
1080
|
+
}, z.core.$strip>]>>;
|
|
1081
|
+
margin: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodObject<{
|
|
1082
|
+
top: z.ZodOptional<z.ZodNumber>;
|
|
1083
|
+
right: z.ZodOptional<z.ZodNumber>;
|
|
1084
|
+
bottom: z.ZodOptional<z.ZodNumber>;
|
|
1085
|
+
left: z.ZodOptional<z.ZodNumber>;
|
|
1086
|
+
}, z.core.$strip>]>>;
|
|
1087
|
+
objects: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1088
|
+
type: z.ZodLiteral<"text">;
|
|
1089
|
+
text: z.ZodString;
|
|
1090
|
+
x: z.ZodNumber;
|
|
1091
|
+
y: z.ZodNumber;
|
|
1092
|
+
w: z.ZodNumber;
|
|
1093
|
+
h: z.ZodNumber;
|
|
1094
|
+
fontPx: z.ZodOptional<z.ZodNumber>;
|
|
1095
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
1096
|
+
color: z.ZodOptional<z.ZodString>;
|
|
1097
|
+
bold: z.ZodOptional<z.ZodBoolean>;
|
|
1098
|
+
alignText: z.ZodOptional<z.ZodEnum<{
|
|
820
1099
|
right: "right";
|
|
821
1100
|
left: "left";
|
|
822
1101
|
center: "center";
|
|
823
|
-
}
|
|
824
|
-
}, z.core.$strip
|
|
825
|
-
|
|
826
|
-
|
|
1102
|
+
}>>;
|
|
1103
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1104
|
+
type: z.ZodLiteral<"image">;
|
|
1105
|
+
src: z.ZodString;
|
|
1106
|
+
x: z.ZodNumber;
|
|
1107
|
+
y: z.ZodNumber;
|
|
1108
|
+
w: z.ZodNumber;
|
|
1109
|
+
h: z.ZodNumber;
|
|
1110
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1111
|
+
type: z.ZodLiteral<"rect">;
|
|
1112
|
+
x: z.ZodNumber;
|
|
1113
|
+
y: z.ZodNumber;
|
|
1114
|
+
w: z.ZodNumber;
|
|
1115
|
+
h: z.ZodNumber;
|
|
1116
|
+
fill: z.ZodOptional<z.ZodObject<{
|
|
1117
|
+
color: z.ZodOptional<z.ZodString>;
|
|
1118
|
+
transparency: z.ZodOptional<z.ZodNumber>;
|
|
1119
|
+
}, z.core.$strip>>;
|
|
1120
|
+
border: z.ZodOptional<z.ZodObject<{
|
|
1121
|
+
color: z.ZodOptional<z.ZodString>;
|
|
1122
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
1123
|
+
dashType: z.ZodOptional<z.ZodEnum<{
|
|
1124
|
+
solid: "solid";
|
|
1125
|
+
dash: "dash";
|
|
1126
|
+
dashDot: "dashDot";
|
|
1127
|
+
lgDash: "lgDash";
|
|
1128
|
+
lgDashDot: "lgDashDot";
|
|
1129
|
+
lgDashDotDot: "lgDashDotDot";
|
|
1130
|
+
sysDash: "sysDash";
|
|
1131
|
+
sysDot: "sysDot";
|
|
1132
|
+
}>>;
|
|
1133
|
+
}, z.core.$strip>>;
|
|
1134
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1135
|
+
type: z.ZodLiteral<"line">;
|
|
1136
|
+
x: z.ZodNumber;
|
|
1137
|
+
y: z.ZodNumber;
|
|
1138
|
+
w: z.ZodNumber;
|
|
1139
|
+
h: z.ZodNumber;
|
|
1140
|
+
line: z.ZodOptional<z.ZodObject<{
|
|
1141
|
+
color: z.ZodOptional<z.ZodString>;
|
|
1142
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
1143
|
+
dashType: z.ZodOptional<z.ZodEnum<{
|
|
1144
|
+
solid: "solid";
|
|
1145
|
+
dash: "dash";
|
|
1146
|
+
dashDot: "dashDot";
|
|
1147
|
+
lgDash: "lgDash";
|
|
1148
|
+
lgDashDot: "lgDashDot";
|
|
1149
|
+
lgDashDotDot: "lgDashDotDot";
|
|
1150
|
+
sysDash: "sysDash";
|
|
1151
|
+
sysDot: "sysDot";
|
|
1152
|
+
}>>;
|
|
1153
|
+
}, z.core.$strip>>;
|
|
1154
|
+
}, z.core.$strip>], "type">>>;
|
|
1155
|
+
slideNumber: z.ZodOptional<z.ZodObject<{
|
|
1156
|
+
x: z.ZodNumber;
|
|
1157
|
+
y: z.ZodNumber;
|
|
1158
|
+
w: z.ZodOptional<z.ZodNumber>;
|
|
1159
|
+
h: z.ZodOptional<z.ZodNumber>;
|
|
1160
|
+
fontPx: z.ZodOptional<z.ZodNumber>;
|
|
1161
|
+
fontFamily: z.ZodOptional<z.ZodString>;
|
|
1162
|
+
color: z.ZodOptional<z.ZodString>;
|
|
827
1163
|
}, z.core.$strip>>;
|
|
828
1164
|
}, z.core.$strip>;
|
|
829
|
-
export type
|
|
1165
|
+
export type InputSlideMasterOptions = z.infer<typeof inputSlideMasterOptionsSchema>;
|
|
830
1166
|
export {};
|
|
831
1167
|
//# sourceMappingURL=inputSchema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputSchema.d.ts","sourceRoot":"","sources":["../src/inputSchema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"inputSchema.d.ts","sourceRoot":"","sources":["../src/inputSchema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EA+BL,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,SAAS,CAAC;AAGjB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAW9B,CAAC;AAEH,KAAK,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAGzD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAU9B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAG/B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAK/B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAKlC,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;;;iBAQxC,CAAC;AAEH,eAAO,MAAM,gCAAgC;;;;;;mBAI3C,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;mBAQvC,CAAC;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAMxC,CAAC;AAEH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAC3C,OAAO,6BAA6B,CACrC,CAAC"}
|
package/dist/inputSchema.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
19
|
import { z } from "zod";
|
|
20
|
-
import { lengthSchema, paddingSchema, borderStyleSchema, fillStyleSchema, shadowStyleSchema, alignItemsSchema, justifyContentSchema, shapeTypeSchema, tableColumnSchema, tableRowSchema,
|
|
20
|
+
import { lengthSchema, paddingSchema, borderStyleSchema, borderDashSchema, fillStyleSchema, shadowStyleSchema, alignItemsSchema, justifyContentSchema, shapeTypeSchema, tableColumnSchema, tableRowSchema, chartTypeSchema, chartDataSchema, bulletOptionsSchema, radarStyleSchema, timelineDirectionSchema, timelineItemSchema, matrixAxisSchema, matrixQuadrantsSchema, matrixItemSchema, treeLayoutSchema, treeNodeShapeSchema, treeConnectorStyleSchema, flowDirectionSchema, flowNodeItemSchema, flowConnectionSchema, flowConnectorStyleSchema, processArrowDirectionSchema, processArrowStepSchema, lineArrowSchema, } from "./types";
|
|
21
21
|
// ===== Base Node Schema =====
|
|
22
22
|
export const inputBaseNodeSchema = z.object({
|
|
23
23
|
w: lengthSchema.optional(),
|
|
@@ -122,6 +122,18 @@ export const inputProcessArrowNodeSchema = inputBaseNodeSchema.extend({
|
|
|
122
122
|
fontPx: z.number().optional(),
|
|
123
123
|
bold: z.boolean().optional(),
|
|
124
124
|
});
|
|
125
|
+
export const inputLineNodeSchema = inputBaseNodeSchema.extend({
|
|
126
|
+
type: z.literal("line"),
|
|
127
|
+
x1: z.number(),
|
|
128
|
+
y1: z.number(),
|
|
129
|
+
x2: z.number(),
|
|
130
|
+
y2: z.number(),
|
|
131
|
+
color: z.string().optional(),
|
|
132
|
+
lineWidth: z.number().optional(),
|
|
133
|
+
dashType: borderDashSchema.optional(),
|
|
134
|
+
beginArrow: lineArrowSchema.optional(),
|
|
135
|
+
endArrow: lineArrowSchema.optional(),
|
|
136
|
+
});
|
|
125
137
|
// ===== Recursive Node Schemas =====
|
|
126
138
|
const inputBoxNodeSchemaBase = inputBaseNodeSchema.extend({
|
|
127
139
|
type: z.literal("box"),
|
|
@@ -141,9 +153,18 @@ const inputHStackNodeSchemaBase = inputBaseNodeSchema.extend({
|
|
|
141
153
|
alignItems: alignItemsSchema.optional(),
|
|
142
154
|
justifyContent: justifyContentSchema.optional(),
|
|
143
155
|
});
|
|
156
|
+
const inputLayerChildSchemaBase = z.lazy(() => inputPomNodeSchema.and(z.object({
|
|
157
|
+
x: z.number(),
|
|
158
|
+
y: z.number(),
|
|
159
|
+
})));
|
|
160
|
+
const inputLayerNodeSchemaBase = inputBaseNodeSchema.extend({
|
|
161
|
+
type: z.literal("layer"),
|
|
162
|
+
children: z.array(inputLayerChildSchemaBase),
|
|
163
|
+
});
|
|
144
164
|
export const inputBoxNodeSchema = inputBoxNodeSchemaBase;
|
|
145
165
|
export const inputVStackNodeSchema = inputVStackNodeSchemaBase;
|
|
146
166
|
export const inputHStackNodeSchema = inputHStackNodeSchemaBase;
|
|
167
|
+
export const inputLayerNodeSchema = inputLayerNodeSchemaBase;
|
|
147
168
|
/**
|
|
148
169
|
* Input schema for POM nodes (for LLM/external input validation)
|
|
149
170
|
*
|
|
@@ -176,19 +197,100 @@ export const inputPomNodeSchema = z.lazy(() => z.discriminatedUnion("type", [
|
|
|
176
197
|
inputTreeNodeSchema,
|
|
177
198
|
inputFlowNodeSchema,
|
|
178
199
|
inputProcessArrowNodeSchema,
|
|
200
|
+
inputLineNodeSchema,
|
|
201
|
+
inputLayerNodeSchemaBase,
|
|
179
202
|
]));
|
|
180
|
-
// ===== Master
|
|
181
|
-
export const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
203
|
+
// ===== Slide Master Options Schema =====
|
|
204
|
+
export const inputMasterTextObjectSchema = z.object({
|
|
205
|
+
type: z.literal("text"),
|
|
206
|
+
text: z.string(),
|
|
207
|
+
x: z.number(),
|
|
208
|
+
y: z.number(),
|
|
209
|
+
w: z.number(),
|
|
210
|
+
h: z.number(),
|
|
211
|
+
fontPx: z.number().optional(),
|
|
212
|
+
fontFamily: z.string().optional(),
|
|
213
|
+
color: z.string().optional(),
|
|
214
|
+
bold: z.boolean().optional(),
|
|
215
|
+
alignText: z.enum(["left", "center", "right"]).optional(),
|
|
216
|
+
});
|
|
217
|
+
export const inputMasterImageObjectSchema = z.object({
|
|
218
|
+
type: z.literal("image"),
|
|
219
|
+
src: z.string(),
|
|
220
|
+
x: z.number(),
|
|
221
|
+
y: z.number(),
|
|
222
|
+
w: z.number(),
|
|
223
|
+
h: z.number(),
|
|
224
|
+
});
|
|
225
|
+
export const inputMasterRectObjectSchema = z.object({
|
|
226
|
+
type: z.literal("rect"),
|
|
227
|
+
x: z.number(),
|
|
228
|
+
y: z.number(),
|
|
229
|
+
w: z.number(),
|
|
230
|
+
h: z.number(),
|
|
231
|
+
fill: fillStyleSchema.optional(),
|
|
232
|
+
border: borderStyleSchema.optional(),
|
|
233
|
+
});
|
|
234
|
+
export const inputMasterLineObjectSchema = z.object({
|
|
235
|
+
type: z.literal("line"),
|
|
236
|
+
x: z.number(),
|
|
237
|
+
y: z.number(),
|
|
238
|
+
w: z.number(),
|
|
239
|
+
h: z.number(),
|
|
240
|
+
line: borderStyleSchema.optional(),
|
|
241
|
+
});
|
|
242
|
+
export const inputMasterObjectSchema = z.discriminatedUnion("type", [
|
|
243
|
+
inputMasterTextObjectSchema,
|
|
244
|
+
inputMasterImageObjectSchema,
|
|
245
|
+
inputMasterRectObjectSchema,
|
|
246
|
+
inputMasterLineObjectSchema,
|
|
247
|
+
]);
|
|
248
|
+
export const inputSlideNumberOptionsSchema = z.object({
|
|
249
|
+
x: z.number(),
|
|
250
|
+
y: z.number(),
|
|
251
|
+
w: z.number().optional(),
|
|
252
|
+
h: z.number().optional(),
|
|
253
|
+
fontPx: z.number().optional(),
|
|
254
|
+
fontFamily: z.string().optional(),
|
|
255
|
+
color: z.string().optional(),
|
|
256
|
+
});
|
|
257
|
+
export const inputSlideMasterBackgroundSchema = z.union([
|
|
258
|
+
z.object({ color: z.string() }),
|
|
259
|
+
z.object({ path: z.string() }),
|
|
260
|
+
z.object({ data: z.string() }),
|
|
261
|
+
]);
|
|
262
|
+
export const inputSlideMasterMarginSchema = z.union([
|
|
263
|
+
z.number(),
|
|
264
|
+
z.object({
|
|
265
|
+
top: z.number().optional(),
|
|
266
|
+
right: z.number().optional(),
|
|
267
|
+
bottom: z.number().optional(),
|
|
268
|
+
left: z.number().optional(),
|
|
269
|
+
}),
|
|
270
|
+
]);
|
|
271
|
+
/**
|
|
272
|
+
* Input schema for slide master options (for LLM/external input validation)
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* ```typescript
|
|
276
|
+
* import { inputSlideMasterOptionsSchema, buildPptx } from "@hirokisakabe/pom";
|
|
277
|
+
*
|
|
278
|
+
* const masterOptions = inputSlideMasterOptionsSchema.parse({
|
|
279
|
+
* title: "MY_MASTER",
|
|
280
|
+
* background: { color: "F0F0F0" },
|
|
281
|
+
* objects: [
|
|
282
|
+
* { type: "text", text: "Header", x: 48, y: 12, w: 200, h: 28, fontPx: 14 },
|
|
283
|
+
* ],
|
|
284
|
+
* slideNumber: { x: 1100, y: 680, fontPx: 10 },
|
|
285
|
+
* });
|
|
286
|
+
*
|
|
287
|
+
* const pptx = await buildPptx([page], { w: 1280, h: 720 }, { master: masterOptions });
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
290
|
+
export const inputSlideMasterOptionsSchema = z.object({
|
|
291
|
+
title: z.string().optional(),
|
|
292
|
+
background: inputSlideMasterBackgroundSchema.optional(),
|
|
293
|
+
margin: inputSlideMasterMarginSchema.optional(),
|
|
294
|
+
objects: z.array(inputMasterObjectSchema).optional(),
|
|
295
|
+
slideNumber: inputSlideNumberOptionsSchema.optional(),
|
|
194
296
|
});
|
|
@@ -8,4 +8,5 @@ export { renderMatrixNode } from "./matrix";
|
|
|
8
8
|
export { renderTreeNode } from "./tree";
|
|
9
9
|
export { renderFlowNode } from "./flow";
|
|
10
10
|
export { renderProcessArrowNode } from "./processArrow";
|
|
11
|
+
export { renderLineNode } from "./line";
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PositionedNode } from "../../types";
|
|
2
|
+
import type { RenderContext } from "../types";
|
|
3
|
+
type LinePositionedNode = Extract<PositionedNode, {
|
|
4
|
+
type: "line";
|
|
5
|
+
}>;
|
|
6
|
+
export declare function renderLineNode(node: LinePositionedNode, ctx: RenderContext): void;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=line.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../../src/renderPptx/nodes/line.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAa,MAAM,aAAa,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C,KAAK,kBAAkB,GAAG,OAAO,CAAC,cAAc,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAoBpE,wBAAgB,cAAc,CAC5B,IAAI,EAAE,kBAAkB,EACxB,GAAG,EAAE,aAAa,GACjB,IAAI,CAgCN"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { pxToIn, pxToPt } from "../units";
|
|
2
|
+
/**
|
|
3
|
+
* boolean | LineArrowOptions から pptxgenjs の arrow type を取得
|
|
4
|
+
*/
|
|
5
|
+
function resolveArrowType(arrow) {
|
|
6
|
+
if (arrow === undefined) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
if (arrow === false) {
|
|
10
|
+
return "none";
|
|
11
|
+
}
|
|
12
|
+
if (arrow === true) {
|
|
13
|
+
return "triangle"; // デフォルト
|
|
14
|
+
}
|
|
15
|
+
return arrow.type ?? "triangle";
|
|
16
|
+
}
|
|
17
|
+
export function renderLineNode(node, ctx) {
|
|
18
|
+
const { x1, y1, x2, y2, color, lineWidth, dashType, beginArrow, endArrow } = node;
|
|
19
|
+
// pptxgenjs の line シェイプは x, y, w, h で描画
|
|
20
|
+
// x, y は左上座標、w, h で方向と長さを指定
|
|
21
|
+
const minX = Math.min(x1, x2);
|
|
22
|
+
const minY = Math.min(y1, y2);
|
|
23
|
+
const lineW = Math.abs(x2 - x1);
|
|
24
|
+
const lineH = Math.abs(y2 - y1);
|
|
25
|
+
// 線の方向を判定して flip を決定
|
|
26
|
+
// flipH: 右から左へ向かう線
|
|
27
|
+
// flipV: 下から上へ向かう線
|
|
28
|
+
const flipH = x2 < x1;
|
|
29
|
+
const flipV = y2 < y1;
|
|
30
|
+
ctx.slide.addShape(ctx.pptx.ShapeType.line, {
|
|
31
|
+
x: pxToIn(minX),
|
|
32
|
+
y: pxToIn(minY),
|
|
33
|
+
w: pxToIn(lineW),
|
|
34
|
+
h: pxToIn(lineH),
|
|
35
|
+
flipH,
|
|
36
|
+
flipV,
|
|
37
|
+
line: {
|
|
38
|
+
color: color ?? "000000",
|
|
39
|
+
width: lineWidth !== undefined ? pxToPt(lineWidth) : 1,
|
|
40
|
+
dashType: dashType,
|
|
41
|
+
beginArrowType: resolveArrowType(beginArrow),
|
|
42
|
+
endArrowType: resolveArrowType(endArrow),
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type PptxGenJSType from "pptxgenjs";
|
|
2
|
-
import type { PositionedNode } from "../types";
|
|
2
|
+
import type { PositionedNode, SlideMasterOptions } from "../types";
|
|
3
3
|
type SlidePx = {
|
|
4
4
|
w: number;
|
|
5
5
|
h: number;
|
|
@@ -10,7 +10,8 @@ export { PX_PER_IN, pxToIn, pxToPt } from "./units";
|
|
|
10
10
|
* PositionedNode ツリーを PptxGenJS スライドに変換する
|
|
11
11
|
* @param pages PositionedNode ツリーの配列(各要素が1ページ)
|
|
12
12
|
* @param slidePx スライド全体のサイズ(px)
|
|
13
|
+
* @param master スライドマスターオプション(省略可能)
|
|
13
14
|
* @returns PptxGenJS インスタンス
|
|
14
15
|
*/
|
|
15
|
-
export declare function renderPptx(pages: PositionedNode[], slidePx: SlidePx): PptxGenJSType;
|
|
16
|
+
export declare function renderPptx(pages: PositionedNode[], slidePx: SlidePx, master?: SlideMasterOptions): PptxGenJSType;
|
|
16
17
|
//# sourceMappingURL=renderPptx.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderPptx.d.ts","sourceRoot":"","sources":["../../src/renderPptx/renderPptx.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,aAAa,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"renderPptx.d.ts","sourceRoot":"","sources":["../../src/renderPptx/renderPptx.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,aAAa,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAEnB,MAAM,UAAU,CAAC;AAkBlB,KAAK,OAAO,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAiJpD;;;;;;GAMG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,cAAc,EAAE,EACvB,OAAO,EAAE,OAAO,EAChB,MAAM,CAAC,EAAE,kBAAkB,iBAgJ5B"}
|