Browse Source

Home - v1.0 Appstore AI版本首页补充重写与纠错

wanjun 1 year ago
parent
commit
2622578581
19 changed files with 2007 additions and 16 deletions
  1. 56 0
      PDF Office/PDF Master.xcodeproj/project.pbxproj
  2. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/ic_transtate.imageset/Contents.json
  3. 103 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/ic_transtate.imageset/translate.pdf
  4. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_error.imageset/Contents.json
  5. 89 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_error.imageset/icon.pdf
  6. 46 0
      PDF Office/PDF Master/Class/Home/NSObject/KMAIServerConfig.swift
  7. 170 0
      PDF Office/PDF Master/Class/Home/ViewController/KMAILanguagePopVC.swift
  8. 118 0
      PDF Office/PDF Master/Class/Home/ViewController/KMAILanguagePopVC.xib
  9. 190 0
      PDF Office/PDF Master/Class/Home/ViewController/KMAIRewritingVC.swift
  10. 292 0
      PDF Office/PDF Master/Class/Home/ViewController/KMAIRewritingVC.xib
  11. 319 0
      PDF Office/PDF Master/Class/Home/ViewController/KMAITranslationVC.swift
  12. 287 0
      PDF Office/PDF Master/Class/Home/ViewController/KMAITranslationVC.xib
  13. 11 12
      PDF Office/PDF Master/Class/Home/ViewController/KMHomeHistoryFileViewController.xib
  14. 1 2
      PDF Office/PDF Master/Class/Home/ViewController/KMHomePopViewController.xib
  15. 18 0
      PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController.swift
  16. 6 2
      PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController.xib
  17. 140 0
      PDF Office/PDF Master/Class/KMLightMember/KMRequestServer/KMRequestServer.swift
  18. 129 0
      PDF Office/PDF Master/Class/KMLightMember/Manager/KMRequestServerManager.swift
  19. 8 0
      PDF Office/PDF Master/Strings/en.lproj/Localizable.strings

+ 56 - 0
PDF Office/PDF Master.xcodeproj/project.pbxproj

@@ -405,6 +405,27 @@
 		9F02016D2A1B088700C9B673 /* KMAIOpenPDFFilesVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F0201692A1B088700C9B673 /* KMAIOpenPDFFilesVC.xib */; };
 		9F02016E2A1B088700C9B673 /* KMAIOpenPDFFilesVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F0201692A1B088700C9B673 /* KMAIOpenPDFFilesVC.xib */; };
 		9F02016F2A1B088700C9B673 /* KMAIOpenPDFFilesVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F0201692A1B088700C9B673 /* KMAIOpenPDFFilesVC.xib */; };
+		9F0201722A1B488C00C9B673 /* KMAITranslationVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201702A1B488C00C9B673 /* KMAITranslationVC.swift */; };
+		9F0201732A1B488C00C9B673 /* KMAITranslationVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201702A1B488C00C9B673 /* KMAITranslationVC.swift */; };
+		9F0201742A1B488C00C9B673 /* KMAITranslationVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201702A1B488C00C9B673 /* KMAITranslationVC.swift */; };
+		9F0201752A1B488C00C9B673 /* KMAITranslationVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F0201712A1B488C00C9B673 /* KMAITranslationVC.xib */; };
+		9F0201762A1B488C00C9B673 /* KMAITranslationVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F0201712A1B488C00C9B673 /* KMAITranslationVC.xib */; };
+		9F0201772A1B488C00C9B673 /* KMAITranslationVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F0201712A1B488C00C9B673 /* KMAITranslationVC.xib */; };
+		9F0201792A1B5C0300C9B673 /* KMAIServerConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201782A1B5C0300C9B673 /* KMAIServerConfig.swift */; };
+		9F02017A2A1B5C0300C9B673 /* KMAIServerConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201782A1B5C0300C9B673 /* KMAIServerConfig.swift */; };
+		9F02017B2A1B5C0300C9B673 /* KMAIServerConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201782A1B5C0300C9B673 /* KMAIServerConfig.swift */; };
+		9F02017E2A1BAC1600C9B673 /* KMAIRewritingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F02017C2A1BAC1600C9B673 /* KMAIRewritingVC.swift */; };
+		9F02017F2A1BAC1600C9B673 /* KMAIRewritingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F02017C2A1BAC1600C9B673 /* KMAIRewritingVC.swift */; };
+		9F0201802A1BAC1600C9B673 /* KMAIRewritingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F02017C2A1BAC1600C9B673 /* KMAIRewritingVC.swift */; };
+		9F0201812A1BAC1600C9B673 /* KMAIRewritingVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F02017D2A1BAC1600C9B673 /* KMAIRewritingVC.xib */; };
+		9F0201822A1BAC1600C9B673 /* KMAIRewritingVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F02017D2A1BAC1600C9B673 /* KMAIRewritingVC.xib */; };
+		9F0201832A1BAC1600C9B673 /* KMAIRewritingVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F02017D2A1BAC1600C9B673 /* KMAIRewritingVC.xib */; };
+		9F0201862A1DA28B00C9B673 /* KMAILanguagePopVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201842A1DA28B00C9B673 /* KMAILanguagePopVC.swift */; };
+		9F0201872A1DA28B00C9B673 /* KMAILanguagePopVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201842A1DA28B00C9B673 /* KMAILanguagePopVC.swift */; };
+		9F0201882A1DA28B00C9B673 /* KMAILanguagePopVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201842A1DA28B00C9B673 /* KMAILanguagePopVC.swift */; };
+		9F0201892A1DA28B00C9B673 /* KMAILanguagePopVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F0201852A1DA28B00C9B673 /* KMAILanguagePopVC.xib */; };
+		9F02018A2A1DA28B00C9B673 /* KMAILanguagePopVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F0201852A1DA28B00C9B673 /* KMAILanguagePopVC.xib */; };
+		9F02018B2A1DA28B00C9B673 /* KMAILanguagePopVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F0201852A1DA28B00C9B673 /* KMAILanguagePopVC.xib */; };
 		9F080B0F298A55A300FC27DA /* KMConvertURLToPDF.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F080B0D298A55A300FC27DA /* KMConvertURLToPDF.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
 		9F080B10298A55A300FC27DA /* KMConvertURLToPDF.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F080B0D298A55A300FC27DA /* KMConvertURLToPDF.m */; };
 		9F080B11298A55A300FC27DA /* KMConvertURLToPDF.m in Sources */ = {isa = PBXBuildFile; fileRef = 9F080B0D298A55A300FC27DA /* KMConvertURLToPDF.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
@@ -3447,6 +3468,13 @@
 		9F0201642A176AF200C9B673 /* KMDottedLineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMDottedLineView.swift; sourceTree = "<group>"; };
 		9F0201682A1B088700C9B673 /* KMAIOpenPDFFilesVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMAIOpenPDFFilesVC.swift; sourceTree = "<group>"; };
 		9F0201692A1B088700C9B673 /* KMAIOpenPDFFilesVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMAIOpenPDFFilesVC.xib; sourceTree = "<group>"; };
+		9F0201702A1B488C00C9B673 /* KMAITranslationVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMAITranslationVC.swift; sourceTree = "<group>"; };
+		9F0201712A1B488C00C9B673 /* KMAITranslationVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMAITranslationVC.xib; sourceTree = "<group>"; };
+		9F0201782A1B5C0300C9B673 /* KMAIServerConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMAIServerConfig.swift; sourceTree = "<group>"; };
+		9F02017C2A1BAC1600C9B673 /* KMAIRewritingVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMAIRewritingVC.swift; sourceTree = "<group>"; };
+		9F02017D2A1BAC1600C9B673 /* KMAIRewritingVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMAIRewritingVC.xib; sourceTree = "<group>"; };
+		9F0201842A1DA28B00C9B673 /* KMAILanguagePopVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMAILanguagePopVC.swift; sourceTree = "<group>"; };
+		9F0201852A1DA28B00C9B673 /* KMAILanguagePopVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMAILanguagePopVC.xib; sourceTree = "<group>"; };
 		9F080B0D298A55A300FC27DA /* KMConvertURLToPDF.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KMConvertURLToPDF.m; sourceTree = "<group>"; };
 		9F080B0E298A55A300FC27DA /* KMConvertURLToPDF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KMConvertURLToPDF.h; sourceTree = "<group>"; };
 		9F080B12298CFDB300FC27DA /* KMTextImageButtonVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMTextImageButtonVC.swift; sourceTree = "<group>"; };
@@ -5096,6 +5124,7 @@
 				BB3AD6F629935483004FC1AE /* Reachability */,
 				9F080B0E298A55A300FC27DA /* KMConvertURLToPDF.h */,
 				9F080B0D298A55A300FC27DA /* KMConvertURLToPDF.m */,
+				9F0201782A1B5C0300C9B673 /* KMAIServerConfig.swift */,
 			);
 			path = NSObject;
 			sourceTree = "<group>";
@@ -5501,6 +5530,12 @@
 				9F1F82BB292E01860092C4B4 /* KMCloudEmptyCollectionViewItem.xib */,
 				9F0201682A1B088700C9B673 /* KMAIOpenPDFFilesVC.swift */,
 				9F0201692A1B088700C9B673 /* KMAIOpenPDFFilesVC.xib */,
+				9F0201702A1B488C00C9B673 /* KMAITranslationVC.swift */,
+				9F0201712A1B488C00C9B673 /* KMAITranslationVC.xib */,
+				9F02017C2A1BAC1600C9B673 /* KMAIRewritingVC.swift */,
+				9F02017D2A1BAC1600C9B673 /* KMAIRewritingVC.xib */,
+				9F0201842A1DA28B00C9B673 /* KMAILanguagePopVC.swift */,
+				9F0201852A1DA28B00C9B673 /* KMAILanguagePopVC.xib */,
 				9F72D20E2994BDCC00DCACF1 /* customViewController */,
 			);
 			path = ViewController;
@@ -9171,6 +9206,7 @@
 				BBC348362955A118008D2CD1 /* KMCreateBackgroundController.xib in Resources */,
 				9F0CB4C02977C06300007028 /* KMPropertiesPanelColorSubVC.xib in Resources */,
 				ADD1B6F42946C07800C3FFF7 /* KMPrintChoosePageSizePosterView.xib in Resources */,
+				9F0201892A1DA28B00C9B673 /* KMAILanguagePopVC.xib in Resources */,
 				AD0FA50E29A9E75000EDEB50 /* KMLoginInputPasswordView.xib in Resources */,
 				BB8F4542295A98960037EA22 /* KMHeaderFooterPropertyController.xib in Resources */,
 				9FA693AB2987C0590055488A /* KMStepperView.xib in Resources */,
@@ -9195,6 +9231,8 @@
 				ADCB98FD292750A200B51A03 /* KMBatchProcessingTableView.xib in Resources */,
 				9FBA0F0129015A82001117AF /* KMFastToolCollectionViewItem.xib in Resources */,
 				BBFBE6C528DD7B98008B2335 /* Main.storyboard in Resources */,
+				9F0201752A1B488C00C9B673 /* KMAITranslationVC.xib in Resources */,
+				9F0201812A1BAC1600C9B673 /* KMAIRewritingVC.xib in Resources */,
 				ADE3C1E729A5ABC200793B13 /* KMLoginWindowController.xib in Resources */,
 				9FD0FA2C29CD3ED400F2AB0D /* KMRightSideEmptyVC.xib in Resources */,
 				9F8539F92947137500DF644E /* newtab_p.pdf in Resources */,
@@ -9251,6 +9289,7 @@
 				ADF1569829A62D31001D1018 /* KMLoginLeftImageView.xib in Resources */,
 				89316856296E45CA0073EA59 /* KMImageAccessoryController.xib in Resources */,
 				BBC3483F2955A60B008D2CD1 /* KMBackgroundPropertyInfoController.xib in Resources */,
+				9F02018A2A1DA28B00C9B673 /* KMAILanguagePopVC.xib in Resources */,
 				9FA693AC2987C0590055488A /* KMStepperView.xib in Resources */,
 				899700E328F3A9F2009AF911 /* KMHomeWindowController.xib in Resources */,
 				BB8F4543295A98960037EA22 /* KMHeaderFooterPropertyController.xib in Resources */,
@@ -9269,6 +9308,7 @@
 				89D2D2B72947316900BFF5FE /* Quick Start Guide_Widget_Widget.pdf in Resources */,
 				ADCB98CE2924743300B51A03 /* KMBatchProcessingView.xib in Resources */,
 				BB4EEF3129763EE7003A3537 /* KMRedactBaseWindowController.xib in Resources */,
+				9F0201762A1B488C00C9B673 /* KMAITranslationVC.xib in Resources */,
 				9F72D20C2994BDAF00DCACF1 /* KMNotificationVC.xib in Resources */,
 				9F3D819729A33A290087B5AD /* KMDesignDropdown.xib in Resources */,
 				BBFE6E792930E53000142C01 /* KMMergePopoverViewController.xib in Resources */,
@@ -9471,6 +9511,7 @@
 				9FD0FA4F29D43D6800F2AB0D /* KMDeviceBrowserWindowController.xib in Resources */,
 				F3B698A9298BC84500E0EB4D /* KMDocumentAIPopViewController.xib in Resources */,
 				9F1F82CE292F6CF90092C4B4 /* KMPDFInsertPageWindow.xib in Resources */,
+				9F0201822A1BAC1600C9B673 /* KMAIRewritingVC.xib in Resources */,
 				89E4E7422964160F002DBA6F /* KMAnnotationLinkViewController.xib in Resources */,
 				89752DEE293875FC003FF08E /* KMMainToolbarController.xib in Resources */,
 				BB49ED0A293F461500C82CA2 /* KMConvertCSVWindowController.xib in Resources */,
@@ -9619,6 +9660,7 @@
 				BB7507EE29861C37002DBDB1 /* PasswordWindowController.xib in Resources */,
 				F3B698AA298BC84500E0EB4D /* KMDocumentAIPopViewController.xib in Resources */,
 				BBC348402955A60B008D2CD1 /* KMBackgroundPropertyInfoController.xib in Resources */,
+				9F0201832A1BAC1600C9B673 /* KMAIRewritingVC.xib in Resources */,
 				9FDD0F9E2952FF4D000C4DAD /* comp-light.json in Resources */,
 				ADB1FEA42975303F00ED072D /* KMBatchBatesNumberView.xib in Resources */,
 				9F94747D29FA22700042F949 /* InfoPlist.strings in Resources */,
@@ -9669,6 +9711,7 @@
 				ADB1FE8429752F3200ED072D /* KMBatchSecurityView.xib in Resources */,
 				9FBA0EE628FEC253001117AF /* KMProductPromotionViewController.xib in Resources */,
 				89E9B3FB295BE2EC00AEFA61 /* KMEditPDFTextPropertyViewController.xib in Resources */,
+				9F02018B2A1DA28B00C9B673 /* KMAILanguagePopVC.xib in Resources */,
 				BB1EC8032967B26700EC0BC3 /* KMPDFEditViewController.xib in Resources */,
 				BBD1F781296F9BE000343885 /* KMPageEditSettingBaseWindowController.xib in Resources */,
 				BB5DF1EE2959C5CB0025CDA1 /* KMHeaderFooterPreviewController.xib in Resources */,
@@ -9783,6 +9826,7 @@
 				BB99ACC7292DE22E0048AFD9 /* KMMergeViewController.xib in Resources */,
 				AD867F8D29D950B400F00440 /* KMBOTAOutlineView.xib in Resources */,
 				9F1F82CF292F6CF90092C4B4 /* KMPDFInsertPageWindow.xib in Resources */,
+				9F0201772A1B488C00C9B673 /* KMAITranslationVC.xib in Resources */,
 				89E93EDD2999DA6D00F10F66 /* KMNoteFilterCollevtionViewItem.xib in Resources */,
 				ADE3C1B029A4779E00793B13 /* KMPrintAccessoryController.xib in Resources */,
 				9FAAA32F290BD01D0046FFCE /* KMHomeHistoryFileViewController.xib in Resources */,
@@ -10041,6 +10085,7 @@
 				9F81ADC229B87C7F002251F4 /* KMConvertPDFManagerOC.m in Sources */,
 				BB5DF1E92959C5CB0025CDA1 /* KMHeaderFooterPreviewController.swift in Sources */,
 				9FDD0F6B294AD12C000C4DAD /* KMMainViewController+UI.swift in Sources */,
+				9F02017E2A1BAC1600C9B673 /* KMAIRewritingVC.swift in Sources */,
 				89D9897428FE743E003A3E87 /* KMOutlineView.swift in Sources */,
 				89752E1D2942CB03003FF08E /* KMSearchMode.swift in Sources */,
 				AD3A3587294C11ED00D72802 /* KMPrintPreviewPresenter.swift in Sources */,
@@ -10120,6 +10165,7 @@
 				BB49ECF1293F40F500C82CA2 /* KMConvertPageRangeSettingItemView.swift in Sources */,
 				9F0CB46F2967E63100007028 /* KMPropertiesPanelNameSubVC.swift in Sources */,
 				9FD0FA3129CD947000F2AB0D /* KMOpacityPanel.swift in Sources */,
+				9F0201792A1B5C0300C9B673 /* KMAIServerConfig.swift in Sources */,
 				9F1FE4F329406E4700E952CA /* FastResizeView.m in Sources */,
 				9F1FE4FC29406E4700E952CA /* CTTabStripController.m in Sources */,
 				BB146FCC299DC0D100784A6A /* GTMSessionUploadFetcher.m in Sources */,
@@ -10463,6 +10509,7 @@
 				BBB14A532978DD5400936EDB /* KMRedactTools.swift in Sources */,
 				BB5F8A1129BB04F000365ADB /* GBDeviceInfo_Common.m in Sources */,
 				BBAFC83C2985194800D0648E /* KMPDFEditAppendWindow.m in Sources */,
+				9F0201722A1B488C00C9B673 /* KMAITranslationVC.swift in Sources */,
 				89E4E6F52963D1E9002DBA6F /* KMAnnotationPropertiesColorManager.m in Sources */,
 				9FDD0F8C2952FCE0000C4DAD /* KMGlobalParser.swift in Sources */,
 				BB897251294C3F660045787C /* KMMenuTableView.swift in Sources */,
@@ -10485,6 +10532,7 @@
 				BB146FE4299DC0D100784A6A /* GTLRURITemplate.m in Sources */,
 				9F1FE50D29407B2B00E952CA /* KMUploadFilePanel.swift in Sources */,
 				89E4E6E32963CD82002DBA6F /* KMGeneralAnnotationViewController.m in Sources */,
+				9F0201862A1DA28B00C9B673 /* KMAILanguagePopVC.swift in Sources */,
 				9F0CB4BD2977C06300007028 /* KMPropertiesPanelColorSubVC.swift in Sources */,
 				BBB9B328299A5D6D004F3235 /* GTMAppAuthFetcherAuthorization+Keychain.m in Sources */,
 				ADC25DF92923BA710080A3F6 /* KMImageToPDFWindowController.swift in Sources */,
@@ -10936,6 +10984,7 @@
 				ADBC2D12299CCD05006280C8 /* KMTextfieldButton.swift in Sources */,
 				9F1FE49429406E4700E952CA /* common.m in Sources */,
 				AD0FA51329A9FA8600EDEB50 /* KMResetPasswordView.swift in Sources */,
+				9F0201732A1B488C00C9B673 /* KMAITranslationVC.swift in Sources */,
 				BBFBE74728DD7DB7008B2335 /* ViewController.swift in Sources */,
 				9FDD0F812952FC36000C4DAD /* KMDesignToken.swift in Sources */,
 				BB147036299DC0D200784A6A /* OIDRegistrationResponse.m in Sources */,
@@ -11061,6 +11110,7 @@
 				9F0CB536298656F900007028 /* KMDesignToken+BorderWidthLeft.swift in Sources */,
 				BBA8B7AB2935DC120097D183 /* KMRemovePasswordResultTipView.swift in Sources */,
 				ADCB9972292C65EE00B51A03 /* KMGOCROperation.m in Sources */,
+				9F02017F2A1BAC1600C9B673 /* KMAIRewritingVC.swift in Sources */,
 				9FDD0F78294FEF64000C4DAD /* KMConvertPDFManager.swift in Sources */,
 				ADC075CB29866DDC006C752F /* KMBatchConvertPDFItemView.swift in Sources */,
 				8942F80429262B2E00389627 /* KMSideViewController.swift in Sources */,
@@ -11075,6 +11125,7 @@
 				8942F818292B678100389627 /* KMAnnotationTableCellView.swift in Sources */,
 				BB8F456A295ABDC10037EA22 /* KMWatermarkAdjectiveBaseModel.swift in Sources */,
 				9F0CB53A2986570600007028 /* KMDesignToken+BoxShadow.swift in Sources */,
+				9F02017A2A1B5C0300C9B673 /* KMAIServerConfig.swift in Sources */,
 				9F0CB4B62977BC1000007028 /* KMPropertiesPanelPreviewSubVC.swift in Sources */,
 				9F1FE4E229406E4700E952CA /* GTMNSAnimation+Duration.m in Sources */,
 				ADB1FE9F2975303400ED072D /* KMBatchBatesNumberView.swift in Sources */,
@@ -11093,6 +11144,7 @@
 				BB897252294C3F660045787C /* KMMenuTableView.swift in Sources */,
 				9F1FE4CD29406E4700E952CA /* CTTabContentsController.m in Sources */,
 				8942F7BC29222C7E00389627 /* KMBookCellView.swift in Sources */,
+				9F0201872A1DA28B00C9B673 /* KMAILanguagePopVC.swift in Sources */,
 				BBEC00DA295C39FD00A26C98 /* KMBatesPropertyInfoController.swift in Sources */,
 				9F0CB52A298656C900007028 /* KMDesignToken+BorderWidthTop.swift in Sources */,
 				BB4EEF492976504C003A3537 /* KMRedactColorView.swift in Sources */,
@@ -11387,6 +11439,7 @@
 				BB897260294C5DDA0045787C /* KMWatermarkPropertyInfoController.swift in Sources */,
 				F3732316292DF9410013862C /* CPDFTextAnnotation+PDFListView.m in Sources */,
 				BBB1A3A029F6128200E54E47 /* KMSystemMenu.swift in Sources */,
+				9F0201882A1DA28B00C9B673 /* KMAILanguagePopVC.swift in Sources */,
 				F37322EC292DF9410013862C /* CPDFStampAnnotation+PDFListView.m in Sources */,
 				BB8F4562295AA39F0037EA22 /* KMHeaderFooterModel.swift in Sources */,
 				BBAFC85429851A9800D0648E /* KMBatchTableRowView.m in Sources */,
@@ -11694,6 +11747,7 @@
 				BB147037299DC0D200784A6A /* OIDRegistrationResponse.m in Sources */,
 				9F221ED929A9EC0900978A59 /* KMFillSignTextPanel.swift in Sources */,
 				89752DC42937033F003FF08E /* KMPopMenuButtonCell.m in Sources */,
+				9F0201742A1B488C00C9B673 /* KMAITranslationVC.swift in Sources */,
 				89E4E6F72963D1E9002DBA6F /* KMAnnotationPropertiesColorManager.m in Sources */,
 				ADCB98CB2924741B00B51A03 /* KMBatchProcessingView.swift in Sources */,
 				BB146FCE299DC0D100784A6A /* GTMSessionUploadFetcher.m in Sources */,
@@ -11913,6 +11967,7 @@
 				BB146FFE299DC0D100784A6A /* OIDAuthState+Mac.m in Sources */,
 				AD88108F29A760D100178CA1 /* KMRegisterPresenter.swift in Sources */,
 				BB3AAB9229878CE000992A5A /* KMWatermarkAdjectivePropertyMainController.swift in Sources */,
+				9F0201802A1BAC1600C9B673 /* KMAIRewritingVC.swift in Sources */,
 				ADE3C1A129A3894900793B13 /* KMSearchTableRowView.swift in Sources */,
 				AD8810A229A8459000178CA1 /* KMComparativeTableViewController.swift in Sources */,
 				9F0CB4A129683E2600007028 /* KMPropertiesPanelSizeSubVC.swift in Sources */,
@@ -12066,6 +12121,7 @@
 				9F0201672A176AF200C9B673 /* KMDottedLineView.swift in Sources */,
 				896DD46929893B9900ADE514 /* KMSplitView.m in Sources */,
 				ADB1FE7829752F0900ED072D /* KMBatchCompressView.swift in Sources */,
+				9F02017B2A1B5C0300C9B673 /* KMAIServerConfig.swift in Sources */,
 				AD88109829A78ADC00178CA1 /* KMVerificationCodeView.swift in Sources */,
 				9F0CB4FF298655F600007028 /* KMDesignToken+BorderColor.swift in Sources */,
 				AD71E7C62990A8A4001C5D3F /* KMBatchRemoveViewModel.swift in Sources */,

+ 12 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/ic_transtate.imageset/Contents.json

@@ -0,0 +1,12 @@
+{
+  "images" : [
+    {
+      "filename" : "translate.pdf",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 103 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/ic_transtate.imageset/translate.pdf

@@ -0,0 +1,103 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 2.000000 13.402344 cm
+0.807843 0.815686 0.831373 scn
+13.707107 7.804763 m
+13.316583 8.195288 12.683417 8.195288 12.292893 7.804763 c
+11.902369 7.414239 11.902369 6.781074 12.292893 6.390550 c
+16.585787 2.097656 l
+1.000000 2.097656 l
+0.447715 2.097656 0.000000 1.649941 0.000000 1.097656 c
+0.000000 0.545372 0.447715 0.097656 1.000000 0.097656 c
+19.000010 0.097656 l
+19.137356 0.097656 19.268251 0.125351 19.387386 0.175453 c
+19.494566 0.220429 19.595499 0.284907 19.684774 0.368887 c
+19.699940 0.383142 19.714661 0.397867 19.728912 0.413034 c
+19.811529 0.500896 19.875261 0.600045 19.920111 0.705322 c
+19.971542 0.825784 20.000010 0.958396 20.000010 1.097656 c
+20.000010 1.236917 19.971542 1.369529 19.920111 1.489991 c
+19.875261 1.595268 19.811529 1.694417 19.728912 1.782279 c
+19.720959 1.790744 19.712856 1.799072 19.704615 1.807256 c
+13.707107 7.804763 l
+h
+f*
+n
+Q
+q
+-1.000000 -0.000000 -0.000000 1.000000 22.399414 2.402344 cm
+0.807843 0.815686 0.831373 scn
+3.414221 6.097656 m
+7.707130 1.804764 l
+8.097655 1.414241 8.097656 0.781076 7.707133 0.390551 c
+7.316609 0.000026 6.683444 0.000025 6.292920 0.390548 c
+0.292895 6.390548 l
+-0.097630 6.781072 -0.097632 7.414237 0.292892 7.804761 c
+0.402131 7.914001 0.530356 7.992684 0.666945 8.040810 c
+0.771161 8.077625 0.883302 8.097656 1.000122 8.097656 c
+1.000375 8.097656 l
+19.000137 8.097656 l
+19.552422 8.097656 20.000137 7.649941 20.000137 7.097656 c
+20.000137 6.545372 19.552422 6.097656 19.000137 6.097656 c
+3.414221 6.097656 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  1559
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 24.000000 24.000000 ]
+     /Resources 1 0 R
+     /Contents 2 0 R
+     /Parent 5 0 R
+  >>
+endobj
+
+5 0 obj
+  << /Kids [ 4 0 R ]
+     /Count 1
+     /Type /Pages
+  >>
+endobj
+
+6 0 obj
+  << /Pages 5 0 R
+     /Type /Catalog
+  >>
+endobj
+
+xref
+0 7
+0000000000 65535 f
+0000000010 00000 n
+0000000034 00000 n
+0000001649 00000 n
+0000001672 00000 n
+0000001845 00000 n
+0000001919 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+1978
+%%EOF

+ 12 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_error.imageset/Contents.json

@@ -0,0 +1,12 @@
+{
+  "images" : [
+    {
+      "filename" : "icon.pdf",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 89 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_error.imageset/icon.pdf

@@ -0,0 +1,89 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 1.000000 1.000000 cm
+0.954167 0.274323 0.355904 scn
+14.000000 7.000000 m
+14.000000 3.134007 10.865993 0.000000 7.000000 0.000000 c
+3.134007 0.000000 0.000000 3.134007 0.000000 7.000000 c
+0.000000 10.865993 3.134007 14.000000 7.000000 14.000000 c
+10.865993 14.000000 14.000000 10.865993 14.000000 7.000000 c
+h
+f
+n
+Q
+q
+1.000000 0.000000 -0.000000 1.000000 7.250000 4.000000 cm
+1.000000 1.000000 1.000000 scn
+0.000000 8.000000 m
+0.000000 3.000000 l
+1.500000 3.000000 l
+1.500000 8.000000 l
+0.000000 8.000000 l
+h
+0.000000 1.500000 m
+0.000000 0.000000 l
+1.500000 0.000000 l
+1.500000 1.500000 l
+0.000000 1.500000 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  684
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 16.000000 16.000000 ]
+     /Resources 1 0 R
+     /Contents 2 0 R
+     /Parent 5 0 R
+  >>
+endobj
+
+5 0 obj
+  << /Kids [ 4 0 R ]
+     /Count 1
+     /Type /Pages
+  >>
+endobj
+
+6 0 obj
+  << /Pages 5 0 R
+     /Type /Catalog
+  >>
+endobj
+
+xref
+0 7
+0000000000 65535 f
+0000000010 00000 n
+0000000034 00000 n
+0000000774 00000 n
+0000000796 00000 n
+0000000969 00000 n
+0000001043 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+1102
+%%EOF

+ 46 - 0
PDF Office/PDF Master/Class/Home/NSObject/KMAIServerConfig.swift

@@ -0,0 +1,46 @@
+//
+//  KMAIServerConfig.swift
+//  PDF Master
+//
+//  Created by wanjun on 2023/5/22.
+//
+
+import Cocoa
+
+class KMAIServerConfig: NSObject {
+    var isDebug: Bool = false
+    var aiTranslationURL: String {
+        get {
+            #if DEBUG
+            if self.isDebug {
+                //测试服务器
+                return "http://101.132.103.13:8030"
+            } else {
+                //正式服务器
+//                return "https://ai.compdf.com"
+                return "http://101.132.103.13:8030"
+            }
+            #else
+            //正式服务器
+            return "https://ai.compdf.com"
+            #endif
+        }
+    }
+    
+    var aiRewritingURL: String {
+        get {
+            #if DEBUG
+            if self.isDebug {
+                //测试服务器
+                return "http://api-us-east-1.compdf.com:8082"
+            } else {
+                //正式服务器
+                return "https://ai.compdf.com"
+            }
+            #else
+            //正式服务器
+            return "https://ai.compdf.com"
+            #endif
+        }
+    }
+}

+ 170 - 0
PDF Office/PDF Master/Class/Home/ViewController/KMAILanguagePopVC.swift

@@ -0,0 +1,170 @@
+//
+//  KMAILanguagePopVC.swift
+//  PDF Master
+//
+//  Created by wanjun on 2023/5/24.
+//
+
+import Cocoa
+
+typealias aiLanguagePopCellViewDownCallback = (_ language: String) -> Void
+
+class KMAILanguagePopTableviewCell: NSTableCellView {
+    
+    @IBOutlet weak var mainBox: KMBox!
+    @IBOutlet weak var languageLabel: NSTextField!
+    var selectUrls: [URL] = []
+    var isSelect: Bool = false
+
+    // MARK: Init
+    
+    override func awakeFromNib() {
+        super.awakeFromNib()
+        
+        self.mainBox.fillColor = .clear
+        self.languageLabel.textColor = NSColor(hex: "#252629")
+        self.languageLabel.font = NSFont.SFProTextRegular(14.0)
+        
+        self.mainBox.moveCallback =  { [unowned self](mouseEntered: Bool, mouseBox: KMBox) -> Void in
+            if !self.isSelect {
+                if mouseEntered {
+                    self.mainBox.fillColor = NSColor(hex: "#EDEEF0")
+                } else {
+                    self.mainBox.fillColor = .clear
+                }
+            }
+        }
+        self.mainBox.downCallback = { [unowned self](downEntered: Bool, mouseBox: KMBox, event) -> Void in
+            if downEntered {
+                if !self.isSelect {
+                    self.mainBox.fillColor = NSColor(hex: "#1770F4", alpha: 0.1)
+                }
+            }
+        }
+    }
+    
+    // MARK: Private Methods
+    
+    func initializeUI(_ url: URL) -> Void {
+    }
+     
+    // MARK: Action
+}
+
+class KMAILanguagePopVC: NSViewController, NSTableViewDelegate, NSTableViewDataSource {
+
+    @IBOutlet weak var tableView: NSTableView!
+    @IBOutlet weak var customBoxWidthLayoutConstraint: NSLayoutConstraint!
+    @IBOutlet weak var customBoxHeightLayoutConstraint: NSLayoutConstraint!
+    
+    var languages: [String] = []
+    var downCallback: aiLanguagePopCellViewDownCallback?
+
+    func initWithPopViewDataArr(_ popViewDataArr: [String]) -> Self {
+        self.languages = popViewDataArr
+        return self
+    }
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+        
+        
+    }
+    
+    override func viewDidAppear() {
+        super.viewDidAppear()
+        self.tableView.reloadData()
+    }
+    
+    // MARK: NSTableViewDelegate
+    
+    func tableView(_ tableView: NSTableView, heightOfRow row: Int) -> CGFloat {
+        return 32.0;
+    }
+    
+    func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
+        let language: String = languages[row] as! String
+        let identifier = tableColumn?.identifier
+        let cellView: KMAILanguagePopTableviewCell = tableView.makeView(withIdentifier:identifier!, owner: self) as! KMAILanguagePopTableviewCell
+        cellView.languageLabel.stringValue = language
+//        cellView.selectUrls = selectFiles
+//        cellView.initializeUI(url)
+//        cellView.highlightCell(multipleChoicesInts, row)
+//        cellView.mainBox.downCallback = { [unowned self](downEntered: Bool, mouseBox: KMBox, event) -> Void in
+//            if self != nil {
+//                if downEntered {
+//                    if self.allowMultipleChoices_shift {
+//                        if self.selectFiles_shift.count == 0 {
+//                            self.selectFiles.append(url)
+//                            self.selectFiles_shift.append(row)
+//                        } else if self.selectFiles_shift.count == 1 {
+//                            let first = self.selectFiles_shift[0] as Int
+//                            self.selectFiles.removeAll()
+//                            if first > row {
+//                                for path in self.files[row...first] {
+//                                    self.selectFiles.append(path as! URL)
+//                                }
+//                            } else {
+//                                for path in self.files[first...row] {
+//                                    self.selectFiles.append(path as! URL)
+//                                }
+//                            }
+//                            self.selectFiles_shift.append(row)
+//                        } else if self.selectFiles_shift.count == 2 {
+//                            let first = self.selectFiles_shift[0] as Int
+//                            self.selectFiles.removeAll()
+//                            if first > row {
+//                                for path in self.files[row...first] {
+//                                    self.selectFiles.append(path as! URL)
+//                                }
+//                            } else {
+//                                for path in self.files[first...row] {
+//                                    self.selectFiles.append(path as! URL)
+//                                }
+//                            }
+//                            self.selectFiles_shift[1] = row
+//                        }
+//                    } else if self.allowMultipleChoices_cmd {
+//                        if self.selectFiles.contains(url) {
+//                            self.selectFiles.removeObject(url)
+//                        } else {
+//                            self.selectFiles.append(url)
+//                        }
+//                        if self.selectFiles_shift.contains(row) {
+//                            self.selectFiles_shift.removeObject(row)
+//                        } else {
+//                            self.selectFiles_shift.append(row)
+//                        }
+//                    } else {
+//                        self.selectFiles.removeAll()
+//                        self.selectFiles_shift.removeAll()
+//                        self.selectFiles.append(url)
+//                        self.selectFiles_shift.append(row)
+//                    }
+//                    tableView.reloadData()
+//                }
+//            }
+//        }
+        return cellView
+    }
+    
+    func tableViewSelectionDidChange(_ notification: Notification) {
+        let tableView: NSTableView = notification.object as? NSTableView ?? NSTableView()
+        if tableView == self.tableView {
+            if (self.tableView?.selectedRow != -1) {
+                if let callback = self.downCallback {
+                    callback(self.languages[self.tableView!.selectedRow])
+                }
+
+            }
+        }
+    }
+    
+    // MARK: NSTableViewDataSource
+    
+    func numberOfRows(in tableView: NSTableView) -> Int {
+        return languages.count
+    }
+    
+}

+ 118 - 0
PDF Office/PDF Master/Class/Home/ViewController/KMAILanguagePopVC.xib

@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="KMAILanguagePopVC" customModule="PDF_Master" customModuleProvider="target">
+            <connections>
+                <outlet property="customBoxHeightLayoutConstraint" destination="rdA-eT-dCB" id="pPf-fQ-F6v"/>
+                <outlet property="customBoxWidthLayoutConstraint" destination="MB3-kd-CwY" id="vvd-ZD-sZa"/>
+                <outlet property="tableView" destination="AiV-eI-jJC" id="I0w-aH-KRV"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="207" height="441"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <scrollView autohidesScrollers="YES" horizontalLineScroll="24" horizontalPageScroll="10" verticalLineScroll="24" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zqa-UQ-ORh">
+                    <rect key="frame" x="0.0" y="0.0" width="207" height="441"/>
+                    <clipView key="contentView" id="T3e-Ee-rVs">
+                        <rect key="frame" x="1" y="1" width="205" height="439"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="none" multipleSelection="NO" autosaveColumns="NO" rowHeight="24" rowSizeStyle="automatic" viewBased="YES" id="AiV-eI-jJC">
+                                <rect key="frame" x="0.0" y="0.0" width="205" height="439"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <size key="intercellSpacing" width="17" height="0.0"/>
+                                <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
+                                <tableColumns>
+                                    <tableColumn identifier="AutomaticTableColumnIdentifier.0" width="193" minWidth="40" maxWidth="1000" id="5UU-2A-kde">
+                                        <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
+                                            <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
+                                        </tableHeaderCell>
+                                        <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" title="Text Cell" id="FtA-cD-ymX">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                        <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
+                                        <prototypeCellViews>
+                                            <tableCellView id="sWi-zz-Afb" customClass="KMAILanguagePopTableviewCell" customModule="PDF_Master" customModuleProvider="target">
+                                                <rect key="frame" x="8" y="0.0" width="188" height="24"/>
+                                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                <subviews>
+                                                    <box boxType="custom" borderWidth="0.0" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="jU9-UR-X43" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
+                                                        <rect key="frame" x="0.0" y="0.0" width="188" height="24"/>
+                                                        <view key="contentView" id="JB2-fC-90U">
+                                                            <rect key="frame" x="0.0" y="0.0" width="188" height="24"/>
+                                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                            <subviews>
+                                                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="GqM-tb-dE5">
+                                                                    <rect key="frame" x="6" y="4" width="176" height="16"/>
+                                                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="KGr-nC-kUD">
+                                                                        <font key="font" usesAppearanceFont="YES"/>
+                                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                                    </textFieldCell>
+                                                                </textField>
+                                                            </subviews>
+                                                            <constraints>
+                                                                <constraint firstItem="GqM-tb-dE5" firstAttribute="centerY" secondItem="JB2-fC-90U" secondAttribute="centerY" id="OZO-Gu-bnj"/>
+                                                                <constraint firstAttribute="trailing" secondItem="GqM-tb-dE5" secondAttribute="trailing" constant="8" id="RaM-zc-KwC"/>
+                                                                <constraint firstItem="GqM-tb-dE5" firstAttribute="leading" secondItem="JB2-fC-90U" secondAttribute="leading" constant="8" id="qgF-kp-WKs"/>
+                                                            </constraints>
+                                                        </view>
+                                                    </box>
+                                                </subviews>
+                                                <constraints>
+                                                    <constraint firstAttribute="bottom" secondItem="jU9-UR-X43" secondAttribute="bottom" id="GCu-Rn-2wc"/>
+                                                    <constraint firstAttribute="trailing" secondItem="jU9-UR-X43" secondAttribute="trailing" id="UnO-Ah-ynL"/>
+                                                    <constraint firstItem="jU9-UR-X43" firstAttribute="leading" secondItem="sWi-zz-Afb" secondAttribute="leading" id="hR1-Kf-qvn"/>
+                                                    <constraint firstItem="jU9-UR-X43" firstAttribute="top" secondItem="sWi-zz-Afb" secondAttribute="top" id="ld0-vw-kfA"/>
+                                                </constraints>
+                                                <connections>
+                                                    <outlet property="languageLabel" destination="GqM-tb-dE5" id="IdR-PZ-0ET"/>
+                                                    <outlet property="mainBox" destination="jU9-UR-X43" id="mY0-Pb-k61"/>
+                                                </connections>
+                                            </tableCellView>
+                                        </prototypeCellViews>
+                                    </tableColumn>
+                                </tableColumns>
+                                <connections>
+                                    <outlet property="dataSource" destination="-2" id="9Mc-Lc-0yL"/>
+                                    <outlet property="delegate" destination="-2" id="6H3-VB-Oxr"/>
+                                </connections>
+                            </tableView>
+                        </subviews>
+                    </clipView>
+                    <constraints>
+                        <constraint firstAttribute="width" constant="207" id="MB3-kd-CwY"/>
+                        <constraint firstAttribute="height" constant="441" id="rdA-eT-dCB"/>
+                    </constraints>
+                    <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="INY-9b-67r">
+                        <rect key="frame" x="1" y="119" width="223" height="15"/>
+                        <autoresizingMask key="autoresizingMask"/>
+                    </scroller>
+                    <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="bV5-KW-cD2">
+                        <rect key="frame" x="224" y="17" width="15" height="102"/>
+                        <autoresizingMask key="autoresizingMask"/>
+                    </scroller>
+                </scrollView>
+            </subviews>
+            <constraints>
+                <constraint firstItem="zqa-UQ-ORh" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" id="Vfd-Yo-udL"/>
+                <constraint firstAttribute="trailing" secondItem="zqa-UQ-ORh" secondAttribute="trailing" id="Y3y-hV-S8z"/>
+                <constraint firstAttribute="bottom" secondItem="zqa-UQ-ORh" secondAttribute="bottom" id="dmE-MK-Uj6"/>
+                <constraint firstItem="zqa-UQ-ORh" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" id="sXK-Qf-aMP"/>
+            </constraints>
+            <point key="canvasLocation" x="2.5" y="237.5"/>
+        </customView>
+    </objects>
+</document>

+ 190 - 0
PDF Office/PDF Master/Class/Home/ViewController/KMAIRewritingVC.swift

@@ -0,0 +1,190 @@
+//
+//  KMAIRewritingVC.swift
+//  PDF Master
+//
+//  Created by wanjun on 2023/5/22.
+//
+
+import Cocoa
+
+@objc enum KMAIRewritingState : Int {
+    case AIRewriting = 0
+    case AIErrorCorrection
+}
+
+//class KMAIRewritingVC: NSViewController {
+//}
+
+class KMAIRewritingVC: NSViewController {
+
+    @IBOutlet weak var aiRewritingLabel: NSTextField!
+    @IBOutlet weak var aiRewritingSubLabel: NSTextField!
+    @IBOutlet weak var rewritingBox: KMBox!
+    @IBOutlet weak var rewritingLabel: NSTextField!
+    @IBOutlet weak var rewritingButton: NSButton!
+
+    @IBOutlet weak var rewritingTextBox: NSBox!
+    @IBOutlet weak var rewritingTextField: NSTextField!
+    @IBOutlet weak var wordsLabel: NSTextField!
+
+    @IBOutlet weak var resultLabel: NSTextField!
+    @IBOutlet weak var copyBox: KMBox!
+    @IBOutlet weak var copyLabel: NSTextField!
+    @IBOutlet weak var copyButton: NSButton!
+    
+    @IBOutlet weak var resultTextBox: NSBox!
+    @IBOutlet weak var resultTextView: NSTextView!
+    @IBOutlet weak var emptyImageView: NSImageView!
+    
+    @IBOutlet weak var errorView: NSView!
+    @IBOutlet weak var errorImageView: NSImageView!
+    @IBOutlet weak var errorLabel: NSTextField!
+
+    @IBOutlet weak var progressView: NSProgressIndicator!
+    
+    var state: KMAIRewritingState = .AIRewriting
+    
+    var isExceed: Bool = false
+    var canRewriting: Bool = false
+    var canCopy: Bool = false
+
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+        
+        self.initLocalization()
+        self.initializeUI()
+    }
+    
+    // MARK: initialize
+    
+    func initializeUI() -> Void {
+        self.progressView.isHidden = true
+
+        self.aiRewritingLabel.textColor = NSColor(hex: "#252629")
+        self.aiRewritingLabel.font = NSFont.SFProTextSemibold(20.0)
+        self.aiRewritingSubLabel.textColor = NSColor(hex: "#94989C")
+        self.aiRewritingSubLabel.font = NSFont.SFProTextRegular(14.0)
+        self.rewritingBox.fillColor = NSColor(hex: "#BDDFFD")
+        self.rewritingBox.cornerRadius = 4.0
+        self.rewritingLabel.textColor = NSColor(hex: "#F7F8FA")
+        self.rewritingLabel.font = NSFont.SFProTextRegular(14.0)
+        self.rewritingTextBox.borderColor = NSColor(hex: "#1770F4")
+        self.wordsLabel.textColor = NSColor(hex: "#94989C")
+        self.wordsLabel.font = NSFont.SFProTextRegular(14.0)
+
+        self.resultLabel.textColor = NSColor(hex: "#252629")
+        self.resultLabel.font = NSFont.SFProTextSemibold(20.0)
+        self.copyBox.borderColor = NSColor(hex: "#DFE1E5")
+        self.copyBox.fillColor = NSColor(hex: "#EDEEF0")
+        self.copyBox.cornerRadius = 4.0
+        self.copyBox.borderWidth = 1.0
+        self.copyLabel.textColor = NSColor(hex: "#B1B3B8")
+        self.copyLabel.font = NSFont.SFProTextRegular(14.0)
+        self.resultTextBox.borderColor = NSColor(hex: "#DFE1E5")
+        
+        self.errorView.isHidden = true
+        self.errorImageView.image = NSImage(named: "icon_error")
+        self.errorLabel.textColor = NSColor(hex: "#F3465B")
+        self.errorLabel.font = NSFont.SFProTextRegular(12.0)
+    }
+    
+    func initLocalization() -> Void {
+        switch self.state {
+        case .AIRewriting:
+            self.aiRewritingLabel.stringValue = NSLocalizedString("AI Rewriting", comment: "")
+            self.aiRewritingSubLabel.stringValue = NSLocalizedString("Limited to 150 characters per session, 5 times per month", comment: "")
+            self.rewritingLabel.stringValue = NSLocalizedString("Rewriting", comment: "")
+            self.resultLabel.stringValue = NSLocalizedString("Result", comment: "")
+            self.copyLabel.stringValue = NSLocalizedString("Copy", comment: "")
+            self.rewritingTextField.placeholderString = NSLocalizedString("Please enter text content here...", comment: "")
+            self.wordsLabel.stringValue = NSLocalizedString("0/150", comment: "")
+            break
+        case .AIErrorCorrection:
+            self.aiRewritingLabel.stringValue = NSLocalizedString("AI Error Correction", comment: "")
+            self.aiRewritingSubLabel.stringValue = NSLocalizedString("Limited to 150 characters per session, 5 times per month", comment: "")
+            self.rewritingLabel.stringValue = NSLocalizedString("Rewriting", comment: "")
+            self.resultLabel.stringValue = NSLocalizedString("Result", comment: "")
+            self.copyLabel.stringValue = NSLocalizedString("Copy", comment: "")
+            self.rewritingTextField.placeholderString = NSLocalizedString("Please enter text content here...", comment: "")
+            self.wordsLabel.stringValue = NSLocalizedString("0/150", comment: "")
+            break
+        default:
+            break
+        }
+    }
+    
+    // MARK: Action
+    
+    @IBAction func aiRewritingAction(_ sender: NSButton) {
+        if self.canRewriting {
+            self.errorView.isHidden = true
+            self.progressView.isHidden = false
+            
+            let infoDictionary = Bundle .main.infoDictionary!
+            let majorVersion = infoDictionary["CFBundleShortVersionString"]
+            KMRequestServerManager.manager.aiRewriting(content: self.rewritingTextField.stringValue, version: "1.0.1", state: self.state) { [unowned self] success, result in
+                self.progressView.isHidden = true
+                let result: NSDictionary = result!.result
+                if success {
+                    self.copyBox.fillColor = NSColor(hex: "#FFFFFF")
+                    self.copyBox.borderColor = NSColor(hex: "#DFE1E5")
+                    self.copyLabel.textColor = NSColor(hex: "#252629")
+                    self.canCopy = true
+                    
+                    self.resultTextView.string = ""
+                    self.resultTextView.string =  result["content"] as? String ?? ""
+                } else {
+                    self.copyBox.borderColor = NSColor(hex: "#DFE1E5")
+                    self.copyBox.fillColor = NSColor(hex: "#EDEEF0")
+                    self.canCopy = false
+                    
+                    self.resultTextView.string = ""
+
+                    self.errorView.isHidden = false
+                    self.errorLabel.stringValue = "error"
+                }
+            }
+        }
+    }
+    
+    @IBAction func copyAction(_ sender: NSButton) {
+        if self.canCopy {
+            let pasteboard = NSPasteboard.general
+            pasteboard.clearContents()
+            pasteboard.setString(self.resultTextView.string, forType: .string)
+        }
+    }
+}
+
+extension KMAIRewritingVC: NSTextFieldDelegate {
+    func controlTextDidEndEditing(_ obj: Notification) {
+        let object = obj.object as! NSTextField
+        
+        
+    }
+    
+    func controlTextDidChange(_ obj: Notification) {
+        let object = obj.object as! NSTextField
+        self.wordsLabel.stringValue = String(format: "%d/150", object.stringValue.count)
+        
+        if object.stringValue.count > 0 {
+            self.rewritingBox.fillColor = NSColor(hex: "#1770F4")
+            self.rewritingLabel.textColor = NSColor(hex: "#FFFFFF")
+            self.canRewriting = true
+        } else {
+            self.rewritingBox.fillColor = NSColor(hex: "#BDDFFD")
+            self.rewritingLabel.textColor = NSColor(hex: "#F7F8FA")
+            self.canRewriting = false
+        }
+        
+        if object.stringValue.count >= 150 {
+            self.wordsLabel.textColor = NSColor(hex: "#F3465B")
+            self.isExceed = true
+        } else {
+            self.wordsLabel.textColor = NSColor(hex: "#94989C")
+            self.isExceed = false
+        }
+    }
+
+}

+ 292 - 0
PDF Office/PDF Master/Class/Home/ViewController/KMAIRewritingVC.xib

@@ -0,0 +1,292 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="KMAIRewritingVC" customModule="PDF_Master" customModuleProvider="target">
+            <connections>
+                <outlet property="aiRewritingLabel" destination="lIX-7t-9jP" id="Zgt-d2-Pwa"/>
+                <outlet property="aiRewritingSubLabel" destination="vVu-Al-W4D" id="uuD-vS-ZYI"/>
+                <outlet property="copyBox" destination="bYV-sq-gG7" id="Flf-DE-duw"/>
+                <outlet property="copyButton" destination="2xQ-KP-wue" id="Ob4-R1-xM2"/>
+                <outlet property="copyLabel" destination="dta-aQ-Ags" id="JvO-Vh-DKm"/>
+                <outlet property="emptyImageView" destination="4sx-UX-pUY" id="6GR-2s-Ut8"/>
+                <outlet property="errorImageView" destination="92Z-hh-WAn" id="g4b-en-gUl"/>
+                <outlet property="errorLabel" destination="rdP-tN-TLc" id="E37-eu-Wpx"/>
+                <outlet property="errorView" destination="Ku7-Fg-Cbu" id="KX8-wO-8Wr"/>
+                <outlet property="progressView" destination="jUa-Yh-Prc" id="xL4-4r-dwP"/>
+                <outlet property="resultLabel" destination="CcX-M0-1q3" id="y4c-Di-r2g"/>
+                <outlet property="resultTextBox" destination="4LD-1L-j3y" id="4x4-YF-FVe"/>
+                <outlet property="resultTextView" destination="t7u-24-0rL" id="9mk-Jg-2nv"/>
+                <outlet property="rewritingBox" destination="nAH-C5-vHu" id="zkC-PN-hfa"/>
+                <outlet property="rewritingButton" destination="Bwd-Jk-59S" id="Fnx-d0-72G"/>
+                <outlet property="rewritingLabel" destination="XAQ-c3-FGO" id="33g-Bs-Hp2"/>
+                <outlet property="rewritingTextBox" destination="m6U-x3-0JF" id="xJP-4B-3K7"/>
+                <outlet property="rewritingTextField" destination="FtX-Qb-KWb" id="3lj-E5-kF1"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+                <outlet property="wordsLabel" destination="vkz-r4-Z4u" id="vI1-Qk-dcH"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="986" height="814"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="lIX-7t-9jP">
+                    <rect key="frame" x="30" y="758" width="926" height="16"/>
+                    <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="y6B-SB-zhf">
+                        <font key="font" usesAppearanceFont="YES"/>
+                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                    </textFieldCell>
+                </textField>
+                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="vVu-Al-W4D">
+                    <rect key="frame" x="30" y="742" width="37" height="16"/>
+                    <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="6r0-Xz-gby">
+                        <font key="font" metaFont="system"/>
+                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                    </textFieldCell>
+                </textField>
+                <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="nAH-C5-vHu" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
+                    <rect key="frame" x="850" y="724" width="104" height="32"/>
+                    <view key="contentView" id="cur-yM-vcg">
+                        <rect key="frame" x="0.0" y="0.0" width="104" height="32"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="XAQ-c3-FGO">
+                                <rect key="frame" x="34" y="8" width="37" height="16"/>
+                                <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="1Dj-YA-Mf7">
+                                    <font key="font" usesAppearanceFont="YES"/>
+                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                </textFieldCell>
+                            </textField>
+                            <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Bwd-Jk-59S">
+                                <rect key="frame" x="0.0" y="0.0" width="104" height="32"/>
+                                <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="bff-Zh-zgM">
+                                    <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                    <font key="font" metaFont="system"/>
+                                </buttonCell>
+                                <connections>
+                                    <action selector="aiRewritingAction:" target="-2" id="Lfm-5q-irj"/>
+                                </connections>
+                            </button>
+                        </subviews>
+                        <constraints>
+                            <constraint firstItem="Bwd-Jk-59S" firstAttribute="top" secondItem="cur-yM-vcg" secondAttribute="top" id="2Y0-7g-Frf"/>
+                            <constraint firstItem="Bwd-Jk-59S" firstAttribute="leading" secondItem="cur-yM-vcg" secondAttribute="leading" id="Cje-1M-MgS"/>
+                            <constraint firstAttribute="trailing" secondItem="Bwd-Jk-59S" secondAttribute="trailing" id="aWW-e0-8xC"/>
+                            <constraint firstAttribute="bottom" secondItem="Bwd-Jk-59S" secondAttribute="bottom" id="b1i-Pq-g0y"/>
+                            <constraint firstItem="XAQ-c3-FGO" firstAttribute="centerY" secondItem="cur-yM-vcg" secondAttribute="centerY" id="hTB-JO-bgU"/>
+                            <constraint firstItem="XAQ-c3-FGO" firstAttribute="centerX" secondItem="cur-yM-vcg" secondAttribute="centerX" id="xPc-OF-HWJ"/>
+                        </constraints>
+                    </view>
+                    <constraints>
+                        <constraint firstAttribute="width" constant="104" id="F3g-O5-Hkv"/>
+                        <constraint firstAttribute="height" constant="32" id="uYf-u8-h9M"/>
+                    </constraints>
+                </box>
+                <box boxType="custom" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="m6U-x3-0JF">
+                    <rect key="frame" x="32" y="452" width="922" height="260"/>
+                    <view key="contentView" id="CCz-eM-Wfx">
+                        <rect key="frame" x="1" y="1" width="920" height="258"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="FtX-Qb-KWb">
+                                <rect key="frame" x="18" y="16" width="884" height="226"/>
+                                <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" id="r6I-eI-IDZ">
+                                    <font key="font" metaFont="system"/>
+                                    <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                </textFieldCell>
+                                <connections>
+                                    <outlet property="delegate" destination="-2" id="y9Y-Ta-dZh"/>
+                                </connections>
+                            </textField>
+                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="vkz-r4-Z4u">
+                                <rect key="frame" x="873" y="8" width="37" height="16"/>
+                                <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="a62-Qk-ZsC">
+                                    <font key="font" usesAppearanceFont="YES"/>
+                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                </textFieldCell>
+                            </textField>
+                        </subviews>
+                        <constraints>
+                            <constraint firstItem="FtX-Qb-KWb" firstAttribute="leading" secondItem="CCz-eM-Wfx" secondAttribute="leading" constant="20" id="79V-a5-oqB"/>
+                            <constraint firstAttribute="trailing" secondItem="FtX-Qb-KWb" secondAttribute="trailing" constant="20" id="GrM-vk-vuG"/>
+                            <constraint firstAttribute="trailing" secondItem="vkz-r4-Z4u" secondAttribute="trailing" constant="12" id="N32-PL-P23"/>
+                            <constraint firstItem="FtX-Qb-KWb" firstAttribute="top" secondItem="CCz-eM-Wfx" secondAttribute="top" constant="16" id="THR-0r-wDz"/>
+                            <constraint firstAttribute="bottom" secondItem="vkz-r4-Z4u" secondAttribute="bottom" constant="8" id="deE-NW-zmR"/>
+                            <constraint firstAttribute="bottom" secondItem="FtX-Qb-KWb" secondAttribute="bottom" constant="16" id="nzx-zO-vuN"/>
+                        </constraints>
+                    </view>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="260" id="ZBT-RD-NTV"/>
+                    </constraints>
+                </box>
+                <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="bYV-sq-gG7" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
+                    <rect key="frame" x="850" y="380" width="104" height="32"/>
+                    <view key="contentView" id="REe-yY-tzF">
+                        <rect key="frame" x="0.0" y="0.0" width="104" height="32"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dta-aQ-Ags">
+                                <rect key="frame" x="34" y="8" width="37" height="16"/>
+                                <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="0gJ-pI-2Rx">
+                                    <font key="font" usesAppearanceFont="YES"/>
+                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                </textFieldCell>
+                            </textField>
+                            <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2xQ-KP-wue">
+                                <rect key="frame" x="0.0" y="0.0" width="104" height="32"/>
+                                <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="B9q-uo-y2g">
+                                    <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                    <font key="font" metaFont="system"/>
+                                </buttonCell>
+                                <connections>
+                                    <action selector="copyAction:" target="-2" id="7hm-xz-47T"/>
+                                </connections>
+                            </button>
+                        </subviews>
+                        <constraints>
+                            <constraint firstAttribute="trailing" secondItem="2xQ-KP-wue" secondAttribute="trailing" id="KUu-aC-BIf"/>
+                            <constraint firstItem="2xQ-KP-wue" firstAttribute="leading" secondItem="REe-yY-tzF" secondAttribute="leading" id="Khx-uT-VRw"/>
+                            <constraint firstItem="2xQ-KP-wue" firstAttribute="top" secondItem="REe-yY-tzF" secondAttribute="top" id="YbD-F7-bjv"/>
+                            <constraint firstItem="dta-aQ-Ags" firstAttribute="centerX" secondItem="REe-yY-tzF" secondAttribute="centerX" id="gaK-PJ-Una"/>
+                            <constraint firstItem="dta-aQ-Ags" firstAttribute="centerY" secondItem="REe-yY-tzF" secondAttribute="centerY" id="jLS-fq-qun"/>
+                            <constraint firstAttribute="bottom" secondItem="2xQ-KP-wue" secondAttribute="bottom" id="qU0-F8-pZg"/>
+                        </constraints>
+                    </view>
+                    <constraints>
+                        <constraint firstAttribute="width" constant="104" id="Vj5-3y-KVR"/>
+                        <constraint firstAttribute="height" constant="32" id="t8t-tl-n0m"/>
+                    </constraints>
+                </box>
+                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="CcX-M0-1q3">
+                    <rect key="frame" x="30" y="388" width="37" height="16"/>
+                    <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="L9a-bf-XQm">
+                        <font key="font" metaFont="system"/>
+                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                    </textFieldCell>
+                </textField>
+                <box boxType="custom" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="4LD-1L-j3y">
+                    <rect key="frame" x="32" y="54" width="922" height="314"/>
+                    <view key="contentView" id="YQK-PU-YI0">
+                        <rect key="frame" x="1" y="1" width="920" height="312"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="4sx-UX-pUY">
+                                <rect key="frame" x="404" y="100" width="112" height="112"/>
+                                <constraints>
+                                    <constraint firstAttribute="width" constant="112" id="MdD-ld-8ne"/>
+                                    <constraint firstAttribute="height" constant="112" id="iHR-9b-fwH"/>
+                                </constraints>
+                                <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="ei9-ff-0j6"/>
+                            </imageView>
+                            <scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" translatesAutoresizingMaskIntoConstraints="NO" id="E6R-D2-LdC">
+                                <rect key="frame" x="20" y="16" width="880" height="280"/>
+                                <clipView key="contentView" drawsBackground="NO" id="qAu-R2-m8b">
+                                    <rect key="frame" x="0.0" y="0.0" width="880" height="280"/>
+                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                    <subviews>
+                                        <textView wantsLayer="YES" importsGraphics="NO" richText="NO" verticallyResizable="YES" spellingCorrection="YES" smartInsertDelete="YES" id="t7u-24-0rL">
+                                            <rect key="frame" x="0.0" y="0.0" width="880" height="280"/>
+                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                            <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                            <size key="minSize" width="880" height="280"/>
+                                            <size key="maxSize" width="880" height="10000000"/>
+                                            <color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                                        </textView>
+                                    </subviews>
+                                </clipView>
+                                <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="GAC-Bp-QzV">
+                                    <rect key="frame" x="-100" y="-100" width="240" height="16"/>
+                                    <autoresizingMask key="autoresizingMask"/>
+                                </scroller>
+                                <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="2dS-Fp-rJ3">
+                                    <rect key="frame" x="-100" y="-100" width="15" height="280"/>
+                                    <autoresizingMask key="autoresizingMask"/>
+                                </scroller>
+                            </scrollView>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="Ku7-Fg-Cbu">
+                                <rect key="frame" x="20" y="280" width="53" height="16"/>
+                                <subviews>
+                                    <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="92Z-hh-WAn">
+                                        <rect key="frame" x="0.0" y="0.0" width="16" height="16"/>
+                                        <constraints>
+                                            <constraint firstAttribute="width" constant="16" id="Nk0-tw-rli"/>
+                                            <constraint firstAttribute="height" constant="16" id="poD-6T-Bgt"/>
+                                        </constraints>
+                                        <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="cFM-ZS-Xbk"/>
+                                    </imageView>
+                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="rdP-tN-TLc">
+                                        <rect key="frame" x="18" y="0.0" width="37" height="16"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="1ow-O0-Kce">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="92Z-hh-WAn" firstAttribute="centerY" secondItem="Ku7-Fg-Cbu" secondAttribute="centerY" id="Pgq-h8-kew"/>
+                                    <constraint firstItem="92Z-hh-WAn" firstAttribute="leading" secondItem="Ku7-Fg-Cbu" secondAttribute="leading" id="Rgc-le-Ure"/>
+                                    <constraint firstAttribute="trailing" secondItem="rdP-tN-TLc" secondAttribute="trailing" id="SR8-j2-Yzi"/>
+                                    <constraint firstAttribute="height" constant="16" id="TnD-CU-xQr"/>
+                                    <constraint firstItem="rdP-tN-TLc" firstAttribute="leading" secondItem="92Z-hh-WAn" secondAttribute="trailing" constant="4" id="oIU-pk-lte"/>
+                                    <constraint firstItem="rdP-tN-TLc" firstAttribute="centerY" secondItem="92Z-hh-WAn" secondAttribute="centerY" id="zXG-pF-Q1J"/>
+                                </constraints>
+                            </customView>
+                        </subviews>
+                        <constraints>
+                            <constraint firstItem="E6R-D2-LdC" firstAttribute="leading" secondItem="YQK-PU-YI0" secondAttribute="leading" constant="20" id="1TR-SU-1bb"/>
+                            <constraint firstAttribute="bottom" secondItem="E6R-D2-LdC" secondAttribute="bottom" constant="16" id="6j4-d0-RDa"/>
+                            <constraint firstItem="E6R-D2-LdC" firstAttribute="top" secondItem="YQK-PU-YI0" secondAttribute="top" constant="16" id="GD1-J2-U24"/>
+                            <constraint firstAttribute="trailing" secondItem="E6R-D2-LdC" secondAttribute="trailing" constant="20" id="hIQ-OL-QjQ"/>
+                            <constraint firstItem="Ku7-Fg-Cbu" firstAttribute="top" secondItem="YQK-PU-YI0" secondAttribute="top" constant="16" id="hiW-AU-EFu"/>
+                            <constraint firstItem="Ku7-Fg-Cbu" firstAttribute="leading" secondItem="YQK-PU-YI0" secondAttribute="leading" constant="20" id="reY-XU-6He"/>
+                        </constraints>
+                    </view>
+                    <constraints>
+                        <constraint firstItem="4sx-UX-pUY" firstAttribute="centerX" secondItem="4LD-1L-j3y" secondAttribute="centerX" id="MtD-ei-651"/>
+                        <constraint firstItem="4sx-UX-pUY" firstAttribute="centerY" secondItem="4LD-1L-j3y" secondAttribute="centerY" id="a2Q-Ab-ntv"/>
+                    </constraints>
+                </box>
+                <progressIndicator maxValue="100" indeterminate="YES" controlSize="small" style="spinning" translatesAutoresizingMaskIntoConstraints="NO" id="jUa-Yh-Prc">
+                    <rect key="frame" x="485" y="399" width="16" height="16"/>
+                </progressIndicator>
+            </subviews>
+            <constraints>
+                <constraint firstItem="4LD-1L-j3y" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="32" id="2DE-fN-S6m"/>
+                <constraint firstAttribute="trailing" secondItem="4LD-1L-j3y" secondAttribute="trailing" constant="32" id="2bw-8s-gfP"/>
+                <constraint firstItem="lIX-7t-9jP" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="32" id="4GA-NU-UWK"/>
+                <constraint firstItem="bYV-sq-gG7" firstAttribute="centerY" secondItem="CcX-M0-1q3" secondAttribute="centerY" id="6os-C8-t8e"/>
+                <constraint firstItem="lIX-7t-9jP" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="40" id="DC8-q9-ROS"/>
+                <constraint firstItem="bYV-sq-gG7" firstAttribute="top" secondItem="m6U-x3-0JF" secondAttribute="bottom" constant="40" id="IOP-bJ-2U4"/>
+                <constraint firstAttribute="trailing" secondItem="bYV-sq-gG7" secondAttribute="trailing" constant="32" id="NS3-cP-pnE"/>
+                <constraint firstItem="nAH-C5-vHu" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="58" id="SR3-fR-OMN"/>
+                <constraint firstAttribute="trailing" secondItem="m6U-x3-0JF" secondAttribute="trailing" constant="32" id="Trz-JB-4l4"/>
+                <constraint firstItem="vVu-Al-W4D" firstAttribute="leading" secondItem="lIX-7t-9jP" secondAttribute="leading" id="Uuu-au-R1r"/>
+                <constraint firstItem="m6U-x3-0JF" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="32" id="WCB-MD-va9"/>
+                <constraint firstItem="vVu-Al-W4D" firstAttribute="top" secondItem="lIX-7t-9jP" secondAttribute="bottom" id="Y5c-u8-yR7"/>
+                <constraint firstAttribute="trailing" secondItem="nAH-C5-vHu" secondAttribute="trailing" constant="32" id="aMq-Hw-FfN"/>
+                <constraint firstAttribute="bottom" secondItem="4LD-1L-j3y" secondAttribute="bottom" constant="54" id="apc-oC-7Q1"/>
+                <constraint firstAttribute="trailing" secondItem="lIX-7t-9jP" secondAttribute="trailing" constant="32" id="avX-D5-lW9"/>
+                <constraint firstItem="jUa-Yh-Prc" firstAttribute="centerX" secondItem="Hz6-mo-xeY" secondAttribute="centerX" id="i4K-Kx-guf"/>
+                <constraint firstItem="jUa-Yh-Prc" firstAttribute="centerY" secondItem="Hz6-mo-xeY" secondAttribute="centerY" id="kKZ-8J-v0c"/>
+                <constraint firstItem="m6U-x3-0JF" firstAttribute="top" secondItem="nAH-C5-vHu" secondAttribute="bottom" constant="12" id="qfY-wb-k87"/>
+                <constraint firstItem="4LD-1L-j3y" firstAttribute="top" secondItem="bYV-sq-gG7" secondAttribute="bottom" constant="12" id="we8-1D-IF7"/>
+                <constraint firstItem="CcX-M0-1q3" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="32" id="zpm-Kx-3Np"/>
+            </constraints>
+            <point key="canvasLocation" x="511" y="478"/>
+        </customView>
+    </objects>
+</document>

+ 319 - 0
PDF Office/PDF Master/Class/Home/ViewController/KMAITranslationVC.swift

@@ -0,0 +1,319 @@
+//
+//  KMAITranslationVC.swift
+//  PDF Master
+//
+//  Created by wanjun on 2023/5/22.
+//
+
+import Cocoa
+
+class KMAITranslationVC: NSViewController {
+
+    @IBOutlet weak var aiTranslationLabel: NSTextField!
+    @IBOutlet weak var aiTranslationView: KMDottedLineView!
+    @IBOutlet weak var supportPDFWordFileImageView: NSImageView!
+    @IBOutlet weak var supportPDFWordFileLabel: NSTextField!
+    @IBOutlet weak var supportPDFWordFileSubLabel: NSTextField!
+    @IBOutlet weak var translationLanguageLabel: NSTextField!
+    @IBOutlet weak var automaticBox: KMBox!
+    @IBOutlet weak var automaticLabel: NSTextField!
+    @IBOutlet weak var languageBox: KMBox!
+    @IBOutlet weak var languageLabel: NSTextField!
+    @IBOutlet weak var languageImageView: NSImageView!
+    @IBOutlet weak var selectYourFilesBox: KMBox!
+    @IBOutlet weak var selectYourFilesLabel: NSTextField!
+    @IBOutlet weak var selectYourFilesImageView: NSImageView!
+    @IBOutlet weak var orDropFileHereLabel: NSTextField!
+    
+    var fromStr: String = "auto"
+    var toStr: String = "en"
+    var fromLanguages: [String] = ["Automatic Identification", "English", "Simplified Chinese", "Traditional Chinese", "Japanese", "Korean", "French", "Spanish", "Italian", "German", "Portuguese", "Russian", "Vietnamese", "Thai", "Arabic", "Greek", "Bulgarian", "Finnish", "Slovene", "Dutch", "Czech", "Swedish", "Polish", "Danish", "Romanian", "Hungarian"]
+    var toLanguages: [String] = ["English", "Simplified Chinese", "Traditional Chinese", "Japanese", "Korean", "French", "Spanish", "Italian", "German", "Portuguese", "Russian", "Vietnamese", "Thai", "Arabic", "Greek", "Bulgarian", "Finnish", "Slovene", "Dutch", "Czech", "Swedish", "Polish", "Danish", "Romanian", "Hungarian"]
+
+    var popover: NSPopover?
+
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+        
+        self.initLocalization()
+        self.initializeUI()
+    }
+    
+    // MARK: initialize
+    
+    func initializeUI() -> Void {
+        self.aiTranslationView.canHover = false
+
+        self.aiTranslationLabel.textColor = NSColor(hex: "#252629")
+        self.aiTranslationLabel.font = NSFont.SFProTextSemibold(20.0)
+        
+        self.supportPDFWordFileImageView.image = NSImage(named: "ic_function_other")
+        self.supportPDFWordFileLabel.textColor = NSColor(hex: "#252629")
+        self.supportPDFWordFileLabel.font = NSFont.SFProTextSemibold(20.0)
+        self.supportPDFWordFileSubLabel.textColor = NSColor(hex: "#94989C")
+        self.supportPDFWordFileSubLabel.font = NSFont.SFProTextRegular(14.0)
+
+        self.translationLanguageLabel.textColor = NSColor(hex: "#252629")
+        self.translationLanguageLabel.font = NSFont.SFProTextRegular(14.0)
+        self.automaticLabel.textColor = NSColor(hex: "#252629")
+        self.automaticLabel.font = NSFont.SFProTextRegular(16.0)
+        self.languageLabel.textColor = NSColor(hex: "#252629")
+        self.languageLabel.font = NSFont.SFProTextRegular(16.0)
+        self.automaticBox.cornerRadius = 4.0
+        self.automaticBox.borderColor = NSColor(hex: "#DFE1E5")
+        self.languageBox.cornerRadius = 4.0
+        self.languageBox.borderColor = NSColor(hex: "#DFE1E5")
+        self.languageImageView.image = NSImage(named: "ic_transtate")
+        self.automaticBox.downCallback = { [unowned self](downEntered: Bool, mouseBox: KMBox, event) -> Void in
+            if downEntered {
+                self.languageAction(true)
+            }
+        }
+        self.languageBox.downCallback = { [unowned self](downEntered: Bool, mouseBox: KMBox, event) -> Void in
+            if downEntered {
+                self.languageAction(false)
+            }
+        }
+
+        self.selectYourFilesBox.cornerRadius = 4.0
+        self.selectYourFilesBox.fillColor = NSColor(hex: "#1770F4")
+        self.selectYourFilesLabel.textColor = NSColor(hex: "#FFFFFF")
+        self.selectYourFilesLabel.font = NSFont.SFProTextRegular(16.0)
+        self.selectYourFilesImageView.image = NSImage(named: "icon_SelectYourFiles")
+        
+        self.orDropFileHereLabel.textColor = NSColor(hex: "#616469")
+        self.orDropFileHereLabel.font = NSFont.SFProTextRegular(14.0)
+        
+        self.selectYourFilesBox.moveCallback = { [unowned self](mouseEntered: Bool, mouseBox: KMBox) -> Void in
+            if mouseEntered {
+                self.selectYourFilesBox.fillColor = NSColor(hex: "#3F8FF6")
+            } else {
+                self.selectYourFilesBox.fillColor = NSColor(hex: "#1770F4")
+            }
+        }
+        self.selectYourFilesBox.downCallback = { [unowned self](downEntered: Bool, mouseBox: KMBox, event) -> Void in
+            if downEntered {
+                let openPanel = NSOpenPanel()
+                openPanel.allowedFileTypes = ["pdf", "PDF", "docx", "doc"]
+                openPanel.allowsMultipleSelection = false
+                openPanel.beginSheetModal(for: self.view.window!) { result in
+                    if result == .OK {
+                        for url in openPanel.urls {
+                            if !url.path.isPDFValid() {
+                                let alert = NSAlert()
+                                alert.alertStyle = .critical
+                                alert.messageText = NSLocalizedString("An error occurred while opening this document. The file is damaged and could not be repaired.", comment: "")
+                                alert.runModal()
+                            } else {
+                                let infoDictionary = Bundle .main.infoDictionary!
+                                let majorVersion = infoDictionary["CFBundleShortVersionString"]
+
+                                KMRequestServerManager.manager.aiTranslationFileUpload(file: url.path, version: "1.0.1") { [unowned self] success, result in
+                                    if success {
+                                        let result: NSDictionary = result!.result
+
+                                        let fileKey = result["fileKey"]
+                                        let fileName = result["fileName"]
+                                        let pageCount = result["pageCount"]
+                                        if fileKey != nil {
+                                            self.fileTranslateHandle(fileKey as! String)
+                                        }
+                                    } else {
+                                        
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+
+            }
+        }
+    }
+    
+    func initLocalization() -> Void {
+        self.aiTranslationLabel.stringValue = NSLocalizedString("AI Translation", comment: "")
+        self.supportPDFWordFileLabel.stringValue = NSLocalizedString("Support PDF, Word file", comment: "")
+        self.supportPDFWordFileSubLabel.stringValue = NSLocalizedString("Limit document size to 10M, document page number to 30, 10w characters per month", comment: "")
+        self.translationLanguageLabel.stringValue = NSLocalizedString("Translation Language:", comment: "")
+        self.selectYourFilesLabel.stringValue = NSLocalizedString("Select your file", comment: "")
+        self.orDropFileHereLabel.stringValue = NSLocalizedString("or drop file here", comment: "")
+        self.automaticLabel.stringValue = NSLocalizedString("Automatic", comment: "")
+        self.languageLabel.stringValue = NSLocalizedString("English", comment: "")
+    }
+    
+    // MARK: Private Methods
+    
+    func fileTranslateHandle(_ fileKey: String) -> Void {
+        let infoDictionary = Bundle .main.infoDictionary!
+        let majorVersion = infoDictionary["CFBundleShortVersionString"]
+        
+        KMRequestServerManager.manager.aiTranslationFileTranslateHandle(fileKey: fileKey, from: self.fromStr, to: self.toStr, version: "1.0.1") { success, result in
+            if success {
+                let result: NSDictionary = result!.result
+
+                let fileUrl: String = result["fileUrl"] as! String
+                let downFileUrl: String = result["downFileUrl"] as! String
+                let ossDownUrl: String = result["ossDownUrl"] as! String
+                let fileName: String = result["fileName"] as! String
+                let downFileName: String = result["downFileName"] as! String
+                let from: String = result["from"] as! String
+                let to: String = result["to"] as! String
+                
+                self.downloadFile(filePath: ossDownUrl, downFileName: downFileName)
+            }
+        }
+    }
+    
+    func downloadFile(filePath: String, downFileName: String) -> Void {
+        guard let fileURL = URL(string: filePath) else {
+            let alert = NSAlert()
+            alert.alertStyle = .critical
+            alert.messageText = NSLocalizedString("Invalid file link", comment: "")
+            alert.runModal()
+
+            return
+        }
+        let sessionConfiguration = URLSessionConfiguration.default
+        let session = URLSession(configuration: sessionConfiguration)
+        let downloadTask = session.downloadTask(with: fileURL) { (tempLocalURL, response, error) in
+            if let error = error {
+                let alert = NSAlert()
+                alert.alertStyle = .critical
+                alert.messageText = String(format: "%@:\(error)", NSLocalizedString("Download failure", comment: ""))
+                alert.runModal()
+                
+                return
+            }
+
+            guard let tempLocalURL = tempLocalURL else {
+                let alert = NSAlert()
+                alert.alertStyle = .critical
+                alert.messageText = NSLocalizedString("The download file temporary path is invalid", comment: "")
+                alert.runModal()
+
+                return
+            }
+
+            let destinationURL = FileManager.default.temporaryDirectory.appendingPathComponent(downFileName)
+
+            do {
+                try FileManager.default.moveItem(at: tempLocalURL, to: destinationURL)
+                
+                NSDocumentController.shared.openDocument(withContentsOf: destinationURL, display: true) { document, documentWasAlreadyOpen, error in
+                    if error != nil {
+                        NSApp.presentError(error!)
+                    } else {
+                        
+                    }
+                }
+            } catch {
+                let alert = NSAlert()
+                alert.alertStyle = .critical
+                alert.messageText = String(format: "%@:\(error)", NSLocalizedString("File saving failure", comment: ""))
+                alert.runModal()
+            }
+        }
+        downloadTask.resume()
+    }
+    
+    func  languageAbbreviation(_ language: String) -> String {
+        if language == "Automatic Identification" {
+            return "auto"
+        } else if language == "English" {
+            return "en"
+        } else if language == "Simplified Chinese" {
+            return "zh"
+        } else if language == "Traditional Chinese" {
+            return "cht"
+        } else if language == "Japanese" {
+            return "jp"
+        } else if language == "Korean" {
+            return "kor"
+        } else if language == "French" {
+            return "fra"
+        } else if language == "Spanish" {
+            return "spa"
+        } else if language == "Italian" {
+            return "it"
+        } else if language == "German" {
+            return "de"
+        } else if language == "Portuguese" {
+            return "pt"
+        } else if language == "Russian" {
+            return "ru"
+        } else if language == "Vietnamese" {
+            return "vie"
+        } else if language == "Thai" {
+            return "th"
+        } else if language == "Arabic" {
+            return "ara"
+        } else if language == "Greek" {
+            return "el"
+        } else if language == "Bulgarian" {
+            return "bul"
+        } else if language == "Finnish" {
+            return "fin"
+        } else if language == "Slovene" {
+            return "slo"
+        } else if language == "Dutch" {
+            return "nl"
+        } else if language == "Czech" {
+            return "cs"
+        } else if language == "Swedish" {
+            return "swe"
+        } else if language == "Polish" {
+            return "pl"
+        } else if language == "Danish" {
+            return "dan"
+        } else if language == "Romanian" {
+            return "rom"
+        } else if language == "Hungarian" {
+            return "hu"
+        }
+        return "auto"
+    }
+    
+    // MARK: Action Methods
+    
+    func languageAction(_ isFromLanguage: Bool) -> Void {
+        if (self.popover != nil && self.popover!.isShown) {
+            self.popover?.close()
+            self.popover = nil
+            return
+        }
+        var languages = self.fromLanguages
+        if !isFromLanguage {
+            languages = self.toLanguages
+        }
+        let vc: KMAILanguagePopVC = KMAILanguagePopVC().initWithPopViewDataArr(self.fromLanguages)
+        let createFilePopover: NSPopover = NSPopover.init()
+        self.popover = createFilePopover
+        createFilePopover.contentViewController = vc
+        createFilePopover.animates = true
+        createFilePopover.behavior = .semitransient
+        createFilePopover.setValue(true, forKey: "shouldHideAnchor")
+
+        vc.downCallback = { [unowned self] (language: String) -> Void in
+            createFilePopover.close()
+            if isFromLanguage {
+                self.automaticLabel.stringValue = language
+                self.fromStr = self.languageAbbreviation(language)
+            } else {
+                self.languageLabel.stringValue = language
+                self.toStr = self.languageAbbreviation(language)
+            }
+        }
+
+        if isFromLanguage {
+            createFilePopover.show(relativeTo: CGRect(x: automaticBox.bounds.origin.x, y: 10, width: automaticBox.bounds.size.width, height: automaticBox.bounds.size.height), of: automaticBox, preferredEdge: .maxY)
+            
+            vc.customBoxWidthLayoutConstraint.constant = automaticBox.frame.width
+        } else {
+            createFilePopover.show(relativeTo: CGRect(x: languageBox.bounds.origin.x, y: 10, width: languageBox.bounds.size.width, height: languageBox.bounds.size.height), of: languageBox, preferredEdge: .maxY)
+            
+            vc.customBoxWidthLayoutConstraint.constant = languageBox.frame.width
+        }
+    }
+}

+ 287 - 0
PDF Office/PDF Master/Class/Home/ViewController/KMAITranslationVC.xib

@@ -0,0 +1,287 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+    <dependencies>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="KMAITranslationVC" customModule="PDF_Master" customModuleProvider="target">
+            <connections>
+                <outlet property="aiTranslationLabel" destination="ED8-nx-ye3" id="58g-AS-AYD"/>
+                <outlet property="aiTranslationView" destination="8ax-UJ-9Yb" id="DQF-hv-9GS"/>
+                <outlet property="automaticBox" destination="0oh-UB-dwx" id="rep-xx-EBj"/>
+                <outlet property="automaticLabel" destination="QWm-C6-Sfz" id="OqH-PR-KVZ"/>
+                <outlet property="languageBox" destination="gs4-sG-7XS" id="nLe-05-u3W"/>
+                <outlet property="languageImageView" destination="UhD-tL-SCP" id="Vwv-gm-TtR"/>
+                <outlet property="languageLabel" destination="Bu3-gS-M5Y" id="IaM-FA-bAo"/>
+                <outlet property="orDropFileHereLabel" destination="yCY-ZD-Ebi" id="9KV-xh-l4L"/>
+                <outlet property="selectYourFilesBox" destination="GxN-7N-Cbx" id="VGm-GT-3eY"/>
+                <outlet property="selectYourFilesImageView" destination="1bb-gf-fiX" id="IHX-yP-W0T"/>
+                <outlet property="selectYourFilesLabel" destination="CXa-a0-fuw" id="tPn-HS-PMz"/>
+                <outlet property="supportPDFWordFileImageView" destination="Cnj-VQ-Uuw" id="tKn-F0-oF4"/>
+                <outlet property="supportPDFWordFileLabel" destination="RLT-8f-B2G" id="2sc-ok-MUY"/>
+                <outlet property="supportPDFWordFileSubLabel" destination="tCA-C4-nrI" id="rWe-IJ-ctn"/>
+                <outlet property="translationLanguageLabel" destination="Pl5-p3-iDc" id="hAt-ga-Hzu"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="1005" height="521"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ED8-nx-ye3">
+                    <rect key="frame" x="30" y="465" width="945" height="16"/>
+                    <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="eQj-aF-vQ3">
+                        <font key="font" usesAppearanceFont="YES"/>
+                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                    </textFieldCell>
+                </textField>
+                <customView translatesAutoresizingMaskIntoConstraints="NO" id="8ax-UJ-9Yb" customClass="KMDottedLineView" customModule="PDF_Master" customModuleProvider="target">
+                    <rect key="frame" x="32" y="49" width="941" height="400"/>
+                    <subviews>
+                        <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="iut-zE-qaZ">
+                            <rect key="frame" x="428" y="288" width="85" height="40"/>
+                            <view key="contentView" id="sRW-06-8EM">
+                                <rect key="frame" x="0.0" y="0.0" width="85" height="40"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Cnj-VQ-Uuw">
+                                        <rect key="frame" x="0.0" y="0.0" width="40" height="40"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="40" id="ewj-h9-9nG"/>
+                                            <constraint firstAttribute="width" constant="40" id="g3B-Dl-PPx"/>
+                                        </constraints>
+                                        <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="X6x-nC-ngb"/>
+                                    </imageView>
+                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="RLT-8f-B2G">
+                                        <rect key="frame" x="50" y="12" width="37" height="16"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="fBC-Nb-jHr">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="Cnj-VQ-Uuw" firstAttribute="leading" secondItem="sRW-06-8EM" secondAttribute="leading" id="2Hq-fV-Vud"/>
+                                    <constraint firstItem="RLT-8f-B2G" firstAttribute="leading" secondItem="Cnj-VQ-Uuw" secondAttribute="trailing" constant="12" id="5SG-MD-m7b"/>
+                                    <constraint firstItem="Cnj-VQ-Uuw" firstAttribute="top" secondItem="sRW-06-8EM" secondAttribute="top" id="CfP-Ze-4O2"/>
+                                    <constraint firstAttribute="trailing" secondItem="RLT-8f-B2G" secondAttribute="trailing" id="EGc-0c-GOV"/>
+                                    <constraint firstItem="RLT-8f-B2G" firstAttribute="centerY" secondItem="Cnj-VQ-Uuw" secondAttribute="centerY" id="y0y-Tb-O8q"/>
+                                </constraints>
+                            </view>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="40" id="deD-FD-5q6"/>
+                            </constraints>
+                        </box>
+                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="tCA-C4-nrI">
+                            <rect key="frame" x="186" y="264" width="569" height="16"/>
+                            <constraints>
+                                <constraint firstAttribute="width" constant="565" id="ZKk-ep-5U8"/>
+                            </constraints>
+                            <textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="Label" id="mfl-BM-jwE">
+                                <font key="font" usesAppearanceFont="YES"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                        <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="Xrp-Ow-rsS">
+                            <rect key="frame" x="228" y="184" width="485" height="40"/>
+                            <view key="contentView" id="agT-lp-yY6">
+                                <rect key="frame" x="0.0" y="0.0" width="485" height="40"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <box boxType="custom" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="gs4-sG-7XS" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
+                                        <rect key="frame" x="285" y="0.0" width="200" height="40"/>
+                                        <view key="contentView" id="Vr9-hr-Q8e">
+                                            <rect key="frame" x="1" y="1" width="198" height="38"/>
+                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                            <subviews>
+                                                <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Xyz-0l-36i">
+                                                    <rect key="frame" x="158" y="11" width="16" height="16"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="width" constant="16" id="DfC-nm-7hg"/>
+                                                        <constraint firstAttribute="height" constant="16" id="t4p-VO-oxz"/>
+                                                    </constraints>
+                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="icon_btn_arrow_gray_down_s_norm_false" id="gu2-jn-7c0"/>
+                                                </imageView>
+                                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Bu3-gS-M5Y">
+                                                    <rect key="frame" x="22" y="11" width="138" height="16"/>
+                                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="q98-q6-DsL">
+                                                        <font key="font" usesAppearanceFont="YES"/>
+                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                    </textFieldCell>
+                                                </textField>
+                                            </subviews>
+                                            <constraints>
+                                                <constraint firstItem="Bu3-gS-M5Y" firstAttribute="leading" secondItem="Vr9-hr-Q8e" secondAttribute="leading" constant="24" id="AAL-kC-qFd"/>
+                                                <constraint firstItem="Xyz-0l-36i" firstAttribute="leading" secondItem="Bu3-gS-M5Y" secondAttribute="trailing" id="FZ5-AZ-Ie4"/>
+                                                <constraint firstAttribute="trailing" secondItem="Xyz-0l-36i" secondAttribute="trailing" constant="24" id="xun-wX-CXV"/>
+                                            </constraints>
+                                        </view>
+                                        <constraints>
+                                            <constraint firstAttribute="width" constant="200" id="6ga-9T-lGV"/>
+                                            <constraint firstItem="Bu3-gS-M5Y" firstAttribute="centerY" secondItem="gs4-sG-7XS" secondAttribute="centerY" id="Hhh-HI-a0a"/>
+                                            <constraint firstItem="Xyz-0l-36i" firstAttribute="centerY" secondItem="gs4-sG-7XS" secondAttribute="centerY" id="N5v-2x-2FS"/>
+                                            <constraint firstAttribute="height" constant="40" id="jmE-3H-VU2"/>
+                                        </constraints>
+                                    </box>
+                                    <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="UhD-tL-SCP">
+                                        <rect key="frame" x="253" y="8" width="24" height="24"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="24" id="DtH-Rs-8Pi"/>
+                                            <constraint firstAttribute="width" constant="24" id="FVp-6Z-Z1a"/>
+                                        </constraints>
+                                        <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="wTV-sd-yXc"/>
+                                    </imageView>
+                                    <box boxType="custom" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="0oh-UB-dwx" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
+                                        <rect key="frame" x="45" y="0.0" width="200" height="40"/>
+                                        <view key="contentView" id="I1e-1P-nhH">
+                                            <rect key="frame" x="1" y="1" width="198" height="38"/>
+                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                            <subviews>
+                                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="QWm-C6-Sfz">
+                                                    <rect key="frame" x="22" y="11" width="138" height="16"/>
+                                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="gtU-xf-JeK">
+                                                        <font key="font" usesAppearanceFont="YES"/>
+                                                        <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                        <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                    </textFieldCell>
+                                                </textField>
+                                                <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Wgp-tu-JVy">
+                                                    <rect key="frame" x="158" y="11" width="16" height="16"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="16" id="Vg0-zx-7DC"/>
+                                                        <constraint firstAttribute="width" constant="16" id="bdy-SJ-U3P"/>
+                                                    </constraints>
+                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="icon_btn_arrow_gray_down_s_norm_false" id="XCb-2i-d3Y"/>
+                                                </imageView>
+                                            </subviews>
+                                            <constraints>
+                                                <constraint firstAttribute="trailing" secondItem="Wgp-tu-JVy" secondAttribute="trailing" constant="24" id="Q9m-Xa-qqo"/>
+                                                <constraint firstItem="QWm-C6-Sfz" firstAttribute="leading" secondItem="I1e-1P-nhH" secondAttribute="leading" constant="24" id="Wzr-jb-n28"/>
+                                                <constraint firstItem="Wgp-tu-JVy" firstAttribute="leading" secondItem="QWm-C6-Sfz" secondAttribute="trailing" id="iIO-Ty-Vnk"/>
+                                            </constraints>
+                                        </view>
+                                        <constraints>
+                                            <constraint firstItem="QWm-C6-Sfz" firstAttribute="centerY" secondItem="0oh-UB-dwx" secondAttribute="centerY" id="C6E-LE-OgW"/>
+                                            <constraint firstItem="Wgp-tu-JVy" firstAttribute="centerY" secondItem="0oh-UB-dwx" secondAttribute="centerY" id="PaM-Wf-vta"/>
+                                            <constraint firstAttribute="height" constant="40" id="Pqc-nd-eQp"/>
+                                            <constraint firstAttribute="width" constant="200" id="f2T-4O-dgI"/>
+                                        </constraints>
+                                    </box>
+                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Pl5-p3-iDc">
+                                        <rect key="frame" x="-2" y="12" width="37" height="16"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="61g-j2-GGP">
+                                            <font key="font" metaFont="system"/>
+                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstAttribute="bottom" secondItem="0oh-UB-dwx" secondAttribute="bottom" id="1g4-jQ-9UQ"/>
+                                    <constraint firstItem="0oh-UB-dwx" firstAttribute="top" secondItem="agT-lp-yY6" secondAttribute="top" id="4yh-uN-5LU"/>
+                                    <constraint firstAttribute="bottom" secondItem="gs4-sG-7XS" secondAttribute="bottom" id="Ewk-ja-eiF"/>
+                                    <constraint firstItem="gs4-sG-7XS" firstAttribute="leading" secondItem="UhD-tL-SCP" secondAttribute="trailing" constant="8" id="H7e-E4-Ee7"/>
+                                    <constraint firstAttribute="trailing" secondItem="gs4-sG-7XS" secondAttribute="trailing" id="IaQ-oK-axv"/>
+                                    <constraint firstItem="Pl5-p3-iDc" firstAttribute="leading" secondItem="agT-lp-yY6" secondAttribute="leading" id="OL7-jd-nMo"/>
+                                    <constraint firstItem="UhD-tL-SCP" firstAttribute="leading" secondItem="0oh-UB-dwx" secondAttribute="trailing" constant="8" id="edn-cL-c3f"/>
+                                    <constraint firstItem="0oh-UB-dwx" firstAttribute="leading" secondItem="Pl5-p3-iDc" secondAttribute="trailing" constant="12" id="hvn-uM-4in"/>
+                                    <constraint firstItem="gs4-sG-7XS" firstAttribute="top" secondItem="agT-lp-yY6" secondAttribute="top" id="tYg-cE-Jcg"/>
+                                </constraints>
+                            </view>
+                            <constraints>
+                                <constraint firstItem="Pl5-p3-iDc" firstAttribute="centerY" secondItem="Xrp-Ow-rsS" secondAttribute="centerY" id="nRk-pm-V9X"/>
+                                <constraint firstItem="UhD-tL-SCP" firstAttribute="centerY" secondItem="Xrp-Ow-rsS" secondAttribute="centerY" id="qRw-oO-d1L"/>
+                            </constraints>
+                        </box>
+                        <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="GxN-7N-Cbx" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
+                            <rect key="frame" x="321" y="96" width="300" height="48"/>
+                            <view key="contentView" id="YC3-ad-nD5">
+                                <rect key="frame" x="0.0" y="0.0" width="300" height="48"/>
+                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                <subviews>
+                                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="pJa-Tg-tWb">
+                                        <rect key="frame" x="119" y="0.0" width="61" height="48"/>
+                                        <subviews>
+                                            <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="1bb-gf-fiX">
+                                                <rect key="frame" x="0.0" y="16" width="16" height="16"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="width" constant="16" id="Mtd-qB-nOC"/>
+                                                    <constraint firstAttribute="height" constant="16" id="yaP-Lu-UFz"/>
+                                                </constraints>
+                                                <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="y9h-P7-9Rd"/>
+                                            </imageView>
+                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="CXa-a0-fuw">
+                                                <rect key="frame" x="26" y="16" width="37" height="16"/>
+                                                <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="4yK-8y-jAp">
+                                                    <font key="font" metaFont="system"/>
+                                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                </textFieldCell>
+                                            </textField>
+                                        </subviews>
+                                        <constraints>
+                                            <constraint firstItem="1bb-gf-fiX" firstAttribute="leading" secondItem="pJa-Tg-tWb" secondAttribute="leading" id="3Hl-d6-rqv"/>
+                                            <constraint firstItem="CXa-a0-fuw" firstAttribute="centerY" secondItem="1bb-gf-fiX" secondAttribute="centerY" id="CXL-Ml-pZC"/>
+                                            <constraint firstItem="CXa-a0-fuw" firstAttribute="leading" secondItem="1bb-gf-fiX" secondAttribute="trailing" constant="12" id="YWu-E8-eGP"/>
+                                            <constraint firstAttribute="trailing" secondItem="CXa-a0-fuw" secondAttribute="trailing" id="cB5-rz-mmi"/>
+                                            <constraint firstItem="1bb-gf-fiX" firstAttribute="centerY" secondItem="pJa-Tg-tWb" secondAttribute="centerY" id="uwV-tX-cHg"/>
+                                        </constraints>
+                                    </customView>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="pJa-Tg-tWb" firstAttribute="top" secondItem="YC3-ad-nD5" secondAttribute="top" id="3xf-hE-ppI"/>
+                                    <constraint firstItem="pJa-Tg-tWb" firstAttribute="centerX" secondItem="YC3-ad-nD5" secondAttribute="centerX" id="As2-wq-Q7Z"/>
+                                    <constraint firstAttribute="bottom" secondItem="pJa-Tg-tWb" secondAttribute="bottom" id="RcZ-WG-apw"/>
+                                </constraints>
+                            </view>
+                            <constraints>
+                                <constraint firstAttribute="height" constant="48" id="Ge3-4O-QfX"/>
+                                <constraint firstAttribute="width" constant="300" id="huF-4T-zY5"/>
+                            </constraints>
+                        </box>
+                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="yCY-ZD-Ebi">
+                            <rect key="frame" x="452" y="72" width="37" height="16"/>
+                            <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="aYu-g1-WaW">
+                                <font key="font" metaFont="system"/>
+                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            </textFieldCell>
+                        </textField>
+                    </subviews>
+                    <constraints>
+                        <constraint firstItem="Xrp-Ow-rsS" firstAttribute="centerX" secondItem="8ax-UJ-9Yb" secondAttribute="centerX" id="1T3-23-Azi"/>
+                        <constraint firstAttribute="height" constant="400" id="7NF-1V-xe9"/>
+                        <constraint firstItem="GxN-7N-Cbx" firstAttribute="top" secondItem="Xrp-Ow-rsS" secondAttribute="bottom" constant="40" id="8wS-KI-LEd"/>
+                        <constraint firstItem="iut-zE-qaZ" firstAttribute="centerX" secondItem="8ax-UJ-9Yb" secondAttribute="centerX" id="97U-RW-AO3"/>
+                        <constraint firstItem="Xrp-Ow-rsS" firstAttribute="top" secondItem="tCA-C4-nrI" secondAttribute="bottom" constant="40" id="HqW-dM-3mC"/>
+                        <constraint firstItem="tCA-C4-nrI" firstAttribute="top" secondItem="iut-zE-qaZ" secondAttribute="bottom" constant="8" id="IJd-x5-Yka"/>
+                        <constraint firstItem="GxN-7N-Cbx" firstAttribute="centerX" secondItem="8ax-UJ-9Yb" secondAttribute="centerX" id="OFp-Ls-No2"/>
+                        <constraint firstItem="iut-zE-qaZ" firstAttribute="top" secondItem="8ax-UJ-9Yb" secondAttribute="top" constant="72" id="VHn-TS-riK"/>
+                        <constraint firstItem="yCY-ZD-Ebi" firstAttribute="centerX" secondItem="8ax-UJ-9Yb" secondAttribute="centerX" id="eeO-18-I12"/>
+                        <constraint firstItem="yCY-ZD-Ebi" firstAttribute="top" secondItem="GxN-7N-Cbx" secondAttribute="bottom" constant="8" id="l9E-Pn-VFn"/>
+                        <constraint firstItem="tCA-C4-nrI" firstAttribute="centerX" secondItem="8ax-UJ-9Yb" secondAttribute="centerX" id="vgs-LB-9o5"/>
+                    </constraints>
+                </customView>
+            </subviews>
+            <constraints>
+                <constraint firstAttribute="trailing" secondItem="8ax-UJ-9Yb" secondAttribute="trailing" constant="32" id="5m9-lH-FE7"/>
+                <constraint firstItem="8ax-UJ-9Yb" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="32" id="A5y-xK-6H8"/>
+                <constraint firstItem="ED8-nx-ye3" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="32" id="CSa-OT-xq6"/>
+                <constraint firstItem="8ax-UJ-9Yb" firstAttribute="top" secondItem="ED8-nx-ye3" secondAttribute="bottom" constant="16" id="GfY-Ls-poL"/>
+                <constraint firstAttribute="trailing" secondItem="ED8-nx-ye3" secondAttribute="trailing" constant="32" id="Pv7-dW-axv"/>
+                <constraint firstItem="ED8-nx-ye3" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="40" id="iMO-Kj-SwU"/>
+            </constraints>
+            <point key="canvasLocation" x="401.5" y="264.5"/>
+        </customView>
+    </objects>
+    <resources>
+        <image name="icon_btn_arrow_gray_down_s_norm_false" width="12" height="12"/>
+    </resources>
+</document>

+ 11 - 12
PDF Office/PDF Master/Class/Home/ViewController/KMHomeHistoryFileViewController.xib

@@ -1,12 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
-        <deployment identifier="macosx"/>
         <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMHomeHistoryFileViewController" customModule="PDF_Office" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMHomeHistoryFileViewController" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="deleteBox" destination="aXB-IV-e8R" id="8Md-O9-YwP"/>
                 <outlet property="deleteBoxHeight" destination="7ky-J5-8lA" id="xpI-5A-eHj"/>
@@ -82,7 +81,7 @@
                                                 <action selector="openFileAction:" target="-2" id="uIl-VG-PWa"/>
                                             </connections>
                                         </button>
-                                        <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="Voy-Qh-tgb" customClass="KMMoveBox" customModule="PDF_Office" customModuleProvider="target">
+                                        <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="Voy-Qh-tgb" customClass="KMMoveBox" customModule="PDF_Master" customModuleProvider="target">
                                             <rect key="frame" x="267" y="42" width="128" height="128"/>
                                             <view key="contentView" id="buu-8f-Cls">
                                                 <rect key="frame" x="0.0" y="0.0" width="128" height="128"/>
@@ -156,7 +155,7 @@
                         <rect key="frame" x="0.0" y="0.0" width="68" height="32"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
-                            <box boxType="custom" borderWidth="0.0" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="NfR-vN-YbT" customClass="KMBox" customModule="PDF_Office" customModuleProvider="target">
+                            <box boxType="custom" borderWidth="0.0" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="NfR-vN-YbT" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
                                 <rect key="frame" x="2" y="2" width="32" height="24"/>
                                 <view key="contentView" id="mHq-Mu-dvJ">
                                     <rect key="frame" x="0.0" y="0.0" width="32" height="24"/>
@@ -179,7 +178,7 @@
                                     <constraint firstAttribute="width" constant="32" id="npY-Rc-XqP"/>
                                 </constraints>
                             </box>
-                            <box boxType="custom" borderWidth="0.0" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="SHU-Sa-IG4" customClass="KMBox" customModule="PDF_Office" customModuleProvider="target">
+                            <box boxType="custom" borderWidth="0.0" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="SHU-Sa-IG4" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
                                 <rect key="frame" x="34" y="2" width="32" height="24"/>
                                 <view key="contentView" id="6xk-lb-lfB">
                                     <rect key="frame" x="0.0" y="0.0" width="32" height="24"/>
@@ -218,7 +217,7 @@
                         <constraint firstAttribute="height" constant="32" id="WBT-Kl-uEp"/>
                     </constraints>
                 </box>
-                <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="aXB-IV-e8R" customClass="KMBox" customModule="PDF_Office" customModuleProvider="target">
+                <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="aXB-IV-e8R" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
                     <rect key="frame" x="597" y="386" width="32" height="32"/>
                     <view key="contentView" id="7eF-HT-fMp">
                         <rect key="frame" x="0.0" y="0.0" width="32" height="32"/>
@@ -241,7 +240,7 @@
                                     <rect key="frame" x="0.0" y="0.0" width="597" height="372"/>
                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                     <subviews>
-                                        <collectionView selectable="YES" id="41G-Wi-2zc" customClass="KMHistoryFileCollectionView" customModule="PDF_Office" customModuleProvider="target">
+                                        <collectionView selectable="YES" id="41G-Wi-2zc" customClass="KMHistoryFileCollectionView" customModule="PDF_Master" customModuleProvider="target">
                                             <rect key="frame" x="0.0" y="0.0" width="597" height="372"/>
                                             <autoresizingMask key="autoresizingMask" widthSizable="YES"/>
                                             <collectionViewFlowLayout key="collectionViewLayout" minimumInteritemSpacing="10" minimumLineSpacing="10" id="TAv-4C-W1m">
@@ -260,7 +259,7 @@
                                     <rect key="frame" x="-100" y="-100" width="233" height="15"/>
                                     <autoresizingMask key="autoresizingMask"/>
                                 </scroller>
-                                <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="OmZ-np-EHK" customClass="KMToolSetScroller" customModule="PDF_Office" customModuleProvider="target">
+                                <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="OmZ-np-EHK" customClass="KMToolSetScroller" customModule="PDF_Master" customModuleProvider="target">
                                     <rect key="frame" x="234" y="1" width="15" height="143"/>
                                     <autoresizingMask key="autoresizingMask"/>
                                 </scroller>
@@ -271,7 +270,7 @@
                                     <rect key="frame" x="0.0" y="0.0" width="597" height="372"/>
                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                     <subviews>
-                                        <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" tableStyle="fullWidth" selectionHighlightStyle="none" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" rowHeight="76" rowSizeStyle="automatic" viewBased="YES" id="KnG-9K-0sJ" customClass="KMHistoryFileTableView" customModule="PDF_Office" customModuleProvider="target">
+                                        <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" tableStyle="fullWidth" selectionHighlightStyle="none" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" rowHeight="76" rowSizeStyle="automatic" viewBased="YES" id="KnG-9K-0sJ" customClass="KMHistoryFileTableView" customModule="PDF_Master" customModuleProvider="target">
                                             <rect key="frame" x="0.0" y="0.0" width="597" height="372"/>
                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                             <color key="backgroundColor" red="1" green="0.99843658089999998" blue="0.99619259260000004" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
@@ -289,11 +288,11 @@
                                                     </textFieldCell>
                                                     <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
                                                     <prototypeCellViews>
-                                                        <tableCellView id="kZK-Bs-0PF" customClass="KMHomeHistoryFileTableviewCell" customModule="PDF_Office" customModuleProvider="target">
+                                                        <tableCellView id="kZK-Bs-0PF" customClass="KMHomeHistoryFileTableviewCell" customModule="PDF_Master" customModuleProvider="target">
                                                             <rect key="frame" x="0.0" y="0.0" width="597" height="76"/>
                                                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                             <subviews>
-                                                                <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="g02-xk-jpk" customClass="KMBox" customModule="PDF_Office" customModuleProvider="target">
+                                                                <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="g02-xk-jpk" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
                                                                     <rect key="frame" x="0.0" y="0.0" width="597" height="76"/>
                                                                     <view key="contentView" id="ZlB-5n-pSb">
                                                                         <rect key="frame" x="0.0" y="0.0" width="597" height="76"/>
@@ -427,7 +426,7 @@
                                     <rect key="frame" x="1" y="356" width="666" height="15"/>
                                     <autoresizingMask key="autoresizingMask"/>
                                 </scroller>
-                                <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="Pqc-wg-QGI" customClass="KMToolSetScroller" customModule="PDF_Office" customModuleProvider="target">
+                                <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="Pqc-wg-QGI" customClass="KMToolSetScroller" customModule="PDF_Master" customModuleProvider="target">
                                     <rect key="frame" x="224" y="17" width="15" height="102"/>
                                     <autoresizingMask key="autoresizingMask"/>
                                 </scroller>

+ 1 - 2
PDF Office/PDF Master/Class/Home/ViewController/KMHomePopViewController.xib

@@ -1,12 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
-        <deployment identifier="macosx"/>
         <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMHomePopViewController" customModule="PDF_Office" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMHomePopViewController" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="customBox" destination="9lg-HU-LiR" id="hkE-v4-san"/>
                 <outlet property="customBoxHeightLayoutConstraint" destination="ZAc-ol-mkr" id="s0N-dl-AMb"/>

+ 18 - 0
PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController.swift

@@ -87,6 +87,8 @@ import KMAdvertisement
     @IBOutlet weak var aiErrorCorrectionImageView: NSImageView!
     @IBOutlet weak var aiErrorCorrectionLabel: NSTextField!
     @IBOutlet var aiOpenPDFFilesViewController: KMAIOpenPDFFilesVC!
+    @IBOutlet var aiTranslationViewController: KMAITranslationVC!
+    @IBOutlet var aiRewritingViewController: KMAIRewritingVC!
     
     var aiHomeState: KMAIHomeToolState = .Home
     
@@ -532,18 +534,34 @@ import KMAdvertisement
             self.aiTranslationLabel.textColor = NSColor(hex: "#252629")
             self.aiTranslationLabel.font = NSFont.SFProTextSemibold(16.0)
 
+            self.rightFullBox.isHidden = false
+            self.rightTopBox.contentView = nil
+            self.rightBottomBox.contentView = nil
+            self.rightFullBox.contentView = self.aiTranslationViewController.view
             break
         case .AIRewriting:
             self.aiRewritingBox.fillColor = NSColor(hex: "#1770F4", alpha: 0.1)
             self.aiRewritingLabel.textColor = NSColor(hex: "#252629")
             self.aiRewritingLabel.font = NSFont.SFProTextSemibold(16.0)
 
+            self.rightFullBox.isHidden = false
+            self.rightTopBox.contentView = nil
+            self.rightBottomBox.contentView = nil
+            self.rightFullBox.contentView = self.aiRewritingViewController.view
+            self.aiRewritingViewController.state = .AIRewriting
+            self.aiRewritingViewController.initLocalization()
             break
         case .AIErrorCorrection:
             self.aiErrorCorrectionBox.fillColor = NSColor(hex: "#1770F4", alpha: 0.1)
             self.aiErrorCorrectionLabel.textColor = NSColor(hex: "#252629")
             self.aiErrorCorrectionLabel.font = NSFont.SFProTextSemibold(16.0)
 
+            self.rightFullBox.isHidden = false
+            self.rightTopBox.contentView = nil
+            self.rightBottomBox.contentView = nil
+            self.rightFullBox.contentView = self.aiRewritingViewController.view
+            self.aiRewritingViewController.state = .AIErrorCorrection
+            self.aiRewritingViewController.initLocalization()
             break
         default:
             break

+ 6 - 2
PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController.xib

@@ -18,9 +18,11 @@
                 <outlet property="aiRewritingBox" destination="0aC-uQ-5lW" id="iLK-iS-H4H"/>
                 <outlet property="aiRewritingImageView" destination="7L8-5k-lE1" id="B5k-0W-Dgp"/>
                 <outlet property="aiRewritingLabel" destination="Fhh-MS-1UA" id="ihQ-rh-yLB"/>
+                <outlet property="aiRewritingViewController" destination="npC-Vy-evi" id="B6V-GX-Q49"/>
                 <outlet property="aiTranslationBox" destination="aEd-2n-FAH" id="QFg-bu-h0w"/>
                 <outlet property="aiTranslationImageView" destination="R0l-VG-P9c" id="bS5-ho-ymi"/>
                 <outlet property="aiTranslationLabel" destination="p5N-bY-CVu" id="1QT-kv-3v4"/>
+                <outlet property="aiTranslationViewController" destination="vQI-sm-WpY" id="TS3-4x-ip4"/>
                 <outlet property="cloudDocumentsBox" destination="ntJ-b8-qxk" id="hNr-Vi-fYQ"/>
                 <outlet property="cloudDocumentsBoxHeight" destination="aCh-WL-S1o" id="Ly4-LY-8YM"/>
                 <outlet property="cloudDocumentsViewController" destination="icM-sk-XE7" id="b9t-ez-lLE"/>
@@ -205,7 +207,7 @@ Gw
                                                 <scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Zv8-o9-nPx">
                                                     <rect key="frame" x="0.0" y="0.0" width="270" height="652"/>
                                                     <clipView key="contentView" drawsBackground="NO" id="0m5-Ti-Llk">
-                                                        <rect key="frame" x="0.0" y="0.0" width="255" height="652"/>
+                                                        <rect key="frame" x="0.0" y="0.0" width="270" height="652"/>
                                                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                         <subviews>
                                                             <view translatesAutoresizingMaskIntoConstraints="NO" id="TNl-3V-JVe">
@@ -312,7 +314,7 @@ Gw
                                                         <autoresizingMask key="autoresizingMask"/>
                                                     </scroller>
                                                     <scroller key="verticalScroller" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="eMA-3D-xnv" customClass="KMToolSetScroller" customModule="PDF_Master" customModuleProvider="target">
-                                                        <rect key="frame" x="255" y="0.0" width="15" height="652"/>
+                                                        <rect key="frame" x="254" y="0.0" width="16" height="652"/>
                                                         <autoresizingMask key="autoresizingMask"/>
                                                     </scroller>
                                                 </scrollView>
@@ -660,6 +662,8 @@ Gw
         <customObject id="cEr-ez-OtI" customClass="KMPDFToolsViewController" customModule="PDF_Master" customModuleProvider="target"/>
         <customObject id="icM-sk-XE7" customClass="KMCloudDocumentsViewController" customModule="PDF_Master" customModuleProvider="target"/>
         <customObject id="FOs-X3-zsa" customClass="KMAIOpenPDFFilesVC" customModule="PDF_Master" customModuleProvider="target"/>
+        <customObject id="vQI-sm-WpY" customClass="KMAITranslationVC" customModule="PDF_Master" customModuleProvider="target"/>
+        <customObject id="npC-Vy-evi" customClass="KMAIRewritingVC" customModule="PDF_Master" customModuleProvider="target"/>
     </objects>
     <resources>
         <image name="NSTouchBarGoForwardTemplate" width="12" height="17"/>

+ 140 - 0
PDF Office/PDF Master/Class/KMLightMember/KMRequestServer/KMRequestServer.swift

@@ -145,6 +145,146 @@ class KMRequestServer {
 //        [downloadTask resume];
     }
     
+    /**
+     翻译上传文件
+     */
+    func aiTranslation(urlString: String,
+                        params: Dictionary<String, Any>?,
+                       body: ((_ formData:AFMultipartFormData) -> Void)?,
+          requestSerializer: ((_ requestSerializer:AFHTTPRequestSerializer) -> Void)?,
+                     completion: KMHttpRequestServerComplete?) -> Void {
+        sessionManager.requestSerializer.setValue("multipart/form-data", forHTTPHeaderField: "Content-Type")
+        sessionManager.requestSerializer.timeoutInterval = 60
+        sessionManager.responseSerializer = AFJSONResponseSerializer()
+        sessionManager.responseSerializer.acceptableContentTypes = ["application/json","text/html","text/json","text/javascript","text/plain","image/gif"]
+        if (requestSerializer != nil) {
+            requestSerializer!(sessionManager.requestSerializer);
+        }
+        if (body != nil) {
+            sessionManager.post(urlString, parameters: params, headers: nil) { formData in
+                body!(formData)
+            } progress: { progress in
+                
+            } success: { task, responseObject in
+                let responseObject = responseObject as AnyObject
+                if (completion != nil) {
+                    completion!(task,responseObject,nil);
+                }
+            } failure: { task, error in
+                if (completion != nil) {
+                    completion!(task, nil, error as NSError);
+                }
+            }
+        } else {
+            sessionManager.post(urlString, parameters: params, headers: nil) { progress in
+            
+            } success: { task, responseObject in
+                if (completion != nil) {
+                    let responseObject = responseObject as AnyObject
+                    completion!(task,responseObject,nil);
+                }
+            } failure: { task, error in
+                if (completion != nil) {
+                    completion!(task, nil, error as NSError);
+                }
+            }
+
+        }
+    }
+    
+    /**
+     文件翻译
+     */
+    func aiFileTranslateHandle(urlString: String,
+                                  params: Dictionary<String, Any>?,
+                                    body: ((_ formData:AFMultipartFormData) -> Void)?,
+                       requestSerializer: ((_ requestSerializer:AFHTTPRequestSerializer) -> Void)?,
+                              completion: KMHttpRequestServerComplete?) -> Void {
+        sessionManager.requestSerializer = AFJSONRequestSerializer()
+        sessionManager.responseSerializer = AFJSONResponseSerializer()
+        sessionManager.responseSerializer.acceptableContentTypes = ["application/json","text/html","text/json","text/javascript","text/plain","image/gif"]
+        if (requestSerializer != nil) {
+            requestSerializer!(sessionManager.requestSerializer);
+        }
+        if (body != nil) {
+            sessionManager.post(urlString, parameters: params, headers: nil) { formData in
+                body!(formData)
+            } progress: { progress in
+                
+            } success: { task, responseObject in
+                let responseObject = responseObject as AnyObject
+                if (completion != nil) {
+                    completion!(task,responseObject,nil);
+                }
+            } failure: { task, error in
+                if (completion != nil) {
+                    completion!(task, nil, error as NSError);
+                }
+            }
+        } else {
+            sessionManager.post(urlString, parameters: params, headers: nil) { progress in
+            
+            } success: { task, responseObject in
+                if (completion != nil) {
+                    let responseObject = responseObject as AnyObject
+                    completion!(task,responseObject,nil);
+                }
+            } failure: { task, error in
+                if (completion != nil) {
+                    completion!(task, nil, error as NSError);
+                }
+            }
+
+        }
+    }
+    
+    /**
+     重写
+     */
+    func aiRewriting(urlString: String,
+                        params: Dictionary<String, Any>?,
+                          body: ((_ formData:AFMultipartFormData) -> Void)?,
+             requestSerializer: ((_ requestSerializer:AFHTTPRequestSerializer) -> Void)?,
+                    completion: KMHttpRequestServerComplete?) -> Void {
+        sessionManager.requestSerializer.setValue("multipart/form-data", forHTTPHeaderField: "Content-Type")
+        sessionManager.requestSerializer.timeoutInterval = 60
+        sessionManager.responseSerializer = AFJSONResponseSerializer()
+        sessionManager.responseSerializer.acceptableContentTypes = ["application/json","text/html","text/json","text/javascript","text/plain","image/gif"]
+        if (requestSerializer != nil) {
+            requestSerializer!(sessionManager.requestSerializer);
+        }
+        if (body != nil) {
+            sessionManager.post(urlString, parameters: params, headers: nil) { formData in
+                body!(formData)
+            } progress: { progress in
+                
+            } success: { task, responseObject in
+                let responseObject = responseObject as AnyObject
+                if (completion != nil) {
+                    completion!(task,responseObject,nil);
+                }
+            } failure: { task, error in
+                if (completion != nil) {
+                    completion!(task, nil, error as NSError);
+                }
+            }
+        } else {
+            sessionManager.post(urlString, parameters: params, headers: nil) { progress in
+            
+            } success: { task, responseObject in
+                if (completion != nil) {
+                    let responseObject = responseObject as AnyObject
+                    completion!(task,responseObject,nil);
+                }
+            } failure: { task, error in
+                if (completion != nil) {
+                    completion!(task, nil, error as NSError);
+                }
+            }
+
+        }
+    }
+    
     /*
      status
      AFNetworkReachabilityStatusUnknown          = -1, 不知道监测的是什么

+ 129 - 0
PDF Office/PDF Master/Class/KMLightMember/Manager/KMRequestServerManager.swift

@@ -490,4 +490,133 @@ class KMRequestServerManager: NSObject {
         print(dic)
         return Result(result: result,message: message,code: code, error: error)
     }
+    
+    /**
+     @abstract 翻译上传
+     @param file  文件路径
+     @param version 版本号
+     */
+    func aiTranslationFileUpload(file: String, version: String, complete: @escaping KMRequestServerComplete) {
+        
+        let infoDictionary = Bundle .main.infoDictionary!
+        let userInfo = KMLightMemberCache.cache.readData(type: .info)
+        let majorVersion = infoDictionary["CFBundleShortVersionString"]
+        let urlString = KMAIServerConfig().aiTranslationURL + "/v1/translate/fileUpload"
+        let fileData = FileManager.default.contents(atPath: file)
+        let params: [String: Any] = ["file": fileData,
+                                     "projectId": "2",
+                                     "version": version,
+                                     "userId": userInfo["id"] as Any]
+        KMRequestServer.requestServer.aiTranslation(urlString: urlString, params: params) { formData in
+            let fileURL = URL(fileURLWithPath: file)
+            try? formData.appendPart(withFileURL: fileURL, name: "file", fileName: fileURL.lastPathComponent, mimeType: "application/octet-stream")
+        } requestSerializer: { requestSerializer in
+            requestSerializer.setValue("Apifox/1.0.0 (https://www.apifox.cn)", forHTTPHeaderField: "User-Agent")
+        } completion: { task, responseObject, error in
+            if responseObject != nil {
+                let data: NSDictionary = responseObject!["data"] as? NSDictionary ?? [:]
+                let code: String = responseObject!["code"] as? String ?? "06005"
+                let message: String = responseObject!["message"] as? String ?? "unknown error"
+                let error = NSError(domain: message, code: Int(code)!)
+                let result = Result(result: data,message: message,code: Int(code)!, error: error)
+                if result.code == 200 {
+                    complete(true, result)
+                } else {
+                    complete(false, result)
+                }
+            }
+        }
+    }
+    
+    /**
+     @abstract 文件翻译
+     @param fileKey  文件Key
+     @param from 初始语言
+     @param to 结束语言
+     @param version 应用版本
+     */
+    func aiTranslationFileTranslateHandle(fileKey: String, from: String, to: String, version: String, complete: @escaping KMRequestServerComplete) {
+        
+        let infoDictionary = Bundle .main.infoDictionary!
+        let userInfo = KMLightMemberCache.cache.readData(type: .info)
+        let majorVersion = infoDictionary["CFBundleShortVersionString"]
+        let urlString = KMAIServerConfig().aiTranslationURL + "/v1/translate/fileTranslateHandle"
+        
+        var semaphore = DispatchSemaphore (value: 0)
+
+        let parameters = String(format: "{\r\n    \"fileKey\": \"%@\",\r\n    \"from\": \"%@\",\r\n    \"to\": \"%@\",\r\n    \"version\": \"%@\",\r\n    \"projectId\": \"2\",\r\n    \"userId\": \"%@\"\r\n}", fileKey, from, to, version, userInfo["id"] as! String)
+        let postData = parameters.data(using: .utf8)
+
+        var request = URLRequest(url: URL(string: urlString)!,timeoutInterval: Double.infinity)
+        request.addValue("Apifox/1.0.0 (https://www.apifox.cn)", forHTTPHeaderField: "User-Agent")
+        request.addValue("application/json", forHTTPHeaderField: "Content-Type")
+
+        request.httpMethod = "POST"
+        request.httpBody = postData
+
+        let task = URLSession.shared.dataTask(with: request) { data, response, error in
+           guard let data = data else {
+              print(String(describing: error))
+              semaphore.signal()
+              return
+           }
+            let jsonObject = try? JSONSerialization.jsonObject(with: data, options: []) as? NSDictionary ?? [:]
+            if jsonObject != nil {
+                let data1: NSDictionary = jsonObject!["data"] as? NSDictionary ?? [:]
+                let code: String = jsonObject!["code"] as? String ?? "06005"
+                let message: String = jsonObject!["msg"] as? String ?? "unknown error"
+                let error = NSError(domain: message, code: Int(code)!)
+                let result = Result(result: data1,message: message,code: Int(code)!, error: error)
+                if result.code == 200 {
+                    complete(true, result)
+                } else {
+                    complete(false, result)
+                }
+
+            }
+           semaphore.signal()
+        }
+        
+        task.resume()
+        semaphore.wait()
+    }
+
+    
+    /**
+     @abstract重写 & 纠错
+     @param content  内容
+     @param version 版本号
+     */
+    func aiRewriting(content: String, version: String, state: KMAIRewritingState, complete: @escaping KMRequestServerComplete) {
+        
+        let userInfo = KMLightMemberCache.cache.readData(type: .info)
+        var urlString = KMAIServerConfig().aiRewritingURL + "/api/rewrite"
+        if state == .AIErrorCorrection {
+            urlString = KMAIServerConfig().aiRewritingURL + "/api/correct-typos"
+        }
+        let params: [String: Any] = ["project_id": 2,
+                                     "content": content,
+                                     "version": version,
+                                     "user_id": userInfo["id"] as Any]
+        
+        KMRequestServer.requestServer.aiRewriting(urlString: urlString, params: params) { formData in
+            
+        } requestSerializer: { requestSerializer in
+            requestSerializer.setValue("Apifox/1.0.0 (https://www.apifox.cn)", forHTTPHeaderField: "User-Agent")
+        } completion: { task, responseObject, error in
+            if responseObject != nil {
+                let data: NSDictionary = responseObject!["data"] as? NSDictionary ?? [:]
+                let code: String = responseObject!["code"] as? String ?? "06005"
+                let message: String = responseObject!["message"] as? String ?? "unknown error"
+                let error = NSError(domain: message, code: Int(code)!)
+                let result = Result(result: data,message: message,code: Int(code)!, error: error)
+                if result.code == 200 {
+                    complete(true, result)
+                } else {
+                    complete(false, result)
+                }
+            }
+        }
+    }
+
 }

+ 8 - 0
PDF Office/PDF Master/Strings/en.lproj/Localizable.strings

@@ -3819,3 +3819,11 @@
 "AI Translation" = "AI Translation";
 "AI Rewriting" = "AI Rewriting";
 "AI Error Correction" = "AI Error Correction";
+"Open PDF Files" = "Open PDF Files";
+"Select your files" = "Select your files";
+"or drop files here to open" = "or drop files here to open";
+"New From Files" = "New From Files";
+"Support PDF, Word file" = "Support PDF, Word file";
+"Limit document size to 10M, document page number to 30, 10w characters per month" = "Limit document size to 10M, document page number to 30, 10w characters per month";
+"Translation Language:" = "Translation Language:";
+"or drop file here" = "or drop file here";