Browse Source

Merge branch 'develop_DMG' into develop

* develop_DMG: (42 commits)
  综合 - 针对Appstore送审清楚权限“com.apple.security.network.server”
  综合 - 针对Appstore审核上架暂时隐藏MainMenu菜单中Help-More Products功能
  综合 - 文案、切图中带有beta内容针对Appstore审核进行移除
  AI - 文本翻译时,APP判断页码是否超过30页
  文案 - V1.0.1版本文案调整
  AI - 选词翻译时tips在关闭窗口时未消失
  综合 - V1.0.1新手引导调整
  AI - 内容翻译获取字符串存在换行、制表符时转义处理
  综合 - V1.0.1新手引导配图调整
  文案 - V1.0.1 调整新手引导、比较表文案
  AI - 内容翻译,针对换行、段落文字进行调整
  AI - 内容翻译针对换行文字无法网络请求的修改
  AI - 翻译正式环境端口替换
  AI - 划词翻译超过150个字时,会在翻译弹窗中显示超出状态
  AI - 划词翻译弹窗补充loading状态
  AI - 划词翻译tips对象赋值调整
  AI - 修复翻译结果语言下拉框数据剔除“Automatic”
  文案 - V1.0.1 AI版本多语文案整理
  AI - PDFView划词翻译修改输入内容改变后,结果文本框内容清空
  AI - 首页重写、纠错结果文本设置为不可编辑
  ...

Conflicts:
	PDF Office/PDF Master/Class/Home/ViewController/KMHomePopViewController.xib
	PDF Office/PDF Master/Class/PDFTools/Convert/Controller/KMConvertBaseWindowController.xib
	PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift
	PDF Office/PDF Master/PDF_Master DMG-Bridging-Header.h
	PDF Office/PDF Master/PDF_Master Pro-Bridging-Header.h
	PDF Office/PDF Master/PDF_Master-Bridging-Header.h
	PDF Office/PDF Master/Strings/en.lproj/Localizable.strings
wanjun 1 year ago
parent
commit
f27a2c818b
84 changed files with 16885 additions and 69 deletions
  1. 112 0
      PDF Office/PDF Master.xcodeproj/project.pbxproj
  2. 1 1
      PDF Office/PDF Master/Base.lproj/Main.storyboard
  3. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/ic_ai_ErrorCorrection.imageset/Contents.json
  4. 152 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/ic_ai_ErrorCorrection.imageset/Error Correction.pdf
  5. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/ic_ai_ErrorCorrection_empty.imageset/Contents.json
  6. 153 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/ic_ai_ErrorCorrection_empty.imageset/Error Correction.pdf
  7. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/ic_ai_Rewriting.imageset/Contents.json
  8. 2230 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/ic_ai_Rewriting.imageset/Rewriting.pdf
  9. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/ic_ai_rewriting_empty.imageset/Contents.json
  10. 2230 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/ic_ai_rewriting_empty.imageset/Rewriting.pdf
  11. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/ic_function_other.imageset/Contents.json
  12. 2498 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/ic_function_other.imageset/other.pdf
  13. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/ic_function_other_AITranslation.imageset/Contents.json
  14. 2393 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/ic_function_other_AITranslation.imageset/other.pdf
  15. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/ic_transtate.imageset/Contents.json
  16. 103 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/ic_transtate.imageset/translate.pdf
  17. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_SelectYourFiles.imageset/Contents.json
  18. 93 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_SelectYourFiles.imageset/icon.pdf
  19. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_empty_ImportFromScanner.imageset/Contents.json
  20. 112 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_empty_ImportFromScanner.imageset/Import From Scanner.pdf
  21. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_empty_NewBlackPage.imageset/Contents.json
  22. 127 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_empty_NewBlackPage.imageset/New Blank Page.pdf
  23. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_empty_NewFromFiles.imageset/Contents.json
  24. 127 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_empty_NewFromFiles.imageset/New From Files.pdf
  25. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_empty_addFiles.imageset/Contents.json
  26. 230 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_empty_addFiles.imageset/add files.pdf
  27. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_error.imageset/Contents.json
  28. 89 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_error.imageset/icon.pdf
  29. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_groping_default.imageset/Contents.json
  30. 112 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_groping_default.imageset/Control.pdf
  31. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_home.imageset/Contents.json
  32. 215 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_home.imageset/home.pdf
  33. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/image_btn_tips.imageset/Contents.json
  34. 131 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/image_btn_tips.imageset/tips.pdf
  35. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Welcome/KMImageNameWelcome1.imageset/Contents.json
  36. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Welcome/KMImageNameWelcome1.imageset/Frame 1021 (2).pdf
  37. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Welcome/KMImageNameWelcome2.imageset/Contents.json
  38. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Welcome/KMImageNameWelcome2.imageset/Frame 1076 (1).pdf
  39. 12 0
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Welcome/KMImageNameWelcome3.imageset/Contents.json
  40. BIN
      PDF Office/PDF Master/Class/Appearance/Image.xcassets/Welcome/KMImageNameWelcome3.imageset/Frame 1020 (1).pdf
  41. 2 1
      PDF Office/PDF Master/Class/ChromiumTabs/KMBrowserWindowController.swift
  42. 46 0
      PDF Office/PDF Master/Class/Home/NSObject/KMAIServerConfig.swift
  43. 0 1
      PDF Office/PDF Master/Class/Home/NSObject/Services/GTLRClass/GTMSessionFetcher/GTMMIMEDocument.m
  44. 0 1
      PDF Office/PDF Master/Class/Home/NSObject/Services/GTLRClass/GTMSessionFetcher/GTMSessionFetcher.m
  45. 0 1
      PDF Office/PDF Master/Class/Home/NSObject/Services/GTLRClass/GTMSessionFetcher/GTMSessionUploadFetcher.m
  46. 74 0
      PDF Office/PDF Master/Class/Home/View/KMDottedLineView.swift
  47. 126 0
      PDF Office/PDF Master/Class/Home/ViewController/KMAILanguagePopVC.swift
  48. 118 0
      PDF Office/PDF Master/Class/Home/ViewController/KMAILanguagePopVC.xib
  49. 398 0
      PDF Office/PDF Master/Class/Home/ViewController/KMAIOpenPDFFilesVC.swift
  50. 330 0
      PDF Office/PDF Master/Class/Home/ViewController/KMAIOpenPDFFilesVC.xib
  51. 446 0
      PDF Office/PDF Master/Class/Home/ViewController/KMAIRewritingVC.swift
  52. 286 0
      PDF Office/PDF Master/Class/Home/ViewController/KMAIRewritingVC.xib
  53. 441 0
      PDF Office/PDF Master/Class/Home/ViewController/KMAITranslationVC.swift
  54. 321 0
      PDF Office/PDF Master/Class/Home/ViewController/KMAITranslationVC.xib
  55. 1 1
      PDF Office/PDF Master/Class/Home/ViewController/KMHomePopViewController.xib
  56. 147 0
      PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController+Action.swift
  57. 5 1
      PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController+UI.swift
  58. 269 4
      PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController.swift
  59. 186 5
      PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController.xib
  60. 419 0
      PDF Office/PDF Master/Class/Home/WindowController/KMAITranslationConfirmWindowController.swift
  61. 400 0
      PDF Office/PDF Master/Class/Home/WindowController/KMAITranslationConfirmWindowController.xib
  62. 495 0
      PDF Office/PDF Master/Class/Home/WindowController/KMAITranslationWindowController.swift
  63. 515 0
      PDF Office/PDF Master/Class/Home/WindowController/KMAITranslationWindowController.xib
  64. 2 3
      PDF Office/PDF Master/Class/Home/WindowController/KMDeviceBrowserWindowController.xib
  65. 13 0
      PDF Office/PDF Master/Class/KMLightMember/Controller/ComparativeTable/Source/KMComparative.plist
  66. 2 2
      PDF Office/PDF Master/Class/KMLightMember/Controller/Login&Register/View/KMLoginLeftImageView.xib
  67. 140 0
      PDF Office/PDF Master/Class/KMLightMember/KMRequestServer/KMRequestServer.swift
  68. 191 0
      PDF Office/PDF Master/Class/KMLightMember/Manager/KMRequestServerManager.swift
  69. 1 10
      PDF Office/PDF Master/Class/KMLightMember/Source/KMLightMember.xcassets/image_login.imageset/Contents.json
  70. BIN
      PDF Office/PDF Master/Class/KMLightMember/Source/KMLightMember.xcassets/image_login.imageset/Group 507.pdf
  71. 6 6
      PDF Office/PDF Master/Class/PDFTools/Convert/Controller/KMConvertBaseWindowController.xib
  72. 4 3
      PDF Office/PDF Master/Class/PDFWindowController/Side/RightSide/Signature/KMSignatureHelpViewController.xib
  73. 5 0
      PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarController.swift
  74. 19 1
      PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarViewController.swift
  75. 1 0
      PDF Office/PDF Master/Class/PDFWindowController/Toolbar/PublicKey.swift
  76. 48 0
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController+Action.swift
  77. 28 0
      PDF Office/PDF Master/Class/PDFWindowController/ViewController/KMMainViewController.swift
  78. 14 14
      PDF Office/PDF Master/Class/Welcome/OC/WelcomeWindowController.m
  79. 11 11
      PDF Office/PDF Master/Class/Welcome/OC/WelcomeWindowController.xib
  80. 1 0
      PDF Office/PDF Master/PDF_Master DMG-Bridging-Header.h
  81. 1 0
      PDF Office/PDF Master/PDF_Master Pro-Bridging-Header.h
  82. 1 0
      PDF Office/PDF Master/PDF_Master-Bridging-Header.h
  83. 0 2
      PDF Office/PDF Master/PDF_Master.entitlements
  84. 36 1
      PDF Office/PDF Master/Strings/en.lproj/Localizable.strings

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

@@ -393,6 +393,48 @@
 		89E9B409295D268E00AEFA61 /* KMEditImagePropertyViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 89E9B405295D268E00AEFA61 /* KMEditImagePropertyViewController.xib */; };
 		89E9B40A295D268E00AEFA61 /* KMEditImagePropertyViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 89E9B405295D268E00AEFA61 /* KMEditImagePropertyViewController.xib */; };
 		89E9B40B295D268E00AEFA61 /* KMEditImagePropertyViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 89E9B405295D268E00AEFA61 /* KMEditImagePropertyViewController.xib */; };
+		9F0201652A176AF200C9B673 /* KMDottedLineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201642A176AF200C9B673 /* KMDottedLineView.swift */; };
+		9F0201662A176AF200C9B673 /* KMDottedLineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201642A176AF200C9B673 /* KMDottedLineView.swift */; };
+		9F0201672A176AF200C9B673 /* KMDottedLineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201642A176AF200C9B673 /* KMDottedLineView.swift */; };
+		9F02016A2A1B088700C9B673 /* KMAIOpenPDFFilesVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201682A1B088700C9B673 /* KMAIOpenPDFFilesVC.swift */; };
+		9F02016B2A1B088700C9B673 /* KMAIOpenPDFFilesVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201682A1B088700C9B673 /* KMAIOpenPDFFilesVC.swift */; };
+		9F02016C2A1B088700C9B673 /* KMAIOpenPDFFilesVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201682A1B088700C9B673 /* KMAIOpenPDFFilesVC.swift */; };
+		9F02016D2A1B088700C9B673 /* KMAIOpenPDFFilesVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F0201692A1B088700C9B673 /* KMAIOpenPDFFilesVC.xib */; };
+		9F02016E2A1B088700C9B673 /* KMAIOpenPDFFilesVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F0201692A1B088700C9B673 /* KMAIOpenPDFFilesVC.xib */; };
+		9F02016F2A1B088700C9B673 /* KMAIOpenPDFFilesVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F0201692A1B088700C9B673 /* KMAIOpenPDFFilesVC.xib */; };
+		9F0201722A1B488C00C9B673 /* KMAITranslationVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201702A1B488C00C9B673 /* KMAITranslationVC.swift */; };
+		9F0201732A1B488C00C9B673 /* KMAITranslationVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201702A1B488C00C9B673 /* KMAITranslationVC.swift */; };
+		9F0201742A1B488C00C9B673 /* KMAITranslationVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201702A1B488C00C9B673 /* KMAITranslationVC.swift */; };
+		9F0201752A1B488C00C9B673 /* KMAITranslationVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F0201712A1B488C00C9B673 /* KMAITranslationVC.xib */; };
+		9F0201762A1B488C00C9B673 /* KMAITranslationVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F0201712A1B488C00C9B673 /* KMAITranslationVC.xib */; };
+		9F0201772A1B488C00C9B673 /* KMAITranslationVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F0201712A1B488C00C9B673 /* KMAITranslationVC.xib */; };
+		9F0201792A1B5C0300C9B673 /* KMAIServerConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201782A1B5C0300C9B673 /* KMAIServerConfig.swift */; };
+		9F02017A2A1B5C0300C9B673 /* KMAIServerConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201782A1B5C0300C9B673 /* KMAIServerConfig.swift */; };
+		9F02017B2A1B5C0300C9B673 /* KMAIServerConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201782A1B5C0300C9B673 /* KMAIServerConfig.swift */; };
+		9F02017E2A1BAC1600C9B673 /* KMAIRewritingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F02017C2A1BAC1600C9B673 /* KMAIRewritingVC.swift */; };
+		9F02017F2A1BAC1600C9B673 /* KMAIRewritingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F02017C2A1BAC1600C9B673 /* KMAIRewritingVC.swift */; };
+		9F0201802A1BAC1600C9B673 /* KMAIRewritingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F02017C2A1BAC1600C9B673 /* KMAIRewritingVC.swift */; };
+		9F0201812A1BAC1600C9B673 /* KMAIRewritingVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F02017D2A1BAC1600C9B673 /* KMAIRewritingVC.xib */; };
+		9F0201822A1BAC1600C9B673 /* KMAIRewritingVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F02017D2A1BAC1600C9B673 /* KMAIRewritingVC.xib */; };
+		9F0201832A1BAC1600C9B673 /* KMAIRewritingVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F02017D2A1BAC1600C9B673 /* KMAIRewritingVC.xib */; };
+		9F0201862A1DA28B00C9B673 /* KMAILanguagePopVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201842A1DA28B00C9B673 /* KMAILanguagePopVC.swift */; };
+		9F0201872A1DA28B00C9B673 /* KMAILanguagePopVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201842A1DA28B00C9B673 /* KMAILanguagePopVC.swift */; };
+		9F0201882A1DA28B00C9B673 /* KMAILanguagePopVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201842A1DA28B00C9B673 /* KMAILanguagePopVC.swift */; };
+		9F0201892A1DA28B00C9B673 /* KMAILanguagePopVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F0201852A1DA28B00C9B673 /* KMAILanguagePopVC.xib */; };
+		9F02018A2A1DA28B00C9B673 /* KMAILanguagePopVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F0201852A1DA28B00C9B673 /* KMAILanguagePopVC.xib */; };
+		9F02018B2A1DA28B00C9B673 /* KMAILanguagePopVC.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F0201852A1DA28B00C9B673 /* KMAILanguagePopVC.xib */; };
+		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 */; };
+		9F0201962A1F352100C9B673 /* KMAITranslationConfirmWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201942A1F352100C9B673 /* KMAITranslationConfirmWindowController.swift */; };
+		9F0201972A1F352100C9B673 /* KMAITranslationConfirmWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201942A1F352100C9B673 /* KMAITranslationConfirmWindowController.swift */; };
+		9F0201982A1F352100C9B673 /* KMAITranslationConfirmWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F0201942A1F352100C9B673 /* KMAITranslationConfirmWindowController.swift */; };
+		9F0201992A1F352100C9B673 /* KMAITranslationConfirmWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F0201952A1F352100C9B673 /* KMAITranslationConfirmWindowController.xib */; };
+		9F02019A2A1F352100C9B673 /* KMAITranslationConfirmWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F0201952A1F352100C9B673 /* KMAITranslationConfirmWindowController.xib */; };
+		9F02019B2A1F352100C9B673 /* KMAITranslationConfirmWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9F0201952A1F352100C9B673 /* KMAITranslationConfirmWindowController.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"; }; };
@@ -3558,6 +3600,20 @@
 		89E9B3F8295BE2EC00AEFA61 /* KMEditPDFTextPropertyViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMEditPDFTextPropertyViewController.xib; sourceTree = "<group>"; };
 		89E9B404295D268E00AEFA61 /* KMEditImagePropertyViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KMEditImagePropertyViewController.swift; sourceTree = "<group>"; };
 		89E9B405295D268E00AEFA61 /* KMEditImagePropertyViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KMEditImagePropertyViewController.xib; sourceTree = "<group>"; };
+		9F0201642A176AF200C9B673 /* KMDottedLineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMDottedLineView.swift; sourceTree = "<group>"; };
+		9F0201682A1B088700C9B673 /* KMAIOpenPDFFilesVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMAIOpenPDFFilesVC.swift; sourceTree = "<group>"; };
+		9F0201692A1B088700C9B673 /* KMAIOpenPDFFilesVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMAIOpenPDFFilesVC.xib; sourceTree = "<group>"; };
+		9F0201702A1B488C00C9B673 /* KMAITranslationVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMAITranslationVC.swift; sourceTree = "<group>"; };
+		9F0201712A1B488C00C9B673 /* KMAITranslationVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMAITranslationVC.xib; sourceTree = "<group>"; };
+		9F0201782A1B5C0300C9B673 /* KMAIServerConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMAIServerConfig.swift; sourceTree = "<group>"; };
+		9F02017C2A1BAC1600C9B673 /* KMAIRewritingVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMAIRewritingVC.swift; sourceTree = "<group>"; };
+		9F02017D2A1BAC1600C9B673 /* KMAIRewritingVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMAIRewritingVC.xib; sourceTree = "<group>"; };
+		9F0201842A1DA28B00C9B673 /* KMAILanguagePopVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMAILanguagePopVC.swift; sourceTree = "<group>"; };
+		9F0201852A1DA28B00C9B673 /* KMAILanguagePopVC.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMAILanguagePopVC.xib; sourceTree = "<group>"; };
+		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>"; };
+		9F0201942A1F352100C9B673 /* KMAITranslationConfirmWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMAITranslationConfirmWindowController.swift; sourceTree = "<group>"; };
+		9F0201952A1F352100C9B673 /* KMAITranslationConfirmWindowController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = KMAITranslationConfirmWindowController.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>"; };
@@ -5265,6 +5321,7 @@
 				BB3AD6F629935483004FC1AE /* Reachability */,
 				9F080B0E298A55A300FC27DA /* KMConvertURLToPDF.h */,
 				9F080B0D298A55A300FC27DA /* KMConvertURLToPDF.m */,
+				9F0201782A1B5C0300C9B673 /* KMAIServerConfig.swift */,
 			);
 			path = NSObject;
 			sourceTree = "<group>";
@@ -5638,6 +5695,7 @@
 				9F5664862988B16F00020985 /* KMTextfieldVC.xib */,
 				9F080B12298CFDB300FC27DA /* KMTextImageButtonVC.swift */,
 				9F080B13298CFDB300FC27DA /* KMTextImageButtonVC.xib */,
+				9F0201642A176AF200C9B673 /* KMDottedLineView.swift */,
 			);
 			path = View;
 			sourceTree = "<group>";
@@ -5667,6 +5725,14 @@
 				9F1F82B3292DEF370092C4B4 /* KMCloudDocumentsViewController.xib */,
 				9F1F82BA292E01860092C4B4 /* KMCloudEmptyCollectionViewItem.swift */,
 				9F1F82BB292E01860092C4B4 /* KMCloudEmptyCollectionViewItem.xib */,
+				9F0201682A1B088700C9B673 /* KMAIOpenPDFFilesVC.swift */,
+				9F0201692A1B088700C9B673 /* KMAIOpenPDFFilesVC.xib */,
+				9F0201702A1B488C00C9B673 /* KMAITranslationVC.swift */,
+				9F0201712A1B488C00C9B673 /* KMAITranslationVC.xib */,
+				9F02017C2A1BAC1600C9B673 /* KMAIRewritingVC.swift */,
+				9F02017D2A1BAC1600C9B673 /* KMAIRewritingVC.xib */,
+				9F0201842A1DA28B00C9B673 /* KMAILanguagePopVC.swift */,
+				9F0201852A1DA28B00C9B673 /* KMAILanguagePopVC.xib */,
 				9F72D20E2994BDCC00DCACF1 /* customViewController */,
 			);
 			path = ViewController;
@@ -5683,6 +5749,10 @@
 				9F0CB5412986953A00007028 /* KMURLToPDFWindowController.xib */,
 				9FD0FA4929D43D6800F2AB0D /* KMDeviceBrowserWindowController.swift */,
 				9FD0FA4A29D43D6800F2AB0D /* KMDeviceBrowserWindowController.xib */,
+				9F02018C2A1DDAA500C9B673 /* KMAITranslationWindowController.swift */,
+				9F02018D2A1DDAA500C9B673 /* KMAITranslationWindowController.xib */,
+				9F0201942A1F352100C9B673 /* KMAITranslationConfirmWindowController.swift */,
+				9F0201952A1F352100C9B673 /* KMAITranslationConfirmWindowController.xib */,
 			);
 			path = WindowController;
 			sourceTree = "<group>";
@@ -9309,6 +9379,7 @@
 				9FF94F1429A7476000B1EF69 /* KMDesignPropertySelector.xib in Resources */,
 				BBC348462956A638008D2CD1 /* KMEditBackgroundController.xib in Resources */,
 				BBA2109429ACC10F00E6B346 /* signlist_add.pdf in Resources */,
+				9F0201992A1F352100C9B673 /* KMAITranslationConfirmWindowController.xib in Resources */,
 				BB89721B294AED6C0045787C /* KMWatermarkAdjectivePreViewBaseController.xib in Resources */,
 				89E4E72F2963FBA2002DBA6F /* KMPropertiesViewPopController.xib in Resources */,
 				9F8539E32947126000DF644E /* KMChromiumToolbar.xib in Resources */,
@@ -9345,6 +9416,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 */,
@@ -9400,6 +9472,7 @@
 				ADD1B6F82946C0CA00C3FFF7 /* KMPrintChoosePageSizeMultipageView.xib in Resources */,
 				89E4E76429656A88002DBA6F /* KMAnnotationStampViewController.xib in Resources */,
 				BBC745ED295F067B0072C2ED /* KMCropSettingWindowController.xib in Resources */,
+				9F02016D2A1B088700C9B673 /* KMAIOpenPDFFilesVC.xib in Resources */,
 				9FF94F1C29A770B500B1EF69 /* KMFillSignShapePanel.xib in Resources */,
 				89E9B3F9295BE2EC00AEFA61 /* KMEditPDFTextPropertyViewController.xib in Resources */,
 				ADB1FE9A2975301500ED072D /* KMBatchHeaderAndFooterView.xib in Resources */,
@@ -9450,6 +9523,7 @@
 				BBC348362955A118008D2CD1 /* KMCreateBackgroundController.xib in Resources */,
 				9F0CB4C02977C06300007028 /* KMPropertiesPanelColorSubVC.xib in Resources */,
 				ADD1B6F42946C07800C3FFF7 /* KMPrintChoosePageSizePosterView.xib in Resources */,
+				9F0201892A1DA28B00C9B673 /* KMAILanguagePopVC.xib in Resources */,
 				AD0FA50E29A9E75000EDEB50 /* KMLoginInputPasswordView.xib in Resources */,
 				BB8F4542295A98960037EA22 /* KMHeaderFooterPropertyController.xib in Resources */,
 				9FA693AB2987C0590055488A /* KMStepperView.xib in Resources */,
@@ -9474,6 +9548,8 @@
 				ADCB98FD292750A200B51A03 /* KMBatchProcessingTableView.xib in Resources */,
 				9FBA0F0129015A82001117AF /* KMFastToolCollectionViewItem.xib in Resources */,
 				BBFBE6C528DD7B98008B2335 /* Main.storyboard in Resources */,
+				9F0201752A1B488C00C9B673 /* KMAITranslationVC.xib in Resources */,
+				9F0201812A1BAC1600C9B673 /* KMAIRewritingVC.xib in Resources */,
 				ADE3C1E729A5ABC200793B13 /* KMLoginWindowController.xib in Resources */,
 				9FD0FA2C29CD3ED400F2AB0D /* KMRightSideEmptyVC.xib in Resources */,
 				9F8539F92947137500DF644E /* newtab_p.pdf in Resources */,
@@ -9530,6 +9606,7 @@
 				ADF1569829A62D31001D1018 /* KMLoginLeftImageView.xib in Resources */,
 				89316856296E45CA0073EA59 /* KMImageAccessoryController.xib in Resources */,
 				BBC3483F2955A60B008D2CD1 /* KMBackgroundPropertyInfoController.xib in Resources */,
+				9F02018A2A1DA28B00C9B673 /* KMAILanguagePopVC.xib in Resources */,
 				9FA693AC2987C0590055488A /* KMStepperView.xib in Resources */,
 				899700E328F3A9F2009AF911 /* KMHomeWindowController.xib in Resources */,
 				BB8F4543295A98960037EA22 /* KMHeaderFooterPropertyController.xib in Resources */,
@@ -9549,6 +9626,7 @@
 				89D2D2B72947316900BFF5FE /* Quick Start Guide_Widget_Widget.pdf in Resources */,
 				ADCB98CE2924743300B51A03 /* KMBatchProcessingView.xib in Resources */,
 				BB4EEF3129763EE7003A3537 /* KMRedactBaseWindowController.xib in Resources */,
+				9F0201762A1B488C00C9B673 /* KMAITranslationVC.xib in Resources */,
 				9F72D20C2994BDAF00DCACF1 /* KMNotificationVC.xib in Resources */,
 				9F3D819729A33A290087B5AD /* KMDesignDropdown.xib in Resources */,
 				BBFE6E792930E53000142C01 /* KMMergePopoverViewController.xib in Resources */,
@@ -9639,6 +9717,7 @@
 				8997010A28F4082C009AF911 /* KMFromViewController.xib in Resources */,
 				ADB1FE8329752F3200ED072D /* KMBatchSecurityView.xib in Resources */,
 				894A00F62976314C0070ED83 /* KMPDFViewPanelSetViewController.xib in Resources */,
+				9F02016E2A1B088700C9B673 /* KMAIOpenPDFFilesVC.xib in Resources */,
 				9F0CB48B29683DC400007028 /* KMPropertiesPanelPresetColorSubVC.xib in Resources */,
 				89D2D2FF294C806000BFF5FE /* KMPDFThumbnailItem.xib in Resources */,
 				89E4E70C2963D62B002DBA6F /* KMAnnotationFontWindowController.xib in Resources */,
@@ -9740,6 +9819,7 @@
 				8942F7FC2926089200389627 /* KMSignatureViewController.xib in Resources */,
 				BB98080129CA93D400BEEB81 /* WelcomeWindowController.xib in Resources */,
 				9F080B18298CFDB300FC27DA /* KMTextImageButtonVC.xib in Resources */,
+				9F02019A2A1F352100C9B673 /* KMAITranslationConfirmWindowController.xib in Resources */,
 				BBFE6E832930EBD400142C01 /* KMCompressWindowController.xib in Resources */,
 				9F0CB46B2967E5CB00007028 /* KMPropertiesPanelSubViewController.xib in Resources */,
 				AD68783929A60FC0005B5210 /* KMLoginView.xib in Resources */,
@@ -9754,6 +9834,7 @@
 				9FD0FA4F29D43D6800F2AB0D /* KMDeviceBrowserWindowController.xib in Resources */,
 				F3B698A9298BC84500E0EB4D /* KMDocumentAIPopViewController.xib in Resources */,
 				9F1F82CE292F6CF90092C4B4 /* KMPDFInsertPageWindow.xib in Resources */,
+				9F0201822A1BAC1600C9B673 /* KMAIRewritingVC.xib in Resources */,
 				89E4E7422964160F002DBA6F /* KMAnnotationLinkViewController.xib in Resources */,
 				89752DEE293875FC003FF08E /* KMMainToolbarController.xib in Resources */,
 				BB49ED0A293F461500C82CA2 /* KMConvertCSVWindowController.xib in Resources */,
@@ -9788,6 +9869,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 */,
@@ -9899,12 +9981,14 @@
 				ADC075C629866B05006C752F /* KMBatchTextRecognitionView.xib in Resources */,
 				AD8810B729A846B100178CA1 /* KMVerficationCodeWindowController.xib in Resources */,
 				BBC348192955920B008D2CD1 /* KMBackgroundPropertyController.xib in Resources */,
+				9F02019B2A1F352100C9B673 /* KMAITranslationConfirmWindowController.xib in Resources */,
 				BB98080229CA93D400BEEB81 /* WelcomeWindowController.xib in Resources */,
 				89E4E76629656A88002DBA6F /* KMAnnotationStampViewController.xib in Resources */,
 				899700E428F3A9F2009AF911 /* KMHomeWindowController.xib in Resources */,
 				BB7507EE29861C37002DBDB1 /* PasswordWindowController.xib in Resources */,
 				F3B698AA298BC84500E0EB4D /* KMDocumentAIPopViewController.xib in Resources */,
 				BBC348402955A60B008D2CD1 /* KMBackgroundPropertyInfoController.xib in Resources */,
+				9F0201832A1BAC1600C9B673 /* KMAIRewritingVC.xib in Resources */,
 				9FDD0F9E2952FF4D000C4DAD /* comp-light.json in Resources */,
 				ADB1FEA42975303F00ED072D /* KMBatchBatesNumberView.xib in Resources */,
 				9F94747D29FA22700042F949 /* InfoPlist.strings in Resources */,
@@ -9925,6 +10009,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 */,
@@ -9956,6 +10041,7 @@
 				ADB1FE8429752F3200ED072D /* KMBatchSecurityView.xib in Resources */,
 				9FBA0EE628FEC253001117AF /* KMProductPromotionViewController.xib in Resources */,
 				89E9B3FB295BE2EC00AEFA61 /* KMEditPDFTextPropertyViewController.xib in Resources */,
+				9F02018B2A1DA28B00C9B673 /* KMAILanguagePopVC.xib in Resources */,
 				BB1EC8032967B26700EC0BC3 /* KMPDFEditViewController.xib in Resources */,
 				BBD1F781296F9BE000343885 /* KMPageEditSettingBaseWindowController.xib in Resources */,
 				BB5DF1EE2959C5CB0025CDA1 /* KMHeaderFooterPreviewController.xib in Resources */,
@@ -9971,6 +10057,7 @@
 				9F1F82DF292F84D60092C4B4 /* KMHomeInsertActionViewController.xib in Resources */,
 				BB9695B829BDB03E00FD68D3 /* InfoWindow.xib in Resources */,
 				9F1FE4E029406E4700E952CA /* .gclient in Resources */,
+				9F02016F2A1B088700C9B673 /* KMAIOpenPDFFilesVC.xib in Resources */,
 				ADCB98EF2924779800B51A03 /* KMBatchProcessingStateTableCell.xib in Resources */,
 				BB897233294B08DE0045787C /* KMWatermarkViewController.xib in Resources */,
 				9F0CB4BA2977BC1000007028 /* KMPropertiesPanelPreviewSubVC.xib in Resources */,
@@ -10071,6 +10158,7 @@
 				BB99ACC7292DE22E0048AFD9 /* KMMergeViewController.xib in Resources */,
 				AD867F8D29D950B400F00440 /* KMBOTAOutlineView.xib in Resources */,
 				9F1F82CF292F6CF90092C4B4 /* KMPDFInsertPageWindow.xib in Resources */,
+				9F0201772A1B488C00C9B673 /* KMAITranslationVC.xib in Resources */,
 				89E93EDD2999DA6D00F10F66 /* KMNoteFilterCollevtionViewItem.xib in Resources */,
 				ADC31FAE2A0E0C3900ED44A2 /* KMEditPropertyAlignmentView.xib in Resources */,
 				ADE3C1B029A4779E00793B13 /* KMPrintAccessoryController.xib in Resources */,
@@ -10231,6 +10319,7 @@
 				9F81ADC629B9B12C002251F4 /* NSButton+DesignToken.swift in Sources */,
 				BBEC00C7295C319400A26C98 /* KMBatesManager.swift in Sources */,
 				BB147020299DC0D100784A6A /* OIDServiceDiscovery.m in Sources */,
+				9F0201652A176AF200C9B673 /* KMDottedLineView.swift in Sources */,
 				BB5DF1F12959C9F00025CDA1 /* KMHeaderFooterPropertyMainController.swift in Sources */,
 				BBC3482429559506008D2CD1 /* KMBackgroundManager.swift in Sources */,
 				AD867FC529DFFBC400F00440 /* KMAnnotationOutlineRowView.swift in Sources */,
@@ -10335,6 +10424,7 @@
 				9F81ADC229B87C7F002251F4 /* KMConvertPDFManagerOC.m in Sources */,
 				BB5DF1E92959C5CB0025CDA1 /* KMHeaderFooterPreviewController.swift in Sources */,
 				9FDD0F6B294AD12C000C4DAD /* KMMainViewController+UI.swift in Sources */,
+				9F02017E2A1BAC1600C9B673 /* KMAIRewritingVC.swift in Sources */,
 				89D9897428FE743E003A3E87 /* KMOutlineView.swift in Sources */,
 				89752E1D2942CB03003FF08E /* KMSearchMode.swift in Sources */,
 				AD3A3587294C11ED00D72802 /* KMPrintPreviewPresenter.swift in Sources */,
@@ -10415,6 +10505,7 @@
 				BB49ECF1293F40F500C82CA2 /* KMConvertPageRangeSettingItemView.swift in Sources */,
 				9F0CB46F2967E63100007028 /* KMPropertiesPanelNameSubVC.swift in Sources */,
 				9FD0FA3129CD947000F2AB0D /* KMOpacityPanel.swift in Sources */,
+				9F0201792A1B5C0300C9B673 /* KMAIServerConfig.swift in Sources */,
 				9F1FE4F329406E4700E952CA /* FastResizeView.m in Sources */,
 				9F1FE4FC29406E4700E952CA /* CTTabStripController.m in Sources */,
 				BB146FCC299DC0D100784A6A /* GTMSessionUploadFetcher.m in Sources */,
@@ -10559,6 +10650,7 @@
 				BBFE6E5D2930809A00142C01 /* KMMergeCollectionPageViewItem.swift in Sources */,
 				89E4E7132963D7FF002DBA6F /* NSFont_SKExtensions.m in Sources */,
 				89316849296E436B0073EA59 /* KMSignatureManager.m in Sources */,
+				9F02016A2A1B088700C9B673 /* KMAIOpenPDFFilesVC.swift in Sources */,
 				BB147005299DC0D100784A6A /* OIDFieldMapping.m in Sources */,
 				BB003015298CA446002DD1A0 /* KMPreferenceGeneralController.swift in Sources */,
 				BBB9B32E299A5D6D004F3235 /* GTMAppAuthFetcherAuthorization.m in Sources */,
@@ -10611,6 +10703,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 */,
@@ -10765,6 +10858,7 @@
 				BBB14A532978DD5400936EDB /* KMRedactTools.swift in Sources */,
 				BB5F8A1129BB04F000365ADB /* GBDeviceInfo_Common.m in Sources */,
 				BBAFC83C2985194800D0648E /* KMPDFEditAppendWindow.m in Sources */,
+				9F0201722A1B488C00C9B673 /* KMAITranslationVC.swift in Sources */,
 				89E4E6F52963D1E9002DBA6F /* KMAnnotationPropertiesColorManager.m in Sources */,
 				9FDD0F8C2952FCE0000C4DAD /* KMGlobalParser.swift in Sources */,
 				BB897251294C3F660045787C /* KMMenuTableView.swift in Sources */,
@@ -10787,6 +10881,7 @@
 				BB146FE4299DC0D100784A6A /* GTLRURITemplate.m in Sources */,
 				9F1FE50D29407B2B00E952CA /* KMUploadFilePanel.swift in Sources */,
 				89E4E6E32963CD82002DBA6F /* KMGeneralAnnotationViewController.m in Sources */,
+				9F0201862A1DA28B00C9B673 /* KMAILanguagePopVC.swift in Sources */,
 				9F0CB4BD2977C06300007028 /* KMPropertiesPanelColorSubVC.swift in Sources */,
 				AD1CA4192A061CE10070541F /* KMAnnotationScreenTypeViewItem.swift in Sources */,
 				BBB9B328299A5D6D004F3235 /* GTMAppAuthFetcherAuthorization+Keychain.m in Sources */,
@@ -10885,6 +10980,7 @@
 				8997010E28F40842009AF911 /* KMOutlineViewController.swift in Sources */,
 				BB2F61502966A91D001CB369 /* KMBackgroundPropertyHomeController.swift in Sources */,
 				9F1FE3DE293EE51F00E952CA /* KMMainDocument.swift in Sources */,
+				9F0201962A1F352100C9B673 /* KMAITranslationConfirmWindowController.swift in Sources */,
 				BBB9B31F299A5D6D004F3235 /* KMGoogleDriveManager.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
@@ -11186,6 +11282,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 */,
@@ -11208,6 +11305,7 @@
 				BB99ACCB292DEE6E0048AFD9 /* KMMergeTitleBar.swift in Sources */,
 				ADD1B6A629416FE800C3FFF7 /* KMOCRPresenter.swift in Sources */,
 				89D9895F28FD21E6003A3E87 /* KMAnnotationCollectionView.swift in Sources */,
+				9F0201662A176AF200C9B673 /* KMDottedLineView.swift in Sources */,
 				BB897257294C559F0045787C /* KMWatermarkPropertyCreateController.swift in Sources */,
 				9F0CB4CE298654FA00007028 /* KMDesignToken+Height.swift in Sources */,
 				ADB1FE3C29700D3400ED072D /* KMBatchCollectionViewItem.swift in Sources */,
@@ -11249,8 +11347,10 @@
 				ADBC2D12299CCD05006280C8 /* KMTextfieldButton.swift in Sources */,
 				9F1FE49429406E4700E952CA /* common.m in Sources */,
 				AD0FA51329A9FA8600EDEB50 /* KMResetPasswordView.swift in Sources */,
+				9F0201732A1B488C00C9B673 /* KMAITranslationVC.swift in Sources */,
 				BBFBE74728DD7DB7008B2335 /* ViewController.swift in Sources */,
 				9FDD0F812952FC36000C4DAD /* KMDesignToken.swift in Sources */,
+				9F0201972A1F352100C9B673 /* KMAITranslationConfirmWindowController.swift in Sources */,
 				BB147036299DC0D200784A6A /* OIDRegistrationResponse.m in Sources */,
 				BB86C21A28F561C7005AD968 /* NSColor_SKExtensions.m in Sources */,
 				9FDD0F8D2952FCE0000C4DAD /* KMGlobalParser.swift in Sources */,
@@ -11377,6 +11477,7 @@
 				9F0CB536298656F900007028 /* KMDesignToken+BorderWidthLeft.swift in Sources */,
 				BBA8B7AB2935DC120097D183 /* KMRemovePasswordResultTipView.swift in Sources */,
 				ADCB9972292C65EE00B51A03 /* KMGOCROperation.m in Sources */,
+				9F02017F2A1BAC1600C9B673 /* KMAIRewritingVC.swift in Sources */,
 				9FDD0F78294FEF64000C4DAD /* KMConvertPDFManager.swift in Sources */,
 				ADC075CB29866DDC006C752F /* KMBatchConvertPDFItemView.swift in Sources */,
 				8942F80429262B2E00389627 /* KMSideViewController.swift in Sources */,
@@ -11391,6 +11492,7 @@
 				8942F818292B678100389627 /* KMAnnotationTableCellView.swift in Sources */,
 				BB8F456A295ABDC10037EA22 /* KMWatermarkAdjectiveBaseModel.swift in Sources */,
 				9F0CB53A2986570600007028 /* KMDesignToken+BoxShadow.swift in Sources */,
+				9F02017A2A1B5C0300C9B673 /* KMAIServerConfig.swift in Sources */,
 				9F0CB4B62977BC1000007028 /* KMPropertiesPanelPreviewSubVC.swift in Sources */,
 				9F1FE4E229406E4700E952CA /* GTMNSAnimation+Duration.m in Sources */,
 				ADB1FE9F2975303400ED072D /* KMBatchBatesNumberView.swift in Sources */,
@@ -11409,6 +11511,7 @@
 				BB897252294C3F660045787C /* KMMenuTableView.swift in Sources */,
 				9F1FE4CD29406E4700E952CA /* CTTabContentsController.m in Sources */,
 				8942F7BC29222C7E00389627 /* KMBookCellView.swift in Sources */,
+				9F0201872A1DA28B00C9B673 /* KMAILanguagePopVC.swift in Sources */,
 				BBEC00DA295C39FD00A26C98 /* KMBatesPropertyInfoController.swift in Sources */,
 				9F0CB52A298656C900007028 /* KMDesignToken+BorderWidthTop.swift in Sources */,
 				BB4EEF492976504C003A3537 /* KMRedactColorView.swift in Sources */,
@@ -11639,6 +11742,7 @@
 				BB49ECEA293F32A400C82CA2 /* KMConvertWordSettingView.swift in Sources */,
 				F373228D292CCA650013862C /* CPDFListViewAnimatedBorderlessWindow.m in Sources */,
 				F373228D292CCA650013862C /* CPDFListViewAnimatedBorderlessWindow.m in Sources */,
+				9F02016B2A1B088700C9B673 /* KMAIOpenPDFFilesVC.swift in Sources */,
 				9F0CB4DA2986553600007028 /* KMDesignToken+VerticalPadding.swift in Sources */,
 				9FF94F1A29A770B500B1EF69 /* KMFillSignShapePanel.swift in Sources */,
 				9F8539C729430AC400DF644E /* KMToolbarRightView.swift in Sources */,
@@ -11710,6 +11814,7 @@
 				BB897260294C5DDA0045787C /* KMWatermarkPropertyInfoController.swift in Sources */,
 				F3732316292DF9410013862C /* CPDFTextAnnotation+PDFListView.m in Sources */,
 				BBB1A3A029F6128200E54E47 /* KMSystemMenu.swift in Sources */,
+				9F0201882A1DA28B00C9B673 /* KMAILanguagePopVC.swift in Sources */,
 				F37322EC292DF9410013862C /* CPDFStampAnnotation+PDFListView.m in Sources */,
 				BB8F4562295AA39F0037EA22 /* KMHeaderFooterModel.swift in Sources */,
 				BBAFC85429851A9800D0648E /* KMBatchTableRowView.m in Sources */,
@@ -11745,6 +11850,7 @@
 				9F1FE4B629406E4700E952CA /* CTBrowser.m in Sources */,
 				BBA19F4529ADE6A3001A285A /* KMBookMarkRowView.swift in Sources */,
 				ADE614A52977952C00F62ED7 /* KMBatchConvertPDFViewModel.swift in Sources */,
+				9F0201982A1F352100C9B673 /* KMAITranslationConfirmWindowController.swift in Sources */,
 				9FDD0FAC29534FCC000C4DAD /* KMAliasLight.swift in Sources */,
 				BBF38A64294F53FD0086D025 /* KMWatermarkFileView.swift in Sources */,
 				899700F828F4051B009AF911 /* KMAnnotationViewController.swift in Sources */,
@@ -12026,6 +12132,7 @@
 				BB147037299DC0D200784A6A /* OIDRegistrationResponse.m in Sources */,
 				9F221ED929A9EC0900978A59 /* KMFillSignTextPanel.swift in Sources */,
 				89752DC42937033F003FF08E /* KMPopMenuButtonCell.m in Sources */,
+				9F0201742A1B488C00C9B673 /* KMAITranslationVC.swift in Sources */,
 				89E4E6F72963D1E9002DBA6F /* KMAnnotationPropertiesColorManager.m in Sources */,
 				ADCB98CB2924741B00B51A03 /* KMBatchProcessingView.swift in Sources */,
 				BB146FCE299DC0D100784A6A /* GTMSessionUploadFetcher.m in Sources */,
@@ -12251,6 +12358,7 @@
 				BB146FFE299DC0D100784A6A /* OIDAuthState+Mac.m in Sources */,
 				AD88108F29A760D100178CA1 /* KMRegisterPresenter.swift in Sources */,
 				BB3AAB9229878CE000992A5A /* KMWatermarkAdjectivePropertyMainController.swift in Sources */,
+				9F0201802A1BAC1600C9B673 /* KMAIRewritingVC.swift in Sources */,
 				ADE3C1A129A3894900793B13 /* KMSearchTableRowView.swift in Sources */,
 				AD1CA41B2A061CE10070541F /* KMAnnotationScreenTypeViewItem.swift in Sources */,
 				AD8810A229A8459000178CA1 /* KMComparativeTableViewController.swift in Sources */,
@@ -12397,14 +12505,17 @@
 				8942F7EB2925E1C400389627 /* KMLiftSideCellView.swift in Sources */,
 				BB86C20C28F5569F005AD968 /* NSGeometry_SKExtensions.m in Sources */,
 				AD88109429A7612000178CA1 /* KMRegisterModel.swift in Sources */,
+				9F02016C2A1B088700C9B673 /* KMAIOpenPDFFilesVC.swift in Sources */,
 				9F1F82D4292F6D510092C4B4 /* KMPDFInsertPreviewViewController.swift in Sources */,
 				ADB1FE7029752BB700ED072D /* KMBatchConvertPDFView.swift in Sources */,
 				9F705F8F291E579F005199AD /* KMHistoryFileTableView.swift in Sources */,
 				9F0CB4812967F64D00007028 /* KMPropertiesPanelReadOnlySubVC.swift in Sources */,
 				9F0CB53B2986570600007028 /* KMDesignToken+BoxShadow.swift in Sources */,
 				BB49ECE7293EF54800C82CA2 /* KMCustomPDFView.swift in Sources */,
+				9F0201672A176AF200C9B673 /* KMDottedLineView.swift in Sources */,
 				896DD46929893B9900ADE514 /* KMSplitView.m in Sources */,
 				ADB1FE7829752F0900ED072D /* KMBatchCompressView.swift in Sources */,
+				9F02017B2A1B5C0300C9B673 /* KMAIServerConfig.swift in Sources */,
 				AD88109829A78ADC00178CA1 /* KMVerificationCodeView.swift in Sources */,
 				9F0CB4FF298655F600007028 /* KMDesignToken+BorderColor.swift in Sources */,
 				AD71E7C62990A8A4001C5D3F /* KMBatchRemoveViewModel.swift in Sources */,
@@ -12444,6 +12555,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 */,

+ 1 - 1
PDF Office/PDF Master/Base.lproj/Main.storyboard

@@ -737,7 +737,7 @@ CA
                                                 <action selector="menuItemAction_onlineHelp:" target="Voe-Tx-rLC" id="nIp-Xn-0ae"/>
                                             </connections>
                                         </menuItem>
-                                        <menuItem title="More Products" id="lZE-0y-nFr">
+                                        <menuItem title="More Products" hidden="YES" id="lZE-0y-nFr">
                                             <modifierMask key="keyEquivalentModifierMask"/>
                                             <connections>
                                                 <action selector="menuItemAction_morePudact:" target="Voe-Tx-rLC" id="dsp-lu-bUU"/>

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

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

+ 152 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/ic_ai_ErrorCorrection.imageset/Error Correction.pdf

@@ -0,0 +1,152 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 1.531250 3.030151 cm
+0.215686 0.831373 0.811765 scn
+11.418592 20.769800 m
+11.418592 20.252438 11.700403 19.799891 12.118641 19.557543 c
+12.118641 18.175371 l
+7.226383 17.830475 3.368544 13.899054 3.368544 9.099952 c
+3.368544 7.866128 3.623538 6.689634 4.085548 5.616745 c
+4.324090 5.062782 4.617815 4.536438 4.960127 4.044037 c
+5.048690 3.916641 4.940897 3.266623 4.636747 2.093958 c
+4.500668 1.569302 4.975939 1.084202 5.502803 1.211470 c
+6.745975 1.511765 7.434424 1.618814 7.568171 1.532574 c
+8.079510 1.202971 8.626099 0.920099 9.201367 0.690414 c
+10.315522 0.245516 11.537265 -0.000048 12.818543 -0.000048 c
+18.037636 -0.000048 22.268543 4.074158 22.268543 9.099952 c
+22.268543 13.898990 18.410807 17.830372 13.518641 18.175358 c
+13.518641 19.557600 l
+13.936825 19.799961 14.218593 20.252478 14.218593 20.769800 c
+14.218593 21.541998 13.590790 22.169800 12.818592 22.169800 c
+12.046395 22.169800 11.418592 21.541998 11.418592 20.769800 c
+h
+7.261635 13.358135 m
+7.396380 13.452629 7.548779 13.519777 7.709039 13.557225 c
+8.609238 13.767574 9.709990 13.767574 12.843432 13.767575 c
+12.843447 13.767575 l
+12.843461 13.767575 l
+12.843475 13.767575 l
+12.843641 13.767575 l
+13.252094 13.767575 13.628986 13.768225 13.977308 13.768826 c
+16.542664 13.773249 17.558304 13.774999 18.218643 13.494916 c
+18.245035 13.483904 l
+18.584702 13.343203 19.885309 12.804443 19.885309 9.268699 c
+19.885309 5.648186 18.728212 5.227671 18.224842 5.044733 c
+18.218643 5.042480 l
+17.718643 4.860706 15.926975 4.769821 12.843641 4.769821 c
+9.760307 4.769821 7.885308 4.786856 7.468641 5.042480 c
+7.452450 5.052414 7.435126 5.062811 7.416782 5.073818 c
+6.963064 5.346107 5.885308 5.992901 5.885308 9.268699 c
+5.885308 12.160749 6.785347 13.024126 7.261635 13.358135 c
+h
+1.527686 12.505590 m
+1.066092 12.648630 0.575939 12.390390 0.432900 11.928796 c
+0.151112 11.019456 0.000000 10.056777 0.000000 9.061583 c
+0.000000 8.066388 0.151111 7.103709 0.432900 6.194368 c
+0.575939 5.732773 1.066092 5.474535 1.527686 5.617573 c
+1.989281 5.760612 2.247520 6.250767 2.104481 6.712360 c
+1.873924 7.456376 1.750000 8.244530 1.750000 9.061583 c
+1.750000 9.878634 1.873924 10.666789 2.104481 11.410804 c
+2.247520 11.872398 1.989281 12.362551 1.527686 12.505590 c
+h
+24.109547 12.505590 m
+24.571142 12.648630 25.061295 12.390390 25.204334 11.928796 c
+25.486122 11.019456 25.637234 10.056777 25.637234 9.061583 c
+25.637234 8.066388 25.486122 7.103709 25.204334 6.194368 c
+25.061295 5.732773 24.571142 5.474535 24.109547 5.617573 c
+23.647953 5.760612 23.389713 6.250767 23.532753 6.712360 c
+23.763309 7.456376 23.887234 8.244530 23.887234 9.061583 c
+23.887234 9.878634 23.763309 10.666789 23.532753 11.410804 c
+23.389713 11.872398 23.647953 12.362551 24.109547 12.505590 c
+h
+9.507048 7.447737 m
+9.498971 7.439538 l
+9.206078 7.146645 8.731204 7.146645 8.438312 7.439538 c
+7.438311 8.439538 l
+7.145418 8.732431 7.145418 9.207305 7.438311 9.500198 c
+7.731205 9.793092 8.206079 9.793092 8.498971 9.500198 c
+8.968579 9.030590 l
+11.438160 11.500178 l
+11.731052 11.793072 12.205925 11.793072 12.498818 11.500178 c
+12.791712 11.207285 12.791712 10.732410 12.498818 10.439517 c
+9.507048 7.447737 l
+h
+13.938311 8.250341 m
+13.645418 7.957447 13.645418 7.482573 13.938311 7.189679 c
+14.231204 6.896786 14.706077 6.896786 14.998970 7.189679 c
+15.968513 8.159226 l
+16.938160 7.189578 l
+17.231052 6.896685 17.705925 6.896685 17.998817 7.189578 c
+18.291710 7.482471 18.291710 7.957346 17.998817 8.250240 c
+17.029171 9.219889 l
+17.998817 10.189536 l
+18.291710 10.482430 18.291710 10.957304 17.998817 11.250198 c
+17.705925 11.543092 17.231052 11.543092 16.938160 11.250198 c
+15.968513 10.280550 l
+14.998970 11.250097 l
+14.706077 11.542991 14.231204 11.542991 13.938311 11.250097 c
+13.645418 10.957203 13.645418 10.482328 13.938311 10.189435 c
+14.907855 9.219889 l
+13.938311 8.250341 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  3903
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 28.000000 28.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
+0000003993 00000 n
+0000004016 00000 n
+0000004189 00000 n
+0000004263 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+4322
+%%EOF

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

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

+ 153 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/ic_ai_ErrorCorrection_empty.imageset/Error Correction.pdf

@@ -0,0 +1,153 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 6.125488 12.120667 cm
+0.968627 0.972549 0.980392 scn
+45.674370 83.079384 m
+45.674370 81.010094 46.801437 79.200027 48.474174 78.230583 c
+48.474174 72.701637 l
+28.905325 71.321877 13.474174 55.596268 13.474174 36.399990 c
+13.474174 31.464695 14.494150 26.758720 16.342194 22.467163 c
+17.296360 20.251312 18.471260 18.145935 19.840508 16.176331 c
+20.194759 15.666748 19.763590 13.066673 18.546988 8.376015 c
+18.002670 6.277390 19.903755 4.336990 22.011211 4.846062 c
+26.983902 6.047241 29.737696 6.475441 30.272682 6.130478 c
+32.318039 4.812065 34.504395 3.680580 36.805470 2.761841 c
+41.262089 0.982246 46.149059 -0.000008 51.274174 -0.000008 c
+72.150543 -0.000008 89.074173 16.296814 89.074173 36.399990 c
+89.074173 55.596268 73.643021 71.321877 54.074173 72.701637 c
+54.074173 78.230354 l
+55.747128 79.199745 56.874371 81.009933 56.874371 83.079384 c
+56.874371 86.168175 54.363159 88.679382 51.274368 88.679382 c
+48.185581 88.679382 45.674370 86.168175 45.674370 83.079384 c
+h
+29.046541 53.432724 m
+29.585522 53.810699 30.195118 54.079292 30.836155 54.229084 c
+34.436951 55.070480 38.839958 55.070480 51.373730 55.070484 c
+51.373787 55.070484 l
+51.373844 55.070484 l
+51.373901 55.070484 l
+51.374565 55.070484 l
+53.008377 55.070484 54.515945 55.073082 55.909233 55.075485 c
+66.170654 55.093178 70.233215 55.100178 72.874573 53.979847 c
+72.906570 53.966274 72.941826 53.951668 72.980141 53.935799 c
+74.338806 53.372993 79.541237 51.217957 79.541237 37.074978 c
+79.541237 22.592926 74.912849 20.910866 72.899368 20.179115 c
+72.874573 20.170105 l
+70.874573 19.443008 63.707901 19.079468 51.374565 19.079468 c
+39.041229 19.079468 31.541231 19.147606 29.874565 20.170105 c
+29.809799 20.209839 29.740503 20.251427 29.667128 20.295456 c
+27.852257 21.384613 23.541233 23.971786 23.541231 37.074978 c
+23.541231 48.643181 27.141390 52.096687 29.046541 53.432724 c
+h
+6.110745 50.022545 m
+4.264367 50.594704 2.303756 49.561745 1.731598 47.715366 c
+0.604448 44.078007 0.000000 40.227291 0.000000 36.246513 c
+0.000000 32.265736 0.604446 28.415020 1.731598 24.777657 c
+2.303757 22.931274 4.264368 21.898323 6.110746 22.470474 c
+7.957124 23.042633 8.990082 25.003250 8.417923 26.849625 c
+7.495697 29.825687 7.000000 32.978302 7.000000 36.246513 c
+7.000000 39.514721 7.495698 42.667339 8.417924 45.643398 c
+8.990082 47.489777 7.957123 49.450386 6.110745 50.022545 c
+h
+96.438187 50.022545 m
+98.284569 50.594704 100.245178 49.561745 100.817337 47.715366 c
+101.944489 44.078007 102.548935 40.227291 102.548935 36.246513 c
+102.548935 32.265736 101.944489 28.415020 100.817337 24.777657 c
+100.245178 22.931274 98.284569 21.898323 96.438187 22.470474 c
+94.591812 23.042633 93.558853 25.003250 94.131012 26.849625 c
+95.053238 29.825687 95.548935 32.978302 95.548935 36.246513 c
+95.548935 39.514721 95.053238 42.667339 94.131012 45.643398 c
+93.558853 47.489777 94.591812 49.450386 96.438187 50.022545 c
+h
+38.008762 29.771294 m
+38.004486 29.766964 38.000195 29.762646 37.995884 29.758335 c
+36.824310 28.586765 34.924816 28.586765 33.753246 29.758335 c
+29.753244 33.758335 l
+28.581673 34.929909 28.581673 36.829403 29.753244 38.000977 c
+30.924818 39.172550 32.824314 39.172550 33.995884 38.000977 c
+35.874317 36.122543 l
+45.752640 46.000896 l
+46.924210 47.172470 48.823700 47.172470 49.995274 46.000896 c
+51.166843 44.829323 51.166843 42.929825 49.995274 41.758251 c
+38.028191 29.791130 l
+38.021751 29.784496 38.015274 29.777885 38.008762 29.771294 c
+h
+55.753242 33.001549 m
+54.581673 31.829971 54.581673 29.930473 55.753242 28.758900 c
+56.924812 27.587326 58.824306 27.587326 59.995876 28.758900 c
+63.874054 32.637089 l
+67.752632 28.758495 l
+68.924202 27.586922 70.823700 27.586922 71.995270 28.758495 c
+73.166840 29.930069 73.166840 31.829567 71.995270 33.001144 c
+68.116684 36.879734 l
+71.995270 40.758327 l
+73.166840 41.929905 73.166840 43.829399 71.995270 45.000977 c
+70.823700 46.172550 68.924202 46.172550 67.752632 45.000977 c
+63.874054 41.122383 l
+59.995876 45.000572 l
+58.824306 46.172146 56.924812 46.172146 55.753242 45.000572 c
+54.581673 43.828995 54.581673 41.929497 55.753242 40.757923 c
+59.631420 36.879734 l
+55.753242 33.001549 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  4196
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 112.000000 112.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
+0000004286 00000 n
+0000004309 00000 n
+0000004484 00000 n
+0000004558 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+4617
+%%EOF

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

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

File diff suppressed because it is too large
+ 2230 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/ic_ai_Rewriting.imageset/Rewriting.pdf


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

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

File diff suppressed because it is too large
+ 2230 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/ic_ai_rewriting_empty.imageset/Rewriting.pdf


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

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

File diff suppressed because it is too large
+ 2498 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/ic_function_other.imageset/other.pdf


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

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

File diff suppressed because it is too large
+ 2393 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/ic_function_other_AITranslation.imageset/other.pdf


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

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

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

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

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

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

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

@@ -0,0 +1,93 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 0.000000 1.600037 cm
+1.000000 1.000000 1.000000 scn
+6.397224 8.899988 m
+5.951925 9.567938 l
+4.826911 11.255458 l
+4.808364 11.283278 4.777142 11.299988 4.743707 11.299988 c
+1.600000 11.299988 l
+1.544773 11.299988 1.500000 11.255217 1.500000 11.199986 c
+1.500000 1.599988 l
+1.500000 1.544760 1.544771 1.499988 1.600000 1.499988 c
+14.400001 1.499988 l
+14.455227 1.499988 14.500000 1.544759 14.500000 1.599989 c
+14.500000 8.799988 l
+14.500000 8.855216 14.455229 8.899988 14.400001 8.899988 c
+7.200000 8.899988 l
+6.397224 8.899988 l
+h
+1.600000 12.799988 m
+0.716345 12.799988 0.000000 12.083642 0.000000 11.199986 c
+0.000000 1.599988 l
+0.000000 0.716332 0.716345 -0.000012 1.600000 -0.000012 c
+14.400001 -0.000012 l
+15.283656 -0.000012 16.000000 0.716333 16.000000 1.599989 c
+16.000000 8.799988 l
+16.000000 9.683643 15.283656 10.399988 14.400001 10.399988 c
+7.200000 10.399988 l
+6.074986 12.087508 l
+5.778241 12.532626 5.278672 12.799988 4.743707 12.799988 c
+1.600000 12.799988 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  1050
+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
+0000001140 00000 n
+0000001163 00000 n
+0000001336 00000 n
+0000001410 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+1469
+%%EOF

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

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

+ 112 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_empty_ImportFromScanner.imageset/Import From Scanner.pdf

@@ -0,0 +1,112 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 5.000000 7.450073 cm
+0.807843 0.815686 0.831373 scn
+29.550201 34.247814 m
+30.131178 34.620720 30.299856 35.393990 29.926952 35.974968 c
+29.554049 36.555946 28.780775 36.724621 28.199799 36.351719 c
+1.324799 19.101841 l
+1.278679 19.072239 1.235161 19.040115 1.194302 19.005764 c
+0.490974 18.695852 0.000000 17.992613 0.000000 17.174683 c
+0.000000 2.174683 l
+0.000000 1.070114 0.895432 0.174683 2.000000 0.174683 c
+36.000000 0.174683 l
+37.104568 0.174683 38.000000 1.070114 38.000000 2.174683 c
+38.000000 17.174683 l
+38.000000 18.279251 37.104568 19.174683 36.000000 19.174683 c
+6.066532 19.174683 l
+29.550201 34.247814 l
+h
+35.500000 2.674683 m
+35.500000 16.674683 l
+2.500000 16.674683 l
+2.500000 2.674683 l
+35.500000 2.674683 l
+h
+20.000000 22.174652 m
+20.000000 22.865009 20.559645 23.424652 21.250000 23.424652 c
+36.250000 23.424652 l
+36.940357 23.424652 37.500000 22.865009 37.500000 22.174652 c
+37.500000 21.484295 36.940357 20.924652 36.250000 20.924652 c
+21.250000 20.924652 l
+20.559645 20.924652 20.000000 21.484295 20.000000 22.174652 c
+h
+19.000000 4.174683 m
+20.104570 4.174683 21.000000 5.070112 21.000000 6.174683 c
+21.000000 7.279253 20.104570 8.174683 19.000000 8.174683 c
+17.895430 8.174683 17.000000 7.279253 17.000000 6.174683 c
+17.000000 5.070112 17.895430 4.174683 19.000000 4.174683 c
+h
+27.250000 6.174683 m
+27.250000 5.070112 26.354570 4.174683 25.250000 4.174683 c
+24.145430 4.174683 23.250000 5.070112 23.250000 6.174683 c
+23.250000 7.279253 24.145430 8.174683 25.250000 8.174683 c
+26.354570 8.174683 27.250000 7.279253 27.250000 6.174683 c
+h
+31.500000 4.174683 m
+32.604568 4.174683 33.500000 5.070112 33.500000 6.174683 c
+33.500000 7.279253 32.604568 8.174683 31.500000 8.174683 c
+30.395430 8.174683 29.500000 7.279253 29.500000 6.174683 c
+29.500000 5.070112 30.395430 4.174683 31.500000 4.174683 c
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  1896
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 48.000000 48.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
+0000001986 00000 n
+0000002009 00000 n
+0000002182 00000 n
+0000002256 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+2315
+%%EOF

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

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

+ 127 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_empty_NewBlackPage.imageset/New Blank Page.pdf

@@ -0,0 +1,127 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 8.250000 3.750000 cm
+0.807843 0.815686 0.831373 scn
+25.148119 34.052544 m
+25.102215 34.102749 l
+21.538939 38.000000 l
+2.500000 38.000000 l
+2.500000 2.500031 l
+28.999977 2.500031 l
+28.999977 30.274498 l
+25.196686 34.004910 l
+25.148119 34.052544 l
+h
+26.947269 35.789692 m
+23.235315 39.849556 l
+22.856424 40.263958 22.320782 40.500000 21.759274 40.500000 c
+2.000000 40.500000 l
+0.895430 40.500000 0.000000 39.604572 0.000000 38.500004 c
+0.000000 2.000031 l
+0.000000 0.895462 0.895429 0.000031 1.999998 0.000031 c
+29.499977 0.000031 l
+30.604546 0.000031 31.499977 0.895458 31.499977 2.000031 c
+31.499977 30.484444 l
+31.499977 31.021584 31.283916 31.536148 30.900444 31.912270 c
+26.947269 35.789692 l
+h
+25.467300 14.607716 m
+25.467300 9.250557 21.124466 4.907722 15.767306 4.907722 c
+10.410147 4.907722 6.067311 9.250557 6.067311 14.607716 c
+6.067311 19.964874 10.410147 24.307711 15.767306 24.307711 c
+21.124466 24.307711 25.467300 19.964874 25.467300 14.607716 c
+h
+15.767306 7.407722 m
+19.743753 7.407722 22.967300 10.631268 22.967300 14.607716 c
+22.967300 18.584164 19.743753 21.807711 15.767306 21.807711 c
+11.790859 21.807711 8.567311 18.584164 8.567311 14.607716 c
+8.567311 10.631268 11.790859 7.407722 15.767306 7.407722 c
+h
+15.765798 18.782564 m
+16.456154 18.782564 17.015797 18.222919 17.015797 17.532564 c
+17.015797 15.859346 l
+18.689243 15.859346 l
+19.379597 15.859346 19.939243 15.299702 19.939243 14.609346 c
+19.939243 13.918991 19.379597 13.359346 18.689243 13.359346 c
+17.015797 13.359346 l
+17.015797 11.685780 l
+17.015797 10.995424 16.456154 10.435780 15.765798 10.435780 c
+15.075441 10.435780 14.515798 10.995424 14.515798 11.685780 c
+14.515798 13.359346 l
+12.842458 13.359346 l
+12.152102 13.359346 11.592458 13.918991 11.592458 14.609346 c
+11.592458 15.299702 12.152102 15.859346 12.842458 15.859346 c
+14.515798 15.859346 l
+14.515798 17.532564 l
+14.515798 18.222919 15.075441 18.782564 15.765798 18.782564 c
+h
+21.000000 36.250000 m
+21.000000 29.500000 l
+27.750000 29.500000 l
+27.750000 27.000000 l
+19.750000 27.000000 l
+19.059645 27.000000 18.500000 27.559643 18.500000 28.250000 c
+18.500000 36.250000 l
+21.000000 36.250000 l
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  2215
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 48.000000 48.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
+0000002305 00000 n
+0000002328 00000 n
+0000002501 00000 n
+0000002575 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+2634
+%%EOF

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

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

+ 127 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_empty_NewFromFiles.imageset/New From Files.pdf

@@ -0,0 +1,127 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 5.750000 4.750000 cm
+0.807843 0.815686 0.831373 scn
+9.250000 38.500000 m
+7.455075 38.500000 6.000000 37.044926 6.000000 35.250000 c
+6.000000 29.500000 l
+3.250000 29.500000 l
+1.455074 29.500000 0.000000 28.044926 0.000000 26.250000 c
+0.000000 3.250000 l
+0.000000 1.455074 1.455074 0.000000 3.250000 0.000000 c
+33.250000 0.000000 l
+35.044926 0.000000 36.500000 1.455078 36.500000 3.250000 c
+36.500000 19.250000 l
+36.500000 21.044926 35.044926 22.500000 33.250000 22.500000 c
+30.500000 22.500000 l
+30.500000 35.250000 l
+30.500000 37.044926 29.044928 38.500000 27.250000 38.500000 c
+9.250000 38.500000 l
+h
+28.000000 22.500000 m
+28.000000 35.250000 l
+28.000000 35.664215 27.664213 36.000000 27.250000 36.000000 c
+9.250000 36.000000 l
+8.835787 36.000000 8.500000 35.664215 8.500000 35.250000 c
+8.500000 29.500000 l
+9.750000 29.500000 l
+12.874523 29.500000 l
+14.010064 29.500000 15.063261 28.907326 15.652582 27.936680 c
+18.734386 22.860767 l
+18.870384 22.636772 19.113430 22.500000 19.375477 22.500000 c
+28.000000 22.500000 l
+h
+2.500000 26.250000 m
+2.500000 26.664213 2.835787 27.000000 3.250000 27.000000 c
+9.750000 27.000000 l
+12.874523 27.000000 l
+13.136571 27.000000 13.379617 26.863228 13.515614 26.639233 c
+16.597418 21.563320 l
+17.186737 20.592674 18.239937 20.000000 19.375477 20.000000 c
+33.250000 20.000000 l
+33.664215 20.000000 34.000000 19.664213 34.000000 19.250000 c
+34.000000 3.250000 l
+34.000000 2.835785 33.664211 2.500000 33.250000 2.500000 c
+3.250000 2.500000 l
+2.835786 2.500000 2.500000 2.835785 2.500000 3.250000 c
+2.500000 26.250000 l
+h
+26.250000 16.500000 m
+26.940355 16.500000 27.500000 15.940355 27.500000 15.250000 c
+27.500000 12.500000 l
+30.250000 12.500000 l
+30.940357 12.500000 31.500000 11.940355 31.500000 11.250000 c
+31.500000 10.559645 30.940357 10.000000 30.250000 10.000000 c
+27.500000 10.000000 l
+27.500000 7.250000 l
+27.500000 6.559643 26.940355 6.000000 26.250000 6.000000 c
+25.559645 6.000000 25.000000 6.559643 25.000000 7.250000 c
+25.000000 10.000000 l
+22.250000 10.000000 l
+21.559645 10.000000 21.000000 10.559645 21.000000 11.250000 c
+21.000000 11.940355 21.559645 12.500000 22.250000 12.500000 c
+25.000000 12.500000 l
+25.000000 15.250000 l
+25.000000 15.940355 25.559645 16.500000 26.250000 16.500000 c
+h
+f*
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  2317
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 48.000000 48.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
+0000002407 00000 n
+0000002430 00000 n
+0000002603 00000 n
+0000002677 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+2736
+%%EOF

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

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

+ 230 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_empty_addFiles.imageset/add files.pdf

@@ -0,0 +1,230 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+1.000000 0.000000 -0.000000 1.000000 23.000000 14.000000 cm
+0.807843 0.815686 0.831373 scn
+42.198082 58.125153 m
+42.253166 58.064903 l
+42.311447 58.007740 l
+49.000000 51.447357 l
+49.000000 3.000000 l
+3.000000 3.000000 l
+3.000000 65.000000 l
+35.912369 65.000000 l
+42.198082 58.125153 l
+h
+37.829082 67.349556 m
+44.412148 60.149483 l
+51.400467 53.295074 l
+51.783939 52.918953 52.000000 52.404388 52.000000 51.867249 c
+52.000000 2.000000 l
+52.000000 0.895432 51.104568 0.000000 50.000000 0.000000 c
+2.000001 0.000000 l
+0.895432 0.000000 0.000000 0.895432 0.000000 2.000000 c
+0.000000 66.000000 l
+0.000000 67.104568 0.895431 68.000000 2.000000 68.000000 c
+36.353039 68.000000 l
+36.914547 68.000000 37.450188 67.763962 37.829082 67.349556 c
+h
+8.000000 38.000000 m
+15.000000 38.000000 l
+15.000000 41.000000 l
+8.000000 41.000000 l
+8.000000 38.000000 l
+h
+18.000000 38.000000 m
+38.000000 38.000000 l
+38.000000 41.000000 l
+18.000000 41.000000 l
+18.000000 38.000000 l
+h
+8.000000 31.000000 m
+29.000000 31.000000 l
+29.000000 34.000000 l
+8.000000 34.000000 l
+8.000000 31.000000 l
+h
+43.000000 24.000000 m
+8.000000 24.000000 l
+8.000000 27.000000 l
+43.000000 27.000000 l
+43.000000 24.000000 l
+h
+8.000000 10.000000 m
+32.000000 10.000000 l
+32.000000 13.000000 l
+8.000000 13.000000 l
+8.000000 10.000000 l
+h
+25.000000 17.000000 m
+8.000000 17.000000 l
+8.000000 20.000000 l
+25.000000 20.000000 l
+25.000000 17.000000 l
+h
+35.000000 17.000000 m
+28.000000 17.000000 l
+28.000000 20.000000 l
+35.000000 20.000000 l
+35.000000 17.000000 l
+h
+f*
+n
+Q
+q
+0.983025 -0.183470 0.183470 0.983025 64.458496 20.234360 cm
+0.807843 0.815686 0.831373 scn
+16.352558 52.007996 m
+16.352558 7.853607 l
+19.352558 7.853607 l
+19.352558 52.007996 l
+16.352558 52.007996 l
+h
+0.000000 52.685425 m
+15.675129 52.685425 l
+15.675129 55.685425 l
+0.000000 55.685425 l
+0.000000 52.685425 l
+h
+15.675131 7.176178 m
+13.389420 7.176178 l
+13.389420 4.176178 l
+15.675131 4.176178 l
+15.675131 7.176178 l
+h
+16.352558 7.853607 m
+16.352558 7.479473 16.049261 7.176178 15.675131 7.176178 c
+15.675131 4.176178 l
+17.706121 4.176178 19.352558 5.822628 19.352558 7.853607 c
+16.352558 7.853607 l
+h
+19.352558 52.007996 m
+19.352558 54.038986 17.706116 55.685425 15.675129 55.685425 c
+15.675129 52.685425 l
+16.049263 52.685425 16.352558 52.382130 16.352558 52.007996 c
+19.352558 52.007996 l
+h
+f
+n
+Q
+q
+1.000000 0.000000 -0.000000 1.000000 56.000000 61.500000 cm
+0.807843 0.815686 0.831373 scn
+0.000000 1.500000 m
+-1.500000 1.500000 l
+-1.500000 0.671573 -0.828427 0.000000 0.000000 0.000000 c
+0.000000 1.500000 l
+h
+14.250000 3.000000 m
+0.000000 3.000000 l
+0.000000 0.000000 l
+14.250000 0.000000 l
+14.250000 3.000000 l
+h
+1.500000 1.500000 m
+1.500000 15.750000 l
+-1.500000 15.750000 l
+-1.500000 1.500000 l
+1.500000 1.500000 l
+h
+f
+n
+Q
+q
+0.965926 0.258819 -0.258819 0.965926 15.326099 12.848835 cm
+0.807843 0.815686 0.831373 scn
+2.308538 6.324112 m
+2.218217 7.821392 l
+2.218217 7.821392 l
+2.308538 6.324112 l
+h
+1.500000 8.497589 m
+1.500000 45.446964 l
+-1.500000 45.446964 l
+-1.500000 8.497589 l
+1.500000 8.497589 l
+h
+2.177428 46.124390 m
+16.709490 46.124390 l
+16.709490 49.124390 l
+2.177428 49.124390 l
+2.177428 46.124390 l
+h
+6.775479 8.096302 m
+2.218217 7.821392 l
+2.398860 4.826832 l
+6.956121 5.101742 l
+6.775479 8.096302 l
+h
+-1.500000 8.497589 m
+-1.500000 6.379524 0.284638 4.699295 2.398860 4.826832 c
+2.218217 7.821392 l
+1.828753 7.797897 1.500000 8.107414 1.500000 8.497589 c
+-1.500000 8.497589 l
+h
+1.500000 45.446964 m
+1.500000 45.821095 1.803293 46.124390 2.177428 46.124390 c
+2.177428 49.124390 l
+0.146442 49.124390 -1.500000 47.477951 -1.500000 45.446964 c
+1.500000 45.446964 l
+h
+f
+n
+Q
+
+endstream
+endobj
+
+3 0 obj
+  3636
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 96.000000 96.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
+0000003726 00000 n
+0000003749 00000 n
+0000003922 00000 n
+0000003996 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+4055
+%%EOF

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

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

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

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

+ 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/icon_home.imageset/Contents.json

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

+ 215 - 0
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Home/icon_home.imageset/home.pdf

@@ -0,0 +1,215 @@
+%PDF-1.7
+
+1 0 obj
+  << >>
+endobj
+
+2 0 obj
+  << /Length 3 0 R >>
+stream
+/DeviceRGB CS
+/DeviceRGB cs
+q
+5.411656 19.885353 m
+4.653033 19.362823 4.199951 18.500589 4.199951 17.579424 c
+4.199951 7.000511 l
+4.199951 5.454115 5.453556 4.200512 6.999953 4.200512 c
+20.999950 4.200512 l
+22.546349 4.200512 23.799952 5.454111 23.799952 7.000509 c
+23.799952 17.579422 l
+23.799952 18.500587 23.346870 19.362823 22.588245 19.885353 c
+15.588245 24.706860 l
+14.631842 25.365618 13.368061 25.365618 12.411657 24.706860 c
+5.411656 19.885353 l
+h
+16.000000 10.999756 m
+12.000000 10.999756 l
+12.000000 5.999756 l
+16.000000 5.999756 l
+16.000000 10.999756 l
+h
+W*
+n
+q
+1.000000 0.000000 -0.000000 1.000000 4.199951 4.035889 cm
+0.090196 0.439216 0.956863 scn
+1.211705 15.849465 m
+0.077209 17.496559 l
+0.077209 17.496559 l
+1.211705 15.849465 l
+h
+18.388294 15.849464 m
+17.253798 14.202372 l
+17.253799 14.202370 l
+18.388294 15.849464 l
+h
+11.388294 20.670971 m
+12.522790 22.318064 l
+12.522790 22.318064 l
+11.388294 20.670971 l
+h
+8.211706 20.670971 m
+7.077210 22.318066 l
+7.077210 22.318066 l
+8.211706 20.670971 l
+h
+7.800049 6.963867 m
+7.800049 8.963867 l
+5.800049 8.963867 l
+5.800049 6.963867 l
+7.800049 6.963867 l
+h
+11.800049 6.963867 m
+13.800049 6.963867 l
+13.800049 8.963867 l
+11.800049 8.963867 l
+11.800049 6.963867 l
+h
+7.800049 1.963867 m
+5.800049 1.963867 l
+5.800049 -0.036133 l
+7.800049 -0.036133 l
+7.800049 1.963867 l
+h
+11.800049 1.963867 m
+11.800049 -0.036133 l
+13.800049 -0.036133 l
+13.800049 1.963867 l
+11.800049 1.963867 l
+h
+2.000000 13.543535 m
+2.000000 13.806725 2.129451 14.053076 2.346202 14.202372 c
+0.077209 17.496559 l
+-1.223287 16.600794 -2.000000 15.122679 -2.000000 13.543535 c
+2.000000 13.543535 l
+h
+2.000000 2.964622 m
+2.000000 13.543535 l
+-2.000000 13.543535 l
+-2.000000 2.964622 l
+2.000000 2.964622 l
+h
+2.800002 2.164623 m
+2.358172 2.164623 2.000000 2.522799 2.000000 2.964622 c
+-2.000000 2.964622 l
+-2.000000 0.313654 0.149038 -1.835377 2.800002 -1.835377 c
+2.800002 2.164623 l
+h
+16.799999 2.164623 m
+2.800002 2.164623 l
+2.800002 -1.835377 l
+16.799999 -1.835377 l
+16.799999 2.164623 l
+h
+17.600000 2.964621 m
+17.600000 2.522795 17.241831 2.164623 16.799999 2.164623 c
+16.799999 -1.835377 l
+19.450964 -1.835377 21.600000 0.313650 21.600000 2.964621 c
+17.600000 2.964621 l
+h
+17.600000 13.543533 m
+17.600000 2.964621 l
+21.600000 2.964621 l
+21.600000 13.543533 l
+17.600000 13.543533 l
+h
+17.253799 14.202370 m
+17.470549 14.053076 17.600000 13.806725 17.600000 13.543533 c
+21.600000 13.543533 l
+21.600000 15.122675 20.823290 16.600794 19.522789 17.496559 c
+17.253799 14.202370 l
+h
+10.253798 19.023876 m
+17.253798 14.202372 l
+19.522791 17.496559 l
+12.522790 22.318064 l
+10.253798 19.023876 l
+h
+9.346202 19.023876 m
+9.619460 19.212093 9.980539 19.212093 10.253798 19.023876 c
+12.522790 22.318064 l
+10.883242 23.447363 8.716760 23.447365 7.077210 22.318066 c
+9.346202 19.023876 l
+h
+2.346201 14.202372 m
+9.346202 19.023876 l
+7.077210 22.318066 l
+0.077209 17.496559 l
+2.346201 14.202372 l
+h
+7.800049 4.963867 m
+11.800049 4.963867 l
+11.800049 8.963867 l
+7.800049 8.963867 l
+7.800049 4.963867 l
+h
+9.800049 1.963867 m
+9.800049 6.963867 l
+5.800049 6.963867 l
+5.800049 1.963867 l
+9.800049 1.963867 l
+h
+11.800049 3.963867 m
+7.800049 3.963867 l
+7.800049 -0.036133 l
+11.800049 -0.036133 l
+11.800049 3.963867 l
+h
+9.800049 6.963867 m
+9.800049 1.963867 l
+13.800049 1.963867 l
+13.800049 6.963867 l
+9.800049 6.963867 l
+h
+f
+n
+Q
+Q
+
+endstream
+endobj
+
+3 0 obj
+  3331
+endobj
+
+4 0 obj
+  << /Annots []
+     /Type /Page
+     /MediaBox [ 0.000000 0.000000 28.000000 28.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
+0000003421 00000 n
+0000003444 00000 n
+0000003617 00000 n
+0000003691 00000 n
+trailer
+<< /ID [ (some) (id) ]
+   /Root 6 0 R
+   /Size 7
+>>
+startxref
+3750
+%%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

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

@@ -0,0 +1,12 @@
+{
+  "images" : [
+    {
+      "filename" : "Frame 1021 (2).pdf",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Welcome/KMImageNameWelcome1.imageset/Frame 1021 (2).pdf


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

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

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Welcome/KMImageNameWelcome2.imageset/Frame 1076 (1).pdf


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

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

BIN
PDF Office/PDF Master/Class/Appearance/Image.xcassets/Welcome/KMImageNameWelcome3.imageset/Frame 1020 (1).pdf


+ 2 - 1
PDF Office/PDF Master/Class/ChromiumTabs/KMBrowserWindowController.swift

@@ -38,7 +38,8 @@ import Cocoa
         NotificationCenter.default.addObserver(self, selector: #selector(openNewWindow(_:)), name: NSNotification.Name.init(rawValue: "KMTabControllerOpenNewWindow"), object: nil)
         
         if (WelcomeWindowController.welcomeHasShow() == false) {
-            KMTools.openQuickStartStudy()
+            //AI 版本禁掉首次开启帮助文档
+//            KMTools.openQuickStartStudy()
             
             DispatchQueue.main.async {
                 let welcome = WelcomeWindowController()

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

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

+ 0 - 1
PDF Office/PDF Master/Class/Home/NSObject/Services/GTLRClass/GTMSessionFetcher/GTMMIMEDocument.m

@@ -406,7 +406,6 @@ static void SearchDataForBytes(NSData *data, const void *targetBytes, NSUInteger
         // and map that two-byte subrange.
         const void *partDataBuffer;
         size_t partDataBufferSize;
-        // The clang included with Xcode 13.3 betas added a -Wunused-but-set-variable warning,
         // which doesn't (yet) skip variables annotated with objc_precie_lifetime. Since that
         // warning is not available in all Xcodes, turn off the -Wunused warning group entirely.
 #pragma clang diagnostic push

+ 0 - 1
PDF Office/PDF Master/Class/Home/NSObject/Services/GTLRClass/GTMSessionFetcher/GTMSessionFetcher.m

@@ -1908,7 +1908,6 @@ NSData *_Nullable GTMDataFromInputStream(NSInputStream *inputStream, NSError **o
 }
 
 - (void)releaseCallbacks {
-  // The clang included with Xcode 13.3 betas added a -Wunused-but-set-variable warning,
   // which doesn't (yet) skip variables annotated with objc_precie_lifetime. Since that
   // warning is not available in all Xcodes, turn off the -Wunused warning group entirely.
 #pragma clang diagnostic push

+ 0 - 1
PDF Office/PDF Master/Class/Home/NSObject/Services/GTLRClass/GTMSessionFetcher/GTMSessionUploadFetcher.m

@@ -1766,7 +1766,6 @@ NSString *const kGTMSessionFetcherUploadInitialBackoffStartedNotification =
               totalBytesExpectedToSend:(int64_t)totalBytesExpected {
   GTMSessionCheckNotSynchronized(self);
 
-  // The clang included with Xcode 13.3 betas added a -Wunused-but-set-variable warning,
   // which doesn't (yet) skip variables annotated with objc_precie_lifetime. Since that
   // warning is not available in all Xcodes, turn off the -Wunused warning group entirely.
 #pragma clang diagnostic push

+ 74 - 0
PDF Office/PDF Master/Class/Home/View/KMDottedLineView.swift

@@ -0,0 +1,74 @@
+//
+//  KMDottedLineView.swift
+//  PDF Master
+//
+//  Created by wanjun on 2023/5/19.
+//
+
+import Cocoa
+
+@objc enum KMDrawBorderState : Int {
+    case None = 0
+    case Hover
+    case Select
+}
+
+class KMDottedLineView: NSView {
+    
+    var state: KMDrawBorderState = .None
+    
+    var area: NSTrackingArea?
+    var canHover : Bool! = true // 是否允许悬浮
+    var canClick : Bool! = true // 是否允许点击
+
+    deinit {
+        if (self.area != nil) {
+            self.removeTrackingArea(self.area!)
+            self.area = nil
+        }
+    }
+
+    override func draw(_ dirtyRect: NSRect) {
+        super.draw(dirtyRect)
+        
+        if ((self.state == .Hover) || (self.state == .Select)) {
+            let path = NSBezierPath(roundedRect: self.bounds, xRadius: 8.0, yRadius: 8.0)
+            path.lineWidth = 1.0
+            NSColor(hex: "#68ACF8").setStroke()
+            path.stroke()
+        } else {
+            let path = NSBezierPath(roundedRect: self.bounds, xRadius: 8.0, yRadius: 8.0)
+            
+            path.setLineDash([3, 3, 3], count: 3, phase: 0)
+            path.lineWidth = 1.0
+            NSColor(hex: "#CED0D4").setStroke()
+            path.stroke()
+        }
+    }
+    
+    override func updateTrackingAreas() {
+        super.updateTrackingAreas()
+
+        if (self.area != nil) {
+            self.removeTrackingArea(self.area!)
+            self.area = nil
+        }
+        
+        self.area = NSTrackingArea(rect: self.bounds, options: [.mouseEnteredAndExited, .mouseMoved, .activeAlways], owner: self)
+        self.addTrackingArea(self.area!)
+    }
+    
+    override func mouseEntered(with event: NSEvent) {
+        if canHover {
+            self.state = .Hover
+            self.needsDisplay = true
+        }
+    }
+    
+    override func mouseExited(with event: NSEvent) {
+        if canHover {
+            self.state = .None
+            self.needsDisplay = true
+        }
+    }
+}

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

@@ -0,0 +1,126 @@
+//
+//  KMAILanguagePopVC.swift
+//  PDF Master
+//
+//  Created by wanjun on 2023/5/24.
+//
+
+import Cocoa
+
+typealias aiLanguagePopCellViewDownCallback = (_ language: String) -> Void
+
+class KMAILanguagePopTableviewCell: NSTableCellView {
+    
+    @IBOutlet weak var mainBox: KMBox!
+    @IBOutlet weak var languageLabel: NSTextField!
+    var selectUrls: [URL] = []
+    var isSelect: Bool = false
+    var selectString: String = ""
+
+    // MARK: Init
+    
+    override func awakeFromNib() {
+        super.awakeFromNib()
+        
+        self.mainBox.fillColor = .clear
+        self.languageLabel.textColor = NSColor(hex: "#252629")
+        self.languageLabel.font = NSFont.SFProTextRegular(14.0)
+        
+        self.mainBox.moveCallback =  { [unowned self](mouseEntered: Bool, mouseBox: KMBox) -> Void in
+            if !self.isSelect {
+                if mouseEntered {
+                    self.mainBox.fillColor = NSColor(hex: "#EDEEF0")
+                } else {
+                    self.mainBox.fillColor = .clear
+                }
+            }
+        }
+        self.mainBox.downCallback = { [unowned self](downEntered: Bool, mouseBox: KMBox, event) -> Void in
+            if downEntered {
+                if !self.isSelect {
+                    self.mainBox.fillColor = NSColor(hex: "#1770F4", alpha: 0.1)
+                }
+            }
+        }
+    }
+    
+    // MARK: Private Methods
+    
+    func refreshAIUI() -> Void {
+        self.mainBox.fillColor = .clear
+    }
+     
+    // MARK: Action
+}
+
+class KMAILanguagePopVC: NSViewController, NSTableViewDelegate, NSTableViewDataSource {
+
+    @IBOutlet weak var tableView: NSTableView!
+    @IBOutlet weak var customBoxWidthLayoutConstraint: NSLayoutConstraint!
+    @IBOutlet weak var customBoxHeightLayoutConstraint: NSLayoutConstraint!
+    
+    var languages: [String] = []
+    var downCallback: aiLanguagePopCellViewDownCallback?
+    var selectString: String = ""
+
+    func initWithPopViewDataArr(_ popViewDataArr: [String]) -> Self {
+        self.languages = popViewDataArr
+        return self
+    }
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+        
+        NotificationCenter.default.addObserver(self, selector: #selector(tableViewDidScroll(_:)), name: NSScrollView.didLiveScrollNotification, object: tableView.enclosingScrollView)
+    }
+    
+    override func viewDidAppear() {
+        super.viewDidAppear()
+        self.tableView.reloadData()
+    }
+    
+    // MARK: NSTableViewDelegate
+    
+    func tableView(_ tableView: NSTableView, heightOfRow row: Int) -> CGFloat {
+        return 32.0;
+    }
+    
+    func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
+        let language: String = languages[row] as! String
+        let identifier = tableColumn?.identifier
+        let cellView: KMAILanguagePopTableviewCell = tableView.makeView(withIdentifier:identifier!, owner: self) as! KMAILanguagePopTableviewCell
+        cellView.languageLabel.stringValue = language
+        cellView.refreshAIUI()
+        if language == self.selectString {
+            cellView.mainBox.fillColor = NSColor(hex: "#0A82FF", alpha: 0.75)
+            cellView.isSelect = true
+        } else {
+            cellView.isSelect = false
+        }
+        return cellView
+    }
+    
+    func tableViewSelectionDidChange(_ notification: Notification) {
+        let tableView: NSTableView = notification.object as? NSTableView ?? NSTableView()
+        if tableView == self.tableView {
+            if (self.tableView?.selectedRow != -1) {
+                if let callback = self.downCallback {
+                    callback(self.languages[self.tableView!.selectedRow])
+                }
+
+            }
+        }
+    }
+    
+    @objc func tableViewDidScroll(_ notification: Notification) {
+        self.tableView.reloadData()
+    }
+    
+    // MARK: NSTableViewDataSource
+    
+    func numberOfRows(in tableView: NSTableView) -> Int {
+        return languages.count
+    }
+    
+}

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

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

+ 398 - 0
PDF Office/PDF Master/Class/Home/ViewController/KMAIOpenPDFFilesVC.swift

@@ -0,0 +1,398 @@
+//
+//  KMAIOpenPDFFilesVC.swift
+//  PDF Master
+//
+//  Created by wanjun on 2023/5/22.
+//
+
+import Cocoa
+
+class KMAIOpenPDFFilesVC: NSViewController {
+    
+    @IBOutlet weak var openPDFFilesLabel: NSTextField!
+    @IBOutlet weak var openPDFFilesImageView: NSImageView!
+    @IBOutlet weak var selectYourFilesBox: KMBox!
+    @IBOutlet weak var selectYourFilesLabel: NSTextField!
+    @IBOutlet weak var selectYourFilesImageView: NSImageView!
+    @IBOutlet weak var orDropFilesHereToOpenLabel: NSTextField!
+
+    @IBOutlet weak var creatPDFLabel: NSTextField!
+    @IBOutlet weak var newFromFilesLabel: NSTextField!
+    @IBOutlet weak var newFromFilesImageView: NSImageView!
+    @IBOutlet weak var newBlankPageLabel: NSTextField!
+    @IBOutlet weak var newBlankPageImageView: NSImageView!
+    @IBOutlet weak var importFromScannerLabel: NSTextField!
+    @IBOutlet weak var importFromScannerImageView: NSImageView!
+    var deviceBrowserWC: KMDeviceBrowserWindowController?
+
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+        
+        self.initLocalization()
+        self.initializeUI()
+    }
+    
+    
+    // MARK: initialize
+    
+    func initializeUI() -> Void {
+        self.openPDFFilesLabel.textColor = NSColor(hex: "#252629")
+        self.openPDFFilesLabel.font = NSFont.SFProTextSemibold(20.0)
+        self.openPDFFilesImageView.image = NSImage(named: "icon_empty_addFiles")
+        self.selectYourFilesBox.cornerRadius = 4.0
+        self.selectYourFilesBox.fillColor = NSColor(hex: "#1770F4")
+        self.selectYourFilesLabel.textColor = NSColor(hex: "#FFFFFF")
+        self.selectYourFilesLabel.font = NSFont.SFProTextRegular(16.0)
+        self.selectYourFilesImageView.image = NSImage(named: "icon_SelectYourFiles")
+        self.orDropFilesHereToOpenLabel.textColor = NSColor(hex: "#616469")
+        self.orDropFilesHereToOpenLabel.font = NSFont.SFProTextRegular(14.0)
+        
+        self.creatPDFLabel.textColor = NSColor(hex: "#252629")
+        self.creatPDFLabel.font = NSFont.SFProTextSemibold(20.0)
+        self.newFromFilesLabel.textColor = NSColor(hex: "#252629")
+        self.newFromFilesLabel.font = NSFont.SFProTextRegular(16.0)
+        self.newFromFilesImageView.image = NSImage(named: "icon_empty_NewFromFiles")
+        self.newBlankPageLabel.textColor = NSColor(hex: "#252629")
+        self.newBlankPageLabel.font = NSFont.SFProTextRegular(16.0)
+        self.newBlankPageImageView.image = NSImage(named: "icon_empty_NewBlackPage")
+        self.importFromScannerLabel.textColor = NSColor(hex: "#252629")
+        self.importFromScannerLabel.font = NSFont.SFProTextRegular(16.0)
+        self.importFromScannerImageView.image = NSImage(named: "icon_empty_ImportFromScanner")
+        
+        self.selectYourFilesBox.moveCallback = { [unowned self](mouseEntered: Bool, mouseBox: KMBox) -> Void in
+            if mouseEntered {
+                self.selectYourFilesBox.fillColor = NSColor(hex: "#3F8FF6")
+            } else {
+                self.selectYourFilesBox.fillColor = NSColor(hex: "#1770F4")
+            }
+        }
+        self.selectYourFilesBox.downCallback = { [unowned self](downEntered: Bool, mouseBox: KMBox, event) -> Void in
+            if downEntered {
+                self.openPDFButtonAction()
+            }
+        }
+
+    }
+    
+    func initLocalization() -> Void {
+        self.openPDFFilesLabel.stringValue = NSLocalizedString("Open PDF Files", comment: "")
+        self.selectYourFilesLabel.stringValue = NSLocalizedString("Select Your Files", comment: "")
+        self.orDropFilesHereToOpenLabel.stringValue = NSLocalizedString("or drop files here to open", comment: "")
+        self.creatPDFLabel.stringValue = NSLocalizedString("Create PDF", comment: "")
+        self.newFromFilesLabel.stringValue = NSLocalizedString("New From Files", comment: "")
+        self.newBlankPageLabel.stringValue = NSLocalizedString("New Blank Page", comment: "")
+        self.importFromScannerLabel.stringValue = NSLocalizedString("Import From Scanner", comment: "")
+    }
+    
+    // MARK: Private Methods
+    
+    func openImageFile(url: URL) -> Void {
+        let filePath = url.path
+        
+        let fileName: NSString = url.lastPathComponent as NSString
+        let savePath = fetchUniquePath(fileName.kUrlToPDFFolderPath()).deletingLastPathComponent
+
+        let imageName = NSString(string: NSString(string: filePath).lastPathComponent).deletingPathExtension
+        
+        let path = self.fetchDifferentFilePath(filePath: savePath + "/" + imageName + ".pdf")
+        let document = CPDFDocument.init()
+        var success = false
+        
+        //FIXME: 无法插入图片
+        let image = NSImage(contentsOfFile: filePath)
+        let insertPageSuccess = document?.insertPage(image!.size, withImage: filePath, at: document!.pageCount)
+        if insertPageSuccess != nil {
+            //信号量控制异步
+            let semaphore = DispatchSemaphore(value: 0)
+            DispatchQueue.global().async {
+                success = ((document?.write(toFile: path)) != nil)
+                semaphore.signal()
+            }
+            semaphore.wait()
+        } else {
+        }
+        if success {
+            if !path.isPDFValid() {
+                let alert = NSAlert()
+                alert.alertStyle = .critical
+                alert.messageText = NSLocalizedString("An error occurred while opening this document. The file is damaged and could not be repaired.", comment: "")
+                alert.runModal()
+                return
+            }
+            NSDocumentController.shared.openDocument(withContentsOf: URL(fileURLWithPath: path), display: true) { document, documentWasAlreadyOpen, error in
+                if error != nil {
+                    NSApp.presentError(error!)
+                    return
+                }
+            }
+        }
+    }
+    
+    func openOfficeFile(url: URL) -> Void {
+        let filePath = url.path
+        let folderPath = "convertToPDF.pdf"
+        let savePath = folderPath.kUrlToPDFFolderPath()
+        if savePath == nil {
+            return
+        }
+        KMConvertPDFManagerOC.convertFile(filePath, savePath: savePath!) { success, errorDic in
+            if errorDic != nil || !success || !FileManager.default.fileExists(atPath: savePath!) {
+                if FileManager.default.fileExists(atPath: savePath!) {
+                    try?FileManager.default.removeItem(atPath: savePath!)
+                }
+                let alert = NSAlert.init()
+                alert.alertStyle = .critical
+                var infoString = ""
+                if errorDic != nil {
+                    for key in (errorDic! as Dictionary).keys {
+                        infoString = infoString.appendingFormat("%@\n", errorDic![key] as! CVarArg)
+                    }
+                }
+                alert.informativeText = NSLocalizedString("Please install Microsoft Office to create PDFs from Office files", comment: "")
+                alert.messageText = NSLocalizedString("Failed to Create PDF", comment: "")
+                alert.addButton(withTitle: NSLocalizedString("OK", comment: ""))
+                alert.runModal()
+                return
+            }
+            
+            if !savePath!.isPDFValid() {
+                let alert = NSAlert()
+                alert.alertStyle = .critical
+                alert.messageText = NSLocalizedString("An error occurred while opening this document. The file is damaged and could not be repaired.", comment: "")
+                alert.runModal()
+                return
+            }
+            NSDocumentController.shared.openDocument(withContentsOf: URL(fileURLWithPath: savePath!), display: true) { document, documentWasAlreadyOpen, error in
+                if error != nil {
+                    NSApp.presentError(error!)
+                    return
+                }
+            }
+        }
+    }
+    
+    func fetchUniquePath(_ originalPath: String) -> String {
+        var path = originalPath
+        let dManager = FileManager.default
+        if !dManager.fileExists(atPath: path) {
+            if path.extension.count < 1 {
+                path = path.stringByAppendingPathExtension("pdf")
+            }
+            return path
+        } else {
+            let originalFullFileName = path.lastPathComponent
+            let originalFileName = path.lastPathComponent.deletingPathExtension.lastPathComponent
+            let originalExtension = path.extension
+
+            let startIndex: Int = 0
+            let endIndex: Int = startIndex + originalPath.count - originalFullFileName.count - 1
+            let fileLocatePath = originalPath.substring(to: endIndex)
+            var i = 1
+            while (1 != 0) {
+                var newName = String(format: "%@%ld", originalFileName, i)
+                newName = String(format: "%@%@", newName, originalExtension)
+                let newPath = fileLocatePath.stringByAppendingPathComponent(newName)
+                if !dManager.fileExists(atPath: newPath) {
+                    return newPath
+                } else {
+                    i+=1
+                    continue
+                }
+            }
+        }
+    }
+    
+    func fetchDifferentFilePath(filePath: String) -> String {
+        var resultFilePath = filePath
+        var index: Int = 0
+        while (FileManager.default.fileExists(atPath: resultFilePath)) {
+            index += 1
+            let path = NSString(string: filePath).deletingPathExtension + "(" + String(index) + ")"
+            resultFilePath = NSString(string: path).appendingPathExtension(NSString(string: filePath).pathExtension)!
+        }
+        
+        return resultFilePath;
+    }
+    
+    func openFile(withFilePath path: URL) -> Void {
+        let type = path.pathExtension.lowercased()
+        if (type == "pdf") {
+            if !path.path.isPDFValid() {
+                let alert = NSAlert()
+                alert.alertStyle = .critical
+                alert.messageText = NSLocalizedString("This file format is not supported, please drag in PDF, picture, Office format files", comment: "")
+                alert.runModal()
+                return
+            }
+            NSDocumentController.shared.openDocument(withContentsOf: path, display: true) { document, documentWasAlreadyOpen, error in
+                if error != nil {
+                    NSApp.presentError(error!)
+                    return
+                }
+            }
+        } else if (type == "jpg") ||
+                  (type == "cur") ||
+                  (type == "bmp") ||
+                  (type == "jpeg") ||
+                  (type == "gif") ||
+                  (type == "png") ||
+                  (type == "tiff") ||
+                  (type == "tif") ||
+                  (type == "ico") ||
+                  (type == "icns") ||
+                  (type == "tga") ||
+                  (type == "psd") ||
+                  (type == "eps") ||
+                  (type == "hdr") ||
+                  (type == "jp2") ||
+                  (type == "jpc") ||
+                  (type == "pict") ||
+                  (type == "sgi") ||
+                  (type == "heic") {
+            openImageFile(url: path)
+        } else if (type == "doc") ||
+                  (type == "docx") ||
+                  (type == "xls") ||
+                  (type == "xlsx") ||
+                  (type == "ppt") ||
+                  (type == "pptx") ||
+                  (type == "pptx") {
+            let fileName: NSString = String(format: "%@.pdf", NSLocalizedString("Untitled", comment: "")) as NSString
+            let savePath = fetchUniquePath(fileName.kUrlToPDFFolderPath())
+            openOfficeFile(url: path)
+        }
+    }
+    
+    // MARK: Action
+    
+    @IBAction func createPDFAction(_ sender: NSButton) {
+        let tag = sender.tag;
+        if tag == 0 {
+            // New From Files
+            self.openSupportPDFButtonAction()
+        } else if tag == 1 {
+            // New Blank Page
+            self.openBlankPage("")
+        } else if tag == 2 {
+            // Import From Scanner
+            self.importFromScanner("")
+        }
+    }
+    
+    func openPDFButtonAction() {
+        let openPanel = NSOpenPanel()
+        openPanel.allowedFileTypes = ["pdf", "PDF"]
+        openPanel.allowsMultipleSelection = true
+        openPanel.beginSheetModal(for: self.view.window!) { result in
+            if result == .OK {
+                for url in openPanel.urls {
+                    if !url.path.isPDFValid() {
+                        let alert = NSAlert()
+                        alert.alertStyle = .critical
+                        alert.messageText = NSLocalizedString("An error occurred while opening this document. The file is damaged and could not be repaired.", comment: "")
+                        alert.runModal()
+                    } else {
+                        NSDocumentController.shared.openDocument(withContentsOf: url, display: true) { document, documentWasAlreadyOpen, error in
+                            if error != nil {
+                                NSApp.presentError(error!)
+                            } else {
+                                
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+    
+    func openSupportPDFButtonAction() {
+        let openPanel = NSOpenPanel()
+        openPanel.allowedFileTypes = ["pdf", "PDF", "jpg", "cur", "bmp", "jpeg", "gif", "png", "tiff", "tif", "ico", "icns", "tga", "psd", "eps", "hdr", "jp2", "jpc", "pict", "sgi", "heic", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "pptx"]
+        openPanel.allowsMultipleSelection = true
+        
+        var window = self.view.window
+        if (window == nil) {
+            window = NSApp.mainWindow
+        }
+        openPanel.beginSheetModal(for: window!) { [self] result in
+            if result == .OK {
+                var imageUrl: [URL] = []
+                for url in openPanel.urls {
+                    let type = url.pathExtension.lowercased()
+                    if (type == "pdf" || type == "PDF") {
+                        if !url.path.isPDFValid() {
+                            let alert = NSAlert()
+                            alert.alertStyle = .critical
+                            alert.messageText = NSLocalizedString("An error occurred while opening this document. The file is damaged and could not be repaired.", comment: "")
+                            alert.runModal()
+                        } else {
+                            NSDocumentController.shared.openDocument(withContentsOf: url, display: true) { document, documentWasAlreadyOpen, error in
+                                if error != nil {
+                                    NSApp.presentError(error!)
+                                    return
+                                }
+                            }
+                        }
+                    } else if (type == "jpg") ||
+                                (type == "cur") ||
+                                (type == "bmp") ||
+                                (type == "jpeg") ||
+                                (type == "gif") ||
+                                (type == "png") ||
+                                (type == "tiff") ||
+                                (type == "tif") ||
+                                (type == "ico") ||
+                                (type == "icns") ||
+                                (type == "tga") ||
+                                (type == "psd") ||
+                                (type == "eps") ||
+                                (type == "hdr") ||
+                                (type == "jp2") ||
+                                (type == "jpc") ||
+                                (type == "pict") ||
+                                (type == "sgi") ||
+                                (type == "heic") {
+                        openImageFile(url: url)
+                    } else if (type == "doc") ||
+                                (type == "docx") ||
+                                (type == "xls") ||
+                                (type == "xlsx") ||
+                                (type == "ppt") ||
+                                (type == "pptx") ||
+                                (type == "pptx") {
+                        self.openOfficeFile(url: url)
+                    }
+                }
+            }
+        }
+    }
+    
+    @IBAction func openBlankPage(_ sender: Any) {
+        let fileName: NSString = String(format: "%@.pdf", NSLocalizedString("Untitled", comment: "")) as NSString
+        let savePath = fetchUniquePath(fileName.kUrlToPDFFolderPath())
+        let pdfDocument = CPDFDocument()
+        pdfDocument?.insertPage(CGSize(width: 595, height: 842), at: 0)
+        pdfDocument?.write(to: URL(fileURLWithPath: savePath))
+        NSDocumentController.shared.openDocument(withContentsOf: URL(fileURLWithPath: savePath), display: true) { document, documentWasAlreadyOpen, error in
+            if error != nil {
+                NSApp.presentError(error!)
+            } else {
+                if document is KMMainDocument {
+                    let newDocument = document
+                    (newDocument as! KMMainDocument).isNewCreated = true
+                }
+            }
+        }
+    }
+    
+    @IBAction func importFromScanner(_ sender: Any) {
+        deviceBrowserWC = KMDeviceBrowserWindowController.init(windowNibName: "KMDeviceBrowserWindowController")
+        deviceBrowserWC!.type = .scanner
+        deviceBrowserWC!.importScannerFileCallback = { [unowned self](url: NSURL) -> Void in
+            openFile(withFilePath: url as URL)
+        }
+        deviceBrowserWC!.showWindow(NSApp.mainWindow)
+    }
+
+}

+ 330 - 0
PDF Office/PDF Master/Class/Home/ViewController/KMAIOpenPDFFilesVC.xib

@@ -0,0 +1,330 @@
+<?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="KMAIOpenPDFFilesVC" customModule="PDF_Master" customModuleProvider="target">
+            <connections>
+                <outlet property="creatPDFLabel" destination="ymv-tl-S9B" id="qbX-IF-uF5"/>
+                <outlet property="importFromScannerImageView" destination="ZkD-G1-ufi" id="q7O-PU-MPZ"/>
+                <outlet property="importFromScannerLabel" destination="6VI-X2-0F4" id="zsM-J0-dFn"/>
+                <outlet property="newBlankPageImageView" destination="vaH-Gg-RE3" id="tJh-vm-5gT"/>
+                <outlet property="newBlankPageLabel" destination="8tw-6D-nG5" id="QDW-PG-c2Q"/>
+                <outlet property="newFromFilesImageView" destination="Vo2-Q5-D0s" id="37d-ie-cRN"/>
+                <outlet property="newFromFilesLabel" destination="7DP-8M-cyh" id="Q2C-GS-eLy"/>
+                <outlet property="openPDFFilesImageView" destination="G8R-Cd-sSC" id="FHu-Vv-wv5"/>
+                <outlet property="openPDFFilesLabel" destination="Kwa-7o-t9g" id="Kep-vK-wn3"/>
+                <outlet property="orDropFilesHereToOpenLabel" destination="Q7o-W4-U5i" id="h2T-uH-eYa"/>
+                <outlet property="selectYourFilesBox" destination="mEy-Af-9bc" id="Pvw-gR-WHT"/>
+                <outlet property="selectYourFilesImageView" destination="iFo-5S-2e6" id="4kU-cr-GPX"/>
+                <outlet property="selectYourFilesLabel" destination="I4g-Mc-xZP" id="tUp-Vx-QnG"/>
+                <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <customView id="Hz6-mo-xeY">
+            <rect key="frame" x="0.0" y="0.0" width="858" height="388"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+            <subviews>
+                <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="rkU-6X-4PB">
+                    <rect key="frame" x="498" y="40" width="328" height="308"/>
+                    <view key="contentView" id="ITd-Xp-Gda">
+                        <rect key="frame" x="0.0" y="0.0" width="328" height="308"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ymv-tl-S9B">
+                                <rect key="frame" x="-2" y="280" width="332" height="28"/>
+                                <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="OvS-AE-U4f">
+                                    <font key="font" usesAppearanceFont="YES"/>
+                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                </textFieldCell>
+                            </textField>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="ijL-7x-C3M" customClass="KMDottedLineView" customModule="PDF_Master" customModuleProvider="target">
+                                <rect key="frame" x="0.0" y="184" width="328" height="80"/>
+                                <subviews>
+                                    <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Vo2-Q5-D0s">
+                                        <rect key="frame" x="20" y="16" width="48" height="48"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="48" id="8Ym-SH-ivV"/>
+                                            <constraint firstAttribute="width" constant="48" id="fBS-XU-A42"/>
+                                        </constraints>
+                                        <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="lUO-YD-f4Y"/>
+                                    </imageView>
+                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="7DP-8M-cyh">
+                                        <rect key="frame" x="78" y="32" width="240" height="16"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="gOr-jf-tVk">
+                                            <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>
+                                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="DEy-Ef-iCj">
+                                        <rect key="frame" x="0.0" y="0.0" width="328" height="80"/>
+                                        <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="FZ7-cc-TD5">
+                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                            <font key="font" metaFont="system"/>
+                                        </buttonCell>
+                                        <connections>
+                                            <action selector="createPDFAction:" target="-2" id="W0r-RG-SA2"/>
+                                        </connections>
+                                    </button>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstAttribute="trailing" secondItem="DEy-Ef-iCj" secondAttribute="trailing" id="BYg-Aa-pMY"/>
+                                    <constraint firstItem="Vo2-Q5-D0s" firstAttribute="leading" secondItem="ijL-7x-C3M" secondAttribute="leading" constant="20" id="ETn-NS-NXm"/>
+                                    <constraint firstItem="7DP-8M-cyh" firstAttribute="centerY" secondItem="Vo2-Q5-D0s" secondAttribute="centerY" id="M0g-jT-3zD"/>
+                                    <constraint firstItem="Vo2-Q5-D0s" firstAttribute="centerY" secondItem="ijL-7x-C3M" secondAttribute="centerY" id="QIl-f0-44d"/>
+                                    <constraint firstItem="7DP-8M-cyh" firstAttribute="leading" secondItem="Vo2-Q5-D0s" secondAttribute="trailing" constant="12" id="SMD-pT-ftc"/>
+                                    <constraint firstItem="DEy-Ef-iCj" firstAttribute="leading" secondItem="ijL-7x-C3M" secondAttribute="leading" id="Ssa-jr-qXP"/>
+                                    <constraint firstAttribute="bottom" secondItem="DEy-Ef-iCj" secondAttribute="bottom" id="fmy-lk-2Zg"/>
+                                    <constraint firstItem="DEy-Ef-iCj" firstAttribute="top" secondItem="ijL-7x-C3M" secondAttribute="top" id="kNW-jZ-PDY"/>
+                                    <constraint firstAttribute="trailing" secondItem="7DP-8M-cyh" secondAttribute="trailing" constant="12" id="kfj-jg-P6K"/>
+                                    <constraint firstAttribute="height" constant="80" id="ou6-ig-yyC"/>
+                                </constraints>
+                            </customView>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="Lt3-8t-GUS" customClass="KMDottedLineView" customModule="PDF_Master" customModuleProvider="target">
+                                <rect key="frame" x="0.0" y="92" width="328" height="80"/>
+                                <subviews>
+                                    <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="vaH-Gg-RE3">
+                                        <rect key="frame" x="20" y="16" width="48" height="48"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="48" id="HSW-dT-BpZ"/>
+                                            <constraint firstAttribute="width" constant="48" id="rS9-IK-oQJ"/>
+                                        </constraints>
+                                        <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="hSo-f9-vaK"/>
+                                    </imageView>
+                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8tw-6D-nG5">
+                                        <rect key="frame" x="78" y="32" width="240" height="16"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="UbN-Sa-wRR">
+                                            <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>
+                                    <button verticalHuggingPriority="750" tag="1" translatesAutoresizingMaskIntoConstraints="NO" id="eB0-YT-Ld7">
+                                        <rect key="frame" x="0.0" y="0.0" width="328" height="80"/>
+                                        <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="kPc-Fw-cKJ">
+                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                            <font key="font" metaFont="system"/>
+                                        </buttonCell>
+                                        <connections>
+                                            <action selector="createPDFAction:" target="-2" id="SoH-HX-tJg"/>
+                                        </connections>
+                                    </button>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="vaH-Gg-RE3" firstAttribute="centerY" secondItem="Lt3-8t-GUS" secondAttribute="centerY" id="3d0-89-07d"/>
+                                    <constraint firstAttribute="trailing" secondItem="8tw-6D-nG5" secondAttribute="trailing" constant="12" id="A30-ej-fqs"/>
+                                    <constraint firstItem="vaH-Gg-RE3" firstAttribute="leading" secondItem="Lt3-8t-GUS" secondAttribute="leading" constant="20" id="BnA-Ys-gGJ"/>
+                                    <constraint firstAttribute="trailing" secondItem="eB0-YT-Ld7" secondAttribute="trailing" id="CLD-fp-ALu"/>
+                                    <constraint firstItem="8tw-6D-nG5" firstAttribute="centerY" secondItem="vaH-Gg-RE3" secondAttribute="centerY" id="JbY-mJ-BfE"/>
+                                    <constraint firstItem="eB0-YT-Ld7" firstAttribute="top" secondItem="Lt3-8t-GUS" secondAttribute="top" id="cs4-6i-IOY"/>
+                                    <constraint firstItem="8tw-6D-nG5" firstAttribute="leading" secondItem="vaH-Gg-RE3" secondAttribute="trailing" constant="12" id="nyG-wP-6Bg"/>
+                                    <constraint firstAttribute="height" constant="80" id="rbU-Sa-9j0"/>
+                                    <constraint firstItem="eB0-YT-Ld7" firstAttribute="leading" secondItem="Lt3-8t-GUS" secondAttribute="leading" id="w2C-sb-Ue3"/>
+                                    <constraint firstAttribute="bottom" secondItem="eB0-YT-Ld7" secondAttribute="bottom" id="y8K-sB-B0c"/>
+                                </constraints>
+                            </customView>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="sWW-D6-Ohy" customClass="KMDottedLineView" customModule="PDF_Master" customModuleProvider="target">
+                                <rect key="frame" x="0.0" y="0.0" width="328" height="80"/>
+                                <subviews>
+                                    <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="ZkD-G1-ufi">
+                                        <rect key="frame" x="20" y="16" width="48" height="48"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="48" id="OEz-Oc-Cfu"/>
+                                            <constraint firstAttribute="width" constant="48" id="tSy-XU-d6c"/>
+                                        </constraints>
+                                        <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="Yd6-Gu-GJW"/>
+                                    </imageView>
+                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="6VI-X2-0F4">
+                                        <rect key="frame" x="78" y="32" width="240" height="16"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="wph-cO-qrj">
+                                            <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>
+                                    <button verticalHuggingPriority="750" tag="2" translatesAutoresizingMaskIntoConstraints="NO" id="0sY-bd-bsz">
+                                        <rect key="frame" x="0.0" y="0.0" width="328" height="80"/>
+                                        <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="vZ0-SU-FIM">
+                                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                            <font key="font" metaFont="system"/>
+                                        </buttonCell>
+                                        <connections>
+                                            <action selector="createPDFAction:" target="-2" id="9kk-Ac-RrI"/>
+                                        </connections>
+                                    </button>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="0sY-bd-bsz" firstAttribute="top" secondItem="sWW-D6-Ohy" secondAttribute="top" id="0TE-FK-alr"/>
+                                    <constraint firstItem="ZkD-G1-ufi" firstAttribute="leading" secondItem="sWW-D6-Ohy" secondAttribute="leading" constant="20" id="5Ca-CA-YqH"/>
+                                    <constraint firstAttribute="trailing" secondItem="6VI-X2-0F4" secondAttribute="trailing" constant="12" id="BiY-n7-BXI"/>
+                                    <constraint firstItem="ZkD-G1-ufi" firstAttribute="centerY" secondItem="sWW-D6-Ohy" secondAttribute="centerY" id="JH7-st-J0e"/>
+                                    <constraint firstItem="6VI-X2-0F4" firstAttribute="leading" secondItem="ZkD-G1-ufi" secondAttribute="trailing" constant="12" id="MM9-TH-Z3i"/>
+                                    <constraint firstAttribute="height" constant="80" id="NUE-4N-0CP"/>
+                                    <constraint firstItem="0sY-bd-bsz" firstAttribute="leading" secondItem="sWW-D6-Ohy" secondAttribute="leading" id="QfC-vG-Be7"/>
+                                    <constraint firstAttribute="trailing" secondItem="0sY-bd-bsz" secondAttribute="trailing" id="Uuv-oN-sem"/>
+                                    <constraint firstAttribute="bottom" secondItem="0sY-bd-bsz" secondAttribute="bottom" id="YMZ-aA-P1j"/>
+                                    <constraint firstItem="6VI-X2-0F4" firstAttribute="centerY" secondItem="ZkD-G1-ufi" secondAttribute="centerY" id="kCa-nz-cJA"/>
+                                </constraints>
+                            </customView>
+                        </subviews>
+                        <constraints>
+                            <constraint firstItem="ymv-tl-S9B" firstAttribute="leading" secondItem="ITd-Xp-Gda" secondAttribute="leading" id="0pQ-QG-Bkp"/>
+                            <constraint firstAttribute="trailing" secondItem="sWW-D6-Ohy" secondAttribute="trailing" id="16k-gk-5gO"/>
+                            <constraint firstAttribute="trailing" secondItem="ijL-7x-C3M" secondAttribute="trailing" id="1Br-pP-mqt"/>
+                            <constraint firstItem="Lt3-8t-GUS" firstAttribute="leading" secondItem="ITd-Xp-Gda" secondAttribute="leading" id="Acx-mM-6Id"/>
+                            <constraint firstAttribute="trailing" secondItem="Lt3-8t-GUS" secondAttribute="trailing" id="Bs6-9V-Bva"/>
+                            <constraint firstItem="Lt3-8t-GUS" firstAttribute="top" secondItem="ijL-7x-C3M" secondAttribute="bottom" constant="12" id="CZV-j3-Dd3"/>
+                            <constraint firstItem="sWW-D6-Ohy" firstAttribute="top" secondItem="Lt3-8t-GUS" secondAttribute="bottom" constant="12" id="HAu-Rr-Jh6"/>
+                            <constraint firstItem="ijL-7x-C3M" firstAttribute="top" secondItem="ymv-tl-S9B" secondAttribute="bottom" constant="16" id="HG9-FX-xMS"/>
+                            <constraint firstItem="ijL-7x-C3M" firstAttribute="leading" secondItem="ITd-Xp-Gda" secondAttribute="leading" id="KZm-39-nw1"/>
+                            <constraint firstItem="sWW-D6-Ohy" firstAttribute="leading" secondItem="ITd-Xp-Gda" secondAttribute="leading" id="POY-aw-77z"/>
+                            <constraint firstAttribute="bottom" secondItem="sWW-D6-Ohy" secondAttribute="bottom" id="PcU-Ej-014"/>
+                            <constraint firstAttribute="trailing" secondItem="ymv-tl-S9B" secondAttribute="trailing" id="T7c-KN-RfV"/>
+                            <constraint firstItem="ymv-tl-S9B" firstAttribute="top" secondItem="ITd-Xp-Gda" secondAttribute="top" id="hoW-km-0Fa"/>
+                        </constraints>
+                    </view>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="308" id="Gbw-1F-7Pn"/>
+                        <constraint firstAttribute="width" constant="328" id="Q9u-eS-ZxW"/>
+                    </constraints>
+                </box>
+                <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="0Nz-PR-SKo">
+                    <rect key="frame" x="32" y="40" width="446" height="308"/>
+                    <view key="contentView" id="Ccx-6r-SYL">
+                        <rect key="frame" x="0.0" y="0.0" width="446" height="308"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Kwa-7o-t9g">
+                                <rect key="frame" x="-2" y="292" width="450" height="16"/>
+                                <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="5x9-0z-eD5">
+                                    <font key="font" usesAppearanceFont="YES"/>
+                                    <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                    <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                </textFieldCell>
+                            </textField>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="VFW-vA-QSU" customClass="KMDottedLineView" customModule="PDF_Master" customModuleProvider="target">
+                                <rect key="frame" x="0.0" y="0.0" width="446" height="264"/>
+                                <subviews>
+                                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="PfB-2S-9kQ">
+                                        <rect key="frame" x="73" y="50" width="300" height="182"/>
+                                        <view key="contentView" id="8s4-Gn-uV5">
+                                            <rect key="frame" x="0.0" y="0.0" width="300" height="182"/>
+                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                            <subviews>
+                                                <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="G8R-Cd-sSC">
+                                                    <rect key="frame" x="102" y="86" width="96" height="96"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="width" constant="96" id="Km8-qh-oqS"/>
+                                                        <constraint firstAttribute="height" constant="96" id="mGC-h2-oD3"/>
+                                                    </constraints>
+                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="C4o-sS-qvs"/>
+                                                </imageView>
+                                                <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="mEy-Af-9bc" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
+                                                    <rect key="frame" x="0.0" y="30" width="300" height="48"/>
+                                                    <view key="contentView" id="luV-jz-hgR">
+                                                        <rect key="frame" x="0.0" y="0.0" width="300" height="48"/>
+                                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                        <subviews>
+                                                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="Qrx-RS-sSa">
+                                                                <rect key="frame" x="120" y="0.0" width="61" height="48"/>
+                                                                <subviews>
+                                                                    <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="iFo-5S-2e6">
+                                                                        <rect key="frame" x="0.0" y="16" width="16" height="16"/>
+                                                                        <constraints>
+                                                                            <constraint firstAttribute="width" constant="16" id="cx2-CX-PmH"/>
+                                                                            <constraint firstAttribute="height" constant="16" id="zVt-wS-uIX"/>
+                                                                        </constraints>
+                                                                        <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="qof-kY-hZ2"/>
+                                                                    </imageView>
+                                                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="I4g-Mc-xZP">
+                                                                        <rect key="frame" x="26" y="16" width="37" height="16"/>
+                                                                        <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="XKi-oh-1Z1">
+                                                                            <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="iFo-5S-2e6" firstAttribute="centerY" secondItem="Qrx-RS-sSa" secondAttribute="centerY" id="2z9-lh-VrY"/>
+                                                                    <constraint firstItem="I4g-Mc-xZP" firstAttribute="centerY" secondItem="iFo-5S-2e6" secondAttribute="centerY" id="QLh-JS-ijg"/>
+                                                                    <constraint firstItem="iFo-5S-2e6" firstAttribute="leading" secondItem="Qrx-RS-sSa" secondAttribute="leading" id="gP7-Q5-sIj"/>
+                                                                    <constraint firstAttribute="trailing" secondItem="I4g-Mc-xZP" secondAttribute="trailing" id="qCP-Lf-xOa"/>
+                                                                    <constraint firstItem="I4g-Mc-xZP" firstAttribute="leading" secondItem="iFo-5S-2e6" secondAttribute="trailing" constant="12" id="t5n-fB-rZ5"/>
+                                                                </constraints>
+                                                            </customView>
+                                                        </subviews>
+                                                        <constraints>
+                                                            <constraint firstAttribute="bottom" secondItem="Qrx-RS-sSa" secondAttribute="bottom" id="5UC-QA-YUi"/>
+                                                            <constraint firstItem="Qrx-RS-sSa" firstAttribute="top" secondItem="luV-jz-hgR" secondAttribute="top" id="FqC-Dj-qmG"/>
+                                                            <constraint firstItem="Qrx-RS-sSa" firstAttribute="centerX" secondItem="luV-jz-hgR" secondAttribute="centerX" id="iym-4C-53Z"/>
+                                                        </constraints>
+                                                    </view>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="48" id="wUq-Yy-puD"/>
+                                                    </constraints>
+                                                </box>
+                                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Q7o-W4-U5i">
+                                                    <rect key="frame" x="-2" y="6" width="304" height="16"/>
+                                                    <textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="Label" id="bUi-8C-1tk">
+                                                        <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="mEy-Af-9bc" firstAttribute="leading" secondItem="8s4-Gn-uV5" secondAttribute="leading" id="03b-RK-Gcb"/>
+                                                <constraint firstItem="Q7o-W4-U5i" firstAttribute="top" secondItem="mEy-Af-9bc" secondAttribute="bottom" constant="8" id="7jE-hi-laD"/>
+                                                <constraint firstAttribute="trailing" secondItem="mEy-Af-9bc" secondAttribute="trailing" id="BeV-W1-8IZ"/>
+                                                <constraint firstItem="Q7o-W4-U5i" firstAttribute="leading" secondItem="8s4-Gn-uV5" secondAttribute="leading" id="KNR-vj-lcv"/>
+                                                <constraint firstAttribute="trailing" secondItem="Q7o-W4-U5i" secondAttribute="trailing" id="Y9m-BZ-94Y"/>
+                                                <constraint firstItem="G8R-Cd-sSC" firstAttribute="centerX" secondItem="8s4-Gn-uV5" secondAttribute="centerX" id="fAt-Bg-rUy"/>
+                                                <constraint firstItem="G8R-Cd-sSC" firstAttribute="top" secondItem="8s4-Gn-uV5" secondAttribute="top" id="fUg-cL-oCn"/>
+                                                <constraint firstItem="mEy-Af-9bc" firstAttribute="top" secondItem="G8R-Cd-sSC" secondAttribute="bottom" constant="8" id="pl7-aB-lW1"/>
+                                            </constraints>
+                                        </view>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="182" id="WOq-J5-YdP"/>
+                                            <constraint firstAttribute="width" constant="300" id="g2w-9u-6Lz"/>
+                                        </constraints>
+                                    </box>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="PfB-2S-9kQ" firstAttribute="top" secondItem="VFW-vA-QSU" secondAttribute="top" constant="32" id="2VJ-9o-obs"/>
+                                    <constraint firstAttribute="bottom" secondItem="PfB-2S-9kQ" secondAttribute="bottom" constant="50" id="g46-lD-3WT"/>
+                                    <constraint firstItem="PfB-2S-9kQ" firstAttribute="centerX" secondItem="VFW-vA-QSU" secondAttribute="centerX" id="hMw-ON-9Mn"/>
+                                </constraints>
+                            </customView>
+                        </subviews>
+                        <constraints>
+                            <constraint firstItem="VFW-vA-QSU" firstAttribute="top" secondItem="Ccx-6r-SYL" secondAttribute="top" constant="44" id="5L9-vL-5r8"/>
+                            <constraint firstItem="Kwa-7o-t9g" firstAttribute="top" secondItem="Ccx-6r-SYL" secondAttribute="top" id="JzD-eU-49A"/>
+                            <constraint firstAttribute="bottom" secondItem="VFW-vA-QSU" secondAttribute="bottom" id="KBS-Fs-zpG"/>
+                            <constraint firstAttribute="trailing" secondItem="VFW-vA-QSU" secondAttribute="trailing" id="PWy-a6-GDa"/>
+                            <constraint firstItem="Kwa-7o-t9g" firstAttribute="leading" secondItem="Ccx-6r-SYL" secondAttribute="leading" id="Ub5-b3-ukL"/>
+                            <constraint firstItem="VFW-vA-QSU" firstAttribute="leading" secondItem="Ccx-6r-SYL" secondAttribute="leading" id="aPv-hJ-Zwr"/>
+                            <constraint firstAttribute="trailing" secondItem="Kwa-7o-t9g" secondAttribute="trailing" id="cyk-wk-nOk"/>
+                        </constraints>
+                    </view>
+                </box>
+            </subviews>
+            <constraints>
+                <constraint firstItem="0Nz-PR-SKo" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="32" id="1yT-Xh-eRe"/>
+                <constraint firstItem="rkU-6X-4PB" firstAttribute="leading" secondItem="0Nz-PR-SKo" secondAttribute="trailing" constant="20" id="9hS-v6-iJ6"/>
+                <constraint firstAttribute="trailing" secondItem="rkU-6X-4PB" secondAttribute="trailing" constant="32" id="IdV-ca-59L"/>
+                <constraint firstAttribute="bottom" secondItem="rkU-6X-4PB" secondAttribute="bottom" constant="40" id="JAT-NW-dZI"/>
+                <constraint firstItem="rkU-6X-4PB" firstAttribute="top" secondItem="0Nz-PR-SKo" secondAttribute="top" id="MeE-TX-R0j"/>
+                <constraint firstItem="rkU-6X-4PB" firstAttribute="bottom" secondItem="0Nz-PR-SKo" secondAttribute="bottom" id="S51-tD-RFN"/>
+                <constraint firstItem="rkU-6X-4PB" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="40" id="XF4-iR-ChB"/>
+            </constraints>
+            <point key="canvasLocation" x="306" y="226"/>
+        </customView>
+    </objects>
+</document>

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

@@ -0,0 +1,446 @@
+//
+//  KMAIRewritingVC.swift
+//  PDF Master
+//
+//  Created by wanjun on 2023/5/22.
+//
+
+import Cocoa
+
+@objc enum KMAIRewritingState : Int {
+    case AIRewriting = 0
+    case AIErrorCorrection
+}
+
+class KMAIRewritingVC: NSViewController {
+
+    @IBOutlet weak var aiRewritingLabel: NSTextField!
+    @IBOutlet weak var aiRewritingSubLabel: NSTextField!
+    @IBOutlet weak var rewritingBox: KMBox!
+    @IBOutlet weak var rewritingLabel: NSTextField!
+    @IBOutlet weak var rewritingButton: NSButton!
+
+    @IBOutlet weak var rewritingTextBox: NSBox!
+    @IBOutlet weak var rewritingTextField: NSTextField!
+    @IBOutlet weak var wordsLabel: NSTextField!
+
+    @IBOutlet weak var resultLabel: NSTextField!
+    @IBOutlet weak var copyBox: KMBox!
+    @IBOutlet weak var copyLabel: NSTextField!
+    @IBOutlet weak var copyButton: NSButton!
+    
+    @IBOutlet weak var resultTextBox: NSBox!
+    @IBOutlet weak var resultTextView: NSTextView!
+    @IBOutlet weak var emptyImageView: NSImageView!
+    
+    @IBOutlet weak var errorView: NSView!
+    @IBOutlet weak var errorImageView: NSImageView!
+    @IBOutlet weak var errorLabel: NSTextField!
+    
+    var state: KMAIRewritingState = .AIRewriting
+    
+    var _uiState: KMAITranslationState = .None
+    
+    var aiRewritingStr: String = ""
+    var aiErrorCorrectionStr: String = ""
+    var aiRewritingResultStr: String = ""
+    var aiErrorCorrectionResultStr: String = ""
+    var aiRewritingErrorStr: String = ""
+    var aiErrorCorrectionErrorStr: String = ""
+    
+    var progressController: SKProgressController?
+
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        // Do view setup here.
+        
+        self.initLocalization()
+        self.initializeUI()
+    }
+    
+    // MARK: initialize
+    
+    func initializeUI() -> Void {
+        self.aiRewritingLabel.textColor = NSColor(hex: "#252629")
+        self.aiRewritingLabel.font = NSFont.SFProTextSemibold(20.0)
+        self.aiRewritingSubLabel.textColor = NSColor(hex: "#94989C")
+        self.aiRewritingSubLabel.font = NSFont.SFProTextRegular(14.0)
+        self.rewritingBox.fillColor = NSColor(hex: "#BDDFFD")
+        self.rewritingBox.cornerRadius = 4.0
+        self.rewritingLabel.textColor = NSColor(hex: "#F7F8FA")
+        self.rewritingLabel.font = NSFont.SFProTextRegular(14.0)
+        self.rewritingTextBox.borderColor = NSColor(hex: "#1770F4")
+        self.wordsLabel.textColor = NSColor(hex: "#94989C")
+        self.wordsLabel.font = NSFont.SFProTextRegular(14.0)
+
+        self.resultLabel.textColor = NSColor(hex: "#252629")
+        self.resultLabel.font = NSFont.SFProTextSemibold(20.0)
+        self.copyBox.borderColor = NSColor(hex: "#DFE1E5")
+        self.copyBox.fillColor = NSColor(hex: "#EDEEF0")
+        self.copyBox.cornerRadius = 4.0
+        self.copyBox.borderWidth = 1.0
+        self.copyLabel.textColor = NSColor(hex: "#B1B3B8")
+        self.copyLabel.font = NSFont.SFProTextRegular(14.0)
+        self.resultTextBox.borderColor = NSColor(hex: "#DFE1E5")
+        
+        self.errorView.isHidden = true
+        self.errorImageView.image = NSImage(named: "icon_error")
+        self.errorLabel.textColor = NSColor(hex: "#F3465B")
+        self.errorLabel.font = NSFont.SFProTextRegular(12.0)
+        
+//        if self.state == .AIRewriting {
+//            self.emptyImageView.image = NSImage(named: "ic_ai_rewriting_empty")
+//        } else if self.state == .AIErrorCorrection {
+//            self.emptyImageView.image = NSImage(named: "ic_ai_ErrorCorrection_empty")
+//        }
+    }
+    
+    func initLocalization() -> Void {
+        switch self.state {
+        case .AIRewriting:
+            self.aiRewritingLabel.stringValue = NSLocalizedString("AI Rewriting", comment: "")
+            self.aiRewritingSubLabel.stringValue = NSLocalizedString("Limited to 150 characters per session, 5 times per month", comment: "")
+            self.rewritingLabel.stringValue = NSLocalizedString("Rewrite", comment: "")
+            self.resultLabel.stringValue = NSLocalizedString("Result", comment: "")
+            self.copyLabel.stringValue = NSLocalizedString("Copy", comment: "")
+            self.rewritingTextField.placeholderString = NSLocalizedString("Please enter text content here...", comment: "")
+            self.wordsLabel.stringValue = NSLocalizedString("0/150", comment: "")
+            self.rewritingTextField.stringValue = self.aiRewritingStr
+            self.resultTextView.string = self.aiRewritingResultStr
+            self.emptyImageView.image = NSImage(named: "ic_ai_rewriting_empty")
+            break
+        case .AIErrorCorrection:
+            self.aiRewritingLabel.stringValue = NSLocalizedString("AI Error Correction", comment: "")
+            self.aiRewritingSubLabel.stringValue = NSLocalizedString("Limited to 150 characters per session, 5 times per month", comment: "")
+            self.rewritingLabel.stringValue = NSLocalizedString("Correct", comment: "")
+            self.resultLabel.stringValue = NSLocalizedString("Result", comment: "")
+            self.copyLabel.stringValue = NSLocalizedString("Copy", comment: "")
+            self.rewritingTextField.placeholderString = NSLocalizedString("Please enter text content here...", comment: "")
+            self.wordsLabel.stringValue = NSLocalizedString("0/150", comment: "")
+            self.rewritingTextField.stringValue = self.aiErrorCorrectionStr
+            self.resultTextView.string = self.aiErrorCorrectionResultStr
+            self.emptyImageView.image = NSImage(named: "ic_ai_ErrorCorrection_empty")
+            break
+        default:
+            break
+        }
+    }
+    
+    // MARK: Get、Set
+    
+    var uiState: KMAITranslationState {
+        get {
+            return _uiState
+        }
+        set {
+            _uiState = newValue
+            
+            self.refreshAIUI()
+        }
+    }
+    
+    // MARK: Private Methods
+
+    func refreshAIUI() -> Void {
+        self.wordsLabel.stringValue = String(format: "%d/150", self.rewritingTextField.stringValue.count)
+        self.copyLabel.stringValue = NSLocalizedString("Copy", comment: "")
+
+        if self.uiState == .CanAIRewriting || self.uiState == .CanAIErrorCorrection {
+            self.rewritingBox.fillColor = NSColor(hex: "#1770F4")
+            self.rewritingBox.borderWidth = 0.0
+            self.rewritingLabel.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.wordsLabel.textColor = NSColor(hex: "#94989C")
+            self.resultTextBox.fillColor = NSColor(hex: "#FFFFFF")
+            self.resultTextBox.borderWidth = 1.0
+            self.rewritingBox.borderColor = NSColor(hex: "#DFE1E5")
+            self.emptyImageView.isHidden = false
+            self.errorView.isHidden = true
+        } else if self.uiState == .CanCopy {
+            self.rewritingBox.fillColor = NSColor(hex: "#1770F4")
+            self.rewritingBox.borderWidth = 0.0
+            self.rewritingLabel.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.wordsLabel.textColor = NSColor(hex: "#94989C")
+            self.resultTextBox.fillColor = NSColor(hex: "#FFFFFF")
+            self.resultTextBox.borderWidth = 1.0
+            self.rewritingBox.borderColor = NSColor(hex: "#DFE1E5")
+            self.emptyImageView.isHidden = true
+            self.errorView.isHidden = true
+        } else if self.uiState == .Copyed {
+            self.rewritingBox.fillColor = NSColor(hex: "#1770F4")
+            self.rewritingBox.borderWidth = 0.0
+            self.rewritingLabel.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.wordsLabel.textColor = NSColor(hex: "#94989C")
+            self.resultTextBox.fillColor = NSColor(hex: "#FFFFFF")
+            self.resultTextBox.borderWidth = 1.0
+            self.rewritingBox.borderColor = NSColor(hex: "#DFE1E5")
+            self.emptyImageView.isHidden = true
+            self.errorView.isHidden = true
+        } else if self.uiState == .Exceed { // 是否超过
+            self.rewritingBox.fillColor = NSColor(hex: "#1770F4")
+            self.rewritingBox.borderWidth = 0.0
+            self.rewritingLabel.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.wordsLabel.textColor = NSColor(hex: "#F3465B")
+            self.resultTextBox.fillColor = NSColor(hex: "#FFFFFF")
+            self.resultTextBox.borderWidth = 1.0
+            self.rewritingBox.borderColor = NSColor(hex: "#F3465B")
+            self.emptyImageView.isHidden = true
+            self.errorView.isHidden = false
+            self.errorLabel.stringValue = NSLocalizedString("Limit to 150 characters at a time", comment: "")
+        } else if self.uiState == .Error {
+            self.rewritingBox.fillColor = NSColor(hex: "#1770F4")
+            self.rewritingBox.borderWidth = 0.0
+            self.rewritingLabel.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")
+            if self.rewritingTextField.stringValue.count > 150 {
+                self.wordsLabel.textColor = NSColor(hex: "#F3465B")
+            } else {
+                self.wordsLabel.textColor = NSColor(hex: "#94989C")
+            }
+            self.resultTextBox.fillColor = NSColor(hex: "#FFFFFF")
+            self.resultTextBox.borderWidth = 1.0
+            self.rewritingBox.borderColor = NSColor(hex: "#F3465B")
+            self.emptyImageView.isHidden = true
+            self.errorView.isHidden = false
+            if self.state == .AIRewriting {
+                self.errorLabel.stringValue = self.aiRewritingErrorStr
+            } else if self.state == .AIErrorCorrection {
+                self.errorLabel.stringValue = self.aiErrorCorrectionErrorStr
+            }
+        } else {
+            self.rewritingBox.fillColor = NSColor(hex: "#BDDFFD")
+            self.rewritingBox.borderWidth = 0.0
+            self.rewritingLabel.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.wordsLabel.textColor = NSColor(hex: "#94989C")
+            self.resultTextBox.fillColor = NSColor(hex: "#FFFFFF")
+            self.resultTextBox.borderWidth = 1.0
+            self.rewritingBox.borderColor = NSColor(hex: "#DFE1E5")
+            self.emptyImageView.isHidden = false
+            self.errorView.isHidden = true
+        }
+    }
+    
+    func acquisition_uiState() -> Void {
+        if self.state == .AIRewriting {
+            if (self.aiRewritingStr.count > 0) && (self.aiRewritingResultStr.count > 0) {
+                let pasteboard = NSPasteboard.general
+                if pasteboard.string(forType: .string) != nil {
+                    if pasteboard.string(forType: .string)!.count > 0 {
+                        if pasteboard.string(forType: .string)! == self.aiRewritingResultStr {
+                            self.uiState = .Copyed
+                        } else {
+                            self.uiState = .CanCopy
+                        }
+                    } else {
+                        self.uiState = .CanCopy
+                    }
+                } else {
+                    self.uiState = .CanCopy
+                }
+            } else if (self.aiRewritingStr.count > 0) {
+                if self.aiRewritingStr.count > 150 {
+                    self.uiState = .Exceed
+                } else {
+                    self.uiState = .CanAIRewriting
+                }
+            } else {
+                if self.aiRewritingErrorStr.count > 0 {
+                    self.uiState = .Error
+                } else {
+                    self.uiState = .None
+                }
+            }
+        } else if self.state == .AIErrorCorrection {
+            if (self.aiErrorCorrectionStr.count > 0) && (self.aiErrorCorrectionResultStr.count > 0) {
+                let pasteboard = NSPasteboard.general
+                if pasteboard.string(forType: .string) != nil {
+                    if pasteboard.string(forType: .string)!.count > 0 {
+                        if pasteboard.string(forType: .string)! == self.aiErrorCorrectionResultStr {
+                            self.uiState = .Copyed
+                        } else {
+                            self.uiState = .CanCopy
+                        }
+                    } else {
+                        self.uiState = .CanCopy
+                    }
+                } else {
+                    self.uiState = .CanCopy
+                }
+            } else if (self.aiErrorCorrectionStr.count > 0) {
+                if self.aiErrorCorrectionStr.count > 150 {
+                    self.uiState = .Exceed
+                } else {
+                    self.uiState = .CanAIRewriting
+                }
+            } else {
+                if self.aiErrorCorrectionErrorStr.count > 0 {
+                    self.uiState = .Error
+                } else {
+                    self.uiState = .None
+                }
+            }
+        }
+    }
+    
+    func showProgressWindow() {
+        let progress = SKProgressController()
+        if self.state == .AIRewriting {
+            progress.message = NSLocalizedString("Rewriting...", comment: "")
+        } else if self.state == . AIErrorCorrection {
+            progress.message = NSLocalizedString("Error Correcting...", comment: "")
+        }
+        progress.window?.backgroundColor = NSColor(hex: "#36383B")
+        progress.window?.contentView?.wantsLayer = true
+        progress.window?.contentView?.layer?.backgroundColor = NSColor(hex: "#36383B").cgColor
+        progress.progressField.textColor = NSColor.white
+        
+        progress.closeBlock = { [unowned self] in
+            
+        }
+        
+        self.progressController = progress
+        self.view.window?.beginSheet(progress.window!)
+    }
+    
+    func hiddenProgressWindow() {
+        if (self.progressController != nil) {
+            self.view.window?.endSheet((self.progressController?.window)!)
+            self.progressController = nil
+        }
+    }
+    
+    // MARK: Action
+    
+    @IBAction func aiRewritingAction(_ sender: NSButton) {
+        if self.uiState == .CanAIRewriting || self.uiState == .CanAIErrorCorrection || self.uiState == .CanCopy || self.uiState == .Copyed || self.uiState == .Exceed || self.uiState == .Error {
+            if !KMLightMemberManager.manager.isLogin() {
+                KMLoginWindowController.show(window: NSApp.mainWindow!)
+                return
+            }
+
+            self.errorView.isHidden = true
+            DispatchQueue.main.async {
+                self.showProgressWindow()
+            }
+
+            let infoDictionary = Bundle .main.infoDictionary!
+            let majorVersion = infoDictionary["CFBundleShortVersionString"]
+            KMRequestServerManager.manager.aiRewriting(content: self.rewritingTextField.stringValue, version: "1.0.1", state: self.state) { [unowned self] success, result in
+                self.hiddenProgressWindow()
+
+                if success {
+                    let result: NSDictionary = result!.result
+                    self.uiState = .CanCopy
+                    
+                    self.resultTextView.string = ""
+                    self.resultTextView.string =  result["content"] as? String ?? ""
+                    if self.state == .AIRewriting {
+                        self.aiRewritingResultStr = result["content"] as? String ?? ""
+                        self.aiRewritingErrorStr = ""
+                    } else if self.state == .AIErrorCorrection {
+                        self.aiErrorCorrectionResultStr = result["content"] as? String ?? ""
+                        self.aiErrorCorrectionErrorStr = ""
+                    }
+                } else {
+                    let result: String = result!.message
+                    
+                    DispatchQueue.main.async {
+                        self.resultTextView.string = ""
+                        self.errorLabel.stringValue = result
+                        if self.state == .AIRewriting {
+                            self.aiRewritingErrorStr = result
+                        } else if self.state == .AIErrorCorrection {
+                            self.aiErrorCorrectionErrorStr = result
+                        }
+                        self.uiState = .Error
+                    }
+                }
+            }
+        }
+    }
+    
+    @IBAction func copyAction(_ sender: NSButton) {
+        if self.uiState == .CanCopy || self.uiState == .Copyed {
+            if !KMLightMemberManager.manager.isLogin() {
+                KMLoginWindowController.show(window: NSApp.mainWindow!)
+                return
+            }
+
+            let pasteboard = NSPasteboard.general
+            pasteboard.clearContents()
+            pasteboard.setString(self.resultTextView.string, forType: .string)
+            
+            self.uiState = .Copyed
+        }
+    }
+}
+
+extension KMAIRewritingVC: NSTextFieldDelegate {
+    func controlTextDidEndEditing(_ obj: Notification) {
+        let object = obj.object as! NSTextField
+        
+    }
+    
+    func controlTextDidChange(_ obj: Notification) {
+        let object = obj.object as! NSTextField
+        self.wordsLabel.stringValue = String(format: "%d/150", object.stringValue.count)
+        
+        if object.stringValue.count > 0 {
+            if self.state == .AIRewriting {
+                self.uiState = .CanAIRewriting
+            } else if self.state == .AIErrorCorrection {
+                self.uiState = .CanAIErrorCorrection
+            }
+        } else {
+            self.uiState = .None
+        }
+        
+        if object.stringValue.count > 150 {
+            self.uiState = .Exceed
+            if self.state == .AIRewriting {
+                self.aiRewritingErrorStr = NSLocalizedString("Limit to 150 characters at a time", comment: "")
+            } else if self.state == .AIErrorCorrection {
+                self.aiErrorCorrectionErrorStr = NSLocalizedString("Limit to 150 characters at a time", comment: "")
+            }
+        } else {
+            if self.state == .AIRewriting {
+                self.aiRewritingErrorStr = ""
+            } else if self.state == .AIErrorCorrection {
+                self.aiErrorCorrectionErrorStr = ""
+            }
+        }
+        
+        if self.state == .AIRewriting {
+            self.aiRewritingStr = object.stringValue
+            self.aiRewritingResultStr = ""
+            self.resultTextView.string = ""
+        } else if self.state == .AIErrorCorrection {
+            self.aiErrorCorrectionStr = object.stringValue
+            self.aiErrorCorrectionResultStr = ""
+            self.resultTextView.string = ""
+        }
+    }
+
+}

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

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

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

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

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

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

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

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>

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

@@ -580,6 +580,153 @@ extension KMHomeViewController {
         }
     }
     
+    func aiTranslation(withFilePath path: String) -> Void {
+        if !KMLightMemberManager.manager.isLogin() {
+            KMLoginWindowController.show(window: NSApp.mainWindow!)
+            return
+        }
+        
+        let isExceedsLimit = self.isPDFPageCountExceedsLimit(filePath: path)
+        if self.isFileGreaterThan10MB(atPath: path) {
+            self.aiTranslationViewController.errorView.isHidden = false
+            self.aiTranslationViewController.errorLabel.stringValue = NSLocalizedString("The uploaded file size cannot exceed 10MB", comment: "")
+        } else if isExceedsLimit {
+            self.aiTranslationViewController.errorView.isHidden = false
+            self.aiTranslationViewController.errorLabel.stringValue = NSLocalizedString("Documents cannot exceed 30 pages", comment: "")
+        } else {
+            let url = URL(fileURLWithPath: path)
+            if (url.pathExtension == "pdf") || url.pathExtension == "PDF" {
+                if !path.isPDFValid() {
+                    let alert = NSAlert()
+                    alert.alertStyle = .critical
+                    alert.messageText = NSLocalizedString("An error occurred while opening this document. The file is damaged and could not be repaired.", comment: "")
+                    alert.runModal()
+                    return
+                }
+            }
+            let infoDictionary = Bundle .main.infoDictionary!
+             let majorVersion = infoDictionary["CFBundleShortVersionString"]
+            DispatchQueue.main.async {
+                self.showProgressWindow()
+            }
+            
+             KMRequestServerManager.manager.aiTranslationFileUpload(file: path, version: "1.0.1") { [unowned self] success, result in
+                 if success {
+                     let result: NSDictionary = result!.result
+
+                     let fileKey = result["fileKey"]
+                     let fileName = result["fileName"]
+                     let pageCount = result["pageCount"]
+                     if fileKey != nil {
+                         self.fileTranslateHandle(fileKey as! String)
+                     }
+                 } else {
+                     let result: String = result!.message
+
+                     DispatchQueue.main.async {
+                         self.hiddenProgressWindow()
+                         self.aiTranslationViewController.errorView.isHidden = false
+                         self.aiTranslationViewController.errorLabel.stringValue = result
+
+                     }
+                 }
+             }
+        }
+    }
+    
+    func fileTranslateHandle(_ fileKey: String) -> Void {
+        let infoDictionary = Bundle .main.infoDictionary!
+        let majorVersion = infoDictionary["CFBundleShortVersionString"]
+        
+        KMRequestServerManager.manager.aiTranslationFileTranslateHandle(fileKey: fileKey, from: self.aiTranslationViewController.fromStr, to: self.aiTranslationViewController.toStr, version: "1.0.1") { success, result in
+            if success {
+                let result: NSDictionary = result!.result
+
+                let fileUrl: String = result["fileUrl"] as! String
+                let downFileUrl: String = result["downFileUrl"] as! String
+                let ossDownUrl: String = result["ossDownUrl"] as! String
+                let fileName: String = result["fileName"] as! String
+                let downFileName: String = result["downFileName"] as! String
+                let from: String = result["from"] as! String
+                let to: String = result["to"] as! String
+                
+                self.downloadFile(filePath: ossDownUrl, downFileName: downFileName)
+            } else {
+                let result: String = result!.message
+
+                DispatchQueue.main.async {
+                    self.hiddenProgressWindow()
+                    
+                    self.aiTranslationViewController.errorView.isHidden = false
+                    self.aiTranslationViewController.errorLabel.stringValue = result
+                }
+            }
+        }
+    }
+    
+    func downloadFile(filePath: String, downFileName: String) -> Void {
+        guard let fileURL = URL(string: filePath) else {
+            let alert = NSAlert()
+            alert.alertStyle = .critical
+            alert.messageText = NSLocalizedString("Invalid file link", comment: "")
+            alert.runModal()
+
+            return
+        }
+        let destinationURL = FileManager.default.temporaryDirectory.appendingPathComponent(downFileName)
+        if FileManager.default.fileExists(atPath: destinationURL.path) {
+            do {
+                try FileManager.default.removeItem(at: destinationURL)
+                print("删除旧文件成功")
+            } catch {
+                print("删除旧文件失败:\(error)")
+            }
+        }
+        let sessionConfiguration = URLSessionConfiguration.default
+        let session = URLSession(configuration: sessionConfiguration)
+        let downloadTask = session.downloadTask(with: fileURL) { (tempLocalURL, response, error) in
+            if let error = error {
+                let alert = NSAlert()
+                alert.alertStyle = .critical
+                alert.messageText = String(format: "%@:\(error)", NSLocalizedString("Download failed", comment: ""))
+                alert.runModal()
+                
+                return
+            }
+
+            guard let tempLocalURL = tempLocalURL else {
+                let alert = NSAlert()
+                alert.alertStyle = .critical
+                alert.messageText = NSLocalizedString("Invalid temporary directory", comment: "")
+                alert.runModal()
+
+                return
+            }
+            
+            DispatchQueue.main.async {
+                self.hiddenProgressWindow()
+            }
+
+            do {
+                try FileManager.default.moveItem(at: tempLocalURL, to: destinationURL)
+                
+                NSDocumentController.shared.openDocument(withContentsOf: destinationURL, display: true) { document, documentWasAlreadyOpen, error in
+                    if error != nil {
+                        NSApp.presentError(error!)
+                    } else {
+                        
+                    }
+                }
+            } catch {
+                let alert = NSAlert()
+                alert.alertStyle = .critical
+                alert.messageText = String(format: "%@:\(error)", NSLocalizedString("Failed to save file", comment: ""))
+                alert.runModal()
+            }
+        }
+        downloadTask.resume()
+    }
+    
     override func otherMouseDown(with event: NSEvent) {
         if historyFileViewController.selectFiles.count > 0 {
             let eventPoint = event.locationInWindow as NSPoint

+ 5 - 1
PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController+UI.swift

@@ -272,7 +272,11 @@ extension KMHomeViewController: KMPDFToolsViewControllerDelegate {
 
 extension KMHomeViewController: KMHomeDragViewDelegate {
     func homeDragView(_ viewController: KMHomeDragView, filePath: URL) {
-        self.openFile(withFilePath: filePath)
+        if self.aiHomeState == .AITranslation {
+            self.aiTranslation(withFilePath: filePath.path)
+        } else {
+            self.openFile(withFilePath: filePath)
+        }
     }
     
     func homeDragView(_ viewController: KMHomeDragView, notSupport: Bool) {

+ 269 - 4
PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController.swift

@@ -17,6 +17,13 @@ import KMAdvertisement
     case CloudDocuments
 }
 
+@objc enum KMAIHomeToolState : Int {
+    case Home = 0
+    case AITranslation
+    case AIRewriting
+    case AIErrorCorrection
+}
+
 @objcMembers class KMHomeViewController: NSViewController {
 
     @IBOutlet weak var leftBox: NSBox!
@@ -66,6 +73,25 @@ import KMAdvertisement
     
     @IBOutlet weak var dragView: KMHomeDragView!
     
+    // AI 临时UI
+    @IBOutlet weak var aiHomeBox: KMBox!
+    @IBOutlet weak var aiHomeImageView: NSImageView!
+    @IBOutlet weak var aiHomeLabel: NSTextField!
+    @IBOutlet weak var aiTranslationBox: KMBox!
+    @IBOutlet weak var aiTranslationImageView: NSImageView!
+    @IBOutlet weak var aiTranslationLabel: NSTextField!
+    @IBOutlet weak var aiRewritingBox: KMBox!
+    @IBOutlet weak var aiRewritingImageView: NSImageView!
+    @IBOutlet weak var aiRewritingLabel: NSTextField!
+    @IBOutlet weak var aiErrorCorrectionBox: KMBox!
+    @IBOutlet weak var aiErrorCorrectionImageView: NSImageView!
+    @IBOutlet weak var aiErrorCorrectionLabel: NSTextField!
+    @IBOutlet var aiOpenPDFFilesViewController: KMAIOpenPDFFilesVC!
+    @IBOutlet var aiTranslationViewController: KMAITranslationVC!
+    @IBOutlet var aiRewritingViewController: KMAIRewritingVC!
+    
+    var aiHomeState: KMAIHomeToolState = .Home
+    
     let ScrollerViewWidget: CGFloat = 15.0
     
     var homeWindowController : MainWindowController!
@@ -93,6 +119,7 @@ import KMAdvertisement
     var pdfOthersButtonVC: KMTextImageButtonVC!
     var popover: NSPopover?
     var deviceBrowserWC: KMDeviceBrowserWindowController?
+    var progressController: SKProgressController?
 
     override func viewWillAppear() {
         super.viewWillAppear()
@@ -132,11 +159,12 @@ import KMAdvertisement
             self.otherMouseDown(with: aEvent)
             return aEvent
         }
-        self.initNetworkingData()
-        self.initLocalization()
-        self.initializeUI()
+//        self.initNetworkingData()
+//        self.initLocalization()
+//        self.initializeUI()
+        self.initializeUI_DMG()
         
-        refreshUI()
+//        refreshUI()
         
         NotificationCenter.default.addObserver(self, selector: #selector(homeFileRectChange(_:)), name: Notification.Name("KMHomeFileRectChange"), object: nil)
     }
@@ -316,6 +344,118 @@ import KMAdvertisement
         pdfOthersButtonVC.stringValue = NSLocalizedString("Others", comment: "")
     }
     
+    // MARK: Action
+    func initializeUI_DMG() -> Void {
+        rightTopBox.fillColor = .white
+        rightBottomBox.fillColor = .white
+        rightFullBox.fillColor = .white
+
+        self.aiHomeBox.fillColor = .clear
+        self.aiHomeBox.cornerRadius = 8.0
+        self.aiHomeImageView.image = NSImage(named: "icon_home")
+        self.aiHomeLabel.stringValue = NSLocalizedString("Home", comment: "")
+        self.aiHomeLabel.textColor = NSColor(hex: "#252629")
+        self.aiHomeLabel.font = NSFont.SFProTextRegular(16.0)
+        self.aiHomeBox.moveCallback = { [unowned self](mouseEntered: Bool, mouseBox: KMBox) -> Void in
+            if aiHomeState != .Home {
+                if mouseEntered {
+                    self.aiHomeBox.fillColor = NSColor(hex: "#EDEEF0")
+                } else {
+                    self.aiHomeBox.fillColor = .clear
+                }
+            }
+        }
+        self.aiHomeBox.downCallback = { [unowned self](downEntered: Bool, mouseBox: KMBox, event) -> Void in
+            if aiHomeState != .Home {
+                if downEntered {
+                    self.aiHomeState = .Home
+                    
+                    self.refreshAIUI()
+                }
+            }
+        }
+
+        self.aiTranslationBox.fillColor = .clear
+        self.aiTranslationBox.cornerRadius = 8.0
+        self.aiTranslationImageView.image = NSImage(named: "ic_function_other")
+        self.aiTranslationLabel.stringValue = NSLocalizedString("AI Translation", comment: "")
+        self.aiTranslationLabel.textColor = NSColor(hex: "#252629")
+        self.aiTranslationLabel.font = NSFont.SFProTextRegular(16.0)
+        self.aiTranslationBox.moveCallback = { [unowned self](mouseEntered: Bool, mouseBox: KMBox) -> Void in
+            if aiHomeState != .AITranslation {
+                if mouseEntered {
+                    self.aiTranslationBox.fillColor = NSColor(hex: "#EDEEF0")
+                } else {
+                    self.aiTranslationBox.fillColor = .clear
+                }
+            }
+        }
+        self.aiTranslationBox.downCallback = { [unowned self](downEntered: Bool, mouseBox: KMBox, event) -> Void in
+            if aiHomeState != .AITranslation {
+                if downEntered {
+                    self.aiHomeState = .AITranslation
+                    
+                    self.refreshAIUI()
+                }
+            }
+        }
+
+        self.aiRewritingBox.fillColor = .clear
+        self.aiRewritingBox.cornerRadius = 8.0
+        self.aiRewritingImageView.image = NSImage(named: "ic_ai_Rewriting")
+        self.aiRewritingLabel.stringValue = NSLocalizedString("AI Rewriting", comment: "")
+        self.aiRewritingLabel.textColor = NSColor(hex: "#252629")
+        self.aiRewritingLabel.font = NSFont.SFProTextRegular(16.0)
+        self.aiRewritingBox.moveCallback = { [unowned self](mouseEntered: Bool, mouseBox: KMBox) -> Void in
+            if aiHomeState != .AIRewriting {
+                if mouseEntered {
+                    self.aiRewritingBox.fillColor = NSColor(hex: "#EDEEF0")
+                } else {
+                    self.aiRewritingBox.fillColor = .clear
+                }
+            }
+        }
+        self.aiRewritingBox.downCallback = { [unowned self](downEntered: Bool, mouseBox: KMBox, event) -> Void in
+            if aiHomeState != .AIRewriting {
+                if downEntered {
+                    self.aiHomeState = .AIRewriting
+                    
+                    self.refreshAIUI()
+                }
+            }
+        }
+
+        self.aiErrorCorrectionBox.fillColor = .clear
+        self.aiErrorCorrectionBox.cornerRadius = 8.0
+        self.aiErrorCorrectionImageView.image = NSImage(named: "ic_ai_ErrorCorrection")
+        self.aiErrorCorrectionLabel.stringValue = NSLocalizedString("AI Error Correction", comment: "")
+        self.aiErrorCorrectionLabel.textColor = NSColor(hex: "#252629")
+        self.aiErrorCorrectionLabel.font = NSFont.SFProTextRegular(16.0)
+        self.aiErrorCorrectionBox.moveCallback = { [unowned self](mouseEntered: Bool, mouseBox: KMBox) -> Void in
+            if aiHomeState != .AIErrorCorrection {
+                if mouseEntered {
+                    self.aiErrorCorrectionBox.fillColor = NSColor(hex: "#EDEEF0")
+                } else {
+                    self.aiErrorCorrectionBox.fillColor = .clear
+                }
+            }
+        }
+        self.aiErrorCorrectionBox.downCallback = { [unowned self](downEntered: Bool, mouseBox: KMBox, event) -> Void in
+            if aiHomeState != .AIErrorCorrection {
+                if downEntered {
+                    self.aiHomeState = .AIErrorCorrection
+                    
+                    self.refreshAIUI()
+                }
+            }
+        }
+        
+        self.refreshAIUI()
+        
+        historyFileViewController.delete = self
+        dragView.delete = self
+    }
+    
     // MARK: Action
     
     @IBAction func productPromotionButtonAction(_ sender: NSButton) {
@@ -363,6 +503,82 @@ import KMAdvertisement
         cloudDocumentsButtonVC.updateUI()
     }
     
+    func refreshAIUI() -> Void {
+        self.aiHomeBox.fillColor = .clear
+        self.aiHomeLabel.font = NSFont.SFProTextRegular(16.0)
+        self.aiTranslationBox.fillColor = .clear
+        self.aiTranslationLabel.font = NSFont.SFProTextRegular(16.0)
+        self.aiRewritingBox.fillColor = .clear
+        self.aiRewritingLabel.font = NSFont.SFProTextRegular(16.0)
+        self.aiErrorCorrectionBox.fillColor = .clear
+        self.aiErrorCorrectionLabel.font = NSFont.SFProTextRegular(16.0)
+
+        rightFullBox.isHidden = true
+        rightTopBox.isHidden = true
+        rightBottomBox.isHidden = true
+
+        switch self.aiHomeState {
+        case .Home:
+            self.aiHomeBox.fillColor = NSColor(hex: "#1770F4", alpha: 0.1)
+            self.aiHomeLabel.font = NSFont.SFProTextSemibold(16.0)
+            
+            self.rightTopBox.isHidden = false
+            self.rightBottomBox.isHidden = false
+            self.rightTopBox.contentView = self.aiOpenPDFFilesViewController.view
+            self.rightBottomBox.contentView = self.historyFileViewController.view
+            self.rightFullBox.contentView = nil
+            
+            self.rightTopBoxHeightConstraint.constant = 388.0
+            
+            self.dragView.isHidden = false
+            break
+        case .AITranslation:
+            self.aiTranslationBox.fillColor = NSColor(hex: "#1770F4", alpha: 0.1)
+            self.aiTranslationLabel.textColor = NSColor(hex: "#252629")
+            self.aiTranslationLabel.font = NSFont.SFProTextSemibold(16.0)
+
+            self.rightFullBox.isHidden = false
+            self.rightTopBox.contentView = nil
+            self.rightBottomBox.contentView = nil
+            self.rightFullBox.contentView = self.aiTranslationViewController.view
+            
+            self.dragView.isHidden = false
+            break
+        case .AIRewriting:
+            self.aiRewritingBox.fillColor = NSColor(hex: "#1770F4", alpha: 0.1)
+            self.aiRewritingLabel.textColor = NSColor(hex: "#252629")
+            self.aiRewritingLabel.font = NSFont.SFProTextSemibold(16.0)
+
+            self.rightFullBox.isHidden = false
+            self.rightTopBox.contentView = nil
+            self.rightBottomBox.contentView = nil
+            self.rightFullBox.contentView = self.aiRewritingViewController.view
+            self.aiRewritingViewController.state = .AIRewriting
+            self.aiRewritingViewController.initLocalization()
+            self.aiRewritingViewController.acquisition_uiState()
+            
+            self.dragView.isHidden = true
+            break
+        case .AIErrorCorrection:
+            self.aiErrorCorrectionBox.fillColor = NSColor(hex: "#1770F4", alpha: 0.1)
+            self.aiErrorCorrectionLabel.textColor = NSColor(hex: "#252629")
+            self.aiErrorCorrectionLabel.font = NSFont.SFProTextSemibold(16.0)
+
+            self.rightFullBox.isHidden = false
+            self.rightTopBox.contentView = nil
+            self.rightBottomBox.contentView = nil
+            self.rightFullBox.contentView = self.aiRewritingViewController.view
+            self.aiRewritingViewController.state = .AIErrorCorrection
+            self.aiRewritingViewController.initLocalization()
+            self.aiRewritingViewController.acquisition_uiState()
+            
+            self.dragView.isHidden = true
+            break
+        default:
+            break
+        }
+    }
+    
     func refreshProductActiveSpacing() -> Void {
         let height = self.view.frame.height - 32.0 - openPDFBoxHeight.constant - 16.0 - createPDFBoxHeight.constant - 24.0 - pdfSeriesBoxHeight.constant - pdfProSeriesBoxHeightConstraint.constant - 8 - othersBoxHeightConstraint.constant - pdfOthersBoxHeightConstraint.constant - 242 - 30
 //        print("height == %f", height)
@@ -384,6 +600,55 @@ import KMAdvertisement
         
         return resultFilePath;
     }
+    
+    func showProgressWindow() {
+        let progress = SKProgressController()
+        progress.message = NSLocalizedString("Translating...", comment: "")
+        progress.window?.backgroundColor = NSColor(hex: "#36383B")
+        progress.window?.contentView?.wantsLayer = true
+        progress.window?.contentView?.layer?.backgroundColor = NSColor(hex: "#36383B").cgColor
+        progress.progressField.textColor = NSColor.white
+        
+        progress.closeBlock = { [unowned self] in
+            
+        }
+        
+        self.progressController = progress
+        self.view.window?.beginSheet(progress.window!)
+    }
+    
+    func hiddenProgressWindow() {
+        if (self.progressController != nil) {
+            self.view.window?.endSheet((self.progressController?.window)!)
+            self.progressController = nil
+        }
+    }
+    
+    func isFileGreaterThan10MB(atPath filePath: String) -> Bool {
+        let fileManager = FileManager.default
+
+        do {
+            let fileAttributes = try fileManager.attributesOfItem(atPath: filePath)
+            if let fileSize = fileAttributes[.size] as? UInt64 {
+                let megabyteSize = fileSize / (1024 * 1024)
+                return megabyteSize > 10
+            }
+        } catch {
+            print("Error: \(error)")
+        }
+
+        return false
+    }
+    
+    func isPDFPageCountExceedsLimit(filePath: String) -> Bool {
+        let url = URL(fileURLWithPath: filePath)
+        guard let document = PDFDocument(url: url) else {
+            return false
+        }
+        
+        let pageCount = document.pageCount
+        return pageCount > 30
+    }
 
     // MARK: Common methods
     

+ 186 - 5
PDF Office/PDF Master/Class/Home/ViewController/KMHomeViewController.xib

@@ -8,6 +8,21 @@
         <customObject id="-2" userLabel="File's Owner" customClass="KMHomeViewController" customModule="PDF_Master" customModuleProvider="target">
             <connections>
                 <outlet property="activitiesBox" destination="MFa-T5-0wb" id="hkR-Nv-9aL"/>
+                <outlet property="aiErrorCorrectionBox" destination="gfM-nc-QPH" id="Hmh-sg-oXV"/>
+                <outlet property="aiErrorCorrectionImageView" destination="tWj-m1-RHC" id="Vih-4K-hKQ"/>
+                <outlet property="aiErrorCorrectionLabel" destination="aGT-3k-XaH" id="v9b-2n-Uue"/>
+                <outlet property="aiHomeBox" destination="fGu-QI-qsr" id="hrL-a0-avA"/>
+                <outlet property="aiHomeImageView" destination="uq4-KF-k9k" id="RRL-4F-uGi"/>
+                <outlet property="aiHomeLabel" destination="ZAT-Co-tte" id="0Kz-Po-Uct"/>
+                <outlet property="aiOpenPDFFilesViewController" destination="FOs-X3-zsa" id="WsQ-cr-AvC"/>
+                <outlet property="aiRewritingBox" destination="0aC-uQ-5lW" id="iLK-iS-H4H"/>
+                <outlet property="aiRewritingImageView" destination="7L8-5k-lE1" id="B5k-0W-Dgp"/>
+                <outlet property="aiRewritingLabel" destination="Fhh-MS-1UA" id="ihQ-rh-yLB"/>
+                <outlet property="aiRewritingViewController" destination="npC-Vy-evi" id="B6V-GX-Q49"/>
+                <outlet property="aiTranslationBox" destination="aEd-2n-FAH" id="QFg-bu-h0w"/>
+                <outlet property="aiTranslationImageView" destination="R0l-VG-P9c" id="bS5-ho-ymi"/>
+                <outlet property="aiTranslationLabel" destination="p5N-bY-CVu" id="1QT-kv-3v4"/>
+                <outlet property="aiTranslationViewController" destination="vQI-sm-WpY" id="TS3-4x-ip4"/>
                 <outlet property="cloudDocumentsBox" destination="ntJ-b8-qxk" id="hNr-Vi-fYQ"/>
                 <outlet property="cloudDocumentsBoxHeight" destination="aCh-WL-S1o" id="Ly4-LY-8YM"/>
                 <outlet property="cloudDocumentsViewController" destination="icM-sk-XE7" id="b9t-ez-lLE"/>
@@ -84,7 +99,7 @@ Gw
                                 <rect key="frame" x="0.0" y="0.0" width="270" height="820"/>
                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                 <subviews>
-                                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="IBc-Xn-ACX">
+                                    <box hidden="YES" boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="IBc-Xn-ACX">
                                         <rect key="frame" x="32" y="740" width="206" height="48"/>
                                         <view key="contentView" id="FXX-vK-R1B">
                                             <rect key="frame" x="0.0" y="0.0" width="206" height="48"/>
@@ -95,7 +110,7 @@ Gw
                                         </constraints>
                                         <color key="fillColor" red="0.10196078431372549" green="0.10196078431372549" blue="0.10196078431372549" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                                     </box>
-                                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="OtM-0x-ayU">
+                                    <box hidden="YES" boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="OtM-0x-ayU">
                                         <rect key="frame" x="32" y="676" width="206" height="48"/>
                                         <view key="contentView" id="yiR-qy-ftP">
                                             <rect key="frame" x="0.0" y="0.0" width="206" height="48"/>
@@ -105,7 +120,7 @@ Gw
                                             <constraint firstAttribute="height" constant="48" id="dGW-CI-1rZ"/>
                                         </constraints>
                                     </box>
-                                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="Dbe-pI-QSy">
+                                    <box hidden="YES" boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="Dbe-pI-QSy">
                                         <rect key="frame" x="208" y="684" width="26" height="32"/>
                                         <view key="contentView" id="BDS-se-7ty">
                                             <rect key="frame" x="0.0" y="0.0" width="26" height="32"/>
@@ -192,7 +207,7 @@ Gw
                                                 <scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Zv8-o9-nPx">
                                                     <rect key="frame" x="0.0" y="0.0" width="270" height="652"/>
                                                     <clipView key="contentView" drawsBackground="NO" id="0m5-Ti-Llk">
-                                                        <rect key="frame" x="0.0" y="0.0" width="255" height="652"/>
+                                                        <rect key="frame" x="0.0" y="0.0" width="270" height="652"/>
                                                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                         <subviews>
                                                             <view translatesAutoresizingMaskIntoConstraints="NO" id="TNl-3V-JVe">
@@ -299,7 +314,7 @@ Gw
                                                         <autoresizingMask key="autoresizingMask"/>
                                                     </scroller>
                                                     <scroller key="verticalScroller" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="eMA-3D-xnv" customClass="KMToolSetScroller" customModule="PDF_Master" customModuleProvider="target">
-                                                        <rect key="frame" x="255" y="0.0" width="15" height="652"/>
+                                                        <rect key="frame" x="254" y="0.0" width="16" height="652"/>
                                                         <autoresizingMask key="autoresizingMask"/>
                                                     </scroller>
                                                 </scrollView>
@@ -314,14 +329,175 @@ Gw
                                         <color key="borderColor" red="1" green="0.99843658089999998" blue="0.99619259260000004" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
                                         <color key="fillColor" red="1" green="0.99843658089999998" blue="0.99619259260000004" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
                                     </box>
+                                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="3io-Hj-Kiz">
+                                        <rect key="frame" x="0.0" y="0.0" width="270" height="820"/>
+                                        <subviews>
+                                            <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="fGu-QI-qsr" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
+                                                <rect key="frame" x="16" y="732" width="238" height="64"/>
+                                                <view key="contentView" id="XIH-la-IM7">
+                                                    <rect key="frame" x="0.0" y="0.0" width="238" height="64"/>
+                                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                    <subviews>
+                                                        <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="uq4-KF-k9k">
+                                                            <rect key="frame" x="16" y="18" width="28" height="28"/>
+                                                            <constraints>
+                                                                <constraint firstAttribute="width" constant="28" id="JWy-0z-k3e"/>
+                                                                <constraint firstAttribute="height" constant="28" id="T4M-96-ah8"/>
+                                                            </constraints>
+                                                            <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="edc-z8-gCQ"/>
+                                                        </imageView>
+                                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ZAT-Co-tte">
+                                                            <rect key="frame" x="54" y="24" width="186" height="16"/>
+                                                            <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="XuC-gZ-0YQ">
+                                                                <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="ZAT-Co-tte" firstAttribute="leading" secondItem="uq4-KF-k9k" secondAttribute="trailing" constant="12" id="PU4-jx-Nu0"/>
+                                                        <constraint firstAttribute="trailing" secondItem="ZAT-Co-tte" secondAttribute="trailing" id="VL4-QQ-6cm"/>
+                                                        <constraint firstItem="uq4-KF-k9k" firstAttribute="leading" secondItem="XIH-la-IM7" secondAttribute="leading" constant="16" id="VUv-xz-TFO"/>
+                                                        <constraint firstItem="ZAT-Co-tte" firstAttribute="centerY" secondItem="uq4-KF-k9k" secondAttribute="centerY" id="Xsd-W2-vdd"/>
+                                                    </constraints>
+                                                </view>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="64" id="TKk-Rp-VWm"/>
+                                                    <constraint firstItem="uq4-KF-k9k" firstAttribute="centerY" secondItem="fGu-QI-qsr" secondAttribute="centerY" id="o4J-SF-n2k"/>
+                                                </constraints>
+                                            </box>
+                                            <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="aEd-2n-FAH" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
+                                                <rect key="frame" x="16" y="660" width="238" height="64"/>
+                                                <view key="contentView" id="lfb-vJ-XnI">
+                                                    <rect key="frame" x="0.0" y="0.0" width="238" height="64"/>
+                                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                    <subviews>
+                                                        <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="R0l-VG-P9c">
+                                                            <rect key="frame" x="16" y="18" width="28" height="28"/>
+                                                            <constraints>
+                                                                <constraint firstAttribute="height" constant="28" id="70S-mf-0VQ"/>
+                                                                <constraint firstAttribute="width" constant="28" id="WF1-br-7fT"/>
+                                                            </constraints>
+                                                            <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="cON-bS-15a"/>
+                                                        </imageView>
+                                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="p5N-bY-CVu">
+                                                            <rect key="frame" x="54" y="24" width="186" height="16"/>
+                                                            <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="RZo-Aj-B8y">
+                                                                <font key="font" metaFont="system"/>
+                                                                <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                                                <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                                            </textFieldCell>
+                                                        </textField>
+                                                    </subviews>
+                                                    <constraints>
+                                                        <constraint firstAttribute="trailing" secondItem="p5N-bY-CVu" secondAttribute="trailing" id="01b-Tg-RQY"/>
+                                                        <constraint firstItem="p5N-bY-CVu" firstAttribute="centerY" secondItem="R0l-VG-P9c" secondAttribute="centerY" id="8r5-0f-Ipy"/>
+                                                        <constraint firstItem="R0l-VG-P9c" firstAttribute="leading" secondItem="lfb-vJ-XnI" secondAttribute="leading" constant="16" id="Ll3-ww-Ua9"/>
+                                                        <constraint firstItem="p5N-bY-CVu" firstAttribute="leading" secondItem="R0l-VG-P9c" secondAttribute="trailing" constant="12" id="sLE-Da-onW"/>
+                                                    </constraints>
+                                                </view>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="64" id="A6a-8U-W3c"/>
+                                                    <constraint firstItem="R0l-VG-P9c" firstAttribute="centerY" secondItem="aEd-2n-FAH" secondAttribute="centerY" id="x6x-n7-TZb"/>
+                                                </constraints>
+                                            </box>
+                                            <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="0aC-uQ-5lW" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
+                                                <rect key="frame" x="16" y="588" width="238" height="64"/>
+                                                <view key="contentView" id="R1S-LV-EMO">
+                                                    <rect key="frame" x="0.0" y="0.0" width="238" height="64"/>
+                                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                    <subviews>
+                                                        <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="7L8-5k-lE1">
+                                                            <rect key="frame" x="16" y="18" width="28" height="28"/>
+                                                            <constraints>
+                                                                <constraint firstAttribute="height" constant="28" id="6GM-P7-ZA4"/>
+                                                                <constraint firstAttribute="width" constant="28" id="9aH-Jk-9re"/>
+                                                            </constraints>
+                                                            <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="oLu-02-hg4"/>
+                                                        </imageView>
+                                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Fhh-MS-1UA">
+                                                            <rect key="frame" x="54" y="24" width="186" height="16"/>
+                                                            <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="hZb-7Q-757">
+                                                                <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="Fhh-MS-1UA" firstAttribute="centerY" secondItem="7L8-5k-lE1" secondAttribute="centerY" id="4EB-DV-CLt"/>
+                                                        <constraint firstItem="7L8-5k-lE1" firstAttribute="leading" secondItem="R1S-LV-EMO" secondAttribute="leading" constant="16" id="904-jB-LVB"/>
+                                                        <constraint firstItem="Fhh-MS-1UA" firstAttribute="leading" secondItem="7L8-5k-lE1" secondAttribute="trailing" constant="12" id="gGb-cT-3z2"/>
+                                                        <constraint firstAttribute="trailing" secondItem="Fhh-MS-1UA" secondAttribute="trailing" id="xyN-yE-rkf"/>
+                                                    </constraints>
+                                                </view>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="64" id="L2u-Qp-yTn"/>
+                                                    <constraint firstItem="7L8-5k-lE1" firstAttribute="centerY" secondItem="0aC-uQ-5lW" secondAttribute="centerY" id="Pz8-Nb-wy8"/>
+                                                </constraints>
+                                            </box>
+                                            <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="gfM-nc-QPH" customClass="KMBox" customModule="PDF_Master" customModuleProvider="target">
+                                                <rect key="frame" x="16" y="516" width="238" height="64"/>
+                                                <view key="contentView" id="hsW-0F-KnS">
+                                                    <rect key="frame" x="0.0" y="0.0" width="238" height="64"/>
+                                                    <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                                    <subviews>
+                                                        <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="tWj-m1-RHC">
+                                                            <rect key="frame" x="16" y="18" width="28" height="28"/>
+                                                            <constraints>
+                                                                <constraint firstAttribute="height" constant="28" id="TDL-Hm-ohv"/>
+                                                                <constraint firstAttribute="width" constant="28" id="Zuv-Vx-2b6"/>
+                                                            </constraints>
+                                                            <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="RX4-be-ygC"/>
+                                                        </imageView>
+                                                        <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aGT-3k-XaH">
+                                                            <rect key="frame" x="54" y="24" width="186" height="16"/>
+                                                            <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="A36-Eb-2cb">
+                                                                <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="aGT-3k-XaH" firstAttribute="centerY" secondItem="tWj-m1-RHC" secondAttribute="centerY" id="3uW-ug-wnS"/>
+                                                        <constraint firstItem="aGT-3k-XaH" firstAttribute="leading" secondItem="tWj-m1-RHC" secondAttribute="trailing" constant="12" id="57F-8b-R4d"/>
+                                                        <constraint firstItem="tWj-m1-RHC" firstAttribute="leading" secondItem="hsW-0F-KnS" secondAttribute="leading" constant="16" id="bu6-f5-Lei"/>
+                                                        <constraint firstAttribute="trailing" secondItem="aGT-3k-XaH" secondAttribute="trailing" id="s4G-Vg-fsl"/>
+                                                    </constraints>
+                                                </view>
+                                                <constraints>
+                                                    <constraint firstItem="tWj-m1-RHC" firstAttribute="centerY" secondItem="gfM-nc-QPH" secondAttribute="centerY" id="CtM-0V-CLq"/>
+                                                    <constraint firstAttribute="height" constant="64" id="Wxl-mi-6dg"/>
+                                                </constraints>
+                                            </box>
+                                        </subviews>
+                                        <constraints>
+                                            <constraint firstItem="0aC-uQ-5lW" firstAttribute="trailing" secondItem="aEd-2n-FAH" secondAttribute="trailing" id="1em-N9-EZt"/>
+                                            <constraint firstItem="0aC-uQ-5lW" firstAttribute="top" secondItem="aEd-2n-FAH" secondAttribute="bottom" constant="8" id="2Wf-YF-47K"/>
+                                            <constraint firstItem="fGu-QI-qsr" firstAttribute="leading" secondItem="3io-Hj-Kiz" secondAttribute="leading" constant="16" id="Iis-JZ-KM7"/>
+                                            <constraint firstItem="aEd-2n-FAH" firstAttribute="leading" secondItem="fGu-QI-qsr" secondAttribute="leading" id="JIW-4g-Eee"/>
+                                            <constraint firstItem="aEd-2n-FAH" firstAttribute="trailing" secondItem="fGu-QI-qsr" secondAttribute="trailing" id="Jyy-2X-OR9"/>
+                                            <constraint firstItem="aEd-2n-FAH" firstAttribute="top" secondItem="fGu-QI-qsr" secondAttribute="bottom" constant="8" id="LA9-Lk-hoG"/>
+                                            <constraint firstItem="fGu-QI-qsr" firstAttribute="top" secondItem="3io-Hj-Kiz" secondAttribute="top" constant="24" id="XKS-E9-44d"/>
+                                            <constraint firstItem="0aC-uQ-5lW" firstAttribute="leading" secondItem="aEd-2n-FAH" secondAttribute="leading" id="bhw-hX-MVg"/>
+                                            <constraint firstAttribute="trailing" secondItem="fGu-QI-qsr" secondAttribute="trailing" constant="16" id="bvC-Lu-ALO"/>
+                                            <constraint firstItem="gfM-nc-QPH" firstAttribute="trailing" secondItem="0aC-uQ-5lW" secondAttribute="trailing" id="fzO-yw-MBw"/>
+                                            <constraint firstItem="gfM-nc-QPH" firstAttribute="leading" secondItem="0aC-uQ-5lW" secondAttribute="leading" id="krm-LG-O6K"/>
+                                            <constraint firstItem="gfM-nc-QPH" firstAttribute="top" secondItem="0aC-uQ-5lW" secondAttribute="bottom" constant="8" id="m9w-w0-Rb8"/>
+                                        </constraints>
+                                    </customView>
                                 </subviews>
                                 <constraints>
                                     <constraint firstItem="20T-xp-Q2e" firstAttribute="top" secondItem="UKl-9H-uAO" secondAttribute="bottom" id="6Ty-9p-ozz"/>
+                                    <constraint firstAttribute="bottom" secondItem="3io-Hj-Kiz" secondAttribute="bottom" id="8hH-Nz-14P"/>
                                     <constraint firstItem="ntJ-b8-qxk" firstAttribute="leading" secondItem="2gJ-MM-ZrB" secondAttribute="leading" constant="16" id="9G7-II-reM"/>
                                     <constraint firstAttribute="trailing" secondItem="IBc-Xn-ACX" secondAttribute="trailing" constant="32" id="9bt-6N-Fpw"/>
                                     <constraint firstAttribute="trailing" secondItem="20T-xp-Q2e" secondAttribute="trailing" constant="16" id="9h5-eC-BcV"/>
                                     <constraint firstAttribute="bottom" secondItem="TRt-mD-49a" secondAttribute="bottom" id="LHh-fM-nsg"/>
                                     <constraint firstItem="IBc-Xn-ACX" firstAttribute="top" secondItem="2gJ-MM-ZrB" secondAttribute="top" constant="32" id="OT0-pO-LgG"/>
+                                    <constraint firstItem="3io-Hj-Kiz" firstAttribute="top" secondItem="2gJ-MM-ZrB" secondAttribute="top" id="OUk-vQ-edJ"/>
                                     <constraint firstItem="IBc-Xn-ACX" firstAttribute="leading" secondItem="2gJ-MM-ZrB" secondAttribute="leading" constant="32" id="Pct-00-aes"/>
                                     <constraint firstItem="Dbe-pI-QSy" firstAttribute="centerY" secondItem="OtM-0x-ayU" secondAttribute="centerY" id="Prm-NR-YvO"/>
                                     <constraint firstItem="deA-td-u53" firstAttribute="top" secondItem="20T-xp-Q2e" secondAttribute="bottom" id="QfX-k5-vsv"/>
@@ -330,11 +506,13 @@ Gw
                                     <constraint firstItem="TRt-mD-49a" firstAttribute="top" secondItem="deA-td-u53" secondAttribute="bottom" constant="24" id="dB5-BE-n63"/>
                                     <constraint firstItem="OtM-0x-ayU" firstAttribute="top" secondItem="IBc-Xn-ACX" secondAttribute="bottom" constant="16" id="dJR-pr-FoO"/>
                                     <constraint firstAttribute="trailing" secondItem="ntJ-b8-qxk" secondAttribute="trailing" constant="16" id="e8Q-or-Xvd"/>
+                                    <constraint firstItem="3io-Hj-Kiz" firstAttribute="leading" secondItem="2gJ-MM-ZrB" secondAttribute="leading" id="eTW-ob-qK1"/>
                                     <constraint firstItem="20T-xp-Q2e" firstAttribute="leading" secondItem="2gJ-MM-ZrB" secondAttribute="leading" constant="16" id="gtH-3g-pwb"/>
                                     <constraint firstItem="deA-td-u53" firstAttribute="leading" secondItem="2gJ-MM-ZrB" secondAttribute="leading" constant="16" id="hLP-Mo-nJv"/>
                                     <constraint firstItem="OtM-0x-ayU" firstAttribute="leading" secondItem="2gJ-MM-ZrB" secondAttribute="leading" constant="32" id="iC5-mp-yL7"/>
                                     <constraint firstItem="TRt-mD-49a" firstAttribute="leading" secondItem="2gJ-MM-ZrB" secondAttribute="leading" id="iq0-o7-PiX"/>
                                     <constraint firstAttribute="trailing" secondItem="TRt-mD-49a" secondAttribute="trailing" id="j9O-4p-xXv"/>
+                                    <constraint firstAttribute="trailing" secondItem="3io-Hj-Kiz" secondAttribute="trailing" id="kZa-Sb-BLN"/>
                                     <constraint firstItem="UKl-9H-uAO" firstAttribute="top" secondItem="OtM-0x-ayU" secondAttribute="bottom" constant="-108" id="o8v-Wg-KIZ"/>
                                     <constraint firstAttribute="trailing" secondItem="deA-td-u53" secondAttribute="trailing" constant="16" id="qjB-C0-vh0"/>
                                     <constraint firstAttribute="trailing" secondItem="OtM-0x-ayU" secondAttribute="trailing" constant="32" id="rZt-Tb-kjn"/>
@@ -483,6 +661,9 @@ Gw
         <customObject id="UcW-Sh-zFW" customClass="KMHomeHistoryFileViewController" customModule="PDF_Master" customModuleProvider="target"/>
         <customObject id="cEr-ez-OtI" customClass="KMPDFToolsViewController" customModule="PDF_Master" customModuleProvider="target"/>
         <customObject id="icM-sk-XE7" customClass="KMCloudDocumentsViewController" customModule="PDF_Master" customModuleProvider="target"/>
+        <customObject id="FOs-X3-zsa" customClass="KMAIOpenPDFFilesVC" customModule="PDF_Master" customModuleProvider="target"/>
+        <customObject id="vQI-sm-WpY" customClass="KMAITranslationVC" customModule="PDF_Master" customModuleProvider="target"/>
+        <customObject id="npC-Vy-evi" customClass="KMAIRewritingVC" customModule="PDF_Master" customModuleProvider="target"/>
     </objects>
     <resources>
         <image name="NSTouchBarGoForwardTemplate" width="12" height="17"/>

+ 419 - 0
PDF Office/PDF Master/Class/Home/WindowController/KMAITranslationConfirmWindowController.swift

@@ -0,0 +1,419 @@
+//
+//  KMAITranslationConfirmWindowController.swift
+//  PDF Master
+//
+//  Created by wanjun on 2023/5/25.
+//
+
+import Cocoa
+
+class KMAITranslationConfirmWindowController: NSWindowController {
+
+    @IBOutlet weak var label: NSTextField!
+    @IBOutlet weak var subLabel: NSTextField!
+    @IBOutlet weak var cancelBox: NSBox!
+    @IBOutlet weak var cancelLabel: NSTextField!
+    @IBOutlet weak var cancelButton: NSButton!
+    @IBOutlet weak var translateBox: NSBox!
+    @IBOutlet weak var translateLabel: NSTextField!
+    @IBOutlet weak var translateButton: NSButton!
+    
+    @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 tipsLabel1: NSTextField!
+    @IBOutlet weak var tipsLabel2: NSTextField!
+
+    @IBOutlet weak var prePDFView: KMCustomPDFView?
+
+    var filePath: String = ""
+    var progressController: SKProgressController?
+    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 popover: NSPopover?
+    
+    var saveFileUrl: URL = URL(fileURLWithPath: "")
+
+    deinit {
+        self.prePDFView?.removeFromSuperview()
+        self.prePDFView = nil
+    }
+    
+    override func windowDidLoad() {
+        super.windowDidLoad()
+
+        self.initLocalization()
+        self.initializeUI()
+        
+        let document = CPDFDocument(url:  URL(fileURLWithPath: self.filePath))
+        self.prePDFView?.document = document!
+        
+        if (self.prePDFView?.documentView() != nil) {
+            self.prePDFView?.documentView().enclosingScrollView?.hasVerticalScroller = false
+            self.prePDFView?.documentView().enclosingScrollView?.hasHorizontalScroller = false
+        }
+    }
+    
+    func initializeUI() -> Void {
+        self.label.textColor = NSColor(hex: "#252629")
+        self.label.font = NSFont.SFProTextSemibold(16.0)
+        
+        self.subLabel.textColor = NSColor(hex: "##616469")
+        self.subLabel.font = NSFont.SFProTextRegular(12.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.tipsLabel1.textColor = NSColor(hex: "#94989C")
+        self.tipsLabel1.font = NSFont.SFProTextRegular(12.0)
+        self.tipsLabel2.textColor = NSColor(hex: "#94989C")
+        self.tipsLabel2.font = NSFont.SFProTextRegular(12.0)
+
+        self.cancelBox.fillColor = NSColor(hex: "#F5F5F5")
+        self.cancelBox.cornerRadius = 5.0
+        self.cancelBox.borderWidth = 0.0
+        self.cancelLabel.textColor = NSColor(hex: "#4D4D4D")
+        self.cancelLabel.font = NSFont.SFProTextRegular(13.0)
+        self.translateBox.fillColor = NSColor(hex: "#4B91F7")
+        self.translateBox.cornerRadius = 5.0
+        self.translateBox.borderWidth = 0.0
+        self.translateLabel.textColor = NSColor(hex: "#FFFFFF")
+        self.translateLabel.font = NSFont.SFProTextRegular(13.0)
+        
+        self.prePDFView?.backgroundColor = NSColor(hex: "#F7F8FA")
+    }
+    
+    func initLocalization() -> Void {
+        self.label.stringValue = NSLocalizedString("AI Translation", comment: "")
+        self.subLabel.stringValue = NSLocalizedString("Translation Language", comment: "")
+        self.cancelLabel.stringValue = NSLocalizedString("Cancel", comment: "")
+        self.translateLabel.stringValue = NSLocalizedString("Translate", comment: "")
+        self.fromLabel.stringValue = "Automatic"
+        self.toLabel.stringValue = "English"
+        self.tipsLabel1.stringValue = NSLocalizedString("Scanned PDF files are not supported", comment: "")
+        self.tipsLabel2.stringValue = NSLocalizedString("Limit document size to 10M, document page number to 30, 10w characters per month.", comment: "")
+    }
+    
+    override func mouseDown(with event: NSEvent) {
+        if self.popover != nil {
+            self.popover?.close()
+            self.popover = nil
+        }
+    }
+
+    // MARK: Private Methods
+    
+
+    // MARK: Action Methods
+
+    @IBAction func translateAction(_ sender: NSButton) {
+        if !KMLightMemberManager.manager.isLogin() {
+            KMLoginWindowController.show(window: NSApp.mainWindow!)
+            return
+        }
+        
+        let filePathUrl = URL(fileURLWithPath: self.filePath)
+        let fileNameWithoutExtension = filePathUrl.deletingPathExtension().lastPathComponent
+        let newFileName = fileNameWithoutExtension + "_aiTranslation"
+        
+        let outputSavePanel = NSSavePanel()
+        outputSavePanel.title = NSLocalizedString("Translate", comment: "")
+        outputSavePanel.allowedFileTypes = ["pdf"]
+        outputSavePanel.nameFieldStringValue = newFileName
+        outputSavePanel.directoryURL = filePathUrl.deletingLastPathComponent()
+        
+        let result = outputSavePanel.runModal()
+        if result == .OK {
+            self.saveFileUrl = outputSavePanel.url!
+            
+            DispatchQueue.main.async {
+                self.showProgressWindow()
+            }
+            
+            let infoDictionary = Bundle .main.infoDictionary!
+            let majorVersion = infoDictionary["CFBundleShortVersionString"]
+
+            KMRequestServerManager.manager.aiTranslationFileUpload(file: self.filePath, version: "1.0.1") { [unowned self] success, result in
+                if success {
+                    let result: NSDictionary = result!.result
+
+                    let fileKey = result["fileKey"]
+                    let fileName = result["fileName"]
+                    let pageCount = result["pageCount"]
+                    if fileKey != nil {
+                        self.fileTranslateHandle(fileKey as! String)
+                    }
+                } else {
+                    let result: String = result!.message
+
+                    DispatchQueue.main.async {
+                        self.hiddenProgressWindow()
+     
+                        let alert = NSAlert()
+                        alert.alertStyle = .critical
+                        alert.messageText = result
+                        alert.runModal()
+                    }
+                }
+            }
+        } else {
+            outputSavePanel.close()
+        }
+    }
+    
+    @IBAction func cancelAction(_ sender: NSButton) {
+        NSApp.mainWindow!.endSheet(self.window!)
+        self.window?.orderOut(self)
+    }
+    
+    @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(languages)
+        let createFilePopover: NSPopover = NSPopover.init()
+        self.popover = createFilePopover
+        createFilePopover.contentViewController = vc
+        createFilePopover.animates = true
+        createFilePopover.behavior = .semitransient
+        createFilePopover.setValue(true, forKey: "shouldHideAnchor")
+        if isFromLanguage {
+            vc.selectString = self.fromLabel.stringValue
+        } else {
+            vc.selectString = self.toLabel.stringValue
+        }
+
+        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)
+            }
+        }
+
+        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
+        }
+    }
+    
+    // MARK: Private Methods
+
+    func showProgressWindow() {
+        let progress = SKProgressController()
+        progress.message = NSLocalizedString("Translating...", comment: "")
+        progress.window?.backgroundColor = NSColor(hex: "#36383B")
+        progress.window?.contentView?.wantsLayer = true
+        progress.window?.contentView?.layer?.backgroundColor = NSColor(hex: "#36383B").cgColor
+        progress.progressField.textColor = NSColor.white
+        
+        progress.closeBlock = { [unowned self] in
+            
+        }
+        
+        self.progressController = progress
+        self.window?.beginSheet(progress.window!)
+    }
+    
+    func hiddenProgressWindow() {
+        if (self.progressController != nil) {
+            self.window?.endSheet((self.progressController?.window)!)
+            self.progressController = nil
+        }
+    }
+    
+    func fileTranslateHandle(_ fileKey: String) -> Void {
+        let infoDictionary = Bundle .main.infoDictionary!
+        let majorVersion = infoDictionary["CFBundleShortVersionString"]
+
+        KMRequestServerManager.manager.aiTranslationFileTranslateHandle(fileKey: fileKey, from: self.fromStr, to: self.toStr, version: "1.0.1") { success, result in
+            if success {
+                let result: NSDictionary = result!.result
+
+                let fileUrl: String = result["fileUrl"] as! String
+                let downFileUrl: String = result["downFileUrl"] as! String
+                let ossDownUrl: String = result["ossDownUrl"] as! String
+                let fileName: String = result["fileName"] as! String
+                let downFileName: String = result["downFileName"] as! String
+                let from: String = result["from"] as! String
+                let to: String = result["to"] as! String
+                
+                self.downloadFile(filePath: ossDownUrl, downFileName: downFileName)
+            } else {
+                let result: String = result!.message
+
+                DispatchQueue.main.async {
+                    self.hiddenProgressWindow()
+                    
+                    let alert = NSAlert()
+                    alert.alertStyle = .critical
+                    alert.messageText = result
+                    alert.runModal()
+                }
+            }
+        }
+    }
+    
+    func downloadFile(filePath: String, downFileName: String) -> Void {
+        guard let fileURL = URL(string: filePath) else {
+            let alert = NSAlert()
+            alert.alertStyle = .critical
+            alert.messageText = NSLocalizedString("Invalid file link", comment: "")
+            alert.runModal()
+
+            return
+        }
+        
+//        let filePathUrl = URL(fileURLWithPath: self.filePath)
+//        let fileNameWithoutExtension = filePathUrl.deletingPathExtension().lastPathComponent
+//        let fileExtension = filePathUrl.pathExtension
+//        let newFileName = fileNameWithoutExtension + "_aiTranslation" + "." + fileExtension
+//        let destinationURL = filePathUrl.deletingLastPathComponent().appendingPathComponent(newFileName)
+        
+        if FileManager.default.fileExists(atPath: self.saveFileUrl.path) {
+            do {
+                try FileManager.default.removeItem(at: self.saveFileUrl)
+                print("删除旧文件成功")
+            } catch {
+                print("删除旧文件失败:\(error)")
+            }
+        }
+        let sessionConfiguration = URLSessionConfiguration.default
+        let session = URLSession(configuration: sessionConfiguration)
+        let downloadTask = session.downloadTask(with: fileURL) { (tempLocalURL, response, error) in
+            if let error = error {
+                let alert = NSAlert()
+                alert.alertStyle = .critical
+                alert.messageText = String(format: "%@:\(error)", NSLocalizedString("Download failed", comment: ""))
+                alert.runModal()
+                
+                return
+            }
+
+            guard let tempLocalURL = tempLocalURL else {
+                let alert = NSAlert()
+                alert.alertStyle = .critical
+                alert.messageText = NSLocalizedString("Invalid temporary directory", comment: "")
+                alert.runModal()
+
+                return
+            }
+            
+            DispatchQueue.main.async {
+                self.hiddenProgressWindow()
+//                NSApp.mainWindow!.endSheet(self.window!)
+                self.window?.orderOut(self)
+            }
+
+            do {
+                try FileManager.default.moveItem(at: tempLocalURL, to: self.saveFileUrl)
+
+                NSDocumentController.shared.openDocument(withContentsOf: self.saveFileUrl, display: true) { document, documentWasAlreadyOpen, error in
+                    if error != nil {
+                        NSApp.presentError(error!)
+                    } else {
+
+                    }
+                }
+            } catch {
+                let alert = NSAlert()
+                alert.alertStyle = .critical
+                alert.messageText = String(format: "%@:\(error)", NSLocalizedString("Failed to save file", comment: ""))
+                alert.runModal()
+            }
+        }
+        downloadTask.resume()
+    }
+    
+    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"
+    }
+
+}

+ 400 - 0
PDF Office/PDF Master/Class/Home/WindowController/KMAITranslationConfirmWindowController.xib

@@ -0,0 +1,400 @@
+<?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="KMAITranslationConfirmWindowController" customModule="PDF_Master" customModuleProvider="target">
+            <connections>
+                <outlet property="cancelBox" destination="vyK-GF-45b" id="SmK-bv-L3Z"/>
+                <outlet property="cancelButton" destination="cGZ-Im-IxK" id="rmV-MT-RM5"/>
+                <outlet property="cancelLabel" destination="deL-QF-z0s" id="eA4-QB-zXm"/>
+                <outlet property="fromBox" destination="hnW-Hu-edB" id="obD-SQ-Lsx"/>
+                <outlet property="fromLabel" destination="Rva-eU-GRw" id="dIy-M0-Xt2"/>
+                <outlet property="label" destination="aq8-Ah-UWm" id="6kD-WB-eMe"/>
+                <outlet property="languageImageView" destination="Yky-Tx-mDq" id="Rbp-QD-wQ7"/>
+                <outlet property="prePDFView" destination="g0s-3J-B7Z" id="Nnu-z9-3YR"/>
+                <outlet property="subLabel" destination="zlV-ti-gJ9" id="Iyb-MH-bFZ"/>
+                <outlet property="tipsLabel1" destination="7Ui-Xy-UA6" id="zZ8-IJ-Hyk"/>
+                <outlet property="tipsLabel2" destination="pdX-rR-ESN" id="X7l-m3-UXt"/>
+                <outlet property="toBox" destination="CL9-IR-CZi" id="Ouj-W7-QOd"/>
+                <outlet property="toLabel" destination="nfg-7P-9zD" id="oPu-fK-v8b"/>
+                <outlet property="translateBox" destination="mxT-Tw-rlp" id="Jh5-hM-0hL"/>
+                <outlet property="translateButton" destination="3Am-My-14a" id="Gzf-c0-bSh"/>
+                <outlet property="translateLabel" destination="nFO-mt-ZB4" id="gmM-Ju-YLy"/>
+                <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" id="F0z-JX-Cv5">
+            <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
+            <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+            <rect key="contentRect" x="196" y="240" width="628" height="334"/>
+            <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="628" height="276"/>
+                <autoresizingMask key="autoresizingMask"/>
+                <subviews>
+                    <box boxType="custom" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="zwE-aA-0ce">
+                        <rect key="frame" x="440" y="16" width="172" height="28"/>
+                        <view key="contentView" id="11a-a7-FcD">
+                            <rect key="frame" x="0.0" y="0.0" width="172" height="28"/>
+                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                            <subviews>
+                                <box boxType="custom" cornerRadius="5" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="vyK-GF-45b">
+                                    <rect key="frame" x="0.0" y="0.0" width="78" height="28"/>
+                                    <view key="contentView" id="XSf-Em-cr2">
+                                        <rect key="frame" x="1" y="1" width="76" height="26"/>
+                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                        <subviews>
+                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="deL-QF-z0s">
+                                                <rect key="frame" x="20" y="5" width="37" height="16"/>
+                                                <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="FIx-7a-CCI">
+                                                    <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="cGZ-Im-IxK">
+                                                <rect key="frame" x="0.0" y="0.0" width="76" height="26"/>
+                                                <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="mp1-Jt-tKe">
+                                                    <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                    <font key="font" metaFont="system"/>
+                                                </buttonCell>
+                                                <connections>
+                                                    <action selector="cancelAction:" target="-2" id="LCk-7o-yve"/>
+                                                </connections>
+                                            </button>
+                                        </subviews>
+                                        <constraints>
+                                            <constraint firstAttribute="trailing" secondItem="cGZ-Im-IxK" secondAttribute="trailing" id="3wu-YM-dAg"/>
+                                            <constraint firstItem="deL-QF-z0s" firstAttribute="centerY" secondItem="XSf-Em-cr2" secondAttribute="centerY" id="4t3-q9-nio"/>
+                                            <constraint firstAttribute="bottom" secondItem="cGZ-Im-IxK" secondAttribute="bottom" id="8ZJ-B7-GY3"/>
+                                            <constraint firstItem="cGZ-Im-IxK" firstAttribute="top" secondItem="XSf-Em-cr2" secondAttribute="top" id="RrO-O9-QeA"/>
+                                            <constraint firstItem="cGZ-Im-IxK" firstAttribute="leading" secondItem="XSf-Em-cr2" secondAttribute="leading" id="d8c-36-nkZ"/>
+                                            <constraint firstItem="deL-QF-z0s" firstAttribute="centerX" secondItem="XSf-Em-cr2" secondAttribute="centerX" id="jvx-ko-4Wn"/>
+                                        </constraints>
+                                    </view>
+                                    <constraints>
+                                        <constraint firstAttribute="width" constant="78" id="TY4-G0-aVa"/>
+                                    </constraints>
+                                    <color key="fillColor" red="0.92156862750000001" green="0.92156862750000001" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                </box>
+                                <box boxType="custom" cornerRadius="5" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="mxT-Tw-rlp">
+                                    <rect key="frame" x="94" y="0.0" width="78" height="28"/>
+                                    <view key="contentView" id="5yL-5z-83R">
+                                        <rect key="frame" x="1" y="1" width="76" height="26"/>
+                                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                        <subviews>
+                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="nFO-mt-ZB4">
+                                                <rect key="frame" x="20" y="5" width="37" height="16"/>
+                                                <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="UTP-2e-VlX">
+                                                    <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="3Am-My-14a">
+                                                <rect key="frame" x="0.0" y="0.0" width="76" height="26"/>
+                                                <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="Fkj-HH-Ela">
+                                                    <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                    <font key="font" metaFont="system"/>
+                                                </buttonCell>
+                                                <connections>
+                                                    <action selector="translateAction:" target="-2" id="6uA-Vn-Eq3"/>
+                                                </connections>
+                                            </button>
+                                        </subviews>
+                                        <constraints>
+                                            <constraint firstItem="nFO-mt-ZB4" firstAttribute="centerY" secondItem="5yL-5z-83R" secondAttribute="centerY" id="0ZN-RX-fTY"/>
+                                            <constraint firstItem="3Am-My-14a" firstAttribute="top" secondItem="5yL-5z-83R" secondAttribute="top" id="1Ly-FI-FtW"/>
+                                            <constraint firstItem="3Am-My-14a" firstAttribute="leading" secondItem="5yL-5z-83R" secondAttribute="leading" id="CUV-Lr-tG5"/>
+                                            <constraint firstAttribute="bottom" secondItem="3Am-My-14a" secondAttribute="bottom" id="S46-iY-pqT"/>
+                                            <constraint firstItem="nFO-mt-ZB4" firstAttribute="centerX" secondItem="5yL-5z-83R" secondAttribute="centerX" id="Yvu-BP-umJ"/>
+                                            <constraint firstAttribute="trailing" secondItem="3Am-My-14a" secondAttribute="trailing" id="yFX-3N-teC"/>
+                                        </constraints>
+                                    </view>
+                                    <constraints>
+                                        <constraint firstAttribute="height" constant="28" id="r0S-8M-b5L"/>
+                                    </constraints>
+                                    <color key="fillColor" red="0.92156862750000001" green="0.92156862750000001" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                </box>
+                            </subviews>
+                            <constraints>
+                                <constraint firstItem="mxT-Tw-rlp" firstAttribute="leading" secondItem="vyK-GF-45b" secondAttribute="trailing" constant="16" id="2zX-i0-5Pl"/>
+                                <constraint firstItem="mxT-Tw-rlp" firstAttribute="top" secondItem="11a-a7-FcD" secondAttribute="top" id="4Ku-SF-lJy"/>
+                                <constraint firstItem="mxT-Tw-rlp" firstAttribute="width" secondItem="vyK-GF-45b" secondAttribute="width" id="AuU-eU-f7L"/>
+                                <constraint firstItem="vyK-GF-45b" firstAttribute="top" secondItem="11a-a7-FcD" secondAttribute="top" id="Fmj-o2-C5j"/>
+                                <constraint firstAttribute="bottom" secondItem="vyK-GF-45b" secondAttribute="bottom" id="M5z-xX-014"/>
+                                <constraint firstItem="mxT-Tw-rlp" firstAttribute="height" secondItem="vyK-GF-45b" secondAttribute="height" id="cV1-EH-k3m"/>
+                                <constraint firstAttribute="bottom" secondItem="mxT-Tw-rlp" secondAttribute="bottom" id="cke-B4-boT"/>
+                                <constraint firstAttribute="trailing" secondItem="mxT-Tw-rlp" secondAttribute="trailing" id="sBz-LK-0mB"/>
+                                <constraint firstItem="vyK-GF-45b" firstAttribute="leading" secondItem="11a-a7-FcD" secondAttribute="leading" id="zfg-bG-f0W"/>
+                            </constraints>
+                        </view>
+                    </box>
+                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="iMz-Q5-D6R">
+                        <rect key="frame" x="16" y="226" width="596" height="50"/>
+                        <subviews>
+                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="aq8-Ah-UWm">
+                                <rect key="frame" x="-2" y="17" width="600" height="16"/>
+                                <textFieldCell key="cell" alignment="left" title="Label" id="F7x-HZ-dOf">
+                                    <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 firstAttribute="trailing" secondItem="aq8-Ah-UWm" secondAttribute="trailing" id="4x3-XJ-ncF"/>
+                            <constraint firstItem="aq8-Ah-UWm" firstAttribute="centerY" secondItem="iMz-Q5-D6R" secondAttribute="centerY" id="aqJ-4f-BbG"/>
+                            <constraint firstItem="aq8-Ah-UWm" firstAttribute="leading" secondItem="iMz-Q5-D6R" secondAttribute="leading" id="vFc-3c-MnQ"/>
+                            <constraint firstAttribute="height" constant="50" id="xdr-Zz-1sq"/>
+                        </constraints>
+                    </customView>
+                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="WyA-fZ-iqG">
+                        <rect key="frame" x="16" y="64" width="596" height="162"/>
+                        <subviews>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="g0s-3J-B7Z" customClass="KMCustomPDFView" customModule="PDF_Master" customModuleProvider="target">
+                                <rect key="frame" x="0.0" y="22" width="106" height="140"/>
+                                <constraints>
+                                    <constraint firstAttribute="width" constant="106" id="bJf-WD-7Mo"/>
+                                    <constraint firstAttribute="height" constant="140" id="fEC-47-NuY"/>
+                                </constraints>
+                            </customView>
+                            <customView translatesAutoresizingMaskIntoConstraints="NO" id="wV9-Le-UHj">
+                                <rect key="frame" x="122" y="0.0" width="474" height="162"/>
+                                <subviews>
+                                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="zlV-ti-gJ9">
+                                        <rect key="frame" x="-2" y="146" width="478" height="16"/>
+                                        <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="ken-B3-K7v">
+                                            <font key="font" usesAppearanceFont="YES"/>
+                                            <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
+                                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                        </textFieldCell>
+                                    </textField>
+                                    <box boxType="custom" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="hnW-Hu-edB">
+                                        <rect key="frame" x="0.0" y="112" width="221" height="32"/>
+                                        <view key="contentView" id="fqa-yz-GHT">
+                                            <rect key="frame" x="1" y="1" width="219" height="30"/>
+                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                            <subviews>
+                                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Rva-eU-GRw">
+                                                    <rect key="frame" x="6" y="7" width="189" height="16"/>
+                                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="0g8-wy-2we">
+                                                        <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="aPk-2b-flp">
+                                                    <rect key="frame" x="193" y="7" width="16" height="16"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="16" id="AfI-rJ-Wja"/>
+                                                        <constraint firstAttribute="width" constant="16" id="Qyh-dF-klv"/>
+                                                    </constraints>
+                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="icon_btn_arrow_gray_down_s_norm_false" id="J4G-LO-Kjd"/>
+                                                </imageView>
+                                                <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="fxA-43-vq4">
+                                                    <rect key="frame" x="0.0" y="0.0" width="219" height="30"/>
+                                                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="jvf-Za-Y4i">
+                                                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                        <font key="font" metaFont="system"/>
+                                                    </buttonCell>
+                                                    <connections>
+                                                        <action selector="fromLanguageAction:" target="-2" id="sFe-uD-Phf"/>
+                                                    </connections>
+                                                </button>
+                                            </subviews>
+                                            <constraints>
+                                                <constraint firstAttribute="bottom" secondItem="fxA-43-vq4" secondAttribute="bottom" id="AsO-bn-hv3"/>
+                                                <constraint firstAttribute="trailing" secondItem="aPk-2b-flp" secondAttribute="trailing" constant="10" id="Ggg-cW-OwQ"/>
+                                                <constraint firstItem="fxA-43-vq4" firstAttribute="top" secondItem="fqa-yz-GHT" secondAttribute="top" id="bgh-aK-zdQ"/>
+                                                <constraint firstItem="aPk-2b-flp" firstAttribute="leading" secondItem="Rva-eU-GRw" secondAttribute="trailing" id="eQf-jI-xz0"/>
+                                                <constraint firstAttribute="trailing" secondItem="fxA-43-vq4" secondAttribute="trailing" id="olN-nD-N5R"/>
+                                                <constraint firstItem="fxA-43-vq4" firstAttribute="leading" secondItem="fqa-yz-GHT" secondAttribute="leading" id="pvz-Kg-x3a"/>
+                                                <constraint firstItem="Rva-eU-GRw" firstAttribute="leading" secondItem="fqa-yz-GHT" secondAttribute="leading" constant="8" id="sJN-cW-zkV"/>
+                                            </constraints>
+                                        </view>
+                                        <constraints>
+                                            <constraint firstItem="Rva-eU-GRw" firstAttribute="centerY" secondItem="hnW-Hu-edB" secondAttribute="centerY" id="DID-ro-lc6"/>
+                                            <constraint firstItem="aPk-2b-flp" firstAttribute="centerY" secondItem="hnW-Hu-edB" secondAttribute="centerY" id="OXO-NT-RaN"/>
+                                            <constraint firstAttribute="height" constant="32" id="wSZ-gX-g4q"/>
+                                        </constraints>
+                                    </box>
+                                    <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Yky-Tx-mDq">
+                                        <rect key="frame" x="229" y="120" width="16" height="16"/>
+                                        <constraints>
+                                            <constraint firstAttribute="width" constant="16" id="Aei-1E-WAS"/>
+                                            <constraint firstAttribute="height" constant="16" id="bLA-nk-uJJ"/>
+                                        </constraints>
+                                        <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="9lW-R6-GpM"/>
+                                    </imageView>
+                                    <box boxType="custom" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="CL9-IR-CZi">
+                                        <rect key="frame" x="253" y="112" width="221" height="32"/>
+                                        <view key="contentView" id="ldf-Ae-zL0">
+                                            <rect key="frame" x="1" y="1" width="219" height="30"/>
+                                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                                            <subviews>
+                                                <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Vyd-QW-lrq">
+                                                    <rect key="frame" x="193" y="7" width="16" height="16"/>
+                                                    <constraints>
+                                                        <constraint firstAttribute="height" constant="16" id="P6h-dl-Zlg"/>
+                                                        <constraint firstAttribute="width" constant="16" id="vCd-1k-Lsb"/>
+                                                    </constraints>
+                                                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="icon_btn_arrow_gray_down_s_norm_false" id="8cp-o3-LWj"/>
+                                                </imageView>
+                                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="nfg-7P-9zD">
+                                                    <rect key="frame" x="6" y="7" width="189" height="16"/>
+                                                    <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="CJ2-nQ-Ths">
+                                                        <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="UPR-GU-UJu">
+                                                    <rect key="frame" x="0.0" y="0.0" width="219" height="30"/>
+                                                    <buttonCell key="cell" type="bevel" bezelStyle="rounded" alignment="center" imageScaling="proportionallyDown" inset="2" id="R3u-dg-UfF">
+                                                        <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                                                        <font key="font" metaFont="system"/>
+                                                    </buttonCell>
+                                                    <connections>
+                                                        <action selector="toLanguageAction:" target="-2" id="cPs-hm-8jf"/>
+                                                    </connections>
+                                                </button>
+                                            </subviews>
+                                            <constraints>
+                                                <constraint firstItem="UPR-GU-UJu" firstAttribute="top" secondItem="ldf-Ae-zL0" secondAttribute="top" id="0n3-lS-qyc"/>
+                                                <constraint firstItem="Vyd-QW-lrq" firstAttribute="leading" secondItem="nfg-7P-9zD" secondAttribute="trailing" id="7Xl-7l-MKF"/>
+                                                <constraint firstAttribute="bottom" secondItem="UPR-GU-UJu" secondAttribute="bottom" id="8dW-uG-rCh"/>
+                                                <constraint firstAttribute="trailing" secondItem="UPR-GU-UJu" secondAttribute="trailing" id="O0l-vk-jnM"/>
+                                                <constraint firstItem="nfg-7P-9zD" firstAttribute="leading" secondItem="ldf-Ae-zL0" secondAttribute="leading" constant="8" id="Trz-67-amA"/>
+                                                <constraint firstAttribute="trailing" secondItem="Vyd-QW-lrq" secondAttribute="trailing" constant="10" id="pdp-Zl-00c"/>
+                                                <constraint firstItem="UPR-GU-UJu" firstAttribute="leading" secondItem="ldf-Ae-zL0" secondAttribute="leading" id="pr0-S0-DMG"/>
+                                            </constraints>
+                                        </view>
+                                        <constraints>
+                                            <constraint firstItem="Vyd-QW-lrq" firstAttribute="centerY" secondItem="CL9-IR-CZi" secondAttribute="centerY" id="SbY-Xt-fxc"/>
+                                            <constraint firstAttribute="height" constant="32" id="odG-mt-EoO"/>
+                                            <constraint firstItem="nfg-7P-9zD" firstAttribute="centerY" secondItem="CL9-IR-CZi" secondAttribute="centerY" id="pWn-Nl-k8a"/>
+                                        </constraints>
+                                    </box>
+                                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="X5b-6y-e7L">
+                                        <rect key="frame" x="0.0" y="76" width="474" height="20"/>
+                                        <subviews>
+                                            <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="nXo-7c-wd1">
+                                                <rect key="frame" x="0.0" y="2" width="16" height="16"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="width" constant="16" id="Gfr-F5-MZF"/>
+                                                    <constraint firstAttribute="height" constant="16" id="yp6-aw-SCd"/>
+                                                </constraints>
+                                                <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="image_btn_tips" id="yV6-OA-rAL"/>
+                                            </imageView>
+                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="7Ui-Xy-UA6">
+                                                <rect key="frame" x="18" y="2" width="458" height="16"/>
+                                                <textFieldCell key="cell" lineBreakMode="clipping" title="Label" id="ao3-xG-chl">
+                                                    <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="nXo-7c-wd1" firstAttribute="centerY" secondItem="X5b-6y-e7L" secondAttribute="centerY" id="7je-j5-uWg"/>
+                                            <constraint firstAttribute="height" constant="20" id="K8K-CK-vKj"/>
+                                            <constraint firstItem="7Ui-Xy-UA6" firstAttribute="centerY" secondItem="X5b-6y-e7L" secondAttribute="centerY" id="Xvv-m5-er4"/>
+                                            <constraint firstItem="7Ui-Xy-UA6" firstAttribute="leading" secondItem="nXo-7c-wd1" secondAttribute="trailing" constant="4" id="bax-Gl-9MH"/>
+                                            <constraint firstItem="nXo-7c-wd1" firstAttribute="leading" secondItem="X5b-6y-e7L" secondAttribute="leading" id="fjS-gZ-DOF"/>
+                                            <constraint firstAttribute="trailing" secondItem="7Ui-Xy-UA6" secondAttribute="trailing" id="qSg-6A-uGC"/>
+                                        </constraints>
+                                    </customView>
+                                    <customView translatesAutoresizingMaskIntoConstraints="NO" id="H37-ay-J2q">
+                                        <rect key="frame" x="0.0" y="0.0" width="474" height="72"/>
+                                        <subviews>
+                                            <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="jSY-bq-cK2">
+                                                <rect key="frame" x="0.0" y="54" width="16" height="16"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="height" constant="16" id="nrz-bm-bHQ"/>
+                                                    <constraint firstAttribute="width" constant="16" id="zB1-Rb-3QC"/>
+                                                </constraints>
+                                                <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="image_btn_tips" id="Eu3-jj-OHz"/>
+                                            </imageView>
+                                            <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="pdX-rR-ESN">
+                                                <rect key="frame" x="18" y="0.0" width="458" height="70"/>
+                                                <textFieldCell key="cell" title="Label" id="t5Z-wu-5ot">
+                                                    <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="jSY-bq-cK2" firstAttribute="top" secondItem="H37-ay-J2q" secondAttribute="top" constant="2" id="MaK-Js-AaG"/>
+                                            <constraint firstAttribute="trailing" secondItem="pdX-rR-ESN" secondAttribute="trailing" id="OZH-dg-yyj"/>
+                                            <constraint firstItem="pdX-rR-ESN" firstAttribute="leading" secondItem="jSY-bq-cK2" secondAttribute="trailing" constant="4" id="VwB-nU-hhY"/>
+                                            <constraint firstItem="jSY-bq-cK2" firstAttribute="leading" secondItem="H37-ay-J2q" secondAttribute="leading" id="cap-CT-ETa"/>
+                                            <constraint firstItem="pdX-rR-ESN" firstAttribute="top" secondItem="jSY-bq-cK2" secondAttribute="top" id="iMg-Zf-51i"/>
+                                            <constraint firstAttribute="bottom" secondItem="pdX-rR-ESN" secondAttribute="bottom" id="tTH-xa-ngG"/>
+                                        </constraints>
+                                    </customView>
+                                </subviews>
+                                <constraints>
+                                    <constraint firstItem="zlV-ti-gJ9" firstAttribute="leading" secondItem="wV9-Le-UHj" secondAttribute="leading" id="2fA-M4-kc8"/>
+                                    <constraint firstItem="CL9-IR-CZi" firstAttribute="centerY" secondItem="hnW-Hu-edB" secondAttribute="centerY" id="2yX-ea-QH5"/>
+                                    <constraint firstItem="X5b-6y-e7L" firstAttribute="leading" secondItem="wV9-Le-UHj" secondAttribute="leading" id="50f-NB-AvG"/>
+                                    <constraint firstItem="Yky-Tx-mDq" firstAttribute="centerY" secondItem="hnW-Hu-edB" secondAttribute="centerY" id="8Ic-F7-drE"/>
+                                    <constraint firstItem="hnW-Hu-edB" firstAttribute="top" secondItem="wV9-Le-UHj" secondAttribute="top" constant="18" id="DQV-zp-F6b"/>
+                                    <constraint firstAttribute="trailing" secondItem="zlV-ti-gJ9" secondAttribute="trailing" id="Hu6-GW-11W"/>
+                                    <constraint firstAttribute="trailing" secondItem="H37-ay-J2q" secondAttribute="trailing" id="JDd-AN-fnx"/>
+                                    <constraint firstItem="zlV-ti-gJ9" firstAttribute="top" secondItem="wV9-Le-UHj" secondAttribute="top" id="Ny9-Za-Rr2"/>
+                                    <constraint firstItem="CL9-IR-CZi" firstAttribute="leading" secondItem="Yky-Tx-mDq" secondAttribute="trailing" constant="8" id="PlU-bT-IhF"/>
+                                    <constraint firstItem="CL9-IR-CZi" firstAttribute="width" secondItem="hnW-Hu-edB" secondAttribute="width" id="SpV-oL-pVN"/>
+                                    <constraint firstItem="X5b-6y-e7L" firstAttribute="top" secondItem="hnW-Hu-edB" secondAttribute="bottom" constant="16" id="TYf-lG-d9v"/>
+                                    <constraint firstItem="H37-ay-J2q" firstAttribute="top" secondItem="X5b-6y-e7L" secondAttribute="bottom" constant="4" id="XBM-iK-M6u"/>
+                                    <constraint firstAttribute="trailing" secondItem="X5b-6y-e7L" secondAttribute="trailing" id="d3G-mZ-Nta"/>
+                                    <constraint firstAttribute="bottom" secondItem="H37-ay-J2q" secondAttribute="bottom" id="eOp-cc-ojX"/>
+                                    <constraint firstItem="Yky-Tx-mDq" firstAttribute="leading" secondItem="hnW-Hu-edB" secondAttribute="trailing" constant="8" id="gHk-NT-lZe"/>
+                                    <constraint firstItem="hnW-Hu-edB" firstAttribute="leading" secondItem="wV9-Le-UHj" secondAttribute="leading" id="ilh-G3-cLJ"/>
+                                    <constraint firstItem="H37-ay-J2q" firstAttribute="leading" secondItem="wV9-Le-UHj" secondAttribute="leading" id="t7x-ir-eXe"/>
+                                    <constraint firstAttribute="trailing" secondItem="CL9-IR-CZi" secondAttribute="trailing" id="vnJ-hR-FeI"/>
+                                </constraints>
+                            </customView>
+                        </subviews>
+                        <constraints>
+                            <constraint firstAttribute="trailing" secondItem="wV9-Le-UHj" secondAttribute="trailing" id="0cX-zw-TKM"/>
+                            <constraint firstItem="g0s-3J-B7Z" firstAttribute="leading" secondItem="WyA-fZ-iqG" secondAttribute="leading" id="8H4-fc-mtZ"/>
+                            <constraint firstAttribute="bottom" secondItem="g0s-3J-B7Z" secondAttribute="bottom" constant="22" id="Ig3-DN-Ep7"/>
+                            <constraint firstItem="wV9-Le-UHj" firstAttribute="leading" secondItem="g0s-3J-B7Z" secondAttribute="trailing" constant="16" id="KjI-O9-OPb"/>
+                            <constraint firstItem="g0s-3J-B7Z" firstAttribute="top" secondItem="WyA-fZ-iqG" secondAttribute="top" id="Pdd-o5-XW8"/>
+                            <constraint firstItem="wV9-Le-UHj" firstAttribute="top" secondItem="WyA-fZ-iqG" secondAttribute="top" id="RMt-fw-g1r"/>
+                            <constraint firstAttribute="height" constant="162" id="iZn-au-HKl"/>
+                            <constraint firstAttribute="bottom" secondItem="wV9-Le-UHj" secondAttribute="bottom" id="ivo-1O-tkd"/>
+                            <constraint firstItem="wV9-Le-UHj" firstAttribute="top" secondItem="WyA-fZ-iqG" secondAttribute="top" id="zU1-6n-P9k"/>
+                        </constraints>
+                    </customView>
+                </subviews>
+                <constraints>
+                    <constraint firstItem="iMz-Q5-D6R" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" id="4cn-Vo-OaD"/>
+                    <constraint firstAttribute="bottom" secondItem="zwE-aA-0ce" secondAttribute="bottom" constant="16" id="87a-u4-6V6"/>
+                    <constraint firstItem="iMz-Q5-D6R" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="16" id="Dx4-bM-pdY"/>
+                    <constraint firstAttribute="trailing" secondItem="zwE-aA-0ce" secondAttribute="trailing" constant="16" id="Jys-Ms-lYK"/>
+                    <constraint firstAttribute="trailing" secondItem="iMz-Q5-D6R" secondAttribute="trailing" constant="16" id="KXX-79-x1l"/>
+                    <constraint firstAttribute="bottom" secondItem="WyA-fZ-iqG" secondAttribute="bottom" constant="64" id="eyK-IB-h4P"/>
+                    <constraint firstAttribute="trailing" secondItem="WyA-fZ-iqG" secondAttribute="trailing" constant="16" id="qsi-RF-zH4"/>
+                    <constraint firstItem="WyA-fZ-iqG" firstAttribute="top" secondItem="iMz-Q5-D6R" secondAttribute="bottom" id="saH-eN-guG"/>
+                    <constraint firstItem="WyA-fZ-iqG" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="16" id="x06-Z1-5KW"/>
+                </constraints>
+            </view>
+            <connections>
+                <outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
+            </connections>
+            <point key="canvasLocation" x="75" y="253"/>
+        </window>
+    </objects>
+    <resources>
+        <image name="icon_btn_arrow_gray_down_s_norm_false" width="12" height="12"/>
+        <image name="image_btn_tips" width="16" height="16"/>
+    </resources>
+</document>

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

@@ -0,0 +1,495 @@
+//
+//  KMAITranslationWindowController.swift
+//  PDF Master
+//
+//  Created by wanjun on 2023/5/24.
+//
+
+import Cocoa
+
+@objc enum KMAITranslationState: Int {
+    case None = 0
+    case CanTranslate
+    case CanAIRewriting
+    case CanAIErrorCorrection
+    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
+    var progressController: SKProgressController?
+
+    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
+            
+            if self.content.count > 150 {
+                self.state = .Exceed
+            } else {
+                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
+        }
+    }
+    
+    func showProgressWindow() {
+        let progress = SKProgressController()
+        progress.message = NSLocalizedString("Translating...", comment: "")
+        progress.window?.backgroundColor = NSColor(hex: "#36383B")
+        progress.window?.contentView?.wantsLayer = true
+        progress.window?.contentView?.layer?.backgroundColor = NSColor(hex: "#36383B").cgColor
+        progress.progressField.textColor = NSColor.white
+        
+        progress.closeBlock = { [unowned self] in
+            
+        }
+        
+        self.progressController = progress
+        self.window?.beginSheet(progress.window!)
+    }
+    
+    func hiddenProgressWindow() {
+        if (self.progressController != nil) {
+            self.window?.endSheet((self.progressController?.window)!)
+            self.progressController = nil
+        }
+    }
+    
+    // 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(languages)
+        let createFilePopover: NSPopover = NSPopover.init()
+        self.popover = createFilePopover
+        createFilePopover.contentViewController = vc
+        createFilePopover.animates = true
+        createFilePopover.behavior = .semitransient
+        createFilePopover.setValue(true, forKey: "shouldHideAnchor")
+        if isFromLanguage {
+            vc.selectString = self.fromLabel.stringValue
+        } else {
+            vc.selectString = self.toLabel.stringValue
+        }
+        
+        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 {
+            if !KMLightMemberManager.manager.isLogin() {
+                KMLoginWindowController.show(window: NSApp.mainWindow!)
+                return
+            }
+            
+            DispatchQueue.main.async {
+                self.showProgressWindow()
+            }
+
+            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
+                DispatchQueue.main.async {
+                    self.hiddenProgressWindow()
+                }
+
+                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
+                        self.toContentTextView.string = ""
+                    }
+                }
+            }
+        }
+    }
+    
+    @IBAction func copyAction(_ sender: NSButton) {
+        if self.state == .CanCopy || self.state == .Copyed {
+            if !KMLightMemberManager.manager.isLogin() {
+                KMLoginWindowController.show(window: NSApp.mainWindow!)
+                return
+            }
+
+            let pasteboard = NSPasteboard.general
+            pasteboard.clearContents()
+            pasteboard.setString(self.toContentTextView.string, forType: .string)
+            
+            self.state = .Copyed
+        }
+    }
+    
+    @IBAction func closeButtonAction(_ sender: NSButton) {
+        if self.popover != nil {
+            self.popover?.close()
+            self.popover = nil
+        }
+        if self.popoverTips != nil {
+            self.popoverTips?.close()
+            self.popoverTips = nil
+        }
+
+        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.popoverTips = 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
+        }
+        
+        self.toContentTextView.string = ""
+    }
+
+}

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

@@ -0,0 +1,515 @@
+<?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="8" y="8" width="252" height="162"/>
+                                    <clipView key="contentView" drawsBackground="NO" id="GOT-gb-1Hz">
+                                        <rect key="frame" x="0.0" y="0.0" width="252" height="162"/>
+                                        <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="252" height="162"/>
+                                                <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="252" height="162"/>
+                                                <size key="maxSize" width="880" height="10000000"/>
+                                                <color key="insertionPointColor" name="textColor" catalog="System" colorSpace="catalog"/>
+                                            </textView>
+                                        </subviews>
+                                    </clipView>
+                                    <scroller key="horizontalScroller" hidden="YES" wantsLayer="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="8" y="8" width="252" height="162"/>
+                                    <subviews>
+                                        <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Duk-Mu-G6Z">
+                                            <rect key="frame" x="0.0" y="146" 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="146" width="236" height="16"/>
+                                            <textFieldCell key="cell" 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="Duk-Mu-G6Z" firstAttribute="top" secondItem="NLV-Yd-ID5" secondAttribute="top" id="kqv-FZ-cw1"/>
+                                        <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 firstItem="sSR-RP-4JK" firstAttribute="top" secondItem="NLV-Yd-ID5" secondAttribute="top" id="vks-yV-ZZf"/>
+                                        <constraint firstAttribute="trailing" secondItem="sSR-RP-4JK" secondAttribute="trailing" id="z3G-IE-Nna"/>
+                                    </constraints>
+                                </customView>
+                            </subviews>
+                            <constraints>
+                                <constraint firstAttribute="bottom" secondItem="NLV-Yd-ID5" secondAttribute="bottom" constant="8" id="1Cp-Jd-dXo"/>
+                                <constraint firstItem="xhJ-fV-5qt" firstAttribute="top" secondItem="Lad-sC-eue" secondAttribute="top" constant="8" id="4kp-KS-iLk"/>
+                                <constraint firstItem="NLV-Yd-ID5" firstAttribute="top" secondItem="Lad-sC-eue" secondAttribute="top" constant="8" id="MPY-sO-RjL"/>
+                                <constraint firstItem="xhJ-fV-5qt" firstAttribute="leading" secondItem="Lad-sC-eue" secondAttribute="leading" constant="8" id="Xz8-Jw-09U"/>
+                                <constraint firstAttribute="bottom" secondItem="xhJ-fV-5qt" secondAttribute="bottom" constant="8" id="bFT-dl-9iw"/>
+                                <constraint firstAttribute="trailing" secondItem="xhJ-fV-5qt" secondAttribute="trailing" constant="8" id="enW-L7-72w"/>
+                                <constraint firstAttribute="trailing" secondItem="NLV-Yd-ID5" secondAttribute="trailing" constant="8" id="g0X-A7-93f"/>
+                                <constraint firstItem="NLV-Yd-ID5" firstAttribute="leading" secondItem="Lad-sC-eue" secondAttribute="leading" constant="8" 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"/>

+ 13 - 0
PDF Office/PDF Master/Class/KMLightMember/Controller/ComparativeTable/Source/KMComparative.plist

@@ -12,6 +12,19 @@
 	<string>Registered</string>
 	<key>content</key>
 	<array>
+		<dict>
+			<key>title</key>
+			<string>AI Robot</string>
+			<key>content</key>
+			<array>
+				<dict>
+					<key>title</key>
+					<string>AI translating, rewriting, and correcting</string>
+					<key>state</key>
+					<integer>4</integer>
+				</dict>
+			</array>
+		</dict>
 		<dict>
 			<key>title</key>
 			<string>Create PDF</string>

+ 2 - 2
PDF Office/PDF Master/Class/KMLightMember/Controller/Login&Register/View/KMLoginLeftImageView.xib

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<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="21701"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21507"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>

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

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

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

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

+ 1 - 10
PDF Office/PDF Master/Class/KMLightMember/Source/KMLightMember.xcassets/image_login.imageset/Contents.json

@@ -2,16 +2,7 @@
   "images" : [
     {
       "filename" : "Group 507.pdf",
-      "idiom" : "universal",
-      "scale" : "1x"
-    },
-    {
-      "idiom" : "universal",
-      "scale" : "2x"
-    },
-    {
-      "idiom" : "universal",
-      "scale" : "3x"
+      "idiom" : "universal"
     }
   ],
   "info" : {

BIN
PDF Office/PDF Master/Class/KMLightMember/Source/KMLightMember.xcassets/image_login.imageset/Group 507.pdf


+ 6 - 6
PDF Office/PDF Master/Class/PDFTools/Convert/Controller/KMConvertBaseWindowController.xib

@@ -30,7 +30,7 @@
             <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="196" y="240" width="586" height="483"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="3008" height="1667"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="1800" height="1125"/>
             <value key="minSize" type="size" width="586" height="483"/>
             <value key="maxSize" type="size" width="586" height="483"/>
             <view key="contentView" id="se5-gp-TjO">
@@ -166,21 +166,21 @@
                                 <scrollView borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jkb-2v-6fa">
                                     <rect key="frame" x="0.0" y="0.0" width="358" height="391"/>
                                     <clipView key="contentView" id="tI2-Vq-Nms">
-                                        <rect key="frame" x="0.0" y="0.0" width="343" height="376"/>
+                                        <rect key="frame" x="0.0" y="0.0" width="358" height="391"/>
                                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                         <subviews>
                                             <view id="dBH-xr-mGL">
-                                                <rect key="frame" x="0.0" y="0.0" width="328" height="361"/>
+                                                <rect key="frame" x="0.0" y="0.0" width="343" height="376"/>
                                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                             </view>
                                         </subviews>
                                     </clipView>
                                     <scroller key="horizontalScroller" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="MLK-hj-eAf">
-                                        <rect key="frame" x="0.0" y="376" width="343" height="15"/>
+                                        <rect key="frame" x="0.0" y="375" width="358" height="16"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                     </scroller>
                                     <scroller key="verticalScroller" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="L4p-RZ-VGS">
-                                        <rect key="frame" x="343" y="0.0" width="15" height="376"/>
+                                        <rect key="frame" x="342" y="0.0" width="16" height="391"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                     </scroller>
                                 </scrollView>
@@ -581,7 +581,7 @@
                                 </buttonCell>
                             </button>
                             <comboBox hidden="YES" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="uah-L1-IyT">
-                                <rect key="frame" x="32" y="-23" width="214" height="25"/>
+                                <rect key="frame" x="31" y="-22" width="215" height="23"/>
                                 <comboBoxCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" completes="NO" numberOfVisibleItems="5" id="X1R-ss-GZO">
                                     <font key="font" metaFont="system"/>
                                     <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>

+ 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"/>

+ 5 - 0
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarController.swift

@@ -33,6 +33,7 @@ extension CAnnotationType {
     @objc optional func changePDFViewGotoNextPageAction()
     @objc optional func changePDFViewGoToPreviousPageAction()
     @objc optional func showPDFViewPrintViewController()
+    @objc optional func aiTranslationPDFFileAction()
     @objc optional func toolbarViewController(_ viewController:KMToolbarViewController, zoomModel selectedTag:Int)
     @objc optional func toolbarViewController(_ viewController:KMToolbarViewController, zoomSting : String)
     @objc optional func mainToolDidClicked(_ toolController: KMToolbarController, _ type: KMToolbarViewType, _ item: KMToolBoxItem, _ pages: [Int])
@@ -690,6 +691,10 @@ extension KMToolbarController: KMToolbarViewControllerDelegate {
         self.delegate?.showPDFViewPrintViewController?()
     }
     
+    func aiTranslationPDFFileAction() {
+        self.delegate?.aiTranslationPDFFileAction?()
+    }
+    
     func toolbarViewController(_ viewController: KMToolbarViewController, shareDocument item: NSMenuItem) {
         self.delegate?.toolbarViewController?(viewController, shareDocument: item)
     }

+ 19 - 1
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/KMToolbarViewController.swift

@@ -95,6 +95,7 @@ import Cocoa
     @objc optional func changePDFViewGotoNextPageAction()
     @objc optional func changePDFViewGoToPreviousPageAction()
     @objc optional func showPDFViewPrintViewController()
+    @objc optional func aiTranslationPDFFileAction()
     @objc optional func toolbarViewController(_ viewController:KMToolbarViewController, zoomSting : String)
     @objc optional func toolbarViewController(_ viewController:KMToolbarViewController, zoomModel selectedTag:Int)
     @objc optional func toolbarViewController(_ viewController:KMToolbarViewController, shareDocument item:NSMenuItem)
@@ -291,6 +292,10 @@ class KMToolbarViewController: NSViewController, NSTextFieldDelegate {
         self.delegate?.showPDFViewPrintViewController?()
     }
     
+    @IBAction func aiTranslationButtonAction(sender:KMToolbarClickButton) {
+        self.delegate?.aiTranslationPDFFileAction?()
+    }
+    
     @IBAction func shareButtonAction(sender:KMToolbarClickButton) {
         self.shareButton = sender
         let menu = NSMenu()
@@ -380,7 +385,8 @@ extension KMToolbarViewController : KMNewToolbarDelegate,NSToolbarItemValidation
     
     func toolbarRightDefaultItemIdentifiers(_ toolbar: KMToolbar!) -> [String]! {
         if toolbarType == .Main {
-            return [KMDocumentPrintToolbarItemIdentifier,
+            return [KMDocumentAITranslationToolbarItemIdentifier,
+                    KMDocumentPrintToolbarItemIdentifier,
                     KMDocumentShareToolbarItemIdentifier,
                     KMRightControlToolbarItemIdentifier]
         }
@@ -661,6 +667,18 @@ extension KMToolbarViewController : KMNewToolbarDelegate,NSToolbarItemValidation
                 menuItem?.target = self
                 menuItem?.tag = item!.btnTag
                 item?.menuFormRepresentation = menuItem
+            } else if identifier == KMDocumentAITranslationToolbarItemIdentifier {
+                item?.image = NSImage(named: "ic_function_other_AITranslation")
+                item?.titleName = "AI Translation"
+                item?.alternateImage = NSImage(named: "ic_function_other_AITranslation")
+                item?.target = self
+                item?.toolTip = NSLocalizedString("AI Translation", comment: "")
+                item?.boxImagePosition = KMToolBoxImagePosition.only
+                item?.btnAction = #selector(aiTranslationButtonAction)
+                
+                let menuItem = NSMenuItem.init(title: item?.titleName, action: #selector(aiTranslationButtonAction), target: self)
+                menuItem?.target = self
+                item?.menuFormRepresentation = menuItem
             } else if identifier == KMDocumentPrintToolbarItemIdentifier {
                 item?.image = NSImage(named: "KMImageNameMainToolbarPrint")
                 item?.titleName = "Print"

+ 1 - 0
PDF Office/PDF Master/Class/PDFWindowController/Toolbar/PublicKey.swift

@@ -23,6 +23,7 @@ let KMDocumentEditToolbarItemIdentifier = "KMDocumentPageEditToolbarItemIdentifi
 let KMDocumentFillSginToolbarItemIdentifier = "KMDocumentFillSginToolbarItemIdentifier"
 let KMDocumentToolToolbarItemIdentifier = "KMDocumentToolToolbarItemIdentifier"
 let KMDocumentPrintToolbarItemIdentifier = "KMDocumentPrintToolbarItemIdentifier"
+let KMDocumentAITranslationToolbarItemIdentifier = "KMDocumentAITranslationToolbarItemIdentifier"
 let KMDocumentShareToolbarItemIdentifier = "KMDocumentShareToolbarItemIdentifier"
 let KMRightControlToolbarItemIdentifier  = "KMRightControlToolbarItemIdentifier"
 let mainToolIdentifiers = [KMLeftControlToolbarItemIdentifier, KMDocumentZoomToolbarItemIdentifier, KMDocumentZoomOutToolbarItemIdentifier,

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

@@ -274,6 +274,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 {
@@ -326,6 +327,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 {
@@ -577,6 +585,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) {
@@ -2016,6 +2036,34 @@ extension KMMainViewController : KMMainToolbarControllerDelegate {
         self.showPrintWindow()
     }
     
+    func aiTranslationPDFFileAction() {
+        if !KMLightMemberManager.manager.isLogin() {
+            KMLoginWindowController.show(window: NSApp.mainWindow!)
+            return
+        }
+
+        let isExceedsLimit = self.isPDFPageCountExceedsLimit(filePath: (self.document?.documentURL.path)!)
+        if self.isFileGreaterThan10MB(atPath: (self.document?.documentURL.path)!) {
+            let alert = NSAlert()
+            alert.alertStyle = .critical
+            alert.messageText = NSLocalizedString("The uploaded file size cannot exceed 10MB", comment: "")
+            alert.runModal()
+
+            return
+        } else if isExceedsLimit  {
+            let alert = NSAlert()
+            alert.alertStyle = .critical
+            alert.messageText = NSLocalizedString("Documents cannot exceed 30 pages", comment: "")
+            alert.runModal()
+
+            return
+        }
+        
+        self.aiTranslationConfirWC = KMAITranslationConfirmWindowController.init(windowNibName: NSNib.Name("KMAITranslationConfirmWindowController"))
+        self.aiTranslationConfirWC!.filePath = (self.document?.documentURL.path)!
+        self.view.window?.beginSheet(self.aiTranslationConfirWC!.window!)
+    }
+    
     func toolbarViewController(_ viewController: KMToolbarViewController, shareDocument item: NSMenuItem) {
         self.shareDocument(sender: viewController)
     }

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

@@ -139,6 +139,8 @@ import Cocoa
     
     var eventMonitor: Any?
     var mouseRightMenuEvent: NSEvent?
+    var aiTranslationWindow: KMAITranslationWindowController?
+    var aiTranslationConfirWC: KMAITranslationConfirmWindowController?
     
     private var background_mask: NSView?
     fileprivate var _secureOptions: [CPDFDocumentWriteOption : Any]?
@@ -615,6 +617,32 @@ import Cocoa
         }
     }
     
+    func isFileGreaterThan10MB(atPath filePath: String) -> Bool {
+        let fileManager = FileManager.default
+
+        do {
+            let fileAttributes = try fileManager.attributesOfItem(atPath: filePath)
+            if let fileSize = fileAttributes[.size] as? UInt64 {
+                let megabyteSize = fileSize / (1024 * 1024)
+                return megabyteSize > 10
+            }
+        } catch {
+            print("Error: \(error)")
+        }
+
+        return false
+    }
+    
+    func isPDFPageCountExceedsLimit(filePath: String) -> Bool {
+        let url = URL(fileURLWithPath: filePath)
+        guard let document = PDFDocument(url: url) else {
+            return false
+        }
+        
+        let pageCount = document.pageCount
+        return pageCount > 30
+    }
+    
     // MARK: Redact 【标记密文】
     func exeRedactConfirm(_ type: KMRedactConfirmType, callback: @escaping () -> ()?) {
         let windowController = KMRedactConfirmWindowController(type)

+ 14 - 14
PDF Office/PDF Master/Class/Welcome/OC/WelcomeWindowController.m

@@ -115,7 +115,7 @@ static NSString * const kKMWelcomeRemindMeLaterKey = @"WelcomeRemindMeLaterKey";
     
     NSClipView *clipView = self.scrollView.contentView;
     // ,self.content4View
-    self.contentViews = @[self.content1View,self.content2View,self.content3View,self.content5View];
+    self.contentViews = @[self.content1View,self.content2View,self.content5View];
     for (int i=0; i<self.contentViews.count; i++) {
         NSView *view = self.contentViews[i];
         view.frame = CGRectMake(i*clipView.bounds.size.width, 0,
@@ -141,19 +141,19 @@ static NSString * const kKMWelcomeRemindMeLaterKey = @"WelcomeRemindMeLaterKey";
 
 - (void)localizedString {
     self.title1Label.stringValue = NSLocalizedString(@"The Brand New PDF Master", nil);
-    self.subtitle1Label.stringValue = NSLocalizedString(@"PDF Master Beta Invites You to Enjoy All Advanced Features!\n\n View, Annotate, Convert PDFs with PDF Master to boost your productivity.", nil);
+    self.subtitle1Label.stringValue = NSLocalizedString(@"PDF Master Invites You to Enjoy All Advanced Features!\n\nUse the new powerful software integrated with AI technology to edit your PDFs", nil);
     
-    self.title2Label.stringValue = NSLocalizedString(@"Comment PDFs with Rich Annotation Tools", nil);
-    self.subtitle2Label.stringValue = NSLocalizedString(@"Add highlights, freehand, text, stamps, links, shapes, and notes to your documents. Easily mark up your PDFs anytime!", nil);
+    self.title2Label.stringValue = NSLocalizedString(@"Process PDF Document wit AI Robot", nil);
+    self.subtitle2Label.stringValue = NSLocalizedString(@"Smart PDF AI robot, powered by Chatgpt helps you translate, rewrite, and correct PDFs with ease, bringing you an enhanced PDF experience.", nil);
     
-    self.title3Label.stringValue = NSLocalizedString(@"Convert PDF to Office Fast and Easily", nil);
-    self.subtitle3Label.stringValue = NSLocalizedString(@"Convert PDF to editable Word, Excel, PPT, Text and image with all your fonts and formatting preserved.", nil);
-    
-    self.title4Label.stringValue = NSLocalizedString(@"Fill out Form & Sign Documents", nil);
-    self.subtitle4Label.stringValue = NSLocalizedString(@"Fill out forms effortlessly and add text, image or handwritten signatures to PDFs.", nil);
+//    self.title3Label.stringValue = NSLocalizedString(@"Convert PDF to Office Fast and Easily", nil);
+//    self.subtitle3Label.stringValue = NSLocalizedString(@"Convert PDF to editable Word, Excel, PPT, Text and image with all your fonts and formatting preserved.", nil);
+//
+//    self.title4Label.stringValue = NSLocalizedString(@"Fill out Form & Sign Documents", nil);
+//    self.subtitle4Label.stringValue = NSLocalizedString(@"Fill out forms effortlessly and add text, image or handwritten signatures to PDFs.", nil);
     
     self.title5Label.stringValue = NSLocalizedString(@"Sign up to Unlock Premium Features", nil);
-    self.subtitle5Label.stringValue = NSLocalizedString(@"All advanced features in PDF Master can be used after registration, including converting PDFs without limitation.", nil);
+    self.subtitle5Label.stringValue = NSLocalizedString(@"All advanced features in PDF Master can be used after registration.", nil);
 }
 
 - (void)initSubViews {
@@ -226,9 +226,8 @@ static NSString * const kKMWelcomeRemindMeLaterKey = @"WelcomeRemindMeLaterKey";
     [self.signUpButtonVC buttonWithType:TokenButtonTypeCta size:TokenButtonSizeL height:[[NSLayoutConstraint alloc] init]];
     
     // , self.pageIndicator5
-    for (TCPageIndicator *pageindicator in @[self.pageIndicator1, self.pageIndicator2, self.pageIndicator3,
-                                             self.pageIndicator4]) {
-        pageindicator.numberOfPages = 4;
+    for (TCPageIndicator *pageindicator in @[self.pageIndicator1, self.pageIndicator2, self.pageIndicator5]) {
+        pageindicator.numberOfPages = 3;
         pageindicator.selectedColor = [NSColor colorWithRed:39/255.f green:60/255.f blue:98/255.f alpha:1.f];
         pageindicator.normalColor = [NSColor colorWithRed:0/255.f green:0/255.f blue:0/255.f alpha:0.2];
         pageindicator.pageIndicatorSize = NSMakeSize(6, 6);
@@ -243,7 +242,7 @@ static NSString * const kKMWelcomeRemindMeLaterKey = @"WelcomeRemindMeLaterKey";
         } else if ([pageindicator isEqual:self.pageIndicator4]) {
             pageindicator.currentPage = 3;
         } else if ([pageindicator isEqual:self.pageIndicator5]) {
-            pageindicator.currentPage = 4;
+            pageindicator.currentPage = 2;
         }
     }
     
@@ -304,6 +303,7 @@ static NSString * const kKMWelcomeRemindMeLaterKey = @"WelcomeRemindMeLaterKey";
         self.preBox.hidden = YES;
     } else if (self.currentIndex == 1) {
     } else if (self.currentIndex == 2) {
+        self.nextBox.hidden = YES;
     } else if (self.currentIndex == 3) {
     } else if (self.currentIndex == 4){
         self.nextBox.hidden = YES;

+ 11 - 11
PDF Office/PDF Master/Class/Welcome/OC/WelcomeWindowController.xib

@@ -47,7 +47,7 @@
             <windowStyleMask key="styleMask" titled="YES" closable="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
             <rect key="contentRect" x="324" y="235" width="586" height="568"/>
-            <rect key="screenRect" x="0.0" y="0.0" width="1440" height="875"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
             <value key="minSize" type="size" width="586" height="568"/>
             <value key="maxSize" type="size" width="586" height="568"/>
             <value key="minFullScreenContentSize" type="size" width="586" height="568"/>
@@ -154,7 +154,7 @@
                     <constraints>
                         <constraint firstAttribute="height" constant="336" id="TXS-Ll-Bjw"/>
                     </constraints>
-                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="KMImageNameWelcomeHomeNew" id="ExO-hX-lBc"/>
+                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="KMImageNameWelcome1" id="ExO-hX-lBc"/>
                 </imageView>
                 <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="rdz-C9-3re">
                     <rect key="frame" x="46" y="102" width="504" height="48"/>
@@ -226,15 +226,15 @@
             <point key="canvasLocation" x="107" y="816"/>
         </customView>
         <customView id="Dv3-VN-g21">
-            <rect key="frame" x="0.0" y="0.0" width="586" height="568"/>
+            <rect key="frame" x="0.0" y="0.0" width="634" height="568"/>
             <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
             <subviews>
                 <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="OFb-Zw-pAG">
-                    <rect key="frame" x="0.0" y="232" width="586" height="336"/>
+                    <rect key="frame" x="0.0" y="232" width="634" height="336"/>
                     <constraints>
                         <constraint firstAttribute="height" constant="336" id="jHi-Db-OHt"/>
                     </constraints>
-                    <imageCell key="cell" continuous="YES" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="KMImageNameWelcomeAnnotation" id="Nkq-cD-yLR"/>
+                    <imageCell key="cell" continuous="YES" refusesFirstResponder="YES" alignment="left" imageScaling="axesIndependently" image="KMImageNameWelcome2" id="Nkq-cD-yLR"/>
                 </imageView>
                 <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="adN-ge-Ndm">
                     <rect key="frame" x="46" y="168" width="514" height="24"/>
@@ -256,7 +256,7 @@
                     </textFieldCell>
                 </textField>
                 <box boxType="custom" cornerRadius="4" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="cA3-wY-yeQ">
-                    <rect key="frame" x="203" y="40" width="180" height="40"/>
+                    <rect key="frame" x="227" y="40" width="180" height="40"/>
                     <view key="contentView" id="VYw-fn-IuO">
                         <rect key="frame" x="1" y="1" width="178" height="38"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@@ -267,7 +267,7 @@
                     </constraints>
                 </box>
                 <customView translatesAutoresizingMaskIntoConstraints="NO" id="zx6-lG-Q7W" customClass="TCPageIndicator">
-                    <rect key="frame" x="193" y="232" width="200" height="22"/>
+                    <rect key="frame" x="217" y="232" width="200" height="22"/>
                     <constraints>
                         <constraint firstAttribute="height" constant="22" id="9xh-eX-hma"/>
                         <constraint firstAttribute="width" constant="200" id="MRd-JM-Zkv"/>
@@ -434,7 +434,7 @@
                     <constraints>
                         <constraint firstAttribute="height" constant="336" id="LaS-h2-Bx3"/>
                     </constraints>
-                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="KMImageNameWelcomeSignUp" id="OVC-QQ-s63"/>
+                    <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="KMImageNameWelcome3" id="OVC-QQ-s63"/>
                 </imageView>
                 <imageView hidden="YES" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Va9-pb-DwV">
                     <rect key="frame" x="21" y="156" width="152" height="152"/>
@@ -504,12 +504,12 @@
         </customView>
     </objects>
     <resources>
-        <image name="KMImageNameWelcomeAnnotation" width="586" height="336"/>
+        <image name="KMImageNameWelcome1" width="586" height="336"/>
+        <image name="KMImageNameWelcome2" width="586" height="336"/>
+        <image name="KMImageNameWelcome3" width="586" height="336"/>
         <image name="KMImageNameWelcomeConvert" width="586" height="336"/>
         <image name="KMImageNameWelcomeFillSign" width="586" height="336"/>
         <image name="KMImageNameWelcomeFreeDays" width="153" height="152"/>
-        <image name="KMImageNameWelcomeHomeNew" width="586" height="336"/>
-        <image name="KMImageNameWelcomeSignUp" width="586" height="336"/>
         <image name="control_btn_icon_close" width="12" height="12"/>
     </resources>
 </document>

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

@@ -81,3 +81,4 @@
 #import "KMRecommondManager.h"
 #import "KMCoverButton.h"
 #import "CPDFListView+Extension.h"
+#import "KMSignatureHelpViewController.h"

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

@@ -58,3 +58,4 @@
 #import "KMRecommondManager.h"
 #import "KMCoverButton.h"
 #import "CPDFListView+Extension.h"
+#import "KMSignatureHelpViewController.h"

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

@@ -82,3 +82,4 @@
 #import "KMRecommondManager.h"
 #import "KMCoverButton.h"
 #import "CPDFListView+Extension.h"
+#import "KMSignatureHelpViewController.h"

+ 0 - 2
PDF Office/PDF Master/PDF_Master.entitlements

@@ -8,8 +8,6 @@
 	<true/>
 	<key>com.apple.security.network.client</key>
 	<true/>
-	<key>com.apple.security.network.server</key>
-	<true/>
 	<key>com.apple.security.print</key>
 	<true/>
 </dict>

+ 36 - 1
PDF Office/PDF Master/Strings/en.lproj/Localizable.strings

@@ -599,12 +599,16 @@
 "Failed to Create PDF" = "Failed to Create PDF";
 "Please install Microsoft Office to create PDFs from Office files" = "Please install Microsoft Office to create PDFs from Office files";
 
-"PDF Master Beta Invites You to Enjoy All Advanced Features!\n\n View, Annotate, Convert PDFs with PDF Master to boost your productivity." = "PDF Master Beta Invites You to Enjoy All Advanced Features!\n\n View, Annotate, Convert PDFs with PDF Master to boost your productivity.";
+"PDF Master Invites You to Enjoy All Advanced Features!\n\n View, Annotate, Convert PDFs with PDF Master to boost your productivity." = "PDF Master Invites You to Enjoy All Advanced Features!\n\n View, Annotate, Convert PDFs with PDF Master to boost your productivity.";
 
 // MARK: - 比较表
 
 "Edit PDF text and images" = "Edit PDF text and images";
 "Extract texts from image-based or scanned PDF with OCR" = "Extract texts from image-based or scanned PDF with OCR";
+"PDF Master Invites You to Enjoy All Advanced Features!\n\nUse the new powerful software integrated with AI technology to edit your PDFs" = "PDF Master Invites You to Enjoy All Advanced Features!\n\nUse the new powerful software integrated with AI technology to edit your PDFs";
+"Process PDF Document wit AI Robot" = "Process PDF Document wit AI Robot";
+"Smart PDF AI robot, powered by Chatgpt helps you translate, rewrite, and correct PDFs with ease, bringing you an enhanced PDF experience." = "Smart PDF AI robot, powered by Chatgpt helps you translate, rewrite, and correct PDFs with ease, bringing you an enhanced PDF experience.";
+"All advanced features in PDF Master can be used after registration." = "All advanced features in PDF Master can be used after registration.";
 
 //MARK: - Pro Mac 多语
 
@@ -3819,3 +3823,34 @@
 "Incorrect Password" = "Incorrect Password";
 "This is a secured document. Editing is not permitted." = "This is a secured document. Editing is not permitted.";
 
+"AI Translation" = "AI Translation";
+"AI Rewriting" = "AI Rewriting";
+"AI Error Correction" = "AI Error Correction";
+"Open PDF Files" = "Open PDF Files";
+"Select Your Files" = "Select Your Files";
+"or drop files here to open" = "or drop files here to open";
+"New From Files" = "New From Files";
+"Support PDF and Word file" = "Support PDF and Word file";
+"Translation Language:" = "Translation Language:";
+"or drop file here" = "or drop file here";
+"Download failed" = "Download failed";
+"Invalid temporary directory" = "Invalid temporary directory";
+"Failed to save file" = "Failed to save file";
+"Invalid file link" = "Invalid file link";
+"Copied" = "Copied";
+"Correct" = "Correct";
+"Limited to 150 characters per session, 5 times per month" = "Limited to 150 characters per session, 5 times per month";
+"Rewrite" = "Rewrite";
+"Result" = "Result";
+"Please enter text content here..." = "Please enter text content here...";
+"Limit to 150 characters at a time" = "Limit to 150 characters at a time";
+"Rewriting..." = "Rewriting...";
+"Error Correcting..." = "Error Correcting...";
+"Translating..." = "Translating...";
+"Uploading..." = "Uploading...";
+"The translated file will be opened as a new file." = "The translated file will be opened as a new file.";
+"Translate" = "Translate";
+"The uploaded file size cannot exceed 10MB" = "The uploaded file size cannot exceed 10MB";
+"Scanned PDF files are not supported" = "Scanned PDF files are not supported";
+"Limit document size to 10M, document page number to 30, 10w characters per month." = "Limit document size to 10M, document page number to 30, 10w characters per month.";
+"Documents cannot exceed 30 pages" = "Documents cannot exceed 30 pages";