Browse Source

AI - PDFView选中文本翻译功能补充

wanjun 1 year ago
parent
commit
d0edb41940
16 changed files with 1312 additions and 8 deletions
  1. 16 0
      PDF Office/PDF Master.xcodeproj/project.pbxproj
  2. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_groping_default.imageset/Contents.json
  3. 112 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_groping_default.imageset/Control.pdf
  4. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/image_btn_tips.imageset/Contents.json
  5. 131 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/image_btn_tips.imageset/tips.pdf
  6. 2 2
      PDF Office/PDF Master/Class/Home/ViewController/KMAITranslationVC.swift
  7. 432 0
      PDF Office/PDF Master/Class/Home/WindowController/KMAITranslationWindowController.swift
  8. 513 0
      PDF Office/PDF Master/Class/Home/WindowController/KMAITranslationWindowController.xib
  9. 2 3
      PDF Office/PDF Master/Class/Home/WindowController/KMDeviceBrowserWindowController.xib
  10. 52 0
      PDF Office/PDF Master/Class/KMLightMember/Manager/KMRequestServerManager.swift
  11. 4 3
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/Signature/KMSignatureHelpViewController.xib
  12. 20 0
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift
  13. 1 0
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift
  14. 1 0
      PDF Office/PDF Master/PDF_Master DMG-Bridging-Header.h
  15. 1 0
      PDF Office/PDF Master/PDF_Master Pro-Bridging-Header.h
  16. 1 0
      PDF Office/PDF Master/PDF_Master-Bridging-Header.h

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

@@ -426,6 +426,12 @@
 		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 */; };
+		9F02018E2A1DDAA500C9B673 /* KMAITranslationWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F02018C2A1DDAA500C9B673 /* KMAITranslationWindowController.swift */; };
+		9F02018F2A1DDAA500C9B673 /* KMAITranslationWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F02018C2A1DDAA500C9B673 /* KMAITranslationWindowController.swift */; };
+		9F0201902A1DDAA500C9B673 /* KMAITranslationWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F02018C2A1DDAA500C9B673 /* KMAITranslationWindowController.swift */; };
+		9F0201912A1DDAA500C9B673 /* KMAITranslationWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F02018D2A1DDAA500C9B673 /* KMAITranslationWindowController.xib */; };
+		9F0201922A1DDAA500C9B673 /* KMAITranslationWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F02018D2A1DDAA500C9B673 /* KMAITranslationWindowController.xib */; };
+		9F0201932A1DDAA500C9B673 /* KMAITranslationWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F02018D2A1DDAA500C9B673 /* KMAITranslationWindowController.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"; }; };
@@ -3475,6 +3481,8 @@
 		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>"; };
+		9F02018C2A1DDAA500C9B673 /* KMAITranslationWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMAITranslationWindowController.swift; sourceTree = "<group>"; };
+		9F02018D2A1DDAA500C9B673 /* KMAITranslationWindowController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMAITranslationWindowController.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>"; };
@@ -5552,6 +5560,8 @@
 				9F0CB5412986953A00007028 /* KMURLToPDFWindowController.xib */,
 				9FD0FA4929D43D6800F2AB0D /* KMDeviceBrowserWindowController.swift */,
 				9FD0FA4A29D43D6800F2AB0D /* KMDeviceBrowserWindowController.xib */,
+				9F02018C2A1DDAA500C9B673 /* KMAITranslationWindowController.swift */,
+				9F02018D2A1DDAA500C9B673 /* KMAITranslationWindowController.xib */,
 			);
 			path = WindowController;
 			sourceTree = "<group>";
@@ -9102,6 +9112,7 @@
 				ADBC374C29CAD65D00D93208 /* KMComparativeOutlineCell.xib in Resources */,
 				9FDD0FBA295D5230000C4DAD /* KMToolbarController.xib in Resources */,
 				894A00F52976314C0070ED83 /* KMPDFViewPanelSetViewController.xib in Resources */,
+				9F0201912A1DDAA500C9B673 /* KMAITranslationWindowController.xib in Resources */,
 				899700E228F3A9F2009AF911 /* KMHomeWindowController.xib in Resources */,
 				89E93EF02999DB6600F10F66 /* KMNoteTypeCollectionViewItem.xib in Resources */,
 				BB2F61532966A91D001CB369 /* KMBackgroundPropertyHomeController.xib in Resources */,
@@ -9545,6 +9556,7 @@
 				BB2EDF50296E63E5003BCF58 /* KMPageEditInsertCustomPageWindowController.xib in Resources */,
 				9F0CB4AB296CF19600007028 /* KMPropertiesPanelListMenuSubVC.xib in Resources */,
 				9F1F82B8292DEF370092C4B4 /* KMCloudDocumentsViewController.xib in Resources */,
+				9F0201922A1DDAA500C9B673 /* KMAITranslationWindowController.xib in Resources */,
 				AD0FA50729A8E61B00EDEB50 /* KMLightMemberAlertView.xib in Resources */,
 				BB69C963299116FD0001A9B1 /* horizontal_line.pdf in Resources */,
 				BBFE6E612930809A00142C01 /* KMMergeCollectionPageViewItem.xib in Resources */,
@@ -9681,6 +9693,7 @@
 				BB89721D294AED6C0045787C /* KMWatermarkAdjectivePreViewBaseController.xib in Resources */,
 				AD2D74BB29F0D3A100EDC5E4 /* KMCancellationSuccessView.xib in Resources */,
 				ADED71DB29B57C01005EEC0A /* Localizable.strings in Resources */,
+				9F0201932A1DDAA500C9B673 /* KMAITranslationWindowController.xib in Resources */,
 				9F72D20D2994BDAF00DCACF1 /* KMNotificationVC.xib in Resources */,
 				ADB2D6EB294740F30029D2B3 /* KMPrintPaperSetWindowController.xib in Resources */,
 				AD0FA50029A8DD8700EDEB50 /* KMRegisterSuccessView.xib in Resources */,
@@ -10359,6 +10372,7 @@
 				BB8F4569295ABDC10037EA22 /* KMWatermarkAdjectiveBaseModel.swift in Sources */,
 				9F0CB5392986570600007028 /* KMDesignToken+BoxShadow.swift in Sources */,
 				9F0CB4B52977BC1000007028 /* KMPropertiesPanelPreviewSubVC.swift in Sources */,
+				9F02018E2A1DDAA500C9B673 /* KMAITranslationWindowController.swift in Sources */,
 				BB88E45829404752002B3655 /* KMPDFConvert.swift in Sources */,
 				ADB1FE9E2975303400ED072D /* KMBatchBatesNumberView.swift in Sources */,
 				9F1FE4CC29406E4700E952CA /* CTTabContentsController.m in Sources */,
@@ -10921,6 +10935,7 @@
 				BB86C1F328F54535005AD968 /* CPDFListView+KeyEvent.m in Sources */,
 				896DD46829893B9900ADE514 /* KMSplitView.m in Sources */,
 				BB897247294C19980045787C /* KMWatermarkAdjectiveListController.swift in Sources */,
+				9F02018F2A1DDAA500C9B673 /* KMAITranslationWindowController.swift in Sources */,
 				9F1FE4A929406E4700E952CA /* CTBrowserWindowController.m in Sources */,
 				BB00301E298CB799002DD1A0 /* KMPreferenceManager.swift in Sources */,
 				89E93EFB299CB4C200F10F66 /* KMOCRBox.m in Sources */,
@@ -12160,6 +12175,7 @@
 				8997011028F40842009AF911 /* KMOutlineViewController.swift in Sources */,
 				9F1F82BE292E01860092C4B4 /* KMCloudEmptyCollectionViewItem.swift in Sources */,
 				BB6DD8272934D056001F0544 /* KMSecureEncryptSuccessTipView.swift in Sources */,
+				9F0201902A1DDAA500C9B673 /* KMAITranslationWindowController.swift in Sources */,
 				BBEC00C1295C306400A26C98 /* KMBatesPropertyController.swift in Sources */,
 				AD53B70729ACC65500D61E81 /* KMMailHelper.m in Sources */,
 				89E4E7242963FB23002DBA6F /* KMGeneralButton.m in Sources */,

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

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

+ 112 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_groping_default.imageset/Control.pdf

@@ -0,0 +1,112 @@
+%PDF-1.7
+
+1 0 obj
+  << /ExtGState << /E1 << /ca 0.120000 >> >> >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+q
+1.000000 0.000000 -0.000000 1.000000 0.000000 0.000000 cm
+0.890196 0.890196 0.890196 scn
+6.000000 0.000000 m
+9.313708 0.000000 12.000000 2.686292 12.000000 6.000000 c
+12.000000 9.313708 9.313708 12.000000 6.000000 12.000000 c
+2.686291 12.000000 0.000000 9.313708 0.000000 6.000000 c
+0.000000 2.686292 2.686291 0.000000 6.000000 0.000000 c
+h
+f*
+n
+Q
+6.000000 0.000000 m
+9.313708 0.000000 12.000000 2.686292 12.000000 6.000000 c
+12.000000 9.313708 9.313708 12.000000 6.000000 12.000000 c
+2.686291 12.000000 0.000000 9.313708 0.000000 6.000000 c
+0.000000 2.686292 2.686291 0.000000 6.000000 0.000000 c
+h
+W*
+n
+q
+/E1 gs
+1.000000 0.000000 -0.000000 1.000000 0.000000 0.000000 cm
+0.000000 0.000000 0.000000 scn
+6.000000 -0.500000 m
+9.589851 -0.500000 12.500000 2.410149 12.500000 6.000000 c
+11.500000 6.000000 l
+11.500000 2.962434 9.037566 0.500000 6.000000 0.500000 c
+6.000000 -0.500000 l
+h
+12.500000 6.000000 m
+12.500000 9.589851 9.589851 12.500000 6.000000 12.500000 c
+6.000000 11.500000 l
+9.037566 11.500000 11.500000 9.037566 11.500000 6.000000 c
+12.500000 6.000000 l
+h
+6.000000 12.500000 m
+2.410149 12.500000 -0.500000 9.589851 -0.500000 6.000000 c
+0.500000 6.000000 l
+0.500000 9.037566 2.962434 11.500000 6.000000 11.500000 c
+6.000000 12.500000 l
+h
+-0.500000 6.000000 m
+-0.500000 2.410149 2.410149 -0.500000 6.000000 -0.500000 c
+6.000000 0.500000 l
+2.962434 0.500000 0.500000 2.962434 0.500000 6.000000 c
+-0.500000 6.000000 l
+h
+f
+n
+Q
+Q
+
+endstream
+endobj
+
+3 0 obj
+  1467
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 12.000000 12.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
+0000000074 00000 n
+0000001597 00000 n
+0000001620 00000 n
+0000001793 00000 n
+0000001867 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+1926
+%%EOF

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

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

+ 131 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/image_btn_tips.imageset/tips.pdf

@@ -0,0 +1,131 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+q
+1.000000 0.000000 -0.000000 1.000000 1.000000 1.000000 cm
+1.000000 1.000000 1.000000 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
+15.000000 8.000000 m
+15.000000 4.134007 11.865993 1.000000 8.000000 1.000000 c
+4.134007 1.000000 1.000000 4.134007 1.000000 8.000000 c
+1.000000 11.865993 4.134007 15.000000 8.000000 15.000000 c
+11.865993 15.000000 15.000000 11.865993 15.000000 8.000000 c
+h
+W*
+n
+q
+1.000000 0.000000 -0.000000 1.000000 1.000000 1.000000 cm
+0.807843 0.815686 0.831373 scn
+13.000000 7.000000 m
+13.000000 3.686292 10.313708 1.000000 7.000000 1.000000 c
+7.000000 -1.000000 l
+11.418278 -1.000000 15.000000 2.581722 15.000000 7.000000 c
+13.000000 7.000000 l
+h
+7.000000 1.000000 m
+3.686291 1.000000 1.000000 3.686292 1.000000 7.000000 c
+-1.000000 7.000000 l
+-1.000000 2.581722 2.581722 -1.000000 7.000000 -1.000000 c
+7.000000 1.000000 l
+h
+1.000000 7.000000 m
+1.000000 10.313708 3.686291 13.000000 7.000000 13.000000 c
+7.000000 15.000000 l
+2.581722 15.000000 -1.000000 11.418278 -1.000000 7.000000 c
+1.000000 7.000000 l
+h
+7.000000 13.000000 m
+10.313708 13.000000 13.000000 10.313708 13.000000 7.000000 c
+15.000000 7.000000 l
+15.000000 11.418278 11.418278 15.000000 7.000000 15.000000 c
+7.000000 13.000000 l
+h
+f
+n
+Q
+Q
+q
+1.000000 0.000000 -0.000000 1.000000 7.100006 4.419922 cm
+0.580392 0.596078 0.611765 scn
+0.370000 2.670077 m
+1.400000 2.670077 l
+1.660000 6.090078 l
+1.710000 7.580078 l
+0.060000 7.580078 l
+0.110000 6.090078 l
+0.370000 2.670077 l
+h
+0.890000 0.000077 m
+1.390000 0.000077 1.770000 0.370078 1.770000 0.890078 c
+1.770000 1.410078 1.390000 1.770078 0.890000 1.770078 c
+0.380000 1.770078 0.000000 1.410078 0.000000 0.890078 c
+0.000000 0.370078 0.370000 0.000077 0.890000 0.000077 c
+h
+f
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  1960
+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
+0000002050 00000 n
+0000002073 00000 n
+0000002246 00000 n
+0000002320 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+2379
+%%EOF

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

@@ -27,7 +27,7 @@ class KMAITranslationVC: NSViewController {
     
     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 fromLanguages: [String] = ["Automatic", "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?
@@ -226,7 +226,7 @@ class KMAITranslationVC: NSViewController {
         downloadTask.resume()
     }
     
-    func  languageAbbreviation(_ language: String) -> String {
+    func languageAbbreviation(_ language: String) -> String {
         if language == "Automatic Identification" {
             return "auto"
         } else if language == "English" {

+ 432 - 0
PDF Office/PDF Master/Class/Home/WindowController/KMAITranslationWindowController.swift

@@ -0,0 +1,432 @@
+//
+//  KMAITranslationWindowController.swift
+//  PDF Master
+//
+//  Created by wanjun on 2023/5/24.
+//
+
+import Cocoa
+
+@objc enum KMAITranslationState: Int {
+    case None = 0
+    case CanTranslate
+    case CanCopy
+    case Copyed
+    case Exceed
+    case Error
+}
+
+class KMAITranslationWindowController: NSWindowController {
+
+    @IBOutlet weak var closeButton: NSButton!
+    @IBOutlet weak var aiTranslationTitleLabel: NSTextField!
+    @IBOutlet weak var tipsButton: NSButton!
+    @IBOutlet weak var translationLanguage: NSTextField!
+    @IBOutlet weak var fromBox: NSBox!
+    @IBOutlet weak var fromLabel: NSTextField!
+    @IBOutlet weak var toBox: NSBox!
+    @IBOutlet weak var toLabel: NSTextField!
+    @IBOutlet weak var languageImageView: NSImageView!
+
+    @IBOutlet weak var fromContentBox: NSBox!
+    @IBOutlet weak var fromContentTextField: NSTextField!
+    @IBOutlet weak var fromContentLabel: NSTextField!
+    @IBOutlet weak var toContentBox: NSBox!
+    @IBOutlet weak var toContentTextView: NSTextView!
+    
+    @IBOutlet weak var translateBox: KMBox!
+    @IBOutlet weak var translateLabel: NSTextField!
+    @IBOutlet weak var translateButton: NSButton!
+
+    @IBOutlet weak var copyBox: KMBox!
+    @IBOutlet weak var copyLabel: NSTextField!
+    @IBOutlet weak var copyButton: NSButton!
+    
+    @IBOutlet weak var errorView: NSView!
+    @IBOutlet weak var errorImageView: NSImageView!
+    @IBOutlet weak var errorLabel: NSTextField!
+    
+    var fromStr: String = "auto"
+    var toStr: String = "en"
+    var fromLanguages: [String] = ["Automatic", "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 content: String = ""
+    
+    var popover: NSPopover?
+    var popoverTips: NSPopover?
+    var _state: KMAITranslationState = .None
+
+    override func windowDidLoad() {
+        super.windowDidLoad()
+        
+        self.window?.backgroundColor = .white
+        
+        self.initLocalization()
+        self.initializeUI()
+    }
+    
+    // MARK: initialize
+    
+    func initializeUI() -> Void {
+        self.aiTranslationTitleLabel.textColor = NSColor(hex: "#252629")
+        self.aiTranslationTitleLabel.font = NSFont.SFProTextSemibold(16.0)
+        self.translationLanguage.textColor = NSColor(hex: "#252629")
+        self.translationLanguage.font = NSFont.SFProTextRegular(14.0)
+        self.fromBox.fillColor = NSColor(hex: "#FFFFFF")
+        self.fromBox.borderColor = NSColor(hex: "#DFE1E5")
+        self.fromLabel.textColor = NSColor(hex: "#252629")
+        self.fromLabel.font = NSFont.SFProTextRegular(14.0)
+        self.toBox.fillColor = NSColor(hex: "#FFFFFF")
+        self.toBox.borderColor = NSColor(hex: "#DFE1E5")
+        self.toLabel.textColor = NSColor(hex: "#252629")
+        self.toLabel.font = NSFont.SFProTextRegular(14.0)
+        self.languageImageView.image = NSImage(named: "ic_transtate")
+        
+        self.fromContentBox.borderColor = NSColor(hex: "#1770F4")
+        self.fromContentBox.fillColor = NSColor(hex: "#FFFFFF")
+        self.fromContentTextField.textColor = NSColor(hex: "#252629")
+        self.fromContentTextField.font = NSFont.SFProTextRegular(12.0)
+        self.fromContentLabel.textColor = NSColor(hex: "#94989C")
+        self.fromContentLabel.font = NSFont.SFProTextRegular(12.0)
+
+        self.toContentBox.borderColor = NSColor(hex: "#DFE1E5")
+        self.toContentBox.fillColor = NSColor(hex: "#FFFFFF")
+        self.toContentTextView.textColor = NSColor(hex: "#252629")
+        self.toContentTextView.font = NSFont.SFProTextRegular(12.0)
+        
+        self.translateBox.fillColor = NSColor(hex: "#BDDFFD")
+        self.translateBox.cornerRadius = 4.0
+        self.translateLabel.textColor = NSColor(hex: "#FFFFFF")
+        self.translateLabel.font = NSFont.SFProTextRegular(12.0)
+        
+        self.copyBox.fillColor = NSColor(hex: "#EDEEF0")
+        self.copyBox.borderColor = NSColor(hex: "#DFE1E5")
+        self.copyBox.borderWidth = 1.0
+        self.copyBox.cornerRadius = 4.0
+        self.copyLabel.textColor = NSColor(hex: "#F7F8FA")
+        self.copyLabel.font = NSFont.SFProTextRegular(12.0)
+        
+        self.errorView.isHidden = true
+        self.errorImageView.image = NSImage(named: "icon_error")
+        self.errorLabel.textColor = NSColor(hex: "#F3465B")
+        self.errorLabel.font = NSFont.SFProTextRegular(12.0)
+        
+        if self.content.count > 0 {
+            self.fromContentTextField.stringValue = self.content
+            
+            self.translateBox.fillColor = NSColor(hex: "#1770F4")
+            self.translateLabel.textColor = NSColor(hex: "#FFFFFF")
+            self.state = .CanTranslate
+        }
+    }
+    
+    func initLocalization() -> Void {
+        self.aiTranslationTitleLabel.stringValue = "AI Translation"
+        self.translationLanguage.stringValue = "Translation Language:"
+        self.translateLabel.stringValue = "Translate"
+        self.copyLabel.stringValue = "Copy"
+        self.fromLabel.stringValue = "Automatic"
+        self.toLabel.stringValue = "English"
+        self.fromContentLabel.stringValue = NSLocalizedString("0/150", comment: "")
+    }
+    
+    override func mouseDown(with event: NSEvent) {
+        if self.popover != nil {
+            self.popover?.close()
+            self.popover = nil
+        }
+        if self.popoverTips != nil {
+            self.popoverTips?.close()
+            self.popoverTips = nil
+        }
+    }
+    
+    // MARK: Get、Set
+    
+    var state: KMAITranslationState {
+        get {
+            return _state
+        }
+        set {
+            _state = newValue
+            
+            self.refreshAIUI()
+        }
+    }
+    
+    // MARK: Private Methods
+
+    func languageAbbreviation(_ language: String) -> String {
+        if language == "Automatic" {
+            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"
+    }
+    
+    func refreshAIUI() -> Void {
+        self.fromContentLabel.stringValue = String(format: "%d/150", self.fromContentTextField.stringValue.count)
+        self.copyLabel.stringValue = NSLocalizedString("Copy", comment: "")
+
+        if self.state == .CanTranslate {
+            self.fromContentLabel.textColor = NSColor(hex: "#94989C")
+            self.translateBox.fillColor = NSColor(hex: "#1770F4")
+            self.translateBox.borderWidth = 0.0
+            self.translateLabel.textColor = NSColor(hex: "#FFFFFF")
+            self.copyBox.fillColor = NSColor(hex: "#EDEEF0")
+            self.copyBox.borderWidth = 1.0
+            self.copyBox.borderColor = NSColor(hex: "#DFE1E5")
+            self.copyLabel.textColor = NSColor(hex: "#B1B3B8")
+            self.errorView.isHidden = true
+        } else if self.state == .CanCopy {
+            self.fromContentLabel.textColor = NSColor(hex: "#94989C")
+            self.translateBox.fillColor = NSColor(hex: "#1770F4")
+            self.translateBox.borderWidth = 0.0
+            self.translateLabel.textColor = NSColor(hex: "#FFFFFF")
+            self.copyBox.fillColor = NSColor(hex: "#FFFFFF")
+            self.copyBox.borderWidth = 1.0
+            self.copyBox.borderColor = NSColor(hex: "#DFE1E5")
+            self.copyLabel.textColor = NSColor(hex: "#252629")
+            self.errorView.isHidden = true
+        } else if self.state == .Copyed {
+            self.fromContentLabel.textColor = NSColor(hex: "#94989C")
+            self.translateBox.fillColor = NSColor(hex: "#1770F4")
+            self.translateBox.borderWidth = 0.0
+            self.translateLabel.textColor = NSColor(hex: "#FFFFFF")
+            self.copyBox.fillColor = NSColor(hex: "#36383B")
+            self.copyBox.borderWidth = 0.0
+            self.copyLabel.textColor = NSColor(hex: "#FFFFFF")
+            self.copyLabel.stringValue = NSLocalizedString("Copied", comment: "")
+            self.errorView.isHidden = true
+        } else if self.state == .Exceed { // 是否超过
+            self.fromContentLabel.textColor = NSColor(hex: "#F3465B")
+            self.translateBox.fillColor = NSColor(hex: "#1770F4")
+            self.translateBox.borderWidth = 0.0
+            self.translateLabel.textColor = NSColor(hex: "#FFFFFF")
+            self.copyBox.fillColor = NSColor(hex: "#EDEEF0")
+            self.copyBox.borderWidth = 1.0
+            self.copyBox.borderColor = NSColor(hex: "#DFE1E5")
+            self.copyLabel.textColor = NSColor(hex: "#B1B3B8")
+            self.errorView.isHidden = true
+        } else if self.state == .Error {
+            if self.fromContentTextField.stringValue.count > 150 {
+                self.fromContentLabel.textColor = NSColor(hex: "#F3465B")
+            } else {
+                self.fromContentLabel.textColor = NSColor(hex: "#94989C")
+            }
+            self.translateBox.fillColor = NSColor(hex: "#1770F4")
+            self.translateBox.borderWidth = 0.0
+            self.translateLabel.textColor = NSColor(hex: "#FFFFFF")
+            self.copyBox.fillColor = NSColor(hex: "#EDEEF0")
+            self.copyBox.borderWidth = 1.0
+            self.copyBox.borderColor = NSColor(hex: "#DFE1E5")
+            self.copyLabel.textColor = NSColor(hex: "#B1B3B8")
+            self.errorView.isHidden = false
+        } else {
+            self.fromContentLabel.textColor = NSColor(hex: "#94989C")
+            self.translateBox.fillColor = NSColor(hex: "#BDDFFD")
+            self.translateBox.borderWidth = 0.0
+            self.translateLabel.textColor = NSColor(hex: "#F7F8FA")
+            self.copyBox.fillColor = NSColor(hex: "#EDEEF0")
+            self.copyBox.borderWidth = 1.0
+            self.copyBox.borderColor = NSColor(hex: "#DFE1E5")
+            self.copyLabel.textColor = NSColor(hex: "#B1B3B8")
+            self.errorView.isHidden = true
+        }
+    }
+    
+    // MARK: Action
+    
+    @IBAction func fromLanguageAction(_ sender: NSButton) {
+        self.languageAction(true)
+    }
+    
+    @IBAction func toLanguageAction(_ sender: NSButton) {
+        self.languageAction(false)
+    }
+    
+    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.fromLabel.stringValue = language
+                self.fromStr = self.languageAbbreviation(language)
+            } else {
+                self.toLabel.stringValue = language
+                self.toStr = self.languageAbbreviation(language)
+            }
+            
+            self.toContentTextView.string = ""
+            if self.fromContentTextField.stringValue.count > 0 {
+                if self.fromContentTextField.stringValue.count > 150 {
+                    self.state = .Exceed
+                } else {
+                    self.state = .CanTranslate
+                }
+            } else {
+                self.state = .None
+            }
+        }
+
+        if isFromLanguage {
+            createFilePopover.show(relativeTo: CGRect(x: fromBox.bounds.origin.x, y: 10, width: fromBox.bounds.size.width, height: fromBox.bounds.size.height), of: fromBox, preferredEdge: .maxY)
+
+            vc.customBoxWidthLayoutConstraint.constant = fromBox.frame.width
+        } else {
+            createFilePopover.show(relativeTo: CGRect(x: toBox.bounds.origin.x, y: 10, width: toBox.bounds.size.width, height: toBox.bounds.size.height), of: toBox, preferredEdge: .maxY)
+
+            vc.customBoxWidthLayoutConstraint.constant = toBox.frame.width
+        }
+    }
+    
+    @IBAction func aiTranslationAction(_ sender: NSButton) {
+        if self.state == .CanTranslate || self.state == .CanCopy || self.state == .Copyed || self.state == .Exceed || self.state == .Error {
+            self.errorView.isHidden = true
+            self.toContentTextView.string = ""
+
+            let infoDictionary = Bundle .main.infoDictionary!
+            let majorVersion = infoDictionary["CFBundleShortVersionString"]
+            KMRequestServerManager.manager.aiTranslationTextTrans(q: self.fromContentTextField.stringValue, from: self.fromStr, to: self.toStr, version: "1.0.1") { [unowned self] success, result in
+                if success {
+                    let result: NSDictionary = result!.result
+
+                    let form: String = result["form"] as! String
+                    let to: String = result["to"] as! String
+                    let src: String = result["src"] as! String
+                    let dst: String = result["dst"] as! String
+                    
+                    DispatchQueue.main.async {
+                        self.state = .CanCopy
+                        
+                        self.toContentTextView.string = dst
+                    }
+                } else {
+                    let result: String = result!.message
+                    
+                    DispatchQueue.main.async {
+                        self.errorLabel.stringValue = result
+                        self.state = .Error
+                    }
+                }
+            }
+        }
+    }
+    
+    @IBAction func copyAction(_ sender: NSButton) {
+        if self.state == .CanCopy || self.state == .Copyed {
+            let pasteboard = NSPasteboard.general
+            pasteboard.clearContents()
+            pasteboard.setString(self.toContentTextView.string, forType: .string)
+            
+            self.state = .Copyed
+        }
+    }
+    
+    @IBAction func closeButtonAction(_ sender: NSButton) {
+        self.window?.close()
+    }
+    
+    @IBAction func tipsButtonAction(_ sender: NSButton) {
+        if (self.popoverTips != nil) {
+            self.popoverTips?.close()
+            self.popoverTips = nil
+            return
+        }
+        let pop: NSPopover = NSPopover.init()
+        self.popover = pop
+        let controller = KMSignatureHelpViewController.init()
+        pop.contentViewController = controller
+        controller.tipString = NSLocalizedString("Limit document size to 10M, document page number to 30, 10w characters per month", comment: "")
+        pop.setValue(true, forKey: "shouldHideAnchor")
+        pop.show(relativeTo: NSRect(x: 0, y: -8, width: NSWidth(sender.bounds), height: NSHeight(sender.bounds)), of: sender, preferredEdge: .maxX)
+    }
+}
+
+extension KMAITranslationWindowController: NSTextFieldDelegate {
+    func controlTextDidEndEditing(_ obj: Notification) {
+        let object = obj.object as! NSTextField
+        
+        
+    }
+    
+    func controlTextDidChange(_ obj: Notification) {
+        let object = obj.object as! NSTextField
+        
+        if object.stringValue.count > 0 {
+            self.state = .CanTranslate
+        } else {
+            self.state = .None
+        }
+        
+        if object.stringValue.count > 150 {
+            self.state = .Exceed
+        }
+    }
+
+}

+ 513 - 0
PDF Office/PDF Master/Class/Home/WindowController/KMAITranslationWindowController.xib

@@ -0,0 +1,513 @@
+<?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="KMAITranslationWindowController" customModule="PDF_Master" customModuleProvider="target">
+            <connections>
+                <outlet property="aiTranslationTitleLabel" destination="f5X-7w-lzl" id="b5S-9B-hXw"/>
+                <outlet property="closeButton" destination="ZOC-Aw-6KM" id="bnZ-KG-3IP"/>
+                <outlet property="copyBox" destination="gy2-f4-Uk2" id="EM7-cd-plo"/>
+                <outlet property="copyButton" destination="3Jh-8E-b7B" id="5V3-NJ-VqU"/>
+                <outlet property="copyLabel" destination="p7M-Ry-WqB" id="pZv-Vh-Y3r"/>
+                <outlet property="errorImageView" destination="Duk-Mu-G6Z" id="t0U-nD-Fbh"/>
+                <outlet property="errorLabel" destination="sSR-RP-4JK" id="g9k-At-ayX"/>
+                <outlet property="errorView" destination="NLV-Yd-ID5" id="M2D-8B-bTI"/>
+                <outlet property="fromBox" destination="YHr-OU-8sN" id="hnM-oU-Hbp"/>
+                <outlet property="fromContentBox" destination="k1S-Pr-djo" id="wCq-Z9-eOC"/>
+                <outlet property="fromContentLabel" destination="roT-Vm-vRn" id="zX2-dO-NAC"/>
+                <outlet property="fromContentTextField" destination="hdM-Q0-JDl" id="3mQ-1m-eb5"/>
+                <outlet property="fromLabel" destination="WqQ-Zq-YmZ" id="Pd3-cV-nPn"/>
+                <outlet property="languageImageView" destination="FC4-eZ-Fx9" id="1Kl-eh-ajJ"/>
+                <outlet property="tipsButton" destination="YZR-Hn-fi0" id="R9o-uB-egE"/>
+                <outlet property="toBox" destination="FFf-PI-Tat" id="Zta-XE-ey0"/>
+                <outlet property="toContentBox" destination="QtU-yz-0XZ" id="NfZ-5v-X4F"/>
+                <outlet property="toContentTextView" destination="Wzn-q1-SdS" id="TaE-fQ-CZ1"/>
+                <outlet property="toLabel" destination="CSz-xA-SxI" id="Hfq-z4-hWv"/>
+                <outlet property="translateBox" destination="HtC-2I-Rf2" id="Tbh-qB-I5b"/>
+                <outlet property="translateButton" destination="aEf-LG-jlp" id="FMd-z0-Uqk"/>
+                <outlet property="translateLabel" destination="GAn-bi-jA2" id="twM-DV-fzJ"/>
+                <outlet property="translationLanguage" destination="0Om-aJ-sAu" id="sof-tV-hyq"/>
+                <outlet property="window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" titlebarAppearsTransparent="YES" titleVisibility="hidden" id="F0z-JX-Cv5">
+            <windowStyleMask key="styleMask" titled="YES" fullSizeContentView="YES"/>
+            <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+            <rect key="contentRect" x="196" y="240" width="663" height="410"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
+            <view key="contentView" id="se5-gp-TjO">
+                <rect key="frame" x="0.0" y="0.0" width="588" height="343"/>
+                <autoresizingMask key="autoresizingMask"/>
+                <subviews>
+                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0Om-aJ-sAu">
+                        <rect key="frame" x="14" y="256" width="154" height="16"/>
+                        <constraints>
+                            <constraint firstAttribute="width" constant="150" id="enB-Az-ZLZ"/>
+                        </constraints>
+                        <textFieldCell key="cell" lineBreakMode="clipping" title="Translation Language:" id="agi-fu-FV2">
+                            <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>
+                    <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="FC4-eZ-Fx9">
+                        <rect key="frame" x="361" y="252" width="24" height="24"/>
+                        <constraints>
+                            <constraint firstAttribute="height" constant="24" id="rW6-Nb-MeE"/>
+                            <constraint firstAttribute="width" constant="24" id="s1k-Ao-izb"/>
+                        </constraints>
+                        <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="64b-aB-Yas"/>
+                    </imageView>
+                    <box boxType="custom" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="YHr-OU-8sN">
+                        <rect key="frame" x="174" y="244" width="179" height="40"/>
+                        <view key="contentView" id="S1n-NS-Elp">
+                            <rect key="frame" x="1" y="1" width="177" height="38"/>
+                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                            <subviews>
+                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="WqQ-Zq-YmZ">
+                                    <rect key="frame" x="14" y="11" width="133" height="16"/>
+                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="UG2-nF-ECS">
+                                        <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="jVf-YW-OqJ">
+                                    <rect key="frame" x="145" y="11" width="16" height="16"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="16" id="9ih-Vk-kR3"/>
+                                        <constraint firstAttribute="height" constant="16" id="eVe-5f-NDf"/>
+                                    </constraints>
+                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="icon_btn_arrow_gray_down_s_norm_false" id="XcC-4F-QRW"/>
+                                </imageView>
+                                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3NP-Md-bMq">
+                                    <rect key="frame" x="0.0" y="0.0" width="177" height="38"/>
+                                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="9cL-aR-TYc">
+                                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                        <font key="font" metaFont="system"/>
+                                    </buttonCell>
+                                    <connections>
+                                        <action selector="fromLanguageAction:" target="-2" id="7gU-aI-5Tc"/>
+                                    </connections>
+                                </button>
+                            </subviews>
+                            <constraints>
+                                <constraint firstItem="3NP-Md-bMq" firstAttribute="leading" secondItem="S1n-NS-Elp" secondAttribute="leading" id="2u5-IX-vdb"/>
+                                <constraint firstAttribute="trailing" secondItem="jVf-YW-OqJ" secondAttribute="trailing" constant="16" id="GsH-v3-ikP"/>
+                                <constraint firstItem="WqQ-Zq-YmZ" firstAttribute="leading" secondItem="S1n-NS-Elp" secondAttribute="leading" constant="16" id="Rcc-ai-8j3"/>
+                                <constraint firstItem="3NP-Md-bMq" firstAttribute="top" secondItem="S1n-NS-Elp" secondAttribute="top" id="U9S-9t-pKx"/>
+                                <constraint firstAttribute="bottom" secondItem="3NP-Md-bMq" secondAttribute="bottom" id="aza-w1-cuG"/>
+                                <constraint firstItem="jVf-YW-OqJ" firstAttribute="leading" secondItem="WqQ-Zq-YmZ" secondAttribute="trailing" id="our-2l-VLb"/>
+                                <constraint firstAttribute="trailing" secondItem="3NP-Md-bMq" secondAttribute="trailing" id="zP6-NL-If8"/>
+                            </constraints>
+                        </view>
+                        <constraints>
+                            <constraint firstItem="WqQ-Zq-YmZ" firstAttribute="centerY" secondItem="YHr-OU-8sN" secondAttribute="centerY" id="KJr-2i-lDf"/>
+                            <constraint firstAttribute="height" constant="40" id="QTI-Tg-Poj"/>
+                            <constraint firstItem="jVf-YW-OqJ" firstAttribute="centerY" secondItem="YHr-OU-8sN" secondAttribute="centerY" id="bZn-bY-wYx"/>
+                        </constraints>
+                    </box>
+                    <box boxType="custom" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="FFf-PI-Tat">
+                        <rect key="frame" x="393" y="244" width="179" height="40"/>
+                        <view key="contentView" id="tGO-cU-weV">
+                            <rect key="frame" x="1" y="1" width="177" height="38"/>
+                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                            <subviews>
+                                <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="ZGc-vl-v6D">
+                                    <rect key="frame" x="145" y="11" width="16" height="16"/>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="16" id="HLD-s8-lBg"/>
+                                        <constraint firstAttribute="height" constant="16" id="Ibq-oK-qwB"/>
+                                    </constraints>
+                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="icon_btn_arrow_gray_down_s_norm_false" id="VHi-NG-0v5"/>
+                                </imageView>
+                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="CSz-xA-SxI">
+                                    <rect key="frame" x="14" y="11" width="133" height="16"/>
+                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="l7v-Rp-PN4">
+                                        <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="PF4-ds-cZg">
+                                    <rect key="frame" x="0.0" y="0.0" width="177" height="38"/>
+                                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="r1Y-ak-g22">
+                                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                        <font key="font" metaFont="system"/>
+                                    </buttonCell>
+                                    <connections>
+                                        <action selector="toLanguageAction:" target="-2" id="q2E-dW-ms9"/>
+                                    </connections>
+                                </button>
+                            </subviews>
+                            <constraints>
+                                <constraint firstItem="PF4-ds-cZg" firstAttribute="top" secondItem="tGO-cU-weV" secondAttribute="top" id="AC6-Pv-nIj"/>
+                                <constraint firstAttribute="trailing" secondItem="ZGc-vl-v6D" secondAttribute="trailing" constant="16" id="IyD-1o-hde"/>
+                                <constraint firstAttribute="bottom" secondItem="PF4-ds-cZg" secondAttribute="bottom" id="KLm-ZQ-4ig"/>
+                                <constraint firstAttribute="trailing" secondItem="PF4-ds-cZg" secondAttribute="trailing" id="MiM-L4-zHE"/>
+                                <constraint firstItem="ZGc-vl-v6D" firstAttribute="leading" secondItem="CSz-xA-SxI" secondAttribute="trailing" id="WkF-0H-zHs"/>
+                                <constraint firstItem="CSz-xA-SxI" firstAttribute="leading" secondItem="tGO-cU-weV" secondAttribute="leading" constant="16" id="dK4-p8-Rbx"/>
+                                <constraint firstItem="PF4-ds-cZg" firstAttribute="leading" secondItem="tGO-cU-weV" secondAttribute="leading" id="fAo-yx-aWX"/>
+                            </constraints>
+                        </view>
+                        <constraints>
+                            <constraint firstItem="ZGc-vl-v6D" firstAttribute="centerY" secondItem="FFf-PI-Tat" secondAttribute="centerY" id="Lyf-aj-7jO"/>
+                            <constraint firstItem="CSz-xA-SxI" firstAttribute="centerY" secondItem="FFf-PI-Tat" secondAttribute="centerY" id="XjE-3U-F6X"/>
+                            <constraint firstAttribute="height" constant="40" id="YBg-zk-c7F"/>
+                        </constraints>
+                    </box>
+                    <box boxType="custom" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="k1S-Pr-djo">
+                        <rect key="frame" x="16" y="48" width="270" height="180"/>
+                        <view key="contentView" id="cJx-Kq-LaQ">
+                            <rect key="frame" x="1" y="1" width="268" height="178"/>
+                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                            <subviews>
+                                <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="hdM-Q0-JDl">
+                                    <rect key="frame" x="18" y="16" width="232" height="146"/>
+                                    <textFieldCell key="cell" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" id="hLa-1M-WD4">
+                                        <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="rAU-a1-LDX"/>
+                                    </connections>
+                                </textField>
+                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="roT-Vm-vRn">
+                                    <rect key="frame" x="221" y="8" width="37" height="16"/>
+                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="BCa-6w-gQj">
+                                        <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="hdM-Q0-JDl" firstAttribute="leading" secondItem="cJx-Kq-LaQ" secondAttribute="leading" constant="20" id="2YM-Tp-1qm"/>
+                                <constraint firstAttribute="trailing" secondItem="roT-Vm-vRn" secondAttribute="trailing" constant="12" id="4ub-bl-JT0"/>
+                                <constraint firstAttribute="bottom" secondItem="hdM-Q0-JDl" secondAttribute="bottom" constant="16" id="N6I-9D-PsZ"/>
+                                <constraint firstAttribute="bottom" secondItem="roT-Vm-vRn" secondAttribute="bottom" constant="8" id="RBh-Ba-c0G"/>
+                                <constraint firstAttribute="trailing" secondItem="hdM-Q0-JDl" secondAttribute="trailing" constant="20" id="VYj-Xn-q2O"/>
+                                <constraint firstItem="hdM-Q0-JDl" firstAttribute="top" secondItem="cJx-Kq-LaQ" secondAttribute="top" constant="16" id="o0x-CJ-j5t"/>
+                            </constraints>
+                        </view>
+                        <constraints>
+                            <constraint firstAttribute="height" constant="180" id="Oan-7I-DZp"/>
+                            <constraint firstAttribute="width" constant="270" id="u2b-Km-fGG"/>
+                        </constraints>
+                    </box>
+                    <box boxType="custom" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="QtU-yz-0XZ">
+                        <rect key="frame" x="302" y="48" width="270" height="180"/>
+                        <view key="contentView" id="Lad-sC-eue">
+                            <rect key="frame" x="1" y="1" width="268" height="178"/>
+                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                            <subviews>
+                                <imageView hidden="YES" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="bm5-xi-Jl8">
+                                    <rect key="frame" x="78" y="33" width="112" height="112"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="112" id="0hC-DX-DMf"/>
+                                        <constraint firstAttribute="width" constant="112" id="HN5-o7-qZD"/>
+                                    </constraints>
+                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="YJi-O9-5OL"/>
+                                </imageView>
+                                <scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xhJ-fV-5qt">
+                                    <rect key="frame" x="20" y="16" width="228" height="146"/>
+                                    <clipView key="contentView" drawsBackground="NO" id="GOT-gb-1Hz">
+                                        <rect key="frame" x="0.0" y="0.0" width="228" height="146"/>
+                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                        <subviews>
+                                            <textView wantsLayer="YES" editable="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" spellingCorrection="YES" smartInsertDelete="YES" id="Wzn-q1-SdS">
+                                                <rect key="frame" x="0.0" y="0.0" width="228" height="146"/>
+                                                <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="228" height="146"/>
+                                                <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="Udv-jV-Mxj">
+                                        <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="jEy-v6-ILt">
+                                        <rect key="frame" x="-100" y="-100" width="15" height="280"/>
+                                        <autoresizingMask key="autoresizingMask"/>
+                                    </scroller>
+                                </scrollView>
+                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="NLV-Yd-ID5">
+                                    <rect key="frame" x="20" y="146" width="53" height="16"/>
+                                    <subviews>
+                                        <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Duk-Mu-G6Z">
+                                            <rect key="frame" x="0.0" y="0.0" width="16" height="16"/>
+                                            <constraints>
+                                                <constraint firstAttribute="width" constant="16" id="aj9-br-DIw"/>
+                                                <constraint firstAttribute="height" constant="16" id="mnp-4R-EQx"/>
+                                            </constraints>
+                                            <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="sao-NL-irT"/>
+                                        </imageView>
+                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="sSR-RP-4JK">
+                                            <rect key="frame" x="18" y="0.0" width="37" height="16"/>
+                                            <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="5Hn-wR-mC6">
+                                                <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="sSR-RP-4JK" firstAttribute="centerY" secondItem="Duk-Mu-G6Z" secondAttribute="centerY" id="d7h-0n-FAn"/>
+                                        <constraint firstItem="Duk-Mu-G6Z" firstAttribute="centerY" secondItem="NLV-Yd-ID5" secondAttribute="centerY" id="kBT-sC-oGT"/>
+                                        <constraint firstAttribute="trailing" secondItem="sSR-RP-4JK" secondAttribute="trailing" id="mDJ-3D-oD8"/>
+                                        <constraint firstItem="Duk-Mu-G6Z" firstAttribute="leading" secondItem="NLV-Yd-ID5" secondAttribute="leading" id="rro-FW-C7h"/>
+                                        <constraint firstItem="sSR-RP-4JK" firstAttribute="leading" secondItem="Duk-Mu-G6Z" secondAttribute="trailing" constant="4" id="sG4-97-CX2"/>
+                                        <constraint firstAttribute="height" constant="16" id="y6u-g7-lyV"/>
+                                    </constraints>
+                                </customView>
+                            </subviews>
+                            <constraints>
+                                <constraint firstItem="xhJ-fV-5qt" firstAttribute="top" secondItem="Lad-sC-eue" secondAttribute="top" constant="16" id="4kp-KS-iLk"/>
+                                <constraint firstItem="NLV-Yd-ID5" firstAttribute="top" secondItem="Lad-sC-eue" secondAttribute="top" constant="16" id="MPY-sO-RjL"/>
+                                <constraint firstItem="xhJ-fV-5qt" firstAttribute="leading" secondItem="Lad-sC-eue" secondAttribute="leading" constant="20" id="Xz8-Jw-09U"/>
+                                <constraint firstAttribute="bottom" secondItem="xhJ-fV-5qt" secondAttribute="bottom" constant="16" id="bFT-dl-9iw"/>
+                                <constraint firstAttribute="trailing" secondItem="xhJ-fV-5qt" secondAttribute="trailing" constant="20" id="enW-L7-72w"/>
+                                <constraint firstItem="NLV-Yd-ID5" firstAttribute="leading" secondItem="Lad-sC-eue" secondAttribute="leading" constant="20" id="pKi-zh-Q9e"/>
+                            </constraints>
+                        </view>
+                        <constraints>
+                            <constraint firstItem="bm5-xi-Jl8" firstAttribute="centerX" secondItem="QtU-yz-0XZ" secondAttribute="centerX" id="kaH-0g-BIJ"/>
+                            <constraint firstItem="bm5-xi-Jl8" firstAttribute="centerY" secondItem="QtU-yz-0XZ" secondAttribute="centerY" id="nE0-5y-Skj"/>
+                            <constraint firstAttribute="width" constant="270" id="oMJ-0n-lbp"/>
+                            <constraint firstAttribute="height" constant="180" id="zWC-Up-mV7"/>
+                        </constraints>
+                    </box>
+                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="HtC-2I-Rf2" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
+                        <rect key="frame" x="189" y="16" width="97" height="24"/>
+                        <view key="contentView" id="zH5-bR-WZQ">
+                            <rect key="frame" x="0.0" y="0.0" width="97" height="24"/>
+                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                            <subviews>
+                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="GAn-bi-jA2">
+                                    <rect key="frame" x="30" y="4" width="37" height="16"/>
+                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="bX0-0T-yRv">
+                                        <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="aEf-LG-jlp">
+                                    <rect key="frame" x="0.0" y="0.0" width="97" height="24"/>
+                                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="0P4-KN-YJB">
+                                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                        <font key="font" metaFont="system"/>
+                                    </buttonCell>
+                                    <connections>
+                                        <action selector="aiTranslationAction:" target="-2" id="AJ7-V6-73h"/>
+                                    </connections>
+                                </button>
+                            </subviews>
+                            <constraints>
+                                <constraint firstAttribute="trailing" secondItem="aEf-LG-jlp" secondAttribute="trailing" id="070-xa-MxK"/>
+                                <constraint firstItem="GAn-bi-jA2" firstAttribute="centerX" secondItem="zH5-bR-WZQ" secondAttribute="centerX" id="7Pz-6h-km7"/>
+                                <constraint firstAttribute="bottom" secondItem="aEf-LG-jlp" secondAttribute="bottom" id="gXe-Dn-FFa"/>
+                                <constraint firstItem="aEf-LG-jlp" firstAttribute="leading" secondItem="zH5-bR-WZQ" secondAttribute="leading" id="mj6-3B-XAZ"/>
+                                <constraint firstItem="aEf-LG-jlp" firstAttribute="top" secondItem="zH5-bR-WZQ" secondAttribute="top" id="trg-i4-hta"/>
+                                <constraint firstItem="GAn-bi-jA2" firstAttribute="centerY" secondItem="zH5-bR-WZQ" secondAttribute="centerY" id="uJI-fJ-6Cn"/>
+                            </constraints>
+                        </view>
+                        <constraints>
+                            <constraint firstAttribute="height" constant="24" id="i9H-Qd-pxN"/>
+                            <constraint firstAttribute="width" constant="97" id="v8W-x3-XWV"/>
+                        </constraints>
+                    </box>
+                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="gy2-f4-Uk2" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
+                        <rect key="frame" x="475" y="16" width="97" height="24"/>
+                        <view key="contentView" id="MfR-Z6-iDx">
+                            <rect key="frame" x="0.0" y="0.0" width="97" height="24"/>
+                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                            <subviews>
+                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="p7M-Ry-WqB">
+                                    <rect key="frame" x="30" y="4" width="37" height="16"/>
+                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="Jr1-ms-0zG">
+                                        <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="3Jh-8E-b7B">
+                                    <rect key="frame" x="0.0" y="0.0" width="97" height="24"/>
+                                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="Xld-Kn-iS3">
+                                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                        <font key="font" metaFont="system"/>
+                                    </buttonCell>
+                                    <connections>
+                                        <action selector="copyAction:" target="-2" id="LVr-2V-1fj"/>
+                                    </connections>
+                                </button>
+                            </subviews>
+                            <constraints>
+                                <constraint firstAttribute="bottom" secondItem="3Jh-8E-b7B" secondAttribute="bottom" id="1xY-cD-cQf"/>
+                                <constraint firstItem="3Jh-8E-b7B" firstAttribute="leading" secondItem="MfR-Z6-iDx" secondAttribute="leading" id="6pp-Xm-i1n"/>
+                                <constraint firstItem="p7M-Ry-WqB" firstAttribute="centerY" secondItem="MfR-Z6-iDx" secondAttribute="centerY" id="GvU-MM-o1c"/>
+                                <constraint firstAttribute="trailing" secondItem="3Jh-8E-b7B" secondAttribute="trailing" id="RDt-nz-2jR"/>
+                                <constraint firstItem="p7M-Ry-WqB" firstAttribute="centerX" secondItem="MfR-Z6-iDx" secondAttribute="centerX" id="a5v-dB-S1O"/>
+                                <constraint firstItem="3Jh-8E-b7B" firstAttribute="top" secondItem="MfR-Z6-iDx" secondAttribute="top" id="taC-ob-G0s"/>
+                            </constraints>
+                        </view>
+                        <constraints>
+                            <constraint firstAttribute="width" constant="97" id="Fh9-0v-n4l"/>
+                            <constraint firstAttribute="height" constant="24" id="Gz1-CL-tI2"/>
+                        </constraints>
+                    </box>
+                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="Hm9-XZ-Kly">
+                        <rect key="frame" x="0.0" y="293" width="588" height="50"/>
+                        <view key="contentView" id="uXS-Ab-u3x">
+                            <rect key="frame" x="0.0" y="0.0" width="588" height="50"/>
+                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                            <subviews>
+                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="f5X-7w-lzl">
+                                    <rect key="frame" x="98" y="17" width="37" height="16"/>
+                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="fbW-8e-acd">
+                                        <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" imageHugsTitle="YES" translatesAutoresizingMaskIntoConstraints="NO" id="YZR-Hn-fi0">
+                                    <rect key="frame" x="137" y="17" width="16" height="16"/>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="16" id="ZnO-ex-r7r"/>
+                                        <constraint firstAttribute="width" constant="16" id="zSz-ja-uLb"/>
+                                    </constraints>
+                                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" image="image_btn_tips" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="ZYQ-5T-eyl">
+                                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                        <font key="font" metaFont="system"/>
+                                    </buttonCell>
+                                    <connections>
+                                        <action selector="tipsButtonAction:" target="-2" id="uEQ-Q1-e4g"/>
+                                    </connections>
+                                </button>
+                                <customView translatesAutoresizingMaskIntoConstraints="NO" id="e3k-bQ-OHM">
+                                    <rect key="frame" x="0.0" y="5" width="84" height="40"/>
+                                    <subviews>
+                                        <box boxType="custom" borderWidth="0.0" cornerRadius="4" translatesAutoresizingMaskIntoConstraints="NO" id="FvR-kA-GMa" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
+                                            <rect key="frame" x="16" y="14" width="12" height="12"/>
+                                            <view key="contentView" id="nox-ru-0NK">
+                                                <rect key="frame" x="0.0" y="0.0" width="12" height="12"/>
+                                                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                            </view>
+                                            <constraints>
+                                                <constraint firstAttribute="height" constant="12" id="XRT-ei-0lR"/>
+                                                <constraint firstAttribute="width" constant="12" id="kD0-K4-VqO"/>
+                                            </constraints>
+                                        </box>
+                                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ZOC-Aw-6KM">
+                                            <rect key="frame" x="16" y="14" width="12" height="12"/>
+                                            <constraints>
+                                                <constraint firstAttribute="height" constant="12" id="a4H-40-9Uj"/>
+                                                <constraint firstAttribute="width" constant="12" id="vkQ-6b-9SB"/>
+                                            </constraints>
+                                            <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="icon_btn_window_close" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="xpR-Cp-ha8">
+                                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                <font key="font" metaFont="system"/>
+                                            </buttonCell>
+                                            <connections>
+                                                <action selector="closeButtonAction:" target="-2" id="6Ai-Bp-mkK"/>
+                                            </connections>
+                                        </button>
+                                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="cad-Hf-ffb">
+                                            <rect key="frame" x="36" y="14" width="12" height="12"/>
+                                            <constraints>
+                                                <constraint firstAttribute="height" constant="12" id="TBm-QM-cwh"/>
+                                                <constraint firstAttribute="width" constant="12" id="Zx7-ky-pv7"/>
+                                            </constraints>
+                                            <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="icon_groping_default" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="4rY-Hh-ylK">
+                                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                <font key="font" metaFont="system"/>
+                                            </buttonCell>
+                                        </button>
+                                        <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="IxO-9g-nPH">
+                                            <rect key="frame" x="56" y="14" width="12" height="12"/>
+                                            <constraints>
+                                                <constraint firstAttribute="height" constant="12" id="6ma-3Z-P0K"/>
+                                                <constraint firstAttribute="width" constant="12" id="joB-Lk-3dV"/>
+                                            </constraints>
+                                            <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="icon_groping_default" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="Vab-Th-pen">
+                                                <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                <font key="font" metaFont="system"/>
+                                            </buttonCell>
+                                        </button>
+                                    </subviews>
+                                    <constraints>
+                                        <constraint firstItem="IxO-9g-nPH" firstAttribute="leading" secondItem="cad-Hf-ffb" secondAttribute="trailing" constant="8" id="3qA-x1-J25"/>
+                                        <constraint firstItem="cad-Hf-ffb" firstAttribute="centerY" secondItem="ZOC-Aw-6KM" secondAttribute="centerY" id="5fX-q7-QcV"/>
+                                        <constraint firstItem="ZOC-Aw-6KM" firstAttribute="centerY" secondItem="e3k-bQ-OHM" secondAttribute="centerY" id="9Jc-lj-0JM"/>
+                                        <constraint firstAttribute="height" constant="40" id="EBw-DD-SpR"/>
+                                        <constraint firstAttribute="width" constant="84" id="FnR-bo-qa7"/>
+                                        <constraint firstItem="FvR-kA-GMa" firstAttribute="leading" secondItem="e3k-bQ-OHM" secondAttribute="leading" constant="16" id="JWS-8M-0qT"/>
+                                        <constraint firstItem="ZOC-Aw-6KM" firstAttribute="leading" secondItem="e3k-bQ-OHM" secondAttribute="leading" constant="16" id="KtF-My-7OE"/>
+                                        <constraint firstItem="FvR-kA-GMa" firstAttribute="top" secondItem="e3k-bQ-OHM" secondAttribute="top" constant="14" id="Lxd-4b-vYW"/>
+                                        <constraint firstItem="IxO-9g-nPH" firstAttribute="centerY" secondItem="ZOC-Aw-6KM" secondAttribute="centerY" id="OX1-hk-D1x"/>
+                                        <constraint firstItem="cad-Hf-ffb" firstAttribute="leading" secondItem="ZOC-Aw-6KM" secondAttribute="trailing" constant="8" id="lo9-Y3-Z9q"/>
+                                    </constraints>
+                                </customView>
+                            </subviews>
+                            <constraints>
+                                <constraint firstItem="f5X-7w-lzl" firstAttribute="leading" secondItem="e3k-bQ-OHM" secondAttribute="trailing" constant="16" id="2FH-Kj-87d"/>
+                                <constraint firstItem="YZR-Hn-fi0" firstAttribute="leading" secondItem="f5X-7w-lzl" secondAttribute="trailing" constant="4" id="AK6-BH-Dkz"/>
+                                <constraint firstItem="YZR-Hn-fi0" firstAttribute="centerY" secondItem="f5X-7w-lzl" secondAttribute="centerY" id="edZ-zN-lnt"/>
+                                <constraint firstItem="e3k-bQ-OHM" firstAttribute="centerY" secondItem="uXS-Ab-u3x" secondAttribute="centerY" id="h5h-8p-Oay"/>
+                                <constraint firstItem="e3k-bQ-OHM" firstAttribute="leading" secondItem="uXS-Ab-u3x" secondAttribute="leading" id="yC7-U2-ZDk"/>
+                            </constraints>
+                        </view>
+                        <constraints>
+                            <constraint firstAttribute="height" constant="50" id="nBi-al-mDS"/>
+                            <constraint firstItem="f5X-7w-lzl" firstAttribute="centerY" secondItem="Hm9-XZ-Kly" secondAttribute="centerY" id="y1J-F6-gyT"/>
+                        </constraints>
+                    </box>
+                </subviews>
+                <constraints>
+                    <constraint firstItem="FFf-PI-Tat" firstAttribute="leading" secondItem="FC4-eZ-Fx9" secondAttribute="trailing" constant="8" id="0S5-C0-cEV"/>
+                    <constraint firstItem="YHr-OU-8sN" firstAttribute="centerY" secondItem="0Om-aJ-sAu" secondAttribute="centerY" id="0ZQ-n8-2U7"/>
+                    <constraint firstItem="QtU-yz-0XZ" firstAttribute="leading" secondItem="k1S-Pr-djo" secondAttribute="trailing" constant="16" id="3sV-K9-HGN"/>
+                    <constraint firstItem="0Om-aJ-sAu" firstAttribute="top" secondItem="Hm9-XZ-Kly" secondAttribute="bottom" constant="21" id="4Lf-gA-ttV"/>
+                    <constraint firstAttribute="trailing" secondItem="QtU-yz-0XZ" secondAttribute="trailing" constant="16" id="NI2-h4-d9m"/>
+                    <constraint firstItem="HtC-2I-Rf2" firstAttribute="top" secondItem="k1S-Pr-djo" secondAttribute="bottom" constant="8" id="Oqq-LX-vTa"/>
+                    <constraint firstItem="FFf-PI-Tat" firstAttribute="width" secondItem="YHr-OU-8sN" secondAttribute="width" id="Pog-SM-3eJ"/>
+                    <constraint firstItem="k1S-Pr-djo" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="16" id="QSe-qa-G2G"/>
+                    <constraint firstItem="0Om-aJ-sAu" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="16" id="S6r-0V-dGs"/>
+                    <constraint firstAttribute="trailing" secondItem="FFf-PI-Tat" secondAttribute="trailing" constant="16" id="TTW-hC-0Pi"/>
+                    <constraint firstItem="k1S-Pr-djo" firstAttribute="top" secondItem="YHr-OU-8sN" secondAttribute="bottom" constant="16" id="WWM-Cf-N8a"/>
+                    <constraint firstItem="Hm9-XZ-Kly" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" id="bsJ-6N-iRh"/>
+                    <constraint firstItem="YHr-OU-8sN" firstAttribute="leading" secondItem="0Om-aJ-sAu" secondAttribute="trailing" constant="8" id="flA-PX-FAN"/>
+                    <constraint firstItem="gy2-f4-Uk2" firstAttribute="trailing" secondItem="QtU-yz-0XZ" secondAttribute="trailing" id="ghB-gL-g0a"/>
+                    <constraint firstAttribute="bottom" secondItem="HtC-2I-Rf2" secondAttribute="bottom" constant="16" id="gtB-hG-P39"/>
+                    <constraint firstItem="FC4-eZ-Fx9" firstAttribute="leading" secondItem="YHr-OU-8sN" secondAttribute="trailing" constant="8" id="hL1-F1-DHQ"/>
+                    <constraint firstItem="Hm9-XZ-Kly" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" id="kFi-ZU-3VU"/>
+                    <constraint firstAttribute="trailing" secondItem="Hm9-XZ-Kly" secondAttribute="trailing" id="ku6-xj-NlT"/>
+                    <constraint firstItem="FC4-eZ-Fx9" firstAttribute="centerY" secondItem="0Om-aJ-sAu" secondAttribute="centerY" id="owM-GY-eFn"/>
+                    <constraint firstItem="HtC-2I-Rf2" firstAttribute="trailing" secondItem="k1S-Pr-djo" secondAttribute="trailing" id="qzN-HM-vH3"/>
+                    <constraint firstItem="QtU-yz-0XZ" firstAttribute="top" secondItem="YHr-OU-8sN" secondAttribute="bottom" constant="16" id="rdA-gX-GX4"/>
+                    <constraint firstItem="gy2-f4-Uk2" firstAttribute="centerY" secondItem="HtC-2I-Rf2" secondAttribute="centerY" id="rqq-Ai-uVJ"/>
+                    <constraint firstItem="FFf-PI-Tat" firstAttribute="centerY" secondItem="YHr-OU-8sN" secondAttribute="centerY" id="wev-JF-ysx"/>
+                </constraints>
+            </view>
+            <connections>
+                <outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
+            </connections>
+            <point key="canvasLocation" x="230" y="214"/>
+        </window>
+    </objects>
+    <resources>
+        <image name="icon_btn_arrow_gray_down_s_norm_false" width="12" height="12"/>
+        <image name="icon_btn_window_close" width="12" height="12"/>
+        <image name="icon_groping_default" width="12" height="12"/>
+        <image name="image_btn_tips" width="16" height="16"/>
+    </resources>
+</document>

+ 2 - 3
PDF Office/PDF Master/Class/Home/WindowController/KMDeviceBrowserWindowController.xib

@@ -1,13 +1,12 @@
 <?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"/>
         <plugIn identifier="com.apple.imagekit.ibplugin" version="21507"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
-        <customObject id="-2" userLabel="File's Owner" customClass="KMDeviceBrowserWindowController" customModule="PDF_Office" customModuleProvider="target">
+        <customObject id="-2" userLabel="File's Owner" customClass="KMDeviceBrowserWindowController" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="cameraDeviceView" destination="FWK-Dq-yNb" id="Cce-MF-TC2"/>
                 <outlet property="deviceBrowserView" destination="LZw-sT-Bz2" id="636-Nr-eeh"/>
@@ -25,7 +24,7 @@
             <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
             <view key="contentView" id="se5-gp-TjO">
                 <rect key="frame" x="0.0" y="0.0" width="719" height="481"/>
-                <autoresizingMask key="autoresizingMask"/>
+                <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                 <subviews>
                     <splitView arrangesAllSubviews="NO" dividerStyle="thin" vertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="f7P-Ge-yPC">
                         <rect key="frame" x="0.0" y="0.0" width="719" height="481"/>

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

@@ -581,6 +581,58 @@ class KMRequestServerManager: NSObject {
         semaphore.wait()
     }
 
+    /**
+     @abstract 内容翻译
+     @param q  选中
+     @param from 初始语言
+     @param to 结束语言
+     @param version 应用版本
+     */
+    func aiTranslationTextTrans(q: 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/textTrans"
+        
+        var semaphore = DispatchSemaphore (value: 0)
+
+        let parameters = String(format: "{\r\n    \"q\": \"%@\",\r\n    \"from\": \"%@\",\r\n    \"to\": \"%@\",\r\n    \"version\": \"%@\",\r\n    \"projectId\": \"2\",\r\n    \"userId\": \"%@\"\r\n}", q, 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重写 & 纠错

+ 4 - 3
PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/Signature/KMSignatureHelpViewController.xib

@@ -1,7 +1,6 @@
 <?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>
@@ -15,11 +14,11 @@
         <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="280" height="36"/>
+            <rect key="frame" x="0.0" y="0.0" width="280" height="32"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
                 <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="ske-oW-ZNH">
-                    <rect key="frame" x="14" y="10" width="252" height="16"/>
+                    <rect key="frame" x="14" y="8" width="252" height="16"/>
                     <textFieldCell key="cell" selectable="YES" alignment="center" title="Multiline Label" id="lBS-WA-vWs">
                         <font key="font" usesAppearanceFont="YES"/>
                         <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -30,6 +29,8 @@
             <constraints>
                 <constraint firstAttribute="trailing" secondItem="ske-oW-ZNH" secondAttribute="trailing" constant="16" id="EHV-ou-m7J"/>
                 <constraint firstItem="ske-oW-ZNH" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="16" id="Fgy-1o-khP"/>
+                <constraint firstItem="ske-oW-ZNH" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="8" id="W7G-yD-JAm"/>
+                <constraint firstAttribute="bottom" secondItem="ske-oW-ZNH" secondAttribute="bottom" constant="8" id="eJH-sM-fmZ"/>
                 <constraint firstItem="ske-oW-ZNH" firstAttribute="centerY" secondItem="Hz6-mo-xeY" secondAttribute="centerY" id="ihX-Ho-Hjq"/>
             </constraints>
             <point key="canvasLocation" x="0.0" y="154"/>

+ 20 - 0
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift

@@ -259,6 +259,7 @@ extension KMMainViewController {
         let line = NSMenuItem(title: NSLocalizedString("Line", comment: ""), action: #selector(menuItemAnnotationClick_add), target: self, tag: 7)!
         let link = NSMenuItem(title: NSLocalizedString("Add Link", comment: ""), action: #selector(menuItemAnnotationClick_add), target: self, tag: 8)!
         let outline = NSMenuItem(title: NSLocalizedString("Add Outline", comment: ""), action: #selector(menuItemAnnotationClick_add), target: self, tag: 9)!
+        let aiTranslation = NSMenuItem(title: NSLocalizedString("AI Translation", comment: ""), action: #selector(aiTranslationAction), target: self)!
 //        let tts = NSMenuItem(title: NSLocalizedString("TTS", comment: ""), action: #selector(menuItemAnnotationClick_add), target: self, tag: 10)!
         menu.insertItem(NSMenuItem.separator(), at: menu.items.count)
         if listView.currentSelection.selectionType() != .image {
@@ -311,6 +312,13 @@ extension KMMainViewController {
             }
         }
         menu.insertItem(NSMenuItem.separator(), at: menu.items.count)
+        
+        if self.isReadMode {
+            
+        } else {
+            menu.insertItem(aiTranslation, at: menu.items.count)
+        }
+        menu.insertItem(NSMenuItem.separator(), at: menu.items.count)
     }
     
     func addBookmarkMenu() -> NSMenuItem {
@@ -510,6 +518,18 @@ extension KMMainViewController {
         }
     }
     
+    @objc func aiTranslationAction(sender: NSMenuItem) {
+        let content = self.listView.currentSelection.string() as? String ?? ""
+        let origin = self.listView.currentSelection.bounds.origin
+        
+        self.aiTranslationWindow = KMAITranslationWindowController.init(windowNibName: "KMAITranslationWindowController")
+        self.aiTranslationWindow?.content = content
+        
+        self.view.window!.addChildWindow(self.aiTranslationWindow!.window!, ordered: NSWindow.OrderingMode.above)
+        self.aiTranslationWindow!.window?.center()
+
+    }
+    
     @objc func menuItemAnnotationClick_addStype(sender: NSMenuItem) {
         Task { @MainActor in
             if (sender.tag == 7 || sender.tag == 8 || sender.tag == 9) {

+ 1 - 0
PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift

@@ -124,6 +124,7 @@ import Cocoa
     
     var eventMonitor: Any?
     var mouseRightMenuEvent: NSEvent?
+    var aiTranslationWindow: KMAITranslationWindowController?
     
     deinit {
         NotificationCenter.default.removeObserver(self)

+ 1 - 0
PDF Office/PDF Master/PDF_Master DMG-Bridging-Header.h

@@ -79,3 +79,4 @@
 #import "KMTools_OC.h"
 //广告
 #import "KMRecommondManager.h"
+#import "KMSignatureHelpViewController.h"

+ 1 - 0
PDF Office/PDF Master/PDF_Master Pro-Bridging-Header.h

@@ -56,3 +56,4 @@
 #import "KMTools_OC.h"
 //广告
 #import "KMRecommondManager.h"
+#import "KMSignatureHelpViewController.h"

+ 1 - 0
PDF Office/PDF Master/PDF_Master-Bridging-Header.h

@@ -80,3 +80,4 @@
 #import "KMTools_OC.h"
 //广告
 #import "KMRecommondManager.h"
+#import "KMSignatureHelpViewController.h"